html_url stringlengths 48 51 | title stringlengths 5 280 | comments stringlengths 63 51.8k | body stringlengths 0 36.2k ⌀ | comment_length int64 16 1.52k | text stringlengths 159 54.1k | embeddings listlengths 768 768 |
|---|---|---|---|---|---|---|
https://github.com/huggingface/datasets/issues/686 | Dataset browser url is still https://huggingface.co/nlp/viewer/ | Yes! might do it with @srush one of these days. Hopefully it won't break too many links (we can always redirect from old url to new) | Might be worth updating to https://huggingface.co/datasets/viewer/ | 26 | Dataset browser url is still https://huggingface.co/nlp/viewer/
Might be worth updating to https://huggingface.co/datasets/viewer/
Yes! might do it with @srush one of these days. Hopefully it won't break too many links (we can always redirect from old url to new) | [
-0.1529245525598526,
0.20321422815322876,
-0.09984323382377625,
-0.17287211120128632,
0.10617002099752426,
0.04673740267753601,
0.17942596971988678,
0.23907019197940826,
-0.050067052245140076,
-0.0185793936252594,
-0.15655772387981415,
0.3058706223964691,
0.12803825736045837,
0.17247365415096283,
0.31058669090270996,
0.024281064048409462,
0.0012545213103294373,
-0.014079757034778595,
-0.1639329493045807,
-0.02256328985095024,
-0.18634894490242004,
0.05121061950922012,
-0.19513943791389465,
0.18064111471176147,
-0.006567631848156452,
0.07460793852806091,
-0.07075367867946625,
0.23050475120544434,
-0.17707619071006775,
-0.39895886182785034,
0.1384267359972,
0.16800551116466522,
-0.04881786182522774,
0.22820937633514404,
-0.0000960608886089176,
0.06721436977386475,
0.4233936667442322,
0.24767577648162842,
-0.34466397762298584,
-0.00007517635822296143,
-0.31063786149024963,
-0.06529579311609268,
0.10531014949083328,
-0.12981823086738586,
-0.14220421016216278,
-0.24684284627437592,
0.35511642694473267,
-0.06529778987169266,
0.07369346916675568,
0.24088987708091736,
0.3633950352668762,
0.3327014446258545,
-0.1858966052532196,
-0.08977368474006653,
-0.0542074516415596,
0.12080482393503189,
-0.06965138763189316,
0.04345580190420151,
-0.01821804791688919,
0.06616002321243286,
-0.2392885982990265,
0.561126708984375,
0.2315683662891388,
-0.02794753387570381,
0.20097139477729797,
-0.014302403666079044,
-0.353767067193985,
0.05352602154016495,
0.07904316484928131,
0.05504816770553589,
0.6028004884719849,
-0.10181836038827896,
-0.17425349354743958,
-0.0268566757440567,
-0.07259532809257507,
0.054823361337184906,
0.2638869881629944,
0.1445004791021347,
0.0604989118874073,
0.22886905074119568,
-0.24190834164619446,
-0.500847339630127,
-0.1607082188129425,
0.14597085118293762,
-0.13185498118400574,
0.36666664481163025,
-0.09557949006557465,
-0.03485504537820816,
0.19618843495845795,
-0.19129866361618042,
0.25465646386146545,
0.12041813880205154,
-0.030397329479455948,
-0.2633923888206482,
0.11335916817188263,
-0.0686037689447403,
0.23500576615333557,
0.42136669158935547,
0.043176814913749695,
0.21897420287132263,
0.15478965640068054,
0.14856892824172974,
-0.18844595551490784,
-0.0044191740453243256,
0.04719162732362747,
-0.038711316883563995,
0.09200720489025116,
-0.00886470079421997,
0.6043270826339722,
0.2491929978132248,
0.2259243130683899,
-0.017977938055992126,
0.17330019176006317,
-0.33658748865127563,
-0.39343905448913574,
-0.33922481536865234,
0.27043020725250244,
-0.10584194958209991,
-0.16211695969104767,
-0.11670561879873276,
0.11401880532503128,
-0.04895015060901642,
-0.015049696899950504,
0.3982779085636139,
-0.13772951066493988,
-0.015708353370428085,
-0.040685199201107025,
-0.14621233940124512,
-0.20740680396556854,
-0.21861529350280762,
-0.31242167949676514,
0.02948639541864395,
-0.30691754817962646,
-0.05215929448604584,
0.23050762712955475,
-0.03774794563651085,
0.19928742945194244,
-0.14178822934627533,
-0.1505470722913742,
0.04721752554178238,
-0.26350459456443787,
0.24867428839206696,
0.03660919517278671,
0.180108904838562,
0.052363019436597824,
0.04484795778989792,
0.02091728150844574,
-0.20015496015548706,
0.04604686051607132,
0.05415163189172745,
-0.22764629125595093,
-0.18824402987957,
-0.1267293244600296,
0.29913052916526794,
-0.13164213299751282,
-0.3244580030441284,
0.04659786447882652,
0.20647679269313812,
-0.25259286165237427,
-0.1256885677576065,
-0.08846700936555862,
0.23246383666992188,
-0.15034230053424835,
0.003481934778392315,
0.07616965472698212,
0.20251627266407013,
-0.15889616310596466,
-0.2690931558609009,
0.030551478266716003,
-0.22084254026412964,
-0.22994789481163025,
0.27018019556999207,
-0.22010549902915955,
-0.27897363901138306,
-0.31012576818466187,
0.26337730884552,
0.6101363301277161,
-0.16966697573661804,
-0.3256670832633972,
0.10789995640516281,
-0.25971800088882446,
-0.2637855112552643,
-0.08734933286905289,
0.11832290887832642,
-0.014970282092690468,
-0.018761897459626198,
-0.014495551586151123,
0.14763449132442474,
0.14486998319625854,
0.21992769837379456,
-0.2966609299182892,
-0.2687578499317169,
0.012295223772525787,
0.08555123209953308,
0.040412113070487976,
-0.01153845340013504,
0.14675326645374298,
-0.1777268499135971,
0.4457988142967224,
-0.06475524604320526,
-0.006859654560685158,
0.1231626644730568,
0.3145541250705719,
0.09748966246843338,
-0.08063653856515884,
-0.07089763879776001,
-0.26562532782554626,
-0.11581762880086899,
0.06968063861131668,
0.15816187858581543,
0.017750203609466553,
-0.2546254098415375,
-0.3468809425830841,
0.0013948101550340652,
-0.1944442242383957,
-0.16498374938964844,
0.2775952219963074,
0.23373757302761078,
-0.27060842514038086,
0.2563655972480774,
-0.2427317053079605,
0.06536772102117538,
0.12906254827976227,
0.23438295722007751,
-0.35971584916114807,
0.3342650830745697,
-0.12441154569387436,
0.1992958039045334,
0.17144623398780823,
-0.06825882941484451,
0.21536552906036377,
-0.0765550285577774,
0.023623302578926086,
0.3552130162715912,
-0.14295214414596558,
0.3339489698410034,
0.4800490438938141,
-0.05727076530456543,
0.30155783891677856,
-0.4770200550556183,
0.15572741627693176,
0.1190638393163681,
-0.16075195372104645,
0.3650277853012085,
-0.2998689115047455,
0.01010102778673172,
-0.06804504990577698,
0.06136874854564667,
0.18254561722278595,
0.259522408246994,
0.36253970861434937,
-0.32489293813705444,
-0.20327985286712646,
-0.23479117453098297,
-0.017585385590791702,
0.15895967185497284,
0.1128980964422226,
0.051396049559116364,
-0.4989531338214874,
0.311869353055954,
0.115495964884758,
-0.0290465597063303,
-0.04765070229768753,
0.38672927021980286,
-0.24147167801856995,
-0.30744868516921997,
0.2407459318637848,
0.28013190627098083,
-0.04375848174095154,
0.3403138220310211,
0.25546765327453613,
0.19329334795475006,
-0.0012780539691448212,
-0.39807167649269104,
0.1768646538257599,
0.1721520721912384,
0.0027356664650142193,
0.008859962224960327,
0.17374104261398315,
-0.29453858733177185,
-0.6536632776260376,
-0.005875809118151665,
-0.0075586759485304356,
0.010746099054813385,
-0.33941516280174255,
0.02360832504928112,
-0.44548580050468445,
-0.6335580348968506,
-0.2669556438922882,
-0.14458049833774567,
-0.3213300108909607,
-0.5371220707893372,
0.17422965168952942,
0.1724795401096344,
-0.3501805067062378,
0.3709133267402649,
-0.34964045882225037,
0.3366968631744385,
-0.1685067117214203,
0.2599724233150482,
-0.23136745393276215,
-0.16337668895721436,
-0.22844579815864563,
0.25683748722076416,
0.0770871490240097,
0.1749696135520935,
0.3014184534549713,
-0.05656791478395462,
0.1974836140871048,
-0.6858534216880798,
-0.4707406461238861,
0.16996335983276367,
0.2959238290786743,
0.1817479431629181,
0.19275875389575958,
0.1188541054725647,
0.008020170032978058,
-0.06429293006658554,
0.23182661831378937,
0.0027227792888879776,
0.03546679764986038,
-0.22111459076404572,
-0.02044840157032013,
0.13295002281665802,
0.011838126927614212,
-0.31344786286354065,
-0.1686442494392395,
-0.2678631842136383,
0.04222987964749336,
-0.18909965455532074,
0.12958067655563354,
0.12804220616817474,
-0.03402308374643326,
-0.17282715439796448,
-0.1392841339111328,
-0.09646230936050415,
-0.26240187883377075,
-0.3715263605117798,
0.24999898672103882,
-0.4449133276939392,
-0.3064359128475189,
0.005577210336923599,
0.1480792760848999,
0.14209726452827454,
-0.059349752962589264,
-0.5062494277954102,
-0.2804401218891144,
-0.1307625025510788,
0.03518583998084068,
0.24759583175182343,
0.00299648754298687,
0.10489603877067566,
0.15573489665985107,
-0.3758838474750519,
0.031799763441085815,
-0.33646321296691895,
-0.053769029676914215,
-0.09490124136209488,
0.28064948320388794,
0.008398247882723808,
0.21985965967178345,
0.22893989086151123,
0.34268057346343994,
0.16347923874855042,
0.019913317635655403,
0.23776240646839142,
-0.1535305678844452,
0.4485097825527191,
0.18218858540058136,
-0.19658824801445007,
0.2710147202014923,
0.07514569908380508,
0.0043194349855184555,
0.3426809310913086,
0.26890259981155396,
0.09848875552415848,
-0.20775380730628967,
-0.1613912731409073,
-0.2719852030277252,
-0.48728030920028687,
-0.0833558589220047,
0.02427237294614315,
0.1197451651096344,
0.3425944745540619,
0.08772420138120651,
-0.24976025521755219,
-0.22474613785743713,
0.1520168036222458,
0.37364840507507324,
0.016987212002277374,
-0.049506038427352905,
-0.2696382701396942,
0.23135407269001007,
-0.6547802090644836,
0.26877495646476746,
-0.11156437546014786,
0.10539936274290085,
0.04208224639296532,
-0.1473432183265686,
0.14441147446632385,
-0.0495905764400959,
0.6202211380004883,
-0.05867326259613037,
0.11360134184360504,
-0.06504886597394943,
0.06788162142038345,
-0.24529404938220978,
0.25405365228652954,
0.17585903406143188,
0.14745663106441498,
0.17891153693199158,
0.11025557667016983,
-0.11254066228866577,
-0.2522720396518707,
0.34036779403686523,
-0.2710326015949249,
-0.1940622180700302,
-0.10162603110074997,
-0.02106238715350628,
-0.2907528281211853,
0.005170911550521851,
-0.08857154101133347,
-0.20423857867717743,
-0.045411430299282074,
0.03874204307794571,
-0.06867288053035736,
0.049804024398326874,
-0.30150145292282104,
-0.01421576738357544,
0.14844560623168945,
0.1374402642250061,
0.21873785555362701,
-0.14371928572654724,
0.30855587124824524,
0.4303293824195862,
0.08746092021465302,
0.4343459904193878,
-0.18877315521240234,
-0.35839614272117615,
0.038058146834373474,
0.11787059903144836,
0.2680729329586029,
0.42999160289764404,
0.05660615861415863,
0.04963932931423187,
0.3776903450489044,
0.21288934350013733,
-0.1849476844072342,
0.1865595132112503,
0.1830233633518219,
0.0021557556465268135,
-0.2337556928396225,
-0.23462308943271637,
0.3446410596370697,
-0.057643868029117584,
-0.19916120171546936,
0.07546858489513397,
0.4092165231704712,
-0.1977352648973465,
-0.22554609179496765,
-0.040585316717624664,
0.7620609998703003,
-0.015528596937656403,
0.15516397356987,
0.3432327210903168,
-0.3480367064476013,
0.4521661698818207,
-0.03928089886903763,
0.237786665558815,
-0.3087502121925354,
-0.2042778879404068,
-0.06631685793399811,
0.04249359294772148,
0.027605239301919937,
-0.11096528172492981,
0.1298292726278305,
0.30034175515174866,
0.29626888036727905,
0.14639633893966675,
0.21904438734054565,
0.36143526434898376,
0.04484468325972557,
-0.11089512705802917,
-0.3656885623931885,
0.294944703578949,
-0.23700524866580963,
0.2156788408756256,
-0.0922103226184845,
-0.12521539628505707,
0.16174918413162231,
-0.014942282810807228,
0.07926405966281891,
0.24420419335365295,
0.002067096997052431,
0.0953829288482666,
-0.05715164914727211,
-0.25284719467163086,
-0.00888486485928297,
0.2713748812675476,
0.13865028321743011,
0.10523135960102081,
-0.27497613430023193,
0.5181616544723511,
-0.21614336967468262,
0.05737631022930145,
-0.07570961862802505,
0.1377534121274948,
0.09104964882135391,
-0.1569630205631256,
-0.1286020427942276,
-0.008118100464344025,
0.2216852605342865,
-0.2824496030807495,
-0.07274102419614792,
-0.05289006233215332,
0.0015450865030288696,
-0.22618453204631805,
0.11297658085823059,
0.044474903494119644,
0.049773383885622025,
-0.348795086145401,
0.2110319584608078,
-0.09577921032905579,
0.26484987139701843,
-0.05775400251150131,
0.3419024348258972,
-0.053267382085323334,
-0.1077440083026886,
0.4212608337402344,
-0.1554349958896637,
-0.1962437927722931,
0.1823095828294754,
0.11846601963043213,
-0.2897754907608032,
-0.2650914490222931,
-0.004352301359176636,
-0.029047556221485138,
-0.13348257541656494,
0.14741359651088715,
-0.0611422099173069,
0.06756584346294403,
-0.09183859080076218,
0.022620778530836105,
-0.08319249749183655,
0.11024318635463715,
-0.12812691926956177,
-0.038215309381484985,
-0.145868718624115,
0.28074514865875244,
-0.005823507905006409,
0.12139646708965302,
0.024296432733535767,
0.35247352719306946,
0.1620064377784729,
-0.33831626176834106,
-0.47310909628868103,
0.1348266899585724,
0.02540583349764347,
-0.20223186910152435,
-0.15702615678310394,
-0.014034941792488098,
0.1987932026386261,
-0.047713082283735275,
0.20989714562892914,
-0.21312323212623596,
-0.21756573021411896,
-0.30296871066093445,
-0.16853490471839905,
0.04370427131652832,
0.09547536820173264,
-0.12640811502933502,
-0.06808439642190933,
-0.09200811386108398,
-0.022577296942472458,
0.03999163210391998,
-0.06534406542778015,
0.2169628143310547,
0.05210098251700401,
-0.06444226205348969,
-0.12215776741504669,
-0.34513917565345764,
0.22922076284885406,
0.11076812446117401,
0.13806314766407013,
0.365217387676239,
-0.028161674737930298,
0.09665950387716293,
-0.28749626874923706,
-0.1066647469997406,
0.06596965342760086,
0.15433496236801147,
0.18047881126403809,
0.2186162769794464,
0.017165277153253555,
-0.28975850343704224,
-0.06316155195236206,
0.21860527992248535,
0.4709542989730835,
0.13833588361740112,
-0.1754734367132187,
-0.1330547034740448,
0.2779674530029297,
0.32323554158210754,
-0.3519640862941742,
0.03926313668489456,
0.14055518805980682,
-0.06502490490674973,
0.148774191737175,
-0.15747299790382385,
-0.07914280891418457,
0.10337615013122559,
0.020699404180049896,
0.11163396388292313,
0.27002596855163574,
-0.11999174952507019,
0.18020658195018768,
0.008528005331754684,
-0.3254857361316681,
0.07661504298448563,
0.35001689195632935,
0.23059576749801636,
0.12112602591514587,
0.3390003442764282,
-0.03672684729099274,
0.11086441576480865,
0.05625062435865402,
0.2756705582141876,
0.1108817532658577,
-0.06488589942455292,
-0.14110322296619415,
0.07550889253616333,
0.09082627296447754,
0.015767380595207214,
0.18692952394485474,
0.4979649782180786,
-0.014368643052875996,
-0.19831426441669464,
-0.17233413457870483,
0.4549839198589325,
-0.019850987941026688,
-0.14796410501003265,
-0.24967259168624878,
-0.14248870313167572,
-0.04399935156106949,
0.21422401070594788,
-0.20484232902526855,
-0.2597123384475708,
-0.07177011668682098,
-0.12861689925193787,
-0.047848016023635864,
-0.5942423343658447,
0.04566594958305359,
-0.03413370996713638,
0.2094423472881317,
0.12382198870182037,
0.14177881181240082,
0.03512196987867355,
0.011091973632574081,
0.2486809492111206,
0.3786731958389282,
0.06046967953443527,
-0.1654721051454544,
0.25084903836250305,
-0.1877601146697998,
-0.09653997421264648,
-0.19488240778446198,
-0.2138693928718567,
-0.08356961607933044,
0.30522263050079346,
0.020180143415927887,
0.4068005681037903,
0.3149118423461914,
-0.24921254813671112,
0.32331937551498413,
-0.013092514127492905,
0.25010189414024353,
-0.020680567249655724,
0.10846800357103348,
-0.011750925332307816,
-0.16634711623191833,
-0.23752161860466003,
-0.31366831064224243,
-0.36916959285736084,
0.026778697967529297,
0.17216633260250092,
-0.2847141623497009,
0.08804798871278763,
-0.3673916161060333,
0.1497754603624344,
0.29271823167800903,
0.5062053203582764,
0.14652079343795776,
0.08582918345928192,
0.09202595055103302,
-0.515545129776001,
-0.6560670137405396,
0.14367015659809113,
0.08821985125541687,
-0.0828443169593811,
-0.06810767203569412,
-0.09663387387990952,
-0.09020248800516129,
-0.026195954531431198,
0.06874080002307892,
0.10956262797117233,
-0.05565265566110611,
-0.11582615971565247,
-0.18696229159832,
0.16248942911624908,
-0.07588693499565125,
0.3305951952934265,
0.07515133172273636,
-0.08438718318939209,
0.2293514609336853,
-0.12166710197925568,
0.11551826447248459,
0.07265792787075043,
0.32204779982566833,
-0.29159417748451233,
-0.3225940763950348,
0.3025614619255066,
0.07036575675010681,
0.10325318574905396,
-0.09505249559879303,
-0.15007822215557098,
-0.31130459904670715,
-0.49813657999038696,
-0.3935403823852539,
0.11781147122383118,
0.11522877216339111,
0.23360460996627808,
0.10066197067499161,
0.006748378276824951,
0.03587210178375244,
0.21055525541305542,
0.14401906728744507,
0.35614365339279175,
-0.15771128237247467,
0.15701349079608917,
0.2726443409919739,
-0.013575457036495209,
0.0609435997903347,
0.19285565614700317,
-0.09126636385917664,
-0.028557144105434418,
-0.11981917172670364,
-0.5693755149841309,
0.5659236907958984,
-0.3538650870323181,
-0.08131909370422363,
-0.07477249205112457,
0.2972428798675537,
0.23037409782409668,
-0.06364145129919052,
-0.2993023097515106,
0.05764833837747574,
0.1360187828540802,
0.04363135248422623,
0.03886353597044945,
0.23110012710094452,
-0.20230264961719513,
-0.06719017028808594,
-0.14421355724334717,
0.38909482955932617,
0.40588971972465515,
-0.3612390160560608,
-0.009341880679130554,
0.01282159611582756
] |
https://github.com/huggingface/datasets/issues/678 | The download instructions for c4 datasets are not contained in the error message | Also not that C4 is a dataset that needs an Apache Beam runtime to be generated.
For example Dataflow, Spark, Flink etc.
Usually we generate the dataset on our side once and for all, but we haven't done it for C4 yet.
More info about beam datasets [here](https://huggingface.co/docs/datasets/beam_dataset.html)
Let me know if you have any questions | The manual download instructions are not clear
```The dataset c4 with config en requires manual data.
Please follow the manual download instructions: <bound method C4.manual_download_instructions of <datasets_modules.datasets.c4.830b0c218bd41fed439812c8dd19dbd4767d2a3faa385eb695cf8666c982b1b3.c4.C4 object at 0x7ff8c5969760>>.
Manual data can be loaded with `datasets.load_dataset(c4, data_dir='<path/to/manual/data>')
```
Either `@property` could be added to C4.manual_download_instrcutions (or make it a real property), or the manual_download_instructions function needs to be called I think.
Let me know if you want a PR for this, but I'm not sure which possible fix is the correct one. | 56 | The download instructions for c4 datasets are not contained in the error message
The manual download instructions are not clear
```The dataset c4 with config en requires manual data.
Please follow the manual download instructions: <bound method C4.manual_download_instructions of <datasets_modules.datasets.c4.830b0c218bd41fed439812c8dd19dbd4767d2a3faa385eb695cf8666c982b1b3.c4.C4 object at 0x7ff8c5969760>>.
Manual data can be loaded with `datasets.load_dataset(c4, data_dir='<path/to/manual/data>')
```
Either `@property` could be added to C4.manual_download_instrcutions (or make it a real property), or the manual_download_instructions function needs to be called I think.
Let me know if you want a PR for this, but I'm not sure which possible fix is the correct one.
Also not that C4 is a dataset that needs an Apache Beam runtime to be generated.
For example Dataflow, Spark, Flink etc.
Usually we generate the dataset on our side once and for all, but we haven't done it for C4 yet.
More info about beam datasets [here](https://huggingface.co/docs/datasets/beam_dataset.html)
Let me know if you have any questions | [
-0.1576070785522461,
-0.25204694271087646,
-0.044344112277030945,
0.24197342991828918,
0.3052387833595276,
-0.01730603352189064,
0.04620017856359482,
0.1740139275789261,
-0.09261663258075714,
0.15250995755195618,
0.011208152398467064,
-0.031105192378163338,
-0.12809939682483673,
0.579796314239502,
-0.0943661704659462,
-0.23610663414001465,
-0.13858774304389954,
0.11836308985948563,
-0.21952751278877258,
-0.013220343738794327,
-0.006101071834564209,
0.2214009165763855,
-0.19569188356399536,
-0.02204277366399765,
-0.20923887193202972,
-0.13728530704975128,
0.015189791098237038,
0.1767096072435379,
-0.25517114996910095,
-0.3560914099216461,
0.36045777797698975,
0.11284032464027405,
0.29814404249191284,
0.16014361381530762,
-0.00009451426740270108,
0.0746881514787674,
0.2518622875213623,
-0.3023441731929779,
-0.2845506966114044,
0.1466868817806244,
-0.030705651268363,
-0.09564497321844101,
0.067062146961689,
-0.19684439897537231,
-0.29971495270729065,
-0.14518499374389648,
0.11928309500217438,
-0.10146035254001617,
0.364005982875824,
0.25996655225753784,
0.37225839495658875,
0.4407115578651428,
0.19577200710773468,
-0.23338165879249573,
0.09535348415374756,
-0.15085919201374054,
-0.14200611412525177,
0.1691170185804367,
-0.04061807692050934,
0.2747166156768799,
0.00043163448572158813,
0.27280575037002563,
0.1778382807970047,
0.058045871555805206,
0.40700531005859375,
-0.2139711230993271,
-0.19565615057945251,
-0.2863413691520691,
0.12146859616041183,
0.04401862248778343,
0.7800214290618896,
-0.17549386620521545,
-0.03188861161470413,
0.06841074675321579,
0.3036722242832184,
-0.09139417856931686,
0.290375292301178,
0.281647652387619,
-0.11352643370628357,
0.13210482895374298,
-0.2517779767513275,
-0.15778329968452454,
-0.2102700173854828,
-0.02754274010658264,
0.12931758165359497,
-0.258745938539505,
-0.18213696777820587,
0.15056832134723663,
0.1448352038860321,
-0.06551715731620789,
-0.03703096881508827,
0.0024912897497415543,
-0.25381240248680115,
0.11775242537260056,
-0.22600634396076202,
-0.13400974869728088,
-0.13678941130638123,
0.5243661403656006,
0.14800119400024414,
0.04933944717049599,
0.05525211617350578,
0.03950309753417969,
-0.09584753960371017,
0.024608060717582703,
-0.0875779241323471,
0.134189635515213,
0.14160776138305664,
-0.027323942631483078,
0.20562289655208588,
0.009081494063138962,
0.13632868230342865,
-0.13247498869895935,
-0.09239967167377472,
-0.3220096230506897,
-0.4273109436035156,
0.12150652706623077,
-0.10254106670618057,
-0.12512560188770294,
-0.25674107670783997,
-0.021687567234039307,
-0.15813177824020386,
0.11701520532369614,
-0.12268166989088058,
0.5028870701789856,
0.031980063766241074,
0.03578038513660431,
0.31101125478744507,
0.1301049292087555,
-0.12641608715057373,
-0.4252975881099701,
-0.1609552800655365,
0.088523268699646,
-0.34060123562812805,
0.10323240607976913,
0.20311446487903595,
-0.08581529557704926,
0.32100221514701843,
-0.010548221878707409,
0.20391812920570374,
0.23368161916732788,
0.043708160519599915,
0.13822461664676666,
-0.32994771003723145,
0.2939600646495819,
0.08926096558570862,
0.1966179460287094,
0.05039210617542267,
0.09924095869064331,
0.014727763831615448,
-0.24289551377296448,
-0.13839036226272583,
-0.3888973295688629,
-0.029312970116734505,
0.28995782136917114,
-0.035973019897937775,
0.06045463681221008,
-0.3929702043533325,
-0.15388037264347076,
-0.07795510441064835,
0.008578754961490631,
-0.01853381097316742,
-0.18412937223911285,
0.179202601313591,
-0.30999019742012024,
0.1034424901008606,
0.5316657423973083,
-0.19394584000110626,
0.059460900723934174,
0.10719136148691177,
-0.32909780740737915,
0.09397132694721222,
0.10964541137218475,
-0.198312908411026,
0.15286898612976074,
-0.32181230187416077,
-0.07171608507633209,
0.0001487433910369873,
-0.29972320795059204,
-0.06717134267091751,
0.24919429421424866,
0.07637020945549011,
-0.10284204035997391,
-0.0841958299279213,
0.045796897262334824,
0.03447956591844559,
0.04714209586381912,
-0.15554332733154297,
0.09643541276454926,
0.04591871798038483,
0.09538116306066513,
-0.2365957349538803,
-0.2664735019207001,
-0.0504298135638237,
-0.017055056989192963,
0.04861156642436981,
0.0009502694010734558,
0.17524297535419464,
-0.022372927516698837,
0.2334791123867035,
-0.12156359851360321,
0.20532557368278503,
0.3341153860092163,
0.08973908424377441,
0.07269036024808884,
-0.09863676875829697,
0.27058565616607666,
-0.48802661895751953,
0.19848793745040894,
-0.023317161947488785,
0.29364562034606934,
0.23744872212409973,
-0.09219180792570114,
-0.2881414592266083,
-0.11706405878067017,
-0.19549547135829926,
-0.39284443855285645,
0.23331618309020996,
0.06380634009838104,
0.01609651744365692,
-0.14242829382419586,
-0.05511504039168358,
0.694941520690918,
-0.41947245597839355,
0.13608364760875702,
-0.17555922269821167,
0.2874917984008789,
-0.2992297410964966,
-0.0015134131535887718,
0.2668256163597107,
-0.1448068618774414,
0.24421167373657227,
-0.1558157056570053,
-0.11827806383371353,
0.5188832879066467,
-0.07005049288272858,
0.1831248700618744,
-0.015659518539905548,
0.10249925404787064,
0.16840329766273499,
-0.4067898988723755,
0.22264541685581207,
0.0969817042350769,
0.05642520263791084,
0.04657260328531265,
0.13687843084335327,
0.027752235531806946,
0.06096601113677025,
-0.03850439935922623,
0.13757620751857758,
0.21145099401474,
0.303519070148468,
0.09035655856132507,
-0.051510415971279144,
-0.008439823985099792,
0.046029232442379,
0.03816957026720047,
0.3691146969795227,
-0.15473447740077972,
-0.26864463090896606,
-0.020440705120563507,
0.37245845794677734,
0.14926235377788544,
-0.21343868970870972,
-0.003970291465520859,
-0.20159536600112915,
0.018255073577165604,
0.4242030084133148,
0.08459566533565521,
0.181524395942688,
0.3259015381336212,
-0.25727295875549316,
0.13949471712112427,
0.07871140539646149,
-0.1675015240907669,
0.21979057788848877,
-0.20678208768367767,
0.17357312142848969,
-0.07653070241212845,
-0.061971165239810944,
0.028804223984479904,
-0.2854051887989044,
-0.12636670470237732,
-0.04958432912826538,
0.06708638370037079,
-0.4333348870277405,
-0.18744932115077972,
-0.07151059806346893,
-0.1334763765335083,
-0.2219574898481369,
0.10571655631065369,
-0.2684016823768616,
-0.24936328828334808,
0.053117044270038605,
0.05193571746349335,
-0.21465936303138733,
0.22115083038806915,
-0.07737840712070465,
0.2021477222442627,
0.18702416121959686,
0.06048615276813507,
-0.2790496349334717,
0.05618076026439667,
-0.3365764915943146,
0.19740574061870575,
0.07633347809314728,
0.1776462197303772,
0.35038816928863525,
-0.29265812039375305,
0.15387076139450073,
-0.42536211013793945,
-0.2524704933166504,
0.27061107754707336,
-0.12422098219394684,
0.03414511680603027,
0.2647263705730438,
0.44573456048965454,
-0.04059683904051781,
-0.1978023797273636,
0.1048383116722107,
-0.2580123841762543,
-0.20562094449996948,
-0.05647099390625954,
-0.03141158074140549,
-0.10526213049888611,
-0.23280781507492065,
-0.47382399439811707,
-0.2691170573234558,
-0.5012937188148499,
0.06166445091366768,
0.023895282298326492,
-0.01796366274356842,
0.3495783805847168,
0.16365419328212738,
0.08348175883293152,
0.18623387813568115,
-0.1325877159833908,
-0.19966435432434082,
-0.25761812925338745,
0.24111035466194153,
-0.42449942231178284,
-0.4918939769268036,
0.2326403260231018,
0.0886930376291275,
0.1810024380683899,
0.13641758263111115,
-0.28830379247665405,
0.10773693025112152,
-0.12723973393440247,
0.21774116158485413,
0.00376298651099205,
0.08904584497213364,
0.4727258086204529,
-0.10598190128803253,
-0.07912591844797134,
-0.2712835371494293,
-0.013919451273977757,
0.18676309287548065,
-0.1283687949180603,
0.4082901179790497,
-0.14155378937721252,
0.0922081470489502,
0.008345995098352432,
0.6587254405021667,
0.06845022737979889,
-0.2738856375217438,
0.39501523971557617,
-0.02452252246439457,
0.548344612121582,
-0.11960931867361069,
-0.04834146797657013,
0.2783372104167938,
-0.13034102320671082,
0.1182849109172821,
0.25618776679039,
-0.07170427590608597,
0.05302067846059799,
-0.29308193922042847,
0.1332416981458664,
-0.3371209502220154,
-0.20325063169002533,
-0.07520114630460739,
0.1337704062461853,
0.23859930038452148,
0.12243422865867615,
0.2099098265171051,
0.07563011348247528,
-0.060033638030290604,
0.22008566558361053,
0.3244326114654541,
0.09455924481153488,
0.08624838292598724,
-0.09772578626871109,
-0.0006390474736690521,
-0.4687546491622925,
0.45852547883987427,
-0.08828534930944443,
0.012118703685700893,
-0.03547629714012146,
-0.0484406054019928,
0.056080155074596405,
-0.07700284570455551,
0.3993709087371826,
-0.350909024477005,
-0.024568475782871246,
0.06716065108776093,
0.31529712677001953,
-0.351236492395401,
-0.135764941573143,
-0.14746348559856415,
0.026634566485881805,
0.35369545221328735,
0.11299552023410797,
-0.3503396213054657,
-0.14482447504997253,
0.050570130348205566,
0.025796523317694664,
-0.11644066870212555,
-0.07796918600797653,
-0.12619620561599731,
-0.056886740028858185,
-0.3180394470691681,
-0.052493028342723846,
-0.05648789554834366,
0.0643649622797966,
-0.19180803000926971,
-0.0424596443772316,
0.0684955045580864,
-0.02263989858329296,
0.027367837727069855,
0.12679129838943481,
0.3164549469947815,
0.08249066025018692,
0.10868354141712189,
0.1601504683494568,
0.18687275052070618,
0.3519443869590759,
0.2604801058769226,
-0.06644265353679657,
0.18685050308704376,
0.16605409979820251,
-0.05296280235052109,
0.024341359734535217,
0.22119441628456116,
-0.06373389065265656,
-0.041715286672115326,
-0.13084106147289276,
0.197663351893425,
-0.15529799461364746,
0.3797975480556488,
0.144974023103714,
-0.19737562537193298,
-0.27996012568473816,
-0.3411349952220917,
0.3049992322921753,
-0.3228605091571808,
-0.01933908462524414,
0.22033847868442535,
0.535468339920044,
-0.22198505699634552,
0.17505580186843872,
0.1773681938648224,
0.8056118488311768,
-0.15244023501873016,
-0.03004090115427971,
0.2842767536640167,
-0.12236116826534271,
0.2576766908168793,
-0.6670982837677002,
0.028385993093252182,
-0.24469849467277527,
0.05664711445569992,
0.01898924447596073,
-0.02935083582997322,
0.08441489934921265,
0.13417840003967285,
-0.2023182362318039,
0.2052096128463745,
0.15798035264015198,
0.2810957729816437,
-0.09645836055278778,
0.23122042417526245,
-0.2328835427761078,
-0.1702730506658554,
-0.23032018542289734,
0.3361826241016388,
-0.10282455384731293,
0.36440399289131165,
-0.31698161363601685,
-0.22640764713287354,
0.047695305198431015,
-0.4318675994873047,
-0.15806059539318085,
0.15781357884407043,
-0.3295030891895294,
0.05067051574587822,
-0.07935589551925659,
-0.05330517515540123,
0.3071308135986328,
0.14607132971286774,
0.30617886781692505,
0.29723992943763733,
-0.38309168815612793,
0.22505857050418854,
-0.04984108358621597,
-0.3608679473400116,
-0.1509021669626236,
0.14392998814582825,
0.15434221923351288,
-0.21633732318878174,
-0.1585422158241272,
0.12107796221971512,
-0.11234297603368759,
-0.2633707523345947,
0.13893598318099976,
-0.22510282695293427,
0.0310811810195446,
-0.19375351071357727,
0.10800327360630035,
0.17894470691680908,
-0.06729927659034729,
-0.08085910975933075,
0.24958956241607666,
-0.21749375760555267,
-0.08771894127130508,
-0.022343292832374573,
0.27721795439720154,
-0.0715375542640686,
-0.11960290372371674,
0.23577997088432312,
-0.09657894819974899,
-0.1894826591014862,
0.24126169085502625,
0.09182408452033997,
-0.21931521594524384,
-0.3616683781147003,
0.02773679792881012,
0.1239839717745781,
-0.4700002670288086,
-0.0984591543674469,
0.07306522876024246,
0.026089981198310852,
0.04414978623390198,
0.4836726486682892,
0.13107192516326904,
-0.01791244000196457,
0.2964157462120056,
-0.19413597881793976,
-0.5111043453216553,
0.17227238416671753,
-0.30639564990997314,
0.22241857647895813,
0.07167012989521027,
0.40833911299705505,
0.2780315577983856,
0.021252281963825226,
-0.47611454129219055,
-0.09573106467723846,
-0.2024458944797516,
0.008619194850325584,
0.47609904408454895,
-0.05353016406297684,
0.2613421082496643,
-0.049885913729667664,
0.19530820846557617,
0.2604643404483795,
-0.42308029532432556,
-0.23193547129631042,
0.040751416236162186,
0.07881301641464233,
-0.018850136548280716,
-0.03262684494256973,
0.1591198742389679,
-0.1057993620634079,
-0.37447312474250793,
-0.05149901658296585,
0.20886965095996857,
0.12183909863233566,
-0.06603874266147614,
0.024468518793582916,
0.15114884078502655,
0.187641441822052,
-0.2258436530828476,
0.01672622561454773,
0.2588256001472473,
0.31964707374572754,
-0.028086235746741295,
-0.04002104699611664,
-0.17569571733474731,
-0.11032707244157791,
0.13414599001407623,
0.15914839506149292,
0.1411132514476776,
0.16153430938720703,
0.15786612033843994,
-0.11924688518047333,
-0.019298208877444267,
-0.07920079678297043,
0.2799161374568939,
-0.10030429065227509,
-0.09369765967130661,
0.006301628425717354,
0.25861090421676636,
0.34500592947006226,
-0.36027777194976807,
0.29753583669662476,
-0.13345345854759216,
0.006438847631216049,
-0.06886213272809982,
-0.012505553662776947,
0.24994716048240662,
-0.152866393327713,
0.14916720986366272,
0.2357267141342163,
0.18980997800827026,
0.03488907963037491,
0.029228823259472847,
0.009628083556890488,
-0.07785465568304062,
-0.0010327883064746857,
0.20975226163864136,
-0.11309807002544403,
0.16476574540138245,
0.37723207473754883,
-0.31606531143188477,
0.09499302506446838,
0.06213701143860817,
0.06154771149158478,
0.11091683804988861,
-0.5008834600448608,
-0.02450639382004738,
0.19885490834712982,
0.07230525463819504,
0.047923773527145386,
-0.015957310795783997,
0.19397971034049988,
0.03295600414276123,
-0.31388360261917114,
-0.4437043368816376,
0.11584576964378357,
-0.17201673984527588,
0.2750706076622009,
-0.16794534027576447,
-0.2745357155799866,
-0.13358715176582336,
0.11272577941417694,
-0.033519890159368515,
-0.21139849722385406,
0.3847886621952057,
0.07260806858539581,
-0.040476247668266296,
-0.27979183197021484,
0.031702667474746704,
0.09532953798770905,
0.1308012306690216,
-0.18733268976211548,
0.2822521924972534,
0.07108733057975769,
-0.03933463245630264,
0.09870210289955139,
0.0260618943721056,
0.3179253339767456,
0.22583387792110443,
0.1370508223772049,
0.15079618990421295,
0.20919927954673767,
0.079220712184906,
0.01034182496368885,
0.08657525479793549,
0.17858321964740753,
0.1475900411605835,
0.3340988755226135,
0.2623825967311859,
-0.28697463870048523,
-0.2721341848373413,
-0.09416921436786652,
0.2695445716381073,
-0.3533777594566345,
-0.003926411271095276,
-0.08606848865747452,
-0.03139688819646835,
-0.29817354679107666,
0.017097435891628265,
-0.42015501856803894,
0.25725290179252625,
0.03542415797710419,
-0.02971956878900528,
0.0713377520442009,
-0.2428661584854126,
0.1755140721797943,
-0.1715015321969986,
0.5958703756332397,
0.19738651812076569,
0.30268409848213196,
-0.30927345156669617,
-0.523294985294342,
-0.5052438974380493,
0.01678745448589325,
-0.0965641587972641,
0.16658787429332733,
-0.25597015023231506,
0.1326683759689331,
0.36282438039779663,
0.050473522394895554,
0.1660001277923584,
0.29068291187286377,
0.22426335513591766,
0.0743626058101654,
-0.1941460818052292,
-0.07186450064182281,
-0.08546148240566254,
-0.17836254835128784,
0.07450444251298904,
-0.3372361958026886,
-0.09296190738677979,
0.09768778830766678,
0.1946699619293213,
-0.08795306086540222,
0.06009254604578018,
0.2378426194190979,
-0.284307062625885,
0.530874490737915,
0.008448529988527298,
0.50931715965271,
-0.0833965465426445,
-0.17350058257579803,
-0.2166522741317749,
-0.21974751353263855,
-0.053623538464307785,
-0.23741304874420166,
0.0840960144996643,
0.27140721678733826,
0.06343211978673935,
0.02072618342936039,
-0.5036243200302124,
0.38939639925956726,
0.2477639764547348,
0.3329302966594696,
-0.2883208096027374,
0.1675182580947876,
-0.4077235758304596,
-0.020123274996876717,
-0.011299805715680122,
0.10147388279438019,
-0.019963674247264862,
-0.19135276973247528,
-0.32729724049568176,
-0.3006255030632019,
0.5939635038375854,
-0.5361890196800232,
-0.04129229113459587,
0.15159772336483002,
0.21817049384117126,
0.09040224552154541,
-0.12110953778028488,
-0.4905555546283722,
0.35219240188598633,
0.16829881072044373,
-0.07891786098480225,
-0.11321662366390228,
0.06578145921230316,
-0.15760298073291779,
-0.1189124584197998,
-0.07594149559736252,
0.3231963515281677,
0.09799399971961975,
-0.17139267921447754,
-0.12869413197040558,
-0.398409903049469
] |
https://github.com/huggingface/datasets/issues/676 | train_test_split returns empty dataset item | Can you reproduce this example in a Colab so we can investigate? (or give more information on your software/hardware config) | I try to split my dataset by `train_test_split`, but after that the item in `train` and `test` `Dataset` is empty.
The codes:
```
yelp_data = datasets.load_from_disk('/home/ssd4/huanglianzhe/test_yelp')
print(yelp_data[0])
yelp_data = yelp_data.train_test_split(test_size=0.1)
print(yelp_data)
print(yelp_data['test'])
print(yelp_data['test'][0])
```
The outputs:
```
{'stars': 2.0, 'text': 'xxxx'}
Loading cached split indices for dataset at /home/ssd4/huanglianzhe/test_yelp/cache-f9b22d8b9d5a7346.arrow and /home/ssd4/huanglianzhe/test_yelp/cache-4aa26fa4005059d1.arrow
DatasetDict({'train': Dataset(features: {'stars': Value(dtype='float64', id=None), 'text': Value(dtype='string', id=None)}, num_rows: 7219009), 'test': Dataset(features: {'stars': Value(dtype='float64', id=None), 'text': Value(dtype='string', id=None)}, num_rows: 802113)})
Dataset(features: {'stars': Value(dtype='float64', id=None), 'text': Value(dtype='string', id=None)}, num_rows: 802113)
{} # yelp_data['test'][0] is empty
``` | 20 | train_test_split returns empty dataset item
I try to split my dataset by `train_test_split`, but after that the item in `train` and `test` `Dataset` is empty.
The codes:
```
yelp_data = datasets.load_from_disk('/home/ssd4/huanglianzhe/test_yelp')
print(yelp_data[0])
yelp_data = yelp_data.train_test_split(test_size=0.1)
print(yelp_data)
print(yelp_data['test'])
print(yelp_data['test'][0])
```
The outputs:
```
{'stars': 2.0, 'text': 'xxxx'}
Loading cached split indices for dataset at /home/ssd4/huanglianzhe/test_yelp/cache-f9b22d8b9d5a7346.arrow and /home/ssd4/huanglianzhe/test_yelp/cache-4aa26fa4005059d1.arrow
DatasetDict({'train': Dataset(features: {'stars': Value(dtype='float64', id=None), 'text': Value(dtype='string', id=None)}, num_rows: 7219009), 'test': Dataset(features: {'stars': Value(dtype='float64', id=None), 'text': Value(dtype='string', id=None)}, num_rows: 802113)})
Dataset(features: {'stars': Value(dtype='float64', id=None), 'text': Value(dtype='string', id=None)}, num_rows: 802113)
{} # yelp_data['test'][0] is empty
```
Can you reproduce this example in a Colab so we can investigate? (or give more information on your software/hardware config) | [
-0.11503510177135468,
-0.05038123577833176,
-0.038193464279174805,
0.37564629316329956,
-0.008087974041700363,
0.2310481071472168,
0.6476925611495972,
0.2886786460876465,
-0.02226811833679676,
0.16844365000724792,
-0.08318229764699936,
0.49569815397262573,
-0.15546277165412903,
0.22362808883190155,
-0.14730407297611237,
-0.0612272173166275,
0.03952353447675705,
0.41697603464126587,
-0.08370544016361237,
-0.17331603169441223,
-0.15758492052555084,
0.3264070153236389,
-0.5189425945281982,
-0.29281753301620483,
-0.7594944834709167,
-0.23616018891334534,
-0.31298601627349854,
-0.01547195017337799,
-0.11078659445047379,
-0.01650312729179859,
0.5567769408226013,
-0.08199509978294373,
-0.13365396857261658,
0.5849176049232483,
-0.00012444569438230246,
0.09813326597213745,
0.325181245803833,
-0.1256597340106964,
-0.460321843624115,
-0.4501070976257324,
-0.5075221061706543,
-0.04947996884584427,
0.342632919549942,
-0.2649558186531067,
-0.22699138522148132,
-0.02266940474510193,
-0.20636218786239624,
-0.26146939396858215,
0.22590000927448273,
0.2926192581653595,
0.06352707743644714,
0.04147574305534363,
-0.24727490544319153,
-0.12424582988023758,
0.2525103986263275,
0.16999275982379913,
-0.31044676899909973,
-0.10983189940452576,
-0.0843174010515213,
0.1739819496870041,
0.115984246134758,
0.246537446975708,
0.06933007389307022,
0.3401448130607605,
-0.09772966057062149,
0.27474433183670044,
-0.44295579195022583,
-0.30450326204299927,
0.3036515414714813,
0.27497419714927673,
0.33984997868537903,
-0.09174447506666183,
-0.15154629945755005,
-0.3225499987602234,
0.04159775748848915,
-0.40115973353385925,
0.07133543491363525,
0.387668639421463,
-0.09019455313682556,
0.13969245553016663,
-0.24744659662246704,
0.0599140040576458,
0.08498725295066833,
0.06739382445812225,
-0.34357553720474243,
0.6945255994796753,
-0.19372719526290894,
0.2074732780456543,
0.09745092689990997,
0.21376238763332367,
0.5437455773353577,
-0.2621800899505615,
-0.26694455742836,
0.02907807007431984,
-0.3628293573856354,
-0.17181749641895294,
-0.11991290003061295,
0.08861076086759567,
-0.05177865922451019,
0.10248702019453049,
0.19631236791610718,
0.07157434523105621,
-0.07909110933542252,
0.1310100257396698,
0.295804888010025,
0.27413812279701233,
0.30775174498558044,
0.4119047522544861,
-0.09864670038223267,
0.0760243609547615,
-0.32787173986434937,
-0.048028364777565,
-0.001570319291204214,
0.08814831078052521,
0.044861193746328354,
-0.05804530531167984,
0.1930096596479416,
-0.15830792486667633,
-0.34440669417381287,
-0.1840529590845108,
-0.5183023810386658,
-0.05679762735962868,
0.18667632341384888,
0.3126015365123749,
-0.057276103645563126,
-0.05592627078294754,
-0.354478120803833,
0.13482868671417236,
-0.09550537914037704,
-0.06617718189954758,
-0.27493977546691895,
0.0778159350156784,
-0.22990307211875916,
0.16313114762306213,
0.24062417447566986,
0.07998371124267578,
0.3387073278427124,
-0.15259161591529846,
-0.09169872105121613,
-0.20259103178977966,
0.22808004915714264,
-0.5900962352752686,
0.4591183662414551,
0.3485632836818695,
0.322277307510376,
0.19129987061023712,
0.09807904064655304,
-0.06643876433372498,
-0.11651470512151718,
0.40295711159706116,
-0.2699320614337921,
-0.30505043268203735,
0.1691550612449646,
0.08497282862663269,
-0.36639708280563354,
0.07941876351833344,
-0.2584613263607025,
0.2686915993690491,
0.2266366183757782,
0.09614801406860352,
0.116398885846138,
-0.044144727289676666,
-0.4369967579841614,
-0.0590527318418026,
0.3124624490737915,
0.2948288917541504,
-0.40841785073280334,
-0.15548095107078552,
-0.19026635587215424,
0.2188364863395691,
0.2140790820121765,
0.039862602949142456,
-0.2395050972700119,
0.13191357254981995,
-0.31537649035453796,
0.339974045753479,
0.36054617166519165,
-0.08714301139116287,
-0.28352484107017517,
0.27717605233192444,
0.02157067507505417,
0.051359616219997406,
0.045185334980487823,
0.001894175773486495,
0.40757855772972107,
0.17925827205181122,
0.32888922095298767,
0.11442890018224716,
-0.277324378490448,
-0.1597403734922409,
-0.21468716859817505,
-0.2300063967704773,
0.14334803819656372,
0.08126772940158844,
0.3348296880722046,
0.019803784787654877,
-0.06643287092447281,
-0.055202338844537735,
0.3579738438129425,
0.06299582868814468,
0.2749549150466919,
0.2020432949066162,
0.38939327001571655,
-0.10761493444442749,
0.00985419936478138,
-0.13989496231079102,
-0.2623066306114197,
0.18024903535842896,
0.19841952621936798,
0.032301925122737885,
-0.09464076161384583,
-0.21395879983901978,
-0.27696865797042847,
-0.06465348601341248,
-0.3802936375141144,
-0.34071287512779236,
-0.007410448044538498,
0.04010311886668205,
0.14360567927360535,
0.03535967692732811,
-0.16226644814014435,
0.5844069719314575,
0.010358063504099846,
0.23156893253326416,
-0.04590031877160072,
0.5272764563560486,
0.1391591876745224,
-0.18831568956375122,
-0.25429898500442505,
0.24488955736160278,
0.1367235779762268,
-0.22673125565052032,
-0.09857919812202454,
0.3551601469516754,
0.19091132283210754,
-0.10770177841186523,
-0.018954552710056305,
-0.3879106044769287,
0.36793044209480286,
-0.1755170375108719,
-0.06996028870344162,
0.039205409586429596,
0.32653751969337463,
-0.22484388947486877,
-0.14713835716247559,
0.5041161179542542,
-0.2933383584022522,
0.3285695016384125,
-0.048002004623413086,
-0.060219451785087585,
0.033606819808483124,
-0.15479294955730438,
-0.014488906599581242,
-0.20785953104496002,
-0.30487486720085144,
-0.47259441018104553,
0.3259235620498657,
0.11505359411239624,
-0.23027418553829193,
0.30690228939056396,
0.45012807846069336,
0.18789534270763397,
0.018809497356414795,
-0.273870050907135,
-0.3083896040916443,
-0.08579044044017792,
0.30470481514930725,
0.5613517761230469,
0.5491411089897156,
0.15597791969776154,
0.3771388828754425,
-0.1911429613828659,
0.2594592869281769,
-0.12601476907730103,
0.2184944450855255,
0.08677744120359421,
0.45059603452682495,
0.11120869219303131,
0.0040067033842206,
-0.11209239810705185,
-0.08219808340072632,
-0.01643349975347519,
0.2886066734790802,
0.05698010325431824,
-0.02536882273852825,
-0.02909444272518158,
-0.34939467906951904,
-0.1848786175251007,
-0.22904202342033386,
-0.30247825384140015,
0.2572636008262634,
-0.36932092905044556,
-0.17483501136302948,
0.04548458382487297,
0.05361809954047203,
0.06456361711025238,
-0.1782747209072113,
-0.00041247904300689697,
0.10945956408977509,
-0.02403617836534977,
0.08019118010997772,
-0.08923602104187012,
-0.29914358258247375,
0.05944173410534859,
-0.13191625475883484,
0.27296194434165955,
-0.035263389348983765,
0.01795181818306446,
-0.13117772340774536,
0.047845564782619476,
-0.088417649269104,
0.3439832627773285,
-0.30981969833374023,
0.23396910727024078,
0.0029203221201896667,
0.004765771329402924,
-0.39752471446990967,
-0.15477587282657623,
0.1998273879289627,
0.013015149161219597,
-0.1557433307170868,
-0.13878938555717468,
0.2697182595729828,
0.014482342638075352,
-0.34016120433807373,
-0.34217220544815063,
-0.17960962653160095,
-0.1125277429819107,
-0.19471357762813568,
-0.21049542725086212,
0.017559215426445007,
-0.027923479676246643,
0.06466647982597351,
0.290225088596344,
0.38150283694267273,
-0.4983845055103302,
-0.09541371464729309,
-0.20462669432163239,
0.4170759916305542,
-0.24865464866161346,
-0.14073976874351501,
0.20690181851387024,
-0.22430519759655,
0.10000395774841309,
0.12041103094816208,
-0.31144779920578003,
0.02751518040895462,
-0.1803901195526123,
0.09840711951255798,
-0.01622004806995392,
-0.23459841310977936,
0.2713417410850525,
-0.012016236782073975,
0.041447095572948456,
-0.15432925522327423,
-0.21206523478031158,
0.09873269498348236,
-0.01921483874320984,
0.33800700306892395,
-0.09952322393655777,
0.04858492314815521,
0.08729994297027588,
0.7695260047912598,
0.13026170432567596,
-0.059040192514657974,
0.18568286299705505,
-0.08036447316408157,
0.2944346070289612,
-0.21485725045204163,
-0.3306839168071747,
0.08523521572351456,
0.05046932399272919,
-0.24846668541431427,
0.3751794695854187,
0.02609683945775032,
-0.29598215222358704,
-0.066269151866436,
0.07879707217216492,
-0.34889674186706543,
-0.4114096164703369,
0.08448724448680878,
-0.30409207940101624,
0.0734923779964447,
0.1738441288471222,
0.24606209993362427,
0.13766348361968994,
-0.057431794703006744,
-0.3457048535346985,
0.09352092444896698,
-0.04771517962217331,
-0.027255618944764137,
-0.11815179884433746,
-0.11205596476793289,
-0.2812517583370209,
0.10497695952653885,
0.24536669254302979,
0.11614599078893661,
0.06747116148471832,
-0.10294443368911743,
0.09770567715167999,
0.09310648590326309,
0.8047714233398438,
0.09511753916740417,
0.025557322427630424,
0.151276096701622,
-0.054395049810409546,
0.02894994430243969,
-0.15431012213230133,
-0.26612505316734314,
0.5942182540893555,
0.0351533368229866,
0.10796236246824265,
-0.16307705640792847,
-0.07575792074203491,
0.2782523036003113,
-0.07358729839324951,
-0.07772161811590195,
0.045204322785139084,
-0.09727048873901367,
-0.20698308944702148,
0.28163328766822815,
0.06954116374254227,
0.05133633315563202,
0.2702436149120331,
-0.2625232934951782,
-0.42139363288879395,
-0.22107478976249695,
-0.32219403982162476,
0.3461489975452423,
0.17229107022285461,
0.4645673334598541,
0.03602408990263939,
0.29995855689048767,
-0.1496410220861435,
0.06853701174259186,
0.30583396553993225,
0.5060018301010132,
-0.10830055177211761,
-0.013205252587795258,
0.19948074221611023,
-0.4382297694683075,
0.30788370966911316,
0.3851029872894287,
-0.07737045735120773,
0.15445315837860107,
-0.39619138836860657,
0.10846377164125443,
0.30414608120918274,
0.26518380641937256,
-0.15415380895137787,
0.05012565478682518,
-0.46727293729782104,
-0.3593151569366455,
0.14451120793819427,
0.06732974946498871,
0.047844380140304565,
0.1550256609916687,
0.16608308255672455,
-0.3851066827774048,
0.40258169174194336,
-0.13885769248008728,
0.661878228187561,
0.11134371906518936,
0.021626818925142288,
0.17099392414093018,
0.05425291508436203,
0.3996337652206421,
-0.06529229134321213,
0.35721874237060547,
-0.16940107941627502,
-0.23355047404766083,
-0.1278267800807953,
0.02708587422966957,
0.07717246562242508,
0.26908302307128906,
-0.3201320469379425,
0.22860825061798096,
0.06354393064975739,
0.19253244996070862,
-0.07434353232383728,
-0.22570675611495972,
-0.081624336540699,
-0.03382140398025513,
-0.12141783535480499,
0.06666750460863113,
-0.1046583503484726,
0.16964612901210785,
-0.06408482789993286,
-0.1659601330757141,
-0.3470739722251892,
-0.12024351209402084,
-0.119652658700943,
0.04153800755739212,
-0.44315123558044434,
0.10550083965063095,
0.12743499875068665,
-0.6294227838516235,
-0.03955130651593208,
0.15331825613975525,
0.13932359218597412,
0.019738780334591866,
0.017457183450460434,
0.29151424765586853,
0.07161153107881546,
0.03809231147170067,
-0.27087172865867615,
-0.23284414410591125,
0.34164226055145264,
0.10643494874238968,
-0.2811030447483063,
-0.10119061917066574,
-0.37898579239845276,
-0.10364564508199692,
0.31492897868156433,
0.40814685821533203,
0.07453767955303192,
-0.3411482274532318,
-0.3092536926269531,
0.27133190631866455,
0.11638446152210236,
-0.21940375864505768,
0.028471559286117554,
-0.0930437296628952,
-0.33960163593292236,
0.18922141194343567,
0.21316957473754883,
-0.3500846028327942,
-0.10382692515850067,
0.05063213035464287,
0.21588772535324097,
0.38808533549308777,
0.5702496767044067,
-0.12574653327465057,
0.1827218234539032,
-0.27409476041793823,
0.2483842968940735,
0.3024665117263794,
-0.12163960188627243,
0.22115838527679443,
-0.21847717463970184,
0.09177929162979126,
0.2944124937057495,
0.20367473363876343,
0.12760579586029053,
0.4597964286804199,
-0.3011159598827362,
-0.3193517029285431,
0.07558940351009369,
0.159555584192276,
-0.014854073524475098,
0.3178521394729614,
-0.04851815104484558,
0.23643378913402557,
0.12218065559864044,
0.04928592965006828,
-0.17078647017478943,
0.336376816034317,
-0.28652411699295044,
0.29143476486206055,
-0.10167217999696732,
-0.00842520222067833,
0.3236617147922516,
-0.18913114070892334,
-0.046891577541828156,
0.18726609647274017,
0.09758871048688889,
-0.1881626546382904,
-0.122406005859375,
0.1336728036403656,
0.015345350839197636,
0.13907407224178314,
-0.38998934626579285,
0.09576105326414108,
-0.18077661097049713,
-0.23373675346374512,
0.33089902997016907,
0.04813356697559357,
0.04548793286085129,
0.10501828044652939,
0.46176382899284363,
0.3260040283203125,
-0.569064736366272,
0.14535993337631226,
0.08051130175590515,
0.24164582788944244,
0.02840360999107361,
0.15276558697223663,
0.18099822103977203,
0.2765830457210541,
0.2391919642686844,
-0.24241477251052856,
-0.07348178327083588,
-0.34848982095718384,
0.24557921290397644,
-0.2719377875328064,
0.22615084052085876,
-0.15227524936199188,
0.2825799286365509,
0.21281354129314423,
0.11779773235321045,
-0.005254063755273819,
-0.03581055998802185,
0.08979777246713638,
-0.047761186957359314,
0.31347405910491943,
0.16524054110050201,
0.23374062776565552,
0.187296062707901,
0.5071592926979065,
0.13275408744812012,
0.27626949548721313,
-0.13462910056114197,
0.13269346952438354,
0.3872716426849365,
0.14475704729557037,
0.42358821630477905,
0.25311079621315,
-0.2026652693748474,
0.25136956572532654,
0.15731801092624664,
-0.224624902009964,
0.04825558513402939,
0.4973715543746948,
-0.01091746985912323,
0.8306033611297607,
0.231443852186203,
0.10095550864934921,
0.19607678055763245,
-0.35824522376060486,
-0.08705577254295349,
0.13867005705833435,
-0.16643455624580383,
-0.035975903272628784,
0.04350053519010544,
0.6147770285606384,
-0.5687759518623352,
-0.32207101583480835,
0.033976852893829346,
-0.07651567459106445,
-0.23277872800827026,
-0.024697517976164818,
0.149242103099823,
-0.20994094014167786,
-0.41547515988349915,
-0.07665181905031204,
0.21041293442249298,
-0.20033974945545197,
0.17734046280384064,
-0.040449269115924835,
-0.15988098084926605,
-0.0455554723739624,
0.09016389399766922,
0.45650485157966614,
0.036321695894002914,
-0.09833960235118866,
0.28441280126571655,
-0.16423197090625763,
-0.14713214337825775,
-0.006801549345254898,
0.05630766600370407,
0.1897607296705246,
0.09891542792320251,
-0.2804592251777649,
-0.09777490049600601,
0.28842705488204956,
-0.32117390632629395,
-0.05765998363494873,
0.0006045419722795486,
0.0949133038520813,
-0.2591904103755951,
0.21110659837722778,
0.1038462445139885,
-0.11999332159757614,
0.36417344212532043,
0.2107378989458084,
0.17873042821884155,
-0.3844689130783081,
0.25865235924720764,
-0.19007720053195953,
-0.13950391113758087,
-0.1266792118549347,
-0.1292676031589508,
-0.41500312089920044,
0.021703990176320076,
0.11240880191326141,
-0.37070950865745544,
0.06452736258506775,
0.13969838619232178,
-0.008870978839695454,
-0.17478467524051666,
0.31115326285362244,
0.11717909574508667,
-0.03756454586982727,
-0.2863928973674774,
-0.2873172163963318,
-0.4279896020889282,
-0.04481416195631027,
-0.16814076900482178,
-0.02446475252509117,
-0.2829696834087372,
0.4049312472343445,
-0.02744419127702713,
-0.009082511067390442,
-0.03409132361412048,
0.0970262661576271,
0.39578405022621155,
0.031071187928318977,
-0.5145772099494934,
-0.23154760897159576,
-0.28651922941207886,
-0.23518094420433044,
0.011683635413646698,
-0.38047927618026733,
-0.09941285848617554,
0.019452359527349472,
-0.20521891117095947,
0.0983181893825531,
-0.40676695108413696,
0.1684652864933014,
-0.039140745997428894,
0.12931190431118011,
0.11729494482278824,
0.4498709440231323,
0.12424331158399582,
0.3546868562698364,
-0.0034436024725437164,
-0.16453292965888977,
-0.05914869159460068,
0.19025710225105286,
0.2555549144744873,
0.4428933560848236,
-0.10553937405347824,
0.21475045382976532,
0.1136973574757576,
0.09093812853097916,
0.28215211629867554,
0.016334202140569687,
-0.05826505273580551,
0.12550482153892517,
-0.5242892503738403,
0.14758628606796265,
0.33404025435447693,
0.4287835359573364,
-0.2159585952758789,
-0.19258445501327515,
-0.07725173979997635,
-0.23645660281181335,
0.16474489867687225,
-0.28816846013069153,
-0.26009464263916016,
-0.3044416010379791,
0.06443366408348083,
0.5333265662193298,
-0.3095368444919586,
-0.609013557434082,
-0.37601515650749207,
0.2566225230693817,
-0.341664582490921,
-0.05024071782827377,
0.06837137043476105,
0.2078637033700943,
0.06428948044776917,
-0.18902242183685303,
0.29286596179008484,
0.1276470273733139,
-0.15941068530082703,
-0.07449859380722046,
-0.2763882577419281
] |
https://github.com/huggingface/datasets/issues/676 | train_test_split returns empty dataset item | We'll do a release pretty soon to include the fix :)
In the meantime you can install the lib from source if you want to | I try to split my dataset by `train_test_split`, but after that the item in `train` and `test` `Dataset` is empty.
The codes:
```
yelp_data = datasets.load_from_disk('/home/ssd4/huanglianzhe/test_yelp')
print(yelp_data[0])
yelp_data = yelp_data.train_test_split(test_size=0.1)
print(yelp_data)
print(yelp_data['test'])
print(yelp_data['test'][0])
```
The outputs:
```
{'stars': 2.0, 'text': 'xxxx'}
Loading cached split indices for dataset at /home/ssd4/huanglianzhe/test_yelp/cache-f9b22d8b9d5a7346.arrow and /home/ssd4/huanglianzhe/test_yelp/cache-4aa26fa4005059d1.arrow
DatasetDict({'train': Dataset(features: {'stars': Value(dtype='float64', id=None), 'text': Value(dtype='string', id=None)}, num_rows: 7219009), 'test': Dataset(features: {'stars': Value(dtype='float64', id=None), 'text': Value(dtype='string', id=None)}, num_rows: 802113)})
Dataset(features: {'stars': Value(dtype='float64', id=None), 'text': Value(dtype='string', id=None)}, num_rows: 802113)
{} # yelp_data['test'][0] is empty
``` | 25 | train_test_split returns empty dataset item
I try to split my dataset by `train_test_split`, but after that the item in `train` and `test` `Dataset` is empty.
The codes:
```
yelp_data = datasets.load_from_disk('/home/ssd4/huanglianzhe/test_yelp')
print(yelp_data[0])
yelp_data = yelp_data.train_test_split(test_size=0.1)
print(yelp_data)
print(yelp_data['test'])
print(yelp_data['test'][0])
```
The outputs:
```
{'stars': 2.0, 'text': 'xxxx'}
Loading cached split indices for dataset at /home/ssd4/huanglianzhe/test_yelp/cache-f9b22d8b9d5a7346.arrow and /home/ssd4/huanglianzhe/test_yelp/cache-4aa26fa4005059d1.arrow
DatasetDict({'train': Dataset(features: {'stars': Value(dtype='float64', id=None), 'text': Value(dtype='string', id=None)}, num_rows: 7219009), 'test': Dataset(features: {'stars': Value(dtype='float64', id=None), 'text': Value(dtype='string', id=None)}, num_rows: 802113)})
Dataset(features: {'stars': Value(dtype='float64', id=None), 'text': Value(dtype='string', id=None)}, num_rows: 802113)
{} # yelp_data['test'][0] is empty
```
We'll do a release pretty soon to include the fix :)
In the meantime you can install the lib from source if you want to | [
-0.11764197051525116,
-0.0009297430515289307,
-0.13349345326423645,
0.2837666869163513,
0.03164158761501312,
0.24874547123908997,
0.5152361392974854,
0.5261701941490173,
0.06058869883418083,
0.08247885853052139,
0.02234886959195137,
0.3803648352622986,
-0.17831765115261078,
0.11841759830713272,
-0.026684097945690155,
-0.14557133615016937,
0.02817082405090332,
0.3949722349643707,
-0.0627409964799881,
-0.10580971091985703,
-0.10679008811712265,
0.3772622346878052,
-0.38724714517593384,
-0.12330025434494019,
-0.526898205280304,
-0.21725405752658844,
-0.14498932659626007,
0.061209600418806076,
-0.11482196301221848,
-0.22095651924610138,
0.544196367263794,
-0.1443571001291275,
-0.17980735003948212,
0.46627962589263916,
-0.00011744927905965596,
0.1740998774766922,
0.3488703966140747,
-0.09596402943134308,
-0.21316279470920563,
-0.5335098505020142,
-0.16031357645988464,
-0.10664945095777512,
0.259299099445343,
-0.20851179957389832,
-0.2019205391407013,
-0.34704330563545227,
-0.3203679621219635,
-0.5306894779205322,
0.1431894302368164,
0.32920825481414795,
0.09062656760215759,
0.08884827792644501,
0.05276872590184212,
-0.03301788866519928,
0.42774105072021484,
0.04493243247270584,
-0.21402494609355927,
-0.28421953320503235,
-0.09641991555690765,
0.17499057948589325,
0.14093290269374847,
0.24964363873004913,
0.03746775537729263,
0.1979113519191742,
0.06350912153720856,
0.23129378259181976,
-0.3535767197608948,
-0.2968398928642273,
0.06744340062141418,
0.3545723855495453,
0.38350585103034973,
-0.12859708070755005,
-0.20916341245174408,
-0.23601216077804565,
-0.01954885572195053,
-0.28497421741485596,
0.030417822301387787,
0.3383016884326935,
-0.05159807205200195,
0.14506979286670685,
-0.19331467151641846,
-0.12446308881044388,
-0.043320536613464355,
0.13513579964637756,
-0.1743128001689911,
0.6467148065567017,
-0.13172756135463715,
0.2141457200050354,
0.2832026183605194,
0.21900495886802673,
0.15265901386737823,
-0.15408289432525635,
-0.38446366786956787,
0.022012297064065933,
-0.3630774915218353,
-0.1830715537071228,
-0.09044482558965683,
-0.24179339408874512,
-0.04043668508529663,
0.4139624834060669,
0.09015919268131256,
0.15479706227779388,
-0.06777031719684601,
0.051500432193279266,
0.3399355411529541,
0.2884170114994049,
0.3791084587574005,
0.5538811683654785,
-0.03623833507299423,
-0.022138629108667374,
-0.07989855855703354,
-0.07834620773792267,
0.07994450628757477,
-0.1314549744129181,
-0.0016994662582874298,
0.03217063844203949,
0.13062362372875214,
-0.1279749721288681,
-0.2455855906009674,
-0.11675641685724258,
-0.34254202246665955,
-0.12768447399139404,
0.10072221606969833,
0.3022538423538208,
-0.05588807910680771,
0.24497389793395996,
-0.2102755755186081,
0.17572517693042755,
-0.1284891813993454,
-0.07826896011829376,
-0.2893948554992676,
0.22244945168495178,
-0.16350966691970825,
-0.057765476405620575,
0.22495411336421967,
0.03339746594429016,
0.35610973834991455,
-0.11955896019935608,
-0.02934955060482025,
-0.16980119049549103,
0.3367895483970642,
-0.31617552042007446,
0.37819716334342957,
0.395426481962204,
0.16838054358959198,
0.2080933153629303,
0.1540403664112091,
0.210333451628685,
-0.18062244355678558,
0.35901713371276855,
-0.2874218225479126,
-0.4169856905937195,
0.013352032750844955,
0.15239278972148895,
-0.2529548406600952,
0.07378928363323212,
-0.10685660690069199,
0.15312233567237854,
0.2022404670715332,
0.0466020442545414,
0.10703103989362717,
-0.025301121175289154,
-0.11903920769691467,
-0.1371486634016037,
0.4137607514858246,
0.177073672413826,
-0.49471017718315125,
-0.16796913743019104,
-0.23876531422138214,
0.007785959169268608,
0.06884738802909851,
0.03161444142460823,
-0.2810124158859253,
0.17524637281894684,
-0.18409310281276703,
0.5340542197227478,
0.49033981561660767,
-0.19696775078773499,
-0.2827196717262268,
0.4055517613887787,
0.014620594680309296,
-0.038233693689107895,
0.057095982134342194,
0.11378972232341766,
0.30040132999420166,
0.2838880717754364,
-0.006330326199531555,
0.2280917763710022,
-0.1854342222213745,
-0.275822252035141,
-0.11093465238809586,
-0.25209933519363403,
0.28524667024612427,
0.08681169152259827,
0.4078785181045532,
-0.17183804512023926,
-0.07489032298326492,
0.06387501955032349,
0.3752991259098053,
0.04288911819458008,
0.386907696723938,
0.3386222720146179,
0.37467050552368164,
0.13015881180763245,
0.07550974190235138,
-0.2861390709877014,
-0.27707231044769287,
0.1796780824661255,
-0.02271019108593464,
-0.10480707883834839,
-0.12082728743553162,
-0.2206858992576599,
-0.21144771575927734,
-0.034458912909030914,
-0.44248685240745544,
-0.42504721879959106,
0.023358862847089767,
-0.059285759925842285,
0.18250174820423126,
-0.004158850759267807,
-0.33732110261917114,
0.24888741970062256,
0.024419793859124184,
0.31483951210975647,
-0.2052736133337021,
0.4214242994785309,
0.03706806153059006,
-0.1337922364473343,
-0.29615911841392517,
0.259088397026062,
0.06291384994983673,
-0.37507861852645874,
-0.026638593524694443,
0.6311466693878174,
0.07723841071128845,
-0.06423693895339966,
-0.05264703929424286,
-0.48101216554641724,
0.3369104266166687,
-0.2955012023448944,
-0.04804055392742157,
0.21484287083148956,
0.24246905744075775,
-0.2903490960597992,
-0.19272685050964355,
0.4654698967933655,
-0.2564731538295746,
0.42910081148147583,
-0.05696156248450279,
0.039722979068756104,
-0.02869103103876114,
-0.1467878818511963,
-0.051579996943473816,
-0.22082984447479248,
-0.24955837428569794,
-0.7266795039176941,
0.38874363899230957,
0.032217394560575485,
-0.09846682846546173,
0.07363379001617432,
0.47301095724105835,
0.14017848670482635,
0.024096310138702393,
-0.24172767996788025,
-0.27939504384994507,
-0.10141207277774811,
0.12618859112262726,
0.4395979940891266,
0.4393755793571472,
0.1826654076576233,
0.3304138481616974,
-0.29301735758781433,
0.20541654527187347,
-0.11256007105112076,
0.2705599367618561,
0.10463681071996689,
0.2017993927001953,
0.15774624049663544,
-0.29343798756599426,
-0.19676648080348969,
-0.07214314490556717,
0.05297377333045006,
0.21975897252559662,
0.06669354438781738,
-0.07156042754650116,
-0.15146175026893616,
-0.38760581612586975,
0.07152023911476135,
-0.13230401277542114,
-0.44928425550460815,
0.08364187180995941,
-0.33697837591171265,
-0.14128045737743378,
-0.15199406445026398,
-0.0507250539958477,
0.19813291728496552,
-0.2802031338214874,
-0.16477562487125397,
0.1501639485359192,
-0.1726745218038559,
0.07824863493442535,
-0.08235392719507217,
-0.2641966640949249,
0.10762713849544525,
-0.10392329841852188,
0.16381783783435822,
0.021665146574378014,
0.07507139444351196,
-0.16811491549015045,
-0.06799497455358505,
-0.15775689482688904,
0.12247611582279205,
-0.2915969491004944,
0.04571878910064697,
0.22565606236457825,
0.09564528614282608,
-0.05324963107705116,
-0.05175714194774628,
0.2858191728591919,
-0.16032156348228455,
-0.13625383377075195,
0.008937731385231018,
0.2589617073535919,
0.01628485694527626,
-0.49510857462882996,
-0.6609776020050049,
-0.13932561874389648,
-0.2159169465303421,
-0.06390859186649323,
-0.16771094501018524,
0.005694031715393066,
-0.18053998053073883,
0.1855221688747406,
0.33429625630378723,
0.23621585965156555,
-0.3171781897544861,
0.04761652275919914,
-0.15196074545383453,
0.465696781873703,
-0.22784671187400818,
-0.11767686903476715,
0.2646730840206146,
-0.08193790912628174,
0.1152106523513794,
0.09290789812803268,
-0.4088464379310608,
0.2679082751274109,
-0.14812879264354706,
0.1757383644580841,
-0.00957714393734932,
-0.07698002457618713,
0.28215160965919495,
-0.009366314858198166,
-0.034418828785419464,
-0.20359820127487183,
-0.0834064781665802,
0.22351819276809692,
-0.17554238438606262,
0.2848981022834778,
0.01680758036673069,
0.24703237414360046,
0.15835291147232056,
0.7831037640571594,
0.12922567129135132,
0.03278752416372299,
0.21755771338939667,
0.005259715020656586,
0.35141512751579285,
-0.19184985756874084,
-0.28532883524894714,
-0.02295372262597084,
-0.015840113162994385,
0.013161782175302505,
0.22414422035217285,
0.061985600739717484,
-0.1975041627883911,
-0.0958135575056076,
0.118919238448143,
-0.2726309299468994,
-0.22777873277664185,
0.12940828502178192,
-0.4907448887825012,
0.002703741192817688,
-0.03133434057235718,
0.22328081727027893,
0.16109219193458557,
-0.010503207333385944,
-0.09476244449615479,
0.05390511080622673,
-0.021863766014575958,
0.04882524535059929,
-0.44012337923049927,
-0.072062648832798,
-0.15266001224517822,
0.17048123478889465,
0.06500805169343948,
0.1534886658191681,
-0.016931094229221344,
-0.1147250160574913,
0.10633819550275803,
-0.017278898507356644,
0.8683214783668518,
0.032638512551784515,
-0.03981725126504898,
0.12152305245399475,
0.021967768669128418,
-0.05440482869744301,
-0.07755991816520691,
-0.19116725027561188,
0.4157629609107971,
0.07896924018859863,
0.11878979206085205,
-0.32467180490493774,
-0.09662973880767822,
0.33753645420074463,
-0.0949484184384346,
-0.06620978564023972,
0.05255965515971184,
-0.09842407703399658,
-0.1475110650062561,
0.12388825416564941,
-0.03771170228719711,
0.08679236471652985,
0.33343374729156494,
-0.15762077271938324,
-0.39919424057006836,
-0.11034432053565979,
-0.4536967873573303,
0.337624192237854,
-0.09191861748695374,
0.6031654477119446,
-0.2223280519247055,
0.22155556082725525,
0.03387756273150444,
0.06203767657279968,
0.1631195843219757,
0.6068790555000305,
-0.20228661596775055,
-0.05292269587516785,
0.12676429748535156,
-0.41224542260169983,
0.3593851923942566,
0.289872944355011,
-0.12252004444599152,
0.23480263352394104,
-0.11028766632080078,
0.1477237045764923,
0.23324771225452423,
0.1892339438199997,
-0.016731474548578262,
-0.04788872227072716,
-0.2788281738758087,
-0.6171294450759888,
0.13847599923610687,
0.05987158045172691,
0.18848855793476105,
0.30240198969841003,
0.21271510422229767,
-0.3137111961841583,
0.3486142158508301,
-0.2725934386253357,
0.5921763777732849,
0.22799190878868103,
0.043874964118003845,
0.08876830339431763,
-0.05578548088669777,
0.25631457567214966,
-0.2995692491531372,
0.272804856300354,
-0.16608354449272156,
0.10475430637598038,
-0.1470033824443817,
0.028578590601682663,
0.18565982580184937,
0.4128018021583557,
-0.2262180745601654,
0.2714932858943939,
-0.022459346801042557,
0.18707852065563202,
-0.22468896210193634,
0.0352175310254097,
-0.13607560098171234,
-0.0008032340556383133,
0.10771235078573227,
0.10704047977924347,
-0.1398870199918747,
0.10704337060451508,
0.05063936114311218,
-0.18953673541545868,
-0.26015663146972656,
-0.21907804906368256,
-0.186104416847229,
0.12155122309923172,
-0.20751388370990753,
0.33872145414352417,
0.08845961093902588,
-0.5442288517951965,
-0.0861145555973053,
0.037626735866069794,
0.1340201199054718,
0.06930488348007202,
0.04167654365301132,
0.3390548527240753,
0.029671669006347656,
-0.014150870963931084,
-0.2532435953617096,
0.012505593709647655,
0.3496003746986389,
0.07549971342086792,
-0.39106613397598267,
0.07255091518163681,
-0.47228753566741943,
-0.34724515676498413,
0.18755492568016052,
0.3271017074584961,
0.29453569650650024,
-0.2646558880805969,
-0.3012765645980835,
0.21098387241363525,
0.0776398628950119,
-0.20295313000679016,
0.08602632582187653,
0.05153455585241318,
-0.39472413063049316,
0.10029558837413788,
0.08735276758670807,
-0.33912259340286255,
-0.15449951589107513,
-0.0792509987950325,
0.24470803141593933,
0.2802990674972534,
0.5937024354934692,
0.05682653561234474,
0.10118292272090912,
-0.3393918573856354,
0.185322105884552,
0.5490463376045227,
-0.2614414095878601,
0.2128620445728302,
-0.09051395952701569,
-0.010297968983650208,
0.19036929309368134,
-0.024782638996839523,
0.11517845094203949,
0.5119803547859192,
-0.31697335839271545,
-0.34215664863586426,
0.08631083369255066,
0.23749397695064545,
-0.033224280923604965,
0.5423038005828857,
-0.100819431245327,
0.1273094117641449,
0.07387850433588028,
0.1382208913564682,
-0.19983939826488495,
0.2956888675689697,
-0.1303071826696396,
0.2745501399040222,
-0.15111301839351654,
-0.004665195941925049,
0.30170226097106934,
-0.14071175456047058,
0.02484958805143833,
0.09274134039878845,
0.05468510091304779,
-0.1928480863571167,
-0.11493653059005737,
0.14513155817985535,
-0.11808931082487106,
0.13058532774448395,
-0.3208774924278259,
-0.004567818716168404,
-0.23572924733161926,
-0.17905326187610626,
0.2752932012081146,
-0.048818737268447876,
0.0758122131228447,
0.35235795378685,
0.5218027234077454,
0.18119554221630096,
-0.4933087229728699,
0.13703271746635437,
0.018110200762748718,
0.17431187629699707,
-0.10674258321523666,
0.12286502122879028,
0.18761268258094788,
0.18680855631828308,
0.01542595587670803,
-0.1866954267024994,
-0.037675902247428894,
-0.2877112925052643,
0.2938874661922455,
-0.2934231162071228,
0.1822543889284134,
-0.09721673280000687,
0.4907478392124176,
0.2497202605009079,
0.0945032462477684,
0.17801649868488312,
-0.0638175681233406,
0.16877038776874542,
-0.06991147994995117,
0.2082051932811737,
0.04419994726777077,
0.2500334680080414,
0.08920522034168243,
0.2784087657928467,
0.12071193754673004,
0.2616215646266937,
-0.10540451109409332,
0.2577393054962158,
0.3951510787010193,
-0.1394706666469574,
0.5480868816375732,
0.37803635001182556,
-0.2128000557422638,
0.029831310734152794,
0.17678725719451904,
-0.10687907040119171,
0.04985015466809273,
0.5641690492630005,
-0.035095132887363434,
0.7496698498725891,
0.3097228407859802,
0.11787174642086029,
0.02203962206840515,
-0.2546597421169281,
-0.26424890756607056,
0.06672339141368866,
-0.13936342298984528,
-0.012874394655227661,
0.12379135936498642,
0.7728578448295593,
-0.5248379111289978,
-0.42856737971305847,
0.05507636070251465,
-0.130867138504982,
-0.21592828631401062,
-0.02935837209224701,
0.03613051772117615,
-0.18240231275558472,
-0.361747145652771,
-0.16158427298069,
0.3612843453884125,
-0.22261007130146027,
0.2184952348470688,
-0.020275793969631195,
-0.17488877475261688,
-0.23738829791545868,
0.19771206378936768,
0.23622167110443115,
-0.022026628255844116,
-0.18970735371112823,
0.16117779910564423,
0.06878817081451416,
-0.2228153944015503,
0.14814475178718567,
-0.012922393158078194,
0.1751764565706253,
0.16933298110961914,
-0.255038321018219,
-0.0734550952911377,
0.19559621810913086,
-0.3825569748878479,
-0.02587774023413658,
0.10705408453941345,
0.06102457642555237,
-0.24998386204242706,
0.16379201412200928,
0.14916376769542694,
-0.14306263625621796,
0.266872376203537,
0.16771264374256134,
0.49396681785583496,
-0.4116894006729126,
0.507523238658905,
-0.24296867847442627,
-0.3146922290325165,
-0.14249618351459503,
-0.17372280359268188,
-0.5078582167625427,
-0.16966494917869568,
0.1771787703037262,
-0.21130642294883728,
-0.09215321391820908,
-0.14027974009513855,
0.023840874433517456,
-0.08353793621063232,
0.23161092400550842,
0.0506574772298336,
-0.1956672966480255,
-0.24340036511421204,
-0.1726277619600296,
-0.5613913536071777,
-0.04894005507230759,
-0.13074204325675964,
0.04380590468645096,
-0.11139701306819916,
0.4335915148258209,
0.007165834307670593,
-0.05716267228126526,
0.24733902513980865,
0.05031796544790268,
0.2724483609199524,
-0.008422039449214935,
-0.44934433698654175,
-0.04241131618618965,
-0.18914587795734406,
0.012154646217823029,
0.0634557232260704,
-0.3176320195198059,
-0.11263641715049744,
-0.004128945525735617,
-0.184409499168396,
0.05831165239214897,
-0.3946796953678131,
0.38097065687179565,
0.05568860471248627,
0.12410689145326614,
0.010963698849081993,
0.3038924038410187,
0.13610577583312988,
0.2473125159740448,
-0.14199811220169067,
-0.1855759471654892,
-0.0968349426984787,
0.19470232725143433,
0.1502644121646881,
0.5261263847351074,
-0.17524994909763336,
-0.00804896280169487,
-0.11474847793579102,
0.051640648394823074,
0.10265344381332397,
-0.009280777536332607,
-0.07566852867603302,
0.16264109313488007,
-0.40663379430770874,
0.06792514771223068,
0.35181674361228943,
0.36145031452178955,
-0.1492455005645752,
-0.28772905468940735,
-0.08490218222141266,
-0.3186243772506714,
0.16442319750785828,
-0.20444972813129425,
-0.23822972178459167,
-0.1468770056962967,
-0.010474219918251038,
0.5484179258346558,
-0.21997608244419098,
-0.7831655144691467,
-0.2817847728729248,
0.25487297773361206,
-0.1522161364555359,
0.005790524184703827,
-0.07955390214920044,
0.15202893316745758,
0.1231079250574112,
-0.11093954741954803,
0.19920767843723297,
0.12010884284973145,
-0.07767647504806519,
0.10514643788337708,
-0.38980358839035034
] |
https://github.com/huggingface/datasets/issues/674 | load_dataset() won't download in Windows | I have the same issue. Tried to download a few of them and not a single one is downloaded successfully.
This is the output:
```
>>> dataset = load_dataset('blended_skill_talk', split='train')
Using custom data configuration default <-- This step never ends
``` | I don't know if this is just me or Windows. Maybe other Windows users can chime in if they don't have this problem. I've been trying to get some of the tutorials working on Windows, but when I use the load_dataset() function, it just stalls and the script keeps running indefinitely without downloading anything. I've waited upwards of 18 hours to download the 'multi-news' dataset (which isn't very big), and still nothing. I've tried running it through different IDE's and the command line, but it had the same behavior. I've also tried it with all virus and malware protection turned off. I've made sure python and all IDE's are exceptions to the firewall and all the requisite permissions are enabled.
Additionally, I checked to see if other packages could download content such as an nltk corpus, and they could. I've also run the same script using Ubuntu and it downloaded fine (and quickly). When I copied the downloaded datasets from my Ubuntu drive to my Windows .cache folder it worked fine by reusing the already-downloaded dataset, but it's cumbersome to do that for every dataset I want to try in my Windows environment.
Could this be a bug, or is there something I'm doing wrong or not thinking of?
Thanks. | 41 | load_dataset() won't download in Windows
I don't know if this is just me or Windows. Maybe other Windows users can chime in if they don't have this problem. I've been trying to get some of the tutorials working on Windows, but when I use the load_dataset() function, it just stalls and the script keeps running indefinitely without downloading anything. I've waited upwards of 18 hours to download the 'multi-news' dataset (which isn't very big), and still nothing. I've tried running it through different IDE's and the command line, but it had the same behavior. I've also tried it with all virus and malware protection turned off. I've made sure python and all IDE's are exceptions to the firewall and all the requisite permissions are enabled.
Additionally, I checked to see if other packages could download content such as an nltk corpus, and they could. I've also run the same script using Ubuntu and it downloaded fine (and quickly). When I copied the downloaded datasets from my Ubuntu drive to my Windows .cache folder it worked fine by reusing the already-downloaded dataset, but it's cumbersome to do that for every dataset I want to try in my Windows environment.
Could this be a bug, or is there something I'm doing wrong or not thinking of?
Thanks.
I have the same issue. Tried to download a few of them and not a single one is downloaded successfully.
This is the output:
```
>>> dataset = load_dataset('blended_skill_talk', split='train')
Using custom data configuration default <-- This step never ends
``` | [
-0.4348374605178833,
0.26388904452323914,
-0.09682497382164001,
0.3132835328578949,
0.2672566771507263,
0.307550311088562,
0.3540584146976471,
0.1106313169002533,
0.4425588846206665,
-0.016528651118278503,
0.11968876421451569,
-0.10646166652441025,
-0.06712810695171356,
0.2139160931110382,
0.14057086408138275,
-0.10026329755783081,
0.01856386661529541,
-0.033099859952926636,
0.05957429111003876,
-0.14802046120166779,
-0.2890073359012604,
0.12175790965557098,
-0.4512638449668884,
-0.1942235380411148,
-0.14553560316562653,
0.10021419078111649,
-0.155009463429451,
0.09381774067878723,
-0.12853269279003143,
-0.2223111242055893,
0.46474021673202515,
0.16812580823898315,
0.2233545482158661,
0.5532972812652588,
-0.00011731475387932733,
-0.16890236735343933,
0.42345649003982544,
-0.08146008849143982,
-0.24167627096176147,
-0.22214199602603912,
0.06862190365791321,
-0.2787032127380371,
0.038405247032642365,
-0.043393176048994064,
0.03275250643491745,
0.3367926776409149,
0.04142032563686371,
-0.20548255741596222,
-0.00615595281124115,
0.3664604425430298,
0.14257167279720306,
0.0846242606639862,
0.09113530814647675,
0.01081681065261364,
0.04764581471681595,
0.107876256108284,
-0.19965140521526337,
0.48184385895729065,
0.17043843865394592,
-0.461063414812088,
0.25283414125442505,
-0.05239549279212952,
-0.20029006898403168,
0.12531834840774536,
0.009417176246643066,
0.028177350759506226,
-0.05430663377046585,
-0.5504899024963379,
0.18587985634803772,
0.30462613701820374,
0.6023483276367188,
0.017699772492051125,
-0.1578364372253418,
-0.12045122683048248,
0.25289249420166016,
-0.026048623025417328,
0.20374807715415955,
0.5219998359680176,
-0.400789350271225,
-0.025911595672369003,
-0.30002522468566895,
-0.15212565660476685,
-0.0877070277929306,
0.3059648871421814,
-0.03307187184691429,
0.04288514330983162,
0.01643560081720352,
0.2268964648246765,
0.24884462356567383,
0.07214957475662231,
0.19175218045711517,
-0.12819461524486542,
0.06827908754348755,
0.027902860194444656,
-0.18093232810497284,
0.3298543691635132,
-0.05043847858905792,
0.2989702820777893,
-0.04181257262825966,
0.1580296754837036,
-0.06019115447998047,
0.17408877611160278,
0.33215048909187317,
0.045965395867824554,
0.2691093385219574,
-0.09944222867488861,
0.2820906341075897,
-0.025282882153987885,
0.32458925247192383,
0.12110518664121628,
-0.08285941183567047,
0.06675001233816147,
-0.5012167096138,
-0.19456824660301208,
0.052375148981809616,
-0.08698618412017822,
0.19551582634449005,
-0.33772048354148865,
-0.2771073281764984,
0.06880869716405869,
0.14458107948303223,
-0.18221502006053925,
-0.050096962600946426,
0.2808069884777069,
-0.10145734250545502,
0.47883275151252747,
0.15403802692890167,
0.24526438117027283,
-0.2062825858592987,
-0.11908454447984695,
0.12727007269859314,
-0.06922560930252075,
-0.3084923326969147,
0.17795129120349884,
0.7094913721084595,
-0.052917350083589554,
0.06639645993709564,
-0.1264294534921646,
0.10030178725719452,
-0.06244175136089325,
0.09064687043428421,
-0.25854557752609253,
-0.022772088646888733,
0.18668967485427856,
0.15990598499774933,
0.42593953013420105,
0.004159826785326004,
-0.03524525463581085,
-0.16026821732521057,
0.2484571635723114,
-0.16962209343910217,
-0.0448932908475399,
0.2376052588224411,
0.09821989387273788,
-0.18630002439022064,
-0.23930612206459045,
-0.17904067039489746,
0.1990799754858017,
-0.035463087260723114,
-0.040819209069013596,
-0.06093791872262955,
-0.2394402176141739,
-0.2222970873117447,
-0.24710491299629211,
0.2509647309780121,
0.6065976023674011,
-0.47335484623908997,
0.1334773153066635,
-0.012821132317185402,
-0.019493866711854935,
-0.01895904541015625,
0.1573493629693985,
-0.2292906492948532,
0.28509360551834106,
-0.336142361164093,
-0.03349274396896362,
0.08890827000141144,
-0.2796664834022522,
-0.33361005783081055,
0.4279622435569763,
-0.0389762818813324,
0.1260470449924469,
-0.05037989467382431,
0.19549210369586945,
0.16094283759593964,
-0.020893549546599388,
0.10184632986783981,
0.40222346782684326,
-0.00857587344944477,
-0.10347321629524231,
-0.1004042774438858,
-0.18584713339805603,
0.379128098487854,
0.4151972830295563,
-0.05853709205985069,
0.11647747457027435,
-0.0023768246173858643,
0.14774882793426514,
0.20852968096733093,
0.2583530843257904,
0.1554790437221527,
0.39215338230133057,
-0.10043385624885559,
0.194047212600708,
0.05739099159836769,
-0.004082215949892998,
-0.5138208866119385,
0.22986018657684326,
0.38143351674079895,
-0.1514693647623062,
0.10525581985712051,
-0.027796391397714615,
-0.22604283690452576,
0.0215201023966074,
-0.08434826135635376,
-0.21461528539657593,
-0.02228963002562523,
0.09550043195486069,
0.3066937029361725,
0.03422022983431816,
-0.012139897793531418,
0.49032899737358093,
-0.16654673218727112,
0.006617499049752951,
-0.213478684425354,
0.23660801351070404,
0.09097357839345932,
-0.21065504848957062,
0.20857059955596924,
-0.06998487561941147,
0.10915318131446838,
-0.07186470925807953,
-0.15703153610229492,
0.2500486373901367,
-0.0906805694103241,
0.0076133087277412415,
0.051250532269477844,
0.011530086398124695,
0.08149821311235428,
-0.3572998344898224,
0.20506450533866882,
0.3924577832221985,
0.2962709069252014,
-0.3245432674884796,
-0.2591126561164856,
0.058097705245018005,
-0.260672926902771,
0.3367082476615906,
-0.00533178448677063,
0.0617842897772789,
-0.03745191544294357,
-0.0032225139439105988,
-0.16172873973846436,
0.21749189496040344,
0.5736044049263,
-0.1049073338508606,
0.036355193704366684,
-0.11448277533054352,
-0.13938242197036743,
0.1269524097442627,
0.4384438097476959,
-0.13173609972000122,
-0.068915955722332,
0.18833479285240173,
-0.2489185631275177,
0.10895965248346329,
-0.09102798998355865,
-0.026656989008188248,
0.63242506980896,
0.10772838443517685,
0.3119974136352539,
0.009793683886528015,
-0.10675010085105896,
-0.38979044556617737,
0.0751156434416771,
0.005439937114715576,
-0.12852022051811218,
0.22428864240646362,
-0.29077330231666565,
-0.03530413657426834,
-0.15672403573989868,
-0.06047692149877548,
0.255126416683197,
0.15563149750232697,
-0.2544584572315216,
0.15046687424182892,
-0.15790364146232605,
0.031115740537643433,
-0.15536445379257202,
-0.1548650860786438,
-0.20510607957839966,
-0.16029229760169983,
-0.38464921712875366,
0.412201464176178,
0.23283284902572632,
-0.152404323220253,
-0.5157058835029602,
0.18874815106391907,
0.11207590997219086,
-0.37641724944114685,
-0.08607787638902664,
-0.09693211317062378,
-0.34954264760017395,
-0.042215291410684586,
0.36895522475242615,
0.1660793423652649,
0.17400342226028442,
-0.2884269058704376,
-0.016038306057453156,
-0.164129838347435,
0.16841503977775574,
-0.14080068469047546,
-0.04904637485742569,
0.21242569386959076,
-0.16797205805778503,
0.5251681804656982,
-0.03272531181573868,
-0.014831498265266418,
0.16399846971035004,
-0.3974747657775879,
0.14880219101905823,
0.138905331492424,
0.27361422777175903,
-0.15332069993019104,
-0.09004206210374832,
-0.3636281192302704,
-0.2869463860988617,
-0.32583481073379517,
0.17192266881465912,
-0.05167510360479355,
-0.013603560626506805,
-0.017034657299518585,
0.17062371969223022,
0.0451982356607914,
0.07077977061271667,
0.016116958111524582,
-0.11327601224184036,
-0.1930202841758728,
0.6751167178153992,
-0.1407323032617569,
-0.6298112869262695,
0.4133816957473755,
0.17274725437164307,
-0.11266367137432098,
0.22657105326652527,
-0.5824320912361145,
0.42298752069473267,
-0.18375134468078613,
0.10286962985992432,
0.1750199794769287,
0.16299764811992645,
0.026215054094791412,
-0.4262455105781555,
0.12260027229785919,
-0.009976599365472794,
-0.335233598947525,
-0.18605250120162964,
0.003644423559308052,
0.32595294713974,
0.13158932328224182,
0.18665942549705505,
-0.19264456629753113,
0.2649831175804138,
0.122291699051857,
0.10345783829689026,
0.11602063477039337,
-0.09099995344877243,
0.44768187403678894,
0.07329756021499634,
-0.3743332624435425,
0.3017483651638031,
-0.4511120021343231,
0.020877264440059662,
0.2434290498495102,
0.09602940082550049,
-0.35618868470191956,
-0.42754995822906494,
0.20479907095432281,
-0.06768206506967545,
-0.25237929821014404,
0.30474618077278137,
-0.28455400466918945,
0.03419969603419304,
0.015500389039516449,
0.3321448266506195,
0.2220669835805893,
-0.34625503420829773,
0.1259208470582962,
0.3952532410621643,
-0.13813161849975586,
0.11016200482845306,
-0.3709639608860016,
-0.11675896495580673,
-0.35218602418899536,
0.0027282312512397766,
-0.2510644495487213,
0.5077357888221741,
-0.27207422256469727,
-0.01533615030348301,
0.09533998370170593,
-0.09608511626720428,
0.6394128203392029,
-0.2933664917945862,
-0.006724361330270767,
0.27665889263153076,
0.25271907448768616,
-0.41011422872543335,
-0.28635573387145996,
-0.32170385122299194,
0.18134325742721558,
-0.0756407380104065,
-0.09838181734085083,
-0.09398254752159119,
-0.008134528994560242,
-0.03194964677095413,
0.32586827874183655,
-0.05180588364601135,
-0.15613141655921936,
-0.3686888515949249,
-0.41208332777023315,
-0.24254603683948517,
-0.0851675495505333,
0.05890640616416931,
-0.02595660835504532,
-0.48369109630584717,
0.06092706695199013,
0.004513131454586983,
0.12620773911476135,
0.18180042505264282,
-0.24909308552742004,
0.1585993468761444,
0.20355470478534698,
0.3336896300315857,
0.2094847559928894,
0.18141719698905945,
-0.051099807024002075,
0.612655520439148,
0.031911544501781464,
-0.007444269955158234,
0.3563106656074524,
-0.3362620770931244,
0.10009640455245972,
0.4206357002258301,
-0.0016220207326114178,
-0.2973085343837738,
0.10307424515485764,
0.08748240023851395,
-0.34811052680015564,
0.1405719518661499,
0.36113545298576355,
-0.07280543446540833,
-0.3170991539955139,
-0.5456187725067139,
0.2885628640651703,
-0.010203477926552296,
0.08214959502220154,
0.23554089665412903,
-0.2802583575248718,
-0.06978566944599152,
-0.16362608969211578,
-0.2875610589981079,
0.7914929986000061,
-0.12767988443374634,
0.31570422649383545,
-0.03158010542392731,
-0.06011486425995827,
0.031163038685917854,
-0.14870378375053406,
0.05795842409133911,
0.07187522947788239,
0.007645994424819946,
-0.1388120949268341,
-0.11172354221343994,
0.17396578192710876,
0.44949567317962646,
-0.23615659773349762,
0.3529340922832489,
-0.042516499757766724,
0.16884371638298035,
-0.08212966471910477,
0.258441299200058,
-0.23623239994049072,
-0.33957725763320923,
-0.06566467136144638,
0.09500245004892349,
0.1114189624786377,
0.5089240074157715,
-0.1955382525920868,
0.0628194808959961,
-0.009482424706220627,
-0.03540067374706268,
-0.41297072172164917,
0.4149443805217743,
-0.10619643330574036,
-0.034864842891693115,
-0.3620472550392151,
-0.20522534847259521,
0.08474542200565338,
0.12917053699493408,
0.12053204327821732,
0.04696909338235855,
-0.356038361787796,
0.24666200578212738,
-0.08131583780050278,
-0.2004200667142868,
0.03798463195562363,
-0.2179812490940094,
0.05813004821538925,
0.03613291680812836,
-0.364395409822464,
0.12395122647285461,
-0.14064152538776398,
-0.055450595915317535,
-0.2276134192943573,
0.027103614062070847,
0.16074618697166443,
-0.1537749171257019,
-0.19512221217155457,
-0.013088427484035492,
0.09296470880508423,
0.034946221858263016,
0.05345035344362259,
0.20126202702522278,
0.045881327241659164,
0.4033927023410797,
-0.01456550881266594,
-0.13532355427742004,
-0.150363489985466,
0.5252746939659119,
-0.2151467204093933,
-0.43878331780433655,
0.3159072995185852,
0.5385574698448181,
-0.22981156408786774,
-0.2972063422203064,
0.08392078429460526,
0.07406043261289597,
-0.29201367497444153,
-0.11278042942285538,
0.10281213372945786,
0.34486252069473267,
0.08636049181222916,
-0.0468953438103199,
-0.006444878876209259,
-0.4304710626602173,
0.1015971451997757,
-0.5667567849159241,
0.021595722064375877,
0.06656359881162643,
0.39426910877227783,
0.09728455543518066,
-0.1676267683506012,
-0.40795016288757324,
0.625030517578125,
-0.11905772984027863,
-0.19076544046401978,
0.08880163729190826,
-0.004999406635761261,
-0.048406973481178284,
0.40716755390167236,
0.1431884765625,
0.19612568616867065,
-0.026603469625115395,
-0.04632963240146637,
-0.058707334101200104,
0.18660074472427368,
-0.07859760522842407,
-0.011876520700752735,
0.19348101317882538,
-0.10281824320554733,
0.04628778249025345,
0.09895894676446915,
-0.6630383133888245,
-0.26475033164024353,
0.03983105719089508,
0.22571150958538055,
0.12033509463071823,
-0.16302290558815002,
0.09663830697536469,
-0.17203344404697418,
0.3454066216945648,
-0.19902537763118744,
0.2333974689245224,
-0.3064645826816559,
0.6293858885765076,
0.07038526237010956,
0.052866946905851364,
0.3849899470806122,
0.16811764240264893,
-0.3313407301902771,
-0.013224124908447266,
-0.059145644307136536,
-0.09364534169435501,
0.30788296461105347,
-0.42581766843795776,
0.3199900984764099,
-0.18572789430618286,
0.2074412852525711,
0.8582127690315247,
-0.26585379242897034,
0.047888316214084625,
0.3950185179710388,
0.07714734971523285,
-0.06449519842863083,
0.023460540920495987,
0.06660352647304535,
-0.14021311700344086,
-0.0744289755821228,
0.15237842500209808,
0.0200662724673748,
-0.3098987936973572,
-0.2634478807449341,
0.0498906672000885,
0.43441733717918396,
0.2207411229610443,
-0.13677670061588287,
0.4721739888191223,
0.11968116462230682,
0.052788808941841125,
-0.06614861637353897,
0.2855158746242523,
-0.11070419102907181,
0.40601134300231934,
0.09349029511213303,
0.20147095620632172,
-0.019468624144792557,
0.43254539370536804,
-0.253136545419693,
-0.29093408584594727,
-0.04869596287608147,
0.09347449988126755,
0.03261896222829819,
0.21332988142967224,
-0.2366548776626587,
0.3340224623680115,
-0.456348717212677,
-0.24568842351436615,
-0.4532689154148102,
-0.014410123229026794,
0.15489916503429413,
-0.012460521422326565,
-0.1058921217918396,
-0.1668461263179779,
-0.1983262002468109,
0.17387789487838745,
0.12102822959423065,
-0.34097880125045776,
0.4674230217933655,
0.17776040732860565,
0.01789582520723343,
-0.4753955006599426,
0.024921245872974396,
-0.07880935072898865,
-0.0989113375544548,
-0.19485411047935486,
0.18536481261253357,
-0.15799157321453094,
0.05071389675140381,
0.12327910959720612,
0.05517443269491196,
0.23491710424423218,
0.3727570176124573,
-0.2836599051952362,
0.30193883180618286,
0.06946128606796265,
-0.05891998112201691,
-0.007292572408914566,
0.5686400532722473,
0.19958718121051788,
0.06618571281433105,
0.23642002046108246,
0.045125462114810944,
-0.06777600198984146,
-0.0304131917655468,
0.06954985857009888,
-0.14416149258613586,
-0.25723010301589966,
0.06173679232597351,
-0.08031980693340302,
0.10837284475564957,
-0.2424013912677765,
-0.17584145069122314,
-0.4169378876686096,
-0.34382858872413635,
0.3497326076030731,
-0.13432782888412476,
0.09095001220703125,
-0.2353842854499817,
0.00506378710269928,
0.03404880315065384,
0.6027305126190186,
0.27920761704444885,
0.527239978313446,
-0.11413577944040298,
-0.18821117281913757,
-0.9585393667221069,
0.023473113775253296,
-0.2382194995880127,
-0.20910866558551788,
0.01927160657942295,
0.222942516207695,
0.03036743775010109,
0.45728540420532227,
0.01156006008386612,
0.07616021484136581,
0.1781708002090454,
0.38216543197631836,
-0.3112042546272278,
-0.19285006821155548,
0.00627538189291954,
0.4389107823371887,
-0.1827264428138733,
-0.4216965436935425,
0.2759922444820404,
-0.13900348544120789,
-0.16366147994995117,
-0.05137941241264343,
-0.1799183189868927,
0.09345671534538269,
0.13998036086559296,
0.45474597811698914,
-0.18626272678375244,
0.5130953788757324,
0.1956939399242401,
-0.05694460868835449,
-0.4508405327796936,
0.09851015359163284,
0.16231657564640045,
0.17845791578292847,
-0.056932296603918076,
-0.2573370337486267,
-0.415976881980896,
0.17619669437408447,
-0.06339378654956818,
-0.0654212236404419,
0.09872947633266449,
0.10025321692228317,
-0.13805168867111206,
-0.20788085460662842,
0.08004126697778702,
0.26791512966156006,
0.11122169345617294,
0.23258888721466064,
-0.24637120962142944,
-0.17652779817581177,
-0.2108059525489807,
0.005175769329071045,
0.23235775530338287,
-0.22490805387496948,
-0.33844155073165894,
-0.1001187339425087,
0.1650857925415039,
-0.3213372528553009,
0.22276756167411804,
-0.3573560118675232,
0.1331167221069336,
0.12652701139450073,
-0.07167117297649384,
-0.30023521184921265,
0.31312501430511475,
-0.32080078125,
0.017322111874818802,
-0.023627182468771935,
0.2866988778114319,
-0.09395209699869156,
-0.19676408171653748,
0.06334073841571808,
-0.14575627446174622
] |
https://github.com/huggingface/datasets/issues/674 | load_dataset() won't download in Windows | This was fixed in #644
I'll do a new release soon :)
In the meantime you can run it by installing from source | I don't know if this is just me or Windows. Maybe other Windows users can chime in if they don't have this problem. I've been trying to get some of the tutorials working on Windows, but when I use the load_dataset() function, it just stalls and the script keeps running indefinitely without downloading anything. I've waited upwards of 18 hours to download the 'multi-news' dataset (which isn't very big), and still nothing. I've tried running it through different IDE's and the command line, but it had the same behavior. I've also tried it with all virus and malware protection turned off. I've made sure python and all IDE's are exceptions to the firewall and all the requisite permissions are enabled.
Additionally, I checked to see if other packages could download content such as an nltk corpus, and they could. I've also run the same script using Ubuntu and it downloaded fine (and quickly). When I copied the downloaded datasets from my Ubuntu drive to my Windows .cache folder it worked fine by reusing the already-downloaded dataset, but it's cumbersome to do that for every dataset I want to try in my Windows environment.
Could this be a bug, or is there something I'm doing wrong or not thinking of?
Thanks. | 23 | load_dataset() won't download in Windows
I don't know if this is just me or Windows. Maybe other Windows users can chime in if they don't have this problem. I've been trying to get some of the tutorials working on Windows, but when I use the load_dataset() function, it just stalls and the script keeps running indefinitely without downloading anything. I've waited upwards of 18 hours to download the 'multi-news' dataset (which isn't very big), and still nothing. I've tried running it through different IDE's and the command line, but it had the same behavior. I've also tried it with all virus and malware protection turned off. I've made sure python and all IDE's are exceptions to the firewall and all the requisite permissions are enabled.
Additionally, I checked to see if other packages could download content such as an nltk corpus, and they could. I've also run the same script using Ubuntu and it downloaded fine (and quickly). When I copied the downloaded datasets from my Ubuntu drive to my Windows .cache folder it worked fine by reusing the already-downloaded dataset, but it's cumbersome to do that for every dataset I want to try in my Windows environment.
Could this be a bug, or is there something I'm doing wrong or not thinking of?
Thanks.
This was fixed in #644
I'll do a new release soon :)
In the meantime you can run it by installing from source | [
-0.5447326302528381,
0.29377633333206177,
-0.07057070732116699,
0.2974260747432709,
0.14205163717269897,
0.32118088006973267,
0.27409040927886963,
0.21087980270385742,
0.37623652815818787,
-0.03033946454524994,
0.1460884064435959,
-0.05348750203847885,
-0.0536382719874382,
0.09938105195760727,
0.1741904765367508,
-0.07834169268608093,
0.03861464560031891,
0.027394108474254608,
0.039845287799835205,
-0.11726389080286026,
-0.34608131647109985,
0.13436256349086761,
-0.5268455147743225,
-0.2473071664571762,
-0.11833685636520386,
0.1657862514257431,
-0.1818951517343521,
0.15490654110908508,
-0.1827930361032486,
-0.317129909992218,
0.4274269938468933,
0.27309802174568176,
0.28716686367988586,
0.5432711839675903,
-0.00011768103286158293,
-0.2694990932941437,
0.44582223892211914,
-0.08409582823514938,
-0.09096130728721619,
-0.14857415854930878,
0.020831741392612457,
-0.3754148781299591,
0.08241600543260574,
-0.08470125496387482,
0.004425399005413055,
0.29439055919647217,
0.10660050809383392,
-0.22473809123039246,
-0.07146380841732025,
0.3034384548664093,
0.14902473986148834,
0.058382563292980194,
0.1866413801908493,
-0.018245084211230278,
0.030929092317819595,
0.08228816092014313,
-0.21409939229488373,
0.3726803660392761,
0.1696050465106964,
-0.38381606340408325,
0.19258946180343628,
0.015572182834148407,
-0.23151688277721405,
0.1429762989282608,
0.012397192418575287,
-0.04771019145846367,
-0.050974100828170776,
-0.4643268287181854,
0.177708238363266,
0.26817548274993896,
0.7157576680183411,
-0.025896631181240082,
-0.15237843990325928,
0.06389162689447403,
0.17005720734596252,
0.00904807634651661,
0.2117130160331726,
0.44649776816368103,
-0.3004865348339081,
-0.00906088575720787,
-0.3201354146003723,
-0.20218800008296967,
-0.15525081753730774,
0.30067330598831177,
-0.019162315875291824,
0.17233267426490784,
0.015173636376857758,
0.24179086089134216,
0.25334063172340393,
0.12940850853919983,
0.24958549439907074,
-0.08429107815027237,
-0.019992712885141373,
0.08751701563596725,
-0.12029007077217102,
0.3168122470378876,
-0.001965656876564026,
0.4192122220993042,
-0.013759732246398926,
0.1223873496055603,
-0.08405199646949768,
0.20619744062423706,
0.3144579827785492,
0.0479620099067688,
0.34323039650917053,
-0.12326711416244507,
0.2831480801105499,
0.01932424306869507,
0.4794269800186157,
0.11237214505672455,
-0.028055712580680847,
0.03299864009022713,
-0.4569457471370697,
-0.17104798555374146,
0.04271344467997551,
-0.07705848664045334,
0.30073797702789307,
-0.4118880033493042,
-0.17136549949645996,
0.011237221769988537,
0.13278287649154663,
-0.23276031017303467,
-0.08352808654308319,
0.2520167827606201,
-0.09773384779691696,
0.5410683751106262,
0.13982951641082764,
0.21107637882232666,
-0.21468035876750946,
-0.09608759731054306,
0.13376477360725403,
-0.028248995542526245,
-0.37555500864982605,
0.1607370525598526,
0.6784368753433228,
-0.01893707364797592,
0.05834587663412094,
-0.11914131045341492,
0.06240168958902359,
0.0006960704922676086,
0.06455744802951813,
-0.23678962886333466,
-0.015065997838973999,
0.22976535558700562,
0.13993562757968903,
0.4387679994106293,
-0.028670702129602432,
-0.0200703926384449,
-0.227859228849411,
0.2863507866859436,
0.012334391474723816,
-0.05081505700945854,
0.17966791987419128,
0.0697396770119667,
-0.14417225122451782,
-0.12598158419132233,
-0.12649044394493103,
0.26900142431259155,
-0.0426495298743248,
-0.12828223407268524,
0.017034590244293213,
-0.20950211584568024,
-0.23951515555381775,
-0.2717230021953583,
0.22666889429092407,
0.6464570164680481,
-0.5141647458076477,
0.2695252001285553,
-0.09417323023080826,
-0.0030313897877931595,
0.013725623488426208,
0.0930570513010025,
-0.1872510462999344,
0.2323409914970398,
-0.2925848960876465,
-0.027940016239881516,
0.032958365976810455,
-0.3341713845729828,
-0.3295564353466034,
0.4202955365180969,
0.0340786874294281,
0.15630704164505005,
-0.07262232154607773,
0.2671046555042267,
0.08620210736989975,
-0.07142383605241776,
-0.005653321743011475,
0.4295675754547119,
-0.018306219950318336,
-0.06024300679564476,
-0.1239619106054306,
-0.16051284968852997,
0.3207067847251892,
0.3485832214355469,
-0.03975493088364601,
0.12625811994075775,
0.09981086850166321,
0.16406726837158203,
0.2192297875881195,
0.20194050669670105,
0.07952721416950226,
0.3887033462524414,
-0.08247919380664825,
0.1266225427389145,
0.1167503371834755,
0.007280588150024414,
-0.6006158590316772,
0.19969815015792847,
0.4054839611053467,
-0.08347748219966888,
0.1673303246498108,
-0.03952886909246445,
-0.20675691962242126,
-0.029362745583057404,
-0.0387592650949955,
-0.292513370513916,
-0.010643480345606804,
0.16209138929843903,
0.30401748418807983,
0.019823189824819565,
-0.030758172273635864,
0.4781760573387146,
-0.049363747239112854,
0.03208647668361664,
-0.28768566250801086,
0.12841901183128357,
0.002696918323636055,
-0.13078956305980682,
0.1691424697637558,
-0.15239515900611877,
0.1291792243719101,
-0.11728475987911224,
-0.14966067671775818,
0.3383616507053375,
-0.05261559784412384,
0.025300592184066772,
0.04241601750254631,
0.05792587995529175,
0.08084249496459961,
-0.4428679049015045,
0.2842029631137848,
0.4864928424358368,
0.2960576117038727,
-0.3706298768520355,
-0.3011002838611603,
0.017001859843730927,
-0.3206237852573395,
0.27084586024284363,
-0.0036835670471191406,
0.017848296090960503,
0.060815803706645966,
-0.02968793362379074,
-0.13015687465667725,
0.17815722525119781,
0.5836648941040039,
-0.10086135566234589,
0.022896599024534225,
-0.17002350091934204,
-0.15430687367916107,
0.10753435641527176,
0.3203771114349365,
-0.09164518117904663,
-0.028702735900878906,
0.154453307390213,
-0.272563099861145,
0.0527825802564621,
-0.08865997940301895,
-0.03968718647956848,
0.6740577220916748,
0.1207209974527359,
0.30307191610336304,
0.01419841218739748,
-0.04757377505302429,
-0.38791367411613464,
0.11168985068798065,
-0.054983168840408325,
-0.1497776061296463,
0.16571453213691711,
-0.30475690960884094,
-0.1206817701458931,
-0.21028247475624084,
-0.017445169389247894,
0.23169288039207458,
0.17713095247745514,
-0.20046822726726532,
0.0942751094698906,
-0.04442835599184036,
0.023813806474208832,
-0.06557364016771317,
-0.2384585589170456,
-0.15169017016887665,
-0.2049010843038559,
-0.3307042717933655,
0.48937657475471497,
0.2152121216058731,
-0.14643552899360657,
-0.5216553807258606,
0.1931723803281784,
0.13262158632278442,
-0.2481977790594101,
-0.19660267233848572,
-0.1243068277835846,
-0.3068206310272217,
-0.013387499377131462,
0.34230837225914,
0.1893697828054428,
0.15010817348957062,
-0.2650110125541687,
0.039942651987075806,
-0.24868130683898926,
0.047510772943496704,
-0.14282748103141785,
-0.025468267500400543,
0.26134371757507324,
-0.04541166126728058,
0.44177156686782837,
-0.0693356841802597,
-0.0001036766916513443,
0.14077027142047882,
-0.45534560084342957,
0.1400996446609497,
0.16914115846157074,
0.21934667229652405,
-0.23200879991054535,
-0.0794263482093811,
-0.31014662981033325,
-0.22507157921791077,
-0.3428764045238495,
0.20978201925754547,
-0.024521786719560623,
0.042883507907390594,
-0.014360061846673489,
0.11118121445178986,
0.019662749022245407,
0.11568737775087357,
-0.052617788314819336,
-0.1598748117685318,
-0.11811122298240662,
0.6609851717948914,
-0.2714056968688965,
-0.6282079219818115,
0.3548404574394226,
0.2915499210357666,
-0.10527287423610687,
0.19164907932281494,
-0.5835195183753967,
0.37445417046546936,
-0.19284462928771973,
0.09269389510154724,
0.19946137070655823,
0.19415633380413055,
-0.016679488122463226,
-0.3557729125022888,
0.10092511773109436,
-0.0099811851978302,
-0.18684253096580505,
-0.23140594363212585,
-0.04585818946361542,
0.2779677212238312,
0.19462844729423523,
0.10560894012451172,
-0.2316228747367859,
0.2021382451057434,
0.13124531507492065,
0.18423837423324585,
0.22698365151882172,
-0.0310878437012434,
0.5086902976036072,
0.03046415001153946,
-0.39043352007865906,
0.25418055057525635,
-0.4080337584018707,
-0.00015245750546455383,
0.2978043556213379,
0.12912511825561523,
-0.4621703326702118,
-0.4852897822856903,
0.17187927663326263,
-0.08588075637817383,
-0.22139906883239746,
0.2845761179924011,
-0.2263181209564209,
-0.019510000944137573,
0.019399527460336685,
0.258695125579834,
0.24116501212120056,
-0.44525134563446045,
0.15170376002788544,
0.4347313642501831,
-0.13991114497184753,
0.07232322543859482,
-0.3505477011203766,
-0.07895898818969727,
-0.43342387676239014,
0.11689935624599457,
-0.23709692060947418,
0.44806957244873047,
-0.1931825429201126,
-0.02726733312010765,
0.10925731062889099,
-0.12465041130781174,
0.6732802391052246,
-0.3448232412338257,
0.0033153407275676727,
0.31580230593681335,
0.18816755712032318,
-0.39024296402931213,
-0.2304421067237854,
-0.39010244607925415,
0.33556994795799255,
-0.09020636975765228,
-0.15917687118053436,
-0.11448891460895538,
0.005000120960175991,
0.018363693729043007,
0.23526138067245483,
-0.01442163810133934,
-0.16285651922225952,
-0.3745219111442566,
-0.45692387223243713,
-0.22275593876838684,
-0.08960380405187607,
0.07805377244949341,
-0.0599670372903347,
-0.4280759394168854,
0.12491753697395325,
-0.023453613743185997,
0.10708386451005936,
0.10481391847133636,
-0.15579096972942352,
0.18513131141662598,
0.1956195831298828,
0.27438321709632874,
0.2562500834465027,
0.1056017205119133,
-0.04241836071014404,
0.5449216365814209,
-0.02496476098895073,
0.01798262447118759,
0.3539716303348541,
-0.3520487844944,
0.08535589277744293,
0.36963793635368347,
0.008487447164952755,
-0.34541523456573486,
0.09238693863153458,
0.05833075940608978,
-0.37865230441093445,
-0.017613627016544342,
0.31957587599754333,
-0.053270068019628525,
-0.27358895540237427,
-0.5353898406028748,
0.3098926246166229,
-0.005707873031497002,
0.056516557931900024,
0.3623391389846802,
-0.25260502099990845,
-0.051508791744709015,
-0.14303374290466309,
-0.23951059579849243,
0.8468360304832458,
-0.1075577437877655,
0.24470506608486176,
-0.06184765696525574,
-0.015715554356575012,
0.08933356404304504,
-0.19361810386180878,
0.06762374937534332,
-0.004996847361326218,
-0.03296400234103203,
-0.11383528262376785,
-0.1157873272895813,
0.22381213307380676,
0.41724997758865356,
-0.4091870188713074,
0.2944084405899048,
-0.05926481634378433,
0.13477228581905365,
-0.12249019742012024,
0.30688396096229553,
-0.23431190848350525,
-0.28177934885025024,
-0.10046393424272537,
0.08915984630584717,
0.1238323524594307,
0.4508272409439087,
-0.282450407743454,
0.12021338194608688,
0.069091796875,
-0.11009922623634338,
-0.42865729331970215,
0.43421900272369385,
-0.006054322235286236,
0.0589018352329731,
-0.4166521430015564,
-0.07027377188205719,
0.06647394597530365,
0.17531199753284454,
0.17213286459445953,
0.06600562483072281,
-0.3955237567424774,
0.27198538184165955,
-0.035587988793849945,
-0.30012136697769165,
0.01646866649389267,
-0.1969321072101593,
0.040742386132478714,
0.0036634206771850586,
-0.3454321026802063,
0.12495958805084229,
-0.17693835496902466,
-0.2024332582950592,
-0.18819734454154968,
0.07656162977218628,
0.18636444211006165,
-0.11489395797252655,
-0.19538305699825287,
0.025334637612104416,
0.036690276116132736,
-0.011333482339978218,
0.058860618621110916,
0.25702619552612305,
-0.010469351895153522,
0.45437973737716675,
0.02971634268760681,
-0.15821892023086548,
-0.10850159823894501,
0.5431085228919983,
-0.09274273365736008,
-0.4721798300743103,
0.19217543303966522,
0.7148699760437012,
-0.26097574830055237,
-0.2856500744819641,
0.07895182818174362,
0.1166238933801651,
-0.289657860994339,
-0.08126342296600342,
0.10035284608602524,
0.33609604835510254,
0.18720275163650513,
0.014400344341993332,
-0.07884202897548676,
-0.3600307106971741,
0.036311086267232895,
-0.5694882273674011,
0.08124269545078278,
0.04865380376577377,
0.3408634066581726,
0.09798066318035126,
-0.13037291169166565,
-0.5350725054740906,
0.6288614869117737,
0.06652452796697617,
-0.2064329832792282,
0.05893518030643463,
-0.05282876640558243,
-0.000053340569138526917,
0.39577096700668335,
0.16048690676689148,
0.24608562886714935,
-0.01909077912569046,
-0.04771052300930023,
-0.028064653277397156,
0.11735381186008453,
-0.08099588751792908,
-0.029463544487953186,
0.22137227654457092,
-0.10124435275793076,
0.019801758229732513,
0.11082583665847778,
-0.6536310911178589,
-0.3515220284461975,
0.04452439397573471,
0.1947992891073227,
0.13923892378807068,
-0.19130416214466095,
0.08437809348106384,
-0.05719548836350441,
0.30194205045700073,
-0.1776508390903473,
0.24322369694709778,
-0.280022531747818,
0.6548902988433838,
0.008443381637334824,
0.11064289510250092,
0.2920009195804596,
0.08618530631065369,
-0.20776553452014923,
-0.0038365349173545837,
0.02584504336118698,
-0.03906381130218506,
0.27553123235702515,
-0.28310060501098633,
0.2741779386997223,
-0.19977818429470062,
0.221806600689888,
0.8365336656570435,
-0.2370651662349701,
0.038237810134887695,
0.3122194707393646,
0.06839890778064728,
-0.12330760806798935,
-0.05895773321390152,
0.03573640435934067,
-0.17187811434268951,
-0.06927285343408585,
0.12406962364912033,
-0.021872568875551224,
-0.365968257188797,
-0.2176697701215744,
0.0453309491276741,
0.5127401351928711,
0.18949727714061737,
-0.19037270545959473,
0.42638513445854187,
-0.04274925962090492,
0.013100944459438324,
-0.07166248559951782,
0.3250524699687958,
-0.11729017645120621,
0.44452035427093506,
0.10962969064712524,
0.17066209018230438,
0.05740692466497421,
0.40895313024520874,
-0.22464710474014282,
-0.23089493811130524,
0.061993300914764404,
0.15731772780418396,
0.061479464173316956,
0.1932947337627411,
-0.1953670084476471,
0.2428782880306244,
-0.43732160329818726,
-0.13045023381710052,
-0.47299477458000183,
0.06793228536844254,
0.20668044686317444,
-0.02044517546892166,
-0.1333402842283249,
-0.15688230097293854,
-0.1622096449136734,
0.20037229359149933,
0.08178979158401489,
-0.2086399644613266,
0.5919044613838196,
0.2108471840620041,
0.05599608272314072,
-0.44795188307762146,
0.1479145586490631,
-0.14660194516181946,
-0.08578457683324814,
-0.24709060788154602,
0.19833660125732422,
-0.07223966717720032,
0.13329103589057922,
0.07738248258829117,
0.17168432474136353,
0.20390428602695465,
0.44241341948509216,
-0.19392359256744385,
0.3094862401485443,
-0.001963729038834572,
-0.10577557981014252,
-0.011007922701537609,
0.5946027636528015,
0.20052988827228546,
0.03281528875231743,
0.18486590683460236,
0.019674966111779213,
-0.04719191789627075,
0.003944661468267441,
0.08078156411647797,
-0.11810730397701263,
-0.1192590594291687,
0.006073489785194397,
-0.05271442234516144,
0.05279106646776199,
-0.13061843812465668,
-0.1308090090751648,
-0.4362175464630127,
-0.3978845775127411,
0.3375803232192993,
-0.23684938251972198,
0.019778836518526077,
-0.27080392837524414,
0.007268665358424187,
0.08669297397136688,
0.6320140957832336,
0.3389939069747925,
0.5349494814872742,
-0.1189100369811058,
-0.27850252389907837,
-1.0058072805404663,
0.11988509446382523,
-0.19918392598628998,
-0.198390930891037,
0.024627448990941048,
0.22827889025211334,
0.054042793810367584,
0.5228111743927002,
0.05320136994123459,
0.07600019127130508,
0.2053552269935608,
0.3606358766555786,
-0.2714616358280182,
-0.08086767792701721,
0.11890290677547455,
0.41507774591445923,
-0.2541849911212921,
-0.44747644662857056,
0.30481746792793274,
-0.15015502274036407,
-0.14155803620815277,
-0.13385866582393646,
-0.21377384662628174,
0.15024299919605255,
0.19273120164871216,
0.43476402759552,
-0.17617394030094147,
0.46404340863227844,
0.09547730535268784,
-0.13095299899578094,
-0.40598100423812866,
0.09209991246461868,
0.1357540339231491,
0.11862069368362427,
-0.042712610214948654,
-0.2561984062194824,
-0.4338245689868927,
0.06246664375066757,
-0.05038869008421898,
-0.04367531090974808,
0.038626447319984436,
0.1462690532207489,
-0.19399204850196838,
-0.23057393729686737,
-0.08511742204427719,
0.2610265612602234,
0.03760445490479469,
0.20828238129615784,
-0.20890513062477112,
-0.17732036113739014,
-0.2015264332294464,
-0.019066382199525833,
0.2685919404029846,
-0.3023800253868103,
-0.31770414113998413,
-0.14646929502487183,
0.08728251606225967,
-0.4101589620113373,
0.13015250861644745,
-0.43165549635887146,
0.11057218164205551,
0.05621466040611267,
0.024149488657712936,
-0.29060548543930054,
0.25895869731903076,
-0.34561091661453247,
-0.029987148940563202,
-0.07505373656749725,
0.2575957775115967,
-0.022414807230234146,
-0.21488246321678162,
-0.052223943173885345,
-0.14089995622634888
] |
https://github.com/huggingface/datasets/issues/674 | load_dataset() won't download in Windows | Closing since version 1.1.0 got released with Windows support :)
Let me know if it works for you now | I don't know if this is just me or Windows. Maybe other Windows users can chime in if they don't have this problem. I've been trying to get some of the tutorials working on Windows, but when I use the load_dataset() function, it just stalls and the script keeps running indefinitely without downloading anything. I've waited upwards of 18 hours to download the 'multi-news' dataset (which isn't very big), and still nothing. I've tried running it through different IDE's and the command line, but it had the same behavior. I've also tried it with all virus and malware protection turned off. I've made sure python and all IDE's are exceptions to the firewall and all the requisite permissions are enabled.
Additionally, I checked to see if other packages could download content such as an nltk corpus, and they could. I've also run the same script using Ubuntu and it downloaded fine (and quickly). When I copied the downloaded datasets from my Ubuntu drive to my Windows .cache folder it worked fine by reusing the already-downloaded dataset, but it's cumbersome to do that for every dataset I want to try in my Windows environment.
Could this be a bug, or is there something I'm doing wrong or not thinking of?
Thanks. | 19 | load_dataset() won't download in Windows
I don't know if this is just me or Windows. Maybe other Windows users can chime in if they don't have this problem. I've been trying to get some of the tutorials working on Windows, but when I use the load_dataset() function, it just stalls and the script keeps running indefinitely without downloading anything. I've waited upwards of 18 hours to download the 'multi-news' dataset (which isn't very big), and still nothing. I've tried running it through different IDE's and the command line, but it had the same behavior. I've also tried it with all virus and malware protection turned off. I've made sure python and all IDE's are exceptions to the firewall and all the requisite permissions are enabled.
Additionally, I checked to see if other packages could download content such as an nltk corpus, and they could. I've also run the same script using Ubuntu and it downloaded fine (and quickly). When I copied the downloaded datasets from my Ubuntu drive to my Windows .cache folder it worked fine by reusing the already-downloaded dataset, but it's cumbersome to do that for every dataset I want to try in my Windows environment.
Could this be a bug, or is there something I'm doing wrong or not thinking of?
Thanks.
Closing since version 1.1.0 got released with Windows support :)
Let me know if it works for you now | [
-0.5312042236328125,
0.2285068929195404,
-0.057598695158958435,
0.26664912700653076,
0.1350669264793396,
0.32391873002052307,
0.256195992231369,
0.21989323198795319,
0.3572814464569092,
0.04361720383167267,
0.18822167813777924,
-0.0625392347574234,
-0.05459009110927582,
0.1764082908630371,
0.13570939004421234,
-0.08165919780731201,
0.09411002695560455,
0.02269633859395981,
0.02265959233045578,
-0.10132180154323578,
-0.3583260476589203,
0.17091292142868042,
-0.4910070300102234,
-0.18535669147968292,
-0.12041398882865906,
0.2017235904932022,
-0.21809974312782288,
0.1222667470574379,
-0.199578195810318,
-0.3122926652431488,
0.46546968817710876,
0.32619455456733704,
0.3328736424446106,
0.49563783407211304,
-0.0001170868199551478,
-0.23157423734664917,
0.48395460844039917,
-0.06907051801681519,
-0.13458219170570374,
-0.27162569761276245,
-0.007763981819152832,
-0.3620639443397522,
0.09496217221021652,
-0.0017414167523384094,
0.010947640985250473,
0.31782233715057373,
0.1540234237909317,
-0.21699437499046326,
-0.11874623596668243,
0.30162620544433594,
0.15001147985458374,
0.06509894877672195,
0.2076624184846878,
-0.023175125941634178,
0.11063680052757263,
0.09909313917160034,
-0.23762141168117523,
0.3654014468193054,
0.1448056697845459,
-0.3507414758205414,
0.16380290687084198,
0.0025700656697154045,
-0.19060787558555603,
0.07563036680221558,
0.09917491674423218,
-0.02577897533774376,
0.020676735788583755,
-0.49770399928092957,
0.1921178698539734,
0.21450799703598022,
0.7776691317558289,
-0.03208518028259277,
-0.19460448622703552,
0.048845261335372925,
0.143014594912529,
-0.03286002576351166,
0.24044063687324524,
0.4651780128479004,
-0.31277233362197876,
0.0017891637980937958,
-0.35490453243255615,
-0.17454546689987183,
-0.21470673382282257,
0.3462231159210205,
-0.003678496927022934,
0.18023064732551575,
0.03052348643541336,
0.2561664879322052,
0.280619740486145,
0.1594638079404831,
0.2893839180469513,
-0.11190922558307648,
-0.04387141391634941,
0.10559391975402832,
-0.15524141490459442,
0.29977473616600037,
0.026616938412189484,
0.41833481192588806,
0.01750827580690384,
0.15702572464942932,
-0.058756135404109955,
0.19470787048339844,
0.30712950229644775,
0.06661998480558395,
0.41804438829421997,
-0.06070389598608017,
0.3588196337223053,
-0.0342603400349617,
0.4944937825202942,
0.09606966376304626,
0.011860549449920654,
0.007107861340045929,
-0.4333910644054413,
-0.15317587554454803,
0.09003415703773499,
-0.08543550223112106,
0.2950436472892761,
-0.4243556559085846,
-0.15567483007907867,
0.03560177609324455,
0.14406812191009521,
-0.20665518939495087,
-0.12080413848161697,
0.25672799348831177,
-0.09023573249578476,
0.5926255583763123,
0.14802086353302002,
0.16927209496498108,
-0.23795707523822784,
-0.07935521751642227,
0.15351499617099762,
-0.02921440824866295,
-0.38962575793266296,
0.14843858778476715,
0.6411633491516113,
-0.06567743420600891,
0.02583361230790615,
-0.13476479053497314,
0.06253476440906525,
-0.04054541885852814,
0.08592656999826431,
-0.24068884551525116,
-0.04495830088853836,
0.24092930555343628,
0.13862523436546326,
0.4186854660511017,
-0.06177699193358421,
0.006727255880832672,
-0.22715315222740173,
0.29927095770835876,
-0.0781945064663887,
-0.08158333599567413,
0.1264634132385254,
0.0773238092660904,
-0.15318305790424347,
-0.17320409417152405,
-0.15458518266677856,
0.274750679731369,
-0.10347620397806168,
-0.14432409405708313,
-0.010416164994239807,
-0.17747759819030762,
-0.31238001585006714,
-0.2741757035255432,
0.1735447347164154,
0.6089104413986206,
-0.5470995306968689,
0.27602824568748474,
-0.034199994057416916,
-0.08766469359397888,
-0.010492131114006042,
0.0894189178943634,
-0.14162328839302063,
0.16393804550170898,
-0.29248183965682983,
-0.021529734134674072,
0.025942891836166382,
-0.3787801265716553,
-0.34754595160484314,
0.4641357362270355,
0.07498979568481445,
0.09119391441345215,
-0.02993009239435196,
0.2377227395772934,
0.15555830299854279,
-0.08652405440807343,
-0.046178802847862244,
0.4049775004386902,
-0.05077831447124481,
-0.0866379588842392,
-0.14867693185806274,
-0.15729966759681702,
0.26716893911361694,
0.35160714387893677,
-0.05584244802594185,
0.19070158898830414,
0.09277382493019104,
0.07837928831577301,
0.24005508422851562,
0.20202507078647614,
0.1472165584564209,
0.40376847982406616,
-0.12471634149551392,
0.043892815709114075,
0.15580697357654572,
-0.025399038568139076,
-0.6035889983177185,
0.20673266053199768,
0.34255629777908325,
-0.03173904865980148,
0.186675027012825,
-0.07063663005828857,
-0.24758031964302063,
-0.021713130176067352,
-0.07181151211261749,
-0.23025038838386536,
-0.018254775553941727,
0.14671573042869568,
0.2857326567173004,
-0.016386225819587708,
-0.05737283080816269,
0.4816446006298065,
0.00016180798411369324,
0.0678996667265892,
-0.30446740984916687,
0.14558807015419006,
-0.0020915549248456955,
-0.17647576332092285,
0.16405116021633148,
-0.1513473093509674,
0.12041482329368591,
-0.1093367338180542,
-0.1514495313167572,
0.3896583020687103,
-0.03681224584579468,
0.05815526843070984,
0.0491906963288784,
0.018419474363327026,
0.06879507750272751,
-0.37770166993141174,
0.2146209478378296,
0.47765156626701355,
0.2862357199192047,
-0.355785071849823,
-0.3085826635360718,
0.1224040612578392,
-0.29283273220062256,
0.268840491771698,
0.027913443744182587,
0.042954154312610626,
0.04131990671157837,
-0.001022789627313614,
-0.1258668154478073,
0.21515876054763794,
0.5775263905525208,
-0.09292182326316833,
-0.0020058713853359222,
-0.16433420777320862,
-0.1167263388633728,
0.07487351447343826,
0.24319185316562653,
-0.18324153125286102,
-0.09914267808198929,
0.18187427520751953,
-0.2656545042991638,
0.04652786999940872,
-0.05120600014925003,
-0.027906324714422226,
0.6937488317489624,
0.1468280553817749,
0.2767847776412964,
0.013910469599068165,
-0.04891858249902725,
-0.3464195430278778,
0.11424645036458969,
-0.027388952672481537,
-0.19944517314434052,
0.12105121463537216,
-0.24858242273330688,
-0.18199674785137177,
-0.2715473771095276,
-0.021885370835661888,
0.17231696844100952,
0.21614360809326172,
-0.2237142026424408,
0.10645387321710587,
-0.045893922448158264,
0.045141324400901794,
-0.04185943678021431,
-0.20324543118476868,
-0.22826984524726868,
-0.2365664541721344,
-0.32887452840805054,
0.5409021377563477,
0.2697983980178833,
-0.17375975847244263,
-0.4869428277015686,
0.2375604212284088,
0.09653018414974213,
-0.1562856286764145,
-0.22886967658996582,
-0.13171693682670593,
-0.3606882691383362,
-0.011516494676470757,
0.3313678205013275,
0.1251848042011261,
0.17120109498500824,
-0.2329801768064499,
0.055118121206760406,
-0.19883252680301666,
0.12729662656784058,
-0.12617677450180054,
-0.005797229707241058,
0.2244526743888855,
-0.042762547731399536,
0.41864824295043945,
-0.10095646977424622,
0.02023463323712349,
0.11982983350753784,
-0.4642215669155121,
0.0796956792473793,
0.22745729982852936,
0.17278173565864563,
-0.2189692258834839,
-0.13733740150928497,
-0.24336007237434387,
-0.2774144113063812,
-0.27215585112571716,
0.2006092518568039,
0.010629266500473022,
0.0735633596777916,
0.022457383573055267,
0.1143827810883522,
0.005369274877011776,
0.0750945508480072,
-0.026267746463418007,
-0.16419821977615356,
-0.23340490460395813,
0.6322655081748962,
-0.221744567155838,
-0.6599827408790588,
0.40752875804901123,
0.2974894046783447,
-0.14751029014587402,
0.21265815198421478,
-0.5720700621604919,
0.3467950224876404,
-0.10196323692798615,
0.061063479632139206,
0.23334890604019165,
0.166535422205925,
-0.013973049819469452,
-0.33234402537345886,
0.1042608916759491,
-0.008153427392244339,
-0.2222927361726761,
-0.23529896140098572,
-0.03789538890123367,
0.2994035482406616,
0.1876712143421173,
0.12726977467536926,
-0.1850460022687912,
0.21827135980129242,
0.11146485805511475,
0.21139106154441833,
0.26066234707832336,
-0.07833351939916611,
0.44978803396224976,
-0.002893410623073578,
-0.3595740497112274,
0.20793363451957703,
-0.45305296778678894,
-0.021835854277014732,
0.24107441306114197,
0.19382008910179138,
-0.44924524426460266,
-0.5416457653045654,
0.10225293040275574,
-0.03257101774215698,
-0.2288876622915268,
0.21013307571411133,
-0.22813153266906738,
0.014400266110897064,
-0.006687875837087631,
0.3081880509853363,
0.20558126270771027,
-0.483515202999115,
0.14955969154834747,
0.5113048553466797,
-0.11422012001276016,
0.03462102636694908,
-0.2572857439517975,
-0.045207392424345016,
-0.5120869874954224,
0.15432165563106537,
-0.2412569671869278,
0.46820855140686035,
-0.16246140003204346,
0.022623613476753235,
0.14768049120903015,
-0.16115880012512207,
0.7127901911735535,
-0.33484530448913574,
0.009046431630849838,
0.29119548201560974,
0.17789655923843384,
-0.3477022051811218,
-0.252178430557251,
-0.320856511592865,
0.270775705575943,
-0.1333315372467041,
-0.10661166906356812,
-0.05135904625058174,
-0.027686698362231255,
0.019404470920562744,
0.20851337909698486,
-0.028263278305530548,
-0.20303001999855042,
-0.38759681582450867,
-0.44891685247421265,
-0.21613489091396332,
-0.11695098131895065,
0.008040064945816994,
-0.05543766915798187,
-0.33812445402145386,
0.07044319808483124,
-0.038957349956035614,
0.044857122004032135,
0.1545579433441162,
-0.17043153941631317,
0.15661919116973877,
0.11777038872241974,
0.25188302993774414,
0.2605077624320984,
0.12649235129356384,
-0.044479675590991974,
0.535225510597229,
-0.0068991780281066895,
-0.05840623378753662,
0.34563496708869934,
-0.32450801134109497,
0.06595364958047867,
0.3794391453266144,
-0.037390392273664474,
-0.32212650775909424,
0.037258800119161606,
0.038567688316106796,
-0.3754253685474396,
-0.08055010437965393,
0.36397072672843933,
-0.12341693043708801,
-0.2981169819831848,
-0.5118228793144226,
0.31010180711746216,
-0.0069005247205495834,
0.04369567334651947,
0.3944943845272064,
-0.2841469645500183,
-0.06196358799934387,
-0.09230652451515198,
-0.28991466760635376,
0.9123578667640686,
-0.10420785844326019,
0.27897998690605164,
-0.056050851941108704,
-0.09261225163936615,
0.060232289135456085,
-0.05973293259739876,
0.07010868936777115,
0.01145082339644432,
-0.010659041814506054,
-0.17478008568286896,
-0.09124714136123657,
0.22464421391487122,
0.4207729697227478,
-0.4020048677921295,
0.3291705250740051,
-0.04448426887392998,
0.13016948103904724,
-0.14561304450035095,
0.33980727195739746,
-0.25607433915138245,
-0.2890041470527649,
-0.10048425942659378,
0.10764141380786896,
0.11470851302146912,
0.4825765788555145,
-0.26555749773979187,
0.0962701290845871,
0.1247299462556839,
-0.08269929885864258,
-0.41172200441360474,
0.3731668293476105,
0.02192804217338562,
-0.008862366899847984,
-0.3657298684120178,
-0.08657859265804291,
0.03712515905499458,
0.08330337703227997,
0.134668231010437,
0.0007059425115585327,
-0.4090564548969269,
0.23475337028503418,
-0.015467830002307892,
-0.208795964717865,
0.024585993960499763,
-0.20351871848106384,
0.052561741322278976,
-0.022574467584490776,
-0.31931594014167786,
0.13532474637031555,
-0.15604963898658752,
-0.19142349064350128,
-0.19110223650932312,
0.05247551202774048,
0.15653902292251587,
-0.07769588381052017,
-0.16301345825195312,
-0.036458954215049744,
-0.005566978827118874,
-0.018811341375112534,
0.0700896680355072,
0.27067312598228455,
0.031092245131731033,
0.3902578353881836,
0.012183278799057007,
-0.1944541186094284,
-0.11069905757904053,
0.6057687401771545,
-0.08065707236528397,
-0.5021281838417053,
0.15302298963069916,
0.6260688900947571,
-0.250881552696228,
-0.24329069256782532,
0.18534427881240845,
0.1611521691083908,
-0.28514787554740906,
-0.01986750215291977,
0.11272243410348892,
0.3741261959075928,
0.13981269299983978,
0.09366568922996521,
-0.051889270544052124,
-0.3265523314476013,
0.03993883356451988,
-0.5623199939727783,
0.003002570942044258,
0.028232555836439133,
0.35590702295303345,
0.1410147100687027,
-0.17617842555046082,
-0.5053320527076721,
0.6522713899612427,
0.01184525154531002,
-0.20513886213302612,
0.04043786972761154,
0.04387421905994415,
-0.051629580557346344,
0.34067484736442566,
0.19370272755622864,
0.2160094678401947,
-0.07505013048648834,
-0.046905338764190674,
-0.08352978527545929,
0.07636141031980515,
-0.06694765388965607,
-0.0165358018130064,
0.22857263684272766,
-0.07137595862150192,
0.015298858284950256,
0.1097327396273613,
-0.6655226945877075,
-0.330179363489151,
0.051956649869680405,
0.21478061378002167,
0.18418791890144348,
-0.2401823252439499,
0.06298606097698212,
-0.037819232791662216,
0.32949891686439514,
-0.14090511202812195,
0.20737557113170624,
-0.24968895316123962,
0.6787942051887512,
0.032336317002773285,
0.1153361052274704,
0.29367250204086304,
0.07562839984893799,
-0.17559856176376343,
-0.002792671322822571,
-0.02569953352212906,
-0.05522081255912781,
0.2679033875465393,
-0.2902223467826843,
0.2437649667263031,
-0.18736469745635986,
0.27554595470428467,
0.8399646282196045,
-0.2070835679769516,
0.08718086034059525,
0.28329455852508545,
0.07463181018829346,
-0.07262077927589417,
-0.04052304849028587,
0.013193946331739426,
-0.15719233453273773,
-0.0853191688656807,
0.0677444189786911,
-0.04510340467095375,
-0.36686182022094727,
-0.21510355174541473,
0.057321906089782715,
0.48656752705574036,
0.12412366271018982,
-0.1937587708234787,
0.4410760998725891,
0.016846437007188797,
0.07542815804481506,
-0.050085268914699554,
0.2841113209724426,
-0.1606818437576294,
0.44080591201782227,
0.14193536341190338,
0.18540731072425842,
0.09823291003704071,
0.47673046588897705,
-0.2801033556461334,
-0.2568109333515167,
0.03811334818601608,
0.1330263465642929,
0.032911427319049835,
0.17376691102981567,
-0.16358526051044464,
0.22261828184127808,
-0.4554186761379242,
-0.10052947700023651,
-0.4397476315498352,
0.07937148213386536,
0.2263455092906952,
-0.05634596571326256,
-0.21581675112247467,
-0.1652945876121521,
-0.1753157377243042,
0.19327165186405182,
0.07229557633399963,
-0.2186773270368576,
0.5698963403701782,
0.23347385227680206,
0.08500512689352036,
-0.39042243361473083,
0.1136043593287468,
-0.14122945070266724,
-0.006167173385620117,
-0.22051623463630676,
0.18580515682697296,
-0.15240822732448578,
0.20627886056900024,
0.11330853402614594,
0.1342744529247284,
0.2519588768482208,
0.5287399291992188,
-0.241377592086792,
0.29727622866630554,
-0.03241327032446861,
-0.12128111720085144,
0.0077466946095228195,
0.5865790843963623,
0.24041494727134705,
0.10505841672420502,
0.2001650333404541,
0.00827818363904953,
-0.016426414251327515,
0.0515773631632328,
0.06664792448282242,
-0.17981882393360138,
-0.18581686913967133,
0.06921028345823288,
-0.035562701523303986,
0.03607092797756195,
-0.12522317469120026,
-0.13987773656845093,
-0.3972563147544861,
-0.4243103563785553,
0.3482151925563812,
-0.21580135822296143,
0.01494419015944004,
-0.27941393852233887,
0.011786069720983505,
0.11182266473770142,
0.5671473741531372,
0.33222874999046326,
0.529779314994812,
-0.16205289959907532,
-0.2303095906972885,
-0.9565058946609497,
0.10805026441812515,
-0.16859817504882812,
-0.17558473348617554,
0.009883989579975605,
0.1923183649778366,
0.0025189146399497986,
0.4843912720680237,
0.023546360433101654,
0.080989770591259,
0.21344119310379028,
0.3761451542377472,
-0.2119748592376709,
-0.06894342601299286,
0.11322042346000671,
0.38490986824035645,
-0.2799786925315857,
-0.43632930517196655,
0.3204379975795746,
-0.1441282033920288,
-0.17247341573238373,
-0.05175245553255081,
-0.1804923117160797,
0.1560872495174408,
0.19692707061767578,
0.4207724630832672,
-0.20911355316638947,
0.47294190526008606,
0.1104513630270958,
-0.05467449501156807,
-0.4447280168533325,
0.08971307426691055,
0.07142267376184464,
0.07184743881225586,
-0.07236802577972412,
-0.2931540012359619,
-0.3677377998828888,
0.02918112277984619,
-0.05445583909749985,
-0.027519287541508675,
-0.0003350675106048584,
0.17169226706027985,
-0.19662897288799286,
-0.17515026032924652,
-0.08567993342876434,
0.22300711274147034,
0.02218441665172577,
0.1691587120294571,
-0.19652202725410461,
-0.1537230759859085,
-0.2684343457221985,
-0.0431600883603096,
0.2580581605434418,
-0.2556961476802826,
-0.3342409133911133,
-0.1974043995141983,
0.08212000876665115,
-0.40353989601135254,
0.1280597746372223,
-0.44312384724617004,
0.09341426938772202,
0.05881517753005028,
0.005714930593967438,
-0.2654508352279663,
0.2720971405506134,
-0.2873011529445648,
0.0370798222720623,
-0.059197865426540375,
0.2502169609069824,
0.009083515033125877,
-0.2215784639120102,
-0.05482815206050873,
-0.19505265355110168
] |
https://github.com/huggingface/datasets/issues/672 | Questions about XSUM | We should try to regenerate the data using the official script.
But iirc that's what we used in the first place, so not sure why it didn't match in the first place.
I'll let you know when the dataset is updated | Hi there ✋
I'm looking into your `xsum` dataset and I have several questions on that.
So here is how I loaded the data:
```
>>> data = datasets.load_dataset('xsum', version='1.0.1')
>>> data['train']
Dataset(features: {'document': Value(dtype='string', id=None), 'summary': Value(dtype='string', id=None)}, num_rows: 204017)
>>> data['test']
Dataset(features: {'document': Value(dtype='string', id=None), 'summary': Value(dtype='string', id=None)}, num_rows: 11333)
```
The first issue is, the instance counts don’t match what I see on [the dataset's website](https://github.com/EdinburghNLP/XSum/tree/master/XSum-Dataset#what-builds-the-xsum-dataset) (11,333 vs 11,334 for test set; 204,017 vs 204,045 for training set)
```
… training (90%, 204,045), validation (5%, 11,332), and test (5%, 11,334) set.
```
Any thoughts why? Perhaps @mariamabarham could help here, since she recently had a PR on this dataaset https://github.com/huggingface/datasets/pull/289 (reviewed by @patrickvonplaten)
Another issue is that the instances don't seem to have IDs. The original datasets provides IDs for the instances: https://github.com/EdinburghNLP/XSum/blob/master/XSum-Dataset/XSum-TRAINING-DEV-TEST-SPLIT-90-5-5.json but to be able to use them, the dataset sizes need to match.
CC @jbragg
| 41 | Questions about XSUM
Hi there ✋
I'm looking into your `xsum` dataset and I have several questions on that.
So here is how I loaded the data:
```
>>> data = datasets.load_dataset('xsum', version='1.0.1')
>>> data['train']
Dataset(features: {'document': Value(dtype='string', id=None), 'summary': Value(dtype='string', id=None)}, num_rows: 204017)
>>> data['test']
Dataset(features: {'document': Value(dtype='string', id=None), 'summary': Value(dtype='string', id=None)}, num_rows: 11333)
```
The first issue is, the instance counts don’t match what I see on [the dataset's website](https://github.com/EdinburghNLP/XSum/tree/master/XSum-Dataset#what-builds-the-xsum-dataset) (11,333 vs 11,334 for test set; 204,017 vs 204,045 for training set)
```
… training (90%, 204,045), validation (5%, 11,332), and test (5%, 11,334) set.
```
Any thoughts why? Perhaps @mariamabarham could help here, since she recently had a PR on this dataaset https://github.com/huggingface/datasets/pull/289 (reviewed by @patrickvonplaten)
Another issue is that the instances don't seem to have IDs. The original datasets provides IDs for the instances: https://github.com/EdinburghNLP/XSum/blob/master/XSum-Dataset/XSum-TRAINING-DEV-TEST-SPLIT-90-5-5.json but to be able to use them, the dataset sizes need to match.
CC @jbragg
We should try to regenerate the data using the official script.
But iirc that's what we used in the first place, so not sure why it didn't match in the first place.
I'll let you know when the dataset is updated | [
-0.09429459273815155,
-0.36811700463294983,
-0.14567513763904572,
0.484241783618927,
0.3399181365966797,
-0.005832970142364502,
0.11150367558002472,
-0.01865457370877266,
0.2138754278421402,
0.2600373923778534,
-0.2300763577222824,
0.22797611355781555,
0.11959701776504517,
0.4290391802787781,
0.12506937980651855,
0.1158343181014061,
-0.014844104647636414,
-0.0975627452135086,
-0.3769935071468353,
-0.2929210662841797,
0.0028307288885116577,
0.052427440881729126,
-0.07497536391019821,
-0.14064829051494598,
-0.6725174188613892,
0.06253478676080704,
-0.13250160217285156,
0.26148492097854614,
-0.08069325238466263,
-0.2141222059726715,
0.23790724575519562,
-0.00456533208489418,
0.051693081855773926,
0.5184447765350342,
-0.0001057436311384663,
0.007649309933185577,
0.12273768335580826,
-0.03692539036273956,
-0.11002582311630249,
0.2392052263021469,
-0.17371302843093872,
-0.016915390267968178,
-0.014408408664166927,
-0.3685780167579651,
-0.09105266630649567,
0.029511235654354095,
-0.144158735871315,
-0.3795345723628998,
0.22137263417243958,
0.03266410529613495,
0.21591418981552124,
0.16816486418247223,
0.12855024635791779,
-0.03427068889141083,
-0.0895385667681694,
-0.09634123742580414,
0.14052128791809082,
0.2543078362941742,
0.3807455897331238,
0.27698877453804016,
0.08531814068555832,
0.12328772246837616,
0.08217984437942505,
-0.19801603257656097,
0.263024240732193,
0.06959807127714157,
0.33492979407310486,
-0.18421919643878937,
-0.30474069714546204,
0.28117257356643677,
0.8441707491874695,
-0.06064768135547638,
-0.27856218814849854,
-0.003650277853012085,
0.008251922205090523,
-0.15324914455413818,
0.14600500464439392,
0.03815833479166031,
0.3942212164402008,
-0.023648086935281754,
-0.24790452420711517,
0.41302457451820374,
-0.22799932956695557,
0.030081406235694885,
-0.13658127188682556,
-0.09567676484584808,
-0.0382307693362236,
0.014848679304122925,
-0.277106910943985,
-0.03625158220529556,
0.08029956370592117,
-0.0657886266708374,
0.14764058589935303,
0.17851732671260834,
-0.28820282220840454,
-0.11030154675245285,
-0.04650753736495972,
-0.0006226450204849243,
0.22708550095558167,
0.14160653948783875,
0.2942694127559662,
0.0741877406835556,
-0.3836720585823059,
0.02145891636610031,
0.1987365186214447,
0.2798699736595154,
0.4257891774177551,
-0.559022843837738,
0.005581788718700409,
-0.08973967283964157,
-0.14739049971103668,
0.0754271000623703,
-0.3453877866268158,
-0.014310010708868504,
0.04975545033812523,
0.0657481700181961,
-0.1653846800327301,
-0.35611963272094727,
-0.23746664822101593,
0.278487890958786,
0.038900189101696014,
-0.11220021545886993,
0.15718398988246918,
-0.14439991116523743,
0.03736303001642227,
0.42742764949798584,
0.03119761496782303,
0.012314535677433014,
-0.5540832877159119,
-0.3021518290042877,
-0.3512794077396393,
0.09895852208137512,
-0.08617712557315826,
-0.015905166044831276,
0.08569848537445068,
-0.1169760674238205,
0.3941987156867981,
-0.08910799026489258,
0.2661679983139038,
-0.07212930172681808,
0.034352466464042664,
0.12084545195102692,
-0.3228807747364044,
0.23434732854366302,
0.016474340111017227,
-0.01141535397619009,
-0.037850942462682724,
0.02966471016407013,
0.00940774381160736,
0.009331312030553818,
-0.20031094551086426,
-0.21323518455028534,
-0.030395762994885445,
0.3145390748977661,
-0.38482004404067993,
-0.2735406160354614,
-0.17831453680992126,
-0.039114248007535934,
0.19347943365573883,
0.17336203157901764,
-0.2078888714313507,
-0.1749672144651413,
0.11063072085380554,
-0.13873714208602905,
0.19160030782222748,
-0.03929358720779419,
-0.6223725080490112,
0.030017152428627014,
-0.021987060084939003,
-0.2789640426635742,
0.08157266676425934,
0.02118544653058052,
-0.006951936054974794,
0.27999189496040344,
0.0989445224404335,
0.1685309261083603,
-0.5400203466415405,
-0.4732564091682434,
-0.15222294628620148,
-0.4094895124435425,
-0.1714005470275879,
-0.08415224403142929,
0.11836720257997513,
0.11252432316541672,
0.03998851403594017,
-0.08856503665447235,
0.1391785889863968,
0.00934968888759613,
0.10513283312320709,
-0.18918170034885406,
-0.4143063426017761,
-0.0582362562417984,
-0.02002968266606331,
0.15978536009788513,
-0.06936044991016388,
-0.2733849287033081,
-0.05410052090883255,
0.351540207862854,
0.2060990333557129,
-0.035255637019872665,
-0.09543819725513458,
0.05570342391729355,
0.295684278011322,
-0.141619011759758,
0.11095297336578369,
-0.2052733302116394,
-0.0060446783900260925,
0.303995817899704,
0.07152317464351654,
0.1947307139635086,
0.7513716220855713,
-0.02836034446954727,
-0.4254818260669708,
-0.2496139258146286,
0.007830638438463211,
-0.16561201214790344,
0.20403368771076202,
-0.17588746547698975,
-0.021142233163118362,
-0.22441676259040833,
-0.1832626312971115,
0.1512981504201889,
-0.5768192410469055,
0.045592427253723145,
-0.5188599824905396,
0.3624449074268341,
0.01848984882235527,
-0.0043065836653113365,
0.07636036723852158,
0.30578649044036865,
-0.027387067675590515,
-0.26456940174102783,
-0.02487495169043541,
0.5631831288337708,
0.1721716970205307,
0.04395056888461113,
0.1727522611618042,
0.16094721853733063,
0.3768123686313629,
-0.16576944291591644,
0.16633398830890656,
-0.2367457002401352,
-0.03795758634805679,
-0.19600361585617065,
-0.3365100622177124,
0.24136961996555328,
-0.1057436615228653,
-0.01224333792924881,
-0.09108292311429977,
0.008398504927754402,
0.004678690806031227,
-0.16979749500751495,
-0.00021751970052719116,
-0.002525128424167633,
0.18837159872055054,
0.17608177661895752,
-0.24032320082187653,
0.06945116817951202,
0.0188235342502594,
0.3829340636730194,
-0.35359466075897217,
-0.19784760475158691,
-0.18690186738967896,
-0.35459643602371216,
-0.22464051842689514,
0.15340852737426758,
0.09630242735147476,
-0.026774588972330093,
0.48451751470565796,
0.28572753071784973,
0.03916666656732559,
-0.019909435883164406,
-0.07042655348777771,
-0.15545038878917694,
0.019963189959526062,
0.02162054553627968,
-0.04756559804081917,
-0.02856478840112686,
-0.04305453598499298,
0.012629474513232708,
-0.19052410125732422,
0.11895234882831573,
0.1140751913189888,
0.15958935022354126,
-0.46368202567100525,
-0.34959912300109863,
-0.25487926602363586,
-0.08025901019573212,
0.1686791479587555,
0.18794295191764832,
0.15141203999519348,
-0.2807499170303345,
0.14353397488594055,
0.07004737108945847,
-0.02694631740450859,
0.023316603153944016,
-0.3429913818836212,
0.24498054385185242,
0.033423587679862976,
0.11106324195861816,
0.09091319143772125,
-0.18000222742557526,
-0.16407161951065063,
0.20225739479064941,
-0.0004145381972193718,
0.3297639787197113,
0.3800823390483856,
-0.12042038887739182,
-0.05754533037543297,
0.11346016824245453,
-0.42255908250808716,
0.021822571754455566,
-0.1813897043466568,
0.28476905822753906,
-0.14758332073688507,
0.04605589061975479,
0.07089295983314514,
-0.004852684680372477,
0.24787792563438416,
-0.012095989659428596,
-0.2618585228919983,
-0.0627107173204422,
0.1765853464603424,
-0.25634896755218506,
-0.08232031017541885,
-0.5738769769668579,
-0.1079508438706398,
-0.059426531195640564,
-0.07693853974342346,
0.47509726881980896,
0.18327008187770844,
0.07034958153963089,
-0.1054379865527153,
0.16665393114089966,
0.2087131142616272,
-0.18778035044670105,
-0.39369097352027893,
-0.8022005558013916,
0.3011884093284607,
-0.10081224888563156,
-0.5333337187767029,
0.015614252537488937,
-0.028889432549476624,
0.3304857015609741,
0.09999734163284302,
-0.37121832370758057,
-0.3593393564224243,
0.04081053286790848,
-0.13711102306842804,
0.48584824800491333,
0.23869842290878296,
0.19382616877555847,
-0.14227214455604553,
-0.17167693376541138,
-0.25040900707244873,
-0.06100405752658844,
0.25430986285209656,
0.3238007426261902,
0.45898956060409546,
-0.3080548346042633,
-0.3199738562107086,
-0.22501340508460999,
0.037758246064186096,
0.21355397999286652,
-0.18535871803760529,
0.006289172917604446,
-0.08134666830301285,
-0.09699290990829468,
0.053460970520973206,
-0.11998413503170013,
0.6289498209953308,
-0.1266481876373291,
-0.06853695213794708,
0.11959275603294373,
0.19068658351898193,
0.2550233006477356,
-0.002516508102416992,
0.09187911450862885,
-0.24409011006355286,
-0.15121401846408844,
-0.2004418969154358,
-0.046250224113464355,
0.024873681366443634,
-0.003786783665418625,
-0.07442662864923477,
-0.11328491568565369,
-0.10464557260274887,
-0.07985164225101471,
-0.01383751630783081,
0.13831385970115662,
-0.0518493577837944,
-1.0071556568145752,
0.24067848920822144,
0.04790687561035156,
0.39976054430007935,
-0.29635757207870483,
0.00986635684967041,
0.059997763484716415,
-0.12047021836042404,
0.0912831574678421,
0.2207183539867401,
0.15513508021831512,
-0.23160313069820404,
-0.22948457300662994,
0.3070247769355774,
-0.06232161074876785,
-0.2843470275402069,
-0.0945146456360817,
-0.14330574870109558,
0.06108178198337555,
0.2233981192111969,
0.05059254914522171,
-0.25972315669059753,
-0.007992953062057495,
0.19250890612602234,
0.300855815410614,
-0.3191562592983246,
-0.16930074989795685,
-0.07081520557403564,
-0.05468839406967163,
0.029962709173560143,
-0.1493472158908844,
-0.14308825135231018,
0.2711484730243683,
-0.2524776756763458,
-0.10677856206893921,
-0.19506826996803284,
-0.13091769814491272,
0.5445536375045776,
0.0330548956990242,
0.46354711055755615,
0.022211987525224686,
0.33103427290916443,
0.3319660723209381,
0.10006090998649597,
0.21574611961841583,
0.48377570509910583,
-0.15621955692768097,
0.25930261611938477,
0.11510906368494034,
-0.35849398374557495,
0.37621328234672546,
0.138981893658638,
0.10314276069402695,
-0.4917179346084595,
-0.21252897381782532,
0.09722979366779327,
-0.18453697860240936,
0.26116102933883667,
0.07356762886047363,
0.1788422018289566,
-0.08513112366199493,
-0.2825026512145996,
0.5260212421417236,
0.13579101860523224,
-0.008349716663360596,
0.3781106472015381,
0.3599121570587158,
-0.13803134858608246,
-0.18964262306690216,
0.5227786302566528,
0.8718805313110352,
0.09747621417045593,
-0.19801044464111328,
0.28273919224739075,
0.38685840368270874,
0.3328576683998108,
-0.4695435166358948,
0.0674930065870285,
-0.22654235363006592,
-0.31472790241241455,
0.04065044969320297,
-0.10314548760652542,
0.14113527536392212,
0.24708177149295807,
0.14903515577316284,
0.09921275824308395,
-0.1775532364845276,
-0.27223068475723267,
-0.1862834095954895,
0.19605927169322968,
-0.2520703375339508,
-0.12800957262516022,
0.3076058030128479,
0.2597721517086029,
0.07552631199359894,
0.19242382049560547,
-0.009511181153357029,
0.055190201848745346,
-0.31893542408943176,
0.00402449443936348,
-0.08777495473623276,
-0.04962736368179321,
-0.09769479185342789,
0.04318045452237129,
0.04734104499220848,
-0.35946977138519287,
-0.08028391003608704,
0.35941994190216064,
0.2364555448293686,
-0.03557393327355385,
-0.07339087873697281,
0.16902390122413635,
-0.3461526036262512,
0.08243518322706223,
0.3339085876941681,
-0.010490893386304379,
0.3831380009651184,
-0.1655251383781433,
-0.21131214499473572,
-0.06181255728006363,
0.09835585951805115,
0.23850961029529572,
-0.3904207944869995,
-0.03867563605308533,
-0.004290778189897537,
-0.49295490980148315,
-0.0564681775867939,
0.18731912970542908,
-0.06171661615371704,
-0.09323285520076752,
0.1899467557668686,
0.24236729741096497,
-0.062194883823394775,
0.4939068555831909,
-0.11949171125888824,
0.02690768986940384,
-0.10811181366443634,
0.21094094216823578,
0.4708757698535919,
-0.1838507205247879,
0.27858519554138184,
0.016936730593442917,
0.03920651972293854,
-0.14658787846565247,
0.03366219252347946,
0.4933127760887146,
-0.11346448957920074,
-0.08128128945827484,
-0.2681726813316345,
-0.2203373908996582,
-0.007414060644805431,
0.22598282992839813,
0.28394871950149536,
-0.002800680696964264,
0.0831824541091919,
-0.3508225679397583,
-0.48509442806243896,
0.31599122285842896,
0.15560320019721985,
0.41662588715553284,
-0.23922502994537354,
0.2694607675075531,
-0.07150361686944962,
0.038521572947502136,
-0.3680201470851898,
0.026410581544041634,
-0.08158867061138153,
0.10119114071130753,
0.09220416098833084,
-0.07363267987966537,
0.2503097355365753,
-0.38072705268859863,
0.20258094370365143,
0.02637460082769394,
-0.13349507749080658,
-0.24357080459594727,
-0.09692586958408356,
0.08970262855291367,
0.15154272317886353,
-0.0670352652668953,
0.2224101573228836,
-0.023727484047412872,
-0.0340132974088192,
-0.07702051103115082,
0.059495437890291214,
-0.10476991534233093,
0.0720105692744255,
0.3274495303630829,
0.052565764635801315,
0.11430082470178604,
-0.018936723470687866,
0.12809517979621887,
0.10964103043079376,
0.27549511194229126,
0.1357036679983139,
-0.23127052187919617,
0.04514158144593239,
-0.2054264396429062,
-0.3339153826236725,
0.01524411141872406,
-0.05265331268310547,
0.1637733280658722,
0.2915728688240051,
-0.04183132201433182,
0.12610220909118652,
0.1449693888425827,
0.365648090839386,
0.41397014260292053,
-0.15432560443878174,
0.10585421323776245,
-0.0190595593303442,
0.3068210482597351,
-0.31315237283706665,
-0.010604764334857464,
0.055567655712366104,
0.3534430265426636,
-0.09213180094957352,
0.08310354501008987,
0.15750882029533386,
-0.06450699269771576,
-0.14582180976867676,
0.159537672996521,
0.2425074428319931,
-0.09422475099563599,
0.11370037496089935,
0.19153720140457153,
-0.19505378603935242,
-0.03736387565732002,
0.13342270255088806,
-0.07937514781951904,
-0.06823935359716415,
0.2332974672317505,
0.04592423886060715,
0.5049700736999512,
0.1906120479106903,
0.18844610452651978,
-0.00024625658988952637,
0.038042936474084854,
-0.054433371871709824,
0.3526475429534912,
0.1662670373916626,
0.16676203906536102,
0.05065586045384407,
0.5731655955314636,
-0.17005620896816254,
-0.03902518376708031,
-0.3009102940559387,
-0.0013900808990001678,
0.09062061458826065,
0.15679796040058136,
-0.24755743145942688,
-0.12050968408584595,
0.07957740128040314,
-0.1994357407093048,
-0.12337347865104675,
-0.2324359267950058,
0.13650181889533997,
-0.011877208948135376,
-0.3977280855178833,
-0.7796939015388489,
-0.1341336965560913,
0.18163833022117615,
0.2501066327095032,
-0.10110459476709366,
0.1526040881872177,
0.5754837989807129,
-0.029698312282562256,
0.09084397554397583,
0.5537943840026855,
0.14276650547981262,
0.1652052253484726,
0.023452598601579666,
0.07883450388908386,
0.22973456978797913,
-0.04566223546862602,
0.12590201199054718,
0.11136447638273239,
-0.0031883716583251953,
-0.16275723278522491,
0.2816796600818634,
0.21523918211460114,
-0.10068949311971664,
-0.14924031496047974,
0.05405883491039276,
0.003776899538934231,
-0.10007312893867493,
0.08834608644247055,
0.0580533891916275,
-0.14771872758865356,
-0.11180348694324493,
-0.21211329102516174,
-0.35978251695632935,
-0.028104767203330994,
-0.1232801228761673,
0.1838153600692749,
0.17356261610984802,
0.011604195460677147,
0.13544145226478577,
-0.35531502962112427,
0.2740554213523865,
0.06913954019546509,
-0.1476639211177826,
-0.29511645436286926,
-0.12017475068569183,
-0.6131007075309753,
0.026710964739322662,
-0.05366889014840126,
-0.5478023290634155,
0.16531744599342346,
0.3015884459018707,
0.12904547154903412,
0.034483250230550766,
0.06809936463832855,
-0.42468106746673584,
-0.15276022255420685,
0.26390618085861206,
-0.5903574228286743,
0.06538751721382141,
-0.22211246192455292,
0.157260462641716,
-0.0014695990830659866,
0.2976369261741638,
0.23233959078788757,
0.23188842833042145,
0.017366968095302582,
0.14682818949222565,
0.1510246843099594,
0.18705271184444427,
0.2307741940021515,
0.027423962950706482,
-0.009788380935788155,
0.44997742772102356,
0.15630441904067993,
0.29332906007766724,
-0.3235435485839844,
-0.22408965229988098,
-0.20347748696804047,
0.32704827189445496,
0.19055357575416565,
0.12062288820743561,
-0.012532607652246952,
0.014575634151697159,
0.06474339962005615,
0.29503133893013,
0.0132930688560009,
-0.42982837557792664,
-0.5134843587875366,
-0.00487903319299221,
0.014398880302906036,
0.03600030019879341,
0.2718864977359772,
0.5303263068199158,
-0.0038961879909038544,
0.11373740434646606,
-0.20144352316856384,
-0.3758944571018219,
0.4186391830444336,
-0.10648491978645325,
0.1832006722688675,
-0.05083942785859108,
0.253404438495636,
0.41862568259239197,
-0.04056955873966217,
-0.3476036489009857,
0.005609169602394104,
0.4202428460121155,
-0.2656206488609314,
-0.11883628368377686,
0.2509297728538513,
0.3692399859428406,
-0.14478254318237305,
-0.011594098061323166,
-0.042435675859451294,
-0.0008029267191886902,
0.032793089747428894,
0.16941072046756744,
-0.031114611774683
] |
https://github.com/huggingface/datasets/issues/672 | Questions about XSUM | Thanks, looking forward to hearing your update on this thread.
This is a blocking issue for us; would appreciate any progress on this front. We can also help with the fix, if you deem it appropriately. | Hi there ✋
I'm looking into your `xsum` dataset and I have several questions on that.
So here is how I loaded the data:
```
>>> data = datasets.load_dataset('xsum', version='1.0.1')
>>> data['train']
Dataset(features: {'document': Value(dtype='string', id=None), 'summary': Value(dtype='string', id=None)}, num_rows: 204017)
>>> data['test']
Dataset(features: {'document': Value(dtype='string', id=None), 'summary': Value(dtype='string', id=None)}, num_rows: 11333)
```
The first issue is, the instance counts don’t match what I see on [the dataset's website](https://github.com/EdinburghNLP/XSum/tree/master/XSum-Dataset#what-builds-the-xsum-dataset) (11,333 vs 11,334 for test set; 204,017 vs 204,045 for training set)
```
… training (90%, 204,045), validation (5%, 11,332), and test (5%, 11,334) set.
```
Any thoughts why? Perhaps @mariamabarham could help here, since she recently had a PR on this dataaset https://github.com/huggingface/datasets/pull/289 (reviewed by @patrickvonplaten)
Another issue is that the instances don't seem to have IDs. The original datasets provides IDs for the instances: https://github.com/EdinburghNLP/XSum/blob/master/XSum-Dataset/XSum-TRAINING-DEV-TEST-SPLIT-90-5-5.json but to be able to use them, the dataset sizes need to match.
CC @jbragg
| 36 | Questions about XSUM
Hi there ✋
I'm looking into your `xsum` dataset and I have several questions on that.
So here is how I loaded the data:
```
>>> data = datasets.load_dataset('xsum', version='1.0.1')
>>> data['train']
Dataset(features: {'document': Value(dtype='string', id=None), 'summary': Value(dtype='string', id=None)}, num_rows: 204017)
>>> data['test']
Dataset(features: {'document': Value(dtype='string', id=None), 'summary': Value(dtype='string', id=None)}, num_rows: 11333)
```
The first issue is, the instance counts don’t match what I see on [the dataset's website](https://github.com/EdinburghNLP/XSum/tree/master/XSum-Dataset#what-builds-the-xsum-dataset) (11,333 vs 11,334 for test set; 204,017 vs 204,045 for training set)
```
… training (90%, 204,045), validation (5%, 11,332), and test (5%, 11,334) set.
```
Any thoughts why? Perhaps @mariamabarham could help here, since she recently had a PR on this dataaset https://github.com/huggingface/datasets/pull/289 (reviewed by @patrickvonplaten)
Another issue is that the instances don't seem to have IDs. The original datasets provides IDs for the instances: https://github.com/EdinburghNLP/XSum/blob/master/XSum-Dataset/XSum-TRAINING-DEV-TEST-SPLIT-90-5-5.json but to be able to use them, the dataset sizes need to match.
CC @jbragg
Thanks, looking forward to hearing your update on this thread.
This is a blocking issue for us; would appreciate any progress on this front. We can also help with the fix, if you deem it appropriately. | [
-0.08709438145160675,
-0.37684544920921326,
-0.1521643102169037,
0.4688608646392822,
0.3402542471885681,
-0.00788416713476181,
0.1615419238805771,
-0.030764717608690262,
0.2476973533630371,
0.283265084028244,
-0.22370077669620514,
0.24992844462394714,
0.10184461623430252,
0.4539225995540619,
0.08792334794998169,
0.10070047527551651,
-0.03528653830289841,
-0.1102672666311264,
-0.36573392152786255,
-0.29219695925712585,
0.007230166345834732,
0.07802249491214752,
-0.06723050773143768,
-0.14523716270923615,
-0.669581949710846,
-0.003887934610247612,
-0.1209946721792221,
0.28037378191947937,
-0.10429634153842926,
-0.2146042138338089,
0.235761359333992,
0.038694627583026886,
0.006720930337905884,
0.5801951885223389,
-0.0001046301331371069,
0.015219345688819885,
0.14736449718475342,
-0.0074839163571596146,
-0.1374785453081131,
0.2280701994895935,
-0.1725151240825653,
-0.018096592277288437,
0.020894242450594902,
-0.3256727457046509,
-0.110319122672081,
0.04404279962182045,
-0.14377419650554657,
-0.36692818999290466,
0.2572000324726105,
-0.013950439170002937,
0.2280745506286621,
0.19098445773124695,
0.15491046011447906,
-0.04963976889848709,
-0.09506256133317947,
-0.11737047135829926,
0.07898314297199249,
0.2292114794254303,
0.4040428698062897,
0.24033555388450623,
0.03807113319635391,
0.1594724804162979,
0.0983695536851883,
-0.1966066062450409,
0.28014883399009705,
0.028958141803741455,
0.34260180592536926,
-0.22745418548583984,
-0.2999531626701355,
0.29394394159317017,
0.8475385904312134,
-0.04668714106082916,
-0.29146718978881836,
-0.030370518565177917,
0.008775451220571995,
-0.14206330478191376,
0.18200671672821045,
0.05971036106348038,
0.3434993028640747,
-0.031171467155218124,
-0.24391312897205353,
0.414999395608902,
-0.25412726402282715,
0.04375368356704712,
-0.15708020329475403,
-0.11554855108261108,
-0.04357944801449776,
-0.008237354457378387,
-0.23893748223781586,
-0.02822555974125862,
0.04950971156358719,
-0.051278457045555115,
0.1646595448255539,
0.18239903450012207,
-0.3299441933631897,
-0.13183516263961792,
0.013427980244159698,
-0.012293793261051178,
0.1998293697834015,
0.15896059572696686,
0.2649379074573517,
0.1013578400015831,
-0.36216047406196594,
0.06983713805675507,
0.2414419800043106,
0.25870320200920105,
0.4240945279598236,
-0.547839343547821,
0.047787949442863464,
-0.06961925327777863,
-0.11345379054546356,
0.08160552382469177,
-0.3491238057613373,
-0.04491313919425011,
-0.03543970361351967,
0.03324627876281738,
-0.17488227784633636,
-0.382194459438324,
-0.23802083730697632,
0.2585428059101105,
0.0388885959982872,
-0.08813489973545074,
0.1911204308271408,
-0.09952586144208908,
0.06114158406853676,
0.39150160551071167,
0.0341389998793602,
0.0414288230240345,
-0.5715640187263489,
-0.27263686060905457,
-0.35040974617004395,
0.086375892162323,
-0.09724457561969757,
-0.021342644467949867,
0.11394003033638,
-0.10429257154464722,
0.38279080390930176,
-0.08024804294109344,
0.27647680044174194,
-0.0013614781200885773,
0.08113338053226471,
0.11003538966178894,
-0.3522944450378418,
0.2302161008119583,
0.026804547756910324,
-0.012643774971365929,
-0.03590785339474678,
0.027292869985103607,
-0.013333208858966827,
-0.02984578162431717,
-0.16581541299819946,
-0.20736917853355408,
-0.020764360204339027,
0.3233805298805237,
-0.33286529779434204,
-0.2567097246646881,
-0.15589690208435059,
0.01782504841685295,
0.185313880443573,
0.18028123676776886,
-0.21221646666526794,
-0.13611865043640137,
0.060190532356500626,
-0.11348313093185425,
0.1756136417388916,
-0.0649842917919159,
-0.5895951390266418,
0.0038926973938941956,
-0.014219919219613075,
-0.2840307652950287,
0.03483003377914429,
0.01771709695458412,
-0.012661917135119438,
0.22267329692840576,
0.13106754422187805,
0.17475993931293488,
-0.5439709424972534,
-0.4694363474845886,
-0.13935492932796478,
-0.35848233103752136,
-0.22000271081924438,
-0.1051340252161026,
0.12271048128604889,
0.07845277339220047,
0.0269541647285223,
-0.11876322329044342,
0.1633792221546173,
0.06668226420879364,
0.1071552261710167,
-0.16041827201843262,
-0.44591808319091797,
-0.06818297505378723,
-0.032296545803546906,
0.20912602543830872,
-0.060098398476839066,
-0.3040696084499359,
-0.06591401249170303,
0.33560413122177124,
0.16526159644126892,
-0.03107258304953575,
-0.07836488634347916,
0.08053538203239441,
0.3151933252811432,
-0.1335745006799698,
0.10550110787153244,
-0.20590001344680786,
-0.01579904556274414,
0.30224207043647766,
0.07597187161445618,
0.2600727081298828,
0.7314263582229614,
-0.034870896488428116,
-0.3778422176837921,
-0.2253965586423874,
0.01597493886947632,
-0.17004825174808502,
0.20467421412467957,
-0.22495675086975098,
-0.024768121540546417,
-0.20334044098854065,
-0.17704862356185913,
0.14756478369235992,
-0.5767455697059631,
0.06286900490522385,
-0.49789315462112427,
0.35289233922958374,
0.00026896223425865173,
-0.010123060084879398,
0.0724387839436531,
0.3005822002887726,
-0.032230354845523834,
-0.25610360503196716,
-0.039776697754859924,
0.5321789979934692,
0.1301264613866806,
0.04853210598230362,
0.2044239342212677,
0.17367218434810638,
0.38566139340400696,
-0.14633461833000183,
0.15544050931930542,
-0.24963654577732086,
-0.05621575936675072,
-0.2027369737625122,
-0.3685397207736969,
0.26048898696899414,
-0.1404675394296646,
0.006330035626888275,
-0.05568608269095421,
0.03796429932117462,
0.008425695821642876,
-0.16280269622802734,
0.0039469655603170395,
0.02479778230190277,
0.21300281584262848,
0.1512254923582077,
-0.24488510191440582,
0.0545099675655365,
0.021426737308502197,
0.39623111486434937,
-0.34349873661994934,
-0.1455949991941452,
-0.2073075771331787,
-0.32957273721694946,
-0.19796445965766907,
0.17285990715026855,
0.11913271993398666,
-0.01761729270219803,
0.45756369829177856,
0.3126804828643799,
0.06904640793800354,
-0.05425259470939636,
-0.09042511880397797,
-0.16001498699188232,
0.02159343659877777,
0.030469078570604324,
-0.07308145612478256,
-0.03139393776655197,
-0.004666623193770647,
-0.03377671539783478,
-0.17685547471046448,
0.09749484062194824,
0.11546627432107925,
0.12965962290763855,
-0.43678271770477295,
-0.3674219250679016,
-0.21228797733783722,
-0.09881438314914703,
0.202877014875412,
0.1948632150888443,
0.1293785721063614,
-0.2920306622982025,
0.19102595746517181,
0.12123118340969086,
-0.07161730527877808,
0.039253346621990204,
-0.34089452028274536,
0.28520137071609497,
0.03185995668172836,
0.14257793128490448,
0.08112922310829163,
-0.19168752431869507,
-0.15848496556282043,
0.2094806283712387,
0.03496040776371956,
0.33840155601501465,
0.3835896849632263,
-0.05239349603652954,
-0.08228398114442825,
0.15182825922966003,
-0.45073261857032776,
0.021873073652386665,
-0.19350376725196838,
0.29335716366767883,
-0.1625695526599884,
0.04622606933116913,
0.06896807998418808,
-0.04193708300590515,
0.27063703536987305,
-0.02926810458302498,
-0.2540872395038605,
-0.0879606083035469,
0.2068854421377182,
-0.24628131091594696,
-0.10897071659564972,
-0.5483402013778687,
-0.09753330051898956,
-0.11581677198410034,
-0.018337279558181763,
0.44353151321411133,
0.18937888741493225,
0.06889322400093079,
-0.10068649798631668,
0.172481507062912,
0.22263622283935547,
-0.18039220571517944,
-0.3716888129711151,
-0.8080675601959229,
0.2895077168941498,
-0.13169848918914795,
-0.5295535922050476,
0.016320396214723587,
-0.012279687449336052,
0.31298956274986267,
0.09784106910228729,
-0.38963937759399414,
-0.3701254725456238,
0.008139114826917648,
-0.09390993416309357,
0.4827435612678528,
0.18999959528446198,
0.22291207313537598,
-0.1478613018989563,
-0.19827817380428314,
-0.26464685797691345,
-0.06289955973625183,
0.2635393738746643,
0.29628533124923706,
0.4528547525405884,
-0.3367646038532257,
-0.29866355657577515,
-0.1789289265871048,
0.06997336447238922,
0.20159205794334412,
-0.13266432285308838,
0.011904258280992508,
-0.02276267297565937,
-0.09651055932044983,
0.033849913626909256,
-0.1430668830871582,
0.6103813052177429,
-0.1313682496547699,
-0.07903221249580383,
0.17134854197502136,
0.22824081778526306,
0.20968583226203918,
-0.03914686292409897,
0.06013864651322365,
-0.17909273505210876,
-0.15892912447452545,
-0.19950875639915466,
-0.025696851313114166,
0.0269995778799057,
-0.02283106930553913,
-0.06631286442279816,
-0.10545316338539124,
-0.09960607439279556,
-0.0844942182302475,
-0.019874826073646545,
0.11827897280454636,
-0.05592668429017067,
-1.004980206489563,
0.25910860300064087,
0.037546440958976746,
0.35263991355895996,
-0.30050528049468994,
-0.02881956845521927,
-0.02607869729399681,
-0.11359080672264099,
0.10709674656391144,
0.2032567411661148,
0.19903206825256348,
-0.2164066731929779,
-0.20588336884975433,
0.30902013182640076,
-0.09240569919347763,
-0.2754475176334381,
-0.06884314119815826,
-0.13812017440795898,
0.07976711541414261,
0.217727392911911,
0.04661429300904274,
-0.28444868326187134,
-0.044449932873249054,
0.17849892377853394,
0.21229566633701324,
-0.28454282879829407,
-0.16379909217357635,
-0.0753101110458374,
-0.02019273117184639,
0.018994832411408424,
-0.09125355631113052,
-0.11065017431974411,
0.26441478729248047,
-0.28876081109046936,
-0.139464870095253,
-0.15352392196655273,
-0.12817497551441193,
0.5450183153152466,
0.054330576211214066,
0.41680413484573364,
0.012289312668144703,
0.34884023666381836,
0.35793256759643555,
0.09194591641426086,
0.24103108048439026,
0.488781601190567,
-0.13362199068069458,
0.2437862902879715,
0.1442537009716034,
-0.40456172823905945,
0.37323737144470215,
0.2094115912914276,
0.10016942024230957,
-0.4752342104911804,
-0.24835148453712463,
0.08730654418468475,
-0.1790093034505844,
0.23624026775360107,
0.09200208634138107,
0.18873532116413116,
-0.0409708246588707,
-0.24705983698368073,
0.5007680058479309,
0.11518985033035278,
-0.001558832824230194,
0.42718788981437683,
0.37918758392333984,
-0.1314917951822281,
-0.1562880575656891,
0.5083361864089966,
0.8966673016548157,
0.08282878994941711,
-0.1813945174217224,
0.26196837425231934,
0.36988365650177,
0.3061383068561554,
-0.4772642254829407,
0.09743588417768478,
-0.1830945461988449,
-0.3640807271003723,
0.05470157414674759,
-0.10120441019535065,
0.13207098841667175,
0.2592508792877197,
0.14412376284599304,
0.05324297025799751,
-0.16168810427188873,
-0.2868404984474182,
-0.19623874127864838,
0.19596533477306366,
-0.2668999135494232,
-0.16529580950737,
0.2729061245918274,
0.2745414972305298,
0.11239394545555115,
0.1550142467021942,
-0.022423774003982544,
0.01944596692919731,
-0.31784147024154663,
0.009640984237194061,
-0.07678423821926117,
-0.04409279674291611,
-0.05914871767163277,
0.05131056159734726,
0.04636968672275543,
-0.33142128586769104,
-0.026158548891544342,
0.3168101906776428,
0.23042376339435577,
-0.053308818489313126,
-0.11305074393749237,
0.19024261832237244,
-0.3336276412010193,
0.07857246696949005,
0.3283728361129761,
-0.0032497812062501907,
0.4269936680793762,
-0.1823468804359436,
-0.18720607459545135,
-0.06055251508951187,
0.09209419041872025,
0.21678729355335236,
-0.3755587339401245,
-0.04232648015022278,
-0.006709255278110504,
-0.4976555407047272,
-0.027197742834687233,
0.17012174427509308,
-0.08036895096302032,
-0.11183285713195801,
0.2077973484992981,
0.20824790000915527,
-0.07946184277534485,
0.4497682750225067,
-0.06595101952552795,
0.03825240582227707,
-0.08778911828994751,
0.2386271059513092,
0.41730716824531555,
-0.18353720009326935,
0.32208675146102905,
0.052572060376405716,
-0.014855317771434784,
-0.17452329397201538,
-0.0034506283700466156,
0.4825315773487091,
-0.11260631680488586,
-0.036928024142980576,
-0.23500362038612366,
-0.2543019652366638,
-0.009773731231689453,
0.2487628161907196,
0.2622334063053131,
-0.0032238587737083435,
0.08630706369876862,
-0.3580664098262787,
-0.4583057463169098,
0.3008619546890259,
0.09514492750167847,
0.4245126247406006,
-0.2772362232208252,
0.2854063808917999,
-0.041114021092653275,
0.06642039865255356,
-0.38652753829956055,
0.0025516063906252384,
-0.14801236987113953,
0.08054603636264801,
0.08717041462659836,
-0.0949060246348381,
0.2682088315486908,
-0.3732397258281708,
0.19243571162223816,
-0.01090237870812416,
-0.1877460479736328,
-0.2438083291053772,
-0.08980511128902435,
0.0889480859041214,
0.14513002336025238,
-0.08353336900472641,
0.2687239348888397,
-0.03558008745312691,
-0.055322203785181046,
-0.053356025367975235,
0.06925822794437408,
-0.11810790002346039,
0.043764807283878326,
0.3051765263080597,
0.04400934278964996,
0.14085721969604492,
-0.01368800550699234,
0.1271902322769165,
0.12042800337076187,
0.2415243685245514,
0.15014754235744476,
-0.27192988991737366,
0.027383500710129738,
-0.2203308641910553,
-0.2931695282459259,
0.01651981845498085,
-0.06267616152763367,
0.15285557508468628,
0.27844148874282837,
-0.06151092052459717,
0.11167769134044647,
0.16479739546775818,
0.37317734956741333,
0.3808891475200653,
-0.13240405917167664,
0.12076553702354431,
-0.010566532611846924,
0.3303655982017517,
-0.2878558933734894,
0.0007568490691483021,
0.07901492714881897,
0.3087944984436035,
-0.08432652056217194,
0.04666442424058914,
0.16873221099376678,
-0.054256539791822433,
-0.11873231828212738,
0.19098716974258423,
0.21433806419372559,
-0.11912189424037933,
0.11660903692245483,
0.1912381500005722,
-0.24863369762897491,
-0.025487948209047318,
0.15626177191734314,
-0.07015462219715118,
-0.057008616626262665,
0.2388651967048645,
0.030884604901075363,
0.48381492495536804,
0.15352699160575867,
0.1727789342403412,
0.017219118773937225,
0.014619916677474976,
-0.05582570657134056,
0.3371431827545166,
0.19834183156490326,
0.1350705623626709,
0.02605518326163292,
0.6015376448631287,
-0.19914931058883667,
-0.051754433661699295,
-0.30566954612731934,
0.0035072118043899536,
0.07000920921564102,
0.15750668942928314,
-0.2648790776729584,
-0.1183074563741684,
0.05070015788078308,
-0.18974347412586212,
-0.11716966331005096,
-0.21108199656009674,
0.18356862664222717,
-0.012626484036445618,
-0.33620262145996094,
-0.8137513399124146,
-0.14696410298347473,
0.1683219075202942,
0.29808056354522705,
-0.10294447839260101,
0.16094550490379333,
0.5675949454307556,
-0.02646499127149582,
0.09210676699876785,
0.5185130834579468,
0.11198271811008453,
0.15776073932647705,
-0.020104695111513138,
0.052773382514715195,
0.21086066961288452,
-0.053441330790519714,
0.10484584420919418,
0.1572989821434021,
0.0018038898706436157,
-0.12536777555942535,
0.2945416569709778,
0.20847149193286896,
-0.12604451179504395,
-0.143320232629776,
0.04519902169704437,
0.0007644658908247948,
-0.09775198996067047,
0.09372514486312866,
0.07132802903652191,
-0.15901747345924377,
-0.0981149822473526,
-0.25611796975135803,
-0.3406972587108612,
-0.028012380003929138,
-0.1255311369895935,
0.14587648212909698,
0.1647302508354187,
-0.006144516635686159,
0.14099064469337463,
-0.32912302017211914,
0.3090842068195343,
0.05499844625592232,
-0.13288536667823792,
-0.2961921989917755,
-0.11933756619691849,
-0.5893236994743347,
0.04566764086484909,
-0.061113905161619186,
-0.5289903283119202,
0.15214528143405914,
0.3244362771511078,
0.1560741662979126,
0.020580247044563293,
0.033994756639003754,
-0.4579610228538513,
-0.10552763938903809,
0.2652137577533722,
-0.6133129596710205,
0.10419276356697083,
-0.19888906180858612,
0.1499168574810028,
0.000853830948472023,
0.29359593987464905,
0.22012051939964294,
0.23704692721366882,
0.021503746509552002,
0.1590389460325241,
0.1622432917356491,
0.1419450342655182,
0.22378605604171753,
-0.016698651015758514,
-0.022850768640637398,
0.488941490650177,
0.17337727546691895,
0.2755284607410431,
-0.3339513838291168,
-0.23245742917060852,
-0.22725068032741547,
0.2942466735839844,
0.22136062383651733,
0.15554510056972504,
-0.03777895122766495,
0.0029989108443260193,
0.06634501367807388,
0.3365393280982971,
0.002802599221467972,
-0.41475537419319153,
-0.48902446031570435,
0.00988696701824665,
0.05367324501276016,
0.04908878356218338,
0.24796681106090546,
0.5102531909942627,
0.013230957090854645,
0.05402960628271103,
-0.2399691641330719,
-0.4003310799598694,
0.43494945764541626,
-0.16498789191246033,
0.14860837161540985,
-0.0401163287460804,
0.26813045144081116,
0.4486648440361023,
-0.07845180481672287,
-0.35148927569389343,
-0.01925334334373474,
0.3600773811340332,
-0.24137279391288757,
-0.1331910938024521,
0.29971522092819214,
0.3858630955219269,
-0.1430395096540451,
-0.035172879695892334,
-0.0849711000919342,
0.014436351135373116,
0.0524502694606781,
0.1392468810081482,
-0.03401399403810501
] |
https://github.com/huggingface/datasets/issues/672 | Questions about XSUM | I just started the generation on my side, I'll let you know how it goes :) | Hi there ✋
I'm looking into your `xsum` dataset and I have several questions on that.
So here is how I loaded the data:
```
>>> data = datasets.load_dataset('xsum', version='1.0.1')
>>> data['train']
Dataset(features: {'document': Value(dtype='string', id=None), 'summary': Value(dtype='string', id=None)}, num_rows: 204017)
>>> data['test']
Dataset(features: {'document': Value(dtype='string', id=None), 'summary': Value(dtype='string', id=None)}, num_rows: 11333)
```
The first issue is, the instance counts don’t match what I see on [the dataset's website](https://github.com/EdinburghNLP/XSum/tree/master/XSum-Dataset#what-builds-the-xsum-dataset) (11,333 vs 11,334 for test set; 204,017 vs 204,045 for training set)
```
… training (90%, 204,045), validation (5%, 11,332), and test (5%, 11,334) set.
```
Any thoughts why? Perhaps @mariamabarham could help here, since she recently had a PR on this dataaset https://github.com/huggingface/datasets/pull/289 (reviewed by @patrickvonplaten)
Another issue is that the instances don't seem to have IDs. The original datasets provides IDs for the instances: https://github.com/EdinburghNLP/XSum/blob/master/XSum-Dataset/XSum-TRAINING-DEV-TEST-SPLIT-90-5-5.json but to be able to use them, the dataset sizes need to match.
CC @jbragg
| 16 | Questions about XSUM
Hi there ✋
I'm looking into your `xsum` dataset and I have several questions on that.
So here is how I loaded the data:
```
>>> data = datasets.load_dataset('xsum', version='1.0.1')
>>> data['train']
Dataset(features: {'document': Value(dtype='string', id=None), 'summary': Value(dtype='string', id=None)}, num_rows: 204017)
>>> data['test']
Dataset(features: {'document': Value(dtype='string', id=None), 'summary': Value(dtype='string', id=None)}, num_rows: 11333)
```
The first issue is, the instance counts don’t match what I see on [the dataset's website](https://github.com/EdinburghNLP/XSum/tree/master/XSum-Dataset#what-builds-the-xsum-dataset) (11,333 vs 11,334 for test set; 204,017 vs 204,045 for training set)
```
… training (90%, 204,045), validation (5%, 11,332), and test (5%, 11,334) set.
```
Any thoughts why? Perhaps @mariamabarham could help here, since she recently had a PR on this dataaset https://github.com/huggingface/datasets/pull/289 (reviewed by @patrickvonplaten)
Another issue is that the instances don't seem to have IDs. The original datasets provides IDs for the instances: https://github.com/EdinburghNLP/XSum/blob/master/XSum-Dataset/XSum-TRAINING-DEV-TEST-SPLIT-90-5-5.json but to be able to use them, the dataset sizes need to match.
CC @jbragg
I just started the generation on my side, I'll let you know how it goes :) | [
-0.09919890761375427,
-0.3942703306674957,
-0.15124885737895966,
0.499251127243042,
0.3250367045402527,
0.008215084671974182,
0.1899511069059372,
-0.03340330347418785,
0.2197483628988266,
0.297578901052475,
-0.18567997217178345,
0.2214597463607788,
0.09753703325986862,
0.4401785135269165,
0.1296776384115219,
0.1508605182170868,
-0.0050970762968063354,
-0.06835979223251343,
-0.37305572628974915,
-0.3198927640914917,
-0.05016151815652847,
0.05404309928417206,
-0.04878675192594528,
-0.12313507497310638,
-0.6788253784179688,
0.047092266380786896,
-0.13023065030574799,
0.27826085686683655,
-0.12477418035268784,
-0.17702849209308624,
0.23572663962841034,
0.05728667229413986,
0.03471476584672928,
0.5405396223068237,
-0.00010533641034271568,
-0.020736966282129288,
0.10161630809307098,
-0.030688269063830376,
-0.08494290709495544,
0.25067347288131714,
-0.16588512063026428,
-0.011623257771134377,
-0.03316710144281387,
-0.3924214541912079,
-0.0799613893032074,
0.05152713507413864,
-0.13154330849647522,
-0.38202419877052307,
0.22575591504573822,
-0.008658578619360924,
0.21699179708957672,
0.15485027432441711,
0.1296728402376175,
-0.056498076766729355,
-0.04474548250436783,
-0.07055732607841492,
0.08073897659778595,
0.2239103466272354,
0.3608609437942505,
0.25623616576194763,
0.07276622205972672,
0.17262358963489532,
0.07621783763170242,
-0.18728148937225342,
0.3275933861732483,
0.06389632821083069,
0.3388044238090515,
-0.25829872488975525,
-0.29199376702308655,
0.29885321855545044,
0.8362565040588379,
-0.0605645626783371,
-0.28564175963401794,
-0.013232588768005371,
-0.01550209615379572,
-0.13693168759346008,
0.17291328310966492,
0.07791770249605179,
0.32552775740623474,
-0.040263909846544266,
-0.2604093849658966,
0.3819592595100403,
-0.25953471660614014,
0.0025324001908302307,
-0.0883050262928009,
-0.1223713606595993,
-0.053110312670469284,
-0.003992907702922821,
-0.25958502292633057,
-0.04027371108531952,
0.10876238346099854,
-0.08857103437185287,
0.16883909702301025,
0.20639975368976593,
-0.2878930866718292,
-0.11792348325252533,
-0.02239415794610977,
-0.019895389676094055,
0.23440206050872803,
0.1514640748500824,
0.25661134719848633,
0.02285626344382763,
-0.3487001061439514,
0.05819222331047058,
0.1865372657775879,
0.24892406165599823,
0.4371139407157898,
-0.5546719431877136,
-0.006097257137298584,
-0.11868096888065338,
-0.12253779172897339,
0.07983577996492386,
-0.38361117243766785,
-0.026628781110048294,
0.03925743326544762,
0.016744717955589294,
-0.1728741079568863,
-0.3478005826473236,
-0.23498135805130005,
0.27125582098960876,
0.01848321408033371,
-0.09214508533477783,
0.15893080830574036,
-0.13195693492889404,
0.043596528470516205,
0.40839600563049316,
0.027719318866729736,
0.032750245183706284,
-0.558765709400177,
-0.3067184090614319,
-0.3500444293022156,
0.1029692143201828,
-0.06930682808160782,
0.012762611731886864,
0.0917777270078659,
-0.07230938971042633,
0.3852653503417969,
-0.0754471942782402,
0.24387113749980927,
-0.017749952152371407,
0.06546331942081451,
0.11458536982536316,
-0.3395024240016937,
0.2190769761800766,
0.041836973279714584,
-0.02165987901389599,
-0.07255108654499054,
0.008233226835727692,
0.008200161159038544,
-0.018536053597927094,
-0.13987118005752563,
-0.2128385603427887,
0.005069015547633171,
0.32545149326324463,
-0.35571593046188354,
-0.2653193771839142,
-0.14581909775733948,
0.007662501186132431,
0.23245999217033386,
0.21268877387046814,
-0.2090703845024109,
-0.11027467250823975,
0.08030697703361511,
-0.1324114203453064,
0.16875427961349487,
-0.0175945907831192,
-0.6140215992927551,
0.029374167323112488,
-0.024933956563472748,
-0.25689762830734253,
0.08732622861862183,
-0.01960291713476181,
0.015685036778450012,
0.26005318760871887,
0.11476850509643555,
0.16822099685668945,
-0.5175316333770752,
-0.4441337287425995,
-0.10442718118429184,
-0.3349783420562744,
-0.17460300028324127,
-0.09144813567399979,
0.17130962014198303,
0.11711547523736954,
0.017360035330057144,
-0.13369794189929962,
0.15482428669929504,
0.03799065947532654,
0.07897575944662094,
-0.16547013819217682,
-0.4269624948501587,
-0.05534486472606659,
-0.02855660766363144,
0.17144393920898438,
-0.0690065324306488,
-0.24672171473503113,
-0.10602685064077377,
0.32756543159484863,
0.17694631218910217,
-0.04191550984978676,
-0.0768796056509018,
0.051374711096286774,
0.32360514998435974,
-0.15542460978031158,
0.07694004476070404,
-0.15863916277885437,
-0.030163034796714783,
0.3010194003582001,
0.06839429587125778,
0.25812262296676636,
0.7335657477378845,
-0.061501722782850266,
-0.39427754282951355,
-0.20832140743732452,
0.002754341810941696,
-0.18399325013160706,
0.19299039244651794,
-0.19890114665031433,
0.0005776453763246536,
-0.2506178319454193,
-0.1730106770992279,
0.13717563450336456,
-0.5779197812080383,
0.03431464359164238,
-0.5610538125038147,
0.3250958025455475,
0.006631352007389069,
0.03155699372291565,
0.07628069072961807,
0.2840645909309387,
-0.033601418137550354,
-0.24835532903671265,
-0.028812125325202942,
0.5453806519508362,
0.16160959005355835,
0.05350639671087265,
0.1831555962562561,
0.19319447875022888,
0.381239116191864,
-0.18894103169441223,
0.15185199677944183,
-0.26460370421409607,
-0.04390301555395126,
-0.20533356070518494,
-0.3492263853549957,
0.23604752123355865,
-0.11437208950519562,
0.010200262069702148,
-0.07597710192203522,
0.0012271907180547714,
0.008439673110842705,
-0.13550660014152527,
0.034424737095832825,
0.00996062159538269,
0.16538995504379272,
0.18450771272182465,
-0.21318522095680237,
0.07379748672246933,
0.026026278734207153,
0.43624311685562134,
-0.337013840675354,
-0.15596352517604828,
-0.2162284255027771,
-0.34238049387931824,
-0.19678103923797607,
0.131641685962677,
0.09406215697526932,
0.013656321913003922,
0.51567143201828,
0.2999621033668518,
0.07221655547618866,
-0.042290978133678436,
-0.0838761031627655,
-0.1740972399711609,
0.03691037744283676,
0.00469323992729187,
-0.0680328756570816,
-0.04236254841089249,
-0.06613125652074814,
-0.00611917395144701,
-0.17681506276130676,
0.11347034573554993,
0.10104551166296005,
0.1873125433921814,
-0.44353267550468445,
-0.3401433825492859,
-0.14087702333927155,
-0.07071613520383835,
0.2071118801832199,
0.18281574547290802,
0.14015711843967438,
-0.2619084417819977,
0.18769718706607819,
0.07380601018667221,
-0.047051362693309784,
-0.016537493094801903,
-0.3119051456451416,
0.28468644618988037,
0.042717255651950836,
0.12915487587451935,
0.06599650532007217,
-0.16815665364265442,
-0.15260571241378784,
0.20715855062007904,
0.003965052776038647,
0.36341458559036255,
0.4104004204273224,
-0.10477705299854279,
-0.03563174232840538,
0.13011901080608368,
-0.4129676818847656,
0.015660732984542847,
-0.20753653347492218,
0.31648141145706177,
-0.1310066431760788,
0.04507756605744362,
0.0733688548207283,
-0.03890729695558548,
0.27378103137016296,
-0.018750403076410294,
-0.2886245548725128,
-0.10206989198923111,
0.15808559954166412,
-0.2652379274368286,
-0.10011567175388336,
-0.5698403120040894,
-0.0769091546535492,
-0.06942707300186157,
-0.05771718919277191,
0.4787973463535309,
0.2264365553855896,
0.08526552468538284,
-0.08462942391633987,
0.1478222757577896,
0.27936235070228577,
-0.18703818321228027,
-0.401579350233078,
-0.8443461656570435,
0.3063880205154419,
-0.15746422111988068,
-0.5241184234619141,
0.021416250616312027,
-0.059847019612789154,
0.34827372431755066,
0.13012880086898804,
-0.3654979467391968,
-0.32577699422836304,
-0.015212247148156166,
-0.11983746290206909,
0.5110431909561157,
0.2357800155878067,
0.19523465633392334,
-0.1350649744272232,
-0.1865757554769516,
-0.27908799052238464,
-0.031917233020067215,
0.2907136082649231,
0.2476893663406372,
0.4593498110771179,
-0.2880561649799347,
-0.2950659394264221,
-0.25883615016937256,
0.06973318010568619,
0.21786627173423767,
-0.16104578971862793,
-0.007418610155582428,
-0.05472618341445923,
-0.09702827036380768,
0.055426813662052155,
-0.15176908671855927,
0.6240476369857788,
-0.09670466184616089,
-0.08541546761989594,
0.16258767247200012,
0.22187605500221252,
0.2558007538318634,
-0.05411063879728317,
0.12690980732440948,
-0.2075280249118805,
-0.12938770651817322,
-0.23948891460895538,
-0.04753156751394272,
0.037242740392684937,
-0.024495456367731094,
-0.06534723192453384,
-0.13259576261043549,
-0.09336619079113007,
-0.10985840857028961,
-0.05938218533992767,
0.1681642234325409,
-0.0372898206114769,
-0.9834536910057068,
0.2603168785572052,
0.034939609467983246,
0.3408541679382324,
-0.2668490409851074,
-0.027139902114868164,
0.026313800364732742,
-0.11470922827720642,
0.09554300457239151,
0.21088877320289612,
0.1977611780166626,
-0.2447778433561325,
-0.20830486714839935,
0.2636698782444,
-0.06135174632072449,
-0.2832504212856293,
-0.048857323825359344,
-0.11743664741516113,
0.049440909177064896,
0.19239717721939087,
0.05553429573774338,
-0.3075263202190399,
-0.046210553497076035,
0.17023144662380219,
0.22386091947555542,
-0.32082459330558777,
-0.188940167427063,
-0.08297886699438095,
-0.03033224493265152,
0.04471387714147568,
-0.1673034429550171,
-0.14538176357746124,
0.30556556582450867,
-0.3080766499042511,
-0.13695530593395233,
-0.16496069729328156,
-0.09491421282291412,
0.5748015642166138,
0.08094871044158936,
0.4154921770095825,
-0.01849723607301712,
0.33749839663505554,
0.3749868869781494,
0.08605039119720459,
0.2072853147983551,
0.48640501499176025,
-0.16348740458488464,
0.25267529487609863,
0.13264688849449158,
-0.37361961603164673,
0.3611026406288147,
0.1413072645664215,
0.09286314249038696,
-0.5118601322174072,
-0.24035832285881042,
0.0719362422823906,
-0.18289697170257568,
0.24797944724559784,
0.10521060973405838,
0.15590836107730865,
-0.07179617881774902,
-0.3228149712085724,
0.54264897108078,
0.12310895323753357,
0.008122570812702179,
0.3860912322998047,
0.35647135972976685,
-0.13401231169700623,
-0.20519426465034485,
0.5239415764808655,
0.8795140385627747,
0.08751548081636429,
-0.19182634353637695,
0.2991398572921753,
0.40962135791778564,
0.345293253660202,
-0.4674290418624878,
0.043030090630054474,
-0.23555119335651398,
-0.340891569852829,
0.0505557507276535,
-0.10154643654823303,
0.13075222074985504,
0.3114386796951294,
0.1271602213382721,
0.03466952592134476,
-0.16332069039344788,
-0.27631691098213196,
-0.18571434915065765,
0.19754859805107117,
-0.27706074714660645,
-0.17488455772399902,
0.2784392237663269,
0.2749241590499878,
0.10198511183261871,
0.16659772396087646,
-0.027052849531173706,
0.039735347032547,
-0.316753089427948,
-0.005298927426338196,
-0.05536439269781113,
-0.029916496947407722,
-0.07150818407535553,
0.03088200092315674,
0.05011242628097534,
-0.3300331234931946,
-0.04633144289255142,
0.3366263210773468,
0.2604947090148926,
-0.060324255377054214,
-0.09449900686740875,
0.15690670907497406,
-0.3263683021068573,
0.05907246470451355,
0.31394779682159424,
-0.015651250258088112,
0.382367879152298,
-0.1759953498840332,
-0.196353942155838,
-0.04524172097444534,
0.0787418782711029,
0.2471218854188919,
-0.38186806440353394,
-0.07535035908222198,
-0.023480549454689026,
-0.4934099614620209,
-0.04538708180189133,
0.1884385049343109,
-0.08485842496156693,
-0.10153774917125702,
0.1960269808769226,
0.23744431138038635,
-0.1112995594739914,
0.45718446373939514,
-0.12396369874477386,
0.03858140856027603,
-0.11483460664749146,
0.19393008947372437,
0.45981529355049133,
-0.1795014888048172,
0.2613754868507385,
0.03431358560919762,
0.003818713128566742,
-0.17969632148742676,
0.06939276307821274,
0.4981958866119385,
-0.12359333038330078,
-0.04104897379875183,
-0.2215932160615921,
-0.22352582216262817,
0.007303768303245306,
0.24832476675510406,
0.28111904859542847,
0.004883624613285065,
0.13701865077018738,
-0.34417372941970825,
-0.4759088456630707,
0.26092493534088135,
0.11047658324241638,
0.43161895871162415,
-0.2707904279232025,
0.23532050848007202,
-0.03585527092218399,
0.08759952336549759,
-0.3749721348285675,
-0.024137988686561584,
-0.09026706218719482,
0.07378681004047394,
0.0886554941534996,
-0.0670766830444336,
0.2347097396850586,
-0.36920973658561707,
0.18375995755195618,
-0.014069698750972748,
-0.17927677929401398,
-0.23888584971427917,
-0.13599619269371033,
0.09261499345302582,
0.1513490378856659,
-0.09982792288064957,
0.2642744779586792,
0.002574194222688675,
-0.09536580741405487,
-0.05649859458208084,
0.08551710844039917,
-0.1130070611834526,
0.03639301657676697,
0.31859686970710754,
0.04439878091216087,
0.15257762372493744,
-0.09021225571632385,
0.12717604637145996,
0.11966513842344284,
0.2854102849960327,
0.14346158504486084,
-0.24549168348312378,
0.03555825352668762,
-0.25117695331573486,
-0.29505521059036255,
0.03420831635594368,
-0.05942215025424957,
0.12594224512577057,
0.2847484350204468,
-0.09414565563201904,
0.14979951083660126,
0.1781172901391983,
0.34418368339538574,
0.3828388452529907,
-0.10774918645620346,
0.12764519453048706,
-0.013042734935879707,
0.324131578207016,
-0.3050272762775421,
-0.014857596717774868,
0.04321296513080597,
0.2958385646343231,
-0.0976334810256958,
0.09050899744033813,
0.1272357702255249,
-0.0715453252196312,
-0.1671735942363739,
0.16737642884254456,
0.1937968134880066,
-0.09805214405059814,
0.12178339064121246,
0.23659460246562958,
-0.2271396368741989,
0.01573588326573372,
0.1643598973751068,
-0.04266738519072533,
-0.06493308395147324,
0.2640986442565918,
0.02769559994339943,
0.4860457181930542,
0.1873307228088379,
0.16176456212997437,
0.032832298427820206,
0.012053210288286209,
-0.08439597487449646,
0.3501390814781189,
0.15191057324409485,
0.1584688425064087,
0.007601439952850342,
0.5896817445755005,
-0.2219509482383728,
-0.01627470552921295,
-0.3264859914779663,
-0.00003316998481750488,
0.101242296397686,
0.15746350586414337,
-0.25574108958244324,
-0.13252630829811096,
0.041788145899772644,
-0.21131199598312378,
-0.1075143814086914,
-0.24855215847492218,
0.1659449338912964,
-0.02263665944337845,
-0.33089637756347656,
-0.76798415184021,
-0.10131079703569412,
0.16100290417671204,
0.25555768609046936,
-0.09821273386478424,
0.14425203204154968,
0.5694272518157959,
-0.05783438682556152,
0.07394041121006012,
0.525484561920166,
0.10987229645252228,
0.2007330060005188,
0.013493096455931664,
0.036666784435510635,
0.21172454953193665,
-0.06288017332553864,
0.0946507379412651,
0.13888728618621826,
-0.025264889001846313,
-0.1828075498342514,
0.27136358618736267,
0.20259946584701538,
-0.11875820904970169,
-0.17261454463005066,
0.10315649956464767,
0.006584749557077885,
-0.0567353293299675,
0.09058299660682678,
0.03451162949204445,
-0.1706051081418991,
-0.09131018072366714,
-0.1935308873653412,
-0.3727799654006958,
-0.022753886878490448,
-0.09960904717445374,
0.18101124465465546,
0.17651939392089844,
-0.01642851158976555,
0.13490504026412964,
-0.36238518357276917,
0.31604236364364624,
0.067789226770401,
-0.13625815510749817,
-0.3066978454589844,
-0.13032282888889313,
-0.5872722268104553,
0.01990373432636261,
-0.05684028938412666,
-0.512330949306488,
0.14079159498214722,
0.34288227558135986,
0.12732547521591187,
0.03760426491498947,
0.000041268765926361084,
-0.4160142242908478,
-0.1572108119726181,
0.3020840883255005,
-0.5865222811698914,
0.06648928672075272,
-0.22073622047901154,
0.16539058089256287,
-0.010511880740523338,
0.26803913712501526,
0.22002217173576355,
0.2306525707244873,
0.02750363200902939,
0.1574287712574005,
0.2008642554283142,
0.19315007328987122,
0.23205351829528809,
-0.020282335579395294,
-0.0036085713654756546,
0.47155433893203735,
0.16009631752967834,
0.2669735848903656,
-0.2912590205669403,
-0.20939774811267853,
-0.20126557350158691,
0.30933332443237305,
0.2263789176940918,
0.14452560245990753,
-0.0006399527192115784,
0.04837668687105179,
0.05735541135072708,
0.3266700506210327,
0.059876449406147,
-0.4564240872859955,
-0.49849799275398254,
0.03366410732269287,
0.0071397870779037476,
0.017011459916830063,
0.28586044907569885,
0.49123910069465637,
-0.017057381570339203,
0.09806741774082184,
-0.2187519520521164,
-0.38293009996414185,
0.43895867466926575,
-0.14735542237758636,
0.15804803371429443,
-0.05358881130814552,
0.27510005235671997,
0.46188533306121826,
-0.07581215351819992,
-0.32381340861320496,
0.02026452124118805,
0.40704360604286194,
-0.2786366939544678,
-0.11596101522445679,
0.26500293612480164,
0.37943530082702637,
-0.13336482644081116,
-0.022267445921897888,
-0.03955536335706711,
-0.017436277121305466,
0.04120311141014099,
0.18548107147216797,
-0.03609815984964371
] |
https://github.com/huggingface/datasets/issues/672 | Questions about XSUM | Hmm after a first run I'm still missing 136668/226711 urls.
I'll relaunch it tomorrow to try to get the remaining ones. | Hi there ✋
I'm looking into your `xsum` dataset and I have several questions on that.
So here is how I loaded the data:
```
>>> data = datasets.load_dataset('xsum', version='1.0.1')
>>> data['train']
Dataset(features: {'document': Value(dtype='string', id=None), 'summary': Value(dtype='string', id=None)}, num_rows: 204017)
>>> data['test']
Dataset(features: {'document': Value(dtype='string', id=None), 'summary': Value(dtype='string', id=None)}, num_rows: 11333)
```
The first issue is, the instance counts don’t match what I see on [the dataset's website](https://github.com/EdinburghNLP/XSum/tree/master/XSum-Dataset#what-builds-the-xsum-dataset) (11,333 vs 11,334 for test set; 204,017 vs 204,045 for training set)
```
… training (90%, 204,045), validation (5%, 11,332), and test (5%, 11,334) set.
```
Any thoughts why? Perhaps @mariamabarham could help here, since she recently had a PR on this dataaset https://github.com/huggingface/datasets/pull/289 (reviewed by @patrickvonplaten)
Another issue is that the instances don't seem to have IDs. The original datasets provides IDs for the instances: https://github.com/EdinburghNLP/XSum/blob/master/XSum-Dataset/XSum-TRAINING-DEV-TEST-SPLIT-90-5-5.json but to be able to use them, the dataset sizes need to match.
CC @jbragg
| 21 | Questions about XSUM
Hi there ✋
I'm looking into your `xsum` dataset and I have several questions on that.
So here is how I loaded the data:
```
>>> data = datasets.load_dataset('xsum', version='1.0.1')
>>> data['train']
Dataset(features: {'document': Value(dtype='string', id=None), 'summary': Value(dtype='string', id=None)}, num_rows: 204017)
>>> data['test']
Dataset(features: {'document': Value(dtype='string', id=None), 'summary': Value(dtype='string', id=None)}, num_rows: 11333)
```
The first issue is, the instance counts don’t match what I see on [the dataset's website](https://github.com/EdinburghNLP/XSum/tree/master/XSum-Dataset#what-builds-the-xsum-dataset) (11,333 vs 11,334 for test set; 204,017 vs 204,045 for training set)
```
… training (90%, 204,045), validation (5%, 11,332), and test (5%, 11,334) set.
```
Any thoughts why? Perhaps @mariamabarham could help here, since she recently had a PR on this dataaset https://github.com/huggingface/datasets/pull/289 (reviewed by @patrickvonplaten)
Another issue is that the instances don't seem to have IDs. The original datasets provides IDs for the instances: https://github.com/EdinburghNLP/XSum/blob/master/XSum-Dataset/XSum-TRAINING-DEV-TEST-SPLIT-90-5-5.json but to be able to use them, the dataset sizes need to match.
CC @jbragg
Hmm after a first run I'm still missing 136668/226711 urls.
I'll relaunch it tomorrow to try to get the remaining ones. | [
-0.019233573228120804,
-0.27874845266342163,
-0.13158796727657318,
0.45143795013427734,
0.3294110894203186,
0.013247646391391754,
0.08347151428461075,
-0.03241093084216118,
0.16328845918178558,
0.2532368004322052,
-0.2140221744775772,
0.18124085664749146,
0.10411800444126129,
0.343321293592453,
0.18061824142932892,
0.1001860722899437,
-0.03980574756860733,
-0.14152376353740692,
-0.4157715439796448,
-0.37894439697265625,
-0.1317085325717926,
0.1342008113861084,
-0.10899490118026733,
-0.12426842749118805,
-0.6119698882102966,
0.0783977285027504,
-0.23884762823581696,
0.33788031339645386,
-0.08541129529476166,
-0.22226741909980774,
0.22413598001003265,
0.06372979283332825,
0.08936834335327148,
0.5341077446937561,
-0.00010782972094602883,
-0.022055257111787796,
0.14247560501098633,
-0.017041385173797607,
-0.16243749856948853,
0.25388675928115845,
-0.231166273355484,
0.026841847226023674,
0.048200540244579315,
-0.40547510981559753,
-0.02636408992111683,
0.11730358749628067,
-0.09464818239212036,
-0.30968835949897766,
0.15807867050170898,
0.09594234079122543,
0.1845942586660385,
0.15719136595726013,
0.08935798704624176,
-0.02565315179526806,
0.005185924470424652,
-0.082803875207901,
0.14461681246757507,
0.21971209347248077,
0.3912554383277893,
0.30322882533073425,
0.06803984194993973,
0.18048101663589478,
0.061224088072776794,
-0.21537010371685028,
0.2798308730125427,
0.09812821447849274,
0.2757806181907654,
-0.2437669336795807,
-0.30179986357688904,
0.2616388499736786,
0.7973626852035522,
-0.0047417618334293365,
-0.26188766956329346,
-0.02697419375181198,
-0.0765676498413086,
-0.1153857558965683,
0.20186716318130493,
0.05570341646671295,
0.3726736307144165,
0.0041703470051288605,
-0.3282064199447632,
0.3529011011123657,
-0.25582072138786316,
0.1323099434375763,
-0.12885978817939758,
-0.04430392384529114,
0.011796435341238976,
0.007970213890075684,
-0.2504277527332306,
0.042773403227329254,
0.1230291947722435,
-0.10499158501625061,
0.2351706326007843,
0.22706474363803864,
-0.21584264934062958,
-0.14378823339939117,
0.06098464876413345,
0.005284123122692108,
0.2470932900905609,
0.22000724077224731,
0.263689786195755,
0.09732162952423096,
-0.40945926308631897,
0.026652773842215538,
0.21864722669124603,
0.20328746736049652,
0.3677199184894562,
-0.5091801285743713,
0.09340573847293854,
-0.042415156960487366,
-0.08678990602493286,
0.0701022669672966,
-0.3361898958683014,
0.02129155397415161,
-0.09371702373027802,
0.08890734612941742,
-0.19430853426456451,
-0.3586159646511078,
-0.16241511702537537,
0.21170158684253693,
0.035316966474056244,
-0.13664557039737701,
0.21738237142562866,
-0.16548997163772583,
-0.0143269132822752,
0.4042075276374817,
0.02371475100517273,
0.021250087767839432,
-0.5393812656402588,
-0.26023542881011963,
-0.34755709767341614,
0.11821797490119934,
-0.059630103409290314,
-0.010099070146679878,
0.12567739188671112,
-0.040250081568956375,
0.41357263922691345,
-0.1710355132818222,
0.2352253645658493,
0.00673661008477211,
0.07880054414272308,
0.15201599895954132,
-0.322806715965271,
0.23113389313220978,
0.08896943926811218,
0.04226840287446976,
-0.07922534644603729,
-0.021215002983808517,
-0.026082176715135574,
-0.0076281726360321045,
-0.20802050828933716,
-0.2832220792770386,
0.04831650108098984,
0.30524879693984985,
-0.39531171321868896,
-0.2976083755493164,
-0.16435083746910095,
-0.05149977281689644,
0.06171008199453354,
0.21278679370880127,
-0.23471733927726746,
-0.06928863376379013,
0.1486751288175583,
-0.12363291531801224,
0.26569056510925293,
0.0006676763296127319,
-0.4929632544517517,
-0.007899109274148941,
0.038150861859321594,
-0.24426054954528809,
0.11149421334266663,
0.01654953509569168,
-0.0232427716255188,
0.2643287479877472,
0.07462150603532791,
0.15984317660331726,
-0.47440385818481445,
-0.4691448509693146,
-0.04264689236879349,
-0.32277798652648926,
-0.18891814351081848,
-0.14455078542232513,
0.09059657901525497,
0.09714696556329727,
0.0018749269656836987,
-0.11551667004823685,
0.20479242503643036,
0.07552307844161987,
0.09304267913103104,
-0.20533184707164764,
-0.46543219685554504,
-0.10009075701236725,
-0.07382701337337494,
0.3007148206233978,
0.02934357523918152,
-0.2999730706214905,
-0.10044150799512863,
0.3271591067314148,
0.22325646877288818,
-0.06686760485172272,
-0.08785262703895569,
0.1660558432340622,
0.2788275480270386,
-0.08237732946872711,
0.11092773079872131,
-0.1868293285369873,
0.04142577573657036,
0.31091436743736267,
0.07509250193834305,
0.25922563672065735,
0.6795739531517029,
-0.02168416604399681,
-0.3754802644252777,
-0.24138705432415009,
0.056828901171684265,
-0.19285479187965393,
0.15841563045978546,
-0.15346196293830872,
-0.013311930000782013,
-0.11180421710014343,
-0.22052966058254242,
0.05730634182691574,
-0.5747531652450562,
0.10634588450193405,
-0.5254188776016235,
0.37927237153053284,
-0.017877599224448204,
0.07875735312700272,
0.16517765820026398,
0.32528921961784363,
0.04516459256410599,
-0.30621814727783203,
0.0017506899312138557,
0.5623016357421875,
0.16072572767734528,
0.013105720281600952,
0.35887765884399414,
0.19969764351844788,
0.4656713902950287,
-0.24284566938877106,
0.09501034021377563,
-0.14355266094207764,
-0.031496524810791016,
-0.20361903309822083,
-0.3394329845905304,
0.20869216322898865,
-0.14231091737747192,
0.056908998638391495,
0.04825136810541153,
0.08409080654382706,
0.00550270639359951,
-0.1831812560558319,
-0.04780762642621994,
0.05291865020990372,
0.23954570293426514,
0.1336754411458969,
-0.30540987849235535,
0.09817558526992798,
0.021970413625240326,
0.37356075644493103,
-0.39049914479255676,
-0.24741224944591522,
-0.2403515875339508,
-0.24153950810432434,
-0.22175541520118713,
0.10886650532484055,
0.06452586501836777,
0.006663333624601364,
0.4553331732749939,
0.298520028591156,
0.1484997570514679,
-0.02453467808663845,
-0.14641344547271729,
-0.19212472438812256,
0.07654528319835663,
0.12659752368927002,
-0.13745170831680298,
-0.13768088817596436,
-0.09141102433204651,
0.05388090759515762,
-0.20656129717826843,
-0.03737514466047287,
0.11474364250898361,
0.10245774686336517,
-0.4339110553264618,
-0.3744903802871704,
-0.24696925282478333,
-0.11583397537469864,
0.24958132207393646,
0.11475260555744171,
0.14984875917434692,
-0.3861023783683777,
0.17437350749969482,
-0.014784496277570724,
-0.11486698687076569,
0.013332424685359001,
-0.4554794132709503,
0.28211408853530884,
0.033330634236335754,
0.09569162130355835,
0.08304916322231293,
-0.22912591695785522,
-0.1364937424659729,
0.18685753643512726,
-0.014990649186074734,
0.33063066005706787,
0.3095940947532654,
-0.1426820456981659,
-0.001428108662366867,
0.06148272007703781,
-0.4463157057762146,
0.033460043370723724,
-0.16776630282402039,
0.21531438827514648,
-0.09461970627307892,
0.0360545739531517,
0.044139161705970764,
-0.0399482436478138,
0.2810700535774231,
0.04538200795650482,
-0.13283753395080566,
-0.06034606695175171,
0.19510622322559357,
-0.31327521800994873,
-0.059658512473106384,
-0.5780404806137085,
-0.07709049433469772,
-0.03025246225297451,
-0.08712132275104523,
0.4910756051540375,
0.22039856016635895,
0.09631895273923874,
-0.1681661456823349,
0.19599062204360962,
0.24433812499046326,
-0.2565474212169647,
-0.3770159184932709,
-0.8533005714416504,
0.3729168176651001,
-0.13951055705547333,
-0.5446469783782959,
0.02305743470788002,
-0.05143990367650986,
0.29162514209747314,
0.1466272920370102,
-0.467515766620636,
-0.33428773283958435,
0.016856849193572998,
-0.16700761020183563,
0.4653501808643341,
0.22314730286598206,
0.21028344333171844,
-0.11818443238735199,
-0.206025630235672,
-0.24948331713676453,
-0.04212735593318939,
0.2474309206008911,
0.3107559382915497,
0.5551186800003052,
-0.3252283036708832,
-0.33983883261680603,
-0.20122665166854858,
0.1445457637310028,
0.16469338536262512,
-0.029896970838308334,
0.02226102352142334,
-0.08066397160291672,
-0.10487137734889984,
0.1389026790857315,
-0.0809604600071907,
0.6621094942092896,
-0.12536469101905823,
-0.0696088895201683,
0.2355695366859436,
0.2911699414253235,
0.22554831206798553,
-0.14717543125152588,
0.08586221933364868,
-0.24584150314331055,
-0.2381785809993744,
-0.18771570920944214,
-0.022772423923015594,
0.05191855877637863,
0.01703369989991188,
-0.10069452226161957,
-0.11457271873950958,
-0.07201234996318817,
0.0026857545599341393,
-0.02675721049308777,
0.19600102305412292,
-0.06189350038766861,
-1.0401005744934082,
0.2407352775335312,
0.037427015602588654,
0.36766040325164795,
-0.30052340030670166,
-0.015107539482414722,
0.017106305807828903,
-0.1203271821141243,
0.0688885897397995,
0.2533518671989441,
0.1982678771018982,
-0.2970380485057831,
-0.1915176659822464,
0.30724674463272095,
-0.06021301820874214,
-0.38163405656814575,
-0.01566050574183464,
-0.1553146243095398,
0.04238603264093399,
0.27002692222595215,
0.04651908576488495,
-0.2352752387523651,
0.002284436719492078,
0.20127183198928833,
0.21299174427986145,
-0.3095555603504181,
-0.08490883558988571,
-0.046338506042957306,
-0.20084768533706665,
0.10597068071365356,
-0.17834004759788513,
-0.12481284141540527,
0.2661639451980591,
-0.27172625064849854,
-0.19760072231292725,
-0.14048552513122559,
-0.19484418630599976,
0.5508690476417542,
0.025192268192768097,
0.43831267952919006,
0.009295632131397724,
0.3014676868915558,
0.41044050455093384,
0.09523938596248627,
0.18885168433189392,
0.4933246076107025,
-0.16350439190864563,
0.24249237775802612,
0.18026143312454224,
-0.4166300594806671,
0.4104345738887787,
0.20774883031845093,
0.05063151568174362,
-0.5396619439125061,
-0.16872186958789825,
0.1276024580001831,
-0.19330088794231415,
0.308647483587265,
0.055559977889060974,
0.15291902422904968,
-0.11292771995067596,
-0.2701953947544098,
0.533548891544342,
0.09596522152423859,
-0.06356195360422134,
0.41995105147361755,
0.4356449246406555,
-0.17222577333450317,
-0.18563060462474823,
0.5252236723899841,
0.9401890635490417,
0.11801137030124664,
-0.20103022456169128,
0.2859897315502167,
0.362859308719635,
0.32005009055137634,
-0.43898648023605347,
0.10767446458339691,
-0.09098869562149048,
-0.31764721870422363,
-0.017318546772003174,
-0.09788927435874939,
0.11442592740058899,
0.27627506852149963,
0.18941515684127808,
0.12742513418197632,
-0.10481047630310059,
-0.20839709043502808,
-0.0775122344493866,
0.1711336076259613,
-0.21120670437812805,
-0.1323251724243164,
0.312809020280838,
0.2388981282711029,
0.15377312898635864,
0.19697189331054688,
-0.018821915611624718,
0.04764634370803833,
-0.3277888894081116,
-0.021833021193742752,
-0.023286744952201843,
-0.05185415595769882,
-0.1385187804698944,
0.11361858993768692,
-0.027062077075242996,
-0.3384091258049011,
-0.17179280519485474,
0.39105698466300964,
0.25248461961746216,
-0.0504944734275341,
-0.19550412893295288,
0.2480485588312149,
-0.42639607191085815,
0.049789752811193466,
0.3418872356414795,
0.02501571550965309,
0.34806129336357117,
-0.21330660581588745,
-0.15713489055633545,
-0.05027659237384796,
0.04639569669961929,
0.1945440024137497,
-0.3856780529022217,
-0.06476165354251862,
-0.08569540083408356,
-0.39786845445632935,
-0.038869068026542664,
0.17455732822418213,
-0.1564904898405075,
-0.1440475732088089,
0.16518844664096832,
0.21854014694690704,
-0.017868120223283768,
0.4426906108856201,
-0.07477322220802307,
0.028831712901592255,
-0.14700298011302948,
0.21398808062076569,
0.4390411674976349,
-0.21444419026374817,
0.29314714670181274,
0.03348800167441368,
0.0004921145737171173,
-0.11982797831296921,
0.09704951196908951,
0.3956157863140106,
-0.03244076296687126,
-0.09340564906597137,
-0.3001122772693634,
-0.11837701499462128,
-0.05973712354898453,
0.22157993912696838,
0.2761351764202118,
-0.0285181924700737,
0.09468764066696167,
-0.3888755142688751,
-0.42925164103507996,
0.3315660357475281,
0.13178493082523346,
0.33455386757850647,
-0.34171923995018005,
0.24348190426826477,
0.014524584636092186,
-0.0421476811170578,
-0.34861522912979126,
0.07675109058618546,
-0.19793011248111725,
0.09030154347419739,
0.042844705283641815,
-0.05033423751592636,
0.3161007761955261,
-0.3747342824935913,
0.16446207463741302,
-0.0852758064866066,
-0.08342163264751434,
-0.1887989640235901,
-0.16127347946166992,
0.11844649910926819,
0.1784985065460205,
-0.08089663088321686,
0.25844764709472656,
0.01952136680483818,
-0.040792208164930344,
-0.02062283642590046,
-0.011881702579557896,
-0.10612311214208603,
0.07199201732873917,
0.307494580745697,
0.03198808804154396,
0.05275551974773407,
-0.059716008603572845,
0.16107365489006042,
0.11124542355537415,
0.3838047385215759,
0.21010033786296844,
-0.28393739461898804,
0.03379535675048828,
-0.29567641019821167,
-0.2647460401058197,
0.008883103728294373,
-0.0692964643239975,
0.09194532036781311,
0.32947486639022827,
-0.04328522831201553,
0.12339550256729126,
0.21550646424293518,
0.3226023018360138,
0.4006248712539673,
-0.20678798854351044,
0.1559055894613266,
-0.04390294477343559,
0.29108381271362305,
-0.26140254735946655,
-0.011665952391922474,
0.03098977357149124,
0.3084946870803833,
-0.1409594565629959,
0.01646767556667328,
0.12409105896949768,
-0.14461785554885864,
-0.11462131142616272,
0.1645524501800537,
0.31774839758872986,
-0.018169153481721878,
0.1336691826581955,
0.12399129569530487,
-0.2424307018518448,
-0.013505939394235611,
0.05978770554065704,
-0.012224718928337097,
-0.06607326120138168,
0.1807795763015747,
0.0019392222166061401,
0.5119619369506836,
0.18709248304367065,
0.16974753141403198,
-0.0036405250430107117,
-0.02996780350804329,
-0.12392903864383698,
0.2858313024044037,
0.16555020213127136,
0.14940685033798218,
-0.0646287053823471,
0.5828599333763123,
-0.22914336621761322,
0.022733254358172417,
-0.2644195556640625,
0.0174927469342947,
0.17375212907791138,
0.12465162575244904,
-0.26378583908081055,
-0.16056828200817108,
0.03703566640615463,
-0.22005869448184967,
-0.06291905045509338,
-0.3337854743003845,
0.11649095267057419,
0.01257985457777977,
-0.32298266887664795,
-0.8925778269767761,
-0.09082631021738052,
0.10982318222522736,
0.27546119689941406,
-0.12729379534721375,
0.10476931929588318,
0.592668890953064,
-0.04268711060285568,
0.11592434346675873,
0.42325395345687866,
0.11045020073652267,
0.13999715447425842,
-0.10323202610015869,
0.07575765997171402,
0.21459315717220306,
-0.03868620842695236,
0.13545724749565125,
0.15521696209907532,
0.05794571712613106,
-0.1702953428030014,
0.33814623951911926,
0.18811917304992676,
-0.09859208017587662,
-0.10251280665397644,
0.0549403540790081,
0.06994502246379852,
-0.061227019876241684,
0.1678125411272049,
0.06039945036172867,
-0.15034520626068115,
-0.0869881808757782,
-0.26060009002685547,
-0.4143606424331665,
-0.07760217040777206,
-0.14624612033367157,
0.13563039898872375,
0.18080618977546692,
0.028012488037347794,
0.11863024532794952,
-0.34753820300102234,
0.3643346130847931,
0.10196235030889511,
-0.10942234843969345,
-0.332622230052948,
-0.24143140017986298,
-0.6039546728134155,
-0.0895562693476677,
-0.035471800714731216,
-0.5677008628845215,
0.1905379742383957,
0.2993088364601135,
0.15375807881355286,
0.06264694035053253,
-0.04260803759098053,
-0.3574115037918091,
-0.12425090372562408,
0.19690591096878052,
-0.60658198595047,
0.08703793585300446,
-0.24835105240345,
0.2716670632362366,
-0.07301250100135803,
0.3079237639904022,
0.2601555287837982,
0.19199956953525543,
-0.003350071609020233,
0.19463840126991272,
0.1530909389257431,
0.12564772367477417,
0.2274765521287918,
0.02185697853565216,
0.023859085515141487,
0.4491068124771118,
0.16515794396400452,
0.2428269386291504,
-0.2997599244117737,
-0.2766379714012146,
-0.07123518735170364,
0.2449837625026703,
0.18595924973487854,
0.04272887855768204,
-0.051421843469142914,
-0.03749478980898857,
0.05629216134548187,
0.3808864951133728,
0.04279998689889908,
-0.43504488468170166,
-0.49970725178718567,
-0.014508847147226334,
0.0461159348487854,
0.07585994899272919,
0.3166544437408447,
0.4712297320365906,
-0.09472660720348358,
0.04669947177171707,
-0.13501952588558197,
-0.39133360981941223,
0.493997186422348,
-0.1814228892326355,
0.1789795160293579,
-0.061773963272571564,
0.28554975986480713,
0.45168402791023254,
0.0753912702202797,
-0.30388176441192627,
-0.05542851239442825,
0.4447307288646698,
-0.22479093074798584,
-0.19836857914924622,
0.23947317898273468,
0.38101571798324585,
-0.13663047552108765,
-0.013814050704240799,
-0.0970003604888916,
0.00499420240521431,
0.006737137213349342,
0.1402169018983841,
-0.010938381776213646
] |
https://github.com/huggingface/datasets/issues/672 | Questions about XSUM | So I managed to download them all but when parsing only 226,181/226,711 worked.
Not sure if it's worth digging and debugging parsing at this point :/ | Hi there ✋
I'm looking into your `xsum` dataset and I have several questions on that.
So here is how I loaded the data:
```
>>> data = datasets.load_dataset('xsum', version='1.0.1')
>>> data['train']
Dataset(features: {'document': Value(dtype='string', id=None), 'summary': Value(dtype='string', id=None)}, num_rows: 204017)
>>> data['test']
Dataset(features: {'document': Value(dtype='string', id=None), 'summary': Value(dtype='string', id=None)}, num_rows: 11333)
```
The first issue is, the instance counts don’t match what I see on [the dataset's website](https://github.com/EdinburghNLP/XSum/tree/master/XSum-Dataset#what-builds-the-xsum-dataset) (11,333 vs 11,334 for test set; 204,017 vs 204,045 for training set)
```
… training (90%, 204,045), validation (5%, 11,332), and test (5%, 11,334) set.
```
Any thoughts why? Perhaps @mariamabarham could help here, since she recently had a PR on this dataaset https://github.com/huggingface/datasets/pull/289 (reviewed by @patrickvonplaten)
Another issue is that the instances don't seem to have IDs. The original datasets provides IDs for the instances: https://github.com/EdinburghNLP/XSum/blob/master/XSum-Dataset/XSum-TRAINING-DEV-TEST-SPLIT-90-5-5.json but to be able to use them, the dataset sizes need to match.
CC @jbragg
| 26 | Questions about XSUM
Hi there ✋
I'm looking into your `xsum` dataset and I have several questions on that.
So here is how I loaded the data:
```
>>> data = datasets.load_dataset('xsum', version='1.0.1')
>>> data['train']
Dataset(features: {'document': Value(dtype='string', id=None), 'summary': Value(dtype='string', id=None)}, num_rows: 204017)
>>> data['test']
Dataset(features: {'document': Value(dtype='string', id=None), 'summary': Value(dtype='string', id=None)}, num_rows: 11333)
```
The first issue is, the instance counts don’t match what I see on [the dataset's website](https://github.com/EdinburghNLP/XSum/tree/master/XSum-Dataset#what-builds-the-xsum-dataset) (11,333 vs 11,334 for test set; 204,017 vs 204,045 for training set)
```
… training (90%, 204,045), validation (5%, 11,332), and test (5%, 11,334) set.
```
Any thoughts why? Perhaps @mariamabarham could help here, since she recently had a PR on this dataaset https://github.com/huggingface/datasets/pull/289 (reviewed by @patrickvonplaten)
Another issue is that the instances don't seem to have IDs. The original datasets provides IDs for the instances: https://github.com/EdinburghNLP/XSum/blob/master/XSum-Dataset/XSum-TRAINING-DEV-TEST-SPLIT-90-5-5.json but to be able to use them, the dataset sizes need to match.
CC @jbragg
So I managed to download them all but when parsing only 226,181/226,711 worked.
Not sure if it's worth digging and debugging parsing at this point :/ | [
-0.0844026505947113,
-0.3709561824798584,
-0.15182113647460938,
0.5515391230583191,
0.3594370484352112,
0.04052408039569855,
0.0683167353272438,
0.05969962105154991,
0.134743332862854,
0.2831321358680725,
-0.26395538449287415,
0.22201290726661682,
0.1665133833885193,
0.3795989155769348,
-0.009754383005201817,
0.0870644748210907,
-0.04583772271871567,
-0.04953141510486603,
-0.3420446217060089,
-0.27435368299484253,
-0.11294294148683548,
0.16725066304206848,
-0.06401820480823517,
-0.09310860931873322,
-0.6161136031150818,
0.030449911952018738,
-0.15060627460479736,
0.22758415341377258,
-0.11466055363416672,
-0.1896904706954956,
0.24544118344783783,
-0.006476160138845444,
0.07307173311710358,
0.5845305919647217,
-0.00010721082071540877,
0.042147718369960785,
0.13858753442764282,
-0.03780995309352875,
-0.10160812735557556,
0.19580604135990143,
-0.13443145155906677,
0.007481211796402931,
0.03758963197469711,
-0.4290548264980316,
-0.10384463518857956,
0.007864805869758129,
-0.12883879244327545,
-0.41391557455062866,
0.2797066569328308,
0.05084351450204849,
0.20601168274879456,
0.13014109432697296,
0.12204785645008087,
-0.061072420328855515,
-0.04149907827377319,
-0.1653330773115158,
0.11359522491693497,
0.168145090341568,
0.42866164445877075,
0.33304354548454285,
0.11321590840816498,
0.13783888518810272,
0.06273535639047623,
-0.09287582337856293,
0.24898159503936768,
0.08912355452775955,
0.3963848948478699,
-0.2542514503002167,
-0.22360584139823914,
0.3075287938117981,
0.7909544110298157,
-0.012841794639825821,
-0.2719564139842987,
-0.08013518154621124,
-0.11374016851186752,
-0.13788026571273804,
0.16848759353160858,
0.09552943706512451,
0.30500444769859314,
0.017378494143486023,
-0.2742905020713806,
0.4346567690372467,
-0.2719219923019409,
0.04312729835510254,
-0.18860861659049988,
-0.019397631287574768,
-0.0990476980805397,
0.013530749827623367,
-0.24417473375797272,
-0.06993450224399567,
0.05984577536582947,
-0.1378885805606842,
0.1849859207868576,
0.19697773456573486,
-0.2687840163707733,
-0.08652924001216888,
0.022501014173030853,
-0.08892247825860977,
0.20754703879356384,
0.14957639575004578,
0.2924565374851227,
0.17406237125396729,
-0.3884459137916565,
0.03605428338050842,
0.2837076187133789,
0.19825078547000885,
0.46406543254852295,
-0.5234386920928955,
-0.05982159823179245,
-0.09465892612934113,
-0.09226320683956146,
0.08916203677654266,
-0.35239630937576294,
0.032511211931705475,
-0.17433330416679382,
0.06821256875991821,
-0.15397262573242188,
-0.39558759331703186,
-0.21917247772216797,
0.2432529479265213,
0.043781861662864685,
-0.052868958562612534,
0.18240240216255188,
-0.07231966406106949,
0.07942897826433182,
0.45095038414001465,
0.044928111135959625,
0.08832091838121414,
-0.5913875102996826,
-0.3623243272304535,
-0.341096967458725,
0.0768074095249176,
-0.038829825818538666,
-0.15174345672130585,
0.09764963388442993,
-0.06790792942047119,
0.35940271615982056,
-0.16815848648548126,
0.23411810398101807,
-0.08897700160741806,
0.05213567614555359,
0.04207216203212738,
-0.2788228392601013,
0.180766299366951,
0.10909976065158844,
0.05629172921180725,
-0.049810294061899185,
0.02150408923625946,
-0.03596653789281845,
0.013575177639722824,
-0.21490737795829773,
-0.22084535658359528,
0.06738248467445374,
0.30820998549461365,
-0.4003605842590332,
-0.19194982945919037,
-0.25211215019226074,
0.048469800502061844,
0.19292712211608887,
0.18565422296524048,
-0.2762891352176666,
-0.19872713088989258,
0.06951141357421875,
-0.14389531314373016,
0.2400277554988861,
-0.06214076280593872,
-0.6286693215370178,
0.02070700377225876,
-0.05511453375220299,
-0.3237285614013672,
0.1594666689634323,
0.04256582260131836,
0.00010796784044941887,
0.17960220575332642,
0.08526210486888885,
0.3123663663864136,
-0.544895589351654,
-0.4406234920024872,
-0.10386528074741364,
-0.30216726660728455,
-0.1983388066291809,
-0.08886135369539261,
0.06561446189880371,
0.05777178332209587,
0.11625445634126663,
-0.11710213869810104,
0.1266624629497528,
0.09030623733997345,
0.11437202244997025,
-0.16813847422599792,
-0.3830766975879669,
-0.059286028146743774,
-0.036117106676101685,
0.21055568754673004,
-0.038276780396699905,
-0.3569951355457306,
-0.07106336206197739,
0.36972182989120483,
0.2348644733428955,
-0.012827854603528976,
-0.051917992532253265,
0.07671104371547699,
0.25660240650177,
-0.1620863378047943,
0.12810271978378296,
-0.20243564248085022,
-0.06746693700551987,
0.3197571337223053,
0.14825251698493958,
0.13080164790153503,
0.6472726464271545,
0.017467781901359558,
-0.373759925365448,
-0.20134344696998596,
-0.0036843232810497284,
-0.15638834238052368,
0.17980946600437164,
-0.15403541922569275,
0.016963500529527664,
-0.1929001659154892,
-0.19648849964141846,
0.14679908752441406,
-0.5844188332557678,
0.08775400370359421,
-0.48378732800483704,
0.3079490661621094,
0.035646624863147736,
-0.055478304624557495,
0.10468529164791107,
0.2320113182067871,
0.016083121299743652,
-0.33513110876083374,
-0.002869797870516777,
0.5101029872894287,
0.21910607814788818,
0.015444613993167877,
0.07228481024503708,
0.07858206331729889,
0.3620751202106476,
-0.19752657413482666,
0.0968504473567009,
-0.20449195802211761,
-0.014520854689180851,
-0.20001119375228882,
-0.40761491656303406,
0.26049983501434326,
-0.11735869944095612,
0.078493632376194,
-0.026496803387999535,
0.011869685724377632,
0.06560315191745758,
-0.16712507605552673,
0.07821674644947052,
-0.006811011582612991,
0.22175554931163788,
0.136330708861351,
-0.23567038774490356,
0.029454544186592102,
-0.023406803607940674,
0.40732187032699585,
-0.3067414164543152,
-0.18345220386981964,
-0.2272915244102478,
-0.37647807598114014,
-0.22483482956886292,
0.20874929428100586,
0.08913466334342957,
0.0061399973928928375,
0.38955414295196533,
0.24785950779914856,
0.16474324464797974,
-0.002628577873110771,
-0.04214748367667198,
-0.17603567242622375,
0.05738387629389763,
0.11936533451080322,
-0.09310324490070343,
-0.021595902740955353,
-0.06505593657493591,
0.010284974239766598,
-0.16248850524425507,
0.05912410840392113,
0.1499178558588028,
0.17066992819309235,
-0.47490352392196655,
-0.3363267183303833,
-0.27884459495544434,
-0.15448138117790222,
0.2290479838848114,
0.21440452337265015,
0.16546130180358887,
-0.3635771870613098,
0.11884967982769012,
0.06554672867059708,
-0.09844981133937836,
-0.06969000399112701,
-0.423526793718338,
0.2534594237804413,
0.0416908785700798,
0.04933080077171326,
0.09349209070205688,
-0.14504177868366241,
-0.21338334679603577,
0.20053280889987946,
0.1096162497997284,
0.29576024413108826,
0.2793506681919098,
-0.0827663466334343,
-0.06759355962276459,
0.15303947031497955,
-0.420055627822876,
0.0808793306350708,
-0.2090594321489334,
0.2647400200366974,
-0.1809300184249878,
0.06377995014190674,
0.0758877620100975,
-0.05834169313311577,
0.2622319459915161,
-0.017545275390148163,
-0.3150866627693176,
-0.007227969355881214,
0.278983473777771,
-0.2849283814430237,
-0.12044546008110046,
-0.6203987002372742,
-0.09507524967193604,
-0.11975805461406708,
0.013591531664133072,
0.44944074749946594,
0.24048633873462677,
0.0030261697247624397,
-0.1237989068031311,
0.16710960865020752,
0.13300274312496185,
-0.1980486512184143,
-0.32578933238983154,
-0.7631090879440308,
0.3649158179759979,
-0.10546587407588959,
-0.5235024094581604,
0.0694446861743927,
0.036555998027324677,
0.33196958899497986,
0.20155951380729675,
-0.3550727963447571,
-0.26318368315696716,
0.028333645313978195,
-0.13804344832897186,
0.5030134916305542,
0.18780824542045593,
0.13116011023521423,
-0.18255189061164856,
-0.12831750512123108,
-0.2406114935874939,
-0.06338545680046082,
0.22128349542617798,
0.28674179315567017,
0.44153785705566406,
-0.2504807710647583,
-0.2394237220287323,
-0.1297154575586319,
0.10672973841428757,
0.22242237627506256,
-0.12335182726383209,
0.01975608617067337,
-0.024323971942067146,
-0.13882865011692047,
0.08650276809930801,
-0.07017021626234055,
0.6146479249000549,
-0.1002102792263031,
-0.07668312638998032,
0.23498497903347015,
0.20129811763763428,
0.18969431519508362,
-0.10802432894706726,
0.05439191684126854,
-0.31266918778419495,
-0.19804255664348602,
-0.21038393676280975,
0.02073856070637703,
-0.015481740236282349,
-0.024156387895345688,
0.0033169016242027283,
-0.08805283904075623,
-0.07070569694042206,
-0.12245190143585205,
-0.09448017179965973,
0.08629889786243439,
0.001993592130020261,
-0.9377426505088806,
0.25836822390556335,
0.09190979599952698,
0.4281424283981323,
-0.3496423065662384,
0.027894623577594757,
0.048078786581754684,
-0.10312920808792114,
0.16258758306503296,
0.13655799627304077,
0.16987591981887817,
-0.23617558181285858,
-0.14200741052627563,
0.34066465497016907,
-0.17954474687576294,
-0.3259527087211609,
-0.03987530618906021,
-0.2304542362689972,
0.06685151159763336,
0.269308477640152,
0.008255533874034882,
-0.3681924343109131,
-0.08414925634860992,
0.15601111948490143,
0.19281713664531708,
-0.25229376554489136,
-0.09345550835132599,
0.02098163589835167,
-0.0953885018825531,
0.05891256779432297,
-0.10135038942098618,
-0.10018665343523026,
0.29698827862739563,
-0.20140667259693146,
-0.1091727614402771,
-0.21922583878040314,
-0.15718337893486023,
0.6077883839607239,
0.0983482301235199,
0.45936280488967896,
-0.017945323139429092,
0.3484978675842285,
0.3587203323841095,
0.05545235052704811,
0.30948248505592346,
0.5613515973091125,
-0.04739028587937355,
0.14068451523780823,
0.23112168908119202,
-0.41035956144332886,
0.38434329628944397,
0.20767763257026672,
0.050920628011226654,
-0.5400856733322144,
-0.2392210066318512,
0.12302818894386292,
-0.12304321676492691,
0.30748170614242554,
0.0821116492152214,
0.11379759758710861,
-0.1260647177696228,
-0.24060271680355072,
0.5399985909461975,
0.20114126801490784,
-0.003930643200874329,
0.34531816840171814,
0.36330121755599976,
-0.1422877162694931,
-0.17413635551929474,
0.4850199818611145,
0.8846732378005981,
0.05810803547501564,
-0.24501976370811462,
0.23362302780151367,
0.3626745939254761,
0.39227989315986633,
-0.5971930027008057,
0.07253438234329224,
-0.15954476594924927,
-0.26001039147377014,
0.004787595942616463,
-0.10003705322742462,
0.15411072969436646,
0.362169086933136,
0.2189943492412567,
0.11911848932504654,
-0.17057642340660095,
-0.24548694491386414,
-0.09991706162691116,
0.17735539376735687,
-0.3138262927532196,
-0.11434471607208252,
0.27802908420562744,
0.26231876015663147,
0.04704928398132324,
0.18219856917858124,
0.025190580636262894,
-0.010249318554997444,
-0.3843560516834259,
-0.039035383611917496,
-0.085882268846035,
0.05813164263963699,
-0.12950721383094788,
0.008787325583398342,
0.013077756389975548,
-0.35574036836624146,
-0.0024168789386749268,
0.300109326839447,
0.13714033365249634,
-0.059860263019800186,
-0.13866324722766876,
0.15163370966911316,
-0.36676621437072754,
0.008035331964492798,
0.3414291441440582,
-0.054977282881736755,
0.36265647411346436,
-0.18829834461212158,
-0.068565733730793,
-0.04833316057920456,
0.08388914167881012,
0.2143615037202835,
-0.3564110994338989,
0.04536564648151398,
-0.06323002278804779,
-0.40321847796440125,
-0.10707259178161621,
0.1976604461669922,
-0.06098896265029907,
-0.07114888727664948,
0.17632420361042023,
0.20757469534873962,
-0.14069083333015442,
0.473156601190567,
-0.11474175751209259,
-0.00009726732969284058,
-0.08910100162029266,
0.1888045072555542,
0.43922874331474304,
-0.23436294496059418,
0.34565168619155884,
0.10642604529857635,
-0.019411182031035423,
-0.15587842464447021,
-0.06488579511642456,
0.48799359798431396,
-0.07288476079702377,
-0.053364772349596024,
-0.3302251398563385,
-0.18108421564102173,
0.037835679948329926,
0.2344365119934082,
0.2910996675491333,
-0.05689103156328201,
0.08592408895492554,
-0.374724805355072,
-0.39154747128486633,
0.30483534932136536,
0.06157664582133293,
0.3998570740222931,
-0.2707557678222656,
0.3009164333343506,
-0.03941171616315842,
0.013466129079461098,
-0.3510236144065857,
0.08144506067037582,
-0.11342267692089081,
0.08639439940452576,
0.0758705884218216,
-0.017368696630001068,
0.19953693449497223,
-0.3763803541660309,
0.16715145111083984,
0.09948525577783585,
-0.1877502053976059,
-0.20053741335868835,
-0.12486687302589417,
0.107813261449337,
0.162776380777359,
-0.09144791215658188,
0.23153242468833923,
-0.060939542949199677,
-0.06871724128723145,
-0.0724649429321289,
0.04163569584488869,
-0.0996675193309784,
0.10376399755477905,
0.27076053619384766,
0.18016166985034943,
0.1299978792667389,
-0.08514827489852905,
0.16320830583572388,
0.12018121033906937,
0.34975332021713257,
0.1439628154039383,
-0.2291555404663086,
0.0017924377461895347,
-0.19928625226020813,
-0.24251796305179596,
-0.03232519328594208,
-0.09728994965553284,
0.05505012720823288,
0.3261321485042572,
-0.08262692391872406,
0.18127037584781647,
0.21185444295406342,
0.3575925827026367,
0.5210464000701904,
-0.11733096837997437,
0.07795373350381851,
-0.00023844651877880096,
0.2967440187931061,
-0.2638823986053467,
-0.005487850401550531,
0.16264225542545319,
0.43305298686027527,
-0.1679997593164444,
0.1031332015991211,
0.12274079024791718,
-0.04398700222373009,
-0.17418347299098969,
0.1689155399799347,
0.33214423060417175,
-0.03231426700949669,
0.1798403412103653,
0.23881204426288605,
-0.1941300630569458,
-0.01929033175110817,
0.08131282031536102,
0.012519102543592453,
-0.0040597617626190186,
0.26059237122535706,
-0.04568978399038315,
0.45839816331863403,
0.2378915250301361,
0.15935884416103363,
-0.015316352248191833,
-0.08780104666948318,
-0.13955537974834442,
0.3989136219024658,
0.1636972576379776,
0.17708644270896912,
-0.004766575992107391,
0.5884442925453186,
-0.15156590938568115,
-0.009563328698277473,
-0.35278934240341187,
0.12066981196403503,
0.0668221265077591,
0.15786537528038025,
-0.2908954918384552,
-0.16043180227279663,
-0.015311207622289658,
-0.15042275190353394,
-0.13910311460494995,
-0.2644777297973633,
0.19075489044189453,
-0.013604603707790375,
-0.3546863794326782,
-0.8215943574905396,
-0.12658247351646423,
0.1065370962023735,
0.2467358410358429,
-0.17471614480018616,
0.18727128207683563,
0.5541861057281494,
-0.07382282614707947,
0.10611708462238312,
0.46610793471336365,
0.1588304340839386,
0.17612868547439575,
-0.05146978422999382,
-0.014345421455800533,
0.18049326539039612,
-0.03000711277127266,
0.08930671215057373,
0.19324256479740143,
-0.022059902548789978,
-0.10068750381469727,
0.38652175664901733,
0.20395731925964355,
-0.1132388785481453,
-0.18933458626270294,
0.04909537732601166,
0.05375141277909279,
-0.08863158524036407,
0.08928372710943222,
-0.015844125300645828,
-0.07793811708688736,
-0.07389489561319351,
-0.3469391465187073,
-0.34500977396965027,
-0.08238566666841507,
-0.12661093473434448,
0.208872452378273,
0.19706174731254578,
0.07250567525625229,
0.11511363089084625,
-0.3228027820587158,
0.2175067812204361,
0.12030181288719177,
-0.1338185966014862,
-0.3367740511894226,
-0.164731964468956,
-0.5921187996864319,
0.013301163911819458,
-0.1393098533153534,
-0.6057732105255127,
0.18740864098072052,
0.37192144989967346,
0.21248969435691833,
0.07154077291488647,
0.016844965517520905,
-0.32779279351234436,
-0.1417148858308792,
0.32227885723114014,
-0.5912337303161621,
0.0750555694103241,
-0.2451961189508438,
0.11036579310894012,
0.03024039790034294,
0.2611948847770691,
0.2501969337463379,
0.22282348573207855,
-0.024226685985922813,
0.16725972294807434,
0.17318947613239288,
0.1581401377916336,
0.1526831090450287,
0.007670588791370392,
-0.010848825797438622,
0.44367435574531555,
0.23603031039237976,
0.3360923230648041,
-0.35654520988464355,
-0.1521238088607788,
-0.1615941971540451,
0.37211301922798157,
0.17444482445716858,
0.1416352540254593,
-0.04511929303407669,
0.05769246444106102,
0.05198344960808754,
0.18596480786800385,
-0.043736185878515244,
-0.39750561118125916,
-0.45371684432029724,
0.007617080584168434,
-0.02232828363776207,
0.07391660660505295,
0.29335102438926697,
0.4988902509212494,
-0.03208637982606888,
0.09974443167448044,
-0.2534346580505371,
-0.4610157907009125,
0.37168723344802856,
-0.13352824747562408,
0.08663968741893768,
-0.02873048186302185,
0.25004661083221436,
0.4638034701347351,
0.011608283966779709,
-0.34174448251724243,
-0.026474080979824066,
0.43527448177337646,
-0.32085585594177246,
-0.19286949932575226,
0.18223604559898376,
0.3333803713321686,
-0.258392870426178,
-0.036494433879852295,
-0.05549556016921997,
0.06730562448501587,
-0.03556334227323532,
0.11691759526729584,
-0.03842184692621231
] |
https://github.com/huggingface/datasets/issues/672 | Questions about XSUM | Thanks @lhoestq
It would be great to improve coverage, but IDs are the really crucial part for us. We'd really appreciate an update to the dataset with IDs either way! | Hi there ✋
I'm looking into your `xsum` dataset and I have several questions on that.
So here is how I loaded the data:
```
>>> data = datasets.load_dataset('xsum', version='1.0.1')
>>> data['train']
Dataset(features: {'document': Value(dtype='string', id=None), 'summary': Value(dtype='string', id=None)}, num_rows: 204017)
>>> data['test']
Dataset(features: {'document': Value(dtype='string', id=None), 'summary': Value(dtype='string', id=None)}, num_rows: 11333)
```
The first issue is, the instance counts don’t match what I see on [the dataset's website](https://github.com/EdinburghNLP/XSum/tree/master/XSum-Dataset#what-builds-the-xsum-dataset) (11,333 vs 11,334 for test set; 204,017 vs 204,045 for training set)
```
… training (90%, 204,045), validation (5%, 11,332), and test (5%, 11,334) set.
```
Any thoughts why? Perhaps @mariamabarham could help here, since she recently had a PR on this dataaset https://github.com/huggingface/datasets/pull/289 (reviewed by @patrickvonplaten)
Another issue is that the instances don't seem to have IDs. The original datasets provides IDs for the instances: https://github.com/EdinburghNLP/XSum/blob/master/XSum-Dataset/XSum-TRAINING-DEV-TEST-SPLIT-90-5-5.json but to be able to use them, the dataset sizes need to match.
CC @jbragg
| 30 | Questions about XSUM
Hi there ✋
I'm looking into your `xsum` dataset and I have several questions on that.
So here is how I loaded the data:
```
>>> data = datasets.load_dataset('xsum', version='1.0.1')
>>> data['train']
Dataset(features: {'document': Value(dtype='string', id=None), 'summary': Value(dtype='string', id=None)}, num_rows: 204017)
>>> data['test']
Dataset(features: {'document': Value(dtype='string', id=None), 'summary': Value(dtype='string', id=None)}, num_rows: 11333)
```
The first issue is, the instance counts don’t match what I see on [the dataset's website](https://github.com/EdinburghNLP/XSum/tree/master/XSum-Dataset#what-builds-the-xsum-dataset) (11,333 vs 11,334 for test set; 204,017 vs 204,045 for training set)
```
… training (90%, 204,045), validation (5%, 11,332), and test (5%, 11,334) set.
```
Any thoughts why? Perhaps @mariamabarham could help here, since she recently had a PR on this dataaset https://github.com/huggingface/datasets/pull/289 (reviewed by @patrickvonplaten)
Another issue is that the instances don't seem to have IDs. The original datasets provides IDs for the instances: https://github.com/EdinburghNLP/XSum/blob/master/XSum-Dataset/XSum-TRAINING-DEV-TEST-SPLIT-90-5-5.json but to be able to use them, the dataset sizes need to match.
CC @jbragg
Thanks @lhoestq
It would be great to improve coverage, but IDs are the really crucial part for us. We'd really appreciate an update to the dataset with IDs either way! | [
-0.12053832411766052,
-0.3434898555278778,
-0.157283216714859,
0.4010956883430481,
0.31504589319229126,
0.05394131690263748,
0.16806741058826447,
0.018259700387716293,
0.22903048992156982,
0.20511943101882935,
-0.17855006456375122,
0.24757477641105652,
0.1144535019993782,
0.44367411732673645,
0.09838459640741348,
0.11011195182800293,
-0.006561361253261566,
-0.13712458312511444,
-0.3460198640823364,
-0.2986065745353699,
-0.043396227061748505,
0.05728179216384888,
-0.15052950382232666,
-0.17447592318058014,
-0.6682881116867065,
0.014502876438200474,
-0.19779753684997559,
0.254042387008667,
-0.10829732567071915,
-0.25136855244636536,
0.3075424134731293,
0.03559677302837372,
0.04552168771624565,
0.49343857169151306,
-0.00010666892922017723,
-0.03352455422282219,
0.13187485933303833,
-0.04612463712692261,
-0.07304376363754272,
0.2865335941314697,
-0.15400588512420654,
-0.09081517159938812,
0.008795679546892643,
-0.37145695090293884,
-0.06358055770397186,
0.07101844251155853,
-0.1505088210105896,
-0.3604395091533661,
0.13190798461437225,
0.026103679090738297,
0.2053840607404709,
0.18168890476226807,
0.17720714211463928,
0.003440848318859935,
-0.07108855992555618,
-0.12997184693813324,
0.054702550172805786,
0.2795856297016144,
0.48674651980400085,
0.22336752712726593,
0.03640075400471687,
0.22357189655303955,
0.06671058386564255,
-0.23517002165317535,
0.24730312824249268,
0.08930506557226181,
0.36106348037719727,
-0.15462534129619598,
-0.3263551890850067,
0.22341981530189514,
0.8148688673973083,
-0.013842232525348663,
-0.3631152808666229,
-0.09141765534877777,
-0.014135262928903103,
-0.19050520658493042,
0.1663070172071457,
0.02315833419561386,
0.4013925790786743,
-0.01922472193837166,
-0.31946781277656555,
0.3984609544277191,
-0.2611428499221802,
0.021119918674230576,
-0.13501496613025665,
-0.10032039880752563,
-0.01699371635913849,
-0.01709529012441635,
-0.23226942121982574,
-0.03962506353855133,
0.09646876156330109,
-0.02442697435617447,
0.11793534457683563,
0.19878597557544708,
-0.3089929521083832,
-0.20485246181488037,
-0.01045166701078415,
0.008186981081962585,
0.260407418012619,
0.17719332873821259,
0.24472945928573608,
0.04156574234366417,
-0.4094993472099304,
0.01699012890458107,
0.22452010214328766,
0.2314256727695465,
0.4467467665672302,
-0.4870942234992981,
0.04704505205154419,
-0.043157123029232025,
-0.12616078555583954,
0.05859307572245598,
-0.349200040102005,
0.01231462974101305,
0.035933930426836014,
0.12007202953100204,
-0.1307222694158554,
-0.36167848110198975,
-0.1987830400466919,
0.2999650537967682,
0.0037914104759693146,
-0.1758432686328888,
0.13981086015701294,
-0.149757981300354,
0.029512640088796616,
0.40213873982429504,
0.016287367790937424,
0.06025870889425278,
-0.5490454435348511,
-0.33048930764198303,
-0.36233800649642944,
0.08521963655948639,
-0.07052567601203918,
-0.017913805320858955,
0.12638451159000397,
-0.11324417591094971,
0.38722115755081177,
-0.1766904890537262,
0.24885404109954834,
0.03684163838624954,
0.08975204825401306,
0.13914699852466583,
-0.3680388629436493,
0.22846657037734985,
0.024002179503440857,
0.01568821258842945,
-0.02859342470765114,
0.051815398037433624,
0.001055493950843811,
-0.00235680490732193,
-0.19217216968536377,
-0.2217099815607071,
-0.00015632249414920807,
0.29051291942596436,
-0.35370171070098877,
-0.32773253321647644,
-0.0906435176730156,
0.030750229954719543,
0.1729968786239624,
0.16538649797439575,
-0.17210498452186584,
-0.05414552986621857,
0.08858570456504822,
-0.10384427756071091,
0.15178723633289337,
0.013269349932670593,
-0.5510632991790771,
-0.008274942636489868,
-0.0016375421546399593,
-0.25355061888694763,
0.13316410779953003,
-0.028040818870067596,
0.042109765112400055,
0.24108025431632996,
0.1172039806842804,
0.13485607504844666,
-0.5617385506629944,
-0.4743936061859131,
-0.16833330690860748,
-0.37354758381843567,
-0.16201117634773254,
-0.11732900142669678,
0.1920337677001953,
0.06438560038805008,
0.03271116316318512,
-0.13099262118339539,
0.13218630850315094,
-0.020676080137491226,
0.052582997828722,
-0.17220120131969452,
-0.45446521043777466,
-0.06961372494697571,
-0.010600827634334564,
0.24013285338878632,
-0.039966028183698654,
-0.3308125436306,
-0.12680315971374512,
0.3707156181335449,
0.157927006483078,
0.007608555257320404,
-0.12163657695055008,
0.03008079156279564,
0.32876354455947876,
-0.16036391258239746,
0.052912626415491104,
-0.14684003591537476,
-0.0415220707654953,
0.30147215723991394,
0.11756108701229095,
0.2241445928812027,
0.7303129434585571,
-0.06592585891485214,
-0.3103888928890228,
-0.17998090386390686,
0.01918688416481018,
-0.25100359320640564,
0.1881149858236313,
-0.18729901313781738,
-0.036854133009910583,
-0.23840567469596863,
-0.1892731636762619,
0.13579851388931274,
-0.6147502660751343,
0.08896549046039581,
-0.4941735863685608,
0.3555937707424164,
-0.020142806693911552,
-0.011546182446181774,
0.06356595456600189,
0.29991722106933594,
-0.01880417764186859,
-0.3205811679363251,
-0.0646444633603096,
0.5364036560058594,
0.1481599062681198,
0.05868172273039818,
0.21483328938484192,
0.24140915274620056,
0.4149380922317505,
-0.1923774629831314,
0.12125233560800552,
-0.2626795768737793,
-0.08701916038990021,
-0.1991874873638153,
-0.4233083128929138,
0.21205803751945496,
-0.12980149686336517,
0.025816068053245544,
-0.10781988501548767,
0.03575114905834198,
-0.032758306711912155,
-0.16881436109542847,
0.030637608841061592,
0.041733793914318085,
0.14962317049503326,
0.14176025986671448,
-0.22970691323280334,
0.07753034681081772,
0.022661179304122925,
0.4194987416267395,
-0.39777323603630066,
-0.1804339587688446,
-0.21003934741020203,
-0.31894850730895996,
-0.16616100072860718,
0.15760251879692078,
0.1537567526102066,
-0.0587063767015934,
0.49315714836120605,
0.32174256443977356,
0.09853879362344742,
-0.03387293219566345,
-0.039565201848745346,
-0.1556171476840973,
0.02355203777551651,
0.0013058409094810486,
-0.17369283735752106,
-0.03942473232746124,
-0.06392069905996323,
0.003362400457262993,
-0.15115207433700562,
0.09757135808467865,
0.1108916625380516,
0.18651480972766876,
-0.44743427634239197,
-0.4137152433395386,
-0.2139124721288681,
-0.1277543604373932,
0.23850171267986298,
0.19503706693649292,
0.1759384572505951,
-0.2985454499721527,
0.1582861840724945,
0.04561211168766022,
-0.0374017097055912,
0.04983232170343399,
-0.40037813782691956,
0.28305166959762573,
0.025446483865380287,
0.07088977843523026,
0.07380098104476929,
-0.16967836022377014,
-0.11663588136434555,
0.21366319060325623,
0.003797987475991249,
0.2504510283470154,
0.3692832589149475,
-0.08442965149879456,
-0.06667178869247437,
0.12250221520662308,
-0.4055010676383972,
-0.007585518062114716,
-0.1713566929101944,
0.25127285718917847,
-0.12380312383174896,
0.062405139207839966,
0.009135633707046509,
-0.03224591910839081,
0.2944411635398865,
-0.042078860104084015,
-0.25152620673179626,
-0.14487811923027039,
0.18088409304618835,
-0.17801326513290405,
-0.04850517585873604,
-0.5882418751716614,
-0.11187783628702164,
-0.10366156697273254,
-0.0437038391828537,
0.4338696002960205,
0.15621787309646606,
0.07177552580833435,
-0.11391723901033401,
0.15052516758441925,
0.23199592530727386,
-0.2218731939792633,
-0.33143067359924316,
-0.855919361114502,
0.35984116792678833,
-0.093761146068573,
-0.47327277064323425,
-0.006853953003883362,
-0.022582100704312325,
0.3321777582168579,
0.128327876329422,
-0.3856081962585449,
-0.36230871081352234,
0.09414844959974289,
-0.09100643545389175,
0.50713050365448,
0.22707292437553406,
0.21421973407268524,
-0.16955417394638062,
-0.16974115371704102,
-0.26871901750564575,
-0.07072991877794266,
0.22785738110542297,
0.2653990089893341,
0.470039963722229,
-0.3075750470161438,
-0.3304246664047241,
-0.23630113899707794,
0.08827364444732666,
0.29663366079330444,
-0.1167367547750473,
0.06798142194747925,
-0.008063049986958504,
-0.10700038075447083,
0.06942783296108246,
-0.21001215279102325,
0.6536991000175476,
-0.09306734800338745,
-0.05852675437927246,
0.16494718194007874,
0.21047121286392212,
0.18723873794078827,
-0.06127748638391495,
-0.021539734676480293,
-0.21850723028182983,
-0.15614734590053558,
-0.19044393301010132,
-0.03171636164188385,
0.10637819766998291,
-0.03542173281311989,
-0.051139768213033676,
-0.11612832546234131,
-0.09879303723573685,
-0.04483691230416298,
-0.04759722948074341,
0.12954965233802795,
-0.06895190477371216,
-0.987317681312561,
0.14829804003238678,
0.06142311543226242,
0.35006171464920044,
-0.27045783400535583,
0.06111681088805199,
0.0373719297349453,
-0.1009262278676033,
0.058613769710063934,
0.23906725645065308,
0.17098309099674225,
-0.31812605261802673,
-0.22770307958126068,
0.3203566074371338,
-0.07803007960319519,
-0.2288999855518341,
-0.07513204962015152,
-0.15177121758460999,
0.11247002333402634,
0.2031218707561493,
0.04632680490612984,
-0.2426425814628601,
-0.005729622207581997,
0.244661346077919,
0.17403386533260345,
-0.28192275762557983,
-0.11505341529846191,
-0.026223324239253998,
0.03691495954990387,
0.08162319660186768,
-0.0664372518658638,
-0.12425194680690765,
0.23765254020690918,
-0.23087722063064575,
-0.17159761488437653,
-0.1750878095626831,
-0.10975778847932816,
0.49909085035324097,
0.025351207703351974,
0.42369377613067627,
0.0014487949665635824,
0.3811967372894287,
0.36567720770835876,
-0.002378620207309723,
0.24523094296455383,
0.5255573987960815,
-0.23790591955184937,
0.2452271431684494,
0.16211625933647156,
-0.39303916692733765,
0.46912556886672974,
0.1861146092414856,
0.08551902323961258,
-0.5343077182769775,
-0.31546682119369507,
0.06594084203243256,
-0.22427797317504883,
0.26629340648651123,
0.09687929600477219,
0.19357267022132874,
0.006181193049997091,
-0.26859113574028015,
0.48130443692207336,
0.14617174863815308,
-0.0028586164116859436,
0.43373334407806396,
0.36250394582748413,
-0.10015055537223816,
-0.19655776023864746,
0.5348649621009827,
0.8573746681213379,
0.13413463532924652,
-0.27696025371551514,
0.1873970627784729,
0.3989759683609009,
0.29242637753486633,
-0.4698541760444641,
0.03099660389125347,
-0.17976373434066772,
-0.37305569648742676,
0.06693147122859955,
-0.06611534208059311,
0.1716616302728653,
0.24352559447288513,
0.13267651200294495,
0.14246496558189392,
-0.10183267295360565,
-0.31058698892593384,
-0.14153577387332916,
0.15865802764892578,
-0.23937633633613586,
-0.17373037338256836,
0.3241588771343231,
0.24936780333518982,
0.10570816695690155,
0.13772925734519958,
-0.0025494517758488655,
0.09020352363586426,
-0.29081425070762634,
-0.06361280381679535,
-0.13760770857334137,
-0.08662344515323639,
-0.10245182365179062,
-0.025332164019346237,
0.10075561702251434,
-0.3295690417289734,
-0.02053692936897278,
0.30939796566963196,
0.21686364710330963,
-0.01410137489438057,
-0.13419462740421295,
0.14026452600955963,
-0.37143319845199585,
0.07061728835105896,
0.3393010199069977,
0.04303688183426857,
0.36603012681007385,
-0.14212000370025635,
-0.17902588844299316,
-0.0798790231347084,
0.044496145099401474,
0.25928014516830444,
-0.36103224754333496,
-0.05247732996940613,
0.00124455988407135,
-0.48012685775756836,
0.005942114628851414,
0.13896188139915466,
-0.04788278788328171,
-0.16695480048656464,
0.18911787867546082,
0.238503560423851,
-0.07038916647434235,
0.46685388684272766,
-0.09854327142238617,
0.08198730647563934,
-0.11238393187522888,
0.2597106993198395,
0.4520573914051056,
-0.16891911625862122,
0.27156901359558105,
0.0058895982801914215,
0.01904461160302162,
-0.17235207557678223,
0.11037666350603104,
0.5367075204849243,
-0.08847139775753021,
-0.08321752399206161,
-0.2841584384441376,
-0.2118472456932068,
0.0026132632046937943,
0.2482559084892273,
0.2747521996498108,
0.01155903935432434,
0.1169232577085495,
-0.31896165013313293,
-0.47212767601013184,
0.33990252017974854,
0.10616070032119751,
0.39931896328926086,
-0.2627229392528534,
0.22208689153194427,
-0.03758585453033447,
0.08433510363101959,
-0.3584274351596832,
-0.05228663235902786,
-0.135008305311203,
0.02681563049554825,
0.10822396725416183,
-0.04826335608959198,
0.2857339382171631,
-0.3554723560810089,
0.19446255266666412,
0.001477520912885666,
-0.10288595408201218,
-0.23749354481697083,
-0.07968106865882874,
0.10357411205768585,
0.16816192865371704,
-0.020225999876856804,
0.29440435767173767,
0.007954910397529602,
-0.0590883307158947,
-0.08116618543863297,
-0.0051047056913375854,
-0.19279423356056213,
0.088652104139328,
0.35929030179977417,
0.0931335836648941,
0.08441769331693649,
-0.060113802552223206,
0.13062578439712524,
0.11255878210067749,
0.2832222580909729,
0.08326447010040283,
-0.24705186486244202,
0.08018127828836441,
-0.2404564917087555,
-0.17649640142917633,
0.00244101881980896,
-0.054430216550827026,
0.1487930566072464,
0.2819156348705292,
0.017839733511209488,
0.12548398971557617,
0.203883558511734,
0.30888691544532776,
0.3877468705177307,
-0.14857451617717743,
0.1263665109872818,
0.017546746879816055,
0.29534053802490234,
-0.29605814814567566,
-0.06952958554029465,
0.05915428325533867,
0.3725505769252777,
-0.07481727004051208,
0.09440556913614273,
0.18763402104377747,
-0.1102064698934555,
-0.11919456720352173,
0.16815173625946045,
0.257280170917511,
-0.0466938242316246,
0.09787333011627197,
0.2053414285182953,
-0.19810256361961365,
-0.05667639896273613,
0.12750285863876343,
-0.08451138436794281,
0.022354155778884888,
0.17905054986476898,
0.029654741287231445,
0.4828334450721741,
0.16847485303878784,
0.15104202926158905,
-0.039496734738349915,
0.012869715690612793,
-0.06324343383312225,
0.3031078577041626,
0.19018809497356415,
0.1405862718820572,
0.036469873040914536,
0.6264364123344421,
-0.14720752835273743,
-0.0713050439953804,
-0.24826642870903015,
-0.04447673633694649,
0.11882182210683823,
0.1468963474035263,
-0.28755709528923035,
-0.06651191413402557,
0.018065042793750763,
-0.2042829692363739,
-0.12632738053798676,
-0.23527128994464874,
0.21655502915382385,
-0.030669085681438446,
-0.31889528036117554,
-0.8173339366912842,
-0.11210522800683975,
0.13546130061149597,
0.32816606760025024,
-0.11147698014974594,
0.13777324557304382,
0.6112168431282043,
-0.05114157497882843,
0.0817144513130188,
0.5912324786186218,
0.1228112131357193,
0.06538432836532593,
0.03190435469150543,
0.049621302634477615,
0.20839804410934448,
-0.07446423918008804,
0.14482669532299042,
0.14227795600891113,
-0.04158411920070648,
-0.1758444756269455,
0.27185332775115967,
0.17917992174625397,
-0.09656558185815811,
-0.11262194812297821,
0.09801945090293884,
-0.06430776417255402,
-0.05607634782791138,
0.07132767140865326,
0.09752478450536728,
-0.1953418254852295,
-0.03742777556180954,
-0.25333163142204285,
-0.363421767950058,
-0.04177837073802948,
-0.12048633396625519,
0.14250142872333527,
0.13559553027153015,
0.011164674535393715,
0.12735740840435028,
-0.2924351692199707,
0.35288363695144653,
0.07142621278762817,
-0.09859862178564072,
-0.2925545871257782,
-0.18848589062690735,
-0.5612859725952148,
0.019108623266220093,
-0.07516917586326599,
-0.5208988189697266,
0.21027080714702606,
0.2816259562969208,
0.14087766408920288,
0.021673275157809258,
0.03306466341018677,
-0.40645095705986023,
-0.06320404261350632,
0.315318763256073,
-0.6724221110343933,
0.018029112368822098,
-0.17778971791267395,
0.19207356870174408,
0.013440966606140137,
0.3005070686340332,
0.2789630591869354,
0.22614482045173645,
-0.02301436848938465,
0.18669913709163666,
0.1346619874238968,
0.15177159011363983,
0.2687848210334778,
0.020696304738521576,
-0.01723741553723812,
0.4619516432285309,
0.16098859906196594,
0.34149792790412903,
-0.30367180705070496,
-0.2003551572561264,
-0.1873815804719925,
0.2807467579841614,
0.18549491465091705,
0.12626099586486816,
-0.05637627840042114,
-0.030970048159360886,
0.13626636564731598,
0.3118079900741577,
0.027343332767486572,
-0.48150634765625,
-0.542868971824646,
0.05891210585832596,
0.07609247416257858,
0.001645547803491354,
0.19911958277225494,
0.4701712131500244,
-0.0038901865482330322,
0.0714816153049469,
-0.2085634469985962,
-0.39708152413368225,
0.4352809488773346,
-0.1364438682794571,
0.24032364785671234,
-0.06602459400892258,
0.23610380291938782,
0.44622907042503357,
0.023361291736364365,
-0.3581888973712921,
-0.051154591143131256,
0.42607995867729187,
-0.1957482397556305,
-0.1757148802280426,
0.2586028575897217,
0.4284219741821289,
-0.17495784163475037,
-0.040143802762031555,
-0.053757622838020325,
0.010809600353240967,
0.052956849336624146,
0.23506101965904236,
-0.021571844816207886
] |
https://github.com/huggingface/datasets/issues/672 | Questions about XSUM | I gave up at an even earlier point. The dataset I use has 204,017 train examples. | Hi there ✋
I'm looking into your `xsum` dataset and I have several questions on that.
So here is how I loaded the data:
```
>>> data = datasets.load_dataset('xsum', version='1.0.1')
>>> data['train']
Dataset(features: {'document': Value(dtype='string', id=None), 'summary': Value(dtype='string', id=None)}, num_rows: 204017)
>>> data['test']
Dataset(features: {'document': Value(dtype='string', id=None), 'summary': Value(dtype='string', id=None)}, num_rows: 11333)
```
The first issue is, the instance counts don’t match what I see on [the dataset's website](https://github.com/EdinburghNLP/XSum/tree/master/XSum-Dataset#what-builds-the-xsum-dataset) (11,333 vs 11,334 for test set; 204,017 vs 204,045 for training set)
```
… training (90%, 204,045), validation (5%, 11,332), and test (5%, 11,334) set.
```
Any thoughts why? Perhaps @mariamabarham could help here, since she recently had a PR on this dataaset https://github.com/huggingface/datasets/pull/289 (reviewed by @patrickvonplaten)
Another issue is that the instances don't seem to have IDs. The original datasets provides IDs for the instances: https://github.com/EdinburghNLP/XSum/blob/master/XSum-Dataset/XSum-TRAINING-DEV-TEST-SPLIT-90-5-5.json but to be able to use them, the dataset sizes need to match.
CC @jbragg
| 16 | Questions about XSUM
Hi there ✋
I'm looking into your `xsum` dataset and I have several questions on that.
So here is how I loaded the data:
```
>>> data = datasets.load_dataset('xsum', version='1.0.1')
>>> data['train']
Dataset(features: {'document': Value(dtype='string', id=None), 'summary': Value(dtype='string', id=None)}, num_rows: 204017)
>>> data['test']
Dataset(features: {'document': Value(dtype='string', id=None), 'summary': Value(dtype='string', id=None)}, num_rows: 11333)
```
The first issue is, the instance counts don’t match what I see on [the dataset's website](https://github.com/EdinburghNLP/XSum/tree/master/XSum-Dataset#what-builds-the-xsum-dataset) (11,333 vs 11,334 for test set; 204,017 vs 204,045 for training set)
```
… training (90%, 204,045), validation (5%, 11,332), and test (5%, 11,334) set.
```
Any thoughts why? Perhaps @mariamabarham could help here, since she recently had a PR on this dataaset https://github.com/huggingface/datasets/pull/289 (reviewed by @patrickvonplaten)
Another issue is that the instances don't seem to have IDs. The original datasets provides IDs for the instances: https://github.com/EdinburghNLP/XSum/blob/master/XSum-Dataset/XSum-TRAINING-DEV-TEST-SPLIT-90-5-5.json but to be able to use them, the dataset sizes need to match.
CC @jbragg
I gave up at an even earlier point. The dataset I use has 204,017 train examples. | [
-0.09927358478307724,
-0.37248048186302185,
-0.13977505266666412,
0.4924609065055847,
0.32378292083740234,
-0.0019079744815826416,
0.17883434891700745,
-0.030592817813158035,
0.2268306016921997,
0.2765001654624939,
-0.19577288627624512,
0.236250638961792,
0.08172466605901718,
0.4162518382072449,
0.13437549769878387,
0.09985794126987457,
-0.02115565538406372,
-0.11951522529125214,
-0.36180025339126587,
-0.2939091920852661,
-0.0009092167019844055,
0.059833139181137085,
-0.08439978957176208,
-0.12955525517463684,
-0.6914077997207642,
0.021311363205313683,
-0.14598315954208374,
0.26352328062057495,
-0.07879197597503662,
-0.1954723745584488,
0.24723170697689056,
0.030697761103510857,
0.05869751423597336,
0.5738728642463684,
-0.00010473364091012627,
-0.0023848935961723328,
0.10760794579982758,
-0.021801460534334183,
-0.10171495378017426,
0.2196226716041565,
-0.16834962368011475,
-0.020322764292359352,
0.005674369633197784,
-0.38734373450279236,
-0.08652358502149582,
0.04762222617864609,
-0.13876104354858398,
-0.3502880036830902,
0.2238689661026001,
0.013207892887294292,
0.22101452946662903,
0.14795279502868652,
0.11049720644950867,
-0.056956999003887177,
-0.05205243080854416,
-0.10752268135547638,
0.09816878288984299,
0.24896183609962463,
0.4054052531719208,
0.25460895895957947,
0.056634776294231415,
0.16813690960407257,
0.07258340716362,
-0.20388738811016083,
0.2872774004936218,
0.06647948920726776,
0.34040623903274536,
-0.19341546297073364,
-0.30727702379226685,
0.3304912745952606,
0.844541609287262,
-0.03718961775302887,
-0.26129788160324097,
-0.037164293229579926,
-0.01140173152089119,
-0.14632441103458405,
0.16857361793518066,
0.06692370027303696,
0.35215649008750916,
-0.041983652859926224,
-0.27146729826927185,
0.4366954565048218,
-0.23508688807487488,
0.03463601693511009,
-0.16161543130874634,
-0.08565263450145721,
-0.07038789987564087,
0.0162692591547966,
-0.20133809745311737,
-0.05844820290803909,
0.05506698787212372,
-0.05016680806875229,
0.17059890925884247,
0.18302850425243378,
-0.29879897832870483,
-0.115695521235466,
-0.020013853907585144,
-0.028623849153518677,
0.23570987582206726,
0.15327583253383636,
0.2867734432220459,
0.06422044336795807,
-0.38261878490448,
0.04667012020945549,
0.22318072617053986,
0.28096866607666016,
0.41718757152557373,
-0.5452029705047607,
-0.0015247836709022522,
-0.10414550453424454,
-0.125153049826622,
0.09366084635257721,
-0.3935849666595459,
-0.031975120306015015,
0.01161673292517662,
-0.007285395637154579,
-0.165105938911438,
-0.3474944233894348,
-0.22181260585784912,
0.26552337408065796,
0.023657038807868958,
-0.0896359384059906,
0.18971341848373413,
-0.1298571527004242,
0.04616806283593178,
0.3801032602787018,
-0.0006398856639862061,
0.03343966603279114,
-0.5421852469444275,
-0.286426842212677,
-0.357543021440506,
0.11921502649784088,
-0.0814279168844223,
-0.030074933543801308,
0.10576000809669495,
-0.08023622632026672,
0.3754306435585022,
-0.09533074498176575,
0.26078683137893677,
-0.012126665562391281,
0.06674709916114807,
0.08483816683292389,
-0.32332083582878113,
0.21863628923892975,
0.032223764806985855,
0.016380900517106056,
-0.04981602355837822,
0.031108468770980835,
-0.03356476128101349,
-0.0112234428524971,
-0.19465628266334534,
-0.2256239503622055,
0.012313663959503174,
0.3181310296058655,
-0.36181288957595825,
-0.2805415987968445,
-0.1812165081501007,
0.006277583539485931,
0.1754131317138672,
0.2128990888595581,
-0.19405776262283325,
-0.15208683907985687,
0.071357861161232,
-0.11751823872327805,
0.17090784013271332,
-0.03802667558193207,
-0.5679003596305847,
0.030260875821113586,
0.023903850466012955,
-0.2643794119358063,
0.07638495415449142,
0.01459423266351223,
-0.012154432013630867,
0.24252313375473022,
0.12057773768901825,
0.18916432559490204,
-0.5386627316474915,
-0.47653862833976746,
-0.12820059061050415,
-0.3288971781730652,
-0.17267298698425293,
-0.0970209538936615,
0.12992818653583527,
0.11828701943159103,
0.026342418044805527,
-0.1328427940607071,
0.1855413317680359,
0.01899111084640026,
0.11315517872571945,
-0.17296560108661652,
-0.42406463623046875,
-0.07285737991333008,
-0.01830558478832245,
0.20050127804279327,
-0.08610936999320984,
-0.31787949800491333,
-0.1180914118885994,
0.346424400806427,
0.16702739894390106,
0.006657388061285019,
-0.10421666502952576,
0.07769060134887695,
0.30163106322288513,
-0.1446908861398697,
0.08415982872247696,
-0.19734588265419006,
0.02333798259496689,
0.3096412420272827,
0.12857463955879211,
0.22644734382629395,
0.7804635763168335,
-0.05428379774093628,
-0.36638033390045166,
-0.22521725296974182,
0.009480960667133331,
-0.1826496720314026,
0.20184437930583954,
-0.22784197330474854,
-0.004388138651847839,
-0.22644731402397156,
-0.18562167882919312,
0.1292770355939865,
-0.590084969997406,
0.03975503146648407,
-0.4913720488548279,
0.30269327759742737,
0.029592685401439667,
0.014840135350823402,
0.05249404162168503,
0.2697273790836334,
-0.039759084582328796,
-0.26745903491973877,
-0.027211777865886688,
0.5520485639572144,
0.17122530937194824,
0.009771555662155151,
0.18117889761924744,
0.19557882845401764,
0.3629959523677826,
-0.18068350851535797,
0.14035432040691376,
-0.23093660175800323,
-0.06873738765716553,
-0.1801777482032776,
-0.39733684062957764,
0.22441968321800232,
-0.1129111796617508,
0.019361935555934906,
-0.054298147559165955,
0.01441098190844059,
0.012869482859969139,
-0.1489400565624237,
-0.0007945811375975609,
0.022387348115444183,
0.21717406809329987,
0.13940615952014923,
-0.22467997670173645,
0.0960167944431305,
0.0005262643098831177,
0.3793882429599762,
-0.3613012731075287,
-0.17107746005058289,
-0.19260799884796143,
-0.3339501619338989,
-0.22871574759483337,
0.17072826623916626,
0.11289121955633163,
-0.020348552614450455,
0.4611945152282715,
0.3074295222759247,
0.08799869567155838,
-0.04028531163930893,
-0.09102801978588104,
-0.15475919842720032,
0.005416274070739746,
0.03537388890981674,
-0.07593324780464172,
-0.07050377875566483,
-0.05247192084789276,
0.02175499126315117,
-0.1583799421787262,
0.07780350744724274,
0.0994938462972641,
0.14433717727661133,
-0.4329530894756317,
-0.3254627585411072,
-0.22616545855998993,
-0.10145805776119232,
0.19626832008361816,
0.16902713477611542,
0.14923900365829468,
-0.27076849341392517,
0.1685469150543213,
0.05281353369355202,
-0.04325258359313011,
0.012200268916785717,
-0.3721606135368347,
0.2992723286151886,
0.04630933701992035,
0.10640953481197357,
0.10711829364299774,
-0.1652509570121765,
-0.17665618658065796,
0.20862364768981934,
0.032213661819696426,
0.3394019305706024,
0.3760529160499573,
-0.07353748381137848,
-0.052185896784067154,
0.13095536828041077,
-0.42307528853416443,
0.03162007033824921,
-0.20390909910202026,
0.2718333303928375,
-0.14481200277805328,
0.024117007851600647,
0.04962010681629181,
-0.01040741242468357,
0.25073036551475525,
-0.039912186563014984,
-0.23875343799591064,
-0.0692073330283165,
0.19070827960968018,
-0.2634194791316986,
-0.09555939584970474,
-0.5472238063812256,
-0.09450735151767731,
-0.08763590455055237,
-0.024529963731765747,
0.4820386469364166,
0.20327000319957733,
0.09307800978422165,
-0.09470033645629883,
0.19943013787269592,
0.24664708971977234,
-0.1848698854446411,
-0.3754304051399231,
-0.8140150308609009,
0.3188568949699402,
-0.1111660823225975,
-0.5230093002319336,
0.02988140657544136,
-0.034150488674640656,
0.28337761759757996,
0.13379070162773132,
-0.39186179637908936,
-0.34397584199905396,
0.0009983722120523453,
-0.11732245981693268,
0.506170392036438,
0.21717141568660736,
0.20651209354400635,
-0.1710246205329895,
-0.18273919820785522,
-0.2552519738674164,
-0.05135710909962654,
0.3030758798122406,
0.29740938544273376,
0.4628179371356964,
-0.324747234582901,
-0.31702345609664917,
-0.20859530568122864,
0.06203102320432663,
0.20970721542835236,
-0.1498318761587143,
-0.014746561646461487,
-0.06710807234048843,
-0.11165943741798401,
0.04214812070131302,
-0.11517757922410965,
0.6210402250289917,
-0.1083306074142456,
-0.0778186172246933,
0.16300907731056213,
0.22714146971702576,
0.23260971903800964,
-0.04593554884195328,
0.0751873254776001,
-0.1875702440738678,
-0.14768604934215546,
-0.17049092054367065,
-0.0469827800989151,
0.030485358089208603,
-0.05824131518602371,
-0.07640180736780167,
-0.10033412277698517,
-0.10450263321399689,
-0.10777980089187622,
-0.03843402862548828,
0.10933127999305725,
-0.04124167561531067,
-0.9979840517044067,
0.2905908226966858,
0.04956025630235672,
0.3575124740600586,
-0.29709386825561523,
-0.028255753219127655,
0.00795433297753334,
-0.12867297232151031,
0.08680912852287292,
0.21515801548957825,
0.20429378747940063,
-0.2144068479537964,
-0.23014505207538605,
0.31662020087242126,
-0.09855349361896515,
-0.3138299882411957,
-0.08796186745166779,
-0.16314440965652466,
0.0783090814948082,
0.21132402122020721,
0.047089774161577225,
-0.2636474072933197,
-0.026438839733600616,
0.2030964344739914,
0.21867266297340393,
-0.2879207730293274,
-0.18550913035869598,
-0.07285001128911972,
-0.03947172313928604,
0.0451781302690506,
-0.11974611133337021,
-0.10935762524604797,
0.2601594626903534,
-0.2708393931388855,
-0.14371615648269653,
-0.19857126474380493,
-0.1354958713054657,
0.5682417154312134,
0.046384915709495544,
0.4107862114906311,
0.0025731143541634083,
0.33456310629844666,
0.35834968090057373,
0.11502949893474579,
0.2347039431333542,
0.47863999009132385,
-0.14825192093849182,
0.25368261337280273,
0.15915560722351074,
-0.36592811346054077,
0.36424964666366577,
0.166031613945961,
0.08493299782276154,
-0.4914814829826355,
-0.23854216933250427,
0.08914662897586823,
-0.19527442753314972,
0.29068607091903687,
0.09434571117162704,
0.1904982030391693,
-0.07808773964643478,
-0.2748824954032898,
0.5450210571289062,
0.13870996236801147,
-0.00970476120710373,
0.38043561577796936,
0.36599040031433105,
-0.11648563295602798,
-0.18732044100761414,
0.5151318907737732,
0.8932387232780457,
0.07692800462245941,
-0.19381974637508392,
0.2794934809207916,
0.40902864933013916,
0.3263080418109894,
-0.4818764925003052,
0.03565927594900131,
-0.16217786073684692,
-0.35303062200546265,
0.04039829969406128,
-0.09729434549808502,
0.12948963046073914,
0.2668582797050476,
0.14362606406211853,
0.05912511795759201,
-0.16503001749515533,
-0.27333736419677734,
-0.19463485479354858,
0.1724720001220703,
-0.27292123436927795,
-0.15353454649448395,
0.27733516693115234,
0.2721075117588043,
0.13054418563842773,
0.15000005066394806,
-0.009312406182289124,
0.03588911145925522,
-0.32536789774894714,
0.0026431456208229065,
-0.0561353862285614,
-0.0674716979265213,
-0.08962108939886093,
0.05041789263486862,
0.04958323389291763,
-0.32575371861457825,
-0.04445314779877663,
0.3328697979450226,
0.2143794596195221,
-0.06345406174659729,
-0.10070642828941345,
0.17119145393371582,
-0.3458364009857178,
0.05605838820338249,
0.3358951210975647,
-0.02514331042766571,
0.42439645528793335,
-0.16991731524467468,
-0.18090027570724487,
-0.03743607550859451,
0.10338584333658218,
0.23112191259860992,
-0.3712257146835327,
-0.026438362896442413,
-0.007929153740406036,
-0.46986693143844604,
-0.07465435564517975,
0.18060648441314697,
-0.09826457500457764,
-0.08301830291748047,
0.20217861235141754,
0.23073264956474304,
-0.061475809663534164,
0.44993752241134644,
-0.10995697975158691,
0.050946444272994995,
-0.10477064549922943,
0.1902831643819809,
0.4379962086677551,
-0.19386973977088928,
0.2532501220703125,
0.016940485686063766,
0.01712280511856079,
-0.15885353088378906,
0.05005481094121933,
0.5058934688568115,
-0.07294580340385437,
-0.07203786075115204,
-0.2528296411037445,
-0.19848628342151642,
-0.0053444248624145985,
0.24420343339443207,
0.2831345796585083,
-0.02584639936685562,
0.10039712488651276,
-0.33026859164237976,
-0.4769793748855591,
0.29217255115509033,
0.13106195628643036,
0.41747263073921204,
-0.25879108905792236,
0.23891441524028778,
-0.04940617084503174,
0.053933896124362946,
-0.37823668122291565,
0.017713027074933052,
-0.12125477939844131,
0.069816455245018,
0.08076627552509308,
-0.05847959965467453,
0.25918206572532654,
-0.3779757022857666,
0.1792132556438446,
-0.0013167373836040497,
-0.16577741503715515,
-0.25156933069229126,
-0.11762197315692902,
0.08902490884065628,
0.1660425066947937,
-0.10493012517690659,
0.27457693219184875,
-0.024084948003292084,
-0.05762988701462746,
-0.07242883741855621,
0.060463305562734604,
-0.1173609271645546,
0.03028002753853798,
0.3011864423751831,
0.01742284744977951,
0.1451926976442337,
-0.06114105135202408,
0.1379966139793396,
0.1187240481376648,
0.2595631182193756,
0.18733474612236023,
-0.2682832181453705,
0.0385158434510231,
-0.22945573925971985,
-0.29669898748397827,
0.016470294445753098,
-0.04875384271144867,
0.10813429951667786,
0.2654646933078766,
-0.06601368635892868,
0.15568168461322784,
0.1725359410047531,
0.35152438282966614,
0.3776398003101349,
-0.1848827600479126,
0.11095012724399567,
0.005314413458108902,
0.3281938135623932,
-0.2923995852470398,
-0.0011996146058663726,
0.04963172972202301,
0.32952189445495605,
-0.07888315618038177,
0.0898391455411911,
0.16863597929477692,
-0.053000107407569885,
-0.15999248623847961,
0.1708453893661499,
0.21008168160915375,
-0.08329629898071289,
0.10489499568939209,
0.20735441148281097,
-0.24558410048484802,
-0.010132651776075363,
0.1504189819097519,
-0.03164788708090782,
-0.031468652188777924,
0.2588605284690857,
0.013110928237438202,
0.5113005638122559,
0.1838935911655426,
0.16355431079864502,
0.017018213868141174,
-0.0001420937478542328,
-0.06958377361297607,
0.3481970429420471,
0.15040718019008636,
0.15924984216690063,
-0.026223808526992798,
0.5760987997055054,
-0.20666182041168213,
-0.0005728988908231258,
-0.3108676075935364,
-0.028976473957300186,
0.09624727070331573,
0.14916115999221802,
-0.2483232319355011,
-0.10396792739629745,
0.048124462366104126,
-0.18607963621616364,
-0.12905175983905792,
-0.2516665458679199,
0.1477457582950592,
-0.020554542541503906,
-0.3541608452796936,
-0.8141177892684937,
-0.10855966061353683,
0.1517537385225296,
0.27636879682540894,
-0.09953062236309052,
0.14247052371501923,
0.5436646342277527,
-0.034408971667289734,
0.0800299346446991,
0.5004678964614868,
0.1134972795844078,
0.19738750159740448,
0.0002366974949836731,
0.05064712092280388,
0.226612851023674,
-0.02681601792573929,
0.10144825279712677,
0.10673253238201141,
0.0004926249384880066,
-0.15041007101535797,
0.2974781394004822,
0.1995946764945984,
-0.1207929253578186,
-0.1327408105134964,
0.03757863491773605,
0.026307981461286545,
-0.10724224150180817,
0.04616272449493408,
0.05251362919807434,
-0.15480101108551025,
-0.08051420748233795,
-0.20899710059165955,
-0.35665374994277954,
-0.025505810976028442,
-0.09978541731834412,
0.20137831568717957,
0.19011178612709045,
0.01691460981965065,
0.14085938036441803,
-0.35993850231170654,
0.3116765022277832,
0.038262225687503815,
-0.10933514684438705,
-0.2739180326461792,
-0.1286853551864624,
-0.6168882846832275,
0.013342216610908508,
-0.08499284088611603,
-0.5377329587936401,
0.16996341943740845,
0.32207074761390686,
0.15080535411834717,
0.047232985496520996,
0.008166603744029999,
-0.43052220344543457,
-0.12222921848297119,
0.2721703052520752,
-0.5976175665855408,
0.07934478670358658,
-0.222513809800148,
0.17407868802547455,
0.019511308521032333,
0.29722145199775696,
0.2198365479707718,
0.21281500160694122,
0.015455849468708038,
0.15549412369728088,
0.18724998831748962,
0.15600545704364777,
0.24867582321166992,
0.008837990462779999,
-0.040969811379909515,
0.47965118288993835,
0.19746944308280945,
0.31389448046684265,
-0.3052365779876709,
-0.1834244579076767,
-0.19230817258358002,
0.2781381905078888,
0.20501737296581268,
0.08163388073444366,
-0.033320002257823944,
0.021579362452030182,
0.09725890308618546,
0.3132694959640503,
0.040332354605197906,
-0.4563271403312683,
-0.4822048544883728,
-0.02402244135737419,
0.048060499131679535,
0.05034901946783066,
0.2764171063899994,
0.5173119902610779,
-0.022504307329654694,
0.04618605971336365,
-0.20399001240730286,
-0.38061511516571045,
0.4077625274658203,
-0.1462407112121582,
0.18505553901195526,
-0.06523149460554123,
0.2599228620529175,
0.4546600580215454,
-0.020159902051091194,
-0.35338446497917175,
-0.012658067047595978,
0.40807411074638367,
-0.25720182061195374,
-0.1338900923728943,
0.27064552903175354,
0.369113564491272,
-0.1420963704586029,
-0.022181367501616478,
-0.04743388295173645,
-0.036277130246162415,
0.05652785301208496,
0.17064185440540314,
-0.05570258945226669
] |
https://github.com/huggingface/datasets/issues/672 | Questions about XSUM | @lhoestq @sshleifer like @jbragg said earlier, the main issue for us is that the current XSUM dataset (in your package) does not have IDs suggested by the original dataset ([here is the file](https://raw.githubusercontent.com/EdinburghNLP/XSum/master/XSum-Dataset/XSum-TRAINING-DEV-TEST-SPLIT-90-5-5.json).) Would appreciate if you update the XSUM dataset to include the instance IDs.
The missing instances is also a problem, but likely not worth pursuing given its relatively small scale. | Hi there ✋
I'm looking into your `xsum` dataset and I have several questions on that.
So here is how I loaded the data:
```
>>> data = datasets.load_dataset('xsum', version='1.0.1')
>>> data['train']
Dataset(features: {'document': Value(dtype='string', id=None), 'summary': Value(dtype='string', id=None)}, num_rows: 204017)
>>> data['test']
Dataset(features: {'document': Value(dtype='string', id=None), 'summary': Value(dtype='string', id=None)}, num_rows: 11333)
```
The first issue is, the instance counts don’t match what I see on [the dataset's website](https://github.com/EdinburghNLP/XSum/tree/master/XSum-Dataset#what-builds-the-xsum-dataset) (11,333 vs 11,334 for test set; 204,017 vs 204,045 for training set)
```
… training (90%, 204,045), validation (5%, 11,332), and test (5%, 11,334) set.
```
Any thoughts why? Perhaps @mariamabarham could help here, since she recently had a PR on this dataaset https://github.com/huggingface/datasets/pull/289 (reviewed by @patrickvonplaten)
Another issue is that the instances don't seem to have IDs. The original datasets provides IDs for the instances: https://github.com/EdinburghNLP/XSum/blob/master/XSum-Dataset/XSum-TRAINING-DEV-TEST-SPLIT-90-5-5.json but to be able to use them, the dataset sizes need to match.
CC @jbragg
| 63 | Questions about XSUM
Hi there ✋
I'm looking into your `xsum` dataset and I have several questions on that.
So here is how I loaded the data:
```
>>> data = datasets.load_dataset('xsum', version='1.0.1')
>>> data['train']
Dataset(features: {'document': Value(dtype='string', id=None), 'summary': Value(dtype='string', id=None)}, num_rows: 204017)
>>> data['test']
Dataset(features: {'document': Value(dtype='string', id=None), 'summary': Value(dtype='string', id=None)}, num_rows: 11333)
```
The first issue is, the instance counts don’t match what I see on [the dataset's website](https://github.com/EdinburghNLP/XSum/tree/master/XSum-Dataset#what-builds-the-xsum-dataset) (11,333 vs 11,334 for test set; 204,017 vs 204,045 for training set)
```
… training (90%, 204,045), validation (5%, 11,332), and test (5%, 11,334) set.
```
Any thoughts why? Perhaps @mariamabarham could help here, since she recently had a PR on this dataaset https://github.com/huggingface/datasets/pull/289 (reviewed by @patrickvonplaten)
Another issue is that the instances don't seem to have IDs. The original datasets provides IDs for the instances: https://github.com/EdinburghNLP/XSum/blob/master/XSum-Dataset/XSum-TRAINING-DEV-TEST-SPLIT-90-5-5.json but to be able to use them, the dataset sizes need to match.
CC @jbragg
@lhoestq @sshleifer like @jbragg said earlier, the main issue for us is that the current XSUM dataset (in your package) does not have IDs suggested by the original dataset ([here is the file](https://raw.githubusercontent.com/EdinburghNLP/XSum/master/XSum-Dataset/XSum-TRAINING-DEV-TEST-SPLIT-90-5-5.json).) Would appreciate if you update the XSUM dataset to include the instance IDs.
The missing instances is also a problem, but likely not worth pursuing given its relatively small scale. | [
-0.1664319485425949,
-0.3865365982055664,
-0.14755186438560486,
0.41031551361083984,
0.3375101685523987,
-0.005333825945854187,
0.13421602547168732,
0.04272174462676048,
0.2139723300933838,
0.2906925678253174,
-0.2072107046842575,
0.3043749928474426,
0.05202582851052284,
0.3954084813594818,
0.1108669564127922,
0.12895725667476654,
-0.036918170750141144,
-0.0796164721250534,
-0.3687424063682556,
-0.2781105637550354,
0.010358214378356934,
0.08667057752609253,
-0.06397848576307297,
-0.10640272498130798,
-0.625708281993866,
-0.0011953357607126236,
-0.07037857919931412,
0.2886463701725006,
-0.12423156946897507,
-0.23180824518203735,
0.2674061954021454,
0.03309701755642891,
0.03237840533256531,
0.5344512462615967,
-0.00010199569805990905,
0.05566622316837311,
0.17177855968475342,
-0.018571078777313232,
-0.11034798622131348,
0.2229580581188202,
-0.12027407437562943,
-0.008308582939207554,
-0.021420583128929138,
-0.3645845949649811,
-0.15466561913490295,
0.053789857774972916,
-0.15656983852386475,
-0.3595401346683502,
0.26121845841407776,
0.03561348468065262,
0.2618618309497833,
0.17373126745224,
0.14234909415245056,
-0.10176007449626923,
-0.06945826858282089,
-0.21827952563762665,
0.057239726185798645,
0.24209953844547272,
0.38956552743911743,
0.2819088399410248,
0.07570309937000275,
0.18212296068668365,
0.075041763484478,
-0.17287012934684753,
0.26093006134033203,
0.08178168535232544,
0.3629447817802429,
-0.1643868088722229,
-0.30317258834838867,
0.2791019380092621,
0.7783161997795105,
-0.0496198832988739,
-0.28093644976615906,
0.0017529800534248352,
0.042349670082330704,
-0.18058009445667267,
0.1583731472492218,
-0.020435994490981102,
0.312470942735672,
0.01669437624514103,
-0.17306628823280334,
0.3848588764667511,
-0.22889328002929688,
0.032479457557201385,
-0.14356042444705963,
-0.044080376625061035,
-0.07008662819862366,
-0.014687754213809967,
-0.1825106143951416,
-0.047721706330776215,
0.00894571840763092,
0.003631865605711937,
0.14165593683719635,
0.15540210902690887,
-0.31443384289741516,
-0.141152024269104,
0.020316481590270996,
-0.06359940022230148,
0.19229260087013245,
0.1255430281162262,
0.280884712934494,
0.12056511640548706,
-0.3568883240222931,
0.045933715999126434,
0.1722760647535324,
0.28896835446357727,
0.3624551594257355,
-0.5636851191520691,
0.037686992436647415,
-0.03632442280650139,
-0.07487925887107849,
0.09207090735435486,
-0.3312952518463135,
-0.03887881338596344,
-0.0027434229850769043,
0.01620268076658249,
-0.13093608617782593,
-0.36461445689201355,
-0.3093111217021942,
0.23985828459262848,
0.06139616668224335,
-0.032337725162506104,
0.13637769222259521,
-0.07832600921392441,
0.0352189838886261,
0.38734257221221924,
0.054040297865867615,
0.054750677198171616,
-0.5485548377037048,
-0.2514093220233917,
-0.3607020378112793,
0.10817566514015198,
-0.09699926525354385,
-0.03042798675596714,
0.09176982939243317,
-0.09939360618591309,
0.35303226113319397,
-0.08296569436788559,
0.26786041259765625,
-0.011360958218574524,
0.056242913007736206,
0.14157725870609283,
-0.37558773159980774,
0.19327494502067566,
0.024441249668598175,
-0.008043739013373852,
-0.026724759489297867,
0.05317366123199463,
-0.013381972908973694,
-0.06391499191522598,
-0.2145492434501648,
-0.2001977413892746,
-0.0062237028032541275,
0.3539358973503113,
-0.31193578243255615,
-0.26476985216140747,
-0.13786277174949646,
-0.037639666348695755,
0.1369856595993042,
0.16690082848072052,
-0.2109554409980774,
-0.11672568321228027,
0.05836972966790199,
-0.10733944177627563,
0.16507990658283234,
-0.0286732017993927,
-0.5455515384674072,
0.009000249207019806,
-0.016047654673457146,
-0.27755168080329895,
0.06497187912464142,
-0.05208074674010277,
-0.01313996221870184,
0.24241027235984802,
0.13491743803024292,
0.17094586789608002,
-0.47720867395401,
-0.5170894265174866,
-0.19877466559410095,
-0.29609087109565735,
-0.22534862160682678,
-0.10238154977560043,
0.11537272483110428,
0.08577627688646317,
-0.004622782580554485,
-0.0884748324751854,
0.18725427985191345,
0.040016885846853256,
0.14527009427547455,
-0.16392827033996582,
-0.4526289701461792,
-0.09699465334415436,
-0.05058062821626663,
0.20024225115776062,
-0.040960896760225296,
-0.30179867148399353,
-0.1011529192328453,
0.3752577602863312,
0.16310790181159973,
-0.02873656526207924,
-0.07251371443271637,
0.10203620791435242,
0.314627081155777,
-0.1599346250295639,
0.05291537195444107,
-0.22088530659675598,
0.005763731896877289,
0.2957915961742401,
0.04208628088235855,
0.26485326886177063,
0.6834335923194885,
-0.038143984973430634,
-0.39162203669548035,
-0.21677365899085999,
-0.0180661641061306,
-0.19709965586662292,
0.24530112743377686,
-0.16238902509212494,
-0.021076802164316177,
-0.1782016158103943,
-0.17120011150836945,
0.17782554030418396,
-0.5446184873580933,
0.042466290295124054,
-0.46828994154930115,
0.3180689513683319,
-0.025031017139554024,
-0.03677740693092346,
0.09038470685482025,
0.2675650715827942,
-0.020895354449748993,
-0.2781306207180023,
-0.024045661091804504,
0.5908076167106628,
0.11889616400003433,
-0.013859830796718597,
0.13969936966896057,
0.13380403816699982,
0.3510760962963104,
-0.1848495900630951,
0.10545283555984497,
-0.2123267501592636,
-0.08400207757949829,
-0.13725197315216064,
-0.35257887840270996,
0.24118119478225708,
-0.11317206919193268,
-0.03698696941137314,
-0.051810622215270996,
0.03541925549507141,
0.060906484723091125,
-0.1979057341814041,
0.030264975503087044,
-0.025080036371946335,
0.14393742382526398,
0.11972306668758392,
-0.2250247299671173,
0.017750311642885208,
0.041690610349178314,
0.3525961935520172,
-0.2550520896911621,
-0.12358637154102325,
-0.15649765729904175,
-0.3450435996055603,
-0.17981648445129395,
0.13645732402801514,
0.10997447371482849,
0.0011713765561580658,
0.4829596281051636,
0.3248569369316101,
0.035276032984256744,
-0.00942009873688221,
-0.14245684444904327,
-0.11504989862442017,
0.012248672544956207,
-0.01896245777606964,
-0.06761270761489868,
-0.016781866550445557,
-0.0689263865351677,
0.012176530435681343,
-0.163682758808136,
0.09996341168880463,
0.12424477189779282,
0.19164755940437317,
-0.37351763248443604,
-0.33467140793800354,
-0.27640196681022644,
-0.08549229800701141,
0.12800322473049164,
0.17545293271541595,
0.19416867196559906,
-0.2772435247898102,
0.1896548867225647,
0.07377272099256516,
-0.05829911679029465,
0.06377728283405304,
-0.3311455249786377,
0.24398326873779297,
0.062469482421875,
0.046151600778102875,
0.09602080285549164,
-0.13298627734184265,
-0.1988457441329956,
0.22830820083618164,
0.025777380913496017,
0.34284114837646484,
0.3706849217414856,
-0.08619681000709534,
-0.06317675113677979,
0.09524870663881302,
-0.4376233220100403,
0.057785362005233765,
-0.1971290558576584,
0.2600507140159607,
-0.12569552659988403,
0.0024520158767700195,
0.10206927359104156,
-0.05848119407892227,
0.2918134927749634,
-0.10222171992063522,
-0.2722828984260559,
-0.05779161676764488,
0.16973184049129486,
-0.2628474533557892,
-0.11110912263393402,
-0.6046497821807861,
-0.05561527609825134,
-0.13412140309810638,
-0.10603992640972137,
0.4435874819755554,
0.14383229613304138,
0.08524405211210251,
-0.05561172589659691,
0.21293120086193085,
0.23960742354393005,
-0.17015159130096436,
-0.3796664774417877,
-0.7306687831878662,
0.257750004529953,
-0.12023033201694489,
-0.5162160396575928,
0.005153995007276535,
0.0044581834226846695,
0.3787733316421509,
0.1294914186000824,
-0.38695037364959717,
-0.361075758934021,
0.045829251408576965,
-0.06637860834598541,
0.4467766582965851,
0.1637558937072754,
0.29842543601989746,
-0.1350427269935608,
-0.23061513900756836,
-0.273147314786911,
-0.05809323489665985,
0.26192235946655273,
0.2238495647907257,
0.4402632415294647,
-0.3096804916858673,
-0.250570684671402,
-0.18283970654010773,
0.04081527888774872,
0.14655782282352448,
-0.16798435151576996,
0.053349025547504425,
-0.06999971717596054,
-0.017250221222639084,
0.014959797263145447,
-0.12588517367839813,
0.5826578140258789,
-0.08084146678447723,
-0.029086634516716003,
0.1526951938867569,
0.17585572600364685,
0.1942482888698578,
-0.050030287355184555,
0.06345455348491669,
-0.17521506547927856,
-0.15911497175693512,
-0.20253844559192657,
-0.03308156132698059,
0.04783523827791214,
-0.03291430324316025,
-0.02250935137271881,
-0.08225603401660919,
-0.06751982867717743,
-0.05433249473571777,
-0.01460103690624237,
0.09584609419107437,
-0.04149232804775238,
-0.9815751910209656,
0.2990344166755676,
0.06181403994560242,
0.3727128505706787,
-0.27104341983795166,
0.029136747121810913,
-0.008318889886140823,
-0.14833393692970276,
0.10562416911125183,
0.12023720890283585,
0.12920604646205902,
-0.24892212450504303,
-0.17674219608306885,
0.3190033733844757,
-0.08307444304227829,
-0.30162569880485535,
-0.09213459491729736,
-0.15000399947166443,
0.08915393799543381,
0.23977376520633698,
0.08280344307422638,
-0.3069484531879425,
-0.08608823269605637,
0.2430824190378189,
0.19355173408985138,
-0.266192227602005,
-0.13250328600406647,
-0.13145649433135986,
-0.07642477750778198,
-0.004566125571727753,
-0.10265182703733444,
-0.15122930705547333,
0.29963481426239014,
-0.20886816084384918,
-0.13633134961128235,
-0.18654711544513702,
-0.16974475979804993,
0.5243934392929077,
0.06162259355187416,
0.4386521279811859,
-0.009469165466725826,
0.33872687816619873,
0.3222387731075287,
0.11364205181598663,
0.22655217349529266,
0.4560769200325012,
-0.1674661487340927,
0.2600366473197937,
0.13714930415153503,
-0.3577572703361511,
0.3021462559700012,
0.16123686730861664,
0.03344176709651947,
-0.4339480996131897,
-0.24147173762321472,
0.06579402089118958,
-0.1872549206018448,
0.28819751739501953,
0.1533888280391693,
0.19018462300300598,
-0.07134874910116196,
-0.23337730765342712,
0.5094259977340698,
0.10266420245170593,
-0.021098792552947998,
0.39918383955955505,
0.3343644440174103,
-0.14948242902755737,
-0.17229212820529938,
0.5163657069206238,
0.8613100051879883,
0.09601427614688873,
-0.18091732263565063,
0.2801847457885742,
0.39669865369796753,
0.3063434660434723,
-0.47724199295043945,
0.09450764954090118,
-0.16172075271606445,
-0.31017425656318665,
0.06459471583366394,
-0.03803236782550812,
0.1542026847600937,
0.2285584658384323,
0.06453697383403778,
0.037970300763845444,
-0.10210083425045013,
-0.22734901309013367,
-0.17292632162570953,
0.21867963671684265,
-0.2502022385597229,
-0.16996334493160248,
0.25279974937438965,
0.312973290681839,
0.08236127346754074,
0.13841299712657928,
-0.03978492319583893,
-0.000019628554582595825,
-0.2951776087284088,
-0.03191755712032318,
-0.05163876339793205,
-0.002218356356024742,
-0.021954169496893883,
0.038633354008197784,
0.043175190687179565,
-0.3069760203361511,
-0.04737209156155586,
0.27166298031806946,
0.22966177761554718,
0.011652018874883652,
-0.1372310072183609,
0.1732465922832489,
-0.3802207410335541,
0.03505098819732666,
0.31456902623176575,
-0.014671403914690018,
0.44549819827079773,
-0.2222692370414734,
-0.20394757390022278,
-0.005413740873336792,
0.1337214559316635,
0.12844814360141754,
-0.31045815348625183,
-0.05125075578689575,
0.02562103420495987,
-0.4915601313114166,
-0.05407789722084999,
0.23485487699508667,
-0.053194932639598846,
-0.11472590267658234,
0.24008187651634216,
0.1850808560848236,
-0.12701505422592163,
0.422976553440094,
-0.06214216724038124,
0.009225338697433472,
-0.09475022554397583,
0.22640669345855713,
0.40637603402137756,
-0.16733846068382263,
0.25981786847114563,
-0.06425129622220993,
0.016676411032676697,
-0.2114749550819397,
-0.05163900926709175,
0.5009376406669617,
-0.11436079442501068,
-0.09558426588773727,
-0.21368840336799622,
-0.23797956109046936,
0.040790531784296036,
0.2407122105360031,
0.2750689387321472,
0.009979195892810822,
0.0775904655456543,
-0.32891327142715454,
-0.45561322569847107,
0.2503008246421814,
0.13048067688941956,
0.41505852341651917,
-0.276404470205307,
0.3125859797000885,
-0.05209608003497124,
0.06438537687063217,
-0.42549124360084534,
-0.010689622722566128,
-0.14551682770252228,
0.027405597269535065,
0.10032665729522705,
-0.08419454842805862,
0.2783965766429901,
-0.34192410111427307,
0.23167017102241516,
0.04787047579884529,
-0.17458122968673706,
-0.2762838304042816,
-0.13655534386634827,
0.07043326646089554,
0.14917467534542084,
-0.07766424119472504,
0.24763327836990356,
-0.025733251124620438,
-0.09248556196689606,
-0.050654806196689606,
0.09386636316776276,
-0.13936719298362732,
0.03685348853468895,
0.2981909513473511,
0.06637082248926163,
0.15865471959114075,
-0.03549153357744217,
0.07819457352161407,
0.11301475763320923,
0.272915780544281,
0.1305638998746872,
-0.2734079957008362,
0.03257312998175621,
-0.21202607452869415,
-0.3130913972854614,
0.02325502410531044,
-0.022260993719100952,
0.1726323962211609,
0.2782166004180908,
-0.12229512631893158,
0.10622897744178772,
0.15347328782081604,
0.35414010286331177,
0.35138100385665894,
-0.15260225534439087,
0.047502823173999786,
0.02522309124469757,
0.36838072538375854,
-0.3287713825702667,
-0.02229379490017891,
0.025503303855657578,
0.26143866777420044,
-0.05511928349733353,
0.05879543721675873,
0.18165552616119385,
-0.023263849318027496,
-0.043384358286857605,
0.20029973983764648,
0.22687041759490967,
-0.10053853690624237,
0.09654241800308228,
0.2139594852924347,
-0.20773230493068695,
-0.0051932744681835175,
0.1913175731897354,
-0.09725172817707062,
-0.07546911388635635,
0.285611093044281,
0.016581133008003235,
0.5100927948951721,
0.1186041310429573,
0.1476449966430664,
-0.036523088812828064,
0.03206564858555794,
-0.06538760662078857,
0.3482097387313843,
0.18485598266124725,
0.1558435559272766,
-0.01117679476737976,
0.5806465744972229,
-0.2293238639831543,
-0.04982452094554901,
-0.3147737979888916,
0.0028497911989688873,
0.043912746012210846,
0.15557222068309784,
-0.2418769747018814,
-0.09445205330848694,
0.0503271222114563,
-0.154991015791893,
-0.10503058135509491,
-0.1727748066186905,
0.1736912727355957,
-0.03145574778318405,
-0.3885217308998108,
-0.7518587112426758,
-0.1490350365638733,
0.1357879489660263,
0.2569051682949066,
-0.09359844774007797,
0.2078542411327362,
0.530371367931366,
-0.006802953779697418,
0.06902013719081879,
0.4900556206703186,
0.13364368677139282,
0.19168326258659363,
0.0421600416302681,
0.014690710231661797,
0.19886697828769684,
-0.028066327795386314,
0.05699153244495392,
0.14837773144245148,
0.03882449120283127,
-0.10543477535247803,
0.2769366502761841,
0.24604976177215576,
-0.18080952763557434,
-0.09605461359024048,
0.031153086572885513,
0.011099551804363728,
-0.07207460701465607,
0.126810222864151,
0.1246972605586052,
-0.11882814764976501,
-0.14536145329475403,
-0.19192975759506226,
-0.3672335147857666,
0.016355011612176895,
-0.12103348970413208,
0.16846662759780884,
0.15897315740585327,
-0.04063592478632927,
0.15841855108737946,
-0.2721066176891327,
0.33823901414871216,
0.0010289475321769714,
-0.11292103677988052,
-0.29340848326683044,
-0.13183140754699707,
-0.6782484650611877,
0.07442578673362732,
-0.08005908131599426,
-0.5033024549484253,
0.15027208626270294,
0.27666470408439636,
0.14835689961910248,
0.07356694340705872,
0.07056312263011932,
-0.4583144187927246,
-0.11970285326242447,
0.2027541548013687,
-0.6247522830963135,
0.09861461073160172,
-0.15919281542301178,
0.12261813879013062,
0.02659457176923752,
0.19652295112609863,
0.17457440495491028,
0.2322186976671219,
0.07669494301080704,
0.13577106595039368,
0.13279147446155548,
0.09529171884059906,
0.19271919131278992,
0.04884278029203415,
-0.029895586892962456,
0.45816799998283386,
0.1391887366771698,
0.23715165257453918,
-0.3483579158782959,
-0.19734258949756622,
-0.2617533802986145,
0.23139971494674683,
0.24930478632450104,
0.14764665067195892,
0.021968061104416847,
0.0007609426975250244,
-0.006090715993195772,
0.3671991229057312,
0.058812662959098816,
-0.4401393532752991,
-0.4696766138076782,
0.020333902910351753,
0.052589140832424164,
0.027828490361571312,
0.28315842151641846,
0.5465502738952637,
0.010519202798604965,
0.08639324456453323,
-0.3044319748878479,
-0.39018529653549194,
0.4265871047973633,
-0.12443244457244873,
0.12852634489536285,
-0.007351611740887165,
0.2603493332862854,
0.436062216758728,
-0.08972416818141937,
-0.3726537525653839,
0.0235137939453125,
0.37490490078926086,
-0.17840752005577087,
-0.15230794250965118,
0.303538978099823,
0.3506132662296295,
-0.133280947804451,
0.00690503790974617,
-0.04332444816827774,
0.00856221467256546,
0.037628673017024994,
0.17328962683677673,
-0.08257748186588287
] |
https://github.com/huggingface/datasets/issues/672 | Questions about XSUM | >So I managed to download them all but when parsing only 226,181/226,711 worked.
@lhoestq any chance we could update the HF-hosted dataset with the IDs in your new version? Happy to help if there's something I can do. | Hi there ✋
I'm looking into your `xsum` dataset and I have several questions on that.
So here is how I loaded the data:
```
>>> data = datasets.load_dataset('xsum', version='1.0.1')
>>> data['train']
Dataset(features: {'document': Value(dtype='string', id=None), 'summary': Value(dtype='string', id=None)}, num_rows: 204017)
>>> data['test']
Dataset(features: {'document': Value(dtype='string', id=None), 'summary': Value(dtype='string', id=None)}, num_rows: 11333)
```
The first issue is, the instance counts don’t match what I see on [the dataset's website](https://github.com/EdinburghNLP/XSum/tree/master/XSum-Dataset#what-builds-the-xsum-dataset) (11,333 vs 11,334 for test set; 204,017 vs 204,045 for training set)
```
… training (90%, 204,045), validation (5%, 11,332), and test (5%, 11,334) set.
```
Any thoughts why? Perhaps @mariamabarham could help here, since she recently had a PR on this dataaset https://github.com/huggingface/datasets/pull/289 (reviewed by @patrickvonplaten)
Another issue is that the instances don't seem to have IDs. The original datasets provides IDs for the instances: https://github.com/EdinburghNLP/XSum/blob/master/XSum-Dataset/XSum-TRAINING-DEV-TEST-SPLIT-90-5-5.json but to be able to use them, the dataset sizes need to match.
CC @jbragg
| 38 | Questions about XSUM
Hi there ✋
I'm looking into your `xsum` dataset and I have several questions on that.
So here is how I loaded the data:
```
>>> data = datasets.load_dataset('xsum', version='1.0.1')
>>> data['train']
Dataset(features: {'document': Value(dtype='string', id=None), 'summary': Value(dtype='string', id=None)}, num_rows: 204017)
>>> data['test']
Dataset(features: {'document': Value(dtype='string', id=None), 'summary': Value(dtype='string', id=None)}, num_rows: 11333)
```
The first issue is, the instance counts don’t match what I see on [the dataset's website](https://github.com/EdinburghNLP/XSum/tree/master/XSum-Dataset#what-builds-the-xsum-dataset) (11,333 vs 11,334 for test set; 204,017 vs 204,045 for training set)
```
… training (90%, 204,045), validation (5%, 11,332), and test (5%, 11,334) set.
```
Any thoughts why? Perhaps @mariamabarham could help here, since she recently had a PR on this dataaset https://github.com/huggingface/datasets/pull/289 (reviewed by @patrickvonplaten)
Another issue is that the instances don't seem to have IDs. The original datasets provides IDs for the instances: https://github.com/EdinburghNLP/XSum/blob/master/XSum-Dataset/XSum-TRAINING-DEV-TEST-SPLIT-90-5-5.json but to be able to use them, the dataset sizes need to match.
CC @jbragg
>So I managed to download them all but when parsing only 226,181/226,711 worked.
@lhoestq any chance we could update the HF-hosted dataset with the IDs in your new version? Happy to help if there's something I can do. | [
-0.11086814850568771,
-0.2911376655101776,
-0.13783489167690277,
0.4550743103027344,
0.28178027272224426,
0.07282999902963638,
0.054408907890319824,
0.09135876595973969,
0.2821638584136963,
0.26557010412216187,
-0.43892839550971985,
0.06820141524076462,
0.20143002271652222,
0.3437096178531647,
0.09783845394849777,
0.09836086630821228,
0.02806594967842102,
-0.06884856522083282,
-0.3998473584651947,
-0.35203611850738525,
-0.0486401692032814,
0.07904570549726486,
-0.07018016278743744,
-0.12539994716644287,
-0.6150902509689331,
-0.00045312754809856415,
-0.25228339433670044,
0.3219080865383148,
-0.06846974045038223,
-0.2613791823387146,
0.2724301517009735,
0.17689819633960724,
0.1588338017463684,
0.5855625867843628,
-0.00010795356502057984,
-0.002130754292011261,
0.07019514590501785,
-0.036224450916051865,
-0.2027471661567688,
0.24571192264556885,
-0.12541937828063965,
-0.050253160297870636,
-0.10464158654212952,
-0.3473929166793823,
-0.04128950461745262,
-0.08584295213222504,
-0.17893007397651672,
-0.2968728244304657,
0.20220869779586792,
0.011718501336872578,
0.19033320248126984,
0.19825655221939087,
0.1489180475473404,
-0.0657883808016777,
0.00046872347593307495,
-0.07727107405662537,
0.17585252225399017,
0.2949226200580597,
0.3840344548225403,
0.23389361798763275,
0.05221615359187126,
0.20369631052017212,
0.079388327896595,
-0.1030988097190857,
0.2630746364593506,
0.00710555212572217,
0.24796822667121887,
-0.10993359982967377,
-0.26267674565315247,
0.3442576825618744,
0.7662885785102844,
-0.00873694196343422,
-0.31431663036346436,
-0.05857143923640251,
-0.05130164325237274,
-0.17539827525615692,
0.182364359498024,
0.01664060540497303,
0.36867183446884155,
-0.01675916463136673,
-0.12193288654088974,
0.2837214767932892,
-0.2416822612285614,
0.08396174013614655,
-0.11713778972625732,
-0.008612722158432007,
-0.04056679457426071,
0.00766029953956604,
-0.29745417833328247,
-0.02404143661260605,
0.12381499260663986,
-0.13668851554393768,
0.11750097572803497,
0.1794932633638382,
-0.3197859823703766,
-0.08998970687389374,
-0.029495082795619965,
-0.07616548985242844,
0.27795231342315674,
0.008784700185060501,
0.17777413129806519,
0.14946991205215454,
-0.4885774552822113,
-0.005044925957918167,
0.24571803212165833,
0.18241316080093384,
0.40608638525009155,
-0.5367923378944397,
0.042455270886421204,
0.02432904578745365,
-0.08926944434642792,
0.07680931687355042,
-0.36913394927978516,
0.052282821387052536,
-0.13617780804634094,
0.06341534852981567,
-0.207942396402359,
-0.4489312469959259,
-0.24327117204666138,
0.29252082109451294,
0.06872684508562088,
-0.11138847470283508,
0.10921703279018402,
-0.03685399144887924,
0.022087175399065018,
0.4510502517223358,
0.02754119783639908,
0.06072716414928436,
-0.5903291702270508,
-0.42030787467956543,
-0.31490558385849,
0.12230974435806274,
0.010372009128332138,
-0.01227053813636303,
0.06632882356643677,
-0.12190967798233032,
0.30883723497390747,
-0.12535415589809418,
0.33763206005096436,
-0.014256924390792847,
-0.03684714064002037,
0.04127887263894081,
-0.34668946266174316,
0.24553194642066956,
0.06497925519943237,
0.013935932889580727,
-0.04707660898566246,
0.04914303869009018,
-0.020030595362186432,
-0.027354054152965546,
-0.2576952576637268,
-0.18760590255260468,
-0.05460936576128006,
0.28079497814178467,
-0.24172824621200562,
-0.2601536810398102,
-0.2303059995174408,
0.02295844815671444,
0.09730381518602371,
0.19584831595420837,
-0.23076221346855164,
-0.14987823367118835,
0.10268446803092957,
-0.08292894810438156,
0.16862937808036804,
0.04263174533843994,
-0.6364938020706177,
0.05905657261610031,
0.07920198887586594,
-0.2454473376274109,
0.04434116184711456,
0.04172482714056969,
-0.04963880404829979,
0.22937193512916565,
0.07539869844913483,
0.1855362206697464,
-0.5582088232040405,
-0.5333786010742188,
-0.1740589588880539,
-0.3230132460594177,
-0.08842052519321442,
-0.09281467646360397,
0.045245781540870667,
0.03356010466814041,
0.08581763505935669,
-0.13376645743846893,
0.09527791291475296,
0.0028810203075408936,
0.13383619487285614,
-0.22597093880176544,
-0.46463945508003235,
-0.07721839100122452,
-0.15328817069530487,
0.22038424015045166,
0.06405779719352722,
-0.2609003186225891,
-0.03736545890569687,
0.44460007548332214,
0.30158329010009766,
-0.02764049544930458,
-0.026219934225082397,
0.13326513767242432,
0.2527402639389038,
-0.007126107811927795,
0.10676789283752441,
-0.15951848030090332,
-0.05298876017332077,
0.299750953912735,
0.02694706618785858,
0.17234578728675842,
0.7534607648849487,
-0.060787104070186615,
-0.4119507968425751,
-0.2014404833316803,
0.04712950065732002,
-0.16899552941322327,
0.15340113639831543,
-0.15865294635295868,
-0.05252687260508537,
-0.24747756123542786,
-0.1893187165260315,
0.2952810823917389,
-0.5699026584625244,
0.09370460361242294,
-0.4114122688770294,
0.43598827719688416,
0.03158925101161003,
0.01110583171248436,
0.1427346169948578,
0.21961385011672974,
0.03496647626161575,
-0.3012126684188843,
-0.10307092219591141,
0.5682694911956787,
0.09729830175638199,
-0.017648398876190186,
0.20866015553474426,
0.1073383241891861,
0.42870810627937317,
-0.14941337704658508,
0.22424852848052979,
-0.273337721824646,
-0.03404765948653221,
-0.17392730712890625,
-0.34393447637557983,
0.24975329637527466,
-0.05894256755709648,
0.0061065927147865295,
-0.06931127607822418,
-0.02519889362156391,
-0.01900395378470421,
-0.13249996304512024,
0.13281823694705963,
-0.01066523790359497,
0.14250200986862183,
0.13921241462230682,
-0.22392843663692474,
-0.04858580231666565,
-0.05733766779303551,
0.4266650080680847,
-0.2708815038204193,
-0.1722158044576645,
-0.28021761775016785,
-0.2724073827266693,
-0.24390873312950134,
0.140364408493042,
0.1972505748271942,
-0.11884484440088272,
0.37793928384780884,
0.2638700008392334,
0.052203550934791565,
0.06597026437520981,
-0.05864991247653961,
-0.11965615302324295,
-0.023051999509334564,
0.02118074521422386,
-0.036294516175985336,
-0.0213889479637146,
-0.0011307927779853344,
0.03821302205324173,
-0.20890885591506958,
0.05713179334998131,
0.12900657951831818,
0.16770926117897034,
-0.4405561685562134,
-0.3460100293159485,
-0.2939581274986267,
-0.10697250068187714,
0.23922869563102722,
0.2096288949251175,
0.05249375104904175,
-0.34090936183929443,
0.18008148670196533,
0.13494065403938293,
-0.04142218828201294,
-0.022229770198464394,
-0.43057647347450256,
0.254524827003479,
-0.006129680201411247,
0.061091646552085876,
0.0682206004858017,
-0.08656605333089828,
-0.23895901441574097,
0.16267579793930054,
0.041939787566661835,
0.3007405698299408,
0.33957865834236145,
-0.05173207074403763,
-0.08339039981365204,
0.03323422744870186,
-0.3909253478050232,
0.06085606664419174,
-0.16102991998195648,
0.22926868498325348,
-0.18987268209457397,
0.0489436499774456,
0.02560616284608841,
0.048238661140203476,
0.28355321288108826,
-0.005784297361969948,
-0.19418375194072723,
-0.08176340162754059,
0.11626793444156647,
-0.1925489753484726,
0.009913545101881027,
-0.5236008763313293,
-0.12504298985004425,
-0.12381087243556976,
-0.13713312149047852,
0.41185352206230164,
0.2634221911430359,
0.055448032915592194,
-0.16768808662891388,
0.1139131486415863,
0.1504208743572235,
-0.3045867383480072,
-0.39800533652305603,
-0.8720011711120605,
0.33179107308387756,
-0.14925089478492737,
-0.5336836576461792,
0.02799959108233452,
-0.0066597312688827515,
0.3115904629230499,
0.09103990346193314,
-0.4845391511917114,
-0.3018912971019745,
0.07886311411857605,
-0.009507328271865845,
0.4274982511997223,
0.19158990681171417,
0.1494913548231125,
-0.2446283996105194,
-0.16364265978336334,
-0.27119573950767517,
-0.07767972350120544,
0.25788289308547974,
0.3769553005695343,
0.45862671732902527,
-0.23412683606147766,
-0.26982924342155457,
-0.17815721035003662,
0.1424584686756134,
0.18214823305606842,
-0.04597046598792076,
0.15693366527557373,
0.0226605124771595,
-0.05745770409703255,
-0.0008393004536628723,
-0.10197588801383972,
0.6396290063858032,
-0.10039648413658142,
0.004112843424081802,
0.17439168691635132,
0.1856537163257599,
0.29196611046791077,
-0.015921734273433685,
-0.027874814346432686,
-0.20390841364860535,
-0.16632743179798126,
-0.18274448812007904,
-0.04678858071565628,
0.04161185771226883,
0.05924993380904198,
-0.0809401273727417,
-0.15938448905944824,
-0.12678426504135132,
0.02074839361011982,
-0.02550593763589859,
0.15405361354351044,
0.05807722732424736,
-0.9112799167633057,
0.3003271222114563,
0.08902285993099213,
0.507056713104248,
-0.332907110452652,
0.09544971585273743,
0.01046748086810112,
-0.032924946397542953,
0.13515740633010864,
0.12403805553913116,
0.1658027321100235,
-0.21338148415088654,
-0.19047807157039642,
0.35864195227622986,
-0.13118043541908264,
-0.21369245648384094,
-0.12866340577602386,
-0.14430508017539978,
-0.021864859387278557,
0.1743834763765335,
0.07591872662305832,
-0.3373076617717743,
-0.18214836716651917,
0.2263556271791458,
0.1824091076850891,
-0.33054935932159424,
-0.11666326224803925,
0.0041452012956142426,
-0.1211458072066307,
0.013783430680632591,
-0.14861184358596802,
-0.1618933081626892,
0.28236910700798035,
-0.18577627837657928,
-0.08462955057621002,
-0.17804382741451263,
-0.0911254808306694,
0.5624825954437256,
0.00799327902495861,
0.3686124086380005,
0.12402405589818954,
0.33759820461273193,
0.35083532333374023,
0.14890936017036438,
0.3623151481151581,
0.5414231419563293,
-0.11915932595729828,
0.26179027557373047,
0.17206186056137085,
-0.3114440441131592,
0.33621811866760254,
0.22805175185203552,
0.10457447171211243,
-0.4190904498100281,
-0.19232194125652313,
0.16107597947120667,
-0.21952584385871887,
0.2987402379512787,
0.0780675932765007,
0.13647674024105072,
-0.17354755103588104,
-0.22408631443977356,
0.5829627513885498,
0.11907978355884552,
0.0010875239968299866,
0.37265413999557495,
0.4998398423194885,
-0.09823338687419891,
-0.13066938519477844,
0.51103276014328,
0.8817676901817322,
0.061300452798604965,
-0.2270236313343048,
0.28809046745300293,
0.22395752370357513,
0.2927211821079254,
-0.6754900813102722,
0.021590065211057663,
-0.19951175153255463,
-0.30585458874702454,
-0.01506793312728405,
-0.035408999770879745,
0.21694177389144897,
0.2565378248691559,
0.26131123304367065,
0.16932149231433868,
-0.13739676773548126,
-0.2695968449115753,
-0.1536487340927124,
0.21813005208969116,
-0.3133375644683838,
-0.1865031123161316,
0.22525770962238312,
0.2843099534511566,
0.05920090153813362,
0.2716240882873535,
-0.0343548059463501,
0.0325583852827549,
-0.3010593354701996,
-0.03501434251666069,
-0.07575254887342453,
-0.04886864125728607,
-0.05451316013932228,
-0.039540279656648636,
0.053973179310560226,
-0.28198909759521484,
-0.0009390562772750854,
0.12338843941688538,
0.25575628876686096,
-0.055534083396196365,
-0.09326993674039841,
0.1879000961780548,
-0.3696552515029907,
0.040989842265844345,
0.291909396648407,
0.01053937990218401,
0.4175281226634979,
-0.2100783884525299,
-0.21938852965831757,
-0.019025206565856934,
0.057999387383461,
0.15306168794631958,
-0.39237409830093384,
-0.0931583046913147,
-0.037659645080566406,
-0.414498895406723,
0.008805768564343452,
0.1827116757631302,
-0.006809251382946968,
-0.11366909742355347,
0.17099103331565857,
0.1509605050086975,
-0.06112612411379814,
0.4131098985671997,
-0.061223361641168594,
0.03776456415653229,
-0.1916014403104782,
0.25047916173934937,
0.42905503511428833,
-0.15980082750320435,
0.3576132655143738,
0.08568134903907776,
-0.0061303433030843735,
-0.15096108615398407,
-0.04125227779150009,
0.5110539793968201,
-0.09783975780010223,
-0.11247654259204865,
-0.2973003387451172,
-0.21169781684875488,
-0.07855773717164993,
0.21771858632564545,
0.31565171480178833,
-0.10962673276662827,
0.12734657526016235,
-0.36497166752815247,
-0.4957457482814789,
0.32247722148895264,
0.03461259603500366,
0.33326655626296997,
-0.21354621648788452,
0.3155980408191681,
-0.08963694423437119,
0.09931613504886627,
-0.35040605068206787,
0.029943648725748062,
-0.05943966284394264,
0.04977943003177643,
-0.05196757614612579,
0.01211361214518547,
0.2587277293205261,
-0.3422491252422333,
0.15812928974628448,
-0.0003124736249446869,
-0.20067274570465088,
-0.20286816358566284,
-0.1906137466430664,
0.1195233166217804,
0.17378559708595276,
-0.047579988837242126,
0.24464009702205658,
-0.08499957621097565,
-0.07493655383586884,
-0.049530912190675735,
0.08957825601100922,
-0.09785870462656021,
0.0650576800107956,
0.3306815028190613,
0.13961921632289886,
0.05827297642827034,
-0.04911764711141586,
0.20191647112369537,
0.3131592869758606,
0.3580687642097473,
0.04821481928229332,
-0.24274888634681702,
-0.01680360548198223,
-0.22522808611392975,
-0.36818286776542664,
0.069731205701828,
-0.07078127562999725,
0.037890080362558365,
0.3394381105899811,
-0.08831706643104553,
0.20879647135734558,
0.1925112009048462,
0.3460712432861328,
0.42253798246383667,
-0.09295060485601425,
0.05929024517536163,
0.049213819205760956,
0.27056413888931274,
-0.3063863217830658,
0.009502636268734932,
0.038275301456451416,
0.3211841881275177,
-0.1325516253709793,
0.08307577669620514,
0.30045512318611145,
-0.023005638271570206,
-0.09217831492424011,
0.17484337091445923,
0.20360763370990753,
-0.0020416490733623505,
0.05136064440011978,
0.24359449744224548,
-0.17545831203460693,
0.05792885273694992,
0.15705500543117523,
-0.03794971480965614,
-0.08332674950361252,
0.22845782339572906,
0.03372054174542427,
0.43636006116867065,
0.2827654480934143,
0.16189034283161163,
-0.02152220904827118,
-0.1516970545053482,
-0.11291834712028503,
0.3693394362926483,
0.26418399810791016,
0.12510409951210022,
-0.05079124867916107,
0.569923996925354,
-0.12668442726135254,
-0.17552195489406586,
-0.28091028332710266,
0.08639924973249435,
0.10224000364542007,
0.16492775082588196,
-0.20201140642166138,
-0.11137060075998306,
-0.089265376329422,
-0.15408207476139069,
-0.14471210539340973,
-0.3010966181755066,
0.21570730209350586,
-0.02653689682483673,
-0.3665006160736084,
-0.9039993286132812,
-0.1263141632080078,
0.15124738216400146,
0.2594662606716156,
-0.08118878304958344,
0.21241798996925354,
0.5510982275009155,
-0.009202651679515839,
0.12704934179782867,
0.5412905812263489,
0.0754253938794136,
0.1766182780265808,
-0.022253770381212234,
-0.010716344229876995,
0.21737326681613922,
0.003979537636041641,
0.20701827108860016,
0.09698417037725449,
-0.04365983605384827,
-0.1632842868566513,
0.32864952087402344,
0.16830134391784668,
-0.08720836788415909,
-0.16006603837013245,
0.002759009599685669,
0.015884730964899063,
-0.08494298160076141,
0.1660187840461731,
0.06243586540222168,
-0.05480213835835457,
-0.06612652540206909,
-0.3546636998653412,
-0.30293044447898865,
-0.040993545204401016,
-0.05209716036915779,
0.1444081813097,
0.21465447545051575,
0.030700255185365677,
0.1190432608127594,
-0.40207651257514954,
0.2650512158870697,
0.11229665577411652,
-0.15879949927330017,
-0.31193533539772034,
-0.1485043615102768,
-0.6052777171134949,
-0.005609035491943359,
-0.15230296552181244,
-0.5811651349067688,
0.23100905120372772,
0.26478615403175354,
0.2139350175857544,
-0.029512956738471985,
0.1296827793121338,
-0.520601749420166,
-0.06893222033977509,
0.30806031823158264,
-0.6280505061149597,
0.12617672979831696,
-0.2924519181251526,
0.2437845915555954,
-0.02572258934378624,
0.2229907512664795,
0.30246543884277344,
0.36279043555259705,
-0.0518987812101841,
0.16642221808433533,
0.1808858960866928,
0.2209709882736206,
0.015756022185087204,
0.06659318506717682,
-0.04500780254602432,
0.4081067144870758,
0.18801060318946838,
0.2256181836128235,
-0.3655063807964325,
-0.22103749215602875,
-0.2046409547328949,
0.27020400762557983,
0.10401061177253723,
0.1994999200105667,
0.03194098174571991,
-0.035403307527303696,
0.07171832025051117,
0.33425915241241455,
-0.01940767467021942,
-0.39524513483047485,
-0.5124576091766357,
0.10008490085601807,
-0.026260875165462494,
0.06369775533676147,
0.359301894903183,
0.5226396322250366,
0.06571943312883377,
0.12330247461795807,
-0.3297065794467926,
-0.3902283012866974,
0.4470280706882477,
-0.099378801882267,
0.08898894488811493,
-0.011283336207270622,
0.2847456634044647,
0.49463745951652527,
-0.11688051372766495,
-0.376223623752594,
0.011624068021774292,
0.42440542578697205,
-0.2406957745552063,
-0.1203693300485611,
0.24979224801063538,
0.3464857339859009,
-0.16005513072013855,
-0.012824291363358498,
0.01516667753458023,
-0.012552846223115921,
-0.032625116407871246,
0.134940043091774,
0.02473042905330658
] |
https://github.com/huggingface/datasets/issues/672 | Questions about XSUM | Well I couldn't parse what I downloaded.
Unfortunately I think I won't be able to take a look at it this week.
I can try to send you what I got if you want to give it a shot @jbragg
Otherwise feel free to re-run the xsum download script, maybe you'll be luckier than me | Hi there ✋
I'm looking into your `xsum` dataset and I have several questions on that.
So here is how I loaded the data:
```
>>> data = datasets.load_dataset('xsum', version='1.0.1')
>>> data['train']
Dataset(features: {'document': Value(dtype='string', id=None), 'summary': Value(dtype='string', id=None)}, num_rows: 204017)
>>> data['test']
Dataset(features: {'document': Value(dtype='string', id=None), 'summary': Value(dtype='string', id=None)}, num_rows: 11333)
```
The first issue is, the instance counts don’t match what I see on [the dataset's website](https://github.com/EdinburghNLP/XSum/tree/master/XSum-Dataset#what-builds-the-xsum-dataset) (11,333 vs 11,334 for test set; 204,017 vs 204,045 for training set)
```
… training (90%, 204,045), validation (5%, 11,332), and test (5%, 11,334) set.
```
Any thoughts why? Perhaps @mariamabarham could help here, since she recently had a PR on this dataaset https://github.com/huggingface/datasets/pull/289 (reviewed by @patrickvonplaten)
Another issue is that the instances don't seem to have IDs. The original datasets provides IDs for the instances: https://github.com/EdinburghNLP/XSum/blob/master/XSum-Dataset/XSum-TRAINING-DEV-TEST-SPLIT-90-5-5.json but to be able to use them, the dataset sizes need to match.
CC @jbragg
| 55 | Questions about XSUM
Hi there ✋
I'm looking into your `xsum` dataset and I have several questions on that.
So here is how I loaded the data:
```
>>> data = datasets.load_dataset('xsum', version='1.0.1')
>>> data['train']
Dataset(features: {'document': Value(dtype='string', id=None), 'summary': Value(dtype='string', id=None)}, num_rows: 204017)
>>> data['test']
Dataset(features: {'document': Value(dtype='string', id=None), 'summary': Value(dtype='string', id=None)}, num_rows: 11333)
```
The first issue is, the instance counts don’t match what I see on [the dataset's website](https://github.com/EdinburghNLP/XSum/tree/master/XSum-Dataset#what-builds-the-xsum-dataset) (11,333 vs 11,334 for test set; 204,017 vs 204,045 for training set)
```
… training (90%, 204,045), validation (5%, 11,332), and test (5%, 11,334) set.
```
Any thoughts why? Perhaps @mariamabarham could help here, since she recently had a PR on this dataaset https://github.com/huggingface/datasets/pull/289 (reviewed by @patrickvonplaten)
Another issue is that the instances don't seem to have IDs. The original datasets provides IDs for the instances: https://github.com/EdinburghNLP/XSum/blob/master/XSum-Dataset/XSum-TRAINING-DEV-TEST-SPLIT-90-5-5.json but to be able to use them, the dataset sizes need to match.
CC @jbragg
Well I couldn't parse what I downloaded.
Unfortunately I think I won't be able to take a look at it this week.
I can try to send you what I got if you want to give it a shot @jbragg
Otherwise feel free to re-run the xsum download script, maybe you'll be luckier than me | [
-0.07263363152742386,
-0.40362071990966797,
-0.16236567497253418,
0.5180845856666565,
0.3325613737106323,
0.02856406569480896,
0.12278130650520325,
-0.03300492838025093,
0.2053791880607605,
0.26137182116508484,
-0.2468283474445343,
0.23382019996643066,
0.0877346321940422,
0.42637184262275696,
0.11076760292053223,
0.09420949220657349,
-0.01659466326236725,
-0.12130899727344513,
-0.3660368323326111,
-0.3092115521430969,
-0.007238812744617462,
0.09555801749229431,
-0.0635271817445755,
-0.10149680078029633,
-0.6309722661972046,
-0.010049393400549889,
-0.1623435914516449,
0.29033175110816956,
-0.12758368253707886,
-0.20895658433437347,
0.2380593866109848,
0.015602957457304,
0.04123756289482117,
0.5506972670555115,
-0.00010530019062571228,
-0.0060285404324531555,
0.12736833095550537,
-0.02368898317217827,
-0.08397693932056427,
0.2564915418624878,
-0.17924946546554565,
-0.024655096232891083,
0.008891724050045013,
-0.4071146547794342,
-0.048554737120866776,
0.027806401252746582,
-0.14766070246696472,
-0.3758968114852905,
0.224538192152977,
0.008196537382900715,
0.22185158729553223,
0.15839047729969025,
0.10222545266151428,
-0.036843862384557724,
-0.06390651315450668,
-0.12227611243724823,
0.11603369563817978,
0.22765204310417175,
0.4027494490146637,
0.3057995140552521,
0.07294555008411407,
0.13701216876506805,
0.06072361767292023,
-0.18351253867149353,
0.2962157428264618,
0.06476668268442154,
0.34815624356269836,
-0.2427537441253662,
-0.30500006675720215,
0.307309091091156,
0.8674849271774292,
-0.03441707044839859,
-0.25137588381767273,
-0.014435786753892899,
-0.01676836609840393,
-0.1252637803554535,
0.1652304232120514,
0.08433404564857483,
0.3414100110530853,
-0.03185967728495598,
-0.2515139877796173,
0.418639212846756,
-0.2792619466781616,
0.027759931981563568,
-0.18175983428955078,
-0.07143959403038025,
-0.09671942889690399,
0.006512444466352463,
-0.22853462398052216,
-0.050538644194602966,
0.06921213120222092,
-0.10191431641578674,
0.15596306324005127,
0.20807720720767975,
-0.2770184576511383,
-0.12859085202217102,
-0.016155637800693512,
0.002237379550933838,
0.2066086232662201,
0.14553478360176086,
0.26175495982170105,
0.06361012160778046,
-0.4012530744075775,
0.02813943475484848,
0.24505910277366638,
0.24343203008174896,
0.458598792552948,
-0.5399461984634399,
-0.021571747958660126,
-0.10498182475566864,
-0.06111615151166916,
0.09253759682178497,
-0.3793509900569916,
-0.010206913575530052,
-0.03998831287026405,
0.039361078292131424,
-0.16921696066856384,
-0.3824184834957123,
-0.22785624861717224,
0.25368165969848633,
0.04152868688106537,
-0.10913809388875961,
0.1842542141675949,
-0.11904094368219376,
0.03613997995853424,
0.3936980664730072,
0.01774762198328972,
0.028467021882534027,
-0.5414431691169739,
-0.3072092831134796,
-0.34718331694602966,
0.12224788963794708,
-0.059767406433820724,
-0.043829888105392456,
0.08972972631454468,
-0.09296530485153198,
0.36724698543548584,
-0.1047382578253746,
0.25947830080986023,
-0.015793804079294205,
0.049546584486961365,
0.09800779819488525,
-0.32262396812438965,
0.21496489644050598,
0.060188066214323044,
0.001447770744562149,
-0.0674225240945816,
0.0415629968047142,
-0.027715671807527542,
0.01689032092690468,
-0.19028371572494507,
-0.20409539341926575,
-0.004519233480095863,
0.3222167193889618,
-0.39591360092163086,
-0.2772587239742279,
-0.19005036354064941,
0.005474500358104706,
0.14483553171157837,
0.23037588596343994,
-0.19110506772994995,
-0.148358553647995,
0.0973164439201355,
-0.14088936150074005,
0.16885866224765778,
-0.0693914145231247,
-0.6325298547744751,
0.008455172181129456,
-0.013141117990016937,
-0.35197633504867554,
0.0666961744427681,
-0.0030396506190299988,
0.007368131540715694,
0.260804682970047,
0.12432372570037842,
0.2177848070859909,
-0.5206572413444519,
-0.48572275042533875,
-0.11479941010475159,
-0.3428824543952942,
-0.18113973736763,
-0.10953216999769211,
0.10120827704668045,
0.11723262071609497,
0.028732633218169212,
-0.1006724163889885,
0.1512284278869629,
0.03046366572380066,
0.13030506670475006,
-0.20504581928253174,
-0.4009779989719391,
-0.06544503569602966,
-0.039053961634635925,
0.18785211443901062,
-0.07558150589466095,
-0.3016085624694824,
-0.090667225420475,
0.3413063883781433,
0.20559126138687134,
0.01353590190410614,
-0.11344414949417114,
0.07609140872955322,
0.29561692476272583,
-0.13789662718772888,
0.07399775087833405,
-0.19057714939117432,
-0.005853429436683655,
0.30916956067085266,
0.1006016880273819,
0.21248379349708557,
0.726569652557373,
-0.03173278644680977,
-0.3925468623638153,
-0.2147994488477707,
0.004555627703666687,
-0.15606443583965302,
0.20153763890266418,
-0.20224761962890625,
-0.0298813097178936,
-0.20528970658779144,
-0.18521247804164886,
0.16759124398231506,
-0.5990704894065857,
0.03992040827870369,
-0.49667471647262573,
0.3045560121536255,
0.03300862014293671,
0.025852132588624954,
0.06673125177621841,
0.2611115574836731,
-0.027131885290145874,
-0.26168590784072876,
-0.026654694229364395,
0.5314075946807861,
0.16156139969825745,
0.025394506752490997,
0.20212587714195251,
0.178230419754982,
0.36476781964302063,
-0.17313000559806824,
0.17254112660884857,
-0.2544904351234436,
-0.03497510775923729,
-0.18627968430519104,
-0.4021553695201874,
0.2673921287059784,
-0.1242140531539917,
0.0038795918226242065,
-0.06706748157739639,
0.025266340002417564,
0.005054915323853493,
-0.1537596881389618,
0.006008651107549667,
0.030466631054878235,
0.2154407948255539,
0.17097659409046173,
-0.24401110410690308,
0.05061771720647812,
0.022739164531230927,
0.3933665156364441,
-0.34050050377845764,
-0.22697407007217407,
-0.2323797643184662,
-0.34999147057533264,
-0.23186787962913513,
0.19009804725646973,
0.11331331729888916,
0.008202571421861649,
0.46067219972610474,
0.2917124330997467,
0.09241587668657303,
-0.009625239297747612,
-0.05776643007993698,
-0.14426860213279724,
0.03755906969308853,
0.07572176307439804,
-0.08491214364767075,
-0.07522795349359512,
-0.07502284646034241,
0.025160083547234535,
-0.14502528309822083,
0.08728080987930298,
0.09134491533041,
0.15193025767803192,
-0.4459272623062134,
-0.3298218250274658,
-0.22452427446842194,
-0.1108563095331192,
0.2284858524799347,
0.17827150225639343,
0.13406960666179657,
-0.30901557207107544,
0.13912394642829895,
0.03578086569905281,
-0.028240317478775978,
-0.02943413145840168,
-0.3591504991054535,
0.3002127707004547,
0.05977383255958557,
0.12292353063821793,
0.10161834955215454,
-0.15884442627429962,
-0.16754889488220215,
0.2136397361755371,
0.053252048790454865,
0.3412391245365143,
0.3781738877296448,
-0.09438479691743851,
-0.05061398446559906,
0.13543787598609924,
-0.4069739282131195,
0.047347113490104675,
-0.21305276453495026,
0.27405408024787903,
-0.16058138012886047,
0.047089189291000366,
0.0490775927901268,
-0.0007049720734357834,
0.23826836049556732,
-0.004510870203375816,
-0.26500964164733887,
-0.0866270512342453,
0.20431052148342133,
-0.2747785151004791,
-0.07356154918670654,
-0.5671486258506775,
-0.14431537687778473,
-0.0556056946516037,
-0.025385364890098572,
0.48453089594841003,
0.21494780480861664,
0.0677580013871193,
-0.13271194696426392,
0.22864525020122528,
0.22702740132808685,
-0.19040921330451965,
-0.3695022463798523,
-0.8211236596107483,
0.3219831585884094,
-0.10932737588882446,
-0.5275318622589111,
0.044315043836832047,
0.00508144311606884,
0.32669177651405334,
0.09866245090961456,
-0.39843398332595825,
-0.31889379024505615,
0.021234147250652313,
-0.11780805885791779,
0.4910200238227844,
0.20240411162376404,
0.17421548068523407,
-0.16249361634254456,
-0.16928745806217194,
-0.24538147449493408,
-0.06433869153261185,
0.23300975561141968,
0.2933529019355774,
0.4438316226005554,
-0.31354981660842896,
-0.3200973868370056,
-0.2105184942483902,
0.06782113760709763,
0.19212718307971954,
-0.13367007672786713,
-0.04303175210952759,
-0.04068193584680557,
-0.11218087375164032,
0.10199420154094696,
-0.11898548901081085,
0.6109256148338318,
-0.11672177910804749,
-0.06997871398925781,
0.17420712113380432,
0.20605069398880005,
0.22478079795837402,
-0.054910242557525635,
0.07159121334552765,
-0.21517759561538696,
-0.10949510335922241,
-0.18891087174415588,
-0.03139915317296982,
-0.010947108268737793,
-0.06191972643136978,
-0.07246705144643784,
-0.10736064612865448,
-0.10652239620685577,
-0.10271118581295013,
-0.012942291796207428,
0.08829439431428909,
-0.03555894270539284,
-0.9891729950904846,
0.25647681951522827,
0.06388133019208908,
0.3727455735206604,
-0.3178670406341553,
-0.04099829122424126,
0.014817040413618088,
-0.11174111068248749,
0.13061246275901794,
0.19817352294921875,
0.14570319652557373,
-0.20579202473163605,
-0.20632599294185638,
0.33841654658317566,
-0.09435786306858063,
-0.29614123702049255,
-0.08033859729766846,
-0.21807409822940826,
0.08453027904033661,
0.2185196876525879,
0.014724098145961761,
-0.24384069442749023,
-0.04726877063512802,
0.18532875180244446,
0.23619717359542847,
-0.3090727627277374,
-0.16793861985206604,
-0.05849895998835564,
-0.041337840259075165,
0.06092873960733414,
-0.12479326874017715,
-0.11121752858161926,
0.26618245244026184,
-0.2729487419128418,
-0.1262558102607727,
-0.16690577566623688,
-0.09674309939146042,
0.5697980523109436,
0.05015932396054268,
0.411044716835022,
0.006646090652793646,
0.30366092920303345,
0.36488279700279236,
0.08134584873914719,
0.21459300816059113,
0.49376600980758667,
-0.12078168988227844,
0.2570342421531677,
0.16276895999908447,
-0.409026563167572,
0.3568692207336426,
0.18179573118686676,
0.06877738237380981,
-0.5050529837608337,
-0.242340087890625,
0.08171621710062027,
-0.1969738006591797,
0.2669082283973694,
0.10650903731584549,
0.17642030119895935,
-0.07451991736888885,
-0.26773467659950256,
0.5765457153320312,
0.15304312109947205,
-0.02169325202703476,
0.3967195749282837,
0.389215886592865,
-0.11537191271781921,
-0.22523261606693268,
0.5142550468444824,
0.9024683833122253,
0.07556387782096863,
-0.2098795473575592,
0.29158636927604675,
0.3819604516029358,
0.33666902780532837,
-0.5109512805938721,
0.03880895674228668,
-0.14838655292987823,
-0.3224581480026245,
0.018117612227797508,
-0.09315396845340729,
0.14438092708587646,
0.2909356355667114,
0.14418423175811768,
0.05484791472554207,
-0.18829289078712463,
-0.292011559009552,
-0.15596650540828705,
0.17590036988258362,
-0.25230836868286133,
-0.12528455257415771,
0.28003570437431335,
0.2756406366825104,
0.09391455352306366,
0.15857788920402527,
-0.022112932056188583,
0.024255191907286644,
-0.34503448009490967,
0.013795781880617142,
-0.0757807120680809,
-0.03141356632113457,
-0.06591251492500305,
0.036640264093875885,
0.007507992908358574,
-0.3132867217063904,
-0.02573634870350361,
0.33284565806388855,
0.20723457634449005,
-0.06852556765079498,
-0.10720397531986237,
0.15508568286895752,
-0.3515685796737671,
0.05110820382833481,
0.3374180495738983,
-0.011840030550956726,
0.404989629983902,
-0.20826059579849243,
-0.1850055456161499,
-0.03167020529508591,
0.09455538541078568,
0.22420932352542877,
-0.35915547609329224,
-0.003996558487415314,
0.0034985020756721497,
-0.45609068870544434,
-0.06797638535499573,
0.1836203634738922,
-0.06900466978549957,
-0.05920077860355377,
0.19600684940814972,
0.24529370665550232,
-0.08930432796478271,
0.4629479646682739,
-0.09401494264602661,
0.03611726313829422,
-0.09331168234348297,
0.19150546193122864,
0.44768381118774414,
-0.22302041947841644,
0.2656007707118988,
0.04108612611889839,
-0.003544967621564865,
-0.16956418752670288,
0.031057193875312805,
0.4695283770561218,
-0.0643552839756012,
-0.09313946962356567,
-0.26824355125427246,
-0.19006963074207306,
-0.02518479712307453,
0.23088490962982178,
0.2963246703147888,
-0.006597340106964111,
0.08696350455284119,
-0.35715606808662415,
-0.4566163122653961,
0.2972085475921631,
0.10312904417514801,
0.4142376482486725,
-0.25922927260398865,
0.23551911115646362,
-0.021956410259008408,
0.04838954657316208,
-0.375313937664032,
0.03277163207530975,
-0.11712026596069336,
0.04542463645339012,
0.1052997037768364,
-0.03503403067588806,
0.23217925429344177,
-0.3884831368923187,
0.18453823029994965,
-0.005595244467258453,
-0.17301009595394135,
-0.23420321941375732,
-0.10400612652301788,
0.09758692234754562,
0.16085100173950195,
-0.09497971832752228,
0.2690058648586273,
-0.039555829018354416,
-0.035568416118621826,
-0.02809979021549225,
0.05439825728535652,
-0.105826735496521,
0.09687546640634537,
0.3189457058906555,
0.07066653668880463,
0.1440327763557434,
-0.09525172412395477,
0.14148971438407898,
0.1393975466489792,
0.28107529878616333,
0.15530934929847717,
-0.24448233842849731,
0.02877655252814293,
-0.22006674110889435,
-0.29276517033576965,
0.028316680341959,
-0.0672239363193512,
0.13891729712486267,
0.28251880407333374,
-0.05177822709083557,
0.1805143505334854,
0.15999265015125275,
0.3281482458114624,
0.403758704662323,
-0.18209104239940643,
0.10955299437046051,
-0.02282664179801941,
0.3217219412326813,
-0.2869966924190521,
-0.010161961428821087,
0.05458971485495567,
0.35866063833236694,
-0.13195830583572388,
0.07486815750598907,
0.14587697386741638,
-0.03033009171485901,
-0.12695463001728058,
0.15840521454811096,
0.2493472695350647,
-0.06573721766471863,
0.14713826775550842,
0.2147451937198639,
-0.2435142546892166,
-0.007211614400148392,
0.13755196332931519,
-0.02837304398417473,
-0.07482457906007767,
0.2515571117401123,
0.010417252779006958,
0.46895959973335266,
0.174360990524292,
0.16661003232002258,
0.017371617257595062,
0.0009580440819263458,
-0.07493086159229279,
0.36950087547302246,
0.16391082108020782,
0.14880263805389404,
0.025485649704933167,
0.5885555148124695,
-0.18434013426303864,
-0.03804442659020424,
-0.3076460361480713,
0.01722736656665802,
0.11174556612968445,
0.17338846623897552,
-0.2574014663696289,
-0.1250399649143219,
0.025565356016159058,
-0.17969131469726562,
-0.11973704397678375,
-0.2582988142967224,
0.1674254983663559,
-0.020445063710212708,
-0.36026477813720703,
-0.781126081943512,
-0.12468437105417252,
0.16953039169311523,
0.2597127854824066,
-0.10416710376739502,
0.12748071551322937,
0.5653452277183533,
-0.0026230141520500183,
0.07571521401405334,
0.5093677043914795,
0.11790826916694641,
0.17179608345031738,
-0.009100684896111488,
0.05232379958033562,
0.21572838723659515,
-0.04045754671096802,
0.13997218012809753,
0.12001632153987885,
-0.017358288168907166,
-0.1546124517917633,
0.29045623540878296,
0.21038787066936493,
-0.10078442096710205,
-0.11953487992286682,
0.05778251588344574,
0.01605580560863018,
-0.08585333824157715,
0.08486247062683105,
0.05657590180635452,
-0.1321597397327423,
-0.09876485168933868,
-0.24147632718086243,
-0.3680669665336609,
-0.020138181746006012,
-0.12222550809383392,
0.19729827344417572,
0.18066048622131348,
0.05015901103615761,
0.1360907256603241,
-0.34736916422843933,
0.2889631986618042,
0.07064763456583023,
-0.10281439870595932,
-0.2903153896331787,
-0.12197212874889374,
-0.6011987328529358,
0.008670799434185028,
-0.05459755286574364,
-0.5773777365684509,
0.16650046408176422,
0.30220720171928406,
0.1711476743221283,
0.05959530919790268,
0.04518137872219086,
-0.4302569031715393,
-0.1458767205476761,
0.23190456628799438,
-0.6059360504150391,
0.07839497923851013,
-0.1940297931432724,
0.1729171872138977,
-0.010304126888513565,
0.3178611695766449,
0.22317436337471008,
0.23177814483642578,
0.0007140971720218658,
0.15335001051425934,
0.15204651653766632,
0.15641239285469055,
0.22935564815998077,
-0.007034659385681152,
-0.04317566007375717,
0.4805378317832947,
0.1899571716785431,
0.2845979630947113,
-0.29294100403785706,
-0.16842098534107208,
-0.176291361451149,
0.3193453550338745,
0.20297189056873322,
0.08509016782045364,
-0.03205480799078941,
0.03696655109524727,
0.08617153018712997,
0.30200743675231934,
0.0019282512366771698,
-0.43831995129585266,
-0.5029206275939941,
-0.00462300144135952,
0.027686476707458496,
0.06204640865325928,
0.26417410373687744,
0.48260363936424255,
-0.020442180335521698,
0.08568075299263,
-0.23522138595581055,
-0.3571695387363434,
0.42725372314453125,
-0.1245935708284378,
0.1778802126646042,
-0.009172429330646992,
0.2533385753631592,
0.45579272508621216,
-0.0013347528874874115,
-0.3526025712490082,
-0.008694089949131012,
0.41748031973838806,
-0.28178709745407104,
-0.15168464183807373,
0.26180708408355713,
0.3729294240474701,
-0.17100852727890015,
-0.033348966389894485,
-0.04744607210159302,
-0.007762756198644638,
0.026433588936924934,
0.15449972450733185,
-0.05897621810436249
] |
https://github.com/huggingface/datasets/issues/669 | How to skip a example when running dataset.map | Hi @xixiaoyao,
Depending on what you want to do you can:
- use a first step of `filter` to filter out the invalid examples: https://huggingface.co/docs/datasets/processing.html#filtering-rows-select-and-filter
- or directly detect the invalid examples inside the callable used with `map` and return them unchanged or even remove them at the same time if you are using `map` in batched mode. Here is an example where we use `map` in batched mode to add new rows on the fly but you can also use it to remove examples on the fly (that's what `filter` actually do under-the-hood): https://huggingface.co/docs/datasets/processing.html#augmenting-the-dataset | in processing func, I process examples and detect some invalid examples, which I did not want it to be added into train dataset. However I did not find how to skip this recognized invalid example when doing dataset.map. | 95 | How to skip a example when running dataset.map
in processing func, I process examples and detect some invalid examples, which I did not want it to be added into train dataset. However I did not find how to skip this recognized invalid example when doing dataset.map.
Hi @xixiaoyao,
Depending on what you want to do you can:
- use a first step of `filter` to filter out the invalid examples: https://huggingface.co/docs/datasets/processing.html#filtering-rows-select-and-filter
- or directly detect the invalid examples inside the callable used with `map` and return them unchanged or even remove them at the same time if you are using `map` in batched mode. Here is an example where we use `map` in batched mode to add new rows on the fly but you can also use it to remove examples on the fly (that's what `filter` actually do under-the-hood): https://huggingface.co/docs/datasets/processing.html#augmenting-the-dataset | [
-0.3242635130882263,
-0.22462068498134613,
0.03135393187403679,
0.00025773048400878906,
0.08961531519889832,
0.33322224020957947,
0.03006943129003048,
0.1055707186460495,
0.14229761064052582,
0.25204235315322876,
0.6323104500770569,
0.4480099081993103,
-0.260084867477417,
0.4908134937286377,
0.08287231624126434,
-0.08566878736019135,
-0.05048557370901108,
0.07248175144195557,
0.19849634170532227,
0.17793892323970795,
-0.3641428053379059,
-0.09617255628108978,
-0.49770253896713257,
0.049641769379377365,
-0.3158499002456665,
-0.2935384511947632,
-0.07697682082653046,
0.1408015489578247,
-0.026565739884972572,
-0.2878864109516144,
0.09602110087871552,
-0.04661332443356514,
0.09826675802469254,
0.504730224609375,
-0.0001258958800463006,
0.11965525150299072,
0.3082428574562073,
-0.09453584998846054,
0.18549208343029022,
-0.3107357621192932,
-0.3292458951473236,
0.16702301800251007,
-0.1726570874452591,
-0.23984333872795105,
-0.07625140249729156,
-0.06129759922623634,
0.08401971310377121,
-0.09973043203353882,
0.46585285663604736,
0.054093245416879654,
0.05297144874930382,
0.2320321798324585,
-0.3186952769756317,
0.04868422821164131,
-0.11169109493494034,
0.40921658277511597,
0.08989707380533218,
0.2354433536529541,
0.11437217891216278,
-0.05321332812309265,
0.06750404834747314,
0.23117920756340027,
-0.17615070939064026,
-0.009762026369571686,
0.18500065803527832,
-0.12284096330404282,
0.16210860013961792,
-0.37648478150367737,
0.09620393812656403,
0.4493288993835449,
0.2245716154575348,
-0.1264568567276001,
-0.23658232390880585,
-0.36588412523269653,
-0.046360358595848083,
-0.275453120470047,
-0.016118884086608887,
-0.1472749412059784,
-0.015308073721826077,
0.41708722710609436,
-0.66742342710495,
-0.19116072356700897,
-0.10372702777385712,
0.06120247021317482,
0.2733074724674225,
-0.17959648370742798,
-0.08181330561637878,
0.2964394688606262,
0.32972073554992676,
0.13351590931415558,
-0.2808515429496765,
-0.07479900866746902,
0.317930668592453,
0.3472795784473419,
0.00034151971340179443,
-0.3308745324611664,
0.0062256306409835815,
0.19762596487998962,
0.024932004511356354,
-0.3257891535758972,
0.05558009445667267,
0.1102718859910965,
0.13631793856620789,
0.5397351980209351,
0.01910368539392948,
-0.28230899572372437,
0.02339933067560196,
0.30643486976623535,
0.2565125823020935,
0.12184606492519379,
-0.013324841856956482,
0.11668889224529266,
-0.21195271611213684,
-0.12569452822208405,
-0.22690215706825256,
0.2246919870376587,
0.08213717490434647,
-0.1516430675983429,
-0.18341565132141113,
-0.0026408256962895393,
-0.4451541602611542,
-0.09777135401964188,
0.17428411543369293,
0.4919384717941284,
0.061802756041288376,
-0.24135079979896545,
-0.3540639281272888,
0.19222702085971832,
-0.09492728114128113,
-0.15130190551280975,
-0.09672483801841736,
0.049800850450992584,
-0.11443150043487549,
0.17908968031406403,
0.15969011187553406,
-0.07926075160503387,
0.42329609394073486,
0.06801535934209824,
-0.2709648013114929,
0.16033144295215607,
0.689712643623352,
-0.16993658244609833,
0.1788068413734436,
0.34120574593544006,
-0.06053301692008972,
-0.057755060493946075,
0.22953592240810394,
0.36708903312683105,
-0.004791192710399628,
0.3568362891674042,
-0.3024686574935913,
-0.4309859871864319,
0.31802964210510254,
-0.014208163134753704,
-0.06733308732509613,
0.20392483472824097,
-0.538290798664093,
0.34647488594055176,
0.21903806924819946,
-0.40698546171188354,
-0.003290414810180664,
0.13022099435329437,
-0.5322644114494324,
-0.19845116138458252,
0.11766939610242844,
0.1650930792093277,
-0.31122785806655884,
-0.29149869084358215,
-0.2650074064731598,
0.03594716638326645,
0.10335765779018402,
-0.0010719560086727142,
-0.338007390499115,
0.4800398647785187,
-0.3783353269100189,
0.1835426539182663,
0.249792218208313,
-0.21216732263565063,
0.05643060803413391,
0.056887269020080566,
-0.17633295059204102,
0.0893617495894432,
-0.3198418915271759,
-0.13345949351787567,
0.3183121383190155,
-0.14144153892993927,
-0.045973777770996094,
0.10657308995723724,
-0.39018315076828003,
-0.0897284597158432,
0.01817498728632927,
-0.016886277124285698,
0.5136345028877258,
-0.2013855129480362,
-0.21836413443088531,
0.13873180747032166,
-0.2506179213523865,
-0.3810960650444031,
0.2124195694923401,
-0.13814401626586914,
-0.10399691015481949,
0.18107111752033234,
0.3804057836532593,
-0.3077709674835205,
0.1553097814321518,
-0.3345041871070862,
-0.010251007974147797,
0.1763612926006317,
0.04012312740087509,
-0.3803941309452057,
0.25751793384552,
-0.5252301096916199,
-0.1266002506017685,
-0.18734923005104065,
-0.01431463286280632,
-0.02886805310845375,
-0.056155964732170105,
-0.3807052969932556,
0.09737107157707214,
-0.17829439043998718,
-0.3164161443710327,
0.04325104504823685,
-0.29252880811691284,
0.31058382987976074,
-0.18606390058994293,
-0.025866147130727768,
0.2752486765384674,
-0.06492678076028824,
0.007534503936767578,
-0.0372888445854187,
0.25939318537712097,
-0.40814223885536194,
0.04436872527003288,
0.3251229226589203,
0.48126909136772156,
0.17755591869354248,
-0.07901699095964432,
0.09323684126138687,
0.19376201927661896,
-0.3268747925758362,
-0.20909851789474487,
0.028235699981451035,
-0.02458176389336586,
0.028055578470230103,
-0.24077662825584412,
0.3548715114593506,
0.12048028409481049,
0.12512287497520447,
0.10261599719524384,
0.15300561487674713,
0.035743020474910736,
-0.15113267302513123,
0.091380774974823,
-0.19117800891399384,
0.02562781609594822,
0.05881943926215172,
0.19741249084472656,
0.15618057548999786,
-0.19578319787979126,
-0.14753112196922302,
0.4238242208957672,
0.004020851105451584,
-0.1040826067328453,
0.22108393907546997,
0.0002525150775909424,
-0.052012234926223755,
0.5704848766326904,
0.0326656736433506,
0.061872489750385284,
0.14999213814735413,
0.029091056436300278,
0.02200482226908207,
-0.3287631869316101,
0.2473175823688507,
0.06750820577144623,
0.1988275945186615,
0.4481799006462097,
-0.33529502153396606,
0.009595055133104324,
0.18307465314865112,
-0.145172119140625,
-0.057996965944767,
0.3105284571647644,
0.023924507200717926,
-0.3376733362674713,
0.19576607644557953,
-0.2525343596935272,
-0.1397380828857422,
0.11950699239969254,
0.08036624640226364,
-0.17877252399921417,
-0.11347189545631409,
0.061953723430633545,
0.48383140563964844,
-0.2872806191444397,
0.2964298129081726,
0.011821307241916656,
0.12412963807582855,
-0.1833326816558838,
-0.26329436898231506,
-0.0218227356672287,
0.11227811872959137,
-0.23223191499710083,
0.06106718257069588,
0.18458576500415802,
0.462058424949646,
0.5137456059455872,
-0.0903165340423584,
-0.19224965572357178,
0.04711185023188591,
-0.5107019543647766,
0.179877370595932,
-0.06471829116344452,
0.22612349689006805,
0.2627542018890381,
0.23966805636882782,
-0.5291047096252441,
0.025642547756433487,
-0.10058032721281052,
-0.2393878996372223,
-0.17651715874671936,
-0.11981508135795593,
0.025913892313838005,
0.34499046206474304,
-0.22986112534999847,
-0.200042724609375,
-0.09952390938997269,
-0.0450545996427536,
0.10516825318336487,
-0.22087536752223969,
0.11665263026952744,
-0.10094314813613892,
0.03376541659235954,
0.21921613812446594,
-0.025263985618948936,
-0.3246285617351532,
-0.013073807582259178,
-0.3057718873023987,
-0.02060563489794731,
-0.294710248708725,
0.04856548830866814,
0.20489132404327393,
-0.30359309911727905,
0.06952369213104248,
0.3210885524749756,
-0.1748848408460617,
-0.41219091415405273,
-0.17302440106868744,
0.0444512702524662,
-0.18050351738929749,
-0.3683570921421051,
0.542281448841095,
0.025718480348587036,
0.07328654825687408,
-0.31015968322753906,
-0.30470144748687744,
0.28723883628845215,
0.23024669289588928,
0.07909024506807327,
0.4050254225730896,
0.5862455368041992,
0.155997633934021,
0.6632354855537415,
0.35877227783203125,
-0.0044964030385017395,
0.2946738004684448,
-0.017391985282301903,
0.11081205308437347,
0.08679993450641632,
0.23579362034797668,
0.006035183556377888,
0.03312179446220398,
-0.366923451423645,
-0.059314846992492676,
0.017405781894922256,
-0.05605441331863403,
0.17785146832466125,
-0.13338807225227356,
-0.30157530307769775,
-0.2497921735048294,
-0.02370915375649929,
-0.1485794484615326,
0.4746420979499817,
0.15007035434246063,
0.034552231431007385,
-0.2720659077167511,
0.04990456625819206,
0.18255724012851715,
0.1444782018661499,
0.8970302939414978,
0.1220846027135849,
-0.3651365041732788,
-0.20026172697544098,
-0.3813799023628235,
0.21610060334205627,
0.2633257806301117,
0.030687272548675537,
-0.18294544517993927,
0.1107097640633583,
-0.13260424137115479,
0.07199263572692871,
0.8909837007522583,
-0.4783502221107483,
0.06790567189455032,
-0.079398013651371,
-0.042556282132864,
-0.2251230627298355,
0.18746542930603027,
-0.0673200786113739,
0.6205631494522095,
0.38685283064842224,
0.4097594916820526,
-0.03323971480131149,
-0.16845320165157318,
0.22442185878753662,
0.4525848925113678,
0.00393405556678772,
-0.16906508803367615,
-0.10965321958065033,
-0.05866973102092743,
-0.6159629821777344,
0.20320641994476318,
0.6330300569534302,
-0.22092096507549286,
-0.2785762846469879,
-0.3541159927845001,
0.07997600734233856,
0.0908181220293045,
0.23937572538852692,
0.3062518537044525,
0.21246308088302612,
-0.14522972702980042,
0.10647115111351013,
0.4780969023704529,
0.025185972452163696,
0.24628664553165436,
0.5393102169036865,
-0.004154708236455917,
-0.6362019181251526,
-0.15521982312202454,
-0.06064539775252342,
0.47692981362342834,
-0.061745837330818176,
0.017622224986553192,
0.14341413974761963,
0.23486101627349854,
0.023042868822813034,
-0.05823482945561409,
0.3424857258796692,
0.17581835389137268,
0.045240048319101334,
-0.4140236973762512,
-0.05008977651596069,
0.07909256219863892,
0.24932576715946198,
-0.18512743711471558,
0.6250055432319641,
-0.16393212974071503,
-0.14716078341007233,
0.30895352363586426,
-0.011228889226913452,
0.6379774212837219,
0.07495565712451935,
-0.2474687397480011,
0.07893116772174835,
0.03720700740814209,
0.193800687789917,
0.09152631461620331,
-0.02088119089603424,
-0.02040397748351097,
-0.3294070065021515,
-0.11442980170249939,
-0.15859203040599823,
0.3285665214061737,
0.5887829661369324,
-0.29459524154663086,
0.274773508310318,
-0.10220608115196228,
0.23153634369373322,
-0.007836626842617989,
-0.09487313032150269,
0.31488439440727234,
-0.11447753012180328,
-0.2315274477005005,
-0.020195208489894867,
0.30148959159851074,
-0.08725908398628235,
0.03579239919781685,
-0.15601013600826263,
0.27890825271606445,
-0.463337242603302,
-0.1052747517824173,
-0.28058919310569763,
-0.689577579498291,
-0.17919044196605682,
0.1165178120136261,
0.2751365900039673,
0.28309378027915955,
0.31880858540534973,
0.17789071798324585,
0.050636474043130875,
-0.23026469349861145,
0.06313151866197586,
0.04298076406121254,
0.20777155458927155,
-0.3268725275993347,
-0.16615375876426697,
0.2756367325782776,
0.037521667778491974,
-0.16494640707969666,
0.37643110752105713,
-0.2958545386791229,
-0.1479962170124054,
0.27567368745803833,
-0.22412864863872528,
0.048444200307130814,
0.022573012858629227,
-0.15495368838310242,
-0.1398323029279709,
0.006810661405324936,
-0.20991088449954987,
-0.03164408728480339,
-0.02452027052640915,
-0.03334294259548187,
0.09261857718229294,
-0.1169908344745636,
-0.1770901083946228,
-0.07023246586322784,
0.08407608419656754,
-0.2639923691749573,
-0.16259415447711945,
0.1618478000164032,
-0.09304754436016083,
-0.0219864659011364,
-0.1291128695011139,
-0.011319980025291443,
0.26236289739608765,
-0.13256129622459412,
0.0652213990688324,
0.34827080368995667,
0.05194397270679474,
0.17097747325897217,
-0.05434985086321831,
-0.032938987016677856,
-0.07352224737405777,
-0.2989517152309418,
-0.20660537481307983,
-0.5582760572433472,
0.1039377748966217,
0.048096999526023865,
0.16273856163024902,
-0.009717518463730812,
0.4578389525413513,
-0.03207452595233917,
-0.03372356295585632,
-0.14931365847587585,
0.18166127800941467,
-0.14035601913928986,
0.18748623132705688,
0.14282068610191345,
0.5469576120376587,
-0.02356027066707611,
-0.16700170934200287,
-0.16795238852500916,
0.36573028564453125,
-0.03393850848078728,
-0.05193287879228592,
-0.10608692467212677,
0.1871073991060257,
-0.014871012419462204,
-0.18258939683437347,
0.2769850790500641,
0.10125558078289032,
-0.009693078696727753,
-0.10230512171983719,
0.2399613857269287,
-0.09568421542644501,
0.06135233864188194,
0.12684790790081024,
0.0009975917637348175,
0.08231218159198761,
-0.1285838484764099,
-0.17991262674331665,
-0.19660520553588867,
0.037827279418706894,
-0.15780338644981384,
0.06387175619602203,
0.10903716832399368,
-0.024334020912647247,
0.2529953718185425,
-0.41944950819015503,
0.1464189887046814,
-0.20202329754829407,
-0.18317818641662598,
0.029582612216472626,
0.07170127332210541,
0.12500903010368347,
0.003441203385591507,
-0.036872245371341705,
-0.199292853474617,
0.14701387286186218,
0.4785042107105255,
0.11930734664201736,
-0.33711931109428406,
0.08305814862251282,
0.6689926981925964,
-0.07086401432752609,
-0.018205542117357254,
0.1826016753911972,
0.07994785904884338,
0.2994878888130188,
-0.044331714510917664,
0.15718141198158264,
0.01314487960189581,
-0.2660852074623108,
0.4661112427711487,
0.28993239998817444,
-0.45451128482818604,
0.12295660376548767,
-0.01416168175637722,
0.1543000042438507,
0.38565826416015625,
0.10163386166095734,
0.12844258546829224,
0.4472120404243469,
-0.0749507024884224,
0.13448399305343628,
0.2135426104068756,
-0.7258263230323792,
-0.006306912750005722,
0.4943147897720337,
-0.059666216373443604,
0.17200031876564026,
0.24859178066253662,
0.06851091980934143,
-0.09979061782360077,
-0.47812986373901367,
-0.2441488653421402,
0.02322562225162983,
-0.06913791596889496,
0.08463196456432343,
-0.0030516311526298523,
0.1252712905406952,
-0.003125585615634918,
-0.09981267154216766,
0.20856162905693054,
0.03700786083936691,
0.5780153870582581,
-0.17653582990169525,
-0.16051901876926422,
-0.27856743335723877,
-0.29883453249931335,
-0.04859983175992966,
0.1928245723247528,
0.14506639540195465,
-0.07411746680736542,
-0.062071144580841064,
-0.1806132197380066,
0.007646284997463226,
0.10892146080732346,
0.018416184931993484,
-0.12736335396766663,
-0.14692799746990204,
0.12654650211334229,
-0.23748095333576202,
0.125973641872406,
-0.035482630133628845,
0.3049454987049103,
-0.22802913188934326,
-0.11899067461490631,
0.21851488947868347,
-0.0575864315032959,
0.015819184482097626,
-0.013955395668745041,
-0.011721599847078323,
0.38113462924957275,
-0.3684956729412079,
0.22880694270133972,
-0.11117148399353027,
0.09092708677053452,
0.06031905114650726,
0.01109054684638977,
0.03469609469175339,
0.03868947550654411,
0.48176097869873047,
-0.4550875723361969,
0.0002895314246416092,
0.06879007816314697,
0.0042934417724609375,
-0.3503245413303375,
0.015115808695554733,
0.3317016661167145,
0.1513875126838684,
-0.32045963406562805,
-0.13019131124019623,
-0.49436426162719727,
-0.0342450812458992,
-0.3479119837284088,
0.19005537033081055,
0.33878451585769653,
-0.31171005964279175,
-0.12355726212263107,
0.17254546284675598,
0.1584007292985916,
-0.16148428618907928,
-0.03669329360127449,
0.2663261294364929,
-0.13989919424057007,
-0.24978481233119965,
-0.3644636869430542,
0.14901651442050934,
0.17263129353523254,
-0.4584941267967224,
0.23560787737369537,
-0.15201590955257416,
-0.15314170718193054,
-0.2025347203016281,
0.059068404138088226,
0.10581360757350922,
-0.021464504301548004,
0.31001102924346924,
0.3010408878326416,
0.24203993380069733,
-0.24077340960502625,
0.24330157041549683,
0.3386470377445221,
0.22366897761821747,
-0.22364212572574615,
0.13512539863586426,
-0.14828281104564667,
0.367567777633667,
-0.2840281128883362,
0.06361480057239532,
-0.04275013878941536,
-0.17962105572223663,
0.3713650703430176,
0.09704960882663727,
-0.3833548128604889,
0.2957873046398163,
-0.27968594431877136,
0.19754861295223236,
0.11384889483451843,
0.0459219329059124,
-0.0012814253568649292,
0.03441222012042999,
-0.016413956880569458,
-0.01051888708025217,
0.5836536884307861,
-0.6836980581283569,
-0.048350341618061066,
-0.35338225960731506,
0.18263129889965057,
0.12674970924854279,
-0.42623934149742126,
-0.65770423412323,
-0.3809610903263092,
0.3768141269683838,
0.005221668630838394,
0.10062943398952484,
0.3586827218532562,
-0.03890414535999298,
-0.10485348850488663,
0.05797738954424858,
0.39942166209220886,
-0.07995614409446716,
-0.09257703274488449,
0.34597617387771606,
-0.15577806532382965
] |
https://github.com/huggingface/datasets/issues/667 | Loss not decrease with Datasets and Transformers | Hi did you manage to fix your issue ?
If so feel free to share your fix and close this thread | HI,
The following script is used to fine-tune a BertForSequenceClassification model on SST2.
The script is adapted from [this colab](https://colab.research.google.com/github/huggingface/datasets/blob/master/notebooks/Overview.ipynb) that presents an example of fine-tuning BertForQuestionAnswering using squad dataset. In that colab, loss works fine. When I adapt it to SST2, the loss fails to decrease as it should. I attach the adapted script below and appreciate anyone pointing out what I miss?
```python
import torch
from datasets import load_dataset
from transformers import BertForSequenceClassification
from transformers import BertTokenizerFast
# Load our training dataset and tokenizer
dataset = load_dataset("glue", 'sst2')
tokenizer = BertTokenizerFast.from_pretrained('bert-base-cased')
del dataset["test"] # let's remove it in this demo
# Tokenize our training dataset
def convert_to_features(example_batch):
encodings = tokenizer(example_batch["sentence"])
encodings.update({"labels": example_batch["label"]})
return encodings
encoded_dataset = dataset.map(convert_to_features, batched=True)
# Format our dataset to outputs torch.Tensor to train a pytorch model
columns = ['input_ids', 'token_type_ids', 'attention_mask', 'labels']
encoded_dataset.set_format(type='torch', columns=columns)
# Instantiate a PyTorch Dataloader around our dataset
# Let's do dynamic batching (pad on the fly with our own collate_fn)
def collate_fn(examples):
return tokenizer.pad(examples, return_tensors='pt')
dataloader = torch.utils.data.DataLoader(encoded_dataset['train'], collate_fn=collate_fn, batch_size=8)
# Now let's train our model
device = 'cuda' if torch.cuda.is_available() else 'cpu'
# Let's load a pretrained Bert model and a simple optimizer
model = BertForSequenceClassification.from_pretrained('bert-base-cased', return_dict=True)
optimizer = torch.optim.Adam(model.parameters(), lr=1e-5)
model.train().to(device)
for i, batch in enumerate(dataloader):
batch.to(device)
outputs = model(**batch)
loss = outputs.loss
loss.backward()
optimizer.step()
model.zero_grad()
print(f'Step {i} - loss: {loss:.3}')
```
In case needed.
- datasets == 1.0.2
- transformers == 3.2.0 | 21 | Loss not decrease with Datasets and Transformers
HI,
The following script is used to fine-tune a BertForSequenceClassification model on SST2.
The script is adapted from [this colab](https://colab.research.google.com/github/huggingface/datasets/blob/master/notebooks/Overview.ipynb) that presents an example of fine-tuning BertForQuestionAnswering using squad dataset. In that colab, loss works fine. When I adapt it to SST2, the loss fails to decrease as it should. I attach the adapted script below and appreciate anyone pointing out what I miss?
```python
import torch
from datasets import load_dataset
from transformers import BertForSequenceClassification
from transformers import BertTokenizerFast
# Load our training dataset and tokenizer
dataset = load_dataset("glue", 'sst2')
tokenizer = BertTokenizerFast.from_pretrained('bert-base-cased')
del dataset["test"] # let's remove it in this demo
# Tokenize our training dataset
def convert_to_features(example_batch):
encodings = tokenizer(example_batch["sentence"])
encodings.update({"labels": example_batch["label"]})
return encodings
encoded_dataset = dataset.map(convert_to_features, batched=True)
# Format our dataset to outputs torch.Tensor to train a pytorch model
columns = ['input_ids', 'token_type_ids', 'attention_mask', 'labels']
encoded_dataset.set_format(type='torch', columns=columns)
# Instantiate a PyTorch Dataloader around our dataset
# Let's do dynamic batching (pad on the fly with our own collate_fn)
def collate_fn(examples):
return tokenizer.pad(examples, return_tensors='pt')
dataloader = torch.utils.data.DataLoader(encoded_dataset['train'], collate_fn=collate_fn, batch_size=8)
# Now let's train our model
device = 'cuda' if torch.cuda.is_available() else 'cpu'
# Let's load a pretrained Bert model and a simple optimizer
model = BertForSequenceClassification.from_pretrained('bert-base-cased', return_dict=True)
optimizer = torch.optim.Adam(model.parameters(), lr=1e-5)
model.train().to(device)
for i, batch in enumerate(dataloader):
batch.to(device)
outputs = model(**batch)
loss = outputs.loss
loss.backward()
optimizer.step()
model.zero_grad()
print(f'Step {i} - loss: {loss:.3}')
```
In case needed.
- datasets == 1.0.2
- transformers == 3.2.0
Hi did you manage to fix your issue ?
If so feel free to share your fix and close this thread | [
0.014327306300401688,
-0.01783992350101471,
0.07662586867809296,
0.2709599435329437,
0.19093330204486847,
-0.21145829558372498,
0.32164451479911804,
0.18336591124534607,
-0.3186628520488739,
0.14407065510749817,
-0.1105743870139122,
0.22517700493335724,
0.0432986281812191,
-0.3711666166782379,
-0.34120112657546997,
-0.5152071714401245,
0.09276796877384186,
0.11719074100255966,
-0.41707104444503784,
-0.3085789084434509,
0.2463037371635437,
0.14868581295013428,
-0.53726726770401,
-0.23325695097446442,
-0.40229830145835876,
0.20824269950389862,
-0.02683761715888977,
0.08499212563037872,
-0.12297766655683517,
-0.15085716545581818,
0.43500378727912903,
0.22466447949409485,
0.6234451532363892,
0.5011127591133118,
-0.00012536952272057533,
0.016735032200813293,
0.08846807479858398,
-0.1851131021976471,
-0.09640580415725708,
0.1887829303741455,
0.009506545960903168,
-0.07200688123703003,
0.07851540297269821,
-0.23934730887413025,
-0.20133379101753235,
0.5764881372451782,
-0.05895400047302246,
-0.15793389081954956,
0.5676104426383972,
0.07138257473707199,
0.05115760862827301,
0.09942327439785004,
-0.30863162875175476,
0.09789867699146271,
-0.031288258731365204,
0.1299944370985031,
-0.22178414463996887,
-0.15883003175258636,
0.14239731431007385,
-0.2430088073015213,
-0.24923521280288696,
0.24424856901168823,
-0.09148266166448593,
0.1282944679260254,
0.4990985691547394,
0.21292021870613098,
-0.3659018278121948,
-0.27159854769706726,
0.2734735608100891,
0.04963881894946098,
0.3472605347633362,
-0.4256632328033447,
-0.42163488268852234,
-0.15043532848358154,
0.12791870534420013,
0.09620030224323273,
0.04650449380278587,
-0.19554546475410461,
0.017718490213155746,
0.09642267227172852,
-0.15671992301940918,
-0.22079811990261078,
-0.4685475826263428,
0.02647005021572113,
0.0917966216802597,
0.4098708927631378,
-0.006210531108081341,
-0.1192716583609581,
-0.11438582837581635,
-0.34917759895324707,
-0.1651538461446762,
0.0337856225669384,
0.12419876456260681,
0.14864324033260345,
-0.5537852048873901,
-0.18463298678398132,
-0.11173201352357864,
-0.17451617121696472,
-0.027535445988178253,
-0.3231813907623291,
0.07807295769453049,
0.10162637382745743,
0.08215323835611343,
-0.15646585822105408,
0.17359772324562073,
0.36481034755706787,
0.09431277215480804,
0.41025951504707336,
0.12088924646377563,
0.11237224191427231,
-0.26159200072288513,
0.003263503313064575,
-0.19725479185581207,
-0.17049945890903473,
0.3708525598049164,
0.05760655552148819,
0.32015055418014526,
-0.19238686561584473,
-0.4567261040210724,
-0.05546680837869644,
-0.3279343545436859,
-0.2216431200504303,
0.09165152907371521,
0.2830949127674103,
-0.14451964199543,
0.21634694933891296,
-0.10085141658782959,
0.2693803310394287,
-0.34167158603668213,
0.07064703106880188,
-0.04727353900671005,
-0.037424810230731964,
-0.5051247477531433,
0.07234859466552734,
0.37264829874038696,
0.2174145132303238,
0.23132774233818054,
0.04512156546115875,
0.12145611643791199,
0.25222545862197876,
-0.06185773015022278,
-0.09853135049343109,
0.328862726688385,
-0.13151592016220093,
-0.28665977716445923,
0.08919738233089447,
-0.2206839770078659,
0.05529479682445526,
0.059523098170757294,
0.12871229648590088,
-0.3794061839580536,
0.21036915481090546,
-0.07567888498306274,
-0.052301425486803055,
-0.026969367638230324,
-0.053566157817840576,
-0.13788187503814697,
0.3341745138168335,
0.14262652397155762,
-0.15332719683647156,
0.1410788744688034,
-0.6094967126846313,
-0.3426012396812439,
-0.024280749261379242,
0.5197733044624329,
0.506279706954956,
-0.4620135426521301,
-0.32426318526268005,
0.2939980924129486,
0.2669239342212677,
0.5352306365966797,
0.5651915073394775,
-0.10795877128839493,
0.03494134545326233,
0.055724576115608215,
0.25125008821487427,
0.18587437272071838,
-0.20936906337738037,
-0.7334697246551514,
-0.08302946388721466,
-0.04419349133968353,
0.08696729689836502,
0.22170916199684143,
-0.13117408752441406,
0.4703833758831024,
-0.2120387852191925,
-0.1244112104177475,
-0.21514001488685608,
-0.10379265248775482,
0.1159091517329216,
-0.2668857276439667,
0.13957180082798004,
0.41363412141799927,
0.03287680819630623,
0.17478367686271667,
-0.032037802040576935,
-0.12600082159042358,
0.6209384799003601,
0.22264382243156433,
-0.18183940649032593,
0.28994637727737427,
0.06439648568630219,
0.17176394164562225,
-0.21748419106006622,
0.21403184533119202,
0.08063729852437973,
-0.3901190459728241,
0.20012810826301575,
-0.1324905902147293,
0.14476951956748962,
0.014918968081474304,
0.06260846555233002,
0.0884096696972847,
-0.27037864923477173,
-0.11363591253757477,
-0.12853604555130005,
0.04653002321720123,
0.07821912318468094,
-0.11114732921123505,
-0.47164270281791687,
-0.18321500718593597,
-0.11921022087335587,
0.1697312444448471,
0.07191793620586395,
-0.08698427677154541,
0.3454034924507141,
0.02591032348573208,
-0.433641254901886,
0.009821519255638123,
0.11935042589902878,
0.3469043970108032,
-0.05270547419786453,
-0.14130479097366333,
0.19168436527252197,
-0.06270313262939453,
0.13142545521259308,
0.23881518840789795,
0.31687211990356445,
0.43152424693107605,
-0.3996690511703491,
0.27709266543388367,
0.499634712934494,
-0.06560760736465454,
0.10539659112691879,
-0.24243822693824768,
-0.019928261637687683,
0.01015317440032959,
0.19961565732955933,
-0.07070781290531158,
-0.2372710108757019,
-0.1725025177001953,
-0.1236381083726883,
-0.30807721614837646,
0.1097654402256012,
-0.30414000153541565,
-0.14817558228969574,
0.21568521857261658,
0.06784215569496155,
-0.15141965448856354,
0.17482370138168335,
0.34010449051856995,
0.06920991837978363,
0.09542414546012878,
0.24091413617134094,
-0.44966769218444824,
-0.22352099418640137,
0.13707342743873596,
-0.01674879714846611,
0.4678153395652771,
-0.025835130363702774,
0.12857432663440704,
-0.11118840426206589,
0.23577740788459778,
-0.1046387255191803,
-0.06670335680246353,
0.3016970455646515,
-0.1883019059896469,
0.10508033633232117,
0.31686362624168396,
0.3701636791229248,
-0.04328249767422676,
-0.0838380753993988,
-0.03840254247188568,
0.17366060614585876,
-0.2928595244884491,
0.3218757212162018,
-0.2582606077194214,
0.06121305376291275,
-0.21387505531311035,
-0.05276194214820862,
0.11865343153476715,
0.1473303586244583,
-0.06269214302301407,
-0.0735691487789154,
-0.04724627733230591,
0.2227204591035843,
0.03474033623933792,
0.3343001902103424,
0.32818976044654846,
-0.21831421554088593,
-0.06667391210794449,
-0.057261910289525986,
-0.028094187378883362,
0.03249054774641991,
-0.04106808826327324,
0.027634264901280403,
-0.26574990153312683,
-0.07365544885396957,
-0.168052077293396,
-0.2551646828651428,
-0.3171065151691437,
0.07041767239570618,
-0.18027156591415405,
-0.13117194175720215,
0.2053002566099167,
-0.04217346012592316,
-0.37287718057632446,
-0.2056102305650711,
-0.011059144511818886,
-0.33342427015304565,
0.09617752581834793,
0.15801067650318146,
-0.10588596761226654,
-0.209053635597229,
0.03349841758608818,
-0.3507477045059204,
0.1322994977235794,
0.12838101387023926,
-0.10993458330631256,
-0.14930109679698944,
-0.10892027616500854,
0.3558451235294342,
-0.05329854413866997,
-0.047571346163749695,
0.029614662751555443,
0.23453450202941895,
0.17033402621746063,
-0.3580477237701416,
0.4893874526023865,
-0.021912692114710808,
-0.2243322879076004,
-0.17584939301013947,
0.022339899092912674,
0.13773994147777557,
-0.07756282389163971,
0.06669460237026215,
-0.24401339888572693,
-0.20234552025794983,
0.13361510634422302,
-0.1854810267686844,
0.35518011450767517,
0.3544386029243469,
0.1523950845003128,
0.110573410987854,
-0.19086894392967224,
-0.450973778963089,
0.34852078557014465,
0.3832605481147766,
0.4323945641517639,
-0.42163747549057007,
0.18232274055480957,
0.036140572279691696,
0.9876054525375366,
0.10437804460525513,
-0.3358760178089142,
0.24497228860855103,
0.12326523661613464,
-0.09123118221759796,
0.04058518260717392,
-0.3617666959762573,
0.5099084377288818,
-0.001531749963760376,
-0.08531154692173004,
0.3287678360939026,
0.031203437596559525,
-0.2091062068939209,
0.10180473327636719,
-0.2216373234987259,
-0.11030749976634979,
-0.36701247096061707,
0.0729522556066513,
0.199371337890625,
0.2293974757194519,
-0.036808937788009644,
0.3337690234184265,
-0.08248448371887207,
-0.10330869257450104,
0.35127049684524536,
0.018406599760055542,
0.4582270085811615,
-0.10776209086179733,
0.17604894936084747,
-0.10721834003925323,
-0.6214438080787659,
0.13849258422851562,
-0.07758776098489761,
0.3409397006034851,
0.0871911495923996,
-0.20413264632225037,
0.08711273223161697,
0.2505130171775818,
0.2127576768398285,
0.24983958899974823,
0.03821692615747452,
-0.04857008159160614,
-0.09833107888698578,
-0.05345431715250015,
-0.15138570964336395,
-0.29046833515167236,
0.004362290259450674,
0.499923974275589,
-0.05232740938663483,
-0.16548633575439453,
-0.48050522804260254,
0.21672500669956207,
-0.1697978377342224,
0.07876846194267273,
0.034356094896793365,
-0.22423061728477478,
0.025675468146800995,
0.11672961711883545,
0.016605548560619354,
0.22480805218219757,
0.17110879719257355,
0.010453552007675171,
0.10896223783493042,
0.10176801681518555,
-0.374082088470459,
0.3025340139865875,
0.36333513259887695,
0.26418599486351013,
0.2990296185016632,
0.1077369898557663,
0.1964431256055832,
0.1423642486333847,
0.22620491683483124,
0.19707678258419037,
-0.02085798606276512,
-0.651915967464447,
0.3639232814311981,
0.20963412523269653,
0.17940542101860046,
0.137777641415596,
-0.009108743630349636,
-0.013654753565788269,
-0.20792989432811737,
0.22047705948352814,
-0.008760747499763966,
0.17009183764457703,
0.4786548316478729,
-0.004626834765076637,
-0.3678678572177887,
-0.05328657478094101,
-0.0504150316119194,
-0.2648199498653412,
-0.1895357072353363,
-0.5693151950836182,
0.096856027841568,
-0.3616546392440796,
0.17450971901416779,
0.3774794042110443,
0.8383359313011169,
0.11993315070867538,
0.06419702619314194,
0.005864406004548073,
0.07539121806621552,
0.415081262588501,
0.04222439229488373,
0.19865518808364868,
-0.18860237300395966,
-0.1785336136817932,
0.057054318487644196,
0.05197957530617714,
0.05779305100440979,
0.054322123527526855,
-0.502373993396759,
0.5196648836135864,
0.07696905732154846,
0.17098119854927063,
-0.0532267764210701,
0.13291774690151215,
0.3378889560699463,
-0.29482603073120117,
-0.2281220704317093,
0.01777217909693718,
-0.03323224186897278,
0.28303539752960205,
-0.03323981910943985,
-0.32210737466812134,
-0.03517682105302811,
-0.14738360047340393,
-0.14008530974388123,
0.09833382815122604,
-0.540610134601593,
-0.19736291468143463,
0.21894900500774384,
-0.4878493547439575,
0.6094720363616943,
0.3612019717693329,
0.7112467288970947,
0.03891666606068611,
-0.13419725000858307,
0.18365883827209473,
-0.1868416666984558,
0.22060811519622803,
0.12245140224695206,
-0.19017700850963593,
0.11500034481287003,
0.025607936084270477,
-0.07040246576070786,
-0.007121607661247253,
0.29481932520866394,
0.02462039142847061,
-0.26785731315612793,
-0.05896541476249695,
0.5732700228691101,
-0.35367825627326965,
0.14652138948440552,
-0.09815466403961182,
-0.10485817492008209,
-0.17383025586605072,
0.019666556268930435,
0.2717899680137634,
-0.1337004452943802,
0.47221046686172485,
0.04650439694523811,
-0.21234267950057983,
0.15077079832553864,
0.5336143374443054,
-0.06129398196935654,
0.035070113837718964,
0.6399749517440796,
-0.1759636253118515,
-0.059374354779720306,
-0.05158581584692001,
-0.04568701982498169,
0.04953194409608841,
-0.34113866090774536,
-0.10746811330318451,
0.10470353811979294,
-0.061081886291503906,
0.24229879677295685,
0.3580409288406372,
-0.11004553735256195,
-0.032170772552490234,
-0.34337377548217773,
0.14856605231761932,
-0.36613282561302185,
-0.08610758185386658,
0.16470682621002197,
0.24356938898563385,
-0.06530110538005829,
0.11256878077983856,
0.08550536632537842,
0.07347475737333298,
-0.18017569184303284,
-0.10886307060718536,
0.11822729557752609,
0.20039159059524536,
0.009600856341421604,
-0.22874709963798523,
-0.013035223819315434,
-0.2042820304632187,
-0.13017144799232483,
0.03875049203634262,
0.21490371227264404,
-0.03775954619050026,
-0.17760618031024933,
0.14796222746372223,
0.09298161417245865,
-0.06450507789850235,
-0.5151130557060242,
0.1278841197490692,
0.11661483347415924,
-0.25108638405799866,
0.3547605872154236,
0.13062748312950134,
0.29096096754074097,
0.4648832678794861,
0.34719744324684143,
-0.3416909873485565,
0.04128429293632507,
-0.10696381330490112,
0.2297142744064331,
0.272452712059021,
0.3789077401161194,
0.0959772914648056,
0.22987748682498932,
-0.16498062014579773,
-0.04275332763791084,
0.2534695565700531,
0.3290732502937317,
0.1927928924560547,
0.1455298364162445,
-0.3761541247367859,
0.011020030826330185,
-0.06262577325105667,
-0.003987235948443413,
0.08920285850763321,
0.02887464128434658,
-0.33052337169647217,
0.18260473012924194,
0.1258682757616043,
-0.06247885152697563,
-0.05675109103322029,
0.047064024955034256,
0.0025413567200303078,
-0.009978894144296646,
0.07938078045845032,
-0.36151355504989624,
0.18414166569709778,
0.1266908347606659,
0.27452903985977173,
0.30681997537612915,
0.2341708242893219,
0.2034865915775299,
0.05389972776174545,
-0.01995975524187088,
0.1516922265291214,
0.03071581944823265,
-0.3423265814781189,
-0.09572742134332657,
0.008000146597623825,
0.08192535489797592,
0.7272571921348572,
-0.23391547799110413,
0.24874281883239746,
-0.04742511361837387,
0.14256198704242706,
-0.29659268260002136,
0.04860874265432358,
0.0628923624753952,
-0.06745164841413498,
-0.10823038220405579,
0.3336432874202728,
0.0007177991792559624,
-0.5508161783218384,
-0.005412546917796135,
0.22324593365192413,
-0.08292672783136368,
-0.31667935848236084,
-0.08545506000518799,
-0.18976955115795135,
0.3159944713115692,
-0.17175090312957764,
-0.3310951590538025,
0.2240344136953354,
0.04621560499072075,
0.04325620085000992,
-0.18818582594394684,
0.004372076131403446,
-0.3820970952510834,
0.25293612480163574,
0.14572080969810486,
0.16158807277679443,
0.32019031047821045,
-0.025588765740394592,
0.1071968525648117,
-0.17643296718597412,
0.5512979626655579,
0.24084335565567017,
0.36117851734161377,
0.006245233118534088,
-0.24769127368927002,
0.16836217045783997,
-0.09842792898416519,
0.03912859037518501,
0.09880153834819794,
-0.09837432205677032,
-0.3236693739891052,
0.04312421754002571,
-0.02472144365310669,
-0.010872887447476387,
0.11315937340259552,
-0.0320630706846714,
-0.07150018215179443,
-0.3820294439792633,
0.24896973371505737,
-0.07154712826013565,
0.09520507603883743,
-0.28936779499053955,
-0.1540640890598297,
-0.15382224321365356,
0.02900705114006996,
0.03778204321861267,
-0.2452779859304428,
0.028873853385448456,
-0.2547990381717682,
-0.019245965406298637,
-0.054546985775232315,
0.5542142391204834,
0.09839950501918793,
0.07641590386629105,
-0.5310482978820801,
0.17372746765613556,
-0.3281562626361847,
0.12338506430387497,
0.09026504307985306,
0.06315458565950394,
-0.09185714274644852,
0.10536317527294159,
0.0074247270822525024,
0.2421836405992508,
0.3709098696708679,
-0.26222050189971924,
0.025620870292186737,
0.2357785403728485,
-0.2690032124519348,
0.24328316748142242,
-0.24646709859371185,
0.08117866516113281,
0.10254628956317902,
-0.21140721440315247,
0.17759327590465546,
0.09552601724863052,
-0.07888583838939667,
0.03578653931617737,
0.12496545910835266,
-0.11480991542339325,
-0.09797626733779907,
0.4438374638557434,
0.20220153033733368,
0.2865838408470154,
-0.1549038141965866,
-0.09487265348434448,
-0.15545302629470825,
-0.24246785044670105,
-0.24545539915561676,
-0.5271036028862,
-0.006019607186317444,
0.4133564531803131,
-0.0477306991815567,
-0.08310456573963165,
-0.19288533926010132,
0.14099948108196259,
0.2417920082807541,
-0.06854252517223358,
-0.39890357851982117,
0.16126149892807007,
-0.04222644120454788,
0.19077152013778687,
-0.442752480506897,
0.07278583943843842,
-0.030805647373199463,
0.10648991167545319,
-0.5212317705154419,
-0.4688403904438019,
0.682217001914978,
-0.6715805530548096,
-0.26214712858200073,
-0.40655767917633057,
0.2129824459552765,
-0.11214097589254379,
-0.15445634722709656,
-0.728784441947937,
0.07489591091871262,
0.04461381584405899,
0.20082083344459534,
-0.31981685757637024,
0.1755496710538864,
0.16373863816261292,
0.23206566274166107,
0.009739790111780167,
0.504239022731781,
0.1847340166568756,
-0.03966968506574631,
0.08179457485675812,
-0.17192062735557556
] |
https://github.com/huggingface/datasets/issues/666 | Does both 'bookcorpus' and 'wikipedia' belong to the same datasets which Google used for pretraining BERT? | No they are other similar copies but they are not provided by the official Bert models authors. | 17 | Does both 'bookcorpus' and 'wikipedia' belong to the same datasets which Google used for pretraining BERT?
No they are other similar copies but they are not provided by the official Bert models authors. | [
0.1324196755886078,
-0.1332351118326187,
-0.08413006365299225,
0.41013240814208984,
-0.06199268996715546,
0.068628691136837,
0.4990639388561249,
0.050850823521614075,
0.05872773751616478,
-0.18183620274066925,
-0.5121811628341675,
0.010585624724626541,
0.16044260561466217,
0.2634945213794708,
0.3741166293621063,
-0.0626940131187439,
0.2953798472881317,
0.06850948929786682,
-0.10614924132823944,
-0.4837567210197449,
-0.07172919809818268,
0.21387827396392822,
0.08652020990848541,
0.25001221895217896,
0.19096066057682037,
0.23103830218315125,
-0.269366055727005,
-0.030453816056251526,
-0.028223438188433647,
0.031050480902194977,
0.37777283787727356,
0.3160232901573181,
0.21821637451648712,
0.4636306166648865,
-0.00011774215818149969,
-0.06487482786178589,
-0.05965820699930191,
-0.025655144825577736,
-0.09059172868728638,
-0.03176210820674896,
-0.5987688302993774,
0.40220579504966736,
0.02056782878935337,
-0.24477893114089966,
-0.24798104166984558,
0.1904207468032837,
0.07987310737371445,
0.008366100490093231,
0.19552980363368988,
0.0961967408657074,
0.15726789832115173,
0.017666727304458618,
0.1153462678194046,
-0.021066153421998024,
0.47453829646110535,
-0.044160544872283936,
0.0986415222287178,
0.2570820152759552,
0.2947521507740021,
-0.007567289751023054,
0.19345903396606445,
0.2982076108455658,
0.01366225816309452,
0.17925339937210083,
0.327929824590683,
0.20274773240089417,
0.03569655865430832,
-0.22890111804008484,
0.1980825960636139,
0.6075034737586975,
0.580810546875,
-0.1521255373954773,
-0.2595592737197876,
0.34409835934638977,
0.14130899310112,
0.38726383447647095,
-0.0057436153292655945,
0.3685971200466156,
0.1439119577407837,
0.06014207378029823,
-0.34902241826057434,
-0.4425520896911621,
-0.21316872537136078,
0.04819614440202713,
-0.4004032611846924,
0.14533814787864685,
-0.02619544416666031,
-0.051578447222709656,
0.11617501080036163,
-0.0598330944776535,
-0.17698925733566284,
-0.4608445465564728,
0.13342081010341644,
0.03164386749267578,
0.25904807448387146,
-0.4295485317707062,
-0.4468907117843628,
0.4916747510433197,
0.01987782120704651,
-0.265194296836853,
0.11515496671199799,
-0.24583929777145386,
-0.46267229318618774,
-0.0033401288092136383,
0.5650667548179626,
-0.16063983738422394,
-0.09720728546380997,
0.41778647899627686,
0.005913272500038147,
0.05201654136180878,
-0.46451836824417114,
0.14071524143218994,
-0.02264859899878502,
0.15966911613941193,
-0.014033790677785873,
-0.4965689480304718,
-0.02017199993133545,
-0.4630061089992523,
-0.20843446254730225,
0.39403411746025085,
-0.27110716700553894,
-0.3099861741065979,
-0.023877587169408798,
0.22175297141075134,
-0.24028705060482025,
0.005996940657496452,
-0.07148078083992004,
0.05210446938872337,
-0.31379014253616333,
-0.041763659566640854,
-0.13708119094371796,
0.1919548362493515,
-0.14781489968299866,
0.0813203901052475,
0.17146964371204376,
-0.1659351885318756,
0.22770678997039795,
0.0033453041687607765,
-0.18745477497577667,
0.1649453043937683,
0.16277042031288147,
-0.23445509374141693,
0.22924187779426575,
0.09882263839244843,
0.14442110061645508,
0.30864962935447693,
-0.21005798876285553,
0.09570476412773132,
-0.2624313533306122,
0.2983240783214569,
-0.2653524577617645,
0.12038600444793701,
0.05441906303167343,
0.14652161300182343,
-0.0216829776763916,
-0.45955875515937805,
-0.13766229152679443,
0.37177371978759766,
0.2018168568611145,
-0.3964063227176666,
-0.021451957523822784,
-0.07413419336080551,
0.00030557066202163696,
-0.04989618808031082,
0.10148387402296066,
0.11365895718336105,
-0.4338349997997284,
-0.09910151362419128,
-0.06959111243486404,
0.16685523092746735,
0.041371285915374756,
0.47699806094169617,
-0.24067334830760956,
-0.001695200800895691,
0.12987381219863892,
0.294498085975647,
-0.007925115525722504,
0.14064837992191315,
-0.21555599570274353,
-0.08017809689044952,
0.6388681530952454,
-0.05731489881873131,
-0.27027609944343567,
0.06284217536449432,
-0.12149031460285187,
0.07060738652944565,
-0.02785675972700119,
0.15781117975711823,
-0.09488401561975479,
-0.012869998812675476,
-0.01847408153116703,
-0.36419713497161865,
0.24797195196151733,
0.22322160005569458,
0.2096710056066513,
-0.2025904655456543,
-0.12395631521940231,
0.31462326645851135,
0.09308592230081558,
-0.20497003197669983,
-0.10002419352531433,
0.3123936653137207,
0.21977798640727997,
0.13530856370925903,
0.3516611158847809,
-0.19045501947402954,
-0.07833441346883774,
-0.10332009941339493,
-0.4503232538700104,
0.11381877213716507,
0.42082417011260986,
-0.22479549050331116,
-0.38420262932777405,
-0.34674733877182007,
0.10694056749343872,
-0.269567608833313,
0.04031175374984741,
-0.11094929277896881,
-0.19286447763442993,
0.14693361520767212,
-0.16919749975204468,
-0.3153446912765503,
-0.12990638613700867,
-0.07474181801080704,
-0.29052531719207764,
0.414048433303833,
-0.3119814693927765,
0.21146561205387115,
-0.015295976772904396,
0.24112138152122498,
-0.21271094679832458,
0.1486358791589737,
0.15321090817451477,
-0.07254604995250702,
0.1858251541852951,
0.22660499811172485,
0.45290639996528625,
0.2760821580886841,
0.5355114340782166,
-0.5498381853103638,
-0.008645372465252876,
0.2895117402076721,
0.17845194041728973,
-0.05894513800740242,
-0.5726771354675293,
0.07896693050861359,
0.4249207377433777,
0.0028084665536880493,
0.28120672702789307,
-0.089124895632267,
-0.13692034780979156,
-0.03905784711241722,
0.06016836315393448,
-0.1927032619714737,
-0.02281412109732628,
0.23318956792354584,
0.26721009612083435,
0.2973284423351288,
-0.29569941759109497,
0.16882038116455078,
0.1861184686422348,
-0.26300719380378723,
0.04442934691905975,
0.13282333314418793,
-0.5474487543106079,
-0.23029926419258118,
0.033278655260801315,
-0.1503332257270813,
-0.12891115248203278,
0.03445363789796829,
0.19153167307376862,
-0.15336093306541443,
-0.16804280877113342,
-0.1252952665090561,
0.2708810567855835,
-0.021253593266010284,
-0.3044987916946411,
-0.2566547393798828,
-0.12743398547172546,
-0.02233162149786949,
-0.1389680951833725,
0.2556280493736267,
-0.0996972918510437,
0.0149442283436656,
-0.3301990032196045,
0.2602411210536957,
0.029983794316649437,
-0.08689354360103607,
-0.1960291713476181,
-0.16356222331523895,
-0.24886846542358398,
-0.05091381072998047,
-0.006240073591470718,
0.05557052418589592,
0.08001875877380371,
-0.011549776419997215,
-0.14275863766670227,
0.48503804206848145,
-0.14708636701107025,
0.18675164878368378,
-0.01641719415783882,
-0.2713662087917328,
-0.24318864941596985,
0.21036984026432037,
0.26459553837776184,
-0.17893283069133759,
-0.24471427500247955,
-0.3091818392276764,
-0.30248481035232544,
-0.3940913677215576,
-0.37495195865631104,
0.1970193088054657,
-0.20949970185756683,
0.038553036749362946,
0.027721039950847626,
0.17482620477676392,
-0.5439239740371704,
-0.16313937306404114,
-0.04017636552453041,
-0.12109492719173431,
-0.07901275902986526,
-0.203161358833313,
-0.02444298565387726,
-0.09624435007572174,
0.1075747013092041,
-0.47313109040260315,
-0.1166658028960228,
0.4031418263912201,
0.01572253927588463,
0.31761980056762695,
-0.027779169380664825,
0.14081667363643646,
-0.059880275279283524,
-0.04061899334192276,
0.2494783103466034,
0.12909093499183655,
-0.4798996150493622,
-0.21050706505775452,
0.43580561876296997,
-0.02840798906981945,
-0.1621992141008377,
-0.2142314463853836,
-0.20480050146579742,
0.15303288400173187,
0.0487893670797348,
-0.21563765406608582,
-0.06167762726545334,
-0.3050425946712494,
-0.2642214894294739,
0.30113840103149414,
0.3834311366081238,
-0.15158168971538544,
-0.06068846210837364,
-0.031217075884342194,
-0.18409794569015503,
-0.01871480606496334,
0.2367311418056488,
0.2664715647697449,
0.21129271388053894,
-0.2286880910396576,
-0.469265341758728,
-0.5121156573295593,
1.040793776512146,
0.1825527846813202,
-0.10180141031742096,
0.171846404671669,
0.22204677760601044,
0.10485122352838516,
0.06644692271947861,
0.10454964637756348,
0.05721224844455719,
0.11356906592845917,
-0.014386889524757862,
0.5116860866546631,
0.13297662138938904,
-0.4170602858066559,
0.0342961847782135,
0.16911867260932922,
-0.6020392179489136,
-0.19542770087718964,
-0.14656099677085876,
0.29702308773994446,
0.24669241905212402,
0.2368280589580536,
-0.0028759799897670746,
0.06609873473644257,
-0.40885651111602783,
-0.08879737555980682,
0.061767883598804474,
0.05066079646348953,
-0.1207096204161644,
0.21413306891918182,
-0.1384863257408142,
-0.6867518424987793,
0.19337275624275208,
-0.0709492489695549,
-0.20522943139076233,
0.056038614362478256,
0.01944972574710846,
0.0868583396077156,
-0.08002915233373642,
0.1252574920654297,
-0.32467028498649597,
-0.15531359612941742,
-0.09703172743320465,
-0.14699408411979675,
0.012696931138634682,
-0.02504185400903225,
-0.5403256416320801,
0.007090857718139887,
0.1818077266216278,
0.17700697481632233,
-0.3593626022338867,
0.15860284864902496,
0.3823162317276001,
-0.06627120822668076,
-0.13403858244419098,
0.039491452276706696,
0.059720974415540695,
-0.026114339008927345,
0.21457232534885406,
-0.163614422082901,
-0.05893131345510483,
0.07200919836759567,
-0.2767027020454407,
0.08303211629390717,
0.10915476828813553,
0.2225005030632019,
0.5866477489471436,
0.25981980562210083,
0.30883166193962097,
0.12660393118858337,
0.14057530462741852,
-0.017269324511289597,
0.12460779398679733,
0.18835891783237457,
0.44415467977523804,
-0.3815991282463074,
0.041876208037137985,
-0.020579490810632706,
-0.24425828456878662,
-0.020868249237537384,
0.2543645203113556,
0.18803195655345917,
-0.024727001786231995,
0.5760331153869629,
-0.3531186580657959,
-0.05135438218712807,
0.026881204918026924,
0.2596489489078522,
0.08058690279722214,
-0.4422304928302765,
-0.7111805081367493,
0.41298598051071167,
0.3456958532333374,
-0.2478865683078766,
-0.0011174939572811127,
0.4646759629249573,
-0.28080570697784424,
0.12825579941272736,
0.30578145384788513,
0.9812768697738647,
-0.140848308801651,
0.5032834410667419,
0.09650907665491104,
0.2022595852613449,
0.20074254274368286,
-0.1934657245874405,
-0.11311103403568268,
-0.3900812566280365,
-0.010719900019466877,
-0.19480650126934052,
-0.055696576833724976,
-0.33120325207710266,
0.20560289919376373,
-0.10978784412145615,
0.34458616375923157,
-0.1208687424659729,
0.11453825235366821,
-0.1543719470500946,
0.06691353768110275,
0.24833349883556366,
0.2096649408340454,
0.22111305594444275,
0.10952816903591156,
0.11157266795635223,
0.2460918128490448,
-0.053175732493400574,
0.05935287848114967,
-0.10163245350122452,
0.05815010517835617,
-0.4849034547805786,
0.0853024423122406,
0.1788756549358368,
0.24242901802062988,
-0.0005605705082416534,
-0.5334537625312805,
0.1449194997549057,
0.29441842436790466,
0.5593867897987366,
-0.06387607753276825,
-0.4661141037940979,
0.40581104159355164,
-0.08683498948812485,
0.12133477628231049,
-0.06918080896139145,
-0.05924078822135925,
0.07234084606170654,
0.032682642340660095,
-0.05033836513757706,
0.11566842347383499,
0.0916898101568222,
-0.10741199553012848,
-0.5722074508666992,
-0.05259145796298981,
-0.09178486466407776,
-0.28886449337005615,
-0.0002389233559370041,
0.1918548047542572,
-0.16957984864711761,
0.006462696939706802,
0.061578020453453064,
-0.1173144280910492,
0.18557320535182953,
0.22907918691635132,
0.29406818747520447,
-0.32874199748039246,
-0.20352153480052948,
0.3612866997718811,
0.6086621880531311,
0.2955797612667084,
0.5356587171554565,
-0.10680289566516876,
-0.18891100585460663,
-0.21034663915634155,
-0.20125752687454224,
0.3934395909309387,
-0.19539152085781097,
0.07578055560588837,
-0.10930296778678894,
0.05023598670959473,
0.03993107005953789,
0.4836311936378479,
0.18751080334186554,
0.257317453622818,
0.01707293465733528,
0.06541705131530762,
0.06739619374275208,
0.040756139904260635,
-0.16065555810928345,
0.5022099018096924,
0.27711668610572815,
-0.2831904888153076,
0.13898548483848572,
-0.04276704788208008,
-0.24408821761608124,
0.29648253321647644,
-0.09836184978485107,
0.029095489531755447,
-0.07509874552488327,
-0.11111331731081009,
-0.1471777856349945,
-0.20767168700695038,
0.022539710626006126,
-0.43051546812057495,
-0.1581306755542755,
-0.20589134097099304,
-0.12121018767356873,
0.13972672820091248,
-0.06777384132146835,
-0.294594407081604,
-0.23392172157764435,
-0.05982372164726257,
-0.018573816865682602,
-0.00015178415924310684,
0.01298069953918457,
0.17155462503433228,
0.39400261640548706,
0.17221209406852722,
-0.0029343999922275543,
-0.17163613438606262,
-0.3191106915473938,
0.16701360046863556,
0.13540251553058624,
0.15840153396129608,
0.273904025554657,
0.06593364477157593,
0.236922487616539,
0.0057691410183906555,
0.012073864229023457,
0.3034847676753998,
0.22475777566432953,
0.12336646020412445,
0.09628179669380188,
0.05734412744641304,
0.06918609142303467,
0.2848481833934784,
0.19619888067245483,
0.38435694575309753,
-0.23112238943576813,
-0.08294368535280228,
0.1619485318660736,
0.19329623878002167,
-0.11127585172653198,
-0.09622403234243393,
0.18269366025924683,
-0.20888127386569977,
-0.21951401233673096,
0.19513258337974548,
0.26009637117385864,
0.2783447206020355,
0.13067065179347992,
0.07643577456474304,
-0.214882954955101,
0.04718314856290817,
0.4676145017147064,
0.2438163012266159,
0.2255597859621048,
0.12545767426490784,
0.22776176035404205,
0.15821662545204163,
0.1559789478778839,
0.16141773760318756,
0.0979192778468132,
0.11060105264186859,
-0.10346323996782303,
-0.027125362306833267,
0.5461993217468262,
0.03882155194878578,
0.0677289068698883,
0.08528482913970947,
0.0421052984893322,
0.2842879891395569,
0.27411749958992004,
0.4039295017719269,
-0.2936069667339325,
-0.26212063431739807,
-0.5696948170661926,
0.013966331258416176,
-0.06563854217529297,
-0.3557179570198059,
0.05192873626947403,
-0.40530499815940857,
0.20636168122291565,
0.14113040268421173,
-0.3217979669570923,
-0.21625150740146637,
0.19461703300476074,
0.07571373134851456,
-0.10937575995922089,
-0.4116971790790558,
0.18303075432777405,
0.17116251587867737,
0.14220157265663147,
0.09446918964385986,
0.171136736869812,
-0.19072942435741425,
-0.14238518476486206,
0.07934349775314331,
0.609525740146637,
-0.032360535115003586,
0.004941396415233612,
-0.20508286356925964,
-0.33601561188697815,
0.3389039635658264,
-0.01959298923611641,
0.17508018016815186,
-0.198465034365654,
0.21576018631458282,
-0.43203580379486084,
0.2925243079662323,
0.08979114890098572,
0.03951247036457062,
0.061323195695877075,
0.1295151263475418,
0.2644067406654358,
-0.25579842925071716,
-0.06526487320661545,
-0.12941321730613708,
0.13276100158691406,
-0.07019753754138947,
-0.0012830272316932678,
-0.3846644461154938,
0.46580880880355835,
0.057936422526836395,
0.2285819947719574,
0.12084508687257767,
0.1112712100148201,
0.025290824472904205,
0.12688104808330536,
0.36326849460601807,
0.3803136348724365,
0.06882768124341965,
-0.3417423963546753,
-0.12384264171123505,
-0.17608565092086792,
0.08786499500274658,
-0.20836743712425232,
0.22014030814170837,
-0.0782322809100151,
0.3059857487678528,
-0.1753036379814148,
0.007671987637877464,
0.25328826904296875,
-0.13765770196914673,
-0.33570268750190735,
0.27086716890335083,
-0.3088420331478119,
-0.013583570718765259,
-0.18897663056850433,
0.06756293773651123,
-0.16380034387111664,
0.15670087933540344,
0.22385357320308685,
-0.11251762509346008,
-0.07179465889930725,
-0.08596096932888031,
-0.12396566569805145,
0.22194896638393402,
0.2634163796901703,
0.17668768763542175,
-0.09609490633010864,
0.2713315188884735,
-0.07538695633411407,
-0.17621511220932007,
0.18699294328689575,
-0.3589598536491394,
-0.030992470681667328,
0.03522157296538353,
-0.24636447429656982,
0.015442263334989548,
-0.1843355894088745,
-0.0716840922832489,
0.12039586156606674,
0.26088187098503113,
0.1746184527873993,
0.19535143673419952,
-0.27932560443878174,
-0.3151468336582184,
-0.06288977712392807,
-0.2449338436126709,
0.04489349201321602,
0.4290238618850708,
-0.12793174386024475,
-0.03880933299660683,
0.03594842553138733,
-0.2259383499622345,
0.5050830245018005,
-0.10657034814357758,
-0.0702054500579834,
-0.4230024814605713,
-0.24443364143371582,
0.08384270966053009,
0.1866806149482727,
-0.7867587208747864,
0.13920056819915771,
0.2918984293937683,
-0.23395803570747375,
-0.1703793704509735,
-0.06967291235923767,
0.24263229966163635,
0.1770137995481491,
-0.28965702652931213,
0.2271283119916916,
-0.006379745900630951,
-0.2858680486679077,
-0.15491025149822235,
-0.22534438967704773
] | |
https://github.com/huggingface/datasets/issues/665 | runing dataset.map, it raises TypeError: can't pickle Tokenizer objects | Hi !
It works on my side with both the LongFormerTokenizer and the LongFormerTokenizerFast.
Which version of transformers/datasets are you using ? | I load squad dataset. Then want to process data use following function with `Huggingface Transformers LongformerTokenizer`.
```
def convert_to_features(example):
# Tokenize contexts and questions (as pairs of inputs)
input_pairs = [example['question'], example['context']]
encodings = tokenizer.encode_plus(input_pairs, pad_to_max_length=True, max_length=512)
context_encodings = tokenizer.encode_plus(example['context'])
# Compute start and end tokens for labels using Transformers's fast tokenizers alignement methodes.
# this will give us the position of answer span in the context text
start_idx, end_idx = get_correct_alignement(example['context'], example['answers'])
start_positions_context = context_encodings.char_to_token(start_idx)
end_positions_context = context_encodings.char_to_token(end_idx-1)
# here we will compute the start and end position of the answer in the whole example
# as the example is encoded like this <s> question</s></s> context</s>
# and we know the postion of the answer in the context
# we can just find out the index of the sep token and then add that to position + 1 (+1 because there are two sep tokens)
# this will give us the position of the answer span in whole example
sep_idx = encodings['input_ids'].index(tokenizer.sep_token_id)
start_positions = start_positions_context + sep_idx + 1
end_positions = end_positions_context + sep_idx + 1
if end_positions > 512:
start_positions, end_positions = 0, 0
encodings.update({'start_positions': start_positions,
'end_positions': end_positions,
'attention_mask': encodings['attention_mask']})
return encodings
```
Then I run `dataset.map(convert_to_features)`, it raise
```
In [59]: a.map(convert_to_features)
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-59-c453b508761d> in <module>
----> 1 a.map(convert_to_features)
/opt/conda/lib/python3.7/site-packages/datasets/arrow_dataset.py in map(self, function, with_indices, input_columns, batched, batch_size, drop_last_batch, remove_columns, keep_in_memory, load_from_cache_file, cache_file_name, writer_batch_size, features, disable_nullable, fn_kwargs, num_proc, suffix_template, new_fingerprint)
1242 fn_kwargs=fn_kwargs,
1243 new_fingerprint=new_fingerprint,
-> 1244 update_data=update_data,
1245 )
1246 else:
/opt/conda/lib/python3.7/site-packages/datasets/arrow_dataset.py in wrapper(*args, **kwargs)
151 "output_all_columns": self._output_all_columns,
152 }
--> 153 out: Union["Dataset", "DatasetDict"] = func(self, *args, **kwargs)
154 if new_format["columns"] is not None:
155 new_format["columns"] = list(set(new_format["columns"]) & set(out.column_names))
/opt/conda/lib/python3.7/site-packages/datasets/fingerprint.py in wrapper(*args, **kwargs)
156 kwargs_for_fingerprint["fingerprint_name"] = fingerprint_name
157 kwargs[fingerprint_name] = update_fingerprint(
--> 158 self._fingerprint, transform, kwargs_for_fingerprint
159 )
160
/opt/conda/lib/python3.7/site-packages/datasets/fingerprint.py in update_fingerprint(fingerprint, transform, transform_args)
103 for key in sorted(transform_args):
104 hasher.update(key)
--> 105 hasher.update(transform_args[key])
106 return hasher.hexdigest()
107
/opt/conda/lib/python3.7/site-packages/datasets/fingerprint.py in update(self, value)
55 def update(self, value):
56 self.m.update(f"=={type(value)}==".encode("utf8"))
---> 57 self.m.update(self.hash(value).encode("utf-8"))
58
59 def hexdigest(self):
/opt/conda/lib/python3.7/site-packages/datasets/fingerprint.py in hash(cls, value)
51 return cls.dispatch[type(value)](cls, value)
52 else:
---> 53 return cls.hash_default(value)
54
55 def update(self, value):
/opt/conda/lib/python3.7/site-packages/datasets/fingerprint.py in hash_default(cls, value)
44 @classmethod
45 def hash_default(cls, value):
---> 46 return cls.hash_bytes(dumps(value))
47
48 @classmethod
/opt/conda/lib/python3.7/site-packages/datasets/utils/py_utils.py in dumps(obj)
365 file = StringIO()
366 with _no_cache_fields(obj):
--> 367 dump(obj, file)
368 return file.getvalue()
369
/opt/conda/lib/python3.7/site-packages/datasets/utils/py_utils.py in dump(obj, file)
337 def dump(obj, file):
338 """pickle an object to a file"""
--> 339 Pickler(file, recurse=True).dump(obj)
340 return
341
/opt/conda/lib/python3.7/site-packages/dill/_dill.py in dump(self, obj)
444 raise PicklingError(msg)
445 else:
--> 446 StockPickler.dump(self, obj)
447 stack.clear() # clear record of 'recursion-sensitive' pickled objects
448 return
/opt/conda/lib/python3.7/pickle.py in dump(self, obj)
435 if self.proto >= 4:
436 self.framer.start_framing()
--> 437 self.save(obj)
438 self.write(STOP)
439 self.framer.end_framing()
/opt/conda/lib/python3.7/pickle.py in save(self, obj, save_persistent_id)
502 f = self.dispatch.get(t)
503 if f is not None:
--> 504 f(self, obj) # Call unbound method with explicit self
505 return
506
/opt/conda/lib/python3.7/site-packages/dill/_dill.py in save_function(pickler, obj)
1436 globs, obj.__name__,
1437 obj.__defaults__, obj.__closure__,
-> 1438 obj.__dict__, fkwdefaults), obj=obj)
1439 else:
1440 _super = ('super' in getattr(obj.func_code,'co_names',())) and (_byref is not None) and getattr(pickler, '_recurse', False)
/opt/conda/lib/python3.7/pickle.py in save_reduce(self, func, args, state, listitems, dictitems, obj)
636 else:
637 save(func)
--> 638 save(args)
639 write(REDUCE)
640
/opt/conda/lib/python3.7/pickle.py in save(self, obj, save_persistent_id)
502 f = self.dispatch.get(t)
503 if f is not None:
--> 504 f(self, obj) # Call unbound method with explicit self
505 return
506
/opt/conda/lib/python3.7/pickle.py in save_tuple(self, obj)
787 write(MARK)
788 for element in obj:
--> 789 save(element)
790
791 if id(obj) in memo:
/opt/conda/lib/python3.7/pickle.py in save(self, obj, save_persistent_id)
502 f = self.dispatch.get(t)
503 if f is not None:
--> 504 f(self, obj) # Call unbound method with explicit self
505 return
506
/opt/conda/lib/python3.7/site-packages/dill/_dill.py in save_module_dict(pickler, obj)
931 # we only care about session the first pass thru
932 pickler._session = False
--> 933 StockPickler.save_dict(pickler, obj)
934 log.info("# D2")
935 return
/opt/conda/lib/python3.7/pickle.py in save_dict(self, obj)
857
858 self.memoize(obj)
--> 859 self._batch_setitems(obj.items())
860
861 dispatch[dict] = save_dict
/opt/conda/lib/python3.7/pickle.py in _batch_setitems(self, items)
883 for k, v in tmp:
884 save(k)
--> 885 save(v)
886 write(SETITEMS)
887 elif n:
/opt/conda/lib/python3.7/pickle.py in save(self, obj, save_persistent_id)
547
548 # Save the reduce() output and finally memoize the object
--> 549 self.save_reduce(obj=obj, *rv)
550
551 def persistent_id(self, obj):
/opt/conda/lib/python3.7/pickle.py in save_reduce(self, func, args, state, listitems, dictitems, obj)
660
661 if state is not None:
--> 662 save(state)
663 write(BUILD)
664
/opt/conda/lib/python3.7/pickle.py in save(self, obj, save_persistent_id)
502 f = self.dispatch.get(t)
503 if f is not None:
--> 504 f(self, obj) # Call unbound method with explicit self
505 return
506
/opt/conda/lib/python3.7/site-packages/dill/_dill.py in save_module_dict(pickler, obj)
931 # we only care about session the first pass thru
932 pickler._session = False
--> 933 StockPickler.save_dict(pickler, obj)
934 log.info("# D2")
935 return
/opt/conda/lib/python3.7/pickle.py in save_dict(self, obj)
857
858 self.memoize(obj)
--> 859 self._batch_setitems(obj.items())
860
861 dispatch[dict] = save_dict
/opt/conda/lib/python3.7/pickle.py in _batch_setitems(self, items)
883 for k, v in tmp:
884 save(k)
--> 885 save(v)
886 write(SETITEMS)
887 elif n:
/opt/conda/lib/python3.7/pickle.py in save(self, obj, save_persistent_id)
547
548 # Save the reduce() output and finally memoize the object
--> 549 self.save_reduce(obj=obj, *rv)
550
551 def persistent_id(self, obj):
/opt/conda/lib/python3.7/pickle.py in save_reduce(self, func, args, state, listitems, dictitems, obj)
660
661 if state is not None:
--> 662 save(state)
663 write(BUILD)
664
/opt/conda/lib/python3.7/pickle.py in save(self, obj, save_persistent_id)
502 f = self.dispatch.get(t)
503 if f is not None:
--> 504 f(self, obj) # Call unbound method with explicit self
505 return
506
/opt/conda/lib/python3.7/site-packages/dill/_dill.py in save_module_dict(pickler, obj)
931 # we only care about session the first pass thru
932 pickler._session = False
--> 933 StockPickler.save_dict(pickler, obj)
934 log.info("# D2")
935 return
/opt/conda/lib/python3.7/pickle.py in save_dict(self, obj)
857
858 self.memoize(obj)
--> 859 self._batch_setitems(obj.items())
860
861 dispatch[dict] = save_dict
/opt/conda/lib/python3.7/pickle.py in _batch_setitems(self, items)
883 for k, v in tmp:
884 save(k)
--> 885 save(v)
886 write(SETITEMS)
887 elif n:
/opt/conda/lib/python3.7/pickle.py in save(self, obj, save_persistent_id)
522 reduce = getattr(obj, "__reduce_ex__", None)
523 if reduce is not None:
--> 524 rv = reduce(self.proto)
525 else:
526 reduce = getattr(obj, "__reduce__", None)
TypeError: can't pickle Tokenizer objects
```
| 22 | runing dataset.map, it raises TypeError: can't pickle Tokenizer objects
I load squad dataset. Then want to process data use following function with `Huggingface Transformers LongformerTokenizer`.
```
def convert_to_features(example):
# Tokenize contexts and questions (as pairs of inputs)
input_pairs = [example['question'], example['context']]
encodings = tokenizer.encode_plus(input_pairs, pad_to_max_length=True, max_length=512)
context_encodings = tokenizer.encode_plus(example['context'])
# Compute start and end tokens for labels using Transformers's fast tokenizers alignement methodes.
# this will give us the position of answer span in the context text
start_idx, end_idx = get_correct_alignement(example['context'], example['answers'])
start_positions_context = context_encodings.char_to_token(start_idx)
end_positions_context = context_encodings.char_to_token(end_idx-1)
# here we will compute the start and end position of the answer in the whole example
# as the example is encoded like this <s> question</s></s> context</s>
# and we know the postion of the answer in the context
# we can just find out the index of the sep token and then add that to position + 1 (+1 because there are two sep tokens)
# this will give us the position of the answer span in whole example
sep_idx = encodings['input_ids'].index(tokenizer.sep_token_id)
start_positions = start_positions_context + sep_idx + 1
end_positions = end_positions_context + sep_idx + 1
if end_positions > 512:
start_positions, end_positions = 0, 0
encodings.update({'start_positions': start_positions,
'end_positions': end_positions,
'attention_mask': encodings['attention_mask']})
return encodings
```
Then I run `dataset.map(convert_to_features)`, it raise
```
In [59]: a.map(convert_to_features)
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-59-c453b508761d> in <module>
----> 1 a.map(convert_to_features)
/opt/conda/lib/python3.7/site-packages/datasets/arrow_dataset.py in map(self, function, with_indices, input_columns, batched, batch_size, drop_last_batch, remove_columns, keep_in_memory, load_from_cache_file, cache_file_name, writer_batch_size, features, disable_nullable, fn_kwargs, num_proc, suffix_template, new_fingerprint)
1242 fn_kwargs=fn_kwargs,
1243 new_fingerprint=new_fingerprint,
-> 1244 update_data=update_data,
1245 )
1246 else:
/opt/conda/lib/python3.7/site-packages/datasets/arrow_dataset.py in wrapper(*args, **kwargs)
151 "output_all_columns": self._output_all_columns,
152 }
--> 153 out: Union["Dataset", "DatasetDict"] = func(self, *args, **kwargs)
154 if new_format["columns"] is not None:
155 new_format["columns"] = list(set(new_format["columns"]) & set(out.column_names))
/opt/conda/lib/python3.7/site-packages/datasets/fingerprint.py in wrapper(*args, **kwargs)
156 kwargs_for_fingerprint["fingerprint_name"] = fingerprint_name
157 kwargs[fingerprint_name] = update_fingerprint(
--> 158 self._fingerprint, transform, kwargs_for_fingerprint
159 )
160
/opt/conda/lib/python3.7/site-packages/datasets/fingerprint.py in update_fingerprint(fingerprint, transform, transform_args)
103 for key in sorted(transform_args):
104 hasher.update(key)
--> 105 hasher.update(transform_args[key])
106 return hasher.hexdigest()
107
/opt/conda/lib/python3.7/site-packages/datasets/fingerprint.py in update(self, value)
55 def update(self, value):
56 self.m.update(f"=={type(value)}==".encode("utf8"))
---> 57 self.m.update(self.hash(value).encode("utf-8"))
58
59 def hexdigest(self):
/opt/conda/lib/python3.7/site-packages/datasets/fingerprint.py in hash(cls, value)
51 return cls.dispatch[type(value)](cls, value)
52 else:
---> 53 return cls.hash_default(value)
54
55 def update(self, value):
/opt/conda/lib/python3.7/site-packages/datasets/fingerprint.py in hash_default(cls, value)
44 @classmethod
45 def hash_default(cls, value):
---> 46 return cls.hash_bytes(dumps(value))
47
48 @classmethod
/opt/conda/lib/python3.7/site-packages/datasets/utils/py_utils.py in dumps(obj)
365 file = StringIO()
366 with _no_cache_fields(obj):
--> 367 dump(obj, file)
368 return file.getvalue()
369
/opt/conda/lib/python3.7/site-packages/datasets/utils/py_utils.py in dump(obj, file)
337 def dump(obj, file):
338 """pickle an object to a file"""
--> 339 Pickler(file, recurse=True).dump(obj)
340 return
341
/opt/conda/lib/python3.7/site-packages/dill/_dill.py in dump(self, obj)
444 raise PicklingError(msg)
445 else:
--> 446 StockPickler.dump(self, obj)
447 stack.clear() # clear record of 'recursion-sensitive' pickled objects
448 return
/opt/conda/lib/python3.7/pickle.py in dump(self, obj)
435 if self.proto >= 4:
436 self.framer.start_framing()
--> 437 self.save(obj)
438 self.write(STOP)
439 self.framer.end_framing()
/opt/conda/lib/python3.7/pickle.py in save(self, obj, save_persistent_id)
502 f = self.dispatch.get(t)
503 if f is not None:
--> 504 f(self, obj) # Call unbound method with explicit self
505 return
506
/opt/conda/lib/python3.7/site-packages/dill/_dill.py in save_function(pickler, obj)
1436 globs, obj.__name__,
1437 obj.__defaults__, obj.__closure__,
-> 1438 obj.__dict__, fkwdefaults), obj=obj)
1439 else:
1440 _super = ('super' in getattr(obj.func_code,'co_names',())) and (_byref is not None) and getattr(pickler, '_recurse', False)
/opt/conda/lib/python3.7/pickle.py in save_reduce(self, func, args, state, listitems, dictitems, obj)
636 else:
637 save(func)
--> 638 save(args)
639 write(REDUCE)
640
/opt/conda/lib/python3.7/pickle.py in save(self, obj, save_persistent_id)
502 f = self.dispatch.get(t)
503 if f is not None:
--> 504 f(self, obj) # Call unbound method with explicit self
505 return
506
/opt/conda/lib/python3.7/pickle.py in save_tuple(self, obj)
787 write(MARK)
788 for element in obj:
--> 789 save(element)
790
791 if id(obj) in memo:
/opt/conda/lib/python3.7/pickle.py in save(self, obj, save_persistent_id)
502 f = self.dispatch.get(t)
503 if f is not None:
--> 504 f(self, obj) # Call unbound method with explicit self
505 return
506
/opt/conda/lib/python3.7/site-packages/dill/_dill.py in save_module_dict(pickler, obj)
931 # we only care about session the first pass thru
932 pickler._session = False
--> 933 StockPickler.save_dict(pickler, obj)
934 log.info("# D2")
935 return
/opt/conda/lib/python3.7/pickle.py in save_dict(self, obj)
857
858 self.memoize(obj)
--> 859 self._batch_setitems(obj.items())
860
861 dispatch[dict] = save_dict
/opt/conda/lib/python3.7/pickle.py in _batch_setitems(self, items)
883 for k, v in tmp:
884 save(k)
--> 885 save(v)
886 write(SETITEMS)
887 elif n:
/opt/conda/lib/python3.7/pickle.py in save(self, obj, save_persistent_id)
547
548 # Save the reduce() output and finally memoize the object
--> 549 self.save_reduce(obj=obj, *rv)
550
551 def persistent_id(self, obj):
/opt/conda/lib/python3.7/pickle.py in save_reduce(self, func, args, state, listitems, dictitems, obj)
660
661 if state is not None:
--> 662 save(state)
663 write(BUILD)
664
/opt/conda/lib/python3.7/pickle.py in save(self, obj, save_persistent_id)
502 f = self.dispatch.get(t)
503 if f is not None:
--> 504 f(self, obj) # Call unbound method with explicit self
505 return
506
/opt/conda/lib/python3.7/site-packages/dill/_dill.py in save_module_dict(pickler, obj)
931 # we only care about session the first pass thru
932 pickler._session = False
--> 933 StockPickler.save_dict(pickler, obj)
934 log.info("# D2")
935 return
/opt/conda/lib/python3.7/pickle.py in save_dict(self, obj)
857
858 self.memoize(obj)
--> 859 self._batch_setitems(obj.items())
860
861 dispatch[dict] = save_dict
/opt/conda/lib/python3.7/pickle.py in _batch_setitems(self, items)
883 for k, v in tmp:
884 save(k)
--> 885 save(v)
886 write(SETITEMS)
887 elif n:
/opt/conda/lib/python3.7/pickle.py in save(self, obj, save_persistent_id)
547
548 # Save the reduce() output and finally memoize the object
--> 549 self.save_reduce(obj=obj, *rv)
550
551 def persistent_id(self, obj):
/opt/conda/lib/python3.7/pickle.py in save_reduce(self, func, args, state, listitems, dictitems, obj)
660
661 if state is not None:
--> 662 save(state)
663 write(BUILD)
664
/opt/conda/lib/python3.7/pickle.py in save(self, obj, save_persistent_id)
502 f = self.dispatch.get(t)
503 if f is not None:
--> 504 f(self, obj) # Call unbound method with explicit self
505 return
506
/opt/conda/lib/python3.7/site-packages/dill/_dill.py in save_module_dict(pickler, obj)
931 # we only care about session the first pass thru
932 pickler._session = False
--> 933 StockPickler.save_dict(pickler, obj)
934 log.info("# D2")
935 return
/opt/conda/lib/python3.7/pickle.py in save_dict(self, obj)
857
858 self.memoize(obj)
--> 859 self._batch_setitems(obj.items())
860
861 dispatch[dict] = save_dict
/opt/conda/lib/python3.7/pickle.py in _batch_setitems(self, items)
883 for k, v in tmp:
884 save(k)
--> 885 save(v)
886 write(SETITEMS)
887 elif n:
/opt/conda/lib/python3.7/pickle.py in save(self, obj, save_persistent_id)
522 reduce = getattr(obj, "__reduce_ex__", None)
523 if reduce is not None:
--> 524 rv = reduce(self.proto)
525 else:
526 reduce = getattr(obj, "__reduce__", None)
TypeError: can't pickle Tokenizer objects
```
Hi !
It works on my side with both the LongFormerTokenizer and the LongFormerTokenizerFast.
Which version of transformers/datasets are you using ? | [
-0.2387792468070984,
-0.29784899950027466,
-0.01968042179942131,
0.23303498327732086,
0.4450329542160034,
-0.1729922890663147,
0.285151869058609,
0.1309390813112259,
-0.27609169483184814,
0.11031325161457062,
-0.06978636234998703,
0.4891909956932068,
-0.008726135827600956,
-0.04673432186245918,
-0.14570960402488708,
-0.11147376894950867,
0.053560320287942886,
0.20785319805145264,
0.01811389997601509,
-0.0561075396835804,
-0.27878260612487793,
0.2074422836303711,
-0.4731772541999817,
0.1585230827331543,
-0.2825991213321686,
-0.26742836833000183,
0.10640472173690796,
-0.1985800564289093,
-0.2693116068840027,
-0.3823219835758209,
-0.14364492893218994,
-0.07336577773094177,
-0.02884814143180847,
0.563336968421936,
-0.00011926037404919043,
0.0994180291891098,
0.1089542955160141,
-0.145972341299057,
0.005223780870437622,
-0.04956597089767456,
-0.07480692863464355,
-0.3035498261451721,
-0.2058742642402649,
-0.458272784948349,
-0.15564605593681335,
-0.14384402334690094,
0.01115584559738636,
-0.332488477230072,
0.5145230889320374,
0.29142072796821594,
0.1399780958890915,
0.49322691559791565,
0.020635265856981277,
0.0532786101102829,
0.01532786339521408,
0.029823776334524155,
-0.13145363330841064,
-0.2608633041381836,
0.1487918347120285,
0.21654660999774933,
-0.130271315574646,
0.32548898458480835,
-0.1613031029701233,
-0.2627820670604706,
0.09947003424167633,
0.0949372872710228,
0.10411272197961807,
-0.4675593674182892,
0.32304832339286804,
-0.0021582134068012238,
0.21897175908088684,
-0.0208103209733963,
-0.2567599415779114,
-0.2679678201675415,
-0.07948525995016098,
0.0625915676355362,
-0.04125243425369263,
-0.20221516489982605,
0.0776134580373764,
0.05128606781363487,
-0.35269349813461304,
-0.17235323786735535,
-0.17987319827079773,
0.10823331773281097,
0.038386598229408264,
0.3674837648868561,
-0.26661092042922974,
0.29305195808410645,
0.09679804742336273,
-0.25016647577285767,
-0.11382152140140533,
-0.09912005811929703,
0.22644498944282532,
0.47687241435050964,
-0.3883419334888458,
-0.300885945558548,
-0.09438016265630722,
-0.40999895334243774,
0.34774601459503174,
-0.03840678930282593,
-0.22767992317676544,
0.25541263818740845,
-0.04895595833659172,
0.1893790066242218,
0.02317630872130394,
0.3520207107067108,
0.26322129368782043,
0.3699648678302765,
0.011672910302877426,
-0.1440165638923645,
0.06525957584381104,
-0.048873476684093475,
-0.08222289383411407,
-0.22157606482505798,
-0.05691240727901459,
0.2582862079143524,
0.35951292514801025,
-0.018613029271364212,
-0.046238239854574203,
0.02786199375987053,
-0.22628015279769897,
0.0427437499165535,
0.17346373200416565,
0.4068899154663086,
0.10801348090171814,
0.23184126615524292,
-0.31838929653167725,
0.09024085104465485,
-0.12427999824285507,
0.025306612253189087,
-0.16548646986484528,
0.21402311325073242,
-0.006621330976486206,
-0.13937939703464508,
-0.16431912779808044,
0.0698126032948494,
0.20134250819683075,
-0.026837512850761414,
0.0632021501660347,
-0.22027723491191864,
0.06153841316699982,
-0.17903092503547668,
0.2758256494998932,
-0.09431135654449463,
-0.050224341452121735,
0.17375634610652924,
0.20817093551158905,
-0.40948057174682617,
-0.20605650544166565,
0.035232916474342346,
-0.3411520719528198,
0.017331700772047043,
0.13118889927864075,
0.1185407042503357,
0.05623745918273926,
0.04769054800271988,
-0.3749629259109497,
0.2920551896095276,
0.41460344195365906,
0.007591649889945984,
0.03226820379495621,
-0.12673820555210114,
-0.2016417384147644,
-0.11112698912620544,
0.21824829280376434,
0.18993636965751648,
-0.1373288482427597,
-0.20797701179981232,
0.2503730058670044,
-0.0020624157041311264,
0.15356677770614624,
0.4049595594406128,
-0.05302755907177925,
0.25622016191482544,
-0.14678503572940826,
0.5597744584083557,
0.4704824388027191,
-0.625508189201355,
-0.5309314131736755,
0.10321839153766632,
-0.4468843936920166,
-0.1779436618089676,
-0.03534664958715439,
0.041638411581516266,
0.5613892078399658,
0.12415531277656555,
-0.1132064014673233,
0.3392552137374878,
0.07229578495025635,
0.2676008641719818,
-0.15639422833919525,
-0.14152976870536804,
0.40929919481277466,
0.09268194437026978,
0.21709808707237244,
0.11648884415626526,
-0.16825279593467712,
0.19713763892650604,
-0.10224737972021103,
-0.1236945390701294,
0.09144434332847595,
0.19020487368106842,
0.16542726755142212,
-0.21081383526325226,
0.08061237633228302,
-0.16297811269760132,
-0.5545790791511536,
0.06518654525279999,
-0.34768620133399963,
0.2234152853488922,
-0.28904998302459717,
-0.1947721689939499,
-0.28876471519470215,
0.15413497388362885,
-0.45191892981529236,
-0.052400071173906326,
0.0838475450873375,
-0.03061482310295105,
0.18893752992153168,
-0.013604627922177315,
0.019288551062345505,
-0.07614041119813919,
0.1458209604024887,
0.18609404563903809,
-0.2552468478679657,
0.20620331168174744,
-0.2569340169429779,
0.02114827185869217,
-0.05973024666309357,
0.09906291961669922,
0.4085010886192322,
-0.17598335444927216,
-0.2551455497741699,
0.2755492031574249,
0.17205199599266052,
-0.08486801385879517,
-0.05005958676338196,
-0.03503546118736267,
0.2658097743988037,
-0.20969520509243011,
-0.06440680474042892,
0.1785881519317627,
0.16671858727931976,
-0.02876027673482895,
-0.09293530136346817,
0.4431660771369934,
0.2247035801410675,
0.31786227226257324,
-0.01910526677966118,
0.1625133454799652,
0.24128490686416626,
-0.10274730622768402,
-0.04649505019187927,
-0.13554337620735168,
-0.17649294435977936,
0.0628637820482254,
0.23403991758823395,
-0.07365301996469498,
0.06564219295978546,
-0.059074871242046356,
0.8479932546615601,
-0.06834638118743896,
0.07938273996114731,
0.2044738531112671,
-0.11635082215070724,
0.049705870449543,
-0.07888424396514893,
-0.40181025862693787,
0.04173742234706879,
0.03922862559556961,
-0.17348940670490265,
-0.10662073642015457,
0.2546636462211609,
0.14594495296478271,
0.041524969041347504,
0.3150503635406494,
0.11469598859548569,
0.225544273853302,
0.15998724102973938,
0.11295114457607269,
-0.17203378677368164,
-0.19414323568344116,
0.16297325491905212,
0.1452348679304123,
-0.14686189591884613,
-0.024431999772787094,
-0.04605673998594284,
0.044477060437202454,
0.010470712557435036,
-0.04867228865623474,
-0.19503360986709595,
-0.250466912984848,
0.03378954157233238,
-0.023758497089147568,
0.09573529660701752,
0.449554979801178,
0.3668549656867981,
0.3240298628807068,
0.4278208613395691,
-0.10992073267698288,
-0.1704414188861847,
-0.19697964191436768,
-0.08769410103559494,
-0.06773465126752853,
0.1707262545824051,
-0.00535688316449523,
-0.03574804961681366,
0.010384462773799896,
0.10249228775501251,
-0.45612791180610657,
-0.4291422665119171,
0.2537456154823303,
-0.17828468978405,
0.1860090047121048,
-0.014134995639324188,
0.12101293355226517,
-0.3429492712020874,
-0.2921084761619568,
0.2118503600358963,
-0.21941320598125458,
-0.30137452483177185,
0.07068181037902832,
-0.061088766902685165,
-0.3209868371486664,
0.05117690935730934,
-0.24058660864830017,
-0.3765723705291748,
-0.33769187331199646,
0.3630162477493286,
-0.008248493075370789,
0.1135793924331665,
0.15415820479393005,
-0.00302607798948884,
0.2885194420814514,
-0.020071396604180336,
-0.035907477140426636,
-0.24400143325328827,
0.054305534809827805,
0.4122081995010376,
-0.18261869251728058,
-0.2826859652996063,
-0.39157694578170776,
-0.17591607570648193,
0.05257883667945862,
-0.12937913835048676,
-0.10209265351295471,
-0.22754734754562378,
-0.2711943984031677,
0.22384607791900635,
-0.16086310148239136,
0.045888230204582214,
0.5580427646636963,
-0.049236368387937546,
0.09076553583145142,
0.01156727597117424,
-0.16093182563781738,
0.27200356125831604,
0.1358187049627304,
0.081289142370224,
-0.010779760777950287,
0.5259879231452942,
0.1519598662853241,
0.8704360127449036,
0.15821492671966553,
-0.21943803131580353,
0.16835519671440125,
-0.14850348234176636,
-0.01063704863190651,
-0.03405507653951645,
-0.38928478956222534,
0.1844978630542755,
-0.04435047507286072,
0.12260723114013672,
0.13958825170993805,
-0.20949199795722961,
-0.15563496947288513,
0.14549137651920319,
-0.09472277760505676,
-0.218725323677063,
-0.27573642134666443,
-0.022572895511984825,
0.09790511429309845,
0.09834414720535278,
0.04776653274893761,
0.1866316795349121,
-0.44355639815330505,
0.06796005368232727,
0.11922764778137207,
0.004403114318847656,
0.048046551644802094,
-0.04683779925107956,
-1.0162560939788818,
-0.09132109582424164,
-0.17027941346168518,
0.36549264192581177,
0.22949711978435516,
0.4982428550720215,
-0.017992455512285233,
-0.04699508473277092,
0.05150580406188965,
-0.21210986375808716,
0.8495116829872131,
0.2505570650100708,
-0.05321195721626282,
0.07962740957736969,
0.018949035555124283,
-0.15455107390880585,
0.057700660079717636,
-0.16324123740196228,
0.6255757212638855,
0.4945645332336426,
0.7852731943130493,
-0.43740472197532654,
-0.08937069773674011,
0.031204042956233025,
-0.059960100799798965,
-0.1476590782403946,
0.08103042095899582,
-0.2087637037038803,
-0.180411696434021,
-0.5762062072753906,
0.25856703519821167,
0.28101325035095215,
0.19283361732959747,
0.15283092856407166,
-0.22316685318946838,
0.06901504844427109,
-0.28400319814682007,
-0.0985405296087265,
0.23120428621768951,
0.21433523297309875,
0.18589964509010315,
-0.0022402051836252213,
0.1455385386943817,
-0.1561146229505539,
-0.20688201487064362,
0.18994294106960297,
0.25589486956596375,
-0.6231854557991028,
0.2523166835308075,
0.16514982283115387,
0.5603795051574707,
0.15823112428188324,
-0.11502523720264435,
0.29464662075042725,
-0.01051352545619011,
0.47939586639404297,
-0.03906324505805969,
0.47881969809532166,
0.36262446641921997,
0.27784213423728943,
-0.301658570766449,
-0.13845354318618774,
0.38594749569892883,
-0.015479073859751225,
0.07214416563510895,
0.015306081622838974,
0.26423370838165283,
-0.15237964689731598,
0.5785444974899292,
0.10501522570848465,
1.0689465999603271,
-0.09628941118717194,
-0.09116224944591522,
0.12688452005386353,
0.26558351516723633,
0.5600724220275879,
-0.2914607524871826,
0.20523881912231445,
-0.5174928307533264,
-0.09049858152866364,
0.004256146028637886,
-0.13982944190502167,
0.13500869274139404,
0.18870440125465393,
-0.43005746603012085,
0.13892552256584167,
0.09927932918071747,
0.4275941550731659,
0.0399220809340477,
0.41344207525253296,
-0.01810356043279171,
-0.47711026668548584,
-0.12599581480026245,
0.06626572459936142,
-0.2162787765264511,
0.2179781198501587,
0.09313574433326721,
0.016773607581853867,
-0.22999055683612823,
-0.33340728282928467,
-0.06853975355625153,
0.08772076666355133,
-0.3980344831943512,
0.6731892228126526,
0.3429543673992157,
-0.19453462958335876,
0.29567334055900574,
0.2294493168592453,
0.15479309856891632,
0.2516958713531494,
-0.06370928883552551,
0.16826605796813965,
0.14975035190582275,
-0.0029831882566213608,
0.19938354194164276,
-0.06823351979255676,
0.11906512826681137,
-0.010318662971258163,
-0.10151160508394241,
0.175491064786911,
-0.012460781261324883,
-0.2762168347835541,
-0.2717879116535187,
-0.12400531768798828,
0.290338397026062,
-0.3395358622074127,
-0.2814115583896637,
-0.039557285606861115,
-0.28503528237342834,
-0.20351310074329376,
0.022034604102373123,
-0.07065904140472412,
-0.374799519777298,
0.22638219594955444,
0.23766908049583435,
-0.14269255101680756,
0.16958646476268768,
0.3712310492992401,
-0.025501083582639694,
-0.0888265073299408,
0.5584914684295654,
0.0715673416852951,
-0.19460977613925934,
-0.2024843990802765,
0.15187907218933105,
-0.033778805285692215,
-0.22719457745552063,
0.10915811359882355,
-0.1162661463022232,
-0.2636433243751526,
-0.22879533469676971,
0.3435634970664978,
-0.025700241327285767,
0.04026198014616966,
-0.2143467515707016,
-0.4193451404571533,
-0.5076627731323242,
0.049949295818805695,
-0.13119997084140778,
0.18116499483585358,
0.4385978579521179,
0.40800604224205017,
-0.25686928629875183,
0.3760196566581726,
-0.2495919018983841,
-0.08002421259880066,
-0.5987672805786133,
0.2662302255630493,
0.01884259283542633,
-0.5459761619567871,
-0.027553904801607132,
0.02164069376885891,
0.026443468406796455,
0.294058620929718,
-0.12007908523082733,
-0.15881237387657166,
-0.07026086002588272,
0.16056318581104279,
0.2280811369419098,
-0.10137251019477844,
-0.2458610236644745,
0.11841046810150146,
-0.17929944396018982,
-0.15681114792823792,
0.1025065928697586,
0.1319531500339508,
0.012163061648607254,
0.12355339527130127,
-0.09083551168441772,
-0.11700523644685745,
-0.05135424807667732,
-0.08652322739362717,
0.04924800619482994,
-0.15517960488796234,
0.2005685269832611,
0.38877812027931213,
-0.19008755683898926,
-0.009076409041881561,
-0.29091838002204895,
0.17954382300376892,
0.6930253505706787,
0.009677674621343613,
0.3933945298194885,
-0.31458789110183716,
-0.15080979466438293,
0.22921109199523926,
-0.20730316638946533,
0.18506640195846558,
-0.3238910436630249,
-0.09588629007339478,
0.22866439819335938,
0.12948498129844666,
-0.2605692744255066,
-0.20624437928199768,
0.5028800368309021,
-0.3981369435787201,
0.1572275012731552,
0.12966448068618774,
-0.09836220741271973,
0.2678849697113037,
0.18320630490779877,
0.1603044867515564,
0.7458080649375916,
0.011786268092691898,
0.17655035853385925,
-0.06224888935685158,
-0.09200140088796616,
0.05511584132909775,
0.5123581290245056,
0.13516101241111755,
0.2308288961648941,
0.11014201492071152,
-0.20327258110046387,
0.37733936309814453,
-0.42855411767959595,
0.2233327180147171,
0.36982885003089905,
-0.12526848912239075,
-0.19376134872436523,
0.20874705910682678,
-0.14037078619003296,
0.2644398808479309,
-0.04349501430988312,
0.35226011276245117,
-0.1093691885471344,
-0.17406626045703888,
-0.16872172057628632,
0.49048706889152527,
-0.3190309703350067,
-0.049097366631031036,
-0.021232690662145615,
-0.07593855261802673,
-0.1959420144557953,
-0.28567615151405334,
0.050842709839344025,
-0.06166030466556549,
0.10977569967508316,
0.015786856412887573,
-0.08042746782302856,
0.2032719999551773,
-0.14787951111793518,
0.17750829458236694,
0.24254110455513,
-0.32913538813591003,
0.2424011528491974,
0.1096196249127388,
0.2629409432411194,
-0.24783456325531006,
0.11491469293832779,
0.3023820221424103,
0.26866012811660767,
-0.4128156304359436,
0.1197531670331955,
-0.061437491327524185,
-0.15522582828998566,
0.15395838022232056,
0.1354498416185379,
-0.1843048334121704,
-0.21929125487804413,
0.23018088936805725,
0.07787932455539703,
-0.2095593959093094,
-0.17226456105709076,
0.1902216076850891,
0.10927625000476837,
0.1233893632888794,
-0.049729399383068085,
-0.08056873083114624,
-0.20539340376853943,
-0.3169712722301483,
-0.17713499069213867,
-0.39904630184173584,
-0.04866921156644821,
0.08204156160354614,
-0.23340527713298798,
0.2352660596370697,
-0.306997686624527,
0.08067841082811356,
0.08235998451709747,
0.36441871523857117,
0.31551843881607056,
0.08895154297351837,
-0.3957797884941101,
-0.02335897833108902,
-0.40491533279418945,
0.21320071816444397,
0.30975788831710815,
-0.19389264285564423,
0.08527778834104538,
0.1949712485074997,
0.06053662300109863,
0.31443339586257935,
-0.10639722645282745,
0.057046450674533844,
-0.13181345164775848,
-0.006787165999412537,
-0.21990114450454712,
0.13424824178218842,
-0.16535654664039612,
0.1062282919883728,
0.2053379863500595,
-0.3196316957473755,
0.3005921244621277,
0.2335086166858673,
-0.016038425266742706,
-0.20376719534397125,
-0.07318393886089325,
-0.21352843940258026,
-0.3241588771343231,
-0.04828055948019028,
0.2011154741048813,
0.2985321581363678,
-0.28266650438308716,
0.18013443052768707,
0.20976580679416656,
-0.043841224163770676,
-0.2875528335571289,
-0.19312211871147156,
0.15643532574176788,
0.4927528202533722,
-0.0002095801755785942,
0.12636980414390564,
-0.3023885190486908,
-0.17570357024669647,
0.08756741881370544,
-0.28133371472358704,
-0.24230000376701355,
0.33336523175239563,
-0.20570093393325806,
0.1753343790769577,
-0.014726635068655014,
0.21862280368804932,
0.07085446268320084,
0.28340816497802734,
-0.24533317983150482,
-0.45495712757110596,
0.6601229906082153,
-0.4289315640926361,
-0.48007938265800476,
-0.05626486986875534,
-0.06597250699996948,
0.13737857341766357,
-0.2057526409626007,
-0.2559032440185547,
-0.15045183897018433,
0.2913421094417572,
0.08456270396709442,
-0.20066991448402405,
0.05188633129000664,
0.15546011924743652,
-0.03583145514130592,
-0.150189608335495,
0.3721500039100647,
0.12918761372566223,
0.06289525330066681,
0.10387624800205231,
-0.2139434814453125
] |
https://github.com/huggingface/datasets/issues/665 | runing dataset.map, it raises TypeError: can't pickle Tokenizer objects | Then I guess you need to give us more informations on your setup (OS, python, GPU, etc) or a Google Colab reproducing the error for us to be able to debug this error. | I load squad dataset. Then want to process data use following function with `Huggingface Transformers LongformerTokenizer`.
```
def convert_to_features(example):
# Tokenize contexts and questions (as pairs of inputs)
input_pairs = [example['question'], example['context']]
encodings = tokenizer.encode_plus(input_pairs, pad_to_max_length=True, max_length=512)
context_encodings = tokenizer.encode_plus(example['context'])
# Compute start and end tokens for labels using Transformers's fast tokenizers alignement methodes.
# this will give us the position of answer span in the context text
start_idx, end_idx = get_correct_alignement(example['context'], example['answers'])
start_positions_context = context_encodings.char_to_token(start_idx)
end_positions_context = context_encodings.char_to_token(end_idx-1)
# here we will compute the start and end position of the answer in the whole example
# as the example is encoded like this <s> question</s></s> context</s>
# and we know the postion of the answer in the context
# we can just find out the index of the sep token and then add that to position + 1 (+1 because there are two sep tokens)
# this will give us the position of the answer span in whole example
sep_idx = encodings['input_ids'].index(tokenizer.sep_token_id)
start_positions = start_positions_context + sep_idx + 1
end_positions = end_positions_context + sep_idx + 1
if end_positions > 512:
start_positions, end_positions = 0, 0
encodings.update({'start_positions': start_positions,
'end_positions': end_positions,
'attention_mask': encodings['attention_mask']})
return encodings
```
Then I run `dataset.map(convert_to_features)`, it raise
```
In [59]: a.map(convert_to_features)
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-59-c453b508761d> in <module>
----> 1 a.map(convert_to_features)
/opt/conda/lib/python3.7/site-packages/datasets/arrow_dataset.py in map(self, function, with_indices, input_columns, batched, batch_size, drop_last_batch, remove_columns, keep_in_memory, load_from_cache_file, cache_file_name, writer_batch_size, features, disable_nullable, fn_kwargs, num_proc, suffix_template, new_fingerprint)
1242 fn_kwargs=fn_kwargs,
1243 new_fingerprint=new_fingerprint,
-> 1244 update_data=update_data,
1245 )
1246 else:
/opt/conda/lib/python3.7/site-packages/datasets/arrow_dataset.py in wrapper(*args, **kwargs)
151 "output_all_columns": self._output_all_columns,
152 }
--> 153 out: Union["Dataset", "DatasetDict"] = func(self, *args, **kwargs)
154 if new_format["columns"] is not None:
155 new_format["columns"] = list(set(new_format["columns"]) & set(out.column_names))
/opt/conda/lib/python3.7/site-packages/datasets/fingerprint.py in wrapper(*args, **kwargs)
156 kwargs_for_fingerprint["fingerprint_name"] = fingerprint_name
157 kwargs[fingerprint_name] = update_fingerprint(
--> 158 self._fingerprint, transform, kwargs_for_fingerprint
159 )
160
/opt/conda/lib/python3.7/site-packages/datasets/fingerprint.py in update_fingerprint(fingerprint, transform, transform_args)
103 for key in sorted(transform_args):
104 hasher.update(key)
--> 105 hasher.update(transform_args[key])
106 return hasher.hexdigest()
107
/opt/conda/lib/python3.7/site-packages/datasets/fingerprint.py in update(self, value)
55 def update(self, value):
56 self.m.update(f"=={type(value)}==".encode("utf8"))
---> 57 self.m.update(self.hash(value).encode("utf-8"))
58
59 def hexdigest(self):
/opt/conda/lib/python3.7/site-packages/datasets/fingerprint.py in hash(cls, value)
51 return cls.dispatch[type(value)](cls, value)
52 else:
---> 53 return cls.hash_default(value)
54
55 def update(self, value):
/opt/conda/lib/python3.7/site-packages/datasets/fingerprint.py in hash_default(cls, value)
44 @classmethod
45 def hash_default(cls, value):
---> 46 return cls.hash_bytes(dumps(value))
47
48 @classmethod
/opt/conda/lib/python3.7/site-packages/datasets/utils/py_utils.py in dumps(obj)
365 file = StringIO()
366 with _no_cache_fields(obj):
--> 367 dump(obj, file)
368 return file.getvalue()
369
/opt/conda/lib/python3.7/site-packages/datasets/utils/py_utils.py in dump(obj, file)
337 def dump(obj, file):
338 """pickle an object to a file"""
--> 339 Pickler(file, recurse=True).dump(obj)
340 return
341
/opt/conda/lib/python3.7/site-packages/dill/_dill.py in dump(self, obj)
444 raise PicklingError(msg)
445 else:
--> 446 StockPickler.dump(self, obj)
447 stack.clear() # clear record of 'recursion-sensitive' pickled objects
448 return
/opt/conda/lib/python3.7/pickle.py in dump(self, obj)
435 if self.proto >= 4:
436 self.framer.start_framing()
--> 437 self.save(obj)
438 self.write(STOP)
439 self.framer.end_framing()
/opt/conda/lib/python3.7/pickle.py in save(self, obj, save_persistent_id)
502 f = self.dispatch.get(t)
503 if f is not None:
--> 504 f(self, obj) # Call unbound method with explicit self
505 return
506
/opt/conda/lib/python3.7/site-packages/dill/_dill.py in save_function(pickler, obj)
1436 globs, obj.__name__,
1437 obj.__defaults__, obj.__closure__,
-> 1438 obj.__dict__, fkwdefaults), obj=obj)
1439 else:
1440 _super = ('super' in getattr(obj.func_code,'co_names',())) and (_byref is not None) and getattr(pickler, '_recurse', False)
/opt/conda/lib/python3.7/pickle.py in save_reduce(self, func, args, state, listitems, dictitems, obj)
636 else:
637 save(func)
--> 638 save(args)
639 write(REDUCE)
640
/opt/conda/lib/python3.7/pickle.py in save(self, obj, save_persistent_id)
502 f = self.dispatch.get(t)
503 if f is not None:
--> 504 f(self, obj) # Call unbound method with explicit self
505 return
506
/opt/conda/lib/python3.7/pickle.py in save_tuple(self, obj)
787 write(MARK)
788 for element in obj:
--> 789 save(element)
790
791 if id(obj) in memo:
/opt/conda/lib/python3.7/pickle.py in save(self, obj, save_persistent_id)
502 f = self.dispatch.get(t)
503 if f is not None:
--> 504 f(self, obj) # Call unbound method with explicit self
505 return
506
/opt/conda/lib/python3.7/site-packages/dill/_dill.py in save_module_dict(pickler, obj)
931 # we only care about session the first pass thru
932 pickler._session = False
--> 933 StockPickler.save_dict(pickler, obj)
934 log.info("# D2")
935 return
/opt/conda/lib/python3.7/pickle.py in save_dict(self, obj)
857
858 self.memoize(obj)
--> 859 self._batch_setitems(obj.items())
860
861 dispatch[dict] = save_dict
/opt/conda/lib/python3.7/pickle.py in _batch_setitems(self, items)
883 for k, v in tmp:
884 save(k)
--> 885 save(v)
886 write(SETITEMS)
887 elif n:
/opt/conda/lib/python3.7/pickle.py in save(self, obj, save_persistent_id)
547
548 # Save the reduce() output and finally memoize the object
--> 549 self.save_reduce(obj=obj, *rv)
550
551 def persistent_id(self, obj):
/opt/conda/lib/python3.7/pickle.py in save_reduce(self, func, args, state, listitems, dictitems, obj)
660
661 if state is not None:
--> 662 save(state)
663 write(BUILD)
664
/opt/conda/lib/python3.7/pickle.py in save(self, obj, save_persistent_id)
502 f = self.dispatch.get(t)
503 if f is not None:
--> 504 f(self, obj) # Call unbound method with explicit self
505 return
506
/opt/conda/lib/python3.7/site-packages/dill/_dill.py in save_module_dict(pickler, obj)
931 # we only care about session the first pass thru
932 pickler._session = False
--> 933 StockPickler.save_dict(pickler, obj)
934 log.info("# D2")
935 return
/opt/conda/lib/python3.7/pickle.py in save_dict(self, obj)
857
858 self.memoize(obj)
--> 859 self._batch_setitems(obj.items())
860
861 dispatch[dict] = save_dict
/opt/conda/lib/python3.7/pickle.py in _batch_setitems(self, items)
883 for k, v in tmp:
884 save(k)
--> 885 save(v)
886 write(SETITEMS)
887 elif n:
/opt/conda/lib/python3.7/pickle.py in save(self, obj, save_persistent_id)
547
548 # Save the reduce() output and finally memoize the object
--> 549 self.save_reduce(obj=obj, *rv)
550
551 def persistent_id(self, obj):
/opt/conda/lib/python3.7/pickle.py in save_reduce(self, func, args, state, listitems, dictitems, obj)
660
661 if state is not None:
--> 662 save(state)
663 write(BUILD)
664
/opt/conda/lib/python3.7/pickle.py in save(self, obj, save_persistent_id)
502 f = self.dispatch.get(t)
503 if f is not None:
--> 504 f(self, obj) # Call unbound method with explicit self
505 return
506
/opt/conda/lib/python3.7/site-packages/dill/_dill.py in save_module_dict(pickler, obj)
931 # we only care about session the first pass thru
932 pickler._session = False
--> 933 StockPickler.save_dict(pickler, obj)
934 log.info("# D2")
935 return
/opt/conda/lib/python3.7/pickle.py in save_dict(self, obj)
857
858 self.memoize(obj)
--> 859 self._batch_setitems(obj.items())
860
861 dispatch[dict] = save_dict
/opt/conda/lib/python3.7/pickle.py in _batch_setitems(self, items)
883 for k, v in tmp:
884 save(k)
--> 885 save(v)
886 write(SETITEMS)
887 elif n:
/opt/conda/lib/python3.7/pickle.py in save(self, obj, save_persistent_id)
522 reduce = getattr(obj, "__reduce_ex__", None)
523 if reduce is not None:
--> 524 rv = reduce(self.proto)
525 else:
526 reduce = getattr(obj, "__reduce__", None)
TypeError: can't pickle Tokenizer objects
```
| 33 | runing dataset.map, it raises TypeError: can't pickle Tokenizer objects
I load squad dataset. Then want to process data use following function with `Huggingface Transformers LongformerTokenizer`.
```
def convert_to_features(example):
# Tokenize contexts and questions (as pairs of inputs)
input_pairs = [example['question'], example['context']]
encodings = tokenizer.encode_plus(input_pairs, pad_to_max_length=True, max_length=512)
context_encodings = tokenizer.encode_plus(example['context'])
# Compute start and end tokens for labels using Transformers's fast tokenizers alignement methodes.
# this will give us the position of answer span in the context text
start_idx, end_idx = get_correct_alignement(example['context'], example['answers'])
start_positions_context = context_encodings.char_to_token(start_idx)
end_positions_context = context_encodings.char_to_token(end_idx-1)
# here we will compute the start and end position of the answer in the whole example
# as the example is encoded like this <s> question</s></s> context</s>
# and we know the postion of the answer in the context
# we can just find out the index of the sep token and then add that to position + 1 (+1 because there are two sep tokens)
# this will give us the position of the answer span in whole example
sep_idx = encodings['input_ids'].index(tokenizer.sep_token_id)
start_positions = start_positions_context + sep_idx + 1
end_positions = end_positions_context + sep_idx + 1
if end_positions > 512:
start_positions, end_positions = 0, 0
encodings.update({'start_positions': start_positions,
'end_positions': end_positions,
'attention_mask': encodings['attention_mask']})
return encodings
```
Then I run `dataset.map(convert_to_features)`, it raise
```
In [59]: a.map(convert_to_features)
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-59-c453b508761d> in <module>
----> 1 a.map(convert_to_features)
/opt/conda/lib/python3.7/site-packages/datasets/arrow_dataset.py in map(self, function, with_indices, input_columns, batched, batch_size, drop_last_batch, remove_columns, keep_in_memory, load_from_cache_file, cache_file_name, writer_batch_size, features, disable_nullable, fn_kwargs, num_proc, suffix_template, new_fingerprint)
1242 fn_kwargs=fn_kwargs,
1243 new_fingerprint=new_fingerprint,
-> 1244 update_data=update_data,
1245 )
1246 else:
/opt/conda/lib/python3.7/site-packages/datasets/arrow_dataset.py in wrapper(*args, **kwargs)
151 "output_all_columns": self._output_all_columns,
152 }
--> 153 out: Union["Dataset", "DatasetDict"] = func(self, *args, **kwargs)
154 if new_format["columns"] is not None:
155 new_format["columns"] = list(set(new_format["columns"]) & set(out.column_names))
/opt/conda/lib/python3.7/site-packages/datasets/fingerprint.py in wrapper(*args, **kwargs)
156 kwargs_for_fingerprint["fingerprint_name"] = fingerprint_name
157 kwargs[fingerprint_name] = update_fingerprint(
--> 158 self._fingerprint, transform, kwargs_for_fingerprint
159 )
160
/opt/conda/lib/python3.7/site-packages/datasets/fingerprint.py in update_fingerprint(fingerprint, transform, transform_args)
103 for key in sorted(transform_args):
104 hasher.update(key)
--> 105 hasher.update(transform_args[key])
106 return hasher.hexdigest()
107
/opt/conda/lib/python3.7/site-packages/datasets/fingerprint.py in update(self, value)
55 def update(self, value):
56 self.m.update(f"=={type(value)}==".encode("utf8"))
---> 57 self.m.update(self.hash(value).encode("utf-8"))
58
59 def hexdigest(self):
/opt/conda/lib/python3.7/site-packages/datasets/fingerprint.py in hash(cls, value)
51 return cls.dispatch[type(value)](cls, value)
52 else:
---> 53 return cls.hash_default(value)
54
55 def update(self, value):
/opt/conda/lib/python3.7/site-packages/datasets/fingerprint.py in hash_default(cls, value)
44 @classmethod
45 def hash_default(cls, value):
---> 46 return cls.hash_bytes(dumps(value))
47
48 @classmethod
/opt/conda/lib/python3.7/site-packages/datasets/utils/py_utils.py in dumps(obj)
365 file = StringIO()
366 with _no_cache_fields(obj):
--> 367 dump(obj, file)
368 return file.getvalue()
369
/opt/conda/lib/python3.7/site-packages/datasets/utils/py_utils.py in dump(obj, file)
337 def dump(obj, file):
338 """pickle an object to a file"""
--> 339 Pickler(file, recurse=True).dump(obj)
340 return
341
/opt/conda/lib/python3.7/site-packages/dill/_dill.py in dump(self, obj)
444 raise PicklingError(msg)
445 else:
--> 446 StockPickler.dump(self, obj)
447 stack.clear() # clear record of 'recursion-sensitive' pickled objects
448 return
/opt/conda/lib/python3.7/pickle.py in dump(self, obj)
435 if self.proto >= 4:
436 self.framer.start_framing()
--> 437 self.save(obj)
438 self.write(STOP)
439 self.framer.end_framing()
/opt/conda/lib/python3.7/pickle.py in save(self, obj, save_persistent_id)
502 f = self.dispatch.get(t)
503 if f is not None:
--> 504 f(self, obj) # Call unbound method with explicit self
505 return
506
/opt/conda/lib/python3.7/site-packages/dill/_dill.py in save_function(pickler, obj)
1436 globs, obj.__name__,
1437 obj.__defaults__, obj.__closure__,
-> 1438 obj.__dict__, fkwdefaults), obj=obj)
1439 else:
1440 _super = ('super' in getattr(obj.func_code,'co_names',())) and (_byref is not None) and getattr(pickler, '_recurse', False)
/opt/conda/lib/python3.7/pickle.py in save_reduce(self, func, args, state, listitems, dictitems, obj)
636 else:
637 save(func)
--> 638 save(args)
639 write(REDUCE)
640
/opt/conda/lib/python3.7/pickle.py in save(self, obj, save_persistent_id)
502 f = self.dispatch.get(t)
503 if f is not None:
--> 504 f(self, obj) # Call unbound method with explicit self
505 return
506
/opt/conda/lib/python3.7/pickle.py in save_tuple(self, obj)
787 write(MARK)
788 for element in obj:
--> 789 save(element)
790
791 if id(obj) in memo:
/opt/conda/lib/python3.7/pickle.py in save(self, obj, save_persistent_id)
502 f = self.dispatch.get(t)
503 if f is not None:
--> 504 f(self, obj) # Call unbound method with explicit self
505 return
506
/opt/conda/lib/python3.7/site-packages/dill/_dill.py in save_module_dict(pickler, obj)
931 # we only care about session the first pass thru
932 pickler._session = False
--> 933 StockPickler.save_dict(pickler, obj)
934 log.info("# D2")
935 return
/opt/conda/lib/python3.7/pickle.py in save_dict(self, obj)
857
858 self.memoize(obj)
--> 859 self._batch_setitems(obj.items())
860
861 dispatch[dict] = save_dict
/opt/conda/lib/python3.7/pickle.py in _batch_setitems(self, items)
883 for k, v in tmp:
884 save(k)
--> 885 save(v)
886 write(SETITEMS)
887 elif n:
/opt/conda/lib/python3.7/pickle.py in save(self, obj, save_persistent_id)
547
548 # Save the reduce() output and finally memoize the object
--> 549 self.save_reduce(obj=obj, *rv)
550
551 def persistent_id(self, obj):
/opt/conda/lib/python3.7/pickle.py in save_reduce(self, func, args, state, listitems, dictitems, obj)
660
661 if state is not None:
--> 662 save(state)
663 write(BUILD)
664
/opt/conda/lib/python3.7/pickle.py in save(self, obj, save_persistent_id)
502 f = self.dispatch.get(t)
503 if f is not None:
--> 504 f(self, obj) # Call unbound method with explicit self
505 return
506
/opt/conda/lib/python3.7/site-packages/dill/_dill.py in save_module_dict(pickler, obj)
931 # we only care about session the first pass thru
932 pickler._session = False
--> 933 StockPickler.save_dict(pickler, obj)
934 log.info("# D2")
935 return
/opt/conda/lib/python3.7/pickle.py in save_dict(self, obj)
857
858 self.memoize(obj)
--> 859 self._batch_setitems(obj.items())
860
861 dispatch[dict] = save_dict
/opt/conda/lib/python3.7/pickle.py in _batch_setitems(self, items)
883 for k, v in tmp:
884 save(k)
--> 885 save(v)
886 write(SETITEMS)
887 elif n:
/opt/conda/lib/python3.7/pickle.py in save(self, obj, save_persistent_id)
547
548 # Save the reduce() output and finally memoize the object
--> 549 self.save_reduce(obj=obj, *rv)
550
551 def persistent_id(self, obj):
/opt/conda/lib/python3.7/pickle.py in save_reduce(self, func, args, state, listitems, dictitems, obj)
660
661 if state is not None:
--> 662 save(state)
663 write(BUILD)
664
/opt/conda/lib/python3.7/pickle.py in save(self, obj, save_persistent_id)
502 f = self.dispatch.get(t)
503 if f is not None:
--> 504 f(self, obj) # Call unbound method with explicit self
505 return
506
/opt/conda/lib/python3.7/site-packages/dill/_dill.py in save_module_dict(pickler, obj)
931 # we only care about session the first pass thru
932 pickler._session = False
--> 933 StockPickler.save_dict(pickler, obj)
934 log.info("# D2")
935 return
/opt/conda/lib/python3.7/pickle.py in save_dict(self, obj)
857
858 self.memoize(obj)
--> 859 self._batch_setitems(obj.items())
860
861 dispatch[dict] = save_dict
/opt/conda/lib/python3.7/pickle.py in _batch_setitems(self, items)
883 for k, v in tmp:
884 save(k)
--> 885 save(v)
886 write(SETITEMS)
887 elif n:
/opt/conda/lib/python3.7/pickle.py in save(self, obj, save_persistent_id)
522 reduce = getattr(obj, "__reduce_ex__", None)
523 if reduce is not None:
--> 524 rv = reduce(self.proto)
525 else:
526 reduce = getattr(obj, "__reduce__", None)
TypeError: can't pickle Tokenizer objects
```
Then I guess you need to give us more informations on your setup (OS, python, GPU, etc) or a Google Colab reproducing the error for us to be able to debug this error. | [
-0.2387792468070984,
-0.29784899950027466,
-0.01968042179942131,
0.23303498327732086,
0.4450329542160034,
-0.1729922890663147,
0.285151869058609,
0.1309390813112259,
-0.27609169483184814,
0.11031325161457062,
-0.06978636234998703,
0.4891909956932068,
-0.008726135827600956,
-0.04673432186245918,
-0.14570960402488708,
-0.11147376894950867,
0.053560320287942886,
0.20785319805145264,
0.01811389997601509,
-0.0561075396835804,
-0.27878260612487793,
0.2074422836303711,
-0.4731772541999817,
0.1585230827331543,
-0.2825991213321686,
-0.26742836833000183,
0.10640472173690796,
-0.1985800564289093,
-0.2693116068840027,
-0.3823219835758209,
-0.14364492893218994,
-0.07336577773094177,
-0.02884814143180847,
0.563336968421936,
-0.00011926037404919043,
0.0994180291891098,
0.1089542955160141,
-0.145972341299057,
0.005223780870437622,
-0.04956597089767456,
-0.07480692863464355,
-0.3035498261451721,
-0.2058742642402649,
-0.458272784948349,
-0.15564605593681335,
-0.14384402334690094,
0.01115584559738636,
-0.332488477230072,
0.5145230889320374,
0.29142072796821594,
0.1399780958890915,
0.49322691559791565,
0.020635265856981277,
0.0532786101102829,
0.01532786339521408,
0.029823776334524155,
-0.13145363330841064,
-0.2608633041381836,
0.1487918347120285,
0.21654660999774933,
-0.130271315574646,
0.32548898458480835,
-0.1613031029701233,
-0.2627820670604706,
0.09947003424167633,
0.0949372872710228,
0.10411272197961807,
-0.4675593674182892,
0.32304832339286804,
-0.0021582134068012238,
0.21897175908088684,
-0.0208103209733963,
-0.2567599415779114,
-0.2679678201675415,
-0.07948525995016098,
0.0625915676355362,
-0.04125243425369263,
-0.20221516489982605,
0.0776134580373764,
0.05128606781363487,
-0.35269349813461304,
-0.17235323786735535,
-0.17987319827079773,
0.10823331773281097,
0.038386598229408264,
0.3674837648868561,
-0.26661092042922974,
0.29305195808410645,
0.09679804742336273,
-0.25016647577285767,
-0.11382152140140533,
-0.09912005811929703,
0.22644498944282532,
0.47687241435050964,
-0.3883419334888458,
-0.300885945558548,
-0.09438016265630722,
-0.40999895334243774,
0.34774601459503174,
-0.03840678930282593,
-0.22767992317676544,
0.25541263818740845,
-0.04895595833659172,
0.1893790066242218,
0.02317630872130394,
0.3520207107067108,
0.26322129368782043,
0.3699648678302765,
0.011672910302877426,
-0.1440165638923645,
0.06525957584381104,
-0.048873476684093475,
-0.08222289383411407,
-0.22157606482505798,
-0.05691240727901459,
0.2582862079143524,
0.35951292514801025,
-0.018613029271364212,
-0.046238239854574203,
0.02786199375987053,
-0.22628015279769897,
0.0427437499165535,
0.17346373200416565,
0.4068899154663086,
0.10801348090171814,
0.23184126615524292,
-0.31838929653167725,
0.09024085104465485,
-0.12427999824285507,
0.025306612253189087,
-0.16548646986484528,
0.21402311325073242,
-0.006621330976486206,
-0.13937939703464508,
-0.16431912779808044,
0.0698126032948494,
0.20134250819683075,
-0.026837512850761414,
0.0632021501660347,
-0.22027723491191864,
0.06153841316699982,
-0.17903092503547668,
0.2758256494998932,
-0.09431135654449463,
-0.050224341452121735,
0.17375634610652924,
0.20817093551158905,
-0.40948057174682617,
-0.20605650544166565,
0.035232916474342346,
-0.3411520719528198,
0.017331700772047043,
0.13118889927864075,
0.1185407042503357,
0.05623745918273926,
0.04769054800271988,
-0.3749629259109497,
0.2920551896095276,
0.41460344195365906,
0.007591649889945984,
0.03226820379495621,
-0.12673820555210114,
-0.2016417384147644,
-0.11112698912620544,
0.21824829280376434,
0.18993636965751648,
-0.1373288482427597,
-0.20797701179981232,
0.2503730058670044,
-0.0020624157041311264,
0.15356677770614624,
0.4049595594406128,
-0.05302755907177925,
0.25622016191482544,
-0.14678503572940826,
0.5597744584083557,
0.4704824388027191,
-0.625508189201355,
-0.5309314131736755,
0.10321839153766632,
-0.4468843936920166,
-0.1779436618089676,
-0.03534664958715439,
0.041638411581516266,
0.5613892078399658,
0.12415531277656555,
-0.1132064014673233,
0.3392552137374878,
0.07229578495025635,
0.2676008641719818,
-0.15639422833919525,
-0.14152976870536804,
0.40929919481277466,
0.09268194437026978,
0.21709808707237244,
0.11648884415626526,
-0.16825279593467712,
0.19713763892650604,
-0.10224737972021103,
-0.1236945390701294,
0.09144434332847595,
0.19020487368106842,
0.16542726755142212,
-0.21081383526325226,
0.08061237633228302,
-0.16297811269760132,
-0.5545790791511536,
0.06518654525279999,
-0.34768620133399963,
0.2234152853488922,
-0.28904998302459717,
-0.1947721689939499,
-0.28876471519470215,
0.15413497388362885,
-0.45191892981529236,
-0.052400071173906326,
0.0838475450873375,
-0.03061482310295105,
0.18893752992153168,
-0.013604627922177315,
0.019288551062345505,
-0.07614041119813919,
0.1458209604024887,
0.18609404563903809,
-0.2552468478679657,
0.20620331168174744,
-0.2569340169429779,
0.02114827185869217,
-0.05973024666309357,
0.09906291961669922,
0.4085010886192322,
-0.17598335444927216,
-0.2551455497741699,
0.2755492031574249,
0.17205199599266052,
-0.08486801385879517,
-0.05005958676338196,
-0.03503546118736267,
0.2658097743988037,
-0.20969520509243011,
-0.06440680474042892,
0.1785881519317627,
0.16671858727931976,
-0.02876027673482895,
-0.09293530136346817,
0.4431660771369934,
0.2247035801410675,
0.31786227226257324,
-0.01910526677966118,
0.1625133454799652,
0.24128490686416626,
-0.10274730622768402,
-0.04649505019187927,
-0.13554337620735168,
-0.17649294435977936,
0.0628637820482254,
0.23403991758823395,
-0.07365301996469498,
0.06564219295978546,
-0.059074871242046356,
0.8479932546615601,
-0.06834638118743896,
0.07938273996114731,
0.2044738531112671,
-0.11635082215070724,
0.049705870449543,
-0.07888424396514893,
-0.40181025862693787,
0.04173742234706879,
0.03922862559556961,
-0.17348940670490265,
-0.10662073642015457,
0.2546636462211609,
0.14594495296478271,
0.041524969041347504,
0.3150503635406494,
0.11469598859548569,
0.225544273853302,
0.15998724102973938,
0.11295114457607269,
-0.17203378677368164,
-0.19414323568344116,
0.16297325491905212,
0.1452348679304123,
-0.14686189591884613,
-0.024431999772787094,
-0.04605673998594284,
0.044477060437202454,
0.010470712557435036,
-0.04867228865623474,
-0.19503360986709595,
-0.250466912984848,
0.03378954157233238,
-0.023758497089147568,
0.09573529660701752,
0.449554979801178,
0.3668549656867981,
0.3240298628807068,
0.4278208613395691,
-0.10992073267698288,
-0.1704414188861847,
-0.19697964191436768,
-0.08769410103559494,
-0.06773465126752853,
0.1707262545824051,
-0.00535688316449523,
-0.03574804961681366,
0.010384462773799896,
0.10249228775501251,
-0.45612791180610657,
-0.4291422665119171,
0.2537456154823303,
-0.17828468978405,
0.1860090047121048,
-0.014134995639324188,
0.12101293355226517,
-0.3429492712020874,
-0.2921084761619568,
0.2118503600358963,
-0.21941320598125458,
-0.30137452483177185,
0.07068181037902832,
-0.061088766902685165,
-0.3209868371486664,
0.05117690935730934,
-0.24058660864830017,
-0.3765723705291748,
-0.33769187331199646,
0.3630162477493286,
-0.008248493075370789,
0.1135793924331665,
0.15415820479393005,
-0.00302607798948884,
0.2885194420814514,
-0.020071396604180336,
-0.035907477140426636,
-0.24400143325328827,
0.054305534809827805,
0.4122081995010376,
-0.18261869251728058,
-0.2826859652996063,
-0.39157694578170776,
-0.17591607570648193,
0.05257883667945862,
-0.12937913835048676,
-0.10209265351295471,
-0.22754734754562378,
-0.2711943984031677,
0.22384607791900635,
-0.16086310148239136,
0.045888230204582214,
0.5580427646636963,
-0.049236368387937546,
0.09076553583145142,
0.01156727597117424,
-0.16093182563781738,
0.27200356125831604,
0.1358187049627304,
0.081289142370224,
-0.010779760777950287,
0.5259879231452942,
0.1519598662853241,
0.8704360127449036,
0.15821492671966553,
-0.21943803131580353,
0.16835519671440125,
-0.14850348234176636,
-0.01063704863190651,
-0.03405507653951645,
-0.38928478956222534,
0.1844978630542755,
-0.04435047507286072,
0.12260723114013672,
0.13958825170993805,
-0.20949199795722961,
-0.15563496947288513,
0.14549137651920319,
-0.09472277760505676,
-0.218725323677063,
-0.27573642134666443,
-0.022572895511984825,
0.09790511429309845,
0.09834414720535278,
0.04776653274893761,
0.1866316795349121,
-0.44355639815330505,
0.06796005368232727,
0.11922764778137207,
0.004403114318847656,
0.048046551644802094,
-0.04683779925107956,
-1.0162560939788818,
-0.09132109582424164,
-0.17027941346168518,
0.36549264192581177,
0.22949711978435516,
0.4982428550720215,
-0.017992455512285233,
-0.04699508473277092,
0.05150580406188965,
-0.21210986375808716,
0.8495116829872131,
0.2505570650100708,
-0.05321195721626282,
0.07962740957736969,
0.018949035555124283,
-0.15455107390880585,
0.057700660079717636,
-0.16324123740196228,
0.6255757212638855,
0.4945645332336426,
0.7852731943130493,
-0.43740472197532654,
-0.08937069773674011,
0.031204042956233025,
-0.059960100799798965,
-0.1476590782403946,
0.08103042095899582,
-0.2087637037038803,
-0.180411696434021,
-0.5762062072753906,
0.25856703519821167,
0.28101325035095215,
0.19283361732959747,
0.15283092856407166,
-0.22316685318946838,
0.06901504844427109,
-0.28400319814682007,
-0.0985405296087265,
0.23120428621768951,
0.21433523297309875,
0.18589964509010315,
-0.0022402051836252213,
0.1455385386943817,
-0.1561146229505539,
-0.20688201487064362,
0.18994294106960297,
0.25589486956596375,
-0.6231854557991028,
0.2523166835308075,
0.16514982283115387,
0.5603795051574707,
0.15823112428188324,
-0.11502523720264435,
0.29464662075042725,
-0.01051352545619011,
0.47939586639404297,
-0.03906324505805969,
0.47881969809532166,
0.36262446641921997,
0.27784213423728943,
-0.301658570766449,
-0.13845354318618774,
0.38594749569892883,
-0.015479073859751225,
0.07214416563510895,
0.015306081622838974,
0.26423370838165283,
-0.15237964689731598,
0.5785444974899292,
0.10501522570848465,
1.0689465999603271,
-0.09628941118717194,
-0.09116224944591522,
0.12688452005386353,
0.26558351516723633,
0.5600724220275879,
-0.2914607524871826,
0.20523881912231445,
-0.5174928307533264,
-0.09049858152866364,
0.004256146028637886,
-0.13982944190502167,
0.13500869274139404,
0.18870440125465393,
-0.43005746603012085,
0.13892552256584167,
0.09927932918071747,
0.4275941550731659,
0.0399220809340477,
0.41344207525253296,
-0.01810356043279171,
-0.47711026668548584,
-0.12599581480026245,
0.06626572459936142,
-0.2162787765264511,
0.2179781198501587,
0.09313574433326721,
0.016773607581853867,
-0.22999055683612823,
-0.33340728282928467,
-0.06853975355625153,
0.08772076666355133,
-0.3980344831943512,
0.6731892228126526,
0.3429543673992157,
-0.19453462958335876,
0.29567334055900574,
0.2294493168592453,
0.15479309856891632,
0.2516958713531494,
-0.06370928883552551,
0.16826605796813965,
0.14975035190582275,
-0.0029831882566213608,
0.19938354194164276,
-0.06823351979255676,
0.11906512826681137,
-0.010318662971258163,
-0.10151160508394241,
0.175491064786911,
-0.012460781261324883,
-0.2762168347835541,
-0.2717879116535187,
-0.12400531768798828,
0.290338397026062,
-0.3395358622074127,
-0.2814115583896637,
-0.039557285606861115,
-0.28503528237342834,
-0.20351310074329376,
0.022034604102373123,
-0.07065904140472412,
-0.374799519777298,
0.22638219594955444,
0.23766908049583435,
-0.14269255101680756,
0.16958646476268768,
0.3712310492992401,
-0.025501083582639694,
-0.0888265073299408,
0.5584914684295654,
0.0715673416852951,
-0.19460977613925934,
-0.2024843990802765,
0.15187907218933105,
-0.033778805285692215,
-0.22719457745552063,
0.10915811359882355,
-0.1162661463022232,
-0.2636433243751526,
-0.22879533469676971,
0.3435634970664978,
-0.025700241327285767,
0.04026198014616966,
-0.2143467515707016,
-0.4193451404571533,
-0.5076627731323242,
0.049949295818805695,
-0.13119997084140778,
0.18116499483585358,
0.4385978579521179,
0.40800604224205017,
-0.25686928629875183,
0.3760196566581726,
-0.2495919018983841,
-0.08002421259880066,
-0.5987672805786133,
0.2662302255630493,
0.01884259283542633,
-0.5459761619567871,
-0.027553904801607132,
0.02164069376885891,
0.026443468406796455,
0.294058620929718,
-0.12007908523082733,
-0.15881237387657166,
-0.07026086002588272,
0.16056318581104279,
0.2280811369419098,
-0.10137251019477844,
-0.2458610236644745,
0.11841046810150146,
-0.17929944396018982,
-0.15681114792823792,
0.1025065928697586,
0.1319531500339508,
0.012163061648607254,
0.12355339527130127,
-0.09083551168441772,
-0.11700523644685745,
-0.05135424807667732,
-0.08652322739362717,
0.04924800619482994,
-0.15517960488796234,
0.2005685269832611,
0.38877812027931213,
-0.19008755683898926,
-0.009076409041881561,
-0.29091838002204895,
0.17954382300376892,
0.6930253505706787,
0.009677674621343613,
0.3933945298194885,
-0.31458789110183716,
-0.15080979466438293,
0.22921109199523926,
-0.20730316638946533,
0.18506640195846558,
-0.3238910436630249,
-0.09588629007339478,
0.22866439819335938,
0.12948498129844666,
-0.2605692744255066,
-0.20624437928199768,
0.5028800368309021,
-0.3981369435787201,
0.1572275012731552,
0.12966448068618774,
-0.09836220741271973,
0.2678849697113037,
0.18320630490779877,
0.1603044867515564,
0.7458080649375916,
0.011786268092691898,
0.17655035853385925,
-0.06224888935685158,
-0.09200140088796616,
0.05511584132909775,
0.5123581290245056,
0.13516101241111755,
0.2308288961648941,
0.11014201492071152,
-0.20327258110046387,
0.37733936309814453,
-0.42855411767959595,
0.2233327180147171,
0.36982885003089905,
-0.12526848912239075,
-0.19376134872436523,
0.20874705910682678,
-0.14037078619003296,
0.2644398808479309,
-0.04349501430988312,
0.35226011276245117,
-0.1093691885471344,
-0.17406626045703888,
-0.16872172057628632,
0.49048706889152527,
-0.3190309703350067,
-0.049097366631031036,
-0.021232690662145615,
-0.07593855261802673,
-0.1959420144557953,
-0.28567615151405334,
0.050842709839344025,
-0.06166030466556549,
0.10977569967508316,
0.015786856412887573,
-0.08042746782302856,
0.2032719999551773,
-0.14787951111793518,
0.17750829458236694,
0.24254110455513,
-0.32913538813591003,
0.2424011528491974,
0.1096196249127388,
0.2629409432411194,
-0.24783456325531006,
0.11491469293832779,
0.3023820221424103,
0.26866012811660767,
-0.4128156304359436,
0.1197531670331955,
-0.061437491327524185,
-0.15522582828998566,
0.15395838022232056,
0.1354498416185379,
-0.1843048334121704,
-0.21929125487804413,
0.23018088936805725,
0.07787932455539703,
-0.2095593959093094,
-0.17226456105709076,
0.1902216076850891,
0.10927625000476837,
0.1233893632888794,
-0.049729399383068085,
-0.08056873083114624,
-0.20539340376853943,
-0.3169712722301483,
-0.17713499069213867,
-0.39904630184173584,
-0.04866921156644821,
0.08204156160354614,
-0.23340527713298798,
0.2352660596370697,
-0.306997686624527,
0.08067841082811356,
0.08235998451709747,
0.36441871523857117,
0.31551843881607056,
0.08895154297351837,
-0.3957797884941101,
-0.02335897833108902,
-0.40491533279418945,
0.21320071816444397,
0.30975788831710815,
-0.19389264285564423,
0.08527778834104538,
0.1949712485074997,
0.06053662300109863,
0.31443339586257935,
-0.10639722645282745,
0.057046450674533844,
-0.13181345164775848,
-0.006787165999412537,
-0.21990114450454712,
0.13424824178218842,
-0.16535654664039612,
0.1062282919883728,
0.2053379863500595,
-0.3196316957473755,
0.3005921244621277,
0.2335086166858673,
-0.016038425266742706,
-0.20376719534397125,
-0.07318393886089325,
-0.21352843940258026,
-0.3241588771343231,
-0.04828055948019028,
0.2011154741048813,
0.2985321581363678,
-0.28266650438308716,
0.18013443052768707,
0.20976580679416656,
-0.043841224163770676,
-0.2875528335571289,
-0.19312211871147156,
0.15643532574176788,
0.4927528202533722,
-0.0002095801755785942,
0.12636980414390564,
-0.3023885190486908,
-0.17570357024669647,
0.08756741881370544,
-0.28133371472358704,
-0.24230000376701355,
0.33336523175239563,
-0.20570093393325806,
0.1753343790769577,
-0.014726635068655014,
0.21862280368804932,
0.07085446268320084,
0.28340816497802734,
-0.24533317983150482,
-0.45495712757110596,
0.6601229906082153,
-0.4289315640926361,
-0.48007938265800476,
-0.05626486986875534,
-0.06597250699996948,
0.13737857341766357,
-0.2057526409626007,
-0.2559032440185547,
-0.15045183897018433,
0.2913421094417572,
0.08456270396709442,
-0.20066991448402405,
0.05188633129000664,
0.15546011924743652,
-0.03583145514130592,
-0.150189608335495,
0.3721500039100647,
0.12918761372566223,
0.06289525330066681,
0.10387624800205231,
-0.2139434814453125
] |
https://github.com/huggingface/datasets/issues/665 | runing dataset.map, it raises TypeError: can't pickle Tokenizer objects | I have the same issue with `transformers/BertJapaneseTokenizer`.
```python
# train_ds = Dataset(features: {
# 'title': Value(dtype='string', id=None),
# 'score': Value(dtype='float64', id=None)
# }, num_rows: 99999)
t = BertJapaneseTokenizer.from_pretrained('bert-base-japanese-whole-word-masking')
encoded = train_ds.map(lambda examples: {'tokens': t.encode(examples['title'])}, batched=True)
```
<details><summary>Error Message</summary>
```
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-35-2b7d66b291c1> in <module>
2
3 encoded = train_ds.map(lambda examples:
----> 4 {'tokens': t.encode(examples['title'])}, batched=True)
/usr/local/lib/python3.6/site-packages/datasets/arrow_dataset.py in map(self, function, with_indices, input_columns, batched, batch_size, drop_last_batch, remove_columns, keep_in_memory, load_from_cache_file, cache_file_name, writer_batch_size, features, disable_nullable, fn_kwargs, num_proc, suffix_template, new_fingerprint)
1242 fn_kwargs=fn_kwargs,
1243 new_fingerprint=new_fingerprint,
-> 1244 update_data=update_data,
1245 )
1246 else:
/usr/local/lib/python3.6/site-packages/datasets/arrow_dataset.py in wrapper(*args, **kwargs)
151 "output_all_columns": self._output_all_columns,
152 }
--> 153 out: Union["Dataset", "DatasetDict"] = func(self, *args, **kwargs)
154 if new_format["columns"] is not None:
155 new_format["columns"] = list(set(new_format["columns"]) & set(out.column_names))
/usr/local/lib/python3.6/site-packages/datasets/fingerprint.py in wrapper(*args, **kwargs)
156 kwargs_for_fingerprint["fingerprint_name"] = fingerprint_name
157 kwargs[fingerprint_name] = update_fingerprint(
--> 158 self._fingerprint, transform, kwargs_for_fingerprint
159 )
160
/usr/local/lib/python3.6/site-packages/datasets/fingerprint.py in update_fingerprint(fingerprint, transform, transform_args)
103 for key in sorted(transform_args):
104 hasher.update(key)
--> 105 hasher.update(transform_args[key])
106 return hasher.hexdigest()
107
/usr/local/lib/python3.6/site-packages/datasets/fingerprint.py in update(self, value)
55 def update(self, value):
56 self.m.update(f"=={type(value)}==".encode("utf8"))
---> 57 self.m.update(self.hash(value).encode("utf-8"))
58
59 def hexdigest(self):
/usr/local/lib/python3.6/site-packages/datasets/fingerprint.py in hash(cls, value)
51 return cls.dispatch[type(value)](cls, value)
52 else:
---> 53 return cls.hash_default(value)
54
55 def update(self, value):
/usr/local/lib/python3.6/site-packages/datasets/fingerprint.py in hash_default(cls, value)
44 @classmethod
45 def hash_default(cls, value):
---> 46 return cls.hash_bytes(dumps(value))
47
48 @classmethod
/usr/local/lib/python3.6/site-packages/datasets/utils/py_utils.py in dumps(obj)
365 file = StringIO()
366 with _no_cache_fields(obj):
--> 367 dump(obj, file)
368 return file.getvalue()
369
/usr/local/lib/python3.6/site-packages/datasets/utils/py_utils.py in dump(obj, file)
337 def dump(obj, file):
338 """pickle an object to a file"""
--> 339 Pickler(file, recurse=True).dump(obj)
340 return
341
/usr/local/lib/python3.6/site-packages/dill/_dill.py in dump(self, obj)
444 raise PicklingError(msg)
445 else:
--> 446 StockPickler.dump(self, obj)
447 stack.clear() # clear record of 'recursion-sensitive' pickled objects
448 return
/usr/local/lib/python3.6/pickle.py in dump(self, obj)
407 if self.proto >= 4:
408 self.framer.start_framing()
--> 409 self.save(obj)
410 self.write(STOP)
411 self.framer.end_framing()
/usr/local/lib/python3.6/pickle.py in save(self, obj, save_persistent_id)
474 f = self.dispatch.get(t)
475 if f is not None:
--> 476 f(self, obj) # Call unbound method with explicit self
477 return
478
/usr/local/lib/python3.6/site-packages/dill/_dill.py in save_function(pickler, obj)
1436 globs, obj.__name__,
1437 obj.__defaults__, obj.__closure__,
-> 1438 obj.__dict__, fkwdefaults), obj=obj)
1439 else:
1440 _super = ('super' in getattr(obj.func_code,'co_names',())) and (_byref is not None) and getattr(pickler, '_recurse', False)
/usr/local/lib/python3.6/pickle.py in save_reduce(self, func, args, state, listitems, dictitems, obj)
608 else:
609 save(func)
--> 610 save(args)
611 write(REDUCE)
612
/usr/local/lib/python3.6/pickle.py in save(self, obj, save_persistent_id)
474 f = self.dispatch.get(t)
475 if f is not None:
--> 476 f(self, obj) # Call unbound method with explicit self
477 return
478
/usr/local/lib/python3.6/pickle.py in save_tuple(self, obj)
749 write(MARK)
750 for element in obj:
--> 751 save(element)
752
753 if id(obj) in memo:
/usr/local/lib/python3.6/pickle.py in save(self, obj, save_persistent_id)
474 f = self.dispatch.get(t)
475 if f is not None:
--> 476 f(self, obj) # Call unbound method with explicit self
477 return
478
/usr/local/lib/python3.6/site-packages/dill/_dill.py in save_module_dict(pickler, obj)
931 # we only care about session the first pass thru
932 pickler._session = False
--> 933 StockPickler.save_dict(pickler, obj)
934 log.info("# D2")
935 return
/usr/local/lib/python3.6/pickle.py in save_dict(self, obj)
819
820 self.memoize(obj)
--> 821 self._batch_setitems(obj.items())
822
823 dispatch[dict] = save_dict
/usr/local/lib/python3.6/pickle.py in _batch_setitems(self, items)
850 k, v = tmp[0]
851 save(k)
--> 852 save(v)
853 write(SETITEM)
854 # else tmp is empty, and we're done
/usr/local/lib/python3.6/pickle.py in save(self, obj, save_persistent_id)
519
520 # Save the reduce() output and finally memoize the object
--> 521 self.save_reduce(obj=obj, *rv)
522
523 def persistent_id(self, obj):
/usr/local/lib/python3.6/pickle.py in save_reduce(self, func, args, state, listitems, dictitems, obj)
632
633 if state is not None:
--> 634 save(state)
635 write(BUILD)
636
/usr/local/lib/python3.6/pickle.py in save(self, obj, save_persistent_id)
474 f = self.dispatch.get(t)
475 if f is not None:
--> 476 f(self, obj) # Call unbound method with explicit self
477 return
478
/usr/local/lib/python3.6/site-packages/dill/_dill.py in save_module_dict(pickler, obj)
931 # we only care about session the first pass thru
932 pickler._session = False
--> 933 StockPickler.save_dict(pickler, obj)
934 log.info("# D2")
935 return
/usr/local/lib/python3.6/pickle.py in save_dict(self, obj)
819
820 self.memoize(obj)
--> 821 self._batch_setitems(obj.items())
822
823 dispatch[dict] = save_dict
/usr/local/lib/python3.6/pickle.py in _batch_setitems(self, items)
845 for k, v in tmp:
846 save(k)
--> 847 save(v)
848 write(SETITEMS)
849 elif n:
/usr/local/lib/python3.6/pickle.py in save(self, obj, save_persistent_id)
519
520 # Save the reduce() output and finally memoize the object
--> 521 self.save_reduce(obj=obj, *rv)
522
523 def persistent_id(self, obj):
/usr/local/lib/python3.6/pickle.py in save_reduce(self, func, args, state, listitems, dictitems, obj)
632
633 if state is not None:
--> 634 save(state)
635 write(BUILD)
636
/usr/local/lib/python3.6/pickle.py in save(self, obj, save_persistent_id)
474 f = self.dispatch.get(t)
475 if f is not None:
--> 476 f(self, obj) # Call unbound method with explicit self
477 return
478
/usr/local/lib/python3.6/site-packages/dill/_dill.py in save_module_dict(pickler, obj)
931 # we only care about session the first pass thru
932 pickler._session = False
--> 933 StockPickler.save_dict(pickler, obj)
934 log.info("# D2")
935 return
/usr/local/lib/python3.6/pickle.py in save_dict(self, obj)
819
820 self.memoize(obj)
--> 821 self._batch_setitems(obj.items())
822
823 dispatch[dict] = save_dict
/usr/local/lib/python3.6/pickle.py in _batch_setitems(self, items)
845 for k, v in tmp:
846 save(k)
--> 847 save(v)
848 write(SETITEMS)
849 elif n:
/usr/local/lib/python3.6/pickle.py in save(self, obj, save_persistent_id)
494 reduce = getattr(obj, "__reduce_ex__", None)
495 if reduce is not None:
--> 496 rv = reduce(self.proto)
497 else:
498 reduce = getattr(obj, "__reduce__", None)
TypeError: can't pickle Tagger objects
```
</details>
trainsformers: 2.10.0
datasets: 1.0.2
dill: 0.3.2
python: 3.6.8
OS: ubuntu 16.04 (Docker Image) on [Deep Learning VM](https://console.cloud.google.com/marketplace/details/click-to-deploy-images/deeplearning) (GCP)
GPU: Tesla P100 (CUDA 10)
| I load squad dataset. Then want to process data use following function with `Huggingface Transformers LongformerTokenizer`.
```
def convert_to_features(example):
# Tokenize contexts and questions (as pairs of inputs)
input_pairs = [example['question'], example['context']]
encodings = tokenizer.encode_plus(input_pairs, pad_to_max_length=True, max_length=512)
context_encodings = tokenizer.encode_plus(example['context'])
# Compute start and end tokens for labels using Transformers's fast tokenizers alignement methodes.
# this will give us the position of answer span in the context text
start_idx, end_idx = get_correct_alignement(example['context'], example['answers'])
start_positions_context = context_encodings.char_to_token(start_idx)
end_positions_context = context_encodings.char_to_token(end_idx-1)
# here we will compute the start and end position of the answer in the whole example
# as the example is encoded like this <s> question</s></s> context</s>
# and we know the postion of the answer in the context
# we can just find out the index of the sep token and then add that to position + 1 (+1 because there are two sep tokens)
# this will give us the position of the answer span in whole example
sep_idx = encodings['input_ids'].index(tokenizer.sep_token_id)
start_positions = start_positions_context + sep_idx + 1
end_positions = end_positions_context + sep_idx + 1
if end_positions > 512:
start_positions, end_positions = 0, 0
encodings.update({'start_positions': start_positions,
'end_positions': end_positions,
'attention_mask': encodings['attention_mask']})
return encodings
```
Then I run `dataset.map(convert_to_features)`, it raise
```
In [59]: a.map(convert_to_features)
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-59-c453b508761d> in <module>
----> 1 a.map(convert_to_features)
/opt/conda/lib/python3.7/site-packages/datasets/arrow_dataset.py in map(self, function, with_indices, input_columns, batched, batch_size, drop_last_batch, remove_columns, keep_in_memory, load_from_cache_file, cache_file_name, writer_batch_size, features, disable_nullable, fn_kwargs, num_proc, suffix_template, new_fingerprint)
1242 fn_kwargs=fn_kwargs,
1243 new_fingerprint=new_fingerprint,
-> 1244 update_data=update_data,
1245 )
1246 else:
/opt/conda/lib/python3.7/site-packages/datasets/arrow_dataset.py in wrapper(*args, **kwargs)
151 "output_all_columns": self._output_all_columns,
152 }
--> 153 out: Union["Dataset", "DatasetDict"] = func(self, *args, **kwargs)
154 if new_format["columns"] is not None:
155 new_format["columns"] = list(set(new_format["columns"]) & set(out.column_names))
/opt/conda/lib/python3.7/site-packages/datasets/fingerprint.py in wrapper(*args, **kwargs)
156 kwargs_for_fingerprint["fingerprint_name"] = fingerprint_name
157 kwargs[fingerprint_name] = update_fingerprint(
--> 158 self._fingerprint, transform, kwargs_for_fingerprint
159 )
160
/opt/conda/lib/python3.7/site-packages/datasets/fingerprint.py in update_fingerprint(fingerprint, transform, transform_args)
103 for key in sorted(transform_args):
104 hasher.update(key)
--> 105 hasher.update(transform_args[key])
106 return hasher.hexdigest()
107
/opt/conda/lib/python3.7/site-packages/datasets/fingerprint.py in update(self, value)
55 def update(self, value):
56 self.m.update(f"=={type(value)}==".encode("utf8"))
---> 57 self.m.update(self.hash(value).encode("utf-8"))
58
59 def hexdigest(self):
/opt/conda/lib/python3.7/site-packages/datasets/fingerprint.py in hash(cls, value)
51 return cls.dispatch[type(value)](cls, value)
52 else:
---> 53 return cls.hash_default(value)
54
55 def update(self, value):
/opt/conda/lib/python3.7/site-packages/datasets/fingerprint.py in hash_default(cls, value)
44 @classmethod
45 def hash_default(cls, value):
---> 46 return cls.hash_bytes(dumps(value))
47
48 @classmethod
/opt/conda/lib/python3.7/site-packages/datasets/utils/py_utils.py in dumps(obj)
365 file = StringIO()
366 with _no_cache_fields(obj):
--> 367 dump(obj, file)
368 return file.getvalue()
369
/opt/conda/lib/python3.7/site-packages/datasets/utils/py_utils.py in dump(obj, file)
337 def dump(obj, file):
338 """pickle an object to a file"""
--> 339 Pickler(file, recurse=True).dump(obj)
340 return
341
/opt/conda/lib/python3.7/site-packages/dill/_dill.py in dump(self, obj)
444 raise PicklingError(msg)
445 else:
--> 446 StockPickler.dump(self, obj)
447 stack.clear() # clear record of 'recursion-sensitive' pickled objects
448 return
/opt/conda/lib/python3.7/pickle.py in dump(self, obj)
435 if self.proto >= 4:
436 self.framer.start_framing()
--> 437 self.save(obj)
438 self.write(STOP)
439 self.framer.end_framing()
/opt/conda/lib/python3.7/pickle.py in save(self, obj, save_persistent_id)
502 f = self.dispatch.get(t)
503 if f is not None:
--> 504 f(self, obj) # Call unbound method with explicit self
505 return
506
/opt/conda/lib/python3.7/site-packages/dill/_dill.py in save_function(pickler, obj)
1436 globs, obj.__name__,
1437 obj.__defaults__, obj.__closure__,
-> 1438 obj.__dict__, fkwdefaults), obj=obj)
1439 else:
1440 _super = ('super' in getattr(obj.func_code,'co_names',())) and (_byref is not None) and getattr(pickler, '_recurse', False)
/opt/conda/lib/python3.7/pickle.py in save_reduce(self, func, args, state, listitems, dictitems, obj)
636 else:
637 save(func)
--> 638 save(args)
639 write(REDUCE)
640
/opt/conda/lib/python3.7/pickle.py in save(self, obj, save_persistent_id)
502 f = self.dispatch.get(t)
503 if f is not None:
--> 504 f(self, obj) # Call unbound method with explicit self
505 return
506
/opt/conda/lib/python3.7/pickle.py in save_tuple(self, obj)
787 write(MARK)
788 for element in obj:
--> 789 save(element)
790
791 if id(obj) in memo:
/opt/conda/lib/python3.7/pickle.py in save(self, obj, save_persistent_id)
502 f = self.dispatch.get(t)
503 if f is not None:
--> 504 f(self, obj) # Call unbound method with explicit self
505 return
506
/opt/conda/lib/python3.7/site-packages/dill/_dill.py in save_module_dict(pickler, obj)
931 # we only care about session the first pass thru
932 pickler._session = False
--> 933 StockPickler.save_dict(pickler, obj)
934 log.info("# D2")
935 return
/opt/conda/lib/python3.7/pickle.py in save_dict(self, obj)
857
858 self.memoize(obj)
--> 859 self._batch_setitems(obj.items())
860
861 dispatch[dict] = save_dict
/opt/conda/lib/python3.7/pickle.py in _batch_setitems(self, items)
883 for k, v in tmp:
884 save(k)
--> 885 save(v)
886 write(SETITEMS)
887 elif n:
/opt/conda/lib/python3.7/pickle.py in save(self, obj, save_persistent_id)
547
548 # Save the reduce() output and finally memoize the object
--> 549 self.save_reduce(obj=obj, *rv)
550
551 def persistent_id(self, obj):
/opt/conda/lib/python3.7/pickle.py in save_reduce(self, func, args, state, listitems, dictitems, obj)
660
661 if state is not None:
--> 662 save(state)
663 write(BUILD)
664
/opt/conda/lib/python3.7/pickle.py in save(self, obj, save_persistent_id)
502 f = self.dispatch.get(t)
503 if f is not None:
--> 504 f(self, obj) # Call unbound method with explicit self
505 return
506
/opt/conda/lib/python3.7/site-packages/dill/_dill.py in save_module_dict(pickler, obj)
931 # we only care about session the first pass thru
932 pickler._session = False
--> 933 StockPickler.save_dict(pickler, obj)
934 log.info("# D2")
935 return
/opt/conda/lib/python3.7/pickle.py in save_dict(self, obj)
857
858 self.memoize(obj)
--> 859 self._batch_setitems(obj.items())
860
861 dispatch[dict] = save_dict
/opt/conda/lib/python3.7/pickle.py in _batch_setitems(self, items)
883 for k, v in tmp:
884 save(k)
--> 885 save(v)
886 write(SETITEMS)
887 elif n:
/opt/conda/lib/python3.7/pickle.py in save(self, obj, save_persistent_id)
547
548 # Save the reduce() output and finally memoize the object
--> 549 self.save_reduce(obj=obj, *rv)
550
551 def persistent_id(self, obj):
/opt/conda/lib/python3.7/pickle.py in save_reduce(self, func, args, state, listitems, dictitems, obj)
660
661 if state is not None:
--> 662 save(state)
663 write(BUILD)
664
/opt/conda/lib/python3.7/pickle.py in save(self, obj, save_persistent_id)
502 f = self.dispatch.get(t)
503 if f is not None:
--> 504 f(self, obj) # Call unbound method with explicit self
505 return
506
/opt/conda/lib/python3.7/site-packages/dill/_dill.py in save_module_dict(pickler, obj)
931 # we only care about session the first pass thru
932 pickler._session = False
--> 933 StockPickler.save_dict(pickler, obj)
934 log.info("# D2")
935 return
/opt/conda/lib/python3.7/pickle.py in save_dict(self, obj)
857
858 self.memoize(obj)
--> 859 self._batch_setitems(obj.items())
860
861 dispatch[dict] = save_dict
/opt/conda/lib/python3.7/pickle.py in _batch_setitems(self, items)
883 for k, v in tmp:
884 save(k)
--> 885 save(v)
886 write(SETITEMS)
887 elif n:
/opt/conda/lib/python3.7/pickle.py in save(self, obj, save_persistent_id)
522 reduce = getattr(obj, "__reduce_ex__", None)
523 if reduce is not None:
--> 524 rv = reduce(self.proto)
525 else:
526 reduce = getattr(obj, "__reduce__", None)
TypeError: can't pickle Tokenizer objects
```
| 861 | runing dataset.map, it raises TypeError: can't pickle Tokenizer objects
I load squad dataset. Then want to process data use following function with `Huggingface Transformers LongformerTokenizer`.
```
def convert_to_features(example):
# Tokenize contexts and questions (as pairs of inputs)
input_pairs = [example['question'], example['context']]
encodings = tokenizer.encode_plus(input_pairs, pad_to_max_length=True, max_length=512)
context_encodings = tokenizer.encode_plus(example['context'])
# Compute start and end tokens for labels using Transformers's fast tokenizers alignement methodes.
# this will give us the position of answer span in the context text
start_idx, end_idx = get_correct_alignement(example['context'], example['answers'])
start_positions_context = context_encodings.char_to_token(start_idx)
end_positions_context = context_encodings.char_to_token(end_idx-1)
# here we will compute the start and end position of the answer in the whole example
# as the example is encoded like this <s> question</s></s> context</s>
# and we know the postion of the answer in the context
# we can just find out the index of the sep token and then add that to position + 1 (+1 because there are two sep tokens)
# this will give us the position of the answer span in whole example
sep_idx = encodings['input_ids'].index(tokenizer.sep_token_id)
start_positions = start_positions_context + sep_idx + 1
end_positions = end_positions_context + sep_idx + 1
if end_positions > 512:
start_positions, end_positions = 0, 0
encodings.update({'start_positions': start_positions,
'end_positions': end_positions,
'attention_mask': encodings['attention_mask']})
return encodings
```
Then I run `dataset.map(convert_to_features)`, it raise
```
In [59]: a.map(convert_to_features)
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-59-c453b508761d> in <module>
----> 1 a.map(convert_to_features)
/opt/conda/lib/python3.7/site-packages/datasets/arrow_dataset.py in map(self, function, with_indices, input_columns, batched, batch_size, drop_last_batch, remove_columns, keep_in_memory, load_from_cache_file, cache_file_name, writer_batch_size, features, disable_nullable, fn_kwargs, num_proc, suffix_template, new_fingerprint)
1242 fn_kwargs=fn_kwargs,
1243 new_fingerprint=new_fingerprint,
-> 1244 update_data=update_data,
1245 )
1246 else:
/opt/conda/lib/python3.7/site-packages/datasets/arrow_dataset.py in wrapper(*args, **kwargs)
151 "output_all_columns": self._output_all_columns,
152 }
--> 153 out: Union["Dataset", "DatasetDict"] = func(self, *args, **kwargs)
154 if new_format["columns"] is not None:
155 new_format["columns"] = list(set(new_format["columns"]) & set(out.column_names))
/opt/conda/lib/python3.7/site-packages/datasets/fingerprint.py in wrapper(*args, **kwargs)
156 kwargs_for_fingerprint["fingerprint_name"] = fingerprint_name
157 kwargs[fingerprint_name] = update_fingerprint(
--> 158 self._fingerprint, transform, kwargs_for_fingerprint
159 )
160
/opt/conda/lib/python3.7/site-packages/datasets/fingerprint.py in update_fingerprint(fingerprint, transform, transform_args)
103 for key in sorted(transform_args):
104 hasher.update(key)
--> 105 hasher.update(transform_args[key])
106 return hasher.hexdigest()
107
/opt/conda/lib/python3.7/site-packages/datasets/fingerprint.py in update(self, value)
55 def update(self, value):
56 self.m.update(f"=={type(value)}==".encode("utf8"))
---> 57 self.m.update(self.hash(value).encode("utf-8"))
58
59 def hexdigest(self):
/opt/conda/lib/python3.7/site-packages/datasets/fingerprint.py in hash(cls, value)
51 return cls.dispatch[type(value)](cls, value)
52 else:
---> 53 return cls.hash_default(value)
54
55 def update(self, value):
/opt/conda/lib/python3.7/site-packages/datasets/fingerprint.py in hash_default(cls, value)
44 @classmethod
45 def hash_default(cls, value):
---> 46 return cls.hash_bytes(dumps(value))
47
48 @classmethod
/opt/conda/lib/python3.7/site-packages/datasets/utils/py_utils.py in dumps(obj)
365 file = StringIO()
366 with _no_cache_fields(obj):
--> 367 dump(obj, file)
368 return file.getvalue()
369
/opt/conda/lib/python3.7/site-packages/datasets/utils/py_utils.py in dump(obj, file)
337 def dump(obj, file):
338 """pickle an object to a file"""
--> 339 Pickler(file, recurse=True).dump(obj)
340 return
341
/opt/conda/lib/python3.7/site-packages/dill/_dill.py in dump(self, obj)
444 raise PicklingError(msg)
445 else:
--> 446 StockPickler.dump(self, obj)
447 stack.clear() # clear record of 'recursion-sensitive' pickled objects
448 return
/opt/conda/lib/python3.7/pickle.py in dump(self, obj)
435 if self.proto >= 4:
436 self.framer.start_framing()
--> 437 self.save(obj)
438 self.write(STOP)
439 self.framer.end_framing()
/opt/conda/lib/python3.7/pickle.py in save(self, obj, save_persistent_id)
502 f = self.dispatch.get(t)
503 if f is not None:
--> 504 f(self, obj) # Call unbound method with explicit self
505 return
506
/opt/conda/lib/python3.7/site-packages/dill/_dill.py in save_function(pickler, obj)
1436 globs, obj.__name__,
1437 obj.__defaults__, obj.__closure__,
-> 1438 obj.__dict__, fkwdefaults), obj=obj)
1439 else:
1440 _super = ('super' in getattr(obj.func_code,'co_names',())) and (_byref is not None) and getattr(pickler, '_recurse', False)
/opt/conda/lib/python3.7/pickle.py in save_reduce(self, func, args, state, listitems, dictitems, obj)
636 else:
637 save(func)
--> 638 save(args)
639 write(REDUCE)
640
/opt/conda/lib/python3.7/pickle.py in save(self, obj, save_persistent_id)
502 f = self.dispatch.get(t)
503 if f is not None:
--> 504 f(self, obj) # Call unbound method with explicit self
505 return
506
/opt/conda/lib/python3.7/pickle.py in save_tuple(self, obj)
787 write(MARK)
788 for element in obj:
--> 789 save(element)
790
791 if id(obj) in memo:
/opt/conda/lib/python3.7/pickle.py in save(self, obj, save_persistent_id)
502 f = self.dispatch.get(t)
503 if f is not None:
--> 504 f(self, obj) # Call unbound method with explicit self
505 return
506
/opt/conda/lib/python3.7/site-packages/dill/_dill.py in save_module_dict(pickler, obj)
931 # we only care about session the first pass thru
932 pickler._session = False
--> 933 StockPickler.save_dict(pickler, obj)
934 log.info("# D2")
935 return
/opt/conda/lib/python3.7/pickle.py in save_dict(self, obj)
857
858 self.memoize(obj)
--> 859 self._batch_setitems(obj.items())
860
861 dispatch[dict] = save_dict
/opt/conda/lib/python3.7/pickle.py in _batch_setitems(self, items)
883 for k, v in tmp:
884 save(k)
--> 885 save(v)
886 write(SETITEMS)
887 elif n:
/opt/conda/lib/python3.7/pickle.py in save(self, obj, save_persistent_id)
547
548 # Save the reduce() output and finally memoize the object
--> 549 self.save_reduce(obj=obj, *rv)
550
551 def persistent_id(self, obj):
/opt/conda/lib/python3.7/pickle.py in save_reduce(self, func, args, state, listitems, dictitems, obj)
660
661 if state is not None:
--> 662 save(state)
663 write(BUILD)
664
/opt/conda/lib/python3.7/pickle.py in save(self, obj, save_persistent_id)
502 f = self.dispatch.get(t)
503 if f is not None:
--> 504 f(self, obj) # Call unbound method with explicit self
505 return
506
/opt/conda/lib/python3.7/site-packages/dill/_dill.py in save_module_dict(pickler, obj)
931 # we only care about session the first pass thru
932 pickler._session = False
--> 933 StockPickler.save_dict(pickler, obj)
934 log.info("# D2")
935 return
/opt/conda/lib/python3.7/pickle.py in save_dict(self, obj)
857
858 self.memoize(obj)
--> 859 self._batch_setitems(obj.items())
860
861 dispatch[dict] = save_dict
/opt/conda/lib/python3.7/pickle.py in _batch_setitems(self, items)
883 for k, v in tmp:
884 save(k)
--> 885 save(v)
886 write(SETITEMS)
887 elif n:
/opt/conda/lib/python3.7/pickle.py in save(self, obj, save_persistent_id)
547
548 # Save the reduce() output and finally memoize the object
--> 549 self.save_reduce(obj=obj, *rv)
550
551 def persistent_id(self, obj):
/opt/conda/lib/python3.7/pickle.py in save_reduce(self, func, args, state, listitems, dictitems, obj)
660
661 if state is not None:
--> 662 save(state)
663 write(BUILD)
664
/opt/conda/lib/python3.7/pickle.py in save(self, obj, save_persistent_id)
502 f = self.dispatch.get(t)
503 if f is not None:
--> 504 f(self, obj) # Call unbound method with explicit self
505 return
506
/opt/conda/lib/python3.7/site-packages/dill/_dill.py in save_module_dict(pickler, obj)
931 # we only care about session the first pass thru
932 pickler._session = False
--> 933 StockPickler.save_dict(pickler, obj)
934 log.info("# D2")
935 return
/opt/conda/lib/python3.7/pickle.py in save_dict(self, obj)
857
858 self.memoize(obj)
--> 859 self._batch_setitems(obj.items())
860
861 dispatch[dict] = save_dict
/opt/conda/lib/python3.7/pickle.py in _batch_setitems(self, items)
883 for k, v in tmp:
884 save(k)
--> 885 save(v)
886 write(SETITEMS)
887 elif n:
/opt/conda/lib/python3.7/pickle.py in save(self, obj, save_persistent_id)
522 reduce = getattr(obj, "__reduce_ex__", None)
523 if reduce is not None:
--> 524 rv = reduce(self.proto)
525 else:
526 reduce = getattr(obj, "__reduce__", None)
TypeError: can't pickle Tokenizer objects
```
I have the same issue with `transformers/BertJapaneseTokenizer`.
```python
# train_ds = Dataset(features: {
# 'title': Value(dtype='string', id=None),
# 'score': Value(dtype='float64', id=None)
# }, num_rows: 99999)
t = BertJapaneseTokenizer.from_pretrained('bert-base-japanese-whole-word-masking')
encoded = train_ds.map(lambda examples: {'tokens': t.encode(examples['title'])}, batched=True)
```
<details><summary>Error Message</summary>
```
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-35-2b7d66b291c1> in <module>
2
3 encoded = train_ds.map(lambda examples:
----> 4 {'tokens': t.encode(examples['title'])}, batched=True)
/usr/local/lib/python3.6/site-packages/datasets/arrow_dataset.py in map(self, function, with_indices, input_columns, batched, batch_size, drop_last_batch, remove_columns, keep_in_memory, load_from_cache_file, cache_file_name, writer_batch_size, features, disable_nullable, fn_kwargs, num_proc, suffix_template, new_fingerprint)
1242 fn_kwargs=fn_kwargs,
1243 new_fingerprint=new_fingerprint,
-> 1244 update_data=update_data,
1245 )
1246 else:
/usr/local/lib/python3.6/site-packages/datasets/arrow_dataset.py in wrapper(*args, **kwargs)
151 "output_all_columns": self._output_all_columns,
152 }
--> 153 out: Union["Dataset", "DatasetDict"] = func(self, *args, **kwargs)
154 if new_format["columns"] is not None:
155 new_format["columns"] = list(set(new_format["columns"]) & set(out.column_names))
/usr/local/lib/python3.6/site-packages/datasets/fingerprint.py in wrapper(*args, **kwargs)
156 kwargs_for_fingerprint["fingerprint_name"] = fingerprint_name
157 kwargs[fingerprint_name] = update_fingerprint(
--> 158 self._fingerprint, transform, kwargs_for_fingerprint
159 )
160
/usr/local/lib/python3.6/site-packages/datasets/fingerprint.py in update_fingerprint(fingerprint, transform, transform_args)
103 for key in sorted(transform_args):
104 hasher.update(key)
--> 105 hasher.update(transform_args[key])
106 return hasher.hexdigest()
107
/usr/local/lib/python3.6/site-packages/datasets/fingerprint.py in update(self, value)
55 def update(self, value):
56 self.m.update(f"=={type(value)}==".encode("utf8"))
---> 57 self.m.update(self.hash(value).encode("utf-8"))
58
59 def hexdigest(self):
/usr/local/lib/python3.6/site-packages/datasets/fingerprint.py in hash(cls, value)
51 return cls.dispatch[type(value)](cls, value)
52 else:
---> 53 return cls.hash_default(value)
54
55 def update(self, value):
/usr/local/lib/python3.6/site-packages/datasets/fingerprint.py in hash_default(cls, value)
44 @classmethod
45 def hash_default(cls, value):
---> 46 return cls.hash_bytes(dumps(value))
47
48 @classmethod
/usr/local/lib/python3.6/site-packages/datasets/utils/py_utils.py in dumps(obj)
365 file = StringIO()
366 with _no_cache_fields(obj):
--> 367 dump(obj, file)
368 return file.getvalue()
369
/usr/local/lib/python3.6/site-packages/datasets/utils/py_utils.py in dump(obj, file)
337 def dump(obj, file):
338 """pickle an object to a file"""
--> 339 Pickler(file, recurse=True).dump(obj)
340 return
341
/usr/local/lib/python3.6/site-packages/dill/_dill.py in dump(self, obj)
444 raise PicklingError(msg)
445 else:
--> 446 StockPickler.dump(self, obj)
447 stack.clear() # clear record of 'recursion-sensitive' pickled objects
448 return
/usr/local/lib/python3.6/pickle.py in dump(self, obj)
407 if self.proto >= 4:
408 self.framer.start_framing()
--> 409 self.save(obj)
410 self.write(STOP)
411 self.framer.end_framing()
/usr/local/lib/python3.6/pickle.py in save(self, obj, save_persistent_id)
474 f = self.dispatch.get(t)
475 if f is not None:
--> 476 f(self, obj) # Call unbound method with explicit self
477 return
478
/usr/local/lib/python3.6/site-packages/dill/_dill.py in save_function(pickler, obj)
1436 globs, obj.__name__,
1437 obj.__defaults__, obj.__closure__,
-> 1438 obj.__dict__, fkwdefaults), obj=obj)
1439 else:
1440 _super = ('super' in getattr(obj.func_code,'co_names',())) and (_byref is not None) and getattr(pickler, '_recurse', False)
/usr/local/lib/python3.6/pickle.py in save_reduce(self, func, args, state, listitems, dictitems, obj)
608 else:
609 save(func)
--> 610 save(args)
611 write(REDUCE)
612
/usr/local/lib/python3.6/pickle.py in save(self, obj, save_persistent_id)
474 f = self.dispatch.get(t)
475 if f is not None:
--> 476 f(self, obj) # Call unbound method with explicit self
477 return
478
/usr/local/lib/python3.6/pickle.py in save_tuple(self, obj)
749 write(MARK)
750 for element in obj:
--> 751 save(element)
752
753 if id(obj) in memo:
/usr/local/lib/python3.6/pickle.py in save(self, obj, save_persistent_id)
474 f = self.dispatch.get(t)
475 if f is not None:
--> 476 f(self, obj) # Call unbound method with explicit self
477 return
478
/usr/local/lib/python3.6/site-packages/dill/_dill.py in save_module_dict(pickler, obj)
931 # we only care about session the first pass thru
932 pickler._session = False
--> 933 StockPickler.save_dict(pickler, obj)
934 log.info("# D2")
935 return
/usr/local/lib/python3.6/pickle.py in save_dict(self, obj)
819
820 self.memoize(obj)
--> 821 self._batch_setitems(obj.items())
822
823 dispatch[dict] = save_dict
/usr/local/lib/python3.6/pickle.py in _batch_setitems(self, items)
850 k, v = tmp[0]
851 save(k)
--> 852 save(v)
853 write(SETITEM)
854 # else tmp is empty, and we're done
/usr/local/lib/python3.6/pickle.py in save(self, obj, save_persistent_id)
519
520 # Save the reduce() output and finally memoize the object
--> 521 self.save_reduce(obj=obj, *rv)
522
523 def persistent_id(self, obj):
/usr/local/lib/python3.6/pickle.py in save_reduce(self, func, args, state, listitems, dictitems, obj)
632
633 if state is not None:
--> 634 save(state)
635 write(BUILD)
636
/usr/local/lib/python3.6/pickle.py in save(self, obj, save_persistent_id)
474 f = self.dispatch.get(t)
475 if f is not None:
--> 476 f(self, obj) # Call unbound method with explicit self
477 return
478
/usr/local/lib/python3.6/site-packages/dill/_dill.py in save_module_dict(pickler, obj)
931 # we only care about session the first pass thru
932 pickler._session = False
--> 933 StockPickler.save_dict(pickler, obj)
934 log.info("# D2")
935 return
/usr/local/lib/python3.6/pickle.py in save_dict(self, obj)
819
820 self.memoize(obj)
--> 821 self._batch_setitems(obj.items())
822
823 dispatch[dict] = save_dict
/usr/local/lib/python3.6/pickle.py in _batch_setitems(self, items)
845 for k, v in tmp:
846 save(k)
--> 847 save(v)
848 write(SETITEMS)
849 elif n:
/usr/local/lib/python3.6/pickle.py in save(self, obj, save_persistent_id)
519
520 # Save the reduce() output and finally memoize the object
--> 521 self.save_reduce(obj=obj, *rv)
522
523 def persistent_id(self, obj):
/usr/local/lib/python3.6/pickle.py in save_reduce(self, func, args, state, listitems, dictitems, obj)
632
633 if state is not None:
--> 634 save(state)
635 write(BUILD)
636
/usr/local/lib/python3.6/pickle.py in save(self, obj, save_persistent_id)
474 f = self.dispatch.get(t)
475 if f is not None:
--> 476 f(self, obj) # Call unbound method with explicit self
477 return
478
/usr/local/lib/python3.6/site-packages/dill/_dill.py in save_module_dict(pickler, obj)
931 # we only care about session the first pass thru
932 pickler._session = False
--> 933 StockPickler.save_dict(pickler, obj)
934 log.info("# D2")
935 return
/usr/local/lib/python3.6/pickle.py in save_dict(self, obj)
819
820 self.memoize(obj)
--> 821 self._batch_setitems(obj.items())
822
823 dispatch[dict] = save_dict
/usr/local/lib/python3.6/pickle.py in _batch_setitems(self, items)
845 for k, v in tmp:
846 save(k)
--> 847 save(v)
848 write(SETITEMS)
849 elif n:
/usr/local/lib/python3.6/pickle.py in save(self, obj, save_persistent_id)
494 reduce = getattr(obj, "__reduce_ex__", None)
495 if reduce is not None:
--> 496 rv = reduce(self.proto)
497 else:
498 reduce = getattr(obj, "__reduce__", None)
TypeError: can't pickle Tagger objects
```
</details>
trainsformers: 2.10.0
datasets: 1.0.2
dill: 0.3.2
python: 3.6.8
OS: ubuntu 16.04 (Docker Image) on [Deep Learning VM](https://console.cloud.google.com/marketplace/details/click-to-deploy-images/deeplearning) (GCP)
GPU: Tesla P100 (CUDA 10)
| [
-0.2387792468070984,
-0.29784899950027466,
-0.01968042179942131,
0.23303498327732086,
0.4450329542160034,
-0.1729922890663147,
0.285151869058609,
0.1309390813112259,
-0.27609169483184814,
0.11031325161457062,
-0.06978636234998703,
0.4891909956932068,
-0.008726135827600956,
-0.04673432186245918,
-0.14570960402488708,
-0.11147376894950867,
0.053560320287942886,
0.20785319805145264,
0.01811389997601509,
-0.0561075396835804,
-0.27878260612487793,
0.2074422836303711,
-0.4731772541999817,
0.1585230827331543,
-0.2825991213321686,
-0.26742836833000183,
0.10640472173690796,
-0.1985800564289093,
-0.2693116068840027,
-0.3823219835758209,
-0.14364492893218994,
-0.07336577773094177,
-0.02884814143180847,
0.563336968421936,
-0.00011926037404919043,
0.0994180291891098,
0.1089542955160141,
-0.145972341299057,
0.005223780870437622,
-0.04956597089767456,
-0.07480692863464355,
-0.3035498261451721,
-0.2058742642402649,
-0.458272784948349,
-0.15564605593681335,
-0.14384402334690094,
0.01115584559738636,
-0.332488477230072,
0.5145230889320374,
0.29142072796821594,
0.1399780958890915,
0.49322691559791565,
0.020635265856981277,
0.0532786101102829,
0.01532786339521408,
0.029823776334524155,
-0.13145363330841064,
-0.2608633041381836,
0.1487918347120285,
0.21654660999774933,
-0.130271315574646,
0.32548898458480835,
-0.1613031029701233,
-0.2627820670604706,
0.09947003424167633,
0.0949372872710228,
0.10411272197961807,
-0.4675593674182892,
0.32304832339286804,
-0.0021582134068012238,
0.21897175908088684,
-0.0208103209733963,
-0.2567599415779114,
-0.2679678201675415,
-0.07948525995016098,
0.0625915676355362,
-0.04125243425369263,
-0.20221516489982605,
0.0776134580373764,
0.05128606781363487,
-0.35269349813461304,
-0.17235323786735535,
-0.17987319827079773,
0.10823331773281097,
0.038386598229408264,
0.3674837648868561,
-0.26661092042922974,
0.29305195808410645,
0.09679804742336273,
-0.25016647577285767,
-0.11382152140140533,
-0.09912005811929703,
0.22644498944282532,
0.47687241435050964,
-0.3883419334888458,
-0.300885945558548,
-0.09438016265630722,
-0.40999895334243774,
0.34774601459503174,
-0.03840678930282593,
-0.22767992317676544,
0.25541263818740845,
-0.04895595833659172,
0.1893790066242218,
0.02317630872130394,
0.3520207107067108,
0.26322129368782043,
0.3699648678302765,
0.011672910302877426,
-0.1440165638923645,
0.06525957584381104,
-0.048873476684093475,
-0.08222289383411407,
-0.22157606482505798,
-0.05691240727901459,
0.2582862079143524,
0.35951292514801025,
-0.018613029271364212,
-0.046238239854574203,
0.02786199375987053,
-0.22628015279769897,
0.0427437499165535,
0.17346373200416565,
0.4068899154663086,
0.10801348090171814,
0.23184126615524292,
-0.31838929653167725,
0.09024085104465485,
-0.12427999824285507,
0.025306612253189087,
-0.16548646986484528,
0.21402311325073242,
-0.006621330976486206,
-0.13937939703464508,
-0.16431912779808044,
0.0698126032948494,
0.20134250819683075,
-0.026837512850761414,
0.0632021501660347,
-0.22027723491191864,
0.06153841316699982,
-0.17903092503547668,
0.2758256494998932,
-0.09431135654449463,
-0.050224341452121735,
0.17375634610652924,
0.20817093551158905,
-0.40948057174682617,
-0.20605650544166565,
0.035232916474342346,
-0.3411520719528198,
0.017331700772047043,
0.13118889927864075,
0.1185407042503357,
0.05623745918273926,
0.04769054800271988,
-0.3749629259109497,
0.2920551896095276,
0.41460344195365906,
0.007591649889945984,
0.03226820379495621,
-0.12673820555210114,
-0.2016417384147644,
-0.11112698912620544,
0.21824829280376434,
0.18993636965751648,
-0.1373288482427597,
-0.20797701179981232,
0.2503730058670044,
-0.0020624157041311264,
0.15356677770614624,
0.4049595594406128,
-0.05302755907177925,
0.25622016191482544,
-0.14678503572940826,
0.5597744584083557,
0.4704824388027191,
-0.625508189201355,
-0.5309314131736755,
0.10321839153766632,
-0.4468843936920166,
-0.1779436618089676,
-0.03534664958715439,
0.041638411581516266,
0.5613892078399658,
0.12415531277656555,
-0.1132064014673233,
0.3392552137374878,
0.07229578495025635,
0.2676008641719818,
-0.15639422833919525,
-0.14152976870536804,
0.40929919481277466,
0.09268194437026978,
0.21709808707237244,
0.11648884415626526,
-0.16825279593467712,
0.19713763892650604,
-0.10224737972021103,
-0.1236945390701294,
0.09144434332847595,
0.19020487368106842,
0.16542726755142212,
-0.21081383526325226,
0.08061237633228302,
-0.16297811269760132,
-0.5545790791511536,
0.06518654525279999,
-0.34768620133399963,
0.2234152853488922,
-0.28904998302459717,
-0.1947721689939499,
-0.28876471519470215,
0.15413497388362885,
-0.45191892981529236,
-0.052400071173906326,
0.0838475450873375,
-0.03061482310295105,
0.18893752992153168,
-0.013604627922177315,
0.019288551062345505,
-0.07614041119813919,
0.1458209604024887,
0.18609404563903809,
-0.2552468478679657,
0.20620331168174744,
-0.2569340169429779,
0.02114827185869217,
-0.05973024666309357,
0.09906291961669922,
0.4085010886192322,
-0.17598335444927216,
-0.2551455497741699,
0.2755492031574249,
0.17205199599266052,
-0.08486801385879517,
-0.05005958676338196,
-0.03503546118736267,
0.2658097743988037,
-0.20969520509243011,
-0.06440680474042892,
0.1785881519317627,
0.16671858727931976,
-0.02876027673482895,
-0.09293530136346817,
0.4431660771369934,
0.2247035801410675,
0.31786227226257324,
-0.01910526677966118,
0.1625133454799652,
0.24128490686416626,
-0.10274730622768402,
-0.04649505019187927,
-0.13554337620735168,
-0.17649294435977936,
0.0628637820482254,
0.23403991758823395,
-0.07365301996469498,
0.06564219295978546,
-0.059074871242046356,
0.8479932546615601,
-0.06834638118743896,
0.07938273996114731,
0.2044738531112671,
-0.11635082215070724,
0.049705870449543,
-0.07888424396514893,
-0.40181025862693787,
0.04173742234706879,
0.03922862559556961,
-0.17348940670490265,
-0.10662073642015457,
0.2546636462211609,
0.14594495296478271,
0.041524969041347504,
0.3150503635406494,
0.11469598859548569,
0.225544273853302,
0.15998724102973938,
0.11295114457607269,
-0.17203378677368164,
-0.19414323568344116,
0.16297325491905212,
0.1452348679304123,
-0.14686189591884613,
-0.024431999772787094,
-0.04605673998594284,
0.044477060437202454,
0.010470712557435036,
-0.04867228865623474,
-0.19503360986709595,
-0.250466912984848,
0.03378954157233238,
-0.023758497089147568,
0.09573529660701752,
0.449554979801178,
0.3668549656867981,
0.3240298628807068,
0.4278208613395691,
-0.10992073267698288,
-0.1704414188861847,
-0.19697964191436768,
-0.08769410103559494,
-0.06773465126752853,
0.1707262545824051,
-0.00535688316449523,
-0.03574804961681366,
0.010384462773799896,
0.10249228775501251,
-0.45612791180610657,
-0.4291422665119171,
0.2537456154823303,
-0.17828468978405,
0.1860090047121048,
-0.014134995639324188,
0.12101293355226517,
-0.3429492712020874,
-0.2921084761619568,
0.2118503600358963,
-0.21941320598125458,
-0.30137452483177185,
0.07068181037902832,
-0.061088766902685165,
-0.3209868371486664,
0.05117690935730934,
-0.24058660864830017,
-0.3765723705291748,
-0.33769187331199646,
0.3630162477493286,
-0.008248493075370789,
0.1135793924331665,
0.15415820479393005,
-0.00302607798948884,
0.2885194420814514,
-0.020071396604180336,
-0.035907477140426636,
-0.24400143325328827,
0.054305534809827805,
0.4122081995010376,
-0.18261869251728058,
-0.2826859652996063,
-0.39157694578170776,
-0.17591607570648193,
0.05257883667945862,
-0.12937913835048676,
-0.10209265351295471,
-0.22754734754562378,
-0.2711943984031677,
0.22384607791900635,
-0.16086310148239136,
0.045888230204582214,
0.5580427646636963,
-0.049236368387937546,
0.09076553583145142,
0.01156727597117424,
-0.16093182563781738,
0.27200356125831604,
0.1358187049627304,
0.081289142370224,
-0.010779760777950287,
0.5259879231452942,
0.1519598662853241,
0.8704360127449036,
0.15821492671966553,
-0.21943803131580353,
0.16835519671440125,
-0.14850348234176636,
-0.01063704863190651,
-0.03405507653951645,
-0.38928478956222534,
0.1844978630542755,
-0.04435047507286072,
0.12260723114013672,
0.13958825170993805,
-0.20949199795722961,
-0.15563496947288513,
0.14549137651920319,
-0.09472277760505676,
-0.218725323677063,
-0.27573642134666443,
-0.022572895511984825,
0.09790511429309845,
0.09834414720535278,
0.04776653274893761,
0.1866316795349121,
-0.44355639815330505,
0.06796005368232727,
0.11922764778137207,
0.004403114318847656,
0.048046551644802094,
-0.04683779925107956,
-1.0162560939788818,
-0.09132109582424164,
-0.17027941346168518,
0.36549264192581177,
0.22949711978435516,
0.4982428550720215,
-0.017992455512285233,
-0.04699508473277092,
0.05150580406188965,
-0.21210986375808716,
0.8495116829872131,
0.2505570650100708,
-0.05321195721626282,
0.07962740957736969,
0.018949035555124283,
-0.15455107390880585,
0.057700660079717636,
-0.16324123740196228,
0.6255757212638855,
0.4945645332336426,
0.7852731943130493,
-0.43740472197532654,
-0.08937069773674011,
0.031204042956233025,
-0.059960100799798965,
-0.1476590782403946,
0.08103042095899582,
-0.2087637037038803,
-0.180411696434021,
-0.5762062072753906,
0.25856703519821167,
0.28101325035095215,
0.19283361732959747,
0.15283092856407166,
-0.22316685318946838,
0.06901504844427109,
-0.28400319814682007,
-0.0985405296087265,
0.23120428621768951,
0.21433523297309875,
0.18589964509010315,
-0.0022402051836252213,
0.1455385386943817,
-0.1561146229505539,
-0.20688201487064362,
0.18994294106960297,
0.25589486956596375,
-0.6231854557991028,
0.2523166835308075,
0.16514982283115387,
0.5603795051574707,
0.15823112428188324,
-0.11502523720264435,
0.29464662075042725,
-0.01051352545619011,
0.47939586639404297,
-0.03906324505805969,
0.47881969809532166,
0.36262446641921997,
0.27784213423728943,
-0.301658570766449,
-0.13845354318618774,
0.38594749569892883,
-0.015479073859751225,
0.07214416563510895,
0.015306081622838974,
0.26423370838165283,
-0.15237964689731598,
0.5785444974899292,
0.10501522570848465,
1.0689465999603271,
-0.09628941118717194,
-0.09116224944591522,
0.12688452005386353,
0.26558351516723633,
0.5600724220275879,
-0.2914607524871826,
0.20523881912231445,
-0.5174928307533264,
-0.09049858152866364,
0.004256146028637886,
-0.13982944190502167,
0.13500869274139404,
0.18870440125465393,
-0.43005746603012085,
0.13892552256584167,
0.09927932918071747,
0.4275941550731659,
0.0399220809340477,
0.41344207525253296,
-0.01810356043279171,
-0.47711026668548584,
-0.12599581480026245,
0.06626572459936142,
-0.2162787765264511,
0.2179781198501587,
0.09313574433326721,
0.016773607581853867,
-0.22999055683612823,
-0.33340728282928467,
-0.06853975355625153,
0.08772076666355133,
-0.3980344831943512,
0.6731892228126526,
0.3429543673992157,
-0.19453462958335876,
0.29567334055900574,
0.2294493168592453,
0.15479309856891632,
0.2516958713531494,
-0.06370928883552551,
0.16826605796813965,
0.14975035190582275,
-0.0029831882566213608,
0.19938354194164276,
-0.06823351979255676,
0.11906512826681137,
-0.010318662971258163,
-0.10151160508394241,
0.175491064786911,
-0.012460781261324883,
-0.2762168347835541,
-0.2717879116535187,
-0.12400531768798828,
0.290338397026062,
-0.3395358622074127,
-0.2814115583896637,
-0.039557285606861115,
-0.28503528237342834,
-0.20351310074329376,
0.022034604102373123,
-0.07065904140472412,
-0.374799519777298,
0.22638219594955444,
0.23766908049583435,
-0.14269255101680756,
0.16958646476268768,
0.3712310492992401,
-0.025501083582639694,
-0.0888265073299408,
0.5584914684295654,
0.0715673416852951,
-0.19460977613925934,
-0.2024843990802765,
0.15187907218933105,
-0.033778805285692215,
-0.22719457745552063,
0.10915811359882355,
-0.1162661463022232,
-0.2636433243751526,
-0.22879533469676971,
0.3435634970664978,
-0.025700241327285767,
0.04026198014616966,
-0.2143467515707016,
-0.4193451404571533,
-0.5076627731323242,
0.049949295818805695,
-0.13119997084140778,
0.18116499483585358,
0.4385978579521179,
0.40800604224205017,
-0.25686928629875183,
0.3760196566581726,
-0.2495919018983841,
-0.08002421259880066,
-0.5987672805786133,
0.2662302255630493,
0.01884259283542633,
-0.5459761619567871,
-0.027553904801607132,
0.02164069376885891,
0.026443468406796455,
0.294058620929718,
-0.12007908523082733,
-0.15881237387657166,
-0.07026086002588272,
0.16056318581104279,
0.2280811369419098,
-0.10137251019477844,
-0.2458610236644745,
0.11841046810150146,
-0.17929944396018982,
-0.15681114792823792,
0.1025065928697586,
0.1319531500339508,
0.012163061648607254,
0.12355339527130127,
-0.09083551168441772,
-0.11700523644685745,
-0.05135424807667732,
-0.08652322739362717,
0.04924800619482994,
-0.15517960488796234,
0.2005685269832611,
0.38877812027931213,
-0.19008755683898926,
-0.009076409041881561,
-0.29091838002204895,
0.17954382300376892,
0.6930253505706787,
0.009677674621343613,
0.3933945298194885,
-0.31458789110183716,
-0.15080979466438293,
0.22921109199523926,
-0.20730316638946533,
0.18506640195846558,
-0.3238910436630249,
-0.09588629007339478,
0.22866439819335938,
0.12948498129844666,
-0.2605692744255066,
-0.20624437928199768,
0.5028800368309021,
-0.3981369435787201,
0.1572275012731552,
0.12966448068618774,
-0.09836220741271973,
0.2678849697113037,
0.18320630490779877,
0.1603044867515564,
0.7458080649375916,
0.011786268092691898,
0.17655035853385925,
-0.06224888935685158,
-0.09200140088796616,
0.05511584132909775,
0.5123581290245056,
0.13516101241111755,
0.2308288961648941,
0.11014201492071152,
-0.20327258110046387,
0.37733936309814453,
-0.42855411767959595,
0.2233327180147171,
0.36982885003089905,
-0.12526848912239075,
-0.19376134872436523,
0.20874705910682678,
-0.14037078619003296,
0.2644398808479309,
-0.04349501430988312,
0.35226011276245117,
-0.1093691885471344,
-0.17406626045703888,
-0.16872172057628632,
0.49048706889152527,
-0.3190309703350067,
-0.049097366631031036,
-0.021232690662145615,
-0.07593855261802673,
-0.1959420144557953,
-0.28567615151405334,
0.050842709839344025,
-0.06166030466556549,
0.10977569967508316,
0.015786856412887573,
-0.08042746782302856,
0.2032719999551773,
-0.14787951111793518,
0.17750829458236694,
0.24254110455513,
-0.32913538813591003,
0.2424011528491974,
0.1096196249127388,
0.2629409432411194,
-0.24783456325531006,
0.11491469293832779,
0.3023820221424103,
0.26866012811660767,
-0.4128156304359436,
0.1197531670331955,
-0.061437491327524185,
-0.15522582828998566,
0.15395838022232056,
0.1354498416185379,
-0.1843048334121704,
-0.21929125487804413,
0.23018088936805725,
0.07787932455539703,
-0.2095593959093094,
-0.17226456105709076,
0.1902216076850891,
0.10927625000476837,
0.1233893632888794,
-0.049729399383068085,
-0.08056873083114624,
-0.20539340376853943,
-0.3169712722301483,
-0.17713499069213867,
-0.39904630184173584,
-0.04866921156644821,
0.08204156160354614,
-0.23340527713298798,
0.2352660596370697,
-0.306997686624527,
0.08067841082811356,
0.08235998451709747,
0.36441871523857117,
0.31551843881607056,
0.08895154297351837,
-0.3957797884941101,
-0.02335897833108902,
-0.40491533279418945,
0.21320071816444397,
0.30975788831710815,
-0.19389264285564423,
0.08527778834104538,
0.1949712485074997,
0.06053662300109863,
0.31443339586257935,
-0.10639722645282745,
0.057046450674533844,
-0.13181345164775848,
-0.006787165999412537,
-0.21990114450454712,
0.13424824178218842,
-0.16535654664039612,
0.1062282919883728,
0.2053379863500595,
-0.3196316957473755,
0.3005921244621277,
0.2335086166858673,
-0.016038425266742706,
-0.20376719534397125,
-0.07318393886089325,
-0.21352843940258026,
-0.3241588771343231,
-0.04828055948019028,
0.2011154741048813,
0.2985321581363678,
-0.28266650438308716,
0.18013443052768707,
0.20976580679416656,
-0.043841224163770676,
-0.2875528335571289,
-0.19312211871147156,
0.15643532574176788,
0.4927528202533722,
-0.0002095801755785942,
0.12636980414390564,
-0.3023885190486908,
-0.17570357024669647,
0.08756741881370544,
-0.28133371472358704,
-0.24230000376701355,
0.33336523175239563,
-0.20570093393325806,
0.1753343790769577,
-0.014726635068655014,
0.21862280368804932,
0.07085446268320084,
0.28340816497802734,
-0.24533317983150482,
-0.45495712757110596,
0.6601229906082153,
-0.4289315640926361,
-0.48007938265800476,
-0.05626486986875534,
-0.06597250699996948,
0.13737857341766357,
-0.2057526409626007,
-0.2559032440185547,
-0.15045183897018433,
0.2913421094417572,
0.08456270396709442,
-0.20066991448402405,
0.05188633129000664,
0.15546011924743652,
-0.03583145514130592,
-0.150189608335495,
0.3721500039100647,
0.12918761372566223,
0.06289525330066681,
0.10387624800205231,
-0.2139434814453125
] |
https://github.com/huggingface/datasets/issues/665 | runing dataset.map, it raises TypeError: can't pickle Tokenizer objects | > I have the same issue with `transformers/BertJapaneseTokenizer`.
It looks like it this tokenizer is not supported unfortunately.
This is because `t.word_tokenizer.mecab` is a `fugashi.fugashi.GenericTagger` which is not compatible with pickle nor dill.
We need objects passes to `map` to be picklable for our caching system to work properly.
Here it crashes because the caching system is not able to pickle the GenericTagger.
\> Maybe you can create an issue on [fugashi](https://github.com/polm/fugashi/issues) 's repo and ask to make `fugashi.fugashi.GenericTagger` compatible with pickle ?
What you can do in the meantime is use a picklable wrapper of the tokenizer:
```python
from transformers import BertJapaneseTokenizer, MecabTokenizer
class PicklableTokenizer(BertJapaneseTokenizer):
def __getstate__(self):
state = dict(self.__dict__)
state["do_lower_case"] = self.word_tokenizer.do_lower_case
state["never_split"] = self.word_tokenizer.never_split
del state["word_tokenizer"]
return state
def __setstate__(self, state):
do_lower_case = state.pop("do_lower_case")
never_split = state.pop("never_split")
self.__dict__ = state
self.word_tokenizer = MecabTokenizer(
do_lower_case=do_lower_case, never_split=never_split)
)
t = PicklableTokenizer.from_pretrained("cl-tohoku/bert-base-japanese-whole-word-masking")
encoded = train_ds.map(lambda examples: {'tokens': t.encode(examples['title'])}, batched=True) # it works
``` | I load squad dataset. Then want to process data use following function with `Huggingface Transformers LongformerTokenizer`.
```
def convert_to_features(example):
# Tokenize contexts and questions (as pairs of inputs)
input_pairs = [example['question'], example['context']]
encodings = tokenizer.encode_plus(input_pairs, pad_to_max_length=True, max_length=512)
context_encodings = tokenizer.encode_plus(example['context'])
# Compute start and end tokens for labels using Transformers's fast tokenizers alignement methodes.
# this will give us the position of answer span in the context text
start_idx, end_idx = get_correct_alignement(example['context'], example['answers'])
start_positions_context = context_encodings.char_to_token(start_idx)
end_positions_context = context_encodings.char_to_token(end_idx-1)
# here we will compute the start and end position of the answer in the whole example
# as the example is encoded like this <s> question</s></s> context</s>
# and we know the postion of the answer in the context
# we can just find out the index of the sep token and then add that to position + 1 (+1 because there are two sep tokens)
# this will give us the position of the answer span in whole example
sep_idx = encodings['input_ids'].index(tokenizer.sep_token_id)
start_positions = start_positions_context + sep_idx + 1
end_positions = end_positions_context + sep_idx + 1
if end_positions > 512:
start_positions, end_positions = 0, 0
encodings.update({'start_positions': start_positions,
'end_positions': end_positions,
'attention_mask': encodings['attention_mask']})
return encodings
```
Then I run `dataset.map(convert_to_features)`, it raise
```
In [59]: a.map(convert_to_features)
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-59-c453b508761d> in <module>
----> 1 a.map(convert_to_features)
/opt/conda/lib/python3.7/site-packages/datasets/arrow_dataset.py in map(self, function, with_indices, input_columns, batched, batch_size, drop_last_batch, remove_columns, keep_in_memory, load_from_cache_file, cache_file_name, writer_batch_size, features, disable_nullable, fn_kwargs, num_proc, suffix_template, new_fingerprint)
1242 fn_kwargs=fn_kwargs,
1243 new_fingerprint=new_fingerprint,
-> 1244 update_data=update_data,
1245 )
1246 else:
/opt/conda/lib/python3.7/site-packages/datasets/arrow_dataset.py in wrapper(*args, **kwargs)
151 "output_all_columns": self._output_all_columns,
152 }
--> 153 out: Union["Dataset", "DatasetDict"] = func(self, *args, **kwargs)
154 if new_format["columns"] is not None:
155 new_format["columns"] = list(set(new_format["columns"]) & set(out.column_names))
/opt/conda/lib/python3.7/site-packages/datasets/fingerprint.py in wrapper(*args, **kwargs)
156 kwargs_for_fingerprint["fingerprint_name"] = fingerprint_name
157 kwargs[fingerprint_name] = update_fingerprint(
--> 158 self._fingerprint, transform, kwargs_for_fingerprint
159 )
160
/opt/conda/lib/python3.7/site-packages/datasets/fingerprint.py in update_fingerprint(fingerprint, transform, transform_args)
103 for key in sorted(transform_args):
104 hasher.update(key)
--> 105 hasher.update(transform_args[key])
106 return hasher.hexdigest()
107
/opt/conda/lib/python3.7/site-packages/datasets/fingerprint.py in update(self, value)
55 def update(self, value):
56 self.m.update(f"=={type(value)}==".encode("utf8"))
---> 57 self.m.update(self.hash(value).encode("utf-8"))
58
59 def hexdigest(self):
/opt/conda/lib/python3.7/site-packages/datasets/fingerprint.py in hash(cls, value)
51 return cls.dispatch[type(value)](cls, value)
52 else:
---> 53 return cls.hash_default(value)
54
55 def update(self, value):
/opt/conda/lib/python3.7/site-packages/datasets/fingerprint.py in hash_default(cls, value)
44 @classmethod
45 def hash_default(cls, value):
---> 46 return cls.hash_bytes(dumps(value))
47
48 @classmethod
/opt/conda/lib/python3.7/site-packages/datasets/utils/py_utils.py in dumps(obj)
365 file = StringIO()
366 with _no_cache_fields(obj):
--> 367 dump(obj, file)
368 return file.getvalue()
369
/opt/conda/lib/python3.7/site-packages/datasets/utils/py_utils.py in dump(obj, file)
337 def dump(obj, file):
338 """pickle an object to a file"""
--> 339 Pickler(file, recurse=True).dump(obj)
340 return
341
/opt/conda/lib/python3.7/site-packages/dill/_dill.py in dump(self, obj)
444 raise PicklingError(msg)
445 else:
--> 446 StockPickler.dump(self, obj)
447 stack.clear() # clear record of 'recursion-sensitive' pickled objects
448 return
/opt/conda/lib/python3.7/pickle.py in dump(self, obj)
435 if self.proto >= 4:
436 self.framer.start_framing()
--> 437 self.save(obj)
438 self.write(STOP)
439 self.framer.end_framing()
/opt/conda/lib/python3.7/pickle.py in save(self, obj, save_persistent_id)
502 f = self.dispatch.get(t)
503 if f is not None:
--> 504 f(self, obj) # Call unbound method with explicit self
505 return
506
/opt/conda/lib/python3.7/site-packages/dill/_dill.py in save_function(pickler, obj)
1436 globs, obj.__name__,
1437 obj.__defaults__, obj.__closure__,
-> 1438 obj.__dict__, fkwdefaults), obj=obj)
1439 else:
1440 _super = ('super' in getattr(obj.func_code,'co_names',())) and (_byref is not None) and getattr(pickler, '_recurse', False)
/opt/conda/lib/python3.7/pickle.py in save_reduce(self, func, args, state, listitems, dictitems, obj)
636 else:
637 save(func)
--> 638 save(args)
639 write(REDUCE)
640
/opt/conda/lib/python3.7/pickle.py in save(self, obj, save_persistent_id)
502 f = self.dispatch.get(t)
503 if f is not None:
--> 504 f(self, obj) # Call unbound method with explicit self
505 return
506
/opt/conda/lib/python3.7/pickle.py in save_tuple(self, obj)
787 write(MARK)
788 for element in obj:
--> 789 save(element)
790
791 if id(obj) in memo:
/opt/conda/lib/python3.7/pickle.py in save(self, obj, save_persistent_id)
502 f = self.dispatch.get(t)
503 if f is not None:
--> 504 f(self, obj) # Call unbound method with explicit self
505 return
506
/opt/conda/lib/python3.7/site-packages/dill/_dill.py in save_module_dict(pickler, obj)
931 # we only care about session the first pass thru
932 pickler._session = False
--> 933 StockPickler.save_dict(pickler, obj)
934 log.info("# D2")
935 return
/opt/conda/lib/python3.7/pickle.py in save_dict(self, obj)
857
858 self.memoize(obj)
--> 859 self._batch_setitems(obj.items())
860
861 dispatch[dict] = save_dict
/opt/conda/lib/python3.7/pickle.py in _batch_setitems(self, items)
883 for k, v in tmp:
884 save(k)
--> 885 save(v)
886 write(SETITEMS)
887 elif n:
/opt/conda/lib/python3.7/pickle.py in save(self, obj, save_persistent_id)
547
548 # Save the reduce() output and finally memoize the object
--> 549 self.save_reduce(obj=obj, *rv)
550
551 def persistent_id(self, obj):
/opt/conda/lib/python3.7/pickle.py in save_reduce(self, func, args, state, listitems, dictitems, obj)
660
661 if state is not None:
--> 662 save(state)
663 write(BUILD)
664
/opt/conda/lib/python3.7/pickle.py in save(self, obj, save_persistent_id)
502 f = self.dispatch.get(t)
503 if f is not None:
--> 504 f(self, obj) # Call unbound method with explicit self
505 return
506
/opt/conda/lib/python3.7/site-packages/dill/_dill.py in save_module_dict(pickler, obj)
931 # we only care about session the first pass thru
932 pickler._session = False
--> 933 StockPickler.save_dict(pickler, obj)
934 log.info("# D2")
935 return
/opt/conda/lib/python3.7/pickle.py in save_dict(self, obj)
857
858 self.memoize(obj)
--> 859 self._batch_setitems(obj.items())
860
861 dispatch[dict] = save_dict
/opt/conda/lib/python3.7/pickle.py in _batch_setitems(self, items)
883 for k, v in tmp:
884 save(k)
--> 885 save(v)
886 write(SETITEMS)
887 elif n:
/opt/conda/lib/python3.7/pickle.py in save(self, obj, save_persistent_id)
547
548 # Save the reduce() output and finally memoize the object
--> 549 self.save_reduce(obj=obj, *rv)
550
551 def persistent_id(self, obj):
/opt/conda/lib/python3.7/pickle.py in save_reduce(self, func, args, state, listitems, dictitems, obj)
660
661 if state is not None:
--> 662 save(state)
663 write(BUILD)
664
/opt/conda/lib/python3.7/pickle.py in save(self, obj, save_persistent_id)
502 f = self.dispatch.get(t)
503 if f is not None:
--> 504 f(self, obj) # Call unbound method with explicit self
505 return
506
/opt/conda/lib/python3.7/site-packages/dill/_dill.py in save_module_dict(pickler, obj)
931 # we only care about session the first pass thru
932 pickler._session = False
--> 933 StockPickler.save_dict(pickler, obj)
934 log.info("# D2")
935 return
/opt/conda/lib/python3.7/pickle.py in save_dict(self, obj)
857
858 self.memoize(obj)
--> 859 self._batch_setitems(obj.items())
860
861 dispatch[dict] = save_dict
/opt/conda/lib/python3.7/pickle.py in _batch_setitems(self, items)
883 for k, v in tmp:
884 save(k)
--> 885 save(v)
886 write(SETITEMS)
887 elif n:
/opt/conda/lib/python3.7/pickle.py in save(self, obj, save_persistent_id)
522 reduce = getattr(obj, "__reduce_ex__", None)
523 if reduce is not None:
--> 524 rv = reduce(self.proto)
525 else:
526 reduce = getattr(obj, "__reduce__", None)
TypeError: can't pickle Tokenizer objects
```
| 153 | runing dataset.map, it raises TypeError: can't pickle Tokenizer objects
I load squad dataset. Then want to process data use following function with `Huggingface Transformers LongformerTokenizer`.
```
def convert_to_features(example):
# Tokenize contexts and questions (as pairs of inputs)
input_pairs = [example['question'], example['context']]
encodings = tokenizer.encode_plus(input_pairs, pad_to_max_length=True, max_length=512)
context_encodings = tokenizer.encode_plus(example['context'])
# Compute start and end tokens for labels using Transformers's fast tokenizers alignement methodes.
# this will give us the position of answer span in the context text
start_idx, end_idx = get_correct_alignement(example['context'], example['answers'])
start_positions_context = context_encodings.char_to_token(start_idx)
end_positions_context = context_encodings.char_to_token(end_idx-1)
# here we will compute the start and end position of the answer in the whole example
# as the example is encoded like this <s> question</s></s> context</s>
# and we know the postion of the answer in the context
# we can just find out the index of the sep token and then add that to position + 1 (+1 because there are two sep tokens)
# this will give us the position of the answer span in whole example
sep_idx = encodings['input_ids'].index(tokenizer.sep_token_id)
start_positions = start_positions_context + sep_idx + 1
end_positions = end_positions_context + sep_idx + 1
if end_positions > 512:
start_positions, end_positions = 0, 0
encodings.update({'start_positions': start_positions,
'end_positions': end_positions,
'attention_mask': encodings['attention_mask']})
return encodings
```
Then I run `dataset.map(convert_to_features)`, it raise
```
In [59]: a.map(convert_to_features)
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-59-c453b508761d> in <module>
----> 1 a.map(convert_to_features)
/opt/conda/lib/python3.7/site-packages/datasets/arrow_dataset.py in map(self, function, with_indices, input_columns, batched, batch_size, drop_last_batch, remove_columns, keep_in_memory, load_from_cache_file, cache_file_name, writer_batch_size, features, disable_nullable, fn_kwargs, num_proc, suffix_template, new_fingerprint)
1242 fn_kwargs=fn_kwargs,
1243 new_fingerprint=new_fingerprint,
-> 1244 update_data=update_data,
1245 )
1246 else:
/opt/conda/lib/python3.7/site-packages/datasets/arrow_dataset.py in wrapper(*args, **kwargs)
151 "output_all_columns": self._output_all_columns,
152 }
--> 153 out: Union["Dataset", "DatasetDict"] = func(self, *args, **kwargs)
154 if new_format["columns"] is not None:
155 new_format["columns"] = list(set(new_format["columns"]) & set(out.column_names))
/opt/conda/lib/python3.7/site-packages/datasets/fingerprint.py in wrapper(*args, **kwargs)
156 kwargs_for_fingerprint["fingerprint_name"] = fingerprint_name
157 kwargs[fingerprint_name] = update_fingerprint(
--> 158 self._fingerprint, transform, kwargs_for_fingerprint
159 )
160
/opt/conda/lib/python3.7/site-packages/datasets/fingerprint.py in update_fingerprint(fingerprint, transform, transform_args)
103 for key in sorted(transform_args):
104 hasher.update(key)
--> 105 hasher.update(transform_args[key])
106 return hasher.hexdigest()
107
/opt/conda/lib/python3.7/site-packages/datasets/fingerprint.py in update(self, value)
55 def update(self, value):
56 self.m.update(f"=={type(value)}==".encode("utf8"))
---> 57 self.m.update(self.hash(value).encode("utf-8"))
58
59 def hexdigest(self):
/opt/conda/lib/python3.7/site-packages/datasets/fingerprint.py in hash(cls, value)
51 return cls.dispatch[type(value)](cls, value)
52 else:
---> 53 return cls.hash_default(value)
54
55 def update(self, value):
/opt/conda/lib/python3.7/site-packages/datasets/fingerprint.py in hash_default(cls, value)
44 @classmethod
45 def hash_default(cls, value):
---> 46 return cls.hash_bytes(dumps(value))
47
48 @classmethod
/opt/conda/lib/python3.7/site-packages/datasets/utils/py_utils.py in dumps(obj)
365 file = StringIO()
366 with _no_cache_fields(obj):
--> 367 dump(obj, file)
368 return file.getvalue()
369
/opt/conda/lib/python3.7/site-packages/datasets/utils/py_utils.py in dump(obj, file)
337 def dump(obj, file):
338 """pickle an object to a file"""
--> 339 Pickler(file, recurse=True).dump(obj)
340 return
341
/opt/conda/lib/python3.7/site-packages/dill/_dill.py in dump(self, obj)
444 raise PicklingError(msg)
445 else:
--> 446 StockPickler.dump(self, obj)
447 stack.clear() # clear record of 'recursion-sensitive' pickled objects
448 return
/opt/conda/lib/python3.7/pickle.py in dump(self, obj)
435 if self.proto >= 4:
436 self.framer.start_framing()
--> 437 self.save(obj)
438 self.write(STOP)
439 self.framer.end_framing()
/opt/conda/lib/python3.7/pickle.py in save(self, obj, save_persistent_id)
502 f = self.dispatch.get(t)
503 if f is not None:
--> 504 f(self, obj) # Call unbound method with explicit self
505 return
506
/opt/conda/lib/python3.7/site-packages/dill/_dill.py in save_function(pickler, obj)
1436 globs, obj.__name__,
1437 obj.__defaults__, obj.__closure__,
-> 1438 obj.__dict__, fkwdefaults), obj=obj)
1439 else:
1440 _super = ('super' in getattr(obj.func_code,'co_names',())) and (_byref is not None) and getattr(pickler, '_recurse', False)
/opt/conda/lib/python3.7/pickle.py in save_reduce(self, func, args, state, listitems, dictitems, obj)
636 else:
637 save(func)
--> 638 save(args)
639 write(REDUCE)
640
/opt/conda/lib/python3.7/pickle.py in save(self, obj, save_persistent_id)
502 f = self.dispatch.get(t)
503 if f is not None:
--> 504 f(self, obj) # Call unbound method with explicit self
505 return
506
/opt/conda/lib/python3.7/pickle.py in save_tuple(self, obj)
787 write(MARK)
788 for element in obj:
--> 789 save(element)
790
791 if id(obj) in memo:
/opt/conda/lib/python3.7/pickle.py in save(self, obj, save_persistent_id)
502 f = self.dispatch.get(t)
503 if f is not None:
--> 504 f(self, obj) # Call unbound method with explicit self
505 return
506
/opt/conda/lib/python3.7/site-packages/dill/_dill.py in save_module_dict(pickler, obj)
931 # we only care about session the first pass thru
932 pickler._session = False
--> 933 StockPickler.save_dict(pickler, obj)
934 log.info("# D2")
935 return
/opt/conda/lib/python3.7/pickle.py in save_dict(self, obj)
857
858 self.memoize(obj)
--> 859 self._batch_setitems(obj.items())
860
861 dispatch[dict] = save_dict
/opt/conda/lib/python3.7/pickle.py in _batch_setitems(self, items)
883 for k, v in tmp:
884 save(k)
--> 885 save(v)
886 write(SETITEMS)
887 elif n:
/opt/conda/lib/python3.7/pickle.py in save(self, obj, save_persistent_id)
547
548 # Save the reduce() output and finally memoize the object
--> 549 self.save_reduce(obj=obj, *rv)
550
551 def persistent_id(self, obj):
/opt/conda/lib/python3.7/pickle.py in save_reduce(self, func, args, state, listitems, dictitems, obj)
660
661 if state is not None:
--> 662 save(state)
663 write(BUILD)
664
/opt/conda/lib/python3.7/pickle.py in save(self, obj, save_persistent_id)
502 f = self.dispatch.get(t)
503 if f is not None:
--> 504 f(self, obj) # Call unbound method with explicit self
505 return
506
/opt/conda/lib/python3.7/site-packages/dill/_dill.py in save_module_dict(pickler, obj)
931 # we only care about session the first pass thru
932 pickler._session = False
--> 933 StockPickler.save_dict(pickler, obj)
934 log.info("# D2")
935 return
/opt/conda/lib/python3.7/pickle.py in save_dict(self, obj)
857
858 self.memoize(obj)
--> 859 self._batch_setitems(obj.items())
860
861 dispatch[dict] = save_dict
/opt/conda/lib/python3.7/pickle.py in _batch_setitems(self, items)
883 for k, v in tmp:
884 save(k)
--> 885 save(v)
886 write(SETITEMS)
887 elif n:
/opt/conda/lib/python3.7/pickle.py in save(self, obj, save_persistent_id)
547
548 # Save the reduce() output and finally memoize the object
--> 549 self.save_reduce(obj=obj, *rv)
550
551 def persistent_id(self, obj):
/opt/conda/lib/python3.7/pickle.py in save_reduce(self, func, args, state, listitems, dictitems, obj)
660
661 if state is not None:
--> 662 save(state)
663 write(BUILD)
664
/opt/conda/lib/python3.7/pickle.py in save(self, obj, save_persistent_id)
502 f = self.dispatch.get(t)
503 if f is not None:
--> 504 f(self, obj) # Call unbound method with explicit self
505 return
506
/opt/conda/lib/python3.7/site-packages/dill/_dill.py in save_module_dict(pickler, obj)
931 # we only care about session the first pass thru
932 pickler._session = False
--> 933 StockPickler.save_dict(pickler, obj)
934 log.info("# D2")
935 return
/opt/conda/lib/python3.7/pickle.py in save_dict(self, obj)
857
858 self.memoize(obj)
--> 859 self._batch_setitems(obj.items())
860
861 dispatch[dict] = save_dict
/opt/conda/lib/python3.7/pickle.py in _batch_setitems(self, items)
883 for k, v in tmp:
884 save(k)
--> 885 save(v)
886 write(SETITEMS)
887 elif n:
/opt/conda/lib/python3.7/pickle.py in save(self, obj, save_persistent_id)
522 reduce = getattr(obj, "__reduce_ex__", None)
523 if reduce is not None:
--> 524 rv = reduce(self.proto)
525 else:
526 reduce = getattr(obj, "__reduce__", None)
TypeError: can't pickle Tokenizer objects
```
> I have the same issue with `transformers/BertJapaneseTokenizer`.
It looks like it this tokenizer is not supported unfortunately.
This is because `t.word_tokenizer.mecab` is a `fugashi.fugashi.GenericTagger` which is not compatible with pickle nor dill.
We need objects passes to `map` to be picklable for our caching system to work properly.
Here it crashes because the caching system is not able to pickle the GenericTagger.
\> Maybe you can create an issue on [fugashi](https://github.com/polm/fugashi/issues) 's repo and ask to make `fugashi.fugashi.GenericTagger` compatible with pickle ?
What you can do in the meantime is use a picklable wrapper of the tokenizer:
```python
from transformers import BertJapaneseTokenizer, MecabTokenizer
class PicklableTokenizer(BertJapaneseTokenizer):
def __getstate__(self):
state = dict(self.__dict__)
state["do_lower_case"] = self.word_tokenizer.do_lower_case
state["never_split"] = self.word_tokenizer.never_split
del state["word_tokenizer"]
return state
def __setstate__(self, state):
do_lower_case = state.pop("do_lower_case")
never_split = state.pop("never_split")
self.__dict__ = state
self.word_tokenizer = MecabTokenizer(
do_lower_case=do_lower_case, never_split=never_split)
)
t = PicklableTokenizer.from_pretrained("cl-tohoku/bert-base-japanese-whole-word-masking")
encoded = train_ds.map(lambda examples: {'tokens': t.encode(examples['title'])}, batched=True) # it works
``` | [
-0.2387792468070984,
-0.29784899950027466,
-0.01968042179942131,
0.23303498327732086,
0.4450329542160034,
-0.1729922890663147,
0.285151869058609,
0.1309390813112259,
-0.27609169483184814,
0.11031325161457062,
-0.06978636234998703,
0.4891909956932068,
-0.008726135827600956,
-0.04673432186245918,
-0.14570960402488708,
-0.11147376894950867,
0.053560320287942886,
0.20785319805145264,
0.01811389997601509,
-0.0561075396835804,
-0.27878260612487793,
0.2074422836303711,
-0.4731772541999817,
0.1585230827331543,
-0.2825991213321686,
-0.26742836833000183,
0.10640472173690796,
-0.1985800564289093,
-0.2693116068840027,
-0.3823219835758209,
-0.14364492893218994,
-0.07336577773094177,
-0.02884814143180847,
0.563336968421936,
-0.00011926037404919043,
0.0994180291891098,
0.1089542955160141,
-0.145972341299057,
0.005223780870437622,
-0.04956597089767456,
-0.07480692863464355,
-0.3035498261451721,
-0.2058742642402649,
-0.458272784948349,
-0.15564605593681335,
-0.14384402334690094,
0.01115584559738636,
-0.332488477230072,
0.5145230889320374,
0.29142072796821594,
0.1399780958890915,
0.49322691559791565,
0.020635265856981277,
0.0532786101102829,
0.01532786339521408,
0.029823776334524155,
-0.13145363330841064,
-0.2608633041381836,
0.1487918347120285,
0.21654660999774933,
-0.130271315574646,
0.32548898458480835,
-0.1613031029701233,
-0.2627820670604706,
0.09947003424167633,
0.0949372872710228,
0.10411272197961807,
-0.4675593674182892,
0.32304832339286804,
-0.0021582134068012238,
0.21897175908088684,
-0.0208103209733963,
-0.2567599415779114,
-0.2679678201675415,
-0.07948525995016098,
0.0625915676355362,
-0.04125243425369263,
-0.20221516489982605,
0.0776134580373764,
0.05128606781363487,
-0.35269349813461304,
-0.17235323786735535,
-0.17987319827079773,
0.10823331773281097,
0.038386598229408264,
0.3674837648868561,
-0.26661092042922974,
0.29305195808410645,
0.09679804742336273,
-0.25016647577285767,
-0.11382152140140533,
-0.09912005811929703,
0.22644498944282532,
0.47687241435050964,
-0.3883419334888458,
-0.300885945558548,
-0.09438016265630722,
-0.40999895334243774,
0.34774601459503174,
-0.03840678930282593,
-0.22767992317676544,
0.25541263818740845,
-0.04895595833659172,
0.1893790066242218,
0.02317630872130394,
0.3520207107067108,
0.26322129368782043,
0.3699648678302765,
0.011672910302877426,
-0.1440165638923645,
0.06525957584381104,
-0.048873476684093475,
-0.08222289383411407,
-0.22157606482505798,
-0.05691240727901459,
0.2582862079143524,
0.35951292514801025,
-0.018613029271364212,
-0.046238239854574203,
0.02786199375987053,
-0.22628015279769897,
0.0427437499165535,
0.17346373200416565,
0.4068899154663086,
0.10801348090171814,
0.23184126615524292,
-0.31838929653167725,
0.09024085104465485,
-0.12427999824285507,
0.025306612253189087,
-0.16548646986484528,
0.21402311325073242,
-0.006621330976486206,
-0.13937939703464508,
-0.16431912779808044,
0.0698126032948494,
0.20134250819683075,
-0.026837512850761414,
0.0632021501660347,
-0.22027723491191864,
0.06153841316699982,
-0.17903092503547668,
0.2758256494998932,
-0.09431135654449463,
-0.050224341452121735,
0.17375634610652924,
0.20817093551158905,
-0.40948057174682617,
-0.20605650544166565,
0.035232916474342346,
-0.3411520719528198,
0.017331700772047043,
0.13118889927864075,
0.1185407042503357,
0.05623745918273926,
0.04769054800271988,
-0.3749629259109497,
0.2920551896095276,
0.41460344195365906,
0.007591649889945984,
0.03226820379495621,
-0.12673820555210114,
-0.2016417384147644,
-0.11112698912620544,
0.21824829280376434,
0.18993636965751648,
-0.1373288482427597,
-0.20797701179981232,
0.2503730058670044,
-0.0020624157041311264,
0.15356677770614624,
0.4049595594406128,
-0.05302755907177925,
0.25622016191482544,
-0.14678503572940826,
0.5597744584083557,
0.4704824388027191,
-0.625508189201355,
-0.5309314131736755,
0.10321839153766632,
-0.4468843936920166,
-0.1779436618089676,
-0.03534664958715439,
0.041638411581516266,
0.5613892078399658,
0.12415531277656555,
-0.1132064014673233,
0.3392552137374878,
0.07229578495025635,
0.2676008641719818,
-0.15639422833919525,
-0.14152976870536804,
0.40929919481277466,
0.09268194437026978,
0.21709808707237244,
0.11648884415626526,
-0.16825279593467712,
0.19713763892650604,
-0.10224737972021103,
-0.1236945390701294,
0.09144434332847595,
0.19020487368106842,
0.16542726755142212,
-0.21081383526325226,
0.08061237633228302,
-0.16297811269760132,
-0.5545790791511536,
0.06518654525279999,
-0.34768620133399963,
0.2234152853488922,
-0.28904998302459717,
-0.1947721689939499,
-0.28876471519470215,
0.15413497388362885,
-0.45191892981529236,
-0.052400071173906326,
0.0838475450873375,
-0.03061482310295105,
0.18893752992153168,
-0.013604627922177315,
0.019288551062345505,
-0.07614041119813919,
0.1458209604024887,
0.18609404563903809,
-0.2552468478679657,
0.20620331168174744,
-0.2569340169429779,
0.02114827185869217,
-0.05973024666309357,
0.09906291961669922,
0.4085010886192322,
-0.17598335444927216,
-0.2551455497741699,
0.2755492031574249,
0.17205199599266052,
-0.08486801385879517,
-0.05005958676338196,
-0.03503546118736267,
0.2658097743988037,
-0.20969520509243011,
-0.06440680474042892,
0.1785881519317627,
0.16671858727931976,
-0.02876027673482895,
-0.09293530136346817,
0.4431660771369934,
0.2247035801410675,
0.31786227226257324,
-0.01910526677966118,
0.1625133454799652,
0.24128490686416626,
-0.10274730622768402,
-0.04649505019187927,
-0.13554337620735168,
-0.17649294435977936,
0.0628637820482254,
0.23403991758823395,
-0.07365301996469498,
0.06564219295978546,
-0.059074871242046356,
0.8479932546615601,
-0.06834638118743896,
0.07938273996114731,
0.2044738531112671,
-0.11635082215070724,
0.049705870449543,
-0.07888424396514893,
-0.40181025862693787,
0.04173742234706879,
0.03922862559556961,
-0.17348940670490265,
-0.10662073642015457,
0.2546636462211609,
0.14594495296478271,
0.041524969041347504,
0.3150503635406494,
0.11469598859548569,
0.225544273853302,
0.15998724102973938,
0.11295114457607269,
-0.17203378677368164,
-0.19414323568344116,
0.16297325491905212,
0.1452348679304123,
-0.14686189591884613,
-0.024431999772787094,
-0.04605673998594284,
0.044477060437202454,
0.010470712557435036,
-0.04867228865623474,
-0.19503360986709595,
-0.250466912984848,
0.03378954157233238,
-0.023758497089147568,
0.09573529660701752,
0.449554979801178,
0.3668549656867981,
0.3240298628807068,
0.4278208613395691,
-0.10992073267698288,
-0.1704414188861847,
-0.19697964191436768,
-0.08769410103559494,
-0.06773465126752853,
0.1707262545824051,
-0.00535688316449523,
-0.03574804961681366,
0.010384462773799896,
0.10249228775501251,
-0.45612791180610657,
-0.4291422665119171,
0.2537456154823303,
-0.17828468978405,
0.1860090047121048,
-0.014134995639324188,
0.12101293355226517,
-0.3429492712020874,
-0.2921084761619568,
0.2118503600358963,
-0.21941320598125458,
-0.30137452483177185,
0.07068181037902832,
-0.061088766902685165,
-0.3209868371486664,
0.05117690935730934,
-0.24058660864830017,
-0.3765723705291748,
-0.33769187331199646,
0.3630162477493286,
-0.008248493075370789,
0.1135793924331665,
0.15415820479393005,
-0.00302607798948884,
0.2885194420814514,
-0.020071396604180336,
-0.035907477140426636,
-0.24400143325328827,
0.054305534809827805,
0.4122081995010376,
-0.18261869251728058,
-0.2826859652996063,
-0.39157694578170776,
-0.17591607570648193,
0.05257883667945862,
-0.12937913835048676,
-0.10209265351295471,
-0.22754734754562378,
-0.2711943984031677,
0.22384607791900635,
-0.16086310148239136,
0.045888230204582214,
0.5580427646636963,
-0.049236368387937546,
0.09076553583145142,
0.01156727597117424,
-0.16093182563781738,
0.27200356125831604,
0.1358187049627304,
0.081289142370224,
-0.010779760777950287,
0.5259879231452942,
0.1519598662853241,
0.8704360127449036,
0.15821492671966553,
-0.21943803131580353,
0.16835519671440125,
-0.14850348234176636,
-0.01063704863190651,
-0.03405507653951645,
-0.38928478956222534,
0.1844978630542755,
-0.04435047507286072,
0.12260723114013672,
0.13958825170993805,
-0.20949199795722961,
-0.15563496947288513,
0.14549137651920319,
-0.09472277760505676,
-0.218725323677063,
-0.27573642134666443,
-0.022572895511984825,
0.09790511429309845,
0.09834414720535278,
0.04776653274893761,
0.1866316795349121,
-0.44355639815330505,
0.06796005368232727,
0.11922764778137207,
0.004403114318847656,
0.048046551644802094,
-0.04683779925107956,
-1.0162560939788818,
-0.09132109582424164,
-0.17027941346168518,
0.36549264192581177,
0.22949711978435516,
0.4982428550720215,
-0.017992455512285233,
-0.04699508473277092,
0.05150580406188965,
-0.21210986375808716,
0.8495116829872131,
0.2505570650100708,
-0.05321195721626282,
0.07962740957736969,
0.018949035555124283,
-0.15455107390880585,
0.057700660079717636,
-0.16324123740196228,
0.6255757212638855,
0.4945645332336426,
0.7852731943130493,
-0.43740472197532654,
-0.08937069773674011,
0.031204042956233025,
-0.059960100799798965,
-0.1476590782403946,
0.08103042095899582,
-0.2087637037038803,
-0.180411696434021,
-0.5762062072753906,
0.25856703519821167,
0.28101325035095215,
0.19283361732959747,
0.15283092856407166,
-0.22316685318946838,
0.06901504844427109,
-0.28400319814682007,
-0.0985405296087265,
0.23120428621768951,
0.21433523297309875,
0.18589964509010315,
-0.0022402051836252213,
0.1455385386943817,
-0.1561146229505539,
-0.20688201487064362,
0.18994294106960297,
0.25589486956596375,
-0.6231854557991028,
0.2523166835308075,
0.16514982283115387,
0.5603795051574707,
0.15823112428188324,
-0.11502523720264435,
0.29464662075042725,
-0.01051352545619011,
0.47939586639404297,
-0.03906324505805969,
0.47881969809532166,
0.36262446641921997,
0.27784213423728943,
-0.301658570766449,
-0.13845354318618774,
0.38594749569892883,
-0.015479073859751225,
0.07214416563510895,
0.015306081622838974,
0.26423370838165283,
-0.15237964689731598,
0.5785444974899292,
0.10501522570848465,
1.0689465999603271,
-0.09628941118717194,
-0.09116224944591522,
0.12688452005386353,
0.26558351516723633,
0.5600724220275879,
-0.2914607524871826,
0.20523881912231445,
-0.5174928307533264,
-0.09049858152866364,
0.004256146028637886,
-0.13982944190502167,
0.13500869274139404,
0.18870440125465393,
-0.43005746603012085,
0.13892552256584167,
0.09927932918071747,
0.4275941550731659,
0.0399220809340477,
0.41344207525253296,
-0.01810356043279171,
-0.47711026668548584,
-0.12599581480026245,
0.06626572459936142,
-0.2162787765264511,
0.2179781198501587,
0.09313574433326721,
0.016773607581853867,
-0.22999055683612823,
-0.33340728282928467,
-0.06853975355625153,
0.08772076666355133,
-0.3980344831943512,
0.6731892228126526,
0.3429543673992157,
-0.19453462958335876,
0.29567334055900574,
0.2294493168592453,
0.15479309856891632,
0.2516958713531494,
-0.06370928883552551,
0.16826605796813965,
0.14975035190582275,
-0.0029831882566213608,
0.19938354194164276,
-0.06823351979255676,
0.11906512826681137,
-0.010318662971258163,
-0.10151160508394241,
0.175491064786911,
-0.012460781261324883,
-0.2762168347835541,
-0.2717879116535187,
-0.12400531768798828,
0.290338397026062,
-0.3395358622074127,
-0.2814115583896637,
-0.039557285606861115,
-0.28503528237342834,
-0.20351310074329376,
0.022034604102373123,
-0.07065904140472412,
-0.374799519777298,
0.22638219594955444,
0.23766908049583435,
-0.14269255101680756,
0.16958646476268768,
0.3712310492992401,
-0.025501083582639694,
-0.0888265073299408,
0.5584914684295654,
0.0715673416852951,
-0.19460977613925934,
-0.2024843990802765,
0.15187907218933105,
-0.033778805285692215,
-0.22719457745552063,
0.10915811359882355,
-0.1162661463022232,
-0.2636433243751526,
-0.22879533469676971,
0.3435634970664978,
-0.025700241327285767,
0.04026198014616966,
-0.2143467515707016,
-0.4193451404571533,
-0.5076627731323242,
0.049949295818805695,
-0.13119997084140778,
0.18116499483585358,
0.4385978579521179,
0.40800604224205017,
-0.25686928629875183,
0.3760196566581726,
-0.2495919018983841,
-0.08002421259880066,
-0.5987672805786133,
0.2662302255630493,
0.01884259283542633,
-0.5459761619567871,
-0.027553904801607132,
0.02164069376885891,
0.026443468406796455,
0.294058620929718,
-0.12007908523082733,
-0.15881237387657166,
-0.07026086002588272,
0.16056318581104279,
0.2280811369419098,
-0.10137251019477844,
-0.2458610236644745,
0.11841046810150146,
-0.17929944396018982,
-0.15681114792823792,
0.1025065928697586,
0.1319531500339508,
0.012163061648607254,
0.12355339527130127,
-0.09083551168441772,
-0.11700523644685745,
-0.05135424807667732,
-0.08652322739362717,
0.04924800619482994,
-0.15517960488796234,
0.2005685269832611,
0.38877812027931213,
-0.19008755683898926,
-0.009076409041881561,
-0.29091838002204895,
0.17954382300376892,
0.6930253505706787,
0.009677674621343613,
0.3933945298194885,
-0.31458789110183716,
-0.15080979466438293,
0.22921109199523926,
-0.20730316638946533,
0.18506640195846558,
-0.3238910436630249,
-0.09588629007339478,
0.22866439819335938,
0.12948498129844666,
-0.2605692744255066,
-0.20624437928199768,
0.5028800368309021,
-0.3981369435787201,
0.1572275012731552,
0.12966448068618774,
-0.09836220741271973,
0.2678849697113037,
0.18320630490779877,
0.1603044867515564,
0.7458080649375916,
0.011786268092691898,
0.17655035853385925,
-0.06224888935685158,
-0.09200140088796616,
0.05511584132909775,
0.5123581290245056,
0.13516101241111755,
0.2308288961648941,
0.11014201492071152,
-0.20327258110046387,
0.37733936309814453,
-0.42855411767959595,
0.2233327180147171,
0.36982885003089905,
-0.12526848912239075,
-0.19376134872436523,
0.20874705910682678,
-0.14037078619003296,
0.2644398808479309,
-0.04349501430988312,
0.35226011276245117,
-0.1093691885471344,
-0.17406626045703888,
-0.16872172057628632,
0.49048706889152527,
-0.3190309703350067,
-0.049097366631031036,
-0.021232690662145615,
-0.07593855261802673,
-0.1959420144557953,
-0.28567615151405334,
0.050842709839344025,
-0.06166030466556549,
0.10977569967508316,
0.015786856412887573,
-0.08042746782302856,
0.2032719999551773,
-0.14787951111793518,
0.17750829458236694,
0.24254110455513,
-0.32913538813591003,
0.2424011528491974,
0.1096196249127388,
0.2629409432411194,
-0.24783456325531006,
0.11491469293832779,
0.3023820221424103,
0.26866012811660767,
-0.4128156304359436,
0.1197531670331955,
-0.061437491327524185,
-0.15522582828998566,
0.15395838022232056,
0.1354498416185379,
-0.1843048334121704,
-0.21929125487804413,
0.23018088936805725,
0.07787932455539703,
-0.2095593959093094,
-0.17226456105709076,
0.1902216076850891,
0.10927625000476837,
0.1233893632888794,
-0.049729399383068085,
-0.08056873083114624,
-0.20539340376853943,
-0.3169712722301483,
-0.17713499069213867,
-0.39904630184173584,
-0.04866921156644821,
0.08204156160354614,
-0.23340527713298798,
0.2352660596370697,
-0.306997686624527,
0.08067841082811356,
0.08235998451709747,
0.36441871523857117,
0.31551843881607056,
0.08895154297351837,
-0.3957797884941101,
-0.02335897833108902,
-0.40491533279418945,
0.21320071816444397,
0.30975788831710815,
-0.19389264285564423,
0.08527778834104538,
0.1949712485074997,
0.06053662300109863,
0.31443339586257935,
-0.10639722645282745,
0.057046450674533844,
-0.13181345164775848,
-0.006787165999412537,
-0.21990114450454712,
0.13424824178218842,
-0.16535654664039612,
0.1062282919883728,
0.2053379863500595,
-0.3196316957473755,
0.3005921244621277,
0.2335086166858673,
-0.016038425266742706,
-0.20376719534397125,
-0.07318393886089325,
-0.21352843940258026,
-0.3241588771343231,
-0.04828055948019028,
0.2011154741048813,
0.2985321581363678,
-0.28266650438308716,
0.18013443052768707,
0.20976580679416656,
-0.043841224163770676,
-0.2875528335571289,
-0.19312211871147156,
0.15643532574176788,
0.4927528202533722,
-0.0002095801755785942,
0.12636980414390564,
-0.3023885190486908,
-0.17570357024669647,
0.08756741881370544,
-0.28133371472358704,
-0.24230000376701355,
0.33336523175239563,
-0.20570093393325806,
0.1753343790769577,
-0.014726635068655014,
0.21862280368804932,
0.07085446268320084,
0.28340816497802734,
-0.24533317983150482,
-0.45495712757110596,
0.6601229906082153,
-0.4289315640926361,
-0.48007938265800476,
-0.05626486986875534,
-0.06597250699996948,
0.13737857341766357,
-0.2057526409626007,
-0.2559032440185547,
-0.15045183897018433,
0.2913421094417572,
0.08456270396709442,
-0.20066991448402405,
0.05188633129000664,
0.15546011924743652,
-0.03583145514130592,
-0.150189608335495,
0.3721500039100647,
0.12918761372566223,
0.06289525330066681,
0.10387624800205231,
-0.2139434814453125
] |
https://github.com/huggingface/datasets/issues/665 | runing dataset.map, it raises TypeError: can't pickle Tokenizer objects | We can also update the `BertJapaneseTokenizer` in `transformers` as you just shown @lhoestq to make it compatible with pickle. It will be faster than asking on fugashi 's repo and good for the other users of `transformers` as well.
I'm currently working on `transformers` I'll include it in the https://github.com/huggingface/transformers/pull/7141 PR and the next release of `transformers`. | I load squad dataset. Then want to process data use following function with `Huggingface Transformers LongformerTokenizer`.
```
def convert_to_features(example):
# Tokenize contexts and questions (as pairs of inputs)
input_pairs = [example['question'], example['context']]
encodings = tokenizer.encode_plus(input_pairs, pad_to_max_length=True, max_length=512)
context_encodings = tokenizer.encode_plus(example['context'])
# Compute start and end tokens for labels using Transformers's fast tokenizers alignement methodes.
# this will give us the position of answer span in the context text
start_idx, end_idx = get_correct_alignement(example['context'], example['answers'])
start_positions_context = context_encodings.char_to_token(start_idx)
end_positions_context = context_encodings.char_to_token(end_idx-1)
# here we will compute the start and end position of the answer in the whole example
# as the example is encoded like this <s> question</s></s> context</s>
# and we know the postion of the answer in the context
# we can just find out the index of the sep token and then add that to position + 1 (+1 because there are two sep tokens)
# this will give us the position of the answer span in whole example
sep_idx = encodings['input_ids'].index(tokenizer.sep_token_id)
start_positions = start_positions_context + sep_idx + 1
end_positions = end_positions_context + sep_idx + 1
if end_positions > 512:
start_positions, end_positions = 0, 0
encodings.update({'start_positions': start_positions,
'end_positions': end_positions,
'attention_mask': encodings['attention_mask']})
return encodings
```
Then I run `dataset.map(convert_to_features)`, it raise
```
In [59]: a.map(convert_to_features)
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-59-c453b508761d> in <module>
----> 1 a.map(convert_to_features)
/opt/conda/lib/python3.7/site-packages/datasets/arrow_dataset.py in map(self, function, with_indices, input_columns, batched, batch_size, drop_last_batch, remove_columns, keep_in_memory, load_from_cache_file, cache_file_name, writer_batch_size, features, disable_nullable, fn_kwargs, num_proc, suffix_template, new_fingerprint)
1242 fn_kwargs=fn_kwargs,
1243 new_fingerprint=new_fingerprint,
-> 1244 update_data=update_data,
1245 )
1246 else:
/opt/conda/lib/python3.7/site-packages/datasets/arrow_dataset.py in wrapper(*args, **kwargs)
151 "output_all_columns": self._output_all_columns,
152 }
--> 153 out: Union["Dataset", "DatasetDict"] = func(self, *args, **kwargs)
154 if new_format["columns"] is not None:
155 new_format["columns"] = list(set(new_format["columns"]) & set(out.column_names))
/opt/conda/lib/python3.7/site-packages/datasets/fingerprint.py in wrapper(*args, **kwargs)
156 kwargs_for_fingerprint["fingerprint_name"] = fingerprint_name
157 kwargs[fingerprint_name] = update_fingerprint(
--> 158 self._fingerprint, transform, kwargs_for_fingerprint
159 )
160
/opt/conda/lib/python3.7/site-packages/datasets/fingerprint.py in update_fingerprint(fingerprint, transform, transform_args)
103 for key in sorted(transform_args):
104 hasher.update(key)
--> 105 hasher.update(transform_args[key])
106 return hasher.hexdigest()
107
/opt/conda/lib/python3.7/site-packages/datasets/fingerprint.py in update(self, value)
55 def update(self, value):
56 self.m.update(f"=={type(value)}==".encode("utf8"))
---> 57 self.m.update(self.hash(value).encode("utf-8"))
58
59 def hexdigest(self):
/opt/conda/lib/python3.7/site-packages/datasets/fingerprint.py in hash(cls, value)
51 return cls.dispatch[type(value)](cls, value)
52 else:
---> 53 return cls.hash_default(value)
54
55 def update(self, value):
/opt/conda/lib/python3.7/site-packages/datasets/fingerprint.py in hash_default(cls, value)
44 @classmethod
45 def hash_default(cls, value):
---> 46 return cls.hash_bytes(dumps(value))
47
48 @classmethod
/opt/conda/lib/python3.7/site-packages/datasets/utils/py_utils.py in dumps(obj)
365 file = StringIO()
366 with _no_cache_fields(obj):
--> 367 dump(obj, file)
368 return file.getvalue()
369
/opt/conda/lib/python3.7/site-packages/datasets/utils/py_utils.py in dump(obj, file)
337 def dump(obj, file):
338 """pickle an object to a file"""
--> 339 Pickler(file, recurse=True).dump(obj)
340 return
341
/opt/conda/lib/python3.7/site-packages/dill/_dill.py in dump(self, obj)
444 raise PicklingError(msg)
445 else:
--> 446 StockPickler.dump(self, obj)
447 stack.clear() # clear record of 'recursion-sensitive' pickled objects
448 return
/opt/conda/lib/python3.7/pickle.py in dump(self, obj)
435 if self.proto >= 4:
436 self.framer.start_framing()
--> 437 self.save(obj)
438 self.write(STOP)
439 self.framer.end_framing()
/opt/conda/lib/python3.7/pickle.py in save(self, obj, save_persistent_id)
502 f = self.dispatch.get(t)
503 if f is not None:
--> 504 f(self, obj) # Call unbound method with explicit self
505 return
506
/opt/conda/lib/python3.7/site-packages/dill/_dill.py in save_function(pickler, obj)
1436 globs, obj.__name__,
1437 obj.__defaults__, obj.__closure__,
-> 1438 obj.__dict__, fkwdefaults), obj=obj)
1439 else:
1440 _super = ('super' in getattr(obj.func_code,'co_names',())) and (_byref is not None) and getattr(pickler, '_recurse', False)
/opt/conda/lib/python3.7/pickle.py in save_reduce(self, func, args, state, listitems, dictitems, obj)
636 else:
637 save(func)
--> 638 save(args)
639 write(REDUCE)
640
/opt/conda/lib/python3.7/pickle.py in save(self, obj, save_persistent_id)
502 f = self.dispatch.get(t)
503 if f is not None:
--> 504 f(self, obj) # Call unbound method with explicit self
505 return
506
/opt/conda/lib/python3.7/pickle.py in save_tuple(self, obj)
787 write(MARK)
788 for element in obj:
--> 789 save(element)
790
791 if id(obj) in memo:
/opt/conda/lib/python3.7/pickle.py in save(self, obj, save_persistent_id)
502 f = self.dispatch.get(t)
503 if f is not None:
--> 504 f(self, obj) # Call unbound method with explicit self
505 return
506
/opt/conda/lib/python3.7/site-packages/dill/_dill.py in save_module_dict(pickler, obj)
931 # we only care about session the first pass thru
932 pickler._session = False
--> 933 StockPickler.save_dict(pickler, obj)
934 log.info("# D2")
935 return
/opt/conda/lib/python3.7/pickle.py in save_dict(self, obj)
857
858 self.memoize(obj)
--> 859 self._batch_setitems(obj.items())
860
861 dispatch[dict] = save_dict
/opt/conda/lib/python3.7/pickle.py in _batch_setitems(self, items)
883 for k, v in tmp:
884 save(k)
--> 885 save(v)
886 write(SETITEMS)
887 elif n:
/opt/conda/lib/python3.7/pickle.py in save(self, obj, save_persistent_id)
547
548 # Save the reduce() output and finally memoize the object
--> 549 self.save_reduce(obj=obj, *rv)
550
551 def persistent_id(self, obj):
/opt/conda/lib/python3.7/pickle.py in save_reduce(self, func, args, state, listitems, dictitems, obj)
660
661 if state is not None:
--> 662 save(state)
663 write(BUILD)
664
/opt/conda/lib/python3.7/pickle.py in save(self, obj, save_persistent_id)
502 f = self.dispatch.get(t)
503 if f is not None:
--> 504 f(self, obj) # Call unbound method with explicit self
505 return
506
/opt/conda/lib/python3.7/site-packages/dill/_dill.py in save_module_dict(pickler, obj)
931 # we only care about session the first pass thru
932 pickler._session = False
--> 933 StockPickler.save_dict(pickler, obj)
934 log.info("# D2")
935 return
/opt/conda/lib/python3.7/pickle.py in save_dict(self, obj)
857
858 self.memoize(obj)
--> 859 self._batch_setitems(obj.items())
860
861 dispatch[dict] = save_dict
/opt/conda/lib/python3.7/pickle.py in _batch_setitems(self, items)
883 for k, v in tmp:
884 save(k)
--> 885 save(v)
886 write(SETITEMS)
887 elif n:
/opt/conda/lib/python3.7/pickle.py in save(self, obj, save_persistent_id)
547
548 # Save the reduce() output and finally memoize the object
--> 549 self.save_reduce(obj=obj, *rv)
550
551 def persistent_id(self, obj):
/opt/conda/lib/python3.7/pickle.py in save_reduce(self, func, args, state, listitems, dictitems, obj)
660
661 if state is not None:
--> 662 save(state)
663 write(BUILD)
664
/opt/conda/lib/python3.7/pickle.py in save(self, obj, save_persistent_id)
502 f = self.dispatch.get(t)
503 if f is not None:
--> 504 f(self, obj) # Call unbound method with explicit self
505 return
506
/opt/conda/lib/python3.7/site-packages/dill/_dill.py in save_module_dict(pickler, obj)
931 # we only care about session the first pass thru
932 pickler._session = False
--> 933 StockPickler.save_dict(pickler, obj)
934 log.info("# D2")
935 return
/opt/conda/lib/python3.7/pickle.py in save_dict(self, obj)
857
858 self.memoize(obj)
--> 859 self._batch_setitems(obj.items())
860
861 dispatch[dict] = save_dict
/opt/conda/lib/python3.7/pickle.py in _batch_setitems(self, items)
883 for k, v in tmp:
884 save(k)
--> 885 save(v)
886 write(SETITEMS)
887 elif n:
/opt/conda/lib/python3.7/pickle.py in save(self, obj, save_persistent_id)
522 reduce = getattr(obj, "__reduce_ex__", None)
523 if reduce is not None:
--> 524 rv = reduce(self.proto)
525 else:
526 reduce = getattr(obj, "__reduce__", None)
TypeError: can't pickle Tokenizer objects
```
| 57 | runing dataset.map, it raises TypeError: can't pickle Tokenizer objects
I load squad dataset. Then want to process data use following function with `Huggingface Transformers LongformerTokenizer`.
```
def convert_to_features(example):
# Tokenize contexts and questions (as pairs of inputs)
input_pairs = [example['question'], example['context']]
encodings = tokenizer.encode_plus(input_pairs, pad_to_max_length=True, max_length=512)
context_encodings = tokenizer.encode_plus(example['context'])
# Compute start and end tokens for labels using Transformers's fast tokenizers alignement methodes.
# this will give us the position of answer span in the context text
start_idx, end_idx = get_correct_alignement(example['context'], example['answers'])
start_positions_context = context_encodings.char_to_token(start_idx)
end_positions_context = context_encodings.char_to_token(end_idx-1)
# here we will compute the start and end position of the answer in the whole example
# as the example is encoded like this <s> question</s></s> context</s>
# and we know the postion of the answer in the context
# we can just find out the index of the sep token and then add that to position + 1 (+1 because there are two sep tokens)
# this will give us the position of the answer span in whole example
sep_idx = encodings['input_ids'].index(tokenizer.sep_token_id)
start_positions = start_positions_context + sep_idx + 1
end_positions = end_positions_context + sep_idx + 1
if end_positions > 512:
start_positions, end_positions = 0, 0
encodings.update({'start_positions': start_positions,
'end_positions': end_positions,
'attention_mask': encodings['attention_mask']})
return encodings
```
Then I run `dataset.map(convert_to_features)`, it raise
```
In [59]: a.map(convert_to_features)
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-59-c453b508761d> in <module>
----> 1 a.map(convert_to_features)
/opt/conda/lib/python3.7/site-packages/datasets/arrow_dataset.py in map(self, function, with_indices, input_columns, batched, batch_size, drop_last_batch, remove_columns, keep_in_memory, load_from_cache_file, cache_file_name, writer_batch_size, features, disable_nullable, fn_kwargs, num_proc, suffix_template, new_fingerprint)
1242 fn_kwargs=fn_kwargs,
1243 new_fingerprint=new_fingerprint,
-> 1244 update_data=update_data,
1245 )
1246 else:
/opt/conda/lib/python3.7/site-packages/datasets/arrow_dataset.py in wrapper(*args, **kwargs)
151 "output_all_columns": self._output_all_columns,
152 }
--> 153 out: Union["Dataset", "DatasetDict"] = func(self, *args, **kwargs)
154 if new_format["columns"] is not None:
155 new_format["columns"] = list(set(new_format["columns"]) & set(out.column_names))
/opt/conda/lib/python3.7/site-packages/datasets/fingerprint.py in wrapper(*args, **kwargs)
156 kwargs_for_fingerprint["fingerprint_name"] = fingerprint_name
157 kwargs[fingerprint_name] = update_fingerprint(
--> 158 self._fingerprint, transform, kwargs_for_fingerprint
159 )
160
/opt/conda/lib/python3.7/site-packages/datasets/fingerprint.py in update_fingerprint(fingerprint, transform, transform_args)
103 for key in sorted(transform_args):
104 hasher.update(key)
--> 105 hasher.update(transform_args[key])
106 return hasher.hexdigest()
107
/opt/conda/lib/python3.7/site-packages/datasets/fingerprint.py in update(self, value)
55 def update(self, value):
56 self.m.update(f"=={type(value)}==".encode("utf8"))
---> 57 self.m.update(self.hash(value).encode("utf-8"))
58
59 def hexdigest(self):
/opt/conda/lib/python3.7/site-packages/datasets/fingerprint.py in hash(cls, value)
51 return cls.dispatch[type(value)](cls, value)
52 else:
---> 53 return cls.hash_default(value)
54
55 def update(self, value):
/opt/conda/lib/python3.7/site-packages/datasets/fingerprint.py in hash_default(cls, value)
44 @classmethod
45 def hash_default(cls, value):
---> 46 return cls.hash_bytes(dumps(value))
47
48 @classmethod
/opt/conda/lib/python3.7/site-packages/datasets/utils/py_utils.py in dumps(obj)
365 file = StringIO()
366 with _no_cache_fields(obj):
--> 367 dump(obj, file)
368 return file.getvalue()
369
/opt/conda/lib/python3.7/site-packages/datasets/utils/py_utils.py in dump(obj, file)
337 def dump(obj, file):
338 """pickle an object to a file"""
--> 339 Pickler(file, recurse=True).dump(obj)
340 return
341
/opt/conda/lib/python3.7/site-packages/dill/_dill.py in dump(self, obj)
444 raise PicklingError(msg)
445 else:
--> 446 StockPickler.dump(self, obj)
447 stack.clear() # clear record of 'recursion-sensitive' pickled objects
448 return
/opt/conda/lib/python3.7/pickle.py in dump(self, obj)
435 if self.proto >= 4:
436 self.framer.start_framing()
--> 437 self.save(obj)
438 self.write(STOP)
439 self.framer.end_framing()
/opt/conda/lib/python3.7/pickle.py in save(self, obj, save_persistent_id)
502 f = self.dispatch.get(t)
503 if f is not None:
--> 504 f(self, obj) # Call unbound method with explicit self
505 return
506
/opt/conda/lib/python3.7/site-packages/dill/_dill.py in save_function(pickler, obj)
1436 globs, obj.__name__,
1437 obj.__defaults__, obj.__closure__,
-> 1438 obj.__dict__, fkwdefaults), obj=obj)
1439 else:
1440 _super = ('super' in getattr(obj.func_code,'co_names',())) and (_byref is not None) and getattr(pickler, '_recurse', False)
/opt/conda/lib/python3.7/pickle.py in save_reduce(self, func, args, state, listitems, dictitems, obj)
636 else:
637 save(func)
--> 638 save(args)
639 write(REDUCE)
640
/opt/conda/lib/python3.7/pickle.py in save(self, obj, save_persistent_id)
502 f = self.dispatch.get(t)
503 if f is not None:
--> 504 f(self, obj) # Call unbound method with explicit self
505 return
506
/opt/conda/lib/python3.7/pickle.py in save_tuple(self, obj)
787 write(MARK)
788 for element in obj:
--> 789 save(element)
790
791 if id(obj) in memo:
/opt/conda/lib/python3.7/pickle.py in save(self, obj, save_persistent_id)
502 f = self.dispatch.get(t)
503 if f is not None:
--> 504 f(self, obj) # Call unbound method with explicit self
505 return
506
/opt/conda/lib/python3.7/site-packages/dill/_dill.py in save_module_dict(pickler, obj)
931 # we only care about session the first pass thru
932 pickler._session = False
--> 933 StockPickler.save_dict(pickler, obj)
934 log.info("# D2")
935 return
/opt/conda/lib/python3.7/pickle.py in save_dict(self, obj)
857
858 self.memoize(obj)
--> 859 self._batch_setitems(obj.items())
860
861 dispatch[dict] = save_dict
/opt/conda/lib/python3.7/pickle.py in _batch_setitems(self, items)
883 for k, v in tmp:
884 save(k)
--> 885 save(v)
886 write(SETITEMS)
887 elif n:
/opt/conda/lib/python3.7/pickle.py in save(self, obj, save_persistent_id)
547
548 # Save the reduce() output and finally memoize the object
--> 549 self.save_reduce(obj=obj, *rv)
550
551 def persistent_id(self, obj):
/opt/conda/lib/python3.7/pickle.py in save_reduce(self, func, args, state, listitems, dictitems, obj)
660
661 if state is not None:
--> 662 save(state)
663 write(BUILD)
664
/opt/conda/lib/python3.7/pickle.py in save(self, obj, save_persistent_id)
502 f = self.dispatch.get(t)
503 if f is not None:
--> 504 f(self, obj) # Call unbound method with explicit self
505 return
506
/opt/conda/lib/python3.7/site-packages/dill/_dill.py in save_module_dict(pickler, obj)
931 # we only care about session the first pass thru
932 pickler._session = False
--> 933 StockPickler.save_dict(pickler, obj)
934 log.info("# D2")
935 return
/opt/conda/lib/python3.7/pickle.py in save_dict(self, obj)
857
858 self.memoize(obj)
--> 859 self._batch_setitems(obj.items())
860
861 dispatch[dict] = save_dict
/opt/conda/lib/python3.7/pickle.py in _batch_setitems(self, items)
883 for k, v in tmp:
884 save(k)
--> 885 save(v)
886 write(SETITEMS)
887 elif n:
/opt/conda/lib/python3.7/pickle.py in save(self, obj, save_persistent_id)
547
548 # Save the reduce() output and finally memoize the object
--> 549 self.save_reduce(obj=obj, *rv)
550
551 def persistent_id(self, obj):
/opt/conda/lib/python3.7/pickle.py in save_reduce(self, func, args, state, listitems, dictitems, obj)
660
661 if state is not None:
--> 662 save(state)
663 write(BUILD)
664
/opt/conda/lib/python3.7/pickle.py in save(self, obj, save_persistent_id)
502 f = self.dispatch.get(t)
503 if f is not None:
--> 504 f(self, obj) # Call unbound method with explicit self
505 return
506
/opt/conda/lib/python3.7/site-packages/dill/_dill.py in save_module_dict(pickler, obj)
931 # we only care about session the first pass thru
932 pickler._session = False
--> 933 StockPickler.save_dict(pickler, obj)
934 log.info("# D2")
935 return
/opt/conda/lib/python3.7/pickle.py in save_dict(self, obj)
857
858 self.memoize(obj)
--> 859 self._batch_setitems(obj.items())
860
861 dispatch[dict] = save_dict
/opt/conda/lib/python3.7/pickle.py in _batch_setitems(self, items)
883 for k, v in tmp:
884 save(k)
--> 885 save(v)
886 write(SETITEMS)
887 elif n:
/opt/conda/lib/python3.7/pickle.py in save(self, obj, save_persistent_id)
522 reduce = getattr(obj, "__reduce_ex__", None)
523 if reduce is not None:
--> 524 rv = reduce(self.proto)
525 else:
526 reduce = getattr(obj, "__reduce__", None)
TypeError: can't pickle Tokenizer objects
```
We can also update the `BertJapaneseTokenizer` in `transformers` as you just shown @lhoestq to make it compatible with pickle. It will be faster than asking on fugashi 's repo and good for the other users of `transformers` as well.
I'm currently working on `transformers` I'll include it in the https://github.com/huggingface/transformers/pull/7141 PR and the next release of `transformers`. | [
-0.2387792468070984,
-0.29784899950027466,
-0.01968042179942131,
0.23303498327732086,
0.4450329542160034,
-0.1729922890663147,
0.285151869058609,
0.1309390813112259,
-0.27609169483184814,
0.11031325161457062,
-0.06978636234998703,
0.4891909956932068,
-0.008726135827600956,
-0.04673432186245918,
-0.14570960402488708,
-0.11147376894950867,
0.053560320287942886,
0.20785319805145264,
0.01811389997601509,
-0.0561075396835804,
-0.27878260612487793,
0.2074422836303711,
-0.4731772541999817,
0.1585230827331543,
-0.2825991213321686,
-0.26742836833000183,
0.10640472173690796,
-0.1985800564289093,
-0.2693116068840027,
-0.3823219835758209,
-0.14364492893218994,
-0.07336577773094177,
-0.02884814143180847,
0.563336968421936,
-0.00011926037404919043,
0.0994180291891098,
0.1089542955160141,
-0.145972341299057,
0.005223780870437622,
-0.04956597089767456,
-0.07480692863464355,
-0.3035498261451721,
-0.2058742642402649,
-0.458272784948349,
-0.15564605593681335,
-0.14384402334690094,
0.01115584559738636,
-0.332488477230072,
0.5145230889320374,
0.29142072796821594,
0.1399780958890915,
0.49322691559791565,
0.020635265856981277,
0.0532786101102829,
0.01532786339521408,
0.029823776334524155,
-0.13145363330841064,
-0.2608633041381836,
0.1487918347120285,
0.21654660999774933,
-0.130271315574646,
0.32548898458480835,
-0.1613031029701233,
-0.2627820670604706,
0.09947003424167633,
0.0949372872710228,
0.10411272197961807,
-0.4675593674182892,
0.32304832339286804,
-0.0021582134068012238,
0.21897175908088684,
-0.0208103209733963,
-0.2567599415779114,
-0.2679678201675415,
-0.07948525995016098,
0.0625915676355362,
-0.04125243425369263,
-0.20221516489982605,
0.0776134580373764,
0.05128606781363487,
-0.35269349813461304,
-0.17235323786735535,
-0.17987319827079773,
0.10823331773281097,
0.038386598229408264,
0.3674837648868561,
-0.26661092042922974,
0.29305195808410645,
0.09679804742336273,
-0.25016647577285767,
-0.11382152140140533,
-0.09912005811929703,
0.22644498944282532,
0.47687241435050964,
-0.3883419334888458,
-0.300885945558548,
-0.09438016265630722,
-0.40999895334243774,
0.34774601459503174,
-0.03840678930282593,
-0.22767992317676544,
0.25541263818740845,
-0.04895595833659172,
0.1893790066242218,
0.02317630872130394,
0.3520207107067108,
0.26322129368782043,
0.3699648678302765,
0.011672910302877426,
-0.1440165638923645,
0.06525957584381104,
-0.048873476684093475,
-0.08222289383411407,
-0.22157606482505798,
-0.05691240727901459,
0.2582862079143524,
0.35951292514801025,
-0.018613029271364212,
-0.046238239854574203,
0.02786199375987053,
-0.22628015279769897,
0.0427437499165535,
0.17346373200416565,
0.4068899154663086,
0.10801348090171814,
0.23184126615524292,
-0.31838929653167725,
0.09024085104465485,
-0.12427999824285507,
0.025306612253189087,
-0.16548646986484528,
0.21402311325073242,
-0.006621330976486206,
-0.13937939703464508,
-0.16431912779808044,
0.0698126032948494,
0.20134250819683075,
-0.026837512850761414,
0.0632021501660347,
-0.22027723491191864,
0.06153841316699982,
-0.17903092503547668,
0.2758256494998932,
-0.09431135654449463,
-0.050224341452121735,
0.17375634610652924,
0.20817093551158905,
-0.40948057174682617,
-0.20605650544166565,
0.035232916474342346,
-0.3411520719528198,
0.017331700772047043,
0.13118889927864075,
0.1185407042503357,
0.05623745918273926,
0.04769054800271988,
-0.3749629259109497,
0.2920551896095276,
0.41460344195365906,
0.007591649889945984,
0.03226820379495621,
-0.12673820555210114,
-0.2016417384147644,
-0.11112698912620544,
0.21824829280376434,
0.18993636965751648,
-0.1373288482427597,
-0.20797701179981232,
0.2503730058670044,
-0.0020624157041311264,
0.15356677770614624,
0.4049595594406128,
-0.05302755907177925,
0.25622016191482544,
-0.14678503572940826,
0.5597744584083557,
0.4704824388027191,
-0.625508189201355,
-0.5309314131736755,
0.10321839153766632,
-0.4468843936920166,
-0.1779436618089676,
-0.03534664958715439,
0.041638411581516266,
0.5613892078399658,
0.12415531277656555,
-0.1132064014673233,
0.3392552137374878,
0.07229578495025635,
0.2676008641719818,
-0.15639422833919525,
-0.14152976870536804,
0.40929919481277466,
0.09268194437026978,
0.21709808707237244,
0.11648884415626526,
-0.16825279593467712,
0.19713763892650604,
-0.10224737972021103,
-0.1236945390701294,
0.09144434332847595,
0.19020487368106842,
0.16542726755142212,
-0.21081383526325226,
0.08061237633228302,
-0.16297811269760132,
-0.5545790791511536,
0.06518654525279999,
-0.34768620133399963,
0.2234152853488922,
-0.28904998302459717,
-0.1947721689939499,
-0.28876471519470215,
0.15413497388362885,
-0.45191892981529236,
-0.052400071173906326,
0.0838475450873375,
-0.03061482310295105,
0.18893752992153168,
-0.013604627922177315,
0.019288551062345505,
-0.07614041119813919,
0.1458209604024887,
0.18609404563903809,
-0.2552468478679657,
0.20620331168174744,
-0.2569340169429779,
0.02114827185869217,
-0.05973024666309357,
0.09906291961669922,
0.4085010886192322,
-0.17598335444927216,
-0.2551455497741699,
0.2755492031574249,
0.17205199599266052,
-0.08486801385879517,
-0.05005958676338196,
-0.03503546118736267,
0.2658097743988037,
-0.20969520509243011,
-0.06440680474042892,
0.1785881519317627,
0.16671858727931976,
-0.02876027673482895,
-0.09293530136346817,
0.4431660771369934,
0.2247035801410675,
0.31786227226257324,
-0.01910526677966118,
0.1625133454799652,
0.24128490686416626,
-0.10274730622768402,
-0.04649505019187927,
-0.13554337620735168,
-0.17649294435977936,
0.0628637820482254,
0.23403991758823395,
-0.07365301996469498,
0.06564219295978546,
-0.059074871242046356,
0.8479932546615601,
-0.06834638118743896,
0.07938273996114731,
0.2044738531112671,
-0.11635082215070724,
0.049705870449543,
-0.07888424396514893,
-0.40181025862693787,
0.04173742234706879,
0.03922862559556961,
-0.17348940670490265,
-0.10662073642015457,
0.2546636462211609,
0.14594495296478271,
0.041524969041347504,
0.3150503635406494,
0.11469598859548569,
0.225544273853302,
0.15998724102973938,
0.11295114457607269,
-0.17203378677368164,
-0.19414323568344116,
0.16297325491905212,
0.1452348679304123,
-0.14686189591884613,
-0.024431999772787094,
-0.04605673998594284,
0.044477060437202454,
0.010470712557435036,
-0.04867228865623474,
-0.19503360986709595,
-0.250466912984848,
0.03378954157233238,
-0.023758497089147568,
0.09573529660701752,
0.449554979801178,
0.3668549656867981,
0.3240298628807068,
0.4278208613395691,
-0.10992073267698288,
-0.1704414188861847,
-0.19697964191436768,
-0.08769410103559494,
-0.06773465126752853,
0.1707262545824051,
-0.00535688316449523,
-0.03574804961681366,
0.010384462773799896,
0.10249228775501251,
-0.45612791180610657,
-0.4291422665119171,
0.2537456154823303,
-0.17828468978405,
0.1860090047121048,
-0.014134995639324188,
0.12101293355226517,
-0.3429492712020874,
-0.2921084761619568,
0.2118503600358963,
-0.21941320598125458,
-0.30137452483177185,
0.07068181037902832,
-0.061088766902685165,
-0.3209868371486664,
0.05117690935730934,
-0.24058660864830017,
-0.3765723705291748,
-0.33769187331199646,
0.3630162477493286,
-0.008248493075370789,
0.1135793924331665,
0.15415820479393005,
-0.00302607798948884,
0.2885194420814514,
-0.020071396604180336,
-0.035907477140426636,
-0.24400143325328827,
0.054305534809827805,
0.4122081995010376,
-0.18261869251728058,
-0.2826859652996063,
-0.39157694578170776,
-0.17591607570648193,
0.05257883667945862,
-0.12937913835048676,
-0.10209265351295471,
-0.22754734754562378,
-0.2711943984031677,
0.22384607791900635,
-0.16086310148239136,
0.045888230204582214,
0.5580427646636963,
-0.049236368387937546,
0.09076553583145142,
0.01156727597117424,
-0.16093182563781738,
0.27200356125831604,
0.1358187049627304,
0.081289142370224,
-0.010779760777950287,
0.5259879231452942,
0.1519598662853241,
0.8704360127449036,
0.15821492671966553,
-0.21943803131580353,
0.16835519671440125,
-0.14850348234176636,
-0.01063704863190651,
-0.03405507653951645,
-0.38928478956222534,
0.1844978630542755,
-0.04435047507286072,
0.12260723114013672,
0.13958825170993805,
-0.20949199795722961,
-0.15563496947288513,
0.14549137651920319,
-0.09472277760505676,
-0.218725323677063,
-0.27573642134666443,
-0.022572895511984825,
0.09790511429309845,
0.09834414720535278,
0.04776653274893761,
0.1866316795349121,
-0.44355639815330505,
0.06796005368232727,
0.11922764778137207,
0.004403114318847656,
0.048046551644802094,
-0.04683779925107956,
-1.0162560939788818,
-0.09132109582424164,
-0.17027941346168518,
0.36549264192581177,
0.22949711978435516,
0.4982428550720215,
-0.017992455512285233,
-0.04699508473277092,
0.05150580406188965,
-0.21210986375808716,
0.8495116829872131,
0.2505570650100708,
-0.05321195721626282,
0.07962740957736969,
0.018949035555124283,
-0.15455107390880585,
0.057700660079717636,
-0.16324123740196228,
0.6255757212638855,
0.4945645332336426,
0.7852731943130493,
-0.43740472197532654,
-0.08937069773674011,
0.031204042956233025,
-0.059960100799798965,
-0.1476590782403946,
0.08103042095899582,
-0.2087637037038803,
-0.180411696434021,
-0.5762062072753906,
0.25856703519821167,
0.28101325035095215,
0.19283361732959747,
0.15283092856407166,
-0.22316685318946838,
0.06901504844427109,
-0.28400319814682007,
-0.0985405296087265,
0.23120428621768951,
0.21433523297309875,
0.18589964509010315,
-0.0022402051836252213,
0.1455385386943817,
-0.1561146229505539,
-0.20688201487064362,
0.18994294106960297,
0.25589486956596375,
-0.6231854557991028,
0.2523166835308075,
0.16514982283115387,
0.5603795051574707,
0.15823112428188324,
-0.11502523720264435,
0.29464662075042725,
-0.01051352545619011,
0.47939586639404297,
-0.03906324505805969,
0.47881969809532166,
0.36262446641921997,
0.27784213423728943,
-0.301658570766449,
-0.13845354318618774,
0.38594749569892883,
-0.015479073859751225,
0.07214416563510895,
0.015306081622838974,
0.26423370838165283,
-0.15237964689731598,
0.5785444974899292,
0.10501522570848465,
1.0689465999603271,
-0.09628941118717194,
-0.09116224944591522,
0.12688452005386353,
0.26558351516723633,
0.5600724220275879,
-0.2914607524871826,
0.20523881912231445,
-0.5174928307533264,
-0.09049858152866364,
0.004256146028637886,
-0.13982944190502167,
0.13500869274139404,
0.18870440125465393,
-0.43005746603012085,
0.13892552256584167,
0.09927932918071747,
0.4275941550731659,
0.0399220809340477,
0.41344207525253296,
-0.01810356043279171,
-0.47711026668548584,
-0.12599581480026245,
0.06626572459936142,
-0.2162787765264511,
0.2179781198501587,
0.09313574433326721,
0.016773607581853867,
-0.22999055683612823,
-0.33340728282928467,
-0.06853975355625153,
0.08772076666355133,
-0.3980344831943512,
0.6731892228126526,
0.3429543673992157,
-0.19453462958335876,
0.29567334055900574,
0.2294493168592453,
0.15479309856891632,
0.2516958713531494,
-0.06370928883552551,
0.16826605796813965,
0.14975035190582275,
-0.0029831882566213608,
0.19938354194164276,
-0.06823351979255676,
0.11906512826681137,
-0.010318662971258163,
-0.10151160508394241,
0.175491064786911,
-0.012460781261324883,
-0.2762168347835541,
-0.2717879116535187,
-0.12400531768798828,
0.290338397026062,
-0.3395358622074127,
-0.2814115583896637,
-0.039557285606861115,
-0.28503528237342834,
-0.20351310074329376,
0.022034604102373123,
-0.07065904140472412,
-0.374799519777298,
0.22638219594955444,
0.23766908049583435,
-0.14269255101680756,
0.16958646476268768,
0.3712310492992401,
-0.025501083582639694,
-0.0888265073299408,
0.5584914684295654,
0.0715673416852951,
-0.19460977613925934,
-0.2024843990802765,
0.15187907218933105,
-0.033778805285692215,
-0.22719457745552063,
0.10915811359882355,
-0.1162661463022232,
-0.2636433243751526,
-0.22879533469676971,
0.3435634970664978,
-0.025700241327285767,
0.04026198014616966,
-0.2143467515707016,
-0.4193451404571533,
-0.5076627731323242,
0.049949295818805695,
-0.13119997084140778,
0.18116499483585358,
0.4385978579521179,
0.40800604224205017,
-0.25686928629875183,
0.3760196566581726,
-0.2495919018983841,
-0.08002421259880066,
-0.5987672805786133,
0.2662302255630493,
0.01884259283542633,
-0.5459761619567871,
-0.027553904801607132,
0.02164069376885891,
0.026443468406796455,
0.294058620929718,
-0.12007908523082733,
-0.15881237387657166,
-0.07026086002588272,
0.16056318581104279,
0.2280811369419098,
-0.10137251019477844,
-0.2458610236644745,
0.11841046810150146,
-0.17929944396018982,
-0.15681114792823792,
0.1025065928697586,
0.1319531500339508,
0.012163061648607254,
0.12355339527130127,
-0.09083551168441772,
-0.11700523644685745,
-0.05135424807667732,
-0.08652322739362717,
0.04924800619482994,
-0.15517960488796234,
0.2005685269832611,
0.38877812027931213,
-0.19008755683898926,
-0.009076409041881561,
-0.29091838002204895,
0.17954382300376892,
0.6930253505706787,
0.009677674621343613,
0.3933945298194885,
-0.31458789110183716,
-0.15080979466438293,
0.22921109199523926,
-0.20730316638946533,
0.18506640195846558,
-0.3238910436630249,
-0.09588629007339478,
0.22866439819335938,
0.12948498129844666,
-0.2605692744255066,
-0.20624437928199768,
0.5028800368309021,
-0.3981369435787201,
0.1572275012731552,
0.12966448068618774,
-0.09836220741271973,
0.2678849697113037,
0.18320630490779877,
0.1603044867515564,
0.7458080649375916,
0.011786268092691898,
0.17655035853385925,
-0.06224888935685158,
-0.09200140088796616,
0.05511584132909775,
0.5123581290245056,
0.13516101241111755,
0.2308288961648941,
0.11014201492071152,
-0.20327258110046387,
0.37733936309814453,
-0.42855411767959595,
0.2233327180147171,
0.36982885003089905,
-0.12526848912239075,
-0.19376134872436523,
0.20874705910682678,
-0.14037078619003296,
0.2644398808479309,
-0.04349501430988312,
0.35226011276245117,
-0.1093691885471344,
-0.17406626045703888,
-0.16872172057628632,
0.49048706889152527,
-0.3190309703350067,
-0.049097366631031036,
-0.021232690662145615,
-0.07593855261802673,
-0.1959420144557953,
-0.28567615151405334,
0.050842709839344025,
-0.06166030466556549,
0.10977569967508316,
0.015786856412887573,
-0.08042746782302856,
0.2032719999551773,
-0.14787951111793518,
0.17750829458236694,
0.24254110455513,
-0.32913538813591003,
0.2424011528491974,
0.1096196249127388,
0.2629409432411194,
-0.24783456325531006,
0.11491469293832779,
0.3023820221424103,
0.26866012811660767,
-0.4128156304359436,
0.1197531670331955,
-0.061437491327524185,
-0.15522582828998566,
0.15395838022232056,
0.1354498416185379,
-0.1843048334121704,
-0.21929125487804413,
0.23018088936805725,
0.07787932455539703,
-0.2095593959093094,
-0.17226456105709076,
0.1902216076850891,
0.10927625000476837,
0.1233893632888794,
-0.049729399383068085,
-0.08056873083114624,
-0.20539340376853943,
-0.3169712722301483,
-0.17713499069213867,
-0.39904630184173584,
-0.04866921156644821,
0.08204156160354614,
-0.23340527713298798,
0.2352660596370697,
-0.306997686624527,
0.08067841082811356,
0.08235998451709747,
0.36441871523857117,
0.31551843881607056,
0.08895154297351837,
-0.3957797884941101,
-0.02335897833108902,
-0.40491533279418945,
0.21320071816444397,
0.30975788831710815,
-0.19389264285564423,
0.08527778834104538,
0.1949712485074997,
0.06053662300109863,
0.31443339586257935,
-0.10639722645282745,
0.057046450674533844,
-0.13181345164775848,
-0.006787165999412537,
-0.21990114450454712,
0.13424824178218842,
-0.16535654664039612,
0.1062282919883728,
0.2053379863500595,
-0.3196316957473755,
0.3005921244621277,
0.2335086166858673,
-0.016038425266742706,
-0.20376719534397125,
-0.07318393886089325,
-0.21352843940258026,
-0.3241588771343231,
-0.04828055948019028,
0.2011154741048813,
0.2985321581363678,
-0.28266650438308716,
0.18013443052768707,
0.20976580679416656,
-0.043841224163770676,
-0.2875528335571289,
-0.19312211871147156,
0.15643532574176788,
0.4927528202533722,
-0.0002095801755785942,
0.12636980414390564,
-0.3023885190486908,
-0.17570357024669647,
0.08756741881370544,
-0.28133371472358704,
-0.24230000376701355,
0.33336523175239563,
-0.20570093393325806,
0.1753343790769577,
-0.014726635068655014,
0.21862280368804932,
0.07085446268320084,
0.28340816497802734,
-0.24533317983150482,
-0.45495712757110596,
0.6601229906082153,
-0.4289315640926361,
-0.48007938265800476,
-0.05626486986875534,
-0.06597250699996948,
0.13737857341766357,
-0.2057526409626007,
-0.2559032440185547,
-0.15045183897018433,
0.2913421094417572,
0.08456270396709442,
-0.20066991448402405,
0.05188633129000664,
0.15546011924743652,
-0.03583145514130592,
-0.150189608335495,
0.3721500039100647,
0.12918761372566223,
0.06289525330066681,
0.10387624800205231,
-0.2139434814453125
] |
https://github.com/huggingface/datasets/issues/665 | runing dataset.map, it raises TypeError: can't pickle Tokenizer objects | Thank you for the rapid and polite response!
@lhoestq Thanks for the suggestion! I've passed the pickle phase, but another `ArrowInvalid` problem occored. I created another issue #687 .
@thomwolf Wow, really fast work. I'm looking forward to the next release 🤗 | I load squad dataset. Then want to process data use following function with `Huggingface Transformers LongformerTokenizer`.
```
def convert_to_features(example):
# Tokenize contexts and questions (as pairs of inputs)
input_pairs = [example['question'], example['context']]
encodings = tokenizer.encode_plus(input_pairs, pad_to_max_length=True, max_length=512)
context_encodings = tokenizer.encode_plus(example['context'])
# Compute start and end tokens for labels using Transformers's fast tokenizers alignement methodes.
# this will give us the position of answer span in the context text
start_idx, end_idx = get_correct_alignement(example['context'], example['answers'])
start_positions_context = context_encodings.char_to_token(start_idx)
end_positions_context = context_encodings.char_to_token(end_idx-1)
# here we will compute the start and end position of the answer in the whole example
# as the example is encoded like this <s> question</s></s> context</s>
# and we know the postion of the answer in the context
# we can just find out the index of the sep token and then add that to position + 1 (+1 because there are two sep tokens)
# this will give us the position of the answer span in whole example
sep_idx = encodings['input_ids'].index(tokenizer.sep_token_id)
start_positions = start_positions_context + sep_idx + 1
end_positions = end_positions_context + sep_idx + 1
if end_positions > 512:
start_positions, end_positions = 0, 0
encodings.update({'start_positions': start_positions,
'end_positions': end_positions,
'attention_mask': encodings['attention_mask']})
return encodings
```
Then I run `dataset.map(convert_to_features)`, it raise
```
In [59]: a.map(convert_to_features)
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-59-c453b508761d> in <module>
----> 1 a.map(convert_to_features)
/opt/conda/lib/python3.7/site-packages/datasets/arrow_dataset.py in map(self, function, with_indices, input_columns, batched, batch_size, drop_last_batch, remove_columns, keep_in_memory, load_from_cache_file, cache_file_name, writer_batch_size, features, disable_nullable, fn_kwargs, num_proc, suffix_template, new_fingerprint)
1242 fn_kwargs=fn_kwargs,
1243 new_fingerprint=new_fingerprint,
-> 1244 update_data=update_data,
1245 )
1246 else:
/opt/conda/lib/python3.7/site-packages/datasets/arrow_dataset.py in wrapper(*args, **kwargs)
151 "output_all_columns": self._output_all_columns,
152 }
--> 153 out: Union["Dataset", "DatasetDict"] = func(self, *args, **kwargs)
154 if new_format["columns"] is not None:
155 new_format["columns"] = list(set(new_format["columns"]) & set(out.column_names))
/opt/conda/lib/python3.7/site-packages/datasets/fingerprint.py in wrapper(*args, **kwargs)
156 kwargs_for_fingerprint["fingerprint_name"] = fingerprint_name
157 kwargs[fingerprint_name] = update_fingerprint(
--> 158 self._fingerprint, transform, kwargs_for_fingerprint
159 )
160
/opt/conda/lib/python3.7/site-packages/datasets/fingerprint.py in update_fingerprint(fingerprint, transform, transform_args)
103 for key in sorted(transform_args):
104 hasher.update(key)
--> 105 hasher.update(transform_args[key])
106 return hasher.hexdigest()
107
/opt/conda/lib/python3.7/site-packages/datasets/fingerprint.py in update(self, value)
55 def update(self, value):
56 self.m.update(f"=={type(value)}==".encode("utf8"))
---> 57 self.m.update(self.hash(value).encode("utf-8"))
58
59 def hexdigest(self):
/opt/conda/lib/python3.7/site-packages/datasets/fingerprint.py in hash(cls, value)
51 return cls.dispatch[type(value)](cls, value)
52 else:
---> 53 return cls.hash_default(value)
54
55 def update(self, value):
/opt/conda/lib/python3.7/site-packages/datasets/fingerprint.py in hash_default(cls, value)
44 @classmethod
45 def hash_default(cls, value):
---> 46 return cls.hash_bytes(dumps(value))
47
48 @classmethod
/opt/conda/lib/python3.7/site-packages/datasets/utils/py_utils.py in dumps(obj)
365 file = StringIO()
366 with _no_cache_fields(obj):
--> 367 dump(obj, file)
368 return file.getvalue()
369
/opt/conda/lib/python3.7/site-packages/datasets/utils/py_utils.py in dump(obj, file)
337 def dump(obj, file):
338 """pickle an object to a file"""
--> 339 Pickler(file, recurse=True).dump(obj)
340 return
341
/opt/conda/lib/python3.7/site-packages/dill/_dill.py in dump(self, obj)
444 raise PicklingError(msg)
445 else:
--> 446 StockPickler.dump(self, obj)
447 stack.clear() # clear record of 'recursion-sensitive' pickled objects
448 return
/opt/conda/lib/python3.7/pickle.py in dump(self, obj)
435 if self.proto >= 4:
436 self.framer.start_framing()
--> 437 self.save(obj)
438 self.write(STOP)
439 self.framer.end_framing()
/opt/conda/lib/python3.7/pickle.py in save(self, obj, save_persistent_id)
502 f = self.dispatch.get(t)
503 if f is not None:
--> 504 f(self, obj) # Call unbound method with explicit self
505 return
506
/opt/conda/lib/python3.7/site-packages/dill/_dill.py in save_function(pickler, obj)
1436 globs, obj.__name__,
1437 obj.__defaults__, obj.__closure__,
-> 1438 obj.__dict__, fkwdefaults), obj=obj)
1439 else:
1440 _super = ('super' in getattr(obj.func_code,'co_names',())) and (_byref is not None) and getattr(pickler, '_recurse', False)
/opt/conda/lib/python3.7/pickle.py in save_reduce(self, func, args, state, listitems, dictitems, obj)
636 else:
637 save(func)
--> 638 save(args)
639 write(REDUCE)
640
/opt/conda/lib/python3.7/pickle.py in save(self, obj, save_persistent_id)
502 f = self.dispatch.get(t)
503 if f is not None:
--> 504 f(self, obj) # Call unbound method with explicit self
505 return
506
/opt/conda/lib/python3.7/pickle.py in save_tuple(self, obj)
787 write(MARK)
788 for element in obj:
--> 789 save(element)
790
791 if id(obj) in memo:
/opt/conda/lib/python3.7/pickle.py in save(self, obj, save_persistent_id)
502 f = self.dispatch.get(t)
503 if f is not None:
--> 504 f(self, obj) # Call unbound method with explicit self
505 return
506
/opt/conda/lib/python3.7/site-packages/dill/_dill.py in save_module_dict(pickler, obj)
931 # we only care about session the first pass thru
932 pickler._session = False
--> 933 StockPickler.save_dict(pickler, obj)
934 log.info("# D2")
935 return
/opt/conda/lib/python3.7/pickle.py in save_dict(self, obj)
857
858 self.memoize(obj)
--> 859 self._batch_setitems(obj.items())
860
861 dispatch[dict] = save_dict
/opt/conda/lib/python3.7/pickle.py in _batch_setitems(self, items)
883 for k, v in tmp:
884 save(k)
--> 885 save(v)
886 write(SETITEMS)
887 elif n:
/opt/conda/lib/python3.7/pickle.py in save(self, obj, save_persistent_id)
547
548 # Save the reduce() output and finally memoize the object
--> 549 self.save_reduce(obj=obj, *rv)
550
551 def persistent_id(self, obj):
/opt/conda/lib/python3.7/pickle.py in save_reduce(self, func, args, state, listitems, dictitems, obj)
660
661 if state is not None:
--> 662 save(state)
663 write(BUILD)
664
/opt/conda/lib/python3.7/pickle.py in save(self, obj, save_persistent_id)
502 f = self.dispatch.get(t)
503 if f is not None:
--> 504 f(self, obj) # Call unbound method with explicit self
505 return
506
/opt/conda/lib/python3.7/site-packages/dill/_dill.py in save_module_dict(pickler, obj)
931 # we only care about session the first pass thru
932 pickler._session = False
--> 933 StockPickler.save_dict(pickler, obj)
934 log.info("# D2")
935 return
/opt/conda/lib/python3.7/pickle.py in save_dict(self, obj)
857
858 self.memoize(obj)
--> 859 self._batch_setitems(obj.items())
860
861 dispatch[dict] = save_dict
/opt/conda/lib/python3.7/pickle.py in _batch_setitems(self, items)
883 for k, v in tmp:
884 save(k)
--> 885 save(v)
886 write(SETITEMS)
887 elif n:
/opt/conda/lib/python3.7/pickle.py in save(self, obj, save_persistent_id)
547
548 # Save the reduce() output and finally memoize the object
--> 549 self.save_reduce(obj=obj, *rv)
550
551 def persistent_id(self, obj):
/opt/conda/lib/python3.7/pickle.py in save_reduce(self, func, args, state, listitems, dictitems, obj)
660
661 if state is not None:
--> 662 save(state)
663 write(BUILD)
664
/opt/conda/lib/python3.7/pickle.py in save(self, obj, save_persistent_id)
502 f = self.dispatch.get(t)
503 if f is not None:
--> 504 f(self, obj) # Call unbound method with explicit self
505 return
506
/opt/conda/lib/python3.7/site-packages/dill/_dill.py in save_module_dict(pickler, obj)
931 # we only care about session the first pass thru
932 pickler._session = False
--> 933 StockPickler.save_dict(pickler, obj)
934 log.info("# D2")
935 return
/opt/conda/lib/python3.7/pickle.py in save_dict(self, obj)
857
858 self.memoize(obj)
--> 859 self._batch_setitems(obj.items())
860
861 dispatch[dict] = save_dict
/opt/conda/lib/python3.7/pickle.py in _batch_setitems(self, items)
883 for k, v in tmp:
884 save(k)
--> 885 save(v)
886 write(SETITEMS)
887 elif n:
/opt/conda/lib/python3.7/pickle.py in save(self, obj, save_persistent_id)
522 reduce = getattr(obj, "__reduce_ex__", None)
523 if reduce is not None:
--> 524 rv = reduce(self.proto)
525 else:
526 reduce = getattr(obj, "__reduce__", None)
TypeError: can't pickle Tokenizer objects
```
| 42 | runing dataset.map, it raises TypeError: can't pickle Tokenizer objects
I load squad dataset. Then want to process data use following function with `Huggingface Transformers LongformerTokenizer`.
```
def convert_to_features(example):
# Tokenize contexts and questions (as pairs of inputs)
input_pairs = [example['question'], example['context']]
encodings = tokenizer.encode_plus(input_pairs, pad_to_max_length=True, max_length=512)
context_encodings = tokenizer.encode_plus(example['context'])
# Compute start and end tokens for labels using Transformers's fast tokenizers alignement methodes.
# this will give us the position of answer span in the context text
start_idx, end_idx = get_correct_alignement(example['context'], example['answers'])
start_positions_context = context_encodings.char_to_token(start_idx)
end_positions_context = context_encodings.char_to_token(end_idx-1)
# here we will compute the start and end position of the answer in the whole example
# as the example is encoded like this <s> question</s></s> context</s>
# and we know the postion of the answer in the context
# we can just find out the index of the sep token and then add that to position + 1 (+1 because there are two sep tokens)
# this will give us the position of the answer span in whole example
sep_idx = encodings['input_ids'].index(tokenizer.sep_token_id)
start_positions = start_positions_context + sep_idx + 1
end_positions = end_positions_context + sep_idx + 1
if end_positions > 512:
start_positions, end_positions = 0, 0
encodings.update({'start_positions': start_positions,
'end_positions': end_positions,
'attention_mask': encodings['attention_mask']})
return encodings
```
Then I run `dataset.map(convert_to_features)`, it raise
```
In [59]: a.map(convert_to_features)
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-59-c453b508761d> in <module>
----> 1 a.map(convert_to_features)
/opt/conda/lib/python3.7/site-packages/datasets/arrow_dataset.py in map(self, function, with_indices, input_columns, batched, batch_size, drop_last_batch, remove_columns, keep_in_memory, load_from_cache_file, cache_file_name, writer_batch_size, features, disable_nullable, fn_kwargs, num_proc, suffix_template, new_fingerprint)
1242 fn_kwargs=fn_kwargs,
1243 new_fingerprint=new_fingerprint,
-> 1244 update_data=update_data,
1245 )
1246 else:
/opt/conda/lib/python3.7/site-packages/datasets/arrow_dataset.py in wrapper(*args, **kwargs)
151 "output_all_columns": self._output_all_columns,
152 }
--> 153 out: Union["Dataset", "DatasetDict"] = func(self, *args, **kwargs)
154 if new_format["columns"] is not None:
155 new_format["columns"] = list(set(new_format["columns"]) & set(out.column_names))
/opt/conda/lib/python3.7/site-packages/datasets/fingerprint.py in wrapper(*args, **kwargs)
156 kwargs_for_fingerprint["fingerprint_name"] = fingerprint_name
157 kwargs[fingerprint_name] = update_fingerprint(
--> 158 self._fingerprint, transform, kwargs_for_fingerprint
159 )
160
/opt/conda/lib/python3.7/site-packages/datasets/fingerprint.py in update_fingerprint(fingerprint, transform, transform_args)
103 for key in sorted(transform_args):
104 hasher.update(key)
--> 105 hasher.update(transform_args[key])
106 return hasher.hexdigest()
107
/opt/conda/lib/python3.7/site-packages/datasets/fingerprint.py in update(self, value)
55 def update(self, value):
56 self.m.update(f"=={type(value)}==".encode("utf8"))
---> 57 self.m.update(self.hash(value).encode("utf-8"))
58
59 def hexdigest(self):
/opt/conda/lib/python3.7/site-packages/datasets/fingerprint.py in hash(cls, value)
51 return cls.dispatch[type(value)](cls, value)
52 else:
---> 53 return cls.hash_default(value)
54
55 def update(self, value):
/opt/conda/lib/python3.7/site-packages/datasets/fingerprint.py in hash_default(cls, value)
44 @classmethod
45 def hash_default(cls, value):
---> 46 return cls.hash_bytes(dumps(value))
47
48 @classmethod
/opt/conda/lib/python3.7/site-packages/datasets/utils/py_utils.py in dumps(obj)
365 file = StringIO()
366 with _no_cache_fields(obj):
--> 367 dump(obj, file)
368 return file.getvalue()
369
/opt/conda/lib/python3.7/site-packages/datasets/utils/py_utils.py in dump(obj, file)
337 def dump(obj, file):
338 """pickle an object to a file"""
--> 339 Pickler(file, recurse=True).dump(obj)
340 return
341
/opt/conda/lib/python3.7/site-packages/dill/_dill.py in dump(self, obj)
444 raise PicklingError(msg)
445 else:
--> 446 StockPickler.dump(self, obj)
447 stack.clear() # clear record of 'recursion-sensitive' pickled objects
448 return
/opt/conda/lib/python3.7/pickle.py in dump(self, obj)
435 if self.proto >= 4:
436 self.framer.start_framing()
--> 437 self.save(obj)
438 self.write(STOP)
439 self.framer.end_framing()
/opt/conda/lib/python3.7/pickle.py in save(self, obj, save_persistent_id)
502 f = self.dispatch.get(t)
503 if f is not None:
--> 504 f(self, obj) # Call unbound method with explicit self
505 return
506
/opt/conda/lib/python3.7/site-packages/dill/_dill.py in save_function(pickler, obj)
1436 globs, obj.__name__,
1437 obj.__defaults__, obj.__closure__,
-> 1438 obj.__dict__, fkwdefaults), obj=obj)
1439 else:
1440 _super = ('super' in getattr(obj.func_code,'co_names',())) and (_byref is not None) and getattr(pickler, '_recurse', False)
/opt/conda/lib/python3.7/pickle.py in save_reduce(self, func, args, state, listitems, dictitems, obj)
636 else:
637 save(func)
--> 638 save(args)
639 write(REDUCE)
640
/opt/conda/lib/python3.7/pickle.py in save(self, obj, save_persistent_id)
502 f = self.dispatch.get(t)
503 if f is not None:
--> 504 f(self, obj) # Call unbound method with explicit self
505 return
506
/opt/conda/lib/python3.7/pickle.py in save_tuple(self, obj)
787 write(MARK)
788 for element in obj:
--> 789 save(element)
790
791 if id(obj) in memo:
/opt/conda/lib/python3.7/pickle.py in save(self, obj, save_persistent_id)
502 f = self.dispatch.get(t)
503 if f is not None:
--> 504 f(self, obj) # Call unbound method with explicit self
505 return
506
/opt/conda/lib/python3.7/site-packages/dill/_dill.py in save_module_dict(pickler, obj)
931 # we only care about session the first pass thru
932 pickler._session = False
--> 933 StockPickler.save_dict(pickler, obj)
934 log.info("# D2")
935 return
/opt/conda/lib/python3.7/pickle.py in save_dict(self, obj)
857
858 self.memoize(obj)
--> 859 self._batch_setitems(obj.items())
860
861 dispatch[dict] = save_dict
/opt/conda/lib/python3.7/pickle.py in _batch_setitems(self, items)
883 for k, v in tmp:
884 save(k)
--> 885 save(v)
886 write(SETITEMS)
887 elif n:
/opt/conda/lib/python3.7/pickle.py in save(self, obj, save_persistent_id)
547
548 # Save the reduce() output and finally memoize the object
--> 549 self.save_reduce(obj=obj, *rv)
550
551 def persistent_id(self, obj):
/opt/conda/lib/python3.7/pickle.py in save_reduce(self, func, args, state, listitems, dictitems, obj)
660
661 if state is not None:
--> 662 save(state)
663 write(BUILD)
664
/opt/conda/lib/python3.7/pickle.py in save(self, obj, save_persistent_id)
502 f = self.dispatch.get(t)
503 if f is not None:
--> 504 f(self, obj) # Call unbound method with explicit self
505 return
506
/opt/conda/lib/python3.7/site-packages/dill/_dill.py in save_module_dict(pickler, obj)
931 # we only care about session the first pass thru
932 pickler._session = False
--> 933 StockPickler.save_dict(pickler, obj)
934 log.info("# D2")
935 return
/opt/conda/lib/python3.7/pickle.py in save_dict(self, obj)
857
858 self.memoize(obj)
--> 859 self._batch_setitems(obj.items())
860
861 dispatch[dict] = save_dict
/opt/conda/lib/python3.7/pickle.py in _batch_setitems(self, items)
883 for k, v in tmp:
884 save(k)
--> 885 save(v)
886 write(SETITEMS)
887 elif n:
/opt/conda/lib/python3.7/pickle.py in save(self, obj, save_persistent_id)
547
548 # Save the reduce() output and finally memoize the object
--> 549 self.save_reduce(obj=obj, *rv)
550
551 def persistent_id(self, obj):
/opt/conda/lib/python3.7/pickle.py in save_reduce(self, func, args, state, listitems, dictitems, obj)
660
661 if state is not None:
--> 662 save(state)
663 write(BUILD)
664
/opt/conda/lib/python3.7/pickle.py in save(self, obj, save_persistent_id)
502 f = self.dispatch.get(t)
503 if f is not None:
--> 504 f(self, obj) # Call unbound method with explicit self
505 return
506
/opt/conda/lib/python3.7/site-packages/dill/_dill.py in save_module_dict(pickler, obj)
931 # we only care about session the first pass thru
932 pickler._session = False
--> 933 StockPickler.save_dict(pickler, obj)
934 log.info("# D2")
935 return
/opt/conda/lib/python3.7/pickle.py in save_dict(self, obj)
857
858 self.memoize(obj)
--> 859 self._batch_setitems(obj.items())
860
861 dispatch[dict] = save_dict
/opt/conda/lib/python3.7/pickle.py in _batch_setitems(self, items)
883 for k, v in tmp:
884 save(k)
--> 885 save(v)
886 write(SETITEMS)
887 elif n:
/opt/conda/lib/python3.7/pickle.py in save(self, obj, save_persistent_id)
522 reduce = getattr(obj, "__reduce_ex__", None)
523 if reduce is not None:
--> 524 rv = reduce(self.proto)
525 else:
526 reduce = getattr(obj, "__reduce__", None)
TypeError: can't pickle Tokenizer objects
```
Thank you for the rapid and polite response!
@lhoestq Thanks for the suggestion! I've passed the pickle phase, but another `ArrowInvalid` problem occored. I created another issue #687 .
@thomwolf Wow, really fast work. I'm looking forward to the next release 🤗 | [
-0.2387792468070984,
-0.29784899950027466,
-0.01968042179942131,
0.23303498327732086,
0.4450329542160034,
-0.1729922890663147,
0.285151869058609,
0.1309390813112259,
-0.27609169483184814,
0.11031325161457062,
-0.06978636234998703,
0.4891909956932068,
-0.008726135827600956,
-0.04673432186245918,
-0.14570960402488708,
-0.11147376894950867,
0.053560320287942886,
0.20785319805145264,
0.01811389997601509,
-0.0561075396835804,
-0.27878260612487793,
0.2074422836303711,
-0.4731772541999817,
0.1585230827331543,
-0.2825991213321686,
-0.26742836833000183,
0.10640472173690796,
-0.1985800564289093,
-0.2693116068840027,
-0.3823219835758209,
-0.14364492893218994,
-0.07336577773094177,
-0.02884814143180847,
0.563336968421936,
-0.00011926037404919043,
0.0994180291891098,
0.1089542955160141,
-0.145972341299057,
0.005223780870437622,
-0.04956597089767456,
-0.07480692863464355,
-0.3035498261451721,
-0.2058742642402649,
-0.458272784948349,
-0.15564605593681335,
-0.14384402334690094,
0.01115584559738636,
-0.332488477230072,
0.5145230889320374,
0.29142072796821594,
0.1399780958890915,
0.49322691559791565,
0.020635265856981277,
0.0532786101102829,
0.01532786339521408,
0.029823776334524155,
-0.13145363330841064,
-0.2608633041381836,
0.1487918347120285,
0.21654660999774933,
-0.130271315574646,
0.32548898458480835,
-0.1613031029701233,
-0.2627820670604706,
0.09947003424167633,
0.0949372872710228,
0.10411272197961807,
-0.4675593674182892,
0.32304832339286804,
-0.0021582134068012238,
0.21897175908088684,
-0.0208103209733963,
-0.2567599415779114,
-0.2679678201675415,
-0.07948525995016098,
0.0625915676355362,
-0.04125243425369263,
-0.20221516489982605,
0.0776134580373764,
0.05128606781363487,
-0.35269349813461304,
-0.17235323786735535,
-0.17987319827079773,
0.10823331773281097,
0.038386598229408264,
0.3674837648868561,
-0.26661092042922974,
0.29305195808410645,
0.09679804742336273,
-0.25016647577285767,
-0.11382152140140533,
-0.09912005811929703,
0.22644498944282532,
0.47687241435050964,
-0.3883419334888458,
-0.300885945558548,
-0.09438016265630722,
-0.40999895334243774,
0.34774601459503174,
-0.03840678930282593,
-0.22767992317676544,
0.25541263818740845,
-0.04895595833659172,
0.1893790066242218,
0.02317630872130394,
0.3520207107067108,
0.26322129368782043,
0.3699648678302765,
0.011672910302877426,
-0.1440165638923645,
0.06525957584381104,
-0.048873476684093475,
-0.08222289383411407,
-0.22157606482505798,
-0.05691240727901459,
0.2582862079143524,
0.35951292514801025,
-0.018613029271364212,
-0.046238239854574203,
0.02786199375987053,
-0.22628015279769897,
0.0427437499165535,
0.17346373200416565,
0.4068899154663086,
0.10801348090171814,
0.23184126615524292,
-0.31838929653167725,
0.09024085104465485,
-0.12427999824285507,
0.025306612253189087,
-0.16548646986484528,
0.21402311325073242,
-0.006621330976486206,
-0.13937939703464508,
-0.16431912779808044,
0.0698126032948494,
0.20134250819683075,
-0.026837512850761414,
0.0632021501660347,
-0.22027723491191864,
0.06153841316699982,
-0.17903092503547668,
0.2758256494998932,
-0.09431135654449463,
-0.050224341452121735,
0.17375634610652924,
0.20817093551158905,
-0.40948057174682617,
-0.20605650544166565,
0.035232916474342346,
-0.3411520719528198,
0.017331700772047043,
0.13118889927864075,
0.1185407042503357,
0.05623745918273926,
0.04769054800271988,
-0.3749629259109497,
0.2920551896095276,
0.41460344195365906,
0.007591649889945984,
0.03226820379495621,
-0.12673820555210114,
-0.2016417384147644,
-0.11112698912620544,
0.21824829280376434,
0.18993636965751648,
-0.1373288482427597,
-0.20797701179981232,
0.2503730058670044,
-0.0020624157041311264,
0.15356677770614624,
0.4049595594406128,
-0.05302755907177925,
0.25622016191482544,
-0.14678503572940826,
0.5597744584083557,
0.4704824388027191,
-0.625508189201355,
-0.5309314131736755,
0.10321839153766632,
-0.4468843936920166,
-0.1779436618089676,
-0.03534664958715439,
0.041638411581516266,
0.5613892078399658,
0.12415531277656555,
-0.1132064014673233,
0.3392552137374878,
0.07229578495025635,
0.2676008641719818,
-0.15639422833919525,
-0.14152976870536804,
0.40929919481277466,
0.09268194437026978,
0.21709808707237244,
0.11648884415626526,
-0.16825279593467712,
0.19713763892650604,
-0.10224737972021103,
-0.1236945390701294,
0.09144434332847595,
0.19020487368106842,
0.16542726755142212,
-0.21081383526325226,
0.08061237633228302,
-0.16297811269760132,
-0.5545790791511536,
0.06518654525279999,
-0.34768620133399963,
0.2234152853488922,
-0.28904998302459717,
-0.1947721689939499,
-0.28876471519470215,
0.15413497388362885,
-0.45191892981529236,
-0.052400071173906326,
0.0838475450873375,
-0.03061482310295105,
0.18893752992153168,
-0.013604627922177315,
0.019288551062345505,
-0.07614041119813919,
0.1458209604024887,
0.18609404563903809,
-0.2552468478679657,
0.20620331168174744,
-0.2569340169429779,
0.02114827185869217,
-0.05973024666309357,
0.09906291961669922,
0.4085010886192322,
-0.17598335444927216,
-0.2551455497741699,
0.2755492031574249,
0.17205199599266052,
-0.08486801385879517,
-0.05005958676338196,
-0.03503546118736267,
0.2658097743988037,
-0.20969520509243011,
-0.06440680474042892,
0.1785881519317627,
0.16671858727931976,
-0.02876027673482895,
-0.09293530136346817,
0.4431660771369934,
0.2247035801410675,
0.31786227226257324,
-0.01910526677966118,
0.1625133454799652,
0.24128490686416626,
-0.10274730622768402,
-0.04649505019187927,
-0.13554337620735168,
-0.17649294435977936,
0.0628637820482254,
0.23403991758823395,
-0.07365301996469498,
0.06564219295978546,
-0.059074871242046356,
0.8479932546615601,
-0.06834638118743896,
0.07938273996114731,
0.2044738531112671,
-0.11635082215070724,
0.049705870449543,
-0.07888424396514893,
-0.40181025862693787,
0.04173742234706879,
0.03922862559556961,
-0.17348940670490265,
-0.10662073642015457,
0.2546636462211609,
0.14594495296478271,
0.041524969041347504,
0.3150503635406494,
0.11469598859548569,
0.225544273853302,
0.15998724102973938,
0.11295114457607269,
-0.17203378677368164,
-0.19414323568344116,
0.16297325491905212,
0.1452348679304123,
-0.14686189591884613,
-0.024431999772787094,
-0.04605673998594284,
0.044477060437202454,
0.010470712557435036,
-0.04867228865623474,
-0.19503360986709595,
-0.250466912984848,
0.03378954157233238,
-0.023758497089147568,
0.09573529660701752,
0.449554979801178,
0.3668549656867981,
0.3240298628807068,
0.4278208613395691,
-0.10992073267698288,
-0.1704414188861847,
-0.19697964191436768,
-0.08769410103559494,
-0.06773465126752853,
0.1707262545824051,
-0.00535688316449523,
-0.03574804961681366,
0.010384462773799896,
0.10249228775501251,
-0.45612791180610657,
-0.4291422665119171,
0.2537456154823303,
-0.17828468978405,
0.1860090047121048,
-0.014134995639324188,
0.12101293355226517,
-0.3429492712020874,
-0.2921084761619568,
0.2118503600358963,
-0.21941320598125458,
-0.30137452483177185,
0.07068181037902832,
-0.061088766902685165,
-0.3209868371486664,
0.05117690935730934,
-0.24058660864830017,
-0.3765723705291748,
-0.33769187331199646,
0.3630162477493286,
-0.008248493075370789,
0.1135793924331665,
0.15415820479393005,
-0.00302607798948884,
0.2885194420814514,
-0.020071396604180336,
-0.035907477140426636,
-0.24400143325328827,
0.054305534809827805,
0.4122081995010376,
-0.18261869251728058,
-0.2826859652996063,
-0.39157694578170776,
-0.17591607570648193,
0.05257883667945862,
-0.12937913835048676,
-0.10209265351295471,
-0.22754734754562378,
-0.2711943984031677,
0.22384607791900635,
-0.16086310148239136,
0.045888230204582214,
0.5580427646636963,
-0.049236368387937546,
0.09076553583145142,
0.01156727597117424,
-0.16093182563781738,
0.27200356125831604,
0.1358187049627304,
0.081289142370224,
-0.010779760777950287,
0.5259879231452942,
0.1519598662853241,
0.8704360127449036,
0.15821492671966553,
-0.21943803131580353,
0.16835519671440125,
-0.14850348234176636,
-0.01063704863190651,
-0.03405507653951645,
-0.38928478956222534,
0.1844978630542755,
-0.04435047507286072,
0.12260723114013672,
0.13958825170993805,
-0.20949199795722961,
-0.15563496947288513,
0.14549137651920319,
-0.09472277760505676,
-0.218725323677063,
-0.27573642134666443,
-0.022572895511984825,
0.09790511429309845,
0.09834414720535278,
0.04776653274893761,
0.1866316795349121,
-0.44355639815330505,
0.06796005368232727,
0.11922764778137207,
0.004403114318847656,
0.048046551644802094,
-0.04683779925107956,
-1.0162560939788818,
-0.09132109582424164,
-0.17027941346168518,
0.36549264192581177,
0.22949711978435516,
0.4982428550720215,
-0.017992455512285233,
-0.04699508473277092,
0.05150580406188965,
-0.21210986375808716,
0.8495116829872131,
0.2505570650100708,
-0.05321195721626282,
0.07962740957736969,
0.018949035555124283,
-0.15455107390880585,
0.057700660079717636,
-0.16324123740196228,
0.6255757212638855,
0.4945645332336426,
0.7852731943130493,
-0.43740472197532654,
-0.08937069773674011,
0.031204042956233025,
-0.059960100799798965,
-0.1476590782403946,
0.08103042095899582,
-0.2087637037038803,
-0.180411696434021,
-0.5762062072753906,
0.25856703519821167,
0.28101325035095215,
0.19283361732959747,
0.15283092856407166,
-0.22316685318946838,
0.06901504844427109,
-0.28400319814682007,
-0.0985405296087265,
0.23120428621768951,
0.21433523297309875,
0.18589964509010315,
-0.0022402051836252213,
0.1455385386943817,
-0.1561146229505539,
-0.20688201487064362,
0.18994294106960297,
0.25589486956596375,
-0.6231854557991028,
0.2523166835308075,
0.16514982283115387,
0.5603795051574707,
0.15823112428188324,
-0.11502523720264435,
0.29464662075042725,
-0.01051352545619011,
0.47939586639404297,
-0.03906324505805969,
0.47881969809532166,
0.36262446641921997,
0.27784213423728943,
-0.301658570766449,
-0.13845354318618774,
0.38594749569892883,
-0.015479073859751225,
0.07214416563510895,
0.015306081622838974,
0.26423370838165283,
-0.15237964689731598,
0.5785444974899292,
0.10501522570848465,
1.0689465999603271,
-0.09628941118717194,
-0.09116224944591522,
0.12688452005386353,
0.26558351516723633,
0.5600724220275879,
-0.2914607524871826,
0.20523881912231445,
-0.5174928307533264,
-0.09049858152866364,
0.004256146028637886,
-0.13982944190502167,
0.13500869274139404,
0.18870440125465393,
-0.43005746603012085,
0.13892552256584167,
0.09927932918071747,
0.4275941550731659,
0.0399220809340477,
0.41344207525253296,
-0.01810356043279171,
-0.47711026668548584,
-0.12599581480026245,
0.06626572459936142,
-0.2162787765264511,
0.2179781198501587,
0.09313574433326721,
0.016773607581853867,
-0.22999055683612823,
-0.33340728282928467,
-0.06853975355625153,
0.08772076666355133,
-0.3980344831943512,
0.6731892228126526,
0.3429543673992157,
-0.19453462958335876,
0.29567334055900574,
0.2294493168592453,
0.15479309856891632,
0.2516958713531494,
-0.06370928883552551,
0.16826605796813965,
0.14975035190582275,
-0.0029831882566213608,
0.19938354194164276,
-0.06823351979255676,
0.11906512826681137,
-0.010318662971258163,
-0.10151160508394241,
0.175491064786911,
-0.012460781261324883,
-0.2762168347835541,
-0.2717879116535187,
-0.12400531768798828,
0.290338397026062,
-0.3395358622074127,
-0.2814115583896637,
-0.039557285606861115,
-0.28503528237342834,
-0.20351310074329376,
0.022034604102373123,
-0.07065904140472412,
-0.374799519777298,
0.22638219594955444,
0.23766908049583435,
-0.14269255101680756,
0.16958646476268768,
0.3712310492992401,
-0.025501083582639694,
-0.0888265073299408,
0.5584914684295654,
0.0715673416852951,
-0.19460977613925934,
-0.2024843990802765,
0.15187907218933105,
-0.033778805285692215,
-0.22719457745552063,
0.10915811359882355,
-0.1162661463022232,
-0.2636433243751526,
-0.22879533469676971,
0.3435634970664978,
-0.025700241327285767,
0.04026198014616966,
-0.2143467515707016,
-0.4193451404571533,
-0.5076627731323242,
0.049949295818805695,
-0.13119997084140778,
0.18116499483585358,
0.4385978579521179,
0.40800604224205017,
-0.25686928629875183,
0.3760196566581726,
-0.2495919018983841,
-0.08002421259880066,
-0.5987672805786133,
0.2662302255630493,
0.01884259283542633,
-0.5459761619567871,
-0.027553904801607132,
0.02164069376885891,
0.026443468406796455,
0.294058620929718,
-0.12007908523082733,
-0.15881237387657166,
-0.07026086002588272,
0.16056318581104279,
0.2280811369419098,
-0.10137251019477844,
-0.2458610236644745,
0.11841046810150146,
-0.17929944396018982,
-0.15681114792823792,
0.1025065928697586,
0.1319531500339508,
0.012163061648607254,
0.12355339527130127,
-0.09083551168441772,
-0.11700523644685745,
-0.05135424807667732,
-0.08652322739362717,
0.04924800619482994,
-0.15517960488796234,
0.2005685269832611,
0.38877812027931213,
-0.19008755683898926,
-0.009076409041881561,
-0.29091838002204895,
0.17954382300376892,
0.6930253505706787,
0.009677674621343613,
0.3933945298194885,
-0.31458789110183716,
-0.15080979466438293,
0.22921109199523926,
-0.20730316638946533,
0.18506640195846558,
-0.3238910436630249,
-0.09588629007339478,
0.22866439819335938,
0.12948498129844666,
-0.2605692744255066,
-0.20624437928199768,
0.5028800368309021,
-0.3981369435787201,
0.1572275012731552,
0.12966448068618774,
-0.09836220741271973,
0.2678849697113037,
0.18320630490779877,
0.1603044867515564,
0.7458080649375916,
0.011786268092691898,
0.17655035853385925,
-0.06224888935685158,
-0.09200140088796616,
0.05511584132909775,
0.5123581290245056,
0.13516101241111755,
0.2308288961648941,
0.11014201492071152,
-0.20327258110046387,
0.37733936309814453,
-0.42855411767959595,
0.2233327180147171,
0.36982885003089905,
-0.12526848912239075,
-0.19376134872436523,
0.20874705910682678,
-0.14037078619003296,
0.2644398808479309,
-0.04349501430988312,
0.35226011276245117,
-0.1093691885471344,
-0.17406626045703888,
-0.16872172057628632,
0.49048706889152527,
-0.3190309703350067,
-0.049097366631031036,
-0.021232690662145615,
-0.07593855261802673,
-0.1959420144557953,
-0.28567615151405334,
0.050842709839344025,
-0.06166030466556549,
0.10977569967508316,
0.015786856412887573,
-0.08042746782302856,
0.2032719999551773,
-0.14787951111793518,
0.17750829458236694,
0.24254110455513,
-0.32913538813591003,
0.2424011528491974,
0.1096196249127388,
0.2629409432411194,
-0.24783456325531006,
0.11491469293832779,
0.3023820221424103,
0.26866012811660767,
-0.4128156304359436,
0.1197531670331955,
-0.061437491327524185,
-0.15522582828998566,
0.15395838022232056,
0.1354498416185379,
-0.1843048334121704,
-0.21929125487804413,
0.23018088936805725,
0.07787932455539703,
-0.2095593959093094,
-0.17226456105709076,
0.1902216076850891,
0.10927625000476837,
0.1233893632888794,
-0.049729399383068085,
-0.08056873083114624,
-0.20539340376853943,
-0.3169712722301483,
-0.17713499069213867,
-0.39904630184173584,
-0.04866921156644821,
0.08204156160354614,
-0.23340527713298798,
0.2352660596370697,
-0.306997686624527,
0.08067841082811356,
0.08235998451709747,
0.36441871523857117,
0.31551843881607056,
0.08895154297351837,
-0.3957797884941101,
-0.02335897833108902,
-0.40491533279418945,
0.21320071816444397,
0.30975788831710815,
-0.19389264285564423,
0.08527778834104538,
0.1949712485074997,
0.06053662300109863,
0.31443339586257935,
-0.10639722645282745,
0.057046450674533844,
-0.13181345164775848,
-0.006787165999412537,
-0.21990114450454712,
0.13424824178218842,
-0.16535654664039612,
0.1062282919883728,
0.2053379863500595,
-0.3196316957473755,
0.3005921244621277,
0.2335086166858673,
-0.016038425266742706,
-0.20376719534397125,
-0.07318393886089325,
-0.21352843940258026,
-0.3241588771343231,
-0.04828055948019028,
0.2011154741048813,
0.2985321581363678,
-0.28266650438308716,
0.18013443052768707,
0.20976580679416656,
-0.043841224163770676,
-0.2875528335571289,
-0.19312211871147156,
0.15643532574176788,
0.4927528202533722,
-0.0002095801755785942,
0.12636980414390564,
-0.3023885190486908,
-0.17570357024669647,
0.08756741881370544,
-0.28133371472358704,
-0.24230000376701355,
0.33336523175239563,
-0.20570093393325806,
0.1753343790769577,
-0.014726635068655014,
0.21862280368804932,
0.07085446268320084,
0.28340816497802734,
-0.24533317983150482,
-0.45495712757110596,
0.6601229906082153,
-0.4289315640926361,
-0.48007938265800476,
-0.05626486986875534,
-0.06597250699996948,
0.13737857341766357,
-0.2057526409626007,
-0.2559032440185547,
-0.15045183897018433,
0.2913421094417572,
0.08456270396709442,
-0.20066991448402405,
0.05188633129000664,
0.15546011924743652,
-0.03583145514130592,
-0.150189608335495,
0.3721500039100647,
0.12918761372566223,
0.06289525330066681,
0.10387624800205231,
-0.2139434814453125
] |
https://github.com/huggingface/datasets/issues/664 | load_dataset from local squad.py, raise error: TypeError: 'NoneType' object is not callable | Hi !
Thanks for reporting.
It looks like no object inherits from `datasets.GeneratorBasedBuilder` (or more generally from `datasets.DatasetBuilder`) in your script.
Could you check that there exist at least one dataset builder class ? |
version: 1.0.2
```
train_dataset = datasets.load_dataset('squad')
```
The above code can works. However, when I download the squad.py from your server, and saved as `my_squad.py` to local. I run followings raise errors.
```
train_dataset = datasets.load_dataset('./my_squad.py')
```
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-28-25a84b4d1581> in <module>
----> 1 train_dataset = nlp.load_dataset('./my_squad.py')
/opt/conda/lib/python3.7/site-packages/datasets/load.py in load_dataset(path, name, data_dir, data_files, split, cache_dir, features, download_config, download_mode, ignore_verifications, save_infos, script_version, **config_kwargs)
602 hash=hash,
603 features=features,
--> 604 **config_kwargs,
605 )
606
TypeError: 'NoneType' object is not callable
| 34 | load_dataset from local squad.py, raise error: TypeError: 'NoneType' object is not callable
version: 1.0.2
```
train_dataset = datasets.load_dataset('squad')
```
The above code can works. However, when I download the squad.py from your server, and saved as `my_squad.py` to local. I run followings raise errors.
```
train_dataset = datasets.load_dataset('./my_squad.py')
```
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-28-25a84b4d1581> in <module>
----> 1 train_dataset = nlp.load_dataset('./my_squad.py')
/opt/conda/lib/python3.7/site-packages/datasets/load.py in load_dataset(path, name, data_dir, data_files, split, cache_dir, features, download_config, download_mode, ignore_verifications, save_infos, script_version, **config_kwargs)
602 hash=hash,
603 features=features,
--> 604 **config_kwargs,
605 )
606
TypeError: 'NoneType' object is not callable
Hi !
Thanks for reporting.
It looks like no object inherits from `datasets.GeneratorBasedBuilder` (or more generally from `datasets.DatasetBuilder`) in your script.
Could you check that there exist at least one dataset builder class ? | [
-0.22435887157917023,
0.32966285943984985,
0.1114712804555893,
0.15808042883872986,
0.3371320962905884,
-0.025465749204158783,
0.6201823949813843,
0.3964117765426636,
-0.1371881365776062,
0.05467928946018219,
-0.08272508531808853,
0.41127142310142517,
-0.12458264082670212,
-0.024263784289360046,
0.3396511971950531,
0.045503128319978714,
-0.061054714024066925,
0.2632739543914795,
-0.19698864221572876,
-0.23984891176223755,
-0.25955888628959656,
-0.03625272214412689,
-0.05322931334376335,
0.3426586389541626,
-0.35873332619667053,
0.016730040311813354,
-0.022224891930818558,
0.413007915019989,
-0.20734655857086182,
-0.40580514073371887,
0.4260215759277344,
-0.05207036808133125,
0.4543030261993408,
0.460936963558197,
-0.00010860504698939621,
0.09642285108566284,
0.20372362434864044,
-0.05677548795938492,
-0.4298076629638672,
-0.49393409490585327,
0.017413757741451263,
-0.26001542806625366,
0.34803062677383423,
-0.4434492290019989,
-0.044265422970056534,
0.1277414709329605,
0.1641690582036972,
-0.20789095759391785,
0.41982924938201904,
0.5076460242271423,
0.21143566071987152,
0.41648605465888977,
-0.04789507016539574,
-0.10724612325429916,
0.060645461082458496,
0.23253217339515686,
-0.1264864206314087,
0.405080646276474,
0.011232823133468628,
-0.20079030096530914,
0.246761292219162,
-0.05163075029850006,
-0.2405681163072586,
-0.02045772224664688,
0.28363725543022156,
0.1646961122751236,
-0.003888443112373352,
-0.33967024087905884,
0.03799052909016609,
0.025460071861743927,
0.30435389280319214,
-0.5623265504837036,
-0.4327319264411926,
0.05224764347076416,
0.23867638409137726,
-0.09037920832633972,
0.06191970035433769,
0.12697623670101166,
-0.13915088772773743,
0.16502971947193146,
-0.2995200455188751,
-0.01745271123945713,
-0.34699127078056335,
0.21854715049266815,
0.1378306746482849,
0.08822552859783173,
-0.0734710842370987,
0.2105124592781067,
-0.09460869431495667,
0.11744679510593414,
0.16583693027496338,
-0.06704992055892944,
0.26005613803863525,
0.2247147262096405,
-0.16577157378196716,
-0.05639010667800903,
0.14840687811374664,
-0.2879840135574341,
0.08354077488183975,
0.13766098022460938,
0.1994941383600235,
0.03540834039449692,
0.14757096767425537,
0.3584354817867279,
0.30463099479675293,
-0.010383332148194313,
0.4460417926311493,
0.3905518352985382,
0.2092553824186325,
0.02047714777290821,
-0.3075549900531769,
0.08164703100919724,
-0.40336909890174866,
-0.10909458994865417,
0.275895893573761,
0.0765986293554306,
0.61480712890625,
-0.17585062980651855,
-0.08847320079803467,
-0.021499693393707275,
-0.01598137430846691,
-0.015097519382834435,
0.17895476520061493,
0.3566185534000397,
-0.004670138470828533,
0.17850691080093384,
0.02264653891324997,
0.3013429641723633,
-0.22894595563411713,
-0.3886496424674988,
-0.15761691331863403,
-0.019161317497491837,
-0.11963868141174316,
0.11190677434206009,
0.32363706827163696,
0.020029880106449127,
0.062040917575359344,
-0.053984928876161575,
0.009688593447208405,
0.08574356138706207,
0.33947819471359253,
-0.2605606019496918,
-0.08834954351186752,
0.08933389186859131,
0.19725218415260315,
0.04556842893362045,
0.3239513635635376,
-0.4812254309654236,
-0.16577568650245667,
0.09357249736785889,
-0.14213979244232178,
-0.41504067182540894,
-0.23594622313976288,
0.18115095794200897,
-0.15414796769618988,
-0.08484801650047302,
-0.07376677542924881,
-0.14946269989013672,
0.22221112251281738,
-0.3436720371246338,
-0.08936465531587601,
-0.211836040019989,
-0.09792576730251312,
-0.3135225772857666,
0.1799427717924118,
0.7318375110626221,
-0.5566923022270203,
-0.17485055327415466,
0.03765187785029411,
-0.17763613164424896,
0.2152797132730484,
0.00919262133538723,
-0.396612286567688,
0.22390985488891602,
-0.03695499897003174,
-0.11634457111358643,
0.8239555954933167,
-0.5646016001701355,
-0.2108428180217743,
0.31482061743736267,
-0.23909184336662292,
-0.19884593784809113,
-0.06610595434904099,
-0.025355448946356773,
0.34009218215942383,
0.0921124815940857,
0.28758305311203003,
0.5355546474456787,
-0.029460186138749123,
0.020822634920477867,
-0.18602785468101501,
-0.20299828052520752,
0.08484318852424622,
0.21913449466228485,
0.02314184233546257,
0.330308198928833,
0.1459704488515854,
0.08640697598457336,
0.005234427750110626,
-0.17677313089370728,
0.11814739555120468,
0.09416826069355011,
0.33870476484298706,
0.07414792478084564,
-0.24908022582530975,
-0.2523493766784668,
-0.6033936142921448,
0.09043712168931961,
-0.33371618390083313,
0.2756749987602234,
-0.20558308064937592,
-0.14933860301971436,
-0.21541935205459595,
0.06647234410047531,
-0.3703395128250122,
0.12641577422618866,
0.14118340611457825,
0.17702032625675201,
0.07986469566822052,
-0.04292541742324829,
-0.35292714834213257,
0.08764752000570297,
-0.20507802069187164,
0.20827490091323853,
-0.17664504051208496,
0.2906634509563446,
-0.18837712705135345,
-0.2833377718925476,
0.089140385389328,
0.20236492156982422,
0.2694809138774872,
-0.18181069195270538,
-0.141118586063385,
0.3598249852657318,
-0.21072807908058167,
-0.06935833394527435,
0.16344058513641357,
-0.29666668176651,
0.012688921764492989,
-0.07519794255495071,
0.2857246398925781,
-0.06479920446872711,
0.10656033456325531,
-0.06781512498855591,
-0.11507967859506607,
0.5167067646980286,
-0.003173418343067169,
0.17210644483566284,
-0.052664920687675476,
0.020594799891114235,
0.10813756287097931,
0.07527640461921692,
-0.20945121347904205,
-0.15810757875442505,
-0.2273746281862259,
0.26974788308143616,
0.4829785227775574,
0.11885897070169449,
-0.14706715941429138,
0.053256481885910034,
0.5740777254104614,
-0.05465083196759224,
0.13728955388069153,
0.08516174554824829,
-0.13134530186653137,
-0.04123270884156227,
0.07084037363529205,
0.14797362685203552,
0.5725581645965576,
0.09963324666023254,
-0.07945345342159271,
-0.026810133829712868,
-0.15646502375602722,
-0.006220247596502304,
-0.03343682736158371,
-0.12059405446052551,
0.21833065152168274,
0.06420961022377014,
0.09337139874696732,
0.03564560413360596,
-0.2885568141937256,
-0.11447137594223022,
0.1267338991165161,
0.243350550532341,
-0.19781959056854248,
0.27673521637916565,
-0.24653902649879456,
0.0061048902571201324,
-0.44813665747642517,
-0.06402743607759476,
-0.34086090326309204,
-0.019282782450318336,
-0.20101426541805267,
0.1224418431520462,
0.15620827674865723,
0.1803925782442093,
-0.11375486850738525,
0.005295485258102417,
0.08495397865772247,
-0.5639902353286743,
0.1915777176618576,
-0.07982375472784042,
-0.3821256458759308,
-0.022375360131263733,
0.43192437291145325,
0.07937240600585938,
0.24854475259780884,
-0.200680673122406,
-0.022445164620876312,
-0.009783634915947914,
-0.004424527287483215,
-0.012908607721328735,
0.11072475463151932,
0.26169392466545105,
0.04674648493528366,
0.21207687258720398,
-0.1695704460144043,
-0.2411048412322998,
0.536125659942627,
-0.32840830087661743,
0.022523535415530205,
0.21595463156700134,
-0.12017994374036789,
-0.0991031602025032,
-0.20322822034358978,
-0.6506760716438293,
-0.5834840536117554,
-0.30923348665237427,
0.09822417795658112,
0.3362255394458771,
0.2940900921821594,
0.24894584715366364,
0.3768066465854645,
0.42349377274513245,
0.02083544246852398,
0.10716060549020767,
-0.07201214879751205,
-0.3683304786682129,
0.3266996145248413,
-0.30986014008522034,
-0.3858875036239624,
0.0721755176782608,
-0.07735525816679001,
0.159359410405159,
-0.16420190036296844,
-0.14369651675224304,
-0.12413348257541656,
0.143411323428154,
0.2297298014163971,
-0.010808754712343216,
0.15344636142253876,
0.3795168697834015,
0.062445949763059616,
0.013037065044045448,
-0.023235995322465897,
-0.24661840498447418,
0.130395770072937,
0.26443955302238464,
0.12920278310775757,
0.11524292826652527,
0.466404527425766,
-0.31065303087234497,
0.6398786902427673,
-0.06542889773845673,
-0.17927424609661102,
0.32211434841156006,
-0.1978890597820282,
0.32807374000549316,
-0.2653108835220337,
-0.5119051933288574,
0.08642629534006119,
-0.00684782862663269,
-0.11171519011259079,
0.13004978001117706,
-0.09437159448862076,
-0.2312445044517517,
-0.34417885541915894,
0.001011056825518608,
-0.30427682399749756,
-0.2875995934009552,
0.12914296984672546,
0.10151976346969604,
0.01781574636697769,
0.16566254198551178,
0.1310948133468628,
-0.46439123153686523,
0.08173537999391556,
-0.29465755820274353,
0.13110120594501495,
0.018882527947425842,
0.11633095890283585,
-0.6968172192573547,
-0.004090496338903904,
-0.26060736179351807,
0.2750988006591797,
-0.0018123681657016277,
0.34437695145606995,
-0.0007361508905887604,
-0.1504272222518921,
0.07905840128660202,
0.0071528032422065735,
0.3598927855491638,
0.04435409605503082,
-0.0332389771938324,
0.34948092699050903,
0.00831642746925354,
-0.3661867678165436,
-0.06900069117546082,
0.05785303935408592,
0.41266074776649475,
0.17792978882789612,
0.3058730363845825,
-0.1788780391216278,
-0.15197791159152985,
0.2920208275318146,
0.11719848960638046,
-0.1820327639579773,
-0.12396366149187088,
-0.40057647228240967,
-0.1464548408985138,
-0.45809823274612427,
-0.13692352175712585,
-0.31793737411499023,
0.31357648968696594,
-0.17640618979930878,
-0.016939649358391762,
0.010125953704118729,
0.22561511397361755,
0.09845499694347382,
0.22851741313934326,
0.1719059944152832,
0.010398170910775661,
0.02343307062983513,
0.18170420825481415,
0.13972340524196625,
0.08857063949108124,
0.42749059200286865,
-0.015426933765411377,
-0.427629292011261,
0.09688370674848557,
0.024751488119363785,
0.2670660614967346,
0.26108428835868835,
0.0509394034743309,
-0.34384164214134216,
0.11450981348752975,
-0.05045180022716522,
0.16148436069488525,
0.016675641760230064,
0.24125118553638458,
-0.243265762925148,
-0.16541270911693573,
-0.6092642545700073,
0.2995342016220093,
-0.01743229478597641,
0.1257801055908203,
0.07407841831445694,
-0.10407057404518127,
-0.06999588012695312,
0.26411062479019165,
-0.03338693082332611,
0.9230501651763916,
-0.24370421469211578,
0.26718375086784363,
0.4023743271827698,
0.027080468833446503,
0.5112029910087585,
-0.1930643916130066,
0.09543855488300323,
-0.5287598967552185,
0.06115495786070824,
0.07875041663646698,
-0.14063280820846558,
0.24486634135246277,
0.45300471782684326,
-0.2674677073955536,
0.2707575559616089,
-0.16330432891845703,
0.2369351089000702,
0.022980619221925735,
0.3502406179904938,
0.08262063562870026,
-0.29687532782554626,
-0.533413827419281,
0.1607748568058014,
-0.1526106595993042,
0.2689838707447052,
-0.12258417159318924,
-0.337527334690094,
-0.17866605520248413,
-0.14766809344291687,
0.09950485825538635,
0.2700580358505249,
-0.19740310311317444,
0.2189333736896515,
0.09264543652534485,
-0.19757534563541412,
-0.025171097368001938,
0.39619356393814087,
0.12240660935640335,
-0.020379941910505295,
-0.15696197748184204,
-0.16560015082359314,
-0.03398182988166809,
0.03313332051038742,
-0.17390933632850647,
0.08831242471933365,
0.3278297781944275,
-0.09335082769393921,
-0.36619797348976135,
0.12512457370758057,
0.038167018443346024,
-0.2050873190164566,
0.20903581380844116,
0.0745568573474884,
0.31462645530700684,
-0.389338880777359,
-0.38713744282722473,
-0.0512852817773819,
0.011202074587345123,
-0.1596222221851349,
0.16645635664463043,
-0.010803177952766418,
-0.1299455165863037,
0.019704196602106094,
0.12227973341941833,
-0.14925822615623474,
0.04549343138933182,
0.6396822929382324,
0.003715965896844864,
0.10974211990833282,
0.5209493041038513,
0.09986206889152527,
0.07453949004411697,
-0.30041947960853577,
0.32967615127563477,
0.012295538559556007,
-0.33253544569015503,
-0.00516003742814064,
0.27631425857543945,
-0.07112978398799896,
0.04935096204280853,
0.025326523929834366,
0.004810694605112076,
0.15566465258598328,
-0.06131437048316002,
-0.19633588194847107,
-0.39217329025268555,
0.08336687088012695,
0.22299504280090332,
0.023874565958976746,
0.3970586657524109,
0.3349560499191284,
0.29664066433906555,
-0.06674596667289734,
-0.31743115186691284,
-0.06359124183654785,
-0.253483384847641,
0.08539287000894547,
0.10110700875520706,
-0.2618177533149719,
0.04043705761432648,
-0.0037619564682245255,
0.12136656045913696,
-0.03906452655792236,
-0.034327611327171326,
-0.23439905047416687,
-0.02421930804848671,
0.167631596326828,
0.1767391562461853,
-0.012967459857463837,
-0.14079105854034424,
-0.19675223529338837,
-0.21414898335933685,
-0.06557456403970718,
-0.06793296337127686,
0.14294108748435974,
-0.024340718984603882,
0.19712121784687042,
-0.04133068397641182,
0.24793490767478943,
-0.05016881600022316,
-0.0038262493908405304,
-0.08803078532218933,
0.12367059290409088,
-0.05304926261305809,
0.21344800293445587,
0.020391907542943954,
-0.06330087035894394,
-0.40117859840393066,
-0.03789170831441879,
0.06906849890947342,
0.3248789310455322,
0.27662116289138794,
-0.49678146839141846,
-0.0730513334274292,
0.15255296230316162,
0.046383120119571686,
0.45506173372268677,
-0.19009500741958618,
0.16611477732658386,
0.03149206191301346,
0.17238985002040863,
-0.23589283227920532,
-0.08595199137926102,
0.41794729232788086,
-0.3348879814147949,
-0.07336138188838959,
0.18535590171813965,
-0.23929406702518463,
-0.019851356744766235,
-0.02001538872718811,
0.03482759743928909,
0.19894254207611084,
0.016871685162186623,
0.2267221361398697,
0.23609717190265656,
-0.13169234991073608,
0.053828202188014984,
0.2121465802192688,
0.22227202355861664,
0.12123245745897293,
0.34049493074417114,
-0.38784730434417725,
-0.040847599506378174,
-0.3319381773471832,
-0.06046641245484352,
0.24386066198349,
-0.3466593623161316,
0.040750902146101,
0.06725363433361053,
0.08570725470781326,
-0.07632551342248917,
-0.2831718325614929,
0.7181068658828735,
-0.4838988184928894,
-0.2441074252128601,
-0.18671409785747528,
0.13321571052074432,
-0.11221455782651901,
0.09411266446113586,
-0.4224551320075989,
-0.031260181218385696,
-0.09045533090829849,
-0.09028749912977219,
-0.13804024457931519,
-0.2224532812833786,
0.12790071964263916,
-0.025649666786193848,
-0.11283265054225922,
-0.12165272235870361,
0.3253854513168335,
0.11823534220457077,
-0.2297561764717102,
-0.06030462682247162,
0.16264460980892181,
0.08888591080904007,
0.25073838233947754,
-0.08894266188144684,
0.09597554802894592,
0.3186889886856079,
0.5235215425491333,
0.07131926715373993,
0.152018740773201,
0.06571997702121735,
-0.21973061561584473,
-0.034274205565452576,
-0.10447295010089874,
0.07627756893634796,
0.06633028388023376,
0.18919409811496735,
0.16641655564308167,
-0.1354343444108963,
-0.12764838337898254,
0.05952480062842369,
-0.08991239964962006,
-0.09374314546585083,
0.5399532914161682,
-0.07341670244932175,
-0.26790621876716614,
-0.3223479092121124,
0.12038369476795197,
-0.5080350637435913,
0.01917613483965397,
0.416130393743515,
0.31607958674430847,
0.11908753961324692,
-0.4740583002567291,
0.07086428254842758,
-0.039555516093969345,
0.3334859609603882,
0.019819043576717377,
0.036532942205667496,
-0.2406848967075348,
0.09047074615955353,
-0.6870470643043518,
0.2286406010389328,
0.008280884474515915,
0.10386423766613007,
0.06607086956501007,
0.3264712989330292,
-0.14427059888839722,
0.15494728088378906,
-0.2070237547159195,
-0.08748875558376312,
-0.02016506716609001,
0.16669759154319763,
-0.23904721438884735,
-0.22155843675136566,
-0.37815040349960327,
0.1564939022064209,
0.061706773936748505,
-0.512126088142395,
0.08679692447185516,
-0.2959517240524292,
0.029035530984401703,
-0.11311215162277222,
-0.16265913844108582,
0.03513943776488304,
-0.09398290514945984,
0.48279714584350586,
0.056031279265880585,
0.4043293595314026,
0.1090320274233818,
-0.1398845613002777,
-0.07183599472045898,
-0.17036376893520355,
-0.1583562046289444,
0.39011186361312866,
0.03529644012451172,
0.3115001618862152,
-0.013625936582684517,
0.06695802509784698,
-0.4052659273147583,
0.23640041053295135,
0.02301354706287384,
-0.1279177963733673,
-0.0627651959657669,
-0.1101919412612915,
-0.13219891488552094,
0.021562179550528526,
-0.050138115882873535,
0.07952088862657547,
-0.01918962597846985,
0.276186466217041,
-0.34405672550201416,
-0.046714551746845245,
0.5400158166885376,
-0.37721896171569824,
-0.2842176854610443,
-0.09521002322435379,
0.3152949810028076,
0.006188228726387024,
-0.24570319056510925,
-0.46099385619163513,
0.18909171223640442,
0.3097382187843323,
-0.1667710244655609,
-0.13262948393821716,
0.28970974683761597,
-0.16852569580078125,
0.16677077114582062,
-0.16726987063884735,
0.18417075276374817,
-0.2169225811958313,
0.00668603740632534,
0.04326922819018364,
-0.16396068036556244
] |
https://github.com/huggingface/datasets/issues/664 | load_dataset from local squad.py, raise error: TypeError: 'NoneType' object is not callable | It happened when try to change the old project which use 'nlp' to new project which use 'datasets'. You should check you old 'my_squad.py' file, change the inherit class from `nlp.xxx` to `datasets.xxx`. Otherwise datasets - load.py - import_main_class() `if inspect.isclass(obj) and issubclass(obj, main_cls_type):` can not find the main_cls. |
version: 1.0.2
```
train_dataset = datasets.load_dataset('squad')
```
The above code can works. However, when I download the squad.py from your server, and saved as `my_squad.py` to local. I run followings raise errors.
```
train_dataset = datasets.load_dataset('./my_squad.py')
```
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-28-25a84b4d1581> in <module>
----> 1 train_dataset = nlp.load_dataset('./my_squad.py')
/opt/conda/lib/python3.7/site-packages/datasets/load.py in load_dataset(path, name, data_dir, data_files, split, cache_dir, features, download_config, download_mode, ignore_verifications, save_infos, script_version, **config_kwargs)
602 hash=hash,
603 features=features,
--> 604 **config_kwargs,
605 )
606
TypeError: 'NoneType' object is not callable
| 49 | load_dataset from local squad.py, raise error: TypeError: 'NoneType' object is not callable
version: 1.0.2
```
train_dataset = datasets.load_dataset('squad')
```
The above code can works. However, when I download the squad.py from your server, and saved as `my_squad.py` to local. I run followings raise errors.
```
train_dataset = datasets.load_dataset('./my_squad.py')
```
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-28-25a84b4d1581> in <module>
----> 1 train_dataset = nlp.load_dataset('./my_squad.py')
/opt/conda/lib/python3.7/site-packages/datasets/load.py in load_dataset(path, name, data_dir, data_files, split, cache_dir, features, download_config, download_mode, ignore_verifications, save_infos, script_version, **config_kwargs)
602 hash=hash,
603 features=features,
--> 604 **config_kwargs,
605 )
606
TypeError: 'NoneType' object is not callable
It happened when try to change the old project which use 'nlp' to new project which use 'datasets'. You should check you old 'my_squad.py' file, change the inherit class from `nlp.xxx` to `datasets.xxx`. Otherwise datasets - load.py - import_main_class() `if inspect.isclass(obj) and issubclass(obj, main_cls_type):` can not find the main_cls. | [
-0.13541154563426971,
0.23297595977783203,
0.11986011266708374,
0.20221759378910065,
0.27362075448036194,
-0.14289337396621704,
0.49727490544319153,
0.3231872022151947,
-0.1525464504957199,
-0.004757590591907501,
-0.2818792760372162,
0.48221853375434875,
-0.0662124827504158,
-0.024013159796595573,
0.2310996949672699,
-0.0464758425951004,
-0.08047757297754288,
0.2212357223033905,
-0.26846563816070557,
-0.22536149621009827,
-0.34554749727249146,
-0.0011470131576061249,
-0.1135677844285965,
0.43576580286026,
-0.2292756885290146,
-0.08050919324159622,
0.02890038676559925,
0.37239909172058105,
-0.16015027463436127,
-0.4512943923473358,
0.4958183765411377,
-0.20437602698802948,
0.41664355993270874,
0.554680585861206,
-0.00011628262291196734,
0.16104204952716827,
0.1892334520816803,
-0.07878978550434113,
-0.3571132719516754,
-0.41139692068099976,
-0.054492004215717316,
-0.3366669714450836,
0.4511792063713074,
-0.46369537711143494,
-0.00987221859395504,
0.09296377748250961,
0.0925673171877861,
-0.20709362626075745,
0.4713388681411743,
0.5780324935913086,
0.16397297382354736,
0.46557044982910156,
-0.0415828675031662,
-0.009318368509411812,
0.0717635303735733,
0.20331667363643646,
-0.08315782248973846,
0.4402509033679962,
0.02418922632932663,
-0.121099092066288,
0.32984068989753723,
-0.014263087883591652,
-0.27658337354660034,
-0.0957668274641037,
0.2223285436630249,
0.06360945105552673,
0.03367923945188522,
-0.2932875454425812,
-0.030406847596168518,
0.036550235003232956,
0.31811589002609253,
-0.44923558831214905,
-0.44898808002471924,
-0.01386275514960289,
0.23027290403842926,
-0.12463583052158356,
0.0725116953253746,
-0.02211393229663372,
-0.02022833563387394,
0.1248222291469574,
-0.25937435030937195,
-0.11575797200202942,
-0.35022881627082825,
0.24445922672748566,
0.11761529743671417,
0.16357529163360596,
-0.03514523431658745,
0.3033766746520996,
-0.11791525781154633,
0.0044317469000816345,
0.21157006919384003,
-0.002069380134344101,
0.18672271072864532,
0.24897195398807526,
-0.20534063875675201,
-0.18042871356010437,
-0.008408874273300171,
-0.31322669982910156,
-0.031115105375647545,
0.08699357509613037,
0.14757689833641052,
0.025107620283961296,
0.017070647329092026,
0.38291046023368835,
0.18728187680244446,
0.17340166866779327,
0.46155864000320435,
0.3178766369819641,
0.2726162075996399,
0.06177781894803047,
-0.2784543037414551,
0.12053076177835464,
-0.39745232462882996,
-0.0996059700846672,
0.14154145121574402,
0.21077001094818115,
0.6745833158493042,
-0.249709814786911,
-0.09141263365745544,
-0.18648749589920044,
-0.07247629016637802,
-0.013248823583126068,
0.22595195472240448,
0.23587164282798767,
-0.03946299105882645,
0.3999706208705902,
0.0621209442615509,
0.24455364048480988,
-0.25605306029319763,
-0.3632083535194397,
-0.05669740214943886,
-0.09886860847473145,
-0.1313498169183731,
0.03926025331020355,
0.2707597315311432,
-0.0012120269238948822,
0.10353181511163712,
-0.07999390363693237,
-0.12399017810821533,
0.06434032320976257,
0.23261788487434387,
-0.3461400270462036,
-0.14148250222206116,
0.03828967362642288,
0.009994734078645706,
0.07546862959861755,
0.31225645542144775,
-0.4406474232673645,
-0.18773415684700012,
0.1325562298297882,
-0.32803598046302795,
-0.3822612464427948,
-0.28488850593566895,
0.09632633626461029,
-0.02071988768875599,
-0.1586911529302597,
-0.08666054159402847,
-0.12647977471351624,
0.2265569269657135,
-0.36698439717292786,
-0.04754657298326492,
-0.2871828079223633,
-0.0973692536354065,
-0.23319563269615173,
0.0014172177761793137,
0.6451674699783325,
-0.4643937647342682,
-0.27762359380722046,
0.005278856959193945,
-0.22824063897132874,
0.1847255825996399,
0.12767717242240906,
-0.383865088224411,
0.07688278704881668,
-0.013194341212511063,
-0.15605951845645905,
0.7974955439567566,
-0.6673081517219543,
-0.28189319372177124,
0.35428422689437866,
-0.1870710253715515,
-0.2659098505973816,
-0.014651648700237274,
-0.0009330445318482816,
0.3211832642555237,
0.10798392444849014,
0.24349048733711243,
0.5570948719978333,
0.08800376206636429,
0.004103990271687508,
-0.233333021402359,
-0.2864217758178711,
0.0937936082482338,
0.0797313004732132,
0.04170311987400055,
0.439080148935318,
0.15505890548229218,
0.12757644057273865,
0.0014603212475776672,
-0.15630674362182617,
0.09557254612445831,
0.0634491890668869,
0.4712246358394623,
0.07196266949176788,
-0.2056616097688675,
-0.2624318301677704,
-0.6318314075469971,
0.058277420699596405,
-0.489211767911911,
0.27128541469573975,
-0.11617137491703033,
-0.11650779843330383,
-0.2783092260360718,
-0.08244194835424423,
-0.2544826567173004,
0.14666084945201874,
0.047027043998241425,
0.2122058868408203,
-0.0014892667531967163,
-0.03625556454062462,
-0.2131616324186325,
0.0651778131723404,
-0.2413802146911621,
0.2377796471118927,
-0.18318499624729156,
0.2627405524253845,
-0.08739937096834183,
-0.23245365917682648,
-0.01672600768506527,
0.1912136971950531,
0.41043969988822937,
-0.16803601384162903,
-0.1764424741268158,
0.31315386295318604,
-0.22655300796031952,
-0.008651375770568848,
0.19587847590446472,
-0.3353462815284729,
0.08892473578453064,
-0.17099955677986145,
0.2699974775314331,
-0.028602421283721924,
0.1897386610507965,
0.011258907616138458,
-0.0585906058549881,
0.45811736583709717,
0.11951524019241333,
0.25163954496383667,
0.03224412351846695,
-0.09304855763912201,
0.11718779802322388,
-0.08534906804561615,
-0.16373895108699799,
-0.08513184636831284,
-0.29358333349227905,
0.3643883466720581,
0.45750483870506287,
0.17216043174266815,
-0.15594524145126343,
-0.10274814814329147,
0.6393775939941406,
-0.0934198796749115,
0.17578232288360596,
0.15460893511772156,
-0.16234159469604492,
-0.04976050183176994,
0.11174456775188446,
0.1338701993227005,
0.587179958820343,
0.08112109452486038,
-0.12965518236160278,
0.029302287846803665,
-0.14498412609100342,
0.037161946296691895,
0.04253316670656204,
-0.06846506893634796,
0.33452731370925903,
0.15887799859046936,
0.25473979115486145,
0.0893218144774437,
-0.31065139174461365,
-0.03871849924325943,
0.10054897516965866,
0.1950019896030426,
-0.25843751430511475,
0.33594608306884766,
-0.2614968717098236,
-0.05795744061470032,
-0.569320797920227,
0.030017457902431488,
-0.3510337471961975,
-0.1079668328166008,
-0.32389748096466064,
0.1313166618347168,
0.2754429578781128,
0.27486035227775574,
-0.01656327396631241,
-0.0646207183599472,
0.02635704167187214,
-0.5099318623542786,
0.22815784811973572,
-0.08440345525741577,
-0.39801493287086487,
-0.09398406744003296,
0.4084725081920624,
0.028758803382515907,
0.1881868541240692,
-0.2039782702922821,
-0.11047139763832092,
0.03312001749873161,
-0.10481838881969452,
0.01848440244793892,
0.22017304599285126,
0.2177957445383072,
-0.04312919080257416,
0.30947965383529663,
-0.1553775519132614,
-0.20278385281562805,
0.48673325777053833,
-0.34461483359336853,
-0.09334971010684967,
0.06435445696115494,
-0.36311569809913635,
0.10494419932365417,
-0.14569270610809326,
-0.7276368737220764,
-0.6275147199630737,
-0.2628311514854431,
0.24215389788150787,
0.2620699107646942,
0.28712907433509827,
0.26857882738113403,
0.22321392595767975,
0.49402719736099243,
0.08080461621284485,
0.17765232920646667,
-0.02087284065783024,
-0.32066768407821655,
0.2025018185377121,
-0.11772835999727249,
-0.19787296652793884,
0.0015175789594650269,
-0.05207699537277222,
0.19552642107009888,
-0.15946723520755768,
-0.14034497737884521,
-0.17689745128154755,
0.15027962625026703,
0.2909514307975769,
-0.06144856661558151,
0.05049699917435646,
0.4215656518936157,
0.0979638546705246,
-0.004085591062903404,
0.02805224061012268,
-0.2793058753013611,
0.027420639991760254,
0.39093804359436035,
0.12419363856315613,
0.21288108825683594,
0.4563586413860321,
-0.2658317983150482,
0.7054882645606995,
-0.06412142515182495,
-0.23989175260066986,
0.42331522703170776,
-0.12233751267194748,
0.23941300809383392,
-0.2846912145614624,
-0.4842720925807953,
0.09686296433210373,
0.007197201251983643,
0.049618661403656006,
-0.011443309485912323,
-0.09937576204538345,
-0.30617210268974304,
-0.2879026234149933,
-0.1688707172870636,
-0.38403239846229553,
-0.15896053612232208,
0.05705663561820984,
0.16978073120117188,
0.06677121669054031,
0.15500026941299438,
0.012534424662590027,
-0.3924722373485565,
0.012911731377243996,
-0.1754385530948639,
0.23735593259334564,
-0.10555774718523026,
0.09189324080944061,
-0.8413458466529846,
-0.07308853417634964,
-0.11165644973516464,
0.3323695659637451,
0.028761645779013634,
0.4508025348186493,
-0.020309869199991226,
-0.07467278838157654,
0.03561079874634743,
0.006192079745233059,
0.26324141025543213,
0.15396365523338318,
-0.09841965138912201,
0.395063191652298,
0.04458846151828766,
-0.38980135321617126,
-0.030233146622776985,
0.05628104880452156,
0.33509740233421326,
0.26191970705986023,
0.47140631079673767,
-0.17028993368148804,
-0.14636632800102234,
0.28803104162216187,
0.16794829070568085,
-0.19727110862731934,
0.07804074138402939,
-0.4350886344909668,
-0.17466667294502258,
-0.4432656466960907,
-0.029774248600006104,
-0.3884366750717163,
0.22457590699195862,
-0.1650504469871521,
-0.03160624951124191,
-0.0512847825884819,
0.15501537919044495,
0.06476418673992157,
0.1581781506538391,
0.20342931151390076,
0.11213096231222153,
-0.11078637838363647,
0.1410600244998932,
0.2987900376319885,
0.1393561065196991,
0.44938230514526367,
-0.15024295449256897,
-0.4060022830963135,
0.10361018776893616,
0.20798110961914062,
0.33989274501800537,
0.283307284116745,
0.09737721085548401,
-0.19709905982017517,
0.14165429770946503,
-0.08585406839847565,
0.16153353452682495,
0.002448149025440216,
0.2898419499397278,
-0.125642329454422,
-0.2721610963344574,
-0.49816417694091797,
0.3472234308719635,
-0.01349986158311367,
-0.0007211118936538696,
0.047880567610263824,
-0.23214282095432281,
-0.13591735064983368,
0.12943167984485626,
-0.07646647840738297,
1.0189130306243896,
-0.23664988577365875,
0.22722043097019196,
0.4061850607395172,
-0.049915775656700134,
0.5643478631973267,
-0.009418066591024399,
0.047176819294691086,
-0.4266599118709564,
0.19523513317108154,
0.06470716744661331,
-0.1686048060655594,
0.3550162613391876,
0.2636227607727051,
-0.29673635959625244,
0.38239678740501404,
-0.2543729543685913,
0.11444839835166931,
0.04505348950624466,
0.3691704571247101,
0.2650752365589142,
-0.21371902525424957,
-0.5628554821014404,
0.08580183237791061,
-0.30859148502349854,
0.35441872477531433,
-0.04095936566591263,
-0.23342685401439667,
-0.19903329014778137,
-0.1054411455988884,
0.14613504707813263,
0.1283929944038391,
-0.20886223018169403,
0.2940071225166321,
0.09974686801433563,
-0.25024649500846863,
-0.002954205498099327,
0.43477508425712585,
0.09459719806909561,
-0.061656299978494644,
-0.13286173343658447,
-0.09676937758922577,
0.019916146993637085,
0.10647846758365631,
-0.14349788427352905,
0.0648084208369255,
0.24392636120319366,
-0.07337736338376999,
-0.4011991024017334,
0.08232737332582474,
-0.04399752616882324,
-0.1573481559753418,
0.18879154324531555,
0.034125618636608124,
0.42535853385925293,
-0.4355708956718445,
-0.3533909320831299,
-0.048396170139312744,
0.07332855463027954,
-0.2084859013557434,
0.10244777798652649,
-0.13254202902317047,
-0.04769694060087204,
-0.08446814864873886,
0.15895962715148926,
-0.27897438406944275,
0.0359264574944973,
0.714699387550354,
0.20933258533477783,
0.14005745947360992,
0.5264490246772766,
-0.04900608956813812,
0.10263831913471222,
-0.24147042632102966,
0.49836522340774536,
-0.059794165194034576,
-0.34543678164482117,
-0.016035083681344986,
0.2934674918651581,
-0.17524194717407227,
-0.03922484815120697,
0.016944877803325653,
0.000576261430978775,
0.24705684185028076,
-0.11866381764411926,
-0.13356877863407135,
-0.41508734226226807,
0.17926695942878723,
0.18621623516082764,
-0.05673927441239357,
0.37512558698654175,
0.4403349459171295,
0.29669079184532166,
-0.11072608828544617,
-0.22742760181427002,
0.11904951930046082,
-0.33270692825317383,
0.18944180011749268,
0.16529347002506256,
-0.25763627886772156,
0.05329802259802818,
0.03355756402015686,
0.08684641867876053,
-0.06622608006000519,
0.03246054798364639,
-0.1703895628452301,
-0.19356012344360352,
0.18418341875076294,
0.16338276863098145,
-0.005541406571865082,
-0.16536076366901398,
-0.2547747492790222,
-0.05575704947113991,
0.028296584263443947,
-0.1752421259880066,
0.17586743831634521,
-0.02418694645166397,
0.3271876275539398,
0.02564842998981476,
0.1931116282939911,
0.04199376702308655,
0.21799592673778534,
-0.10928438603878021,
-0.006949476897716522,
-0.06288538873195648,
0.2167605310678482,
0.015966324135661125,
-0.053457312285900116,
-0.5466082692146301,
-0.10272104293107986,
0.1644965410232544,
0.3463962972164154,
0.06921885907649994,
-0.42698484659194946,
-0.10340467095375061,
0.053017210215330124,
-0.11955344676971436,
0.3888305723667145,
-0.1290796995162964,
0.04149729758501053,
0.10038390755653381,
0.09875251352787018,
-0.2382851094007492,
-0.13217739760875702,
0.4685731530189514,
-0.407520055770874,
-0.12829187512397766,
0.07408639788627625,
-0.20691874623298645,
0.05360107123851776,
0.05881378427147865,
-0.004031101241707802,
0.1316424012184143,
0.07850106805562973,
0.31927138566970825,
0.18672038614749908,
-0.035966500639915466,
-0.04252689704298973,
0.23325787484645844,
0.13654939830303192,
0.05349232628941536,
0.17733824253082275,
-0.3531416356563568,
-0.09282253682613373,
-0.34302130341529846,
0.14571045339107513,
0.2776843309402466,
-0.31693410873413086,
-0.015362236648797989,
0.06730460375547409,
0.02446630597114563,
-0.05484239012002945,
-0.24696233868598938,
0.775188148021698,
-0.4322023391723633,
-0.3938003480434418,
-0.004566416144371033,
0.23896118998527527,
-0.18179604411125183,
-0.02442135289311409,
-0.45649585127830505,
-0.04821309447288513,
0.00597226619720459,
-0.08954375982284546,
-0.2270386815071106,
-0.1992722600698471,
0.1921372413635254,
0.04114638268947601,
-0.166607066988945,
-0.15946702659130096,
0.17135414481163025,
0.1736435890197754,
-0.204736590385437,
0.016774337738752365,
0.29993200302124023,
0.11327525973320007,
0.21807821094989777,
-0.06441865861415863,
0.21343781054019928,
0.2466427981853485,
0.4532645344734192,
-0.00011034496128559113,
0.1085016131401062,
0.2124364674091339,
-0.19397905468940735,
0.029935643076896667,
-0.2111644595861435,
0.12400341033935547,
0.09157957136631012,
0.10523442924022675,
0.0921538919210434,
-0.10571900755167007,
-0.05183325335383415,
-0.126116544008255,
-0.11227761209011078,
-0.13709740340709686,
0.6239542961120605,
-0.10822930932044983,
-0.29542607069015503,
-0.185038760304451,
0.1738893985748291,
-0.5231868028640747,
0.13775011897087097,
0.4567699432373047,
0.31263822317123413,
0.15702590346336365,
-0.3407135605812073,
0.017802156507968903,
-0.12960883975028992,
0.3685934245586395,
-0.0496990941464901,
-0.005254969000816345,
-0.17887191474437714,
0.1182347983121872,
-0.6548084616661072,
0.28755372762680054,
0.056023970246315,
0.14918074011802673,
0.07990874350070953,
0.09775077551603317,
-0.15214687585830688,
0.11057274788618088,
-0.13467960059642792,
-0.11366352438926697,
0.16446691751480103,
-0.012347675859928131,
-0.33707791566848755,
-0.08828900754451752,
-0.24374999105930328,
0.1428171694278717,
0.14277403056621552,
-0.5289891958236694,
0.1137128695845604,
-0.178477942943573,
-0.076054647564888,
-0.09033077210187912,
-0.22505907714366913,
0.07651838660240173,
0.07742485404014587,
0.39021316170692444,
0.12824003398418427,
0.4732939600944519,
0.10376878827810287,
-0.21797937154769897,
0.24735110998153687,
-0.32923102378845215,
-0.09803134948015213,
0.44349589943885803,
0.03945521265268326,
0.3189324736595154,
-0.06659267842769623,
0.20706912875175476,
-0.3452315330505371,
0.25069060921669006,
-0.02762424200773239,
-0.15891700983047485,
-0.13071827590465546,
-0.18937449157238007,
0.013281948864459991,
-0.0669306293129921,
-0.09528003633022308,
0.16649001836776733,
0.12971103191375732,
0.20248231291770935,
-0.3556897044181824,
0.017870234325528145,
0.5928726196289062,
-0.31853461265563965,
-0.19260017573833466,
-0.03987807035446167,
0.2668410539627075,
0.015528466552495956,
-0.13211363554000854,
-0.41478824615478516,
0.12789368629455566,
0.4793131649494171,
-0.19441094994544983,
-0.11193601787090302,
0.19778671860694885,
-0.1374835968017578,
0.16446588933467865,
-0.14372679591178894,
0.08960264921188354,
-0.12099913507699966,
-0.051951274275779724,
0.1405801624059677,
-0.13768990337848663
] |
https://github.com/huggingface/datasets/issues/657 | Squad Metric Description & Feature Mismatch | Thanks for reporting !
There indeed a mismatch between the features and the kwargs description
I believe `answer_start` was added to match the squad dataset format for consistency, even though it is not used in the metric computation. I think I'd rather keep it this way, so that you can just give `references=squad["answers"]` to `.compute()`.
Maybe we can just fix the description then. | The [description](https://github.com/huggingface/datasets/blob/master/metrics/squad/squad.py#L39) doesn't mention `answer_start` in squad. However the `datasets.features` require [it](https://github.com/huggingface/datasets/blob/master/metrics/squad/squad.py#L68). It's also not used in the evaluation. | 63 | Squad Metric Description & Feature Mismatch
The [description](https://github.com/huggingface/datasets/blob/master/metrics/squad/squad.py#L39) doesn't mention `answer_start` in squad. However the `datasets.features` require [it](https://github.com/huggingface/datasets/blob/master/metrics/squad/squad.py#L68). It's also not used in the evaluation.
Thanks for reporting !
There indeed a mismatch between the features and the kwargs description
I believe `answer_start` was added to match the squad dataset format for consistency, even though it is not used in the metric computation. I think I'd rather keep it this way, so that you can just give `references=squad["answers"]` to `.compute()`.
Maybe we can just fix the description then. | [
0.03843475505709648,
-0.1900423765182495,
-0.05375976860523224,
-0.07253237068653107,
0.41921716928482056,
-0.042600151151418686,
0.10886429250240326,
0.07943778485059738,
-0.2159089744091034,
0.1062573790550232,
-0.181974858045578,
0.4140360355377197,
0.3362867832183838,
-0.060461558401584625,
0.10037831217050552,
0.15688687562942505,
0.04732838645577431,
0.083982452750206,
-0.01248660683631897,
-0.13994190096855164,
-0.14153152704238892,
0.2984048128128052,
-0.22523494064807892,
0.2715795934200287,
-0.27364981174468994,
-0.017892753705382347,
-0.05063531547784805,
0.16225159168243408,
-0.37464991211891174,
-0.5675832033157349,
0.26775696873664856,
0.030636699870228767,
-0.3266790211200714,
0.2287682592868805,
-0.0001090158402803354,
-0.14459329843521118,
0.2327793389558792,
-0.13778230547904968,
-0.17716699838638306,
-0.0342068076133728,
0.18004676699638367,
-0.3626689016819,
0.19188621640205383,
-0.41095778346061707,
-0.048721715807914734,
0.11483360826969147,
0.006360404193401337,
-0.054237447679042816,
0.38479578495025635,
0.12954650819301605,
0.22974184155464172,
0.4827031195163727,
0.01158091053366661,
-0.29391083121299744,
-0.0669136717915535,
-0.03566466271877289,
-0.10962501913309097,
0.20750316977500916,
0.295032799243927,
-0.18215312063694,
-0.2618215084075928,
0.23409321904182434,
0.04064022749662399,
0.04451027885079384,
0.4658946096897125,
0.048879265785217285,
0.25087687373161316,
-0.12956896424293518,
0.06295546144247055,
0.055778197944164276,
0.22743716835975647,
-0.20712187886238098,
-0.37988966703414917,
-0.10258512198925018,
0.05314658582210541,
-0.09194222837686539,
0.08725245296955109,
0.08281155675649643,
-0.17975470423698425,
-0.012323141098022461,
-0.3148844540119171,
0.1019585132598877,
-0.18910852074623108,
0.035803429782390594,
-0.0675043910741806,
0.33968332409858704,
-0.1549960970878601,
0.036152325570583344,
0.22650335729122162,
-0.07048831880092621,
-0.13317590951919556,
0.0341339148581028,
-0.07356111705303192,
0.28443828225135803,
-0.4198208451271057,
-0.15604588389396667,
0.2228899896144867,
-0.020036138594150543,
0.6190391182899475,
-0.04215071350336075,
0.1646750122308731,
0.02486393041908741,
0.3776244521141052,
0.17757785320281982,
0.07931694388389587,
0.49911126494407654,
0.5429849624633789,
-0.11498013138771057,
-0.0014039762318134308,
0.158189058303833,
-0.14008669555187225,
0.0006069876253604889,
0.09427490085363388,
-0.14679284393787384,
0.13624589145183563,
0.037965044379234314,
0.10921481251716614,
-0.14110615849494934,
-0.18797780573368073,
0.11407194286584854,
0.055667661130428314,
-0.08167412877082825,
0.018131917342543602,
0.3469873368740082,
-0.00546495895832777,
-0.060589566826820374,
-0.17108073830604553,
0.25349849462509155,
-0.018308274447917938,
0.1575537621974945,
-0.32580336928367615,
0.12191632390022278,
-0.2628064453601837,
0.04482673108577728,
-0.12854254245758057,
-0.12195909023284912,
0.47474583983421326,
-0.05012242868542671,
0.7316462993621826,
-0.3010174036026001,
-0.05865900218486786,
0.06366267800331116,
-0.039080165326595306,
-0.027419965714216232,
-0.0383254736661911,
0.06654315441846848,
0.32915446162223816,
-0.3137713670730591,
-0.052379243075847626,
-0.012810878455638885,
-0.26798734068870544,
-0.2070082724094391,
0.09716291725635529,
0.21693064272403717,
-0.5295920968055725,
0.08417484164237976,
0.019198328256607056,
0.32223474979400635,
0.0022984519600868225,
-0.03817976266145706,
-0.06785290688276291,
0.07855463027954102,
-0.4157375395298004,
-0.23736955225467682,
0.43495112657546997,
0.1600910723209381,
-0.07442974299192429,
-0.09361418336629868,
0.28633207082748413,
-0.09146900475025177,
-0.22943469882011414,
0.06238585710525513,
-0.0687924399971962,
0.09119957685470581,
-0.118932344019413,
0.22051401436328888,
0.4820016324520111,
-0.6493632197380066,
-0.30483919382095337,
0.011718986555933952,
-0.1494528204202652,
-0.13850079476833344,
-0.24316975474357605,
-0.02763507328927517,
0.2740223705768585,
0.17747056484222412,
0.06583455950021744,
0.05880181863903999,
0.2066638171672821,
-0.059947043657302856,
-0.37926486134529114,
-0.15848663449287415,
-0.009675435721874237,
-0.04949885979294777,
-0.08488231897354126,
0.13712182641029358,
0.06002720445394516,
0.1734498292207718,
0.05995742231607437,
0.035007085651159286,
-0.11967360228300095,
0.08978258073329926,
0.19239164888858795,
-0.18641497194766998,
0.14186421036720276,
-0.2624904215335846,
-0.3259228467941284,
0.23147204518318176,
-0.42197397351264954,
0.1186334565281868,
0.15110982954502106,
-0.3517676591873169,
-0.62822026014328,
0.2035231739282608,
-0.14919637143611908,
-0.20650842785835266,
0.20311859250068665,
-0.33126845955848694,
0.2791954278945923,
0.009360644966363907,
-0.1268215775489807,
-0.14569278061389923,
-0.2963275909423828,
0.07487679272890091,
0.06228524073958397,
0.0990389883518219,
-0.2384699434041977,
0.0805215835571289,
0.19409415125846863,
0.2733445465564728,
0.13195651769638062,
0.1275605410337448,
-0.12571334838867188,
0.44584420323371887,
0.009767808951437473,
0.19403274357318878,
0.29392579197883606,
0.04451964795589447,
-0.05088799446821213,
0.007126878947019577,
-0.030810045078396797,
0.21973931789398193,
0.0883624255657196,
-0.23235419392585754,
-0.3145398795604706,
0.4246508479118347,
-0.12249772250652313,
0.1658184826374054,
0.03430800139904022,
0.11276189237833023,
0.1513228416442871,
-0.023765215650200844,
-0.25451305508613586,
-0.0314413458108902,
0.006619848310947418,
-0.050197239965200424,
0.05426360294222832,
-0.0734681785106659,
-0.08026590943336487,
-0.08127111941576004,
0.6966172456741333,
0.011920284479856491,
0.06424279510974884,
0.17749905586242676,
-0.032926492393016815,
-0.2631053626537323,
-0.19261647760868073,
-0.4333091080188751,
0.34883496165275574,
0.19071198999881744,
0.07821114361286163,
0.023033451288938522,
-0.04344979301095009,
-0.023894263431429863,
0.053415123373270035,
0.1939953714609146,
-0.010323431342840195,
0.35425716638565063,
0.3989412486553192,
-0.1800173670053482,
-0.0387113094329834,
0.18868857622146606,
-0.22104884684085846,
0.07986681908369064,
-0.23873364925384521,
-0.0015481151640415192,
0.24075978994369507,
0.04064590483903885,
0.008851893246173859,
-0.12707163393497467,
-0.4600839614868164,
-0.41507306694984436,
0.36346620321273804,
0.026314057409763336,
0.2164815217256546,
0.34125563502311707,
0.21490487456321716,
0.19216744601726532,
0.1436503380537033,
0.01680564507842064,
0.12012813985347748,
-0.4616582691669464,
0.10719036310911179,
0.07020203769207001,
-0.16242684423923492,
0.10047297179698944,
0.2189999222755432,
-0.3725537657737732,
-0.029996953904628754,
-0.17795395851135254,
-0.4762519598007202,
0.1616974174976349,
-0.0275496244430542,
0.3890666365623474,
0.19123710691928864,
0.13600477576255798,
-0.49795693159103394,
-0.10729897767305374,
0.4114947021007538,
-0.3360349237918854,
-0.3585229814052582,
-0.10362115502357483,
0.054212361574172974,
-0.19299441576004028,
-0.23704470694065094,
-0.3711310029029846,
0.011339538730680943,
-0.4087287187576294,
0.387157142162323,
0.08038371801376343,
0.060145195573568344,
0.28981900215148926,
-0.0015503885224461555,
0.3929223418235779,
-0.12497073411941528,
-0.14589300751686096,
-0.4327928423881531,
-0.3826178014278412,
0.3666389286518097,
-0.08493147045373917,
-0.4884543716907501,
0.018998663872480392,
-0.11493559181690216,
-0.04526051506400108,
-0.3103397488594055,
-0.03520435467362404,
-1.1364413499832153,
0.17007967829704285,
0.12717805802822113,
-0.18136686086654663,
0.11921892315149307,
0.23682533204555511,
-0.5600418448448181,
-0.07883518189191818,
-0.3416192829608917,
-0.41135936975479126,
0.3146166205406189,
0.2838902175426483,
0.14135736227035522,
-0.25062498450279236,
0.21618357300758362,
0.12429462373256683,
0.8888479471206665,
0.23310601711273193,
0.16090263426303864,
-0.24263125658035278,
-0.1912286877632141,
0.1344810575246811,
0.0041367486119270325,
-0.39075613021850586,
0.18292692303657532,
-0.09793522953987122,
0.02404792234301567,
0.33769434690475464,
0.22049754858016968,
-0.03593670576810837,
-0.08841288089752197,
0.2805611789226532,
-0.17139580845832825,
-0.25176337361335754,
-0.21282413601875305,
0.23266708850860596,
0.10440151393413544,
0.10943463444709778,
0.24017411470413208,
-0.34198740124702454,
-0.1232592836022377,
-0.008246462792158127,
0.23201844096183777,
0.06512938439846039,
0.17796063423156738,
-0.7929941415786743,
-0.12334442138671875,
-0.14994153380393982,
0.22139596939086914,
0.27402111887931824,
-0.04382232949137688,
-0.0035352669656276703,
-0.07845692336559296,
0.12785619497299194,
-0.08859625458717346,
0.6530701518058777,
0.1421281099319458,
-0.09442056715488434,
0.16901437938213348,
0.17559128999710083,
-0.46836429834365845,
-0.13060811161994934,
-0.08842229843139648,
0.3365377187728882,
0.3961407244205475,
0.3704068958759308,
-0.4528733789920807,
-0.17982089519500732,
-0.08241262286901474,
-0.024838551878929138,
-0.12352745234966278,
0.007057896815240383,
-0.6551505327224731,
-0.2761807441711426,
-0.16532650589942932,
0.249529629945755,
0.12408293038606644,
0.0326756127178669,
0.1633639633655548,
0.028010640293359756,
0.30290964245796204,
0.10785958915948868,
0.11454504728317261,
0.49668270349502563,
0.33561021089553833,
0.02257613092660904,
-0.12467241287231445,
0.2346402108669281,
-0.08503836393356323,
-0.3230128884315491,
0.3395518660545349,
0.026983851566910744,
-0.11592820286750793,
0.01912534236907959,
-0.32660314440727234,
0.2890709340572357,
0.24163001775741577,
-0.1814803183078766,
0.09060467034578323,
-0.3929249346256256,
0.06736688315868378,
-0.18507236242294312,
0.042773451656103134,
0.4216826856136322,
0.07685655355453491,
-0.03986234962940216,
-0.11432769894599915,
0.41056835651397705,
-0.24016590416431427,
-0.15830600261688232,
-0.034450069069862366,
0.37068408727645874,
0.1414438784122467,
0.06017231196165085,
-0.010241732001304626,
1.020006537437439,
0.05213044211268425,
-0.15800823271274567,
0.2711504399776459,
-0.047281913459300995,
0.5198644995689392,
-0.1478835493326187,
0.2608552873134613,
-0.42598217725753784,
-0.13478726148605347,
0.08391400426626205,
-0.2199782133102417,
-0.09049109369516373,
0.10066371411085129,
-0.22068725526332855,
0.1749459207057953,
-0.1338857114315033,
0.4090330898761749,
-0.059633806347846985,
0.2469777762889862,
-0.03612422198057175,
-0.07392679154872894,
-0.42894256114959717,
0.23089849948883057,
-0.08637958765029907,
0.12107200920581818,
-0.05054198578000069,
-0.08396604657173157,
-0.2879820466041565,
-0.14695382118225098,
-0.193577840924263,
0.08095049858093262,
0.018884709104895592,
0.2164883017539978,
0.39568784832954407,
-0.25211095809936523,
0.08060097694396973,
0.4948325455188751,
0.3612062931060791,
-0.017902333289384842,
-0.1604379266500473,
0.1334342211484909,
-0.3254791796207428,
0.09686314314603806,
0.018893571570515633,
0.258301317691803,
0.0252777561545372,
-0.3979591131210327,
-0.18004700541496277,
0.050872594118118286,
0.021719571202993393,
-0.17886942625045776,
-0.301059365272522,
0.1531130075454712,
0.0394400991499424,
-0.29731521010398865,
-0.2082677185535431,
-0.0005502700805664062,
-0.04947793483734131,
-0.2583518922328949,
0.13204175233840942,
0.06723541021347046,
-0.23131783306598663,
0.3131326735019684,
0.3865985572338104,
-0.11130011826753616,
0.23712818324565887,
0.40639230608940125,
-0.2009037733078003,
-0.11789856106042862,
0.16097550094127655,
-0.1262587159872055,
-0.23193319141864777,
-0.2166244089603424,
-0.08835472166538239,
-0.2817944884300232,
-0.24367520213127136,
0.0997195765376091,
0.11000082641839981,
-0.15039008855819702,
-0.1758226752281189,
0.22638508677482605,
0.29880964756011963,
0.1472545862197876,
0.0732387900352478,
-0.3525339961051941,
-0.2241639643907547,
0.23532859981060028,
0.017750104889273643,
-0.1402798444032669,
0.012005046010017395,
0.31745555996894836,
0.09253405034542084,
0.3731617331504822,
-0.3981429934501648,
0.06570331007242203,
-0.3477117121219635,
0.15246345102787018,
0.01648310385644436,
-0.3082909882068634,
0.34138643741607666,
-0.06580236554145813,
0.06702164560556412,
0.06574687361717224,
-0.4848763346672058,
-0.22544953227043152,
-0.05606456100940704,
0.12896466255187988,
-0.12472530454397202,
0.2390371412038803,
0.2399480789899826,
0.17770853638648987,
-0.11011035740375519,
-0.12384088337421417,
0.10574781894683838,
0.201177716255188,
0.01972024515271187,
0.19398994743824005,
-0.29986312985420227,
0.3818896412849426,
0.1315319985151291,
-0.3277375102043152,
0.21662072837352753,
0.06560277938842773,
-0.12606441974639893,
0.07019434869289398,
-0.14836803078651428,
-0.06195744499564171,
0.1529889851808548,
0.2921738624572754,
0.12417368590831757,
0.15557271242141724,
0.19477340579032898,
0.06185877323150635,
0.03871683403849602,
0.010580619797110558,
0.14098110795021057,
0.15724091231822968,
-0.20076018571853638,
0.13958604633808136,
-0.2652696967124939,
0.20518840849399567,
-0.30299198627471924,
-0.1528887152671814,
0.48505300283432007,
-0.0681186243891716,
0.22126445174217224,
0.19867192208766937,
0.24530917406082153,
0.0994071364402771,
0.21999134123325348,
0.10792052000761032,
0.5991268157958984,
-0.06106889247894287,
0.059996817260980606,
-0.08682847023010254,
0.011827018111944199,
0.15569289028644562,
0.3291960656642914,
0.012881830334663391,
0.24645793437957764,
0.014765709638595581,
-0.03691016882658005,
0.35916900634765625,
-0.04787174612283707,
0.0404675155878067,
0.16425247490406036,
0.26094716787338257,
-0.26875248551368713,
0.06920301169157028,
0.125668466091156,
0.15830868482589722,
-0.07004678249359131,
0.7059488892555237,
-0.2635211944580078,
-0.049814313650131226,
-0.2375161200761795,
-0.12691442668437958,
-0.017710957676172256,
-0.09246675670146942,
-0.10099153220653534,
-0.2525005638599396,
0.015523232519626617,
-0.2578633725643158,
0.22520558536052704,
-0.14016634225845337,
0.23482799530029297,
-0.2815512418746948,
0.12799334526062012,
0.11616267263889313,
0.0049282256513834,
0.31267619132995605,
0.3076821565628052,
-0.05000404641032219,
0.0465308278799057,
0.16217389702796936,
0.3137163519859314,
0.2272777259349823,
0.44712814688682556,
0.3903553783893585,
0.05120476707816124,
-0.029213130474090576,
0.08330707252025604,
-0.0924871414899826,
-0.06919805705547333,
0.0647645816206932,
0.12322767078876495,
-0.0407954603433609,
-0.5604952573776245,
0.3493502140045166,
0.18571968376636505,
-0.24994774162769318,
0.08379911631345749,
-0.02172132208943367,
0.011481447145342827,
-0.08129990100860596,
0.1417374610900879,
-0.250515878200531,
-0.0043503157794475555,
-0.1979367583990097,
0.07368995249271393,
-0.16139855980873108,
0.05954756960272789,
-0.1602686494588852,
0.26968270540237427,
0.15017008781433105,
-0.2571900486946106,
0.14071114361286163,
0.04424291104078293,
0.18468835949897766,
0.24146416783332825,
-0.03274828940629959,
-0.023010484874248505,
0.027772322297096252,
-0.7008518576622009,
0.24372246861457825,
0.29138627648353577,
0.14461557567119598,
0.06401470303535461,
0.29499146342277527,
-0.17538923025131226,
0.2501957416534424,
0.04877638816833496,
-0.24128752946853638,
-0.07482225447893143,
-0.19626247882843018,
-0.47600096464157104,
0.02130819298326969,
-0.2091040462255478,
-0.05789817124605179,
0.19155895709991455,
0.03492183983325958,
-0.024318892508745193,
-0.22261610627174377,
0.05212606489658356,
0.09320087730884552,
0.029138699173927307,
-0.010578133165836334,
0.0017505958676338196,
-0.1912245750427246,
0.14089012145996094,
0.41106733679771423,
0.008581425994634628,
0.0723995640873909,
0.1618167757987976,
-0.32886630296707153,
-0.12041302025318146,
0.10130418837070465,
-0.015252035111188889,
0.2814256548881531,
0.025754446163773537,
-0.401380717754364,
-0.0533989816904068,
0.4772094786167145,
0.23399628698825836,
-0.34524714946746826,
-0.4014284610748291,
0.046357035636901855,
0.023744501173496246,
0.07742465287446976,
-0.026225898414850235,
0.4119681715965271,
-0.08338344097137451,
0.29361262917518616,
-0.17652887105941772,
-0.4193330705165863,
0.707258939743042,
-0.32689231634140015,
-0.34184473752975464,
0.019342396408319473,
0.39705175161361694,
0.34597107768058777,
-0.15929953753948212,
-0.6697816848754883,
-0.13791786134243011,
0.2949354946613312,
0.0028172023594379425,
-0.11229251325130463,
0.10815167427062988,
-0.4581032693386078,
-0.03936990723013878,
-0.03132585436105728,
-0.2585922181606293,
0.11693152040243149,
-0.11400335282087326,
0.1401877999305725,
-0.28124693036079407
] |
https://github.com/huggingface/datasets/issues/657 | Squad Metric Description & Feature Mismatch | But then providing the `answer_start` becomes mandatory since the format of the features is checked against the one provided in the squad [file](https://github.com/huggingface/datasets/pull/658/files). | The [description](https://github.com/huggingface/datasets/blob/master/metrics/squad/squad.py#L39) doesn't mention `answer_start` in squad. However the `datasets.features` require [it](https://github.com/huggingface/datasets/blob/master/metrics/squad/squad.py#L68). It's also not used in the evaluation. | 23 | Squad Metric Description & Feature Mismatch
The [description](https://github.com/huggingface/datasets/blob/master/metrics/squad/squad.py#L39) doesn't mention `answer_start` in squad. However the `datasets.features` require [it](https://github.com/huggingface/datasets/blob/master/metrics/squad/squad.py#L68). It's also not used in the evaluation.
But then providing the `answer_start` becomes mandatory since the format of the features is checked against the one provided in the squad [file](https://github.com/huggingface/datasets/pull/658/files). | [
0.07148385047912598,
-0.368669331073761,
-0.08562180399894714,
-0.09630407392978668,
0.40952473878860474,
-0.10431189835071564,
0.12534356117248535,
0.03956548124551773,
-0.28089192509651184,
0.01617187261581421,
-0.015553915873169899,
0.35087329149246216,
0.2142234891653061,
0.08771615475416183,
-0.12120310962200165,
0.1233920305967331,
0.02282767742872238,
0.11464257538318634,
-0.14615857601165771,
-0.07210764288902283,
-0.10576574504375458,
0.2958203852176666,
-0.31014055013656616,
0.13930299878120422,
-0.3326880931854248,
0.2032148391008377,
-0.032256100326776505,
0.20537659525871277,
-0.5319285988807678,
-0.48790833353996277,
0.30318182706832886,
0.07320518046617508,
-0.23465241491794586,
0.2549629509449005,
-0.00010877860040636733,
-0.15703533589839935,
0.19286057353019714,
-0.15020497143268585,
-0.0956224799156189,
-0.18650774657726288,
0.10024643689393997,
-0.30134809017181396,
0.2080405354499817,
-0.2634671926498413,
-0.12064653635025024,
0.12668566405773163,
-0.02587953768670559,
0.01581280678510666,
0.5856688022613525,
0.17736591398715973,
0.20964503288269043,
0.5279719829559326,
0.005136210471391678,
-0.2664540410041809,
-0.007929064333438873,
0.08325812965631485,
-0.12416757643222809,
0.24112339317798615,
0.3226965069770813,
-0.009124880656599998,
-0.2592713534832001,
0.21548190712928772,
0.18227286636829376,
0.0905657559633255,
0.4155045747756958,
0.011193268932402134,
0.17103248834609985,
-0.18925966322422028,
-0.11016330868005753,
0.07993429899215698,
0.21630257368087769,
-0.16200456023216248,
-0.23680207133293152,
-0.14090102910995483,
0.053300317376852036,
-0.14083565771579742,
0.20255208015441895,
0.059907227754592896,
-0.029472708702087402,
0.05763857066631317,
-0.25253474712371826,
0.061658721417188644,
-0.19256269931793213,
-0.05694422125816345,
-0.03841906040906906,
0.18458998203277588,
-0.21790552139282227,
-0.02238692343235016,
0.05886678397655487,
-0.07703088968992233,
-0.32858899235725403,
0.02757289633154869,
-0.003977637737989426,
0.15556611120700836,
-0.3463529050350189,
-0.24500039219856262,
0.14011535048484802,
-0.012089617550373077,
0.5897560119628906,
0.13071295619010925,
0.027830474078655243,
-0.0755566954612732,
0.19161666929721832,
0.09664006531238556,
0.06833411008119583,
0.35943174362182617,
0.5389781594276428,
-0.26014772057533264,
-0.04702866077423096,
0.09791348874568939,
-0.06022630259394646,
0.036229267716407776,
0.2225050926208496,
-0.1853068768978119,
0.11027142405509949,
-0.010552618652582169,
0.19733932614326477,
-0.18637700378894806,
-0.3243860900402069,
0.23624075949192047,
0.03313882648944855,
-0.1849231719970703,
0.16101564466953278,
0.3308873176574707,
0.03947240114212036,
-0.1160726472735405,
-0.1364458203315735,
0.3753705620765686,
-0.06154991686344147,
0.1788347214460373,
-0.2362852245569229,
0.01757768727838993,
-0.178505077958107,
0.017615804448723793,
0.077015221118927,
-0.09459200501441956,
0.46842604875564575,
0.10372685641050339,
0.6205453276634216,
-0.21397005021572113,
0.09008943289518356,
0.09077449142932892,
-0.008681848645210266,
-0.05883996561169624,
-0.038192588835954666,
0.0323757529258728,
0.31557729840278625,
-0.1487371027469635,
-0.03838445618748665,
-0.01218046247959137,
-0.3050559461116791,
-0.16850300133228302,
0.022898225113749504,
0.2471959888935089,
-0.4179116487503052,
0.1742907166481018,
0.18661002814769745,
0.15926194190979004,
-0.15781092643737793,
-0.01988825388252735,
0.0972556620836258,
-0.007158063352108002,
-0.21755294501781464,
-0.08710729330778122,
0.456559956073761,
0.31230247020721436,
-0.013883247971534729,
-0.18961553275585175,
0.49367526173591614,
-0.24226990342140198,
-0.35012805461883545,
0.17470604181289673,
-0.08727817982435226,
-0.06259749084711075,
-0.22548294067382812,
0.1653342843055725,
0.4319165349006653,
-0.6663406491279602,
-0.12114332616329193,
0.11779629439115524,
-0.40870702266693115,
-0.13483138382434845,
-0.16340026259422302,
-0.1139436811208725,
0.21576164662837982,
0.04142725095152855,
0.06478715687990189,
0.1040395051240921,
0.06288981437683105,
-0.08148710429668427,
-0.3227226138114929,
-0.09681407362222672,
-0.11054044961929321,
-0.03404507786035538,
-0.20245657861232758,
0.005068384110927582,
-0.03670857101678848,
0.26627317070961,
-0.03007759153842926,
0.14355111122131348,
-0.22138091921806335,
0.07600809633731842,
0.25797775387763977,
-0.28628265857696533,
0.07790827751159668,
-0.18388968706130981,
-0.3849327564239502,
0.07955573499202728,
-0.3601304888725281,
0.01633361726999283,
0.16351518034934998,
-0.2715013027191162,
-0.5420480370521545,
0.046952031552791595,
-0.1306709349155426,
-0.13014772534370422,
0.19640924036502838,
-0.29223164916038513,
0.19080325961112976,
-0.0649096816778183,
-0.20681053400039673,
0.05555520951747894,
-0.5343651175498962,
0.22050511837005615,
0.07472272217273712,
-0.03906969726085663,
-0.22121067345142365,
0.14890053868293762,
0.15440987050533295,
0.1852426677942276,
0.10269005596637726,
-0.04095247760415077,
-0.11151706427335739,
0.5497416257858276,
-0.09682118147611618,
0.15956240892410278,
0.2671710252761841,
-0.04583640396595001,
0.06073963642120361,
-0.12181049585342407,
-0.14073455333709717,
0.09952753782272339,
-0.07035928964614868,
-0.19787171483039856,
-0.3766762912273407,
0.4630091190338135,
-0.17003564536571503,
0.11723020672798157,
0.15489459037780762,
0.07903153449296951,
0.19189925491809845,
-0.11351719498634338,
-0.42259055376052856,
-0.21073685586452484,
0.15895774960517883,
0.06132318452000618,
0.05973956361413002,
0.06735578179359436,
-0.22341841459274292,
-0.06762132793664932,
0.766330361366272,
-0.01283305324614048,
0.016943946480751038,
0.16079670190811157,
0.06206744164228439,
-0.1778205931186676,
-0.1424492746591568,
-0.49260595440864563,
0.5218937993049622,
0.21191802620887756,
0.014999482780694962,
0.0737033262848854,
-0.15310055017471313,
-0.19208839535713196,
0.09158051013946533,
0.04983700066804886,
-0.09476979076862335,
0.25927668809890747,
0.20158472657203674,
-0.1314312219619751,
-0.06713023781776428,
0.09838196635246277,
-0.1724919080734253,
-0.11295893788337708,
-0.2569567561149597,
-0.125819593667984,
0.12757235765457153,
0.03171796351671219,
-0.1661219298839569,
-0.15063349902629852,
-0.30982881784439087,
-0.274574875831604,
0.3487705588340759,
-0.022336725145578384,
0.29358768463134766,
0.3687448501586914,
0.15835435688495636,
0.3362483084201813,
0.05445742607116699,
-0.1106504425406456,
0.1403377503156662,
-0.20517688989639282,
0.11163271963596344,
0.09819905459880829,
-0.11218304932117462,
0.08993489295244217,
0.22858643531799316,
-0.5091595649719238,
-0.013945337384939194,
-0.05052897334098816,
-0.47659075260162354,
0.2807791829109192,
-0.04546130448579788,
0.30854395031929016,
0.0962100476026535,
0.0719200074672699,
-0.3590722680091858,
0.018329277634620667,
0.3224570155143738,
-0.32356950640678406,
-0.32167473435401917,
-0.18649789690971375,
-0.01325142104178667,
-0.26891857385635376,
-0.36471226811408997,
-0.5461171865463257,
0.09523741155862808,
-0.2989223599433899,
0.37669849395751953,
0.14007551968097687,
-0.027344688773155212,
0.2844635546207428,
-0.014834712259471416,
0.34550637006759644,
-0.2718374729156494,
0.006416779011487961,
-0.39366161823272705,
-0.4697285294532776,
0.22687318921089172,
-0.13843123614788055,
-0.4657113254070282,
0.05883200094103813,
0.03300408646464348,
-0.03632709011435509,
-0.22949513792991638,
-0.05290501192212105,
-1.058634877204895,
0.04986106604337692,
0.12507666647434235,
-0.22153475880622864,
0.1816776692867279,
0.3187165856361389,
-0.5645018219947815,
-0.05417849123477936,
-0.3160337507724762,
-0.34213149547576904,
0.39886072278022766,
0.21404170989990234,
0.20970693230628967,
-0.3139365315437317,
0.31156525015830994,
0.13620682060718536,
0.9513809084892273,
0.2537687420845032,
0.16071361303329468,
-0.06731939315795898,
-0.06004653871059418,
0.36136388778686523,
-0.11130122095346451,
-0.2788298428058624,
0.30162256956100464,
0.07739367336034775,
0.19182540476322174,
0.31225723028182983,
0.19245058298110962,
0.20499370992183685,
-0.049421168863773346,
0.30525606870651245,
-0.14060533046722412,
-0.2224222719669342,
-0.25500017404556274,
0.2897501587867737,
0.05531846731901169,
0.10373355448246002,
0.18591171503067017,
-0.26070424914360046,
0.016889357939362526,
-0.02937980368733406,
0.43183034658432007,
0.2483835220336914,
0.1019391119480133,
-0.8079237341880798,
-0.11212454736232758,
-0.07660459727048874,
0.14635416865348816,
0.20551159977912903,
0.08524538576602936,
-0.014318685978651047,
-0.20518556237220764,
0.01762707531452179,
-0.05900932475924492,
0.5863503813743591,
0.35036036372184753,
-0.11953797936439514,
-0.03431772440671921,
0.2263384461402893,
-0.5820806622505188,
-0.16424396634101868,
-0.15852829813957214,
0.40970584750175476,
0.5023409128189087,
0.5473328828811646,
-0.4737730622291565,
-0.3406573235988617,
0.10709964483976364,
-0.15513859689235687,
-0.047514498233795166,
-0.032837770879268646,
-0.524474024772644,
-0.23692163825035095,
-0.2704085111618042,
0.26531386375427246,
0.17739978432655334,
-0.015745148062705994,
0.20894289016723633,
0.0026247315108776093,
0.3166657090187073,
-0.0421450212597847,
0.1978398561477661,
0.4141670763492584,
0.10202325880527496,
0.015005462802946568,
-0.04435459524393082,
0.03897993266582489,
-0.0707697719335556,
-0.3313656747341156,
0.3410164713859558,
-0.011207595467567444,
-0.09310843050479889,
0.17191532254219055,
-0.32926955819129944,
0.2612442374229431,
0.4037448763847351,
-0.1517471820116043,
0.15036417543888092,
-0.4624972641468048,
0.14318937063217163,
-0.21123486757278442,
0.11752798408269882,
0.4971185326576233,
0.058616891503334045,
-0.06269790977239609,
-0.006545341573655605,
0.2420922815799713,
-0.21785913407802582,
-0.060911353677511215,
-0.0005250237882137299,
0.41248029470443726,
0.18339186906814575,
0.09144283086061478,
-0.09821196645498276,
0.960006594657898,
0.12519031763076782,
-0.09172819554805756,
0.2422219216823578,
0.04187393933534622,
0.4939928352832794,
-0.02684851363301277,
0.24825648963451385,
-0.2694191634654999,
-0.2852005958557129,
0.11164931952953339,
-0.2703738510608673,
0.044056087732315063,
0.054432936012744904,
-0.21140718460083008,
0.1932343989610672,
-0.06835028529167175,
0.5172490477561951,
-0.05995480716228485,
0.3799263834953308,
-0.16935081779956818,
-0.03105233982205391,
-0.32962021231651306,
0.21612752974033356,
0.08241960406303406,
0.07197292149066925,
-0.086053766310215,
-0.05782704055309296,
-0.11770729720592499,
-0.30639874935150146,
-0.05242259055376053,
0.044731251895427704,
-0.04595901817083359,
0.021889638155698776,
0.4349376857280731,
-0.20405110716819763,
0.15549138188362122,
0.3100820481777191,
0.335857629776001,
0.04398198053240776,
-0.09029606729745865,
0.18627844750881195,
-0.18757832050323486,
0.03770717978477478,
0.001145032700151205,
0.20609857141971588,
0.1023438423871994,
-0.2707350254058838,
0.0024801641702651978,
-0.030949696898460388,
0.08291488140821457,
-0.180499866604805,
-0.2589588165283203,
0.0774732157588005,
-0.027488909661769867,
-0.31783348321914673,
-0.3131404221057892,
-0.0012584328651428223,
-0.1030946671962738,
-0.11174812912940979,
0.14071661233901978,
0.010770715773105621,
-0.10476399213075638,
0.24261900782585144,
0.3311523497104645,
-0.17368842661380768,
-0.0474306158721447,
0.26635095477104187,
-0.30805444717407227,
-0.05395292490720749,
0.18931612372398376,
-0.16409346461296082,
-0.07310573011636734,
-0.22503280639648438,
-0.04451760649681091,
-0.20473001897335052,
-0.26117029786109924,
-0.0439944788813591,
0.25914305448532104,
-0.18600770831108093,
-0.07652275264263153,
0.09503698348999023,
0.37090277671813965,
0.1623033732175827,
0.20812992751598358,
-0.3234917223453522,
-0.2744862139225006,
0.18545466661453247,
-0.1068592518568039,
-0.20315806567668915,
0.10210088640451431,
0.4163109064102173,
0.09862420707941055,
0.2295035570859909,
-0.4194537103176117,
0.11959373950958252,
-0.14902862906455994,
0.0883522480726242,
0.04530203342437744,
-0.3655311167240143,
0.3733588457107544,
-0.036669887602329254,
0.08409181982278824,
0.06562459468841553,
-0.490303635597229,
-0.2547086179256439,
-0.0756019800901413,
0.11206623166799545,
-0.04574200510978699,
0.029030675068497658,
0.08410796523094177,
0.01548701524734497,
-0.17263945937156677,
-0.08167198300361633,
0.05255473032593727,
0.2083195447921753,
0.10038989782333374,
0.057195063680410385,
-0.39769718050956726,
0.1715797334909439,
0.06654931604862213,
-0.3400271534919739,
0.21614427864551544,
0.09231849759817123,
-0.07060312479734421,
0.057120777666568756,
-0.30345776677131653,
-0.03673616424202919,
-0.0810493752360344,
0.3800121247768402,
0.156839057803154,
0.1931459605693817,
-0.01975860446691513,
0.07800956070423126,
0.03015880659222603,
-0.08852202445268631,
0.18161612749099731,
0.16555097699165344,
-0.2564045190811157,
0.11506529152393341,
-0.2157733142375946,
0.20282846689224243,
-0.1534431427717209,
-0.004939043428748846,
0.4422466456890106,
-0.04438449814915657,
0.2240917682647705,
0.3737490177154541,
0.21726620197296143,
0.19006961584091187,
0.3056747019290924,
0.2750157415866852,
0.45917412638664246,
0.09200736880302429,
0.08049818873405457,
-0.048211511224508286,
0.07658201456069946,
0.1516331434249878,
0.5011119246482849,
-0.024469129741191864,
0.3242197632789612,
-0.19245341420173645,
-0.09542646259069443,
0.33724445104599,
-0.21352994441986084,
0.1509518325328827,
0.16702885925769806,
0.11102044582366943,
-0.24992947280406952,
0.1986943632364273,
0.14734399318695068,
0.18802374601364136,
-0.046223968267440796,
0.8048351407051086,
-0.36502858996391296,
-0.19451439380645752,
-0.2721889913082123,
-0.14922554790973663,
-0.08657441288232803,
-0.13280817866325378,
-0.07129544019699097,
-0.2399507761001587,
-0.016819752752780914,
-0.15285079181194305,
0.07418542355298996,
-0.09172043204307556,
0.09130948781967163,
-0.18893708288669586,
-0.016214333474636078,
0.062175944447517395,
0.003081453964114189,
0.31482285261154175,
0.14819616079330444,
-0.015135280787944794,
0.11076467484235764,
0.024511761963367462,
0.23111964762210846,
0.37741854786872864,
0.47386717796325684,
0.2855057418346405,
0.11901448667049408,
0.1324755698442459,
0.00006221886724233627,
0.04215824976563454,
-0.14178580045700073,
0.05893944948911667,
0.07221784442663193,
-0.01586189866065979,
-0.4801880717277527,
0.27545908093452454,
0.24550846219062805,
-0.290088951587677,
0.17660772800445557,
0.051871806383132935,
-0.05133631452918053,
-0.26269304752349854,
0.0709405392408371,
-0.18394750356674194,
0.16742077469825745,
-0.22813034057617188,
0.086331307888031,
-0.3151620626449585,
0.012539383955299854,
-0.15034691989421844,
0.2780928313732147,
0.1792275309562683,
-0.22726239264011383,
0.12187212705612183,
0.049132127314805984,
0.021314077079296112,
0.2931472361087799,
-0.03754265606403351,
0.008920622989535332,
0.016721263527870178,
-0.7170854210853577,
0.1781844198703766,
0.3404879570007324,
0.3211585283279419,
0.11115378141403198,
0.3643414378166199,
-0.13215866684913635,
0.3216063976287842,
0.15011221170425415,
-0.22611699998378754,
-0.0753634050488472,
-0.2230733335018158,
-0.3450174927711487,
0.08895773440599442,
-0.06353959441184998,
0.03586191684007645,
0.14503510296344757,
0.05244751274585724,
0.07168138027191162,
-0.12672904133796692,
0.04146594554185867,
0.06836605072021484,
0.11596688628196716,
-0.005902159959077835,
-0.14777664840221405,
-0.07984980940818787,
0.1761416345834732,
0.3649194538593292,
-0.06576255708932877,
-0.013251347467303276,
0.2049597203731537,
-0.19809292256832123,
-0.19402357935905457,
-0.013613604009151459,
-0.06124533340334892,
0.3370964825153351,
-0.05159452557563782,
-0.43263399600982666,
-0.0818316712975502,
0.4637615382671356,
0.18932823836803436,
-0.46133121848106384,
-0.390794962644577,
0.20445090532302856,
-0.09799138456583023,
0.041125185787677765,
-0.10057644546031952,
0.5699027180671692,
-0.09650081396102905,
0.3637690842151642,
-0.23424279689788818,
-0.36058318614959717,
0.5602976083755493,
-0.25984272360801697,
-0.10111093521118164,
-0.021464236080646515,
0.41381099820137024,
0.38652533292770386,
-0.245656818151474,
-0.611287534236908,
-0.1607123613357544,
0.1788603812456131,
-0.003161374479532242,
-0.22958531975746155,
0.1471383273601532,
-0.3713882565498352,
-0.017742231488227844,
-0.06560030579566956,
-0.03276296705007553,
0.21917149424552917,
-0.23740170896053314,
0.1443992406129837,
-0.1633358895778656
] |
https://github.com/huggingface/datasets/issues/651 | Problem with JSON dataset format | Currently the `json` dataset doesn't support this format unfortunately.
However you could load it with
```python
from datasets import Dataset
import pandas as pd
df = pd.read_json("path_to_local.json", orient="index")
dataset = Dataset.from_pandas(df)
``` | I have a local json dataset with the following form.
{
'id01234': {'key1': value1, 'key2': value2, 'key3': value3},
'id01235': {'key1': value1, 'key2': value2, 'key3': value3},
.
.
.
'id09999': {'key1': value1, 'key2': value2, 'key3': value3}
}
Note that instead of a list of records it's basically a dictionary of key value pairs with the keys being the record_ids and the values being the corresponding record.
Reading this with json:
```
data = datasets.load('json', data_files='path_to_local.json')
```
Throws an error and asks me to chose a field. What's the right way to handle this? | 32 | Problem with JSON dataset format
I have a local json dataset with the following form.
{
'id01234': {'key1': value1, 'key2': value2, 'key3': value3},
'id01235': {'key1': value1, 'key2': value2, 'key3': value3},
.
.
.
'id09999': {'key1': value1, 'key2': value2, 'key3': value3}
}
Note that instead of a list of records it's basically a dictionary of key value pairs with the keys being the record_ids and the values being the corresponding record.
Reading this with json:
```
data = datasets.load('json', data_files='path_to_local.json')
```
Throws an error and asks me to chose a field. What's the right way to handle this?
Currently the `json` dataset doesn't support this format unfortunately.
However you could load it with
```python
from datasets import Dataset
import pandas as pd
df = pd.read_json("path_to_local.json", orient="index")
dataset = Dataset.from_pandas(df)
``` | [
0.14586959779262543,
0.1199864000082016,
-0.06581166386604309,
0.38023847341537476,
-0.09949307143688202,
0.2573181986808777,
0.2378648966550827,
0.45176005363464355,
0.45882678031921387,
-0.06212310492992401,
0.1368803083896637,
0.48565277457237244,
-0.1455083042383194,
0.2548019289970398,
-0.32021719217300415,
-0.14806683361530304,
0.09851613640785217,
0.2186024934053421,
0.27038535475730896,
-0.04702598229050636,
-0.43970242142677307,
-0.11534319818019867,
0.04895937442779541,
0.01905859261751175,
0.04828128218650818,
-0.2671147882938385,
-0.02607715129852295,
0.07178448140621185,
-0.16207416355609894,
-0.45817577838897705,
0.1564130038022995,
0.1291373372077942,
0.08289939165115356,
0.10497669130563736,
-0.00011298852768959478,
0.09564661979675293,
0.1844620406627655,
-0.0450863391160965,
-0.1903441846370697,
-0.2990056276321411,
-0.7772289514541626,
-0.1859281063079834,
0.3369084596633911,
-0.260332852602005,
-0.21339523792266846,
-0.8189464211463928,
-0.1771574765443802,
-0.5484946966171265,
0.34850865602493286,
0.05387451872229576,
0.17561423778533936,
-0.04570431634783745,
-0.11727023869752884,
0.22958898544311523,
-0.12424001842737198,
0.4465414881706238,
0.0052381400018930435,
0.2138412892818451,
0.15404143929481506,
0.22341138124465942,
0.17109879851341248,
-0.11150161921977997,
-0.271405965089798,
-0.10854868590831757,
0.37144652009010315,
-0.056857362389564514,
-0.046028606593608856,
0.06835860759019852,
0.025437427684664726,
0.20538151264190674,
0.7304258346557617,
-0.07660488039255142,
-0.4558510482311249,
-0.207788348197937,
-0.0709650069475174,
-0.051254965364933014,
0.04907631129026413,
0.14006583392620087,
-0.031733863055706024,
0.4423696994781494,
-0.16039308905601501,
-0.1668308824300766,
-0.09140074998140335,
0.46210914850234985,
-0.18488220870494843,
-0.015627481043338776,
-0.024264048784971237,
0.1310405731201172,
-0.04881803318858147,
-0.3260754942893982,
0.02861383929848671,
-0.4399694800376892,
0.1288776397705078,
0.06355787813663483,
-0.03376277908682823,
-0.21681250631809235,
-0.04169763624668121,
-0.33408263325691223,
0.2119554579257965,
-0.04817310720682144,
-0.007476854138076305,
0.11137747019529343,
-0.24219270050525665,
0.30402618646621704,
0.6694847941398621,
-0.24202008545398712,
0.4449410140514374,
0.02180526778101921,
0.04669824615120888,
-0.13065564632415771,
0.23541128635406494,
-0.06294809281826019,
-0.18227888643741608,
0.029254939407110214,
-0.22618599236011505,
-0.21800848841667175,
0.09425687044858932,
-0.1267886608839035,
-0.1877720206975937,
0.4639972150325775,
-0.49869048595428467,
0.038636837154626846,
0.07294117659330368,
0.16419997811317444,
-0.05915449932217598,
0.45816677808761597,
0.07391783595085144,
0.309589147567749,
0.291824609041214,
0.2605215609073639,
-0.0923481285572052,
0.051723405718803406,
0.2988285422325134,
-0.2001809924840927,
0.06855477392673492,
-0.0650402158498764,
0.2729403078556061,
0.11339279264211655,
-0.097633957862854,
-0.13521353900432587,
0.06043766438961029,
0.033962592482566833,
0.03365487977862358,
0.3438403904438019,
0.11555483937263489,
0.27289435267448425,
0.05871976166963577,
-0.7610891461372375,
-0.2815733551979065,
0.30701348185539246,
-0.12314694374799728,
-0.11965096741914749,
-0.2131773978471756,
0.1140165776014328,
-0.21453948318958282,
-0.16839127242565155,
-0.5135980844497681,
0.10993903875350952,
-0.035038597881793976,
0.0967564731836319,
-0.11460482329130173,
0.06827449798583984,
-0.09626419097185135,
-0.31193387508392334,
-0.07156766951084137,
0.21587467193603516,
-0.7670139670372009,
0.06247369945049286,
0.260425329208374,
0.14399826526641846,
-0.0009407028555870056,
0.3863135576248169,
-0.3122444450855255,
0.11306251585483551,
0.04665827006101608,
0.20998139679431915,
0.346383273601532,
-0.42406368255615234,
-0.18533268570899963,
0.6589515209197998,
0.13116402924060822,
0.05728866904973984,
0.18357309699058533,
0.06412623077630997,
0.08610701560974121,
-0.12496966123580933,
0.49131590127944946,
0.27823203802108765,
-0.13014543056488037,
0.13153310120105743,
-0.04132743179798126,
-0.29374995827674866,
0.38448500633239746,
0.1433083564043045,
-0.29871639609336853,
0.040085431188344955,
-0.06385289877653122,
0.18495680391788483,
0.10303351283073425,
-0.10274295508861542,
-0.034619107842445374,
0.25441986322402954,
0.13309220969676971,
-0.2291436344385147,
-0.09172143787145615,
0.16780295968055725,
-0.49313467741012573,
0.05831701308488846,
0.040798865258693695,
-0.2706650495529175,
-0.17323864996433258,
-0.229288250207901,
-0.2658456265926361,
-0.04484177380800247,
-0.3415184020996094,
0.375365674495697,
0.10296979546546936,
-0.13867923617362976,
-0.06136178597807884,
0.08323316276073456,
-0.18905490636825562,
-0.12876735627651215,
0.10517427325248718,
0.04856518283486366,
-0.3560822308063507,
0.23402537405490875,
0.08910614252090454,
0.1402282863855362,
0.1026289165019989,
0.09526055306196213,
0.1381034553050995,
-0.08163478970527649,
0.049051377922296524,
0.22232040762901306,
0.2931484878063202,
-0.06884177029132843,
0.07576093822717667,
0.19655261933803558,
0.2696463465690613,
0.2145307958126068,
-0.08054810017347336,
0.051745180040597916,
0.26693037152290344,
-0.1208435446023941,
-0.4998883306980133,
0.56246018409729,
-0.0740090161561966,
0.27541595697402954,
-0.24178668856620789,
0.13448815047740936,
0.5070400238037109,
0.1711893230676651,
-0.24481961131095886,
-0.26526594161987305,
-0.1872989535331726,
0.2555713951587677,
0.055000077933073044,
0.1753740757703781,
-0.5730940103530884,
0.08077821135520935,
0.3986862599849701,
-0.11621411144733429,
0.17856016755104065,
0.07740642875432968,
0.01831667497754097,
0.11023611575365067,
0.01665934920310974,
0.34692806005477905,
0.18404945731163025,
0.10198044031858444,
-0.17225009202957153,
-0.15937675535678864,
0.17047260701656342,
-0.12622696161270142,
-0.030276678502559662,
0.06290002912282944,
0.10214602947235107,
0.17328985035419464,
0.12940183281898499,
-0.264636367559433,
0.009744197130203247,
0.10829949378967285,
0.1709945797920227,
0.3211761713027954,
-0.18438728153705597,
0.21818386018276215,
-0.5527153611183167,
-0.16909947991371155,
-0.19156748056411743,
-0.3349091708660126,
0.005753876641392708,
-0.2660442292690277,
0.01434195414185524,
0.0908639058470726,
-0.19456882774829865,
0.01331290602684021,
0.012349344789981842,
0.07735045254230499,
-0.009309139102697372,
-0.42008981108665466,
-0.05779310688376427,
-0.17078693211078644,
-0.1814786195755005,
0.05587160214781761,
0.4747774600982666,
0.07128837704658508,
0.11242299526929855,
-0.16440363228321075,
-0.14231647551059723,
-0.05383662134408951,
0.11027590185403824,
0.10404390841722488,
-0.08334004878997803,
0.11460719257593155,
0.18965929746627808,
0.5317562818527222,
-0.3402482271194458,
-0.16362202167510986,
0.2713461220264435,
0.3887447118759155,
-0.1310291439294815,
0.03923288360238075,
0.13945603370666504,
0.05959310755133629,
0.07943005859851837,
-0.3075088560581207,
-0.17110493779182434,
-0.21679723262786865,
0.43569087982177734,
0.15936608612537384,
0.17105962336063385,
-0.008481555618345737,
0.11289766430854797,
-0.016431640833616257,
0.1447686105966568,
-0.14454764127731323,
-0.061472877860069275,
-0.3365548849105835,
0.3744824230670929,
-0.1530008316040039,
-0.37977689504623413,
0.07527719438076019,
-0.02515166811645031,
-0.030955027788877487,
-0.24017202854156494,
-0.09913484752178192,
-0.0014945492148399353,
0.04224446415901184,
0.06570073962211609,
0.016220783814787865,
-0.1312146931886673,
0.19239911437034607,
0.10649873316287994,
0.013934029266238213,
-0.0919715017080307,
-0.11255444586277008,
0.26916104555130005,
0.27328166365623474,
0.10711550712585449,
0.3044457733631134,
0.5737470984458923,
0.0091618113219738,
0.1929808408021927,
0.2185964584350586,
-0.06329032778739929,
0.08230715245008469,
-0.06310199201107025,
-0.008937697857618332,
-0.08128654211759567,
0.008339250460267067,
-0.25821441411972046,
0.023941516876220703,
-0.12837563455104828,
0.06361059844493866,
0.07804363965988159,
-0.11224568635225296,
-0.21322600543498993,
0.15029236674308777,
-0.46599477529525757,
-0.19256752729415894,
0.14236214756965637,
-0.2337082326412201,
-0.07032544165849686,
-0.21692970395088196,
-0.0009834766387939453,
0.10182061791419983,
0.036061372607946396,
-0.12837418913841248,
0.29312312602996826,
0.10162138938903809,
0.0939057394862175,
-0.41728276014328003,
-0.3083842396736145,
-0.42764097452163696,
0.13671642541885376,
0.11047933995723724,
0.7288773655891418,
-0.019555561244487762,
0.1968230903148651,
0.0636686310172081,
-0.024218158796429634,
0.595088541507721,
-0.10598819702863693,
0.09601664543151855,
0.15250743925571442,
0.10064586997032166,
-0.49925199151039124,
0.23103918135166168,
-0.08528552949428558,
0.32089412212371826,
-0.26901546120643616,
0.45167437195777893,
-0.40524736046791077,
-0.3435758650302887,
-0.19200186431407928,
0.24024565517902374,
-0.2700730860233307,
-0.21016405522823334,
-0.1921624392271042,
-0.2964920103549957,
-0.23805031180381775,
-0.2589570879936218,
0.2959806025028229,
0.15898087620735168,
0.3359682559967041,
-0.06910531222820282,
-0.11254851520061493,
-0.004072181880474091,
0.12937960028648376,
0.05579402670264244,
0.19939863681793213,
0.27293312549591064,
0.11315424740314484,
0.17934110760688782,
0.17266909778118134,
0.42474186420440674,
0.5462691783905029,
0.33341267704963684,
-0.1455203890800476,
-0.014333225786685944,
-0.2502032518386841,
0.24674925208091736,
-0.05596432089805603,
-0.012683533132076263,
-0.02024250477552414,
0.17803116142749786,
-0.27356255054473877,
-0.14630438387393951,
-0.15173287689685822,
0.3680627942085266,
-0.3114071488380432,
-0.35213083028793335,
-0.5186554193496704,
0.6033041477203369,
0.08412565290927887,
-0.012381620705127716,
0.02539968118071556,
0.2774886190891266,
-0.12279839813709259,
0.48105430603027344,
0.21790876984596252,
0.5684346556663513,
-0.3487240672111511,
0.02675212360918522,
0.19774633646011353,
-0.5146609544754028,
0.48306187987327576,
-0.21833832561969757,
-0.09679410606622696,
-0.3696780204772949,
0.3934250771999359,
-0.15482281148433685,
-0.037350621074438095,
0.37274396419525146,
0.4814712405204773,
-0.054715268313884735,
0.13615766167640686,
-0.3032665550708771,
-0.09465737640857697,
-0.1093672662973404,
0.2447790801525116,
0.10321471840143204,
-0.15915068984031677,
-0.45899394154548645,
0.08169441670179367,
-0.20378728210926056,
-0.2845907211303711,
0.02293730527162552,
-0.16842639446258545,
-0.34228378534317017,
-0.1301281750202179,
-0.1290246844291687,
-0.21742317080497742,
0.3331001102924347,
0.07945693284273148,
0.26414379477500916,
-0.2754000425338745,
0.13387247920036316,
0.25486573576927185,
0.06443437933921814,
0.1171613335609436,
-0.19342227280139923,
-0.20338623225688934,
-0.37930163741111755,
0.0770607739686966,
-0.049961335957050323,
0.011861947365105152,
0.11848253011703491,
0.0981207862496376,
-0.04150699824094772,
-0.10091500729322433,
-0.17325450479984283,
-0.14893382787704468,
-0.10108226537704468,
0.20715491473674774,
-0.12937425076961517,
-0.3121793568134308,
-0.5626692175865173,
-0.05512623488903046,
0.07297046482563019,
0.09018498659133911,
0.10777167975902557,
0.07975761592388153,
0.0778420940041542,
0.06463067978620529,
-0.008443702012300491,
0.0016055554151535034,
0.11393807828426361,
0.32337167859077454,
0.06683781743049622,
-0.039882510900497437,
0.31392839550971985,
0.13029611110687256,
-0.16493605077266693,
-0.131699800491333,
0.5236612558364868,
0.332233190536499,
0.25764819979667664,
-0.029817819595336914,
-0.19306409358978271,
-0.010491624474525452,
-0.2179306149482727,
0.31783944368362427,
-0.022367551922798157,
-0.1482020616531372,
0.24052588641643524,
-0.49403512477874756,
-0.21801698207855225,
0.29467612504959106,
0.23698635399341583,
0.013988785445690155,
0.15849405527114868,
0.06045554205775261,
-0.2530006468296051,
-0.22749263048171997,
-0.21280770003795624,
-0.07626268267631531,
-0.3122352361679077,
0.26958167552948,
-0.13622942566871643,
0.24585750699043274,
0.03529674932360649,
-0.24426281452178955,
0.13391847908496857,
-0.17402684688568115,
0.06464637070894241,
-0.20348745584487915,
-0.0977173000574112,
0.11483214795589447,
0.3019969165325165,
-0.14221139252185822,
-0.008598513901233673,
-0.2923329472541809,
-0.28439751267433167,
0.0394899919629097,
-0.138778954744339,
0.20765703916549683,
-0.06953504681587219,
0.44485801458358765,
0.051657550036907196,
0.019893474876880646,
0.07773406058549881,
-0.06768514215946198,
0.056082844734191895,
0.21443650126457214,
-0.05325964465737343,
0.06912720203399658,
0.10862962156534195,
-0.07383576780557632,
-0.27086952328681946,
0.1666850745677948,
-0.1808830052614212,
0.13744646310806274,
0.2203942835330963,
-0.4979730248451233,
0.41076725721359253,
0.47570496797561646,
0.3956713080406189,
0.46448883414268494,
-0.22309119999408722,
0.24628891050815582,
0.22140422463417053,
0.15310977399349213,
-0.020489029586315155,
-0.5072889924049377,
0.38487178087234497,
0.12897644937038422,
-0.07820713520050049,
0.2625134587287903,
0.06821966171264648,
-0.041361600160598755,
-0.35332876443862915,
-0.24045401811599731,
0.23586879670619965,
-0.03739781677722931,
-0.11413387954235077,
0.5161638855934143,
-0.05396008864045143,
-0.21244092285633087,
-0.06893958151340485,
0.5151495933532715,
0.2435203194618225,
0.2089928537607193,
0.207899808883667,
-0.06016049534082413,
0.41389691829681396,
0.05166551098227501,
-0.030179642140865326,
-0.41531771421432495,
0.414458692073822,
-0.0049179792404174805,
0.030782334506511688,
-0.017713680863380432,
0.4281781315803528,
0.1536104381084442,
0.07010196149349213,
-0.0016899374313652515,
0.20206010341644287,
-0.024591390043497086,
-0.050845950841903687,
-0.28868451714515686,
-0.3768409490585327,
-0.15840008854866028,
-0.05803782120347023,
-0.184988334774971,
-0.2045612633228302,
-0.3123614192008972,
-0.1415836215019226,
0.040495503693819046,
0.22433370351791382,
-0.33651354908943176,
0.47119399905204773,
-0.013673987239599228,
0.1332266628742218,
-0.2788592278957367,
0.05979375168681145,
0.11225271970033646,
-0.19887974858283997,
0.2645430564880371,
-0.05351191759109497,
-0.018886413425207138,
0.15892156958580017,
-0.1320631355047226,
0.03694514185190201,
-0.5998960733413696,
-0.1819777935743332,
-0.08550757169723511,
0.05560611933469772,
-0.09054826200008392,
-0.1600075513124466,
0.29666638374328613,
0.12643878161907196,
0.01646289974451065,
0.3209456503391266,
0.1543252021074295,
0.07163965702056885,
-0.09466950595378876,
-0.07172399014234543,
-0.17539240419864655,
-0.14421677589416504,
0.2563313841819763,
-0.1602596640586853,
-0.15904974937438965,
-0.4251285791397095,
0.161382794380188,
0.37980401515960693,
0.39135420322418213,
0.12063518166542053,
0.07768917828798294,
-0.17841900885105133,
0.37602904438972473,
0.07174300402402878,
0.04281847923994064,
0.030469879508018494,
0.1283906251192093,
-0.20762860774993896,
-0.11480792611837387,
-0.0716458112001419,
-0.2363211214542389,
0.4204460680484772,
0.10629938542842865,
0.288970410823822,
0.36432337760925293,
-0.23314838111400604,
0.45097991824150085,
-0.36368581652641296,
0.19108347594738007,
0.06987051665782928,
-0.46372735500335693,
0.11115846037864685,
0.19460783898830414,
-0.05518714711070061,
-0.0834939181804657,
0.2223048359155655,
0.1503240168094635,
0.07078436762094498,
-0.3576923608779907,
-0.0745876282453537,
-0.2778407037258148,
-0.16648003458976746,
-0.14178797602653503,
0.29652562737464905,
0.07311436533927917,
0.11395109444856644,
0.04235084354877472,
0.182649165391922,
-0.008529167622327805,
-0.1535203754901886,
0.45775580406188965,
-0.23299023509025574,
0.4298783838748932,
-0.20282050967216492,
0.18438918888568878,
-0.14105559885501862,
-0.2135642021894455,
-0.37158632278442383,
-0.1534889191389084,
-0.3980415165424347,
0.23725029826164246,
-0.19229638576507568,
0.005645199678838253,
-0.11541531980037689,
0.2940391004085541,
-0.1114014983177185,
0.3417704701423645,
-0.021854683756828308,
-0.015342770144343376,
0.2648358643054962,
-0.3608394265174866,
-0.16840557754039764,
0.4840179979801178,
-0.11433324217796326,
0.013391286134719849,
-0.12343528121709824,
-0.06479409337043762,
-0.012195795774459839,
0.3006782829761505,
-0.16690543293952942,
-0.11975753307342529,
-0.23897823691368103,
-0.0009339535608887672,
-0.10934503376483917,
-0.09569127857685089,
0.08294080197811127,
-0.07763504236936569,
0.018536018207669258,
-0.15877200663089752,
-0.23147936165332794
] |
https://github.com/huggingface/datasets/issues/650 | dummy data testing can't test datasets using `dl_manager.extract` in `_split_generators` | Hi :)
In your dummy data zip file you can just have `subset000.xz` as directories instead of compressed files.
Let me know if it helps | Hi, I recently want to add a dataset whose source data is like this
```
openwebtext.tar.xz
|__ openwebtext
|__subset000.xz
| |__ ....txt
| |__ ....txt
| ...
|__ subset001.xz
|
....
```
So I wrote `openwebtext.py` like this
```
def _split_generators(self, dl_manager):
dl_dir = dl_manager.download_and_extract(_URL)
owt_dir = os.path.join(dl_dir, 'openwebtext')
subset_xzs = [
os.path.join(owt_dir, file_name) for file_name in os.listdir(owt_dir) if file_name.endswith('xz') # filter out ...xz.lock
]
ex_dirs = dl_manager.extract(subset_xzs, num_proc=round(os.cpu_count()*0.75))
nested_txt_files = [
[
os.path.join(ex_dir,txt_file_name) for txt_file_name in os.listdir(ex_dir) if txt_file_name.endswith('txt')
] for ex_dir in ex_dirs
]
txt_files = chain(*nested_txt_files)
return [
datasets.SplitGenerator(
name=datasets.Split.TRAIN, gen_kwargs={"txt_files": txt_files}
),
]
```
All went good, I can load and use real openwebtext, except when I try to test with dummy data. The problem is `MockDownloadManager.extract` do nothing, so `ex_dirs = dl_manager.extract(subset_xzs)` won't decompress `subset_xxx.xz`s for me.
How should I do ? Or you can modify `MockDownloadManager` to make it like a real `DownloadManager` ? | 25 | dummy data testing can't test datasets using `dl_manager.extract` in `_split_generators`
Hi, I recently want to add a dataset whose source data is like this
```
openwebtext.tar.xz
|__ openwebtext
|__subset000.xz
| |__ ....txt
| |__ ....txt
| ...
|__ subset001.xz
|
....
```
So I wrote `openwebtext.py` like this
```
def _split_generators(self, dl_manager):
dl_dir = dl_manager.download_and_extract(_URL)
owt_dir = os.path.join(dl_dir, 'openwebtext')
subset_xzs = [
os.path.join(owt_dir, file_name) for file_name in os.listdir(owt_dir) if file_name.endswith('xz') # filter out ...xz.lock
]
ex_dirs = dl_manager.extract(subset_xzs, num_proc=round(os.cpu_count()*0.75))
nested_txt_files = [
[
os.path.join(ex_dir,txt_file_name) for txt_file_name in os.listdir(ex_dir) if txt_file_name.endswith('txt')
] for ex_dir in ex_dirs
]
txt_files = chain(*nested_txt_files)
return [
datasets.SplitGenerator(
name=datasets.Split.TRAIN, gen_kwargs={"txt_files": txt_files}
),
]
```
All went good, I can load and use real openwebtext, except when I try to test with dummy data. The problem is `MockDownloadManager.extract` do nothing, so `ex_dirs = dl_manager.extract(subset_xzs)` won't decompress `subset_xxx.xz`s for me.
How should I do ? Or you can modify `MockDownloadManager` to make it like a real `DownloadManager` ?
Hi :)
In your dummy data zip file you can just have `subset000.xz` as directories instead of compressed files.
Let me know if it helps | [
-0.27755504846572876,
0.053498342633247375,
0.013497132807970047,
0.3913991451263428,
-0.07236066460609436,
0.1356922686100006,
0.45223426818847656,
0.3349652886390686,
-0.0165996216237545,
0.08433191478252411,
-0.05750950425863266,
0.2236393839120865,
-0.16328419744968414,
-0.048292070627212524,
0.06415911763906479,
-0.19064989686012268,
-0.1669514775276184,
0.24371971189975739,
0.013464771211147308,
0.031177274882793427,
-0.2944733500480652,
0.0815390944480896,
-0.28349852561950684,
-0.09138602018356323,
-0.137154221534729,
0.01812685839831829,
-0.20956435799598694,
0.3072614371776581,
-0.24577437341213226,
-0.2825934588909149,
0.0010185744613409042,
0.018356086686253548,
0.04236169159412384,
0.5455901622772217,
-0.0001227711618412286,
0.13881920278072357,
0.3071187734603882,
-0.2575385868549347,
-0.3333342671394348,
-0.033770158886909485,
-0.25072532892227173,
-0.2780001759529114,
-0.1756441593170166,
0.02130281925201416,
-0.08408322185277939,
-0.22686389088630676,
-0.18545109033584595,
-0.26224657893180847,
0.3548205494880676,
0.2717152535915375,
0.09233203530311584,
0.6131175756454468,
-0.04158041626214981,
-0.1280229240655899,
0.2287498116493225,
-0.02640952169895172,
-0.18793712556362152,
0.2233155369758606,
-0.052986398339271545,
-0.02368001639842987,
0.08733680844306946,
-0.1019546389579773,
-0.0011846385896205902,
0.49504563212394714,
-0.3201797604560852,
0.11933857202529907,
0.15074685215950012,
-0.31897151470184326,
-0.046372190117836,
0.5505450367927551,
0.48023828864097595,
-0.13915911316871643,
-0.3204441964626312,
-0.23362088203430176,
-0.2743140459060669,
-0.1307140290737152,
0.07476502656936646,
0.2180379182100296,
-0.22924357652664185,
0.3225831985473633,
-0.029313642531633377,
-0.02882017381489277,
0.13852712512016296,
0.27053841948509216,
-0.28169798851013184,
0.3059700131416321,
-0.12361320853233337,
0.05023721978068352,
0.4046255946159363,
0.3228845000267029,
0.26717478036880493,
-0.2975228428840637,
-0.35196200013160706,
-0.06609265506267548,
-0.15843363106250763,
-0.20819108188152313,
-0.3658331036567688,
-0.4488222897052765,
0.15948891639709473,
0.3530181050300598,
-0.011457637883722782,
0.18241137266159058,
0.0564965195953846,
0.15329596400260925,
0.07903902232646942,
0.4907520115375519,
0.21765905618667603,
0.27142664790153503,
0.05277096852660179,
0.13929463922977448,
0.001677047461271286,
0.04832872375845909,
0.0824965089559555,
-0.35594016313552856,
-0.2401302605867386,
0.1764751374721527,
0.3213752508163452,
-0.1328306943178177,
-0.3999723494052887,
-0.18784865736961365,
-0.2729801535606384,
-0.25519853830337524,
-0.003033713437616825,
0.3480631411075592,
-0.05527379736304283,
0.15278689563274384,
0.1276450902223587,
0.4727516770362854,
-0.049808308482170105,
-0.596410870552063,
-0.16894951462745667,
0.07432277500629425,
-0.2225884646177292,
0.11390554159879684,
0.11822846531867981,
0.02194306254386902,
0.43730074167251587,
0.11585643142461777,
-0.11792516708374023,
-0.012244794517755508,
0.6474173665046692,
-0.012039722874760628,
0.4655233919620514,
0.14857415854930878,
0.1298145353794098,
-0.06888186931610107,
0.11000263690948486,
-0.14748509228229523,
-0.0640193372964859,
0.0963684618473053,
0.056153833866119385,
-0.1661677211523056,
0.001803046092391014,
0.04889358580112457,
-0.43058401346206665,
0.21518485248088837,
-0.002232469618320465,
0.10780929028987885,
-0.09367474168539047,
-0.012706829234957695,
-0.031016133725643158,
-0.04640187323093414,
-0.09328004717826843,
0.16582950949668884,
0.3068811893463135,
0.4303739666938782,
-0.2990069091320038,
0.18865343928337097,
-0.43575531244277954,
0.10578006505966187,
0.5174136757850647,
-0.08119378983974457,
-0.07922758162021637,
0.38941407203674316,
-0.28142791986465454,
0.10369051992893219,
0.42815399169921875,
-0.10707758367061615,
-0.13391827046871185,
0.3495471775531769,
-0.08564063906669617,
0.24677123129367828,
0.30352556705474854,
-0.3556998074054718,
-0.17408879101276398,
-0.04092016816139221,
-0.4010947644710541,
0.12161587923765182,
-0.022330062463879585,
-0.07523064315319061,
-0.31594422459602356,
-0.12163949012756348,
0.39321303367614746,
0.08532233536243439,
0.004344169050455093,
0.13148464262485504,
-0.09225771576166153,
0.11898163706064224,
0.21703296899795532,
-0.013368446379899979,
0.06386157125234604,
-0.0933699905872345,
-0.34158778190612793,
-0.3053728938102722,
-0.061341337859630585,
0.1441967487335205,
-0.21572428941726685,
0.38680899143218994,
-0.3383389711380005,
0.38136744499206543,
0.33052998781204224,
-0.09562987089157104,
-0.5658614635467529,
-0.0990951657295227,
-0.24026529490947723,
-0.3324825167655945,
0.03407059609889984,
0.301725834608078,
0.10296538472175598,
0.07476769387722015,
-0.00005652382969856262,
-0.2724881172180176,
0.3430291414260864,
0.13224650919437408,
-0.3578066825866699,
0.1702774316072464,
0.09351126104593277,
-0.10670684278011322,
-0.005165621638298035,
0.04385504871606827,
-0.13982409238815308,
-0.4835776090621948,
-0.19198673963546753,
0.20145678520202637,
0.2268776297569275,
-0.15148277580738068,
-0.11232488602399826,
-0.22810404002666473,
0.016749411821365356,
-0.14878156781196594,
0.08567855507135391,
0.4087575376033783,
0.054392606019973755,
-0.13916152715682983,
0.15770962834358215,
0.15115825831890106,
0.3081713318824768,
-0.048870719969272614,
-0.21569663286209106,
0.06147775799036026,
0.16610951721668243,
-0.3463019132614136,
0.2142067402601242,
-0.2726498246192932,
0.09132629632949829,
0.23509883880615234,
0.3804806172847748,
-0.04183980077505112,
0.2846015393733978,
0.03487887978553772,
0.28502747416496277,
-0.06712581217288971,
0.14398826658725739,
-0.05489848554134369,
-0.3179726302623749,
-0.12463157624006271,
0.25778019428253174,
0.25021791458129883,
0.5530327558517456,
-0.005169344134628773,
0.39022502303123474,
0.10676535964012146,
0.17987388372421265,
-0.13995030522346497,
0.3181185722351074,
0.0894177183508873,
-0.17373132705688477,
0.2202003300189972,
-0.2962658703327179,
-0.3673279583454132,
-0.1835872232913971,
0.27001357078552246,
0.3687213063240051,
0.39299318194389343,
-0.3055081367492676,
-0.10900819301605225,
-0.4188293218612671,
0.13964813947677612,
0.016662809997797012,
-0.2076057642698288,
-0.010196488350629807,
-0.12572674453258514,
-0.03105461597442627,
0.08214238286018372,
-0.2311614751815796,
0.07370593398809433,
0.15415282547473907,
0.10148660838603973,
-0.08274000883102417,
-0.017665309831500053,
-0.2265048772096634,
-0.09925620257854462,
-0.3669631779193878,
0.04975608363747597,
0.39647629857063293,
0.06288372725248337,
0.1707434207201004,
-0.2563389837741852,
-0.3311188220977783,
-0.04440920054912567,
-0.003823503851890564,
0.2833932042121887,
0.015330355614423752,
0.32752725481987,
0.26952046155929565,
0.05543297529220581,
0.36029934883117676,
-0.18510594964027405,
-0.07459788769483566,
-0.1926945000886917,
-0.1971706748008728,
0.13446755707263947,
0.15169043838977814,
0.13279904425144196,
-0.23246929049491882,
-0.5946475267410278,
-0.15092158317565918,
-0.25865083932876587,
0.010437928140163422,
0.08212409913539886,
-0.02982395887374878,
0.28400444984436035,
0.044970881193876266,
0.0342341847717762,
0.22166718542575836,
-0.2649141550064087,
-0.26092228293418884,
-0.3637111186981201,
0.28904035687446594,
-0.23346148431301117,
-0.26680344343185425,
0.016826104372739792,
-0.5399338603019714,
0.15518753230571747,
-0.21243923902511597,
-0.053714316338300705,
-0.0245189368724823,
0.1239686980843544,
-0.14193883538246155,
0.10302689671516418,
0.20291700959205627,
0.18788978457450867,
-0.045367754995822906,
0.03922167420387268,
-0.13728070259094238,
0.10339823365211487,
0.2979874908924103,
0.08681145310401917,
0.5367177128791809,
-0.1488341987133026,
0.17385146021842957,
0.03054722771048546,
0.2985990047454834,
0.035753022879362106,
0.015335418283939362,
0.24456645548343658,
-0.17976099252700806,
0.29224324226379395,
-0.10956764966249466,
-0.20952047407627106,
-0.30423569679260254,
0.012517273426055908,
0.03748341649770737,
0.28664839267730713,
-0.11375225335359573,
-0.052530840039253235,
-0.06076434999704361,
0.18782734870910645,
0.06760036945343018,
-0.2674081027507782,
0.0879296213388443,
-0.27740103006362915,
-0.19979527592658997,
0.036231935024261475,
0.2855173349380493,
-0.0677640289068222,
-0.2022215723991394,
0.09116052091121674,
-0.10124333202838898,
0.1115729957818985,
-0.2520762085914612,
-0.18028637766838074,
0.3822594881057739,
-0.5033355951309204,
0.4058060050010681,
0.01770552061498165,
0.2860855758190155,
0.3129202127456665,
-0.2308184802532196,
0.07826907932758331,
0.047727327793836594,
0.41598933935165405,
-0.35791218280792236,
0.15825337171554565,
0.44728824496269226,
-0.2505180239677429,
-0.042227596044540405,
-0.1235632598400116,
-0.2599177658557892,
-0.18909119069576263,
0.026363426819443703,
-0.35840868949890137,
-0.3673055171966553,
-0.23470555245876312,
0.17901435494422913,
0.17222709953784943,
-0.13158881664276123,
-0.09460442513227463,
-0.19542047381401062,
-0.14084699749946594,
-0.17394980788230896,
-0.25783103704452515,
-0.08319569379091263,
0.051124077290296555,
-0.25383487343788147,
-0.11262263357639313,
-0.021323611959815025,
-0.24223476648330688,
0.334498792886734,
0.3226645290851593,
0.1653527021408081,
-0.012119024060666561,
0.004892405122518539,
0.2595239281654358,
0.03211231529712677,
-0.00028358399868011475,
0.5156348943710327,
-0.18270409107208252,
-0.2526944875717163,
0.15328797698020935,
-0.16461804509162903,
0.380135178565979,
0.12217868864536285,
-0.03869835287332535,
0.08444742113351822,
-0.4061068892478943,
0.09178465604782104,
-0.31411734223365784,
0.5976011157035828,
0.31873762607574463,
-0.16188836097717285,
0.18393589556217194,
-0.286527544260025,
0.44003424048423767,
-0.11985565721988678,
-0.058653414249420166,
0.5181101560592651,
-0.43901175260543823,
-0.27257323265075684,
0.22926616668701172,
-0.10002192109823227,
0.6527178287506104,
0.15517982840538025,
-0.010355427861213684,
0.21163663268089294,
0.2181539386510849,
0.1894758641719818,
-0.25400030612945557,
0.062061015516519547,
-0.29331445693969727,
-0.2902557849884033,
0.11504694819450378,
-0.11877091228961945,
0.2748996913433075,
0.3439328670501709,
-0.3710970878601074,
0.23149682581424713,
-0.1662522256374359,
0.11616747081279755,
0.2451561987400055,
0.4671816825866699,
-0.21617688238620758,
0.016014590859413147,
-0.0778769925236702,
0.05205173045396805,
0.3815428614616394,
0.20019632577896118,
-0.027513667941093445,
-0.1653929054737091,
-0.2098921537399292,
-0.15881502628326416,
0.025439709424972534,
0.23438304662704468,
-0.41783931851387024,
-0.07265038043260574,
-0.040376413613557816,
-0.22043846547603607,
0.13767610490322113,
0.1729961633682251,
0.241877481341362,
0.053733013570308685,
-0.1271219551563263,
-0.1456124484539032,
-0.2578452229499817,
-0.04589204117655754,
0.19404444098472595,
0.06722337007522583,
0.14782197773456573,
0.03734714537858963,
-0.37429624795913696,
0.2848319709300995,
-0.17329519987106323,
-0.20975668728351593,
0.3150959610939026,
-0.1556827872991562,
0.16486388444900513,
-0.36360082030296326,
0.017421768978238106,
-0.06409361958503723,
-0.13632456958293915,
-0.07852636277675629,
0.053322143852710724,
0.05214579775929451,
-0.7080101370811462,
0.14134711027145386,
-0.271391898393631,
-0.3244529664516449,
-0.03938429430127144,
0.10668725520372391,
-0.2228567898273468,
0.4759727418422699,
0.41735830903053284,
-0.11632177233695984,
0.377733051776886,
-0.23466843366622925,
0.3289365768432617,
0.3370266854763031,
-0.16974009573459625,
0.6116287112236023,
-0.055521462112665176,
-0.38032662868499756,
0.10902068018913269,
0.35773274302482605,
0.2878514528274536,
-0.06371542066335678,
-0.2488832175731659,
-0.14060820639133453,
-0.150030255317688,
-0.15824583172798157,
0.1125161349773407,
0.39555272459983826,
-0.17766550183296204,
0.29586654901504517,
-0.17470254004001617,
0.3727816045284271,
-0.1949801743030548,
-0.0024365545250475407,
-0.18815378844738007,
0.12338002771139145,
-0.08576273918151855,
-0.1829473376274109,
0.24296778440475464,
-0.00495156180113554,
0.04999915510416031,
-0.05309181660413742,
-0.26029273867607117,
-0.17874881625175476,
-0.2944217324256897,
0.17440420389175415,
0.06579692661762238,
-0.2386597841978073,
0.14599144458770752,
0.054040998220443726,
-0.025801807641983032,
-0.12079782783985138,
0.17627660930156708,
-0.3385203182697296,
-0.010981537401676178,
0.252572238445282,
0.34275591373443604,
-0.006727874279022217,
-0.6286965012550354,
0.00993221253156662,
-0.27355432510375977,
0.2913060784339905,
-0.21935206651687622,
0.049105897545814514,
0.16068509221076965,
0.03289695084095001,
0.12784448266029358,
-0.20778781175613403,
0.13203305006027222,
-0.13347041606903076,
0.5864822268486023,
0.11926227807998657,
0.006347693502902985,
-0.0403594933450222,
0.22034764289855957,
0.38051313161849976,
0.09980417042970657,
0.07832088321447372,
0.13496530055999756,
0.08630072325468063,
-0.30461665987968445,
0.03166252002120018,
0.2106904834508896,
0.04893958196043968,
0.3257642090320587,
0.274530827999115,
0.2787441909313202,
0.01718863844871521,
-0.030475452542304993,
-0.19405606389045715,
0.21148893237113953,
0.2699236273765564,
0.1913391500711441,
0.7015009522438049,
-0.4936886131763458,
0.33378395438194275,
0.1052519902586937,
-0.2653428316116333,
0.2542865574359894,
-0.4790073037147522,
0.19292452931404114,
0.6058322787284851,
-0.3864370286464691,
0.07417985051870346,
-0.08014527708292007,
-0.21125443279743195,
0.20389410853385925,
0.19992968440055847,
0.2975570559501648,
0.2877904176712036,
0.02603384479880333,
0.36194929480552673,
-0.5504582524299622,
-0.07715670764446259,
-0.19184191524982452,
0.2061721682548523,
0.2919974625110626,
0.03849951550364494,
-0.0975593775510788,
0.009371146559715271,
-0.47083133459091187,
-0.23006531596183777,
0.2454041689634323,
-0.2955705523490906,
-0.22639772295951843,
-0.05194302648305893,
-0.011238045990467072,
0.34972673654556274,
-0.26972100138664246,
0.055360160768032074,
-0.08173144608736038,
-0.3166092336177826,
0.20978568494319916,
0.10952972620725632,
-0.08090206980705261,
0.19632266461849213,
0.49506646394729614,
0.2401910275220871,
0.022662945091724396,
-0.43914568424224854,
-0.36611488461494446,
0.1244545429944992,
0.04496090114116669,
-0.13863655924797058,
0.3397323191165924,
-0.3198177218437195,
-0.20740742981433868,
0.2640452980995178,
0.04141003638505936,
-0.08066372573375702,
-0.43988704681396484,
0.2591479420661926,
-0.40326616168022156,
-0.17697329819202423,
0.6636248230934143,
0.157911017537117,
0.009540267288684845,
0.029466234147548676,
-0.24004912376403809,
-0.09030213952064514,
0.04179275035858154,
0.1923098862171173,
-0.44230037927627563,
0.1097014918923378,
0.009878045879304409,
0.025805093348026276,
-0.2754497826099396,
0.47268763184547424,
-0.05480291321873665,
-0.030134208500385284,
-0.2771565318107605,
-0.16373933851718903,
-0.5738851428031921,
0.2634528875350952,
-0.05278920754790306,
-0.48653948307037354,
0.08103126287460327,
-0.11998356133699417,
0.37761056423187256,
0.17625567317008972,
-0.1693369597196579,
0.34869852662086487,
0.2776540219783783,
0.29125624895095825,
-0.36257854104042053,
-0.24387948215007782,
-0.2989763021469116,
0.030773334205150604,
-0.05003940314054489,
-0.4768277108669281,
0.08960913121700287,
-0.0004993081092834473,
-0.1357267200946808,
0.1987258791923523,
0.01933910697698593,
0.3844158947467804,
0.0003759711980819702,
0.27152252197265625,
0.08794374763965607,
0.45241984724998474,
-0.10058089345693588,
0.1148441806435585,
-0.03840957209467888,
0.2583160698413849,
-0.1768367886543274,
-0.08817707747220993,
0.21985305845737457,
0.25923651456832886,
0.007110996171832085,
0.29045096039772034,
-0.32018283009529114,
0.4042017161846161,
0.3185974955558777,
0.30754002928733826,
-0.556834876537323,
0.13012446463108063,
-0.22092923521995544,
-0.03402164950966835,
0.6548747420310974,
0.2844884693622589,
-0.3331449031829834,
0.11738015711307526,
-0.04902099445462227,
0.008213834837079048,
0.3080021142959595,
-0.13476510345935822,
-0.15683746337890625,
-0.22404752671718597,
0.06814762949943542,
-0.09667404741048813,
-0.1177389845252037,
-0.1457936316728592,
-0.15659472346305847,
0.1873215287923813,
-0.05106242746114731,
0.12154324352741241,
0.1973780393600464,
0.5144412517547607,
-0.00370948389172554,
0.008738260716199875,
0.28755703568458557,
0.23626068234443665,
-0.031984832137823105,
0.027049046009778976,
-0.1153377965092659
] |
https://github.com/huggingface/datasets/issues/650 | dummy data testing can't test datasets using `dl_manager.extract` in `_split_generators` | Thanks for your comment @lhoestq ,
Just for confirmation, changing dummy data like this won't make dummy test test the functionality to extract `subsetxxx.xz` but actually kind of circumvent it. But since we will test the real data so it is ok ? | Hi, I recently want to add a dataset whose source data is like this
```
openwebtext.tar.xz
|__ openwebtext
|__subset000.xz
| |__ ....txt
| |__ ....txt
| ...
|__ subset001.xz
|
....
```
So I wrote `openwebtext.py` like this
```
def _split_generators(self, dl_manager):
dl_dir = dl_manager.download_and_extract(_URL)
owt_dir = os.path.join(dl_dir, 'openwebtext')
subset_xzs = [
os.path.join(owt_dir, file_name) for file_name in os.listdir(owt_dir) if file_name.endswith('xz') # filter out ...xz.lock
]
ex_dirs = dl_manager.extract(subset_xzs, num_proc=round(os.cpu_count()*0.75))
nested_txt_files = [
[
os.path.join(ex_dir,txt_file_name) for txt_file_name in os.listdir(ex_dir) if txt_file_name.endswith('txt')
] for ex_dir in ex_dirs
]
txt_files = chain(*nested_txt_files)
return [
datasets.SplitGenerator(
name=datasets.Split.TRAIN, gen_kwargs={"txt_files": txt_files}
),
]
```
All went good, I can load and use real openwebtext, except when I try to test with dummy data. The problem is `MockDownloadManager.extract` do nothing, so `ex_dirs = dl_manager.extract(subset_xzs)` won't decompress `subset_xxx.xz`s for me.
How should I do ? Or you can modify `MockDownloadManager` to make it like a real `DownloadManager` ? | 43 | dummy data testing can't test datasets using `dl_manager.extract` in `_split_generators`
Hi, I recently want to add a dataset whose source data is like this
```
openwebtext.tar.xz
|__ openwebtext
|__subset000.xz
| |__ ....txt
| |__ ....txt
| ...
|__ subset001.xz
|
....
```
So I wrote `openwebtext.py` like this
```
def _split_generators(self, dl_manager):
dl_dir = dl_manager.download_and_extract(_URL)
owt_dir = os.path.join(dl_dir, 'openwebtext')
subset_xzs = [
os.path.join(owt_dir, file_name) for file_name in os.listdir(owt_dir) if file_name.endswith('xz') # filter out ...xz.lock
]
ex_dirs = dl_manager.extract(subset_xzs, num_proc=round(os.cpu_count()*0.75))
nested_txt_files = [
[
os.path.join(ex_dir,txt_file_name) for txt_file_name in os.listdir(ex_dir) if txt_file_name.endswith('txt')
] for ex_dir in ex_dirs
]
txt_files = chain(*nested_txt_files)
return [
datasets.SplitGenerator(
name=datasets.Split.TRAIN, gen_kwargs={"txt_files": txt_files}
),
]
```
All went good, I can load and use real openwebtext, except when I try to test with dummy data. The problem is `MockDownloadManager.extract` do nothing, so `ex_dirs = dl_manager.extract(subset_xzs)` won't decompress `subset_xxx.xz`s for me.
How should I do ? Or you can modify `MockDownloadManager` to make it like a real `DownloadManager` ?
Thanks for your comment @lhoestq ,
Just for confirmation, changing dummy data like this won't make dummy test test the functionality to extract `subsetxxx.xz` but actually kind of circumvent it. But since we will test the real data so it is ok ? | [
-0.27755504846572876,
0.053498342633247375,
0.013497132807970047,
0.3913991451263428,
-0.07236066460609436,
0.1356922686100006,
0.45223426818847656,
0.3349652886390686,
-0.0165996216237545,
0.08433191478252411,
-0.05750950425863266,
0.2236393839120865,
-0.16328419744968414,
-0.048292070627212524,
0.06415911763906479,
-0.19064989686012268,
-0.1669514775276184,
0.24371971189975739,
0.013464771211147308,
0.031177274882793427,
-0.2944733500480652,
0.0815390944480896,
-0.28349852561950684,
-0.09138602018356323,
-0.137154221534729,
0.01812685839831829,
-0.20956435799598694,
0.3072614371776581,
-0.24577437341213226,
-0.2825934588909149,
0.0010185744613409042,
0.018356086686253548,
0.04236169159412384,
0.5455901622772217,
-0.0001227711618412286,
0.13881920278072357,
0.3071187734603882,
-0.2575385868549347,
-0.3333342671394348,
-0.033770158886909485,
-0.25072532892227173,
-0.2780001759529114,
-0.1756441593170166,
0.02130281925201416,
-0.08408322185277939,
-0.22686389088630676,
-0.18545109033584595,
-0.26224657893180847,
0.3548205494880676,
0.2717152535915375,
0.09233203530311584,
0.6131175756454468,
-0.04158041626214981,
-0.1280229240655899,
0.2287498116493225,
-0.02640952169895172,
-0.18793712556362152,
0.2233155369758606,
-0.052986398339271545,
-0.02368001639842987,
0.08733680844306946,
-0.1019546389579773,
-0.0011846385896205902,
0.49504563212394714,
-0.3201797604560852,
0.11933857202529907,
0.15074685215950012,
-0.31897151470184326,
-0.046372190117836,
0.5505450367927551,
0.48023828864097595,
-0.13915911316871643,
-0.3204441964626312,
-0.23362088203430176,
-0.2743140459060669,
-0.1307140290737152,
0.07476502656936646,
0.2180379182100296,
-0.22924357652664185,
0.3225831985473633,
-0.029313642531633377,
-0.02882017381489277,
0.13852712512016296,
0.27053841948509216,
-0.28169798851013184,
0.3059700131416321,
-0.12361320853233337,
0.05023721978068352,
0.4046255946159363,
0.3228845000267029,
0.26717478036880493,
-0.2975228428840637,
-0.35196200013160706,
-0.06609265506267548,
-0.15843363106250763,
-0.20819108188152313,
-0.3658331036567688,
-0.4488222897052765,
0.15948891639709473,
0.3530181050300598,
-0.011457637883722782,
0.18241137266159058,
0.0564965195953846,
0.15329596400260925,
0.07903902232646942,
0.4907520115375519,
0.21765905618667603,
0.27142664790153503,
0.05277096852660179,
0.13929463922977448,
0.001677047461271286,
0.04832872375845909,
0.0824965089559555,
-0.35594016313552856,
-0.2401302605867386,
0.1764751374721527,
0.3213752508163452,
-0.1328306943178177,
-0.3999723494052887,
-0.18784865736961365,
-0.2729801535606384,
-0.25519853830337524,
-0.003033713437616825,
0.3480631411075592,
-0.05527379736304283,
0.15278689563274384,
0.1276450902223587,
0.4727516770362854,
-0.049808308482170105,
-0.596410870552063,
-0.16894951462745667,
0.07432277500629425,
-0.2225884646177292,
0.11390554159879684,
0.11822846531867981,
0.02194306254386902,
0.43730074167251587,
0.11585643142461777,
-0.11792516708374023,
-0.012244794517755508,
0.6474173665046692,
-0.012039722874760628,
0.4655233919620514,
0.14857415854930878,
0.1298145353794098,
-0.06888186931610107,
0.11000263690948486,
-0.14748509228229523,
-0.0640193372964859,
0.0963684618473053,
0.056153833866119385,
-0.1661677211523056,
0.001803046092391014,
0.04889358580112457,
-0.43058401346206665,
0.21518485248088837,
-0.002232469618320465,
0.10780929028987885,
-0.09367474168539047,
-0.012706829234957695,
-0.031016133725643158,
-0.04640187323093414,
-0.09328004717826843,
0.16582950949668884,
0.3068811893463135,
0.4303739666938782,
-0.2990069091320038,
0.18865343928337097,
-0.43575531244277954,
0.10578006505966187,
0.5174136757850647,
-0.08119378983974457,
-0.07922758162021637,
0.38941407203674316,
-0.28142791986465454,
0.10369051992893219,
0.42815399169921875,
-0.10707758367061615,
-0.13391827046871185,
0.3495471775531769,
-0.08564063906669617,
0.24677123129367828,
0.30352556705474854,
-0.3556998074054718,
-0.17408879101276398,
-0.04092016816139221,
-0.4010947644710541,
0.12161587923765182,
-0.022330062463879585,
-0.07523064315319061,
-0.31594422459602356,
-0.12163949012756348,
0.39321303367614746,
0.08532233536243439,
0.004344169050455093,
0.13148464262485504,
-0.09225771576166153,
0.11898163706064224,
0.21703296899795532,
-0.013368446379899979,
0.06386157125234604,
-0.0933699905872345,
-0.34158778190612793,
-0.3053728938102722,
-0.061341337859630585,
0.1441967487335205,
-0.21572428941726685,
0.38680899143218994,
-0.3383389711380005,
0.38136744499206543,
0.33052998781204224,
-0.09562987089157104,
-0.5658614635467529,
-0.0990951657295227,
-0.24026529490947723,
-0.3324825167655945,
0.03407059609889984,
0.301725834608078,
0.10296538472175598,
0.07476769387722015,
-0.00005652382969856262,
-0.2724881172180176,
0.3430291414260864,
0.13224650919437408,
-0.3578066825866699,
0.1702774316072464,
0.09351126104593277,
-0.10670684278011322,
-0.005165621638298035,
0.04385504871606827,
-0.13982409238815308,
-0.4835776090621948,
-0.19198673963546753,
0.20145678520202637,
0.2268776297569275,
-0.15148277580738068,
-0.11232488602399826,
-0.22810404002666473,
0.016749411821365356,
-0.14878156781196594,
0.08567855507135391,
0.4087575376033783,
0.054392606019973755,
-0.13916152715682983,
0.15770962834358215,
0.15115825831890106,
0.3081713318824768,
-0.048870719969272614,
-0.21569663286209106,
0.06147775799036026,
0.16610951721668243,
-0.3463019132614136,
0.2142067402601242,
-0.2726498246192932,
0.09132629632949829,
0.23509883880615234,
0.3804806172847748,
-0.04183980077505112,
0.2846015393733978,
0.03487887978553772,
0.28502747416496277,
-0.06712581217288971,
0.14398826658725739,
-0.05489848554134369,
-0.3179726302623749,
-0.12463157624006271,
0.25778019428253174,
0.25021791458129883,
0.5530327558517456,
-0.005169344134628773,
0.39022502303123474,
0.10676535964012146,
0.17987388372421265,
-0.13995030522346497,
0.3181185722351074,
0.0894177183508873,
-0.17373132705688477,
0.2202003300189972,
-0.2962658703327179,
-0.3673279583454132,
-0.1835872232913971,
0.27001357078552246,
0.3687213063240051,
0.39299318194389343,
-0.3055081367492676,
-0.10900819301605225,
-0.4188293218612671,
0.13964813947677612,
0.016662809997797012,
-0.2076057642698288,
-0.010196488350629807,
-0.12572674453258514,
-0.03105461597442627,
0.08214238286018372,
-0.2311614751815796,
0.07370593398809433,
0.15415282547473907,
0.10148660838603973,
-0.08274000883102417,
-0.017665309831500053,
-0.2265048772096634,
-0.09925620257854462,
-0.3669631779193878,
0.04975608363747597,
0.39647629857063293,
0.06288372725248337,
0.1707434207201004,
-0.2563389837741852,
-0.3311188220977783,
-0.04440920054912567,
-0.003823503851890564,
0.2833932042121887,
0.015330355614423752,
0.32752725481987,
0.26952046155929565,
0.05543297529220581,
0.36029934883117676,
-0.18510594964027405,
-0.07459788769483566,
-0.1926945000886917,
-0.1971706748008728,
0.13446755707263947,
0.15169043838977814,
0.13279904425144196,
-0.23246929049491882,
-0.5946475267410278,
-0.15092158317565918,
-0.25865083932876587,
0.010437928140163422,
0.08212409913539886,
-0.02982395887374878,
0.28400444984436035,
0.044970881193876266,
0.0342341847717762,
0.22166718542575836,
-0.2649141550064087,
-0.26092228293418884,
-0.3637111186981201,
0.28904035687446594,
-0.23346148431301117,
-0.26680344343185425,
0.016826104372739792,
-0.5399338603019714,
0.15518753230571747,
-0.21243923902511597,
-0.053714316338300705,
-0.0245189368724823,
0.1239686980843544,
-0.14193883538246155,
0.10302689671516418,
0.20291700959205627,
0.18788978457450867,
-0.045367754995822906,
0.03922167420387268,
-0.13728070259094238,
0.10339823365211487,
0.2979874908924103,
0.08681145310401917,
0.5367177128791809,
-0.1488341987133026,
0.17385146021842957,
0.03054722771048546,
0.2985990047454834,
0.035753022879362106,
0.015335418283939362,
0.24456645548343658,
-0.17976099252700806,
0.29224324226379395,
-0.10956764966249466,
-0.20952047407627106,
-0.30423569679260254,
0.012517273426055908,
0.03748341649770737,
0.28664839267730713,
-0.11375225335359573,
-0.052530840039253235,
-0.06076434999704361,
0.18782734870910645,
0.06760036945343018,
-0.2674081027507782,
0.0879296213388443,
-0.27740103006362915,
-0.19979527592658997,
0.036231935024261475,
0.2855173349380493,
-0.0677640289068222,
-0.2022215723991394,
0.09116052091121674,
-0.10124333202838898,
0.1115729957818985,
-0.2520762085914612,
-0.18028637766838074,
0.3822594881057739,
-0.5033355951309204,
0.4058060050010681,
0.01770552061498165,
0.2860855758190155,
0.3129202127456665,
-0.2308184802532196,
0.07826907932758331,
0.047727327793836594,
0.41598933935165405,
-0.35791218280792236,
0.15825337171554565,
0.44728824496269226,
-0.2505180239677429,
-0.042227596044540405,
-0.1235632598400116,
-0.2599177658557892,
-0.18909119069576263,
0.026363426819443703,
-0.35840868949890137,
-0.3673055171966553,
-0.23470555245876312,
0.17901435494422913,
0.17222709953784943,
-0.13158881664276123,
-0.09460442513227463,
-0.19542047381401062,
-0.14084699749946594,
-0.17394980788230896,
-0.25783103704452515,
-0.08319569379091263,
0.051124077290296555,
-0.25383487343788147,
-0.11262263357639313,
-0.021323611959815025,
-0.24223476648330688,
0.334498792886734,
0.3226645290851593,
0.1653527021408081,
-0.012119024060666561,
0.004892405122518539,
0.2595239281654358,
0.03211231529712677,
-0.00028358399868011475,
0.5156348943710327,
-0.18270409107208252,
-0.2526944875717163,
0.15328797698020935,
-0.16461804509162903,
0.380135178565979,
0.12217868864536285,
-0.03869835287332535,
0.08444742113351822,
-0.4061068892478943,
0.09178465604782104,
-0.31411734223365784,
0.5976011157035828,
0.31873762607574463,
-0.16188836097717285,
0.18393589556217194,
-0.286527544260025,
0.44003424048423767,
-0.11985565721988678,
-0.058653414249420166,
0.5181101560592651,
-0.43901175260543823,
-0.27257323265075684,
0.22926616668701172,
-0.10002192109823227,
0.6527178287506104,
0.15517982840538025,
-0.010355427861213684,
0.21163663268089294,
0.2181539386510849,
0.1894758641719818,
-0.25400030612945557,
0.062061015516519547,
-0.29331445693969727,
-0.2902557849884033,
0.11504694819450378,
-0.11877091228961945,
0.2748996913433075,
0.3439328670501709,
-0.3710970878601074,
0.23149682581424713,
-0.1662522256374359,
0.11616747081279755,
0.2451561987400055,
0.4671816825866699,
-0.21617688238620758,
0.016014590859413147,
-0.0778769925236702,
0.05205173045396805,
0.3815428614616394,
0.20019632577896118,
-0.027513667941093445,
-0.1653929054737091,
-0.2098921537399292,
-0.15881502628326416,
0.025439709424972534,
0.23438304662704468,
-0.41783931851387024,
-0.07265038043260574,
-0.040376413613557816,
-0.22043846547603607,
0.13767610490322113,
0.1729961633682251,
0.241877481341362,
0.053733013570308685,
-0.1271219551563263,
-0.1456124484539032,
-0.2578452229499817,
-0.04589204117655754,
0.19404444098472595,
0.06722337007522583,
0.14782197773456573,
0.03734714537858963,
-0.37429624795913696,
0.2848319709300995,
-0.17329519987106323,
-0.20975668728351593,
0.3150959610939026,
-0.1556827872991562,
0.16486388444900513,
-0.36360082030296326,
0.017421768978238106,
-0.06409361958503723,
-0.13632456958293915,
-0.07852636277675629,
0.053322143852710724,
0.05214579775929451,
-0.7080101370811462,
0.14134711027145386,
-0.271391898393631,
-0.3244529664516449,
-0.03938429430127144,
0.10668725520372391,
-0.2228567898273468,
0.4759727418422699,
0.41735830903053284,
-0.11632177233695984,
0.377733051776886,
-0.23466843366622925,
0.3289365768432617,
0.3370266854763031,
-0.16974009573459625,
0.6116287112236023,
-0.055521462112665176,
-0.38032662868499756,
0.10902068018913269,
0.35773274302482605,
0.2878514528274536,
-0.06371542066335678,
-0.2488832175731659,
-0.14060820639133453,
-0.150030255317688,
-0.15824583172798157,
0.1125161349773407,
0.39555272459983826,
-0.17766550183296204,
0.29586654901504517,
-0.17470254004001617,
0.3727816045284271,
-0.1949801743030548,
-0.0024365545250475407,
-0.18815378844738007,
0.12338002771139145,
-0.08576273918151855,
-0.1829473376274109,
0.24296778440475464,
-0.00495156180113554,
0.04999915510416031,
-0.05309181660413742,
-0.26029273867607117,
-0.17874881625175476,
-0.2944217324256897,
0.17440420389175415,
0.06579692661762238,
-0.2386597841978073,
0.14599144458770752,
0.054040998220443726,
-0.025801807641983032,
-0.12079782783985138,
0.17627660930156708,
-0.3385203182697296,
-0.010981537401676178,
0.252572238445282,
0.34275591373443604,
-0.006727874279022217,
-0.6286965012550354,
0.00993221253156662,
-0.27355432510375977,
0.2913060784339905,
-0.21935206651687622,
0.049105897545814514,
0.16068509221076965,
0.03289695084095001,
0.12784448266029358,
-0.20778781175613403,
0.13203305006027222,
-0.13347041606903076,
0.5864822268486023,
0.11926227807998657,
0.006347693502902985,
-0.0403594933450222,
0.22034764289855957,
0.38051313161849976,
0.09980417042970657,
0.07832088321447372,
0.13496530055999756,
0.08630072325468063,
-0.30461665987968445,
0.03166252002120018,
0.2106904834508896,
0.04893958196043968,
0.3257642090320587,
0.274530827999115,
0.2787441909313202,
0.01718863844871521,
-0.030475452542304993,
-0.19405606389045715,
0.21148893237113953,
0.2699236273765564,
0.1913391500711441,
0.7015009522438049,
-0.4936886131763458,
0.33378395438194275,
0.1052519902586937,
-0.2653428316116333,
0.2542865574359894,
-0.4790073037147522,
0.19292452931404114,
0.6058322787284851,
-0.3864370286464691,
0.07417985051870346,
-0.08014527708292007,
-0.21125443279743195,
0.20389410853385925,
0.19992968440055847,
0.2975570559501648,
0.2877904176712036,
0.02603384479880333,
0.36194929480552673,
-0.5504582524299622,
-0.07715670764446259,
-0.19184191524982452,
0.2061721682548523,
0.2919974625110626,
0.03849951550364494,
-0.0975593775510788,
0.009371146559715271,
-0.47083133459091187,
-0.23006531596183777,
0.2454041689634323,
-0.2955705523490906,
-0.22639772295951843,
-0.05194302648305893,
-0.011238045990467072,
0.34972673654556274,
-0.26972100138664246,
0.055360160768032074,
-0.08173144608736038,
-0.3166092336177826,
0.20978568494319916,
0.10952972620725632,
-0.08090206980705261,
0.19632266461849213,
0.49506646394729614,
0.2401910275220871,
0.022662945091724396,
-0.43914568424224854,
-0.36611488461494446,
0.1244545429944992,
0.04496090114116669,
-0.13863655924797058,
0.3397323191165924,
-0.3198177218437195,
-0.20740742981433868,
0.2640452980995178,
0.04141003638505936,
-0.08066372573375702,
-0.43988704681396484,
0.2591479420661926,
-0.40326616168022156,
-0.17697329819202423,
0.6636248230934143,
0.157911017537117,
0.009540267288684845,
0.029466234147548676,
-0.24004912376403809,
-0.09030213952064514,
0.04179275035858154,
0.1923098862171173,
-0.44230037927627563,
0.1097014918923378,
0.009878045879304409,
0.025805093348026276,
-0.2754497826099396,
0.47268763184547424,
-0.05480291321873665,
-0.030134208500385284,
-0.2771565318107605,
-0.16373933851718903,
-0.5738851428031921,
0.2634528875350952,
-0.05278920754790306,
-0.48653948307037354,
0.08103126287460327,
-0.11998356133699417,
0.37761056423187256,
0.17625567317008972,
-0.1693369597196579,
0.34869852662086487,
0.2776540219783783,
0.29125624895095825,
-0.36257854104042053,
-0.24387948215007782,
-0.2989763021469116,
0.030773334205150604,
-0.05003940314054489,
-0.4768277108669281,
0.08960913121700287,
-0.0004993081092834473,
-0.1357267200946808,
0.1987258791923523,
0.01933910697698593,
0.3844158947467804,
0.0003759711980819702,
0.27152252197265625,
0.08794374763965607,
0.45241984724998474,
-0.10058089345693588,
0.1148441806435585,
-0.03840957209467888,
0.2583160698413849,
-0.1768367886543274,
-0.08817707747220993,
0.21985305845737457,
0.25923651456832886,
0.007110996171832085,
0.29045096039772034,
-0.32018283009529114,
0.4042017161846161,
0.3185974955558777,
0.30754002928733826,
-0.556834876537323,
0.13012446463108063,
-0.22092923521995544,
-0.03402164950966835,
0.6548747420310974,
0.2844884693622589,
-0.3331449031829834,
0.11738015711307526,
-0.04902099445462227,
0.008213834837079048,
0.3080021142959595,
-0.13476510345935822,
-0.15683746337890625,
-0.22404752671718597,
0.06814762949943542,
-0.09667404741048813,
-0.1177389845252037,
-0.1457936316728592,
-0.15659472346305847,
0.1873215287923813,
-0.05106242746114731,
0.12154324352741241,
0.1973780393600464,
0.5144412517547607,
-0.00370948389172554,
0.008738260716199875,
0.28755703568458557,
0.23626068234443665,
-0.031984832137823105,
0.027049046009778976,
-0.1153377965092659
] |
https://github.com/huggingface/datasets/issues/650 | dummy data testing can't test datasets using `dl_manager.extract` in `_split_generators` | Yes it's fine for now. We plan to add a job for slow tests.
And at one point we'll also do another pass on the dummy data handling and consider extracting files. | Hi, I recently want to add a dataset whose source data is like this
```
openwebtext.tar.xz
|__ openwebtext
|__subset000.xz
| |__ ....txt
| |__ ....txt
| ...
|__ subset001.xz
|
....
```
So I wrote `openwebtext.py` like this
```
def _split_generators(self, dl_manager):
dl_dir = dl_manager.download_and_extract(_URL)
owt_dir = os.path.join(dl_dir, 'openwebtext')
subset_xzs = [
os.path.join(owt_dir, file_name) for file_name in os.listdir(owt_dir) if file_name.endswith('xz') # filter out ...xz.lock
]
ex_dirs = dl_manager.extract(subset_xzs, num_proc=round(os.cpu_count()*0.75))
nested_txt_files = [
[
os.path.join(ex_dir,txt_file_name) for txt_file_name in os.listdir(ex_dir) if txt_file_name.endswith('txt')
] for ex_dir in ex_dirs
]
txt_files = chain(*nested_txt_files)
return [
datasets.SplitGenerator(
name=datasets.Split.TRAIN, gen_kwargs={"txt_files": txt_files}
),
]
```
All went good, I can load and use real openwebtext, except when I try to test with dummy data. The problem is `MockDownloadManager.extract` do nothing, so `ex_dirs = dl_manager.extract(subset_xzs)` won't decompress `subset_xxx.xz`s for me.
How should I do ? Or you can modify `MockDownloadManager` to make it like a real `DownloadManager` ? | 32 | dummy data testing can't test datasets using `dl_manager.extract` in `_split_generators`
Hi, I recently want to add a dataset whose source data is like this
```
openwebtext.tar.xz
|__ openwebtext
|__subset000.xz
| |__ ....txt
| |__ ....txt
| ...
|__ subset001.xz
|
....
```
So I wrote `openwebtext.py` like this
```
def _split_generators(self, dl_manager):
dl_dir = dl_manager.download_and_extract(_URL)
owt_dir = os.path.join(dl_dir, 'openwebtext')
subset_xzs = [
os.path.join(owt_dir, file_name) for file_name in os.listdir(owt_dir) if file_name.endswith('xz') # filter out ...xz.lock
]
ex_dirs = dl_manager.extract(subset_xzs, num_proc=round(os.cpu_count()*0.75))
nested_txt_files = [
[
os.path.join(ex_dir,txt_file_name) for txt_file_name in os.listdir(ex_dir) if txt_file_name.endswith('txt')
] for ex_dir in ex_dirs
]
txt_files = chain(*nested_txt_files)
return [
datasets.SplitGenerator(
name=datasets.Split.TRAIN, gen_kwargs={"txt_files": txt_files}
),
]
```
All went good, I can load and use real openwebtext, except when I try to test with dummy data. The problem is `MockDownloadManager.extract` do nothing, so `ex_dirs = dl_manager.extract(subset_xzs)` won't decompress `subset_xxx.xz`s for me.
How should I do ? Or you can modify `MockDownloadManager` to make it like a real `DownloadManager` ?
Yes it's fine for now. We plan to add a job for slow tests.
And at one point we'll also do another pass on the dummy data handling and consider extracting files. | [
-0.27755504846572876,
0.053498342633247375,
0.013497132807970047,
0.3913991451263428,
-0.07236066460609436,
0.1356922686100006,
0.45223426818847656,
0.3349652886390686,
-0.0165996216237545,
0.08433191478252411,
-0.05750950425863266,
0.2236393839120865,
-0.16328419744968414,
-0.048292070627212524,
0.06415911763906479,
-0.19064989686012268,
-0.1669514775276184,
0.24371971189975739,
0.013464771211147308,
0.031177274882793427,
-0.2944733500480652,
0.0815390944480896,
-0.28349852561950684,
-0.09138602018356323,
-0.137154221534729,
0.01812685839831829,
-0.20956435799598694,
0.3072614371776581,
-0.24577437341213226,
-0.2825934588909149,
0.0010185744613409042,
0.018356086686253548,
0.04236169159412384,
0.5455901622772217,
-0.0001227711618412286,
0.13881920278072357,
0.3071187734603882,
-0.2575385868549347,
-0.3333342671394348,
-0.033770158886909485,
-0.25072532892227173,
-0.2780001759529114,
-0.1756441593170166,
0.02130281925201416,
-0.08408322185277939,
-0.22686389088630676,
-0.18545109033584595,
-0.26224657893180847,
0.3548205494880676,
0.2717152535915375,
0.09233203530311584,
0.6131175756454468,
-0.04158041626214981,
-0.1280229240655899,
0.2287498116493225,
-0.02640952169895172,
-0.18793712556362152,
0.2233155369758606,
-0.052986398339271545,
-0.02368001639842987,
0.08733680844306946,
-0.1019546389579773,
-0.0011846385896205902,
0.49504563212394714,
-0.3201797604560852,
0.11933857202529907,
0.15074685215950012,
-0.31897151470184326,
-0.046372190117836,
0.5505450367927551,
0.48023828864097595,
-0.13915911316871643,
-0.3204441964626312,
-0.23362088203430176,
-0.2743140459060669,
-0.1307140290737152,
0.07476502656936646,
0.2180379182100296,
-0.22924357652664185,
0.3225831985473633,
-0.029313642531633377,
-0.02882017381489277,
0.13852712512016296,
0.27053841948509216,
-0.28169798851013184,
0.3059700131416321,
-0.12361320853233337,
0.05023721978068352,
0.4046255946159363,
0.3228845000267029,
0.26717478036880493,
-0.2975228428840637,
-0.35196200013160706,
-0.06609265506267548,
-0.15843363106250763,
-0.20819108188152313,
-0.3658331036567688,
-0.4488222897052765,
0.15948891639709473,
0.3530181050300598,
-0.011457637883722782,
0.18241137266159058,
0.0564965195953846,
0.15329596400260925,
0.07903902232646942,
0.4907520115375519,
0.21765905618667603,
0.27142664790153503,
0.05277096852660179,
0.13929463922977448,
0.001677047461271286,
0.04832872375845909,
0.0824965089559555,
-0.35594016313552856,
-0.2401302605867386,
0.1764751374721527,
0.3213752508163452,
-0.1328306943178177,
-0.3999723494052887,
-0.18784865736961365,
-0.2729801535606384,
-0.25519853830337524,
-0.003033713437616825,
0.3480631411075592,
-0.05527379736304283,
0.15278689563274384,
0.1276450902223587,
0.4727516770362854,
-0.049808308482170105,
-0.596410870552063,
-0.16894951462745667,
0.07432277500629425,
-0.2225884646177292,
0.11390554159879684,
0.11822846531867981,
0.02194306254386902,
0.43730074167251587,
0.11585643142461777,
-0.11792516708374023,
-0.012244794517755508,
0.6474173665046692,
-0.012039722874760628,
0.4655233919620514,
0.14857415854930878,
0.1298145353794098,
-0.06888186931610107,
0.11000263690948486,
-0.14748509228229523,
-0.0640193372964859,
0.0963684618473053,
0.056153833866119385,
-0.1661677211523056,
0.001803046092391014,
0.04889358580112457,
-0.43058401346206665,
0.21518485248088837,
-0.002232469618320465,
0.10780929028987885,
-0.09367474168539047,
-0.012706829234957695,
-0.031016133725643158,
-0.04640187323093414,
-0.09328004717826843,
0.16582950949668884,
0.3068811893463135,
0.4303739666938782,
-0.2990069091320038,
0.18865343928337097,
-0.43575531244277954,
0.10578006505966187,
0.5174136757850647,
-0.08119378983974457,
-0.07922758162021637,
0.38941407203674316,
-0.28142791986465454,
0.10369051992893219,
0.42815399169921875,
-0.10707758367061615,
-0.13391827046871185,
0.3495471775531769,
-0.08564063906669617,
0.24677123129367828,
0.30352556705474854,
-0.3556998074054718,
-0.17408879101276398,
-0.04092016816139221,
-0.4010947644710541,
0.12161587923765182,
-0.022330062463879585,
-0.07523064315319061,
-0.31594422459602356,
-0.12163949012756348,
0.39321303367614746,
0.08532233536243439,
0.004344169050455093,
0.13148464262485504,
-0.09225771576166153,
0.11898163706064224,
0.21703296899795532,
-0.013368446379899979,
0.06386157125234604,
-0.0933699905872345,
-0.34158778190612793,
-0.3053728938102722,
-0.061341337859630585,
0.1441967487335205,
-0.21572428941726685,
0.38680899143218994,
-0.3383389711380005,
0.38136744499206543,
0.33052998781204224,
-0.09562987089157104,
-0.5658614635467529,
-0.0990951657295227,
-0.24026529490947723,
-0.3324825167655945,
0.03407059609889984,
0.301725834608078,
0.10296538472175598,
0.07476769387722015,
-0.00005652382969856262,
-0.2724881172180176,
0.3430291414260864,
0.13224650919437408,
-0.3578066825866699,
0.1702774316072464,
0.09351126104593277,
-0.10670684278011322,
-0.005165621638298035,
0.04385504871606827,
-0.13982409238815308,
-0.4835776090621948,
-0.19198673963546753,
0.20145678520202637,
0.2268776297569275,
-0.15148277580738068,
-0.11232488602399826,
-0.22810404002666473,
0.016749411821365356,
-0.14878156781196594,
0.08567855507135391,
0.4087575376033783,
0.054392606019973755,
-0.13916152715682983,
0.15770962834358215,
0.15115825831890106,
0.3081713318824768,
-0.048870719969272614,
-0.21569663286209106,
0.06147775799036026,
0.16610951721668243,
-0.3463019132614136,
0.2142067402601242,
-0.2726498246192932,
0.09132629632949829,
0.23509883880615234,
0.3804806172847748,
-0.04183980077505112,
0.2846015393733978,
0.03487887978553772,
0.28502747416496277,
-0.06712581217288971,
0.14398826658725739,
-0.05489848554134369,
-0.3179726302623749,
-0.12463157624006271,
0.25778019428253174,
0.25021791458129883,
0.5530327558517456,
-0.005169344134628773,
0.39022502303123474,
0.10676535964012146,
0.17987388372421265,
-0.13995030522346497,
0.3181185722351074,
0.0894177183508873,
-0.17373132705688477,
0.2202003300189972,
-0.2962658703327179,
-0.3673279583454132,
-0.1835872232913971,
0.27001357078552246,
0.3687213063240051,
0.39299318194389343,
-0.3055081367492676,
-0.10900819301605225,
-0.4188293218612671,
0.13964813947677612,
0.016662809997797012,
-0.2076057642698288,
-0.010196488350629807,
-0.12572674453258514,
-0.03105461597442627,
0.08214238286018372,
-0.2311614751815796,
0.07370593398809433,
0.15415282547473907,
0.10148660838603973,
-0.08274000883102417,
-0.017665309831500053,
-0.2265048772096634,
-0.09925620257854462,
-0.3669631779193878,
0.04975608363747597,
0.39647629857063293,
0.06288372725248337,
0.1707434207201004,
-0.2563389837741852,
-0.3311188220977783,
-0.04440920054912567,
-0.003823503851890564,
0.2833932042121887,
0.015330355614423752,
0.32752725481987,
0.26952046155929565,
0.05543297529220581,
0.36029934883117676,
-0.18510594964027405,
-0.07459788769483566,
-0.1926945000886917,
-0.1971706748008728,
0.13446755707263947,
0.15169043838977814,
0.13279904425144196,
-0.23246929049491882,
-0.5946475267410278,
-0.15092158317565918,
-0.25865083932876587,
0.010437928140163422,
0.08212409913539886,
-0.02982395887374878,
0.28400444984436035,
0.044970881193876266,
0.0342341847717762,
0.22166718542575836,
-0.2649141550064087,
-0.26092228293418884,
-0.3637111186981201,
0.28904035687446594,
-0.23346148431301117,
-0.26680344343185425,
0.016826104372739792,
-0.5399338603019714,
0.15518753230571747,
-0.21243923902511597,
-0.053714316338300705,
-0.0245189368724823,
0.1239686980843544,
-0.14193883538246155,
0.10302689671516418,
0.20291700959205627,
0.18788978457450867,
-0.045367754995822906,
0.03922167420387268,
-0.13728070259094238,
0.10339823365211487,
0.2979874908924103,
0.08681145310401917,
0.5367177128791809,
-0.1488341987133026,
0.17385146021842957,
0.03054722771048546,
0.2985990047454834,
0.035753022879362106,
0.015335418283939362,
0.24456645548343658,
-0.17976099252700806,
0.29224324226379395,
-0.10956764966249466,
-0.20952047407627106,
-0.30423569679260254,
0.012517273426055908,
0.03748341649770737,
0.28664839267730713,
-0.11375225335359573,
-0.052530840039253235,
-0.06076434999704361,
0.18782734870910645,
0.06760036945343018,
-0.2674081027507782,
0.0879296213388443,
-0.27740103006362915,
-0.19979527592658997,
0.036231935024261475,
0.2855173349380493,
-0.0677640289068222,
-0.2022215723991394,
0.09116052091121674,
-0.10124333202838898,
0.1115729957818985,
-0.2520762085914612,
-0.18028637766838074,
0.3822594881057739,
-0.5033355951309204,
0.4058060050010681,
0.01770552061498165,
0.2860855758190155,
0.3129202127456665,
-0.2308184802532196,
0.07826907932758331,
0.047727327793836594,
0.41598933935165405,
-0.35791218280792236,
0.15825337171554565,
0.44728824496269226,
-0.2505180239677429,
-0.042227596044540405,
-0.1235632598400116,
-0.2599177658557892,
-0.18909119069576263,
0.026363426819443703,
-0.35840868949890137,
-0.3673055171966553,
-0.23470555245876312,
0.17901435494422913,
0.17222709953784943,
-0.13158881664276123,
-0.09460442513227463,
-0.19542047381401062,
-0.14084699749946594,
-0.17394980788230896,
-0.25783103704452515,
-0.08319569379091263,
0.051124077290296555,
-0.25383487343788147,
-0.11262263357639313,
-0.021323611959815025,
-0.24223476648330688,
0.334498792886734,
0.3226645290851593,
0.1653527021408081,
-0.012119024060666561,
0.004892405122518539,
0.2595239281654358,
0.03211231529712677,
-0.00028358399868011475,
0.5156348943710327,
-0.18270409107208252,
-0.2526944875717163,
0.15328797698020935,
-0.16461804509162903,
0.380135178565979,
0.12217868864536285,
-0.03869835287332535,
0.08444742113351822,
-0.4061068892478943,
0.09178465604782104,
-0.31411734223365784,
0.5976011157035828,
0.31873762607574463,
-0.16188836097717285,
0.18393589556217194,
-0.286527544260025,
0.44003424048423767,
-0.11985565721988678,
-0.058653414249420166,
0.5181101560592651,
-0.43901175260543823,
-0.27257323265075684,
0.22926616668701172,
-0.10002192109823227,
0.6527178287506104,
0.15517982840538025,
-0.010355427861213684,
0.21163663268089294,
0.2181539386510849,
0.1894758641719818,
-0.25400030612945557,
0.062061015516519547,
-0.29331445693969727,
-0.2902557849884033,
0.11504694819450378,
-0.11877091228961945,
0.2748996913433075,
0.3439328670501709,
-0.3710970878601074,
0.23149682581424713,
-0.1662522256374359,
0.11616747081279755,
0.2451561987400055,
0.4671816825866699,
-0.21617688238620758,
0.016014590859413147,
-0.0778769925236702,
0.05205173045396805,
0.3815428614616394,
0.20019632577896118,
-0.027513667941093445,
-0.1653929054737091,
-0.2098921537399292,
-0.15881502628326416,
0.025439709424972534,
0.23438304662704468,
-0.41783931851387024,
-0.07265038043260574,
-0.040376413613557816,
-0.22043846547603607,
0.13767610490322113,
0.1729961633682251,
0.241877481341362,
0.053733013570308685,
-0.1271219551563263,
-0.1456124484539032,
-0.2578452229499817,
-0.04589204117655754,
0.19404444098472595,
0.06722337007522583,
0.14782197773456573,
0.03734714537858963,
-0.37429624795913696,
0.2848319709300995,
-0.17329519987106323,
-0.20975668728351593,
0.3150959610939026,
-0.1556827872991562,
0.16486388444900513,
-0.36360082030296326,
0.017421768978238106,
-0.06409361958503723,
-0.13632456958293915,
-0.07852636277675629,
0.053322143852710724,
0.05214579775929451,
-0.7080101370811462,
0.14134711027145386,
-0.271391898393631,
-0.3244529664516449,
-0.03938429430127144,
0.10668725520372391,
-0.2228567898273468,
0.4759727418422699,
0.41735830903053284,
-0.11632177233695984,
0.377733051776886,
-0.23466843366622925,
0.3289365768432617,
0.3370266854763031,
-0.16974009573459625,
0.6116287112236023,
-0.055521462112665176,
-0.38032662868499756,
0.10902068018913269,
0.35773274302482605,
0.2878514528274536,
-0.06371542066335678,
-0.2488832175731659,
-0.14060820639133453,
-0.150030255317688,
-0.15824583172798157,
0.1125161349773407,
0.39555272459983826,
-0.17766550183296204,
0.29586654901504517,
-0.17470254004001617,
0.3727816045284271,
-0.1949801743030548,
-0.0024365545250475407,
-0.18815378844738007,
0.12338002771139145,
-0.08576273918151855,
-0.1829473376274109,
0.24296778440475464,
-0.00495156180113554,
0.04999915510416031,
-0.05309181660413742,
-0.26029273867607117,
-0.17874881625175476,
-0.2944217324256897,
0.17440420389175415,
0.06579692661762238,
-0.2386597841978073,
0.14599144458770752,
0.054040998220443726,
-0.025801807641983032,
-0.12079782783985138,
0.17627660930156708,
-0.3385203182697296,
-0.010981537401676178,
0.252572238445282,
0.34275591373443604,
-0.006727874279022217,
-0.6286965012550354,
0.00993221253156662,
-0.27355432510375977,
0.2913060784339905,
-0.21935206651687622,
0.049105897545814514,
0.16068509221076965,
0.03289695084095001,
0.12784448266029358,
-0.20778781175613403,
0.13203305006027222,
-0.13347041606903076,
0.5864822268486023,
0.11926227807998657,
0.006347693502902985,
-0.0403594933450222,
0.22034764289855957,
0.38051313161849976,
0.09980417042970657,
0.07832088321447372,
0.13496530055999756,
0.08630072325468063,
-0.30461665987968445,
0.03166252002120018,
0.2106904834508896,
0.04893958196043968,
0.3257642090320587,
0.274530827999115,
0.2787441909313202,
0.01718863844871521,
-0.030475452542304993,
-0.19405606389045715,
0.21148893237113953,
0.2699236273765564,
0.1913391500711441,
0.7015009522438049,
-0.4936886131763458,
0.33378395438194275,
0.1052519902586937,
-0.2653428316116333,
0.2542865574359894,
-0.4790073037147522,
0.19292452931404114,
0.6058322787284851,
-0.3864370286464691,
0.07417985051870346,
-0.08014527708292007,
-0.21125443279743195,
0.20389410853385925,
0.19992968440055847,
0.2975570559501648,
0.2877904176712036,
0.02603384479880333,
0.36194929480552673,
-0.5504582524299622,
-0.07715670764446259,
-0.19184191524982452,
0.2061721682548523,
0.2919974625110626,
0.03849951550364494,
-0.0975593775510788,
0.009371146559715271,
-0.47083133459091187,
-0.23006531596183777,
0.2454041689634323,
-0.2955705523490906,
-0.22639772295951843,
-0.05194302648305893,
-0.011238045990467072,
0.34972673654556274,
-0.26972100138664246,
0.055360160768032074,
-0.08173144608736038,
-0.3166092336177826,
0.20978568494319916,
0.10952972620725632,
-0.08090206980705261,
0.19632266461849213,
0.49506646394729614,
0.2401910275220871,
0.022662945091724396,
-0.43914568424224854,
-0.36611488461494446,
0.1244545429944992,
0.04496090114116669,
-0.13863655924797058,
0.3397323191165924,
-0.3198177218437195,
-0.20740742981433868,
0.2640452980995178,
0.04141003638505936,
-0.08066372573375702,
-0.43988704681396484,
0.2591479420661926,
-0.40326616168022156,
-0.17697329819202423,
0.6636248230934143,
0.157911017537117,
0.009540267288684845,
0.029466234147548676,
-0.24004912376403809,
-0.09030213952064514,
0.04179275035858154,
0.1923098862171173,
-0.44230037927627563,
0.1097014918923378,
0.009878045879304409,
0.025805093348026276,
-0.2754497826099396,
0.47268763184547424,
-0.05480291321873665,
-0.030134208500385284,
-0.2771565318107605,
-0.16373933851718903,
-0.5738851428031921,
0.2634528875350952,
-0.05278920754790306,
-0.48653948307037354,
0.08103126287460327,
-0.11998356133699417,
0.37761056423187256,
0.17625567317008972,
-0.1693369597196579,
0.34869852662086487,
0.2776540219783783,
0.29125624895095825,
-0.36257854104042053,
-0.24387948215007782,
-0.2989763021469116,
0.030773334205150604,
-0.05003940314054489,
-0.4768277108669281,
0.08960913121700287,
-0.0004993081092834473,
-0.1357267200946808,
0.1987258791923523,
0.01933910697698593,
0.3844158947467804,
0.0003759711980819702,
0.27152252197265625,
0.08794374763965607,
0.45241984724998474,
-0.10058089345693588,
0.1148441806435585,
-0.03840957209467888,
0.2583160698413849,
-0.1768367886543274,
-0.08817707747220993,
0.21985305845737457,
0.25923651456832886,
0.007110996171832085,
0.29045096039772034,
-0.32018283009529114,
0.4042017161846161,
0.3185974955558777,
0.30754002928733826,
-0.556834876537323,
0.13012446463108063,
-0.22092923521995544,
-0.03402164950966835,
0.6548747420310974,
0.2844884693622589,
-0.3331449031829834,
0.11738015711307526,
-0.04902099445462227,
0.008213834837079048,
0.3080021142959595,
-0.13476510345935822,
-0.15683746337890625,
-0.22404752671718597,
0.06814762949943542,
-0.09667404741048813,
-0.1177389845252037,
-0.1457936316728592,
-0.15659472346305847,
0.1873215287923813,
-0.05106242746114731,
0.12154324352741241,
0.1973780393600464,
0.5144412517547607,
-0.00370948389172554,
0.008738260716199875,
0.28755703568458557,
0.23626068234443665,
-0.031984832137823105,
0.027049046009778976,
-0.1153377965092659
] |
https://github.com/huggingface/datasets/issues/649 | Inconsistent behavior in map | Thanks for reporting !
This issue must have appeared when we refactored type inference in `nlp`
By default the library tries to keep the same feature types when applying `map` but apparently it has troubles with nested structures. I'll try to fix that next week | I'm observing inconsistent behavior when applying .map(). This happens specifically when I'm incrementally adding onto a feature that is a nested dictionary. Here's a simple example that reproduces the problem.
```python
import datasets
# Dataset with a single feature called 'field' consisting of two examples
dataset = datasets.Dataset.from_dict({'field': ['a', 'b']})
print(dataset[0])
# outputs
{'field': 'a'}
# Map this dataset to create another feature called 'otherfield', which is a dictionary containing a key called 'capital'
dataset = dataset.map(lambda example: {'otherfield': {'capital': example['field'].capitalize()}})
print(dataset[0])
# output is okay
{'field': 'a', 'otherfield': {'capital': 'A'}}
# Now I want to map again to modify 'otherfield', by adding another key called 'append_x' to the dictionary under 'otherfield'
print(dataset.map(lambda example: {'otherfield': {'append_x': example['field'] + 'x'}})[0])
# printing out the first example after applying the map shows that the new key 'append_x' doesn't get added
# it also messes up the value stored at 'capital'
{'field': 'a', 'otherfield': {'capital': None}}
# Instead, I try to do the same thing by using a different mapped fn
print(dataset.map(lambda example: {'otherfield': {'append_x': example['field'] + 'x', 'capital': example['otherfield']['capital']}})[0])
# this preserves the value under capital, but still no 'append_x'
{'field': 'a', 'otherfield': {'capital': 'A'}}
# Instead, I try to pass 'otherfield' to remove_columns
print(dataset.map(lambda example: {'otherfield': {'append_x': example['field'] + 'x', 'capital': example['otherfield']['capital']}}, remove_columns=['otherfield'])[0])
# this still doesn't fix the problem
{'field': 'a', 'otherfield': {'capital': 'A'}}
# Alternately, here's what happens if I just directly map both 'capital' and 'append_x' on a fresh dataset.
# Recreate the dataset
dataset = datasets.Dataset.from_dict({'field': ['a', 'b']})
# Now map the entire 'otherfield' dict directly, instead of incrementally as before
print(dataset.map(lambda example: {'otherfield': {'append_x': example['field'] + 'x', 'capital': example['field'].capitalize()}})[0])
# This looks good!
{'field': 'a', 'otherfield': {'append_x': 'ax', 'capital': 'A'}}
```
This might be a new issue, because I didn't see this behavior in the `nlp` library.
Any help is appreciated! | 45 | Inconsistent behavior in map
I'm observing inconsistent behavior when applying .map(). This happens specifically when I'm incrementally adding onto a feature that is a nested dictionary. Here's a simple example that reproduces the problem.
```python
import datasets
# Dataset with a single feature called 'field' consisting of two examples
dataset = datasets.Dataset.from_dict({'field': ['a', 'b']})
print(dataset[0])
# outputs
{'field': 'a'}
# Map this dataset to create another feature called 'otherfield', which is a dictionary containing a key called 'capital'
dataset = dataset.map(lambda example: {'otherfield': {'capital': example['field'].capitalize()}})
print(dataset[0])
# output is okay
{'field': 'a', 'otherfield': {'capital': 'A'}}
# Now I want to map again to modify 'otherfield', by adding another key called 'append_x' to the dictionary under 'otherfield'
print(dataset.map(lambda example: {'otherfield': {'append_x': example['field'] + 'x'}})[0])
# printing out the first example after applying the map shows that the new key 'append_x' doesn't get added
# it also messes up the value stored at 'capital'
{'field': 'a', 'otherfield': {'capital': None}}
# Instead, I try to do the same thing by using a different mapped fn
print(dataset.map(lambda example: {'otherfield': {'append_x': example['field'] + 'x', 'capital': example['otherfield']['capital']}})[0])
# this preserves the value under capital, but still no 'append_x'
{'field': 'a', 'otherfield': {'capital': 'A'}}
# Instead, I try to pass 'otherfield' to remove_columns
print(dataset.map(lambda example: {'otherfield': {'append_x': example['field'] + 'x', 'capital': example['otherfield']['capital']}}, remove_columns=['otherfield'])[0])
# this still doesn't fix the problem
{'field': 'a', 'otherfield': {'capital': 'A'}}
# Alternately, here's what happens if I just directly map both 'capital' and 'append_x' on a fresh dataset.
# Recreate the dataset
dataset = datasets.Dataset.from_dict({'field': ['a', 'b']})
# Now map the entire 'otherfield' dict directly, instead of incrementally as before
print(dataset.map(lambda example: {'otherfield': {'append_x': example['field'] + 'x', 'capital': example['field'].capitalize()}})[0])
# This looks good!
{'field': 'a', 'otherfield': {'append_x': 'ax', 'capital': 'A'}}
```
This might be a new issue, because I didn't see this behavior in the `nlp` library.
Any help is appreciated!
Thanks for reporting !
This issue must have appeared when we refactored type inference in `nlp`
By default the library tries to keep the same feature types when applying `map` but apparently it has troubles with nested structures. I'll try to fix that next week | [
0.3283729553222656,
-0.2924293279647827,
-0.07196904718875885,
0.08141149580478668,
-0.07207600027322769,
-0.20643606781959534,
0.06377164274454117,
0.01955355517566204,
0.20414860546588898,
-0.005322366952896118,
0.29203158617019653,
0.5868220925331116,
0.20928767323493958,
0.11784026771783829,
-0.31621021032333374,
0.16313469409942627,
0.2691352963447571,
-0.07550676167011261,
0.07360939681529999,
-0.13668006658554077,
-0.25080859661102295,
0.06666950136423111,
-0.5501964688301086,
-0.10457465052604675,
-0.05123249813914299,
-0.23762863874435425,
-0.22726425528526306,
-0.21539121866226196,
0.09330979734659195,
-0.06405125558376312,
-0.08025956153869629,
0.16096587479114532,
-0.31273120641708374,
0.35008636116981506,
-0.00011513603385537863,
-0.10091857612133026,
0.21503402292728424,
-0.0772833451628685,
0.0711236447095871,
0.025444574654102325,
-0.06516404449939728,
-0.1851978451013565,
-0.021564040333032608,
-0.2740437686443329,
0.19115689396858215,
-0.08589427918195724,
-0.20547620952129364,
-0.2903946340084076,
0.09982666373252869,
-0.21470443904399872,
0.20834249258041382,
-0.0882745087146759,
0.09078305959701538,
0.2036319077014923,
0.028771966695785522,
0.11713030934333801,
-0.06434950977563858,
0.005695992149412632,
0.029610037803649902,
-0.2457847148180008,
0.10123704373836517,
0.03238903731107712,
-0.18864481151103973,
-0.16289342939853668,
0.38634300231933594,
0.12198401242494583,
0.32459431886672974,
-0.3239736258983612,
0.06263285875320435,
-0.01920754462480545,
0.029119480401277542,
0.025182601064443588,
-0.34328094124794006,
-0.25399407744407654,
-0.30015361309051514,
-0.08273299038410187,
0.22755181789398193,
-0.37307778000831604,
-0.10392585396766663,
-0.19140571355819702,
-0.14686448872089386,
-0.12798458337783813,
0.2984396517276764,
0.5585368871688843,
-0.35717296600341797,
0.09475269913673401,
-0.10846514254808426,
0.27340641617774963,
-0.160378560423851,
-0.16444213688373566,
-0.2618700861930847,
-0.45084676146507263,
0.0857141986489296,
0.38647380471229553,
0.004379037767648697,
0.015033677220344543,
0.3914426863193512,
-0.18689343333244324,
-0.04696096107363701,
-0.43794429302215576,
0.11307591199874878,
0.2154434621334076,
-0.32550373673439026,
0.2683793306350708,
0.3306061327457428,
0.15376196801662445,
0.4373144805431366,
0.2231994867324829,
0.14748765528202057,
-0.03184690326452255,
-0.3212687075138092,
0.08614426851272583,
0.6086956262588501,
0.06241145730018616,
0.2395026534795761,
-0.271307110786438,
0.42563819885253906,
0.07984577119350433,
0.009899461641907692,
0.15742796659469604,
-0.5427671670913696,
-0.066373310983181,
0.07126402854919434,
-0.11170393973588943,
0.2715511620044708,
-0.08661806583404541,
-0.07858273386955261,
0.3137057423591614,
0.020754361525177956,
0.5313531160354614,
-0.1912366896867752,
-0.03860366716980934,
-0.20775172114372253,
0.0864647775888443,
0.002423051744699478,
0.13042938709259033,
0.2730064392089844,
0.31780698895454407,
-0.1392194926738739,
-0.21773962676525116,
-0.3970099091529846,
-0.01701495796442032,
0.34004077315330505,
-0.15349774062633514,
-0.3614327609539032,
0.36818110942840576,
-0.049587320536375046,
-0.4164005517959595,
0.03813355416059494,
0.27085641026496887,
-0.04036528617143631,
0.16026882827281952,
0.30317196249961853,
0.16588397324085236,
-0.1487569659948349,
-0.0807439535856247,
-0.17516496777534485,
0.3520652651786804,
0.4351247549057007,
-0.2993876338005066,
0.14438311755657196,
0.03544042631983757,
-0.4979199469089508,
-0.40508225560188293,
0.030157456174492836,
0.5204486846923828,
-0.1916334331035614,
-0.048871006816625595,
-0.08413896709680557,
0.33150142431259155,
0.0023973211646080017,
0.24200160801410675,
0.01366208866238594,
0.1531417965888977,
-0.12497405707836151,
0.21450091898441315,
0.2045970857143402,
-0.1615840494632721,
-0.444352924823761,
0.24026638269424438,
-0.04633237421512604,
0.4343184530735016,
-0.3960132896900177,
-0.024924347177147865,
0.16106180846691132,
-0.1516004204750061,
0.14885064959526062,
-0.04629277437925339,
0.1757984757423401,
-0.006665783002972603,
-0.2617478370666504,
0.3233526051044464,
0.286960244178772,
-0.34800082445144653,
-0.2542610764503479,
0.40026983618736267,
0.26084426045417786,
-0.08048728853464127,
0.25764939188957214,
0.13209912180900574,
0.20610371232032776,
-0.02678605541586876,
0.1052473932504654,
0.033110491931438446,
-0.11369708180427551,
0.08441252261400223,
-0.4560527205467224,
0.33300918340682983,
-0.07633558660745621,
-0.17634882032871246,
-0.17075394093990326,
0.010076846927404404,
0.009604614228010178,
0.11994851380586624,
-0.0798504650592804,
-0.06913645565509796,
0.15362896025180817,
-0.000863879919052124,
-0.2326343059539795,
-0.06644389033317566,
0.12538248300552368,
-0.1909984052181244,
0.23309989273548126,
0.08060617744922638,
-0.1279173344373703,
0.06957830488681793,
0.13760416209697723,
-0.13898861408233643,
-0.4655870795249939,
0.13938260078430176,
0.40006864070892334,
-0.16738897562026978,
-0.24144554138183594,
0.36418774724006653,
0.06925831735134125,
-0.0023018792271614075,
-0.2280893623828888,
0.09896554797887802,
0.33258774876594543,
0.3299347758293152,
0.03586571291089058,
0.15660645067691803,
0.14415204524993896,
-0.2623310983181,
-0.09114360064268112,
0.1735057681798935,
0.3850865364074707,
0.30004310607910156,
-0.3314896821975708,
-0.05684865266084671,
-0.1686348170042038,
0.08515681326389313,
-0.04637429863214493,
-0.6482143402099609,
-0.35560500621795654,
0.14067624509334564,
-0.035036973655223846,
-0.14333580434322357,
0.1924089789390564,
0.48538580536842346,
0.15401214361190796,
-0.11670735478401184,
0.046206578612327576,
-0.10362903028726578,
-0.034030914306640625,
0.0007395483553409576,
-0.16490985453128815,
0.2468133121728897,
0.5029407143592834,
-0.031755536794662476,
0.21455751359462738,
0.030669141560792923,
0.3216383457183838,
-0.2117251306772232,
0.021316945552825928,
0.11739902198314667,
0.016156461089849472,
0.14658987522125244,
0.5601221919059753,
0.14247111976146698,
-0.16843387484550476,
0.2632063329219818,
0.18713635206222534,
0.038645073771476746,
0.062404531985521317,
0.0907626748085022,
-0.2531963288784027,
0.13387620449066162,
0.051071371883153915,
-0.3161159157752991,
-0.09841500222682953,
-0.5975276827812195,
-0.052073463797569275,
0.37073904275894165,
-0.23557543754577637,
0.08399870991706848,
0.3379153609275818,
-0.3251422047615051,
0.024129735305905342,
-0.2906598150730133,
0.0372626855969429,
-0.2106790691614151,
0.010151274502277374,
-0.0008531920611858368,
-0.11927106231451035,
-0.2419508695602417,
0.07478777319192886,
0.4518422484397888,
-0.24251487851142883,
-0.34458866715431213,
-0.7150274515151978,
-0.0899500697851181,
-0.35233640670776367,
0.14811594784259796,
-0.07131199538707733,
-0.07213008403778076,
-0.015670420601963997,
-0.09273218363523483,
0.2402782440185547,
-0.20404411852359772,
-0.19753076136112213,
0.09245229512453079,
0.18701636791229248,
-0.3144245147705078,
-0.12148548662662506,
-0.08738931268453598,
0.08959593623876572,
-0.23794618248939514,
0.2975448668003082,
-0.06863221526145935,
0.08028997480869293,
0.1324366331100464,
-0.10910184681415558,
-0.2828168272972107,
0.17428374290466309,
-0.07876444607973099,
-0.17408129572868347,
0.3903702199459076,
0.22821205854415894,
-0.12057428061962128,
0.17201195657253265,
-0.062009844928979874,
-0.11676789820194244,
-0.1341579109430313,
0.18554790318012238,
-0.11876501142978668,
-0.2799406051635742,
-0.15949827432632446,
0.4333629310131073,
0.35959702730178833,
0.0029949937015771866,
0.2989766001701355,
0.1547246128320694,
-0.06642655283212662,
-0.1760401427745819,
-0.4334546625614166,
0.14088737964630127,
0.5860912203788757,
0.013951756060123444,
0.16319677233695984,
0.2730634808540344,
0.07339994609355927,
0.30570071935653687,
0.31737762689590454,
-0.09800846874713898,
0.22328263521194458,
-0.11888217180967331,
-0.04788494482636452,
-0.2906945049762726,
-0.16337867081165314,
-0.2218584567308426,
-0.2506217062473297,
0.01415301114320755,
0.029592253267765045,
0.0194457545876503,
-0.44282951951026917,
0.14003276824951172,
-0.11876459419727325,
-0.2647048234939575,
-0.28488877415657043,
-0.051630400121212006,
-0.29991957545280457,
0.28410622477531433,
0.13674697279930115,
0.2810206413269043,
-0.15520349144935608,
-0.1385190486907959,
-0.07895904779434204,
-0.34285831451416016,
0.2689990997314453,
-0.21500840783119202,
-0.29716527462005615,
-0.12107145041227341,
-0.31534111499786377,
0.3885840177536011,
0.06522504985332489,
0.2098758965730667,
0.1250796765089035,
-0.4220081865787506,
0.09194160997867584,
0.1380857676267624,
0.402026891708374,
-0.42665335536003113,
-0.020000971853733063,
-0.12461569905281067,
-0.3372524082660675,
-0.5130751729011536,
-0.1785171627998352,
0.00599154457449913,
0.8075056672096252,
0.1143297553062439,
0.4953760802745819,
-0.057776715606451035,
0.017659230157732964,
-0.17426085472106934,
0.03474999591708183,
0.027113724499940872,
-0.11880233883857727,
0.08789391815662384,
-0.11597158759832382,
-0.2429099977016449,
-0.22274476289749146,
0.013371216133236885,
0.01864880882203579,
0.31741079688072205,
-0.34976819157600403,
0.1555938869714737,
0.14349180459976196,
-0.1378660947084427,
-0.04315957427024841,
0.2221333086490631,
0.23281580209732056,
0.1089470237493515,
0.04082726687192917,
0.07117722183465958,
-0.31100040674209595,
0.32431918382644653,
-0.005917489528656006,
0.1358446478843689,
-0.07201109826564789,
-0.26791051030158997,
-0.011942535638809204,
0.2709803581237793,
0.17277012765407562,
0.22417834401130676,
-0.22278445959091187,
-0.029161348938941956,
-0.02258748561143875,
-0.29127222299575806,
0.595576286315918,
0.02221747860312462,
0.025812702253460884,
-0.15897074341773987,
0.4224529266357422,
-0.027971113100647926,
-0.486710786819458,
0.3390015959739685,
-0.0815826803445816,
-0.23240195214748383,
0.5947387218475342,
-0.18800532817840576,
0.5043506622314453,
0.1774412989616394,
-0.033369001001119614,
0.2652248442173004,
0.09610004723072052,
-0.0781436339020729,
0.10005813837051392,
0.20750458538532257,
-0.31495025753974915,
-0.1735149472951889,
-0.0446479395031929,
0.18846961855888367,
-0.19582486152648926,
0.18967878818511963,
-0.10846424102783203,
0.05083125829696655,
-0.16579638421535492,
0.6276270747184753,
0.06885002553462982,
-0.3101539611816406,
0.39812180399894714,
-0.03455568104982376,
-0.10071419179439545,
0.07025499641895294,
0.4636613726615906,
0.30735695362091064,
0.02035468816757202,
-0.05490922927856445,
-0.19066308438777924,
-0.34298592805862427,
-0.022257454693317413,
0.0342617966234684,
-0.1484510749578476,
0.2699087858200073,
0.08880366384983063,
0.008246570825576782,
0.02727324515581131,
0.5211559534072876,
0.0885116457939148,
0.11086738109588623,
0.1789795160293579,
-0.13819102942943573,
0.5807951092720032,
0.23291298747062683,
0.13203875720500946,
-0.23734179139137268,
-0.2910968065261841,
0.14372846484184265,
-0.28044193983078003,
0.0871349424123764,
-0.2552814483642578,
-0.0709310844540596,
-0.7718076109886169,
0.35059553384780884,
-0.27586084604263306,
-0.2989434003829956,
-0.08838565647602081,
0.02319510281085968,
-0.20387716591358185,
-0.11831000447273254,
0.039466120302677155,
-0.1617491990327835,
-0.0789022147655487,
0.30456480383872986,
-0.1264171451330185,
-0.19723793864250183,
0.100783571600914,
0.5037266612052917,
0.0695551261305809,
0.4625643193721771,
0.2889646291732788,
-0.22224779427051544,
-0.014258161187171936,
-0.04709497094154358,
-0.19659557938575745,
-0.2833276093006134,
0.24513357877731323,
0.08031032979488373,
-0.14159183204174042,
0.000698477029800415,
0.155864417552948,
0.3267737329006195,
-0.3146663308143616,
0.05010451748967171,
-0.20876045525074005,
-0.2365892380475998,
-0.07857407629489899,
0.3313896656036377,
0.17737968266010284,
0.07719306647777557,
-0.1244436651468277,
-0.08761557936668396,
-0.03718104958534241,
0.51581871509552,
-0.2492159605026245,
0.02973153442144394,
0.5445585250854492,
0.34825897216796875,
0.5488525629043579,
0.16696912050247192,
0.0330427922308445,
-0.11399196088314056,
0.13796280324459076,
0.057644255459308624,
-0.007028495892882347,
-0.1969984471797943,
0.09278364479541779,
0.09752712398767471,
0.24672284722328186,
0.14313578605651855,
-0.020217910408973694,
-0.08178359270095825,
0.22357049584388733,
-0.3962995111942291,
0.39921098947525024,
0.04770716279745102,
-0.10955391824245453,
0.26546066999435425,
-0.1771475374698639,
0.35525748133659363,
0.20557552576065063,
0.2373933494091034,
-0.1122223287820816,
-0.1242632269859314,
0.21625426411628723,
0.014635324478149414,
0.057858847081661224,
-0.03929325193166733,
-0.06619368493556976,
-0.07947409898042679,
-0.37623679637908936,
0.179887056350708,
0.33192116022109985,
-0.22019453346729279,
0.031651388853788376,
0.2090613692998886,
0.08473208546638489,
0.10286013782024384,
-0.19606831669807434,
-0.19934998452663422,
-0.4081461727619171,
0.20837710797786713,
-0.13688208162784576,
-0.2583909034729004,
0.714057981967926,
0.1178329735994339,
0.4833856225013733,
0.5350746512413025,
0.13878847658634186,
-0.36394360661506653,
-0.238373264670372,
-0.033843811601400375,
-0.18953929841518402,
-0.2641140818595886,
0.15690121054649353,
0.5044383406639099,
-0.0935211256146431,
0.017058566212654114,
0.2735712230205536,
0.15565267205238342,
-0.0954524502158165,
0.48878365755081177,
0.5087665319442749,
0.06416749954223633,
0.08388394862413406,
-0.100664883852005,
0.1373462975025177,
-0.1960141509771347,
0.3739912211894989,
0.22219663858413696,
0.11002553999423981,
0.1483699381351471,
0.26389455795288086,
0.001718372106552124,
0.1322786957025528,
-0.33378806710243225,
0.01905565895140171,
0.22919468581676483,
-0.21127554774284363,
-0.3193449079990387,
0.0417502224445343,
-0.33456623554229736,
-0.060392141342163086,
-0.2493549883365631,
-0.16864559054374695,
-0.10242611169815063,
0.5230633020401001,
-0.18456603586673737,
-0.035946160554885864,
-0.17006589472293854,
0.013020938262343407,
-0.24951913952827454,
0.5381358861923218,
-0.0387335941195488,
0.20343433320522308,
-0.06279833614826202,
0.005170650780200958,
-0.06118365004658699,
-0.13187453150749207,
0.11706306040287018,
0.27967116236686707,
-0.3479599058628082,
0.44384410977363586,
0.013166037388145924,
-0.3360474407672882,
0.12063458561897278,
0.2105063796043396,
-0.20481431484222412,
0.07884030044078827,
0.10180491209030151,
0.10024507343769073,
-0.1397598683834076,
0.14862801134586334,
0.3657959997653961,
0.43428096175193787,
-0.07454019784927368,
0.22150613367557526,
0.0665692687034607,
-0.0716380625963211,
0.013789072632789612,
-0.22270441055297852,
0.16656458377838135,
-0.521220862865448,
0.016632815822958946,
-0.172962486743927,
0.22353264689445496,
0.06546321511268616,
0.06677670031785965,
0.053608499467372894,
0.2340751737356186,
0.1249890923500061,
-0.1575351059436798,
-0.2167906016111374,
0.002999119460582733,
-0.4744947850704193,
0.16152483224868774,
-0.15102842450141907,
-0.04721111059188843,
-0.157903790473938,
0.031176431104540825,
0.3251596689224243,
-0.029674366116523743,
0.1237819492816925,
-0.47170451283454895,
-0.2631175220012665,
0.3394148647785187,
-0.044644881039857864,
-0.1144513189792633,
-0.18044710159301758,
-0.20154857635498047,
0.12416791915893555,
-0.3140755891799927,
0.17283065617084503,
-0.11436065286397934,
0.1543126404285431,
-0.028825808316469193,
0.008205346763134003,
-0.33651161193847656,
-0.24160602688789368,
0.5207401514053345,
0.3949011266231537,
-0.032420575618743896,
-0.2991228401660919,
-0.2901269495487213,
-0.18782588839530945,
0.011145927011966705,
-0.21213705837726593,
0.30953893065452576,
-0.09640809893608093,
0.36931195855140686,
0.00618082657456398,
0.008632805198431015,
0.03335022181272507,
0.12966617941856384,
0.17431795597076416,
-0.34380218386650085,
-0.09900544583797455,
0.03993389755487442,
-0.21831893920898438,
0.1883193403482437,
-0.017157383263111115,
0.5380635261535645,
-0.14532575011253357,
0.38567566871643066,
0.09558098018169403,
-0.31967154145240784,
0.32576894760131836,
-0.3355545997619629,
-0.1595035046339035,
0.18424351513385773,
0.015836402773857117,
0.03435516729950905,
-0.21076425909996033,
0.030129380524158478,
-0.4007391631603241,
0.2965136170387268,
-0.3499027490615845,
-0.1761534959077835,
0.0013839835301041603,
-0.28398996591567993,
-0.385112464427948,
-0.05793715640902519,
0.12563902139663696,
0.08408521115779877,
-0.13492240011692047,
0.16993874311447144,
-0.10887573659420013
] |
https://github.com/huggingface/datasets/issues/647 | Cannot download dataset_info.json | Thanks for reporting !
We should add support for servers without internet connection indeed
I'll do that early next week | I am running my job on a cloud server where does not provide for connections from the standard compute nodes to outside resources. Hence, when I use `dataset.load_dataset()` to load data, I got an error like this:
```
ConnectionError: Couldn't reach https://storage.googleapis.com/huggingface-nlp/cache/datasets/text/default-53ee3045f07ba8ca/0.0.0/dataset_info.json
```
I tried to open this link manually, but I cannot access this file. How can I download this file and pass it through `dataset.load_dataset()` manually?
Versions:
Python version 3.7.3
PyTorch version 1.6.0
TensorFlow version 2.3.0
datasets version: 1.0.1
| 20 | Cannot download dataset_info.json
I am running my job on a cloud server where does not provide for connections from the standard compute nodes to outside resources. Hence, when I use `dataset.load_dataset()` to load data, I got an error like this:
```
ConnectionError: Couldn't reach https://storage.googleapis.com/huggingface-nlp/cache/datasets/text/default-53ee3045f07ba8ca/0.0.0/dataset_info.json
```
I tried to open this link manually, but I cannot access this file. How can I download this file and pass it through `dataset.load_dataset()` manually?
Versions:
Python version 3.7.3
PyTorch version 1.6.0
TensorFlow version 2.3.0
datasets version: 1.0.1
Thanks for reporting !
We should add support for servers without internet connection indeed
I'll do that early next week | [
-0.25816893577575684,
0.02437390387058258,
-0.05948873236775398,
0.2031504213809967,
0.07885235548019409,
0.12885937094688416,
0.09597358852624893,
0.2360111027956009,
0.19916678965091705,
0.0795682743191719,
0.14541953802108765,
0.2383173257112503,
0.2438558042049408,
0.18965166807174683,
0.1779324859380722,
-0.10449342429637909,
-0.17571842670440674,
0.060259122401475906,
0.016306202858686447,
0.16399602591991425,
-0.20364733040332794,
0.11252237856388092,
-0.027788564562797546,
0.09308719635009766,
-0.14860542118549347,
-0.32952970266342163,
0.17262864112854004,
0.16745930910110474,
-0.19953617453575134,
-0.048016563057899475,
0.3676278293132782,
0.11115801334381104,
0.023130815476179123,
0.18008404970169067,
-0.0001172042393591255,
0.24824844300746918,
0.3314515948295593,
-0.04688259959220886,
-0.38553139567375183,
-0.61510169506073,
-0.27753162384033203,
-0.31046587228775024,
0.13269659876823425,
-0.2921256721019745,
0.05455523729324341,
-0.027438491582870483,
0.3667287826538086,
-0.24558989703655243,
0.30661940574645996,
0.38288870453834534,
0.08188731968402863,
0.1975744217634201,
0.16682003438472748,
-0.015102416276931763,
-0.07966906577348709,
-0.1569046825170517,
0.1030239537358284,
0.2234269380569458,
0.07784885913133621,
0.022297674790024757,
0.1356128454208374,
0.2242700457572937,
-0.14158624410629272,
0.1933998167514801,
0.31850844621658325,
0.07709195464849472,
-0.22840437293052673,
-0.2921457886695862,
0.3731551170349121,
0.4352722764015198,
0.7340180277824402,
-0.2587640881538391,
-0.35040283203125,
-0.09410528093576431,
0.06857849657535553,
0.004910526797175407,
0.4181966781616211,
0.3318796753883362,
-0.26745492219924927,
0.05324423313140869,
-0.38543495535850525,
-0.4756147265434265,
-0.5133510828018188,
0.2596518397331238,
-0.043795570731163025,
-0.0062728151679039,
-0.08685261756181717,
0.06506804376840591,
0.13078299164772034,
0.05299869924783707,
0.11021625250577927,
-0.058689601719379425,
0.0596238449215889,
0.22557207942008972,
-0.13930435478687286,
0.0642869621515274,
-0.023155510425567627,
-0.3781895041465759,
0.09888900071382523,
0.2373104989528656,
0.19101645052433014,
0.08853183686733246,
-0.29795804619789124,
0.2700926959514618,
0.24381104111671448,
-0.019225649535655975,
-0.07532622665166855,
0.05070747807621956,
0.3943023085594177,
0.18914271891117096,
0.20857864618301392,
-0.194688618183136,
-0.05913133546710014,
-0.20781201124191284,
-0.10139434039592743,
0.00010442174971103668,
0.2709667682647705,
-0.007575061172246933,
-0.22176381945610046,
0.17437471449375153,
-0.24921101331710815,
0.05778855085372925,
-0.030844461172819138,
0.2868507206439972,
-0.4215427339076996,
0.11882263422012329,
0.3688766360282898,
0.09011797606945038,
-0.012429779395461082,
-0.225528284907341,
-0.04059544950723648,
0.05071745440363884,
0.151868999004364,
0.1059541404247284,
0.20242106914520264,
-0.03582678735256195,
0.3656514286994934,
-0.0974893644452095,
-0.009423069655895233,
-0.14569219946861267,
0.36197561025619507,
-0.06761963665485382,
-0.3675270676612854,
0.47842592000961304,
0.3598553240299225,
0.04989117383956909,
-0.030413653701543808,
0.04043569415807724,
-0.004261620342731476,
0.10281962156295776,
-0.5772807002067566,
-0.4673510491847992,
-0.13048067688941956,
0.08809410035610199,
-0.1737639307975769,
0.014178650453686714,
-0.35517191886901855,
-0.060847725719213486,
-0.26711195707321167,
-0.2797562777996063,
-0.10318393260240555,
0.0695323497056961,
-0.16759753227233887,
-0.2041427493095398,
0.35809800028800964,
0.3052932918071747,
-0.4322124421596527,
-0.05839826911687851,
-0.05735495686531067,
-0.2180732935667038,
0.06161780655384064,
0.08046470582485199,
-0.2448321431875229,
0.2876024842262268,
-0.1839333027601242,
0.07813015580177307,
0.47640150785446167,
-0.34751296043395996,
-0.722058117389679,
0.5315423607826233,
-0.2805054783821106,
-0.06556413322687149,
0.04453080892562866,
0.20949026942253113,
0.1288461685180664,
0.258805513381958,
0.407920241355896,
0.4810495376586914,
0.06353600323200226,
-0.09150613844394684,
0.002336408942937851,
-0.3649243414402008,
0.09458866715431213,
0.31086599826812744,
0.09893874078989029,
0.22256162762641907,
0.1619277000427246,
-0.05301720276474953,
0.20419842004776,
0.04454056918621063,
0.0700533390045166,
0.4480999708175659,
-0.012417588382959366,
0.08853095769882202,
-0.10269705206155777,
-0.11302598565816879,
-0.6764416694641113,
0.1161554679274559,
0.00027783215045928955,
-0.08137243986129761,
-0.6097719073295593,
-0.08024582266807556,
-0.22058406472206116,
-0.03893624246120453,
0.08832388371229172,
0.2622843384742737,
0.049385786056518555,
0.049601662904024124,
0.10819488763809204,
0.13242274522781372,
-0.10001236200332642,
0.4082683324813843,
-0.31105679273605347,
0.11386033892631531,
-0.34752172231674194,
0.1198776513338089,
0.18422412872314453,
0.19429796934127808,
0.10918429493904114,
-0.15186399221420288,
0.09170445799827576,
-0.054160598665475845,
-0.14909625053405762,
0.43828490376472473,
-0.22895672917366028,
0.4687093496322632,
-0.0645764097571373,
0.3214545249938965,
0.07934886962175369,
-0.08259406685829163,
-0.07101000845432281,
0.04189547151327133,
0.10062724351882935,
-0.02805669978260994,
-0.2885225713253021,
0.30348771810531616,
0.1970919519662857,
0.250565767288208,
0.08423715829849243,
0.226390540599823,
0.2398902177810669,
0.01060299202799797,
-0.10176384449005127,
0.3073265254497528,
0.16924452781677246,
0.11322273313999176,
0.200982928276062,
-0.1750231385231018,
-0.5216659307479858,
0.12669837474822998,
0.37509310245513916,
-0.12191246449947357,
0.12621073424816132,
0.10157039761543274,
-0.16633722186088562,
-0.08905855566263199,
0.10786173492670059,
0.159213587641716,
0.18489022552967072,
-0.03570670261979103,
-0.03911170735955238,
0.1988345831632614,
-0.023586101830005646,
-0.24330009520053864,
-0.09120447188615799,
0.048278506845235825,
0.23655973374843597,
0.08271496742963791,
0.017968514934182167,
-0.0010184971615672112,
-0.01602325774729252,
-0.2249884456396103,
0.16848796606063843,
0.260335773229599,
-0.25085175037384033,
0.24826131761074066,
-0.21475750207901,
-0.14315074682235718,
0.11236898601055145,
0.21778419613838196,
-0.27803394198417664,
-0.19697163999080658,
-0.11266914010047913,
0.4512028098106384,
-0.05306270718574524,
-0.2184862196445465,
-0.22827893495559692,
0.312713623046875,
0.11348137259483337,
-0.5957488417625427,
-0.09968018531799316,
-0.15282125771045685,
-0.08975309878587723,
0.008762367069721222,
0.16863425076007843,
0.14477452635765076,
0.20645134150981903,
-0.17803733050823212,
0.010593956336379051,
-0.40247809886932373,
0.1097433790564537,
0.056042421609163284,
0.17263390123844147,
0.13988490402698517,
0.13568001985549927,
0.6456847786903381,
-0.10964768379926682,
0.06761883199214935,
0.11287032067775726,
-0.08281750231981277,
-0.1381504088640213,
-0.032399892807006836,
-0.16083146631717682,
0.14645059406757355,
-0.054403360933065414,
-0.5343639850616455,
-0.42857787013053894,
-0.29950883984565735,
0.40563976764678955,
-0.024459118023514748,
0.2796206772327423,
0.06018928065896034,
0.029387589544057846,
0.21108774840831757,
0.36876505613327026,
0.12993143498897552,
-0.09448665380477905,
-0.6934444308280945,
0.3646915853023529,
-0.19513039290905,
-0.36318814754486084,
0.25327232480049133,
0.0645148828625679,
0.15944623947143555,
0.4275208115577698,
-0.6492442488670349,
-0.13558286428451538,
-0.05048086494207382,
0.21795839071273804,
-0.2815861403942108,
-0.033886365592479706,
0.49391481280326843,
-0.20210964977741241,
0.07096346467733383,
-0.06199979409575462,
-0.031290099024772644,
0.014736071228981018,
0.10171903669834137,
0.21201984584331512,
0.4684886932373047,
0.538823664188385,
0.1260891556739807,
0.6983600854873657,
-0.1538122147321701,
0.08500100672245026,
-0.022463299334049225,
-0.38150274753570557,
0.20229265093803406,
0.1190602257847786,
-0.12212645262479782,
-0.14625144004821777,
-0.08833904564380646,
-0.13003535568714142,
-0.22537876665592194,
-0.07557018846273422,
0.1261391043663025,
-0.33446455001831055,
-0.1559285670518875,
-0.44941920042037964,
-0.28113695979118347,
0.10396029055118561,
-0.05138055980205536,
0.2389107048511505,
0.22310464084148407,
0.20899730920791626,
-0.4047694504261017,
-0.23677900433540344,
-0.0049993135035037994,
0.3802207112312317,
0.1709280163049698,
0.20294156670570374,
-0.10413285344839096,
-0.13792559504508972,
-0.4995947480201721,
0.43119919300079346,
0.010129747912287712,
0.40715155005455017,
-0.2748408019542694,
0.18494728207588196,
0.05986708775162697,
-0.05744905024766922,
0.4644342064857483,
-0.3087019920349121,
0.32222265005111694,
0.0798892080783844,
-0.04345080256462097,
-0.23674331605434418,
0.047607142478227615,
-0.10106969624757767,
0.3014735281467438,
0.4305863678455353,
0.45238205790519714,
-0.18539676070213318,
-0.11833607405424118,
-0.08365600556135178,
-0.04123968631029129,
-0.24900798499584198,
-0.03739875182509422,
-0.14057543873786926,
-0.5846741795539856,
-0.2606702446937561,
-0.14656484127044678,
0.006371801719069481,
0.34924814105033875,
0.09990233927965164,
0.20690035820007324,
-0.05850694328546524,
0.23248866200447083,
-0.014671847224235535,
0.001899484544992447,
-0.02405541017651558,
0.14830738306045532,
-0.1793144941329956,
0.47645094990730286,
0.20764446258544922,
0.20929011702537537,
0.6061325669288635,
0.31823432445526123,
-0.30979520082473755,
0.07608146220445633,
0.007452455349266529,
0.07075409591197968,
0.15883275866508484,
-0.10019662976264954,
-0.04757487028837204,
0.5560961961746216,
0.170089453458786,
-0.2265903353691101,
0.21637257933616638,
0.20044931769371033,
-0.04496556147933006,
-0.2611289322376251,
-0.5889948010444641,
0.5028380155563354,
0.10209061205387115,
-0.0888955295085907,
0.30960118770599365,
-0.08674508333206177,
-0.025994228199124336,
-0.01791384629905224,
-0.2588959038257599,
0.7463459372520447,
-0.007848300039768219,
0.10218538343906403,
0.22008264064788818,
0.12902669608592987,
0.739245593547821,
-0.8184084296226501,
0.42603564262390137,
0.0502769835293293,
-0.2318524867296219,
-0.28000006079673767,
-0.16879841685295105,
0.04279409721493721,
0.24651575088500977,
0.13539691269397736,
0.35376960039138794,
0.04929143190383911,
0.1398376226425171,
0.2809299826622009,
0.32761111855506897,
-0.31236305832862854,
-0.19702079892158508,
-0.12951762974262238,
0.027607116848230362,
-0.2567071318626404,
0.5734647512435913,
-0.10124494135379791,
-0.3177196979522705,
-0.01056322455406189,
-0.20151519775390625,
-0.22051219642162323,
0.29665449261665344,
-0.35374778509140015,
0.18290384113788605,
-0.025192905217409134,
0.012327097356319427,
-0.11975331604480743,
0.11887648701667786,
0.030778612941503525,
0.22701308131217957,
-0.40643271803855896,
0.09622149169445038,
-0.3807075321674347,
-0.2729482650756836,
0.060030099004507065,
0.19309313595294952,
0.1431875377893448,
-0.14882299304008484,
-0.3436146080493927,
0.31033357977867126,
-0.20932097733020782,
-0.5062011480331421,
0.34418541193008423,
-0.15106797218322754,
-0.3313431739807129,
0.08298684656620026,
-0.14149817824363708,
-0.10667906701564789,
-0.04205844923853874,
0.013935510069131851,
0.056483641266822815,
0.045998625457286835,
0.03079267218708992,
-0.05861242860555649,
0.10702945291996002,
-0.18670254945755005,
0.07200144231319427,
0.614006757736206,
-0.08181947469711304,
-0.15761107206344604,
0.4818260669708252,
0.15078800916671753,
-0.06862928718328476,
-0.14762282371520996,
0.032845452427864075,
-0.03151969611644745,
0.13396599888801575,
0.04767428711056709,
-0.07740028202533722,
0.4039572477340698,
-0.35120970010757446,
-0.02435598149895668,
0.1211346760392189,
0.09781742841005325,
0.02881767973303795,
-0.8456357717514038,
-0.22713075578212738,
0.23954881727695465,
0.0572061687707901,
0.08955180644989014,
0.2577363848686218,
-0.014642888680100441,
0.15451180934906006,
-0.10041740536689758,
-0.19870880246162415,
0.16890926659107208,
-0.2931164503097534,
-0.24073904752731323,
0.44376954436302185,
0.22843125462532043,
0.5434685945510864,
-0.06829094141721725,
-0.03361669182777405,
-0.07245854288339615,
-0.13386887311935425,
-0.0819212794303894,
-0.031599171459674835,
0.19336193799972534,
0.0343472883105278,
-0.1537771075963974,
-0.04018913581967354,
-0.5816942453384399,
-0.23841971158981323,
0.2793464958667755,
0.25835469365119934,
0.12578463554382324,
-0.054152995347976685,
0.08943583071231842,
-0.35156649351119995,
0.4427087604999542,
-0.40987998247146606,
0.20006145536899567,
0.011804580688476562,
0.6186723709106445,
-0.2902221977710724,
0.18991699814796448,
0.09339862316846848,
0.0799570083618164,
-0.39631152153015137,
-0.1322663426399231,
0.06441596895456314,
-0.15627425909042358,
0.4741697609424591,
-0.3039166331291199,
0.2632943093776703,
-0.15181247889995575,
0.11238993704319,
0.17346632480621338,
-0.2352960854768753,
0.2265855073928833,
0.19392454624176025,
0.10534319281578064,
-0.07755123823881149,
-0.07107625156641006,
0.31267115473747253,
0.14308403432369232,
0.05829695239663124,
-0.05905718356370926,
0.08159509301185608,
-0.026931561529636383,
-0.07523824274539948,
-0.013257715851068497,
0.3911985158920288,
-0.21902680397033691,
0.13760241866111755,
0.24329477548599243,
-0.012494895607233047,
0.02296500653028488,
-0.02996681071817875,
0.3261118233203888,
0.09830253571271896,
0.2900645136833191,
-0.07943321019411087,
-0.1628965139389038,
0.05812327563762665,
0.15744644403457642,
-0.18316376209259033,
-0.5663149952888489,
-0.24026258289813995,
0.16024281084537506,
-0.3456604778766632,
0.06731890141963959,
-0.3224356472492218,
0.19918745756149292,
-0.2051939219236374,
0.0599442794919014,
-0.4050638973712921,
0.23308821022510529,
0.0006373599171638489,
-0.07907377183437347,
-0.4354058504104614,
-0.21185898780822754,
0.05593259632587433,
0.215628981590271,
0.3409401476383209,
-0.2835577726364136,
0.010521583259105682,
0.05136113241314888,
-0.0588664710521698,
-0.08722309023141861,
0.03645429015159607,
0.146137535572052,
0.09613876789808273,
-0.27602577209472656,
-0.08537296205759048,
-0.15793685615062714,
-0.09755972027778625,
0.15219838917255402,
0.23728971183300018,
0.2586217224597931,
0.10057645291090012,
-0.06368440389633179,
0.30233344435691833,
0.05303618684411049,
-0.1611158847808838,
0.00356251560151577,
0.05965045467019081,
0.4132119119167328,
-0.4068717360496521,
0.22443214058876038,
0.11592935025691986,
-0.0663938969373703,
0.43380528688430786,
-0.09105141460895538,
0.40804973244667053,
-0.17149539291858673,
0.19695287942886353,
-0.14351823925971985,
-0.05488722771406174,
-0.22234022617340088,
-0.19790267944335938,
-0.4185049533843994,
-0.3149419128894806,
0.3104334771633148,
0.07408056408166885,
0.30621349811553955,
-0.09843747317790985,
0.00513855367898941,
-0.22736524045467377,
0.5094872713088989,
0.3295615017414093,
0.31426993012428284,
-0.007813055999577045,
-0.03330347687005997,
-0.4118768274784088,
-0.029503844678401947,
-0.22486311197280884,
-0.22119301557540894,
0.1552862673997879,
0.20184719562530518,
-0.1512492597103119,
0.13930167257785797,
-0.15220995247364044,
-0.07376853376626968,
-0.20996443927288055,
0.11528783291578293,
-0.10315641760826111,
-0.3068383038043976,
-0.13240599632263184,
0.127776637673378,
-0.012560749426484108,
-0.33406469225883484,
0.08856341242790222,
-0.23978090286254883,
-0.009169146418571472,
-0.13102416694164276,
0.21735882759094238,
-0.13175125420093536,
0.10133412480354309,
0.4135286808013916,
0.014708345755934715,
0.4208112955093384,
0.051382891833782196,
-0.11414831131696701,
-0.27179229259490967,
-0.12317577004432678,
-0.2075551301240921,
0.31005859375,
0.13115347921848297,
0.22133643925189972,
-0.09968447685241699,
-0.04063669964671135,
-0.3142707645893097,
0.14507152140140533,
-0.13666397333145142,
-0.08180364221334457,
-0.16016992926597595,
-0.10022716224193573,
-0.3212530314922333,
0.23255953192710876,
0.08400735259056091,
-0.02415578067302704,
-0.06816206872463226,
-0.060340382158756256,
-0.2181839942932129,
-0.04491782188415527,
0.3933366537094116,
-0.4936448037624359,
-0.1012941300868988,
-0.028959326446056366,
0.18535441160202026,
-0.09532753378152847,
0.10945440083742142,
-0.2316054105758667,
0.25624388456344604,
0.3378903567790985,
-0.14610779285430908,
-0.15666961669921875,
-0.059596847742795944,
-0.17536331713199615,
-0.023731179535388947,
-0.05222413316369057,
0.34848231077194214,
-0.05844362825155258,
-0.3829178214073181,
-0.29681476950645447,
-0.2815040349960327
] |
https://github.com/huggingface/datasets/issues/647 | Cannot download dataset_info.json | Right now the recommended way is to create the dataset on a server with internet connection and then to save it and copy the serialized dataset to the server without internet connection. | I am running my job on a cloud server where does not provide for connections from the standard compute nodes to outside resources. Hence, when I use `dataset.load_dataset()` to load data, I got an error like this:
```
ConnectionError: Couldn't reach https://storage.googleapis.com/huggingface-nlp/cache/datasets/text/default-53ee3045f07ba8ca/0.0.0/dataset_info.json
```
I tried to open this link manually, but I cannot access this file. How can I download this file and pass it through `dataset.load_dataset()` manually?
Versions:
Python version 3.7.3
PyTorch version 1.6.0
TensorFlow version 2.3.0
datasets version: 1.0.1
| 32 | Cannot download dataset_info.json
I am running my job on a cloud server where does not provide for connections from the standard compute nodes to outside resources. Hence, when I use `dataset.load_dataset()` to load data, I got an error like this:
```
ConnectionError: Couldn't reach https://storage.googleapis.com/huggingface-nlp/cache/datasets/text/default-53ee3045f07ba8ca/0.0.0/dataset_info.json
```
I tried to open this link manually, but I cannot access this file. How can I download this file and pass it through `dataset.load_dataset()` manually?
Versions:
Python version 3.7.3
PyTorch version 1.6.0
TensorFlow version 2.3.0
datasets version: 1.0.1
Right now the recommended way is to create the dataset on a server with internet connection and then to save it and copy the serialized dataset to the server without internet connection. | [
-0.2739141583442688,
0.05753108859062195,
-0.03478338196873665,
0.1870901882648468,
0.09355466067790985,
0.18032541871070862,
0.09541946649551392,
0.2747618854045868,
0.0829552561044693,
0.08681342005729675,
0.11729248613119125,
0.24106460809707642,
0.20684422552585602,
0.1972000151872635,
0.22802166640758514,
-0.08971649408340454,
-0.1748177409172058,
0.06889764964580536,
0.037933334708213806,
0.1446816474199295,
-0.15147975087165833,
0.07321027666330338,
0.022248558700084686,
0.0637846440076828,
-0.10278192162513733,
-0.3270796537399292,
0.1324491649866104,
0.19725319743156433,
-0.22604483366012573,
-0.0828820988535881,
0.3538631498813629,
0.1435670554637909,
0.06546560674905777,
0.19082660973072052,
-0.00011644991172943264,
0.25542527437210083,
0.2761067748069763,
-0.12649306654930115,
-0.3891868591308594,
-0.5971481204032898,
-0.21901935338974,
-0.3448013961315155,
0.1283263862133026,
-0.3310895562171936,
0.04931798577308655,
-0.07340020686388016,
0.3594779968261719,
-0.19554677605628967,
0.3597826659679413,
0.3856021761894226,
0.07746652513742447,
0.2254534512758255,
0.19470897316932678,
0.019543634727597237,
-0.12841317057609558,
-0.12199302017688751,
0.08882953971624374,
0.3027688264846802,
0.03299862518906593,
0.12232770025730133,
0.14634859561920166,
0.1968403160572052,
-0.12258937954902649,
0.20052163302898407,
0.32001957297325134,
0.043426498770713806,
-0.2740688621997833,
-0.31155332922935486,
0.3755386173725128,
0.40861988067626953,
0.7346758246421814,
-0.30742859840393066,
-0.38797974586486816,
-0.08710957318544388,
0.05894070863723755,
-0.04548026621341705,
0.42120376229286194,
0.33487212657928467,
-0.23798035085201263,
0.13759472966194153,
-0.3929385244846344,
-0.5090522766113281,
-0.5490765571594238,
0.24416135251522064,
-0.023886337876319885,
-0.06894078850746155,
-0.08392766863107681,
0.06555071473121643,
0.07008244097232819,
0.03193265572190285,
0.11315768957138062,
-0.11062353849411011,
0.13743983209133148,
0.2582966089248657,
-0.08431844413280487,
0.014720536768436432,
-0.06845150142908096,
-0.4558711349964142,
0.09963131695985794,
0.1897510290145874,
0.18067988753318787,
0.08769921958446503,
-0.22846023738384247,
0.23558178544044495,
0.17963916063308716,
0.004850327968597412,
-0.09187894314527512,
0.04512348026037216,
0.3965952396392822,
0.14813175797462463,
0.20234620571136475,
-0.1901381015777588,
-0.1607416719198227,
-0.11932912468910217,
-0.0338573195040226,
0.017802517861127853,
0.2646450996398926,
-0.030443236231803894,
-0.21770094335079193,
0.21428106725215912,
-0.27922379970550537,
0.05771161615848541,
-0.04489758610725403,
0.3205520510673523,
-0.4517364501953125,
0.08739899098873138,
0.36417919397354126,
0.06018834561109543,
-0.04159406200051308,
-0.19079050421714783,
-0.032249726355075836,
0.07932403683662415,
0.2298872470855713,
0.09893186390399933,
0.18626612424850464,
-0.07698187232017517,
0.4051518440246582,
-0.10582830756902695,
-0.02534748613834381,
-0.15011939406394958,
0.38150036334991455,
-0.034779079258441925,
-0.3565565049648285,
0.48565560579299927,
0.4002937972545624,
0.05000517517328262,
-0.06985554099082947,
0.008738987147808075,
-0.01390763372182846,
0.1168026551604271,
-0.5142011642456055,
-0.4643813669681549,
-0.14290958642959595,
0.08723864704370499,
-0.20374205708503723,
0.02771132066845894,
-0.34422630071640015,
-0.047754447907209396,
-0.16500386595726013,
-0.24399906396865845,
-0.14055398106575012,
0.08323469758033752,
-0.18115828931331635,
-0.22397157549858093,
0.40704232454299927,
0.26067978143692017,
-0.41629758477211,
-0.052328456193208694,
0.009146472439169884,
-0.18224084377288818,
0.09578267484903336,
0.07175084948539734,
-0.24509449303150177,
0.3522920310497284,
-0.13903050124645233,
0.061771854758262634,
0.5221267342567444,
-0.3030911982059479,
-0.7184163928031921,
0.46865981817245483,
-0.29634997248649597,
-0.051452718675136566,
0.014909759163856506,
0.1851375550031662,
0.1693570762872696,
0.17724163830280304,
0.34532472491264343,
0.5167126059532166,
0.04640967398881912,
-0.07200247049331665,
-0.008346982300281525,
-0.3728989362716675,
0.12203530222177505,
0.2592836618423462,
0.08207966387271881,
0.16530391573905945,
0.16329297423362732,
0.045184772461652756,
0.16990995407104492,
0.0009181350469589233,
0.05794959515333176,
0.46471309661865234,
-0.0027854368090629578,
0.10303552448749542,
-0.1065409928560257,
-0.07079904526472092,
-0.7039732933044434,
0.11875074356794357,
-0.021239884197711945,
-0.12102282047271729,
-0.6178976893424988,
-0.12306885421276093,
-0.19175943732261658,
-0.02107437327504158,
0.06448837369680405,
0.24694675207138062,
0.03367248922586441,
0.05277824401855469,
0.17378093302249908,
0.14977316558361053,
-0.08952252566814423,
0.40026402473449707,
-0.28564897179603577,
0.1286260485649109,
-0.40034112334251404,
0.1032395213842392,
0.12495287507772446,
0.1720954179763794,
0.13401396572589874,
-0.16289523243904114,
0.11663705855607986,
-0.12408801168203354,
-0.17396491765975952,
0.4517516791820526,
-0.2501601278781891,
0.510627806186676,
-0.12133877724409103,
0.35446155071258545,
0.13580350577831268,
-0.08702652156352997,
-0.04391447454690933,
0.038127996027469635,
0.08423104137182236,
0.0218503475189209,
-0.36998122930526733,
0.30214303731918335,
0.1896650642156601,
0.12185142934322357,
0.1134381890296936,
0.2273877114057541,
0.30664974451065063,
0.02346235141158104,
-0.13107281923294067,
0.2813239097595215,
0.1746361255645752,
0.12727881968021393,
0.2188442200422287,
-0.12740644812583923,
-0.5014266967773438,
0.2014044225215912,
0.4261486232280731,
-0.13544487953186035,
0.1467633992433548,
0.11359522491693497,
-0.17005380988121033,
-0.13700684905052185,
0.0919986143708229,
0.16418509185314178,
0.14026270806789398,
-0.06555154919624329,
0.013620942831039429,
0.12984707951545715,
-0.04437224939465523,
-0.22953641414642334,
-0.10626935213804245,
0.026365526020526886,
0.2623516023159027,
0.096501424908638,
0.04918193817138672,
0.03341374918818474,
0.0066689737141132355,
-0.13864856958389282,
0.1981184333562851,
0.27358725666999817,
-0.19487424194812775,
0.2650148868560791,
-0.2267475724220276,
-0.0929267406463623,
0.041276998817920685,
0.14242461323738098,
-0.2560819387435913,
-0.16251634061336517,
-0.09250656515359879,
0.4689166843891144,
-0.057584553956985474,
-0.19094626605510712,
-0.1897982656955719,
0.2515120804309845,
0.13665984570980072,
-0.5261316299438477,
-0.005742251873016357,
-0.09596201777458191,
-0.0684395432472229,
-0.018587935715913773,
0.1396000236272812,
0.13542786240577698,
0.2400064617395401,
-0.17964190244674683,
0.0289253331720829,
-0.374414324760437,
0.09972844272851944,
0.08436696976423264,
0.17518357932567596,
0.11681251972913742,
0.08576205372810364,
0.6367670893669128,
-0.10552412271499634,
0.01767795905470848,
0.09989356249570847,
-0.047489456832408905,
-0.1694599837064743,
0.039654508233070374,
-0.16271166503429413,
0.0653252899646759,
-0.012670272961258888,
-0.5224090218544006,
-0.5092214941978455,
-0.2645643651485443,
0.3670659065246582,
-0.012649601325392723,
0.30411702394485474,
0.10398917645215988,
-0.02374088019132614,
0.19280168414115906,
0.39470160007476807,
0.14600259065628052,
-0.0952269583940506,
-0.7382694482803345,
0.4059027135372162,
-0.26040828227996826,
-0.4382018744945526,
0.23434296250343323,
0.06214997172355652,
0.13856858015060425,
0.42935091257095337,
-0.6090548038482666,
-0.13595052063465118,
-0.03913819044828415,
0.23755377531051636,
-0.22619685530662537,
-0.07201690226793289,
0.5114516019821167,
-0.19255483150482178,
0.08233584463596344,
-0.10409672558307648,
0.021199990063905716,
0.08360380679368973,
0.12908945977687836,
0.24413689970970154,
0.41841158270835876,
0.5404875874519348,
0.16811038553714752,
0.7009677886962891,
-0.056370481848716736,
0.060444410890340805,
-0.04320180416107178,
-0.35822349786758423,
0.19437742233276367,
0.13166436553001404,
-0.10630257427692413,
-0.11051120609045029,
-0.10306376218795776,
-0.15227149426937103,
-0.16188396513462067,
-0.08169998973608017,
0.13512225449085236,
-0.29917192459106445,
-0.1520615965127945,
-0.4132370054721832,
-0.31500229239463806,
0.1286230832338333,
-0.06788372248411179,
0.2963244915008545,
0.2067396193742752,
0.215734601020813,
-0.4287415146827698,
-0.25889426469802856,
0.006370086222887039,
0.37621623277664185,
0.17847201228141785,
0.22540245950222015,
-0.13243147730827332,
-0.16565757989883423,
-0.6117650270462036,
0.3463321030139923,
0.010315604507923126,
0.4689980149269104,
-0.23017606139183044,
0.1798456311225891,
0.08350475877523422,
-0.09413423389196396,
0.429055392742157,
-0.2495359629392624,
0.3105313777923584,
0.018376927822828293,
-0.03568572178483009,
-0.28808534145355225,
0.03499532863497734,
-0.05214038863778114,
0.36109670996665955,
0.3792175054550171,
0.44290491938591003,
-0.2210146188735962,
-0.10460056364536285,
-0.07956437021493912,
-0.01676390878856182,
-0.34974205493927,
-0.01434921845793724,
-0.13872583210468292,
-0.6285733580589294,
-0.28296908736228943,
-0.18708550930023193,
-0.04451706260442734,
0.3387078046798706,
0.13429147005081177,
0.2128896266222,
-0.056580305099487305,
0.277651846408844,
-0.025485768914222717,
0.010986799374222755,
-0.0339396633207798,
0.19588351249694824,
-0.10985495150089264,
0.5311947464942932,
0.21370728313922882,
0.245078906416893,
0.588562548160553,
0.3323700726032257,
-0.3327037990093231,
0.01997164636850357,
0.02453438565135002,
0.05326444283127785,
0.12409438192844391,
-0.1331603080034256,
-0.07896061986684799,
0.5337429046630859,
0.15370598435401917,
-0.30341875553131104,
0.21270711719989777,
0.13964363932609558,
-0.05719948187470436,
-0.29894930124282837,
-0.5814872980117798,
0.47833842039108276,
0.07753153145313263,
-0.05669848248362541,
0.29936304688453674,
-0.20107720792293549,
-0.049285344779491425,
-0.00460208673030138,
-0.1940881311893463,
0.7162189483642578,
-0.0931386798620224,
0.10333587229251862,
0.21502718329429626,
0.14011523127555847,
0.655505895614624,
-0.7900182008743286,
0.3992989659309387,
0.03814559802412987,
-0.2679976522922516,
-0.27835145592689514,
-0.1457652747631073,
0.02543889731168747,
0.16492557525634766,
0.02661104127764702,
0.3068060278892517,
0.07204413414001465,
0.11961381137371063,
0.23978516459465027,
0.41480234265327454,
-0.28936782479286194,
-0.26714375615119934,
-0.1212489902973175,
0.02690736949443817,
-0.2770170569419861,
0.5673683285713196,
-0.057767998427152634,
-0.31267184019088745,
-0.01945425570011139,
-0.19621025025844574,
-0.19640685617923737,
0.2838347554206848,
-0.3512868583202362,
0.24603283405303955,
-0.05817649886012077,
-0.03324727714061737,
-0.16558480262756348,
0.11155733466148376,
0.09889587014913559,
0.24063006043434143,
-0.3796512186527252,
0.05637328326702118,
-0.3700045049190521,
-0.28705161809921265,
0.04000242054462433,
0.13085804879665375,
0.18125666677951813,
-0.12443217635154724,
-0.23558399081230164,
0.2666380703449249,
-0.17470376193523407,
-0.4450395703315735,
0.3805360794067383,
-0.24224244058132172,
-0.27849918603897095,
0.09185124188661575,
-0.15551136434078217,
-0.12241847813129425,
-0.08793225884437561,
-0.016386447474360466,
0.050187330693006516,
0.10848783701658249,
-0.0505950003862381,
-0.04037395119667053,
0.06923656165599823,
-0.1534147560596466,
0.08091729879379272,
0.581664502620697,
-0.0806179940700531,
-0.15872754156589508,
0.5003037452697754,
0.17044654488563538,
-0.06811563670635223,
-0.11952021718025208,
0.116256482899189,
-0.04127569869160652,
0.14673063158988953,
0.019553784281015396,
-0.12938271462917328,
0.4212912917137146,
-0.39321503043174744,
0.028967730700969696,
0.12046230584383011,
0.039304908365011215,
-0.03301183879375458,
-0.8135484457015991,
-0.2863280475139618,
0.22875459492206573,
0.1580991894006729,
0.1293037235736847,
0.2596992254257202,
0.010022629052400589,
0.1542130559682846,
-0.02977863885462284,
-0.1967710554599762,
0.1311979442834854,
-0.32082098722457886,
-0.18799380958080292,
0.43758395314216614,
0.16767063736915588,
0.4972367584705353,
-0.07361981272697449,
-0.03892330825328827,
-0.07098619639873505,
-0.11900670826435089,
-0.07064609229564667,
-0.09701035916805267,
0.18627294898033142,
-0.016225691884756088,
-0.1704062670469284,
-0.043865106999874115,
-0.590101957321167,
-0.23162329196929932,
0.2620549201965332,
0.2117796689271927,
0.13155755400657654,
-0.049578383564949036,
0.054541800171136856,
-0.30191680788993835,
0.37763622403144836,
-0.3937428593635559,
0.15432977676391602,
0.0022259950637817383,
0.6276221871376038,
-0.2808523178100586,
0.20708726346492767,
0.05003552883863449,
0.04121110588312149,
-0.4263060390949249,
-0.1283074915409088,
0.08903749287128448,
-0.15826129913330078,
0.42998236417770386,
-0.29204946756362915,
0.254751056432724,
-0.11869293451309204,
0.10420369356870651,
0.19050215184688568,
-0.25033336877822876,
0.2916424572467804,
0.2337571680545807,
0.09119727462530136,
-0.043665673583745956,
-0.07142538577318192,
0.29569581151008606,
0.00969885103404522,
0.015097860246896744,
-0.035624660551548004,
0.08380924165248871,
0.0553012490272522,
-0.14735330641269684,
-0.025103768333792686,
0.4249933362007141,
-0.199736088514328,
0.10904379189014435,
0.24119606614112854,
-0.035036541521549225,
0.03134119138121605,
-0.016563070937991142,
0.3380122482776642,
0.10419490188360214,
0.24617403745651245,
-0.0894293412566185,
-0.10748790204524994,
0.16847443580627441,
0.1592968851327896,
-0.13155591487884521,
-0.5190199017524719,
-0.2859692871570587,
0.09307664632797241,
-0.30064162611961365,
0.1135270744562149,
-0.2937907874584198,
0.17156334221363068,
-0.20903585851192474,
-0.007637948263436556,
-0.3982139229774475,
0.29759496450424194,
0.00846538320183754,
-0.11589552462100983,
-0.43680986762046814,
-0.17157895863056183,
0.06072437763214111,
0.24278897047042847,
0.33129027485847473,
-0.32230067253112793,
-0.013005375862121582,
0.09447059035301208,
-0.04862084984779358,
-0.0815676599740982,
0.035483427345752716,
0.14929920434951782,
0.08257221430540085,
-0.28038614988327026,
0.006378535181283951,
-0.10567004978656769,
-0.10895562171936035,
0.04292258247733116,
0.20407703518867493,
0.2475273460149765,
0.08920177817344666,
-0.060750145465135574,
0.3859770894050598,
0.08319409191608429,
-0.17353376746177673,
0.021427568048238754,
0.060329556465148926,
0.33655983209609985,
-0.38600489497184753,
0.23627431690692902,
0.09127040952444077,
-0.05634674057364464,
0.3863757848739624,
-0.04678304120898247,
0.36953067779541016,
-0.1001310646533966,
0.2297031581401825,
-0.059205785393714905,
-0.060183532536029816,
-0.19320416450500488,
-0.15123066306114197,
-0.4297841489315033,
-0.25877711176872253,
0.35523656010627747,
0.07586196810007095,
0.3142484724521637,
-0.0911465510725975,
0.013211626559495926,
-0.21634511649608612,
0.5425177812576294,
0.3017624616622925,
0.32330745458602905,
-0.010450798086822033,
-0.03131391108036041,
-0.41004320979118347,
-0.06543058902025223,
-0.208973228931427,
-0.2313196212053299,
0.18024678528308868,
0.24930424988269806,
-0.1689024269580841,
0.1777106076478958,
-0.15274257957935333,
-0.028799623250961304,
-0.15649022161960602,
0.15881885588169098,
-0.0730370581150055,
-0.28421032428741455,
-0.07042039930820465,
0.12993291020393372,
-0.03452654927968979,
-0.3565252423286438,
0.1670377403497696,
-0.21852056682109833,
-0.010818205773830414,
-0.13997094333171844,
0.2111240029335022,
-0.14604416489601135,
0.03072129562497139,
0.4213563799858093,
0.024379912763834,
0.34933730959892273,
0.02271377295255661,
-0.13198888301849365,
-0.21369314193725586,
-0.03716999664902687,
-0.2274543195962906,
0.3000168800354004,
0.12381649017333984,
0.2504254877567291,
-0.11348770558834076,
-0.051904257386922836,
-0.32408687472343445,
0.07990172505378723,
-0.13842806220054626,
-0.18686755001544952,
-0.16410093009471893,
-0.1094837635755539,
-0.357293963432312,
0.22800388932228088,
0.12956590950489044,
0.046415429562330246,
-0.08759768307209015,
-0.035355888307094574,
-0.21757389605045319,
-0.053409643471241,
0.4117555618286133,
-0.5382965207099915,
-0.06889733672142029,
-0.004562431946396828,
0.12569308280944824,
-0.1282256841659546,
0.14390799403190613,
-0.23836034536361694,
0.3045872747898102,
0.32893526554107666,
-0.2071259617805481,
-0.18138505518436432,
-0.014490578323602676,
-0.11643441021442413,
-0.02064945176243782,
-0.05355095490813255,
0.4048132300376892,
-0.07681623101234436,
-0.3848380744457245,
-0.3207510709762573,
-0.2601368725299835
] |
https://github.com/huggingface/datasets/issues/647 | Cannot download dataset_info.json | #652 should allow you to load text/json/csv/pandas datasets without an internet connection **IF** you've the dataset script locally.
Example:
If you have `datasets/text/text.py` locally, then you can do `load_dataset("./datasets/text", data_files=...)` | I am running my job on a cloud server where does not provide for connections from the standard compute nodes to outside resources. Hence, when I use `dataset.load_dataset()` to load data, I got an error like this:
```
ConnectionError: Couldn't reach https://storage.googleapis.com/huggingface-nlp/cache/datasets/text/default-53ee3045f07ba8ca/0.0.0/dataset_info.json
```
I tried to open this link manually, but I cannot access this file. How can I download this file and pass it through `dataset.load_dataset()` manually?
Versions:
Python version 3.7.3
PyTorch version 1.6.0
TensorFlow version 2.3.0
datasets version: 1.0.1
| 30 | Cannot download dataset_info.json
I am running my job on a cloud server where does not provide for connections from the standard compute nodes to outside resources. Hence, when I use `dataset.load_dataset()` to load data, I got an error like this:
```
ConnectionError: Couldn't reach https://storage.googleapis.com/huggingface-nlp/cache/datasets/text/default-53ee3045f07ba8ca/0.0.0/dataset_info.json
```
I tried to open this link manually, but I cannot access this file. How can I download this file and pass it through `dataset.load_dataset()` manually?
Versions:
Python version 3.7.3
PyTorch version 1.6.0
TensorFlow version 2.3.0
datasets version: 1.0.1
#652 should allow you to load text/json/csv/pandas datasets without an internet connection **IF** you've the dataset script locally.
Example:
If you have `datasets/text/text.py` locally, then you can do `load_dataset("./datasets/text", data_files=...)` | [
-0.2791208028793335,
0.05780690908432007,
-0.04657020792365074,
0.1835986077785492,
0.12291248887777328,
0.18686729669570923,
0.15476647019386292,
0.2711954414844513,
0.20814092457294464,
0.041916683316230774,
0.048986002802848816,
0.2596799433231354,
0.2826950252056122,
0.19255785644054413,
0.18472331762313843,
-0.04452695697546005,
-0.20542433857917786,
0.032313451170921326,
0.024126622825860977,
0.17658962309360504,
-0.21302422881126404,
0.0461442805826664,
-0.034445032477378845,
0.13384367525577545,
-0.11622479557991028,
-0.3269081711769104,
0.16065534949302673,
0.20227733254432678,
-0.18100851774215698,
-0.03994723781943321,
0.43200889229774475,
0.16076752543449402,
0.058231696486473083,
0.1993090808391571,
-0.00011628074571490288,
0.20813439786434174,
0.33969783782958984,
-0.05234447866678238,
-0.39722347259521484,
-0.6450172066688538,
-0.25023582577705383,
-0.26939624547958374,
0.17294012010097504,
-0.301724910736084,
0.06875249743461609,
-0.12498744577169418,
0.3304021954536438,
-0.26597610116004944,
0.2997102737426758,
0.38086217641830444,
0.08116815239191055,
0.18610164523124695,
0.15857411921024323,
-0.00456909229978919,
-0.14470335841178894,
-0.13789644837379456,
0.1531009078025818,
0.2840479016304016,
0.04237371310591698,
-0.01523407269269228,
0.10866913199424744,
0.20428133010864258,
-0.1773226410150528,
0.2587241530418396,
0.3738180994987488,
0.11033903062343597,
-0.2407456636428833,
-0.27736732363700867,
0.4009687602519989,
0.42149728536605835,
0.7367280721664429,
-0.32518255710601807,
-0.3985491394996643,
-0.14951086044311523,
0.029951393604278564,
-0.003878854215145111,
0.3894180655479431,
0.3143300712108612,
-0.25396642088890076,
0.07171279191970825,
-0.3475775122642517,
-0.44197964668273926,
-0.5005507469177246,
0.24432404339313507,
-0.09052252024412155,
-0.07120448350906372,
-0.07642687857151031,
0.06945246458053589,
0.13989387452602386,
0.017505193129181862,
0.20899121463298798,
-0.07504099607467651,
0.10165540128946304,
0.26412129402160645,
-0.16144844889640808,
0.06801526248455048,
0.013272672891616821,
-0.42027440667152405,
0.07999920099973679,
0.1321251094341278,
0.1859791874885559,
0.10210340470075607,
-0.3240417540073395,
0.2630487084388733,
0.2888852059841156,
0.0031038830056786537,
-0.0972452387213707,
0.05373968183994293,
0.41103053092956543,
0.20299026370048523,
0.20621204376220703,
-0.16933777928352356,
-0.10288549959659576,
-0.2158844918012619,
-0.0904720276594162,
-0.034214530140161514,
0.28202539682388306,
-0.025426309555768967,
-0.27504023909568787,
0.16282948851585388,
-0.2433774173259735,
0.08104754984378815,
0.0057740602642297745,
0.3083931505680084,
-0.4633272886276245,
0.14827807247638702,
0.37307798862457275,
0.06774698197841644,
0.001143990084528923,
-0.14913581311702728,
-0.052632901817560196,
0.13200058043003082,
0.16112658381462097,
0.06867120414972305,
0.1769047975540161,
-0.04105444625020027,
0.35269641876220703,
-0.10151173919439316,
-0.03557893633842468,
-0.14306360483169556,
0.30784380435943604,
-0.04154879227280617,
-0.3538808822631836,
0.4735925495624542,
0.3906005918979645,
0.08654699474573135,
-0.002598922699689865,
-0.030178384855389595,
-0.022992707788944244,
0.09055548161268234,
-0.5049899220466614,
-0.4248256981372833,
-0.1023377925157547,
0.09072783589363098,
-0.16513456404209137,
0.018883761018514633,
-0.37950217723846436,
-0.054054226726293564,
-0.23878592252731323,
-0.21321727335453033,
-0.11380132287740707,
0.06575289368629456,
-0.15763208270072937,
-0.1937025636434555,
0.38142129778862,
0.3426973819732666,
-0.4553873836994171,
-0.04289035499095917,
-0.025677047669887543,
-0.18674926459789276,
0.031460948288440704,
0.11710810661315918,
-0.2610657513141632,
0.32786208391189575,
-0.14165492355823517,
-0.0006124451756477356,
0.4650781750679016,
-0.3743422031402588,
-0.6786801218986511,
0.5116197466850281,
-0.25111138820648193,
-0.03737778216600418,
0.01207241415977478,
0.19409394264221191,
0.06404280662536621,
0.22464407980442047,
0.4172990918159485,
0.5540280342102051,
0.03524137660861015,
-0.0761466696858406,
0.033500608056783676,
-0.37423092126846313,
0.12064623087644577,
0.3107517957687378,
0.12383148074150085,
0.16018277406692505,
0.17569100856781006,
-0.004819444380700588,
0.18748053908348083,
0.01225963979959488,
0.03612952679395676,
0.4173099994659424,
-0.047864776104688644,
0.12983113527297974,
-0.08882883936166763,
-0.08697541058063507,
-0.6877628564834595,
0.12591850757598877,
0.030222423374652863,
-0.15602178871631622,
-0.6504184007644653,
-0.11489755660295486,
-0.2287503480911255,
-0.01892220415174961,
0.08011920750141144,
0.22970256209373474,
0.030290868133306503,
0.0678144171833992,
0.1056918054819107,
0.1507730782032013,
-0.11274628341197968,
0.46340736746788025,
-0.26216983795166016,
0.15451106429100037,
-0.36426979303359985,
0.054570212960243225,
0.18428443372249603,
0.20455873012542725,
0.13703981041908264,
-0.14326006174087524,
0.07273461669683456,
-0.07530071586370468,
-0.15269199013710022,
0.4997185468673706,
-0.21788649260997772,
0.4904348850250244,
-0.09088631719350815,
0.316501259803772,
0.10069552809000015,
-0.019656799733638763,
-0.09898818284273148,
0.04191067814826965,
0.13255642354488373,
0.004910998046398163,
-0.3661688566207886,
0.3218410611152649,
0.17728187143802643,
0.23631852865219116,
0.12180334329605103,
0.2513243556022644,
0.2710549235343933,
0.01934770867228508,
-0.06972403079271317,
0.2834271788597107,
0.14047162234783173,
0.09779880940914154,
0.2253124862909317,
-0.1177346259355545,
-0.5117952823638916,
0.1311013251543045,
0.3453789949417114,
-0.12342548370361328,
0.12011049687862396,
0.10888473689556122,
-0.16162022948265076,
-0.11355902254581451,
0.07920171320438385,
0.1813420206308365,
0.11463906615972519,
-0.05158688500523567,
-0.05414370074868202,
0.155996635556221,
-0.04888354241847992,
-0.22230921685695648,
-0.10949329286813736,
0.07055692374706268,
0.1992180049419403,
0.012059532105922699,
0.003158051986247301,
0.023165378719568253,
0.008396122604608536,
-0.17616572976112366,
0.19336731731891632,
0.2756213843822479,
-0.22503356635570526,
0.2806059718132019,
-0.24292445182800293,
-0.1875537633895874,
0.12722408771514893,
0.17160436511039734,
-0.20334413647651672,
-0.16663408279418945,
-0.15299417078495026,
0.48404181003570557,
-0.04543782025575638,
-0.1549713909626007,
-0.19145682454109192,
0.28223109245300293,
0.16416525840759277,
-0.5675444006919861,
-0.04698434844613075,
-0.15553568303585052,
-0.05623725801706314,
0.015401870012283325,
0.20385049283504486,
0.17009757459163666,
0.21699096262454987,
-0.1641971915960312,
0.06328582763671875,
-0.43641209602355957,
0.12093717604875565,
0.04383882135152817,
0.13224098086357117,
0.14613358676433563,
0.12475563585758209,
0.6109938025474548,
-0.1397799700498581,
0.029905986040830612,
0.08678526431322098,
-0.07666148990392685,
-0.09991178661584854,
-0.027535252273082733,
-0.15748141705989838,
0.09701017290353775,
-0.028345389291644096,
-0.5136216282844543,
-0.41842392086982727,
-0.31515809893608093,
0.4051455855369568,
0.01109641045331955,
0.24974587559700012,
0.14291514456272125,
0.013667250983417034,
0.21279016137123108,
0.3999158442020416,
0.11463358253240585,
-0.09256289154291153,
-0.6567984223365784,
0.40058499574661255,
-0.21182765066623688,
-0.38860946893692017,
0.1795174926519394,
0.04105478525161743,
0.17347772419452667,
0.37418025732040405,
-0.6029784083366394,
-0.14921878278255463,
-0.09577271342277527,
0.23850572109222412,
-0.25026610493659973,
-0.058799467980861664,
0.4799557030200958,
-0.20104637742042542,
0.05037291347980499,
-0.0519973523914814,
-0.04123477637767792,
0.02039341628551483,
0.10760293900966644,
0.21547254920005798,
0.45810192823410034,
0.5635311603546143,
0.10509000718593597,
0.6342535614967346,
-0.18718110024929047,
0.06579022854566574,
-0.02323193848133087,
-0.39575284719467163,
0.2789328098297119,
0.1227039098739624,
-0.14849740266799927,
-0.21320822834968567,
-0.08651457726955414,
-0.12629276514053345,
-0.17912040650844574,
-0.09123377501964569,
0.12774091958999634,
-0.3572419583797455,
-0.1581609696149826,
-0.431130051612854,
-0.2972109317779541,
0.07318271696567535,
-0.10858848690986633,
0.1910107433795929,
0.2258857786655426,
0.20707380771636963,
-0.38539791107177734,
-0.2513486444950104,
0.00825049914419651,
0.3692334294319153,
0.1811159998178482,
0.18688127398490906,
-0.04523967579007149,
-0.12045606225728989,
-0.5152065753936768,
0.3726806640625,
-0.04262465983629227,
0.4191330671310425,
-0.1932641565799713,
0.15511786937713623,
0.07653851062059402,
-0.06324391812086105,
0.4792936444282532,
-0.24439723789691925,
0.324992835521698,
0.07732845842838287,
-0.058341044932603836,
-0.3281804919242859,
0.043775927275419235,
-0.09961755573749542,
0.3088560998439789,
0.360507607460022,
0.40017643570899963,
-0.1641087830066681,
-0.11085459589958191,
-0.05236468464136124,
-0.03630947321653366,
-0.266495019197464,
-0.03896555304527283,
-0.15161241590976715,
-0.6053227782249451,
-0.28096553683280945,
-0.1779874563217163,
0.0015704706311225891,
0.3210447430610657,
0.13025864958763123,
0.21684883534908295,
-0.06667248159646988,
0.20298469066619873,
0.0007950365543365479,
0.026355493813753128,
-0.03812472149729729,
0.21381020545959473,
-0.13033191859722137,
0.48479074239730835,
0.18353530764579773,
0.22293977439403534,
0.577366292476654,
0.3251751959323883,
-0.3378046751022339,
0.023107200860977173,
0.015353475697338581,
0.05416499450802803,
0.10978308320045471,
-0.14830449223518372,
-0.03994055837392807,
0.5120701789855957,
0.15433147549629211,
-0.21613626182079315,
0.26798442006111145,
0.1858840435743332,
-0.01934942975640297,
-0.25541743636131287,
-0.6606376767158508,
0.5072331428527832,
0.09060607850551605,
-0.10041020065546036,
0.3094783127307892,
-0.1373145431280136,
-0.023788822814822197,
-0.03602428734302521,
-0.2209879755973816,
0.671367347240448,
-0.12451767921447754,
0.1313057392835617,
0.21637707948684692,
0.12027980387210846,
0.7099758386611938,
-0.7732658386230469,
0.3676517605781555,
0.0492255799472332,
-0.22920747101306915,
-0.26220956444740295,
-0.1553095281124115,
0.009133782237768173,
0.14470379054546356,
0.14032931625843048,
0.370215505361557,
0.06310392916202545,
0.16994331777095795,
0.30198925733566284,
0.36090436577796936,
-0.3123672902584076,
-0.23910674452781677,
-0.12969698011875153,
0.028656799346208572,
-0.23752151429653168,
0.5534265041351318,
-0.07186674326658249,
-0.2736503481864929,
-0.007323455065488815,
-0.22254841029644012,
-0.18526124954223633,
0.26239079236984253,
-0.30868300795555115,
0.2724308967590332,
-0.06768618524074554,
-0.007740706205368042,
-0.1633070707321167,
0.19580703973770142,
0.06080323085188866,
0.22488845884799957,
-0.3993472456932068,
0.08883359283208847,
-0.37306132912635803,
-0.2940768301486969,
0.013120261952280998,
0.1559785008430481,
0.2039618194103241,
-0.0827016532421112,
-0.2740243971347809,
0.3077610731124878,
-0.1745194047689438,
-0.4703129529953003,
0.32942530512809753,
-0.12103874981403351,
-0.2856195569038391,
0.10297572612762451,
-0.1716604083776474,
-0.16960850358009338,
-0.0616297610104084,
0.005670316517353058,
0.05527465045452118,
0.028312478214502335,
0.048015423119068146,
-0.04010225832462311,
0.048358891159296036,
-0.22445715963840485,
0.05677518993616104,
0.6204460859298706,
-0.11330118030309677,
-0.14729899168014526,
0.48696091771125793,
0.20255212485790253,
-0.09326523542404175,
-0.12896306812763214,
0.015746362507343292,
0.0206469614058733,
0.18166950345039368,
0.061859458684921265,
-0.09702907502651215,
0.40652716159820557,
-0.3604157269001007,
-0.02963828667998314,
0.11493553221225739,
0.049356020987033844,
-0.01290011778473854,
-0.8330098390579224,
-0.27870407700538635,
0.24362236261367798,
0.08422353863716125,
0.10873434692621231,
0.2688499391078949,
-0.002219829708337784,
0.160464808344841,
-0.09008275717496872,
-0.1942877620458603,
0.1731632500886917,
-0.2985092103481293,
-0.22021496295928955,
0.4320724904537201,
0.22346621751785278,
0.5248361825942993,
-0.08118344843387604,
-0.017793718725442886,
-0.09460313618183136,
-0.08880522102117538,
-0.0914294645190239,
-0.07996584475040436,
0.18580250442028046,
0.0011570286005735397,
-0.18776892125606537,
-0.010870074853301048,
-0.6070570945739746,
-0.26400893926620483,
0.22682379186153412,
0.27172088623046875,
0.1981515884399414,
-0.03495124727487564,
0.019173406064510345,
-0.343226820230484,
0.41070371866226196,
-0.35441750288009644,
0.18740352988243103,
-0.031011663377285004,
0.5695281624794006,
-0.2640036344528198,
0.17362742125988007,
0.0520726777613163,
0.07727259397506714,
-0.36440080404281616,
-0.14327377080917358,
0.06221790984272957,
-0.19296491146087646,
0.42708197236061096,
-0.28025007247924805,
0.24039000272750854,
-0.10604444146156311,
0.15595537424087524,
0.21381039917469025,
-0.2523761987686157,
0.24273474514484406,
0.20682987570762634,
0.0972651019692421,
-0.09432760626077652,
-0.024910682812333107,
0.2158673256635666,
0.03902213275432587,
0.05039522424340248,
-0.012588731944561005,
0.06654727458953857,
-0.009979821741580963,
-0.10726064443588257,
-0.014593934640288353,
0.4498603641986847,
-0.18599899113178253,
0.1092178076505661,
0.31789612770080566,
-0.018889494240283966,
-0.001889202743768692,
0.033369407057762146,
0.3920712471008301,
0.12674686312675476,
0.2934991717338562,
-0.09564202278852463,
-0.209174245595932,
0.02399589866399765,
0.2001219391822815,
-0.19511738419532776,
-0.5417720675468445,
-0.2135821133852005,
0.13363179564476013,
-0.3624090552330017,
0.03388044983148575,
-0.30840831995010376,
0.19864094257354736,
-0.2256321758031845,
0.09168318659067154,
-0.38489753007888794,
0.24158263206481934,
0.016178011894226074,
-0.11535370349884033,
-0.33374863862991333,
-0.21569859981536865,
0.05385565757751465,
0.21960434317588806,
0.3604964315891266,
-0.3386315107345581,
-0.06588266789913177,
0.03337777033448219,
-0.04161560535430908,
-0.10410309582948685,
0.0878840833902359,
0.14233797788619995,
0.08791475743055344,
-0.2790157198905945,
-0.09240029007196426,
-0.14702831208705902,
-0.08008696138858795,
0.1165987104177475,
0.22712071239948273,
0.2707594335079193,
0.1289186179637909,
-0.09188435971736908,
0.3254321813583374,
0.04075200855731964,
-0.18687091767787933,
0.04292786493897438,
0.03263581544160843,
0.35063278675079346,
-0.36504268646240234,
0.2370016723871231,
0.12695732712745667,
-0.08322212100028992,
0.4458383023738861,
-0.07311980426311493,
0.4121452271938324,
-0.1663271188735962,
0.19766995310783386,
-0.06922341883182526,
-0.035448748618364334,
-0.20828542113304138,
-0.14675462245941162,
-0.4075518250465393,
-0.3283410668373108,
0.3176426589488983,
0.06354085355997086,
0.30683591961860657,
-0.09448948502540588,
0.013533834367990494,
-0.18600323796272278,
0.5233607888221741,
0.33158057928085327,
0.3229912221431732,
0.01804111897945404,
0.012183547019958496,
-0.4556889832019806,
-0.05680721253156662,
-0.22684362530708313,
-0.23447152972221375,
0.15274567902088165,
0.16903305053710938,
-0.1858551800251007,
0.11044549942016602,
-0.13807065784931183,
-0.0008358452469110489,
-0.2150801420211792,
0.07052341848611832,
-0.06055651605129242,
-0.34873345494270325,
-0.16440102458000183,
0.1297166347503662,
-0.025180980563163757,
-0.33429625630378723,
0.08954504877328873,
-0.26879385113716125,
-0.0057378001511096954,
-0.13505491614341736,
0.2368738055229187,
-0.11414949595928192,
0.030237209051847458,
0.38608643412590027,
-0.039992064237594604,
0.3857758939266205,
0.06565140187740326,
-0.08715685456991196,
-0.28261691331863403,
-0.10704588145017624,
-0.20590844750404358,
0.32484865188598633,
0.1207987517118454,
0.20534519851207733,
-0.11928152292966843,
-0.11000525951385498,
-0.3097416162490845,
0.19029501080513,
-0.1096411645412445,
-0.15077385306358337,
-0.12371049076318741,
-0.09940808266401291,
-0.3078344464302063,
0.2365947663784027,
0.06981047242879868,
-0.014807082712650299,
-0.09090064465999603,
0.009741174057126045,
-0.1888255476951599,
-0.09988732635974884,
0.43156927824020386,
-0.4962153434753418,
-0.11336012184619904,
-0.03687415271997452,
0.14170978963375092,
-0.10034062713384628,
0.10420679301023483,
-0.20023006200790405,
0.3202190399169922,
0.3165215849876404,
-0.1479848325252533,
-0.18975795805454254,
-0.05628390982747078,
-0.17734859883785248,
0.003949251025915146,
-0.07033170759677887,
0.3125742971897125,
-0.05936086177825928,
-0.36559051275253296,
-0.31024840474128723,
-0.25524580478668213
] |
https://github.com/huggingface/datasets/issues/643 | Caching processed dataset at wrong folder | Thanks for reporting !
It uses a temporary file to write the data.
However it looks like the temporary file is not placed in the right directory during the processing | Hi guys, I run this on my Colab (PRO):
```python
from datasets import load_dataset
dataset = load_dataset('text', data_files='/content/corpus.txt', cache_dir='/content/drive/My Drive', split='train')
def encode(examples):
return tokenizer(examples['text'], truncation=True, padding='max_length')
dataset = dataset.map(encode, batched=True)
```
The file is about 4 GB, so I cannot process it on the Colab HD because there is no enough space. So I decided to mount my Google Drive fs and do it on it.
The dataset is cached in the right place but by processing it (applying `encode` function) seems to use a different folder because Colab HD starts to grow and it crashes when it should be done in the Drive fs.
What gets me crazy, it prints it is processing/encoding the dataset in the right folder:
```
Testing the mapped function outputs
Testing finished, running the mapping function on the dataset
Caching processed dataset at /content/drive/My Drive/text/default-ad3e69d6242ee916/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/cache-b16341780a59747d.arrow
``` | 30 | Caching processed dataset at wrong folder
Hi guys, I run this on my Colab (PRO):
```python
from datasets import load_dataset
dataset = load_dataset('text', data_files='/content/corpus.txt', cache_dir='/content/drive/My Drive', split='train')
def encode(examples):
return tokenizer(examples['text'], truncation=True, padding='max_length')
dataset = dataset.map(encode, batched=True)
```
The file is about 4 GB, so I cannot process it on the Colab HD because there is no enough space. So I decided to mount my Google Drive fs and do it on it.
The dataset is cached in the right place but by processing it (applying `encode` function) seems to use a different folder because Colab HD starts to grow and it crashes when it should be done in the Drive fs.
What gets me crazy, it prints it is processing/encoding the dataset in the right folder:
```
Testing the mapped function outputs
Testing finished, running the mapping function on the dataset
Caching processed dataset at /content/drive/My Drive/text/default-ad3e69d6242ee916/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/cache-b16341780a59747d.arrow
```
Thanks for reporting !
It uses a temporary file to write the data.
However it looks like the temporary file is not placed in the right directory during the processing | [
-0.05628242343664169,
0.17550355195999146,
-0.04873049259185791,
0.39088505506515503,
-0.03564659506082535,
-0.05728080868721008,
0.2760777175426483,
-0.024447061121463776,
0.040812280029058456,
0.15739372372627258,
0.050647564232349396,
0.17668648064136505,
0.05192212015390396,
0.36383628845214844,
-0.03565724939107895,
0.32181739807128906,
0.27689388394355774,
-0.0544237345457077,
0.05434666946530342,
-0.04352697357535362,
-0.3072211444377899,
0.3765658140182495,
-0.200190469622612,
-0.01863936334848404,
-0.5099132657051086,
-0.17084187269210815,
-0.2043418139219284,
-0.036643654108047485,
0.01987089402973652,
0.20870943367481232,
0.1927693784236908,
0.09847131371498108,
0.17479747533798218,
0.6240897178649902,
-0.0001294347457587719,
-0.11497671902179718,
0.20481576025485992,
-0.26663127541542053,
-0.19613578915596008,
-0.10221979022026062,
-0.31190067529678345,
-0.004488916136324406,
-0.1497933268547058,
-0.07203955948352814,
-0.16851574182510376,
0.05816793441772461,
0.3384489119052887,
-0.5294009447097778,
-0.0324840247631073,
0.19708788394927979,
0.05505453795194626,
-0.4087737500667572,
-0.47871461510658264,
0.3768622875213623,
0.10740283876657486,
0.27378416061401367,
-0.1276576668024063,
0.261773020029068,
0.027408510446548462,
-0.14511854946613312,
0.006361827254295349,
0.2977356016635895,
0.0007322877645492554,
-0.07494163513183594,
0.2810918986797333,
0.35852378606796265,
-0.2941535711288452,
-0.33320552110671997,
0.5126186013221741,
-0.46633195877075195,
0.39866384863853455,
-0.3778877854347229,
-0.20511412620544434,
-0.2074556052684784,
-0.32966452836990356,
-0.28112921118736267,
0.5710793733596802,
0.17239037156105042,
-0.06783036887645721,
0.03818034380674362,
-0.34264373779296875,
-0.23521558940410614,
0.08012242615222931,
0.107357919216156,
-0.17124208807945251,
0.25844818353652954,
-0.2692754566669464,
0.00782417505979538,
-0.08137543499469757,
0.25112032890319824,
0.6566110253334045,
-0.3971770703792572,
-0.017765771597623825,
0.3113222122192383,
-0.017162997275590897,
0.04184858500957489,
-0.25285932421684265,
0.5198615193367004,
-0.2589477002620697,
-0.1941891759634018,
-0.14018630981445312,
-0.1371275782585144,
-0.14531664550304413,
0.11144771426916122,
-0.010033465921878815,
0.38937607407569885,
0.014290928840637207,
0.1784573197364807,
0.1091899573802948,
0.08549915999174118,
-0.46496447920799255,
-0.10242380946874619,
-0.10189121216535568,
-0.2805902659893036,
0.021553006023168564,
0.1529059112071991,
-0.035746019333601,
-0.24229256808757782,
-0.11040794104337692,
-0.05701195448637009,
-0.3516082167625427,
0.03534112498164177,
0.06646084040403366,
0.28544968366622925,
0.022369500249624252,
-0.16365793347358704,
-0.20735591650009155,
0.24099254608154297,
-0.18838736414909363,
0.37410324811935425,
-0.06816283613443375,
0.04874596372246742,
-0.32135722041130066,
0.4333797097206116,
0.040643755346536636,
-0.22252202033996582,
0.1916910707950592,
0.01579935848712921,
-0.0768362283706665,
-0.3220776915550232,
-0.009508075192570686,
-0.46107903122901917,
0.38091522455215454,
0.22028997540473938,
0.14263583719730377,
0.43194663524627686,
0.0019605085253715515,
-0.26122385263442993,
-0.1253497302532196,
0.26388007402420044,
-0.5655606985092163,
-0.25839918851852417,
0.25293514132499695,
-0.042058609426021576,
-0.2712310552597046,
-0.05088666081428528,
-0.6118239760398865,
0.09735801070928574,
0.47514891624450684,
-0.24969644844532013,
0.029133811593055725,
-0.007169295102357864,
-0.5547558665275574,
-0.2493056058883667,
0.08414046466350555,
0.2138260304927826,
-0.37840843200683594,
0.22924143075942993,
-0.26324009895324707,
0.4557933807373047,
0.47820794582366943,
0.4059205651283264,
0.09803562611341476,
0.35412588715553284,
-0.47034910321235657,
-0.018397778272628784,
0.12029260396957397,
-0.3309088349342346,
-0.7670692801475525,
0.2393062859773636,
-0.05532161518931389,
0.002258721739053726,
0.042481180280447006,
0.04301992431282997,
0.16670799255371094,
-0.17284247279167175,
0.13214173913002014,
0.14669694006443024,
0.1153547391295433,
0.22499868273735046,
-0.2722530961036682,
-0.11354177445173264,
-0.03176338970661163,
-0.1408683806657791,
0.0147981196641922,
0.1906708925962448,
0.03138544782996178,
-0.31112274527549744,
0.16270053386688232,
-0.09545227885246277,
0.10952873528003693,
0.28403306007385254,
0.198729008436203,
-0.12179267406463623,
-0.008815166540443897,
0.21952611207962036,
-0.1978289783000946,
0.07856528460979462,
-0.04359325021505356,
-0.18749679625034332,
-0.4925782084465027,
-0.10610882937908173,
-0.0936829000711441,
-0.14423419535160065,
-0.15058642625808716,
-0.2586650848388672,
-0.07056201249361038,
0.3078175485134125,
0.18956086039543152,
0.07181346416473389,
-0.017285164445638657,
0.5587957501411438,
0.042569153010845184,
-0.15474407374858856,
-0.0659867525100708,
0.20572000741958618,
-0.11041995137929916,
-0.26709213852882385,
-0.17828267812728882,
-0.16843730211257935,
0.20959797501564026,
-0.2671530842781067,
-0.17586785554885864,
0.18201977014541626,
0.28028881549835205,
0.45504504442214966,
0.03524426370859146,
0.2760803699493408,
0.10846196860074997,
0.1304480880498886,
0.20539121329784393,
-0.09243574738502502,
0.029336407780647278,
0.16519707441329956,
-0.08067125827074051,
0.3651886284351349,
-0.1599465161561966,
0.06357711553573608,
-0.06421583145856857,
-0.3164082169532776,
-0.054416313767433167,
0.14122924208641052,
0.24152594804763794,
-0.1335030198097229,
0.14567287266254425,
0.40685608983039856,
0.3810803294181824,
0.1703888475894928,
0.17087537050247192,
0.3384847342967987,
0.5877078771591187,
0.08307930827140808,
-0.0072800591588020325,
0.08683596551418304,
-0.14175012707710266,
-0.2576189637184143,
0.2089812159538269,
0.4739123284816742,
0.46118199825286865,
-0.10007500648498535,
0.2996844947338104,
0.12598127126693726,
0.09052671492099762,
-0.16171367466449738,
0.2070007026195526,
0.04864729568362236,
0.17922759056091309,
-0.010285712778568268,
0.21945297718048096,
-0.029627785086631775,
-0.04114876314997673,
0.2106039673089981,
0.09955223649740219,
0.20706918835639954,
-0.09999793767929077,
0.5765218734741211,
-0.17496682703495026,
-0.29626715183258057,
-0.2514060139656067,
-0.22467440366744995,
0.1264941394329071,
-0.19124966859817505,
-0.06766360253095627,
0.2575969994068146,
-0.008091246709227562,
-0.004709281027317047,
0.30188238620758057,
0.16648982465267181,
-0.09584291279315948,
-0.5050302147865295,
-0.18037721514701843,
0.15352657437324524,
-0.20050060749053955,
-0.1138211041688919,
0.35160374641418457,
-0.019749317318201065,
0.026805784553289413,
-0.22377228736877441,
0.020073208957910538,
-0.3809761106967926,
-0.07765619456768036,
0.21115611493587494,
-0.11352194845676422,
0.2927732467651367,
-0.2416090965270996,
0.05247502028942108,
-0.3985487222671509,
-0.25748002529144287,
-0.10083512961864471,
-0.061855532228946686,
-0.06827684491872787,
-0.4157511591911316,
-0.012267107143998146,
-0.04173978790640831,
-0.1293984055519104,
0.04820999875664711,
-0.23075458407402039,
-0.024025514721870422,
0.09108422696590424,
-0.003161482512950897,
0.3184530735015869,
-0.014143488369882107,
-0.03935521841049194,
-0.24731479585170746,
0.37026235461235046,
-0.34975317120552063,
-0.3336966037750244,
-0.6516956090927124,
0.28388744592666626,
-0.1492912322282791,
-0.04403707757592201,
-0.0416816808283329,
-0.0779944583773613,
0.05556191876530647,
0.42722660303115845,
-0.42908775806427,
-0.320713073015213,
-0.13453546166419983,
-0.009809557348489761,
0.2001427859067917,
-0.08156521618366241,
0.30037710070610046,
-0.004547995049506426,
0.21038274466991425,
-0.03070184774696827,
-0.33221688866615295,
0.042832206934690475,
0.3315361738204956,
0.32568231225013733,
-0.017859719693660736,
0.18843397498130798,
0.006296154111623764,
0.6751114726066589,
0.21257860958576202,
0.01764969527721405,
0.38556772470474243,
-0.06289862096309662,
0.2614310681819916,
-0.24942314624786377,
-0.09229987114667892,
0.2275807410478592,
0.031353726983070374,
-0.6610521674156189,
0.399105966091156,
0.09607447683811188,
-0.40418297052383423,
0.18559519946575165,
-0.22659873962402344,
-0.32756781578063965,
-0.2346791923046112,
0.24207262694835663,
0.059365641325712204,
0.2746417224407196,
0.066651850938797,
0.13238471746444702,
-0.26733189821243286,
-0.2672293484210968,
0.06028611585497856,
0.11975988000631332,
0.2946387231349945,
0.18168997764587402,
0.34726792573928833,
-0.5023312568664551,
-0.36413630843162537,
0.3330274224281311,
0.3905140459537506,
0.11178022623062134,
-0.061358362436294556,
0.30690068006515503,
0.16387099027633667,
-0.14162206649780273,
0.6055471897125244,
-0.3414016664028168,
-0.16183236241340637,
-0.14560791850090027,
0.08381250500679016,
-0.005111483857035637,
0.011138800531625748,
0.09111146628856659,
0.42819932103157043,
0.012799996882677078,
0.5021359920501709,
0.33247366547584534,
0.00617515854537487,
-0.1754256784915924,
0.2356712967157364,
-0.32560670375823975,
-0.09170886874198914,
-0.2625860571861267,
-0.5155370831489563,
-0.20173659920692444,
-0.02435614913702011,
0.14273414015769958,
-0.070904940366745,
0.12097320705652237,
0.06334123015403748,
0.1503104269504547,
-0.018134307116270065,
0.042011797428131104,
0.14891137182712555,
0.4182381331920624,
0.12637409567832947,
-0.14376680552959442,
0.1408955603837967,
0.14093536138534546,
0.32214289903640747,
0.514764666557312,
0.17042532563209534,
0.21716034412384033,
0.21103107929229736,
-0.23645047843456268,
0.3073488473892212,
0.44084247946739197,
-0.17776471376419067,
-0.16905781626701355,
-0.16956381499767303,
-0.08285637199878693,
-0.3682970106601715,
0.3819872736930847,
0.16395214200019836,
0.3501550555229187,
-0.3786008358001709,
-0.47771382331848145,
0.4054705798625946,
0.1832025796175003,
-0.2680818438529968,
0.3681361675262451,
-0.0032619833946228027,
-0.5314046740531921,
0.4476587176322937,
0.11921276897192001,
1.067720890045166,
-0.028055638074874878,
0.21879558265209198,
0.024862060323357582,
0.03359382599592209,
0.026398008689284325,
-0.4069092869758606,
0.2578330934047699,
-0.21669158339500427,
-0.6217982769012451,
-0.10705891251564026,
-0.2104317992925644,
-0.14675438404083252,
0.05683030188083649,
-0.21965241432189941,
0.4503045976161957,
0.07890231907367706,
-0.005241461098194122,
-0.09495072066783905,
-0.10467096418142319,
-0.1614505797624588,
-0.12858755886554718,
-0.15709473192691803,
0.015191890299320221,
0.034629277884960175,
0.46750643849372864,
-0.18153280019760132,
0.1736755520105362,
-0.23769228160381317,
0.08730971813201904,
-0.14082637429237366,
-0.02488020621240139,
-0.5036340951919556,
-0.0072959065437316895,
-0.3956758379936218,
-0.2783016562461853,
-0.13243909180164337,
0.32889890670776367,
0.5609939694404602,
0.24092739820480347,
0.05076804384589195,
-0.005017660558223724,
0.13461050391197205,
0.20992092788219452,
-0.00002605002373456955,
-0.45596224069595337,
0.03469808027148247,
0.08749144524335861,
0.18096309900283813,
-0.3113732635974884,
0.09018771350383759,
-0.29996323585510254,
-0.08840540796518326,
0.01756429672241211,
-0.07604271173477173,
0.04289407655596733,
-0.2532408535480499,
0.01992999017238617,
-0.1287471204996109,
0.0843428373336792,
0.012571455910801888,
0.00753205269575119,
0.2728305757045746,
0.4122646450996399,
-0.5614528656005859,
-0.36943474411964417,
-0.20273081958293915,
0.17904219031333923,
0.28240546584129333,
0.09358870983123779,
0.5242558717727661,
-0.24576491117477417,
-0.17746539413928986,
0.011296030133962631,
0.05607905238866806,
-0.3277437686920166,
0.23278990387916565,
0.12817971408367157,
-0.4396623373031616,
-0.15212532877922058,
-0.1758616864681244,
0.07329501211643219,
0.2788391411304474,
-0.01595158874988556,
-0.4446372389793396,
-0.37180691957473755,
-0.4002510905265808,
0.03303422033786774,
0.04931866377592087,
0.043531619012355804,
0.028192557394504547,
0.2562392055988312,
0.1701100915670395,
-0.2793212831020355,
-0.15571264922618866,
0.16068685054779053,
-0.06122282147407532,
0.11317344754934311,
0.030395252630114555,
0.0429069884121418,
0.4526514708995819,
-0.18337422609329224,
-0.12350758165121078,
0.1809014081954956,
0.027848143130540848,
-0.07766897976398468,
-0.04612301290035248,
0.17953632771968842,
0.16716402769088745,
-0.053349100053310394,
-0.024050801992416382,
-0.2914881110191345,
0.10143958032131195,
-0.43074238300323486,
0.20564040541648865,
0.27802008390426636,
0.10401573777198792,
-0.14920151233673096,
0.1424131542444229,
0.0012866407632827759,
-0.03194636106491089,
-0.03526611626148224,
-0.12860317528247833,
0.3755890727043152,
0.1459934115409851,
0.27231502532958984,
0.17547672986984253,
0.08138103783130646,
-0.029972167685627937,
-0.038394227623939514,
0.14420601725578308,
0.3954291343688965,
0.12954993546009064,
-0.2500983476638794,
0.013653837144374847,
-0.06977184861898422,
0.03109443187713623,
0.12424881756305695,
-0.13788968324661255,
-0.3759157061576843,
0.3196122646331787,
-0.009032512083649635,
0.13037553429603577,
-0.03551870584487915,
0.05037428066134453,
-0.18603286147117615,
-0.04182988405227661,
0.511343777179718,
0.25044429302215576,
0.19006627798080444,
-0.0409480482339859,
0.031554438173770905,
0.48797091841697693,
-0.21090583503246307,
0.009066727012395859,
-0.20427623391151428,
0.03348953649401665,
0.5536413192749023,
0.3623773157596588,
0.09028007090091705,
-0.07182445377111435,
0.5481162071228027,
0.1639939248561859,
0.18409016728401184,
0.40367087721824646,
-0.03416093811392784,
-0.019787192344665527,
-0.1628614366054535,
-0.09792496263980865,
0.23463842272758484,
-0.18001699447631836,
0.3569231629371643,
0.22075451910495758,
0.021263062953948975,
-0.42895784974098206,
-0.018519459292292595,
-0.2301098108291626,
0.24648308753967285,
-0.1843441128730774,
-0.2571745812892914,
0.2252785861492157,
-0.1393986940383911,
0.10977678000926971,
0.3992195427417755,
-0.10516925156116486,
-0.09028655290603638,
0.0895911306142807,
0.15809117257595062,
-0.19477464258670807,
0.38909921050071716,
0.024705063551664352,
0.12840402126312256,
0.21576832234859467,
-0.018961738795042038,
0.6912629008293152,
-0.40179044008255005,
0.12115561962127686,
-0.06572295725345612,
0.127167746424675,
0.2669979929924011,
0.3885888457298279,
-0.3067551851272583,
-0.13190346956253052,
0.1379081904888153,
0.07229231297969818,
-0.0580659881234169,
0.2541581094264984,
-0.045496851205825806,
0.018901702016592026,
0.0825255811214447,
0.04031779617071152,
-0.024140745401382446,
0.19202156364917755,
0.18070819973945618,
0.19068439304828644,
0.24277400970458984,
0.092380590736866,
-0.15467789769172668,
0.07201070338487625,
-0.1111399233341217,
0.04041352495551109,
-0.3237195909023285,
0.14143842458724976,
0.1943967491388321,
-0.26932260394096375,
0.33781662583351135,
0.28225553035736084,
-0.003954775631427765,
0.17373713850975037,
0.41448479890823364,
0.4470074474811554,
0.3810234069824219,
-0.3458941876888275,
-0.28103113174438477,
-0.32146719098091125,
0.3492797315120697,
-0.02052578702569008,
0.18443185091018677,
-0.5769678354263306,
0.07261556386947632,
0.03965933620929718,
-0.060809142887592316,
0.011717833578586578,
0.053860705345869064,
-0.12304400652647018,
0.1567472368478775,
-0.2668750584125519,
-0.12036433815956116,
-0.15445975959300995,
-0.025230521336197853,
-0.1251646876335144,
-0.46478956937789917,
0.21742045879364014,
-0.22354081273078918,
0.029381245374679565,
0.04448526352643967,
0.0315537303686142,
-0.24769163131713867,
-0.016668185591697693,
0.43640267848968506,
0.13883240520954132,
0.1036728024482727,
-0.22087126970291138,
-0.01765713281929493,
-0.2244783639907837,
-0.0005779201164841652,
-0.36655986309051514,
-0.04255057871341705,
-0.007967531681060791,
0.316620409488678,
-0.31498125195503235,
0.09721262007951736,
-0.37292391061782837,
0.04068225994706154,
0.23184405267238617,
0.11125942319631577,
0.07314116507768631,
-0.0877920612692833,
-0.21252474188804626,
0.07284066826105118,
0.17202715575695038,
0.5756814479827881,
0.011907350271940231,
0.21673429012298584,
-0.26102447509765625,
0.004854463040828705,
0.23588111996650696,
-0.3160810172557831,
-0.49294543266296387,
0.38314300775527954,
0.03322798013687134,
0.19370974600315094,
-0.06598407030105591,
-0.2832104563713074,
0.05432867258787155,
0.10611120611429214,
-0.20176714658737183,
-0.16212701797485352,
-0.005603045225143433,
0.09526553750038147,
0.1294672042131424,
-0.06041768565773964,
0.3633388876914978,
0.11855972558259964,
-0.3589942455291748,
-0.07256942987442017,
-0.27321767807006836
] |
https://github.com/huggingface/datasets/issues/643 | Caching processed dataset at wrong folder | Well actually I just tested and the temporary file is placed in the same directory, so it should work as expected.
Which version of `datasets` are you using ? | Hi guys, I run this on my Colab (PRO):
```python
from datasets import load_dataset
dataset = load_dataset('text', data_files='/content/corpus.txt', cache_dir='/content/drive/My Drive', split='train')
def encode(examples):
return tokenizer(examples['text'], truncation=True, padding='max_length')
dataset = dataset.map(encode, batched=True)
```
The file is about 4 GB, so I cannot process it on the Colab HD because there is no enough space. So I decided to mount my Google Drive fs and do it on it.
The dataset is cached in the right place but by processing it (applying `encode` function) seems to use a different folder because Colab HD starts to grow and it crashes when it should be done in the Drive fs.
What gets me crazy, it prints it is processing/encoding the dataset in the right folder:
```
Testing the mapped function outputs
Testing finished, running the mapping function on the dataset
Caching processed dataset at /content/drive/My Drive/text/default-ad3e69d6242ee916/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/cache-b16341780a59747d.arrow
``` | 29 | Caching processed dataset at wrong folder
Hi guys, I run this on my Colab (PRO):
```python
from datasets import load_dataset
dataset = load_dataset('text', data_files='/content/corpus.txt', cache_dir='/content/drive/My Drive', split='train')
def encode(examples):
return tokenizer(examples['text'], truncation=True, padding='max_length')
dataset = dataset.map(encode, batched=True)
```
The file is about 4 GB, so I cannot process it on the Colab HD because there is no enough space. So I decided to mount my Google Drive fs and do it on it.
The dataset is cached in the right place but by processing it (applying `encode` function) seems to use a different folder because Colab HD starts to grow and it crashes when it should be done in the Drive fs.
What gets me crazy, it prints it is processing/encoding the dataset in the right folder:
```
Testing the mapped function outputs
Testing finished, running the mapping function on the dataset
Caching processed dataset at /content/drive/My Drive/text/default-ad3e69d6242ee916/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/cache-b16341780a59747d.arrow
```
Well actually I just tested and the temporary file is placed in the same directory, so it should work as expected.
Which version of `datasets` are you using ? | [
-0.09802588820457458,
0.18809384107589722,
-0.028087181970477104,
0.38901108503341675,
-0.01529846340417862,
-0.011468105018138885,
0.32723358273506165,
-0.00962837040424347,
0.03386711701750755,
0.22865694761276245,
0.005428170785307884,
0.227529838681221,
0.027003604918718338,
0.3596072196960449,
-0.08189158886671066,
0.3205983340740204,
0.27600523829460144,
-0.04001231491565704,
0.0644230842590332,
-0.05527319014072418,
-0.349148690700531,
0.3673861026763916,
-0.2507932782173157,
-0.034262776374816895,
-0.5128509402275085,
-0.13687890768051147,
-0.17992720007896423,
-0.06549840420484543,
-0.05333487689495087,
0.213981494307518,
0.24176962673664093,
0.08781445026397705,
0.24950122833251953,
0.6615493297576904,
-0.00012835209781769663,
-0.1254281848669052,
0.26651859283447266,
-0.20713312923908234,
-0.23301434516906738,
-0.13736151158809662,
-0.31810426712036133,
-0.01419022399932146,
-0.13391689956188202,
-0.06768764555454254,
-0.18390461802482605,
0.05591453239321709,
0.27224865555763245,
-0.5808059573173523,
-0.025083109736442566,
0.2409740686416626,
0.07253177464008331,
-0.4288328289985657,
-0.4749282896518707,
0.3053099513053894,
0.09756837785243988,
0.2478017359972,
-0.1422928273677826,
0.2430686205625534,
0.010071270167827606,
-0.14866922795772552,
-0.013940207660198212,
0.33002182841300964,
-0.02701730839908123,
-0.013857938349246979,
0.2550145387649536,
0.3406347334384918,
-0.31940436363220215,
-0.3421720862388611,
0.5276231169700623,
-0.4035203456878662,
0.42922288179397583,
-0.34040015935897827,
-0.17677345871925354,
-0.24743220210075378,
-0.3338010013103485,
-0.26520270109176636,
0.5508045554161072,
0.14174945652484894,
-0.056906528770923615,
0.054689254611730576,
-0.44031694531440735,
-0.19309382140636444,
0.10153315961360931,
0.1382194459438324,
-0.2382398098707199,
0.2111840844154358,
-0.29505860805511475,
0.027647506445646286,
-0.011653359979391098,
0.17794948816299438,
0.6766319274902344,
-0.3875519037246704,
-0.010365787893533707,
0.26300784945487976,
-0.07647117972373962,
0.05874142050743103,
-0.18973660469055176,
0.538162887096405,
-0.20990216732025146,
-0.17878206074237823,
-0.20831312239170074,
-0.13280722498893738,
-0.16672201454639435,
0.09461967647075653,
0.0385344959795475,
0.4278600811958313,
-0.00020378828048706055,
0.203984335064888,
0.12465110421180725,
0.10270648449659348,
-0.5209600925445557,
-0.08315097540616989,
-0.07672418653964996,
-0.2948054075241089,
0.031073223799467087,
0.09694072604179382,
0.01829354465007782,
-0.282768577337265,
-0.14021241664886475,
-0.03787337243556976,
-0.33142054080963135,
0.007637199480086565,
0.10459596663713455,
0.2721991539001465,
0.019771520048379898,
-0.10990958660840988,
-0.24340540170669556,
0.24867455661296844,
-0.21183499693870544,
0.345662921667099,
-0.087007075548172,
0.00869807694107294,
-0.3563786447048187,
0.4384666681289673,
0.08301664888858795,
-0.2516983449459076,
0.15143205225467682,
0.02719039097428322,
-0.07140591740608215,
-0.28998374938964844,
-0.052511684596538544,
-0.4461802840232849,
0.36200281977653503,
0.17326825857162476,
0.13986606895923615,
0.44467219710350037,
0.013379950076341629,
-0.282995343208313,
-0.13267362117767334,
0.24263286590576172,
-0.5642430186271667,
-0.2653878331184387,
0.19853560626506805,
-0.022292308509349823,
-0.27735793590545654,
-0.06934626400470734,
-0.6552334427833557,
0.15275052189826965,
0.44169867038726807,
-0.2127339392900467,
0.008525244891643524,
-0.014979299157857895,
-0.5274878740310669,
-0.22386333346366882,
0.06533978879451752,
0.20044629275798798,
-0.365279883146286,
0.2058350145816803,
-0.3317602872848511,
0.4557802081108093,
0.47562557458877563,
0.3935823142528534,
0.06009501963853836,
0.2928661108016968,
-0.49340012669563293,
-0.027843691408634186,
0.10949557274580002,
-0.3094344735145569,
-0.8372093439102173,
0.2986418306827545,
-0.01381579041481018,
-0.003694199025630951,
-0.016019850969314575,
-0.017527906224131584,
0.18697895109653473,
-0.1316637247800827,
0.16383324563503265,
0.12822678685188293,
0.11123829334974289,
0.19218862056732178,
-0.2752435803413391,
-0.10777366161346436,
-0.010733585804700851,
-0.13896428048610687,
0.03776776045560837,
0.2096470296382904,
0.04147634655237198,
-0.314126193523407,
0.13812172412872314,
-0.06978616118431091,
0.11100113391876221,
0.27281031012535095,
0.23266570270061493,
-0.12982487678527832,
0.011575406417250633,
0.16339722275733948,
-0.22437894344329834,
0.1474629044532776,
0.02823372185230255,
-0.1464347094297409,
-0.47513413429260254,
-0.11716116964817047,
-0.1194387748837471,
-0.16300053894519806,
-0.17022906243801117,
-0.25177884101867676,
-0.07694122940301895,
0.3072749674320221,
0.15771378576755524,
0.028426580131053925,
-0.04070327803492546,
0.525129497051239,
0.06266862154006958,
-0.15932190418243408,
-0.07757847011089325,
0.24202413856983185,
-0.10741845518350601,
-0.23920997977256775,
-0.14879563450813293,
-0.19556277990341187,
0.2205369472503662,
-0.26134374737739563,
-0.21083885431289673,
0.17789319157600403,
0.30595967173576355,
0.40316301584243774,
0.0000762157142162323,
0.2722768485546112,
0.11505387723445892,
0.10920664668083191,
0.16948680579662323,
-0.073065385222435,
0.0028636036440730095,
0.1589083969593048,
-0.08707738667726517,
0.2959049344062805,
-0.14691929519176483,
0.12184346467256546,
-0.10496294498443604,
-0.27685537934303284,
-0.04854518920183182,
0.12851648032665253,
0.2272479236125946,
-0.1897711604833603,
0.07602144777774811,
0.34309619665145874,
0.38312554359436035,
0.1982021927833557,
0.21052560210227966,
0.31934425234794617,
0.6449171900749207,
0.07452543079853058,
-0.035059429705142975,
0.13079077005386353,
-0.13659673929214478,
-0.25201910734176636,
0.22194422781467438,
0.5235063433647156,
0.46024930477142334,
-0.09053342044353485,
0.3149169385433197,
0.16299670934677124,
0.05788416415452957,
-0.15066248178482056,
0.18342286348342896,
0.06282256543636322,
0.2291884422302246,
-0.039277270436286926,
0.22241276502609253,
-0.043675635010004044,
-0.04939575120806694,
0.20051118731498718,
0.0795627012848854,
0.2584431767463684,
-0.12045048177242279,
0.5334348678588867,
-0.2883337140083313,
-0.2838526666164398,
-0.24356171488761902,
-0.24318109452724457,
0.1216462105512619,
-0.21363338828086853,
-0.09766864776611328,
0.2837238013744354,
0.02298305183649063,
0.030286867171525955,
0.23214241862297058,
0.17797856032848358,
-0.1119578406214714,
-0.4812888503074646,
-0.1549045890569687,
0.17863620817661285,
-0.2874039113521576,
-0.10782834887504578,
0.3575811982154846,
-0.0645388811826706,
-0.0030333641916513443,
-0.21686281263828278,
0.049956075847148895,
-0.38204869627952576,
-0.10524746030569077,
0.24308645725250244,
-0.14620620012283325,
0.298490434885025,
-0.21733129024505615,
0.009643591940402985,
-0.4151872396469116,
-0.25891369581222534,
-0.04265676811337471,
-0.07312045246362686,
-0.06631041318178177,
-0.3781528174877167,
-0.02690408006310463,
-0.03676193207502365,
-0.0858888328075409,
0.0030580461025238037,
-0.19070865213871002,
-0.05072992667555809,
0.03930356726050377,
-0.0032562389969825745,
0.2771957814693451,
0.026325836777687073,
-0.028273560106754303,
-0.20602333545684814,
0.3607293963432312,
-0.3355201780796051,
-0.3527885377407074,
-0.6440092325210571,
0.30365192890167236,
-0.14457905292510986,
-0.04961689934134483,
-0.009105663746595383,
-0.0806201845407486,
0.08113014698028564,
0.4302975535392761,
-0.47165971994400024,
-0.3017311692237854,
-0.1893894374370575,
0.013647984713315964,
0.23609089851379395,
-0.07862111181020737,
0.30279597640037537,
0.02901141159236431,
0.196447491645813,
-0.03910704329609871,
-0.40182608366012573,
0.01206890493631363,
0.3081808388233185,
0.3579261302947998,
0.020045820623636246,
0.2512148916721344,
0.05427038297057152,
0.6362170577049255,
0.31141045689582825,
-0.0254184789955616,
0.41966864466667175,
-0.052501827478408813,
0.279105544090271,
-0.2759060859680176,
-0.13349540531635284,
0.22068995237350464,
0.008531659841537476,
-0.646842360496521,
0.4143175482749939,
0.13502417504787445,
-0.4364435374736786,
0.12933677434921265,
-0.2338133305311203,
-0.30974557995796204,
-0.2208637297153473,
0.20106346905231476,
0.015064496546983719,
0.24187937378883362,
0.09316711127758026,
0.14087018370628357,
-0.22386020421981812,
-0.2583942115306854,
0.07339969277381897,
0.08290243148803711,
0.27941614389419556,
0.19866222143173218,
0.28410571813583374,
-0.449278324842453,
-0.3418406546115875,
0.36563318967819214,
0.3487122356891632,
0.11741840094327927,
-0.05171961709856987,
0.2863924205303192,
0.16708865761756897,
-0.1253134310245514,
0.6017550230026245,
-0.3549862205982208,
-0.15763036906719208,
-0.13965599238872528,
0.08609937131404877,
-0.02861701510846615,
-0.01272599771618843,
0.0868602842092514,
0.4143783152103424,
-0.015319719910621643,
0.5273715257644653,
0.33713340759277344,
-0.009212826378643513,
-0.13580556213855743,
0.21359413862228394,
-0.29086390137672424,
-0.1111326590180397,
-0.2496885061264038,
-0.5072106122970581,
-0.20358167588710785,
-0.03051508218050003,
0.14300456643104553,
-0.036044128239154816,
0.05778256803750992,
-0.015750030055642128,
0.1317577362060547,
-0.07887101173400879,
0.037328749895095825,
0.16874535381793976,
0.39874526858329773,
0.14348827302455902,
-0.09290759265422821,
0.18170756101608276,
0.15065106749534607,
0.3403622508049011,
0.5511046648025513,
0.1500350534915924,
0.14958380162715912,
0.19813138246536255,
-0.17519044876098633,
0.2572016716003418,
0.37372079491615295,
-0.18851327896118164,
-0.22406113147735596,
-0.12973223626613617,
-0.04015167057514191,
-0.3493865132331848,
0.3809075951576233,
0.18466857075691223,
0.3165337145328522,
-0.4214712381362915,
-0.5009721517562866,
0.4355788230895996,
0.22056570649147034,
-0.2880977392196655,
0.3781588077545166,
0.03542444854974747,
-0.523360550403595,
0.38928908109664917,
0.10441356897354126,
1.0422186851501465,
-0.02919987589120865,
0.14409859478473663,
0.0531245693564415,
0.08300907909870148,
0.0313161239027977,
-0.3644895553588867,
0.2190927416086197,
-0.16763751208782196,
-0.6126418709754944,
-0.09935610741376877,
-0.17022719979286194,
-0.14945712685585022,
0.1020815372467041,
-0.19655945897102356,
0.47374796867370605,
0.04643218219280243,
0.02021144889295101,
-0.10031624138355255,
-0.08615642786026001,
-0.14757764339447021,
-0.13698020577430725,
-0.20152747631072998,
0.04242256283760071,
-0.01387900859117508,
0.44636955857276917,
-0.1584409773349762,
0.2061465084552765,
-0.1769954264163971,
0.0774846151471138,
-0.1612950563430786,
-0.03004661574959755,
-0.41297635436058044,
-0.010057954117655754,
-0.3488592803478241,
-0.27770599722862244,
-0.12160345911979675,
0.3321132957935333,
0.5052721500396729,
0.24087215960025787,
0.006547510623931885,
0.017362471669912338,
0.12774625420570374,
0.2272513061761856,
-0.003738564671948552,
-0.4449220299720764,
0.05438176915049553,
0.07110857963562012,
0.12711834907531738,
-0.33989790081977844,
0.1443743109703064,
-0.32992351055145264,
-0.0805930346250534,
0.04988007992506027,
-0.07241745293140411,
0.012218203395605087,
-0.22235366702079773,
0.018688984215259552,
-0.09972026944160461,
0.08186757564544678,
0.018769850954413414,
-0.027727559208869934,
0.27608492970466614,
0.4491717219352722,
-0.5062205195426941,
-0.37611308693885803,
-0.20032796263694763,
0.23121431469917297,
0.2537480890750885,
0.07797477394342422,
0.47094613313674927,
-0.20334210991859436,
-0.1989324986934662,
0.016319405287504196,
0.04930458962917328,
-0.27085864543914795,
0.2654400169849396,
0.11768963187932968,
-0.43259984254837036,
-0.07609376311302185,
-0.10497628152370453,
0.062380630522966385,
0.2794387936592102,
-0.06900138407945633,
-0.3804730772972107,
-0.3362632393836975,
-0.3996807932853699,
0.015815839171409607,
0.0075659118592739105,
0.07678939402103424,
0.037235647439956665,
0.18348164856433868,
0.19788946211338043,
-0.25221511721611023,
-0.1632392704486847,
0.1962476521730423,
-0.02916806936264038,
0.0893336683511734,
0.03083604760468006,
0.020176421850919724,
0.38366615772247314,
-0.1811821460723877,
-0.12018472701311111,
0.18720459938049316,
0.028853081166744232,
-0.09750039875507355,
-0.04264169931411743,
0.17534364759922028,
0.20007231831550598,
-0.08732585608959198,
-0.026149164885282516,
-0.3177044987678528,
0.0501992404460907,
-0.4659598171710968,
0.23928913474082947,
0.32948052883148193,
0.11402751505374908,
-0.14675872027873993,
0.16017267107963562,
-0.09015064686536789,
0.0041615888476371765,
-0.027972400188446045,
-0.14303342998027802,
0.37413740158081055,
0.180434450507164,
0.27665504813194275,
0.23076096177101135,
0.0583929717540741,
-0.04585970193147659,
-0.035467781126499176,
0.16617849469184875,
0.3798241913318634,
0.14162343740463257,
-0.2876995801925659,
0.039834123104810715,
-0.04351745545864105,
0.08180594444274902,
0.12899479269981384,
-0.11841224879026413,
-0.4044560492038727,
0.341064453125,
0.012253358960151672,
0.07886612415313721,
-0.05860566720366478,
0.07629629969596863,
-0.1434563547372818,
-0.03621307387948036,
0.4677838683128357,
0.21677663922309875,
0.17265409231185913,
-0.019874855875968933,
0.012063279747962952,
0.527411162853241,
-0.2263324111700058,
0.06272199004888535,
-0.1645875871181488,
0.023125287145376205,
0.5131480693817139,
0.3814440667629242,
0.10081419348716736,
-0.05560695379972458,
0.5689258575439453,
0.12794005870819092,
0.16138610243797302,
0.39759302139282227,
-0.026482362300157547,
0.031163182109594345,
-0.20193926990032196,
-0.055016253143548965,
0.22146810591220856,
-0.23552384972572327,
0.3087993562221527,
0.20961648225784302,
0.018090054392814636,
-0.4070119261741638,
0.01041420642286539,
-0.23499815165996552,
0.17449437081813812,
-0.15339496731758118,
-0.23135226964950562,
0.21955302357673645,
-0.14572572708129883,
0.07599325478076935,
0.4029559791088104,
-0.15428781509399414,
-0.15165837109088898,
0.1393974870443344,
0.13623011112213135,
-0.23834548890590668,
0.3084791302680969,
0.04703783616423607,
0.11733018606901169,
0.21498996019363403,
0.021236997097730637,
0.7285474538803101,
-0.3807324171066284,
0.11813127994537354,
-0.04957317188382149,
0.1587444543838501,
0.2729341685771942,
0.39471155405044556,
-0.2817906439304352,
-0.16707353293895721,
0.12214590609073639,
0.06125103682279587,
-0.10608052462339401,
0.2734850347042084,
-0.09344196319580078,
-0.0007922127842903137,
0.12419621646404266,
0.05866166949272156,
-0.02246784046292305,
0.1964731514453888,
0.13488490879535675,
0.2219516485929489,
0.16979724168777466,
0.1599486917257309,
-0.1646048128604889,
0.1446327269077301,
-0.1275210678577423,
0.04137607663869858,
-0.34540799260139465,
0.10610967129468918,
0.2801473140716553,
-0.2671583890914917,
0.3705638349056244,
0.24982552230358124,
0.0027984939515590668,
0.15812987089157104,
0.4029337465763092,
0.43334341049194336,
0.37841057777404785,
-0.31799522042274475,
-0.2564053237438202,
-0.3567010462284088,
0.3485020399093628,
-0.03957473114132881,
0.2108887881040573,
-0.5317531824111938,
0.08372177183628082,
0.009193077683448792,
-0.028842024505138397,
0.014768145978450775,
0.08350609987974167,
-0.12800940871238708,
0.19440056383609772,
-0.2590568959712982,
-0.12694884836673737,
-0.1365114152431488,
0.0002451147884130478,
-0.11578191816806793,
-0.45384833216667175,
0.23802931606769562,
-0.21687471866607666,
0.013395629823207855,
0.021986085921525955,
0.06987863779067993,
-0.20337162911891937,
-0.07986785471439362,
0.46827420592308044,
0.20582813024520874,
0.13738960027694702,
-0.20238718390464783,
0.029515502974390984,
-0.312599778175354,
0.0013135946355760098,
-0.34607240557670593,
-0.022615358233451843,
-0.017788775265216827,
0.31841444969177246,
-0.3162151277065277,
0.09221045672893524,
-0.3713303506374359,
0.04091876745223999,
0.23945258557796478,
0.13911695778369904,
0.06616127490997314,
-0.10142932087182999,
-0.2200341820716858,
0.04275921359658241,
0.1457413285970688,
0.5836619138717651,
0.030410952866077423,
0.26496410369873047,
-0.2504309415817261,
-0.06838418543338776,
0.27648860216140747,
-0.3251816928386688,
-0.5561158061027527,
0.36123141646385193,
0.0431549996137619,
0.23613643646240234,
-0.14284399151802063,
-0.2722611129283905,
0.0014823749661445618,
0.15119847655296326,
-0.22023910284042358,
-0.12962712347507477,
0.016941851004958153,
0.10761238634586334,
0.13389895856380463,
-0.07623650133609772,
0.36817383766174316,
0.11757352203130722,
-0.3408055603504181,
-0.022471122443675995,
-0.26140373945236206
] |
https://github.com/huggingface/datasets/issues/643 | Caching processed dataset at wrong folder | It looks like a pyarrow issue with google colab.
For some reason this code increases the disk usage of google colab while it actually writes into google drive:
```python
import pyarrow as pa
stream = pa.OSFile("/content/drive/My Drive/path/to/file.arrow", "wb")
writer = pa.RecordBatchStreamWriter(stream, schema=pa.schema({"text": pa.string()}))
writer.write_table(pa.Table.from_pydict({"text": ["a"*511 + "\n"] * ((1 << 30) // 512)})) # 1GiB
writer.close()
stream.close()
```
Moreover if I `rm` the file on google drive, it frees disk space on google colab. | Hi guys, I run this on my Colab (PRO):
```python
from datasets import load_dataset
dataset = load_dataset('text', data_files='/content/corpus.txt', cache_dir='/content/drive/My Drive', split='train')
def encode(examples):
return tokenizer(examples['text'], truncation=True, padding='max_length')
dataset = dataset.map(encode, batched=True)
```
The file is about 4 GB, so I cannot process it on the Colab HD because there is no enough space. So I decided to mount my Google Drive fs and do it on it.
The dataset is cached in the right place but by processing it (applying `encode` function) seems to use a different folder because Colab HD starts to grow and it crashes when it should be done in the Drive fs.
What gets me crazy, it prints it is processing/encoding the dataset in the right folder:
```
Testing the mapped function outputs
Testing finished, running the mapping function on the dataset
Caching processed dataset at /content/drive/My Drive/text/default-ad3e69d6242ee916/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/cache-b16341780a59747d.arrow
``` | 74 | Caching processed dataset at wrong folder
Hi guys, I run this on my Colab (PRO):
```python
from datasets import load_dataset
dataset = load_dataset('text', data_files='/content/corpus.txt', cache_dir='/content/drive/My Drive', split='train')
def encode(examples):
return tokenizer(examples['text'], truncation=True, padding='max_length')
dataset = dataset.map(encode, batched=True)
```
The file is about 4 GB, so I cannot process it on the Colab HD because there is no enough space. So I decided to mount my Google Drive fs and do it on it.
The dataset is cached in the right place but by processing it (applying `encode` function) seems to use a different folder because Colab HD starts to grow and it crashes when it should be done in the Drive fs.
What gets me crazy, it prints it is processing/encoding the dataset in the right folder:
```
Testing the mapped function outputs
Testing finished, running the mapping function on the dataset
Caching processed dataset at /content/drive/My Drive/text/default-ad3e69d6242ee916/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/cache-b16341780a59747d.arrow
```
It looks like a pyarrow issue with google colab.
For some reason this code increases the disk usage of google colab while it actually writes into google drive:
```python
import pyarrow as pa
stream = pa.OSFile("/content/drive/My Drive/path/to/file.arrow", "wb")
writer = pa.RecordBatchStreamWriter(stream, schema=pa.schema({"text": pa.string()}))
writer.write_table(pa.Table.from_pydict({"text": ["a"*511 + "\n"] * ((1 << 30) // 512)})) # 1GiB
writer.close()
stream.close()
```
Moreover if I `rm` the file on google drive, it frees disk space on google colab. | [
0.02142048254609108,
0.25080978870391846,
-0.004486246034502983,
0.40462225675582886,
-0.05932916700839996,
-0.0976661741733551,
0.3005954623222351,
0.00513562373816967,
-0.21525894105434418,
0.12719640135765076,
-0.045128993690013885,
0.3386109173297882,
0.10689106583595276,
0.2934121787548065,
0.06055589020252228,
0.22359098494052887,
0.291343092918396,
-0.008043646812438965,
0.11098997294902802,
-0.010150264948606491,
-0.2467476725578308,
0.3662288188934326,
-0.20087948441505432,
-0.031370893120765686,
-0.47766515612602234,
-0.06887762993574142,
-0.07052590698003769,
-0.13167816400527954,
-0.03252317011356354,
0.10941243171691895,
0.18375462293624878,
0.0785788893699646,
0.15011301636695862,
0.5543878674507141,
-0.00012748427980113775,
-0.20145265758037567,
0.23198767006397247,
-0.16464266180992126,
-0.1672949194908142,
0.09523670375347137,
-0.0660739466547966,
-0.015847831964492798,
0.0897296592593193,
-0.0740429013967514,
-0.047713421285152435,
0.036730170249938965,
0.26212039589881897,
-0.15351209044456482,
-0.022563591599464417,
0.16203171014785767,
0.054975688457489014,
-0.31916889548301697,
-0.38508090376853943,
0.4330039918422699,
0.39033612608909607,
0.2227914184331894,
-0.17583949863910675,
0.5310472846031189,
0.0761607438325882,
-0.18302105367183685,
-0.3298392593860626,
0.26407524943351746,
-0.12644056975841522,
0.11067847907543182,
0.3017996847629547,
0.459848016500473,
-0.2333257496356964,
-0.15052065253257751,
0.4259735941886902,
-0.4988749623298645,
0.3272492587566376,
-0.5334559082984924,
-0.0028969012200832367,
-0.30412012338638306,
-0.290557861328125,
-0.36091986298561096,
0.5149069428443909,
0.27989426255226135,
-0.24086865782737732,
0.03735779598355293,
-0.38955503702163696,
-0.12541259825229645,
0.008492603898048401,
0.0503372848033905,
-0.18002581596374512,
0.17110119760036469,
-0.12236768007278442,
0.05162215977907181,
0.028798341751098633,
0.3116212487220764,
0.7678453326225281,
-0.36481696367263794,
0.0661572515964508,
0.1391305923461914,
-0.07347962260246277,
0.18149088323116302,
-0.1290125846862793,
0.5854721665382385,
-0.1312907338142395,
-0.13408778607845306,
-0.1266850382089615,
-0.15304484963417053,
0.0074449265375733376,
0.17375758290290833,
0.1315622180700302,
0.34848707914352417,
-0.21328061819076538,
0.04258503392338753,
0.04282975569367409,
0.052900735288858414,
-0.3369435966014862,
-0.07823169231414795,
0.03169722855091095,
-0.264461487531662,
0.19536824524402618,
-0.07787254452705383,
0.023122575134038925,
-0.2491859495639801,
-0.16892403364181519,
-0.21164479851722717,
-0.3935556411743164,
-0.0601106695830822,
-0.06102849915623665,
0.20244905352592468,
-0.022812623530626297,
-0.2642132341861725,
-0.26387345790863037,
0.28940069675445557,
-0.27681201696395874,
0.35750409960746765,
-0.0012719044461846352,
0.06000172719359398,
-0.2810417413711548,
0.5400333404541016,
0.15487366914749146,
-0.17990103363990784,
0.020317817106842995,
0.14104454219341278,
-0.043112821877002716,
-0.23542159795761108,
-0.08903486281633377,
-0.47103241086006165,
0.28956976532936096,
0.19141986966133118,
0.18920263648033142,
0.31326812505722046,
-0.178536519408226,
-0.24738432466983795,
-0.16250503063201904,
0.4494556784629822,
-0.5062212944030762,
-0.312324196100235,
0.17992910742759705,
-0.02528747171163559,
-0.29935121536254883,
-0.06709010154008865,
-0.7675718665122986,
0.13218197226524353,
0.4474858045578003,
-0.2971971333026886,
0.03093024343252182,
-0.09656092524528503,
-0.4285759925842285,
-0.3032741844654083,
0.014989295974373817,
0.14524124562740326,
-0.3597572445869446,
0.06038130819797516,
-0.1958557665348053,
0.40153709053993225,
0.48472508788108826,
0.47464096546173096,
-0.024226782843470573,
0.35472920536994934,
-0.430255264043808,
0.021374426782131195,
-0.010669209063053131,
-0.15673987567424774,
-0.8236620426177979,
0.1317308098077774,
-0.13239237666130066,
0.06958679854869843,
0.10815119743347168,
0.005556903779506683,
0.15888838469982147,
-0.06549849361181259,
0.22463656961917877,
0.20693166553974152,
0.07378343492746353,
0.2635887563228607,
-0.37587347626686096,
-0.18323950469493866,
-0.015857677906751633,
-0.05943995714187622,
-0.03874768689274788,
0.020846135914325714,
0.00706876814365387,
-0.4193621277809143,
0.23586636781692505,
-0.15875692665576935,
0.1791307032108307,
0.23955942690372467,
0.3115638494491577,
-0.22373192012310028,
0.008697887882590294,
0.22105377912521362,
-0.2592788338661194,
0.05652349442243576,
-0.08452378213405609,
-0.18529260158538818,
-0.6225892901420593,
-0.1273643672466278,
-0.17772528529167175,
-0.06606385111808777,
-0.10207569599151611,
-0.19240659475326538,
-0.09817784279584885,
0.23569126427173615,
0.17943120002746582,
0.07739080488681793,
0.1373388171195984,
0.33018290996551514,
0.18369658291339874,
-0.11906298249959946,
0.026947345584630966,
0.3751266896724701,
-0.15675166249275208,
-0.3961030840873718,
-0.07029902935028076,
-0.14272940158843994,
0.20495939254760742,
-0.15967059135437012,
-0.045209433883428574,
0.0729755312204361,
0.1840246021747589,
0.4450160264968872,
-0.0777897760272026,
0.28582054376602173,
0.13169826567173004,
0.021611090749502182,
0.17327114939689636,
-0.08940491080284119,
0.013826972804963589,
0.037589386105537415,
-0.036116354167461395,
0.3025760352611542,
-0.014247540384531021,
0.13366484642028809,
-0.1301427185535431,
-0.348551869392395,
-0.13776321709156036,
0.049012478440999985,
0.34286606311798096,
0.08567444980144501,
0.0891672745347023,
0.5186514854431152,
0.42370468378067017,
0.2823851406574249,
0.1714913696050644,
0.3646705150604248,
0.6328814029693604,
-0.00508870929479599,
-0.054119326174259186,
0.25750476121902466,
-0.22851970791816711,
-0.36353006958961487,
0.2713562250137329,
0.29311972856521606,
0.4082561135292053,
-0.01396236103028059,
0.19795003533363342,
0.18319882452487946,
0.10566756129264832,
-0.2301926165819168,
0.2001953274011612,
0.13378292322158813,
0.26390010118484497,
-0.015043579041957855,
0.3801981806755066,
-0.12439972907304764,
-0.15187135338783264,
0.19235259294509888,
0.06030374765396118,
0.1992248147726059,
-0.20930297672748566,
0.5275092720985413,
-0.17338846623897552,
-0.20813968777656555,
-0.27647191286087036,
-0.200517475605011,
0.045170724391937256,
-0.14977023005485535,
-0.06261389702558517,
0.4318827688694,
0.0306839756667614,
-0.048645153641700745,
0.3401044011116028,
0.1422448754310608,
-0.16213351488113403,
-0.5259189009666443,
-0.1383046656847,
-0.02201319858431816,
-0.3286527097225189,
-0.07749484479427338,
0.402700275182724,
-0.04410051926970482,
0.07715378701686859,
-0.13842089474201202,
0.08845902979373932,
-0.3343406617641449,
-0.12146982550621033,
0.27408361434936523,
-0.1896560788154602,
0.3587256073951721,
-0.35141295194625854,
-0.11154529452323914,
-0.4793855547904968,
-0.3280753493309021,
-0.10174775868654251,
-0.06174001842737198,
-0.11428109556436539,
-0.3009617328643799,
-0.057871267199516296,
0.0006671521696262062,
-0.07716628164052963,
0.07415436208248138,
-0.13013657927513123,
0.020014241337776184,
0.19324378669261932,
-0.006830984726548195,
0.38064831495285034,
-0.005065097473561764,
-0.04323650896549225,
-0.13888387382030487,
0.3479844927787781,
-0.3142755925655365,
-0.24783168733119965,
-0.4356372654438019,
0.28980323672294617,
-0.009841828607022762,
-0.05521625652909279,
-0.04590301960706711,
-0.15164758265018463,
-0.042331475764513016,
0.4133681654930115,
-0.5115941762924194,
-0.3616773784160614,
-0.12397025525569916,
0.2218838930130005,
0.1521575003862381,
-0.11067372560501099,
0.26702773571014404,
0.13213880360126495,
0.17917735874652863,
0.08476162701845169,
-0.47116023302078247,
-0.10828617960214615,
0.30994781851768494,
0.23492825031280518,
0.025339588522911072,
0.006628435105085373,
0.02641742303967476,
0.6789852976799011,
-0.019874949008226395,
0.09686876833438873,
0.502528190612793,
-0.07394386827945709,
0.20428624749183655,
-0.19574430584907532,
-0.014086595736443996,
0.1454431116580963,
-0.1160622239112854,
-0.639432966709137,
0.36948853731155396,
0.08485689759254456,
-0.4844219982624054,
0.2561871111392975,
-0.2750028371810913,
-0.2847714424133301,
-0.30844348669052124,
0.28344810009002686,
0.23775914311408997,
0.18736104667186737,
0.062341753393411636,
0.037747107446193695,
-0.16573572158813477,
-0.32956045866012573,
0.04549211263656616,
-0.05430290102958679,
0.21755069494247437,
0.08982879668474197,
0.3859019875526428,
-0.413476824760437,
-0.49098342657089233,
0.22059810161590576,
0.3826884925365448,
-0.1792142242193222,
0.034378599375486374,
0.22285139560699463,
0.36231786012649536,
-0.24912984669208527,
0.5580064654350281,
-0.06940482556819916,
-0.13392898440361023,
-0.14628800749778748,
0.16648666560649872,
-0.13333949446678162,
-0.04571118950843811,
-0.06754934042692184,
0.26044973731040955,
-0.01633569970726967,
0.3377733826637268,
0.17283520102500916,
0.0868891179561615,
-0.08430331945419312,
0.33915022015571594,
-0.2835310697555542,
-0.08677255362272263,
-0.19644105434417725,
-0.7121967077255249,
-0.07806683331727982,
0.05880351737141609,
0.1275707185268402,
0.09806884080171585,
0.041875824332237244,
0.17319244146347046,
0.2353617548942566,
-0.012408599257469177,
0.05767171084880829,
0.1508387327194214,
0.5057435035705566,
0.04892214015126228,
-0.12494093179702759,
-0.0064021386206150055,
0.05242970213294029,
0.468328058719635,
0.4879968464374542,
0.3116283714771271,
0.2212161272764206,
0.151951402425766,
-0.1782701313495636,
0.23900845646858215,
0.2694666385650635,
-0.10863099247217178,
-0.10663140565156937,
-0.2813800871372223,
-0.06302084028720856,
-0.2542044222354889,
0.1934586614370346,
0.11442448943853378,
0.24293768405914307,
-0.25236448645591736,
-0.2127581387758255,
0.5412887930870056,
0.18124833703041077,
-0.32037025690078735,
0.16571757197380066,
0.07982482761144638,
-0.50040602684021,
0.4107102155685425,
0.1969546377658844,
1.030381202697754,
-0.047158874571323395,
0.30193036794662476,
0.30874472856521606,
-0.16687625646591187,
-0.11743244528770447,
-0.2488429993391037,
0.30392980575561523,
-0.22091008722782135,
-0.5396698713302612,
-0.01102655753493309,
-0.24752788245677948,
-0.19057008624076843,
-0.018833346664905548,
-0.2668169438838959,
0.3062218725681305,
-0.04383097589015961,
0.05094536393880844,
-0.0009033083915710449,
-0.12111858278512955,
0.04585426300764084,
-0.132874995470047,
-0.26345694065093994,
-0.02138863317668438,
-0.08802816271781921,
0.25984975695610046,
-0.13320159912109375,
0.13819049298763275,
-0.1858518123626709,
0.016106322407722473,
-0.16804587841033936,
-0.01602260023355484,
-0.4394676983356476,
-0.07213038206100464,
-0.2420896589756012,
-0.3970455527305603,
-0.145439013838768,
0.2823376953601837,
0.23000124096870422,
-0.01478290930390358,
0.07041747123003006,
0.0020572394132614136,
0.12754438817501068,
0.2864452600479126,
0.08461834490299225,
-0.42606914043426514,
-0.14459137618541718,
0.022675547748804092,
0.033943839371204376,
-0.27288156747817993,
0.10012103617191315,
-0.35971564054489136,
-0.13636712729930878,
0.20269103348255157,
-0.16268400847911835,
0.029470978304743767,
-0.0940956324338913,
-0.11335089802742004,
-0.055096935480833054,
0.06607823073863983,
0.00950684305280447,
-0.046366192400455475,
0.26391834020614624,
0.46375009417533875,
-0.4630715548992157,
-0.3630079925060272,
-0.1878153532743454,
0.2531951069831848,
0.4450024366378784,
0.21451249718666077,
0.5582185983657837,
-0.20285587012767792,
-0.2048254907131195,
0.05769979953765869,
-0.13677629828453064,
-0.22378189861774445,
0.1204758957028389,
0.13265253603458405,
-0.3732176125049591,
0.051184237003326416,
-0.17872771620750427,
0.06843309849500656,
0.2830268144607544,
-0.034684307873249054,
-0.4491626024246216,
-0.15573367476463318,
-0.38188135623931885,
0.047159984707832336,
0.1669679433107376,
-0.08748418092727661,
0.1780773401260376,
0.15507476031780243,
0.22161924839019775,
-0.09530200809240341,
-0.14564433693885803,
0.20070786774158478,
0.0055036600679159164,
0.24326768517494202,
0.017268141731619835,
-0.11233816295862198,
0.4713476598262787,
-0.19187046587467194,
-0.11798819154500961,
0.11681574583053589,
0.15496240556240082,
-0.11699662357568741,
-0.015345844440162182,
0.18272243440151215,
0.10440298169851303,
-0.10240180045366287,
-0.12492844462394714,
-0.10016748309135437,
0.2199307233095169,
-0.40583038330078125,
0.32531943917274475,
0.2486816644668579,
0.11820964515209198,
-0.2841392755508423,
0.26526588201522827,
-0.09521771222352982,
-0.11225150525569916,
-0.1452149599790573,
-0.17684748768806458,
0.3615037798881531,
0.20945695042610168,
0.21118101477622986,
0.25805845856666565,
0.09754142165184021,
0.08068563044071198,
-0.001296013593673706,
0.27641743421554565,
0.30492961406707764,
0.027261193841695786,
-0.22699622809886932,
-0.16707929968833923,
-0.18343257904052734,
0.03024768829345703,
0.12252236902713776,
-0.00357231916859746,
-0.49580416083335876,
0.3037509024143219,
0.004100935533642769,
0.15449158847332,
-0.12035461515188217,
0.17048829793930054,
-0.2577298879623413,
-0.1299336552619934,
0.45284757018089294,
0.21150752902030945,
0.13995446264743805,
-0.029839031398296356,
-0.0397716760635376,
0.5303691029548645,
0.0392148494720459,
-0.10854446887969971,
-0.15346120297908783,
0.030916105955839157,
0.40098971128463745,
0.4879714846611023,
0.10873201489448547,
0.0028848424553871155,
0.24441777169704437,
0.017258256673812866,
0.08390755951404572,
0.21103259921073914,
-0.09052276611328125,
-0.038835786283016205,
-0.1549651324748993,
-0.14607474207878113,
0.22404220700263977,
-0.01101367175579071,
0.1774437576532364,
0.2570496201515198,
0.15775719285011292,
-0.10782206058502197,
-0.05954120680689812,
-0.18871159851551056,
0.27016520500183105,
-0.2121593952178955,
-0.29042670130729675,
0.2382967174053192,
-0.14848823845386505,
0.0976768434047699,
0.47623708844184875,
-0.21125459671020508,
-0.2921561598777771,
0.32269904017448425,
0.20243698358535767,
-0.2835075259208679,
0.23900412023067474,
0.15347927808761597,
0.19420090317726135,
0.16752660274505615,
0.009842976927757263,
0.5851384997367859,
-0.4067665934562683,
0.034578777849674225,
-0.18982119858264923,
0.14898186922073364,
0.4157557487487793,
0.33116254210472107,
-0.2545660138130188,
-0.29144251346588135,
0.09245520830154419,
0.12788516283035278,
-0.13094490766525269,
0.13305264711380005,
-0.017601430416107178,
0.2327793389558792,
0.00033439137041568756,
0.049342818558216095,
-0.045565564185380936,
0.16885921359062195,
0.24122709035873413,
0.1468367725610733,
0.18487544357776642,
-0.014840379357337952,
-0.18733832240104675,
-0.07141561061143875,
-0.025514930486679077,
-0.06181716173887253,
-0.24940955638885498,
0.159664586186409,
0.24076908826828003,
-0.2312215119600296,
0.301277220249176,
0.31046953797340393,
-0.010210269130766392,
0.1933280974626541,
0.5336734652519226,
0.36856526136398315,
0.3064679205417633,
-0.38566142320632935,
-0.12429670244455338,
-0.2901502251625061,
0.37730246782302856,
-0.20153838396072388,
0.12561871111392975,
-0.3924019932746887,
0.15160530805587769,
-0.1680918037891388,
0.027775749564170837,
-0.053737059235572815,
0.31088224053382874,
-0.19917620718479156,
0.036818839609622955,
-0.3342725336551666,
-0.0064270272850990295,
-0.013486050069332123,
-0.17229707539081573,
-0.14040565490722656,
-0.4480999708175659,
0.38331326842308044,
-0.22762233018875122,
0.05772240459918976,
0.003216410055756569,
0.06265895068645477,
-0.17173394560813904,
0.051243074238300323,
0.5267399549484253,
0.15378496050834656,
0.16209174692630768,
-0.1921783685684204,
0.058952659368515015,
-0.2873106598854065,
-0.01656997762620449,
-0.32120832800865173,
0.006009787321090698,
-0.08351266384124756,
0.2568943500518799,
-0.21648727357387543,
0.07526784390211105,
-0.31692010164260864,
0.3819309175014496,
0.2212304025888443,
0.03620597720146179,
0.37124499678611755,
-0.11406216025352478,
-0.16972707211971283,
0.04519451782107353,
-0.11739695072174072,
0.34689950942993164,
0.057016726583242416,
0.23563458025455475,
-0.40450650453567505,
-0.09702529013156891,
0.22555536031723022,
-0.4353237748146057,
-0.48239418864250183,
0.48286741971969604,
0.10746797174215317,
0.29922622442245483,
-0.20779576897621155,
-0.2479833960533142,
0.01598820835351944,
0.13340114057064056,
-0.17620941996574402,
-0.2149592638015747,
0.14185470342636108,
-0.07390095293521881,
0.09046012163162231,
-0.024156061932444572,
0.2754199504852295,
0.060807086527347565,
-0.4763146638870239,
-0.19218766689300537,
-0.30002206563949585
] |
https://github.com/huggingface/datasets/issues/643 | Caching processed dataset at wrong folder | Actually I did more tests it doesn't >.<
I'll let you know if I find a way to fix that | Hi guys, I run this on my Colab (PRO):
```python
from datasets import load_dataset
dataset = load_dataset('text', data_files='/content/corpus.txt', cache_dir='/content/drive/My Drive', split='train')
def encode(examples):
return tokenizer(examples['text'], truncation=True, padding='max_length')
dataset = dataset.map(encode, batched=True)
```
The file is about 4 GB, so I cannot process it on the Colab HD because there is no enough space. So I decided to mount my Google Drive fs and do it on it.
The dataset is cached in the right place but by processing it (applying `encode` function) seems to use a different folder because Colab HD starts to grow and it crashes when it should be done in the Drive fs.
What gets me crazy, it prints it is processing/encoding the dataset in the right folder:
```
Testing the mapped function outputs
Testing finished, running the mapping function on the dataset
Caching processed dataset at /content/drive/My Drive/text/default-ad3e69d6242ee916/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/cache-b16341780a59747d.arrow
``` | 20 | Caching processed dataset at wrong folder
Hi guys, I run this on my Colab (PRO):
```python
from datasets import load_dataset
dataset = load_dataset('text', data_files='/content/corpus.txt', cache_dir='/content/drive/My Drive', split='train')
def encode(examples):
return tokenizer(examples['text'], truncation=True, padding='max_length')
dataset = dataset.map(encode, batched=True)
```
The file is about 4 GB, so I cannot process it on the Colab HD because there is no enough space. So I decided to mount my Google Drive fs and do it on it.
The dataset is cached in the right place but by processing it (applying `encode` function) seems to use a different folder because Colab HD starts to grow and it crashes when it should be done in the Drive fs.
What gets me crazy, it prints it is processing/encoding the dataset in the right folder:
```
Testing the mapped function outputs
Testing finished, running the mapping function on the dataset
Caching processed dataset at /content/drive/My Drive/text/default-ad3e69d6242ee916/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/cache-b16341780a59747d.arrow
```
Actually I did more tests it doesn't >.<
I'll let you know if I find a way to fix that | [
-0.10019710659980774,
0.1869409680366516,
-0.01998027041554451,
0.458135724067688,
-0.0414949506521225,
-0.03286110982298851,
0.31075140833854675,
0.013784307986497879,
0.006922680884599686,
0.19623681902885437,
0.015261035412549973,
0.2812226712703705,
0.053010083734989166,
0.44532105326652527,
-0.0918106660246849,
0.3288269639015198,
0.2770383954048157,
-0.07167378067970276,
0.042229317128658295,
-0.08333079516887665,
-0.36452940106391907,
0.3949059844017029,
-0.22267013788223267,
-0.02973620593547821,
-0.4760727286338806,
-0.1265689879655838,
-0.1334369033575058,
-0.059912554919719696,
-0.027534956112504005,
0.2656662166118622,
0.2077787071466446,
0.017254168167710304,
0.19594156742095947,
0.6396953463554382,
-0.00012908133794553578,
-0.15408527851104736,
0.21326901018619537,
-0.2452562153339386,
-0.15935039520263672,
-0.11468513309955597,
-0.2909758985042572,
0.010528173297643661,
-0.10921446233987808,
-0.05793317034840584,
-0.2169557809829712,
0.12249390780925751,
0.2166626751422882,
-0.532535970211029,
-0.010078676044940948,
0.2681659758090973,
0.06409464031457901,
-0.47394946217536926,
-0.4806690812110901,
0.3833519220352173,
0.05876760929822922,
0.24376316368579865,
-0.1412622034549713,
0.2848825454711914,
-0.01537882536649704,
-0.11636479943990707,
-0.08424968272447586,
0.29582127928733826,
-0.06959179043769836,
0.012816016562283039,
0.23059281706809998,
0.3311595916748047,
-0.30487847328186035,
-0.30385246872901917,
0.533562421798706,
-0.440862774848938,
0.34669229388237,
-0.35410815477371216,
-0.1448860913515091,
-0.26512768864631653,
-0.3225085735321045,
-0.354112833738327,
0.5375029444694519,
0.13830718398094177,
-0.11072811484336853,
0.0715746283531189,
-0.4810947775840759,
-0.23269057273864746,
0.06565935909748077,
0.0965537577867508,
-0.19041043519973755,
0.31480181217193604,
-0.26143333315849304,
0.034551169723272324,
-0.038721051067113876,
0.23438075184822083,
0.6895992159843445,
-0.36777353286743164,
-0.01953095570206642,
0.19275976717472076,
-0.12136112153530121,
0.057378143072128296,
-0.2128067910671234,
0.5516889095306396,
-0.21210694313049316,
-0.1210528016090393,
-0.2416573315858841,
-0.11899695545434952,
-0.12520429491996765,
0.0866352915763855,
0.05049116909503937,
0.4452635943889618,
-0.033296018838882446,
0.13302627205848694,
0.08180450648069382,
0.03958848863840103,
-0.5268155932426453,
-0.08456537872552872,
-0.02715151757001877,
-0.2695401906967163,
-0.00424753874540329,
0.12879140675067902,
-0.03699379414319992,
-0.2902013957500458,
-0.09931975603103638,
-0.04602088779211044,
-0.312728613615036,
-0.013800282031297684,
0.095496766269207,
0.31461018323898315,
-0.04344242066144943,
-0.10356902331113815,
-0.2572101056575775,
0.24543128907680511,
-0.19695046544075012,
0.34186986088752747,
-0.08037428557872772,
0.020740246400237083,
-0.345539927482605,
0.4818636178970337,
0.0642976313829422,
-0.2464161515235901,
0.1298305243253708,
0.03639944642782211,
-0.010365135967731476,
-0.32841596007347107,
-0.058350011706352234,
-0.44854071736335754,
0.3813800811767578,
0.14369605481624603,
0.14532777667045593,
0.4247840344905853,
0.0019369274377822876,
-0.219582200050354,
-0.13116449117660522,
0.23652318120002747,
-0.6200780868530273,
-0.25339770317077637,
0.16883136332035065,
-0.03210381045937538,
-0.2495458573102951,
-0.06734612584114075,
-0.6999959945678711,
0.12243033945560455,
0.47702816128730774,
-0.20505644381046295,
-0.008038148283958435,
-0.0043335482478141785,
-0.49354684352874756,
-0.24478216469287872,
0.05729381740093231,
0.12440820038318634,
-0.2343386709690094,
0.17920400202274323,
-0.36341553926467896,
0.4979803264141083,
0.5139265656471252,
0.3871520459651947,
0.0752895176410675,
0.2675049304962158,
-0.49604135751724243,
-0.04134082421660423,
0.109333835542202,
-0.28991276025772095,
-0.8469175696372986,
0.3187880516052246,
-0.04235157370567322,
-0.012807204388082027,
0.005616404116153717,
-0.025561390444636345,
0.21973830461502075,
-0.08949436992406845,
0.17821785807609558,
0.15923894941806793,
0.09488389641046524,
0.21197746694087982,
-0.2583330571651459,
-0.14644135534763336,
-0.052018746733665466,
-0.14985017478466034,
0.030135953798890114,
0.2176421880722046,
-0.0006993785500526428,
-0.37061718106269836,
0.150919109582901,
-0.11751717329025269,
0.12936292588710785,
0.25620412826538086,
0.25774696469306946,
-0.1585952341556549,
0.000006780726835131645,
0.13453766703605652,
-0.20219656825065613,
0.1305844485759735,
0.009378891438245773,
-0.16633953154087067,
-0.5060366988182068,
-0.06810970604419708,
-0.12669453024864197,
-0.16416096687316895,
-0.14280655980110168,
-0.22283753752708435,
-0.08746984601020813,
0.3029133081436157,
0.12670022249221802,
0.05501661077141762,
-0.021477699279785156,
0.5375718474388123,
0.1039922833442688,
-0.1637994796037674,
-0.031033743172883987,
0.22711913287639618,
-0.10921952873468399,
-0.22415375709533691,
-0.13674747943878174,
-0.17256617546081543,
0.2570611834526062,
-0.21235552430152893,
-0.20307427644729614,
0.1432764232158661,
0.2454458475112915,
0.4036563038825989,
-0.03177715092897415,
0.2653977870941162,
0.09254870563745499,
0.041397351771593094,
0.16716253757476807,
-0.07847200334072113,
-0.031306441873311996,
0.15565615892410278,
-0.000980764627456665,
0.2876312732696533,
-0.09895028173923492,
0.18514806032180786,
-0.09197628498077393,
-0.2702074646949768,
-0.04421336203813553,
0.08200626075267792,
0.2814541161060333,
-0.14405260980129242,
0.09229681640863419,
0.3347589373588562,
0.3947921395301819,
0.2348683476448059,
0.23493248224258423,
0.33714866638183594,
0.6447885036468506,
0.11911530792713165,
-0.017149947583675385,
0.16718974709510803,
-0.13172301650047302,
-0.24941903352737427,
0.25483667850494385,
0.49528148770332336,
0.42300617694854736,
-0.10293827205896378,
0.2637452185153961,
0.20363794267177582,
0.08372346311807632,
-0.15127505362033844,
0.1671997606754303,
0.060197584331035614,
0.3180696368217468,
0.00765097513794899,
0.2109297662973404,
-0.06495367735624313,
-0.05526592954993248,
0.19154195487499237,
0.06583951413631439,
0.255520224571228,
-0.12847848236560822,
0.5481224060058594,
-0.30725976824760437,
-0.25642529129981995,
-0.24134069681167603,
-0.27609506249427795,
0.07815477252006531,
-0.16026797890663147,
-0.11822909116744995,
0.33699941635131836,
0.0332641564309597,
0.05068109184503555,
0.23718273639678955,
0.19760309159755707,
-0.1381632387638092,
-0.46970173716545105,
-0.14373596012592316,
0.15273770689964294,
-0.24541103839874268,
-0.11331567168235779,
0.3678135871887207,
-0.05697888135910034,
0.024177752435207367,
-0.18594661355018616,
0.02272183448076248,
-0.3783480226993561,
-0.09861854463815689,
0.26978373527526855,
-0.11955802142620087,
0.29590561985969543,
-0.2688418924808502,
0.018858663737773895,
-0.42180436849594116,
-0.3589332103729248,
-0.08004536479711533,
-0.03467973694205284,
-0.07876849174499512,
-0.40269553661346436,
-0.033261217176914215,
-0.02690017782151699,
-0.08116519451141357,
0.003207489848136902,
-0.16453124582767487,
-0.03340018168091774,
0.0611831471323967,
0.00832555815577507,
0.30514734983444214,
-0.04505786672234535,
-0.0811835527420044,
-0.2303549200296402,
0.37232664227485657,
-0.31750527024269104,
-0.36634600162506104,
-0.6225439310073853,
0.24930405616760254,
-0.12686720490455627,
-0.03618400916457176,
-0.03113720193505287,
-0.08763530105352402,
0.12133601307868958,
0.37396156787872314,
-0.45661914348602295,
-0.25310373306274414,
-0.1389433741569519,
-0.0384317971765995,
0.20747990906238556,
-0.0992780476808548,
0.2927907109260559,
0.0628475695848465,
0.22102585434913635,
-0.013477131724357605,
-0.42799434065818787,
0.021627135574817657,
0.3045812249183655,
0.38204240798950195,
0.07782390713691711,
0.25608691573143005,
0.03970801457762718,
0.6177144646644592,
0.2947864532470703,
-0.008836623281240463,
0.4568139612674713,
-0.03529650717973709,
0.2197226732969284,
-0.22867247462272644,
-0.15132400393486023,
0.26615869998931885,
0.05037114769220352,
-0.6271564364433289,
0.397325336933136,
0.10809335857629776,
-0.43475088477134705,
0.14372391998767853,
-0.2814537286758423,
-0.32600581645965576,
-0.22516043484210968,
0.2219088226556778,
-0.0011853352189064026,
0.2085200548171997,
0.06639441847801208,
0.14016491174697876,
-0.21652139723300934,
-0.24714741110801697,
0.1060161292552948,
0.044922295957803726,
0.2869085371494293,
0.1469973921775818,
0.2787698805332184,
-0.4967869520187378,
-0.37904566526412964,
0.3464755415916443,
0.3606937527656555,
0.0563131682574749,
-0.06475360691547394,
0.3000009059906006,
0.17423361539840698,
-0.12405215948820114,
0.5816717743873596,
-0.3319547474384308,
-0.18783627450466156,
-0.18803422152996063,
0.024383924901485443,
0.019396113231778145,
0.0048051998019218445,
0.1159655749797821,
0.39860498905181885,
-0.05560988560318947,
0.4732910394668579,
0.32174167037010193,
0.01590675115585327,
-0.12497086822986603,
0.19985507428646088,
-0.34492358565330505,
-0.14828050136566162,
-0.19743503630161285,
-0.5270224213600159,
-0.20299234986305237,
-0.004955396056175232,
0.1355160027742386,
-0.01283620297908783,
0.07481492310762405,
-0.014131415635347366,
0.11475872248411179,
-0.08787473291158676,
0.06752663850784302,
0.1530640721321106,
0.4317629337310791,
0.1444837898015976,
-0.10859254002571106,
0.09387361258268356,
0.2191275656223297,
0.3815646767616272,
0.5146511793136597,
0.18172681331634521,
0.16136369109153748,
0.17988896369934082,
-0.1523648053407669,
0.3045819103717804,
0.31953176856040955,
-0.18026143312454224,
-0.210951030254364,
-0.0914967805147171,
-0.03810514509677887,
-0.3330705463886261,
0.3399733006954193,
0.1309186965227127,
0.3543568253517151,
-0.4325096309185028,
-0.42812636494636536,
0.46149390935897827,
0.1713367998600006,
-0.296661376953125,
0.3499470353126526,
0.04479902610182762,
-0.5196496248245239,
0.4166848659515381,
0.1613180935382843,
1.1192386150360107,
0.006420794874429703,
0.14921043813228607,
0.05635154992341995,
0.08638980984687805,
-0.022403407841920853,
-0.3167370557785034,
0.22546710073947906,
-0.18972766399383545,
-0.6439608335494995,
-0.09536070376634598,
-0.16862741112709045,
-0.20845097303390503,
0.0929967612028122,
-0.1833427995443344,
0.42816072702407837,
0.013186648488044739,
-0.06844523549079895,
-0.10664937645196915,
-0.08828292042016983,
-0.02911962755024433,
-0.16448251903057098,
-0.24939167499542236,
0.023403801023960114,
-0.06696425378322601,
0.4125226140022278,
-0.1377210021018982,
0.18277227878570557,
-0.15452636778354645,
0.05879589915275574,
-0.1939365714788437,
-0.05226470157504082,
-0.39535272121429443,
-0.022839263081550598,
-0.35586559772491455,
-0.2806161046028137,
-0.12237250804901123,
0.343216210603714,
0.5044693350791931,
0.2127479910850525,
0.010919925756752491,
0.006249193102121353,
0.12358763813972473,
0.2426980882883072,
0.033219385892152786,
-0.4295629858970642,
0.005099881440401077,
0.05304650962352753,
0.10054180771112442,
-0.30448830127716064,
0.1799134463071823,
-0.40501582622528076,
-0.028911910951137543,
0.05715273320674896,
-0.1012038141489029,
0.05129320174455643,
-0.22988274693489075,
0.008256703615188599,
-0.0810009315609932,
0.09299452602863312,
0.021213343366980553,
-0.015037670731544495,
0.26316043734550476,
0.4860740005970001,
-0.43865880370140076,
-0.40453284978866577,
-0.23673637211322784,
0.22744351625442505,
0.3079240322113037,
0.07213706523180008,
0.458825945854187,
-0.18148258328437805,
-0.21179793775081635,
0.021754398941993713,
0.008197285234928131,
-0.2481897473335266,
0.30987638235092163,
0.06897851824760437,
-0.4246731698513031,
-0.08323390781879425,
-0.143131822347641,
0.03464860841631889,
0.31592923402786255,
0.03403102606534958,
-0.4057690501213074,
-0.29755470156669617,
-0.39055296778678894,
0.03294987604022026,
-0.053981710225343704,
0.0018418654799461365,
0.05339086800813675,
0.14696674048900604,
0.17592881619930267,
-0.18087728321552277,
-0.15882667899131775,
0.14161503314971924,
-0.08573666960000992,
0.070746049284935,
0.055378541350364685,
0.0067404210567474365,
0.39654576778411865,
-0.1677691787481308,
-0.10596738755702972,
0.16167491674423218,
0.0639214962720871,
-0.08797350525856018,
-0.04327178746461868,
0.17179875075817108,
0.1972261667251587,
-0.062070757150650024,
-0.05268222838640213,
-0.2885946035385132,
0.04799040034413338,
-0.4657149314880371,
0.22358037531375885,
0.30481478571891785,
0.12559020519256592,
-0.14870823919773102,
0.20371201634407043,
-0.14391100406646729,
-0.07964031398296356,
-0.060464322566986084,
-0.1301432102918625,
0.3830965757369995,
0.15702365338802338,
0.22632236778736115,
0.2681726813316345,
0.0695643275976181,
-0.009363332763314247,
-0.07343610376119614,
0.21255263686180115,
0.39360111951828003,
0.1422574520111084,
-0.20259226858615875,
0.0021380074322223663,
-0.008406179957091808,
0.06430169939994812,
0.09221945703029633,
-0.0775454118847847,
-0.40968769788742065,
0.3800760805606842,
0.010046814568340778,
0.09699097275733948,
-0.07449467480182648,
0.08500340580940247,
-0.210076704621315,
-0.05631890147924423,
0.5034117698669434,
0.1240139752626419,
0.165340393781662,
0.03018850088119507,
0.009283693507313728,
0.5287914872169495,
-0.19849339127540588,
0.06445921957492828,
-0.22980660200119019,
0.029999617487192154,
0.5227380990982056,
0.4158554673194885,
0.09571315348148346,
-0.03639516979455948,
0.48895394802093506,
0.12388268113136292,
0.05488138645887375,
0.35118937492370605,
-0.039124999195337296,
0.048187341541051865,
-0.16361314058303833,
-0.09376125037670135,
0.15948769450187683,
-0.22399494051933289,
0.2865586280822754,
0.23153851926326752,
-0.03869497776031494,
-0.36127400398254395,
-0.06337866932153702,
-0.22792713344097137,
0.22801610827445984,
-0.19606995582580566,
-0.2139558047056198,
0.21102812886238098,
-0.11823572963476181,
0.11599674820899963,
0.3922675848007202,
-0.16134761273860931,
-0.2112935334444046,
0.18200689554214478,
0.16080325841903687,
-0.24903975427150726,
0.34549757838249207,
-0.011498134583234787,
0.13920101523399353,
0.17602722346782684,
0.06545655429363251,
0.7366921305656433,
-0.41530489921569824,
0.10581834614276886,
-0.11740818619728088,
0.1387728452682495,
0.24894775450229645,
0.42298924922943115,
-0.2619301974773407,
-0.19627276062965393,
0.17663098871707916,
0.0808219164609909,
-0.11009176820516586,
0.223932683467865,
-0.06680603325366974,
0.06562229245901108,
0.07449229061603546,
0.056740790605545044,
-0.018180949613451958,
0.19787359237670898,
0.13040505349636078,
0.23230576515197754,
0.2414749711751938,
0.19127237796783447,
-0.12686115503311157,
0.12683922052383423,
-0.15308153629302979,
0.03178749978542328,
-0.3571460247039795,
0.1267790049314499,
0.25892379879951477,
-0.2709529995918274,
0.36771315336227417,
0.3034544587135315,
-0.004808714613318443,
0.19693559408187866,
0.420200914144516,
0.3629053235054016,
0.3622792363166809,
-0.32034748792648315,
-0.2182140201330185,
-0.3224582374095917,
0.3802945017814636,
-0.006321653723716736,
0.20202992856502533,
-0.5194978713989258,
0.045750200748443604,
0.007902145385742188,
-0.021659724414348602,
0.03848215937614441,
0.17160086333751678,
-0.10970503836870193,
0.1593046337366104,
-0.3157356083393097,
-0.09870941936969757,
-0.11037808656692505,
-0.002516016364097595,
-0.10390521585941315,
-0.40724340081214905,
0.32307204604148865,
-0.11304876953363419,
0.027075141668319702,
0.03977934643626213,
0.0766296535730362,
-0.26202481985092163,
-0.11654102802276611,
0.45898666977882385,
0.21342124044895172,
0.14910346269607544,
-0.252342164516449,
0.0602661594748497,
-0.22608613967895508,
0.003875826485455036,
-0.3273197412490845,
0.011949349194765091,
0.009175939485430717,
0.3091532289981842,
-0.2791394889354706,
0.08068642020225525,
-0.40379199385643005,
0.07496648281812668,
0.25751793384552,
0.039462924003601074,
0.08473670482635498,
-0.07738946378231049,
-0.171328604221344,
0.02627897448837757,
0.09992055594921112,
0.5492198467254639,
0.0676572322845459,
0.24197997152805328,
-0.24680332839488983,
-0.022203806787729263,
0.2681180238723755,
-0.3252449035644531,
-0.5462806224822998,
0.3673076033592224,
0.08142057806253433,
0.23632434010505676,
-0.16523447632789612,
-0.240494966506958,
-0.026938654482364655,
0.12081781029701233,
-0.2052074372768402,
-0.10554154217243195,
0.02602226473391056,
0.03427065163850784,
0.15190425515174866,
-0.06298144906759262,
0.32290345430374146,
0.13106831908226013,
-0.39479774236679077,
-0.0453304722905159,
-0.23683026432991028
] |
https://github.com/huggingface/datasets/issues/643 | Caching processed dataset at wrong folder | Actually I also have the issue when writing a regular text file
```python
f = open("/content/drive/My Drive/path/to/file", "w")
f.write(("a"*511 + "\n") * ((1 << 30) // 512)) # 1GiB
f.close()
```
Is that supposed to happen ? | Hi guys, I run this on my Colab (PRO):
```python
from datasets import load_dataset
dataset = load_dataset('text', data_files='/content/corpus.txt', cache_dir='/content/drive/My Drive', split='train')
def encode(examples):
return tokenizer(examples['text'], truncation=True, padding='max_length')
dataset = dataset.map(encode, batched=True)
```
The file is about 4 GB, so I cannot process it on the Colab HD because there is no enough space. So I decided to mount my Google Drive fs and do it on it.
The dataset is cached in the right place but by processing it (applying `encode` function) seems to use a different folder because Colab HD starts to grow and it crashes when it should be done in the Drive fs.
What gets me crazy, it prints it is processing/encoding the dataset in the right folder:
```
Testing the mapped function outputs
Testing finished, running the mapping function on the dataset
Caching processed dataset at /content/drive/My Drive/text/default-ad3e69d6242ee916/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/cache-b16341780a59747d.arrow
``` | 37 | Caching processed dataset at wrong folder
Hi guys, I run this on my Colab (PRO):
```python
from datasets import load_dataset
dataset = load_dataset('text', data_files='/content/corpus.txt', cache_dir='/content/drive/My Drive', split='train')
def encode(examples):
return tokenizer(examples['text'], truncation=True, padding='max_length')
dataset = dataset.map(encode, batched=True)
```
The file is about 4 GB, so I cannot process it on the Colab HD because there is no enough space. So I decided to mount my Google Drive fs and do it on it.
The dataset is cached in the right place but by processing it (applying `encode` function) seems to use a different folder because Colab HD starts to grow and it crashes when it should be done in the Drive fs.
What gets me crazy, it prints it is processing/encoding the dataset in the right folder:
```
Testing the mapped function outputs
Testing finished, running the mapping function on the dataset
Caching processed dataset at /content/drive/My Drive/text/default-ad3e69d6242ee916/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/cache-b16341780a59747d.arrow
```
Actually I also have the issue when writing a regular text file
```python
f = open("/content/drive/My Drive/path/to/file", "w")
f.write(("a"*511 + "\n") * ((1 << 30) // 512)) # 1GiB
f.close()
```
Is that supposed to happen ? | [
-0.08096203207969666,
0.15093427896499634,
-0.004715915769338608,
0.4641733169555664,
-0.007445380091667175,
-0.0837901309132576,
0.37827709317207336,
-0.01606573536992073,
-0.012285307049751282,
0.15142349898815155,
0.022320633754134178,
0.2040354311466217,
0.12372218817472458,
0.45949265360832214,
-0.09322191774845123,
0.3096233904361725,
0.2900455892086029,
-0.07453674077987671,
0.05552467703819275,
-0.10317428410053253,
-0.35429704189300537,
0.3774949312210083,
-0.22020584344863892,
-0.008754916489124298,
-0.49590152502059937,
-0.19434508681297302,
-0.11987970024347305,
0.02711409330368042,
-0.007465166971087456,
0.297282338142395,
0.11814078688621521,
0.03256312385201454,
0.17042626440525055,
0.636683464050293,
-0.00012978423910681158,
-0.15086162090301514,
0.2038343995809555,
-0.22845347225666046,
-0.17012977600097656,
-0.13428066670894623,
-0.2650022506713867,
0.030045809224247932,
-0.05697324126958847,
-0.05058643966913223,
-0.13847175240516663,
0.15489107370376587,
0.2752763032913208,
-0.5360541939735413,
0.009406059980392456,
0.2767139971256256,
0.05800624191761017,
-0.4531145989894867,
-0.49367278814315796,
0.3889503479003906,
0.1365726888179779,
0.2704539895057678,
-0.181336909532547,
0.25282537937164307,
-0.01091686636209488,
-0.13031810522079468,
-0.07113990932703018,
0.278556764125824,
-0.08067271113395691,
0.01989995501935482,
0.2697371542453766,
0.42759326100349426,
-0.315277636051178,
-0.2621914744377136,
0.5415555238723755,
-0.4134801924228668,
0.36088889837265015,
-0.39020365476608276,
-0.2110203206539154,
-0.29570281505584717,
-0.33449816703796387,
-0.3674356937408447,
0.5965526700019836,
0.18027116358280182,
-0.13479623198509216,
0.04447676241397858,
-0.4733824133872986,
-0.2119872272014618,
0.08285938203334808,
0.1022462397813797,
-0.15765869617462158,
0.2304852306842804,
-0.2503766119480133,
0.0505877360701561,
-0.05162028595805168,
0.2697185277938843,
0.6813457608222961,
-0.4417133629322052,
-0.023760203272104263,
0.2037515938282013,
-0.09178702533245087,
0.09407778084278107,
-0.26437923312187195,
0.4885316491127014,
-0.2613621950149536,
-0.1318340301513672,
-0.18075965344905853,
-0.13165751099586487,
-0.14695769548416138,
0.1340813934803009,
0.10137096047401428,
0.3952640891075134,
-0.012355595827102661,
0.118258036673069,
0.1236557736992836,
0.015767710283398628,
-0.5297678709030151,
-0.10275851935148239,
-0.03626739978790283,
-0.2775633633136749,
0.006511706858873367,
0.05827071890234947,
-0.030673127621412277,
-0.29445773363113403,
-0.12284564226865768,
-0.05814097076654434,
-0.3343105614185333,
0.030598724260926247,
0.039150163531303406,
0.2700136601924896,
-0.02273460105061531,
-0.1497122049331665,
-0.20755305886268616,
0.238786980509758,
-0.23237484693527222,
0.39856281876564026,
-0.06609656661748886,
0.0024267546832561493,
-0.33749184012413025,
0.462607204914093,
0.03474729135632515,
-0.24264949560165405,
0.11732570827007294,
0.06567125022411346,
-0.02276398241519928,
-0.3494027853012085,
-0.03630686551332474,
-0.49178749322891235,
0.3772357404232025,
0.15312068164348602,
0.1754186451435089,
0.45456749200820923,
-0.01625681295990944,
-0.2907525897026062,
-0.08232221007347107,
0.2838456630706787,
-0.5681081414222717,
-0.2272556573152542,
0.1737814098596573,
-0.033788155764341354,
-0.25044041872024536,
-0.0980440080165863,
-0.6474566459655762,
0.04808778688311577,
0.5046128630638123,
-0.24063757061958313,
0.010345704853534698,
-0.021247070282697678,
-0.5231413245201111,
-0.26212894916534424,
0.0020734909921884537,
0.17768160998821259,
-0.24391907453536987,
0.2162410318851471,
-0.2958572208881378,
0.5004324316978455,
0.5286248326301575,
0.47288545966148376,
0.09167937934398651,
0.2983112335205078,
-0.5009073615074158,
-0.04038180038332939,
0.11564291268587112,
-0.24531298875808716,
-0.7745265960693359,
0.3366715908050537,
-0.08656531572341919,
0.020292116329073906,
0.023860104382038116,
0.003978224005550146,
0.20725099742412567,
-0.11135324090719223,
0.20356929302215576,
0.11613596975803375,
0.11525171995162964,
0.19146807491779327,
-0.2601095139980316,
-0.09954050928354263,
-0.06758766621351242,
-0.17694148421287537,
-0.016032684594392776,
0.16076192259788513,
0.033243969082832336,
-0.37904658913612366,
0.13455426692962646,
-0.13050365447998047,
0.15872132778167725,
0.2919359803199768,
0.22547592222690582,
-0.1097869873046875,
0.002340420614928007,
0.15824416279792786,
-0.16367530822753906,
0.06631173938512802,
0.006432142108678818,
-0.15497279167175293,
-0.46884095668792725,
-0.09541624784469604,
-0.06918364763259888,
-0.1704113632440567,
-0.1157703548669815,
-0.20903322100639343,
-0.0990912988781929,
0.3020281195640564,
0.05276291444897652,
0.10340197384357452,
-0.03718694671988487,
0.559899091720581,
0.05849059671163559,
-0.1376342922449112,
-0.010079745203256607,
0.1996806412935257,
-0.09741298109292984,
-0.2990055978298187,
-0.1839177906513214,
-0.14008116722106934,
0.21009641885757446,
-0.18220986425876617,
-0.20296436548233032,
0.14398083090782166,
0.2620844841003418,
0.45441877841949463,
-0.06785578280687332,
0.28468695282936096,
0.1313076615333557,
0.11781738698482513,
0.17360666394233704,
-0.05961769446730614,
0.012909750454127789,
0.09755737334489822,
-0.05963956564664841,
0.2911245822906494,
-0.09391863644123077,
0.16491299867630005,
-0.06305445730686188,
-0.31154748797416687,
-0.10432934761047363,
0.0928654819726944,
0.2769778072834015,
-0.07679528743028641,
0.11376360058784485,
0.3560960292816162,
0.36500492691993713,
0.2202548384666443,
0.22128582000732422,
0.28144538402557373,
0.6594774127006531,
0.07963784039020538,
0.01691204309463501,
0.13166120648384094,
-0.14345401525497437,
-0.22671449184417725,
0.2522944509983063,
0.4938218891620636,
0.4509130120277405,
-0.1102534830570221,
0.2818645238876343,
0.23087608814239502,
0.05723516643047333,
-0.19205529987812042,
0.20526228845119476,
0.06357629597187042,
0.23962734639644623,
0.019332531839609146,
0.19997288286685944,
-0.038397420197725296,
-0.11539200693368912,
0.20902693271636963,
0.0695497989654541,
0.19521358609199524,
-0.16900856792926788,
0.5489718914031982,
-0.23307958245277405,
-0.2392110526561737,
-0.3021417558193207,
-0.1950257569551468,
0.0795685350894928,
-0.13427403569221497,
-0.1480570137500763,
0.32758352160453796,
0.011945310980081558,
-0.03002111054956913,
0.258242666721344,
0.23657681047916412,
-0.109111487865448,
-0.4411355257034302,
-0.10464015603065491,
0.11541572958230972,
-0.2608533203601837,
-0.11390168964862823,
0.3723791241645813,
-0.013291066512465477,
0.01797030121088028,
-0.20587441325187683,
0.02744823321700096,
-0.3316386342048645,
-0.09504397213459015,
0.21603429317474365,
-0.12458984553813934,
0.30081361532211304,
-0.2806510329246521,
0.005245082080364227,
-0.4323667287826538,
-0.323248028755188,
-0.11168765276670456,
-0.01636800542473793,
-0.13285957276821136,
-0.4609755575656891,
0.03800845518708229,
-0.09036071598529816,
-0.16003450751304626,
-0.016956515610218048,
-0.10873045772314072,
-0.07062046229839325,
0.13839440047740936,
-0.019044049084186554,
0.31416434049606323,
0.04012589901685715,
-0.10426472872495651,
-0.2069062888622284,
0.3973644971847534,
-0.28421661257743835,
-0.34327828884124756,
-0.5802720785140991,
0.24808500707149506,
-0.12918013334274292,
-0.07658344507217407,
0.004005599766969681,
-0.06495209038257599,
0.05096989870071411,
0.40508484840393066,
-0.4348992705345154,
-0.2244688868522644,
-0.16090264916419983,
-0.05844985321164131,
0.19669313728809357,
-0.032175540924072266,
0.28751885890960693,
0.04436198249459267,
0.2087787240743637,
-0.04883050546050072,
-0.4330040216445923,
0.10432012379169464,
0.27356061339378357,
0.3252652585506439,
0.04118802398443222,
0.26716744899749756,
0.013369262218475342,
0.5328200459480286,
0.30425575375556946,
0.03190254420042038,
0.43048587441444397,
-0.025774044916033745,
0.24790510535240173,
-0.2646467089653015,
-0.1220799908041954,
0.2533503770828247,
-0.0026004910469055176,
-0.6874221563339233,
0.3849371075630188,
0.13314524292945862,
-0.375219464302063,
0.14884540438652039,
-0.24732957780361176,
-0.28697669506073,
-0.23957136273384094,
0.22744564712047577,
0.016055341809988022,
0.2355136275291443,
0.03113739937543869,
0.18945220112800598,
-0.19621726870536804,
-0.25965017080307007,
0.07107032835483551,
0.11552926152944565,
0.28327029943466187,
0.07879594713449478,
0.2494218498468399,
-0.4221400320529938,
-0.3851810097694397,
0.3280622363090515,
0.41009944677352905,
0.07846357673406601,
-0.07906346023082733,
0.2768157720565796,
0.20137399435043335,
-0.12842929363250732,
0.5718344449996948,
-0.32251134514808655,
-0.21289081871509552,
-0.15759047865867615,
0.005542021244764328,
-0.018000105395913124,
0.004231464117765427,
0.047693077474832535,
0.4170286953449249,
-0.0004015713930130005,
0.49023890495300293,
0.3160836100578308,
0.003176990197971463,
-0.1257743090391159,
0.1545054018497467,
-0.3040201961994171,
-0.16543574631214142,
-0.18659082055091858,
-0.5046248435974121,
-0.1751074343919754,
-0.07435827702283859,
0.1343408226966858,
0.0022161765955388546,
-0.0032349680550396442,
-0.023353641852736473,
0.1278812289237976,
-0.053251828998327255,
0.09453536570072174,
0.09103283286094666,
0.4122695028781891,
0.10799162089824677,
-0.1451217383146286,
0.11756720393896103,
0.22429724037647247,
0.31801638007164,
0.5354546308517456,
0.18983031809329987,
0.16551291942596436,
0.1603083312511444,
-0.24001054465770721,
0.28403088450431824,
0.3559730648994446,
-0.12739530205726624,
-0.15536168217658997,
-0.10325534641742706,
-0.10126088559627533,
-0.33445045351982117,
0.33140459656715393,
0.15848883986473083,
0.3463462293148041,
-0.39687588810920715,
-0.434034138917923,
0.43497636914253235,
0.15699441730976105,
-0.2913617789745331,
0.3219602704048157,
0.00028255581855773926,
-0.5629948377609253,
0.40826570987701416,
0.1468815803527832,
1.1026690006256104,
-0.025093145668506622,
0.23380263149738312,
0.02356007695198059,
-0.004649795591831207,
-0.05453100800514221,
-0.32944637537002563,
0.2526039183139801,
-0.22814829647541046,
-0.6414875984191895,
-0.09158722311258316,
-0.20053251087665558,
-0.17123156785964966,
0.06736045330762863,
-0.16939137876033783,
0.35704997181892395,
0.06081594526767731,
-0.0344432108104229,
-0.0861869752407074,
-0.0958181619644165,
-0.12508636713027954,
-0.13225145637989044,
-0.23257121443748474,
0.00003137066960334778,
-0.014496348798274994,
0.4019242525100708,
-0.1263515055179596,
0.14708954095840454,
-0.18719393014907837,
0.0651533231139183,
-0.21331824362277985,
-0.05091458559036255,
-0.401842325925827,
-0.004836738109588623,
-0.3165283501148224,
-0.3073410987854004,
-0.07202136516571045,
0.34423333406448364,
0.5794881582260132,
0.24487899243831635,
0.009438281878829002,
-0.03117040917277336,
0.06879889219999313,
0.22609978914260864,
0.023799892514944077,
-0.43192058801651,
-0.004445565864443779,
0.0783526599407196,
0.09783356636762619,
-0.33060476183891296,
0.13950537145137787,
-0.3778976798057556,
-0.055466316640377045,
0.06625678390264511,
-0.11219491064548492,
-0.0004935392644256353,
-0.2233908623456955,
-0.02942928671836853,
-0.08490979671478271,
0.07341822981834412,
0.010668029077351093,
-0.0022156909108161926,
0.28303173184394836,
0.45143991708755493,
-0.4418177604675293,
-0.4067654311656952,
-0.23479478061199188,
0.2583926320075989,
0.2941420078277588,
0.08051929622888565,
0.505718469619751,
-0.1924353688955307,
-0.19081667065620422,
0.033710382878780365,
0.05533147603273392,
-0.2769651412963867,
0.34195464849472046,
0.12618239223957062,
-0.42281630635261536,
-0.10773809254169464,
-0.15173529088497162,
0.1283305287361145,
0.2605069875717163,
0.037266384810209274,
-0.4263400137424469,
-0.33105993270874023,
-0.36913785338401794,
0.01535017043352127,
-0.05117896571755409,
0.041353918612003326,
0.08081970363855362,
0.13990136981010437,
0.20292556285858154,
-0.24394941329956055,
-0.1427309662103653,
0.19147691130638123,
-0.07767023146152496,
0.1080353632569313,
0.12533143162727356,
-0.030389398336410522,
0.39051833748817444,
-0.15572644770145416,
-0.1167277991771698,
0.18533799052238464,
0.07321985065937042,
-0.07714948803186417,
-0.06138987839221954,
0.1893729716539383,
0.20490285754203796,
-0.11018474400043488,
-0.04767938703298569,
-0.25409966707229614,
0.07724009454250336,
-0.44380655884742737,
0.27154046297073364,
0.3231218457221985,
0.06872911006212234,
-0.1394195854663849,
0.1464877873659134,
-0.042056694626808167,
-0.10526636987924576,
-0.037479087710380554,
-0.19403550028800964,
0.4067789316177368,
0.1452094465494156,
0.1737908273935318,
0.2661372125148773,
0.08640843629837036,
0.002730222186073661,
-0.05817151814699173,
0.2556656002998352,
0.3912893831729889,
0.13915202021598816,
-0.2817206382751465,
0.0091891810297966,
-0.009316762909293175,
0.08773922175168991,
0.11180752515792847,
-0.10984674096107483,
-0.38554897904396057,
0.3469548523426056,
0.006165403872728348,
0.16759935021400452,
-0.08600138872861862,
0.06646904349327087,
-0.22958096861839294,
-0.04957818612456322,
0.4888733923435211,
0.17878222465515137,
0.09831677377223969,
-0.0034018978476524353,
0.01615000143647194,
0.4908657670021057,
-0.17433619499206543,
0.03083808347582817,
-0.2170119285583496,
0.04166533425450325,
0.4911316931247711,
0.36547163128852844,
0.06583075225353241,
-0.011005289852619171,
0.5228964686393738,
0.17763589322566986,
0.06926065683364868,
0.3879835307598114,
0.014595229178667068,
0.041226353496313095,
-0.24443419277668,
-0.055692996829748154,
0.14130142331123352,
-0.21058127284049988,
0.3062291741371155,
0.20232591032981873,
-0.09694195538759232,
-0.41657504439353943,
-0.012494033202528954,
-0.22298815846443176,
0.19457948207855225,
-0.27661585807800293,
-0.27022436261177063,
0.22306331992149353,
-0.12569662928581238,
0.1343889832496643,
0.41462773084640503,
-0.18295370042324066,
-0.12240992486476898,
0.1584744155406952,
0.13881820440292358,
-0.19145677983760834,
0.35101643204689026,
0.07482397556304932,
0.10257000476121902,
0.20829468965530396,
0.015305455774068832,
0.7186046838760376,
-0.39963996410369873,
0.13843047618865967,
-0.12461380660533905,
0.20113569498062134,
0.2932029962539673,
0.45308956503868103,
-0.25995874404907227,
-0.1737225204706192,
0.15628725290298462,
0.07342535257339478,
-0.06174037232995033,
0.25703081488609314,
-0.0532396137714386,
0.14939436316490173,
0.10647577047348022,
0.04630663990974426,
-0.006128864362835884,
0.23497208952903748,
0.14040963351726532,
0.16130834817886353,
0.15360784530639648,
0.16680961847305298,
-0.1433657556772232,
0.10039602965116501,
-0.14891201257705688,
0.02409815788269043,
-0.3396229147911072,
0.08567620068788528,
0.31139907240867615,
-0.2772240936756134,
0.36880794167518616,
0.2808133065700531,
-0.013530939817428589,
0.21274393796920776,
0.45223042368888855,
0.40780752897262573,
0.3765893578529358,
-0.32652929425239563,
-0.1923314929008484,
-0.25157636404037476,
0.3914068639278412,
-0.02244541421532631,
0.19845907390117645,
-0.5478371381759644,
0.042085133492946625,
-0.020549193024635315,
-0.043378785252571106,
0.004484981298446655,
0.17473049461841583,
-0.17578044533729553,
0.14819981157779694,
-0.30364295840263367,
-0.10356760025024414,
-0.07639415562152863,
-0.10822166502475739,
-0.10968251526355743,
-0.4672413468360901,
0.34929460287094116,
-0.1440924108028412,
0.03274304419755936,
0.07268162816762924,
0.14534074068069458,
-0.2700289487838745,
-0.15875749289989471,
0.4588567316532135,
0.24595759809017181,
0.16915994882583618,
-0.23274406790733337,
0.005966756492853165,
-0.21208855509757996,
-0.00016068993136286736,
-0.3116273283958435,
0.04556162655353546,
0.011116772890090942,
0.34007447957992554,
-0.2860615849494934,
0.08650544285774231,
-0.32109448313713074,
0.14065460860729218,
0.2385004609823227,
0.023211343213915825,
0.13867825269699097,
-0.07415874302387238,
-0.21073445677757263,
-0.0015975090209394693,
0.16091090440750122,
0.5694400668144226,
0.042406968772411346,
0.19789399206638336,
-0.22499743103981018,
-0.008281807415187359,
0.23399467766284943,
-0.3523564338684082,
-0.5315514802932739,
0.39487773180007935,
0.07396002113819122,
0.24986320734024048,
-0.1458754539489746,
-0.32000064849853516,
-0.025337189435958862,
0.1369531750679016,
-0.249001145362854,
-0.14092032611370087,
-0.003468722105026245,
0.04679371416568756,
0.09674011170864105,
-0.022526465356349945,
0.35378751158714294,
0.10317530483007431,
-0.40715330839157104,
-0.0464940220117569,
-0.2741342782974243
] |
https://github.com/huggingface/datasets/issues/643 | Caching processed dataset at wrong folder | The code you wrote should write a 1GB file in the Google Drive folder. Doesn't it? | Hi guys, I run this on my Colab (PRO):
```python
from datasets import load_dataset
dataset = load_dataset('text', data_files='/content/corpus.txt', cache_dir='/content/drive/My Drive', split='train')
def encode(examples):
return tokenizer(examples['text'], truncation=True, padding='max_length')
dataset = dataset.map(encode, batched=True)
```
The file is about 4 GB, so I cannot process it on the Colab HD because there is no enough space. So I decided to mount my Google Drive fs and do it on it.
The dataset is cached in the right place but by processing it (applying `encode` function) seems to use a different folder because Colab HD starts to grow and it crashes when it should be done in the Drive fs.
What gets me crazy, it prints it is processing/encoding the dataset in the right folder:
```
Testing the mapped function outputs
Testing finished, running the mapping function on the dataset
Caching processed dataset at /content/drive/My Drive/text/default-ad3e69d6242ee916/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/cache-b16341780a59747d.arrow
``` | 16 | Caching processed dataset at wrong folder
Hi guys, I run this on my Colab (PRO):
```python
from datasets import load_dataset
dataset = load_dataset('text', data_files='/content/corpus.txt', cache_dir='/content/drive/My Drive', split='train')
def encode(examples):
return tokenizer(examples['text'], truncation=True, padding='max_length')
dataset = dataset.map(encode, batched=True)
```
The file is about 4 GB, so I cannot process it on the Colab HD because there is no enough space. So I decided to mount my Google Drive fs and do it on it.
The dataset is cached in the right place but by processing it (applying `encode` function) seems to use a different folder because Colab HD starts to grow and it crashes when it should be done in the Drive fs.
What gets me crazy, it prints it is processing/encoding the dataset in the right folder:
```
Testing the mapped function outputs
Testing finished, running the mapping function on the dataset
Caching processed dataset at /content/drive/My Drive/text/default-ad3e69d6242ee916/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/cache-b16341780a59747d.arrow
```
The code you wrote should write a 1GB file in the Google Drive folder. Doesn't it? | [
-0.04469699412584305,
0.17951232194900513,
-0.04743408411741257,
0.40678858757019043,
-0.03534640371799469,
-0.01586049795150757,
0.3132927417755127,
0.026928357779979706,
-0.0032727811485528946,
0.2124624103307724,
0.052783846855163574,
0.23325680196285248,
0.017306184396147728,
0.4683631360530853,
-0.08881600201129913,
0.31173864006996155,
0.25330889225006104,
-0.06140458583831787,
0.06521989405155182,
-0.07938559353351593,
-0.3149401843547821,
0.3846553862094879,
-0.20037446916103363,
-0.03628012537956238,
-0.5003235936164856,
-0.12092138081789017,
-0.1952659636735916,
-0.028328873217105865,
-0.09481312334537506,
0.24903364479541779,
0.1699591726064682,
0.032848961651325226,
0.21131356060504913,
0.6244876980781555,
-0.00012606970267370343,
-0.17915797233581543,
0.2552551031112671,
-0.23707637190818787,
-0.1875326782464981,
-0.0942382663488388,
-0.29133114218711853,
-0.012064806185662746,
-0.1296514868736267,
-0.051967497915029526,
-0.17388388514518738,
0.13680118322372437,
0.24108143150806427,
-0.5128405690193176,
0.012583933770656586,
0.2712927460670471,
0.09608344733715057,
-0.4741634130477905,
-0.4019346833229065,
0.35410234332084656,
0.10014811903238297,
0.23021981120109558,
-0.09787304699420929,
0.297321617603302,
-0.006414569914340973,
-0.12767146527767181,
-0.06667568534612656,
0.3040255308151245,
-0.022450922057032585,
-0.0017924550920724869,
0.2682516276836395,
0.34787482023239136,
-0.31018632650375366,
-0.31760430335998535,
0.5124369263648987,
-0.47323083877563477,
0.345090389251709,
-0.3447909951210022,
-0.16219918429851532,
-0.26866579055786133,
-0.3249446153640747,
-0.37675216794013977,
0.5275464057922363,
0.16368018090724945,
-0.14650680124759674,
0.05047866702079773,
-0.4966207444667816,
-0.2640623152256012,
0.05831138789653778,
0.08599282056093216,
-0.21573644876480103,
0.3034999966621399,
-0.2949536144733429,
0.028117574751377106,
-0.05020600184798241,
0.2880081534385681,
0.6402247548103333,
-0.3850521147251129,
0.020675797015428543,
0.19592328369617462,
-0.07506921887397766,
0.0538775771856308,
-0.1898897886276245,
0.5359107851982117,
-0.20537671446800232,
-0.08069439232349396,
-0.25082242488861084,
-0.19148468971252441,
-0.09575818479061127,
0.0858408734202385,
0.05775598809123039,
0.4821522533893585,
-0.05819062143564224,
0.12877869606018066,
0.055815521627664566,
0.011578213423490524,
-0.4982733428478241,
-0.08588507771492004,
-0.06155598908662796,
-0.2610614597797394,
-0.023286879062652588,
0.1011679396033287,
-0.017623960971832275,
-0.28134655952453613,
-0.156687930226326,
-0.002441815100610256,
-0.3255881071090698,
-0.0047462391667068005,
0.07364104688167572,
0.2545738220214844,
-0.0352054238319397,
-0.172734797000885,
-0.20613420009613037,
0.24387730658054352,
-0.2096228152513504,
0.3257508873939514,
-0.09735871851444244,
0.08342917263507843,
-0.3553805947303772,
0.46141308546066284,
0.06435789167881012,
-0.21753275394439697,
0.16182884573936462,
-0.03033413365483284,
0.04865099862217903,
-0.3234557509422302,
-0.019979897886514664,
-0.43593326210975647,
0.346786767244339,
0.1586114913225174,
0.15475517511367798,
0.41479039192199707,
0.0052945055067539215,
-0.3118020296096802,
-0.12082362174987793,
0.2784830629825592,
-0.6148864030838013,
-0.2724705636501312,
0.1674014925956726,
0.004311409778892994,
-0.25422611832618713,
-0.07849167287349701,
-0.7056843638420105,
0.12968647480010986,
0.5126650333404541,
-0.20336441695690155,
0.014364168047904968,
-0.029666312038898468,
-0.48537734150886536,
-0.2789668142795563,
0.09312118589878082,
0.13973505795001984,
-0.2764248847961426,
0.21114429831504822,
-0.3240927457809448,
0.5097718238830566,
0.536867082118988,
0.4086743891239166,
0.0867166519165039,
0.3118775486946106,
-0.48067158460617065,
-0.0023119673132896423,
0.1090577095746994,
-0.2603106200695038,
-0.7887853980064392,
0.3294820487499237,
-0.09211989492177963,
-0.034104686230421066,
0.010874234139919281,
-0.05245673656463623,
0.24981477856636047,
-0.12818431854248047,
0.22235342860221863,
0.1184074655175209,
0.04476311057806015,
0.1605670303106308,
-0.2890417277812958,
-0.14155350625514984,
-0.03888525068759918,
-0.16787031292915344,
0.008493337780237198,
0.15579834580421448,
0.02035558968782425,
-0.3486264944076538,
0.1816389560699463,
-0.09685733914375305,
0.1932920664548874,
0.2729935944080353,
0.24301423132419586,
-0.15129335224628448,
-0.02574082277715206,
0.19230490922927856,
-0.17054128646850586,
0.11762525886297226,
0.005134548991918564,
-0.144520565867424,
-0.4764551520347595,
-0.11686469614505768,
-0.1284797638654709,
-0.1662077009677887,
-0.11462725698947906,
-0.2664223611354828,
-0.04777104780077934,
0.2823029160499573,
0.12352725863456726,
0.04259486123919487,
-0.02301100641489029,
0.5242790579795837,
0.11134804785251617,
-0.1764964908361435,
-0.056591909378767014,
0.20397111773490906,
-0.16022948920726776,
-0.2727031111717224,
-0.11935935914516449,
-0.1635744273662567,
0.19501644372940063,
-0.2037995606660843,
-0.17642951011657715,
0.14636686444282532,
0.23996256291866302,
0.36143821477890015,
0.0290910042822361,
0.2707650661468506,
0.08384935557842255,
0.033318813890218735,
0.2098008245229721,
-0.05540236458182335,
-0.00604679249227047,
0.12786829471588135,
-0.1146661564707756,
0.2786540985107422,
-0.07390058040618896,
0.1376664787530899,
-0.08800819516181946,
-0.29318881034851074,
-0.1379479169845581,
0.1056080311536789,
0.20405833423137665,
-0.10389143973588943,
0.1000170111656189,
0.32061922550201416,
0.3659147322177887,
0.23438985645771027,
0.2518417239189148,
0.3290376663208008,
0.6469292044639587,
0.034354064613580704,
-0.032018885016441345,
0.161945641040802,
-0.1168716624379158,
-0.30373212695121765,
0.2609198987483978,
0.4575294554233551,
0.4510045051574707,
-0.07149427384138107,
0.3330642282962799,
0.17955252528190613,
0.05965009331703186,
-0.14602689445018768,
0.1589968055486679,
0.0625515729188919,
0.24260367453098297,
-0.045044153928756714,
0.21309760212898254,
-0.046340424567461014,
-0.05287664011120796,
0.1504989117383957,
0.04992783069610596,
0.23705926537513733,
-0.13753385841846466,
0.52236407995224,
-0.21703025698661804,
-0.21228519082069397,
-0.23913726210594177,
-0.25862571597099304,
0.08960171788930893,
-0.17586688697338104,
-0.1378314346075058,
0.2729138135910034,
0.050050657242536545,
-0.024110110476613045,
0.21734432876110077,
0.21240486204624176,
-0.09687753021717072,
-0.4409406781196594,
-0.09341999888420105,
0.15982642769813538,
-0.2728135585784912,
-0.07838847488164902,
0.34544944763183594,
-0.06018362566828728,
0.0677398294210434,
-0.166966512799263,
0.05561591684818268,
-0.31325262784957886,
-0.10326702892780304,
0.23997335135936737,
-0.182625874876976,
0.28256288170814514,
-0.25891175866127014,
0.004353448748588562,
-0.44897401332855225,
-0.32100942730903625,
-0.11420537531375885,
-0.028110353276133537,
-0.10647524148225784,
-0.44977694749832153,
0.004318154416978359,
-0.05347800999879837,
-0.13240490853786469,
-0.0062675923109054565,
-0.1664135754108429,
-0.05084868520498276,
0.10700857639312744,
0.046280596405267715,
0.28241467475891113,
-0.0013549281284213066,
-0.026372529566287994,
-0.18665440380573273,
0.42914098501205444,
-0.2935035228729248,
-0.3800826072692871,
-0.6091431975364685,
0.2402903288602829,
-0.1338401883840561,
-0.06447748839855194,
0.013708565384149551,
-0.06464994698762894,
0.1100766509771347,
0.3217848539352417,
-0.4183184504508972,
-0.28014758229255676,
-0.18304286897182465,
-0.05658230185508728,
0.1905386745929718,
-0.027039354667067528,
0.2956300675868988,
0.03463394194841385,
0.18068274855613708,
-0.023259958252310753,
-0.42321085929870605,
-0.0010999515652656555,
0.3015037477016449,
0.33486542105674744,
-0.0046830568462610245,
0.26094114780426025,
0.053218115121126175,
0.5737907290458679,
0.3420693874359131,
0.0703262910246849,
0.41117963194847107,
-0.018538950011134148,
0.2835712432861328,
-0.2689014971256256,
-0.0825405865907669,
0.3358347415924072,
-0.004560515284538269,
-0.6965683102607727,
0.38905203342437744,
0.13809606432914734,
-0.4020673930644989,
0.17780768871307373,
-0.25607478618621826,
-0.2944071292877197,
-0.19554503262043,
0.2278750091791153,
0.01925126276910305,
0.15463227033615112,
0.05192549154162407,
0.11037909239530563,
-0.20175689458847046,
-0.2173902988433838,
0.06266000866889954,
0.05610170587897301,
0.28712204098701477,
0.19013096392154694,
0.30353835225105286,
-0.48263806104660034,
-0.4505162835121155,
0.31932806968688965,
0.35838502645492554,
0.02687354013323784,
-0.028257222846150398,
0.29936930537223816,
0.2221173346042633,
-0.14310957491397858,
0.5819003582000732,
-0.3227648437023163,
-0.23594669997692108,
-0.17222009599208832,
0.036044903099536896,
0.018400998786091805,
0.00023673474788665771,
0.06747044622898102,
0.4076426327228546,
-0.02780335023999214,
0.4173494279384613,
0.3009566068649292,
0.02324497327208519,
-0.07660681009292603,
0.21388880908489227,
-0.2958987355232239,
-0.11700516939163208,
-0.23670785129070282,
-0.5745475888252258,
-0.24604535102844238,
-0.025319546461105347,
0.21170005202293396,
0.014666290953755379,
0.06071536988019943,
-0.0048598237335681915,
0.14582131803035736,
-0.07857910543680191,
0.09075555205345154,
0.13103948533535004,
0.4218703508377075,
0.15771476924419403,
-0.13342896103858948,
0.08700307458639145,
0.21628114581108093,
0.3260955214500427,
0.548058271408081,
0.16658520698547363,
0.21738389134407043,
0.2050192952156067,
-0.21903172135353088,
0.3270571231842041,
0.33673736453056335,
-0.17309077084064484,
-0.2543383538722992,
-0.08127310872077942,
0.007118009030818939,
-0.36723294854164124,
0.36363309621810913,
0.13313767313957214,
0.3152443468570709,
-0.4551059305667877,
-0.4510667622089386,
0.44005367159843445,
0.170836940407753,
-0.2595471143722534,
0.35538583993911743,
0.08198302239179611,
-0.5158584117889404,
0.4137578010559082,
0.13818003237247467,
1.1279290914535522,
-0.023164860904216766,
0.20079250633716583,
0.06869088113307953,
0.08180961012840271,
0.005759622901678085,
-0.325264573097229,
0.2268909066915512,
-0.14915823936462402,
-0.6130777597427368,
-0.07238665968179703,
-0.15858444571495056,
-0.20139291882514954,
0.06475447863340378,
-0.20767901837825775,
0.4101580083370209,
0.027353353798389435,
-0.035020750015974045,
-0.09747722744941711,
-0.05458423122763634,
-0.06753943860530853,
-0.11008015275001526,
-0.157621368765831,
0.059599436819553375,
0.005640923976898193,
0.40713751316070557,
-0.16161054372787476,
0.19933341443538666,
-0.19286102056503296,
0.032641954720020294,
-0.19746440649032593,
-0.05139831081032753,
-0.37691354751586914,
-0.01544138789176941,
-0.36998048424720764,
-0.29887449741363525,
-0.11578412353992462,
0.3191696107387543,
0.508995771408081,
0.2731175124645233,
0.009428165853023529,
-0.02985372766852379,
0.08989971876144409,
0.2153797745704651,
0.009097576141357422,
-0.47288978099823,
0.012827321887016296,
0.029775314033031464,
0.12234968692064285,
-0.2711934447288513,
0.14952616393566132,
-0.38594698905944824,
-0.0631943866610527,
0.11623665690422058,
-0.11675752699375153,
0.03705715760588646,
-0.21185150742530823,
-0.01829790323972702,
-0.11918090283870697,
0.06900493800640106,
0.03944917768239975,
0.04351883381605148,
0.2638121545314789,
0.4571983516216278,
-0.41703739762306213,
-0.43055495619773865,
-0.26612573862075806,
0.1776321977376938,
0.3450029790401459,
0.0716150626540184,
0.4960000514984131,
-0.20811106264591217,
-0.1910768300294876,
0.01850750669836998,
0.00006491690874099731,
-0.19556649029254913,
0.3140622079372406,
0.1060144305229187,
-0.4377087652683258,
-0.0703066810965538,
-0.14968374371528625,
0.06984641402959824,
0.33209383487701416,
0.04376906156539917,
-0.3825739026069641,
-0.2999253273010254,
-0.4178442358970642,
0.03823361173272133,
-0.03615235164761543,
0.04073039069771767,
0.014799512922763824,
0.13675904273986816,
0.2235817164182663,
-0.19359152019023895,
-0.19285160303115845,
0.1412617266178131,
-0.09203904867172241,
0.06692624092102051,
0.08989208936691284,
-0.00698370486497879,
0.4290526509284973,
-0.17222879827022552,
-0.09154971688985825,
0.16637296974658966,
0.04235341399908066,
-0.12212543934583664,
-0.03234637528657913,
0.1566825658082962,
0.22427120804786682,
-0.03606946021318436,
-0.026347685605287552,
-0.2317691296339035,
0.04012765362858772,
-0.45751848816871643,
0.24925634264945984,
0.30223584175109863,
0.13605692982673645,
-0.20501893758773804,
0.19418080151081085,
-0.11275715380907059,
-0.033519040793180466,
-0.11977992951869965,
-0.11453604698181152,
0.3726639747619629,
0.13492745161056519,
0.21752546727657318,
0.3037360906600952,
0.0779423713684082,
0.02916896715760231,
-0.021077491343021393,
0.19025473296642303,
0.4145388901233673,
0.1018226221203804,
-0.239972785115242,
0.02451777085661888,
-0.05476367846131325,
0.10277824848890305,
0.13734303414821625,
-0.08892671018838882,
-0.3767092227935791,
0.3508293330669403,
0.036521077156066895,
0.15079353749752045,
-0.05236079543828964,
0.05473589524626732,
-0.21975956857204437,
-0.010061506181955338,
0.5260444283485413,
0.12902723252773285,
0.18774843215942383,
-0.04407854378223419,
0.020692016929388046,
0.5375123620033264,
-0.16738532483577728,
-0.002444830723106861,
-0.2392359972000122,
0.011491362005472183,
0.4959448575973511,
0.4118017554283142,
0.08947490900754929,
-0.01472192257642746,
0.4912986755371094,
0.11212121695280075,
0.10707319527864456,
0.36793234944343567,
-0.04120764508843422,
-0.012450970709323883,
-0.185786172747612,
-0.0598008967936039,
0.15540020167827606,
-0.17738130688667297,
0.30188408493995667,
0.21543845534324646,
-0.07869680970907211,
-0.3884582817554474,
-0.04142119362950325,
-0.21032027900218964,
0.20806534588336945,
-0.2081901729106903,
-0.21796418726444244,
0.2021917998790741,
-0.12337551265954971,
0.06148272752761841,
0.411555677652359,
-0.1338241547346115,
-0.19268469512462616,
0.14972229301929474,
0.09435965120792389,
-0.2575375437736511,
0.35880541801452637,
0.032256267964839935,
0.08747385442256927,
0.149779811501503,
0.027460169047117233,
0.7081148028373718,
-0.43931782245635986,
0.11496804654598236,
-0.1275026947259903,
0.12377926707267761,
0.31784456968307495,
0.44502392411231995,
-0.25847846269607544,
-0.17824672162532806,
0.14974500238895416,
0.04779094457626343,
-0.12814244627952576,
0.22534921765327454,
-0.04095456004142761,
0.07052068412303925,
0.06975564360618591,
0.09330587089061737,
-0.053202565759420395,
0.1945137083530426,
0.14852812886238098,
0.1457558423280716,
0.20580759644508362,
0.1708897054195404,
-0.1727921962738037,
0.11145902425050735,
-0.15206851065158844,
0.041484422981739044,
-0.4139541685581207,
0.10717564076185226,
0.25661131739616394,
-0.2570846676826477,
0.34534117579460144,
0.2927153408527374,
0.010591262951493263,
0.17428572475910187,
0.4269963800907135,
0.41162109375,
0.36642372608184814,
-0.35345935821533203,
-0.18676309287548065,
-0.30903011560440063,
0.38333624601364136,
-0.05091441795229912,
0.140567347407341,
-0.5579475164413452,
0.10946474969387054,
-0.011994324624538422,
-0.04616592079401016,
-0.00601978600025177,
0.19202274084091187,
-0.13856419920921326,
0.1270836889743805,
-0.27602824568748474,
-0.11364319920539856,
-0.07765091955661774,
-0.016688959673047066,
-0.07711203396320343,
-0.43174728751182556,
0.3348552882671356,
-0.14196522533893585,
0.056300289928913116,
0.02175573818385601,
0.09625285863876343,
-0.2522623538970947,
-0.15636782348155975,
0.4937504827976227,
0.19673627614974976,
0.19236546754837036,
-0.2603969871997833,
0.00031287409365177155,
-0.2698328495025635,
0.09809520840644836,
-0.3428792953491211,
0.04071274772286415,
-0.019372008740901947,
0.3388943076133728,
-0.28159984946250916,
0.043913546949625015,
-0.37469643354415894,
0.14207300543785095,
0.27247196435928345,
0.033709507435560226,
0.13082543015480042,
-0.02836058847606182,
-0.20415270328521729,
0.059485096484422684,
0.1460774540901184,
0.5029761791229248,
0.01888883486390114,
0.23556257784366608,
-0.2690114974975586,
-0.03955482691526413,
0.28696104884147644,
-0.31568828225135803,
-0.5447865724563599,
0.3355136811733246,
0.05934666842222214,
0.27115416526794434,
-0.16006700694561005,
-0.2820848822593689,
0.007151700556278229,
0.12445101886987686,
-0.22024908661842346,
-0.20368899405002594,
0.057548992335796356,
0.019439317286014557,
0.13097892701625824,
-0.04694504290819168,
0.3310013711452484,
0.0756133645772934,
-0.39831238985061646,
-0.05064927414059639,
-0.2439453899860382
] |
https://github.com/huggingface/datasets/issues/643 | Caching processed dataset at wrong folder | I could check it and as you say as I write to te Drive disk the colab disk also increases... | Hi guys, I run this on my Colab (PRO):
```python
from datasets import load_dataset
dataset = load_dataset('text', data_files='/content/corpus.txt', cache_dir='/content/drive/My Drive', split='train')
def encode(examples):
return tokenizer(examples['text'], truncation=True, padding='max_length')
dataset = dataset.map(encode, batched=True)
```
The file is about 4 GB, so I cannot process it on the Colab HD because there is no enough space. So I decided to mount my Google Drive fs and do it on it.
The dataset is cached in the right place but by processing it (applying `encode` function) seems to use a different folder because Colab HD starts to grow and it crashes when it should be done in the Drive fs.
What gets me crazy, it prints it is processing/encoding the dataset in the right folder:
```
Testing the mapped function outputs
Testing finished, running the mapping function on the dataset
Caching processed dataset at /content/drive/My Drive/text/default-ad3e69d6242ee916/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/cache-b16341780a59747d.arrow
``` | 20 | Caching processed dataset at wrong folder
Hi guys, I run this on my Colab (PRO):
```python
from datasets import load_dataset
dataset = load_dataset('text', data_files='/content/corpus.txt', cache_dir='/content/drive/My Drive', split='train')
def encode(examples):
return tokenizer(examples['text'], truncation=True, padding='max_length')
dataset = dataset.map(encode, batched=True)
```
The file is about 4 GB, so I cannot process it on the Colab HD because there is no enough space. So I decided to mount my Google Drive fs and do it on it.
The dataset is cached in the right place but by processing it (applying `encode` function) seems to use a different folder because Colab HD starts to grow and it crashes when it should be done in the Drive fs.
What gets me crazy, it prints it is processing/encoding the dataset in the right folder:
```
Testing the mapped function outputs
Testing finished, running the mapping function on the dataset
Caching processed dataset at /content/drive/My Drive/text/default-ad3e69d6242ee916/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/cache-b16341780a59747d.arrow
```
I could check it and as you say as I write to te Drive disk the colab disk also increases... | [
-0.09090013802051544,
0.08981896936893463,
-0.0347919836640358,
0.49087226390838623,
-0.06337078660726547,
-0.02706298604607582,
0.26767855882644653,
0.004958542063832283,
0.02421559765934944,
0.22792348265647888,
-0.014807101339101791,
0.2577185332775116,
0.06507819145917892,
0.4686148464679718,
-0.08558762073516846,
0.3258923888206482,
0.26148682832717896,
-0.09086187183856964,
0.023612700402736664,
-0.0889640599489212,
-0.3442033529281616,
0.3814181387424469,
-0.187889963388443,
-0.08837151527404785,
-0.46065229177474976,
-0.1489054560661316,
-0.14864060282707214,
-0.055590979754924774,
-0.06168106943368912,
0.25517091155052185,
0.15188249945640564,
0.047634415328502655,
0.2141137272119522,
0.6586297750473022,
-0.00012668754789046943,
-0.21073763072490692,
0.1852644383907318,
-0.23399986326694489,
-0.19729824364185333,
-0.03035140037536621,
-0.29135510325431824,
-0.04287813603878021,
-0.08044640719890594,
-0.0939842015504837,
-0.1805126965045929,
0.15257643163204193,
0.18759658932685852,
-0.4624527096748352,
0.03697916865348816,
0.22151312232017517,
0.08155626803636551,
-0.45840033888816833,
-0.4723297357559204,
0.37778931856155396,
0.09730510413646698,
0.22218312323093414,
-0.14820171892642975,
0.32220980525016785,
-0.010229095816612244,
-0.06610612571239471,
-0.12281865626573563,
0.29109838604927063,
-0.04572897031903267,
0.010027787648141384,
0.24369922280311584,
0.3522856533527374,
-0.26920804381370544,
-0.3386731445789337,
0.6088118553161621,
-0.4549604058265686,
0.33563560247421265,
-0.3624156713485718,
-0.11854592710733414,
-0.27656885981559753,
-0.2856236398220062,
-0.37578722834587097,
0.5314133167266846,
0.13894318044185638,
-0.1478150337934494,
0.06865284591913223,
-0.4924883544445038,
-0.2548328936100006,
0.07558716833591461,
0.0571192130446434,
-0.20388415455818176,
0.2674262225627899,
-0.2745117247104645,
0.009109370410442352,
-0.017953861504793167,
0.2676403522491455,
0.7121442556381226,
-0.3867533802986145,
-0.009783279150724411,
0.2255641222000122,
-0.13497506082057953,
0.04301469027996063,
-0.17611157894134521,
0.5634053349494934,
-0.2399386465549469,
-0.14548003673553467,
-0.23181167244911194,
-0.14497900009155273,
-0.13368983566761017,
0.11136561632156372,
0.05797881260514259,
0.43676963448524475,
-0.06560740619897842,
0.11535931378602982,
0.07338852435350418,
0.04401860386133194,
-0.4660319983959198,
-0.07881228625774384,
-0.05303357541561127,
-0.24415649473667145,
0.01957877352833748,
0.08584070205688477,
-0.024346765130758286,
-0.280148446559906,
-0.15939843654632568,
-0.06706804782152176,
-0.292598694562912,
0.019488511607050896,
0.07093756645917892,
0.27825799584388733,
-0.008434731513261795,
-0.11637309938669205,
-0.2690792381763458,
0.22445379197597504,
-0.18271662294864655,
0.39758384227752686,
-0.08624359965324402,
0.028013719245791435,
-0.31135129928588867,
0.4865095615386963,
0.07445932924747467,
-0.2300518900156021,
0.10226219147443771,
0.07515083253383636,
-0.00567106157541275,
-0.3322516977787018,
-0.11819428205490112,
-0.42489349842071533,
0.33539897203445435,
0.18243111670017242,
0.1418437510728836,
0.3487936854362488,
-0.07529547810554504,
-0.22268617153167725,
-0.11019723117351532,
0.26073068380355835,
-0.6085553169250488,
-0.22799061238765717,
0.14202480018138885,
-0.000722736120223999,
-0.24469685554504395,
-0.08334687352180481,
-0.7278811931610107,
0.0973595529794693,
0.4525424838066101,
-0.16910740733146667,
0.0063451677560806274,
-0.013453654944896698,
-0.4763547480106354,
-0.20479847490787506,
0.03977659344673157,
0.13663066923618317,
-0.2087153196334839,
0.182603657245636,
-0.3155364990234375,
0.5325465798377991,
0.48009300231933594,
0.40413257479667664,
0.08266270905733109,
0.2509361505508423,
-0.5047851204872131,
-0.13025474548339844,
0.0681142807006836,
-0.24287597835063934,
-0.8206090331077576,
0.2948428988456726,
-0.0977441668510437,
0.008605239912867546,
0.08283060044050217,
-0.02415667474269867,
0.21683301031589508,
-0.099723681807518,
0.1954146921634674,
0.12508326768875122,
0.07380563765764236,
0.20053018629550934,
-0.3050266206264496,
-0.13277283310890198,
-0.10845468938350677,
-0.17191700637340546,
-0.0028993450105190277,
0.1939239650964737,
0.02337382733821869,
-0.3604537844657898,
0.1965492069721222,
-0.1077609658241272,
0.16632720828056335,
0.2490561306476593,
0.27589675784111023,
-0.22322072088718414,
-0.015825366601347923,
0.14759373664855957,
-0.18789169192314148,
0.09841597825288773,
0.03099856525659561,
-0.1838447004556656,
-0.491402268409729,
-0.11475156992673874,
-0.16925960779190063,
-0.14466558396816254,
-0.11538644134998322,
-0.23380309343338013,
-0.07124453037977219,
0.31114453077316284,
0.09795117378234863,
0.003481220453977585,
-0.014339346438646317,
0.5263149738311768,
0.08601582795381546,
-0.15858803689479828,
-0.018412627279758453,
0.2007099688053131,
-0.08312271535396576,
-0.23016999661922455,
-0.13305363059043884,
-0.1328962743282318,
0.19083786010742188,
-0.24058489501476288,
-0.19070789217948914,
0.09763717651367188,
0.2659994959831238,
0.43392258882522583,
0.03833254054188728,
0.27173152565956116,
0.1190790981054306,
0.09989367425441742,
0.21449720859527588,
-0.09618844091892242,
-0.049937423318624496,
0.11049967259168625,
-0.024675928056240082,
0.2426777482032776,
-0.07568405568599701,
0.16171376407146454,
-0.10388794541358948,
-0.3116763234138489,
-0.07439637184143066,
0.054308775812387466,
0.31531304121017456,
-0.126709446310997,
0.01700235903263092,
0.39111995697021484,
0.40464234352111816,
0.2553064823150635,
0.24832597374916077,
0.37560805678367615,
0.6352419853210449,
0.07731719315052032,
-0.08197657018899918,
0.22103044390678406,
-0.16408973932266235,
-0.3080352246761322,
0.23510925471782684,
0.5566419363021851,
0.4196312427520752,
-0.07898897677659988,
0.3083801567554474,
0.2244252860546112,
0.09889538586139679,
-0.16015109419822693,
0.1938726305961609,
0.05116404965519905,
0.25983086228370667,
0.06327520310878754,
0.24444535374641418,
-0.03099846839904785,
-0.06441090255975723,
0.18183979392051697,
0.06068607419729233,
0.23820875585079193,
-0.15056580305099487,
0.5132125616073608,
-0.21931280195713043,
-0.21985340118408203,
-0.2537248432636261,
-0.20956015586853027,
0.11713679134845734,
-0.17276631295681,
-0.13116589188575745,
0.3562392294406891,
0.05763459578156471,
-0.010853368788957596,
0.26674017310142517,
0.2275640219449997,
-0.12323248386383057,
-0.42424532771110535,
-0.13583087921142578,
0.16878901422023773,
-0.24261102080345154,
-0.07813175767660141,
0.359692245721817,
-0.0710112452507019,
0.08656659722328186,
-0.19870300590991974,
0.07297788560390472,
-0.36264657974243164,
-0.135043203830719,
0.25161075592041016,
-0.136773020029068,
0.30735138058662415,
-0.29485854506492615,
0.006539724767208099,
-0.4329468011856079,
-0.3261018991470337,
-0.1517665833234787,
-0.048066411167383194,
-0.11878155171871185,
-0.4421817362308502,
-0.04192836955189705,
-0.0632457509636879,
-0.1138276755809784,
0.02017264813184738,
-0.17134413123130798,
-0.06227754056453705,
0.09998378157615662,
0.03766055777668953,
0.3234497904777527,
0.006057072430849075,
-0.08442559093236923,
-0.19189199805259705,
0.4517863094806671,
-0.27824676036834717,
-0.3682189881801605,
-0.6094020009040833,
0.2131616175174713,
-0.08354360610246658,
0.0003341659903526306,
0.021286439150571823,
-0.13305777311325073,
0.12717205286026,
0.35493355989456177,
-0.46179288625717163,
-0.3288869559764862,
-0.14892861247062683,
0.02330046519637108,
0.190487340092659,
-0.054721564054489136,
0.26636672019958496,
0.06456347554922104,
0.17163902521133423,
0.02431364357471466,
-0.42644041776657104,
-0.004849940538406372,
0.3264300525188446,
0.3931539058685303,
0.0035660918802022934,
0.21746626496315002,
0.010487094521522522,
0.5704646706581116,
0.2698991000652313,
-0.02059296891093254,
0.4525628983974457,
-0.010425100103020668,
0.22745072841644287,
-0.2605687379837036,
-0.13222534954547882,
0.22769825160503387,
0.02032853662967682,
-0.6987561583518982,
0.41557401418685913,
0.09590932726860046,
-0.40832090377807617,
0.18282359838485718,
-0.3095014691352844,
-0.24390122294425964,
-0.20389166474342346,
0.2121490240097046,
0.030038561671972275,
0.20551273226737976,
0.021233107894659042,
0.10080751031637192,
-0.19139008224010468,
-0.2594242990016937,
0.055140648037195206,
0.04015862196683884,
0.24124184250831604,
0.12296172976493835,
0.30730077624320984,
-0.46045467257499695,
-0.43483465909957886,
0.3341541290283203,
0.3555987775325775,
-0.002316080965101719,
-0.043842509388923645,
0.2870713174343109,
0.24582645297050476,
-0.14826549589633942,
0.5649097561836243,
-0.30257195234298706,
-0.16594848036766052,
-0.17209786176681519,
0.028917886316776276,
0.01754971779882908,
0.029803287237882614,
0.04482594504952431,
0.37308505177497864,
0.0043940115720033646,
0.5102787017822266,
0.3682123124599457,
0.0015425144229084253,
-0.09156763553619385,
0.27326297760009766,
-0.33222877979278564,
-0.17291738092899323,
-0.1844390332698822,
-0.5728092789649963,
-0.17616872489452362,
0.013024300336837769,
0.1412498950958252,
0.0300490390509367,
0.022144924849271774,
-0.031968776136636734,
0.1181979551911354,
-0.10869606584310532,
0.09761074930429459,
0.174745574593544,
0.44275641441345215,
0.22531186044216156,
-0.09145604074001312,
0.04054073244333267,
0.228124737739563,
0.376605749130249,
0.5109021663665771,
0.15203168988227844,
0.23015396296977997,
0.18369901180267334,
-0.20981818437576294,
0.23599186539649963,
0.32075852155685425,
-0.14427922666072845,
-0.17456302046775818,
-0.1821289360523224,
-0.011246047914028168,
-0.3184019923210144,
0.3036257326602936,
0.11711226403713226,
0.3674888610839844,
-0.40667596459388733,
-0.40754789113998413,
0.4499433636665344,
0.13454972207546234,
-0.3216322660446167,
0.23896323144435883,
-0.0022424235939979553,
-0.5306397080421448,
0.4041656255722046,
0.17167451977729797,
1.1117684841156006,
0.04018707200884819,
0.17658531665802002,
0.03924255818128586,
0.03194770961999893,
-0.06525203585624695,
-0.3078402876853943,
0.1893233060836792,
-0.19088052213191986,
-0.6514492630958557,
-0.07321155071258545,
-0.16131314635276794,
-0.2037961184978485,
0.07695616036653519,
-0.2160162478685379,
0.38868144154548645,
-0.0033977776765823364,
-0.07168318331241608,
-0.11225119233131409,
-0.05288735777139664,
-0.04609198123216629,
-0.13059379160404205,
-0.280353844165802,
0.03775370121002197,
-0.060142919421195984,
0.39657872915267944,
-0.14118707180023193,
0.1791493445634842,
-0.12148080766201019,
0.07274965196847916,
-0.1955314576625824,
-0.07947889715433121,
-0.3821720778942108,
-0.018294621258974075,
-0.3670302629470825,
-0.3077127933502197,
-0.10502198338508606,
0.3306055963039398,
0.5086337924003601,
0.2187628597021103,
0.03009963221848011,
-0.01384030282497406,
0.09322609752416611,
0.24040883779525757,
0.028544001281261444,
-0.4196968674659729,
-0.028753990307450294,
0.045472219586372375,
0.08159171789884567,
-0.29180318117141724,
0.17616355419158936,
-0.36306166648864746,
-0.02913832664489746,
0.0981050431728363,
-0.12106941640377045,
0.03222821280360222,
-0.24012909829616547,
0.008700981736183167,
-0.10037599503993988,
0.1044992208480835,
0.04045862704515457,
-0.0503646656870842,
0.24960778653621674,
0.5033812522888184,
-0.42370638251304626,
-0.46637460589408875,
-0.2362973541021347,
0.23910176753997803,
0.36802518367767334,
0.10114462673664093,
0.4734416604042053,
-0.2448926419019699,
-0.18145479261875153,
0.00027022138237953186,
0.025036655366420746,
-0.25989577174186707,
0.3429083526134491,
0.07766128331422806,
-0.34602969884872437,
-0.08735699951648712,
-0.14695501327514648,
0.033136893063783646,
0.3445209860801697,
0.0494183748960495,
-0.4454936385154724,
-0.2655266523361206,
-0.41457656025886536,
-0.0005245804786682129,
-0.030143942683935165,
0.07282514125108719,
0.05130236595869064,
0.12420015037059784,
0.17920278012752533,
-0.12314523756504059,
-0.18424835801124573,
0.17784547805786133,
-0.06877350062131882,
0.10790497809648514,
0.10925013571977615,
-0.04456444829702377,
0.40419355034828186,
-0.17493446171283722,
-0.08944723010063171,
0.1353369653224945,
0.0723467618227005,
-0.11882676929235458,
-0.006115257740020752,
0.1551075428724289,
0.17449814081192017,
-0.028528759256005287,
-0.10910326987504959,
-0.22612950205802917,
0.0833103284239769,
-0.45501798391342163,
0.3012819290161133,
0.26829102635383606,
0.1576905995607376,
-0.1673208326101303,
0.19079220294952393,
-0.1116957888007164,
-0.06561455875635147,
-0.07366514950990677,
-0.1129290759563446,
0.36039143800735474,
0.14416994154453278,
0.22142000496387482,
0.2751777172088623,
0.06325356662273407,
0.011139124631881714,
-0.04440828412771225,
0.21566501259803772,
0.37253519892692566,
0.09085740149021149,
-0.16231761872768402,
0.008314631879329681,
0.003054607193917036,
0.025527890771627426,
0.11603732407093048,
-0.061675965785980225,
-0.46995067596435547,
0.3420883119106293,
0.04895910993218422,
0.1168971061706543,
-0.059060465544462204,
0.11152543127536774,
-0.22927847504615784,
-0.04325741529464722,
0.5168875455856323,
0.1539977341890335,
0.13168013095855713,
0.04408273473381996,
0.032783739268779755,
0.5230236053466797,
-0.1982860565185547,
0.024688487872481346,
-0.21922186017036438,
0.018057260662317276,
0.48650237917900085,
0.42598956823349,
0.09425081312656403,
-0.026139579713344574,
0.4793217182159424,
0.0896812155842781,
0.09089777618646622,
0.35618433356285095,
-0.05009723827242851,
0.054943569004535675,
-0.1865662783384323,
-0.03881886228919029,
0.19215849041938782,
-0.22903621196746826,
0.2488803267478943,
0.26218611001968384,
-0.05148238688707352,
-0.3562256097793579,
-0.07596297562122345,
-0.27275002002716064,
0.24198542535305023,
-0.219963937997818,
-0.23840834200382233,
0.25708556175231934,
-0.1364898532629013,
0.10880282521247864,
0.41271737217903137,
-0.1660006195306778,
-0.1683591604232788,
0.19645270705223083,
0.14567852020263672,
-0.2558954358100891,
0.3493213951587677,
0.01033036783337593,
0.13497596979141235,
0.1556820571422577,
0.04227294400334358,
0.7475676536560059,
-0.4142773747444153,
0.14088988304138184,
-0.17506827414035797,
0.1564684957265854,
0.2523054778575897,
0.4177722632884979,
-0.24359950423240662,
-0.21428634226322174,
0.21197748184204102,
0.07344386726617813,
-0.13100433349609375,
0.19412663578987122,
-0.09873782098293304,
0.0808149129152298,
0.05632049962878227,
0.0752585232257843,
-0.04123516380786896,
0.21306633949279785,
0.12651990354061127,
0.1920010894536972,
0.22908490896224976,
0.1382923573255539,
-0.10696877539157867,
0.08597631007432938,
-0.11103212833404541,
0.01391107589006424,
-0.3589211106300354,
0.09744933247566223,
0.2541069984436035,
-0.355303555727005,
0.37862125039100647,
0.27193012833595276,
0.006804432719945908,
0.13422122597694397,
0.47631821036338806,
0.39503103494644165,
0.3025309443473816,
-0.29443302750587463,
-0.18985949456691742,
-0.26398470997810364,
0.35945022106170654,
-0.01349354162812233,
0.1397276371717453,
-0.581243634223938,
0.061645641922950745,
-0.07075238972902298,
-0.0522550567984581,
0.003525972366333008,
0.18892033398151398,
-0.13349397480487823,
0.10615512728691101,
-0.33262839913368225,
-0.07844683527946472,
-0.08842916786670685,
-0.015610894188284874,
-0.06666046380996704,
-0.43353426456451416,
0.33512288331985474,
-0.12347525358200073,
0.04848981648683548,
0.0505678653717041,
0.16132919490337372,
-0.23147957026958466,
-0.12278060615062714,
0.46602094173431396,
0.20352214574813843,
0.17421452701091766,
-0.29068902134895325,
0.04107791930437088,
-0.1961384117603302,
-0.04518774151802063,
-0.34567853808403015,
0.030292369425296783,
0.02242136001586914,
0.30427026748657227,
-0.1964488923549652,
0.054057832807302475,
-0.30245527625083923,
0.14616431295871735,
0.2656729221343994,
0.02784339152276516,
0.16702938079833984,
-0.08944743871688843,
-0.17172953486442566,
0.02506883069872856,
0.09711089730262756,
0.5377411246299744,
0.08248935639858246,
0.2462521642446518,
-0.19964835047721863,
-0.08838861435651779,
0.2424054592847824,
-0.2692520022392273,
-0.5248529314994812,
0.38996195793151855,
0.09188695251941681,
0.20483264327049255,
-0.21265043318271637,
-0.2469797432422638,
0.013411685824394226,
0.13866010308265686,
-0.24245429039001465,
-0.13936638832092285,
0.1419806182384491,
0.0024186912924051285,
0.1437821239233017,
-0.041259441524744034,
0.32984817028045654,
0.09806010127067566,
-0.40877747535705566,
-0.06126284971833229,
-0.2565208673477173
] |
https://github.com/huggingface/datasets/issues/643 | Caching processed dataset at wrong folder | To reproduce it:
```bash
!df -h | grep sda1
```
```python
f = open("/content/drive/My Drive/test_to_remove.txt", "w")
f.write(("a"*511 + "\n") * ((1 << 30) // 512)) # 1GiB
f.write(("a"*511 + "\n") * ((1 << 30) // 512)) # 1GiB
f.close()
```
```bash
!ls -lh /content/drive/My\ Drive/test_to_remove.txt
!df -h | grep sda1
!rm -rf /content/drive/My\ Drive/test_to_remove.txt
```
[Colab](https://colab.research.google.com/drive/1D0UiweCYQwwWZ65EEhuqqbaDDbhJYXfm?usp=sharing)
| Hi guys, I run this on my Colab (PRO):
```python
from datasets import load_dataset
dataset = load_dataset('text', data_files='/content/corpus.txt', cache_dir='/content/drive/My Drive', split='train')
def encode(examples):
return tokenizer(examples['text'], truncation=True, padding='max_length')
dataset = dataset.map(encode, batched=True)
```
The file is about 4 GB, so I cannot process it on the Colab HD because there is no enough space. So I decided to mount my Google Drive fs and do it on it.
The dataset is cached in the right place but by processing it (applying `encode` function) seems to use a different folder because Colab HD starts to grow and it crashes when it should be done in the Drive fs.
What gets me crazy, it prints it is processing/encoding the dataset in the right folder:
```
Testing the mapped function outputs
Testing finished, running the mapping function on the dataset
Caching processed dataset at /content/drive/My Drive/text/default-ad3e69d6242ee916/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/cache-b16341780a59747d.arrow
``` | 56 | Caching processed dataset at wrong folder
Hi guys, I run this on my Colab (PRO):
```python
from datasets import load_dataset
dataset = load_dataset('text', data_files='/content/corpus.txt', cache_dir='/content/drive/My Drive', split='train')
def encode(examples):
return tokenizer(examples['text'], truncation=True, padding='max_length')
dataset = dataset.map(encode, batched=True)
```
The file is about 4 GB, so I cannot process it on the Colab HD because there is no enough space. So I decided to mount my Google Drive fs and do it on it.
The dataset is cached in the right place but by processing it (applying `encode` function) seems to use a different folder because Colab HD starts to grow and it crashes when it should be done in the Drive fs.
What gets me crazy, it prints it is processing/encoding the dataset in the right folder:
```
Testing the mapped function outputs
Testing finished, running the mapping function on the dataset
Caching processed dataset at /content/drive/My Drive/text/default-ad3e69d6242ee916/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/cache-b16341780a59747d.arrow
```
To reproduce it:
```bash
!df -h | grep sda1
```
```python
f = open("/content/drive/My Drive/test_to_remove.txt", "w")
f.write(("a"*511 + "\n") * ((1 << 30) // 512)) # 1GiB
f.write(("a"*511 + "\n") * ((1 << 30) // 512)) # 1GiB
f.close()
```
```bash
!ls -lh /content/drive/My\ Drive/test_to_remove.txt
!df -h | grep sda1
!rm -rf /content/drive/My\ Drive/test_to_remove.txt
```
[Colab](https://colab.research.google.com/drive/1D0UiweCYQwwWZ65EEhuqqbaDDbhJYXfm?usp=sharing)
| [
-0.08412209153175354,
0.19454526901245117,
-0.016326352953910828,
0.4593133330345154,
-0.04390528053045273,
-0.07286743819713593,
0.3859434425830841,
0.030553914606571198,
0.03372136503458023,
0.20726615190505981,
-0.03545251488685608,
0.2843727469444275,
0.04713255912065506,
0.4058023989200592,
-0.11385715007781982,
0.35542112588882446,
0.2777642607688904,
-0.1252811700105667,
-0.0011572986841201782,
-0.11845482140779495,
-0.34211066365242004,
0.3819754719734192,
-0.20498515665531158,
-0.02564924955368042,
-0.4567471742630005,
-0.09564957022666931,
-0.1473441869020462,
-0.0011714883148670197,
-0.015974832698702812,
0.28343313932418823,
0.1546795666217804,
0.03423048183321953,
0.20644865930080414,
0.6668289303779602,
-0.00012679467909038067,
-0.17387047410011292,
0.2114759236574173,
-0.200600266456604,
-0.27278241515159607,
-0.10199561715126038,
-0.30441033840179443,
0.0360216349363327,
-0.11117817461490631,
-0.08113835006952286,
-0.1309182494878769,
0.11510613560676575,
0.19568046927452087,
-0.5906018614768982,
-0.021709159016609192,
0.2646547853946686,
0.0812927857041359,
-0.4493579864501953,
-0.5469544529914856,
0.351917564868927,
0.11213307082653046,
0.2696872353553772,
-0.12555645406246185,
0.24547091126441956,
-0.029603876173496246,
-0.1314677596092224,
-0.08997225016355515,
0.3205051124095917,
-0.11098025739192963,
-0.02869415655732155,
0.22429323196411133,
0.32446709275245667,
-0.3142947852611542,
-0.2437790334224701,
0.5524443984031677,
-0.405146062374115,
0.322174072265625,
-0.3460020124912262,
-0.16349592804908752,
-0.30338895320892334,
-0.34983736276626587,
-0.3369373381137848,
0.5142973065376282,
0.12257654219865799,
-0.08384396135807037,
0.0870276540517807,
-0.5243644118309021,
-0.18939341604709625,
0.09647557139396667,
0.08815401792526245,
-0.22076591849327087,
0.28850165009498596,
-0.26367056369781494,
0.032477784901857376,
-0.038378845900297165,
0.23513326048851013,
0.6513157486915588,
-0.4771050810813904,
0.012942526489496231,
0.22875066101551056,
-0.11911536753177643,
0.10849590599536896,
-0.14204049110412598,
0.48236149549484253,
-0.21839159727096558,
-0.12623447179794312,
-0.2273809313774109,
-0.1387719213962555,
-0.12282086163759232,
0.09688062965869904,
0.05490093678236008,
0.47194087505340576,
-0.06679671257734299,
0.13345378637313843,
0.0674370750784874,
0.09576288610696793,
-0.49575483798980713,
-0.05393010377883911,
0.005182887427508831,
-0.23322288691997528,
-0.03551402688026428,
0.13115458190441132,
-0.016515037044882774,
-0.2762654423713684,
-0.21029551327228546,
0.018731117248535156,
-0.3704523742198944,
-0.01851140893995762,
0.09340077638626099,
0.26197659969329834,
-0.02475333958864212,
-0.12638989090919495,
-0.22203844785690308,
0.24806971848011017,
-0.2516387104988098,
0.4041091799736023,
-0.12241662293672562,
0.04744865745306015,
-0.36777690052986145,
0.42212894558906555,
0.07116681337356567,
-0.21112795174121857,
0.11362102627754211,
0.06183292716741562,
-0.004740335047245026,
-0.3111232817173004,
-0.07622053474187851,
-0.43262651562690735,
0.4141174256801605,
0.11124479025602341,
0.11415435373783112,
0.41614896059036255,
0.02645239792764187,
-0.26708275079727173,
-0.08235462009906769,
0.23688006401062012,
-0.5531479120254517,
-0.20450039207935333,
0.15991289913654327,
0.004120207857340574,
-0.2979142665863037,
-0.06699168682098389,
-0.6956050395965576,
0.1260886788368225,
0.4034119248390198,
-0.15624010562896729,
0.018571726977825165,
-0.051468200981616974,
-0.4866917133331299,
-0.2335224747657776,
0.05059555172920227,
0.17090240120887756,
-0.27701592445373535,
0.1444513201713562,
-0.348914235830307,
0.5182404518127441,
0.5450218915939331,
0.4078434109687805,
0.07122896611690521,
0.2802248001098633,
-0.5115204453468323,
-0.019544918090105057,
0.07523008435964584,
-0.25709688663482666,
-0.7950388193130493,
0.3377695381641388,
-0.08355209976434708,
0.0778089091181755,
-0.015746034681797028,
-0.0586845800280571,
0.19733218848705292,
-0.10494723170995712,
0.15352416038513184,
0.13607221841812134,
0.10038870573043823,
0.18006688356399536,
-0.2769971191883087,
-0.12628084421157837,
-0.04091596603393555,
-0.17355769872665405,
0.03681498020887375,
0.17253389954566956,
0.04766556993126869,
-0.3246940076351166,
0.18042242527008057,
-0.11660043895244598,
0.1493273228406906,
0.2664095163345337,
0.23968447744846344,
-0.12332908809185028,
-0.022479642182588577,
0.13647601008415222,
-0.22202575206756592,
0.15326493978500366,
0.03407111018896103,
-0.15380068123340607,
-0.5125195980072021,
-0.10512233525514603,
-0.12526077032089233,
-0.14727769792079926,
-0.11385394632816315,
-0.2297271490097046,
-0.06336717307567596,
0.3790796101093292,
0.09415176510810852,
0.05428919568657875,
-0.005392272025346756,
0.5049633383750916,
0.08774352818727493,
-0.1718437820672989,
-0.055808890610933304,
0.18888942897319794,
-0.1316518932580948,
-0.2515570819377899,
-0.1695166975259781,
-0.13287487626075745,
0.22088971734046936,
-0.2341688573360443,
-0.18339091539382935,
0.14538876712322235,
0.2613755464553833,
0.4232812523841858,
-0.035013794898986816,
0.2826690673828125,
0.0854923352599144,
0.107439786195755,
0.17938734591007233,
-0.07344947755336761,
-0.023070309311151505,
0.1655798852443695,
-0.10582473129034042,
0.28176775574684143,
-0.1135013997554779,
0.18411356210708618,
-0.10231475532054901,
-0.32436326146125793,
-0.0864485502243042,
0.06313711404800415,
0.28963300585746765,
-0.13161666691303253,
0.07990099489688873,
0.3997073471546173,
0.3467101752758026,
0.23565556108951569,
0.2422429621219635,
0.3499775826931,
0.6368634700775146,
0.04117254540324211,
-0.04808671027421951,
0.14041855931282043,
-0.08090653270483017,
-0.2828871011734009,
0.2752012014389038,
0.5394611358642578,
0.4638066291809082,
-0.09886761009693146,
0.31495222449302673,
0.16912811994552612,
0.0862853080034256,
-0.16008475422859192,
0.20286503434181213,
0.06761303544044495,
0.25050532817840576,
0.03374464809894562,
0.24409832060337067,
-0.0421401709318161,
-0.09047814458608627,
0.13349297642707825,
0.04070654511451721,
0.22353661060333252,
-0.114471435546875,
0.599041223526001,
-0.3186646103858948,
-0.21061661839485168,
-0.21024426817893982,
-0.24068903923034668,
0.1269741654396057,
-0.20225881040096283,
-0.13222531974315643,
0.31609731912612915,
-0.046973660588264465,
0.026432305574417114,
0.21525757014751434,
0.1936611831188202,
-0.14260613918304443,
-0.458107054233551,
-0.15888261795043945,
0.161017045378685,
-0.25789889693260193,
-0.08917537331581116,
0.3661745488643646,
-0.049939025193452835,
0.04227782040834427,
-0.15296591818332672,
0.00761636346578598,
-0.39258918166160583,
-0.13847222924232483,
0.26125991344451904,
-0.18237803876399994,
0.32251930236816406,
-0.22174808382987976,
-0.024166561663150787,
-0.43952780961990356,
-0.3129887580871582,
-0.0940910279750824,
-0.025611689314246178,
-0.10190750658512115,
-0.410866379737854,
-0.008952554315328598,
-0.04935675859451294,
-0.1378784477710724,
0.0002186298370361328,
-0.09526067227125168,
-0.0734972432255745,
0.03956436365842819,
-0.014223512262105942,
0.2749411463737488,
0.018020372837781906,
-0.07924337685108185,
-0.1839403510093689,
0.4457669258117676,
-0.2575642764568329,
-0.3838845491409302,
-0.5558649897575378,
0.18451376259326935,
-0.08444289118051529,
-0.0193764790892601,
-0.04454389959573746,
-0.08015613257884979,
0.11605638265609741,
0.40780168771743774,
-0.48329776525497437,
-0.24453802406787872,
-0.15509457886219025,
-0.020274074748158455,
0.17703579366207123,
-0.0848398208618164,
0.30104243755340576,
0.06986922770738602,
0.18744336068630219,
-0.050175741314888,
-0.41788050532341003,
0.03491375222802162,
0.27925893664360046,
0.32623693346977234,
-0.007592428475618362,
0.2600139379501343,
0.09159956872463226,
0.5603270530700684,
0.27192679047584534,
-0.035767149180173874,
0.4003482162952423,
-0.00690636970102787,
0.2754010558128357,
-0.2521512508392334,
-0.11577348411083221,
0.2647079825401306,
0.05520521104335785,
-0.7013983130455017,
0.4209539294242859,
0.05774709954857826,
-0.4382655620574951,
0.17729702591896057,
-0.21168085932731628,
-0.3041621744632721,
-0.22471386194229126,
0.22299599647521973,
0.00124257430434227,
0.17845411598682404,
0.060588981956243515,
0.13987421989440918,
-0.1659090667963028,
-0.21830326318740845,
0.08348406851291656,
0.05657970532774925,
0.3373071849346161,
0.13397102057933807,
0.2628173828125,
-0.44826918840408325,
-0.3884054720401764,
0.34940260648727417,
0.36113476753234863,
0.047024279832839966,
-0.08484701812267303,
0.2404612898826599,
0.18696406483650208,
-0.14442040026187897,
0.5466488599777222,
-0.33474695682525635,
-0.1636124849319458,
-0.12997080385684967,
0.016988664865493774,
-0.014109419658780098,
0.0017945952713489532,
0.012402094900608063,
0.36658841371536255,
-0.03253798186779022,
0.5276474356651306,
0.28050684928894043,
-0.04221087321639061,
-0.10704731941223145,
0.23495081067085266,
-0.2846837639808655,
-0.15014417469501495,
-0.1825913041830063,
-0.5665205121040344,
-0.20811572670936584,
-0.018408775329589844,
0.14759163558483124,
0.0265530813485384,
0.03632625192403793,
-0.0005757361650466919,
0.12859271466732025,
-0.09070836007595062,
0.10476202517747879,
0.13627658784389496,
0.39408746361732483,
0.17355243861675262,
-0.10359539091587067,
0.06452327221632004,
0.21686285734176636,
0.3731347322463989,
0.5316537618637085,
0.1416010856628418,
0.1814558058977127,
0.21403366327285767,
-0.17202790081501007,
0.23649099469184875,
0.3640683889389038,
-0.15165969729423523,
-0.20995837450027466,
-0.1321105659008026,
-0.022067323327064514,
-0.33698034286499023,
0.3455794155597687,
0.15785302221775055,
0.3325902819633484,
-0.3623312711715698,
-0.41151946783065796,
0.41175809502601624,
0.1483871042728424,
-0.3303752541542053,
0.31580787897109985,
0.03312675282359123,
-0.5511077642440796,
0.4613457918167114,
0.12809471786022186,
1.1126842498779297,
-0.0020383819937705994,
0.1784241497516632,
0.11356990039348602,
0.09570135176181793,
-0.019431978464126587,
-0.27553272247314453,
0.20059944689273834,
-0.1734854280948639,
-0.5922015905380249,
-0.07991037517786026,
-0.16189463436603546,
-0.20401471853256226,
0.1059158444404602,
-0.13291119039058685,
0.4099911153316498,
-0.01664368063211441,
-0.056709062308073044,
-0.09468287974596024,
-0.06107332929968834,
-0.04684506356716156,
-0.09613054990768433,
-0.21896982192993164,
0.05032063275575638,
-0.03694208711385727,
0.3914657235145569,
-0.14950788021087646,
0.21687382459640503,
-0.19719867408275604,
0.04227040708065033,
-0.1725223809480667,
-0.02998172491788864,
-0.37398943305015564,
0.016700811684131622,
-0.36729562282562256,
-0.32031312584877014,
-0.14619536697864532,
0.3489956557750702,
0.4700148105621338,
0.24220362305641174,
0.0681796744465828,
0.013583464547991753,
0.0455537885427475,
0.2881099581718445,
0.044952016323804855,
-0.4729411005973816,
0.0219207052141428,
0.08926422148942947,
0.0966317430138588,
-0.30601513385772705,
0.1714947521686554,
-0.3764616847038269,
-0.030977025628089905,
0.09097204357385635,
-0.1157446950674057,
0.03237311914563179,
-0.23533298075199127,
-0.0012708231806755066,
-0.12411567568778992,
0.09112903475761414,
0.03816338628530502,
-0.024962373077869415,
0.27131468057632446,
0.4538406729698181,
-0.49131736159324646,
-0.4338659644126892,
-0.24297668039798737,
0.21969082951545715,
0.27615559101104736,
0.09230251610279083,
0.47147297859191895,
-0.19631552696228027,
-0.20172126591205597,
-0.003578152507543564,
-0.03694956749677658,
-0.25879475474357605,
0.32997193932533264,
0.1093435287475586,
-0.4681282937526703,
-0.10549745708703995,
-0.1262487918138504,
0.008128326386213303,
0.28135839104652405,
0.02667824551463127,
-0.4296485483646393,
-0.3005278706550598,
-0.3171997368335724,
0.016102492809295654,
-0.05971727892756462,
0.0772562026977539,
0.06958047300577164,
0.11938226222991943,
0.08923526108264923,
-0.19503064453601837,
-0.18294906616210938,
0.20485351979732513,
-0.09477066248655319,
0.12279412895441055,
0.07863327860832214,
-0.017576351761817932,
0.4281572997570038,
-0.19396893680095673,
-0.08138132840394974,
0.14314749836921692,
0.07386352121829987,
-0.12011797726154327,
-0.04920042306184769,
0.15489231050014496,
0.19745028018951416,
-0.08152418583631516,
-0.04581058397889137,
-0.24721762537956238,
0.07090175151824951,
-0.49011456966400146,
0.295086145401001,
0.33480867743492126,
0.1295575201511383,
-0.16132992506027222,
0.20499593019485474,
-0.11874604970216751,
-0.04101114347577095,
-0.07011275738477707,
-0.14109431207180023,
0.36003410816192627,
0.1319342851638794,
0.23072461783885956,
0.31766584515571594,
0.04634451866149902,
-0.02781081199645996,
-0.06529507786035538,
0.20717185735702515,
0.45478150248527527,
0.13233810663223267,
-0.18517965078353882,
-0.03283548355102539,
-0.028497884050011635,
0.10773259401321411,
0.059315845370292664,
-0.08558152616024017,
-0.45708101987838745,
0.31996220350265503,
0.04240617901086807,
0.11962105333805084,
-0.0851219967007637,
0.06941572576761246,
-0.2036309391260147,
-0.011687684804201126,
0.5102899074554443,
0.12880940735340118,
0.16026467084884644,
0.04735630005598068,
-0.0059920912608504295,
0.5263212323188782,
-0.1773722767829895,
0.05667045712471008,
-0.20049259066581726,
-0.010306291282176971,
0.5074065327644348,
0.39610999822616577,
0.052276767790317535,
-0.009569771587848663,
0.49423056840896606,
0.12248365581035614,
0.06461603939533234,
0.39557012915611267,
-0.013043094426393509,
0.04676671326160431,
-0.19546006619930267,
-0.061731528490781784,
0.1664906144142151,
-0.23718661069869995,
0.2832928001880646,
0.18716758489608765,
-0.06919509917497635,
-0.3907463848590851,
-0.017704345285892487,
-0.18242117762565613,
0.23733967542648315,
-0.2330203652381897,
-0.22966928780078888,
0.18608680367469788,
-0.13800959289073944,
0.07924087345600128,
0.3893231153488159,
-0.16834457218647003,
-0.18063780665397644,
0.15582796931266785,
0.17712365090847015,
-0.2397204488515854,
0.3626713752746582,
-0.02890928089618683,
0.13238799571990967,
0.15181109309196472,
0.05002908781170845,
0.7001643180847168,
-0.35577017068862915,
0.13347914814949036,
-0.10259418189525604,
0.17005059123039246,
0.28603851795196533,
0.39810073375701904,
-0.24472463130950928,
-0.18872126936912537,
0.17636460065841675,
0.06700139492750168,
-0.12249387800693512,
0.27179327607154846,
-0.14918966591358185,
0.032715823501348495,
0.09777070581912994,
0.07509234547615051,
-0.05001172795891762,
0.18273043632507324,
0.16196155548095703,
0.16374008357524872,
0.21667544543743134,
0.1712021827697754,
-0.13854452967643738,
0.14000067114830017,
-0.14634205400943756,
0.04111142456531525,
-0.36516448855400085,
0.08798912167549133,
0.2932603061199188,
-0.2734496295452118,
0.42566993832588196,
0.29813429713249207,
0.013294056057929993,
0.1791388988494873,
0.40299728512763977,
0.3924373984336853,
0.34115442633628845,
-0.3213726878166199,
-0.16172277927398682,
-0.2840149998664856,
0.36397162079811096,
-0.026698317378759384,
0.16063781082630157,
-0.5455217361450195,
0.07935050129890442,
-0.001282237470149994,
-0.06129615008831024,
0.025704555213451385,
0.16798937320709229,
-0.10003200173377991,
0.14877890050411224,
-0.31148481369018555,
-0.11306853592395782,
-0.075188547372818,
-0.08744160830974579,
-0.10505544394254684,
-0.4513826370239258,
0.319715678691864,
-0.09074491262435913,
0.048518598079681396,
0.04772048443555832,
0.11988675594329834,
-0.2438070923089981,
-0.11185179650783539,
0.4397113621234894,
0.2618427872657776,
0.16834105551242828,
-0.2935880124568939,
-0.025957565754652023,
-0.2678939998149872,
0.01909061148762703,
-0.31063640117645264,
0.017039962112903595,
-0.013297636061906815,
0.3414582312107086,
-0.2391728013753891,
0.0636947900056839,
-0.3666890263557434,
0.17392005026340485,
0.27569007873535156,
0.011921338737010956,
0.06774071604013443,
-0.05717657506465912,
-0.26740652322769165,
0.07808149605989456,
0.0970485657453537,
0.5984993577003479,
0.09427523612976074,
0.29170867800712585,
-0.24872715771198273,
-0.08656227588653564,
0.3026677072048187,
-0.35107627511024475,
-0.5694529414176941,
0.37087777256965637,
0.0836351215839386,
0.23537728190422058,
-0.16460241377353668,
-0.27260327339172363,
0.009831033647060394,
0.12280549854040146,
-0.24636349081993103,
-0.11481916904449463,
0.03847634047269821,
0.015251325443387032,
0.13418500125408173,
-0.03204510360956192,
0.2907693386077881,
0.14695706963539124,
-0.4093952775001526,
0.0017056837677955627,
-0.23897145688533783
] |
https://github.com/huggingface/datasets/issues/643 | Caching processed dataset at wrong folder | Apparently, Colab uses a local cache of the data files read/written from Google Drive. See:
- https://github.com/googlecolab/colabtools/issues/2087#issuecomment-860818457
- https://github.com/googlecolab/colabtools/issues/1915#issuecomment-804234540
- https://github.com/googlecolab/colabtools/issues/2147#issuecomment-885052636 | Hi guys, I run this on my Colab (PRO):
```python
from datasets import load_dataset
dataset = load_dataset('text', data_files='/content/corpus.txt', cache_dir='/content/drive/My Drive', split='train')
def encode(examples):
return tokenizer(examples['text'], truncation=True, padding='max_length')
dataset = dataset.map(encode, batched=True)
```
The file is about 4 GB, so I cannot process it on the Colab HD because there is no enough space. So I decided to mount my Google Drive fs and do it on it.
The dataset is cached in the right place but by processing it (applying `encode` function) seems to use a different folder because Colab HD starts to grow and it crashes when it should be done in the Drive fs.
What gets me crazy, it prints it is processing/encoding the dataset in the right folder:
```
Testing the mapped function outputs
Testing finished, running the mapping function on the dataset
Caching processed dataset at /content/drive/My Drive/text/default-ad3e69d6242ee916/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/cache-b16341780a59747d.arrow
``` | 21 | Caching processed dataset at wrong folder
Hi guys, I run this on my Colab (PRO):
```python
from datasets import load_dataset
dataset = load_dataset('text', data_files='/content/corpus.txt', cache_dir='/content/drive/My Drive', split='train')
def encode(examples):
return tokenizer(examples['text'], truncation=True, padding='max_length')
dataset = dataset.map(encode, batched=True)
```
The file is about 4 GB, so I cannot process it on the Colab HD because there is no enough space. So I decided to mount my Google Drive fs and do it on it.
The dataset is cached in the right place but by processing it (applying `encode` function) seems to use a different folder because Colab HD starts to grow and it crashes when it should be done in the Drive fs.
What gets me crazy, it prints it is processing/encoding the dataset in the right folder:
```
Testing the mapped function outputs
Testing finished, running the mapping function on the dataset
Caching processed dataset at /content/drive/My Drive/text/default-ad3e69d6242ee916/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/cache-b16341780a59747d.arrow
```
Apparently, Colab uses a local cache of the data files read/written from Google Drive. See:
- https://github.com/googlecolab/colabtools/issues/2087#issuecomment-860818457
- https://github.com/googlecolab/colabtools/issues/1915#issuecomment-804234540
- https://github.com/googlecolab/colabtools/issues/2147#issuecomment-885052636 | [
-0.06103435903787613,
0.27208411693573,
-0.028377313166856766,
0.4453434944152832,
-0.08153101801872253,
-0.02102949097752571,
0.33343735337257385,
0.035966549068689346,
-0.04892965033650398,
0.23377639055252075,
-0.013697903603315353,
0.27560269832611084,
0.0365145318210125,
0.39523112773895264,
-0.08284232765436172,
0.33471956849098206,
0.2051369845867157,
-0.051005199551582336,
0.05001112073659897,
-0.08528663963079453,
-0.35515397787094116,
0.36715075373649597,
-0.16795417666435242,
-0.0600113719701767,
-0.4700477719306946,
-0.054497070610523224,
-0.13622350990772247,
-0.0494375005364418,
-0.041768878698349,
0.2399597018957138,
0.28626468777656555,
0.035959433764219284,
0.12369696795940399,
0.5833587646484375,
-0.0001266251492779702,
-0.15615764260292053,
0.22028033435344696,
-0.21297839283943176,
-0.23455248773097992,
-0.10912533104419708,
-0.3383675813674927,
-0.014568869955837727,
-0.026006827130913734,
-0.06006551533937454,
-0.21095308661460876,
0.14814509451389313,
0.26975515484809875,
-0.491091251373291,
-0.013143070042133331,
0.24093639850616455,
0.07932060956954956,
-0.47091859579086304,
-0.5250528454780579,
0.3897104859352112,
0.13528162240982056,
0.2636300027370453,
-0.17660574615001678,
0.3681117296218872,
0.04854981601238251,
-0.117983378469944,
-0.11884785443544388,
0.3179060220718384,
-0.0560809001326561,
0.10589545965194702,
0.21134468913078308,
0.3340999484062195,
-0.3169404864311218,
-0.26320481300354004,
0.5499746203422546,
-0.4216972291469574,
0.33625322580337524,
-0.3492867648601532,
-0.13510383665561676,
-0.3083280920982361,
-0.3160904049873352,
-0.33116796612739563,
0.5454385876655579,
0.17979702353477478,
-0.14868104457855225,
0.07935118675231934,
-0.5265552401542664,
-0.16875994205474854,
0.09502820670604706,
0.05488777905702591,
-0.20621222257614136,
0.29811376333236694,
-0.26024577021598816,
0.01585034281015396,
-0.07814574241638184,
0.2501659393310547,
0.7252609133720398,
-0.36864712834358215,
0.06603929400444031,
0.23895636200904846,
-0.04887769743800163,
0.09353992342948914,
-0.12926211953163147,
0.6320323348045349,
-0.27384519577026367,
-0.1767207235097885,
-0.18683339655399323,
-0.10857982188463211,
-0.15759849548339844,
0.13801966607570648,
0.018836041912436485,
0.47895297408103943,
0.0039040446281433105,
0.09200160205364227,
0.07521853595972061,
0.057281699031591415,
-0.4851468801498413,
-0.053683556616306305,
-0.007904767990112305,
-0.2523822486400604,
-0.038313671946525574,
0.12863871455192566,
-0.04702813923358917,
-0.31970125436782837,
-0.0857711136341095,
0.00026064924895763397,
-0.314064085483551,
-0.020906884223222733,
0.1428413838148117,
0.1975008249282837,
-0.05272633582353592,
-0.12748602032661438,
-0.2333371937274933,
0.13532984256744385,
-0.203335240483284,
0.3468831479549408,
-0.10636095702648163,
0.010696539655327797,
-0.29814451932907104,
0.4901648759841919,
0.11978055536746979,
-0.27683040499687195,
0.14246505498886108,
-0.008190890774130821,
-0.019696831703186035,
-0.2453966587781906,
-0.05825906991958618,
-0.4647097885608673,
0.4115084409713745,
0.17771676182746887,
0.1157999187707901,
0.39213529229164124,
0.05385652929544449,
-0.26974615454673767,
-0.16761872172355652,
0.25861749053001404,
-0.5754591822624207,
-0.29967695474624634,
0.23043660819530487,
-0.02080449089407921,
-0.2513173222541809,
-0.06531297415494919,
-0.6218789219856262,
0.10694465041160583,
0.4818570911884308,
-0.17545939981937408,
0.032123103737831116,
-0.07478710263967514,
-0.609878659248352,
-0.21555623412132263,
0.019656961783766747,
0.2119017243385315,
-0.34358078241348267,
0.1560850441455841,
-0.2851773798465729,
0.4931887984275818,
0.5012341737747192,
0.40640735626220703,
0.0037116825114935637,
0.22756844758987427,
-0.4611550271511078,
-0.08454661816358566,
0.016954705119132996,
-0.29203417897224426,
-0.7751473784446716,
0.319612979888916,
-0.0727759525179863,
0.007427191361784935,
-0.02727014571428299,
-0.08565562963485718,
0.2009657323360443,
-0.17159035801887512,
0.2674722373485565,
0.19722813367843628,
0.045478932559490204,
0.23044168949127197,
-0.29519179463386536,
-0.1713251769542694,
-0.08743616938591003,
-0.1459079384803772,
0.017695963382720947,
0.17573213577270508,
0.024173781275749207,
-0.3182271122932434,
0.09072180837392807,
-0.11315992474555969,
0.16022734344005585,
0.25994423031806946,
0.23579932749271393,
-0.15457719564437866,
0.008715769276022911,
0.23361822962760925,
-0.15429988503456116,
0.16252774000167847,
0.0036726631224155426,
-0.1264238804578781,
-0.45460444688796997,
-0.08868734538555145,
-0.12747710943222046,
-0.1392585039138794,
-0.15009799599647522,
-0.21661964058876038,
-0.0460939034819603,
0.32673943042755127,
0.12410332262516022,
0.09009319543838501,
0.007263053208589554,
0.5470098853111267,
0.09622256457805634,
-0.18616053462028503,
-0.06889715790748596,
0.1952027976512909,
-0.12871265411376953,
-0.20068036019802094,
-0.16031356155872345,
-0.1325291097164154,
0.2135445773601532,
-0.22562390565872192,
-0.21901163458824158,
0.11920488625764847,
0.19582340121269226,
0.402707576751709,
0.01708390563726425,
0.2980303168296814,
0.12682680785655975,
0.09363429248332977,
0.195058211684227,
-0.1518372893333435,
0.007207722403109074,
0.14140722155570984,
-0.05166977643966675,
0.30323684215545654,
-0.10354040563106537,
0.1649564802646637,
-0.12152215838432312,
-0.2772287130355835,
-0.01439041830599308,
0.06297843158245087,
0.24632006883621216,
-0.1730794608592987,
0.11196351051330566,
0.3348490595817566,
0.4395119845867157,
0.2801445424556732,
0.21449118852615356,
0.38090166449546814,
0.5975574851036072,
0.09681792557239532,
-0.05890168994665146,
0.15619489550590515,
-0.12043709307909012,
-0.3311530351638794,
0.28584975004196167,
0.515872597694397,
0.4232354164123535,
-0.11362367123365402,
0.32283687591552734,
0.19805023074150085,
0.061659641563892365,
-0.2252926528453827,
0.11604790389537811,
0.0464668907225132,
0.24953290820121765,
-0.024331502616405487,
0.25533729791641235,
-0.06806997209787369,
-0.06447184830904007,
0.2110360860824585,
0.06944786012172699,
0.20281335711479187,
-0.06495651602745056,
0.5757150053977966,
-0.33959174156188965,
-0.27047160267829895,
-0.30583229660987854,
-0.30918577313423157,
0.08824586868286133,
-0.18298938870429993,
-0.11511953175067902,
0.33136987686157227,
-0.00176960788667202,
-0.02203318662941456,
0.2284809648990631,
0.24632583558559418,
-0.15726250410079956,
-0.537196159362793,
-0.1162831038236618,
0.07967513054609299,
-0.2961494028568268,
-0.08471143245697021,
0.363379567861557,
-0.028939252719283104,
0.033170122653245926,
-0.2750113010406494,
-0.009912296198308468,
-0.27737921476364136,
-0.09033254534006119,
0.3296646177768707,
-0.12286096811294556,
0.31799185276031494,
-0.2799588739871979,
-0.06810222566127777,
-0.5162338018417358,
-0.340628981590271,
-0.09035215526819229,
-0.040702760219573975,
-0.06439214199781418,
-0.4448989927768707,
-0.04234825819730759,
-0.03312200680375099,
-0.12725988030433655,
0.06475567817687988,
-0.20191486179828644,
0.018033228814601898,
0.10640430450439453,
0.032687317579984665,
0.30010372400283813,
-0.010556577704846859,
-0.08356882631778717,
-0.15443405508995056,
0.40332189202308655,
-0.28723716735839844,
-0.3533238172531128,
-0.6466093063354492,
0.24988813698291779,
-0.13518662750720978,
-0.028356533497571945,
-0.02519441768527031,
-0.0988631322979927,
0.09050138294696808,
0.3466602563858032,
-0.46977686882019043,
-0.34158530831336975,
-0.16214632987976074,
-0.02301599085330963,
0.28761494159698486,
-0.11579389870166779,
0.3167225122451782,
0.05333234742283821,
0.1837206333875656,
-0.04758730158209801,
-0.45732539892196655,
0.04129966348409653,
0.33449673652648926,
0.31549906730651855,
0.07120538502931595,
0.16563111543655396,
0.052488621324300766,
0.5838849544525146,
0.19638414680957794,
0.003347828984260559,
0.4174215495586395,
0.03341628611087799,
0.2707604765892029,
-0.2606351375579834,
-0.11673662811517715,
0.3184654116630554,
-0.009153231978416443,
-0.7088978290557861,
0.3999037742614746,
0.14240986108779907,
-0.4741086959838867,
0.11238187551498413,
-0.22953324019908905,
-0.3285394608974457,
-0.2492348700761795,
0.22412294149398804,
0.04614397510886192,
0.2049540877342224,
0.10143475234508514,
0.057861074805259705,
-0.19399532675743103,
-0.23826676607131958,
0.041961170732975006,
0.07882270216941833,
0.26326048374176025,
0.14196552336215973,
0.3554454445838928,
-0.46851614117622375,
-0.44229018688201904,
0.275727778673172,
0.4402049481868744,
0.06995327770709991,
-0.07369552552700043,
0.2665047347545624,
0.17750078439712524,
-0.1060265451669693,
0.43249964714050293,
-0.3066911995410919,
-0.11861242353916168,
-0.10688400268554688,
-0.05876933038234711,
0.03520061820745468,
-0.03815416246652603,
0.07275363802909851,
0.37154126167297363,
-0.031523849815130234,
0.3799000680446625,
0.34563735127449036,
0.028784506022930145,
-0.0514397993683815,
0.25258350372314453,
-0.3350936770439148,
-0.04909303039312363,
-0.15841859579086304,
-0.5227058529853821,
-0.12820425629615784,
-0.02806539088487625,
0.09829822182655334,
-0.04187348857522011,
0.0433153435587883,
0.08914661407470703,
0.1448996365070343,
-0.02190232090651989,
0.006687954068183899,
0.14208616316318512,
0.3605314791202545,
0.18424780666828156,
-0.11147195100784302,
0.087938591837883,
0.1742119938135147,
0.37841930985450745,
0.5623610019683838,
0.13468137383460999,
0.15770699083805084,
0.21166670322418213,
-0.18189474940299988,
0.16854806244373322,
0.32760459184646606,
-0.20299699902534485,
-0.3079082667827606,
-0.14623166620731354,
-0.10282722115516663,
-0.2917167842388153,
0.41361263394355774,
0.04016623646020889,
0.2762879729270935,
-0.3081183433532715,
-0.41566163301467896,
0.4458431899547577,
0.17358806729316711,
-0.31691160798072815,
0.2682507336139679,
-0.019202478229999542,
-0.4749496877193451,
0.4058654308319092,
0.1894848495721817,
0.9381867051124573,
-0.024828948080539703,
0.14398737251758575,
0.034087590873241425,
0.0824858546257019,
-0.03356682136654854,
-0.24095997214317322,
0.23717756569385529,
-0.12496860325336456,
-0.6252007484436035,
-0.08587749302387238,
-0.14573638141155243,
-0.23889672756195068,
0.021111413836479187,
-0.12560905516147614,
0.3776455819606781,
0.07926608622074127,
-0.030371781438589096,
-0.09792184829711914,
-0.18686604499816895,
-0.025343379005789757,
-0.1460149586200714,
-0.17432142794132233,
0.06506620347499847,
-0.051962710916996,
0.4258987009525299,
-0.11261854320764542,
0.20057004690170288,
-0.20466916263103485,
0.07179342955350876,
-0.17073288559913635,
-0.002780606970191002,
-0.4321497678756714,
-0.016216013580560684,
-0.3535531759262085,
-0.3014709949493408,
-0.1923631727695465,
0.32475900650024414,
0.5008482933044434,
0.17711205780506134,
-0.018786391243338585,
-0.04098573699593544,
0.11836028099060059,
0.28951260447502136,
0.017474664375185966,
-0.4401690661907196,
0.09839323163032532,
0.06162169575691223,
0.20574942231178284,
-0.3807371258735657,
0.1405450850725174,
-0.41273099184036255,
0.03852440416812897,
0.13725174963474274,
-0.1217074990272522,
0.14950917661190033,
-0.19387830793857574,
0.02155596762895584,
-0.05602506548166275,
0.09672683477401733,
0.03512335568666458,
-0.045684173703193665,
0.2836751639842987,
0.4138992130756378,
-0.4844202697277069,
-0.4147196412086487,
-0.20222583413124084,
0.252409964799881,
0.3291337788105011,
0.04873095452785492,
0.4361199736595154,
-0.2197815477848053,
-0.17256703972816467,
0.046301066875457764,
-0.056387778371572495,
-0.25565096735954285,
0.2581130862236023,
0.07655930519104004,
-0.45646345615386963,
-0.06621895730495453,
-0.11938964575529099,
0.07477564364671707,
0.3262425661087036,
0.021223369985818863,
-0.40472570061683655,
-0.28405192494392395,
-0.38056305050849915,
-0.006106607615947723,
-0.011771533638238907,
-0.03403564915060997,
0.10520458966493607,
0.18421368300914764,
0.20320607721805573,
-0.18533460795879364,
-0.17207327485084534,
0.18457365036010742,
-0.07795581221580505,
0.11027934402227402,
0.09159938246011734,
0.005163699388504028,
0.43967846035957336,
-0.11587083339691162,
-0.1271943747997284,
0.15213555097579956,
0.04772680997848511,
-0.12610964477062225,
0.007436053827404976,
0.1519673466682434,
0.1834234893321991,
-0.1086486354470253,
-0.11923312395811081,
-0.22608523070812225,
0.09337028861045837,
-0.47231435775756836,
0.26707687973976135,
0.3169145882129669,
0.09450530260801315,
-0.16869351267814636,
0.1908189058303833,
-0.056038595736026764,
0.005970805883407593,
-0.04175286740064621,
-0.12283393740653992,
0.3638267517089844,
0.14463436603546143,
0.23552477359771729,
0.2257515788078308,
0.08237302303314209,
0.12970997393131256,
-0.08420848101377487,
0.1280229091644287,
0.41047394275665283,
0.1123141199350357,
-0.20948977768421173,
0.008257009088993073,
-0.004857919178903103,
0.06630969792604446,
0.048410169780254364,
-0.037864360958337784,
-0.440035343170166,
0.3940444886684418,
0.00930941104888916,
0.173515185713768,
-0.11559325456619263,
0.10549022257328033,
-0.1395040601491928,
-0.0170404314994812,
0.49581292271614075,
0.2734279930591583,
0.16251902282238007,
0.045527901500463486,
-0.003254985436797142,
0.5179218053817749,
-0.10219796001911163,
0.025369418784976006,
-0.1444009691476822,
0.015120092779397964,
0.5032031536102295,
0.38505905866622925,
0.10048647224903107,
0.0218726247549057,
0.43037110567092896,
0.1386062353849411,
0.09441990405321121,
0.2966916263103485,
-0.017315592616796494,
0.057420410215854645,
-0.22263817489147186,
-0.010426677763462067,
0.1287032812833786,
-0.1916089653968811,
0.3092508614063263,
0.1943608969449997,
-0.02651529759168625,
-0.3995790481567383,
-0.016850439831614494,
-0.21021594107151031,
0.24060700833797455,
-0.18410897254943848,
-0.23052915930747986,
0.24489536881446838,
-0.11818063259124756,
0.09150604903697968,
0.4082013964653015,
-0.16537287831306458,
-0.1561182737350464,
0.19896924495697021,
0.12040968239307404,
-0.2833485007286072,
0.3890855312347412,
-0.012354407459497452,
0.15006893873214722,
0.1247943714261055,
0.05526513233780861,
0.6754958033561707,
-0.43723154067993164,
0.0796014815568924,
-0.1580546796321869,
0.13614390790462494,
0.22112630307674408,
0.43289485573768616,
-0.23618283867835999,
-0.2410748451948166,
0.1083938479423523,
0.09521197527647018,
-0.1768152266740799,
0.21510834991931915,
-0.1572490930557251,
0.01979595236480236,
0.10729263722896576,
0.06545937806367874,
-0.03459957242012024,
0.2740280032157898,
0.06374606490135193,
0.190017431974411,
0.2508348822593689,
0.0725255161523819,
-0.08091340214014053,
0.15791207551956177,
-0.11632226407527924,
0.05372048541903496,
-0.32477888464927673,
0.1395675241947174,
0.2562488615512848,
-0.2785402536392212,
0.39835190773010254,
0.3185352087020874,
0.004149626940488815,
0.17677681148052216,
0.4488007128238678,
0.3871701955795288,
0.26921433210372925,
-0.22403179109096527,
-0.23945385217666626,
-0.30323389172554016,
0.373172402381897,
0.01114485040307045,
0.21977290511131287,
-0.5214636325836182,
0.10248744487762451,
-0.013494573533535004,
0.027357224375009537,
-0.13126347959041595,
0.14334321022033691,
-0.1088341772556305,
0.060225170105695724,
-0.27160170674324036,
-0.12166048586368561,
-0.0860634595155716,
-0.10306989401578903,
-0.10225371271371841,
-0.4066259264945984,
0.28546884655952454,
-0.1369551569223404,
0.04592384397983551,
0.041386090219020844,
-0.021767403930425644,
-0.26532062888145447,
-0.14549343287944794,
0.42065709829330444,
0.2559312582015991,
0.08698204159736633,
-0.22788742184638977,
0.07638293504714966,
-0.22092598676681519,
0.057495586574077606,
-0.2973892390727997,
-0.005990572273731232,
-0.05994141474366188,
0.31447163224220276,
-0.2841035723686218,
0.1138191968202591,
-0.36403730511665344,
0.14912691712379456,
0.2469116598367691,
0.09449517726898193,
0.14215455949306488,
-0.11979582905769348,
-0.2716233432292938,
0.04392332583665848,
0.11211639642715454,
0.5071700811386108,
0.07411058247089386,
0.27568519115448,
-0.24540898203849792,
-0.03980420529842377,
0.27469730377197266,
-0.35871753096580505,
-0.44448235630989075,
0.3010289967060089,
0.046257078647613525,
0.23890000581741333,
-0.21089740097522736,
-0.18060657382011414,
0.021490707993507385,
0.11596947908401489,
-0.213340163230896,
-0.13801226019859314,
0.058921921998262405,
-0.0019632894545793533,
0.14631882309913635,
-0.09953897446393967,
0.2787249982357025,
0.1334889531135559,
-0.3511354923248291,
-0.10386161506175995,
-0.23085761070251465
] |
https://github.com/huggingface/datasets/issues/633 | Load large text file for LM pre-training resulting in OOM | Not sure what could cause that on the `datasets` side. Could this be a `Trainer` issue ? cc @julien-c @sgugger ? | I tried to pretrain Longformer using transformers and datasets. But I got OOM issues with loading a large text file. My script is almost like this:
```python
from datasets import load_dataset
@dataclass
class DataCollatorForDatasetsLanguageModeling(DataCollatorForLanguageModeling):
"""
Data collator used for language modeling based on DataCollatorForLazyLanguageModeling
- collates batches of tensors, honoring their tokenizer's pad_token
- preprocesses batches for masked language modeling
"""
block_size: int = 512
def __call__(self, examples: List[dict]) -> Dict[str, torch.Tensor]:
examples = [example['text'] for example in examples]
batch, attention_mask = self._tensorize_batch(examples)
if self.mlm:
inputs, labels = self.mask_tokens(batch)
return {"input_ids": inputs, "labels": labels}
else:
labels = batch.clone().detach()
if self.tokenizer.pad_token_id is not None:
labels[labels == self.tokenizer.pad_token_id] = -100
return {"input_ids": batch, "labels": labels}
def _tensorize_batch(self, examples: List[str]) -> Tuple[torch.Tensor, torch.Tensor]:
if self.tokenizer._pad_token is None:
raise ValueError(
"You are attempting to pad samples but the tokenizer you are using"
f" ({self.tokenizer.__class__.__name__}) does not have one."
)
tensor_examples = self.tokenizer.batch_encode_plus(
[ex for ex in examples if ex],
max_length=self.block_size,
return_tensors="pt",
pad_to_max_length=True,
return_attention_mask=True,
truncation=True,
)
input_ids, attention_mask = tensor_examples["input_ids"], tensor_examples["attention_mask"]
return input_ids, attention_mask
dataset = load_dataset('text', data_files='train.txt',cache_dir="./", , split='train')
data_collator = DataCollatorForDatasetsLanguageModeling(tokenizer=tokenizer, mlm=True,
mlm_probability=0.15, block_size=tokenizer.max_len)
trainer = Trainer(model=model, args=args, data_collator=data_collator,
train_dataset=train_dataset, prediction_loss_only=True, )
trainer.train(model_path=model_path)
```
This train.txt is about 1.1GB and has 90k lines where each line is a sequence of 4k words.
During training, the memory usage increased fast as the following graph and resulted in OOM before the finish of training.

Could you please give me any suggestions on why this happened and how to fix it?
Thanks. | 21 | Load large text file for LM pre-training resulting in OOM
I tried to pretrain Longformer using transformers and datasets. But I got OOM issues with loading a large text file. My script is almost like this:
```python
from datasets import load_dataset
@dataclass
class DataCollatorForDatasetsLanguageModeling(DataCollatorForLanguageModeling):
"""
Data collator used for language modeling based on DataCollatorForLazyLanguageModeling
- collates batches of tensors, honoring their tokenizer's pad_token
- preprocesses batches for masked language modeling
"""
block_size: int = 512
def __call__(self, examples: List[dict]) -> Dict[str, torch.Tensor]:
examples = [example['text'] for example in examples]
batch, attention_mask = self._tensorize_batch(examples)
if self.mlm:
inputs, labels = self.mask_tokens(batch)
return {"input_ids": inputs, "labels": labels}
else:
labels = batch.clone().detach()
if self.tokenizer.pad_token_id is not None:
labels[labels == self.tokenizer.pad_token_id] = -100
return {"input_ids": batch, "labels": labels}
def _tensorize_batch(self, examples: List[str]) -> Tuple[torch.Tensor, torch.Tensor]:
if self.tokenizer._pad_token is None:
raise ValueError(
"You are attempting to pad samples but the tokenizer you are using"
f" ({self.tokenizer.__class__.__name__}) does not have one."
)
tensor_examples = self.tokenizer.batch_encode_plus(
[ex for ex in examples if ex],
max_length=self.block_size,
return_tensors="pt",
pad_to_max_length=True,
return_attention_mask=True,
truncation=True,
)
input_ids, attention_mask = tensor_examples["input_ids"], tensor_examples["attention_mask"]
return input_ids, attention_mask
dataset = load_dataset('text', data_files='train.txt',cache_dir="./", , split='train')
data_collator = DataCollatorForDatasetsLanguageModeling(tokenizer=tokenizer, mlm=True,
mlm_probability=0.15, block_size=tokenizer.max_len)
trainer = Trainer(model=model, args=args, data_collator=data_collator,
train_dataset=train_dataset, prediction_loss_only=True, )
trainer.train(model_path=model_path)
```
This train.txt is about 1.1GB and has 90k lines where each line is a sequence of 4k words.
During training, the memory usage increased fast as the following graph and resulted in OOM before the finish of training.

Could you please give me any suggestions on why this happened and how to fix it?
Thanks.
Not sure what could cause that on the `datasets` side. Could this be a `Trainer` issue ? cc @julien-c @sgugger ? | [
-0.6339283585548401,
-0.47753778100013733,
0.010693363845348358,
0.29863524436950684,
0.36004769802093506,
-0.1518251597881317,
0.5567324757575989,
0.37380579113960266,
0.01088225468993187,
0.010719746351242065,
-0.1295929253101349,
-0.1828002780675888,
-0.26698487997055054,
-0.16208980977535248,
-0.03237204998731613,
0.023206885904073715,
-0.09982117265462875,
0.19687515497207642,
-0.2772675156593323,
-0.09666657447814941,
0.05701180547475815,
-0.07762926816940308,
-0.21276047825813293,
-0.029743991792201996,
-0.3879220187664032,
-0.06171319633722305,
0.3158179223537445,
0.12212134897708893,
-0.1640809327363968,
-0.0958080142736435,
-0.22970141470432281,
0.1197899580001831,
0.4393485188484192,
0.4340214729309082,
-0.00011477212683530524,
0.006616219878196716,
0.18904384970664978,
-0.23633266985416412,
-0.16726946830749512,
0.019216440618038177,
0.07755492627620697,
-0.3022913932800293,
-0.10640020668506622,
-0.3036171495914459,
-0.02724609524011612,
-0.10612530261278152,
-0.015682043507695198,
-0.22437302768230438,
0.4987519383430481,
0.5414043068885803,
0.15876251459121704,
0.25081300735473633,
-0.21366100013256073,
0.0723966509103775,
0.25443702936172485,
0.0488995760679245,
0.1056830957531929,
-0.27951449155807495,
0.46878406405448914,
-0.1923186331987381,
-0.47268855571746826,
0.1478176862001419,
-0.22477363049983978,
-0.20168264210224152,
-0.09508860856294632,
0.03820447996258736,
0.36608895659446716,
0.031569477170705795,
0.2641869783401489,
0.3474210202693939,
0.4272076189517975,
-0.0008120127022266388,
-0.289635568857193,
-0.3209858536720276,
-0.14262455701828003,
-0.08431586623191833,
0.18923655152320862,
0.2010769546031952,
0.059826578944921494,
0.11845916509628296,
0.10712733119726181,
-0.12533129751682281,
-0.15199026465415955,
0.07616106420755386,
-0.27480751276016235,
0.33979544043540955,
-0.20125117897987366,
-0.03804318606853485,
0.15557512640953064,
-0.09447921812534332,
0.19616937637329102,
-0.09977510571479797,
0.003403950482606888,
0.25671419501304626,
-0.245441272854805,
-0.11239507794380188,
-0.07168225198984146,
-0.5194145441055298,
0.16278403997421265,
-0.2759450674057007,
0.1981883943080902,
0.29723939299583435,
-0.08766181021928787,
-0.06761691719293594,
0.08639387786388397,
0.4202020466327667,
-0.25243741273880005,
0.26052793860435486,
0.22725635766983032,
0.16401110589504242,
-0.17170630395412445,
-0.04439859092235565,
-0.33051154017448425,
-0.19624567031860352,
0.10159362852573395,
-0.07734166085720062,
-0.011017010547220707,
-0.2546045482158661,
-0.24042175710201263,
0.05854658782482147,
-0.14076969027519226,
-0.03084544464945793,
0.2748163938522339,
0.38997286558151245,
-0.3540611267089844,
0.4294978082180023,
0.16510933637619019,
0.052328936755657196,
-0.4855332672595978,
-0.33652669191360474,
-0.17440199851989746,
0.15325728058815002,
-0.20324474573135376,
0.038975562900304794,
0.12979257106781006,
0.13963374495506287,
0.05965423583984375,
-0.04288341850042343,
-0.0625898689031601,
-0.44021931290626526,
-0.009444482624530792,
-0.024103429168462753,
0.020752981305122375,
-0.04251480475068092,
0.06302379071712494,
-0.02336559072136879,
0.23476582765579224,
-0.12499457597732544,
-0.025381658226251602,
0.3477915823459625,
-0.2762118875980377,
-0.2276410162448883,
0.05097950994968414,
0.21017630398273468,
-0.02824842929840088,
0.20915503799915314,
0.028506658971309662,
0.07685685157775879,
0.5359783172607422,
0.006653331220149994,
-0.04714777320623398,
-0.3782060742378235,
0.09452182054519653,
0.09201760590076447,
0.1619914025068283,
0.17663070559501648,
-0.042587969452142715,
-0.07260239124298096,
0.0063892244361341,
0.10358665883541107,
0.25504034757614136,
0.3907330334186554,
-0.22647030651569366,
0.2906738817691803,
0.007004471495747566,
-0.05665605142712593,
0.5319919586181641,
-0.2620989978313446,
-0.448444128036499,
0.23385274410247803,
-0.3511556386947632,
0.10818185657262802,
0.22066983580589294,
0.1759030818939209,
0.11388914287090302,
-0.1089852899312973,
0.26901498436927795,
0.3656851649284363,
0.07051589339971542,
0.1209140196442604,
-0.23662437498569489,
-0.09222844988107681,
-0.1715157926082611,
0.48420286178588867,
0.36272403597831726,
-0.02558579295873642,
-0.07308889180421829,
0.35637998580932617,
0.18339842557907104,
-0.1992236077785492,
0.13128061592578888,
0.36934155225753784,
-0.17442509531974792,
-0.1261582374572754,
0.0944812074303627,
0.06559769064188004,
-0.3000325560569763,
-0.07098697125911713,
-0.09084425866603851,
0.0828668475151062,
-0.1136055737733841,
-0.08942607045173645,
0.28255847096443176,
0.02287023328244686,
-0.0766652524471283,
0.11318020522594452,
0.03794129937887192,
-0.13182224333286285,
0.024866361171007156,
-0.07041719555854797,
0.1261971890926361,
0.015421975404024124,
-0.09320687502622604,
0.08736041188240051,
-0.2184159904718399,
-0.12394054979085922,
0.0018030330538749695,
-0.137061208486557,
0.07695000618696213,
0.17527323961257935,
-0.05118799954652786,
0.03840121626853943,
-0.17304009199142456,
0.10695729404687881,
-0.15297769010066986,
-0.2987070679664612,
-0.5071570873260498,
0.43589335680007935,
0.18647874891757965,
-0.33810955286026,
0.3402597904205322,
0.1040273904800415,
-0.029599443078041077,
-0.10627070814371109,
-0.11989574879407883,
0.5749332904815674,
0.27307116985321045,
0.019617579877376556,
0.29909294843673706,
-0.24541117250919342,
0.2542804777622223,
-0.2662392258644104,
-0.10361561179161072,
-0.09776493161916733,
0.4209232032299042,
0.03105533868074417,
0.23506294190883636,
0.14828065037727356,
-0.08694546669721603,
-0.232059508562088,
0.47038108110427856,
-0.1788094937801361,
-0.013872608542442322,
0.26652613282203674,
-0.4247211217880249,
-0.011563490144908428,
-0.34802117943763733,
-0.24947787821292877,
0.0067334845662117004,
0.17322899401187897,
-0.09441326558589935,
-0.055435195565223694,
0.008537785150110722,
-0.26279330253601074,
0.007836148142814636,
0.1532370001077652,
-0.0718524307012558,
0.31983456015586853,
0.11651500314474106,
0.10059522092342377,
-0.122891865670681,
-0.1794070154428482,
0.10284756124019623,
0.17828989028930664,
-0.27519121766090393,
0.18444325029850006,
-0.02282267063856125,
-0.013446485623717308,
-0.2862633764743805,
0.1904245764017105,
-0.12680108845233917,
0.0388152077794075,
-0.0647432953119278,
0.25868889689445496,
-0.07790280133485794,
0.10191172361373901,
0.3001607060432434,
0.3549228012561798,
0.4629628658294678,
-0.07809486240148544,
0.326348215341568,
-0.08266382664442062,
-0.1796954870223999,
0.032943595200777054,
0.33450770378112793,
-0.3179926872253418,
-0.024890778586268425,
0.005377540364861488,
0.05117718130350113,
-0.09892972558736801,
-0.16603437066078186,
0.09468895941972733,
0.196824312210083,
-0.16618932783603668,
-0.2573060691356659,
-0.07217618823051453,
0.17769087851047516,
-0.042431723326444626,
0.11972848325967789,
-0.23244111239910126,
0.008407561108469963,
0.1450573354959488,
-0.006289597600698471,
-0.18432363867759705,
0.04044550284743309,
-0.1199219599366188,
-0.04705164581537247,
-0.411641389131546,
-0.05351852625608444,
0.10705065727233887,
0.13673138618469238,
0.35936760902404785,
0.10678976029157639,
0.19445137679576874,
0.28844478726387024,
0.15859206020832062,
0.006367621943354607,
-0.0885988399386406,
0.5141718983650208,
-0.017572684213519096,
-0.29719802737236023,
-0.2908625900745392,
-0.23975418508052826,
0.02511288784444332,
0.3155249357223511,
-0.684260904788971,
0.23378321528434753,
-0.1138516515493393,
-0.09402675926685333,
-0.3955192267894745,
0.0007258430123329163,
0.2522047758102417,
-0.07614870369434357,
0.016339777037501335,
0.09547417610883713,
0.2302767038345337,
0.1546790897846222,
-0.03878729045391083,
0.38579460978507996,
-0.4130840301513672,
0.35940811038017273,
-0.13545823097229004,
0.4855530261993408,
-0.122118279337883,
-0.2300206571817398,
0.09887474775314331,
0.15044830739498138,
-0.01711525395512581,
-0.021802209317684174,
-0.013968504965305328,
-0.25937944650650024,
-0.058237224817276,
0.0227312333881855,
0.5197213292121887,
0.01689060777425766,
-0.16558955609798431,
-0.015898926183581352,
0.06816425919532776,
0.2563197910785675,
-0.26069891452789307,
0.49052777886390686,
-0.19077889621257782,
0.01841624826192856,
-0.19967399537563324,
0.01874571293592453,
-0.20498108863830566,
-0.21508586406707764,
-0.164134681224823,
0.09344439208507538,
-0.03038274496793747,
-0.22404396533966064,
-0.2116939276456833,
0.10314016044139862,
-0.3681343197822571,
-0.0437651127576828,
0.11799006909132004,
0.22933240234851837,
0.18077029287815094,
-0.19614383578300476,
-0.08628876507282257,
-0.20187069475650787,
0.35741427540779114,
0.1934524029493332,
0.11246532201766968,
0.16325931251049042,
-0.05687852203845978,
-0.2155371457338333,
-0.17745190858840942,
-0.29045435786247253,
0.14190825819969177,
0.6505106687545776,
0.6102464199066162,
-0.21627351641654968,
-0.15859898924827576,
0.07914479076862335,
0.002603483386337757,
-0.16527341306209564,
-0.548757016658783,
-0.12850907444953918,
-0.16549962759017944,
-0.44105130434036255,
0.004606112837791443,
0.35849836468696594,
0.3558535575866699,
-0.2264459729194641,
-0.03187551349401474,
0.13872987031936646,
-0.0007013268768787384,
0.37175118923187256,
-0.12976384162902832,
0.015054157003760338,
-0.06641082465648651,
0.225828617811203,
-0.10741686820983887,
0.36735567450523376,
0.24888965487480164,
0.35636386275291443,
0.1917259395122528,
-0.31755685806274414,
0.0706881731748581,
-0.029888737946748734,
0.23143038153648376,
0.11516103148460388,
0.11022848635911942,
0.3546280860900879,
0.1289711445569992,
0.3322555422782898,
-0.19096627831459045,
0.6737229228019714,
-0.007344553247094154,
0.20682765543460846,
-0.8374910354614258,
-0.26737040281295776,
0.33145615458488464,
-0.02635771967470646,
0.19940276443958282,
0.215718075633049,
-0.40385204553604126,
-0.3216697573661804,
0.376661479473114,
0.09908346086740494,
0.7675239443778992,
-0.2972695827484131,
0.39625850319862366,
-0.1552990972995758,
0.6611965894699097,
0.12803049385547638,
-0.3813104033470154,
0.1585618406534195,
-0.39879149198532104,
-0.2663658857345581,
0.21300511062145233,
-0.09231188893318176,
0.036539800465106964,
0.16050389409065247,
-0.2905767560005188,
-0.029811730608344078,
0.0862521380186081,
0.2249334454536438,
0.13066981732845306,
0.5134936571121216,
0.12092680484056473,
-0.6006978154182434,
-0.08281297981739044,
0.02656909078359604,
-0.02340024709701538,
-0.10490188002586365,
-0.0492798313498497,
0.07994647324085236,
-0.0313267819583416,
-0.20856402814388275,
-0.028466172516345978,
0.20525774359703064,
-0.2474464625120163,
0.08661594241857529,
0.06375248730182648,
-0.07205313444137573,
0.5367995500564575,
0.10623051226139069,
-0.001361064612865448,
0.4988958239555359,
-0.039286620914936066,
0.13215835392475128,
-0.2274819314479828,
-0.1652863323688507,
0.20070844888687134,
-0.06584891676902771,
0.4217033088207245,
0.08837933093309402,
-0.0005880966782569885,
0.11410333216190338,
0.0632382407784462,
-0.046690933406353,
0.09476359188556671,
-0.36430907249450684,
0.10549724102020264,
-0.41123154759407043,
-0.21542777121067047,
-0.08843062818050385,
-0.30078285932540894,
-0.1009221225976944,
0.12310943007469177,
0.13735687732696533,
-0.46444618701934814,
0.11514545977115631,
0.2652113139629364,
-0.3750092685222626,
0.011997109279036522,
0.38382449746131897,
0.17105859518051147,
-0.10513918846845627,
0.49984270334243774,
0.4575878381729126,
-0.053361937403678894,
-0.2644973695278168,
-0.10962903499603271,
0.29444822669029236,
-0.2731435000896454,
0.0849163606762886,
-0.2455592304468155,
-0.3016006648540497,
0.209351047873497,
0.08087542653083801,
0.10009974241256714,
-0.01499941200017929,
-0.06326231360435486,
-0.25102943181991577,
-0.6380501389503479,
-0.18144388496875763,
-0.0027230940759181976,
-0.00354844331741333,
0.1460832953453064,
0.27389806509017944,
-0.3100467920303345,
0.5892773270606995,
-0.2788558602333069,
-0.05294197052717209,
-0.20760811865329742,
0.2782232165336609,
-0.055562183260917664,
-0.38554659485816956,
0.21153579652309418,
0.2033519148826599,
0.1001039668917656,
0.08059665560722351,
0.00590919703245163,
-0.22135356068611145,
-0.14351996779441833,
0.11271549016237259,
0.23647010326385498,
-0.41966331005096436,
-0.01599399372935295,
-0.312997043132782,
-0.09248970448970795,
-0.27002182602882385,
0.06606784462928772,
0.017028577625751495,
0.01394578069448471,
-0.22617922723293304,
0.009393874555826187,
0.04752609133720398,
-0.2552624046802521,
0.04206028953194618,
-0.25458529591560364,
0.12509100139141083,
0.2465714067220688,
0.1331031173467636,
0.11783083528280258,
0.0006371289491653442,
-0.3931019604206085,
0.17964592576026917,
0.6661380529403687,
-0.017532095313072205,
0.4190823435783386,
-0.43573224544525146,
-0.0715063214302063,
0.24765951931476593,
0.04980342835187912,
0.048066146671772,
-0.34167730808258057,
-0.010718589648604393,
0.2935883700847626,
0.22681888937950134,
0.015208568423986435,
-0.014733202755451202,
0.22635462880134583,
-0.41129830479621887,
0.1301487535238266,
0.3453426659107208,
-0.11192676424980164,
-0.06747587025165558,
0.1559651792049408,
0.09132310748100281,
0.5066777467727661,
0.11496534198522568,
0.005711604841053486,
0.24894991517066956,
-0.00122002512216568,
0.15485714375972748,
0.48569241166114807,
0.261119544506073,
0.23868051171302795,
0.3016282618045807,
-0.032666049897670746,
-0.04069993644952774,
-0.2312840223312378,
0.2294139564037323,
-0.435617059469223,
-0.41516661643981934,
-0.2674567401409149,
0.5044151544570923,
-0.01932355761528015,
0.12420932948589325,
-0.3350299298763275,
-0.06624119728803635,
-0.04065354913473129,
0.2541331350803375,
-0.11921557784080505,
0.2744082510471344,
-0.45309436321258545,
-0.17059893906116486,
-0.08942428231239319,
-0.12396197021007538,
0.011534325778484344,
0.18963316082954407,
-0.0558583103120327,
0.27227628231048584,
-0.5796654224395752,
0.22938616573810577,
0.05213649570941925,
0.1451501101255417,
-0.1346784234046936,
0.1227787584066391,
0.10550137609243393,
-0.5078572034835815,
0.34333521127700806,
0.23785626888275146,
0.29185950756073,
0.11540549993515015,
-0.22190696001052856,
0.34437036514282227,
0.43669766187667847,
-0.1908072531223297,
-0.04061196744441986,
-0.12098392844200134,
-0.03561992570757866,
-0.1499127894639969,
0.19743536412715912,
0.3490368723869324,
0.18789905309677124,
0.2596159875392914,
0.0557275116443634,
-0.26596614718437195,
0.27851778268814087,
0.06501396000385284,
-0.3240588903427124,
0.17866621911525726,
-0.13293880224227905,
0.4019324481487274,
-0.32858094573020935,
-0.4429645836353302,
0.00986664742231369,
-0.39412444829940796,
0.21558675169944763,
0.6670199036598206,
-0.2954224944114685,
0.28785526752471924,
-0.02548792213201523,
0.04855022579431534,
0.0018409136682748795,
0.47605016827583313,
0.46973514556884766,
0.2841596007347107,
-0.37837129831314087,
-0.025667212903499603,
-0.32888373732566833,
0.2765583097934723,
-0.2024305909872055,
0.06699749082326889,
0.022247930988669395,
0.17079433798789978,
0.16457822918891907,
-0.003302011638879776,
-0.07962261140346527,
-0.013621993362903595,
0.21880324184894562,
-0.19506913423538208,
-0.1675596684217453,
-0.12804758548736572,
0.0020943284034729004,
0.3573179543018341,
-0.025900525972247124,
-0.29754993319511414,
0.15886540710926056,
0.11506294459104538,
0.0991566851735115,
-0.3214535713195801,
0.3626996874809265,
-0.19846373796463013,
-0.02036242187023163,
0.0691281408071518,
-0.15047122538089752,
0.37920957803726196,
-0.22043859958648682,
-0.03304758667945862,
-0.08182770013809204,
0.12814156711101532,
-0.16707712411880493,
-0.22100013494491577,
0.3402222692966461,
0.38842451572418213,
-0.10763649642467499,
0.10821394622325897,
-0.25519275665283203,
-0.08646275848150253,
0.040304481983184814,
-0.36969074606895447,
-0.3087161183357239,
-0.0074881562031805515,
-0.0002531483769416809,
0.008524507284164429,
0.10309776663780212,
0.24583062529563904,
0.10533731430768967,
-0.027840254828333855,
-0.22922900319099426,
-0.1855800449848175,
0.20947544276714325,
-0.2946496903896332,
-0.31304094195365906,
-0.03537982702255249,
0.05562475696206093,
-0.16362905502319336,
0.2511020004749298,
-0.46240702271461487,
0.14574888348579407,
0.22974419593811035,
-0.025514401495456696,
-0.4540731608867645,
0.2232973277568817,
0.2540613114833832,
0.016472186893224716,
-0.20769661664962769,
0.05345691740512848,
0.1526237428188324,
-0.1369924396276474,
-0.20163996517658234,
-0.1757192611694336
] |
https://github.com/huggingface/datasets/issues/633 | Load large text file for LM pre-training resulting in OOM | There was a memory leak issue fixed recently in master. You should install from source and see if it fixes your problem. | I tried to pretrain Longformer using transformers and datasets. But I got OOM issues with loading a large text file. My script is almost like this:
```python
from datasets import load_dataset
@dataclass
class DataCollatorForDatasetsLanguageModeling(DataCollatorForLanguageModeling):
"""
Data collator used for language modeling based on DataCollatorForLazyLanguageModeling
- collates batches of tensors, honoring their tokenizer's pad_token
- preprocesses batches for masked language modeling
"""
block_size: int = 512
def __call__(self, examples: List[dict]) -> Dict[str, torch.Tensor]:
examples = [example['text'] for example in examples]
batch, attention_mask = self._tensorize_batch(examples)
if self.mlm:
inputs, labels = self.mask_tokens(batch)
return {"input_ids": inputs, "labels": labels}
else:
labels = batch.clone().detach()
if self.tokenizer.pad_token_id is not None:
labels[labels == self.tokenizer.pad_token_id] = -100
return {"input_ids": batch, "labels": labels}
def _tensorize_batch(self, examples: List[str]) -> Tuple[torch.Tensor, torch.Tensor]:
if self.tokenizer._pad_token is None:
raise ValueError(
"You are attempting to pad samples but the tokenizer you are using"
f" ({self.tokenizer.__class__.__name__}) does not have one."
)
tensor_examples = self.tokenizer.batch_encode_plus(
[ex for ex in examples if ex],
max_length=self.block_size,
return_tensors="pt",
pad_to_max_length=True,
return_attention_mask=True,
truncation=True,
)
input_ids, attention_mask = tensor_examples["input_ids"], tensor_examples["attention_mask"]
return input_ids, attention_mask
dataset = load_dataset('text', data_files='train.txt',cache_dir="./", , split='train')
data_collator = DataCollatorForDatasetsLanguageModeling(tokenizer=tokenizer, mlm=True,
mlm_probability=0.15, block_size=tokenizer.max_len)
trainer = Trainer(model=model, args=args, data_collator=data_collator,
train_dataset=train_dataset, prediction_loss_only=True, )
trainer.train(model_path=model_path)
```
This train.txt is about 1.1GB and has 90k lines where each line is a sequence of 4k words.
During training, the memory usage increased fast as the following graph and resulted in OOM before the finish of training.

Could you please give me any suggestions on why this happened and how to fix it?
Thanks. | 22 | Load large text file for LM pre-training resulting in OOM
I tried to pretrain Longformer using transformers and datasets. But I got OOM issues with loading a large text file. My script is almost like this:
```python
from datasets import load_dataset
@dataclass
class DataCollatorForDatasetsLanguageModeling(DataCollatorForLanguageModeling):
"""
Data collator used for language modeling based on DataCollatorForLazyLanguageModeling
- collates batches of tensors, honoring their tokenizer's pad_token
- preprocesses batches for masked language modeling
"""
block_size: int = 512
def __call__(self, examples: List[dict]) -> Dict[str, torch.Tensor]:
examples = [example['text'] for example in examples]
batch, attention_mask = self._tensorize_batch(examples)
if self.mlm:
inputs, labels = self.mask_tokens(batch)
return {"input_ids": inputs, "labels": labels}
else:
labels = batch.clone().detach()
if self.tokenizer.pad_token_id is not None:
labels[labels == self.tokenizer.pad_token_id] = -100
return {"input_ids": batch, "labels": labels}
def _tensorize_batch(self, examples: List[str]) -> Tuple[torch.Tensor, torch.Tensor]:
if self.tokenizer._pad_token is None:
raise ValueError(
"You are attempting to pad samples but the tokenizer you are using"
f" ({self.tokenizer.__class__.__name__}) does not have one."
)
tensor_examples = self.tokenizer.batch_encode_plus(
[ex for ex in examples if ex],
max_length=self.block_size,
return_tensors="pt",
pad_to_max_length=True,
return_attention_mask=True,
truncation=True,
)
input_ids, attention_mask = tensor_examples["input_ids"], tensor_examples["attention_mask"]
return input_ids, attention_mask
dataset = load_dataset('text', data_files='train.txt',cache_dir="./", , split='train')
data_collator = DataCollatorForDatasetsLanguageModeling(tokenizer=tokenizer, mlm=True,
mlm_probability=0.15, block_size=tokenizer.max_len)
trainer = Trainer(model=model, args=args, data_collator=data_collator,
train_dataset=train_dataset, prediction_loss_only=True, )
trainer.train(model_path=model_path)
```
This train.txt is about 1.1GB and has 90k lines where each line is a sequence of 4k words.
During training, the memory usage increased fast as the following graph and resulted in OOM before the finish of training.

Could you please give me any suggestions on why this happened and how to fix it?
Thanks.
There was a memory leak issue fixed recently in master. You should install from source and see if it fixes your problem. | [
-0.6339283585548401,
-0.47753778100013733,
0.010693363845348358,
0.29863524436950684,
0.36004769802093506,
-0.1518251597881317,
0.5567324757575989,
0.37380579113960266,
0.01088225468993187,
0.010719746351242065,
-0.1295929253101349,
-0.1828002780675888,
-0.26698487997055054,
-0.16208980977535248,
-0.03237204998731613,
0.023206885904073715,
-0.09982117265462875,
0.19687515497207642,
-0.2772675156593323,
-0.09666657447814941,
0.05701180547475815,
-0.07762926816940308,
-0.21276047825813293,
-0.029743991792201996,
-0.3879220187664032,
-0.06171319633722305,
0.3158179223537445,
0.12212134897708893,
-0.1640809327363968,
-0.0958080142736435,
-0.22970141470432281,
0.1197899580001831,
0.4393485188484192,
0.4340214729309082,
-0.00011477212683530524,
0.006616219878196716,
0.18904384970664978,
-0.23633266985416412,
-0.16726946830749512,
0.019216440618038177,
0.07755492627620697,
-0.3022913932800293,
-0.10640020668506622,
-0.3036171495914459,
-0.02724609524011612,
-0.10612530261278152,
-0.015682043507695198,
-0.22437302768230438,
0.4987519383430481,
0.5414043068885803,
0.15876251459121704,
0.25081300735473633,
-0.21366100013256073,
0.0723966509103775,
0.25443702936172485,
0.0488995760679245,
0.1056830957531929,
-0.27951449155807495,
0.46878406405448914,
-0.1923186331987381,
-0.47268855571746826,
0.1478176862001419,
-0.22477363049983978,
-0.20168264210224152,
-0.09508860856294632,
0.03820447996258736,
0.36608895659446716,
0.031569477170705795,
0.2641869783401489,
0.3474210202693939,
0.4272076189517975,
-0.0008120127022266388,
-0.289635568857193,
-0.3209858536720276,
-0.14262455701828003,
-0.08431586623191833,
0.18923655152320862,
0.2010769546031952,
0.059826578944921494,
0.11845916509628296,
0.10712733119726181,
-0.12533129751682281,
-0.15199026465415955,
0.07616106420755386,
-0.27480751276016235,
0.33979544043540955,
-0.20125117897987366,
-0.03804318606853485,
0.15557512640953064,
-0.09447921812534332,
0.19616937637329102,
-0.09977510571479797,
0.003403950482606888,
0.25671419501304626,
-0.245441272854805,
-0.11239507794380188,
-0.07168225198984146,
-0.5194145441055298,
0.16278403997421265,
-0.2759450674057007,
0.1981883943080902,
0.29723939299583435,
-0.08766181021928787,
-0.06761691719293594,
0.08639387786388397,
0.4202020466327667,
-0.25243741273880005,
0.26052793860435486,
0.22725635766983032,
0.16401110589504242,
-0.17170630395412445,
-0.04439859092235565,
-0.33051154017448425,
-0.19624567031860352,
0.10159362852573395,
-0.07734166085720062,
-0.011017010547220707,
-0.2546045482158661,
-0.24042175710201263,
0.05854658782482147,
-0.14076969027519226,
-0.03084544464945793,
0.2748163938522339,
0.38997286558151245,
-0.3540611267089844,
0.4294978082180023,
0.16510933637619019,
0.052328936755657196,
-0.4855332672595978,
-0.33652669191360474,
-0.17440199851989746,
0.15325728058815002,
-0.20324474573135376,
0.038975562900304794,
0.12979257106781006,
0.13963374495506287,
0.05965423583984375,
-0.04288341850042343,
-0.0625898689031601,
-0.44021931290626526,
-0.009444482624530792,
-0.024103429168462753,
0.020752981305122375,
-0.04251480475068092,
0.06302379071712494,
-0.02336559072136879,
0.23476582765579224,
-0.12499457597732544,
-0.025381658226251602,
0.3477915823459625,
-0.2762118875980377,
-0.2276410162448883,
0.05097950994968414,
0.21017630398273468,
-0.02824842929840088,
0.20915503799915314,
0.028506658971309662,
0.07685685157775879,
0.5359783172607422,
0.006653331220149994,
-0.04714777320623398,
-0.3782060742378235,
0.09452182054519653,
0.09201760590076447,
0.1619914025068283,
0.17663070559501648,
-0.042587969452142715,
-0.07260239124298096,
0.0063892244361341,
0.10358665883541107,
0.25504034757614136,
0.3907330334186554,
-0.22647030651569366,
0.2906738817691803,
0.007004471495747566,
-0.05665605142712593,
0.5319919586181641,
-0.2620989978313446,
-0.448444128036499,
0.23385274410247803,
-0.3511556386947632,
0.10818185657262802,
0.22066983580589294,
0.1759030818939209,
0.11388914287090302,
-0.1089852899312973,
0.26901498436927795,
0.3656851649284363,
0.07051589339971542,
0.1209140196442604,
-0.23662437498569489,
-0.09222844988107681,
-0.1715157926082611,
0.48420286178588867,
0.36272403597831726,
-0.02558579295873642,
-0.07308889180421829,
0.35637998580932617,
0.18339842557907104,
-0.1992236077785492,
0.13128061592578888,
0.36934155225753784,
-0.17442509531974792,
-0.1261582374572754,
0.0944812074303627,
0.06559769064188004,
-0.3000325560569763,
-0.07098697125911713,
-0.09084425866603851,
0.0828668475151062,
-0.1136055737733841,
-0.08942607045173645,
0.28255847096443176,
0.02287023328244686,
-0.0766652524471283,
0.11318020522594452,
0.03794129937887192,
-0.13182224333286285,
0.024866361171007156,
-0.07041719555854797,
0.1261971890926361,
0.015421975404024124,
-0.09320687502622604,
0.08736041188240051,
-0.2184159904718399,
-0.12394054979085922,
0.0018030330538749695,
-0.137061208486557,
0.07695000618696213,
0.17527323961257935,
-0.05118799954652786,
0.03840121626853943,
-0.17304009199142456,
0.10695729404687881,
-0.15297769010066986,
-0.2987070679664612,
-0.5071570873260498,
0.43589335680007935,
0.18647874891757965,
-0.33810955286026,
0.3402597904205322,
0.1040273904800415,
-0.029599443078041077,
-0.10627070814371109,
-0.11989574879407883,
0.5749332904815674,
0.27307116985321045,
0.019617579877376556,
0.29909294843673706,
-0.24541117250919342,
0.2542804777622223,
-0.2662392258644104,
-0.10361561179161072,
-0.09776493161916733,
0.4209232032299042,
0.03105533868074417,
0.23506294190883636,
0.14828065037727356,
-0.08694546669721603,
-0.232059508562088,
0.47038108110427856,
-0.1788094937801361,
-0.013872608542442322,
0.26652613282203674,
-0.4247211217880249,
-0.011563490144908428,
-0.34802117943763733,
-0.24947787821292877,
0.0067334845662117004,
0.17322899401187897,
-0.09441326558589935,
-0.055435195565223694,
0.008537785150110722,
-0.26279330253601074,
0.007836148142814636,
0.1532370001077652,
-0.0718524307012558,
0.31983456015586853,
0.11651500314474106,
0.10059522092342377,
-0.122891865670681,
-0.1794070154428482,
0.10284756124019623,
0.17828989028930664,
-0.27519121766090393,
0.18444325029850006,
-0.02282267063856125,
-0.013446485623717308,
-0.2862633764743805,
0.1904245764017105,
-0.12680108845233917,
0.0388152077794075,
-0.0647432953119278,
0.25868889689445496,
-0.07790280133485794,
0.10191172361373901,
0.3001607060432434,
0.3549228012561798,
0.4629628658294678,
-0.07809486240148544,
0.326348215341568,
-0.08266382664442062,
-0.1796954870223999,
0.032943595200777054,
0.33450770378112793,
-0.3179926872253418,
-0.024890778586268425,
0.005377540364861488,
0.05117718130350113,
-0.09892972558736801,
-0.16603437066078186,
0.09468895941972733,
0.196824312210083,
-0.16618932783603668,
-0.2573060691356659,
-0.07217618823051453,
0.17769087851047516,
-0.042431723326444626,
0.11972848325967789,
-0.23244111239910126,
0.008407561108469963,
0.1450573354959488,
-0.006289597600698471,
-0.18432363867759705,
0.04044550284743309,
-0.1199219599366188,
-0.04705164581537247,
-0.411641389131546,
-0.05351852625608444,
0.10705065727233887,
0.13673138618469238,
0.35936760902404785,
0.10678976029157639,
0.19445137679576874,
0.28844478726387024,
0.15859206020832062,
0.006367621943354607,
-0.0885988399386406,
0.5141718983650208,
-0.017572684213519096,
-0.29719802737236023,
-0.2908625900745392,
-0.23975418508052826,
0.02511288784444332,
0.3155249357223511,
-0.684260904788971,
0.23378321528434753,
-0.1138516515493393,
-0.09402675926685333,
-0.3955192267894745,
0.0007258430123329163,
0.2522047758102417,
-0.07614870369434357,
0.016339777037501335,
0.09547417610883713,
0.2302767038345337,
0.1546790897846222,
-0.03878729045391083,
0.38579460978507996,
-0.4130840301513672,
0.35940811038017273,
-0.13545823097229004,
0.4855530261993408,
-0.122118279337883,
-0.2300206571817398,
0.09887474775314331,
0.15044830739498138,
-0.01711525395512581,
-0.021802209317684174,
-0.013968504965305328,
-0.25937944650650024,
-0.058237224817276,
0.0227312333881855,
0.5197213292121887,
0.01689060777425766,
-0.16558955609798431,
-0.015898926183581352,
0.06816425919532776,
0.2563197910785675,
-0.26069891452789307,
0.49052777886390686,
-0.19077889621257782,
0.01841624826192856,
-0.19967399537563324,
0.01874571293592453,
-0.20498108863830566,
-0.21508586406707764,
-0.164134681224823,
0.09344439208507538,
-0.03038274496793747,
-0.22404396533966064,
-0.2116939276456833,
0.10314016044139862,
-0.3681343197822571,
-0.0437651127576828,
0.11799006909132004,
0.22933240234851837,
0.18077029287815094,
-0.19614383578300476,
-0.08628876507282257,
-0.20187069475650787,
0.35741427540779114,
0.1934524029493332,
0.11246532201766968,
0.16325931251049042,
-0.05687852203845978,
-0.2155371457338333,
-0.17745190858840942,
-0.29045435786247253,
0.14190825819969177,
0.6505106687545776,
0.6102464199066162,
-0.21627351641654968,
-0.15859898924827576,
0.07914479076862335,
0.002603483386337757,
-0.16527341306209564,
-0.548757016658783,
-0.12850907444953918,
-0.16549962759017944,
-0.44105130434036255,
0.004606112837791443,
0.35849836468696594,
0.3558535575866699,
-0.2264459729194641,
-0.03187551349401474,
0.13872987031936646,
-0.0007013268768787384,
0.37175118923187256,
-0.12976384162902832,
0.015054157003760338,
-0.06641082465648651,
0.225828617811203,
-0.10741686820983887,
0.36735567450523376,
0.24888965487480164,
0.35636386275291443,
0.1917259395122528,
-0.31755685806274414,
0.0706881731748581,
-0.029888737946748734,
0.23143038153648376,
0.11516103148460388,
0.11022848635911942,
0.3546280860900879,
0.1289711445569992,
0.3322555422782898,
-0.19096627831459045,
0.6737229228019714,
-0.007344553247094154,
0.20682765543460846,
-0.8374910354614258,
-0.26737040281295776,
0.33145615458488464,
-0.02635771967470646,
0.19940276443958282,
0.215718075633049,
-0.40385204553604126,
-0.3216697573661804,
0.376661479473114,
0.09908346086740494,
0.7675239443778992,
-0.2972695827484131,
0.39625850319862366,
-0.1552990972995758,
0.6611965894699097,
0.12803049385547638,
-0.3813104033470154,
0.1585618406534195,
-0.39879149198532104,
-0.2663658857345581,
0.21300511062145233,
-0.09231188893318176,
0.036539800465106964,
0.16050389409065247,
-0.2905767560005188,
-0.029811730608344078,
0.0862521380186081,
0.2249334454536438,
0.13066981732845306,
0.5134936571121216,
0.12092680484056473,
-0.6006978154182434,
-0.08281297981739044,
0.02656909078359604,
-0.02340024709701538,
-0.10490188002586365,
-0.0492798313498497,
0.07994647324085236,
-0.0313267819583416,
-0.20856402814388275,
-0.028466172516345978,
0.20525774359703064,
-0.2474464625120163,
0.08661594241857529,
0.06375248730182648,
-0.07205313444137573,
0.5367995500564575,
0.10623051226139069,
-0.001361064612865448,
0.4988958239555359,
-0.039286620914936066,
0.13215835392475128,
-0.2274819314479828,
-0.1652863323688507,
0.20070844888687134,
-0.06584891676902771,
0.4217033088207245,
0.08837933093309402,
-0.0005880966782569885,
0.11410333216190338,
0.0632382407784462,
-0.046690933406353,
0.09476359188556671,
-0.36430907249450684,
0.10549724102020264,
-0.41123154759407043,
-0.21542777121067047,
-0.08843062818050385,
-0.30078285932540894,
-0.1009221225976944,
0.12310943007469177,
0.13735687732696533,
-0.46444618701934814,
0.11514545977115631,
0.2652113139629364,
-0.3750092685222626,
0.011997109279036522,
0.38382449746131897,
0.17105859518051147,
-0.10513918846845627,
0.49984270334243774,
0.4575878381729126,
-0.053361937403678894,
-0.2644973695278168,
-0.10962903499603271,
0.29444822669029236,
-0.2731435000896454,
0.0849163606762886,
-0.2455592304468155,
-0.3016006648540497,
0.209351047873497,
0.08087542653083801,
0.10009974241256714,
-0.01499941200017929,
-0.06326231360435486,
-0.25102943181991577,
-0.6380501389503479,
-0.18144388496875763,
-0.0027230940759181976,
-0.00354844331741333,
0.1460832953453064,
0.27389806509017944,
-0.3100467920303345,
0.5892773270606995,
-0.2788558602333069,
-0.05294197052717209,
-0.20760811865329742,
0.2782232165336609,
-0.055562183260917664,
-0.38554659485816956,
0.21153579652309418,
0.2033519148826599,
0.1001039668917656,
0.08059665560722351,
0.00590919703245163,
-0.22135356068611145,
-0.14351996779441833,
0.11271549016237259,
0.23647010326385498,
-0.41966331005096436,
-0.01599399372935295,
-0.312997043132782,
-0.09248970448970795,
-0.27002182602882385,
0.06606784462928772,
0.017028577625751495,
0.01394578069448471,
-0.22617922723293304,
0.009393874555826187,
0.04752609133720398,
-0.2552624046802521,
0.04206028953194618,
-0.25458529591560364,
0.12509100139141083,
0.2465714067220688,
0.1331031173467636,
0.11783083528280258,
0.0006371289491653442,
-0.3931019604206085,
0.17964592576026917,
0.6661380529403687,
-0.017532095313072205,
0.4190823435783386,
-0.43573224544525146,
-0.0715063214302063,
0.24765951931476593,
0.04980342835187912,
0.048066146671772,
-0.34167730808258057,
-0.010718589648604393,
0.2935883700847626,
0.22681888937950134,
0.015208568423986435,
-0.014733202755451202,
0.22635462880134583,
-0.41129830479621887,
0.1301487535238266,
0.3453426659107208,
-0.11192676424980164,
-0.06747587025165558,
0.1559651792049408,
0.09132310748100281,
0.5066777467727661,
0.11496534198522568,
0.005711604841053486,
0.24894991517066956,
-0.00122002512216568,
0.15485714375972748,
0.48569241166114807,
0.261119544506073,
0.23868051171302795,
0.3016282618045807,
-0.032666049897670746,
-0.04069993644952774,
-0.2312840223312378,
0.2294139564037323,
-0.435617059469223,
-0.41516661643981934,
-0.2674567401409149,
0.5044151544570923,
-0.01932355761528015,
0.12420932948589325,
-0.3350299298763275,
-0.06624119728803635,
-0.04065354913473129,
0.2541331350803375,
-0.11921557784080505,
0.2744082510471344,
-0.45309436321258545,
-0.17059893906116486,
-0.08942428231239319,
-0.12396197021007538,
0.011534325778484344,
0.18963316082954407,
-0.0558583103120327,
0.27227628231048584,
-0.5796654224395752,
0.22938616573810577,
0.05213649570941925,
0.1451501101255417,
-0.1346784234046936,
0.1227787584066391,
0.10550137609243393,
-0.5078572034835815,
0.34333521127700806,
0.23785626888275146,
0.29185950756073,
0.11540549993515015,
-0.22190696001052856,
0.34437036514282227,
0.43669766187667847,
-0.1908072531223297,
-0.04061196744441986,
-0.12098392844200134,
-0.03561992570757866,
-0.1499127894639969,
0.19743536412715912,
0.3490368723869324,
0.18789905309677124,
0.2596159875392914,
0.0557275116443634,
-0.26596614718437195,
0.27851778268814087,
0.06501396000385284,
-0.3240588903427124,
0.17866621911525726,
-0.13293880224227905,
0.4019324481487274,
-0.32858094573020935,
-0.4429645836353302,
0.00986664742231369,
-0.39412444829940796,
0.21558675169944763,
0.6670199036598206,
-0.2954224944114685,
0.28785526752471924,
-0.02548792213201523,
0.04855022579431534,
0.0018409136682748795,
0.47605016827583313,
0.46973514556884766,
0.2841596007347107,
-0.37837129831314087,
-0.025667212903499603,
-0.32888373732566833,
0.2765583097934723,
-0.2024305909872055,
0.06699749082326889,
0.022247930988669395,
0.17079433798789978,
0.16457822918891907,
-0.003302011638879776,
-0.07962261140346527,
-0.013621993362903595,
0.21880324184894562,
-0.19506913423538208,
-0.1675596684217453,
-0.12804758548736572,
0.0020943284034729004,
0.3573179543018341,
-0.025900525972247124,
-0.29754993319511414,
0.15886540710926056,
0.11506294459104538,
0.0991566851735115,
-0.3214535713195801,
0.3626996874809265,
-0.19846373796463013,
-0.02036242187023163,
0.0691281408071518,
-0.15047122538089752,
0.37920957803726196,
-0.22043859958648682,
-0.03304758667945862,
-0.08182770013809204,
0.12814156711101532,
-0.16707712411880493,
-0.22100013494491577,
0.3402222692966461,
0.38842451572418213,
-0.10763649642467499,
0.10821394622325897,
-0.25519275665283203,
-0.08646275848150253,
0.040304481983184814,
-0.36969074606895447,
-0.3087161183357239,
-0.0074881562031805515,
-0.0002531483769416809,
0.008524507284164429,
0.10309776663780212,
0.24583062529563904,
0.10533731430768967,
-0.027840254828333855,
-0.22922900319099426,
-0.1855800449848175,
0.20947544276714325,
-0.2946496903896332,
-0.31304094195365906,
-0.03537982702255249,
0.05562475696206093,
-0.16362905502319336,
0.2511020004749298,
-0.46240702271461487,
0.14574888348579407,
0.22974419593811035,
-0.025514401495456696,
-0.4540731608867645,
0.2232973277568817,
0.2540613114833832,
0.016472186893224716,
-0.20769661664962769,
0.05345691740512848,
0.1526237428188324,
-0.1369924396276474,
-0.20163996517658234,
-0.1757192611694336
] |
https://github.com/huggingface/datasets/issues/633 | Load large text file for LM pre-training resulting in OOM | @lhoestq @sgugger Thanks for your comments. I have install from source code as you told, but the problem is still there.
To reproduce the issue, just replace [these lines](https://github.com/huggingface/transformers/blob/master/examples/language-modeling/run_language_modeling.py#L241-L258) with:
(load_dataset and DataCollatorForDatasetsLanguageModeling as [above mentioned](https://github.com/huggingface/datasets/issues/633#issue-702440484))
```python
dataset = load_dataset("bookcorpus")
dataset = dataset.train_test_split(test_size=0.1)
train_dataset = dataset['train']
eval_dataset = dataset['test'] if training_args.do_eval else None
data_collator = DataCollatorForDatasetsLanguageModeling(
tokenizer=tokenizer,
mlm=data_args.mlm,
mlm_probability=data_args.mlm_probability,
block_size=data_args.block_size
)
```
and run by:
```bash
python run_language_modeling.py
--output_dir=output \
--model_type=bert \
--model_name_or_path=bert-base-uncased \
--do_train \
--do_eval \
--mlm
``` | I tried to pretrain Longformer using transformers and datasets. But I got OOM issues with loading a large text file. My script is almost like this:
```python
from datasets import load_dataset
@dataclass
class DataCollatorForDatasetsLanguageModeling(DataCollatorForLanguageModeling):
"""
Data collator used for language modeling based on DataCollatorForLazyLanguageModeling
- collates batches of tensors, honoring their tokenizer's pad_token
- preprocesses batches for masked language modeling
"""
block_size: int = 512
def __call__(self, examples: List[dict]) -> Dict[str, torch.Tensor]:
examples = [example['text'] for example in examples]
batch, attention_mask = self._tensorize_batch(examples)
if self.mlm:
inputs, labels = self.mask_tokens(batch)
return {"input_ids": inputs, "labels": labels}
else:
labels = batch.clone().detach()
if self.tokenizer.pad_token_id is not None:
labels[labels == self.tokenizer.pad_token_id] = -100
return {"input_ids": batch, "labels": labels}
def _tensorize_batch(self, examples: List[str]) -> Tuple[torch.Tensor, torch.Tensor]:
if self.tokenizer._pad_token is None:
raise ValueError(
"You are attempting to pad samples but the tokenizer you are using"
f" ({self.tokenizer.__class__.__name__}) does not have one."
)
tensor_examples = self.tokenizer.batch_encode_plus(
[ex for ex in examples if ex],
max_length=self.block_size,
return_tensors="pt",
pad_to_max_length=True,
return_attention_mask=True,
truncation=True,
)
input_ids, attention_mask = tensor_examples["input_ids"], tensor_examples["attention_mask"]
return input_ids, attention_mask
dataset = load_dataset('text', data_files='train.txt',cache_dir="./", , split='train')
data_collator = DataCollatorForDatasetsLanguageModeling(tokenizer=tokenizer, mlm=True,
mlm_probability=0.15, block_size=tokenizer.max_len)
trainer = Trainer(model=model, args=args, data_collator=data_collator,
train_dataset=train_dataset, prediction_loss_only=True, )
trainer.train(model_path=model_path)
```
This train.txt is about 1.1GB and has 90k lines where each line is a sequence of 4k words.
During training, the memory usage increased fast as the following graph and resulted in OOM before the finish of training.

Could you please give me any suggestions on why this happened and how to fix it?
Thanks. | 80 | Load large text file for LM pre-training resulting in OOM
I tried to pretrain Longformer using transformers and datasets. But I got OOM issues with loading a large text file. My script is almost like this:
```python
from datasets import load_dataset
@dataclass
class DataCollatorForDatasetsLanguageModeling(DataCollatorForLanguageModeling):
"""
Data collator used for language modeling based on DataCollatorForLazyLanguageModeling
- collates batches of tensors, honoring their tokenizer's pad_token
- preprocesses batches for masked language modeling
"""
block_size: int = 512
def __call__(self, examples: List[dict]) -> Dict[str, torch.Tensor]:
examples = [example['text'] for example in examples]
batch, attention_mask = self._tensorize_batch(examples)
if self.mlm:
inputs, labels = self.mask_tokens(batch)
return {"input_ids": inputs, "labels": labels}
else:
labels = batch.clone().detach()
if self.tokenizer.pad_token_id is not None:
labels[labels == self.tokenizer.pad_token_id] = -100
return {"input_ids": batch, "labels": labels}
def _tensorize_batch(self, examples: List[str]) -> Tuple[torch.Tensor, torch.Tensor]:
if self.tokenizer._pad_token is None:
raise ValueError(
"You are attempting to pad samples but the tokenizer you are using"
f" ({self.tokenizer.__class__.__name__}) does not have one."
)
tensor_examples = self.tokenizer.batch_encode_plus(
[ex for ex in examples if ex],
max_length=self.block_size,
return_tensors="pt",
pad_to_max_length=True,
return_attention_mask=True,
truncation=True,
)
input_ids, attention_mask = tensor_examples["input_ids"], tensor_examples["attention_mask"]
return input_ids, attention_mask
dataset = load_dataset('text', data_files='train.txt',cache_dir="./", , split='train')
data_collator = DataCollatorForDatasetsLanguageModeling(tokenizer=tokenizer, mlm=True,
mlm_probability=0.15, block_size=tokenizer.max_len)
trainer = Trainer(model=model, args=args, data_collator=data_collator,
train_dataset=train_dataset, prediction_loss_only=True, )
trainer.train(model_path=model_path)
```
This train.txt is about 1.1GB and has 90k lines where each line is a sequence of 4k words.
During training, the memory usage increased fast as the following graph and resulted in OOM before the finish of training.

Could you please give me any suggestions on why this happened and how to fix it?
Thanks.
@lhoestq @sgugger Thanks for your comments. I have install from source code as you told, but the problem is still there.
To reproduce the issue, just replace [these lines](https://github.com/huggingface/transformers/blob/master/examples/language-modeling/run_language_modeling.py#L241-L258) with:
(load_dataset and DataCollatorForDatasetsLanguageModeling as [above mentioned](https://github.com/huggingface/datasets/issues/633#issue-702440484))
```python
dataset = load_dataset("bookcorpus")
dataset = dataset.train_test_split(test_size=0.1)
train_dataset = dataset['train']
eval_dataset = dataset['test'] if training_args.do_eval else None
data_collator = DataCollatorForDatasetsLanguageModeling(
tokenizer=tokenizer,
mlm=data_args.mlm,
mlm_probability=data_args.mlm_probability,
block_size=data_args.block_size
)
```
and run by:
```bash
python run_language_modeling.py
--output_dir=output \
--model_type=bert \
--model_name_or_path=bert-base-uncased \
--do_train \
--do_eval \
--mlm
``` | [
-0.6339283585548401,
-0.47753778100013733,
0.010693363845348358,
0.29863524436950684,
0.36004769802093506,
-0.1518251597881317,
0.5567324757575989,
0.37380579113960266,
0.01088225468993187,
0.010719746351242065,
-0.1295929253101349,
-0.1828002780675888,
-0.26698487997055054,
-0.16208980977535248,
-0.03237204998731613,
0.023206885904073715,
-0.09982117265462875,
0.19687515497207642,
-0.2772675156593323,
-0.09666657447814941,
0.05701180547475815,
-0.07762926816940308,
-0.21276047825813293,
-0.029743991792201996,
-0.3879220187664032,
-0.06171319633722305,
0.3158179223537445,
0.12212134897708893,
-0.1640809327363968,
-0.0958080142736435,
-0.22970141470432281,
0.1197899580001831,
0.4393485188484192,
0.4340214729309082,
-0.00011477212683530524,
0.006616219878196716,
0.18904384970664978,
-0.23633266985416412,
-0.16726946830749512,
0.019216440618038177,
0.07755492627620697,
-0.3022913932800293,
-0.10640020668506622,
-0.3036171495914459,
-0.02724609524011612,
-0.10612530261278152,
-0.015682043507695198,
-0.22437302768230438,
0.4987519383430481,
0.5414043068885803,
0.15876251459121704,
0.25081300735473633,
-0.21366100013256073,
0.0723966509103775,
0.25443702936172485,
0.0488995760679245,
0.1056830957531929,
-0.27951449155807495,
0.46878406405448914,
-0.1923186331987381,
-0.47268855571746826,
0.1478176862001419,
-0.22477363049983978,
-0.20168264210224152,
-0.09508860856294632,
0.03820447996258736,
0.36608895659446716,
0.031569477170705795,
0.2641869783401489,
0.3474210202693939,
0.4272076189517975,
-0.0008120127022266388,
-0.289635568857193,
-0.3209858536720276,
-0.14262455701828003,
-0.08431586623191833,
0.18923655152320862,
0.2010769546031952,
0.059826578944921494,
0.11845916509628296,
0.10712733119726181,
-0.12533129751682281,
-0.15199026465415955,
0.07616106420755386,
-0.27480751276016235,
0.33979544043540955,
-0.20125117897987366,
-0.03804318606853485,
0.15557512640953064,
-0.09447921812534332,
0.19616937637329102,
-0.09977510571479797,
0.003403950482606888,
0.25671419501304626,
-0.245441272854805,
-0.11239507794380188,
-0.07168225198984146,
-0.5194145441055298,
0.16278403997421265,
-0.2759450674057007,
0.1981883943080902,
0.29723939299583435,
-0.08766181021928787,
-0.06761691719293594,
0.08639387786388397,
0.4202020466327667,
-0.25243741273880005,
0.26052793860435486,
0.22725635766983032,
0.16401110589504242,
-0.17170630395412445,
-0.04439859092235565,
-0.33051154017448425,
-0.19624567031860352,
0.10159362852573395,
-0.07734166085720062,
-0.011017010547220707,
-0.2546045482158661,
-0.24042175710201263,
0.05854658782482147,
-0.14076969027519226,
-0.03084544464945793,
0.2748163938522339,
0.38997286558151245,
-0.3540611267089844,
0.4294978082180023,
0.16510933637619019,
0.052328936755657196,
-0.4855332672595978,
-0.33652669191360474,
-0.17440199851989746,
0.15325728058815002,
-0.20324474573135376,
0.038975562900304794,
0.12979257106781006,
0.13963374495506287,
0.05965423583984375,
-0.04288341850042343,
-0.0625898689031601,
-0.44021931290626526,
-0.009444482624530792,
-0.024103429168462753,
0.020752981305122375,
-0.04251480475068092,
0.06302379071712494,
-0.02336559072136879,
0.23476582765579224,
-0.12499457597732544,
-0.025381658226251602,
0.3477915823459625,
-0.2762118875980377,
-0.2276410162448883,
0.05097950994968414,
0.21017630398273468,
-0.02824842929840088,
0.20915503799915314,
0.028506658971309662,
0.07685685157775879,
0.5359783172607422,
0.006653331220149994,
-0.04714777320623398,
-0.3782060742378235,
0.09452182054519653,
0.09201760590076447,
0.1619914025068283,
0.17663070559501648,
-0.042587969452142715,
-0.07260239124298096,
0.0063892244361341,
0.10358665883541107,
0.25504034757614136,
0.3907330334186554,
-0.22647030651569366,
0.2906738817691803,
0.007004471495747566,
-0.05665605142712593,
0.5319919586181641,
-0.2620989978313446,
-0.448444128036499,
0.23385274410247803,
-0.3511556386947632,
0.10818185657262802,
0.22066983580589294,
0.1759030818939209,
0.11388914287090302,
-0.1089852899312973,
0.26901498436927795,
0.3656851649284363,
0.07051589339971542,
0.1209140196442604,
-0.23662437498569489,
-0.09222844988107681,
-0.1715157926082611,
0.48420286178588867,
0.36272403597831726,
-0.02558579295873642,
-0.07308889180421829,
0.35637998580932617,
0.18339842557907104,
-0.1992236077785492,
0.13128061592578888,
0.36934155225753784,
-0.17442509531974792,
-0.1261582374572754,
0.0944812074303627,
0.06559769064188004,
-0.3000325560569763,
-0.07098697125911713,
-0.09084425866603851,
0.0828668475151062,
-0.1136055737733841,
-0.08942607045173645,
0.28255847096443176,
0.02287023328244686,
-0.0766652524471283,
0.11318020522594452,
0.03794129937887192,
-0.13182224333286285,
0.024866361171007156,
-0.07041719555854797,
0.1261971890926361,
0.015421975404024124,
-0.09320687502622604,
0.08736041188240051,
-0.2184159904718399,
-0.12394054979085922,
0.0018030330538749695,
-0.137061208486557,
0.07695000618696213,
0.17527323961257935,
-0.05118799954652786,
0.03840121626853943,
-0.17304009199142456,
0.10695729404687881,
-0.15297769010066986,
-0.2987070679664612,
-0.5071570873260498,
0.43589335680007935,
0.18647874891757965,
-0.33810955286026,
0.3402597904205322,
0.1040273904800415,
-0.029599443078041077,
-0.10627070814371109,
-0.11989574879407883,
0.5749332904815674,
0.27307116985321045,
0.019617579877376556,
0.29909294843673706,
-0.24541117250919342,
0.2542804777622223,
-0.2662392258644104,
-0.10361561179161072,
-0.09776493161916733,
0.4209232032299042,
0.03105533868074417,
0.23506294190883636,
0.14828065037727356,
-0.08694546669721603,
-0.232059508562088,
0.47038108110427856,
-0.1788094937801361,
-0.013872608542442322,
0.26652613282203674,
-0.4247211217880249,
-0.011563490144908428,
-0.34802117943763733,
-0.24947787821292877,
0.0067334845662117004,
0.17322899401187897,
-0.09441326558589935,
-0.055435195565223694,
0.008537785150110722,
-0.26279330253601074,
0.007836148142814636,
0.1532370001077652,
-0.0718524307012558,
0.31983456015586853,
0.11651500314474106,
0.10059522092342377,
-0.122891865670681,
-0.1794070154428482,
0.10284756124019623,
0.17828989028930664,
-0.27519121766090393,
0.18444325029850006,
-0.02282267063856125,
-0.013446485623717308,
-0.2862633764743805,
0.1904245764017105,
-0.12680108845233917,
0.0388152077794075,
-0.0647432953119278,
0.25868889689445496,
-0.07790280133485794,
0.10191172361373901,
0.3001607060432434,
0.3549228012561798,
0.4629628658294678,
-0.07809486240148544,
0.326348215341568,
-0.08266382664442062,
-0.1796954870223999,
0.032943595200777054,
0.33450770378112793,
-0.3179926872253418,
-0.024890778586268425,
0.005377540364861488,
0.05117718130350113,
-0.09892972558736801,
-0.16603437066078186,
0.09468895941972733,
0.196824312210083,
-0.16618932783603668,
-0.2573060691356659,
-0.07217618823051453,
0.17769087851047516,
-0.042431723326444626,
0.11972848325967789,
-0.23244111239910126,
0.008407561108469963,
0.1450573354959488,
-0.006289597600698471,
-0.18432363867759705,
0.04044550284743309,
-0.1199219599366188,
-0.04705164581537247,
-0.411641389131546,
-0.05351852625608444,
0.10705065727233887,
0.13673138618469238,
0.35936760902404785,
0.10678976029157639,
0.19445137679576874,
0.28844478726387024,
0.15859206020832062,
0.006367621943354607,
-0.0885988399386406,
0.5141718983650208,
-0.017572684213519096,
-0.29719802737236023,
-0.2908625900745392,
-0.23975418508052826,
0.02511288784444332,
0.3155249357223511,
-0.684260904788971,
0.23378321528434753,
-0.1138516515493393,
-0.09402675926685333,
-0.3955192267894745,
0.0007258430123329163,
0.2522047758102417,
-0.07614870369434357,
0.016339777037501335,
0.09547417610883713,
0.2302767038345337,
0.1546790897846222,
-0.03878729045391083,
0.38579460978507996,
-0.4130840301513672,
0.35940811038017273,
-0.13545823097229004,
0.4855530261993408,
-0.122118279337883,
-0.2300206571817398,
0.09887474775314331,
0.15044830739498138,
-0.01711525395512581,
-0.021802209317684174,
-0.013968504965305328,
-0.25937944650650024,
-0.058237224817276,
0.0227312333881855,
0.5197213292121887,
0.01689060777425766,
-0.16558955609798431,
-0.015898926183581352,
0.06816425919532776,
0.2563197910785675,
-0.26069891452789307,
0.49052777886390686,
-0.19077889621257782,
0.01841624826192856,
-0.19967399537563324,
0.01874571293592453,
-0.20498108863830566,
-0.21508586406707764,
-0.164134681224823,
0.09344439208507538,
-0.03038274496793747,
-0.22404396533966064,
-0.2116939276456833,
0.10314016044139862,
-0.3681343197822571,
-0.0437651127576828,
0.11799006909132004,
0.22933240234851837,
0.18077029287815094,
-0.19614383578300476,
-0.08628876507282257,
-0.20187069475650787,
0.35741427540779114,
0.1934524029493332,
0.11246532201766968,
0.16325931251049042,
-0.05687852203845978,
-0.2155371457338333,
-0.17745190858840942,
-0.29045435786247253,
0.14190825819969177,
0.6505106687545776,
0.6102464199066162,
-0.21627351641654968,
-0.15859898924827576,
0.07914479076862335,
0.002603483386337757,
-0.16527341306209564,
-0.548757016658783,
-0.12850907444953918,
-0.16549962759017944,
-0.44105130434036255,
0.004606112837791443,
0.35849836468696594,
0.3558535575866699,
-0.2264459729194641,
-0.03187551349401474,
0.13872987031936646,
-0.0007013268768787384,
0.37175118923187256,
-0.12976384162902832,
0.015054157003760338,
-0.06641082465648651,
0.225828617811203,
-0.10741686820983887,
0.36735567450523376,
0.24888965487480164,
0.35636386275291443,
0.1917259395122528,
-0.31755685806274414,
0.0706881731748581,
-0.029888737946748734,
0.23143038153648376,
0.11516103148460388,
0.11022848635911942,
0.3546280860900879,
0.1289711445569992,
0.3322555422782898,
-0.19096627831459045,
0.6737229228019714,
-0.007344553247094154,
0.20682765543460846,
-0.8374910354614258,
-0.26737040281295776,
0.33145615458488464,
-0.02635771967470646,
0.19940276443958282,
0.215718075633049,
-0.40385204553604126,
-0.3216697573661804,
0.376661479473114,
0.09908346086740494,
0.7675239443778992,
-0.2972695827484131,
0.39625850319862366,
-0.1552990972995758,
0.6611965894699097,
0.12803049385547638,
-0.3813104033470154,
0.1585618406534195,
-0.39879149198532104,
-0.2663658857345581,
0.21300511062145233,
-0.09231188893318176,
0.036539800465106964,
0.16050389409065247,
-0.2905767560005188,
-0.029811730608344078,
0.0862521380186081,
0.2249334454536438,
0.13066981732845306,
0.5134936571121216,
0.12092680484056473,
-0.6006978154182434,
-0.08281297981739044,
0.02656909078359604,
-0.02340024709701538,
-0.10490188002586365,
-0.0492798313498497,
0.07994647324085236,
-0.0313267819583416,
-0.20856402814388275,
-0.028466172516345978,
0.20525774359703064,
-0.2474464625120163,
0.08661594241857529,
0.06375248730182648,
-0.07205313444137573,
0.5367995500564575,
0.10623051226139069,
-0.001361064612865448,
0.4988958239555359,
-0.039286620914936066,
0.13215835392475128,
-0.2274819314479828,
-0.1652863323688507,
0.20070844888687134,
-0.06584891676902771,
0.4217033088207245,
0.08837933093309402,
-0.0005880966782569885,
0.11410333216190338,
0.0632382407784462,
-0.046690933406353,
0.09476359188556671,
-0.36430907249450684,
0.10549724102020264,
-0.41123154759407043,
-0.21542777121067047,
-0.08843062818050385,
-0.30078285932540894,
-0.1009221225976944,
0.12310943007469177,
0.13735687732696533,
-0.46444618701934814,
0.11514545977115631,
0.2652113139629364,
-0.3750092685222626,
0.011997109279036522,
0.38382449746131897,
0.17105859518051147,
-0.10513918846845627,
0.49984270334243774,
0.4575878381729126,
-0.053361937403678894,
-0.2644973695278168,
-0.10962903499603271,
0.29444822669029236,
-0.2731435000896454,
0.0849163606762886,
-0.2455592304468155,
-0.3016006648540497,
0.209351047873497,
0.08087542653083801,
0.10009974241256714,
-0.01499941200017929,
-0.06326231360435486,
-0.25102943181991577,
-0.6380501389503479,
-0.18144388496875763,
-0.0027230940759181976,
-0.00354844331741333,
0.1460832953453064,
0.27389806509017944,
-0.3100467920303345,
0.5892773270606995,
-0.2788558602333069,
-0.05294197052717209,
-0.20760811865329742,
0.2782232165336609,
-0.055562183260917664,
-0.38554659485816956,
0.21153579652309418,
0.2033519148826599,
0.1001039668917656,
0.08059665560722351,
0.00590919703245163,
-0.22135356068611145,
-0.14351996779441833,
0.11271549016237259,
0.23647010326385498,
-0.41966331005096436,
-0.01599399372935295,
-0.312997043132782,
-0.09248970448970795,
-0.27002182602882385,
0.06606784462928772,
0.017028577625751495,
0.01394578069448471,
-0.22617922723293304,
0.009393874555826187,
0.04752609133720398,
-0.2552624046802521,
0.04206028953194618,
-0.25458529591560364,
0.12509100139141083,
0.2465714067220688,
0.1331031173467636,
0.11783083528280258,
0.0006371289491653442,
-0.3931019604206085,
0.17964592576026917,
0.6661380529403687,
-0.017532095313072205,
0.4190823435783386,
-0.43573224544525146,
-0.0715063214302063,
0.24765951931476593,
0.04980342835187912,
0.048066146671772,
-0.34167730808258057,
-0.010718589648604393,
0.2935883700847626,
0.22681888937950134,
0.015208568423986435,
-0.014733202755451202,
0.22635462880134583,
-0.41129830479621887,
0.1301487535238266,
0.3453426659107208,
-0.11192676424980164,
-0.06747587025165558,
0.1559651792049408,
0.09132310748100281,
0.5066777467727661,
0.11496534198522568,
0.005711604841053486,
0.24894991517066956,
-0.00122002512216568,
0.15485714375972748,
0.48569241166114807,
0.261119544506073,
0.23868051171302795,
0.3016282618045807,
-0.032666049897670746,
-0.04069993644952774,
-0.2312840223312378,
0.2294139564037323,
-0.435617059469223,
-0.41516661643981934,
-0.2674567401409149,
0.5044151544570923,
-0.01932355761528015,
0.12420932948589325,
-0.3350299298763275,
-0.06624119728803635,
-0.04065354913473129,
0.2541331350803375,
-0.11921557784080505,
0.2744082510471344,
-0.45309436321258545,
-0.17059893906116486,
-0.08942428231239319,
-0.12396197021007538,
0.011534325778484344,
0.18963316082954407,
-0.0558583103120327,
0.27227628231048584,
-0.5796654224395752,
0.22938616573810577,
0.05213649570941925,
0.1451501101255417,
-0.1346784234046936,
0.1227787584066391,
0.10550137609243393,
-0.5078572034835815,
0.34333521127700806,
0.23785626888275146,
0.29185950756073,
0.11540549993515015,
-0.22190696001052856,
0.34437036514282227,
0.43669766187667847,
-0.1908072531223297,
-0.04061196744441986,
-0.12098392844200134,
-0.03561992570757866,
-0.1499127894639969,
0.19743536412715912,
0.3490368723869324,
0.18789905309677124,
0.2596159875392914,
0.0557275116443634,
-0.26596614718437195,
0.27851778268814087,
0.06501396000385284,
-0.3240588903427124,
0.17866621911525726,
-0.13293880224227905,
0.4019324481487274,
-0.32858094573020935,
-0.4429645836353302,
0.00986664742231369,
-0.39412444829940796,
0.21558675169944763,
0.6670199036598206,
-0.2954224944114685,
0.28785526752471924,
-0.02548792213201523,
0.04855022579431534,
0.0018409136682748795,
0.47605016827583313,
0.46973514556884766,
0.2841596007347107,
-0.37837129831314087,
-0.025667212903499603,
-0.32888373732566833,
0.2765583097934723,
-0.2024305909872055,
0.06699749082326889,
0.022247930988669395,
0.17079433798789978,
0.16457822918891907,
-0.003302011638879776,
-0.07962261140346527,
-0.013621993362903595,
0.21880324184894562,
-0.19506913423538208,
-0.1675596684217453,
-0.12804758548736572,
0.0020943284034729004,
0.3573179543018341,
-0.025900525972247124,
-0.29754993319511414,
0.15886540710926056,
0.11506294459104538,
0.0991566851735115,
-0.3214535713195801,
0.3626996874809265,
-0.19846373796463013,
-0.02036242187023163,
0.0691281408071518,
-0.15047122538089752,
0.37920957803726196,
-0.22043859958648682,
-0.03304758667945862,
-0.08182770013809204,
0.12814156711101532,
-0.16707712411880493,
-0.22100013494491577,
0.3402222692966461,
0.38842451572418213,
-0.10763649642467499,
0.10821394622325897,
-0.25519275665283203,
-0.08646275848150253,
0.040304481983184814,
-0.36969074606895447,
-0.3087161183357239,
-0.0074881562031805515,
-0.0002531483769416809,
0.008524507284164429,
0.10309776663780212,
0.24583062529563904,
0.10533731430768967,
-0.027840254828333855,
-0.22922900319099426,
-0.1855800449848175,
0.20947544276714325,
-0.2946496903896332,
-0.31304094195365906,
-0.03537982702255249,
0.05562475696206093,
-0.16362905502319336,
0.2511020004749298,
-0.46240702271461487,
0.14574888348579407,
0.22974419593811035,
-0.025514401495456696,
-0.4540731608867645,
0.2232973277568817,
0.2540613114833832,
0.016472186893224716,
-0.20769661664962769,
0.05345691740512848,
0.1526237428188324,
-0.1369924396276474,
-0.20163996517658234,
-0.1757192611694336
] |
https://github.com/huggingface/datasets/issues/633 | Load large text file for LM pre-training resulting in OOM | Same here. Pre-training on wikitext-103 to do some test. At the end of the training it takes 32GB of RAM + ~30GB of SWAP. I installed dataset==1.1.0, not built from source. I will try uninstalling and building from source when it finish. | I tried to pretrain Longformer using transformers and datasets. But I got OOM issues with loading a large text file. My script is almost like this:
```python
from datasets import load_dataset
@dataclass
class DataCollatorForDatasetsLanguageModeling(DataCollatorForLanguageModeling):
"""
Data collator used for language modeling based on DataCollatorForLazyLanguageModeling
- collates batches of tensors, honoring their tokenizer's pad_token
- preprocesses batches for masked language modeling
"""
block_size: int = 512
def __call__(self, examples: List[dict]) -> Dict[str, torch.Tensor]:
examples = [example['text'] for example in examples]
batch, attention_mask = self._tensorize_batch(examples)
if self.mlm:
inputs, labels = self.mask_tokens(batch)
return {"input_ids": inputs, "labels": labels}
else:
labels = batch.clone().detach()
if self.tokenizer.pad_token_id is not None:
labels[labels == self.tokenizer.pad_token_id] = -100
return {"input_ids": batch, "labels": labels}
def _tensorize_batch(self, examples: List[str]) -> Tuple[torch.Tensor, torch.Tensor]:
if self.tokenizer._pad_token is None:
raise ValueError(
"You are attempting to pad samples but the tokenizer you are using"
f" ({self.tokenizer.__class__.__name__}) does not have one."
)
tensor_examples = self.tokenizer.batch_encode_plus(
[ex for ex in examples if ex],
max_length=self.block_size,
return_tensors="pt",
pad_to_max_length=True,
return_attention_mask=True,
truncation=True,
)
input_ids, attention_mask = tensor_examples["input_ids"], tensor_examples["attention_mask"]
return input_ids, attention_mask
dataset = load_dataset('text', data_files='train.txt',cache_dir="./", , split='train')
data_collator = DataCollatorForDatasetsLanguageModeling(tokenizer=tokenizer, mlm=True,
mlm_probability=0.15, block_size=tokenizer.max_len)
trainer = Trainer(model=model, args=args, data_collator=data_collator,
train_dataset=train_dataset, prediction_loss_only=True, )
trainer.train(model_path=model_path)
```
This train.txt is about 1.1GB and has 90k lines where each line is a sequence of 4k words.
During training, the memory usage increased fast as the following graph and resulted in OOM before the finish of training.

Could you please give me any suggestions on why this happened and how to fix it?
Thanks. | 42 | Load large text file for LM pre-training resulting in OOM
I tried to pretrain Longformer using transformers and datasets. But I got OOM issues with loading a large text file. My script is almost like this:
```python
from datasets import load_dataset
@dataclass
class DataCollatorForDatasetsLanguageModeling(DataCollatorForLanguageModeling):
"""
Data collator used for language modeling based on DataCollatorForLazyLanguageModeling
- collates batches of tensors, honoring their tokenizer's pad_token
- preprocesses batches for masked language modeling
"""
block_size: int = 512
def __call__(self, examples: List[dict]) -> Dict[str, torch.Tensor]:
examples = [example['text'] for example in examples]
batch, attention_mask = self._tensorize_batch(examples)
if self.mlm:
inputs, labels = self.mask_tokens(batch)
return {"input_ids": inputs, "labels": labels}
else:
labels = batch.clone().detach()
if self.tokenizer.pad_token_id is not None:
labels[labels == self.tokenizer.pad_token_id] = -100
return {"input_ids": batch, "labels": labels}
def _tensorize_batch(self, examples: List[str]) -> Tuple[torch.Tensor, torch.Tensor]:
if self.tokenizer._pad_token is None:
raise ValueError(
"You are attempting to pad samples but the tokenizer you are using"
f" ({self.tokenizer.__class__.__name__}) does not have one."
)
tensor_examples = self.tokenizer.batch_encode_plus(
[ex for ex in examples if ex],
max_length=self.block_size,
return_tensors="pt",
pad_to_max_length=True,
return_attention_mask=True,
truncation=True,
)
input_ids, attention_mask = tensor_examples["input_ids"], tensor_examples["attention_mask"]
return input_ids, attention_mask
dataset = load_dataset('text', data_files='train.txt',cache_dir="./", , split='train')
data_collator = DataCollatorForDatasetsLanguageModeling(tokenizer=tokenizer, mlm=True,
mlm_probability=0.15, block_size=tokenizer.max_len)
trainer = Trainer(model=model, args=args, data_collator=data_collator,
train_dataset=train_dataset, prediction_loss_only=True, )
trainer.train(model_path=model_path)
```
This train.txt is about 1.1GB and has 90k lines where each line is a sequence of 4k words.
During training, the memory usage increased fast as the following graph and resulted in OOM before the finish of training.

Could you please give me any suggestions on why this happened and how to fix it?
Thanks.
Same here. Pre-training on wikitext-103 to do some test. At the end of the training it takes 32GB of RAM + ~30GB of SWAP. I installed dataset==1.1.0, not built from source. I will try uninstalling and building from source when it finish. | [
-0.6339283585548401,
-0.47753778100013733,
0.010693363845348358,
0.29863524436950684,
0.36004769802093506,
-0.1518251597881317,
0.5567324757575989,
0.37380579113960266,
0.01088225468993187,
0.010719746351242065,
-0.1295929253101349,
-0.1828002780675888,
-0.26698487997055054,
-0.16208980977535248,
-0.03237204998731613,
0.023206885904073715,
-0.09982117265462875,
0.19687515497207642,
-0.2772675156593323,
-0.09666657447814941,
0.05701180547475815,
-0.07762926816940308,
-0.21276047825813293,
-0.029743991792201996,
-0.3879220187664032,
-0.06171319633722305,
0.3158179223537445,
0.12212134897708893,
-0.1640809327363968,
-0.0958080142736435,
-0.22970141470432281,
0.1197899580001831,
0.4393485188484192,
0.4340214729309082,
-0.00011477212683530524,
0.006616219878196716,
0.18904384970664978,
-0.23633266985416412,
-0.16726946830749512,
0.019216440618038177,
0.07755492627620697,
-0.3022913932800293,
-0.10640020668506622,
-0.3036171495914459,
-0.02724609524011612,
-0.10612530261278152,
-0.015682043507695198,
-0.22437302768230438,
0.4987519383430481,
0.5414043068885803,
0.15876251459121704,
0.25081300735473633,
-0.21366100013256073,
0.0723966509103775,
0.25443702936172485,
0.0488995760679245,
0.1056830957531929,
-0.27951449155807495,
0.46878406405448914,
-0.1923186331987381,
-0.47268855571746826,
0.1478176862001419,
-0.22477363049983978,
-0.20168264210224152,
-0.09508860856294632,
0.03820447996258736,
0.36608895659446716,
0.031569477170705795,
0.2641869783401489,
0.3474210202693939,
0.4272076189517975,
-0.0008120127022266388,
-0.289635568857193,
-0.3209858536720276,
-0.14262455701828003,
-0.08431586623191833,
0.18923655152320862,
0.2010769546031952,
0.059826578944921494,
0.11845916509628296,
0.10712733119726181,
-0.12533129751682281,
-0.15199026465415955,
0.07616106420755386,
-0.27480751276016235,
0.33979544043540955,
-0.20125117897987366,
-0.03804318606853485,
0.15557512640953064,
-0.09447921812534332,
0.19616937637329102,
-0.09977510571479797,
0.003403950482606888,
0.25671419501304626,
-0.245441272854805,
-0.11239507794380188,
-0.07168225198984146,
-0.5194145441055298,
0.16278403997421265,
-0.2759450674057007,
0.1981883943080902,
0.29723939299583435,
-0.08766181021928787,
-0.06761691719293594,
0.08639387786388397,
0.4202020466327667,
-0.25243741273880005,
0.26052793860435486,
0.22725635766983032,
0.16401110589504242,
-0.17170630395412445,
-0.04439859092235565,
-0.33051154017448425,
-0.19624567031860352,
0.10159362852573395,
-0.07734166085720062,
-0.011017010547220707,
-0.2546045482158661,
-0.24042175710201263,
0.05854658782482147,
-0.14076969027519226,
-0.03084544464945793,
0.2748163938522339,
0.38997286558151245,
-0.3540611267089844,
0.4294978082180023,
0.16510933637619019,
0.052328936755657196,
-0.4855332672595978,
-0.33652669191360474,
-0.17440199851989746,
0.15325728058815002,
-0.20324474573135376,
0.038975562900304794,
0.12979257106781006,
0.13963374495506287,
0.05965423583984375,
-0.04288341850042343,
-0.0625898689031601,
-0.44021931290626526,
-0.009444482624530792,
-0.024103429168462753,
0.020752981305122375,
-0.04251480475068092,
0.06302379071712494,
-0.02336559072136879,
0.23476582765579224,
-0.12499457597732544,
-0.025381658226251602,
0.3477915823459625,
-0.2762118875980377,
-0.2276410162448883,
0.05097950994968414,
0.21017630398273468,
-0.02824842929840088,
0.20915503799915314,
0.028506658971309662,
0.07685685157775879,
0.5359783172607422,
0.006653331220149994,
-0.04714777320623398,
-0.3782060742378235,
0.09452182054519653,
0.09201760590076447,
0.1619914025068283,
0.17663070559501648,
-0.042587969452142715,
-0.07260239124298096,
0.0063892244361341,
0.10358665883541107,
0.25504034757614136,
0.3907330334186554,
-0.22647030651569366,
0.2906738817691803,
0.007004471495747566,
-0.05665605142712593,
0.5319919586181641,
-0.2620989978313446,
-0.448444128036499,
0.23385274410247803,
-0.3511556386947632,
0.10818185657262802,
0.22066983580589294,
0.1759030818939209,
0.11388914287090302,
-0.1089852899312973,
0.26901498436927795,
0.3656851649284363,
0.07051589339971542,
0.1209140196442604,
-0.23662437498569489,
-0.09222844988107681,
-0.1715157926082611,
0.48420286178588867,
0.36272403597831726,
-0.02558579295873642,
-0.07308889180421829,
0.35637998580932617,
0.18339842557907104,
-0.1992236077785492,
0.13128061592578888,
0.36934155225753784,
-0.17442509531974792,
-0.1261582374572754,
0.0944812074303627,
0.06559769064188004,
-0.3000325560569763,
-0.07098697125911713,
-0.09084425866603851,
0.0828668475151062,
-0.1136055737733841,
-0.08942607045173645,
0.28255847096443176,
0.02287023328244686,
-0.0766652524471283,
0.11318020522594452,
0.03794129937887192,
-0.13182224333286285,
0.024866361171007156,
-0.07041719555854797,
0.1261971890926361,
0.015421975404024124,
-0.09320687502622604,
0.08736041188240051,
-0.2184159904718399,
-0.12394054979085922,
0.0018030330538749695,
-0.137061208486557,
0.07695000618696213,
0.17527323961257935,
-0.05118799954652786,
0.03840121626853943,
-0.17304009199142456,
0.10695729404687881,
-0.15297769010066986,
-0.2987070679664612,
-0.5071570873260498,
0.43589335680007935,
0.18647874891757965,
-0.33810955286026,
0.3402597904205322,
0.1040273904800415,
-0.029599443078041077,
-0.10627070814371109,
-0.11989574879407883,
0.5749332904815674,
0.27307116985321045,
0.019617579877376556,
0.29909294843673706,
-0.24541117250919342,
0.2542804777622223,
-0.2662392258644104,
-0.10361561179161072,
-0.09776493161916733,
0.4209232032299042,
0.03105533868074417,
0.23506294190883636,
0.14828065037727356,
-0.08694546669721603,
-0.232059508562088,
0.47038108110427856,
-0.1788094937801361,
-0.013872608542442322,
0.26652613282203674,
-0.4247211217880249,
-0.011563490144908428,
-0.34802117943763733,
-0.24947787821292877,
0.0067334845662117004,
0.17322899401187897,
-0.09441326558589935,
-0.055435195565223694,
0.008537785150110722,
-0.26279330253601074,
0.007836148142814636,
0.1532370001077652,
-0.0718524307012558,
0.31983456015586853,
0.11651500314474106,
0.10059522092342377,
-0.122891865670681,
-0.1794070154428482,
0.10284756124019623,
0.17828989028930664,
-0.27519121766090393,
0.18444325029850006,
-0.02282267063856125,
-0.013446485623717308,
-0.2862633764743805,
0.1904245764017105,
-0.12680108845233917,
0.0388152077794075,
-0.0647432953119278,
0.25868889689445496,
-0.07790280133485794,
0.10191172361373901,
0.3001607060432434,
0.3549228012561798,
0.4629628658294678,
-0.07809486240148544,
0.326348215341568,
-0.08266382664442062,
-0.1796954870223999,
0.032943595200777054,
0.33450770378112793,
-0.3179926872253418,
-0.024890778586268425,
0.005377540364861488,
0.05117718130350113,
-0.09892972558736801,
-0.16603437066078186,
0.09468895941972733,
0.196824312210083,
-0.16618932783603668,
-0.2573060691356659,
-0.07217618823051453,
0.17769087851047516,
-0.042431723326444626,
0.11972848325967789,
-0.23244111239910126,
0.008407561108469963,
0.1450573354959488,
-0.006289597600698471,
-0.18432363867759705,
0.04044550284743309,
-0.1199219599366188,
-0.04705164581537247,
-0.411641389131546,
-0.05351852625608444,
0.10705065727233887,
0.13673138618469238,
0.35936760902404785,
0.10678976029157639,
0.19445137679576874,
0.28844478726387024,
0.15859206020832062,
0.006367621943354607,
-0.0885988399386406,
0.5141718983650208,
-0.017572684213519096,
-0.29719802737236023,
-0.2908625900745392,
-0.23975418508052826,
0.02511288784444332,
0.3155249357223511,
-0.684260904788971,
0.23378321528434753,
-0.1138516515493393,
-0.09402675926685333,
-0.3955192267894745,
0.0007258430123329163,
0.2522047758102417,
-0.07614870369434357,
0.016339777037501335,
0.09547417610883713,
0.2302767038345337,
0.1546790897846222,
-0.03878729045391083,
0.38579460978507996,
-0.4130840301513672,
0.35940811038017273,
-0.13545823097229004,
0.4855530261993408,
-0.122118279337883,
-0.2300206571817398,
0.09887474775314331,
0.15044830739498138,
-0.01711525395512581,
-0.021802209317684174,
-0.013968504965305328,
-0.25937944650650024,
-0.058237224817276,
0.0227312333881855,
0.5197213292121887,
0.01689060777425766,
-0.16558955609798431,
-0.015898926183581352,
0.06816425919532776,
0.2563197910785675,
-0.26069891452789307,
0.49052777886390686,
-0.19077889621257782,
0.01841624826192856,
-0.19967399537563324,
0.01874571293592453,
-0.20498108863830566,
-0.21508586406707764,
-0.164134681224823,
0.09344439208507538,
-0.03038274496793747,
-0.22404396533966064,
-0.2116939276456833,
0.10314016044139862,
-0.3681343197822571,
-0.0437651127576828,
0.11799006909132004,
0.22933240234851837,
0.18077029287815094,
-0.19614383578300476,
-0.08628876507282257,
-0.20187069475650787,
0.35741427540779114,
0.1934524029493332,
0.11246532201766968,
0.16325931251049042,
-0.05687852203845978,
-0.2155371457338333,
-0.17745190858840942,
-0.29045435786247253,
0.14190825819969177,
0.6505106687545776,
0.6102464199066162,
-0.21627351641654968,
-0.15859898924827576,
0.07914479076862335,
0.002603483386337757,
-0.16527341306209564,
-0.548757016658783,
-0.12850907444953918,
-0.16549962759017944,
-0.44105130434036255,
0.004606112837791443,
0.35849836468696594,
0.3558535575866699,
-0.2264459729194641,
-0.03187551349401474,
0.13872987031936646,
-0.0007013268768787384,
0.37175118923187256,
-0.12976384162902832,
0.015054157003760338,
-0.06641082465648651,
0.225828617811203,
-0.10741686820983887,
0.36735567450523376,
0.24888965487480164,
0.35636386275291443,
0.1917259395122528,
-0.31755685806274414,
0.0706881731748581,
-0.029888737946748734,
0.23143038153648376,
0.11516103148460388,
0.11022848635911942,
0.3546280860900879,
0.1289711445569992,
0.3322555422782898,
-0.19096627831459045,
0.6737229228019714,
-0.007344553247094154,
0.20682765543460846,
-0.8374910354614258,
-0.26737040281295776,
0.33145615458488464,
-0.02635771967470646,
0.19940276443958282,
0.215718075633049,
-0.40385204553604126,
-0.3216697573661804,
0.376661479473114,
0.09908346086740494,
0.7675239443778992,
-0.2972695827484131,
0.39625850319862366,
-0.1552990972995758,
0.6611965894699097,
0.12803049385547638,
-0.3813104033470154,
0.1585618406534195,
-0.39879149198532104,
-0.2663658857345581,
0.21300511062145233,
-0.09231188893318176,
0.036539800465106964,
0.16050389409065247,
-0.2905767560005188,
-0.029811730608344078,
0.0862521380186081,
0.2249334454536438,
0.13066981732845306,
0.5134936571121216,
0.12092680484056473,
-0.6006978154182434,
-0.08281297981739044,
0.02656909078359604,
-0.02340024709701538,
-0.10490188002586365,
-0.0492798313498497,
0.07994647324085236,
-0.0313267819583416,
-0.20856402814388275,
-0.028466172516345978,
0.20525774359703064,
-0.2474464625120163,
0.08661594241857529,
0.06375248730182648,
-0.07205313444137573,
0.5367995500564575,
0.10623051226139069,
-0.001361064612865448,
0.4988958239555359,
-0.039286620914936066,
0.13215835392475128,
-0.2274819314479828,
-0.1652863323688507,
0.20070844888687134,
-0.06584891676902771,
0.4217033088207245,
0.08837933093309402,
-0.0005880966782569885,
0.11410333216190338,
0.0632382407784462,
-0.046690933406353,
0.09476359188556671,
-0.36430907249450684,
0.10549724102020264,
-0.41123154759407043,
-0.21542777121067047,
-0.08843062818050385,
-0.30078285932540894,
-0.1009221225976944,
0.12310943007469177,
0.13735687732696533,
-0.46444618701934814,
0.11514545977115631,
0.2652113139629364,
-0.3750092685222626,
0.011997109279036522,
0.38382449746131897,
0.17105859518051147,
-0.10513918846845627,
0.49984270334243774,
0.4575878381729126,
-0.053361937403678894,
-0.2644973695278168,
-0.10962903499603271,
0.29444822669029236,
-0.2731435000896454,
0.0849163606762886,
-0.2455592304468155,
-0.3016006648540497,
0.209351047873497,
0.08087542653083801,
0.10009974241256714,
-0.01499941200017929,
-0.06326231360435486,
-0.25102943181991577,
-0.6380501389503479,
-0.18144388496875763,
-0.0027230940759181976,
-0.00354844331741333,
0.1460832953453064,
0.27389806509017944,
-0.3100467920303345,
0.5892773270606995,
-0.2788558602333069,
-0.05294197052717209,
-0.20760811865329742,
0.2782232165336609,
-0.055562183260917664,
-0.38554659485816956,
0.21153579652309418,
0.2033519148826599,
0.1001039668917656,
0.08059665560722351,
0.00590919703245163,
-0.22135356068611145,
-0.14351996779441833,
0.11271549016237259,
0.23647010326385498,
-0.41966331005096436,
-0.01599399372935295,
-0.312997043132782,
-0.09248970448970795,
-0.27002182602882385,
0.06606784462928772,
0.017028577625751495,
0.01394578069448471,
-0.22617922723293304,
0.009393874555826187,
0.04752609133720398,
-0.2552624046802521,
0.04206028953194618,
-0.25458529591560364,
0.12509100139141083,
0.2465714067220688,
0.1331031173467636,
0.11783083528280258,
0.0006371289491653442,
-0.3931019604206085,
0.17964592576026917,
0.6661380529403687,
-0.017532095313072205,
0.4190823435783386,
-0.43573224544525146,
-0.0715063214302063,
0.24765951931476593,
0.04980342835187912,
0.048066146671772,
-0.34167730808258057,
-0.010718589648604393,
0.2935883700847626,
0.22681888937950134,
0.015208568423986435,
-0.014733202755451202,
0.22635462880134583,
-0.41129830479621887,
0.1301487535238266,
0.3453426659107208,
-0.11192676424980164,
-0.06747587025165558,
0.1559651792049408,
0.09132310748100281,
0.5066777467727661,
0.11496534198522568,
0.005711604841053486,
0.24894991517066956,
-0.00122002512216568,
0.15485714375972748,
0.48569241166114807,
0.261119544506073,
0.23868051171302795,
0.3016282618045807,
-0.032666049897670746,
-0.04069993644952774,
-0.2312840223312378,
0.2294139564037323,
-0.435617059469223,
-0.41516661643981934,
-0.2674567401409149,
0.5044151544570923,
-0.01932355761528015,
0.12420932948589325,
-0.3350299298763275,
-0.06624119728803635,
-0.04065354913473129,
0.2541331350803375,
-0.11921557784080505,
0.2744082510471344,
-0.45309436321258545,
-0.17059893906116486,
-0.08942428231239319,
-0.12396197021007538,
0.011534325778484344,
0.18963316082954407,
-0.0558583103120327,
0.27227628231048584,
-0.5796654224395752,
0.22938616573810577,
0.05213649570941925,
0.1451501101255417,
-0.1346784234046936,
0.1227787584066391,
0.10550137609243393,
-0.5078572034835815,
0.34333521127700806,
0.23785626888275146,
0.29185950756073,
0.11540549993515015,
-0.22190696001052856,
0.34437036514282227,
0.43669766187667847,
-0.1908072531223297,
-0.04061196744441986,
-0.12098392844200134,
-0.03561992570757866,
-0.1499127894639969,
0.19743536412715912,
0.3490368723869324,
0.18789905309677124,
0.2596159875392914,
0.0557275116443634,
-0.26596614718437195,
0.27851778268814087,
0.06501396000385284,
-0.3240588903427124,
0.17866621911525726,
-0.13293880224227905,
0.4019324481487274,
-0.32858094573020935,
-0.4429645836353302,
0.00986664742231369,
-0.39412444829940796,
0.21558675169944763,
0.6670199036598206,
-0.2954224944114685,
0.28785526752471924,
-0.02548792213201523,
0.04855022579431534,
0.0018409136682748795,
0.47605016827583313,
0.46973514556884766,
0.2841596007347107,
-0.37837129831314087,
-0.025667212903499603,
-0.32888373732566833,
0.2765583097934723,
-0.2024305909872055,
0.06699749082326889,
0.022247930988669395,
0.17079433798789978,
0.16457822918891907,
-0.003302011638879776,
-0.07962261140346527,
-0.013621993362903595,
0.21880324184894562,
-0.19506913423538208,
-0.1675596684217453,
-0.12804758548736572,
0.0020943284034729004,
0.3573179543018341,
-0.025900525972247124,
-0.29754993319511414,
0.15886540710926056,
0.11506294459104538,
0.0991566851735115,
-0.3214535713195801,
0.3626996874809265,
-0.19846373796463013,
-0.02036242187023163,
0.0691281408071518,
-0.15047122538089752,
0.37920957803726196,
-0.22043859958648682,
-0.03304758667945862,
-0.08182770013809204,
0.12814156711101532,
-0.16707712411880493,
-0.22100013494491577,
0.3402222692966461,
0.38842451572418213,
-0.10763649642467499,
0.10821394622325897,
-0.25519275665283203,
-0.08646275848150253,
0.040304481983184814,
-0.36969074606895447,
-0.3087161183357239,
-0.0074881562031805515,
-0.0002531483769416809,
0.008524507284164429,
0.10309776663780212,
0.24583062529563904,
0.10533731430768967,
-0.027840254828333855,
-0.22922900319099426,
-0.1855800449848175,
0.20947544276714325,
-0.2946496903896332,
-0.31304094195365906,
-0.03537982702255249,
0.05562475696206093,
-0.16362905502319336,
0.2511020004749298,
-0.46240702271461487,
0.14574888348579407,
0.22974419593811035,
-0.025514401495456696,
-0.4540731608867645,
0.2232973277568817,
0.2540613114833832,
0.016472186893224716,
-0.20769661664962769,
0.05345691740512848,
0.1526237428188324,
-0.1369924396276474,
-0.20163996517658234,
-0.1757192611694336
] |
https://github.com/huggingface/datasets/issues/633 | Load large text file for LM pre-training resulting in OOM | This seems to be on the `transformers` library side.
If you have more informations (pip env) or even better, a colab reproducing the error we can investigate. | I tried to pretrain Longformer using transformers and datasets. But I got OOM issues with loading a large text file. My script is almost like this:
```python
from datasets import load_dataset
@dataclass
class DataCollatorForDatasetsLanguageModeling(DataCollatorForLanguageModeling):
"""
Data collator used for language modeling based on DataCollatorForLazyLanguageModeling
- collates batches of tensors, honoring their tokenizer's pad_token
- preprocesses batches for masked language modeling
"""
block_size: int = 512
def __call__(self, examples: List[dict]) -> Dict[str, torch.Tensor]:
examples = [example['text'] for example in examples]
batch, attention_mask = self._tensorize_batch(examples)
if self.mlm:
inputs, labels = self.mask_tokens(batch)
return {"input_ids": inputs, "labels": labels}
else:
labels = batch.clone().detach()
if self.tokenizer.pad_token_id is not None:
labels[labels == self.tokenizer.pad_token_id] = -100
return {"input_ids": batch, "labels": labels}
def _tensorize_batch(self, examples: List[str]) -> Tuple[torch.Tensor, torch.Tensor]:
if self.tokenizer._pad_token is None:
raise ValueError(
"You are attempting to pad samples but the tokenizer you are using"
f" ({self.tokenizer.__class__.__name__}) does not have one."
)
tensor_examples = self.tokenizer.batch_encode_plus(
[ex for ex in examples if ex],
max_length=self.block_size,
return_tensors="pt",
pad_to_max_length=True,
return_attention_mask=True,
truncation=True,
)
input_ids, attention_mask = tensor_examples["input_ids"], tensor_examples["attention_mask"]
return input_ids, attention_mask
dataset = load_dataset('text', data_files='train.txt',cache_dir="./", , split='train')
data_collator = DataCollatorForDatasetsLanguageModeling(tokenizer=tokenizer, mlm=True,
mlm_probability=0.15, block_size=tokenizer.max_len)
trainer = Trainer(model=model, args=args, data_collator=data_collator,
train_dataset=train_dataset, prediction_loss_only=True, )
trainer.train(model_path=model_path)
```
This train.txt is about 1.1GB and has 90k lines where each line is a sequence of 4k words.
During training, the memory usage increased fast as the following graph and resulted in OOM before the finish of training.

Could you please give me any suggestions on why this happened and how to fix it?
Thanks. | 27 | Load large text file for LM pre-training resulting in OOM
I tried to pretrain Longformer using transformers and datasets. But I got OOM issues with loading a large text file. My script is almost like this:
```python
from datasets import load_dataset
@dataclass
class DataCollatorForDatasetsLanguageModeling(DataCollatorForLanguageModeling):
"""
Data collator used for language modeling based on DataCollatorForLazyLanguageModeling
- collates batches of tensors, honoring their tokenizer's pad_token
- preprocesses batches for masked language modeling
"""
block_size: int = 512
def __call__(self, examples: List[dict]) -> Dict[str, torch.Tensor]:
examples = [example['text'] for example in examples]
batch, attention_mask = self._tensorize_batch(examples)
if self.mlm:
inputs, labels = self.mask_tokens(batch)
return {"input_ids": inputs, "labels": labels}
else:
labels = batch.clone().detach()
if self.tokenizer.pad_token_id is not None:
labels[labels == self.tokenizer.pad_token_id] = -100
return {"input_ids": batch, "labels": labels}
def _tensorize_batch(self, examples: List[str]) -> Tuple[torch.Tensor, torch.Tensor]:
if self.tokenizer._pad_token is None:
raise ValueError(
"You are attempting to pad samples but the tokenizer you are using"
f" ({self.tokenizer.__class__.__name__}) does not have one."
)
tensor_examples = self.tokenizer.batch_encode_plus(
[ex for ex in examples if ex],
max_length=self.block_size,
return_tensors="pt",
pad_to_max_length=True,
return_attention_mask=True,
truncation=True,
)
input_ids, attention_mask = tensor_examples["input_ids"], tensor_examples["attention_mask"]
return input_ids, attention_mask
dataset = load_dataset('text', data_files='train.txt',cache_dir="./", , split='train')
data_collator = DataCollatorForDatasetsLanguageModeling(tokenizer=tokenizer, mlm=True,
mlm_probability=0.15, block_size=tokenizer.max_len)
trainer = Trainer(model=model, args=args, data_collator=data_collator,
train_dataset=train_dataset, prediction_loss_only=True, )
trainer.train(model_path=model_path)
```
This train.txt is about 1.1GB and has 90k lines where each line is a sequence of 4k words.
During training, the memory usage increased fast as the following graph and resulted in OOM before the finish of training.

Could you please give me any suggestions on why this happened and how to fix it?
Thanks.
This seems to be on the `transformers` library side.
If you have more informations (pip env) or even better, a colab reproducing the error we can investigate. | [
-0.6339283585548401,
-0.47753778100013733,
0.010693363845348358,
0.29863524436950684,
0.36004769802093506,
-0.1518251597881317,
0.5567324757575989,
0.37380579113960266,
0.01088225468993187,
0.010719746351242065,
-0.1295929253101349,
-0.1828002780675888,
-0.26698487997055054,
-0.16208980977535248,
-0.03237204998731613,
0.023206885904073715,
-0.09982117265462875,
0.19687515497207642,
-0.2772675156593323,
-0.09666657447814941,
0.05701180547475815,
-0.07762926816940308,
-0.21276047825813293,
-0.029743991792201996,
-0.3879220187664032,
-0.06171319633722305,
0.3158179223537445,
0.12212134897708893,
-0.1640809327363968,
-0.0958080142736435,
-0.22970141470432281,
0.1197899580001831,
0.4393485188484192,
0.4340214729309082,
-0.00011477212683530524,
0.006616219878196716,
0.18904384970664978,
-0.23633266985416412,
-0.16726946830749512,
0.019216440618038177,
0.07755492627620697,
-0.3022913932800293,
-0.10640020668506622,
-0.3036171495914459,
-0.02724609524011612,
-0.10612530261278152,
-0.015682043507695198,
-0.22437302768230438,
0.4987519383430481,
0.5414043068885803,
0.15876251459121704,
0.25081300735473633,
-0.21366100013256073,
0.0723966509103775,
0.25443702936172485,
0.0488995760679245,
0.1056830957531929,
-0.27951449155807495,
0.46878406405448914,
-0.1923186331987381,
-0.47268855571746826,
0.1478176862001419,
-0.22477363049983978,
-0.20168264210224152,
-0.09508860856294632,
0.03820447996258736,
0.36608895659446716,
0.031569477170705795,
0.2641869783401489,
0.3474210202693939,
0.4272076189517975,
-0.0008120127022266388,
-0.289635568857193,
-0.3209858536720276,
-0.14262455701828003,
-0.08431586623191833,
0.18923655152320862,
0.2010769546031952,
0.059826578944921494,
0.11845916509628296,
0.10712733119726181,
-0.12533129751682281,
-0.15199026465415955,
0.07616106420755386,
-0.27480751276016235,
0.33979544043540955,
-0.20125117897987366,
-0.03804318606853485,
0.15557512640953064,
-0.09447921812534332,
0.19616937637329102,
-0.09977510571479797,
0.003403950482606888,
0.25671419501304626,
-0.245441272854805,
-0.11239507794380188,
-0.07168225198984146,
-0.5194145441055298,
0.16278403997421265,
-0.2759450674057007,
0.1981883943080902,
0.29723939299583435,
-0.08766181021928787,
-0.06761691719293594,
0.08639387786388397,
0.4202020466327667,
-0.25243741273880005,
0.26052793860435486,
0.22725635766983032,
0.16401110589504242,
-0.17170630395412445,
-0.04439859092235565,
-0.33051154017448425,
-0.19624567031860352,
0.10159362852573395,
-0.07734166085720062,
-0.011017010547220707,
-0.2546045482158661,
-0.24042175710201263,
0.05854658782482147,
-0.14076969027519226,
-0.03084544464945793,
0.2748163938522339,
0.38997286558151245,
-0.3540611267089844,
0.4294978082180023,
0.16510933637619019,
0.052328936755657196,
-0.4855332672595978,
-0.33652669191360474,
-0.17440199851989746,
0.15325728058815002,
-0.20324474573135376,
0.038975562900304794,
0.12979257106781006,
0.13963374495506287,
0.05965423583984375,
-0.04288341850042343,
-0.0625898689031601,
-0.44021931290626526,
-0.009444482624530792,
-0.024103429168462753,
0.020752981305122375,
-0.04251480475068092,
0.06302379071712494,
-0.02336559072136879,
0.23476582765579224,
-0.12499457597732544,
-0.025381658226251602,
0.3477915823459625,
-0.2762118875980377,
-0.2276410162448883,
0.05097950994968414,
0.21017630398273468,
-0.02824842929840088,
0.20915503799915314,
0.028506658971309662,
0.07685685157775879,
0.5359783172607422,
0.006653331220149994,
-0.04714777320623398,
-0.3782060742378235,
0.09452182054519653,
0.09201760590076447,
0.1619914025068283,
0.17663070559501648,
-0.042587969452142715,
-0.07260239124298096,
0.0063892244361341,
0.10358665883541107,
0.25504034757614136,
0.3907330334186554,
-0.22647030651569366,
0.2906738817691803,
0.007004471495747566,
-0.05665605142712593,
0.5319919586181641,
-0.2620989978313446,
-0.448444128036499,
0.23385274410247803,
-0.3511556386947632,
0.10818185657262802,
0.22066983580589294,
0.1759030818939209,
0.11388914287090302,
-0.1089852899312973,
0.26901498436927795,
0.3656851649284363,
0.07051589339971542,
0.1209140196442604,
-0.23662437498569489,
-0.09222844988107681,
-0.1715157926082611,
0.48420286178588867,
0.36272403597831726,
-0.02558579295873642,
-0.07308889180421829,
0.35637998580932617,
0.18339842557907104,
-0.1992236077785492,
0.13128061592578888,
0.36934155225753784,
-0.17442509531974792,
-0.1261582374572754,
0.0944812074303627,
0.06559769064188004,
-0.3000325560569763,
-0.07098697125911713,
-0.09084425866603851,
0.0828668475151062,
-0.1136055737733841,
-0.08942607045173645,
0.28255847096443176,
0.02287023328244686,
-0.0766652524471283,
0.11318020522594452,
0.03794129937887192,
-0.13182224333286285,
0.024866361171007156,
-0.07041719555854797,
0.1261971890926361,
0.015421975404024124,
-0.09320687502622604,
0.08736041188240051,
-0.2184159904718399,
-0.12394054979085922,
0.0018030330538749695,
-0.137061208486557,
0.07695000618696213,
0.17527323961257935,
-0.05118799954652786,
0.03840121626853943,
-0.17304009199142456,
0.10695729404687881,
-0.15297769010066986,
-0.2987070679664612,
-0.5071570873260498,
0.43589335680007935,
0.18647874891757965,
-0.33810955286026,
0.3402597904205322,
0.1040273904800415,
-0.029599443078041077,
-0.10627070814371109,
-0.11989574879407883,
0.5749332904815674,
0.27307116985321045,
0.019617579877376556,
0.29909294843673706,
-0.24541117250919342,
0.2542804777622223,
-0.2662392258644104,
-0.10361561179161072,
-0.09776493161916733,
0.4209232032299042,
0.03105533868074417,
0.23506294190883636,
0.14828065037727356,
-0.08694546669721603,
-0.232059508562088,
0.47038108110427856,
-0.1788094937801361,
-0.013872608542442322,
0.26652613282203674,
-0.4247211217880249,
-0.011563490144908428,
-0.34802117943763733,
-0.24947787821292877,
0.0067334845662117004,
0.17322899401187897,
-0.09441326558589935,
-0.055435195565223694,
0.008537785150110722,
-0.26279330253601074,
0.007836148142814636,
0.1532370001077652,
-0.0718524307012558,
0.31983456015586853,
0.11651500314474106,
0.10059522092342377,
-0.122891865670681,
-0.1794070154428482,
0.10284756124019623,
0.17828989028930664,
-0.27519121766090393,
0.18444325029850006,
-0.02282267063856125,
-0.013446485623717308,
-0.2862633764743805,
0.1904245764017105,
-0.12680108845233917,
0.0388152077794075,
-0.0647432953119278,
0.25868889689445496,
-0.07790280133485794,
0.10191172361373901,
0.3001607060432434,
0.3549228012561798,
0.4629628658294678,
-0.07809486240148544,
0.326348215341568,
-0.08266382664442062,
-0.1796954870223999,
0.032943595200777054,
0.33450770378112793,
-0.3179926872253418,
-0.024890778586268425,
0.005377540364861488,
0.05117718130350113,
-0.09892972558736801,
-0.16603437066078186,
0.09468895941972733,
0.196824312210083,
-0.16618932783603668,
-0.2573060691356659,
-0.07217618823051453,
0.17769087851047516,
-0.042431723326444626,
0.11972848325967789,
-0.23244111239910126,
0.008407561108469963,
0.1450573354959488,
-0.006289597600698471,
-0.18432363867759705,
0.04044550284743309,
-0.1199219599366188,
-0.04705164581537247,
-0.411641389131546,
-0.05351852625608444,
0.10705065727233887,
0.13673138618469238,
0.35936760902404785,
0.10678976029157639,
0.19445137679576874,
0.28844478726387024,
0.15859206020832062,
0.006367621943354607,
-0.0885988399386406,
0.5141718983650208,
-0.017572684213519096,
-0.29719802737236023,
-0.2908625900745392,
-0.23975418508052826,
0.02511288784444332,
0.3155249357223511,
-0.684260904788971,
0.23378321528434753,
-0.1138516515493393,
-0.09402675926685333,
-0.3955192267894745,
0.0007258430123329163,
0.2522047758102417,
-0.07614870369434357,
0.016339777037501335,
0.09547417610883713,
0.2302767038345337,
0.1546790897846222,
-0.03878729045391083,
0.38579460978507996,
-0.4130840301513672,
0.35940811038017273,
-0.13545823097229004,
0.4855530261993408,
-0.122118279337883,
-0.2300206571817398,
0.09887474775314331,
0.15044830739498138,
-0.01711525395512581,
-0.021802209317684174,
-0.013968504965305328,
-0.25937944650650024,
-0.058237224817276,
0.0227312333881855,
0.5197213292121887,
0.01689060777425766,
-0.16558955609798431,
-0.015898926183581352,
0.06816425919532776,
0.2563197910785675,
-0.26069891452789307,
0.49052777886390686,
-0.19077889621257782,
0.01841624826192856,
-0.19967399537563324,
0.01874571293592453,
-0.20498108863830566,
-0.21508586406707764,
-0.164134681224823,
0.09344439208507538,
-0.03038274496793747,
-0.22404396533966064,
-0.2116939276456833,
0.10314016044139862,
-0.3681343197822571,
-0.0437651127576828,
0.11799006909132004,
0.22933240234851837,
0.18077029287815094,
-0.19614383578300476,
-0.08628876507282257,
-0.20187069475650787,
0.35741427540779114,
0.1934524029493332,
0.11246532201766968,
0.16325931251049042,
-0.05687852203845978,
-0.2155371457338333,
-0.17745190858840942,
-0.29045435786247253,
0.14190825819969177,
0.6505106687545776,
0.6102464199066162,
-0.21627351641654968,
-0.15859898924827576,
0.07914479076862335,
0.002603483386337757,
-0.16527341306209564,
-0.548757016658783,
-0.12850907444953918,
-0.16549962759017944,
-0.44105130434036255,
0.004606112837791443,
0.35849836468696594,
0.3558535575866699,
-0.2264459729194641,
-0.03187551349401474,
0.13872987031936646,
-0.0007013268768787384,
0.37175118923187256,
-0.12976384162902832,
0.015054157003760338,
-0.06641082465648651,
0.225828617811203,
-0.10741686820983887,
0.36735567450523376,
0.24888965487480164,
0.35636386275291443,
0.1917259395122528,
-0.31755685806274414,
0.0706881731748581,
-0.029888737946748734,
0.23143038153648376,
0.11516103148460388,
0.11022848635911942,
0.3546280860900879,
0.1289711445569992,
0.3322555422782898,
-0.19096627831459045,
0.6737229228019714,
-0.007344553247094154,
0.20682765543460846,
-0.8374910354614258,
-0.26737040281295776,
0.33145615458488464,
-0.02635771967470646,
0.19940276443958282,
0.215718075633049,
-0.40385204553604126,
-0.3216697573661804,
0.376661479473114,
0.09908346086740494,
0.7675239443778992,
-0.2972695827484131,
0.39625850319862366,
-0.1552990972995758,
0.6611965894699097,
0.12803049385547638,
-0.3813104033470154,
0.1585618406534195,
-0.39879149198532104,
-0.2663658857345581,
0.21300511062145233,
-0.09231188893318176,
0.036539800465106964,
0.16050389409065247,
-0.2905767560005188,
-0.029811730608344078,
0.0862521380186081,
0.2249334454536438,
0.13066981732845306,
0.5134936571121216,
0.12092680484056473,
-0.6006978154182434,
-0.08281297981739044,
0.02656909078359604,
-0.02340024709701538,
-0.10490188002586365,
-0.0492798313498497,
0.07994647324085236,
-0.0313267819583416,
-0.20856402814388275,
-0.028466172516345978,
0.20525774359703064,
-0.2474464625120163,
0.08661594241857529,
0.06375248730182648,
-0.07205313444137573,
0.5367995500564575,
0.10623051226139069,
-0.001361064612865448,
0.4988958239555359,
-0.039286620914936066,
0.13215835392475128,
-0.2274819314479828,
-0.1652863323688507,
0.20070844888687134,
-0.06584891676902771,
0.4217033088207245,
0.08837933093309402,
-0.0005880966782569885,
0.11410333216190338,
0.0632382407784462,
-0.046690933406353,
0.09476359188556671,
-0.36430907249450684,
0.10549724102020264,
-0.41123154759407043,
-0.21542777121067047,
-0.08843062818050385,
-0.30078285932540894,
-0.1009221225976944,
0.12310943007469177,
0.13735687732696533,
-0.46444618701934814,
0.11514545977115631,
0.2652113139629364,
-0.3750092685222626,
0.011997109279036522,
0.38382449746131897,
0.17105859518051147,
-0.10513918846845627,
0.49984270334243774,
0.4575878381729126,
-0.053361937403678894,
-0.2644973695278168,
-0.10962903499603271,
0.29444822669029236,
-0.2731435000896454,
0.0849163606762886,
-0.2455592304468155,
-0.3016006648540497,
0.209351047873497,
0.08087542653083801,
0.10009974241256714,
-0.01499941200017929,
-0.06326231360435486,
-0.25102943181991577,
-0.6380501389503479,
-0.18144388496875763,
-0.0027230940759181976,
-0.00354844331741333,
0.1460832953453064,
0.27389806509017944,
-0.3100467920303345,
0.5892773270606995,
-0.2788558602333069,
-0.05294197052717209,
-0.20760811865329742,
0.2782232165336609,
-0.055562183260917664,
-0.38554659485816956,
0.21153579652309418,
0.2033519148826599,
0.1001039668917656,
0.08059665560722351,
0.00590919703245163,
-0.22135356068611145,
-0.14351996779441833,
0.11271549016237259,
0.23647010326385498,
-0.41966331005096436,
-0.01599399372935295,
-0.312997043132782,
-0.09248970448970795,
-0.27002182602882385,
0.06606784462928772,
0.017028577625751495,
0.01394578069448471,
-0.22617922723293304,
0.009393874555826187,
0.04752609133720398,
-0.2552624046802521,
0.04206028953194618,
-0.25458529591560364,
0.12509100139141083,
0.2465714067220688,
0.1331031173467636,
0.11783083528280258,
0.0006371289491653442,
-0.3931019604206085,
0.17964592576026917,
0.6661380529403687,
-0.017532095313072205,
0.4190823435783386,
-0.43573224544525146,
-0.0715063214302063,
0.24765951931476593,
0.04980342835187912,
0.048066146671772,
-0.34167730808258057,
-0.010718589648604393,
0.2935883700847626,
0.22681888937950134,
0.015208568423986435,
-0.014733202755451202,
0.22635462880134583,
-0.41129830479621887,
0.1301487535238266,
0.3453426659107208,
-0.11192676424980164,
-0.06747587025165558,
0.1559651792049408,
0.09132310748100281,
0.5066777467727661,
0.11496534198522568,
0.005711604841053486,
0.24894991517066956,
-0.00122002512216568,
0.15485714375972748,
0.48569241166114807,
0.261119544506073,
0.23868051171302795,
0.3016282618045807,
-0.032666049897670746,
-0.04069993644952774,
-0.2312840223312378,
0.2294139564037323,
-0.435617059469223,
-0.41516661643981934,
-0.2674567401409149,
0.5044151544570923,
-0.01932355761528015,
0.12420932948589325,
-0.3350299298763275,
-0.06624119728803635,
-0.04065354913473129,
0.2541331350803375,
-0.11921557784080505,
0.2744082510471344,
-0.45309436321258545,
-0.17059893906116486,
-0.08942428231239319,
-0.12396197021007538,
0.011534325778484344,
0.18963316082954407,
-0.0558583103120327,
0.27227628231048584,
-0.5796654224395752,
0.22938616573810577,
0.05213649570941925,
0.1451501101255417,
-0.1346784234046936,
0.1227787584066391,
0.10550137609243393,
-0.5078572034835815,
0.34333521127700806,
0.23785626888275146,
0.29185950756073,
0.11540549993515015,
-0.22190696001052856,
0.34437036514282227,
0.43669766187667847,
-0.1908072531223297,
-0.04061196744441986,
-0.12098392844200134,
-0.03561992570757866,
-0.1499127894639969,
0.19743536412715912,
0.3490368723869324,
0.18789905309677124,
0.2596159875392914,
0.0557275116443634,
-0.26596614718437195,
0.27851778268814087,
0.06501396000385284,
-0.3240588903427124,
0.17866621911525726,
-0.13293880224227905,
0.4019324481487274,
-0.32858094573020935,
-0.4429645836353302,
0.00986664742231369,
-0.39412444829940796,
0.21558675169944763,
0.6670199036598206,
-0.2954224944114685,
0.28785526752471924,
-0.02548792213201523,
0.04855022579431534,
0.0018409136682748795,
0.47605016827583313,
0.46973514556884766,
0.2841596007347107,
-0.37837129831314087,
-0.025667212903499603,
-0.32888373732566833,
0.2765583097934723,
-0.2024305909872055,
0.06699749082326889,
0.022247930988669395,
0.17079433798789978,
0.16457822918891907,
-0.003302011638879776,
-0.07962261140346527,
-0.013621993362903595,
0.21880324184894562,
-0.19506913423538208,
-0.1675596684217453,
-0.12804758548736572,
0.0020943284034729004,
0.3573179543018341,
-0.025900525972247124,
-0.29754993319511414,
0.15886540710926056,
0.11506294459104538,
0.0991566851735115,
-0.3214535713195801,
0.3626996874809265,
-0.19846373796463013,
-0.02036242187023163,
0.0691281408071518,
-0.15047122538089752,
0.37920957803726196,
-0.22043859958648682,
-0.03304758667945862,
-0.08182770013809204,
0.12814156711101532,
-0.16707712411880493,
-0.22100013494491577,
0.3402222692966461,
0.38842451572418213,
-0.10763649642467499,
0.10821394622325897,
-0.25519275665283203,
-0.08646275848150253,
0.040304481983184814,
-0.36969074606895447,
-0.3087161183357239,
-0.0074881562031805515,
-0.0002531483769416809,
0.008524507284164429,
0.10309776663780212,
0.24583062529563904,
0.10533731430768967,
-0.027840254828333855,
-0.22922900319099426,
-0.1855800449848175,
0.20947544276714325,
-0.2946496903896332,
-0.31304094195365906,
-0.03537982702255249,
0.05562475696206093,
-0.16362905502319336,
0.2511020004749298,
-0.46240702271461487,
0.14574888348579407,
0.22974419593811035,
-0.025514401495456696,
-0.4540731608867645,
0.2232973277568817,
0.2540613114833832,
0.016472186893224716,
-0.20769661664962769,
0.05345691740512848,
0.1526237428188324,
-0.1369924396276474,
-0.20163996517658234,
-0.1757192611694336
] |
https://github.com/huggingface/datasets/issues/633 | Load large text file for LM pre-training resulting in OOM | It seems like it's solved with freshed versions of transformers. I have tried to replicate the error doing a fresh pip install transformers & datasets on colab and the error doesn't continue. On colab it keeps stable on 5GB! (Y)
Edit: **Thanks for your great work**. Have a good day. | I tried to pretrain Longformer using transformers and datasets. But I got OOM issues with loading a large text file. My script is almost like this:
```python
from datasets import load_dataset
@dataclass
class DataCollatorForDatasetsLanguageModeling(DataCollatorForLanguageModeling):
"""
Data collator used for language modeling based on DataCollatorForLazyLanguageModeling
- collates batches of tensors, honoring their tokenizer's pad_token
- preprocesses batches for masked language modeling
"""
block_size: int = 512
def __call__(self, examples: List[dict]) -> Dict[str, torch.Tensor]:
examples = [example['text'] for example in examples]
batch, attention_mask = self._tensorize_batch(examples)
if self.mlm:
inputs, labels = self.mask_tokens(batch)
return {"input_ids": inputs, "labels": labels}
else:
labels = batch.clone().detach()
if self.tokenizer.pad_token_id is not None:
labels[labels == self.tokenizer.pad_token_id] = -100
return {"input_ids": batch, "labels": labels}
def _tensorize_batch(self, examples: List[str]) -> Tuple[torch.Tensor, torch.Tensor]:
if self.tokenizer._pad_token is None:
raise ValueError(
"You are attempting to pad samples but the tokenizer you are using"
f" ({self.tokenizer.__class__.__name__}) does not have one."
)
tensor_examples = self.tokenizer.batch_encode_plus(
[ex for ex in examples if ex],
max_length=self.block_size,
return_tensors="pt",
pad_to_max_length=True,
return_attention_mask=True,
truncation=True,
)
input_ids, attention_mask = tensor_examples["input_ids"], tensor_examples["attention_mask"]
return input_ids, attention_mask
dataset = load_dataset('text', data_files='train.txt',cache_dir="./", , split='train')
data_collator = DataCollatorForDatasetsLanguageModeling(tokenizer=tokenizer, mlm=True,
mlm_probability=0.15, block_size=tokenizer.max_len)
trainer = Trainer(model=model, args=args, data_collator=data_collator,
train_dataset=train_dataset, prediction_loss_only=True, )
trainer.train(model_path=model_path)
```
This train.txt is about 1.1GB and has 90k lines where each line is a sequence of 4k words.
During training, the memory usage increased fast as the following graph and resulted in OOM before the finish of training.

Could you please give me any suggestions on why this happened and how to fix it?
Thanks. | 50 | Load large text file for LM pre-training resulting in OOM
I tried to pretrain Longformer using transformers and datasets. But I got OOM issues with loading a large text file. My script is almost like this:
```python
from datasets import load_dataset
@dataclass
class DataCollatorForDatasetsLanguageModeling(DataCollatorForLanguageModeling):
"""
Data collator used for language modeling based on DataCollatorForLazyLanguageModeling
- collates batches of tensors, honoring their tokenizer's pad_token
- preprocesses batches for masked language modeling
"""
block_size: int = 512
def __call__(self, examples: List[dict]) -> Dict[str, torch.Tensor]:
examples = [example['text'] for example in examples]
batch, attention_mask = self._tensorize_batch(examples)
if self.mlm:
inputs, labels = self.mask_tokens(batch)
return {"input_ids": inputs, "labels": labels}
else:
labels = batch.clone().detach()
if self.tokenizer.pad_token_id is not None:
labels[labels == self.tokenizer.pad_token_id] = -100
return {"input_ids": batch, "labels": labels}
def _tensorize_batch(self, examples: List[str]) -> Tuple[torch.Tensor, torch.Tensor]:
if self.tokenizer._pad_token is None:
raise ValueError(
"You are attempting to pad samples but the tokenizer you are using"
f" ({self.tokenizer.__class__.__name__}) does not have one."
)
tensor_examples = self.tokenizer.batch_encode_plus(
[ex for ex in examples if ex],
max_length=self.block_size,
return_tensors="pt",
pad_to_max_length=True,
return_attention_mask=True,
truncation=True,
)
input_ids, attention_mask = tensor_examples["input_ids"], tensor_examples["attention_mask"]
return input_ids, attention_mask
dataset = load_dataset('text', data_files='train.txt',cache_dir="./", , split='train')
data_collator = DataCollatorForDatasetsLanguageModeling(tokenizer=tokenizer, mlm=True,
mlm_probability=0.15, block_size=tokenizer.max_len)
trainer = Trainer(model=model, args=args, data_collator=data_collator,
train_dataset=train_dataset, prediction_loss_only=True, )
trainer.train(model_path=model_path)
```
This train.txt is about 1.1GB and has 90k lines where each line is a sequence of 4k words.
During training, the memory usage increased fast as the following graph and resulted in OOM before the finish of training.

Could you please give me any suggestions on why this happened and how to fix it?
Thanks.
It seems like it's solved with freshed versions of transformers. I have tried to replicate the error doing a fresh pip install transformers & datasets on colab and the error doesn't continue. On colab it keeps stable on 5GB! (Y)
Edit: **Thanks for your great work**. Have a good day. | [
-0.6339283585548401,
-0.47753778100013733,
0.010693363845348358,
0.29863524436950684,
0.36004769802093506,
-0.1518251597881317,
0.5567324757575989,
0.37380579113960266,
0.01088225468993187,
0.010719746351242065,
-0.1295929253101349,
-0.1828002780675888,
-0.26698487997055054,
-0.16208980977535248,
-0.03237204998731613,
0.023206885904073715,
-0.09982117265462875,
0.19687515497207642,
-0.2772675156593323,
-0.09666657447814941,
0.05701180547475815,
-0.07762926816940308,
-0.21276047825813293,
-0.029743991792201996,
-0.3879220187664032,
-0.06171319633722305,
0.3158179223537445,
0.12212134897708893,
-0.1640809327363968,
-0.0958080142736435,
-0.22970141470432281,
0.1197899580001831,
0.4393485188484192,
0.4340214729309082,
-0.00011477212683530524,
0.006616219878196716,
0.18904384970664978,
-0.23633266985416412,
-0.16726946830749512,
0.019216440618038177,
0.07755492627620697,
-0.3022913932800293,
-0.10640020668506622,
-0.3036171495914459,
-0.02724609524011612,
-0.10612530261278152,
-0.015682043507695198,
-0.22437302768230438,
0.4987519383430481,
0.5414043068885803,
0.15876251459121704,
0.25081300735473633,
-0.21366100013256073,
0.0723966509103775,
0.25443702936172485,
0.0488995760679245,
0.1056830957531929,
-0.27951449155807495,
0.46878406405448914,
-0.1923186331987381,
-0.47268855571746826,
0.1478176862001419,
-0.22477363049983978,
-0.20168264210224152,
-0.09508860856294632,
0.03820447996258736,
0.36608895659446716,
0.031569477170705795,
0.2641869783401489,
0.3474210202693939,
0.4272076189517975,
-0.0008120127022266388,
-0.289635568857193,
-0.3209858536720276,
-0.14262455701828003,
-0.08431586623191833,
0.18923655152320862,
0.2010769546031952,
0.059826578944921494,
0.11845916509628296,
0.10712733119726181,
-0.12533129751682281,
-0.15199026465415955,
0.07616106420755386,
-0.27480751276016235,
0.33979544043540955,
-0.20125117897987366,
-0.03804318606853485,
0.15557512640953064,
-0.09447921812534332,
0.19616937637329102,
-0.09977510571479797,
0.003403950482606888,
0.25671419501304626,
-0.245441272854805,
-0.11239507794380188,
-0.07168225198984146,
-0.5194145441055298,
0.16278403997421265,
-0.2759450674057007,
0.1981883943080902,
0.29723939299583435,
-0.08766181021928787,
-0.06761691719293594,
0.08639387786388397,
0.4202020466327667,
-0.25243741273880005,
0.26052793860435486,
0.22725635766983032,
0.16401110589504242,
-0.17170630395412445,
-0.04439859092235565,
-0.33051154017448425,
-0.19624567031860352,
0.10159362852573395,
-0.07734166085720062,
-0.011017010547220707,
-0.2546045482158661,
-0.24042175710201263,
0.05854658782482147,
-0.14076969027519226,
-0.03084544464945793,
0.2748163938522339,
0.38997286558151245,
-0.3540611267089844,
0.4294978082180023,
0.16510933637619019,
0.052328936755657196,
-0.4855332672595978,
-0.33652669191360474,
-0.17440199851989746,
0.15325728058815002,
-0.20324474573135376,
0.038975562900304794,
0.12979257106781006,
0.13963374495506287,
0.05965423583984375,
-0.04288341850042343,
-0.0625898689031601,
-0.44021931290626526,
-0.009444482624530792,
-0.024103429168462753,
0.020752981305122375,
-0.04251480475068092,
0.06302379071712494,
-0.02336559072136879,
0.23476582765579224,
-0.12499457597732544,
-0.025381658226251602,
0.3477915823459625,
-0.2762118875980377,
-0.2276410162448883,
0.05097950994968414,
0.21017630398273468,
-0.02824842929840088,
0.20915503799915314,
0.028506658971309662,
0.07685685157775879,
0.5359783172607422,
0.006653331220149994,
-0.04714777320623398,
-0.3782060742378235,
0.09452182054519653,
0.09201760590076447,
0.1619914025068283,
0.17663070559501648,
-0.042587969452142715,
-0.07260239124298096,
0.0063892244361341,
0.10358665883541107,
0.25504034757614136,
0.3907330334186554,
-0.22647030651569366,
0.2906738817691803,
0.007004471495747566,
-0.05665605142712593,
0.5319919586181641,
-0.2620989978313446,
-0.448444128036499,
0.23385274410247803,
-0.3511556386947632,
0.10818185657262802,
0.22066983580589294,
0.1759030818939209,
0.11388914287090302,
-0.1089852899312973,
0.26901498436927795,
0.3656851649284363,
0.07051589339971542,
0.1209140196442604,
-0.23662437498569489,
-0.09222844988107681,
-0.1715157926082611,
0.48420286178588867,
0.36272403597831726,
-0.02558579295873642,
-0.07308889180421829,
0.35637998580932617,
0.18339842557907104,
-0.1992236077785492,
0.13128061592578888,
0.36934155225753784,
-0.17442509531974792,
-0.1261582374572754,
0.0944812074303627,
0.06559769064188004,
-0.3000325560569763,
-0.07098697125911713,
-0.09084425866603851,
0.0828668475151062,
-0.1136055737733841,
-0.08942607045173645,
0.28255847096443176,
0.02287023328244686,
-0.0766652524471283,
0.11318020522594452,
0.03794129937887192,
-0.13182224333286285,
0.024866361171007156,
-0.07041719555854797,
0.1261971890926361,
0.015421975404024124,
-0.09320687502622604,
0.08736041188240051,
-0.2184159904718399,
-0.12394054979085922,
0.0018030330538749695,
-0.137061208486557,
0.07695000618696213,
0.17527323961257935,
-0.05118799954652786,
0.03840121626853943,
-0.17304009199142456,
0.10695729404687881,
-0.15297769010066986,
-0.2987070679664612,
-0.5071570873260498,
0.43589335680007935,
0.18647874891757965,
-0.33810955286026,
0.3402597904205322,
0.1040273904800415,
-0.029599443078041077,
-0.10627070814371109,
-0.11989574879407883,
0.5749332904815674,
0.27307116985321045,
0.019617579877376556,
0.29909294843673706,
-0.24541117250919342,
0.2542804777622223,
-0.2662392258644104,
-0.10361561179161072,
-0.09776493161916733,
0.4209232032299042,
0.03105533868074417,
0.23506294190883636,
0.14828065037727356,
-0.08694546669721603,
-0.232059508562088,
0.47038108110427856,
-0.1788094937801361,
-0.013872608542442322,
0.26652613282203674,
-0.4247211217880249,
-0.011563490144908428,
-0.34802117943763733,
-0.24947787821292877,
0.0067334845662117004,
0.17322899401187897,
-0.09441326558589935,
-0.055435195565223694,
0.008537785150110722,
-0.26279330253601074,
0.007836148142814636,
0.1532370001077652,
-0.0718524307012558,
0.31983456015586853,
0.11651500314474106,
0.10059522092342377,
-0.122891865670681,
-0.1794070154428482,
0.10284756124019623,
0.17828989028930664,
-0.27519121766090393,
0.18444325029850006,
-0.02282267063856125,
-0.013446485623717308,
-0.2862633764743805,
0.1904245764017105,
-0.12680108845233917,
0.0388152077794075,
-0.0647432953119278,
0.25868889689445496,
-0.07790280133485794,
0.10191172361373901,
0.3001607060432434,
0.3549228012561798,
0.4629628658294678,
-0.07809486240148544,
0.326348215341568,
-0.08266382664442062,
-0.1796954870223999,
0.032943595200777054,
0.33450770378112793,
-0.3179926872253418,
-0.024890778586268425,
0.005377540364861488,
0.05117718130350113,
-0.09892972558736801,
-0.16603437066078186,
0.09468895941972733,
0.196824312210083,
-0.16618932783603668,
-0.2573060691356659,
-0.07217618823051453,
0.17769087851047516,
-0.042431723326444626,
0.11972848325967789,
-0.23244111239910126,
0.008407561108469963,
0.1450573354959488,
-0.006289597600698471,
-0.18432363867759705,
0.04044550284743309,
-0.1199219599366188,
-0.04705164581537247,
-0.411641389131546,
-0.05351852625608444,
0.10705065727233887,
0.13673138618469238,
0.35936760902404785,
0.10678976029157639,
0.19445137679576874,
0.28844478726387024,
0.15859206020832062,
0.006367621943354607,
-0.0885988399386406,
0.5141718983650208,
-0.017572684213519096,
-0.29719802737236023,
-0.2908625900745392,
-0.23975418508052826,
0.02511288784444332,
0.3155249357223511,
-0.684260904788971,
0.23378321528434753,
-0.1138516515493393,
-0.09402675926685333,
-0.3955192267894745,
0.0007258430123329163,
0.2522047758102417,
-0.07614870369434357,
0.016339777037501335,
0.09547417610883713,
0.2302767038345337,
0.1546790897846222,
-0.03878729045391083,
0.38579460978507996,
-0.4130840301513672,
0.35940811038017273,
-0.13545823097229004,
0.4855530261993408,
-0.122118279337883,
-0.2300206571817398,
0.09887474775314331,
0.15044830739498138,
-0.01711525395512581,
-0.021802209317684174,
-0.013968504965305328,
-0.25937944650650024,
-0.058237224817276,
0.0227312333881855,
0.5197213292121887,
0.01689060777425766,
-0.16558955609798431,
-0.015898926183581352,
0.06816425919532776,
0.2563197910785675,
-0.26069891452789307,
0.49052777886390686,
-0.19077889621257782,
0.01841624826192856,
-0.19967399537563324,
0.01874571293592453,
-0.20498108863830566,
-0.21508586406707764,
-0.164134681224823,
0.09344439208507538,
-0.03038274496793747,
-0.22404396533966064,
-0.2116939276456833,
0.10314016044139862,
-0.3681343197822571,
-0.0437651127576828,
0.11799006909132004,
0.22933240234851837,
0.18077029287815094,
-0.19614383578300476,
-0.08628876507282257,
-0.20187069475650787,
0.35741427540779114,
0.1934524029493332,
0.11246532201766968,
0.16325931251049042,
-0.05687852203845978,
-0.2155371457338333,
-0.17745190858840942,
-0.29045435786247253,
0.14190825819969177,
0.6505106687545776,
0.6102464199066162,
-0.21627351641654968,
-0.15859898924827576,
0.07914479076862335,
0.002603483386337757,
-0.16527341306209564,
-0.548757016658783,
-0.12850907444953918,
-0.16549962759017944,
-0.44105130434036255,
0.004606112837791443,
0.35849836468696594,
0.3558535575866699,
-0.2264459729194641,
-0.03187551349401474,
0.13872987031936646,
-0.0007013268768787384,
0.37175118923187256,
-0.12976384162902832,
0.015054157003760338,
-0.06641082465648651,
0.225828617811203,
-0.10741686820983887,
0.36735567450523376,
0.24888965487480164,
0.35636386275291443,
0.1917259395122528,
-0.31755685806274414,
0.0706881731748581,
-0.029888737946748734,
0.23143038153648376,
0.11516103148460388,
0.11022848635911942,
0.3546280860900879,
0.1289711445569992,
0.3322555422782898,
-0.19096627831459045,
0.6737229228019714,
-0.007344553247094154,
0.20682765543460846,
-0.8374910354614258,
-0.26737040281295776,
0.33145615458488464,
-0.02635771967470646,
0.19940276443958282,
0.215718075633049,
-0.40385204553604126,
-0.3216697573661804,
0.376661479473114,
0.09908346086740494,
0.7675239443778992,
-0.2972695827484131,
0.39625850319862366,
-0.1552990972995758,
0.6611965894699097,
0.12803049385547638,
-0.3813104033470154,
0.1585618406534195,
-0.39879149198532104,
-0.2663658857345581,
0.21300511062145233,
-0.09231188893318176,
0.036539800465106964,
0.16050389409065247,
-0.2905767560005188,
-0.029811730608344078,
0.0862521380186081,
0.2249334454536438,
0.13066981732845306,
0.5134936571121216,
0.12092680484056473,
-0.6006978154182434,
-0.08281297981739044,
0.02656909078359604,
-0.02340024709701538,
-0.10490188002586365,
-0.0492798313498497,
0.07994647324085236,
-0.0313267819583416,
-0.20856402814388275,
-0.028466172516345978,
0.20525774359703064,
-0.2474464625120163,
0.08661594241857529,
0.06375248730182648,
-0.07205313444137573,
0.5367995500564575,
0.10623051226139069,
-0.001361064612865448,
0.4988958239555359,
-0.039286620914936066,
0.13215835392475128,
-0.2274819314479828,
-0.1652863323688507,
0.20070844888687134,
-0.06584891676902771,
0.4217033088207245,
0.08837933093309402,
-0.0005880966782569885,
0.11410333216190338,
0.0632382407784462,
-0.046690933406353,
0.09476359188556671,
-0.36430907249450684,
0.10549724102020264,
-0.41123154759407043,
-0.21542777121067047,
-0.08843062818050385,
-0.30078285932540894,
-0.1009221225976944,
0.12310943007469177,
0.13735687732696533,
-0.46444618701934814,
0.11514545977115631,
0.2652113139629364,
-0.3750092685222626,
0.011997109279036522,
0.38382449746131897,
0.17105859518051147,
-0.10513918846845627,
0.49984270334243774,
0.4575878381729126,
-0.053361937403678894,
-0.2644973695278168,
-0.10962903499603271,
0.29444822669029236,
-0.2731435000896454,
0.0849163606762886,
-0.2455592304468155,
-0.3016006648540497,
0.209351047873497,
0.08087542653083801,
0.10009974241256714,
-0.01499941200017929,
-0.06326231360435486,
-0.25102943181991577,
-0.6380501389503479,
-0.18144388496875763,
-0.0027230940759181976,
-0.00354844331741333,
0.1460832953453064,
0.27389806509017944,
-0.3100467920303345,
0.5892773270606995,
-0.2788558602333069,
-0.05294197052717209,
-0.20760811865329742,
0.2782232165336609,
-0.055562183260917664,
-0.38554659485816956,
0.21153579652309418,
0.2033519148826599,
0.1001039668917656,
0.08059665560722351,
0.00590919703245163,
-0.22135356068611145,
-0.14351996779441833,
0.11271549016237259,
0.23647010326385498,
-0.41966331005096436,
-0.01599399372935295,
-0.312997043132782,
-0.09248970448970795,
-0.27002182602882385,
0.06606784462928772,
0.017028577625751495,
0.01394578069448471,
-0.22617922723293304,
0.009393874555826187,
0.04752609133720398,
-0.2552624046802521,
0.04206028953194618,
-0.25458529591560364,
0.12509100139141083,
0.2465714067220688,
0.1331031173467636,
0.11783083528280258,
0.0006371289491653442,
-0.3931019604206085,
0.17964592576026917,
0.6661380529403687,
-0.017532095313072205,
0.4190823435783386,
-0.43573224544525146,
-0.0715063214302063,
0.24765951931476593,
0.04980342835187912,
0.048066146671772,
-0.34167730808258057,
-0.010718589648604393,
0.2935883700847626,
0.22681888937950134,
0.015208568423986435,
-0.014733202755451202,
0.22635462880134583,
-0.41129830479621887,
0.1301487535238266,
0.3453426659107208,
-0.11192676424980164,
-0.06747587025165558,
0.1559651792049408,
0.09132310748100281,
0.5066777467727661,
0.11496534198522568,
0.005711604841053486,
0.24894991517066956,
-0.00122002512216568,
0.15485714375972748,
0.48569241166114807,
0.261119544506073,
0.23868051171302795,
0.3016282618045807,
-0.032666049897670746,
-0.04069993644952774,
-0.2312840223312378,
0.2294139564037323,
-0.435617059469223,
-0.41516661643981934,
-0.2674567401409149,
0.5044151544570923,
-0.01932355761528015,
0.12420932948589325,
-0.3350299298763275,
-0.06624119728803635,
-0.04065354913473129,
0.2541331350803375,
-0.11921557784080505,
0.2744082510471344,
-0.45309436321258545,
-0.17059893906116486,
-0.08942428231239319,
-0.12396197021007538,
0.011534325778484344,
0.18963316082954407,
-0.0558583103120327,
0.27227628231048584,
-0.5796654224395752,
0.22938616573810577,
0.05213649570941925,
0.1451501101255417,
-0.1346784234046936,
0.1227787584066391,
0.10550137609243393,
-0.5078572034835815,
0.34333521127700806,
0.23785626888275146,
0.29185950756073,
0.11540549993515015,
-0.22190696001052856,
0.34437036514282227,
0.43669766187667847,
-0.1908072531223297,
-0.04061196744441986,
-0.12098392844200134,
-0.03561992570757866,
-0.1499127894639969,
0.19743536412715912,
0.3490368723869324,
0.18789905309677124,
0.2596159875392914,
0.0557275116443634,
-0.26596614718437195,
0.27851778268814087,
0.06501396000385284,
-0.3240588903427124,
0.17866621911525726,
-0.13293880224227905,
0.4019324481487274,
-0.32858094573020935,
-0.4429645836353302,
0.00986664742231369,
-0.39412444829940796,
0.21558675169944763,
0.6670199036598206,
-0.2954224944114685,
0.28785526752471924,
-0.02548792213201523,
0.04855022579431534,
0.0018409136682748795,
0.47605016827583313,
0.46973514556884766,
0.2841596007347107,
-0.37837129831314087,
-0.025667212903499603,
-0.32888373732566833,
0.2765583097934723,
-0.2024305909872055,
0.06699749082326889,
0.022247930988669395,
0.17079433798789978,
0.16457822918891907,
-0.003302011638879776,
-0.07962261140346527,
-0.013621993362903595,
0.21880324184894562,
-0.19506913423538208,
-0.1675596684217453,
-0.12804758548736572,
0.0020943284034729004,
0.3573179543018341,
-0.025900525972247124,
-0.29754993319511414,
0.15886540710926056,
0.11506294459104538,
0.0991566851735115,
-0.3214535713195801,
0.3626996874809265,
-0.19846373796463013,
-0.02036242187023163,
0.0691281408071518,
-0.15047122538089752,
0.37920957803726196,
-0.22043859958648682,
-0.03304758667945862,
-0.08182770013809204,
0.12814156711101532,
-0.16707712411880493,
-0.22100013494491577,
0.3402222692966461,
0.38842451572418213,
-0.10763649642467499,
0.10821394622325897,
-0.25519275665283203,
-0.08646275848150253,
0.040304481983184814,
-0.36969074606895447,
-0.3087161183357239,
-0.0074881562031805515,
-0.0002531483769416809,
0.008524507284164429,
0.10309776663780212,
0.24583062529563904,
0.10533731430768967,
-0.027840254828333855,
-0.22922900319099426,
-0.1855800449848175,
0.20947544276714325,
-0.2946496903896332,
-0.31304094195365906,
-0.03537982702255249,
0.05562475696206093,
-0.16362905502319336,
0.2511020004749298,
-0.46240702271461487,
0.14574888348579407,
0.22974419593811035,
-0.025514401495456696,
-0.4540731608867645,
0.2232973277568817,
0.2540613114833832,
0.016472186893224716,
-0.20769661664962769,
0.05345691740512848,
0.1526237428188324,
-0.1369924396276474,
-0.20163996517658234,
-0.1757192611694336
] |
https://github.com/huggingface/datasets/issues/633 | Load large text file for LM pre-training resulting in OOM | @gaceladri witch version transformers and datasets are you using now? I want to try again. Thanks. | I tried to pretrain Longformer using transformers and datasets. But I got OOM issues with loading a large text file. My script is almost like this:
```python
from datasets import load_dataset
@dataclass
class DataCollatorForDatasetsLanguageModeling(DataCollatorForLanguageModeling):
"""
Data collator used for language modeling based on DataCollatorForLazyLanguageModeling
- collates batches of tensors, honoring their tokenizer's pad_token
- preprocesses batches for masked language modeling
"""
block_size: int = 512
def __call__(self, examples: List[dict]) -> Dict[str, torch.Tensor]:
examples = [example['text'] for example in examples]
batch, attention_mask = self._tensorize_batch(examples)
if self.mlm:
inputs, labels = self.mask_tokens(batch)
return {"input_ids": inputs, "labels": labels}
else:
labels = batch.clone().detach()
if self.tokenizer.pad_token_id is not None:
labels[labels == self.tokenizer.pad_token_id] = -100
return {"input_ids": batch, "labels": labels}
def _tensorize_batch(self, examples: List[str]) -> Tuple[torch.Tensor, torch.Tensor]:
if self.tokenizer._pad_token is None:
raise ValueError(
"You are attempting to pad samples but the tokenizer you are using"
f" ({self.tokenizer.__class__.__name__}) does not have one."
)
tensor_examples = self.tokenizer.batch_encode_plus(
[ex for ex in examples if ex],
max_length=self.block_size,
return_tensors="pt",
pad_to_max_length=True,
return_attention_mask=True,
truncation=True,
)
input_ids, attention_mask = tensor_examples["input_ids"], tensor_examples["attention_mask"]
return input_ids, attention_mask
dataset = load_dataset('text', data_files='train.txt',cache_dir="./", , split='train')
data_collator = DataCollatorForDatasetsLanguageModeling(tokenizer=tokenizer, mlm=True,
mlm_probability=0.15, block_size=tokenizer.max_len)
trainer = Trainer(model=model, args=args, data_collator=data_collator,
train_dataset=train_dataset, prediction_loss_only=True, )
trainer.train(model_path=model_path)
```
This train.txt is about 1.1GB and has 90k lines where each line is a sequence of 4k words.
During training, the memory usage increased fast as the following graph and resulted in OOM before the finish of training.

Could you please give me any suggestions on why this happened and how to fix it?
Thanks. | 16 | Load large text file for LM pre-training resulting in OOM
I tried to pretrain Longformer using transformers and datasets. But I got OOM issues with loading a large text file. My script is almost like this:
```python
from datasets import load_dataset
@dataclass
class DataCollatorForDatasetsLanguageModeling(DataCollatorForLanguageModeling):
"""
Data collator used for language modeling based on DataCollatorForLazyLanguageModeling
- collates batches of tensors, honoring their tokenizer's pad_token
- preprocesses batches for masked language modeling
"""
block_size: int = 512
def __call__(self, examples: List[dict]) -> Dict[str, torch.Tensor]:
examples = [example['text'] for example in examples]
batch, attention_mask = self._tensorize_batch(examples)
if self.mlm:
inputs, labels = self.mask_tokens(batch)
return {"input_ids": inputs, "labels": labels}
else:
labels = batch.clone().detach()
if self.tokenizer.pad_token_id is not None:
labels[labels == self.tokenizer.pad_token_id] = -100
return {"input_ids": batch, "labels": labels}
def _tensorize_batch(self, examples: List[str]) -> Tuple[torch.Tensor, torch.Tensor]:
if self.tokenizer._pad_token is None:
raise ValueError(
"You are attempting to pad samples but the tokenizer you are using"
f" ({self.tokenizer.__class__.__name__}) does not have one."
)
tensor_examples = self.tokenizer.batch_encode_plus(
[ex for ex in examples if ex],
max_length=self.block_size,
return_tensors="pt",
pad_to_max_length=True,
return_attention_mask=True,
truncation=True,
)
input_ids, attention_mask = tensor_examples["input_ids"], tensor_examples["attention_mask"]
return input_ids, attention_mask
dataset = load_dataset('text', data_files='train.txt',cache_dir="./", , split='train')
data_collator = DataCollatorForDatasetsLanguageModeling(tokenizer=tokenizer, mlm=True,
mlm_probability=0.15, block_size=tokenizer.max_len)
trainer = Trainer(model=model, args=args, data_collator=data_collator,
train_dataset=train_dataset, prediction_loss_only=True, )
trainer.train(model_path=model_path)
```
This train.txt is about 1.1GB and has 90k lines where each line is a sequence of 4k words.
During training, the memory usage increased fast as the following graph and resulted in OOM before the finish of training.

Could you please give me any suggestions on why this happened and how to fix it?
Thanks.
@gaceladri witch version transformers and datasets are you using now? I want to try again. Thanks. | [
-0.6339283585548401,
-0.47753778100013733,
0.010693363845348358,
0.29863524436950684,
0.36004769802093506,
-0.1518251597881317,
0.5567324757575989,
0.37380579113960266,
0.01088225468993187,
0.010719746351242065,
-0.1295929253101349,
-0.1828002780675888,
-0.26698487997055054,
-0.16208980977535248,
-0.03237204998731613,
0.023206885904073715,
-0.09982117265462875,
0.19687515497207642,
-0.2772675156593323,
-0.09666657447814941,
0.05701180547475815,
-0.07762926816940308,
-0.21276047825813293,
-0.029743991792201996,
-0.3879220187664032,
-0.06171319633722305,
0.3158179223537445,
0.12212134897708893,
-0.1640809327363968,
-0.0958080142736435,
-0.22970141470432281,
0.1197899580001831,
0.4393485188484192,
0.4340214729309082,
-0.00011477212683530524,
0.006616219878196716,
0.18904384970664978,
-0.23633266985416412,
-0.16726946830749512,
0.019216440618038177,
0.07755492627620697,
-0.3022913932800293,
-0.10640020668506622,
-0.3036171495914459,
-0.02724609524011612,
-0.10612530261278152,
-0.015682043507695198,
-0.22437302768230438,
0.4987519383430481,
0.5414043068885803,
0.15876251459121704,
0.25081300735473633,
-0.21366100013256073,
0.0723966509103775,
0.25443702936172485,
0.0488995760679245,
0.1056830957531929,
-0.27951449155807495,
0.46878406405448914,
-0.1923186331987381,
-0.47268855571746826,
0.1478176862001419,
-0.22477363049983978,
-0.20168264210224152,
-0.09508860856294632,
0.03820447996258736,
0.36608895659446716,
0.031569477170705795,
0.2641869783401489,
0.3474210202693939,
0.4272076189517975,
-0.0008120127022266388,
-0.289635568857193,
-0.3209858536720276,
-0.14262455701828003,
-0.08431586623191833,
0.18923655152320862,
0.2010769546031952,
0.059826578944921494,
0.11845916509628296,
0.10712733119726181,
-0.12533129751682281,
-0.15199026465415955,
0.07616106420755386,
-0.27480751276016235,
0.33979544043540955,
-0.20125117897987366,
-0.03804318606853485,
0.15557512640953064,
-0.09447921812534332,
0.19616937637329102,
-0.09977510571479797,
0.003403950482606888,
0.25671419501304626,
-0.245441272854805,
-0.11239507794380188,
-0.07168225198984146,
-0.5194145441055298,
0.16278403997421265,
-0.2759450674057007,
0.1981883943080902,
0.29723939299583435,
-0.08766181021928787,
-0.06761691719293594,
0.08639387786388397,
0.4202020466327667,
-0.25243741273880005,
0.26052793860435486,
0.22725635766983032,
0.16401110589504242,
-0.17170630395412445,
-0.04439859092235565,
-0.33051154017448425,
-0.19624567031860352,
0.10159362852573395,
-0.07734166085720062,
-0.011017010547220707,
-0.2546045482158661,
-0.24042175710201263,
0.05854658782482147,
-0.14076969027519226,
-0.03084544464945793,
0.2748163938522339,
0.38997286558151245,
-0.3540611267089844,
0.4294978082180023,
0.16510933637619019,
0.052328936755657196,
-0.4855332672595978,
-0.33652669191360474,
-0.17440199851989746,
0.15325728058815002,
-0.20324474573135376,
0.038975562900304794,
0.12979257106781006,
0.13963374495506287,
0.05965423583984375,
-0.04288341850042343,
-0.0625898689031601,
-0.44021931290626526,
-0.009444482624530792,
-0.024103429168462753,
0.020752981305122375,
-0.04251480475068092,
0.06302379071712494,
-0.02336559072136879,
0.23476582765579224,
-0.12499457597732544,
-0.025381658226251602,
0.3477915823459625,
-0.2762118875980377,
-0.2276410162448883,
0.05097950994968414,
0.21017630398273468,
-0.02824842929840088,
0.20915503799915314,
0.028506658971309662,
0.07685685157775879,
0.5359783172607422,
0.006653331220149994,
-0.04714777320623398,
-0.3782060742378235,
0.09452182054519653,
0.09201760590076447,
0.1619914025068283,
0.17663070559501648,
-0.042587969452142715,
-0.07260239124298096,
0.0063892244361341,
0.10358665883541107,
0.25504034757614136,
0.3907330334186554,
-0.22647030651569366,
0.2906738817691803,
0.007004471495747566,
-0.05665605142712593,
0.5319919586181641,
-0.2620989978313446,
-0.448444128036499,
0.23385274410247803,
-0.3511556386947632,
0.10818185657262802,
0.22066983580589294,
0.1759030818939209,
0.11388914287090302,
-0.1089852899312973,
0.26901498436927795,
0.3656851649284363,
0.07051589339971542,
0.1209140196442604,
-0.23662437498569489,
-0.09222844988107681,
-0.1715157926082611,
0.48420286178588867,
0.36272403597831726,
-0.02558579295873642,
-0.07308889180421829,
0.35637998580932617,
0.18339842557907104,
-0.1992236077785492,
0.13128061592578888,
0.36934155225753784,
-0.17442509531974792,
-0.1261582374572754,
0.0944812074303627,
0.06559769064188004,
-0.3000325560569763,
-0.07098697125911713,
-0.09084425866603851,
0.0828668475151062,
-0.1136055737733841,
-0.08942607045173645,
0.28255847096443176,
0.02287023328244686,
-0.0766652524471283,
0.11318020522594452,
0.03794129937887192,
-0.13182224333286285,
0.024866361171007156,
-0.07041719555854797,
0.1261971890926361,
0.015421975404024124,
-0.09320687502622604,
0.08736041188240051,
-0.2184159904718399,
-0.12394054979085922,
0.0018030330538749695,
-0.137061208486557,
0.07695000618696213,
0.17527323961257935,
-0.05118799954652786,
0.03840121626853943,
-0.17304009199142456,
0.10695729404687881,
-0.15297769010066986,
-0.2987070679664612,
-0.5071570873260498,
0.43589335680007935,
0.18647874891757965,
-0.33810955286026,
0.3402597904205322,
0.1040273904800415,
-0.029599443078041077,
-0.10627070814371109,
-0.11989574879407883,
0.5749332904815674,
0.27307116985321045,
0.019617579877376556,
0.29909294843673706,
-0.24541117250919342,
0.2542804777622223,
-0.2662392258644104,
-0.10361561179161072,
-0.09776493161916733,
0.4209232032299042,
0.03105533868074417,
0.23506294190883636,
0.14828065037727356,
-0.08694546669721603,
-0.232059508562088,
0.47038108110427856,
-0.1788094937801361,
-0.013872608542442322,
0.26652613282203674,
-0.4247211217880249,
-0.011563490144908428,
-0.34802117943763733,
-0.24947787821292877,
0.0067334845662117004,
0.17322899401187897,
-0.09441326558589935,
-0.055435195565223694,
0.008537785150110722,
-0.26279330253601074,
0.007836148142814636,
0.1532370001077652,
-0.0718524307012558,
0.31983456015586853,
0.11651500314474106,
0.10059522092342377,
-0.122891865670681,
-0.1794070154428482,
0.10284756124019623,
0.17828989028930664,
-0.27519121766090393,
0.18444325029850006,
-0.02282267063856125,
-0.013446485623717308,
-0.2862633764743805,
0.1904245764017105,
-0.12680108845233917,
0.0388152077794075,
-0.0647432953119278,
0.25868889689445496,
-0.07790280133485794,
0.10191172361373901,
0.3001607060432434,
0.3549228012561798,
0.4629628658294678,
-0.07809486240148544,
0.326348215341568,
-0.08266382664442062,
-0.1796954870223999,
0.032943595200777054,
0.33450770378112793,
-0.3179926872253418,
-0.024890778586268425,
0.005377540364861488,
0.05117718130350113,
-0.09892972558736801,
-0.16603437066078186,
0.09468895941972733,
0.196824312210083,
-0.16618932783603668,
-0.2573060691356659,
-0.07217618823051453,
0.17769087851047516,
-0.042431723326444626,
0.11972848325967789,
-0.23244111239910126,
0.008407561108469963,
0.1450573354959488,
-0.006289597600698471,
-0.18432363867759705,
0.04044550284743309,
-0.1199219599366188,
-0.04705164581537247,
-0.411641389131546,
-0.05351852625608444,
0.10705065727233887,
0.13673138618469238,
0.35936760902404785,
0.10678976029157639,
0.19445137679576874,
0.28844478726387024,
0.15859206020832062,
0.006367621943354607,
-0.0885988399386406,
0.5141718983650208,
-0.017572684213519096,
-0.29719802737236023,
-0.2908625900745392,
-0.23975418508052826,
0.02511288784444332,
0.3155249357223511,
-0.684260904788971,
0.23378321528434753,
-0.1138516515493393,
-0.09402675926685333,
-0.3955192267894745,
0.0007258430123329163,
0.2522047758102417,
-0.07614870369434357,
0.016339777037501335,
0.09547417610883713,
0.2302767038345337,
0.1546790897846222,
-0.03878729045391083,
0.38579460978507996,
-0.4130840301513672,
0.35940811038017273,
-0.13545823097229004,
0.4855530261993408,
-0.122118279337883,
-0.2300206571817398,
0.09887474775314331,
0.15044830739498138,
-0.01711525395512581,
-0.021802209317684174,
-0.013968504965305328,
-0.25937944650650024,
-0.058237224817276,
0.0227312333881855,
0.5197213292121887,
0.01689060777425766,
-0.16558955609798431,
-0.015898926183581352,
0.06816425919532776,
0.2563197910785675,
-0.26069891452789307,
0.49052777886390686,
-0.19077889621257782,
0.01841624826192856,
-0.19967399537563324,
0.01874571293592453,
-0.20498108863830566,
-0.21508586406707764,
-0.164134681224823,
0.09344439208507538,
-0.03038274496793747,
-0.22404396533966064,
-0.2116939276456833,
0.10314016044139862,
-0.3681343197822571,
-0.0437651127576828,
0.11799006909132004,
0.22933240234851837,
0.18077029287815094,
-0.19614383578300476,
-0.08628876507282257,
-0.20187069475650787,
0.35741427540779114,
0.1934524029493332,
0.11246532201766968,
0.16325931251049042,
-0.05687852203845978,
-0.2155371457338333,
-0.17745190858840942,
-0.29045435786247253,
0.14190825819969177,
0.6505106687545776,
0.6102464199066162,
-0.21627351641654968,
-0.15859898924827576,
0.07914479076862335,
0.002603483386337757,
-0.16527341306209564,
-0.548757016658783,
-0.12850907444953918,
-0.16549962759017944,
-0.44105130434036255,
0.004606112837791443,
0.35849836468696594,
0.3558535575866699,
-0.2264459729194641,
-0.03187551349401474,
0.13872987031936646,
-0.0007013268768787384,
0.37175118923187256,
-0.12976384162902832,
0.015054157003760338,
-0.06641082465648651,
0.225828617811203,
-0.10741686820983887,
0.36735567450523376,
0.24888965487480164,
0.35636386275291443,
0.1917259395122528,
-0.31755685806274414,
0.0706881731748581,
-0.029888737946748734,
0.23143038153648376,
0.11516103148460388,
0.11022848635911942,
0.3546280860900879,
0.1289711445569992,
0.3322555422782898,
-0.19096627831459045,
0.6737229228019714,
-0.007344553247094154,
0.20682765543460846,
-0.8374910354614258,
-0.26737040281295776,
0.33145615458488464,
-0.02635771967470646,
0.19940276443958282,
0.215718075633049,
-0.40385204553604126,
-0.3216697573661804,
0.376661479473114,
0.09908346086740494,
0.7675239443778992,
-0.2972695827484131,
0.39625850319862366,
-0.1552990972995758,
0.6611965894699097,
0.12803049385547638,
-0.3813104033470154,
0.1585618406534195,
-0.39879149198532104,
-0.2663658857345581,
0.21300511062145233,
-0.09231188893318176,
0.036539800465106964,
0.16050389409065247,
-0.2905767560005188,
-0.029811730608344078,
0.0862521380186081,
0.2249334454536438,
0.13066981732845306,
0.5134936571121216,
0.12092680484056473,
-0.6006978154182434,
-0.08281297981739044,
0.02656909078359604,
-0.02340024709701538,
-0.10490188002586365,
-0.0492798313498497,
0.07994647324085236,
-0.0313267819583416,
-0.20856402814388275,
-0.028466172516345978,
0.20525774359703064,
-0.2474464625120163,
0.08661594241857529,
0.06375248730182648,
-0.07205313444137573,
0.5367995500564575,
0.10623051226139069,
-0.001361064612865448,
0.4988958239555359,
-0.039286620914936066,
0.13215835392475128,
-0.2274819314479828,
-0.1652863323688507,
0.20070844888687134,
-0.06584891676902771,
0.4217033088207245,
0.08837933093309402,
-0.0005880966782569885,
0.11410333216190338,
0.0632382407784462,
-0.046690933406353,
0.09476359188556671,
-0.36430907249450684,
0.10549724102020264,
-0.41123154759407043,
-0.21542777121067047,
-0.08843062818050385,
-0.30078285932540894,
-0.1009221225976944,
0.12310943007469177,
0.13735687732696533,
-0.46444618701934814,
0.11514545977115631,
0.2652113139629364,
-0.3750092685222626,
0.011997109279036522,
0.38382449746131897,
0.17105859518051147,
-0.10513918846845627,
0.49984270334243774,
0.4575878381729126,
-0.053361937403678894,
-0.2644973695278168,
-0.10962903499603271,
0.29444822669029236,
-0.2731435000896454,
0.0849163606762886,
-0.2455592304468155,
-0.3016006648540497,
0.209351047873497,
0.08087542653083801,
0.10009974241256714,
-0.01499941200017929,
-0.06326231360435486,
-0.25102943181991577,
-0.6380501389503479,
-0.18144388496875763,
-0.0027230940759181976,
-0.00354844331741333,
0.1460832953453064,
0.27389806509017944,
-0.3100467920303345,
0.5892773270606995,
-0.2788558602333069,
-0.05294197052717209,
-0.20760811865329742,
0.2782232165336609,
-0.055562183260917664,
-0.38554659485816956,
0.21153579652309418,
0.2033519148826599,
0.1001039668917656,
0.08059665560722351,
0.00590919703245163,
-0.22135356068611145,
-0.14351996779441833,
0.11271549016237259,
0.23647010326385498,
-0.41966331005096436,
-0.01599399372935295,
-0.312997043132782,
-0.09248970448970795,
-0.27002182602882385,
0.06606784462928772,
0.017028577625751495,
0.01394578069448471,
-0.22617922723293304,
0.009393874555826187,
0.04752609133720398,
-0.2552624046802521,
0.04206028953194618,
-0.25458529591560364,
0.12509100139141083,
0.2465714067220688,
0.1331031173467636,
0.11783083528280258,
0.0006371289491653442,
-0.3931019604206085,
0.17964592576026917,
0.6661380529403687,
-0.017532095313072205,
0.4190823435783386,
-0.43573224544525146,
-0.0715063214302063,
0.24765951931476593,
0.04980342835187912,
0.048066146671772,
-0.34167730808258057,
-0.010718589648604393,
0.2935883700847626,
0.22681888937950134,
0.015208568423986435,
-0.014733202755451202,
0.22635462880134583,
-0.41129830479621887,
0.1301487535238266,
0.3453426659107208,
-0.11192676424980164,
-0.06747587025165558,
0.1559651792049408,
0.09132310748100281,
0.5066777467727661,
0.11496534198522568,
0.005711604841053486,
0.24894991517066956,
-0.00122002512216568,
0.15485714375972748,
0.48569241166114807,
0.261119544506073,
0.23868051171302795,
0.3016282618045807,
-0.032666049897670746,
-0.04069993644952774,
-0.2312840223312378,
0.2294139564037323,
-0.435617059469223,
-0.41516661643981934,
-0.2674567401409149,
0.5044151544570923,
-0.01932355761528015,
0.12420932948589325,
-0.3350299298763275,
-0.06624119728803635,
-0.04065354913473129,
0.2541331350803375,
-0.11921557784080505,
0.2744082510471344,
-0.45309436321258545,
-0.17059893906116486,
-0.08942428231239319,
-0.12396197021007538,
0.011534325778484344,
0.18963316082954407,
-0.0558583103120327,
0.27227628231048584,
-0.5796654224395752,
0.22938616573810577,
0.05213649570941925,
0.1451501101255417,
-0.1346784234046936,
0.1227787584066391,
0.10550137609243393,
-0.5078572034835815,
0.34333521127700806,
0.23785626888275146,
0.29185950756073,
0.11540549993515015,
-0.22190696001052856,
0.34437036514282227,
0.43669766187667847,
-0.1908072531223297,
-0.04061196744441986,
-0.12098392844200134,
-0.03561992570757866,
-0.1499127894639969,
0.19743536412715912,
0.3490368723869324,
0.18789905309677124,
0.2596159875392914,
0.0557275116443634,
-0.26596614718437195,
0.27851778268814087,
0.06501396000385284,
-0.3240588903427124,
0.17866621911525726,
-0.13293880224227905,
0.4019324481487274,
-0.32858094573020935,
-0.4429645836353302,
0.00986664742231369,
-0.39412444829940796,
0.21558675169944763,
0.6670199036598206,
-0.2954224944114685,
0.28785526752471924,
-0.02548792213201523,
0.04855022579431534,
0.0018409136682748795,
0.47605016827583313,
0.46973514556884766,
0.2841596007347107,
-0.37837129831314087,
-0.025667212903499603,
-0.32888373732566833,
0.2765583097934723,
-0.2024305909872055,
0.06699749082326889,
0.022247930988669395,
0.17079433798789978,
0.16457822918891907,
-0.003302011638879776,
-0.07962261140346527,
-0.013621993362903595,
0.21880324184894562,
-0.19506913423538208,
-0.1675596684217453,
-0.12804758548736572,
0.0020943284034729004,
0.3573179543018341,
-0.025900525972247124,
-0.29754993319511414,
0.15886540710926056,
0.11506294459104538,
0.0991566851735115,
-0.3214535713195801,
0.3626996874809265,
-0.19846373796463013,
-0.02036242187023163,
0.0691281408071518,
-0.15047122538089752,
0.37920957803726196,
-0.22043859958648682,
-0.03304758667945862,
-0.08182770013809204,
0.12814156711101532,
-0.16707712411880493,
-0.22100013494491577,
0.3402222692966461,
0.38842451572418213,
-0.10763649642467499,
0.10821394622325897,
-0.25519275665283203,
-0.08646275848150253,
0.040304481983184814,
-0.36969074606895447,
-0.3087161183357239,
-0.0074881562031805515,
-0.0002531483769416809,
0.008524507284164429,
0.10309776663780212,
0.24583062529563904,
0.10533731430768967,
-0.027840254828333855,
-0.22922900319099426,
-0.1855800449848175,
0.20947544276714325,
-0.2946496903896332,
-0.31304094195365906,
-0.03537982702255249,
0.05562475696206093,
-0.16362905502319336,
0.2511020004749298,
-0.46240702271461487,
0.14574888348579407,
0.22974419593811035,
-0.025514401495456696,
-0.4540731608867645,
0.2232973277568817,
0.2540613114833832,
0.016472186893224716,
-0.20769661664962769,
0.05345691740512848,
0.1526237428188324,
-0.1369924396276474,
-0.20163996517658234,
-0.1757192611694336
] |
https://github.com/huggingface/datasets/issues/633 | Load large text file for LM pre-training resulting in OOM | It's happening to me again. After 4 hours of pre-training, my ram memory gets full and the kernel dies. I am using the last transformers version as today. 4.4.0 and the last version of datasets 1.2.1, both installed from master. The memory consumption keeps increasing. | I tried to pretrain Longformer using transformers and datasets. But I got OOM issues with loading a large text file. My script is almost like this:
```python
from datasets import load_dataset
@dataclass
class DataCollatorForDatasetsLanguageModeling(DataCollatorForLanguageModeling):
"""
Data collator used for language modeling based on DataCollatorForLazyLanguageModeling
- collates batches of tensors, honoring their tokenizer's pad_token
- preprocesses batches for masked language modeling
"""
block_size: int = 512
def __call__(self, examples: List[dict]) -> Dict[str, torch.Tensor]:
examples = [example['text'] for example in examples]
batch, attention_mask = self._tensorize_batch(examples)
if self.mlm:
inputs, labels = self.mask_tokens(batch)
return {"input_ids": inputs, "labels": labels}
else:
labels = batch.clone().detach()
if self.tokenizer.pad_token_id is not None:
labels[labels == self.tokenizer.pad_token_id] = -100
return {"input_ids": batch, "labels": labels}
def _tensorize_batch(self, examples: List[str]) -> Tuple[torch.Tensor, torch.Tensor]:
if self.tokenizer._pad_token is None:
raise ValueError(
"You are attempting to pad samples but the tokenizer you are using"
f" ({self.tokenizer.__class__.__name__}) does not have one."
)
tensor_examples = self.tokenizer.batch_encode_plus(
[ex for ex in examples if ex],
max_length=self.block_size,
return_tensors="pt",
pad_to_max_length=True,
return_attention_mask=True,
truncation=True,
)
input_ids, attention_mask = tensor_examples["input_ids"], tensor_examples["attention_mask"]
return input_ids, attention_mask
dataset = load_dataset('text', data_files='train.txt',cache_dir="./", , split='train')
data_collator = DataCollatorForDatasetsLanguageModeling(tokenizer=tokenizer, mlm=True,
mlm_probability=0.15, block_size=tokenizer.max_len)
trainer = Trainer(model=model, args=args, data_collator=data_collator,
train_dataset=train_dataset, prediction_loss_only=True, )
trainer.train(model_path=model_path)
```
This train.txt is about 1.1GB and has 90k lines where each line is a sequence of 4k words.
During training, the memory usage increased fast as the following graph and resulted in OOM before the finish of training.

Could you please give me any suggestions on why this happened and how to fix it?
Thanks. | 45 | Load large text file for LM pre-training resulting in OOM
I tried to pretrain Longformer using transformers and datasets. But I got OOM issues with loading a large text file. My script is almost like this:
```python
from datasets import load_dataset
@dataclass
class DataCollatorForDatasetsLanguageModeling(DataCollatorForLanguageModeling):
"""
Data collator used for language modeling based on DataCollatorForLazyLanguageModeling
- collates batches of tensors, honoring their tokenizer's pad_token
- preprocesses batches for masked language modeling
"""
block_size: int = 512
def __call__(self, examples: List[dict]) -> Dict[str, torch.Tensor]:
examples = [example['text'] for example in examples]
batch, attention_mask = self._tensorize_batch(examples)
if self.mlm:
inputs, labels = self.mask_tokens(batch)
return {"input_ids": inputs, "labels": labels}
else:
labels = batch.clone().detach()
if self.tokenizer.pad_token_id is not None:
labels[labels == self.tokenizer.pad_token_id] = -100
return {"input_ids": batch, "labels": labels}
def _tensorize_batch(self, examples: List[str]) -> Tuple[torch.Tensor, torch.Tensor]:
if self.tokenizer._pad_token is None:
raise ValueError(
"You are attempting to pad samples but the tokenizer you are using"
f" ({self.tokenizer.__class__.__name__}) does not have one."
)
tensor_examples = self.tokenizer.batch_encode_plus(
[ex for ex in examples if ex],
max_length=self.block_size,
return_tensors="pt",
pad_to_max_length=True,
return_attention_mask=True,
truncation=True,
)
input_ids, attention_mask = tensor_examples["input_ids"], tensor_examples["attention_mask"]
return input_ids, attention_mask
dataset = load_dataset('text', data_files='train.txt',cache_dir="./", , split='train')
data_collator = DataCollatorForDatasetsLanguageModeling(tokenizer=tokenizer, mlm=True,
mlm_probability=0.15, block_size=tokenizer.max_len)
trainer = Trainer(model=model, args=args, data_collator=data_collator,
train_dataset=train_dataset, prediction_loss_only=True, )
trainer.train(model_path=model_path)
```
This train.txt is about 1.1GB and has 90k lines where each line is a sequence of 4k words.
During training, the memory usage increased fast as the following graph and resulted in OOM before the finish of training.

Could you please give me any suggestions on why this happened and how to fix it?
Thanks.
It's happening to me again. After 4 hours of pre-training, my ram memory gets full and the kernel dies. I am using the last transformers version as today. 4.4.0 and the last version of datasets 1.2.1, both installed from master. The memory consumption keeps increasing. | [
-0.6339283585548401,
-0.47753778100013733,
0.010693363845348358,
0.29863524436950684,
0.36004769802093506,
-0.1518251597881317,
0.5567324757575989,
0.37380579113960266,
0.01088225468993187,
0.010719746351242065,
-0.1295929253101349,
-0.1828002780675888,
-0.26698487997055054,
-0.16208980977535248,
-0.03237204998731613,
0.023206885904073715,
-0.09982117265462875,
0.19687515497207642,
-0.2772675156593323,
-0.09666657447814941,
0.05701180547475815,
-0.07762926816940308,
-0.21276047825813293,
-0.029743991792201996,
-0.3879220187664032,
-0.06171319633722305,
0.3158179223537445,
0.12212134897708893,
-0.1640809327363968,
-0.0958080142736435,
-0.22970141470432281,
0.1197899580001831,
0.4393485188484192,
0.4340214729309082,
-0.00011477212683530524,
0.006616219878196716,
0.18904384970664978,
-0.23633266985416412,
-0.16726946830749512,
0.019216440618038177,
0.07755492627620697,
-0.3022913932800293,
-0.10640020668506622,
-0.3036171495914459,
-0.02724609524011612,
-0.10612530261278152,
-0.015682043507695198,
-0.22437302768230438,
0.4987519383430481,
0.5414043068885803,
0.15876251459121704,
0.25081300735473633,
-0.21366100013256073,
0.0723966509103775,
0.25443702936172485,
0.0488995760679245,
0.1056830957531929,
-0.27951449155807495,
0.46878406405448914,
-0.1923186331987381,
-0.47268855571746826,
0.1478176862001419,
-0.22477363049983978,
-0.20168264210224152,
-0.09508860856294632,
0.03820447996258736,
0.36608895659446716,
0.031569477170705795,
0.2641869783401489,
0.3474210202693939,
0.4272076189517975,
-0.0008120127022266388,
-0.289635568857193,
-0.3209858536720276,
-0.14262455701828003,
-0.08431586623191833,
0.18923655152320862,
0.2010769546031952,
0.059826578944921494,
0.11845916509628296,
0.10712733119726181,
-0.12533129751682281,
-0.15199026465415955,
0.07616106420755386,
-0.27480751276016235,
0.33979544043540955,
-0.20125117897987366,
-0.03804318606853485,
0.15557512640953064,
-0.09447921812534332,
0.19616937637329102,
-0.09977510571479797,
0.003403950482606888,
0.25671419501304626,
-0.245441272854805,
-0.11239507794380188,
-0.07168225198984146,
-0.5194145441055298,
0.16278403997421265,
-0.2759450674057007,
0.1981883943080902,
0.29723939299583435,
-0.08766181021928787,
-0.06761691719293594,
0.08639387786388397,
0.4202020466327667,
-0.25243741273880005,
0.26052793860435486,
0.22725635766983032,
0.16401110589504242,
-0.17170630395412445,
-0.04439859092235565,
-0.33051154017448425,
-0.19624567031860352,
0.10159362852573395,
-0.07734166085720062,
-0.011017010547220707,
-0.2546045482158661,
-0.24042175710201263,
0.05854658782482147,
-0.14076969027519226,
-0.03084544464945793,
0.2748163938522339,
0.38997286558151245,
-0.3540611267089844,
0.4294978082180023,
0.16510933637619019,
0.052328936755657196,
-0.4855332672595978,
-0.33652669191360474,
-0.17440199851989746,
0.15325728058815002,
-0.20324474573135376,
0.038975562900304794,
0.12979257106781006,
0.13963374495506287,
0.05965423583984375,
-0.04288341850042343,
-0.0625898689031601,
-0.44021931290626526,
-0.009444482624530792,
-0.024103429168462753,
0.020752981305122375,
-0.04251480475068092,
0.06302379071712494,
-0.02336559072136879,
0.23476582765579224,
-0.12499457597732544,
-0.025381658226251602,
0.3477915823459625,
-0.2762118875980377,
-0.2276410162448883,
0.05097950994968414,
0.21017630398273468,
-0.02824842929840088,
0.20915503799915314,
0.028506658971309662,
0.07685685157775879,
0.5359783172607422,
0.006653331220149994,
-0.04714777320623398,
-0.3782060742378235,
0.09452182054519653,
0.09201760590076447,
0.1619914025068283,
0.17663070559501648,
-0.042587969452142715,
-0.07260239124298096,
0.0063892244361341,
0.10358665883541107,
0.25504034757614136,
0.3907330334186554,
-0.22647030651569366,
0.2906738817691803,
0.007004471495747566,
-0.05665605142712593,
0.5319919586181641,
-0.2620989978313446,
-0.448444128036499,
0.23385274410247803,
-0.3511556386947632,
0.10818185657262802,
0.22066983580589294,
0.1759030818939209,
0.11388914287090302,
-0.1089852899312973,
0.26901498436927795,
0.3656851649284363,
0.07051589339971542,
0.1209140196442604,
-0.23662437498569489,
-0.09222844988107681,
-0.1715157926082611,
0.48420286178588867,
0.36272403597831726,
-0.02558579295873642,
-0.07308889180421829,
0.35637998580932617,
0.18339842557907104,
-0.1992236077785492,
0.13128061592578888,
0.36934155225753784,
-0.17442509531974792,
-0.1261582374572754,
0.0944812074303627,
0.06559769064188004,
-0.3000325560569763,
-0.07098697125911713,
-0.09084425866603851,
0.0828668475151062,
-0.1136055737733841,
-0.08942607045173645,
0.28255847096443176,
0.02287023328244686,
-0.0766652524471283,
0.11318020522594452,
0.03794129937887192,
-0.13182224333286285,
0.024866361171007156,
-0.07041719555854797,
0.1261971890926361,
0.015421975404024124,
-0.09320687502622604,
0.08736041188240051,
-0.2184159904718399,
-0.12394054979085922,
0.0018030330538749695,
-0.137061208486557,
0.07695000618696213,
0.17527323961257935,
-0.05118799954652786,
0.03840121626853943,
-0.17304009199142456,
0.10695729404687881,
-0.15297769010066986,
-0.2987070679664612,
-0.5071570873260498,
0.43589335680007935,
0.18647874891757965,
-0.33810955286026,
0.3402597904205322,
0.1040273904800415,
-0.029599443078041077,
-0.10627070814371109,
-0.11989574879407883,
0.5749332904815674,
0.27307116985321045,
0.019617579877376556,
0.29909294843673706,
-0.24541117250919342,
0.2542804777622223,
-0.2662392258644104,
-0.10361561179161072,
-0.09776493161916733,
0.4209232032299042,
0.03105533868074417,
0.23506294190883636,
0.14828065037727356,
-0.08694546669721603,
-0.232059508562088,
0.47038108110427856,
-0.1788094937801361,
-0.013872608542442322,
0.26652613282203674,
-0.4247211217880249,
-0.011563490144908428,
-0.34802117943763733,
-0.24947787821292877,
0.0067334845662117004,
0.17322899401187897,
-0.09441326558589935,
-0.055435195565223694,
0.008537785150110722,
-0.26279330253601074,
0.007836148142814636,
0.1532370001077652,
-0.0718524307012558,
0.31983456015586853,
0.11651500314474106,
0.10059522092342377,
-0.122891865670681,
-0.1794070154428482,
0.10284756124019623,
0.17828989028930664,
-0.27519121766090393,
0.18444325029850006,
-0.02282267063856125,
-0.013446485623717308,
-0.2862633764743805,
0.1904245764017105,
-0.12680108845233917,
0.0388152077794075,
-0.0647432953119278,
0.25868889689445496,
-0.07790280133485794,
0.10191172361373901,
0.3001607060432434,
0.3549228012561798,
0.4629628658294678,
-0.07809486240148544,
0.326348215341568,
-0.08266382664442062,
-0.1796954870223999,
0.032943595200777054,
0.33450770378112793,
-0.3179926872253418,
-0.024890778586268425,
0.005377540364861488,
0.05117718130350113,
-0.09892972558736801,
-0.16603437066078186,
0.09468895941972733,
0.196824312210083,
-0.16618932783603668,
-0.2573060691356659,
-0.07217618823051453,
0.17769087851047516,
-0.042431723326444626,
0.11972848325967789,
-0.23244111239910126,
0.008407561108469963,
0.1450573354959488,
-0.006289597600698471,
-0.18432363867759705,
0.04044550284743309,
-0.1199219599366188,
-0.04705164581537247,
-0.411641389131546,
-0.05351852625608444,
0.10705065727233887,
0.13673138618469238,
0.35936760902404785,
0.10678976029157639,
0.19445137679576874,
0.28844478726387024,
0.15859206020832062,
0.006367621943354607,
-0.0885988399386406,
0.5141718983650208,
-0.017572684213519096,
-0.29719802737236023,
-0.2908625900745392,
-0.23975418508052826,
0.02511288784444332,
0.3155249357223511,
-0.684260904788971,
0.23378321528434753,
-0.1138516515493393,
-0.09402675926685333,
-0.3955192267894745,
0.0007258430123329163,
0.2522047758102417,
-0.07614870369434357,
0.016339777037501335,
0.09547417610883713,
0.2302767038345337,
0.1546790897846222,
-0.03878729045391083,
0.38579460978507996,
-0.4130840301513672,
0.35940811038017273,
-0.13545823097229004,
0.4855530261993408,
-0.122118279337883,
-0.2300206571817398,
0.09887474775314331,
0.15044830739498138,
-0.01711525395512581,
-0.021802209317684174,
-0.013968504965305328,
-0.25937944650650024,
-0.058237224817276,
0.0227312333881855,
0.5197213292121887,
0.01689060777425766,
-0.16558955609798431,
-0.015898926183581352,
0.06816425919532776,
0.2563197910785675,
-0.26069891452789307,
0.49052777886390686,
-0.19077889621257782,
0.01841624826192856,
-0.19967399537563324,
0.01874571293592453,
-0.20498108863830566,
-0.21508586406707764,
-0.164134681224823,
0.09344439208507538,
-0.03038274496793747,
-0.22404396533966064,
-0.2116939276456833,
0.10314016044139862,
-0.3681343197822571,
-0.0437651127576828,
0.11799006909132004,
0.22933240234851837,
0.18077029287815094,
-0.19614383578300476,
-0.08628876507282257,
-0.20187069475650787,
0.35741427540779114,
0.1934524029493332,
0.11246532201766968,
0.16325931251049042,
-0.05687852203845978,
-0.2155371457338333,
-0.17745190858840942,
-0.29045435786247253,
0.14190825819969177,
0.6505106687545776,
0.6102464199066162,
-0.21627351641654968,
-0.15859898924827576,
0.07914479076862335,
0.002603483386337757,
-0.16527341306209564,
-0.548757016658783,
-0.12850907444953918,
-0.16549962759017944,
-0.44105130434036255,
0.004606112837791443,
0.35849836468696594,
0.3558535575866699,
-0.2264459729194641,
-0.03187551349401474,
0.13872987031936646,
-0.0007013268768787384,
0.37175118923187256,
-0.12976384162902832,
0.015054157003760338,
-0.06641082465648651,
0.225828617811203,
-0.10741686820983887,
0.36735567450523376,
0.24888965487480164,
0.35636386275291443,
0.1917259395122528,
-0.31755685806274414,
0.0706881731748581,
-0.029888737946748734,
0.23143038153648376,
0.11516103148460388,
0.11022848635911942,
0.3546280860900879,
0.1289711445569992,
0.3322555422782898,
-0.19096627831459045,
0.6737229228019714,
-0.007344553247094154,
0.20682765543460846,
-0.8374910354614258,
-0.26737040281295776,
0.33145615458488464,
-0.02635771967470646,
0.19940276443958282,
0.215718075633049,
-0.40385204553604126,
-0.3216697573661804,
0.376661479473114,
0.09908346086740494,
0.7675239443778992,
-0.2972695827484131,
0.39625850319862366,
-0.1552990972995758,
0.6611965894699097,
0.12803049385547638,
-0.3813104033470154,
0.1585618406534195,
-0.39879149198532104,
-0.2663658857345581,
0.21300511062145233,
-0.09231188893318176,
0.036539800465106964,
0.16050389409065247,
-0.2905767560005188,
-0.029811730608344078,
0.0862521380186081,
0.2249334454536438,
0.13066981732845306,
0.5134936571121216,
0.12092680484056473,
-0.6006978154182434,
-0.08281297981739044,
0.02656909078359604,
-0.02340024709701538,
-0.10490188002586365,
-0.0492798313498497,
0.07994647324085236,
-0.0313267819583416,
-0.20856402814388275,
-0.028466172516345978,
0.20525774359703064,
-0.2474464625120163,
0.08661594241857529,
0.06375248730182648,
-0.07205313444137573,
0.5367995500564575,
0.10623051226139069,
-0.001361064612865448,
0.4988958239555359,
-0.039286620914936066,
0.13215835392475128,
-0.2274819314479828,
-0.1652863323688507,
0.20070844888687134,
-0.06584891676902771,
0.4217033088207245,
0.08837933093309402,
-0.0005880966782569885,
0.11410333216190338,
0.0632382407784462,
-0.046690933406353,
0.09476359188556671,
-0.36430907249450684,
0.10549724102020264,
-0.41123154759407043,
-0.21542777121067047,
-0.08843062818050385,
-0.30078285932540894,
-0.1009221225976944,
0.12310943007469177,
0.13735687732696533,
-0.46444618701934814,
0.11514545977115631,
0.2652113139629364,
-0.3750092685222626,
0.011997109279036522,
0.38382449746131897,
0.17105859518051147,
-0.10513918846845627,
0.49984270334243774,
0.4575878381729126,
-0.053361937403678894,
-0.2644973695278168,
-0.10962903499603271,
0.29444822669029236,
-0.2731435000896454,
0.0849163606762886,
-0.2455592304468155,
-0.3016006648540497,
0.209351047873497,
0.08087542653083801,
0.10009974241256714,
-0.01499941200017929,
-0.06326231360435486,
-0.25102943181991577,
-0.6380501389503479,
-0.18144388496875763,
-0.0027230940759181976,
-0.00354844331741333,
0.1460832953453064,
0.27389806509017944,
-0.3100467920303345,
0.5892773270606995,
-0.2788558602333069,
-0.05294197052717209,
-0.20760811865329742,
0.2782232165336609,
-0.055562183260917664,
-0.38554659485816956,
0.21153579652309418,
0.2033519148826599,
0.1001039668917656,
0.08059665560722351,
0.00590919703245163,
-0.22135356068611145,
-0.14351996779441833,
0.11271549016237259,
0.23647010326385498,
-0.41966331005096436,
-0.01599399372935295,
-0.312997043132782,
-0.09248970448970795,
-0.27002182602882385,
0.06606784462928772,
0.017028577625751495,
0.01394578069448471,
-0.22617922723293304,
0.009393874555826187,
0.04752609133720398,
-0.2552624046802521,
0.04206028953194618,
-0.25458529591560364,
0.12509100139141083,
0.2465714067220688,
0.1331031173467636,
0.11783083528280258,
0.0006371289491653442,
-0.3931019604206085,
0.17964592576026917,
0.6661380529403687,
-0.017532095313072205,
0.4190823435783386,
-0.43573224544525146,
-0.0715063214302063,
0.24765951931476593,
0.04980342835187912,
0.048066146671772,
-0.34167730808258057,
-0.010718589648604393,
0.2935883700847626,
0.22681888937950134,
0.015208568423986435,
-0.014733202755451202,
0.22635462880134583,
-0.41129830479621887,
0.1301487535238266,
0.3453426659107208,
-0.11192676424980164,
-0.06747587025165558,
0.1559651792049408,
0.09132310748100281,
0.5066777467727661,
0.11496534198522568,
0.005711604841053486,
0.24894991517066956,
-0.00122002512216568,
0.15485714375972748,
0.48569241166114807,
0.261119544506073,
0.23868051171302795,
0.3016282618045807,
-0.032666049897670746,
-0.04069993644952774,
-0.2312840223312378,
0.2294139564037323,
-0.435617059469223,
-0.41516661643981934,
-0.2674567401409149,
0.5044151544570923,
-0.01932355761528015,
0.12420932948589325,
-0.3350299298763275,
-0.06624119728803635,
-0.04065354913473129,
0.2541331350803375,
-0.11921557784080505,
0.2744082510471344,
-0.45309436321258545,
-0.17059893906116486,
-0.08942428231239319,
-0.12396197021007538,
0.011534325778484344,
0.18963316082954407,
-0.0558583103120327,
0.27227628231048584,
-0.5796654224395752,
0.22938616573810577,
0.05213649570941925,
0.1451501101255417,
-0.1346784234046936,
0.1227787584066391,
0.10550137609243393,
-0.5078572034835815,
0.34333521127700806,
0.23785626888275146,
0.29185950756073,
0.11540549993515015,
-0.22190696001052856,
0.34437036514282227,
0.43669766187667847,
-0.1908072531223297,
-0.04061196744441986,
-0.12098392844200134,
-0.03561992570757866,
-0.1499127894639969,
0.19743536412715912,
0.3490368723869324,
0.18789905309677124,
0.2596159875392914,
0.0557275116443634,
-0.26596614718437195,
0.27851778268814087,
0.06501396000385284,
-0.3240588903427124,
0.17866621911525726,
-0.13293880224227905,
0.4019324481487274,
-0.32858094573020935,
-0.4429645836353302,
0.00986664742231369,
-0.39412444829940796,
0.21558675169944763,
0.6670199036598206,
-0.2954224944114685,
0.28785526752471924,
-0.02548792213201523,
0.04855022579431534,
0.0018409136682748795,
0.47605016827583313,
0.46973514556884766,
0.2841596007347107,
-0.37837129831314087,
-0.025667212903499603,
-0.32888373732566833,
0.2765583097934723,
-0.2024305909872055,
0.06699749082326889,
0.022247930988669395,
0.17079433798789978,
0.16457822918891907,
-0.003302011638879776,
-0.07962261140346527,
-0.013621993362903595,
0.21880324184894562,
-0.19506913423538208,
-0.1675596684217453,
-0.12804758548736572,
0.0020943284034729004,
0.3573179543018341,
-0.025900525972247124,
-0.29754993319511414,
0.15886540710926056,
0.11506294459104538,
0.0991566851735115,
-0.3214535713195801,
0.3626996874809265,
-0.19846373796463013,
-0.02036242187023163,
0.0691281408071518,
-0.15047122538089752,
0.37920957803726196,
-0.22043859958648682,
-0.03304758667945862,
-0.08182770013809204,
0.12814156711101532,
-0.16707712411880493,
-0.22100013494491577,
0.3402222692966461,
0.38842451572418213,
-0.10763649642467499,
0.10821394622325897,
-0.25519275665283203,
-0.08646275848150253,
0.040304481983184814,
-0.36969074606895447,
-0.3087161183357239,
-0.0074881562031805515,
-0.0002531483769416809,
0.008524507284164429,
0.10309776663780212,
0.24583062529563904,
0.10533731430768967,
-0.027840254828333855,
-0.22922900319099426,
-0.1855800449848175,
0.20947544276714325,
-0.2946496903896332,
-0.31304094195365906,
-0.03537982702255249,
0.05562475696206093,
-0.16362905502319336,
0.2511020004749298,
-0.46240702271461487,
0.14574888348579407,
0.22974419593811035,
-0.025514401495456696,
-0.4540731608867645,
0.2232973277568817,
0.2540613114833832,
0.016472186893224716,
-0.20769661664962769,
0.05345691740512848,
0.1526237428188324,
-0.1369924396276474,
-0.20163996517658234,
-0.1757192611694336
] |
https://github.com/huggingface/datasets/issues/633 | Load large text file for LM pre-training resulting in OOM | Thanks for the investigation @gaceladri
Apparently this happens when `num_workers>0` and has to do with objects being copied-on-write.
Did you try setting num_workers to 0 @gaceladri ?
If the issue doesn't happen with `num_workers=0` then this would confirm that it's indeed related to this python/pytorch issue.
Since a `Dataset` object is a wrapper of a pyarrow Table, we should investigate if the data being copied comes from the Table itself or from metadata in the `Dataset` object. If it comes from the metadata in the `Dataset` object, we should be able to implement a workaround. But if it comes from the Table, we'll need to see with the pyarrow team what we can do... | I tried to pretrain Longformer using transformers and datasets. But I got OOM issues with loading a large text file. My script is almost like this:
```python
from datasets import load_dataset
@dataclass
class DataCollatorForDatasetsLanguageModeling(DataCollatorForLanguageModeling):
"""
Data collator used for language modeling based on DataCollatorForLazyLanguageModeling
- collates batches of tensors, honoring their tokenizer's pad_token
- preprocesses batches for masked language modeling
"""
block_size: int = 512
def __call__(self, examples: List[dict]) -> Dict[str, torch.Tensor]:
examples = [example['text'] for example in examples]
batch, attention_mask = self._tensorize_batch(examples)
if self.mlm:
inputs, labels = self.mask_tokens(batch)
return {"input_ids": inputs, "labels": labels}
else:
labels = batch.clone().detach()
if self.tokenizer.pad_token_id is not None:
labels[labels == self.tokenizer.pad_token_id] = -100
return {"input_ids": batch, "labels": labels}
def _tensorize_batch(self, examples: List[str]) -> Tuple[torch.Tensor, torch.Tensor]:
if self.tokenizer._pad_token is None:
raise ValueError(
"You are attempting to pad samples but the tokenizer you are using"
f" ({self.tokenizer.__class__.__name__}) does not have one."
)
tensor_examples = self.tokenizer.batch_encode_plus(
[ex for ex in examples if ex],
max_length=self.block_size,
return_tensors="pt",
pad_to_max_length=True,
return_attention_mask=True,
truncation=True,
)
input_ids, attention_mask = tensor_examples["input_ids"], tensor_examples["attention_mask"]
return input_ids, attention_mask
dataset = load_dataset('text', data_files='train.txt',cache_dir="./", , split='train')
data_collator = DataCollatorForDatasetsLanguageModeling(tokenizer=tokenizer, mlm=True,
mlm_probability=0.15, block_size=tokenizer.max_len)
trainer = Trainer(model=model, args=args, data_collator=data_collator,
train_dataset=train_dataset, prediction_loss_only=True, )
trainer.train(model_path=model_path)
```
This train.txt is about 1.1GB and has 90k lines where each line is a sequence of 4k words.
During training, the memory usage increased fast as the following graph and resulted in OOM before the finish of training.

Could you please give me any suggestions on why this happened and how to fix it?
Thanks. | 114 | Load large text file for LM pre-training resulting in OOM
I tried to pretrain Longformer using transformers and datasets. But I got OOM issues with loading a large text file. My script is almost like this:
```python
from datasets import load_dataset
@dataclass
class DataCollatorForDatasetsLanguageModeling(DataCollatorForLanguageModeling):
"""
Data collator used for language modeling based on DataCollatorForLazyLanguageModeling
- collates batches of tensors, honoring their tokenizer's pad_token
- preprocesses batches for masked language modeling
"""
block_size: int = 512
def __call__(self, examples: List[dict]) -> Dict[str, torch.Tensor]:
examples = [example['text'] for example in examples]
batch, attention_mask = self._tensorize_batch(examples)
if self.mlm:
inputs, labels = self.mask_tokens(batch)
return {"input_ids": inputs, "labels": labels}
else:
labels = batch.clone().detach()
if self.tokenizer.pad_token_id is not None:
labels[labels == self.tokenizer.pad_token_id] = -100
return {"input_ids": batch, "labels": labels}
def _tensorize_batch(self, examples: List[str]) -> Tuple[torch.Tensor, torch.Tensor]:
if self.tokenizer._pad_token is None:
raise ValueError(
"You are attempting to pad samples but the tokenizer you are using"
f" ({self.tokenizer.__class__.__name__}) does not have one."
)
tensor_examples = self.tokenizer.batch_encode_plus(
[ex for ex in examples if ex],
max_length=self.block_size,
return_tensors="pt",
pad_to_max_length=True,
return_attention_mask=True,
truncation=True,
)
input_ids, attention_mask = tensor_examples["input_ids"], tensor_examples["attention_mask"]
return input_ids, attention_mask
dataset = load_dataset('text', data_files='train.txt',cache_dir="./", , split='train')
data_collator = DataCollatorForDatasetsLanguageModeling(tokenizer=tokenizer, mlm=True,
mlm_probability=0.15, block_size=tokenizer.max_len)
trainer = Trainer(model=model, args=args, data_collator=data_collator,
train_dataset=train_dataset, prediction_loss_only=True, )
trainer.train(model_path=model_path)
```
This train.txt is about 1.1GB and has 90k lines where each line is a sequence of 4k words.
During training, the memory usage increased fast as the following graph and resulted in OOM before the finish of training.

Could you please give me any suggestions on why this happened and how to fix it?
Thanks.
Thanks for the investigation @gaceladri
Apparently this happens when `num_workers>0` and has to do with objects being copied-on-write.
Did you try setting num_workers to 0 @gaceladri ?
If the issue doesn't happen with `num_workers=0` then this would confirm that it's indeed related to this python/pytorch issue.
Since a `Dataset` object is a wrapper of a pyarrow Table, we should investigate if the data being copied comes from the Table itself or from metadata in the `Dataset` object. If it comes from the metadata in the `Dataset` object, we should be able to implement a workaround. But if it comes from the Table, we'll need to see with the pyarrow team what we can do... | [
-0.6339283585548401,
-0.47753778100013733,
0.010693363845348358,
0.29863524436950684,
0.36004769802093506,
-0.1518251597881317,
0.5567324757575989,
0.37380579113960266,
0.01088225468993187,
0.010719746351242065,
-0.1295929253101349,
-0.1828002780675888,
-0.26698487997055054,
-0.16208980977535248,
-0.03237204998731613,
0.023206885904073715,
-0.09982117265462875,
0.19687515497207642,
-0.2772675156593323,
-0.09666657447814941,
0.05701180547475815,
-0.07762926816940308,
-0.21276047825813293,
-0.029743991792201996,
-0.3879220187664032,
-0.06171319633722305,
0.3158179223537445,
0.12212134897708893,
-0.1640809327363968,
-0.0958080142736435,
-0.22970141470432281,
0.1197899580001831,
0.4393485188484192,
0.4340214729309082,
-0.00011477212683530524,
0.006616219878196716,
0.18904384970664978,
-0.23633266985416412,
-0.16726946830749512,
0.019216440618038177,
0.07755492627620697,
-0.3022913932800293,
-0.10640020668506622,
-0.3036171495914459,
-0.02724609524011612,
-0.10612530261278152,
-0.015682043507695198,
-0.22437302768230438,
0.4987519383430481,
0.5414043068885803,
0.15876251459121704,
0.25081300735473633,
-0.21366100013256073,
0.0723966509103775,
0.25443702936172485,
0.0488995760679245,
0.1056830957531929,
-0.27951449155807495,
0.46878406405448914,
-0.1923186331987381,
-0.47268855571746826,
0.1478176862001419,
-0.22477363049983978,
-0.20168264210224152,
-0.09508860856294632,
0.03820447996258736,
0.36608895659446716,
0.031569477170705795,
0.2641869783401489,
0.3474210202693939,
0.4272076189517975,
-0.0008120127022266388,
-0.289635568857193,
-0.3209858536720276,
-0.14262455701828003,
-0.08431586623191833,
0.18923655152320862,
0.2010769546031952,
0.059826578944921494,
0.11845916509628296,
0.10712733119726181,
-0.12533129751682281,
-0.15199026465415955,
0.07616106420755386,
-0.27480751276016235,
0.33979544043540955,
-0.20125117897987366,
-0.03804318606853485,
0.15557512640953064,
-0.09447921812534332,
0.19616937637329102,
-0.09977510571479797,
0.003403950482606888,
0.25671419501304626,
-0.245441272854805,
-0.11239507794380188,
-0.07168225198984146,
-0.5194145441055298,
0.16278403997421265,
-0.2759450674057007,
0.1981883943080902,
0.29723939299583435,
-0.08766181021928787,
-0.06761691719293594,
0.08639387786388397,
0.4202020466327667,
-0.25243741273880005,
0.26052793860435486,
0.22725635766983032,
0.16401110589504242,
-0.17170630395412445,
-0.04439859092235565,
-0.33051154017448425,
-0.19624567031860352,
0.10159362852573395,
-0.07734166085720062,
-0.011017010547220707,
-0.2546045482158661,
-0.24042175710201263,
0.05854658782482147,
-0.14076969027519226,
-0.03084544464945793,
0.2748163938522339,
0.38997286558151245,
-0.3540611267089844,
0.4294978082180023,
0.16510933637619019,
0.052328936755657196,
-0.4855332672595978,
-0.33652669191360474,
-0.17440199851989746,
0.15325728058815002,
-0.20324474573135376,
0.038975562900304794,
0.12979257106781006,
0.13963374495506287,
0.05965423583984375,
-0.04288341850042343,
-0.0625898689031601,
-0.44021931290626526,
-0.009444482624530792,
-0.024103429168462753,
0.020752981305122375,
-0.04251480475068092,
0.06302379071712494,
-0.02336559072136879,
0.23476582765579224,
-0.12499457597732544,
-0.025381658226251602,
0.3477915823459625,
-0.2762118875980377,
-0.2276410162448883,
0.05097950994968414,
0.21017630398273468,
-0.02824842929840088,
0.20915503799915314,
0.028506658971309662,
0.07685685157775879,
0.5359783172607422,
0.006653331220149994,
-0.04714777320623398,
-0.3782060742378235,
0.09452182054519653,
0.09201760590076447,
0.1619914025068283,
0.17663070559501648,
-0.042587969452142715,
-0.07260239124298096,
0.0063892244361341,
0.10358665883541107,
0.25504034757614136,
0.3907330334186554,
-0.22647030651569366,
0.2906738817691803,
0.007004471495747566,
-0.05665605142712593,
0.5319919586181641,
-0.2620989978313446,
-0.448444128036499,
0.23385274410247803,
-0.3511556386947632,
0.10818185657262802,
0.22066983580589294,
0.1759030818939209,
0.11388914287090302,
-0.1089852899312973,
0.26901498436927795,
0.3656851649284363,
0.07051589339971542,
0.1209140196442604,
-0.23662437498569489,
-0.09222844988107681,
-0.1715157926082611,
0.48420286178588867,
0.36272403597831726,
-0.02558579295873642,
-0.07308889180421829,
0.35637998580932617,
0.18339842557907104,
-0.1992236077785492,
0.13128061592578888,
0.36934155225753784,
-0.17442509531974792,
-0.1261582374572754,
0.0944812074303627,
0.06559769064188004,
-0.3000325560569763,
-0.07098697125911713,
-0.09084425866603851,
0.0828668475151062,
-0.1136055737733841,
-0.08942607045173645,
0.28255847096443176,
0.02287023328244686,
-0.0766652524471283,
0.11318020522594452,
0.03794129937887192,
-0.13182224333286285,
0.024866361171007156,
-0.07041719555854797,
0.1261971890926361,
0.015421975404024124,
-0.09320687502622604,
0.08736041188240051,
-0.2184159904718399,
-0.12394054979085922,
0.0018030330538749695,
-0.137061208486557,
0.07695000618696213,
0.17527323961257935,
-0.05118799954652786,
0.03840121626853943,
-0.17304009199142456,
0.10695729404687881,
-0.15297769010066986,
-0.2987070679664612,
-0.5071570873260498,
0.43589335680007935,
0.18647874891757965,
-0.33810955286026,
0.3402597904205322,
0.1040273904800415,
-0.029599443078041077,
-0.10627070814371109,
-0.11989574879407883,
0.5749332904815674,
0.27307116985321045,
0.019617579877376556,
0.29909294843673706,
-0.24541117250919342,
0.2542804777622223,
-0.2662392258644104,
-0.10361561179161072,
-0.09776493161916733,
0.4209232032299042,
0.03105533868074417,
0.23506294190883636,
0.14828065037727356,
-0.08694546669721603,
-0.232059508562088,
0.47038108110427856,
-0.1788094937801361,
-0.013872608542442322,
0.26652613282203674,
-0.4247211217880249,
-0.011563490144908428,
-0.34802117943763733,
-0.24947787821292877,
0.0067334845662117004,
0.17322899401187897,
-0.09441326558589935,
-0.055435195565223694,
0.008537785150110722,
-0.26279330253601074,
0.007836148142814636,
0.1532370001077652,
-0.0718524307012558,
0.31983456015586853,
0.11651500314474106,
0.10059522092342377,
-0.122891865670681,
-0.1794070154428482,
0.10284756124019623,
0.17828989028930664,
-0.27519121766090393,
0.18444325029850006,
-0.02282267063856125,
-0.013446485623717308,
-0.2862633764743805,
0.1904245764017105,
-0.12680108845233917,
0.0388152077794075,
-0.0647432953119278,
0.25868889689445496,
-0.07790280133485794,
0.10191172361373901,
0.3001607060432434,
0.3549228012561798,
0.4629628658294678,
-0.07809486240148544,
0.326348215341568,
-0.08266382664442062,
-0.1796954870223999,
0.032943595200777054,
0.33450770378112793,
-0.3179926872253418,
-0.024890778586268425,
0.005377540364861488,
0.05117718130350113,
-0.09892972558736801,
-0.16603437066078186,
0.09468895941972733,
0.196824312210083,
-0.16618932783603668,
-0.2573060691356659,
-0.07217618823051453,
0.17769087851047516,
-0.042431723326444626,
0.11972848325967789,
-0.23244111239910126,
0.008407561108469963,
0.1450573354959488,
-0.006289597600698471,
-0.18432363867759705,
0.04044550284743309,
-0.1199219599366188,
-0.04705164581537247,
-0.411641389131546,
-0.05351852625608444,
0.10705065727233887,
0.13673138618469238,
0.35936760902404785,
0.10678976029157639,
0.19445137679576874,
0.28844478726387024,
0.15859206020832062,
0.006367621943354607,
-0.0885988399386406,
0.5141718983650208,
-0.017572684213519096,
-0.29719802737236023,
-0.2908625900745392,
-0.23975418508052826,
0.02511288784444332,
0.3155249357223511,
-0.684260904788971,
0.23378321528434753,
-0.1138516515493393,
-0.09402675926685333,
-0.3955192267894745,
0.0007258430123329163,
0.2522047758102417,
-0.07614870369434357,
0.016339777037501335,
0.09547417610883713,
0.2302767038345337,
0.1546790897846222,
-0.03878729045391083,
0.38579460978507996,
-0.4130840301513672,
0.35940811038017273,
-0.13545823097229004,
0.4855530261993408,
-0.122118279337883,
-0.2300206571817398,
0.09887474775314331,
0.15044830739498138,
-0.01711525395512581,
-0.021802209317684174,
-0.013968504965305328,
-0.25937944650650024,
-0.058237224817276,
0.0227312333881855,
0.5197213292121887,
0.01689060777425766,
-0.16558955609798431,
-0.015898926183581352,
0.06816425919532776,
0.2563197910785675,
-0.26069891452789307,
0.49052777886390686,
-0.19077889621257782,
0.01841624826192856,
-0.19967399537563324,
0.01874571293592453,
-0.20498108863830566,
-0.21508586406707764,
-0.164134681224823,
0.09344439208507538,
-0.03038274496793747,
-0.22404396533966064,
-0.2116939276456833,
0.10314016044139862,
-0.3681343197822571,
-0.0437651127576828,
0.11799006909132004,
0.22933240234851837,
0.18077029287815094,
-0.19614383578300476,
-0.08628876507282257,
-0.20187069475650787,
0.35741427540779114,
0.1934524029493332,
0.11246532201766968,
0.16325931251049042,
-0.05687852203845978,
-0.2155371457338333,
-0.17745190858840942,
-0.29045435786247253,
0.14190825819969177,
0.6505106687545776,
0.6102464199066162,
-0.21627351641654968,
-0.15859898924827576,
0.07914479076862335,
0.002603483386337757,
-0.16527341306209564,
-0.548757016658783,
-0.12850907444953918,
-0.16549962759017944,
-0.44105130434036255,
0.004606112837791443,
0.35849836468696594,
0.3558535575866699,
-0.2264459729194641,
-0.03187551349401474,
0.13872987031936646,
-0.0007013268768787384,
0.37175118923187256,
-0.12976384162902832,
0.015054157003760338,
-0.06641082465648651,
0.225828617811203,
-0.10741686820983887,
0.36735567450523376,
0.24888965487480164,
0.35636386275291443,
0.1917259395122528,
-0.31755685806274414,
0.0706881731748581,
-0.029888737946748734,
0.23143038153648376,
0.11516103148460388,
0.11022848635911942,
0.3546280860900879,
0.1289711445569992,
0.3322555422782898,
-0.19096627831459045,
0.6737229228019714,
-0.007344553247094154,
0.20682765543460846,
-0.8374910354614258,
-0.26737040281295776,
0.33145615458488464,
-0.02635771967470646,
0.19940276443958282,
0.215718075633049,
-0.40385204553604126,
-0.3216697573661804,
0.376661479473114,
0.09908346086740494,
0.7675239443778992,
-0.2972695827484131,
0.39625850319862366,
-0.1552990972995758,
0.6611965894699097,
0.12803049385547638,
-0.3813104033470154,
0.1585618406534195,
-0.39879149198532104,
-0.2663658857345581,
0.21300511062145233,
-0.09231188893318176,
0.036539800465106964,
0.16050389409065247,
-0.2905767560005188,
-0.029811730608344078,
0.0862521380186081,
0.2249334454536438,
0.13066981732845306,
0.5134936571121216,
0.12092680484056473,
-0.6006978154182434,
-0.08281297981739044,
0.02656909078359604,
-0.02340024709701538,
-0.10490188002586365,
-0.0492798313498497,
0.07994647324085236,
-0.0313267819583416,
-0.20856402814388275,
-0.028466172516345978,
0.20525774359703064,
-0.2474464625120163,
0.08661594241857529,
0.06375248730182648,
-0.07205313444137573,
0.5367995500564575,
0.10623051226139069,
-0.001361064612865448,
0.4988958239555359,
-0.039286620914936066,
0.13215835392475128,
-0.2274819314479828,
-0.1652863323688507,
0.20070844888687134,
-0.06584891676902771,
0.4217033088207245,
0.08837933093309402,
-0.0005880966782569885,
0.11410333216190338,
0.0632382407784462,
-0.046690933406353,
0.09476359188556671,
-0.36430907249450684,
0.10549724102020264,
-0.41123154759407043,
-0.21542777121067047,
-0.08843062818050385,
-0.30078285932540894,
-0.1009221225976944,
0.12310943007469177,
0.13735687732696533,
-0.46444618701934814,
0.11514545977115631,
0.2652113139629364,
-0.3750092685222626,
0.011997109279036522,
0.38382449746131897,
0.17105859518051147,
-0.10513918846845627,
0.49984270334243774,
0.4575878381729126,
-0.053361937403678894,
-0.2644973695278168,
-0.10962903499603271,
0.29444822669029236,
-0.2731435000896454,
0.0849163606762886,
-0.2455592304468155,
-0.3016006648540497,
0.209351047873497,
0.08087542653083801,
0.10009974241256714,
-0.01499941200017929,
-0.06326231360435486,
-0.25102943181991577,
-0.6380501389503479,
-0.18144388496875763,
-0.0027230940759181976,
-0.00354844331741333,
0.1460832953453064,
0.27389806509017944,
-0.3100467920303345,
0.5892773270606995,
-0.2788558602333069,
-0.05294197052717209,
-0.20760811865329742,
0.2782232165336609,
-0.055562183260917664,
-0.38554659485816956,
0.21153579652309418,
0.2033519148826599,
0.1001039668917656,
0.08059665560722351,
0.00590919703245163,
-0.22135356068611145,
-0.14351996779441833,
0.11271549016237259,
0.23647010326385498,
-0.41966331005096436,
-0.01599399372935295,
-0.312997043132782,
-0.09248970448970795,
-0.27002182602882385,
0.06606784462928772,
0.017028577625751495,
0.01394578069448471,
-0.22617922723293304,
0.009393874555826187,
0.04752609133720398,
-0.2552624046802521,
0.04206028953194618,
-0.25458529591560364,
0.12509100139141083,
0.2465714067220688,
0.1331031173467636,
0.11783083528280258,
0.0006371289491653442,
-0.3931019604206085,
0.17964592576026917,
0.6661380529403687,
-0.017532095313072205,
0.4190823435783386,
-0.43573224544525146,
-0.0715063214302063,
0.24765951931476593,
0.04980342835187912,
0.048066146671772,
-0.34167730808258057,
-0.010718589648604393,
0.2935883700847626,
0.22681888937950134,
0.015208568423986435,
-0.014733202755451202,
0.22635462880134583,
-0.41129830479621887,
0.1301487535238266,
0.3453426659107208,
-0.11192676424980164,
-0.06747587025165558,
0.1559651792049408,
0.09132310748100281,
0.5066777467727661,
0.11496534198522568,
0.005711604841053486,
0.24894991517066956,
-0.00122002512216568,
0.15485714375972748,
0.48569241166114807,
0.261119544506073,
0.23868051171302795,
0.3016282618045807,
-0.032666049897670746,
-0.04069993644952774,
-0.2312840223312378,
0.2294139564037323,
-0.435617059469223,
-0.41516661643981934,
-0.2674567401409149,
0.5044151544570923,
-0.01932355761528015,
0.12420932948589325,
-0.3350299298763275,
-0.06624119728803635,
-0.04065354913473129,
0.2541331350803375,
-0.11921557784080505,
0.2744082510471344,
-0.45309436321258545,
-0.17059893906116486,
-0.08942428231239319,
-0.12396197021007538,
0.011534325778484344,
0.18963316082954407,
-0.0558583103120327,
0.27227628231048584,
-0.5796654224395752,
0.22938616573810577,
0.05213649570941925,
0.1451501101255417,
-0.1346784234046936,
0.1227787584066391,
0.10550137609243393,
-0.5078572034835815,
0.34333521127700806,
0.23785626888275146,
0.29185950756073,
0.11540549993515015,
-0.22190696001052856,
0.34437036514282227,
0.43669766187667847,
-0.1908072531223297,
-0.04061196744441986,
-0.12098392844200134,
-0.03561992570757866,
-0.1499127894639969,
0.19743536412715912,
0.3490368723869324,
0.18789905309677124,
0.2596159875392914,
0.0557275116443634,
-0.26596614718437195,
0.27851778268814087,
0.06501396000385284,
-0.3240588903427124,
0.17866621911525726,
-0.13293880224227905,
0.4019324481487274,
-0.32858094573020935,
-0.4429645836353302,
0.00986664742231369,
-0.39412444829940796,
0.21558675169944763,
0.6670199036598206,
-0.2954224944114685,
0.28785526752471924,
-0.02548792213201523,
0.04855022579431534,
0.0018409136682748795,
0.47605016827583313,
0.46973514556884766,
0.2841596007347107,
-0.37837129831314087,
-0.025667212903499603,
-0.32888373732566833,
0.2765583097934723,
-0.2024305909872055,
0.06699749082326889,
0.022247930988669395,
0.17079433798789978,
0.16457822918891907,
-0.003302011638879776,
-0.07962261140346527,
-0.013621993362903595,
0.21880324184894562,
-0.19506913423538208,
-0.1675596684217453,
-0.12804758548736572,
0.0020943284034729004,
0.3573179543018341,
-0.025900525972247124,
-0.29754993319511414,
0.15886540710926056,
0.11506294459104538,
0.0991566851735115,
-0.3214535713195801,
0.3626996874809265,
-0.19846373796463013,
-0.02036242187023163,
0.0691281408071518,
-0.15047122538089752,
0.37920957803726196,
-0.22043859958648682,
-0.03304758667945862,
-0.08182770013809204,
0.12814156711101532,
-0.16707712411880493,
-0.22100013494491577,
0.3402222692966461,
0.38842451572418213,
-0.10763649642467499,
0.10821394622325897,
-0.25519275665283203,
-0.08646275848150253,
0.040304481983184814,
-0.36969074606895447,
-0.3087161183357239,
-0.0074881562031805515,
-0.0002531483769416809,
0.008524507284164429,
0.10309776663780212,
0.24583062529563904,
0.10533731430768967,
-0.027840254828333855,
-0.22922900319099426,
-0.1855800449848175,
0.20947544276714325,
-0.2946496903896332,
-0.31304094195365906,
-0.03537982702255249,
0.05562475696206093,
-0.16362905502319336,
0.2511020004749298,
-0.46240702271461487,
0.14574888348579407,
0.22974419593811035,
-0.025514401495456696,
-0.4540731608867645,
0.2232973277568817,
0.2540613114833832,
0.016472186893224716,
-0.20769661664962769,
0.05345691740512848,
0.1526237428188324,
-0.1369924396276474,
-0.20163996517658234,
-0.1757192611694336
] |
https://github.com/huggingface/datasets/issues/633 | Load large text file for LM pre-training resulting in OOM | Hmmm so this might come from another issue...
Since it doesn't seem to be related to multiprocessing it should be easier to investigate though.
Do you have some ideas @gaceladri ? | I tried to pretrain Longformer using transformers and datasets. But I got OOM issues with loading a large text file. My script is almost like this:
```python
from datasets import load_dataset
@dataclass
class DataCollatorForDatasetsLanguageModeling(DataCollatorForLanguageModeling):
"""
Data collator used for language modeling based on DataCollatorForLazyLanguageModeling
- collates batches of tensors, honoring their tokenizer's pad_token
- preprocesses batches for masked language modeling
"""
block_size: int = 512
def __call__(self, examples: List[dict]) -> Dict[str, torch.Tensor]:
examples = [example['text'] for example in examples]
batch, attention_mask = self._tensorize_batch(examples)
if self.mlm:
inputs, labels = self.mask_tokens(batch)
return {"input_ids": inputs, "labels": labels}
else:
labels = batch.clone().detach()
if self.tokenizer.pad_token_id is not None:
labels[labels == self.tokenizer.pad_token_id] = -100
return {"input_ids": batch, "labels": labels}
def _tensorize_batch(self, examples: List[str]) -> Tuple[torch.Tensor, torch.Tensor]:
if self.tokenizer._pad_token is None:
raise ValueError(
"You are attempting to pad samples but the tokenizer you are using"
f" ({self.tokenizer.__class__.__name__}) does not have one."
)
tensor_examples = self.tokenizer.batch_encode_plus(
[ex for ex in examples if ex],
max_length=self.block_size,
return_tensors="pt",
pad_to_max_length=True,
return_attention_mask=True,
truncation=True,
)
input_ids, attention_mask = tensor_examples["input_ids"], tensor_examples["attention_mask"]
return input_ids, attention_mask
dataset = load_dataset('text', data_files='train.txt',cache_dir="./", , split='train')
data_collator = DataCollatorForDatasetsLanguageModeling(tokenizer=tokenizer, mlm=True,
mlm_probability=0.15, block_size=tokenizer.max_len)
trainer = Trainer(model=model, args=args, data_collator=data_collator,
train_dataset=train_dataset, prediction_loss_only=True, )
trainer.train(model_path=model_path)
```
This train.txt is about 1.1GB and has 90k lines where each line is a sequence of 4k words.
During training, the memory usage increased fast as the following graph and resulted in OOM before the finish of training.

Could you please give me any suggestions on why this happened and how to fix it?
Thanks. | 31 | Load large text file for LM pre-training resulting in OOM
I tried to pretrain Longformer using transformers and datasets. But I got OOM issues with loading a large text file. My script is almost like this:
```python
from datasets import load_dataset
@dataclass
class DataCollatorForDatasetsLanguageModeling(DataCollatorForLanguageModeling):
"""
Data collator used for language modeling based on DataCollatorForLazyLanguageModeling
- collates batches of tensors, honoring their tokenizer's pad_token
- preprocesses batches for masked language modeling
"""
block_size: int = 512
def __call__(self, examples: List[dict]) -> Dict[str, torch.Tensor]:
examples = [example['text'] for example in examples]
batch, attention_mask = self._tensorize_batch(examples)
if self.mlm:
inputs, labels = self.mask_tokens(batch)
return {"input_ids": inputs, "labels": labels}
else:
labels = batch.clone().detach()
if self.tokenizer.pad_token_id is not None:
labels[labels == self.tokenizer.pad_token_id] = -100
return {"input_ids": batch, "labels": labels}
def _tensorize_batch(self, examples: List[str]) -> Tuple[torch.Tensor, torch.Tensor]:
if self.tokenizer._pad_token is None:
raise ValueError(
"You are attempting to pad samples but the tokenizer you are using"
f" ({self.tokenizer.__class__.__name__}) does not have one."
)
tensor_examples = self.tokenizer.batch_encode_plus(
[ex for ex in examples if ex],
max_length=self.block_size,
return_tensors="pt",
pad_to_max_length=True,
return_attention_mask=True,
truncation=True,
)
input_ids, attention_mask = tensor_examples["input_ids"], tensor_examples["attention_mask"]
return input_ids, attention_mask
dataset = load_dataset('text', data_files='train.txt',cache_dir="./", , split='train')
data_collator = DataCollatorForDatasetsLanguageModeling(tokenizer=tokenizer, mlm=True,
mlm_probability=0.15, block_size=tokenizer.max_len)
trainer = Trainer(model=model, args=args, data_collator=data_collator,
train_dataset=train_dataset, prediction_loss_only=True, )
trainer.train(model_path=model_path)
```
This train.txt is about 1.1GB and has 90k lines where each line is a sequence of 4k words.
During training, the memory usage increased fast as the following graph and resulted in OOM before the finish of training.

Could you please give me any suggestions on why this happened and how to fix it?
Thanks.
Hmmm so this might come from another issue...
Since it doesn't seem to be related to multiprocessing it should be easier to investigate though.
Do you have some ideas @gaceladri ? | [
-0.6339283585548401,
-0.47753778100013733,
0.010693363845348358,
0.29863524436950684,
0.36004769802093506,
-0.1518251597881317,
0.5567324757575989,
0.37380579113960266,
0.01088225468993187,
0.010719746351242065,
-0.1295929253101349,
-0.1828002780675888,
-0.26698487997055054,
-0.16208980977535248,
-0.03237204998731613,
0.023206885904073715,
-0.09982117265462875,
0.19687515497207642,
-0.2772675156593323,
-0.09666657447814941,
0.05701180547475815,
-0.07762926816940308,
-0.21276047825813293,
-0.029743991792201996,
-0.3879220187664032,
-0.06171319633722305,
0.3158179223537445,
0.12212134897708893,
-0.1640809327363968,
-0.0958080142736435,
-0.22970141470432281,
0.1197899580001831,
0.4393485188484192,
0.4340214729309082,
-0.00011477212683530524,
0.006616219878196716,
0.18904384970664978,
-0.23633266985416412,
-0.16726946830749512,
0.019216440618038177,
0.07755492627620697,
-0.3022913932800293,
-0.10640020668506622,
-0.3036171495914459,
-0.02724609524011612,
-0.10612530261278152,
-0.015682043507695198,
-0.22437302768230438,
0.4987519383430481,
0.5414043068885803,
0.15876251459121704,
0.25081300735473633,
-0.21366100013256073,
0.0723966509103775,
0.25443702936172485,
0.0488995760679245,
0.1056830957531929,
-0.27951449155807495,
0.46878406405448914,
-0.1923186331987381,
-0.47268855571746826,
0.1478176862001419,
-0.22477363049983978,
-0.20168264210224152,
-0.09508860856294632,
0.03820447996258736,
0.36608895659446716,
0.031569477170705795,
0.2641869783401489,
0.3474210202693939,
0.4272076189517975,
-0.0008120127022266388,
-0.289635568857193,
-0.3209858536720276,
-0.14262455701828003,
-0.08431586623191833,
0.18923655152320862,
0.2010769546031952,
0.059826578944921494,
0.11845916509628296,
0.10712733119726181,
-0.12533129751682281,
-0.15199026465415955,
0.07616106420755386,
-0.27480751276016235,
0.33979544043540955,
-0.20125117897987366,
-0.03804318606853485,
0.15557512640953064,
-0.09447921812534332,
0.19616937637329102,
-0.09977510571479797,
0.003403950482606888,
0.25671419501304626,
-0.245441272854805,
-0.11239507794380188,
-0.07168225198984146,
-0.5194145441055298,
0.16278403997421265,
-0.2759450674057007,
0.1981883943080902,
0.29723939299583435,
-0.08766181021928787,
-0.06761691719293594,
0.08639387786388397,
0.4202020466327667,
-0.25243741273880005,
0.26052793860435486,
0.22725635766983032,
0.16401110589504242,
-0.17170630395412445,
-0.04439859092235565,
-0.33051154017448425,
-0.19624567031860352,
0.10159362852573395,
-0.07734166085720062,
-0.011017010547220707,
-0.2546045482158661,
-0.24042175710201263,
0.05854658782482147,
-0.14076969027519226,
-0.03084544464945793,
0.2748163938522339,
0.38997286558151245,
-0.3540611267089844,
0.4294978082180023,
0.16510933637619019,
0.052328936755657196,
-0.4855332672595978,
-0.33652669191360474,
-0.17440199851989746,
0.15325728058815002,
-0.20324474573135376,
0.038975562900304794,
0.12979257106781006,
0.13963374495506287,
0.05965423583984375,
-0.04288341850042343,
-0.0625898689031601,
-0.44021931290626526,
-0.009444482624530792,
-0.024103429168462753,
0.020752981305122375,
-0.04251480475068092,
0.06302379071712494,
-0.02336559072136879,
0.23476582765579224,
-0.12499457597732544,
-0.025381658226251602,
0.3477915823459625,
-0.2762118875980377,
-0.2276410162448883,
0.05097950994968414,
0.21017630398273468,
-0.02824842929840088,
0.20915503799915314,
0.028506658971309662,
0.07685685157775879,
0.5359783172607422,
0.006653331220149994,
-0.04714777320623398,
-0.3782060742378235,
0.09452182054519653,
0.09201760590076447,
0.1619914025068283,
0.17663070559501648,
-0.042587969452142715,
-0.07260239124298096,
0.0063892244361341,
0.10358665883541107,
0.25504034757614136,
0.3907330334186554,
-0.22647030651569366,
0.2906738817691803,
0.007004471495747566,
-0.05665605142712593,
0.5319919586181641,
-0.2620989978313446,
-0.448444128036499,
0.23385274410247803,
-0.3511556386947632,
0.10818185657262802,
0.22066983580589294,
0.1759030818939209,
0.11388914287090302,
-0.1089852899312973,
0.26901498436927795,
0.3656851649284363,
0.07051589339971542,
0.1209140196442604,
-0.23662437498569489,
-0.09222844988107681,
-0.1715157926082611,
0.48420286178588867,
0.36272403597831726,
-0.02558579295873642,
-0.07308889180421829,
0.35637998580932617,
0.18339842557907104,
-0.1992236077785492,
0.13128061592578888,
0.36934155225753784,
-0.17442509531974792,
-0.1261582374572754,
0.0944812074303627,
0.06559769064188004,
-0.3000325560569763,
-0.07098697125911713,
-0.09084425866603851,
0.0828668475151062,
-0.1136055737733841,
-0.08942607045173645,
0.28255847096443176,
0.02287023328244686,
-0.0766652524471283,
0.11318020522594452,
0.03794129937887192,
-0.13182224333286285,
0.024866361171007156,
-0.07041719555854797,
0.1261971890926361,
0.015421975404024124,
-0.09320687502622604,
0.08736041188240051,
-0.2184159904718399,
-0.12394054979085922,
0.0018030330538749695,
-0.137061208486557,
0.07695000618696213,
0.17527323961257935,
-0.05118799954652786,
0.03840121626853943,
-0.17304009199142456,
0.10695729404687881,
-0.15297769010066986,
-0.2987070679664612,
-0.5071570873260498,
0.43589335680007935,
0.18647874891757965,
-0.33810955286026,
0.3402597904205322,
0.1040273904800415,
-0.029599443078041077,
-0.10627070814371109,
-0.11989574879407883,
0.5749332904815674,
0.27307116985321045,
0.019617579877376556,
0.29909294843673706,
-0.24541117250919342,
0.2542804777622223,
-0.2662392258644104,
-0.10361561179161072,
-0.09776493161916733,
0.4209232032299042,
0.03105533868074417,
0.23506294190883636,
0.14828065037727356,
-0.08694546669721603,
-0.232059508562088,
0.47038108110427856,
-0.1788094937801361,
-0.013872608542442322,
0.26652613282203674,
-0.4247211217880249,
-0.011563490144908428,
-0.34802117943763733,
-0.24947787821292877,
0.0067334845662117004,
0.17322899401187897,
-0.09441326558589935,
-0.055435195565223694,
0.008537785150110722,
-0.26279330253601074,
0.007836148142814636,
0.1532370001077652,
-0.0718524307012558,
0.31983456015586853,
0.11651500314474106,
0.10059522092342377,
-0.122891865670681,
-0.1794070154428482,
0.10284756124019623,
0.17828989028930664,
-0.27519121766090393,
0.18444325029850006,
-0.02282267063856125,
-0.013446485623717308,
-0.2862633764743805,
0.1904245764017105,
-0.12680108845233917,
0.0388152077794075,
-0.0647432953119278,
0.25868889689445496,
-0.07790280133485794,
0.10191172361373901,
0.3001607060432434,
0.3549228012561798,
0.4629628658294678,
-0.07809486240148544,
0.326348215341568,
-0.08266382664442062,
-0.1796954870223999,
0.032943595200777054,
0.33450770378112793,
-0.3179926872253418,
-0.024890778586268425,
0.005377540364861488,
0.05117718130350113,
-0.09892972558736801,
-0.16603437066078186,
0.09468895941972733,
0.196824312210083,
-0.16618932783603668,
-0.2573060691356659,
-0.07217618823051453,
0.17769087851047516,
-0.042431723326444626,
0.11972848325967789,
-0.23244111239910126,
0.008407561108469963,
0.1450573354959488,
-0.006289597600698471,
-0.18432363867759705,
0.04044550284743309,
-0.1199219599366188,
-0.04705164581537247,
-0.411641389131546,
-0.05351852625608444,
0.10705065727233887,
0.13673138618469238,
0.35936760902404785,
0.10678976029157639,
0.19445137679576874,
0.28844478726387024,
0.15859206020832062,
0.006367621943354607,
-0.0885988399386406,
0.5141718983650208,
-0.017572684213519096,
-0.29719802737236023,
-0.2908625900745392,
-0.23975418508052826,
0.02511288784444332,
0.3155249357223511,
-0.684260904788971,
0.23378321528434753,
-0.1138516515493393,
-0.09402675926685333,
-0.3955192267894745,
0.0007258430123329163,
0.2522047758102417,
-0.07614870369434357,
0.016339777037501335,
0.09547417610883713,
0.2302767038345337,
0.1546790897846222,
-0.03878729045391083,
0.38579460978507996,
-0.4130840301513672,
0.35940811038017273,
-0.13545823097229004,
0.4855530261993408,
-0.122118279337883,
-0.2300206571817398,
0.09887474775314331,
0.15044830739498138,
-0.01711525395512581,
-0.021802209317684174,
-0.013968504965305328,
-0.25937944650650024,
-0.058237224817276,
0.0227312333881855,
0.5197213292121887,
0.01689060777425766,
-0.16558955609798431,
-0.015898926183581352,
0.06816425919532776,
0.2563197910785675,
-0.26069891452789307,
0.49052777886390686,
-0.19077889621257782,
0.01841624826192856,
-0.19967399537563324,
0.01874571293592453,
-0.20498108863830566,
-0.21508586406707764,
-0.164134681224823,
0.09344439208507538,
-0.03038274496793747,
-0.22404396533966064,
-0.2116939276456833,
0.10314016044139862,
-0.3681343197822571,
-0.0437651127576828,
0.11799006909132004,
0.22933240234851837,
0.18077029287815094,
-0.19614383578300476,
-0.08628876507282257,
-0.20187069475650787,
0.35741427540779114,
0.1934524029493332,
0.11246532201766968,
0.16325931251049042,
-0.05687852203845978,
-0.2155371457338333,
-0.17745190858840942,
-0.29045435786247253,
0.14190825819969177,
0.6505106687545776,
0.6102464199066162,
-0.21627351641654968,
-0.15859898924827576,
0.07914479076862335,
0.002603483386337757,
-0.16527341306209564,
-0.548757016658783,
-0.12850907444953918,
-0.16549962759017944,
-0.44105130434036255,
0.004606112837791443,
0.35849836468696594,
0.3558535575866699,
-0.2264459729194641,
-0.03187551349401474,
0.13872987031936646,
-0.0007013268768787384,
0.37175118923187256,
-0.12976384162902832,
0.015054157003760338,
-0.06641082465648651,
0.225828617811203,
-0.10741686820983887,
0.36735567450523376,
0.24888965487480164,
0.35636386275291443,
0.1917259395122528,
-0.31755685806274414,
0.0706881731748581,
-0.029888737946748734,
0.23143038153648376,
0.11516103148460388,
0.11022848635911942,
0.3546280860900879,
0.1289711445569992,
0.3322555422782898,
-0.19096627831459045,
0.6737229228019714,
-0.007344553247094154,
0.20682765543460846,
-0.8374910354614258,
-0.26737040281295776,
0.33145615458488464,
-0.02635771967470646,
0.19940276443958282,
0.215718075633049,
-0.40385204553604126,
-0.3216697573661804,
0.376661479473114,
0.09908346086740494,
0.7675239443778992,
-0.2972695827484131,
0.39625850319862366,
-0.1552990972995758,
0.6611965894699097,
0.12803049385547638,
-0.3813104033470154,
0.1585618406534195,
-0.39879149198532104,
-0.2663658857345581,
0.21300511062145233,
-0.09231188893318176,
0.036539800465106964,
0.16050389409065247,
-0.2905767560005188,
-0.029811730608344078,
0.0862521380186081,
0.2249334454536438,
0.13066981732845306,
0.5134936571121216,
0.12092680484056473,
-0.6006978154182434,
-0.08281297981739044,
0.02656909078359604,
-0.02340024709701538,
-0.10490188002586365,
-0.0492798313498497,
0.07994647324085236,
-0.0313267819583416,
-0.20856402814388275,
-0.028466172516345978,
0.20525774359703064,
-0.2474464625120163,
0.08661594241857529,
0.06375248730182648,
-0.07205313444137573,
0.5367995500564575,
0.10623051226139069,
-0.001361064612865448,
0.4988958239555359,
-0.039286620914936066,
0.13215835392475128,
-0.2274819314479828,
-0.1652863323688507,
0.20070844888687134,
-0.06584891676902771,
0.4217033088207245,
0.08837933093309402,
-0.0005880966782569885,
0.11410333216190338,
0.0632382407784462,
-0.046690933406353,
0.09476359188556671,
-0.36430907249450684,
0.10549724102020264,
-0.41123154759407043,
-0.21542777121067047,
-0.08843062818050385,
-0.30078285932540894,
-0.1009221225976944,
0.12310943007469177,
0.13735687732696533,
-0.46444618701934814,
0.11514545977115631,
0.2652113139629364,
-0.3750092685222626,
0.011997109279036522,
0.38382449746131897,
0.17105859518051147,
-0.10513918846845627,
0.49984270334243774,
0.4575878381729126,
-0.053361937403678894,
-0.2644973695278168,
-0.10962903499603271,
0.29444822669029236,
-0.2731435000896454,
0.0849163606762886,
-0.2455592304468155,
-0.3016006648540497,
0.209351047873497,
0.08087542653083801,
0.10009974241256714,
-0.01499941200017929,
-0.06326231360435486,
-0.25102943181991577,
-0.6380501389503479,
-0.18144388496875763,
-0.0027230940759181976,
-0.00354844331741333,
0.1460832953453064,
0.27389806509017944,
-0.3100467920303345,
0.5892773270606995,
-0.2788558602333069,
-0.05294197052717209,
-0.20760811865329742,
0.2782232165336609,
-0.055562183260917664,
-0.38554659485816956,
0.21153579652309418,
0.2033519148826599,
0.1001039668917656,
0.08059665560722351,
0.00590919703245163,
-0.22135356068611145,
-0.14351996779441833,
0.11271549016237259,
0.23647010326385498,
-0.41966331005096436,
-0.01599399372935295,
-0.312997043132782,
-0.09248970448970795,
-0.27002182602882385,
0.06606784462928772,
0.017028577625751495,
0.01394578069448471,
-0.22617922723293304,
0.009393874555826187,
0.04752609133720398,
-0.2552624046802521,
0.04206028953194618,
-0.25458529591560364,
0.12509100139141083,
0.2465714067220688,
0.1331031173467636,
0.11783083528280258,
0.0006371289491653442,
-0.3931019604206085,
0.17964592576026917,
0.6661380529403687,
-0.017532095313072205,
0.4190823435783386,
-0.43573224544525146,
-0.0715063214302063,
0.24765951931476593,
0.04980342835187912,
0.048066146671772,
-0.34167730808258057,
-0.010718589648604393,
0.2935883700847626,
0.22681888937950134,
0.015208568423986435,
-0.014733202755451202,
0.22635462880134583,
-0.41129830479621887,
0.1301487535238266,
0.3453426659107208,
-0.11192676424980164,
-0.06747587025165558,
0.1559651792049408,
0.09132310748100281,
0.5066777467727661,
0.11496534198522568,
0.005711604841053486,
0.24894991517066956,
-0.00122002512216568,
0.15485714375972748,
0.48569241166114807,
0.261119544506073,
0.23868051171302795,
0.3016282618045807,
-0.032666049897670746,
-0.04069993644952774,
-0.2312840223312378,
0.2294139564037323,
-0.435617059469223,
-0.41516661643981934,
-0.2674567401409149,
0.5044151544570923,
-0.01932355761528015,
0.12420932948589325,
-0.3350299298763275,
-0.06624119728803635,
-0.04065354913473129,
0.2541331350803375,
-0.11921557784080505,
0.2744082510471344,
-0.45309436321258545,
-0.17059893906116486,
-0.08942428231239319,
-0.12396197021007538,
0.011534325778484344,
0.18963316082954407,
-0.0558583103120327,
0.27227628231048584,
-0.5796654224395752,
0.22938616573810577,
0.05213649570941925,
0.1451501101255417,
-0.1346784234046936,
0.1227787584066391,
0.10550137609243393,
-0.5078572034835815,
0.34333521127700806,
0.23785626888275146,
0.29185950756073,
0.11540549993515015,
-0.22190696001052856,
0.34437036514282227,
0.43669766187667847,
-0.1908072531223297,
-0.04061196744441986,
-0.12098392844200134,
-0.03561992570757866,
-0.1499127894639969,
0.19743536412715912,
0.3490368723869324,
0.18789905309677124,
0.2596159875392914,
0.0557275116443634,
-0.26596614718437195,
0.27851778268814087,
0.06501396000385284,
-0.3240588903427124,
0.17866621911525726,
-0.13293880224227905,
0.4019324481487274,
-0.32858094573020935,
-0.4429645836353302,
0.00986664742231369,
-0.39412444829940796,
0.21558675169944763,
0.6670199036598206,
-0.2954224944114685,
0.28785526752471924,
-0.02548792213201523,
0.04855022579431534,
0.0018409136682748795,
0.47605016827583313,
0.46973514556884766,
0.2841596007347107,
-0.37837129831314087,
-0.025667212903499603,
-0.32888373732566833,
0.2765583097934723,
-0.2024305909872055,
0.06699749082326889,
0.022247930988669395,
0.17079433798789978,
0.16457822918891907,
-0.003302011638879776,
-0.07962261140346527,
-0.013621993362903595,
0.21880324184894562,
-0.19506913423538208,
-0.1675596684217453,
-0.12804758548736572,
0.0020943284034729004,
0.3573179543018341,
-0.025900525972247124,
-0.29754993319511414,
0.15886540710926056,
0.11506294459104538,
0.0991566851735115,
-0.3214535713195801,
0.3626996874809265,
-0.19846373796463013,
-0.02036242187023163,
0.0691281408071518,
-0.15047122538089752,
0.37920957803726196,
-0.22043859958648682,
-0.03304758667945862,
-0.08182770013809204,
0.12814156711101532,
-0.16707712411880493,
-0.22100013494491577,
0.3402222692966461,
0.38842451572418213,
-0.10763649642467499,
0.10821394622325897,
-0.25519275665283203,
-0.08646275848150253,
0.040304481983184814,
-0.36969074606895447,
-0.3087161183357239,
-0.0074881562031805515,
-0.0002531483769416809,
0.008524507284164429,
0.10309776663780212,
0.24583062529563904,
0.10533731430768967,
-0.027840254828333855,
-0.22922900319099426,
-0.1855800449848175,
0.20947544276714325,
-0.2946496903896332,
-0.31304094195365906,
-0.03537982702255249,
0.05562475696206093,
-0.16362905502319336,
0.2511020004749298,
-0.46240702271461487,
0.14574888348579407,
0.22974419593811035,
-0.025514401495456696,
-0.4540731608867645,
0.2232973277568817,
0.2540613114833832,
0.016472186893224716,
-0.20769661664962769,
0.05345691740512848,
0.1526237428188324,
-0.1369924396276474,
-0.20163996517658234,
-0.1757192611694336
] |
https://github.com/huggingface/datasets/issues/633 | Load large text file for LM pre-training resulting in OOM | @lhoestq I looked quickly to a previously spoted bug in my env wandb /sdk/interface/interface.py, because sometimes when I load the dataset I got a multiprocessing error at line 510 in wandb...interface.py
This bug is reported here https://github.com/huggingface/datasets/issues/847
```
---------------------------------------------------------------------------
AssertionError Traceback (most recent call last)
<timed eval> in <module>
~/anaconda3/envs/tfm/lib/python3.6/site-packages/transformers/trainer.py in train(self, model_path, trial)
877 print(len(epoch_iterator))
878
--> 879 for step, inputs in enumerate(epoch_iterator):
880
881 start_step = time.time()
~/anaconda3/envs/tfm/lib/python3.6/site-packages/torch/utils/data/dataloader.py in __next__(self)
433 if self._sampler_iter is None:
434 self._reset()
--> 435 data = self._next_data()
436 self._num_yielded += 1
437 if self._dataset_kind == _DatasetKind.Iterable and \
~/anaconda3/envs/tfm/lib/python3.6/site-packages/torch/utils/data/dataloader.py in _next_data(self)
1083 else:
1084 del self._task_info[idx]
-> 1085 return self._process_data(data)
1086
1087 def _try_put_index(self):
~/anaconda3/envs/tfm/lib/python3.6/site-packages/torch/utils/data/dataloader.py in _process_data(self, data)
1109 self._try_put_index()
1110 if isinstance(data, ExceptionWrapper):
-> 1111 data.reraise()
1112 return data
1113
~/anaconda3/envs/tfm/lib/python3.6/site-packages/torch/_utils.py in reraise(self)
426 # have message field
427 raise self.exc_type(message=msg)
--> 428 raise self.exc_type(msg)
429
430
AssertionError: Caught AssertionError in DataLoader worker process 0.
Original Traceback (most recent call last):
File "/home/ad/anaconda3/envs/tfm/lib/python3.6/site-packages/torch/utils/data/_utils/worker.py", line 198, in _worker_loop
data = fetcher.fetch(index)
File "/home/ad/anaconda3/envs/tfm/lib/python3.6/site-packages/torch/utils/data/_utils/fetch.py", line 44, in fetch
data = [self.dataset[idx] for idx in possibly_batched_index]
File "/home/ad/anaconda3/envs/tfm/lib/python3.6/site-packages/torch/utils/data/_utils/fetch.py", line 44, in <listcomp>
data = [self.dataset[idx] for idx in possibly_batched_index]
File "/home/ad/anaconda3/envs/tfm/lib/python3.6/site-packages/datasets/arrow_dataset.py", line 1083, in __getitem__
format_kwargs=self._format_kwargs,
File "/home/ad/anaconda3/envs/tfm/lib/python3.6/site-packages/datasets/arrow_dataset.py", line 1070, in _getitem
format_kwargs=format_kwargs,
File "/home/ad/anaconda3/envs/tfm/lib/python3.6/site-packages/datasets/arrow_dataset.py", line 886, in _convert_outputs
v = map_nested(command, v, **map_nested_kwargs)
File "/home/ad/anaconda3/envs/tfm/lib/python3.6/site-packages/datasets/utils/py_utils.py", line 216, in map_nested
return function(data_struct)
File "/home/ad/anaconda3/envs/tfm/lib/python3.6/site-packages/datasets/arrow_dataset.py", line 847, in command
return torch.tensor(x, **format_kwargs)
File "/home/ad/anaconda3/envs/tfm/lib/python3.6/warnings.py", line 101, in _showwarnmsg
_showwarnmsg_impl(msg)
File "/home/ad/anaconda3/envs/tfm/lib/python3.6/warnings.py", line 30, in _showwarnmsg_impl
file.write(text)
File "/home/ad/anaconda3/envs/tfm/lib/python3.6/site-packages/wandb/sdk/lib/redirect.py", line 100, in new_write
cb(name, data)
File "/home/ad/anaconda3/envs/tfm/lib/python3.6/site-packages/wandb/sdk/wandb_run.py", line 729, in _console_callback
self._backend.interface.publish_output(name, data)
File "/home/ad/anaconda3/envs/tfm/lib/python3.6/site-packages/wandb/sdk/interface/interface.py", line 186, in publish_output
self._publish_output(o)
File "/home/ad/anaconda3/envs/tfm/lib/python3.6/site-packages/wandb/sdk/interface/interface.py", line 191, in _publish_output
self._publish(rec)
File "/home/ad/anaconda3/envs/tfm/lib/python3.6/site-packages/wandb/sdk/interface/interface.py", line 510, in _publish
if self._process and not self._process.is_alive():
File "/home/ad/anaconda3/envs/tfm/lib/python3.6/multiprocessing/process.py", line 134, in is_alive
assert self._parent_pid == os.getpid(), 'can only test a child process'
AssertionError: can only test a child process
```
My workaround was to just comment those lines without looking to much into consecuences:
```
def _publish(self, record: pb.Record, local: bool = None) -> None:
#if self._process and not self._process.is_alive():
# raise Exception("The wandb backend process has shutdown")
```
It worked so far... I need to try running without wandb and see if it could be causing something wrong with multiprocessing. I am going to try to launch the training setting wandb to false and I will let you know again. | I tried to pretrain Longformer using transformers and datasets. But I got OOM issues with loading a large text file. My script is almost like this:
```python
from datasets import load_dataset
@dataclass
class DataCollatorForDatasetsLanguageModeling(DataCollatorForLanguageModeling):
"""
Data collator used for language modeling based on DataCollatorForLazyLanguageModeling
- collates batches of tensors, honoring their tokenizer's pad_token
- preprocesses batches for masked language modeling
"""
block_size: int = 512
def __call__(self, examples: List[dict]) -> Dict[str, torch.Tensor]:
examples = [example['text'] for example in examples]
batch, attention_mask = self._tensorize_batch(examples)
if self.mlm:
inputs, labels = self.mask_tokens(batch)
return {"input_ids": inputs, "labels": labels}
else:
labels = batch.clone().detach()
if self.tokenizer.pad_token_id is not None:
labels[labels == self.tokenizer.pad_token_id] = -100
return {"input_ids": batch, "labels": labels}
def _tensorize_batch(self, examples: List[str]) -> Tuple[torch.Tensor, torch.Tensor]:
if self.tokenizer._pad_token is None:
raise ValueError(
"You are attempting to pad samples but the tokenizer you are using"
f" ({self.tokenizer.__class__.__name__}) does not have one."
)
tensor_examples = self.tokenizer.batch_encode_plus(
[ex for ex in examples if ex],
max_length=self.block_size,
return_tensors="pt",
pad_to_max_length=True,
return_attention_mask=True,
truncation=True,
)
input_ids, attention_mask = tensor_examples["input_ids"], tensor_examples["attention_mask"]
return input_ids, attention_mask
dataset = load_dataset('text', data_files='train.txt',cache_dir="./", , split='train')
data_collator = DataCollatorForDatasetsLanguageModeling(tokenizer=tokenizer, mlm=True,
mlm_probability=0.15, block_size=tokenizer.max_len)
trainer = Trainer(model=model, args=args, data_collator=data_collator,
train_dataset=train_dataset, prediction_loss_only=True, )
trainer.train(model_path=model_path)
```
This train.txt is about 1.1GB and has 90k lines where each line is a sequence of 4k words.
During training, the memory usage increased fast as the following graph and resulted in OOM before the finish of training.

Could you please give me any suggestions on why this happened and how to fix it?
Thanks. | 396 | Load large text file for LM pre-training resulting in OOM
I tried to pretrain Longformer using transformers and datasets. But I got OOM issues with loading a large text file. My script is almost like this:
```python
from datasets import load_dataset
@dataclass
class DataCollatorForDatasetsLanguageModeling(DataCollatorForLanguageModeling):
"""
Data collator used for language modeling based on DataCollatorForLazyLanguageModeling
- collates batches of tensors, honoring their tokenizer's pad_token
- preprocesses batches for masked language modeling
"""
block_size: int = 512
def __call__(self, examples: List[dict]) -> Dict[str, torch.Tensor]:
examples = [example['text'] for example in examples]
batch, attention_mask = self._tensorize_batch(examples)
if self.mlm:
inputs, labels = self.mask_tokens(batch)
return {"input_ids": inputs, "labels": labels}
else:
labels = batch.clone().detach()
if self.tokenizer.pad_token_id is not None:
labels[labels == self.tokenizer.pad_token_id] = -100
return {"input_ids": batch, "labels": labels}
def _tensorize_batch(self, examples: List[str]) -> Tuple[torch.Tensor, torch.Tensor]:
if self.tokenizer._pad_token is None:
raise ValueError(
"You are attempting to pad samples but the tokenizer you are using"
f" ({self.tokenizer.__class__.__name__}) does not have one."
)
tensor_examples = self.tokenizer.batch_encode_plus(
[ex for ex in examples if ex],
max_length=self.block_size,
return_tensors="pt",
pad_to_max_length=True,
return_attention_mask=True,
truncation=True,
)
input_ids, attention_mask = tensor_examples["input_ids"], tensor_examples["attention_mask"]
return input_ids, attention_mask
dataset = load_dataset('text', data_files='train.txt',cache_dir="./", , split='train')
data_collator = DataCollatorForDatasetsLanguageModeling(tokenizer=tokenizer, mlm=True,
mlm_probability=0.15, block_size=tokenizer.max_len)
trainer = Trainer(model=model, args=args, data_collator=data_collator,
train_dataset=train_dataset, prediction_loss_only=True, )
trainer.train(model_path=model_path)
```
This train.txt is about 1.1GB and has 90k lines where each line is a sequence of 4k words.
During training, the memory usage increased fast as the following graph and resulted in OOM before the finish of training.

Could you please give me any suggestions on why this happened and how to fix it?
Thanks.
@lhoestq I looked quickly to a previously spoted bug in my env wandb /sdk/interface/interface.py, because sometimes when I load the dataset I got a multiprocessing error at line 510 in wandb...interface.py
This bug is reported here https://github.com/huggingface/datasets/issues/847
```
---------------------------------------------------------------------------
AssertionError Traceback (most recent call last)
<timed eval> in <module>
~/anaconda3/envs/tfm/lib/python3.6/site-packages/transformers/trainer.py in train(self, model_path, trial)
877 print(len(epoch_iterator))
878
--> 879 for step, inputs in enumerate(epoch_iterator):
880
881 start_step = time.time()
~/anaconda3/envs/tfm/lib/python3.6/site-packages/torch/utils/data/dataloader.py in __next__(self)
433 if self._sampler_iter is None:
434 self._reset()
--> 435 data = self._next_data()
436 self._num_yielded += 1
437 if self._dataset_kind == _DatasetKind.Iterable and \
~/anaconda3/envs/tfm/lib/python3.6/site-packages/torch/utils/data/dataloader.py in _next_data(self)
1083 else:
1084 del self._task_info[idx]
-> 1085 return self._process_data(data)
1086
1087 def _try_put_index(self):
~/anaconda3/envs/tfm/lib/python3.6/site-packages/torch/utils/data/dataloader.py in _process_data(self, data)
1109 self._try_put_index()
1110 if isinstance(data, ExceptionWrapper):
-> 1111 data.reraise()
1112 return data
1113
~/anaconda3/envs/tfm/lib/python3.6/site-packages/torch/_utils.py in reraise(self)
426 # have message field
427 raise self.exc_type(message=msg)
--> 428 raise self.exc_type(msg)
429
430
AssertionError: Caught AssertionError in DataLoader worker process 0.
Original Traceback (most recent call last):
File "/home/ad/anaconda3/envs/tfm/lib/python3.6/site-packages/torch/utils/data/_utils/worker.py", line 198, in _worker_loop
data = fetcher.fetch(index)
File "/home/ad/anaconda3/envs/tfm/lib/python3.6/site-packages/torch/utils/data/_utils/fetch.py", line 44, in fetch
data = [self.dataset[idx] for idx in possibly_batched_index]
File "/home/ad/anaconda3/envs/tfm/lib/python3.6/site-packages/torch/utils/data/_utils/fetch.py", line 44, in <listcomp>
data = [self.dataset[idx] for idx in possibly_batched_index]
File "/home/ad/anaconda3/envs/tfm/lib/python3.6/site-packages/datasets/arrow_dataset.py", line 1083, in __getitem__
format_kwargs=self._format_kwargs,
File "/home/ad/anaconda3/envs/tfm/lib/python3.6/site-packages/datasets/arrow_dataset.py", line 1070, in _getitem
format_kwargs=format_kwargs,
File "/home/ad/anaconda3/envs/tfm/lib/python3.6/site-packages/datasets/arrow_dataset.py", line 886, in _convert_outputs
v = map_nested(command, v, **map_nested_kwargs)
File "/home/ad/anaconda3/envs/tfm/lib/python3.6/site-packages/datasets/utils/py_utils.py", line 216, in map_nested
return function(data_struct)
File "/home/ad/anaconda3/envs/tfm/lib/python3.6/site-packages/datasets/arrow_dataset.py", line 847, in command
return torch.tensor(x, **format_kwargs)
File "/home/ad/anaconda3/envs/tfm/lib/python3.6/warnings.py", line 101, in _showwarnmsg
_showwarnmsg_impl(msg)
File "/home/ad/anaconda3/envs/tfm/lib/python3.6/warnings.py", line 30, in _showwarnmsg_impl
file.write(text)
File "/home/ad/anaconda3/envs/tfm/lib/python3.6/site-packages/wandb/sdk/lib/redirect.py", line 100, in new_write
cb(name, data)
File "/home/ad/anaconda3/envs/tfm/lib/python3.6/site-packages/wandb/sdk/wandb_run.py", line 729, in _console_callback
self._backend.interface.publish_output(name, data)
File "/home/ad/anaconda3/envs/tfm/lib/python3.6/site-packages/wandb/sdk/interface/interface.py", line 186, in publish_output
self._publish_output(o)
File "/home/ad/anaconda3/envs/tfm/lib/python3.6/site-packages/wandb/sdk/interface/interface.py", line 191, in _publish_output
self._publish(rec)
File "/home/ad/anaconda3/envs/tfm/lib/python3.6/site-packages/wandb/sdk/interface/interface.py", line 510, in _publish
if self._process and not self._process.is_alive():
File "/home/ad/anaconda3/envs/tfm/lib/python3.6/multiprocessing/process.py", line 134, in is_alive
assert self._parent_pid == os.getpid(), 'can only test a child process'
AssertionError: can only test a child process
```
My workaround was to just comment those lines without looking to much into consecuences:
```
def _publish(self, record: pb.Record, local: bool = None) -> None:
#if self._process and not self._process.is_alive():
# raise Exception("The wandb backend process has shutdown")
```
It worked so far... I need to try running without wandb and see if it could be causing something wrong with multiprocessing. I am going to try to launch the training setting wandb to false and I will let you know again. | [
-0.6339283585548401,
-0.47753778100013733,
0.010693363845348358,
0.29863524436950684,
0.36004769802093506,
-0.1518251597881317,
0.5567324757575989,
0.37380579113960266,
0.01088225468993187,
0.010719746351242065,
-0.1295929253101349,
-0.1828002780675888,
-0.26698487997055054,
-0.16208980977535248,
-0.03237204998731613,
0.023206885904073715,
-0.09982117265462875,
0.19687515497207642,
-0.2772675156593323,
-0.09666657447814941,
0.05701180547475815,
-0.07762926816940308,
-0.21276047825813293,
-0.029743991792201996,
-0.3879220187664032,
-0.06171319633722305,
0.3158179223537445,
0.12212134897708893,
-0.1640809327363968,
-0.0958080142736435,
-0.22970141470432281,
0.1197899580001831,
0.4393485188484192,
0.4340214729309082,
-0.00011477212683530524,
0.006616219878196716,
0.18904384970664978,
-0.23633266985416412,
-0.16726946830749512,
0.019216440618038177,
0.07755492627620697,
-0.3022913932800293,
-0.10640020668506622,
-0.3036171495914459,
-0.02724609524011612,
-0.10612530261278152,
-0.015682043507695198,
-0.22437302768230438,
0.4987519383430481,
0.5414043068885803,
0.15876251459121704,
0.25081300735473633,
-0.21366100013256073,
0.0723966509103775,
0.25443702936172485,
0.0488995760679245,
0.1056830957531929,
-0.27951449155807495,
0.46878406405448914,
-0.1923186331987381,
-0.47268855571746826,
0.1478176862001419,
-0.22477363049983978,
-0.20168264210224152,
-0.09508860856294632,
0.03820447996258736,
0.36608895659446716,
0.031569477170705795,
0.2641869783401489,
0.3474210202693939,
0.4272076189517975,
-0.0008120127022266388,
-0.289635568857193,
-0.3209858536720276,
-0.14262455701828003,
-0.08431586623191833,
0.18923655152320862,
0.2010769546031952,
0.059826578944921494,
0.11845916509628296,
0.10712733119726181,
-0.12533129751682281,
-0.15199026465415955,
0.07616106420755386,
-0.27480751276016235,
0.33979544043540955,
-0.20125117897987366,
-0.03804318606853485,
0.15557512640953064,
-0.09447921812534332,
0.19616937637329102,
-0.09977510571479797,
0.003403950482606888,
0.25671419501304626,
-0.245441272854805,
-0.11239507794380188,
-0.07168225198984146,
-0.5194145441055298,
0.16278403997421265,
-0.2759450674057007,
0.1981883943080902,
0.29723939299583435,
-0.08766181021928787,
-0.06761691719293594,
0.08639387786388397,
0.4202020466327667,
-0.25243741273880005,
0.26052793860435486,
0.22725635766983032,
0.16401110589504242,
-0.17170630395412445,
-0.04439859092235565,
-0.33051154017448425,
-0.19624567031860352,
0.10159362852573395,
-0.07734166085720062,
-0.011017010547220707,
-0.2546045482158661,
-0.24042175710201263,
0.05854658782482147,
-0.14076969027519226,
-0.03084544464945793,
0.2748163938522339,
0.38997286558151245,
-0.3540611267089844,
0.4294978082180023,
0.16510933637619019,
0.052328936755657196,
-0.4855332672595978,
-0.33652669191360474,
-0.17440199851989746,
0.15325728058815002,
-0.20324474573135376,
0.038975562900304794,
0.12979257106781006,
0.13963374495506287,
0.05965423583984375,
-0.04288341850042343,
-0.0625898689031601,
-0.44021931290626526,
-0.009444482624530792,
-0.024103429168462753,
0.020752981305122375,
-0.04251480475068092,
0.06302379071712494,
-0.02336559072136879,
0.23476582765579224,
-0.12499457597732544,
-0.025381658226251602,
0.3477915823459625,
-0.2762118875980377,
-0.2276410162448883,
0.05097950994968414,
0.21017630398273468,
-0.02824842929840088,
0.20915503799915314,
0.028506658971309662,
0.07685685157775879,
0.5359783172607422,
0.006653331220149994,
-0.04714777320623398,
-0.3782060742378235,
0.09452182054519653,
0.09201760590076447,
0.1619914025068283,
0.17663070559501648,
-0.042587969452142715,
-0.07260239124298096,
0.0063892244361341,
0.10358665883541107,
0.25504034757614136,
0.3907330334186554,
-0.22647030651569366,
0.2906738817691803,
0.007004471495747566,
-0.05665605142712593,
0.5319919586181641,
-0.2620989978313446,
-0.448444128036499,
0.23385274410247803,
-0.3511556386947632,
0.10818185657262802,
0.22066983580589294,
0.1759030818939209,
0.11388914287090302,
-0.1089852899312973,
0.26901498436927795,
0.3656851649284363,
0.07051589339971542,
0.1209140196442604,
-0.23662437498569489,
-0.09222844988107681,
-0.1715157926082611,
0.48420286178588867,
0.36272403597831726,
-0.02558579295873642,
-0.07308889180421829,
0.35637998580932617,
0.18339842557907104,
-0.1992236077785492,
0.13128061592578888,
0.36934155225753784,
-0.17442509531974792,
-0.1261582374572754,
0.0944812074303627,
0.06559769064188004,
-0.3000325560569763,
-0.07098697125911713,
-0.09084425866603851,
0.0828668475151062,
-0.1136055737733841,
-0.08942607045173645,
0.28255847096443176,
0.02287023328244686,
-0.0766652524471283,
0.11318020522594452,
0.03794129937887192,
-0.13182224333286285,
0.024866361171007156,
-0.07041719555854797,
0.1261971890926361,
0.015421975404024124,
-0.09320687502622604,
0.08736041188240051,
-0.2184159904718399,
-0.12394054979085922,
0.0018030330538749695,
-0.137061208486557,
0.07695000618696213,
0.17527323961257935,
-0.05118799954652786,
0.03840121626853943,
-0.17304009199142456,
0.10695729404687881,
-0.15297769010066986,
-0.2987070679664612,
-0.5071570873260498,
0.43589335680007935,
0.18647874891757965,
-0.33810955286026,
0.3402597904205322,
0.1040273904800415,
-0.029599443078041077,
-0.10627070814371109,
-0.11989574879407883,
0.5749332904815674,
0.27307116985321045,
0.019617579877376556,
0.29909294843673706,
-0.24541117250919342,
0.2542804777622223,
-0.2662392258644104,
-0.10361561179161072,
-0.09776493161916733,
0.4209232032299042,
0.03105533868074417,
0.23506294190883636,
0.14828065037727356,
-0.08694546669721603,
-0.232059508562088,
0.47038108110427856,
-0.1788094937801361,
-0.013872608542442322,
0.26652613282203674,
-0.4247211217880249,
-0.011563490144908428,
-0.34802117943763733,
-0.24947787821292877,
0.0067334845662117004,
0.17322899401187897,
-0.09441326558589935,
-0.055435195565223694,
0.008537785150110722,
-0.26279330253601074,
0.007836148142814636,
0.1532370001077652,
-0.0718524307012558,
0.31983456015586853,
0.11651500314474106,
0.10059522092342377,
-0.122891865670681,
-0.1794070154428482,
0.10284756124019623,
0.17828989028930664,
-0.27519121766090393,
0.18444325029850006,
-0.02282267063856125,
-0.013446485623717308,
-0.2862633764743805,
0.1904245764017105,
-0.12680108845233917,
0.0388152077794075,
-0.0647432953119278,
0.25868889689445496,
-0.07790280133485794,
0.10191172361373901,
0.3001607060432434,
0.3549228012561798,
0.4629628658294678,
-0.07809486240148544,
0.326348215341568,
-0.08266382664442062,
-0.1796954870223999,
0.032943595200777054,
0.33450770378112793,
-0.3179926872253418,
-0.024890778586268425,
0.005377540364861488,
0.05117718130350113,
-0.09892972558736801,
-0.16603437066078186,
0.09468895941972733,
0.196824312210083,
-0.16618932783603668,
-0.2573060691356659,
-0.07217618823051453,
0.17769087851047516,
-0.042431723326444626,
0.11972848325967789,
-0.23244111239910126,
0.008407561108469963,
0.1450573354959488,
-0.006289597600698471,
-0.18432363867759705,
0.04044550284743309,
-0.1199219599366188,
-0.04705164581537247,
-0.411641389131546,
-0.05351852625608444,
0.10705065727233887,
0.13673138618469238,
0.35936760902404785,
0.10678976029157639,
0.19445137679576874,
0.28844478726387024,
0.15859206020832062,
0.006367621943354607,
-0.0885988399386406,
0.5141718983650208,
-0.017572684213519096,
-0.29719802737236023,
-0.2908625900745392,
-0.23975418508052826,
0.02511288784444332,
0.3155249357223511,
-0.684260904788971,
0.23378321528434753,
-0.1138516515493393,
-0.09402675926685333,
-0.3955192267894745,
0.0007258430123329163,
0.2522047758102417,
-0.07614870369434357,
0.016339777037501335,
0.09547417610883713,
0.2302767038345337,
0.1546790897846222,
-0.03878729045391083,
0.38579460978507996,
-0.4130840301513672,
0.35940811038017273,
-0.13545823097229004,
0.4855530261993408,
-0.122118279337883,
-0.2300206571817398,
0.09887474775314331,
0.15044830739498138,
-0.01711525395512581,
-0.021802209317684174,
-0.013968504965305328,
-0.25937944650650024,
-0.058237224817276,
0.0227312333881855,
0.5197213292121887,
0.01689060777425766,
-0.16558955609798431,
-0.015898926183581352,
0.06816425919532776,
0.2563197910785675,
-0.26069891452789307,
0.49052777886390686,
-0.19077889621257782,
0.01841624826192856,
-0.19967399537563324,
0.01874571293592453,
-0.20498108863830566,
-0.21508586406707764,
-0.164134681224823,
0.09344439208507538,
-0.03038274496793747,
-0.22404396533966064,
-0.2116939276456833,
0.10314016044139862,
-0.3681343197822571,
-0.0437651127576828,
0.11799006909132004,
0.22933240234851837,
0.18077029287815094,
-0.19614383578300476,
-0.08628876507282257,
-0.20187069475650787,
0.35741427540779114,
0.1934524029493332,
0.11246532201766968,
0.16325931251049042,
-0.05687852203845978,
-0.2155371457338333,
-0.17745190858840942,
-0.29045435786247253,
0.14190825819969177,
0.6505106687545776,
0.6102464199066162,
-0.21627351641654968,
-0.15859898924827576,
0.07914479076862335,
0.002603483386337757,
-0.16527341306209564,
-0.548757016658783,
-0.12850907444953918,
-0.16549962759017944,
-0.44105130434036255,
0.004606112837791443,
0.35849836468696594,
0.3558535575866699,
-0.2264459729194641,
-0.03187551349401474,
0.13872987031936646,
-0.0007013268768787384,
0.37175118923187256,
-0.12976384162902832,
0.015054157003760338,
-0.06641082465648651,
0.225828617811203,
-0.10741686820983887,
0.36735567450523376,
0.24888965487480164,
0.35636386275291443,
0.1917259395122528,
-0.31755685806274414,
0.0706881731748581,
-0.029888737946748734,
0.23143038153648376,
0.11516103148460388,
0.11022848635911942,
0.3546280860900879,
0.1289711445569992,
0.3322555422782898,
-0.19096627831459045,
0.6737229228019714,
-0.007344553247094154,
0.20682765543460846,
-0.8374910354614258,
-0.26737040281295776,
0.33145615458488464,
-0.02635771967470646,
0.19940276443958282,
0.215718075633049,
-0.40385204553604126,
-0.3216697573661804,
0.376661479473114,
0.09908346086740494,
0.7675239443778992,
-0.2972695827484131,
0.39625850319862366,
-0.1552990972995758,
0.6611965894699097,
0.12803049385547638,
-0.3813104033470154,
0.1585618406534195,
-0.39879149198532104,
-0.2663658857345581,
0.21300511062145233,
-0.09231188893318176,
0.036539800465106964,
0.16050389409065247,
-0.2905767560005188,
-0.029811730608344078,
0.0862521380186081,
0.2249334454536438,
0.13066981732845306,
0.5134936571121216,
0.12092680484056473,
-0.6006978154182434,
-0.08281297981739044,
0.02656909078359604,
-0.02340024709701538,
-0.10490188002586365,
-0.0492798313498497,
0.07994647324085236,
-0.0313267819583416,
-0.20856402814388275,
-0.028466172516345978,
0.20525774359703064,
-0.2474464625120163,
0.08661594241857529,
0.06375248730182648,
-0.07205313444137573,
0.5367995500564575,
0.10623051226139069,
-0.001361064612865448,
0.4988958239555359,
-0.039286620914936066,
0.13215835392475128,
-0.2274819314479828,
-0.1652863323688507,
0.20070844888687134,
-0.06584891676902771,
0.4217033088207245,
0.08837933093309402,
-0.0005880966782569885,
0.11410333216190338,
0.0632382407784462,
-0.046690933406353,
0.09476359188556671,
-0.36430907249450684,
0.10549724102020264,
-0.41123154759407043,
-0.21542777121067047,
-0.08843062818050385,
-0.30078285932540894,
-0.1009221225976944,
0.12310943007469177,
0.13735687732696533,
-0.46444618701934814,
0.11514545977115631,
0.2652113139629364,
-0.3750092685222626,
0.011997109279036522,
0.38382449746131897,
0.17105859518051147,
-0.10513918846845627,
0.49984270334243774,
0.4575878381729126,
-0.053361937403678894,
-0.2644973695278168,
-0.10962903499603271,
0.29444822669029236,
-0.2731435000896454,
0.0849163606762886,
-0.2455592304468155,
-0.3016006648540497,
0.209351047873497,
0.08087542653083801,
0.10009974241256714,
-0.01499941200017929,
-0.06326231360435486,
-0.25102943181991577,
-0.6380501389503479,
-0.18144388496875763,
-0.0027230940759181976,
-0.00354844331741333,
0.1460832953453064,
0.27389806509017944,
-0.3100467920303345,
0.5892773270606995,
-0.2788558602333069,
-0.05294197052717209,
-0.20760811865329742,
0.2782232165336609,
-0.055562183260917664,
-0.38554659485816956,
0.21153579652309418,
0.2033519148826599,
0.1001039668917656,
0.08059665560722351,
0.00590919703245163,
-0.22135356068611145,
-0.14351996779441833,
0.11271549016237259,
0.23647010326385498,
-0.41966331005096436,
-0.01599399372935295,
-0.312997043132782,
-0.09248970448970795,
-0.27002182602882385,
0.06606784462928772,
0.017028577625751495,
0.01394578069448471,
-0.22617922723293304,
0.009393874555826187,
0.04752609133720398,
-0.2552624046802521,
0.04206028953194618,
-0.25458529591560364,
0.12509100139141083,
0.2465714067220688,
0.1331031173467636,
0.11783083528280258,
0.0006371289491653442,
-0.3931019604206085,
0.17964592576026917,
0.6661380529403687,
-0.017532095313072205,
0.4190823435783386,
-0.43573224544525146,
-0.0715063214302063,
0.24765951931476593,
0.04980342835187912,
0.048066146671772,
-0.34167730808258057,
-0.010718589648604393,
0.2935883700847626,
0.22681888937950134,
0.015208568423986435,
-0.014733202755451202,
0.22635462880134583,
-0.41129830479621887,
0.1301487535238266,
0.3453426659107208,
-0.11192676424980164,
-0.06747587025165558,
0.1559651792049408,
0.09132310748100281,
0.5066777467727661,
0.11496534198522568,
0.005711604841053486,
0.24894991517066956,
-0.00122002512216568,
0.15485714375972748,
0.48569241166114807,
0.261119544506073,
0.23868051171302795,
0.3016282618045807,
-0.032666049897670746,
-0.04069993644952774,
-0.2312840223312378,
0.2294139564037323,
-0.435617059469223,
-0.41516661643981934,
-0.2674567401409149,
0.5044151544570923,
-0.01932355761528015,
0.12420932948589325,
-0.3350299298763275,
-0.06624119728803635,
-0.04065354913473129,
0.2541331350803375,
-0.11921557784080505,
0.2744082510471344,
-0.45309436321258545,
-0.17059893906116486,
-0.08942428231239319,
-0.12396197021007538,
0.011534325778484344,
0.18963316082954407,
-0.0558583103120327,
0.27227628231048584,
-0.5796654224395752,
0.22938616573810577,
0.05213649570941925,
0.1451501101255417,
-0.1346784234046936,
0.1227787584066391,
0.10550137609243393,
-0.5078572034835815,
0.34333521127700806,
0.23785626888275146,
0.29185950756073,
0.11540549993515015,
-0.22190696001052856,
0.34437036514282227,
0.43669766187667847,
-0.1908072531223297,
-0.04061196744441986,
-0.12098392844200134,
-0.03561992570757866,
-0.1499127894639969,
0.19743536412715912,
0.3490368723869324,
0.18789905309677124,
0.2596159875392914,
0.0557275116443634,
-0.26596614718437195,
0.27851778268814087,
0.06501396000385284,
-0.3240588903427124,
0.17866621911525726,
-0.13293880224227905,
0.4019324481487274,
-0.32858094573020935,
-0.4429645836353302,
0.00986664742231369,
-0.39412444829940796,
0.21558675169944763,
0.6670199036598206,
-0.2954224944114685,
0.28785526752471924,
-0.02548792213201523,
0.04855022579431534,
0.0018409136682748795,
0.47605016827583313,
0.46973514556884766,
0.2841596007347107,
-0.37837129831314087,
-0.025667212903499603,
-0.32888373732566833,
0.2765583097934723,
-0.2024305909872055,
0.06699749082326889,
0.022247930988669395,
0.17079433798789978,
0.16457822918891907,
-0.003302011638879776,
-0.07962261140346527,
-0.013621993362903595,
0.21880324184894562,
-0.19506913423538208,
-0.1675596684217453,
-0.12804758548736572,
0.0020943284034729004,
0.3573179543018341,
-0.025900525972247124,
-0.29754993319511414,
0.15886540710926056,
0.11506294459104538,
0.0991566851735115,
-0.3214535713195801,
0.3626996874809265,
-0.19846373796463013,
-0.02036242187023163,
0.0691281408071518,
-0.15047122538089752,
0.37920957803726196,
-0.22043859958648682,
-0.03304758667945862,
-0.08182770013809204,
0.12814156711101532,
-0.16707712411880493,
-0.22100013494491577,
0.3402222692966461,
0.38842451572418213,
-0.10763649642467499,
0.10821394622325897,
-0.25519275665283203,
-0.08646275848150253,
0.040304481983184814,
-0.36969074606895447,
-0.3087161183357239,
-0.0074881562031805515,
-0.0002531483769416809,
0.008524507284164429,
0.10309776663780212,
0.24583062529563904,
0.10533731430768967,
-0.027840254828333855,
-0.22922900319099426,
-0.1855800449848175,
0.20947544276714325,
-0.2946496903896332,
-0.31304094195365906,
-0.03537982702255249,
0.05562475696206093,
-0.16362905502319336,
0.2511020004749298,
-0.46240702271461487,
0.14574888348579407,
0.22974419593811035,
-0.025514401495456696,
-0.4540731608867645,
0.2232973277568817,
0.2540613114833832,
0.016472186893224716,
-0.20769661664962769,
0.05345691740512848,
0.1526237428188324,
-0.1369924396276474,
-0.20163996517658234,
-0.1757192611694336
] |
https://github.com/huggingface/datasets/issues/633 | Load large text file for LM pre-training resulting in OOM | @lhoestq But despite this, I got lost into the [class Dataset()](https://huggingface.co/docs/datasets/_modules/datasets/arrow_dataset.html#Dataset) reading the pyarrow files.
Edit: but you should be rigth, that it does not have to be related to multiprocessing since it keeps happening when `num_workers=0` | I tried to pretrain Longformer using transformers and datasets. But I got OOM issues with loading a large text file. My script is almost like this:
```python
from datasets import load_dataset
@dataclass
class DataCollatorForDatasetsLanguageModeling(DataCollatorForLanguageModeling):
"""
Data collator used for language modeling based on DataCollatorForLazyLanguageModeling
- collates batches of tensors, honoring their tokenizer's pad_token
- preprocesses batches for masked language modeling
"""
block_size: int = 512
def __call__(self, examples: List[dict]) -> Dict[str, torch.Tensor]:
examples = [example['text'] for example in examples]
batch, attention_mask = self._tensorize_batch(examples)
if self.mlm:
inputs, labels = self.mask_tokens(batch)
return {"input_ids": inputs, "labels": labels}
else:
labels = batch.clone().detach()
if self.tokenizer.pad_token_id is not None:
labels[labels == self.tokenizer.pad_token_id] = -100
return {"input_ids": batch, "labels": labels}
def _tensorize_batch(self, examples: List[str]) -> Tuple[torch.Tensor, torch.Tensor]:
if self.tokenizer._pad_token is None:
raise ValueError(
"You are attempting to pad samples but the tokenizer you are using"
f" ({self.tokenizer.__class__.__name__}) does not have one."
)
tensor_examples = self.tokenizer.batch_encode_plus(
[ex for ex in examples if ex],
max_length=self.block_size,
return_tensors="pt",
pad_to_max_length=True,
return_attention_mask=True,
truncation=True,
)
input_ids, attention_mask = tensor_examples["input_ids"], tensor_examples["attention_mask"]
return input_ids, attention_mask
dataset = load_dataset('text', data_files='train.txt',cache_dir="./", , split='train')
data_collator = DataCollatorForDatasetsLanguageModeling(tokenizer=tokenizer, mlm=True,
mlm_probability=0.15, block_size=tokenizer.max_len)
trainer = Trainer(model=model, args=args, data_collator=data_collator,
train_dataset=train_dataset, prediction_loss_only=True, )
trainer.train(model_path=model_path)
```
This train.txt is about 1.1GB and has 90k lines where each line is a sequence of 4k words.
During training, the memory usage increased fast as the following graph and resulted in OOM before the finish of training.

Could you please give me any suggestions on why this happened and how to fix it?
Thanks. | 37 | Load large text file for LM pre-training resulting in OOM
I tried to pretrain Longformer using transformers and datasets. But I got OOM issues with loading a large text file. My script is almost like this:
```python
from datasets import load_dataset
@dataclass
class DataCollatorForDatasetsLanguageModeling(DataCollatorForLanguageModeling):
"""
Data collator used for language modeling based on DataCollatorForLazyLanguageModeling
- collates batches of tensors, honoring their tokenizer's pad_token
- preprocesses batches for masked language modeling
"""
block_size: int = 512
def __call__(self, examples: List[dict]) -> Dict[str, torch.Tensor]:
examples = [example['text'] for example in examples]
batch, attention_mask = self._tensorize_batch(examples)
if self.mlm:
inputs, labels = self.mask_tokens(batch)
return {"input_ids": inputs, "labels": labels}
else:
labels = batch.clone().detach()
if self.tokenizer.pad_token_id is not None:
labels[labels == self.tokenizer.pad_token_id] = -100
return {"input_ids": batch, "labels": labels}
def _tensorize_batch(self, examples: List[str]) -> Tuple[torch.Tensor, torch.Tensor]:
if self.tokenizer._pad_token is None:
raise ValueError(
"You are attempting to pad samples but the tokenizer you are using"
f" ({self.tokenizer.__class__.__name__}) does not have one."
)
tensor_examples = self.tokenizer.batch_encode_plus(
[ex for ex in examples if ex],
max_length=self.block_size,
return_tensors="pt",
pad_to_max_length=True,
return_attention_mask=True,
truncation=True,
)
input_ids, attention_mask = tensor_examples["input_ids"], tensor_examples["attention_mask"]
return input_ids, attention_mask
dataset = load_dataset('text', data_files='train.txt',cache_dir="./", , split='train')
data_collator = DataCollatorForDatasetsLanguageModeling(tokenizer=tokenizer, mlm=True,
mlm_probability=0.15, block_size=tokenizer.max_len)
trainer = Trainer(model=model, args=args, data_collator=data_collator,
train_dataset=train_dataset, prediction_loss_only=True, )
trainer.train(model_path=model_path)
```
This train.txt is about 1.1GB and has 90k lines where each line is a sequence of 4k words.
During training, the memory usage increased fast as the following graph and resulted in OOM before the finish of training.

Could you please give me any suggestions on why this happened and how to fix it?
Thanks.
@lhoestq But despite this, I got lost into the [class Dataset()](https://huggingface.co/docs/datasets/_modules/datasets/arrow_dataset.html#Dataset) reading the pyarrow files.
Edit: but you should be rigth, that it does not have to be related to multiprocessing since it keeps happening when `num_workers=0` | [
-0.6339283585548401,
-0.47753778100013733,
0.010693363845348358,
0.29863524436950684,
0.36004769802093506,
-0.1518251597881317,
0.5567324757575989,
0.37380579113960266,
0.01088225468993187,
0.010719746351242065,
-0.1295929253101349,
-0.1828002780675888,
-0.26698487997055054,
-0.16208980977535248,
-0.03237204998731613,
0.023206885904073715,
-0.09982117265462875,
0.19687515497207642,
-0.2772675156593323,
-0.09666657447814941,
0.05701180547475815,
-0.07762926816940308,
-0.21276047825813293,
-0.029743991792201996,
-0.3879220187664032,
-0.06171319633722305,
0.3158179223537445,
0.12212134897708893,
-0.1640809327363968,
-0.0958080142736435,
-0.22970141470432281,
0.1197899580001831,
0.4393485188484192,
0.4340214729309082,
-0.00011477212683530524,
0.006616219878196716,
0.18904384970664978,
-0.23633266985416412,
-0.16726946830749512,
0.019216440618038177,
0.07755492627620697,
-0.3022913932800293,
-0.10640020668506622,
-0.3036171495914459,
-0.02724609524011612,
-0.10612530261278152,
-0.015682043507695198,
-0.22437302768230438,
0.4987519383430481,
0.5414043068885803,
0.15876251459121704,
0.25081300735473633,
-0.21366100013256073,
0.0723966509103775,
0.25443702936172485,
0.0488995760679245,
0.1056830957531929,
-0.27951449155807495,
0.46878406405448914,
-0.1923186331987381,
-0.47268855571746826,
0.1478176862001419,
-0.22477363049983978,
-0.20168264210224152,
-0.09508860856294632,
0.03820447996258736,
0.36608895659446716,
0.031569477170705795,
0.2641869783401489,
0.3474210202693939,
0.4272076189517975,
-0.0008120127022266388,
-0.289635568857193,
-0.3209858536720276,
-0.14262455701828003,
-0.08431586623191833,
0.18923655152320862,
0.2010769546031952,
0.059826578944921494,
0.11845916509628296,
0.10712733119726181,
-0.12533129751682281,
-0.15199026465415955,
0.07616106420755386,
-0.27480751276016235,
0.33979544043540955,
-0.20125117897987366,
-0.03804318606853485,
0.15557512640953064,
-0.09447921812534332,
0.19616937637329102,
-0.09977510571479797,
0.003403950482606888,
0.25671419501304626,
-0.245441272854805,
-0.11239507794380188,
-0.07168225198984146,
-0.5194145441055298,
0.16278403997421265,
-0.2759450674057007,
0.1981883943080902,
0.29723939299583435,
-0.08766181021928787,
-0.06761691719293594,
0.08639387786388397,
0.4202020466327667,
-0.25243741273880005,
0.26052793860435486,
0.22725635766983032,
0.16401110589504242,
-0.17170630395412445,
-0.04439859092235565,
-0.33051154017448425,
-0.19624567031860352,
0.10159362852573395,
-0.07734166085720062,
-0.011017010547220707,
-0.2546045482158661,
-0.24042175710201263,
0.05854658782482147,
-0.14076969027519226,
-0.03084544464945793,
0.2748163938522339,
0.38997286558151245,
-0.3540611267089844,
0.4294978082180023,
0.16510933637619019,
0.052328936755657196,
-0.4855332672595978,
-0.33652669191360474,
-0.17440199851989746,
0.15325728058815002,
-0.20324474573135376,
0.038975562900304794,
0.12979257106781006,
0.13963374495506287,
0.05965423583984375,
-0.04288341850042343,
-0.0625898689031601,
-0.44021931290626526,
-0.009444482624530792,
-0.024103429168462753,
0.020752981305122375,
-0.04251480475068092,
0.06302379071712494,
-0.02336559072136879,
0.23476582765579224,
-0.12499457597732544,
-0.025381658226251602,
0.3477915823459625,
-0.2762118875980377,
-0.2276410162448883,
0.05097950994968414,
0.21017630398273468,
-0.02824842929840088,
0.20915503799915314,
0.028506658971309662,
0.07685685157775879,
0.5359783172607422,
0.006653331220149994,
-0.04714777320623398,
-0.3782060742378235,
0.09452182054519653,
0.09201760590076447,
0.1619914025068283,
0.17663070559501648,
-0.042587969452142715,
-0.07260239124298096,
0.0063892244361341,
0.10358665883541107,
0.25504034757614136,
0.3907330334186554,
-0.22647030651569366,
0.2906738817691803,
0.007004471495747566,
-0.05665605142712593,
0.5319919586181641,
-0.2620989978313446,
-0.448444128036499,
0.23385274410247803,
-0.3511556386947632,
0.10818185657262802,
0.22066983580589294,
0.1759030818939209,
0.11388914287090302,
-0.1089852899312973,
0.26901498436927795,
0.3656851649284363,
0.07051589339971542,
0.1209140196442604,
-0.23662437498569489,
-0.09222844988107681,
-0.1715157926082611,
0.48420286178588867,
0.36272403597831726,
-0.02558579295873642,
-0.07308889180421829,
0.35637998580932617,
0.18339842557907104,
-0.1992236077785492,
0.13128061592578888,
0.36934155225753784,
-0.17442509531974792,
-0.1261582374572754,
0.0944812074303627,
0.06559769064188004,
-0.3000325560569763,
-0.07098697125911713,
-0.09084425866603851,
0.0828668475151062,
-0.1136055737733841,
-0.08942607045173645,
0.28255847096443176,
0.02287023328244686,
-0.0766652524471283,
0.11318020522594452,
0.03794129937887192,
-0.13182224333286285,
0.024866361171007156,
-0.07041719555854797,
0.1261971890926361,
0.015421975404024124,
-0.09320687502622604,
0.08736041188240051,
-0.2184159904718399,
-0.12394054979085922,
0.0018030330538749695,
-0.137061208486557,
0.07695000618696213,
0.17527323961257935,
-0.05118799954652786,
0.03840121626853943,
-0.17304009199142456,
0.10695729404687881,
-0.15297769010066986,
-0.2987070679664612,
-0.5071570873260498,
0.43589335680007935,
0.18647874891757965,
-0.33810955286026,
0.3402597904205322,
0.1040273904800415,
-0.029599443078041077,
-0.10627070814371109,
-0.11989574879407883,
0.5749332904815674,
0.27307116985321045,
0.019617579877376556,
0.29909294843673706,
-0.24541117250919342,
0.2542804777622223,
-0.2662392258644104,
-0.10361561179161072,
-0.09776493161916733,
0.4209232032299042,
0.03105533868074417,
0.23506294190883636,
0.14828065037727356,
-0.08694546669721603,
-0.232059508562088,
0.47038108110427856,
-0.1788094937801361,
-0.013872608542442322,
0.26652613282203674,
-0.4247211217880249,
-0.011563490144908428,
-0.34802117943763733,
-0.24947787821292877,
0.0067334845662117004,
0.17322899401187897,
-0.09441326558589935,
-0.055435195565223694,
0.008537785150110722,
-0.26279330253601074,
0.007836148142814636,
0.1532370001077652,
-0.0718524307012558,
0.31983456015586853,
0.11651500314474106,
0.10059522092342377,
-0.122891865670681,
-0.1794070154428482,
0.10284756124019623,
0.17828989028930664,
-0.27519121766090393,
0.18444325029850006,
-0.02282267063856125,
-0.013446485623717308,
-0.2862633764743805,
0.1904245764017105,
-0.12680108845233917,
0.0388152077794075,
-0.0647432953119278,
0.25868889689445496,
-0.07790280133485794,
0.10191172361373901,
0.3001607060432434,
0.3549228012561798,
0.4629628658294678,
-0.07809486240148544,
0.326348215341568,
-0.08266382664442062,
-0.1796954870223999,
0.032943595200777054,
0.33450770378112793,
-0.3179926872253418,
-0.024890778586268425,
0.005377540364861488,
0.05117718130350113,
-0.09892972558736801,
-0.16603437066078186,
0.09468895941972733,
0.196824312210083,
-0.16618932783603668,
-0.2573060691356659,
-0.07217618823051453,
0.17769087851047516,
-0.042431723326444626,
0.11972848325967789,
-0.23244111239910126,
0.008407561108469963,
0.1450573354959488,
-0.006289597600698471,
-0.18432363867759705,
0.04044550284743309,
-0.1199219599366188,
-0.04705164581537247,
-0.411641389131546,
-0.05351852625608444,
0.10705065727233887,
0.13673138618469238,
0.35936760902404785,
0.10678976029157639,
0.19445137679576874,
0.28844478726387024,
0.15859206020832062,
0.006367621943354607,
-0.0885988399386406,
0.5141718983650208,
-0.017572684213519096,
-0.29719802737236023,
-0.2908625900745392,
-0.23975418508052826,
0.02511288784444332,
0.3155249357223511,
-0.684260904788971,
0.23378321528434753,
-0.1138516515493393,
-0.09402675926685333,
-0.3955192267894745,
0.0007258430123329163,
0.2522047758102417,
-0.07614870369434357,
0.016339777037501335,
0.09547417610883713,
0.2302767038345337,
0.1546790897846222,
-0.03878729045391083,
0.38579460978507996,
-0.4130840301513672,
0.35940811038017273,
-0.13545823097229004,
0.4855530261993408,
-0.122118279337883,
-0.2300206571817398,
0.09887474775314331,
0.15044830739498138,
-0.01711525395512581,
-0.021802209317684174,
-0.013968504965305328,
-0.25937944650650024,
-0.058237224817276,
0.0227312333881855,
0.5197213292121887,
0.01689060777425766,
-0.16558955609798431,
-0.015898926183581352,
0.06816425919532776,
0.2563197910785675,
-0.26069891452789307,
0.49052777886390686,
-0.19077889621257782,
0.01841624826192856,
-0.19967399537563324,
0.01874571293592453,
-0.20498108863830566,
-0.21508586406707764,
-0.164134681224823,
0.09344439208507538,
-0.03038274496793747,
-0.22404396533966064,
-0.2116939276456833,
0.10314016044139862,
-0.3681343197822571,
-0.0437651127576828,
0.11799006909132004,
0.22933240234851837,
0.18077029287815094,
-0.19614383578300476,
-0.08628876507282257,
-0.20187069475650787,
0.35741427540779114,
0.1934524029493332,
0.11246532201766968,
0.16325931251049042,
-0.05687852203845978,
-0.2155371457338333,
-0.17745190858840942,
-0.29045435786247253,
0.14190825819969177,
0.6505106687545776,
0.6102464199066162,
-0.21627351641654968,
-0.15859898924827576,
0.07914479076862335,
0.002603483386337757,
-0.16527341306209564,
-0.548757016658783,
-0.12850907444953918,
-0.16549962759017944,
-0.44105130434036255,
0.004606112837791443,
0.35849836468696594,
0.3558535575866699,
-0.2264459729194641,
-0.03187551349401474,
0.13872987031936646,
-0.0007013268768787384,
0.37175118923187256,
-0.12976384162902832,
0.015054157003760338,
-0.06641082465648651,
0.225828617811203,
-0.10741686820983887,
0.36735567450523376,
0.24888965487480164,
0.35636386275291443,
0.1917259395122528,
-0.31755685806274414,
0.0706881731748581,
-0.029888737946748734,
0.23143038153648376,
0.11516103148460388,
0.11022848635911942,
0.3546280860900879,
0.1289711445569992,
0.3322555422782898,
-0.19096627831459045,
0.6737229228019714,
-0.007344553247094154,
0.20682765543460846,
-0.8374910354614258,
-0.26737040281295776,
0.33145615458488464,
-0.02635771967470646,
0.19940276443958282,
0.215718075633049,
-0.40385204553604126,
-0.3216697573661804,
0.376661479473114,
0.09908346086740494,
0.7675239443778992,
-0.2972695827484131,
0.39625850319862366,
-0.1552990972995758,
0.6611965894699097,
0.12803049385547638,
-0.3813104033470154,
0.1585618406534195,
-0.39879149198532104,
-0.2663658857345581,
0.21300511062145233,
-0.09231188893318176,
0.036539800465106964,
0.16050389409065247,
-0.2905767560005188,
-0.029811730608344078,
0.0862521380186081,
0.2249334454536438,
0.13066981732845306,
0.5134936571121216,
0.12092680484056473,
-0.6006978154182434,
-0.08281297981739044,
0.02656909078359604,
-0.02340024709701538,
-0.10490188002586365,
-0.0492798313498497,
0.07994647324085236,
-0.0313267819583416,
-0.20856402814388275,
-0.028466172516345978,
0.20525774359703064,
-0.2474464625120163,
0.08661594241857529,
0.06375248730182648,
-0.07205313444137573,
0.5367995500564575,
0.10623051226139069,
-0.001361064612865448,
0.4988958239555359,
-0.039286620914936066,
0.13215835392475128,
-0.2274819314479828,
-0.1652863323688507,
0.20070844888687134,
-0.06584891676902771,
0.4217033088207245,
0.08837933093309402,
-0.0005880966782569885,
0.11410333216190338,
0.0632382407784462,
-0.046690933406353,
0.09476359188556671,
-0.36430907249450684,
0.10549724102020264,
-0.41123154759407043,
-0.21542777121067047,
-0.08843062818050385,
-0.30078285932540894,
-0.1009221225976944,
0.12310943007469177,
0.13735687732696533,
-0.46444618701934814,
0.11514545977115631,
0.2652113139629364,
-0.3750092685222626,
0.011997109279036522,
0.38382449746131897,
0.17105859518051147,
-0.10513918846845627,
0.49984270334243774,
0.4575878381729126,
-0.053361937403678894,
-0.2644973695278168,
-0.10962903499603271,
0.29444822669029236,
-0.2731435000896454,
0.0849163606762886,
-0.2455592304468155,
-0.3016006648540497,
0.209351047873497,
0.08087542653083801,
0.10009974241256714,
-0.01499941200017929,
-0.06326231360435486,
-0.25102943181991577,
-0.6380501389503479,
-0.18144388496875763,
-0.0027230940759181976,
-0.00354844331741333,
0.1460832953453064,
0.27389806509017944,
-0.3100467920303345,
0.5892773270606995,
-0.2788558602333069,
-0.05294197052717209,
-0.20760811865329742,
0.2782232165336609,
-0.055562183260917664,
-0.38554659485816956,
0.21153579652309418,
0.2033519148826599,
0.1001039668917656,
0.08059665560722351,
0.00590919703245163,
-0.22135356068611145,
-0.14351996779441833,
0.11271549016237259,
0.23647010326385498,
-0.41966331005096436,
-0.01599399372935295,
-0.312997043132782,
-0.09248970448970795,
-0.27002182602882385,
0.06606784462928772,
0.017028577625751495,
0.01394578069448471,
-0.22617922723293304,
0.009393874555826187,
0.04752609133720398,
-0.2552624046802521,
0.04206028953194618,
-0.25458529591560364,
0.12509100139141083,
0.2465714067220688,
0.1331031173467636,
0.11783083528280258,
0.0006371289491653442,
-0.3931019604206085,
0.17964592576026917,
0.6661380529403687,
-0.017532095313072205,
0.4190823435783386,
-0.43573224544525146,
-0.0715063214302063,
0.24765951931476593,
0.04980342835187912,
0.048066146671772,
-0.34167730808258057,
-0.010718589648604393,
0.2935883700847626,
0.22681888937950134,
0.015208568423986435,
-0.014733202755451202,
0.22635462880134583,
-0.41129830479621887,
0.1301487535238266,
0.3453426659107208,
-0.11192676424980164,
-0.06747587025165558,
0.1559651792049408,
0.09132310748100281,
0.5066777467727661,
0.11496534198522568,
0.005711604841053486,
0.24894991517066956,
-0.00122002512216568,
0.15485714375972748,
0.48569241166114807,
0.261119544506073,
0.23868051171302795,
0.3016282618045807,
-0.032666049897670746,
-0.04069993644952774,
-0.2312840223312378,
0.2294139564037323,
-0.435617059469223,
-0.41516661643981934,
-0.2674567401409149,
0.5044151544570923,
-0.01932355761528015,
0.12420932948589325,
-0.3350299298763275,
-0.06624119728803635,
-0.04065354913473129,
0.2541331350803375,
-0.11921557784080505,
0.2744082510471344,
-0.45309436321258545,
-0.17059893906116486,
-0.08942428231239319,
-0.12396197021007538,
0.011534325778484344,
0.18963316082954407,
-0.0558583103120327,
0.27227628231048584,
-0.5796654224395752,
0.22938616573810577,
0.05213649570941925,
0.1451501101255417,
-0.1346784234046936,
0.1227787584066391,
0.10550137609243393,
-0.5078572034835815,
0.34333521127700806,
0.23785626888275146,
0.29185950756073,
0.11540549993515015,
-0.22190696001052856,
0.34437036514282227,
0.43669766187667847,
-0.1908072531223297,
-0.04061196744441986,
-0.12098392844200134,
-0.03561992570757866,
-0.1499127894639969,
0.19743536412715912,
0.3490368723869324,
0.18789905309677124,
0.2596159875392914,
0.0557275116443634,
-0.26596614718437195,
0.27851778268814087,
0.06501396000385284,
-0.3240588903427124,
0.17866621911525726,
-0.13293880224227905,
0.4019324481487274,
-0.32858094573020935,
-0.4429645836353302,
0.00986664742231369,
-0.39412444829940796,
0.21558675169944763,
0.6670199036598206,
-0.2954224944114685,
0.28785526752471924,
-0.02548792213201523,
0.04855022579431534,
0.0018409136682748795,
0.47605016827583313,
0.46973514556884766,
0.2841596007347107,
-0.37837129831314087,
-0.025667212903499603,
-0.32888373732566833,
0.2765583097934723,
-0.2024305909872055,
0.06699749082326889,
0.022247930988669395,
0.17079433798789978,
0.16457822918891907,
-0.003302011638879776,
-0.07962261140346527,
-0.013621993362903595,
0.21880324184894562,
-0.19506913423538208,
-0.1675596684217453,
-0.12804758548736572,
0.0020943284034729004,
0.3573179543018341,
-0.025900525972247124,
-0.29754993319511414,
0.15886540710926056,
0.11506294459104538,
0.0991566851735115,
-0.3214535713195801,
0.3626996874809265,
-0.19846373796463013,
-0.02036242187023163,
0.0691281408071518,
-0.15047122538089752,
0.37920957803726196,
-0.22043859958648682,
-0.03304758667945862,
-0.08182770013809204,
0.12814156711101532,
-0.16707712411880493,
-0.22100013494491577,
0.3402222692966461,
0.38842451572418213,
-0.10763649642467499,
0.10821394622325897,
-0.25519275665283203,
-0.08646275848150253,
0.040304481983184814,
-0.36969074606895447,
-0.3087161183357239,
-0.0074881562031805515,
-0.0002531483769416809,
0.008524507284164429,
0.10309776663780212,
0.24583062529563904,
0.10533731430768967,
-0.027840254828333855,
-0.22922900319099426,
-0.1855800449848175,
0.20947544276714325,
-0.2946496903896332,
-0.31304094195365906,
-0.03537982702255249,
0.05562475696206093,
-0.16362905502319336,
0.2511020004749298,
-0.46240702271461487,
0.14574888348579407,
0.22974419593811035,
-0.025514401495456696,
-0.4540731608867645,
0.2232973277568817,
0.2540613114833832,
0.016472186893224716,
-0.20769661664962769,
0.05345691740512848,
0.1526237428188324,
-0.1369924396276474,
-0.20163996517658234,
-0.1757192611694336
] |
https://github.com/huggingface/datasets/issues/633 | Load large text file for LM pre-training resulting in OOM | Or maybe wandb uses multiprocessing ? One process for wandb logging and one for actual training ? If this is the case then even setting `num_workers=0` would cause the process to be forked for wandb and therefore cause the memory issue. | I tried to pretrain Longformer using transformers and datasets. But I got OOM issues with loading a large text file. My script is almost like this:
```python
from datasets import load_dataset
@dataclass
class DataCollatorForDatasetsLanguageModeling(DataCollatorForLanguageModeling):
"""
Data collator used for language modeling based on DataCollatorForLazyLanguageModeling
- collates batches of tensors, honoring their tokenizer's pad_token
- preprocesses batches for masked language modeling
"""
block_size: int = 512
def __call__(self, examples: List[dict]) -> Dict[str, torch.Tensor]:
examples = [example['text'] for example in examples]
batch, attention_mask = self._tensorize_batch(examples)
if self.mlm:
inputs, labels = self.mask_tokens(batch)
return {"input_ids": inputs, "labels": labels}
else:
labels = batch.clone().detach()
if self.tokenizer.pad_token_id is not None:
labels[labels == self.tokenizer.pad_token_id] = -100
return {"input_ids": batch, "labels": labels}
def _tensorize_batch(self, examples: List[str]) -> Tuple[torch.Tensor, torch.Tensor]:
if self.tokenizer._pad_token is None:
raise ValueError(
"You are attempting to pad samples but the tokenizer you are using"
f" ({self.tokenizer.__class__.__name__}) does not have one."
)
tensor_examples = self.tokenizer.batch_encode_plus(
[ex for ex in examples if ex],
max_length=self.block_size,
return_tensors="pt",
pad_to_max_length=True,
return_attention_mask=True,
truncation=True,
)
input_ids, attention_mask = tensor_examples["input_ids"], tensor_examples["attention_mask"]
return input_ids, attention_mask
dataset = load_dataset('text', data_files='train.txt',cache_dir="./", , split='train')
data_collator = DataCollatorForDatasetsLanguageModeling(tokenizer=tokenizer, mlm=True,
mlm_probability=0.15, block_size=tokenizer.max_len)
trainer = Trainer(model=model, args=args, data_collator=data_collator,
train_dataset=train_dataset, prediction_loss_only=True, )
trainer.train(model_path=model_path)
```
This train.txt is about 1.1GB and has 90k lines where each line is a sequence of 4k words.
During training, the memory usage increased fast as the following graph and resulted in OOM before the finish of training.

Could you please give me any suggestions on why this happened and how to fix it?
Thanks. | 41 | Load large text file for LM pre-training resulting in OOM
I tried to pretrain Longformer using transformers and datasets. But I got OOM issues with loading a large text file. My script is almost like this:
```python
from datasets import load_dataset
@dataclass
class DataCollatorForDatasetsLanguageModeling(DataCollatorForLanguageModeling):
"""
Data collator used for language modeling based on DataCollatorForLazyLanguageModeling
- collates batches of tensors, honoring their tokenizer's pad_token
- preprocesses batches for masked language modeling
"""
block_size: int = 512
def __call__(self, examples: List[dict]) -> Dict[str, torch.Tensor]:
examples = [example['text'] for example in examples]
batch, attention_mask = self._tensorize_batch(examples)
if self.mlm:
inputs, labels = self.mask_tokens(batch)
return {"input_ids": inputs, "labels": labels}
else:
labels = batch.clone().detach()
if self.tokenizer.pad_token_id is not None:
labels[labels == self.tokenizer.pad_token_id] = -100
return {"input_ids": batch, "labels": labels}
def _tensorize_batch(self, examples: List[str]) -> Tuple[torch.Tensor, torch.Tensor]:
if self.tokenizer._pad_token is None:
raise ValueError(
"You are attempting to pad samples but the tokenizer you are using"
f" ({self.tokenizer.__class__.__name__}) does not have one."
)
tensor_examples = self.tokenizer.batch_encode_plus(
[ex for ex in examples if ex],
max_length=self.block_size,
return_tensors="pt",
pad_to_max_length=True,
return_attention_mask=True,
truncation=True,
)
input_ids, attention_mask = tensor_examples["input_ids"], tensor_examples["attention_mask"]
return input_ids, attention_mask
dataset = load_dataset('text', data_files='train.txt',cache_dir="./", , split='train')
data_collator = DataCollatorForDatasetsLanguageModeling(tokenizer=tokenizer, mlm=True,
mlm_probability=0.15, block_size=tokenizer.max_len)
trainer = Trainer(model=model, args=args, data_collator=data_collator,
train_dataset=train_dataset, prediction_loss_only=True, )
trainer.train(model_path=model_path)
```
This train.txt is about 1.1GB and has 90k lines where each line is a sequence of 4k words.
During training, the memory usage increased fast as the following graph and resulted in OOM before the finish of training.

Could you please give me any suggestions on why this happened and how to fix it?
Thanks.
Or maybe wandb uses multiprocessing ? One process for wandb logging and one for actual training ? If this is the case then even setting `num_workers=0` would cause the process to be forked for wandb and therefore cause the memory issue. | [
-0.6339283585548401,
-0.47753778100013733,
0.010693363845348358,
0.29863524436950684,
0.36004769802093506,
-0.1518251597881317,
0.5567324757575989,
0.37380579113960266,
0.01088225468993187,
0.010719746351242065,
-0.1295929253101349,
-0.1828002780675888,
-0.26698487997055054,
-0.16208980977535248,
-0.03237204998731613,
0.023206885904073715,
-0.09982117265462875,
0.19687515497207642,
-0.2772675156593323,
-0.09666657447814941,
0.05701180547475815,
-0.07762926816940308,
-0.21276047825813293,
-0.029743991792201996,
-0.3879220187664032,
-0.06171319633722305,
0.3158179223537445,
0.12212134897708893,
-0.1640809327363968,
-0.0958080142736435,
-0.22970141470432281,
0.1197899580001831,
0.4393485188484192,
0.4340214729309082,
-0.00011477212683530524,
0.006616219878196716,
0.18904384970664978,
-0.23633266985416412,
-0.16726946830749512,
0.019216440618038177,
0.07755492627620697,
-0.3022913932800293,
-0.10640020668506622,
-0.3036171495914459,
-0.02724609524011612,
-0.10612530261278152,
-0.015682043507695198,
-0.22437302768230438,
0.4987519383430481,
0.5414043068885803,
0.15876251459121704,
0.25081300735473633,
-0.21366100013256073,
0.0723966509103775,
0.25443702936172485,
0.0488995760679245,
0.1056830957531929,
-0.27951449155807495,
0.46878406405448914,
-0.1923186331987381,
-0.47268855571746826,
0.1478176862001419,
-0.22477363049983978,
-0.20168264210224152,
-0.09508860856294632,
0.03820447996258736,
0.36608895659446716,
0.031569477170705795,
0.2641869783401489,
0.3474210202693939,
0.4272076189517975,
-0.0008120127022266388,
-0.289635568857193,
-0.3209858536720276,
-0.14262455701828003,
-0.08431586623191833,
0.18923655152320862,
0.2010769546031952,
0.059826578944921494,
0.11845916509628296,
0.10712733119726181,
-0.12533129751682281,
-0.15199026465415955,
0.07616106420755386,
-0.27480751276016235,
0.33979544043540955,
-0.20125117897987366,
-0.03804318606853485,
0.15557512640953064,
-0.09447921812534332,
0.19616937637329102,
-0.09977510571479797,
0.003403950482606888,
0.25671419501304626,
-0.245441272854805,
-0.11239507794380188,
-0.07168225198984146,
-0.5194145441055298,
0.16278403997421265,
-0.2759450674057007,
0.1981883943080902,
0.29723939299583435,
-0.08766181021928787,
-0.06761691719293594,
0.08639387786388397,
0.4202020466327667,
-0.25243741273880005,
0.26052793860435486,
0.22725635766983032,
0.16401110589504242,
-0.17170630395412445,
-0.04439859092235565,
-0.33051154017448425,
-0.19624567031860352,
0.10159362852573395,
-0.07734166085720062,
-0.011017010547220707,
-0.2546045482158661,
-0.24042175710201263,
0.05854658782482147,
-0.14076969027519226,
-0.03084544464945793,
0.2748163938522339,
0.38997286558151245,
-0.3540611267089844,
0.4294978082180023,
0.16510933637619019,
0.052328936755657196,
-0.4855332672595978,
-0.33652669191360474,
-0.17440199851989746,
0.15325728058815002,
-0.20324474573135376,
0.038975562900304794,
0.12979257106781006,
0.13963374495506287,
0.05965423583984375,
-0.04288341850042343,
-0.0625898689031601,
-0.44021931290626526,
-0.009444482624530792,
-0.024103429168462753,
0.020752981305122375,
-0.04251480475068092,
0.06302379071712494,
-0.02336559072136879,
0.23476582765579224,
-0.12499457597732544,
-0.025381658226251602,
0.3477915823459625,
-0.2762118875980377,
-0.2276410162448883,
0.05097950994968414,
0.21017630398273468,
-0.02824842929840088,
0.20915503799915314,
0.028506658971309662,
0.07685685157775879,
0.5359783172607422,
0.006653331220149994,
-0.04714777320623398,
-0.3782060742378235,
0.09452182054519653,
0.09201760590076447,
0.1619914025068283,
0.17663070559501648,
-0.042587969452142715,
-0.07260239124298096,
0.0063892244361341,
0.10358665883541107,
0.25504034757614136,
0.3907330334186554,
-0.22647030651569366,
0.2906738817691803,
0.007004471495747566,
-0.05665605142712593,
0.5319919586181641,
-0.2620989978313446,
-0.448444128036499,
0.23385274410247803,
-0.3511556386947632,
0.10818185657262802,
0.22066983580589294,
0.1759030818939209,
0.11388914287090302,
-0.1089852899312973,
0.26901498436927795,
0.3656851649284363,
0.07051589339971542,
0.1209140196442604,
-0.23662437498569489,
-0.09222844988107681,
-0.1715157926082611,
0.48420286178588867,
0.36272403597831726,
-0.02558579295873642,
-0.07308889180421829,
0.35637998580932617,
0.18339842557907104,
-0.1992236077785492,
0.13128061592578888,
0.36934155225753784,
-0.17442509531974792,
-0.1261582374572754,
0.0944812074303627,
0.06559769064188004,
-0.3000325560569763,
-0.07098697125911713,
-0.09084425866603851,
0.0828668475151062,
-0.1136055737733841,
-0.08942607045173645,
0.28255847096443176,
0.02287023328244686,
-0.0766652524471283,
0.11318020522594452,
0.03794129937887192,
-0.13182224333286285,
0.024866361171007156,
-0.07041719555854797,
0.1261971890926361,
0.015421975404024124,
-0.09320687502622604,
0.08736041188240051,
-0.2184159904718399,
-0.12394054979085922,
0.0018030330538749695,
-0.137061208486557,
0.07695000618696213,
0.17527323961257935,
-0.05118799954652786,
0.03840121626853943,
-0.17304009199142456,
0.10695729404687881,
-0.15297769010066986,
-0.2987070679664612,
-0.5071570873260498,
0.43589335680007935,
0.18647874891757965,
-0.33810955286026,
0.3402597904205322,
0.1040273904800415,
-0.029599443078041077,
-0.10627070814371109,
-0.11989574879407883,
0.5749332904815674,
0.27307116985321045,
0.019617579877376556,
0.29909294843673706,
-0.24541117250919342,
0.2542804777622223,
-0.2662392258644104,
-0.10361561179161072,
-0.09776493161916733,
0.4209232032299042,
0.03105533868074417,
0.23506294190883636,
0.14828065037727356,
-0.08694546669721603,
-0.232059508562088,
0.47038108110427856,
-0.1788094937801361,
-0.013872608542442322,
0.26652613282203674,
-0.4247211217880249,
-0.011563490144908428,
-0.34802117943763733,
-0.24947787821292877,
0.0067334845662117004,
0.17322899401187897,
-0.09441326558589935,
-0.055435195565223694,
0.008537785150110722,
-0.26279330253601074,
0.007836148142814636,
0.1532370001077652,
-0.0718524307012558,
0.31983456015586853,
0.11651500314474106,
0.10059522092342377,
-0.122891865670681,
-0.1794070154428482,
0.10284756124019623,
0.17828989028930664,
-0.27519121766090393,
0.18444325029850006,
-0.02282267063856125,
-0.013446485623717308,
-0.2862633764743805,
0.1904245764017105,
-0.12680108845233917,
0.0388152077794075,
-0.0647432953119278,
0.25868889689445496,
-0.07790280133485794,
0.10191172361373901,
0.3001607060432434,
0.3549228012561798,
0.4629628658294678,
-0.07809486240148544,
0.326348215341568,
-0.08266382664442062,
-0.1796954870223999,
0.032943595200777054,
0.33450770378112793,
-0.3179926872253418,
-0.024890778586268425,
0.005377540364861488,
0.05117718130350113,
-0.09892972558736801,
-0.16603437066078186,
0.09468895941972733,
0.196824312210083,
-0.16618932783603668,
-0.2573060691356659,
-0.07217618823051453,
0.17769087851047516,
-0.042431723326444626,
0.11972848325967789,
-0.23244111239910126,
0.008407561108469963,
0.1450573354959488,
-0.006289597600698471,
-0.18432363867759705,
0.04044550284743309,
-0.1199219599366188,
-0.04705164581537247,
-0.411641389131546,
-0.05351852625608444,
0.10705065727233887,
0.13673138618469238,
0.35936760902404785,
0.10678976029157639,
0.19445137679576874,
0.28844478726387024,
0.15859206020832062,
0.006367621943354607,
-0.0885988399386406,
0.5141718983650208,
-0.017572684213519096,
-0.29719802737236023,
-0.2908625900745392,
-0.23975418508052826,
0.02511288784444332,
0.3155249357223511,
-0.684260904788971,
0.23378321528434753,
-0.1138516515493393,
-0.09402675926685333,
-0.3955192267894745,
0.0007258430123329163,
0.2522047758102417,
-0.07614870369434357,
0.016339777037501335,
0.09547417610883713,
0.2302767038345337,
0.1546790897846222,
-0.03878729045391083,
0.38579460978507996,
-0.4130840301513672,
0.35940811038017273,
-0.13545823097229004,
0.4855530261993408,
-0.122118279337883,
-0.2300206571817398,
0.09887474775314331,
0.15044830739498138,
-0.01711525395512581,
-0.021802209317684174,
-0.013968504965305328,
-0.25937944650650024,
-0.058237224817276,
0.0227312333881855,
0.5197213292121887,
0.01689060777425766,
-0.16558955609798431,
-0.015898926183581352,
0.06816425919532776,
0.2563197910785675,
-0.26069891452789307,
0.49052777886390686,
-0.19077889621257782,
0.01841624826192856,
-0.19967399537563324,
0.01874571293592453,
-0.20498108863830566,
-0.21508586406707764,
-0.164134681224823,
0.09344439208507538,
-0.03038274496793747,
-0.22404396533966064,
-0.2116939276456833,
0.10314016044139862,
-0.3681343197822571,
-0.0437651127576828,
0.11799006909132004,
0.22933240234851837,
0.18077029287815094,
-0.19614383578300476,
-0.08628876507282257,
-0.20187069475650787,
0.35741427540779114,
0.1934524029493332,
0.11246532201766968,
0.16325931251049042,
-0.05687852203845978,
-0.2155371457338333,
-0.17745190858840942,
-0.29045435786247253,
0.14190825819969177,
0.6505106687545776,
0.6102464199066162,
-0.21627351641654968,
-0.15859898924827576,
0.07914479076862335,
0.002603483386337757,
-0.16527341306209564,
-0.548757016658783,
-0.12850907444953918,
-0.16549962759017944,
-0.44105130434036255,
0.004606112837791443,
0.35849836468696594,
0.3558535575866699,
-0.2264459729194641,
-0.03187551349401474,
0.13872987031936646,
-0.0007013268768787384,
0.37175118923187256,
-0.12976384162902832,
0.015054157003760338,
-0.06641082465648651,
0.225828617811203,
-0.10741686820983887,
0.36735567450523376,
0.24888965487480164,
0.35636386275291443,
0.1917259395122528,
-0.31755685806274414,
0.0706881731748581,
-0.029888737946748734,
0.23143038153648376,
0.11516103148460388,
0.11022848635911942,
0.3546280860900879,
0.1289711445569992,
0.3322555422782898,
-0.19096627831459045,
0.6737229228019714,
-0.007344553247094154,
0.20682765543460846,
-0.8374910354614258,
-0.26737040281295776,
0.33145615458488464,
-0.02635771967470646,
0.19940276443958282,
0.215718075633049,
-0.40385204553604126,
-0.3216697573661804,
0.376661479473114,
0.09908346086740494,
0.7675239443778992,
-0.2972695827484131,
0.39625850319862366,
-0.1552990972995758,
0.6611965894699097,
0.12803049385547638,
-0.3813104033470154,
0.1585618406534195,
-0.39879149198532104,
-0.2663658857345581,
0.21300511062145233,
-0.09231188893318176,
0.036539800465106964,
0.16050389409065247,
-0.2905767560005188,
-0.029811730608344078,
0.0862521380186081,
0.2249334454536438,
0.13066981732845306,
0.5134936571121216,
0.12092680484056473,
-0.6006978154182434,
-0.08281297981739044,
0.02656909078359604,
-0.02340024709701538,
-0.10490188002586365,
-0.0492798313498497,
0.07994647324085236,
-0.0313267819583416,
-0.20856402814388275,
-0.028466172516345978,
0.20525774359703064,
-0.2474464625120163,
0.08661594241857529,
0.06375248730182648,
-0.07205313444137573,
0.5367995500564575,
0.10623051226139069,
-0.001361064612865448,
0.4988958239555359,
-0.039286620914936066,
0.13215835392475128,
-0.2274819314479828,
-0.1652863323688507,
0.20070844888687134,
-0.06584891676902771,
0.4217033088207245,
0.08837933093309402,
-0.0005880966782569885,
0.11410333216190338,
0.0632382407784462,
-0.046690933406353,
0.09476359188556671,
-0.36430907249450684,
0.10549724102020264,
-0.41123154759407043,
-0.21542777121067047,
-0.08843062818050385,
-0.30078285932540894,
-0.1009221225976944,
0.12310943007469177,
0.13735687732696533,
-0.46444618701934814,
0.11514545977115631,
0.2652113139629364,
-0.3750092685222626,
0.011997109279036522,
0.38382449746131897,
0.17105859518051147,
-0.10513918846845627,
0.49984270334243774,
0.4575878381729126,
-0.053361937403678894,
-0.2644973695278168,
-0.10962903499603271,
0.29444822669029236,
-0.2731435000896454,
0.0849163606762886,
-0.2455592304468155,
-0.3016006648540497,
0.209351047873497,
0.08087542653083801,
0.10009974241256714,
-0.01499941200017929,
-0.06326231360435486,
-0.25102943181991577,
-0.6380501389503479,
-0.18144388496875763,
-0.0027230940759181976,
-0.00354844331741333,
0.1460832953453064,
0.27389806509017944,
-0.3100467920303345,
0.5892773270606995,
-0.2788558602333069,
-0.05294197052717209,
-0.20760811865329742,
0.2782232165336609,
-0.055562183260917664,
-0.38554659485816956,
0.21153579652309418,
0.2033519148826599,
0.1001039668917656,
0.08059665560722351,
0.00590919703245163,
-0.22135356068611145,
-0.14351996779441833,
0.11271549016237259,
0.23647010326385498,
-0.41966331005096436,
-0.01599399372935295,
-0.312997043132782,
-0.09248970448970795,
-0.27002182602882385,
0.06606784462928772,
0.017028577625751495,
0.01394578069448471,
-0.22617922723293304,
0.009393874555826187,
0.04752609133720398,
-0.2552624046802521,
0.04206028953194618,
-0.25458529591560364,
0.12509100139141083,
0.2465714067220688,
0.1331031173467636,
0.11783083528280258,
0.0006371289491653442,
-0.3931019604206085,
0.17964592576026917,
0.6661380529403687,
-0.017532095313072205,
0.4190823435783386,
-0.43573224544525146,
-0.0715063214302063,
0.24765951931476593,
0.04980342835187912,
0.048066146671772,
-0.34167730808258057,
-0.010718589648604393,
0.2935883700847626,
0.22681888937950134,
0.015208568423986435,
-0.014733202755451202,
0.22635462880134583,
-0.41129830479621887,
0.1301487535238266,
0.3453426659107208,
-0.11192676424980164,
-0.06747587025165558,
0.1559651792049408,
0.09132310748100281,
0.5066777467727661,
0.11496534198522568,
0.005711604841053486,
0.24894991517066956,
-0.00122002512216568,
0.15485714375972748,
0.48569241166114807,
0.261119544506073,
0.23868051171302795,
0.3016282618045807,
-0.032666049897670746,
-0.04069993644952774,
-0.2312840223312378,
0.2294139564037323,
-0.435617059469223,
-0.41516661643981934,
-0.2674567401409149,
0.5044151544570923,
-0.01932355761528015,
0.12420932948589325,
-0.3350299298763275,
-0.06624119728803635,
-0.04065354913473129,
0.2541331350803375,
-0.11921557784080505,
0.2744082510471344,
-0.45309436321258545,
-0.17059893906116486,
-0.08942428231239319,
-0.12396197021007538,
0.011534325778484344,
0.18963316082954407,
-0.0558583103120327,
0.27227628231048584,
-0.5796654224395752,
0.22938616573810577,
0.05213649570941925,
0.1451501101255417,
-0.1346784234046936,
0.1227787584066391,
0.10550137609243393,
-0.5078572034835815,
0.34333521127700806,
0.23785626888275146,
0.29185950756073,
0.11540549993515015,
-0.22190696001052856,
0.34437036514282227,
0.43669766187667847,
-0.1908072531223297,
-0.04061196744441986,
-0.12098392844200134,
-0.03561992570757866,
-0.1499127894639969,
0.19743536412715912,
0.3490368723869324,
0.18789905309677124,
0.2596159875392914,
0.0557275116443634,
-0.26596614718437195,
0.27851778268814087,
0.06501396000385284,
-0.3240588903427124,
0.17866621911525726,
-0.13293880224227905,
0.4019324481487274,
-0.32858094573020935,
-0.4429645836353302,
0.00986664742231369,
-0.39412444829940796,
0.21558675169944763,
0.6670199036598206,
-0.2954224944114685,
0.28785526752471924,
-0.02548792213201523,
0.04855022579431534,
0.0018409136682748795,
0.47605016827583313,
0.46973514556884766,
0.2841596007347107,
-0.37837129831314087,
-0.025667212903499603,
-0.32888373732566833,
0.2765583097934723,
-0.2024305909872055,
0.06699749082326889,
0.022247930988669395,
0.17079433798789978,
0.16457822918891907,
-0.003302011638879776,
-0.07962261140346527,
-0.013621993362903595,
0.21880324184894562,
-0.19506913423538208,
-0.1675596684217453,
-0.12804758548736572,
0.0020943284034729004,
0.3573179543018341,
-0.025900525972247124,
-0.29754993319511414,
0.15886540710926056,
0.11506294459104538,
0.0991566851735115,
-0.3214535713195801,
0.3626996874809265,
-0.19846373796463013,
-0.02036242187023163,
0.0691281408071518,
-0.15047122538089752,
0.37920957803726196,
-0.22043859958648682,
-0.03304758667945862,
-0.08182770013809204,
0.12814156711101532,
-0.16707712411880493,
-0.22100013494491577,
0.3402222692966461,
0.38842451572418213,
-0.10763649642467499,
0.10821394622325897,
-0.25519275665283203,
-0.08646275848150253,
0.040304481983184814,
-0.36969074606895447,
-0.3087161183357239,
-0.0074881562031805515,
-0.0002531483769416809,
0.008524507284164429,
0.10309776663780212,
0.24583062529563904,
0.10533731430768967,
-0.027840254828333855,
-0.22922900319099426,
-0.1855800449848175,
0.20947544276714325,
-0.2946496903896332,
-0.31304094195365906,
-0.03537982702255249,
0.05562475696206093,
-0.16362905502319336,
0.2511020004749298,
-0.46240702271461487,
0.14574888348579407,
0.22974419593811035,
-0.025514401495456696,
-0.4540731608867645,
0.2232973277568817,
0.2540613114833832,
0.016472186893224716,
-0.20769661664962769,
0.05345691740512848,
0.1526237428188324,
-0.1369924396276474,
-0.20163996517658234,
-0.1757192611694336
] |
https://github.com/huggingface/datasets/issues/633 | Load large text file for LM pre-training resulting in OOM | @lhoestq could be, but if we set wandb to false this should not happen. I am going to try. | I tried to pretrain Longformer using transformers and datasets. But I got OOM issues with loading a large text file. My script is almost like this:
```python
from datasets import load_dataset
@dataclass
class DataCollatorForDatasetsLanguageModeling(DataCollatorForLanguageModeling):
"""
Data collator used for language modeling based on DataCollatorForLazyLanguageModeling
- collates batches of tensors, honoring their tokenizer's pad_token
- preprocesses batches for masked language modeling
"""
block_size: int = 512
def __call__(self, examples: List[dict]) -> Dict[str, torch.Tensor]:
examples = [example['text'] for example in examples]
batch, attention_mask = self._tensorize_batch(examples)
if self.mlm:
inputs, labels = self.mask_tokens(batch)
return {"input_ids": inputs, "labels": labels}
else:
labels = batch.clone().detach()
if self.tokenizer.pad_token_id is not None:
labels[labels == self.tokenizer.pad_token_id] = -100
return {"input_ids": batch, "labels": labels}
def _tensorize_batch(self, examples: List[str]) -> Tuple[torch.Tensor, torch.Tensor]:
if self.tokenizer._pad_token is None:
raise ValueError(
"You are attempting to pad samples but the tokenizer you are using"
f" ({self.tokenizer.__class__.__name__}) does not have one."
)
tensor_examples = self.tokenizer.batch_encode_plus(
[ex for ex in examples if ex],
max_length=self.block_size,
return_tensors="pt",
pad_to_max_length=True,
return_attention_mask=True,
truncation=True,
)
input_ids, attention_mask = tensor_examples["input_ids"], tensor_examples["attention_mask"]
return input_ids, attention_mask
dataset = load_dataset('text', data_files='train.txt',cache_dir="./", , split='train')
data_collator = DataCollatorForDatasetsLanguageModeling(tokenizer=tokenizer, mlm=True,
mlm_probability=0.15, block_size=tokenizer.max_len)
trainer = Trainer(model=model, args=args, data_collator=data_collator,
train_dataset=train_dataset, prediction_loss_only=True, )
trainer.train(model_path=model_path)
```
This train.txt is about 1.1GB and has 90k lines where each line is a sequence of 4k words.
During training, the memory usage increased fast as the following graph and resulted in OOM before the finish of training.

Could you please give me any suggestions on why this happened and how to fix it?
Thanks. | 19 | Load large text file for LM pre-training resulting in OOM
I tried to pretrain Longformer using transformers and datasets. But I got OOM issues with loading a large text file. My script is almost like this:
```python
from datasets import load_dataset
@dataclass
class DataCollatorForDatasetsLanguageModeling(DataCollatorForLanguageModeling):
"""
Data collator used for language modeling based on DataCollatorForLazyLanguageModeling
- collates batches of tensors, honoring their tokenizer's pad_token
- preprocesses batches for masked language modeling
"""
block_size: int = 512
def __call__(self, examples: List[dict]) -> Dict[str, torch.Tensor]:
examples = [example['text'] for example in examples]
batch, attention_mask = self._tensorize_batch(examples)
if self.mlm:
inputs, labels = self.mask_tokens(batch)
return {"input_ids": inputs, "labels": labels}
else:
labels = batch.clone().detach()
if self.tokenizer.pad_token_id is not None:
labels[labels == self.tokenizer.pad_token_id] = -100
return {"input_ids": batch, "labels": labels}
def _tensorize_batch(self, examples: List[str]) -> Tuple[torch.Tensor, torch.Tensor]:
if self.tokenizer._pad_token is None:
raise ValueError(
"You are attempting to pad samples but the tokenizer you are using"
f" ({self.tokenizer.__class__.__name__}) does not have one."
)
tensor_examples = self.tokenizer.batch_encode_plus(
[ex for ex in examples if ex],
max_length=self.block_size,
return_tensors="pt",
pad_to_max_length=True,
return_attention_mask=True,
truncation=True,
)
input_ids, attention_mask = tensor_examples["input_ids"], tensor_examples["attention_mask"]
return input_ids, attention_mask
dataset = load_dataset('text', data_files='train.txt',cache_dir="./", , split='train')
data_collator = DataCollatorForDatasetsLanguageModeling(tokenizer=tokenizer, mlm=True,
mlm_probability=0.15, block_size=tokenizer.max_len)
trainer = Trainer(model=model, args=args, data_collator=data_collator,
train_dataset=train_dataset, prediction_loss_only=True, )
trainer.train(model_path=model_path)
```
This train.txt is about 1.1GB and has 90k lines where each line is a sequence of 4k words.
During training, the memory usage increased fast as the following graph and resulted in OOM before the finish of training.

Could you please give me any suggestions on why this happened and how to fix it?
Thanks.
@lhoestq could be, but if we set wandb to false this should not happen. I am going to try. | [
-0.6339283585548401,
-0.47753778100013733,
0.010693363845348358,
0.29863524436950684,
0.36004769802093506,
-0.1518251597881317,
0.5567324757575989,
0.37380579113960266,
0.01088225468993187,
0.010719746351242065,
-0.1295929253101349,
-0.1828002780675888,
-0.26698487997055054,
-0.16208980977535248,
-0.03237204998731613,
0.023206885904073715,
-0.09982117265462875,
0.19687515497207642,
-0.2772675156593323,
-0.09666657447814941,
0.05701180547475815,
-0.07762926816940308,
-0.21276047825813293,
-0.029743991792201996,
-0.3879220187664032,
-0.06171319633722305,
0.3158179223537445,
0.12212134897708893,
-0.1640809327363968,
-0.0958080142736435,
-0.22970141470432281,
0.1197899580001831,
0.4393485188484192,
0.4340214729309082,
-0.00011477212683530524,
0.006616219878196716,
0.18904384970664978,
-0.23633266985416412,
-0.16726946830749512,
0.019216440618038177,
0.07755492627620697,
-0.3022913932800293,
-0.10640020668506622,
-0.3036171495914459,
-0.02724609524011612,
-0.10612530261278152,
-0.015682043507695198,
-0.22437302768230438,
0.4987519383430481,
0.5414043068885803,
0.15876251459121704,
0.25081300735473633,
-0.21366100013256073,
0.0723966509103775,
0.25443702936172485,
0.0488995760679245,
0.1056830957531929,
-0.27951449155807495,
0.46878406405448914,
-0.1923186331987381,
-0.47268855571746826,
0.1478176862001419,
-0.22477363049983978,
-0.20168264210224152,
-0.09508860856294632,
0.03820447996258736,
0.36608895659446716,
0.031569477170705795,
0.2641869783401489,
0.3474210202693939,
0.4272076189517975,
-0.0008120127022266388,
-0.289635568857193,
-0.3209858536720276,
-0.14262455701828003,
-0.08431586623191833,
0.18923655152320862,
0.2010769546031952,
0.059826578944921494,
0.11845916509628296,
0.10712733119726181,
-0.12533129751682281,
-0.15199026465415955,
0.07616106420755386,
-0.27480751276016235,
0.33979544043540955,
-0.20125117897987366,
-0.03804318606853485,
0.15557512640953064,
-0.09447921812534332,
0.19616937637329102,
-0.09977510571479797,
0.003403950482606888,
0.25671419501304626,
-0.245441272854805,
-0.11239507794380188,
-0.07168225198984146,
-0.5194145441055298,
0.16278403997421265,
-0.2759450674057007,
0.1981883943080902,
0.29723939299583435,
-0.08766181021928787,
-0.06761691719293594,
0.08639387786388397,
0.4202020466327667,
-0.25243741273880005,
0.26052793860435486,
0.22725635766983032,
0.16401110589504242,
-0.17170630395412445,
-0.04439859092235565,
-0.33051154017448425,
-0.19624567031860352,
0.10159362852573395,
-0.07734166085720062,
-0.011017010547220707,
-0.2546045482158661,
-0.24042175710201263,
0.05854658782482147,
-0.14076969027519226,
-0.03084544464945793,
0.2748163938522339,
0.38997286558151245,
-0.3540611267089844,
0.4294978082180023,
0.16510933637619019,
0.052328936755657196,
-0.4855332672595978,
-0.33652669191360474,
-0.17440199851989746,
0.15325728058815002,
-0.20324474573135376,
0.038975562900304794,
0.12979257106781006,
0.13963374495506287,
0.05965423583984375,
-0.04288341850042343,
-0.0625898689031601,
-0.44021931290626526,
-0.009444482624530792,
-0.024103429168462753,
0.020752981305122375,
-0.04251480475068092,
0.06302379071712494,
-0.02336559072136879,
0.23476582765579224,
-0.12499457597732544,
-0.025381658226251602,
0.3477915823459625,
-0.2762118875980377,
-0.2276410162448883,
0.05097950994968414,
0.21017630398273468,
-0.02824842929840088,
0.20915503799915314,
0.028506658971309662,
0.07685685157775879,
0.5359783172607422,
0.006653331220149994,
-0.04714777320623398,
-0.3782060742378235,
0.09452182054519653,
0.09201760590076447,
0.1619914025068283,
0.17663070559501648,
-0.042587969452142715,
-0.07260239124298096,
0.0063892244361341,
0.10358665883541107,
0.25504034757614136,
0.3907330334186554,
-0.22647030651569366,
0.2906738817691803,
0.007004471495747566,
-0.05665605142712593,
0.5319919586181641,
-0.2620989978313446,
-0.448444128036499,
0.23385274410247803,
-0.3511556386947632,
0.10818185657262802,
0.22066983580589294,
0.1759030818939209,
0.11388914287090302,
-0.1089852899312973,
0.26901498436927795,
0.3656851649284363,
0.07051589339971542,
0.1209140196442604,
-0.23662437498569489,
-0.09222844988107681,
-0.1715157926082611,
0.48420286178588867,
0.36272403597831726,
-0.02558579295873642,
-0.07308889180421829,
0.35637998580932617,
0.18339842557907104,
-0.1992236077785492,
0.13128061592578888,
0.36934155225753784,
-0.17442509531974792,
-0.1261582374572754,
0.0944812074303627,
0.06559769064188004,
-0.3000325560569763,
-0.07098697125911713,
-0.09084425866603851,
0.0828668475151062,
-0.1136055737733841,
-0.08942607045173645,
0.28255847096443176,
0.02287023328244686,
-0.0766652524471283,
0.11318020522594452,
0.03794129937887192,
-0.13182224333286285,
0.024866361171007156,
-0.07041719555854797,
0.1261971890926361,
0.015421975404024124,
-0.09320687502622604,
0.08736041188240051,
-0.2184159904718399,
-0.12394054979085922,
0.0018030330538749695,
-0.137061208486557,
0.07695000618696213,
0.17527323961257935,
-0.05118799954652786,
0.03840121626853943,
-0.17304009199142456,
0.10695729404687881,
-0.15297769010066986,
-0.2987070679664612,
-0.5071570873260498,
0.43589335680007935,
0.18647874891757965,
-0.33810955286026,
0.3402597904205322,
0.1040273904800415,
-0.029599443078041077,
-0.10627070814371109,
-0.11989574879407883,
0.5749332904815674,
0.27307116985321045,
0.019617579877376556,
0.29909294843673706,
-0.24541117250919342,
0.2542804777622223,
-0.2662392258644104,
-0.10361561179161072,
-0.09776493161916733,
0.4209232032299042,
0.03105533868074417,
0.23506294190883636,
0.14828065037727356,
-0.08694546669721603,
-0.232059508562088,
0.47038108110427856,
-0.1788094937801361,
-0.013872608542442322,
0.26652613282203674,
-0.4247211217880249,
-0.011563490144908428,
-0.34802117943763733,
-0.24947787821292877,
0.0067334845662117004,
0.17322899401187897,
-0.09441326558589935,
-0.055435195565223694,
0.008537785150110722,
-0.26279330253601074,
0.007836148142814636,
0.1532370001077652,
-0.0718524307012558,
0.31983456015586853,
0.11651500314474106,
0.10059522092342377,
-0.122891865670681,
-0.1794070154428482,
0.10284756124019623,
0.17828989028930664,
-0.27519121766090393,
0.18444325029850006,
-0.02282267063856125,
-0.013446485623717308,
-0.2862633764743805,
0.1904245764017105,
-0.12680108845233917,
0.0388152077794075,
-0.0647432953119278,
0.25868889689445496,
-0.07790280133485794,
0.10191172361373901,
0.3001607060432434,
0.3549228012561798,
0.4629628658294678,
-0.07809486240148544,
0.326348215341568,
-0.08266382664442062,
-0.1796954870223999,
0.032943595200777054,
0.33450770378112793,
-0.3179926872253418,
-0.024890778586268425,
0.005377540364861488,
0.05117718130350113,
-0.09892972558736801,
-0.16603437066078186,
0.09468895941972733,
0.196824312210083,
-0.16618932783603668,
-0.2573060691356659,
-0.07217618823051453,
0.17769087851047516,
-0.042431723326444626,
0.11972848325967789,
-0.23244111239910126,
0.008407561108469963,
0.1450573354959488,
-0.006289597600698471,
-0.18432363867759705,
0.04044550284743309,
-0.1199219599366188,
-0.04705164581537247,
-0.411641389131546,
-0.05351852625608444,
0.10705065727233887,
0.13673138618469238,
0.35936760902404785,
0.10678976029157639,
0.19445137679576874,
0.28844478726387024,
0.15859206020832062,
0.006367621943354607,
-0.0885988399386406,
0.5141718983650208,
-0.017572684213519096,
-0.29719802737236023,
-0.2908625900745392,
-0.23975418508052826,
0.02511288784444332,
0.3155249357223511,
-0.684260904788971,
0.23378321528434753,
-0.1138516515493393,
-0.09402675926685333,
-0.3955192267894745,
0.0007258430123329163,
0.2522047758102417,
-0.07614870369434357,
0.016339777037501335,
0.09547417610883713,
0.2302767038345337,
0.1546790897846222,
-0.03878729045391083,
0.38579460978507996,
-0.4130840301513672,
0.35940811038017273,
-0.13545823097229004,
0.4855530261993408,
-0.122118279337883,
-0.2300206571817398,
0.09887474775314331,
0.15044830739498138,
-0.01711525395512581,
-0.021802209317684174,
-0.013968504965305328,
-0.25937944650650024,
-0.058237224817276,
0.0227312333881855,
0.5197213292121887,
0.01689060777425766,
-0.16558955609798431,
-0.015898926183581352,
0.06816425919532776,
0.2563197910785675,
-0.26069891452789307,
0.49052777886390686,
-0.19077889621257782,
0.01841624826192856,
-0.19967399537563324,
0.01874571293592453,
-0.20498108863830566,
-0.21508586406707764,
-0.164134681224823,
0.09344439208507538,
-0.03038274496793747,
-0.22404396533966064,
-0.2116939276456833,
0.10314016044139862,
-0.3681343197822571,
-0.0437651127576828,
0.11799006909132004,
0.22933240234851837,
0.18077029287815094,
-0.19614383578300476,
-0.08628876507282257,
-0.20187069475650787,
0.35741427540779114,
0.1934524029493332,
0.11246532201766968,
0.16325931251049042,
-0.05687852203845978,
-0.2155371457338333,
-0.17745190858840942,
-0.29045435786247253,
0.14190825819969177,
0.6505106687545776,
0.6102464199066162,
-0.21627351641654968,
-0.15859898924827576,
0.07914479076862335,
0.002603483386337757,
-0.16527341306209564,
-0.548757016658783,
-0.12850907444953918,
-0.16549962759017944,
-0.44105130434036255,
0.004606112837791443,
0.35849836468696594,
0.3558535575866699,
-0.2264459729194641,
-0.03187551349401474,
0.13872987031936646,
-0.0007013268768787384,
0.37175118923187256,
-0.12976384162902832,
0.015054157003760338,
-0.06641082465648651,
0.225828617811203,
-0.10741686820983887,
0.36735567450523376,
0.24888965487480164,
0.35636386275291443,
0.1917259395122528,
-0.31755685806274414,
0.0706881731748581,
-0.029888737946748734,
0.23143038153648376,
0.11516103148460388,
0.11022848635911942,
0.3546280860900879,
0.1289711445569992,
0.3322555422782898,
-0.19096627831459045,
0.6737229228019714,
-0.007344553247094154,
0.20682765543460846,
-0.8374910354614258,
-0.26737040281295776,
0.33145615458488464,
-0.02635771967470646,
0.19940276443958282,
0.215718075633049,
-0.40385204553604126,
-0.3216697573661804,
0.376661479473114,
0.09908346086740494,
0.7675239443778992,
-0.2972695827484131,
0.39625850319862366,
-0.1552990972995758,
0.6611965894699097,
0.12803049385547638,
-0.3813104033470154,
0.1585618406534195,
-0.39879149198532104,
-0.2663658857345581,
0.21300511062145233,
-0.09231188893318176,
0.036539800465106964,
0.16050389409065247,
-0.2905767560005188,
-0.029811730608344078,
0.0862521380186081,
0.2249334454536438,
0.13066981732845306,
0.5134936571121216,
0.12092680484056473,
-0.6006978154182434,
-0.08281297981739044,
0.02656909078359604,
-0.02340024709701538,
-0.10490188002586365,
-0.0492798313498497,
0.07994647324085236,
-0.0313267819583416,
-0.20856402814388275,
-0.028466172516345978,
0.20525774359703064,
-0.2474464625120163,
0.08661594241857529,
0.06375248730182648,
-0.07205313444137573,
0.5367995500564575,
0.10623051226139069,
-0.001361064612865448,
0.4988958239555359,
-0.039286620914936066,
0.13215835392475128,
-0.2274819314479828,
-0.1652863323688507,
0.20070844888687134,
-0.06584891676902771,
0.4217033088207245,
0.08837933093309402,
-0.0005880966782569885,
0.11410333216190338,
0.0632382407784462,
-0.046690933406353,
0.09476359188556671,
-0.36430907249450684,
0.10549724102020264,
-0.41123154759407043,
-0.21542777121067047,
-0.08843062818050385,
-0.30078285932540894,
-0.1009221225976944,
0.12310943007469177,
0.13735687732696533,
-0.46444618701934814,
0.11514545977115631,
0.2652113139629364,
-0.3750092685222626,
0.011997109279036522,
0.38382449746131897,
0.17105859518051147,
-0.10513918846845627,
0.49984270334243774,
0.4575878381729126,
-0.053361937403678894,
-0.2644973695278168,
-0.10962903499603271,
0.29444822669029236,
-0.2731435000896454,
0.0849163606762886,
-0.2455592304468155,
-0.3016006648540497,
0.209351047873497,
0.08087542653083801,
0.10009974241256714,
-0.01499941200017929,
-0.06326231360435486,
-0.25102943181991577,
-0.6380501389503479,
-0.18144388496875763,
-0.0027230940759181976,
-0.00354844331741333,
0.1460832953453064,
0.27389806509017944,
-0.3100467920303345,
0.5892773270606995,
-0.2788558602333069,
-0.05294197052717209,
-0.20760811865329742,
0.2782232165336609,
-0.055562183260917664,
-0.38554659485816956,
0.21153579652309418,
0.2033519148826599,
0.1001039668917656,
0.08059665560722351,
0.00590919703245163,
-0.22135356068611145,
-0.14351996779441833,
0.11271549016237259,
0.23647010326385498,
-0.41966331005096436,
-0.01599399372935295,
-0.312997043132782,
-0.09248970448970795,
-0.27002182602882385,
0.06606784462928772,
0.017028577625751495,
0.01394578069448471,
-0.22617922723293304,
0.009393874555826187,
0.04752609133720398,
-0.2552624046802521,
0.04206028953194618,
-0.25458529591560364,
0.12509100139141083,
0.2465714067220688,
0.1331031173467636,
0.11783083528280258,
0.0006371289491653442,
-0.3931019604206085,
0.17964592576026917,
0.6661380529403687,
-0.017532095313072205,
0.4190823435783386,
-0.43573224544525146,
-0.0715063214302063,
0.24765951931476593,
0.04980342835187912,
0.048066146671772,
-0.34167730808258057,
-0.010718589648604393,
0.2935883700847626,
0.22681888937950134,
0.015208568423986435,
-0.014733202755451202,
0.22635462880134583,
-0.41129830479621887,
0.1301487535238266,
0.3453426659107208,
-0.11192676424980164,
-0.06747587025165558,
0.1559651792049408,
0.09132310748100281,
0.5066777467727661,
0.11496534198522568,
0.005711604841053486,
0.24894991517066956,
-0.00122002512216568,
0.15485714375972748,
0.48569241166114807,
0.261119544506073,
0.23868051171302795,
0.3016282618045807,
-0.032666049897670746,
-0.04069993644952774,
-0.2312840223312378,
0.2294139564037323,
-0.435617059469223,
-0.41516661643981934,
-0.2674567401409149,
0.5044151544570923,
-0.01932355761528015,
0.12420932948589325,
-0.3350299298763275,
-0.06624119728803635,
-0.04065354913473129,
0.2541331350803375,
-0.11921557784080505,
0.2744082510471344,
-0.45309436321258545,
-0.17059893906116486,
-0.08942428231239319,
-0.12396197021007538,
0.011534325778484344,
0.18963316082954407,
-0.0558583103120327,
0.27227628231048584,
-0.5796654224395752,
0.22938616573810577,
0.05213649570941925,
0.1451501101255417,
-0.1346784234046936,
0.1227787584066391,
0.10550137609243393,
-0.5078572034835815,
0.34333521127700806,
0.23785626888275146,
0.29185950756073,
0.11540549993515015,
-0.22190696001052856,
0.34437036514282227,
0.43669766187667847,
-0.1908072531223297,
-0.04061196744441986,
-0.12098392844200134,
-0.03561992570757866,
-0.1499127894639969,
0.19743536412715912,
0.3490368723869324,
0.18789905309677124,
0.2596159875392914,
0.0557275116443634,
-0.26596614718437195,
0.27851778268814087,
0.06501396000385284,
-0.3240588903427124,
0.17866621911525726,
-0.13293880224227905,
0.4019324481487274,
-0.32858094573020935,
-0.4429645836353302,
0.00986664742231369,
-0.39412444829940796,
0.21558675169944763,
0.6670199036598206,
-0.2954224944114685,
0.28785526752471924,
-0.02548792213201523,
0.04855022579431534,
0.0018409136682748795,
0.47605016827583313,
0.46973514556884766,
0.2841596007347107,
-0.37837129831314087,
-0.025667212903499603,
-0.32888373732566833,
0.2765583097934723,
-0.2024305909872055,
0.06699749082326889,
0.022247930988669395,
0.17079433798789978,
0.16457822918891907,
-0.003302011638879776,
-0.07962261140346527,
-0.013621993362903595,
0.21880324184894562,
-0.19506913423538208,
-0.1675596684217453,
-0.12804758548736572,
0.0020943284034729004,
0.3573179543018341,
-0.025900525972247124,
-0.29754993319511414,
0.15886540710926056,
0.11506294459104538,
0.0991566851735115,
-0.3214535713195801,
0.3626996874809265,
-0.19846373796463013,
-0.02036242187023163,
0.0691281408071518,
-0.15047122538089752,
0.37920957803726196,
-0.22043859958648682,
-0.03304758667945862,
-0.08182770013809204,
0.12814156711101532,
-0.16707712411880493,
-0.22100013494491577,
0.3402222692966461,
0.38842451572418213,
-0.10763649642467499,
0.10821394622325897,
-0.25519275665283203,
-0.08646275848150253,
0.040304481983184814,
-0.36969074606895447,
-0.3087161183357239,
-0.0074881562031805515,
-0.0002531483769416809,
0.008524507284164429,
0.10309776663780212,
0.24583062529563904,
0.10533731430768967,
-0.027840254828333855,
-0.22922900319099426,
-0.1855800449848175,
0.20947544276714325,
-0.2946496903896332,
-0.31304094195365906,
-0.03537982702255249,
0.05562475696206093,
-0.16362905502319336,
0.2511020004749298,
-0.46240702271461487,
0.14574888348579407,
0.22974419593811035,
-0.025514401495456696,
-0.4540731608867645,
0.2232973277568817,
0.2540613114833832,
0.016472186893224716,
-0.20769661664962769,
0.05345691740512848,
0.1526237428188324,
-0.1369924396276474,
-0.20163996517658234,
-0.1757192611694336
] |
https://github.com/huggingface/datasets/issues/633 | Load large text file for LM pre-training resulting in OOM | @lhoestq It keeps happening. I have uninstalled wandb from my env, setted `%env WANDB_DISABLED=true` on my notebook, and commented this func:
```
def get_available_reporting_integrations():
integrations = []
if is_azureml_available():
integrations.append("azure_ml")
if is_comet_available():
integrations.append("comet_ml")
if is_mlflow_available():
integrations.append("mlflow")
if is_tensorboard_available():
integrations.append("tensorboard")
# if is_wandb_available():
# integrations.append("wandb")
return integrations
```
As a fast test and it keeps increasing the ram memory. Wandb could not be the blameworthy here. | I tried to pretrain Longformer using transformers and datasets. But I got OOM issues with loading a large text file. My script is almost like this:
```python
from datasets import load_dataset
@dataclass
class DataCollatorForDatasetsLanguageModeling(DataCollatorForLanguageModeling):
"""
Data collator used for language modeling based on DataCollatorForLazyLanguageModeling
- collates batches of tensors, honoring their tokenizer's pad_token
- preprocesses batches for masked language modeling
"""
block_size: int = 512
def __call__(self, examples: List[dict]) -> Dict[str, torch.Tensor]:
examples = [example['text'] for example in examples]
batch, attention_mask = self._tensorize_batch(examples)
if self.mlm:
inputs, labels = self.mask_tokens(batch)
return {"input_ids": inputs, "labels": labels}
else:
labels = batch.clone().detach()
if self.tokenizer.pad_token_id is not None:
labels[labels == self.tokenizer.pad_token_id] = -100
return {"input_ids": batch, "labels": labels}
def _tensorize_batch(self, examples: List[str]) -> Tuple[torch.Tensor, torch.Tensor]:
if self.tokenizer._pad_token is None:
raise ValueError(
"You are attempting to pad samples but the tokenizer you are using"
f" ({self.tokenizer.__class__.__name__}) does not have one."
)
tensor_examples = self.tokenizer.batch_encode_plus(
[ex for ex in examples if ex],
max_length=self.block_size,
return_tensors="pt",
pad_to_max_length=True,
return_attention_mask=True,
truncation=True,
)
input_ids, attention_mask = tensor_examples["input_ids"], tensor_examples["attention_mask"]
return input_ids, attention_mask
dataset = load_dataset('text', data_files='train.txt',cache_dir="./", , split='train')
data_collator = DataCollatorForDatasetsLanguageModeling(tokenizer=tokenizer, mlm=True,
mlm_probability=0.15, block_size=tokenizer.max_len)
trainer = Trainer(model=model, args=args, data_collator=data_collator,
train_dataset=train_dataset, prediction_loss_only=True, )
trainer.train(model_path=model_path)
```
This train.txt is about 1.1GB and has 90k lines where each line is a sequence of 4k words.
During training, the memory usage increased fast as the following graph and resulted in OOM before the finish of training.

Could you please give me any suggestions on why this happened and how to fix it?
Thanks. | 65 | Load large text file for LM pre-training resulting in OOM
I tried to pretrain Longformer using transformers and datasets. But I got OOM issues with loading a large text file. My script is almost like this:
```python
from datasets import load_dataset
@dataclass
class DataCollatorForDatasetsLanguageModeling(DataCollatorForLanguageModeling):
"""
Data collator used for language modeling based on DataCollatorForLazyLanguageModeling
- collates batches of tensors, honoring their tokenizer's pad_token
- preprocesses batches for masked language modeling
"""
block_size: int = 512
def __call__(self, examples: List[dict]) -> Dict[str, torch.Tensor]:
examples = [example['text'] for example in examples]
batch, attention_mask = self._tensorize_batch(examples)
if self.mlm:
inputs, labels = self.mask_tokens(batch)
return {"input_ids": inputs, "labels": labels}
else:
labels = batch.clone().detach()
if self.tokenizer.pad_token_id is not None:
labels[labels == self.tokenizer.pad_token_id] = -100
return {"input_ids": batch, "labels": labels}
def _tensorize_batch(self, examples: List[str]) -> Tuple[torch.Tensor, torch.Tensor]:
if self.tokenizer._pad_token is None:
raise ValueError(
"You are attempting to pad samples but the tokenizer you are using"
f" ({self.tokenizer.__class__.__name__}) does not have one."
)
tensor_examples = self.tokenizer.batch_encode_plus(
[ex for ex in examples if ex],
max_length=self.block_size,
return_tensors="pt",
pad_to_max_length=True,
return_attention_mask=True,
truncation=True,
)
input_ids, attention_mask = tensor_examples["input_ids"], tensor_examples["attention_mask"]
return input_ids, attention_mask
dataset = load_dataset('text', data_files='train.txt',cache_dir="./", , split='train')
data_collator = DataCollatorForDatasetsLanguageModeling(tokenizer=tokenizer, mlm=True,
mlm_probability=0.15, block_size=tokenizer.max_len)
trainer = Trainer(model=model, args=args, data_collator=data_collator,
train_dataset=train_dataset, prediction_loss_only=True, )
trainer.train(model_path=model_path)
```
This train.txt is about 1.1GB and has 90k lines where each line is a sequence of 4k words.
During training, the memory usage increased fast as the following graph and resulted in OOM before the finish of training.

Could you please give me any suggestions on why this happened and how to fix it?
Thanks.
@lhoestq It keeps happening. I have uninstalled wandb from my env, setted `%env WANDB_DISABLED=true` on my notebook, and commented this func:
```
def get_available_reporting_integrations():
integrations = []
if is_azureml_available():
integrations.append("azure_ml")
if is_comet_available():
integrations.append("comet_ml")
if is_mlflow_available():
integrations.append("mlflow")
if is_tensorboard_available():
integrations.append("tensorboard")
# if is_wandb_available():
# integrations.append("wandb")
return integrations
```
As a fast test and it keeps increasing the ram memory. Wandb could not be the blameworthy here. | [
-0.6339283585548401,
-0.47753778100013733,
0.010693363845348358,
0.29863524436950684,
0.36004769802093506,
-0.1518251597881317,
0.5567324757575989,
0.37380579113960266,
0.01088225468993187,
0.010719746351242065,
-0.1295929253101349,
-0.1828002780675888,
-0.26698487997055054,
-0.16208980977535248,
-0.03237204998731613,
0.023206885904073715,
-0.09982117265462875,
0.19687515497207642,
-0.2772675156593323,
-0.09666657447814941,
0.05701180547475815,
-0.07762926816940308,
-0.21276047825813293,
-0.029743991792201996,
-0.3879220187664032,
-0.06171319633722305,
0.3158179223537445,
0.12212134897708893,
-0.1640809327363968,
-0.0958080142736435,
-0.22970141470432281,
0.1197899580001831,
0.4393485188484192,
0.4340214729309082,
-0.00011477212683530524,
0.006616219878196716,
0.18904384970664978,
-0.23633266985416412,
-0.16726946830749512,
0.019216440618038177,
0.07755492627620697,
-0.3022913932800293,
-0.10640020668506622,
-0.3036171495914459,
-0.02724609524011612,
-0.10612530261278152,
-0.015682043507695198,
-0.22437302768230438,
0.4987519383430481,
0.5414043068885803,
0.15876251459121704,
0.25081300735473633,
-0.21366100013256073,
0.0723966509103775,
0.25443702936172485,
0.0488995760679245,
0.1056830957531929,
-0.27951449155807495,
0.46878406405448914,
-0.1923186331987381,
-0.47268855571746826,
0.1478176862001419,
-0.22477363049983978,
-0.20168264210224152,
-0.09508860856294632,
0.03820447996258736,
0.36608895659446716,
0.031569477170705795,
0.2641869783401489,
0.3474210202693939,
0.4272076189517975,
-0.0008120127022266388,
-0.289635568857193,
-0.3209858536720276,
-0.14262455701828003,
-0.08431586623191833,
0.18923655152320862,
0.2010769546031952,
0.059826578944921494,
0.11845916509628296,
0.10712733119726181,
-0.12533129751682281,
-0.15199026465415955,
0.07616106420755386,
-0.27480751276016235,
0.33979544043540955,
-0.20125117897987366,
-0.03804318606853485,
0.15557512640953064,
-0.09447921812534332,
0.19616937637329102,
-0.09977510571479797,
0.003403950482606888,
0.25671419501304626,
-0.245441272854805,
-0.11239507794380188,
-0.07168225198984146,
-0.5194145441055298,
0.16278403997421265,
-0.2759450674057007,
0.1981883943080902,
0.29723939299583435,
-0.08766181021928787,
-0.06761691719293594,
0.08639387786388397,
0.4202020466327667,
-0.25243741273880005,
0.26052793860435486,
0.22725635766983032,
0.16401110589504242,
-0.17170630395412445,
-0.04439859092235565,
-0.33051154017448425,
-0.19624567031860352,
0.10159362852573395,
-0.07734166085720062,
-0.011017010547220707,
-0.2546045482158661,
-0.24042175710201263,
0.05854658782482147,
-0.14076969027519226,
-0.03084544464945793,
0.2748163938522339,
0.38997286558151245,
-0.3540611267089844,
0.4294978082180023,
0.16510933637619019,
0.052328936755657196,
-0.4855332672595978,
-0.33652669191360474,
-0.17440199851989746,
0.15325728058815002,
-0.20324474573135376,
0.038975562900304794,
0.12979257106781006,
0.13963374495506287,
0.05965423583984375,
-0.04288341850042343,
-0.0625898689031601,
-0.44021931290626526,
-0.009444482624530792,
-0.024103429168462753,
0.020752981305122375,
-0.04251480475068092,
0.06302379071712494,
-0.02336559072136879,
0.23476582765579224,
-0.12499457597732544,
-0.025381658226251602,
0.3477915823459625,
-0.2762118875980377,
-0.2276410162448883,
0.05097950994968414,
0.21017630398273468,
-0.02824842929840088,
0.20915503799915314,
0.028506658971309662,
0.07685685157775879,
0.5359783172607422,
0.006653331220149994,
-0.04714777320623398,
-0.3782060742378235,
0.09452182054519653,
0.09201760590076447,
0.1619914025068283,
0.17663070559501648,
-0.042587969452142715,
-0.07260239124298096,
0.0063892244361341,
0.10358665883541107,
0.25504034757614136,
0.3907330334186554,
-0.22647030651569366,
0.2906738817691803,
0.007004471495747566,
-0.05665605142712593,
0.5319919586181641,
-0.2620989978313446,
-0.448444128036499,
0.23385274410247803,
-0.3511556386947632,
0.10818185657262802,
0.22066983580589294,
0.1759030818939209,
0.11388914287090302,
-0.1089852899312973,
0.26901498436927795,
0.3656851649284363,
0.07051589339971542,
0.1209140196442604,
-0.23662437498569489,
-0.09222844988107681,
-0.1715157926082611,
0.48420286178588867,
0.36272403597831726,
-0.02558579295873642,
-0.07308889180421829,
0.35637998580932617,
0.18339842557907104,
-0.1992236077785492,
0.13128061592578888,
0.36934155225753784,
-0.17442509531974792,
-0.1261582374572754,
0.0944812074303627,
0.06559769064188004,
-0.3000325560569763,
-0.07098697125911713,
-0.09084425866603851,
0.0828668475151062,
-0.1136055737733841,
-0.08942607045173645,
0.28255847096443176,
0.02287023328244686,
-0.0766652524471283,
0.11318020522594452,
0.03794129937887192,
-0.13182224333286285,
0.024866361171007156,
-0.07041719555854797,
0.1261971890926361,
0.015421975404024124,
-0.09320687502622604,
0.08736041188240051,
-0.2184159904718399,
-0.12394054979085922,
0.0018030330538749695,
-0.137061208486557,
0.07695000618696213,
0.17527323961257935,
-0.05118799954652786,
0.03840121626853943,
-0.17304009199142456,
0.10695729404687881,
-0.15297769010066986,
-0.2987070679664612,
-0.5071570873260498,
0.43589335680007935,
0.18647874891757965,
-0.33810955286026,
0.3402597904205322,
0.1040273904800415,
-0.029599443078041077,
-0.10627070814371109,
-0.11989574879407883,
0.5749332904815674,
0.27307116985321045,
0.019617579877376556,
0.29909294843673706,
-0.24541117250919342,
0.2542804777622223,
-0.2662392258644104,
-0.10361561179161072,
-0.09776493161916733,
0.4209232032299042,
0.03105533868074417,
0.23506294190883636,
0.14828065037727356,
-0.08694546669721603,
-0.232059508562088,
0.47038108110427856,
-0.1788094937801361,
-0.013872608542442322,
0.26652613282203674,
-0.4247211217880249,
-0.011563490144908428,
-0.34802117943763733,
-0.24947787821292877,
0.0067334845662117004,
0.17322899401187897,
-0.09441326558589935,
-0.055435195565223694,
0.008537785150110722,
-0.26279330253601074,
0.007836148142814636,
0.1532370001077652,
-0.0718524307012558,
0.31983456015586853,
0.11651500314474106,
0.10059522092342377,
-0.122891865670681,
-0.1794070154428482,
0.10284756124019623,
0.17828989028930664,
-0.27519121766090393,
0.18444325029850006,
-0.02282267063856125,
-0.013446485623717308,
-0.2862633764743805,
0.1904245764017105,
-0.12680108845233917,
0.0388152077794075,
-0.0647432953119278,
0.25868889689445496,
-0.07790280133485794,
0.10191172361373901,
0.3001607060432434,
0.3549228012561798,
0.4629628658294678,
-0.07809486240148544,
0.326348215341568,
-0.08266382664442062,
-0.1796954870223999,
0.032943595200777054,
0.33450770378112793,
-0.3179926872253418,
-0.024890778586268425,
0.005377540364861488,
0.05117718130350113,
-0.09892972558736801,
-0.16603437066078186,
0.09468895941972733,
0.196824312210083,
-0.16618932783603668,
-0.2573060691356659,
-0.07217618823051453,
0.17769087851047516,
-0.042431723326444626,
0.11972848325967789,
-0.23244111239910126,
0.008407561108469963,
0.1450573354959488,
-0.006289597600698471,
-0.18432363867759705,
0.04044550284743309,
-0.1199219599366188,
-0.04705164581537247,
-0.411641389131546,
-0.05351852625608444,
0.10705065727233887,
0.13673138618469238,
0.35936760902404785,
0.10678976029157639,
0.19445137679576874,
0.28844478726387024,
0.15859206020832062,
0.006367621943354607,
-0.0885988399386406,
0.5141718983650208,
-0.017572684213519096,
-0.29719802737236023,
-0.2908625900745392,
-0.23975418508052826,
0.02511288784444332,
0.3155249357223511,
-0.684260904788971,
0.23378321528434753,
-0.1138516515493393,
-0.09402675926685333,
-0.3955192267894745,
0.0007258430123329163,
0.2522047758102417,
-0.07614870369434357,
0.016339777037501335,
0.09547417610883713,
0.2302767038345337,
0.1546790897846222,
-0.03878729045391083,
0.38579460978507996,
-0.4130840301513672,
0.35940811038017273,
-0.13545823097229004,
0.4855530261993408,
-0.122118279337883,
-0.2300206571817398,
0.09887474775314331,
0.15044830739498138,
-0.01711525395512581,
-0.021802209317684174,
-0.013968504965305328,
-0.25937944650650024,
-0.058237224817276,
0.0227312333881855,
0.5197213292121887,
0.01689060777425766,
-0.16558955609798431,
-0.015898926183581352,
0.06816425919532776,
0.2563197910785675,
-0.26069891452789307,
0.49052777886390686,
-0.19077889621257782,
0.01841624826192856,
-0.19967399537563324,
0.01874571293592453,
-0.20498108863830566,
-0.21508586406707764,
-0.164134681224823,
0.09344439208507538,
-0.03038274496793747,
-0.22404396533966064,
-0.2116939276456833,
0.10314016044139862,
-0.3681343197822571,
-0.0437651127576828,
0.11799006909132004,
0.22933240234851837,
0.18077029287815094,
-0.19614383578300476,
-0.08628876507282257,
-0.20187069475650787,
0.35741427540779114,
0.1934524029493332,
0.11246532201766968,
0.16325931251049042,
-0.05687852203845978,
-0.2155371457338333,
-0.17745190858840942,
-0.29045435786247253,
0.14190825819969177,
0.6505106687545776,
0.6102464199066162,
-0.21627351641654968,
-0.15859898924827576,
0.07914479076862335,
0.002603483386337757,
-0.16527341306209564,
-0.548757016658783,
-0.12850907444953918,
-0.16549962759017944,
-0.44105130434036255,
0.004606112837791443,
0.35849836468696594,
0.3558535575866699,
-0.2264459729194641,
-0.03187551349401474,
0.13872987031936646,
-0.0007013268768787384,
0.37175118923187256,
-0.12976384162902832,
0.015054157003760338,
-0.06641082465648651,
0.225828617811203,
-0.10741686820983887,
0.36735567450523376,
0.24888965487480164,
0.35636386275291443,
0.1917259395122528,
-0.31755685806274414,
0.0706881731748581,
-0.029888737946748734,
0.23143038153648376,
0.11516103148460388,
0.11022848635911942,
0.3546280860900879,
0.1289711445569992,
0.3322555422782898,
-0.19096627831459045,
0.6737229228019714,
-0.007344553247094154,
0.20682765543460846,
-0.8374910354614258,
-0.26737040281295776,
0.33145615458488464,
-0.02635771967470646,
0.19940276443958282,
0.215718075633049,
-0.40385204553604126,
-0.3216697573661804,
0.376661479473114,
0.09908346086740494,
0.7675239443778992,
-0.2972695827484131,
0.39625850319862366,
-0.1552990972995758,
0.6611965894699097,
0.12803049385547638,
-0.3813104033470154,
0.1585618406534195,
-0.39879149198532104,
-0.2663658857345581,
0.21300511062145233,
-0.09231188893318176,
0.036539800465106964,
0.16050389409065247,
-0.2905767560005188,
-0.029811730608344078,
0.0862521380186081,
0.2249334454536438,
0.13066981732845306,
0.5134936571121216,
0.12092680484056473,
-0.6006978154182434,
-0.08281297981739044,
0.02656909078359604,
-0.02340024709701538,
-0.10490188002586365,
-0.0492798313498497,
0.07994647324085236,
-0.0313267819583416,
-0.20856402814388275,
-0.028466172516345978,
0.20525774359703064,
-0.2474464625120163,
0.08661594241857529,
0.06375248730182648,
-0.07205313444137573,
0.5367995500564575,
0.10623051226139069,
-0.001361064612865448,
0.4988958239555359,
-0.039286620914936066,
0.13215835392475128,
-0.2274819314479828,
-0.1652863323688507,
0.20070844888687134,
-0.06584891676902771,
0.4217033088207245,
0.08837933093309402,
-0.0005880966782569885,
0.11410333216190338,
0.0632382407784462,
-0.046690933406353,
0.09476359188556671,
-0.36430907249450684,
0.10549724102020264,
-0.41123154759407043,
-0.21542777121067047,
-0.08843062818050385,
-0.30078285932540894,
-0.1009221225976944,
0.12310943007469177,
0.13735687732696533,
-0.46444618701934814,
0.11514545977115631,
0.2652113139629364,
-0.3750092685222626,
0.011997109279036522,
0.38382449746131897,
0.17105859518051147,
-0.10513918846845627,
0.49984270334243774,
0.4575878381729126,
-0.053361937403678894,
-0.2644973695278168,
-0.10962903499603271,
0.29444822669029236,
-0.2731435000896454,
0.0849163606762886,
-0.2455592304468155,
-0.3016006648540497,
0.209351047873497,
0.08087542653083801,
0.10009974241256714,
-0.01499941200017929,
-0.06326231360435486,
-0.25102943181991577,
-0.6380501389503479,
-0.18144388496875763,
-0.0027230940759181976,
-0.00354844331741333,
0.1460832953453064,
0.27389806509017944,
-0.3100467920303345,
0.5892773270606995,
-0.2788558602333069,
-0.05294197052717209,
-0.20760811865329742,
0.2782232165336609,
-0.055562183260917664,
-0.38554659485816956,
0.21153579652309418,
0.2033519148826599,
0.1001039668917656,
0.08059665560722351,
0.00590919703245163,
-0.22135356068611145,
-0.14351996779441833,
0.11271549016237259,
0.23647010326385498,
-0.41966331005096436,
-0.01599399372935295,
-0.312997043132782,
-0.09248970448970795,
-0.27002182602882385,
0.06606784462928772,
0.017028577625751495,
0.01394578069448471,
-0.22617922723293304,
0.009393874555826187,
0.04752609133720398,
-0.2552624046802521,
0.04206028953194618,
-0.25458529591560364,
0.12509100139141083,
0.2465714067220688,
0.1331031173467636,
0.11783083528280258,
0.0006371289491653442,
-0.3931019604206085,
0.17964592576026917,
0.6661380529403687,
-0.017532095313072205,
0.4190823435783386,
-0.43573224544525146,
-0.0715063214302063,
0.24765951931476593,
0.04980342835187912,
0.048066146671772,
-0.34167730808258057,
-0.010718589648604393,
0.2935883700847626,
0.22681888937950134,
0.015208568423986435,
-0.014733202755451202,
0.22635462880134583,
-0.41129830479621887,
0.1301487535238266,
0.3453426659107208,
-0.11192676424980164,
-0.06747587025165558,
0.1559651792049408,
0.09132310748100281,
0.5066777467727661,
0.11496534198522568,
0.005711604841053486,
0.24894991517066956,
-0.00122002512216568,
0.15485714375972748,
0.48569241166114807,
0.261119544506073,
0.23868051171302795,
0.3016282618045807,
-0.032666049897670746,
-0.04069993644952774,
-0.2312840223312378,
0.2294139564037323,
-0.435617059469223,
-0.41516661643981934,
-0.2674567401409149,
0.5044151544570923,
-0.01932355761528015,
0.12420932948589325,
-0.3350299298763275,
-0.06624119728803635,
-0.04065354913473129,
0.2541331350803375,
-0.11921557784080505,
0.2744082510471344,
-0.45309436321258545,
-0.17059893906116486,
-0.08942428231239319,
-0.12396197021007538,
0.011534325778484344,
0.18963316082954407,
-0.0558583103120327,
0.27227628231048584,
-0.5796654224395752,
0.22938616573810577,
0.05213649570941925,
0.1451501101255417,
-0.1346784234046936,
0.1227787584066391,
0.10550137609243393,
-0.5078572034835815,
0.34333521127700806,
0.23785626888275146,
0.29185950756073,
0.11540549993515015,
-0.22190696001052856,
0.34437036514282227,
0.43669766187667847,
-0.1908072531223297,
-0.04061196744441986,
-0.12098392844200134,
-0.03561992570757866,
-0.1499127894639969,
0.19743536412715912,
0.3490368723869324,
0.18789905309677124,
0.2596159875392914,
0.0557275116443634,
-0.26596614718437195,
0.27851778268814087,
0.06501396000385284,
-0.3240588903427124,
0.17866621911525726,
-0.13293880224227905,
0.4019324481487274,
-0.32858094573020935,
-0.4429645836353302,
0.00986664742231369,
-0.39412444829940796,
0.21558675169944763,
0.6670199036598206,
-0.2954224944114685,
0.28785526752471924,
-0.02548792213201523,
0.04855022579431534,
0.0018409136682748795,
0.47605016827583313,
0.46973514556884766,
0.2841596007347107,
-0.37837129831314087,
-0.025667212903499603,
-0.32888373732566833,
0.2765583097934723,
-0.2024305909872055,
0.06699749082326889,
0.022247930988669395,
0.17079433798789978,
0.16457822918891907,
-0.003302011638879776,
-0.07962261140346527,
-0.013621993362903595,
0.21880324184894562,
-0.19506913423538208,
-0.1675596684217453,
-0.12804758548736572,
0.0020943284034729004,
0.3573179543018341,
-0.025900525972247124,
-0.29754993319511414,
0.15886540710926056,
0.11506294459104538,
0.0991566851735115,
-0.3214535713195801,
0.3626996874809265,
-0.19846373796463013,
-0.02036242187023163,
0.0691281408071518,
-0.15047122538089752,
0.37920957803726196,
-0.22043859958648682,
-0.03304758667945862,
-0.08182770013809204,
0.12814156711101532,
-0.16707712411880493,
-0.22100013494491577,
0.3402222692966461,
0.38842451572418213,
-0.10763649642467499,
0.10821394622325897,
-0.25519275665283203,
-0.08646275848150253,
0.040304481983184814,
-0.36969074606895447,
-0.3087161183357239,
-0.0074881562031805515,
-0.0002531483769416809,
0.008524507284164429,
0.10309776663780212,
0.24583062529563904,
0.10533731430768967,
-0.027840254828333855,
-0.22922900319099426,
-0.1855800449848175,
0.20947544276714325,
-0.2946496903896332,
-0.31304094195365906,
-0.03537982702255249,
0.05562475696206093,
-0.16362905502319336,
0.2511020004749298,
-0.46240702271461487,
0.14574888348579407,
0.22974419593811035,
-0.025514401495456696,
-0.4540731608867645,
0.2232973277568817,
0.2540613114833832,
0.016472186893224716,
-0.20769661664962769,
0.05345691740512848,
0.1526237428188324,
-0.1369924396276474,
-0.20163996517658234,
-0.1757192611694336
] |
https://github.com/huggingface/datasets/issues/633 | Load large text file for LM pre-training resulting in OOM | Thanks for checking @gaceladri . Let's investigate the single process setting then.
If you have some sort of colab notebook with a minimal code example that shows this behavior feel free to share it @gaceladri so that we can play around with it to find what causes this. Otherwise I'll probably try to reproduce on my side at one point | I tried to pretrain Longformer using transformers and datasets. But I got OOM issues with loading a large text file. My script is almost like this:
```python
from datasets import load_dataset
@dataclass
class DataCollatorForDatasetsLanguageModeling(DataCollatorForLanguageModeling):
"""
Data collator used for language modeling based on DataCollatorForLazyLanguageModeling
- collates batches of tensors, honoring their tokenizer's pad_token
- preprocesses batches for masked language modeling
"""
block_size: int = 512
def __call__(self, examples: List[dict]) -> Dict[str, torch.Tensor]:
examples = [example['text'] for example in examples]
batch, attention_mask = self._tensorize_batch(examples)
if self.mlm:
inputs, labels = self.mask_tokens(batch)
return {"input_ids": inputs, "labels": labels}
else:
labels = batch.clone().detach()
if self.tokenizer.pad_token_id is not None:
labels[labels == self.tokenizer.pad_token_id] = -100
return {"input_ids": batch, "labels": labels}
def _tensorize_batch(self, examples: List[str]) -> Tuple[torch.Tensor, torch.Tensor]:
if self.tokenizer._pad_token is None:
raise ValueError(
"You are attempting to pad samples but the tokenizer you are using"
f" ({self.tokenizer.__class__.__name__}) does not have one."
)
tensor_examples = self.tokenizer.batch_encode_plus(
[ex for ex in examples if ex],
max_length=self.block_size,
return_tensors="pt",
pad_to_max_length=True,
return_attention_mask=True,
truncation=True,
)
input_ids, attention_mask = tensor_examples["input_ids"], tensor_examples["attention_mask"]
return input_ids, attention_mask
dataset = load_dataset('text', data_files='train.txt',cache_dir="./", , split='train')
data_collator = DataCollatorForDatasetsLanguageModeling(tokenizer=tokenizer, mlm=True,
mlm_probability=0.15, block_size=tokenizer.max_len)
trainer = Trainer(model=model, args=args, data_collator=data_collator,
train_dataset=train_dataset, prediction_loss_only=True, )
trainer.train(model_path=model_path)
```
This train.txt is about 1.1GB and has 90k lines where each line is a sequence of 4k words.
During training, the memory usage increased fast as the following graph and resulted in OOM before the finish of training.

Could you please give me any suggestions on why this happened and how to fix it?
Thanks. | 60 | Load large text file for LM pre-training resulting in OOM
I tried to pretrain Longformer using transformers and datasets. But I got OOM issues with loading a large text file. My script is almost like this:
```python
from datasets import load_dataset
@dataclass
class DataCollatorForDatasetsLanguageModeling(DataCollatorForLanguageModeling):
"""
Data collator used for language modeling based on DataCollatorForLazyLanguageModeling
- collates batches of tensors, honoring their tokenizer's pad_token
- preprocesses batches for masked language modeling
"""
block_size: int = 512
def __call__(self, examples: List[dict]) -> Dict[str, torch.Tensor]:
examples = [example['text'] for example in examples]
batch, attention_mask = self._tensorize_batch(examples)
if self.mlm:
inputs, labels = self.mask_tokens(batch)
return {"input_ids": inputs, "labels": labels}
else:
labels = batch.clone().detach()
if self.tokenizer.pad_token_id is not None:
labels[labels == self.tokenizer.pad_token_id] = -100
return {"input_ids": batch, "labels": labels}
def _tensorize_batch(self, examples: List[str]) -> Tuple[torch.Tensor, torch.Tensor]:
if self.tokenizer._pad_token is None:
raise ValueError(
"You are attempting to pad samples but the tokenizer you are using"
f" ({self.tokenizer.__class__.__name__}) does not have one."
)
tensor_examples = self.tokenizer.batch_encode_plus(
[ex for ex in examples if ex],
max_length=self.block_size,
return_tensors="pt",
pad_to_max_length=True,
return_attention_mask=True,
truncation=True,
)
input_ids, attention_mask = tensor_examples["input_ids"], tensor_examples["attention_mask"]
return input_ids, attention_mask
dataset = load_dataset('text', data_files='train.txt',cache_dir="./", , split='train')
data_collator = DataCollatorForDatasetsLanguageModeling(tokenizer=tokenizer, mlm=True,
mlm_probability=0.15, block_size=tokenizer.max_len)
trainer = Trainer(model=model, args=args, data_collator=data_collator,
train_dataset=train_dataset, prediction_loss_only=True, )
trainer.train(model_path=model_path)
```
This train.txt is about 1.1GB and has 90k lines where each line is a sequence of 4k words.
During training, the memory usage increased fast as the following graph and resulted in OOM before the finish of training.

Could you please give me any suggestions on why this happened and how to fix it?
Thanks.
Thanks for checking @gaceladri . Let's investigate the single process setting then.
If you have some sort of colab notebook with a minimal code example that shows this behavior feel free to share it @gaceladri so that we can play around with it to find what causes this. Otherwise I'll probably try to reproduce on my side at one point | [
-0.6339283585548401,
-0.47753778100013733,
0.010693363845348358,
0.29863524436950684,
0.36004769802093506,
-0.1518251597881317,
0.5567324757575989,
0.37380579113960266,
0.01088225468993187,
0.010719746351242065,
-0.1295929253101349,
-0.1828002780675888,
-0.26698487997055054,
-0.16208980977535248,
-0.03237204998731613,
0.023206885904073715,
-0.09982117265462875,
0.19687515497207642,
-0.2772675156593323,
-0.09666657447814941,
0.05701180547475815,
-0.07762926816940308,
-0.21276047825813293,
-0.029743991792201996,
-0.3879220187664032,
-0.06171319633722305,
0.3158179223537445,
0.12212134897708893,
-0.1640809327363968,
-0.0958080142736435,
-0.22970141470432281,
0.1197899580001831,
0.4393485188484192,
0.4340214729309082,
-0.00011477212683530524,
0.006616219878196716,
0.18904384970664978,
-0.23633266985416412,
-0.16726946830749512,
0.019216440618038177,
0.07755492627620697,
-0.3022913932800293,
-0.10640020668506622,
-0.3036171495914459,
-0.02724609524011612,
-0.10612530261278152,
-0.015682043507695198,
-0.22437302768230438,
0.4987519383430481,
0.5414043068885803,
0.15876251459121704,
0.25081300735473633,
-0.21366100013256073,
0.0723966509103775,
0.25443702936172485,
0.0488995760679245,
0.1056830957531929,
-0.27951449155807495,
0.46878406405448914,
-0.1923186331987381,
-0.47268855571746826,
0.1478176862001419,
-0.22477363049983978,
-0.20168264210224152,
-0.09508860856294632,
0.03820447996258736,
0.36608895659446716,
0.031569477170705795,
0.2641869783401489,
0.3474210202693939,
0.4272076189517975,
-0.0008120127022266388,
-0.289635568857193,
-0.3209858536720276,
-0.14262455701828003,
-0.08431586623191833,
0.18923655152320862,
0.2010769546031952,
0.059826578944921494,
0.11845916509628296,
0.10712733119726181,
-0.12533129751682281,
-0.15199026465415955,
0.07616106420755386,
-0.27480751276016235,
0.33979544043540955,
-0.20125117897987366,
-0.03804318606853485,
0.15557512640953064,
-0.09447921812534332,
0.19616937637329102,
-0.09977510571479797,
0.003403950482606888,
0.25671419501304626,
-0.245441272854805,
-0.11239507794380188,
-0.07168225198984146,
-0.5194145441055298,
0.16278403997421265,
-0.2759450674057007,
0.1981883943080902,
0.29723939299583435,
-0.08766181021928787,
-0.06761691719293594,
0.08639387786388397,
0.4202020466327667,
-0.25243741273880005,
0.26052793860435486,
0.22725635766983032,
0.16401110589504242,
-0.17170630395412445,
-0.04439859092235565,
-0.33051154017448425,
-0.19624567031860352,
0.10159362852573395,
-0.07734166085720062,
-0.011017010547220707,
-0.2546045482158661,
-0.24042175710201263,
0.05854658782482147,
-0.14076969027519226,
-0.03084544464945793,
0.2748163938522339,
0.38997286558151245,
-0.3540611267089844,
0.4294978082180023,
0.16510933637619019,
0.052328936755657196,
-0.4855332672595978,
-0.33652669191360474,
-0.17440199851989746,
0.15325728058815002,
-0.20324474573135376,
0.038975562900304794,
0.12979257106781006,
0.13963374495506287,
0.05965423583984375,
-0.04288341850042343,
-0.0625898689031601,
-0.44021931290626526,
-0.009444482624530792,
-0.024103429168462753,
0.020752981305122375,
-0.04251480475068092,
0.06302379071712494,
-0.02336559072136879,
0.23476582765579224,
-0.12499457597732544,
-0.025381658226251602,
0.3477915823459625,
-0.2762118875980377,
-0.2276410162448883,
0.05097950994968414,
0.21017630398273468,
-0.02824842929840088,
0.20915503799915314,
0.028506658971309662,
0.07685685157775879,
0.5359783172607422,
0.006653331220149994,
-0.04714777320623398,
-0.3782060742378235,
0.09452182054519653,
0.09201760590076447,
0.1619914025068283,
0.17663070559501648,
-0.042587969452142715,
-0.07260239124298096,
0.0063892244361341,
0.10358665883541107,
0.25504034757614136,
0.3907330334186554,
-0.22647030651569366,
0.2906738817691803,
0.007004471495747566,
-0.05665605142712593,
0.5319919586181641,
-0.2620989978313446,
-0.448444128036499,
0.23385274410247803,
-0.3511556386947632,
0.10818185657262802,
0.22066983580589294,
0.1759030818939209,
0.11388914287090302,
-0.1089852899312973,
0.26901498436927795,
0.3656851649284363,
0.07051589339971542,
0.1209140196442604,
-0.23662437498569489,
-0.09222844988107681,
-0.1715157926082611,
0.48420286178588867,
0.36272403597831726,
-0.02558579295873642,
-0.07308889180421829,
0.35637998580932617,
0.18339842557907104,
-0.1992236077785492,
0.13128061592578888,
0.36934155225753784,
-0.17442509531974792,
-0.1261582374572754,
0.0944812074303627,
0.06559769064188004,
-0.3000325560569763,
-0.07098697125911713,
-0.09084425866603851,
0.0828668475151062,
-0.1136055737733841,
-0.08942607045173645,
0.28255847096443176,
0.02287023328244686,
-0.0766652524471283,
0.11318020522594452,
0.03794129937887192,
-0.13182224333286285,
0.024866361171007156,
-0.07041719555854797,
0.1261971890926361,
0.015421975404024124,
-0.09320687502622604,
0.08736041188240051,
-0.2184159904718399,
-0.12394054979085922,
0.0018030330538749695,
-0.137061208486557,
0.07695000618696213,
0.17527323961257935,
-0.05118799954652786,
0.03840121626853943,
-0.17304009199142456,
0.10695729404687881,
-0.15297769010066986,
-0.2987070679664612,
-0.5071570873260498,
0.43589335680007935,
0.18647874891757965,
-0.33810955286026,
0.3402597904205322,
0.1040273904800415,
-0.029599443078041077,
-0.10627070814371109,
-0.11989574879407883,
0.5749332904815674,
0.27307116985321045,
0.019617579877376556,
0.29909294843673706,
-0.24541117250919342,
0.2542804777622223,
-0.2662392258644104,
-0.10361561179161072,
-0.09776493161916733,
0.4209232032299042,
0.03105533868074417,
0.23506294190883636,
0.14828065037727356,
-0.08694546669721603,
-0.232059508562088,
0.47038108110427856,
-0.1788094937801361,
-0.013872608542442322,
0.26652613282203674,
-0.4247211217880249,
-0.011563490144908428,
-0.34802117943763733,
-0.24947787821292877,
0.0067334845662117004,
0.17322899401187897,
-0.09441326558589935,
-0.055435195565223694,
0.008537785150110722,
-0.26279330253601074,
0.007836148142814636,
0.1532370001077652,
-0.0718524307012558,
0.31983456015586853,
0.11651500314474106,
0.10059522092342377,
-0.122891865670681,
-0.1794070154428482,
0.10284756124019623,
0.17828989028930664,
-0.27519121766090393,
0.18444325029850006,
-0.02282267063856125,
-0.013446485623717308,
-0.2862633764743805,
0.1904245764017105,
-0.12680108845233917,
0.0388152077794075,
-0.0647432953119278,
0.25868889689445496,
-0.07790280133485794,
0.10191172361373901,
0.3001607060432434,
0.3549228012561798,
0.4629628658294678,
-0.07809486240148544,
0.326348215341568,
-0.08266382664442062,
-0.1796954870223999,
0.032943595200777054,
0.33450770378112793,
-0.3179926872253418,
-0.024890778586268425,
0.005377540364861488,
0.05117718130350113,
-0.09892972558736801,
-0.16603437066078186,
0.09468895941972733,
0.196824312210083,
-0.16618932783603668,
-0.2573060691356659,
-0.07217618823051453,
0.17769087851047516,
-0.042431723326444626,
0.11972848325967789,
-0.23244111239910126,
0.008407561108469963,
0.1450573354959488,
-0.006289597600698471,
-0.18432363867759705,
0.04044550284743309,
-0.1199219599366188,
-0.04705164581537247,
-0.411641389131546,
-0.05351852625608444,
0.10705065727233887,
0.13673138618469238,
0.35936760902404785,
0.10678976029157639,
0.19445137679576874,
0.28844478726387024,
0.15859206020832062,
0.006367621943354607,
-0.0885988399386406,
0.5141718983650208,
-0.017572684213519096,
-0.29719802737236023,
-0.2908625900745392,
-0.23975418508052826,
0.02511288784444332,
0.3155249357223511,
-0.684260904788971,
0.23378321528434753,
-0.1138516515493393,
-0.09402675926685333,
-0.3955192267894745,
0.0007258430123329163,
0.2522047758102417,
-0.07614870369434357,
0.016339777037501335,
0.09547417610883713,
0.2302767038345337,
0.1546790897846222,
-0.03878729045391083,
0.38579460978507996,
-0.4130840301513672,
0.35940811038017273,
-0.13545823097229004,
0.4855530261993408,
-0.122118279337883,
-0.2300206571817398,
0.09887474775314331,
0.15044830739498138,
-0.01711525395512581,
-0.021802209317684174,
-0.013968504965305328,
-0.25937944650650024,
-0.058237224817276,
0.0227312333881855,
0.5197213292121887,
0.01689060777425766,
-0.16558955609798431,
-0.015898926183581352,
0.06816425919532776,
0.2563197910785675,
-0.26069891452789307,
0.49052777886390686,
-0.19077889621257782,
0.01841624826192856,
-0.19967399537563324,
0.01874571293592453,
-0.20498108863830566,
-0.21508586406707764,
-0.164134681224823,
0.09344439208507538,
-0.03038274496793747,
-0.22404396533966064,
-0.2116939276456833,
0.10314016044139862,
-0.3681343197822571,
-0.0437651127576828,
0.11799006909132004,
0.22933240234851837,
0.18077029287815094,
-0.19614383578300476,
-0.08628876507282257,
-0.20187069475650787,
0.35741427540779114,
0.1934524029493332,
0.11246532201766968,
0.16325931251049042,
-0.05687852203845978,
-0.2155371457338333,
-0.17745190858840942,
-0.29045435786247253,
0.14190825819969177,
0.6505106687545776,
0.6102464199066162,
-0.21627351641654968,
-0.15859898924827576,
0.07914479076862335,
0.002603483386337757,
-0.16527341306209564,
-0.548757016658783,
-0.12850907444953918,
-0.16549962759017944,
-0.44105130434036255,
0.004606112837791443,
0.35849836468696594,
0.3558535575866699,
-0.2264459729194641,
-0.03187551349401474,
0.13872987031936646,
-0.0007013268768787384,
0.37175118923187256,
-0.12976384162902832,
0.015054157003760338,
-0.06641082465648651,
0.225828617811203,
-0.10741686820983887,
0.36735567450523376,
0.24888965487480164,
0.35636386275291443,
0.1917259395122528,
-0.31755685806274414,
0.0706881731748581,
-0.029888737946748734,
0.23143038153648376,
0.11516103148460388,
0.11022848635911942,
0.3546280860900879,
0.1289711445569992,
0.3322555422782898,
-0.19096627831459045,
0.6737229228019714,
-0.007344553247094154,
0.20682765543460846,
-0.8374910354614258,
-0.26737040281295776,
0.33145615458488464,
-0.02635771967470646,
0.19940276443958282,
0.215718075633049,
-0.40385204553604126,
-0.3216697573661804,
0.376661479473114,
0.09908346086740494,
0.7675239443778992,
-0.2972695827484131,
0.39625850319862366,
-0.1552990972995758,
0.6611965894699097,
0.12803049385547638,
-0.3813104033470154,
0.1585618406534195,
-0.39879149198532104,
-0.2663658857345581,
0.21300511062145233,
-0.09231188893318176,
0.036539800465106964,
0.16050389409065247,
-0.2905767560005188,
-0.029811730608344078,
0.0862521380186081,
0.2249334454536438,
0.13066981732845306,
0.5134936571121216,
0.12092680484056473,
-0.6006978154182434,
-0.08281297981739044,
0.02656909078359604,
-0.02340024709701538,
-0.10490188002586365,
-0.0492798313498497,
0.07994647324085236,
-0.0313267819583416,
-0.20856402814388275,
-0.028466172516345978,
0.20525774359703064,
-0.2474464625120163,
0.08661594241857529,
0.06375248730182648,
-0.07205313444137573,
0.5367995500564575,
0.10623051226139069,
-0.001361064612865448,
0.4988958239555359,
-0.039286620914936066,
0.13215835392475128,
-0.2274819314479828,
-0.1652863323688507,
0.20070844888687134,
-0.06584891676902771,
0.4217033088207245,
0.08837933093309402,
-0.0005880966782569885,
0.11410333216190338,
0.0632382407784462,
-0.046690933406353,
0.09476359188556671,
-0.36430907249450684,
0.10549724102020264,
-0.41123154759407043,
-0.21542777121067047,
-0.08843062818050385,
-0.30078285932540894,
-0.1009221225976944,
0.12310943007469177,
0.13735687732696533,
-0.46444618701934814,
0.11514545977115631,
0.2652113139629364,
-0.3750092685222626,
0.011997109279036522,
0.38382449746131897,
0.17105859518051147,
-0.10513918846845627,
0.49984270334243774,
0.4575878381729126,
-0.053361937403678894,
-0.2644973695278168,
-0.10962903499603271,
0.29444822669029236,
-0.2731435000896454,
0.0849163606762886,
-0.2455592304468155,
-0.3016006648540497,
0.209351047873497,
0.08087542653083801,
0.10009974241256714,
-0.01499941200017929,
-0.06326231360435486,
-0.25102943181991577,
-0.6380501389503479,
-0.18144388496875763,
-0.0027230940759181976,
-0.00354844331741333,
0.1460832953453064,
0.27389806509017944,
-0.3100467920303345,
0.5892773270606995,
-0.2788558602333069,
-0.05294197052717209,
-0.20760811865329742,
0.2782232165336609,
-0.055562183260917664,
-0.38554659485816956,
0.21153579652309418,
0.2033519148826599,
0.1001039668917656,
0.08059665560722351,
0.00590919703245163,
-0.22135356068611145,
-0.14351996779441833,
0.11271549016237259,
0.23647010326385498,
-0.41966331005096436,
-0.01599399372935295,
-0.312997043132782,
-0.09248970448970795,
-0.27002182602882385,
0.06606784462928772,
0.017028577625751495,
0.01394578069448471,
-0.22617922723293304,
0.009393874555826187,
0.04752609133720398,
-0.2552624046802521,
0.04206028953194618,
-0.25458529591560364,
0.12509100139141083,
0.2465714067220688,
0.1331031173467636,
0.11783083528280258,
0.0006371289491653442,
-0.3931019604206085,
0.17964592576026917,
0.6661380529403687,
-0.017532095313072205,
0.4190823435783386,
-0.43573224544525146,
-0.0715063214302063,
0.24765951931476593,
0.04980342835187912,
0.048066146671772,
-0.34167730808258057,
-0.010718589648604393,
0.2935883700847626,
0.22681888937950134,
0.015208568423986435,
-0.014733202755451202,
0.22635462880134583,
-0.41129830479621887,
0.1301487535238266,
0.3453426659107208,
-0.11192676424980164,
-0.06747587025165558,
0.1559651792049408,
0.09132310748100281,
0.5066777467727661,
0.11496534198522568,
0.005711604841053486,
0.24894991517066956,
-0.00122002512216568,
0.15485714375972748,
0.48569241166114807,
0.261119544506073,
0.23868051171302795,
0.3016282618045807,
-0.032666049897670746,
-0.04069993644952774,
-0.2312840223312378,
0.2294139564037323,
-0.435617059469223,
-0.41516661643981934,
-0.2674567401409149,
0.5044151544570923,
-0.01932355761528015,
0.12420932948589325,
-0.3350299298763275,
-0.06624119728803635,
-0.04065354913473129,
0.2541331350803375,
-0.11921557784080505,
0.2744082510471344,
-0.45309436321258545,
-0.17059893906116486,
-0.08942428231239319,
-0.12396197021007538,
0.011534325778484344,
0.18963316082954407,
-0.0558583103120327,
0.27227628231048584,
-0.5796654224395752,
0.22938616573810577,
0.05213649570941925,
0.1451501101255417,
-0.1346784234046936,
0.1227787584066391,
0.10550137609243393,
-0.5078572034835815,
0.34333521127700806,
0.23785626888275146,
0.29185950756073,
0.11540549993515015,
-0.22190696001052856,
0.34437036514282227,
0.43669766187667847,
-0.1908072531223297,
-0.04061196744441986,
-0.12098392844200134,
-0.03561992570757866,
-0.1499127894639969,
0.19743536412715912,
0.3490368723869324,
0.18789905309677124,
0.2596159875392914,
0.0557275116443634,
-0.26596614718437195,
0.27851778268814087,
0.06501396000385284,
-0.3240588903427124,
0.17866621911525726,
-0.13293880224227905,
0.4019324481487274,
-0.32858094573020935,
-0.4429645836353302,
0.00986664742231369,
-0.39412444829940796,
0.21558675169944763,
0.6670199036598206,
-0.2954224944114685,
0.28785526752471924,
-0.02548792213201523,
0.04855022579431534,
0.0018409136682748795,
0.47605016827583313,
0.46973514556884766,
0.2841596007347107,
-0.37837129831314087,
-0.025667212903499603,
-0.32888373732566833,
0.2765583097934723,
-0.2024305909872055,
0.06699749082326889,
0.022247930988669395,
0.17079433798789978,
0.16457822918891907,
-0.003302011638879776,
-0.07962261140346527,
-0.013621993362903595,
0.21880324184894562,
-0.19506913423538208,
-0.1675596684217453,
-0.12804758548736572,
0.0020943284034729004,
0.3573179543018341,
-0.025900525972247124,
-0.29754993319511414,
0.15886540710926056,
0.11506294459104538,
0.0991566851735115,
-0.3214535713195801,
0.3626996874809265,
-0.19846373796463013,
-0.02036242187023163,
0.0691281408071518,
-0.15047122538089752,
0.37920957803726196,
-0.22043859958648682,
-0.03304758667945862,
-0.08182770013809204,
0.12814156711101532,
-0.16707712411880493,
-0.22100013494491577,
0.3402222692966461,
0.38842451572418213,
-0.10763649642467499,
0.10821394622325897,
-0.25519275665283203,
-0.08646275848150253,
0.040304481983184814,
-0.36969074606895447,
-0.3087161183357239,
-0.0074881562031805515,
-0.0002531483769416809,
0.008524507284164429,
0.10309776663780212,
0.24583062529563904,
0.10533731430768967,
-0.027840254828333855,
-0.22922900319099426,
-0.1855800449848175,
0.20947544276714325,
-0.2946496903896332,
-0.31304094195365906,
-0.03537982702255249,
0.05562475696206093,
-0.16362905502319336,
0.2511020004749298,
-0.46240702271461487,
0.14574888348579407,
0.22974419593811035,
-0.025514401495456696,
-0.4540731608867645,
0.2232973277568817,
0.2540613114833832,
0.016472186893224716,
-0.20769661664962769,
0.05345691740512848,
0.1526237428188324,
-0.1369924396276474,
-0.20163996517658234,
-0.1757192611694336
] |
https://github.com/huggingface/datasets/issues/633 | Load large text file for LM pre-training resulting in OOM | @lhoestq sure. Here you have https://colab.research.google.com/drive/1ba09ZOpyHGAOQLcsxiQAHRXl10qnMU5o?usp=sharing let me know if the link works and it reproduces the issue. To me, it reproduces the issue, since if you start the training the ram memory keeps increasing.
Let me know. Thanks! | I tried to pretrain Longformer using transformers and datasets. But I got OOM issues with loading a large text file. My script is almost like this:
```python
from datasets import load_dataset
@dataclass
class DataCollatorForDatasetsLanguageModeling(DataCollatorForLanguageModeling):
"""
Data collator used for language modeling based on DataCollatorForLazyLanguageModeling
- collates batches of tensors, honoring their tokenizer's pad_token
- preprocesses batches for masked language modeling
"""
block_size: int = 512
def __call__(self, examples: List[dict]) -> Dict[str, torch.Tensor]:
examples = [example['text'] for example in examples]
batch, attention_mask = self._tensorize_batch(examples)
if self.mlm:
inputs, labels = self.mask_tokens(batch)
return {"input_ids": inputs, "labels": labels}
else:
labels = batch.clone().detach()
if self.tokenizer.pad_token_id is not None:
labels[labels == self.tokenizer.pad_token_id] = -100
return {"input_ids": batch, "labels": labels}
def _tensorize_batch(self, examples: List[str]) -> Tuple[torch.Tensor, torch.Tensor]:
if self.tokenizer._pad_token is None:
raise ValueError(
"You are attempting to pad samples but the tokenizer you are using"
f" ({self.tokenizer.__class__.__name__}) does not have one."
)
tensor_examples = self.tokenizer.batch_encode_plus(
[ex for ex in examples if ex],
max_length=self.block_size,
return_tensors="pt",
pad_to_max_length=True,
return_attention_mask=True,
truncation=True,
)
input_ids, attention_mask = tensor_examples["input_ids"], tensor_examples["attention_mask"]
return input_ids, attention_mask
dataset = load_dataset('text', data_files='train.txt',cache_dir="./", , split='train')
data_collator = DataCollatorForDatasetsLanguageModeling(tokenizer=tokenizer, mlm=True,
mlm_probability=0.15, block_size=tokenizer.max_len)
trainer = Trainer(model=model, args=args, data_collator=data_collator,
train_dataset=train_dataset, prediction_loss_only=True, )
trainer.train(model_path=model_path)
```
This train.txt is about 1.1GB and has 90k lines where each line is a sequence of 4k words.
During training, the memory usage increased fast as the following graph and resulted in OOM before the finish of training.

Could you please give me any suggestions on why this happened and how to fix it?
Thanks. | 39 | Load large text file for LM pre-training resulting in OOM
I tried to pretrain Longformer using transformers and datasets. But I got OOM issues with loading a large text file. My script is almost like this:
```python
from datasets import load_dataset
@dataclass
class DataCollatorForDatasetsLanguageModeling(DataCollatorForLanguageModeling):
"""
Data collator used for language modeling based on DataCollatorForLazyLanguageModeling
- collates batches of tensors, honoring their tokenizer's pad_token
- preprocesses batches for masked language modeling
"""
block_size: int = 512
def __call__(self, examples: List[dict]) -> Dict[str, torch.Tensor]:
examples = [example['text'] for example in examples]
batch, attention_mask = self._tensorize_batch(examples)
if self.mlm:
inputs, labels = self.mask_tokens(batch)
return {"input_ids": inputs, "labels": labels}
else:
labels = batch.clone().detach()
if self.tokenizer.pad_token_id is not None:
labels[labels == self.tokenizer.pad_token_id] = -100
return {"input_ids": batch, "labels": labels}
def _tensorize_batch(self, examples: List[str]) -> Tuple[torch.Tensor, torch.Tensor]:
if self.tokenizer._pad_token is None:
raise ValueError(
"You are attempting to pad samples but the tokenizer you are using"
f" ({self.tokenizer.__class__.__name__}) does not have one."
)
tensor_examples = self.tokenizer.batch_encode_plus(
[ex for ex in examples if ex],
max_length=self.block_size,
return_tensors="pt",
pad_to_max_length=True,
return_attention_mask=True,
truncation=True,
)
input_ids, attention_mask = tensor_examples["input_ids"], tensor_examples["attention_mask"]
return input_ids, attention_mask
dataset = load_dataset('text', data_files='train.txt',cache_dir="./", , split='train')
data_collator = DataCollatorForDatasetsLanguageModeling(tokenizer=tokenizer, mlm=True,
mlm_probability=0.15, block_size=tokenizer.max_len)
trainer = Trainer(model=model, args=args, data_collator=data_collator,
train_dataset=train_dataset, prediction_loss_only=True, )
trainer.train(model_path=model_path)
```
This train.txt is about 1.1GB and has 90k lines where each line is a sequence of 4k words.
During training, the memory usage increased fast as the following graph and resulted in OOM before the finish of training.

Could you please give me any suggestions on why this happened and how to fix it?
Thanks.
@lhoestq sure. Here you have https://colab.research.google.com/drive/1ba09ZOpyHGAOQLcsxiQAHRXl10qnMU5o?usp=sharing let me know if the link works and it reproduces the issue. To me, it reproduces the issue, since if you start the training the ram memory keeps increasing.
Let me know. Thanks! | [
-0.6339283585548401,
-0.47753778100013733,
0.010693363845348358,
0.29863524436950684,
0.36004769802093506,
-0.1518251597881317,
0.5567324757575989,
0.37380579113960266,
0.01088225468993187,
0.010719746351242065,
-0.1295929253101349,
-0.1828002780675888,
-0.26698487997055054,
-0.16208980977535248,
-0.03237204998731613,
0.023206885904073715,
-0.09982117265462875,
0.19687515497207642,
-0.2772675156593323,
-0.09666657447814941,
0.05701180547475815,
-0.07762926816940308,
-0.21276047825813293,
-0.029743991792201996,
-0.3879220187664032,
-0.06171319633722305,
0.3158179223537445,
0.12212134897708893,
-0.1640809327363968,
-0.0958080142736435,
-0.22970141470432281,
0.1197899580001831,
0.4393485188484192,
0.4340214729309082,
-0.00011477212683530524,
0.006616219878196716,
0.18904384970664978,
-0.23633266985416412,
-0.16726946830749512,
0.019216440618038177,
0.07755492627620697,
-0.3022913932800293,
-0.10640020668506622,
-0.3036171495914459,
-0.02724609524011612,
-0.10612530261278152,
-0.015682043507695198,
-0.22437302768230438,
0.4987519383430481,
0.5414043068885803,
0.15876251459121704,
0.25081300735473633,
-0.21366100013256073,
0.0723966509103775,
0.25443702936172485,
0.0488995760679245,
0.1056830957531929,
-0.27951449155807495,
0.46878406405448914,
-0.1923186331987381,
-0.47268855571746826,
0.1478176862001419,
-0.22477363049983978,
-0.20168264210224152,
-0.09508860856294632,
0.03820447996258736,
0.36608895659446716,
0.031569477170705795,
0.2641869783401489,
0.3474210202693939,
0.4272076189517975,
-0.0008120127022266388,
-0.289635568857193,
-0.3209858536720276,
-0.14262455701828003,
-0.08431586623191833,
0.18923655152320862,
0.2010769546031952,
0.059826578944921494,
0.11845916509628296,
0.10712733119726181,
-0.12533129751682281,
-0.15199026465415955,
0.07616106420755386,
-0.27480751276016235,
0.33979544043540955,
-0.20125117897987366,
-0.03804318606853485,
0.15557512640953064,
-0.09447921812534332,
0.19616937637329102,
-0.09977510571479797,
0.003403950482606888,
0.25671419501304626,
-0.245441272854805,
-0.11239507794380188,
-0.07168225198984146,
-0.5194145441055298,
0.16278403997421265,
-0.2759450674057007,
0.1981883943080902,
0.29723939299583435,
-0.08766181021928787,
-0.06761691719293594,
0.08639387786388397,
0.4202020466327667,
-0.25243741273880005,
0.26052793860435486,
0.22725635766983032,
0.16401110589504242,
-0.17170630395412445,
-0.04439859092235565,
-0.33051154017448425,
-0.19624567031860352,
0.10159362852573395,
-0.07734166085720062,
-0.011017010547220707,
-0.2546045482158661,
-0.24042175710201263,
0.05854658782482147,
-0.14076969027519226,
-0.03084544464945793,
0.2748163938522339,
0.38997286558151245,
-0.3540611267089844,
0.4294978082180023,
0.16510933637619019,
0.052328936755657196,
-0.4855332672595978,
-0.33652669191360474,
-0.17440199851989746,
0.15325728058815002,
-0.20324474573135376,
0.038975562900304794,
0.12979257106781006,
0.13963374495506287,
0.05965423583984375,
-0.04288341850042343,
-0.0625898689031601,
-0.44021931290626526,
-0.009444482624530792,
-0.024103429168462753,
0.020752981305122375,
-0.04251480475068092,
0.06302379071712494,
-0.02336559072136879,
0.23476582765579224,
-0.12499457597732544,
-0.025381658226251602,
0.3477915823459625,
-0.2762118875980377,
-0.2276410162448883,
0.05097950994968414,
0.21017630398273468,
-0.02824842929840088,
0.20915503799915314,
0.028506658971309662,
0.07685685157775879,
0.5359783172607422,
0.006653331220149994,
-0.04714777320623398,
-0.3782060742378235,
0.09452182054519653,
0.09201760590076447,
0.1619914025068283,
0.17663070559501648,
-0.042587969452142715,
-0.07260239124298096,
0.0063892244361341,
0.10358665883541107,
0.25504034757614136,
0.3907330334186554,
-0.22647030651569366,
0.2906738817691803,
0.007004471495747566,
-0.05665605142712593,
0.5319919586181641,
-0.2620989978313446,
-0.448444128036499,
0.23385274410247803,
-0.3511556386947632,
0.10818185657262802,
0.22066983580589294,
0.1759030818939209,
0.11388914287090302,
-0.1089852899312973,
0.26901498436927795,
0.3656851649284363,
0.07051589339971542,
0.1209140196442604,
-0.23662437498569489,
-0.09222844988107681,
-0.1715157926082611,
0.48420286178588867,
0.36272403597831726,
-0.02558579295873642,
-0.07308889180421829,
0.35637998580932617,
0.18339842557907104,
-0.1992236077785492,
0.13128061592578888,
0.36934155225753784,
-0.17442509531974792,
-0.1261582374572754,
0.0944812074303627,
0.06559769064188004,
-0.3000325560569763,
-0.07098697125911713,
-0.09084425866603851,
0.0828668475151062,
-0.1136055737733841,
-0.08942607045173645,
0.28255847096443176,
0.02287023328244686,
-0.0766652524471283,
0.11318020522594452,
0.03794129937887192,
-0.13182224333286285,
0.024866361171007156,
-0.07041719555854797,
0.1261971890926361,
0.015421975404024124,
-0.09320687502622604,
0.08736041188240051,
-0.2184159904718399,
-0.12394054979085922,
0.0018030330538749695,
-0.137061208486557,
0.07695000618696213,
0.17527323961257935,
-0.05118799954652786,
0.03840121626853943,
-0.17304009199142456,
0.10695729404687881,
-0.15297769010066986,
-0.2987070679664612,
-0.5071570873260498,
0.43589335680007935,
0.18647874891757965,
-0.33810955286026,
0.3402597904205322,
0.1040273904800415,
-0.029599443078041077,
-0.10627070814371109,
-0.11989574879407883,
0.5749332904815674,
0.27307116985321045,
0.019617579877376556,
0.29909294843673706,
-0.24541117250919342,
0.2542804777622223,
-0.2662392258644104,
-0.10361561179161072,
-0.09776493161916733,
0.4209232032299042,
0.03105533868074417,
0.23506294190883636,
0.14828065037727356,
-0.08694546669721603,
-0.232059508562088,
0.47038108110427856,
-0.1788094937801361,
-0.013872608542442322,
0.26652613282203674,
-0.4247211217880249,
-0.011563490144908428,
-0.34802117943763733,
-0.24947787821292877,
0.0067334845662117004,
0.17322899401187897,
-0.09441326558589935,
-0.055435195565223694,
0.008537785150110722,
-0.26279330253601074,
0.007836148142814636,
0.1532370001077652,
-0.0718524307012558,
0.31983456015586853,
0.11651500314474106,
0.10059522092342377,
-0.122891865670681,
-0.1794070154428482,
0.10284756124019623,
0.17828989028930664,
-0.27519121766090393,
0.18444325029850006,
-0.02282267063856125,
-0.013446485623717308,
-0.2862633764743805,
0.1904245764017105,
-0.12680108845233917,
0.0388152077794075,
-0.0647432953119278,
0.25868889689445496,
-0.07790280133485794,
0.10191172361373901,
0.3001607060432434,
0.3549228012561798,
0.4629628658294678,
-0.07809486240148544,
0.326348215341568,
-0.08266382664442062,
-0.1796954870223999,
0.032943595200777054,
0.33450770378112793,
-0.3179926872253418,
-0.024890778586268425,
0.005377540364861488,
0.05117718130350113,
-0.09892972558736801,
-0.16603437066078186,
0.09468895941972733,
0.196824312210083,
-0.16618932783603668,
-0.2573060691356659,
-0.07217618823051453,
0.17769087851047516,
-0.042431723326444626,
0.11972848325967789,
-0.23244111239910126,
0.008407561108469963,
0.1450573354959488,
-0.006289597600698471,
-0.18432363867759705,
0.04044550284743309,
-0.1199219599366188,
-0.04705164581537247,
-0.411641389131546,
-0.05351852625608444,
0.10705065727233887,
0.13673138618469238,
0.35936760902404785,
0.10678976029157639,
0.19445137679576874,
0.28844478726387024,
0.15859206020832062,
0.006367621943354607,
-0.0885988399386406,
0.5141718983650208,
-0.017572684213519096,
-0.29719802737236023,
-0.2908625900745392,
-0.23975418508052826,
0.02511288784444332,
0.3155249357223511,
-0.684260904788971,
0.23378321528434753,
-0.1138516515493393,
-0.09402675926685333,
-0.3955192267894745,
0.0007258430123329163,
0.2522047758102417,
-0.07614870369434357,
0.016339777037501335,
0.09547417610883713,
0.2302767038345337,
0.1546790897846222,
-0.03878729045391083,
0.38579460978507996,
-0.4130840301513672,
0.35940811038017273,
-0.13545823097229004,
0.4855530261993408,
-0.122118279337883,
-0.2300206571817398,
0.09887474775314331,
0.15044830739498138,
-0.01711525395512581,
-0.021802209317684174,
-0.013968504965305328,
-0.25937944650650024,
-0.058237224817276,
0.0227312333881855,
0.5197213292121887,
0.01689060777425766,
-0.16558955609798431,
-0.015898926183581352,
0.06816425919532776,
0.2563197910785675,
-0.26069891452789307,
0.49052777886390686,
-0.19077889621257782,
0.01841624826192856,
-0.19967399537563324,
0.01874571293592453,
-0.20498108863830566,
-0.21508586406707764,
-0.164134681224823,
0.09344439208507538,
-0.03038274496793747,
-0.22404396533966064,
-0.2116939276456833,
0.10314016044139862,
-0.3681343197822571,
-0.0437651127576828,
0.11799006909132004,
0.22933240234851837,
0.18077029287815094,
-0.19614383578300476,
-0.08628876507282257,
-0.20187069475650787,
0.35741427540779114,
0.1934524029493332,
0.11246532201766968,
0.16325931251049042,
-0.05687852203845978,
-0.2155371457338333,
-0.17745190858840942,
-0.29045435786247253,
0.14190825819969177,
0.6505106687545776,
0.6102464199066162,
-0.21627351641654968,
-0.15859898924827576,
0.07914479076862335,
0.002603483386337757,
-0.16527341306209564,
-0.548757016658783,
-0.12850907444953918,
-0.16549962759017944,
-0.44105130434036255,
0.004606112837791443,
0.35849836468696594,
0.3558535575866699,
-0.2264459729194641,
-0.03187551349401474,
0.13872987031936646,
-0.0007013268768787384,
0.37175118923187256,
-0.12976384162902832,
0.015054157003760338,
-0.06641082465648651,
0.225828617811203,
-0.10741686820983887,
0.36735567450523376,
0.24888965487480164,
0.35636386275291443,
0.1917259395122528,
-0.31755685806274414,
0.0706881731748581,
-0.029888737946748734,
0.23143038153648376,
0.11516103148460388,
0.11022848635911942,
0.3546280860900879,
0.1289711445569992,
0.3322555422782898,
-0.19096627831459045,
0.6737229228019714,
-0.007344553247094154,
0.20682765543460846,
-0.8374910354614258,
-0.26737040281295776,
0.33145615458488464,
-0.02635771967470646,
0.19940276443958282,
0.215718075633049,
-0.40385204553604126,
-0.3216697573661804,
0.376661479473114,
0.09908346086740494,
0.7675239443778992,
-0.2972695827484131,
0.39625850319862366,
-0.1552990972995758,
0.6611965894699097,
0.12803049385547638,
-0.3813104033470154,
0.1585618406534195,
-0.39879149198532104,
-0.2663658857345581,
0.21300511062145233,
-0.09231188893318176,
0.036539800465106964,
0.16050389409065247,
-0.2905767560005188,
-0.029811730608344078,
0.0862521380186081,
0.2249334454536438,
0.13066981732845306,
0.5134936571121216,
0.12092680484056473,
-0.6006978154182434,
-0.08281297981739044,
0.02656909078359604,
-0.02340024709701538,
-0.10490188002586365,
-0.0492798313498497,
0.07994647324085236,
-0.0313267819583416,
-0.20856402814388275,
-0.028466172516345978,
0.20525774359703064,
-0.2474464625120163,
0.08661594241857529,
0.06375248730182648,
-0.07205313444137573,
0.5367995500564575,
0.10623051226139069,
-0.001361064612865448,
0.4988958239555359,
-0.039286620914936066,
0.13215835392475128,
-0.2274819314479828,
-0.1652863323688507,
0.20070844888687134,
-0.06584891676902771,
0.4217033088207245,
0.08837933093309402,
-0.0005880966782569885,
0.11410333216190338,
0.0632382407784462,
-0.046690933406353,
0.09476359188556671,
-0.36430907249450684,
0.10549724102020264,
-0.41123154759407043,
-0.21542777121067047,
-0.08843062818050385,
-0.30078285932540894,
-0.1009221225976944,
0.12310943007469177,
0.13735687732696533,
-0.46444618701934814,
0.11514545977115631,
0.2652113139629364,
-0.3750092685222626,
0.011997109279036522,
0.38382449746131897,
0.17105859518051147,
-0.10513918846845627,
0.49984270334243774,
0.4575878381729126,
-0.053361937403678894,
-0.2644973695278168,
-0.10962903499603271,
0.29444822669029236,
-0.2731435000896454,
0.0849163606762886,
-0.2455592304468155,
-0.3016006648540497,
0.209351047873497,
0.08087542653083801,
0.10009974241256714,
-0.01499941200017929,
-0.06326231360435486,
-0.25102943181991577,
-0.6380501389503479,
-0.18144388496875763,
-0.0027230940759181976,
-0.00354844331741333,
0.1460832953453064,
0.27389806509017944,
-0.3100467920303345,
0.5892773270606995,
-0.2788558602333069,
-0.05294197052717209,
-0.20760811865329742,
0.2782232165336609,
-0.055562183260917664,
-0.38554659485816956,
0.21153579652309418,
0.2033519148826599,
0.1001039668917656,
0.08059665560722351,
0.00590919703245163,
-0.22135356068611145,
-0.14351996779441833,
0.11271549016237259,
0.23647010326385498,
-0.41966331005096436,
-0.01599399372935295,
-0.312997043132782,
-0.09248970448970795,
-0.27002182602882385,
0.06606784462928772,
0.017028577625751495,
0.01394578069448471,
-0.22617922723293304,
0.009393874555826187,
0.04752609133720398,
-0.2552624046802521,
0.04206028953194618,
-0.25458529591560364,
0.12509100139141083,
0.2465714067220688,
0.1331031173467636,
0.11783083528280258,
0.0006371289491653442,
-0.3931019604206085,
0.17964592576026917,
0.6661380529403687,
-0.017532095313072205,
0.4190823435783386,
-0.43573224544525146,
-0.0715063214302063,
0.24765951931476593,
0.04980342835187912,
0.048066146671772,
-0.34167730808258057,
-0.010718589648604393,
0.2935883700847626,
0.22681888937950134,
0.015208568423986435,
-0.014733202755451202,
0.22635462880134583,
-0.41129830479621887,
0.1301487535238266,
0.3453426659107208,
-0.11192676424980164,
-0.06747587025165558,
0.1559651792049408,
0.09132310748100281,
0.5066777467727661,
0.11496534198522568,
0.005711604841053486,
0.24894991517066956,
-0.00122002512216568,
0.15485714375972748,
0.48569241166114807,
0.261119544506073,
0.23868051171302795,
0.3016282618045807,
-0.032666049897670746,
-0.04069993644952774,
-0.2312840223312378,
0.2294139564037323,
-0.435617059469223,
-0.41516661643981934,
-0.2674567401409149,
0.5044151544570923,
-0.01932355761528015,
0.12420932948589325,
-0.3350299298763275,
-0.06624119728803635,
-0.04065354913473129,
0.2541331350803375,
-0.11921557784080505,
0.2744082510471344,
-0.45309436321258545,
-0.17059893906116486,
-0.08942428231239319,
-0.12396197021007538,
0.011534325778484344,
0.18963316082954407,
-0.0558583103120327,
0.27227628231048584,
-0.5796654224395752,
0.22938616573810577,
0.05213649570941925,
0.1451501101255417,
-0.1346784234046936,
0.1227787584066391,
0.10550137609243393,
-0.5078572034835815,
0.34333521127700806,
0.23785626888275146,
0.29185950756073,
0.11540549993515015,
-0.22190696001052856,
0.34437036514282227,
0.43669766187667847,
-0.1908072531223297,
-0.04061196744441986,
-0.12098392844200134,
-0.03561992570757866,
-0.1499127894639969,
0.19743536412715912,
0.3490368723869324,
0.18789905309677124,
0.2596159875392914,
0.0557275116443634,
-0.26596614718437195,
0.27851778268814087,
0.06501396000385284,
-0.3240588903427124,
0.17866621911525726,
-0.13293880224227905,
0.4019324481487274,
-0.32858094573020935,
-0.4429645836353302,
0.00986664742231369,
-0.39412444829940796,
0.21558675169944763,
0.6670199036598206,
-0.2954224944114685,
0.28785526752471924,
-0.02548792213201523,
0.04855022579431534,
0.0018409136682748795,
0.47605016827583313,
0.46973514556884766,
0.2841596007347107,
-0.37837129831314087,
-0.025667212903499603,
-0.32888373732566833,
0.2765583097934723,
-0.2024305909872055,
0.06699749082326889,
0.022247930988669395,
0.17079433798789978,
0.16457822918891907,
-0.003302011638879776,
-0.07962261140346527,
-0.013621993362903595,
0.21880324184894562,
-0.19506913423538208,
-0.1675596684217453,
-0.12804758548736572,
0.0020943284034729004,
0.3573179543018341,
-0.025900525972247124,
-0.29754993319511414,
0.15886540710926056,
0.11506294459104538,
0.0991566851735115,
-0.3214535713195801,
0.3626996874809265,
-0.19846373796463013,
-0.02036242187023163,
0.0691281408071518,
-0.15047122538089752,
0.37920957803726196,
-0.22043859958648682,
-0.03304758667945862,
-0.08182770013809204,
0.12814156711101532,
-0.16707712411880493,
-0.22100013494491577,
0.3402222692966461,
0.38842451572418213,
-0.10763649642467499,
0.10821394622325897,
-0.25519275665283203,
-0.08646275848150253,
0.040304481983184814,
-0.36969074606895447,
-0.3087161183357239,
-0.0074881562031805515,
-0.0002531483769416809,
0.008524507284164429,
0.10309776663780212,
0.24583062529563904,
0.10533731430768967,
-0.027840254828333855,
-0.22922900319099426,
-0.1855800449848175,
0.20947544276714325,
-0.2946496903896332,
-0.31304094195365906,
-0.03537982702255249,
0.05562475696206093,
-0.16362905502319336,
0.2511020004749298,
-0.46240702271461487,
0.14574888348579407,
0.22974419593811035,
-0.025514401495456696,
-0.4540731608867645,
0.2232973277568817,
0.2540613114833832,
0.016472186893224716,
-0.20769661664962769,
0.05345691740512848,
0.1526237428188324,
-0.1369924396276474,
-0.20163996517658234,
-0.1757192611694336
] |
https://github.com/huggingface/datasets/issues/633 | Load large text file for LM pre-training resulting in OOM | Could the bug be comming from tokenizers?
I got this warning at the terminal from my jupyter notebook:
```
huggingface/tokenizers: The current process just got forked, after parallelism has already been used. Disabling parallelism to avoid deadlocks...
To disable this warning, you can either:
- Avoid using `tokenizers` before the fork if possible
- Explicitly set the environment variable TOKENIZERS_PARALLELISM=(true | false)
``` | I tried to pretrain Longformer using transformers and datasets. But I got OOM issues with loading a large text file. My script is almost like this:
```python
from datasets import load_dataset
@dataclass
class DataCollatorForDatasetsLanguageModeling(DataCollatorForLanguageModeling):
"""
Data collator used for language modeling based on DataCollatorForLazyLanguageModeling
- collates batches of tensors, honoring their tokenizer's pad_token
- preprocesses batches for masked language modeling
"""
block_size: int = 512
def __call__(self, examples: List[dict]) -> Dict[str, torch.Tensor]:
examples = [example['text'] for example in examples]
batch, attention_mask = self._tensorize_batch(examples)
if self.mlm:
inputs, labels = self.mask_tokens(batch)
return {"input_ids": inputs, "labels": labels}
else:
labels = batch.clone().detach()
if self.tokenizer.pad_token_id is not None:
labels[labels == self.tokenizer.pad_token_id] = -100
return {"input_ids": batch, "labels": labels}
def _tensorize_batch(self, examples: List[str]) -> Tuple[torch.Tensor, torch.Tensor]:
if self.tokenizer._pad_token is None:
raise ValueError(
"You are attempting to pad samples but the tokenizer you are using"
f" ({self.tokenizer.__class__.__name__}) does not have one."
)
tensor_examples = self.tokenizer.batch_encode_plus(
[ex for ex in examples if ex],
max_length=self.block_size,
return_tensors="pt",
pad_to_max_length=True,
return_attention_mask=True,
truncation=True,
)
input_ids, attention_mask = tensor_examples["input_ids"], tensor_examples["attention_mask"]
return input_ids, attention_mask
dataset = load_dataset('text', data_files='train.txt',cache_dir="./", , split='train')
data_collator = DataCollatorForDatasetsLanguageModeling(tokenizer=tokenizer, mlm=True,
mlm_probability=0.15, block_size=tokenizer.max_len)
trainer = Trainer(model=model, args=args, data_collator=data_collator,
train_dataset=train_dataset, prediction_loss_only=True, )
trainer.train(model_path=model_path)
```
This train.txt is about 1.1GB and has 90k lines where each line is a sequence of 4k words.
During training, the memory usage increased fast as the following graph and resulted in OOM before the finish of training.

Could you please give me any suggestions on why this happened and how to fix it?
Thanks. | 63 | Load large text file for LM pre-training resulting in OOM
I tried to pretrain Longformer using transformers and datasets. But I got OOM issues with loading a large text file. My script is almost like this:
```python
from datasets import load_dataset
@dataclass
class DataCollatorForDatasetsLanguageModeling(DataCollatorForLanguageModeling):
"""
Data collator used for language modeling based on DataCollatorForLazyLanguageModeling
- collates batches of tensors, honoring their tokenizer's pad_token
- preprocesses batches for masked language modeling
"""
block_size: int = 512
def __call__(self, examples: List[dict]) -> Dict[str, torch.Tensor]:
examples = [example['text'] for example in examples]
batch, attention_mask = self._tensorize_batch(examples)
if self.mlm:
inputs, labels = self.mask_tokens(batch)
return {"input_ids": inputs, "labels": labels}
else:
labels = batch.clone().detach()
if self.tokenizer.pad_token_id is not None:
labels[labels == self.tokenizer.pad_token_id] = -100
return {"input_ids": batch, "labels": labels}
def _tensorize_batch(self, examples: List[str]) -> Tuple[torch.Tensor, torch.Tensor]:
if self.tokenizer._pad_token is None:
raise ValueError(
"You are attempting to pad samples but the tokenizer you are using"
f" ({self.tokenizer.__class__.__name__}) does not have one."
)
tensor_examples = self.tokenizer.batch_encode_plus(
[ex for ex in examples if ex],
max_length=self.block_size,
return_tensors="pt",
pad_to_max_length=True,
return_attention_mask=True,
truncation=True,
)
input_ids, attention_mask = tensor_examples["input_ids"], tensor_examples["attention_mask"]
return input_ids, attention_mask
dataset = load_dataset('text', data_files='train.txt',cache_dir="./", , split='train')
data_collator = DataCollatorForDatasetsLanguageModeling(tokenizer=tokenizer, mlm=True,
mlm_probability=0.15, block_size=tokenizer.max_len)
trainer = Trainer(model=model, args=args, data_collator=data_collator,
train_dataset=train_dataset, prediction_loss_only=True, )
trainer.train(model_path=model_path)
```
This train.txt is about 1.1GB and has 90k lines where each line is a sequence of 4k words.
During training, the memory usage increased fast as the following graph and resulted in OOM before the finish of training.

Could you please give me any suggestions on why this happened and how to fix it?
Thanks.
Could the bug be comming from tokenizers?
I got this warning at the terminal from my jupyter notebook:
```
huggingface/tokenizers: The current process just got forked, after parallelism has already been used. Disabling parallelism to avoid deadlocks...
To disable this warning, you can either:
- Avoid using `tokenizers` before the fork if possible
- Explicitly set the environment variable TOKENIZERS_PARALLELISM=(true | false)
``` | [
-0.6339283585548401,
-0.47753778100013733,
0.010693363845348358,
0.29863524436950684,
0.36004769802093506,
-0.1518251597881317,
0.5567324757575989,
0.37380579113960266,
0.01088225468993187,
0.010719746351242065,
-0.1295929253101349,
-0.1828002780675888,
-0.26698487997055054,
-0.16208980977535248,
-0.03237204998731613,
0.023206885904073715,
-0.09982117265462875,
0.19687515497207642,
-0.2772675156593323,
-0.09666657447814941,
0.05701180547475815,
-0.07762926816940308,
-0.21276047825813293,
-0.029743991792201996,
-0.3879220187664032,
-0.06171319633722305,
0.3158179223537445,
0.12212134897708893,
-0.1640809327363968,
-0.0958080142736435,
-0.22970141470432281,
0.1197899580001831,
0.4393485188484192,
0.4340214729309082,
-0.00011477212683530524,
0.006616219878196716,
0.18904384970664978,
-0.23633266985416412,
-0.16726946830749512,
0.019216440618038177,
0.07755492627620697,
-0.3022913932800293,
-0.10640020668506622,
-0.3036171495914459,
-0.02724609524011612,
-0.10612530261278152,
-0.015682043507695198,
-0.22437302768230438,
0.4987519383430481,
0.5414043068885803,
0.15876251459121704,
0.25081300735473633,
-0.21366100013256073,
0.0723966509103775,
0.25443702936172485,
0.0488995760679245,
0.1056830957531929,
-0.27951449155807495,
0.46878406405448914,
-0.1923186331987381,
-0.47268855571746826,
0.1478176862001419,
-0.22477363049983978,
-0.20168264210224152,
-0.09508860856294632,
0.03820447996258736,
0.36608895659446716,
0.031569477170705795,
0.2641869783401489,
0.3474210202693939,
0.4272076189517975,
-0.0008120127022266388,
-0.289635568857193,
-0.3209858536720276,
-0.14262455701828003,
-0.08431586623191833,
0.18923655152320862,
0.2010769546031952,
0.059826578944921494,
0.11845916509628296,
0.10712733119726181,
-0.12533129751682281,
-0.15199026465415955,
0.07616106420755386,
-0.27480751276016235,
0.33979544043540955,
-0.20125117897987366,
-0.03804318606853485,
0.15557512640953064,
-0.09447921812534332,
0.19616937637329102,
-0.09977510571479797,
0.003403950482606888,
0.25671419501304626,
-0.245441272854805,
-0.11239507794380188,
-0.07168225198984146,
-0.5194145441055298,
0.16278403997421265,
-0.2759450674057007,
0.1981883943080902,
0.29723939299583435,
-0.08766181021928787,
-0.06761691719293594,
0.08639387786388397,
0.4202020466327667,
-0.25243741273880005,
0.26052793860435486,
0.22725635766983032,
0.16401110589504242,
-0.17170630395412445,
-0.04439859092235565,
-0.33051154017448425,
-0.19624567031860352,
0.10159362852573395,
-0.07734166085720062,
-0.011017010547220707,
-0.2546045482158661,
-0.24042175710201263,
0.05854658782482147,
-0.14076969027519226,
-0.03084544464945793,
0.2748163938522339,
0.38997286558151245,
-0.3540611267089844,
0.4294978082180023,
0.16510933637619019,
0.052328936755657196,
-0.4855332672595978,
-0.33652669191360474,
-0.17440199851989746,
0.15325728058815002,
-0.20324474573135376,
0.038975562900304794,
0.12979257106781006,
0.13963374495506287,
0.05965423583984375,
-0.04288341850042343,
-0.0625898689031601,
-0.44021931290626526,
-0.009444482624530792,
-0.024103429168462753,
0.020752981305122375,
-0.04251480475068092,
0.06302379071712494,
-0.02336559072136879,
0.23476582765579224,
-0.12499457597732544,
-0.025381658226251602,
0.3477915823459625,
-0.2762118875980377,
-0.2276410162448883,
0.05097950994968414,
0.21017630398273468,
-0.02824842929840088,
0.20915503799915314,
0.028506658971309662,
0.07685685157775879,
0.5359783172607422,
0.006653331220149994,
-0.04714777320623398,
-0.3782060742378235,
0.09452182054519653,
0.09201760590076447,
0.1619914025068283,
0.17663070559501648,
-0.042587969452142715,
-0.07260239124298096,
0.0063892244361341,
0.10358665883541107,
0.25504034757614136,
0.3907330334186554,
-0.22647030651569366,
0.2906738817691803,
0.007004471495747566,
-0.05665605142712593,
0.5319919586181641,
-0.2620989978313446,
-0.448444128036499,
0.23385274410247803,
-0.3511556386947632,
0.10818185657262802,
0.22066983580589294,
0.1759030818939209,
0.11388914287090302,
-0.1089852899312973,
0.26901498436927795,
0.3656851649284363,
0.07051589339971542,
0.1209140196442604,
-0.23662437498569489,
-0.09222844988107681,
-0.1715157926082611,
0.48420286178588867,
0.36272403597831726,
-0.02558579295873642,
-0.07308889180421829,
0.35637998580932617,
0.18339842557907104,
-0.1992236077785492,
0.13128061592578888,
0.36934155225753784,
-0.17442509531974792,
-0.1261582374572754,
0.0944812074303627,
0.06559769064188004,
-0.3000325560569763,
-0.07098697125911713,
-0.09084425866603851,
0.0828668475151062,
-0.1136055737733841,
-0.08942607045173645,
0.28255847096443176,
0.02287023328244686,
-0.0766652524471283,
0.11318020522594452,
0.03794129937887192,
-0.13182224333286285,
0.024866361171007156,
-0.07041719555854797,
0.1261971890926361,
0.015421975404024124,
-0.09320687502622604,
0.08736041188240051,
-0.2184159904718399,
-0.12394054979085922,
0.0018030330538749695,
-0.137061208486557,
0.07695000618696213,
0.17527323961257935,
-0.05118799954652786,
0.03840121626853943,
-0.17304009199142456,
0.10695729404687881,
-0.15297769010066986,
-0.2987070679664612,
-0.5071570873260498,
0.43589335680007935,
0.18647874891757965,
-0.33810955286026,
0.3402597904205322,
0.1040273904800415,
-0.029599443078041077,
-0.10627070814371109,
-0.11989574879407883,
0.5749332904815674,
0.27307116985321045,
0.019617579877376556,
0.29909294843673706,
-0.24541117250919342,
0.2542804777622223,
-0.2662392258644104,
-0.10361561179161072,
-0.09776493161916733,
0.4209232032299042,
0.03105533868074417,
0.23506294190883636,
0.14828065037727356,
-0.08694546669721603,
-0.232059508562088,
0.47038108110427856,
-0.1788094937801361,
-0.013872608542442322,
0.26652613282203674,
-0.4247211217880249,
-0.011563490144908428,
-0.34802117943763733,
-0.24947787821292877,
0.0067334845662117004,
0.17322899401187897,
-0.09441326558589935,
-0.055435195565223694,
0.008537785150110722,
-0.26279330253601074,
0.007836148142814636,
0.1532370001077652,
-0.0718524307012558,
0.31983456015586853,
0.11651500314474106,
0.10059522092342377,
-0.122891865670681,
-0.1794070154428482,
0.10284756124019623,
0.17828989028930664,
-0.27519121766090393,
0.18444325029850006,
-0.02282267063856125,
-0.013446485623717308,
-0.2862633764743805,
0.1904245764017105,
-0.12680108845233917,
0.0388152077794075,
-0.0647432953119278,
0.25868889689445496,
-0.07790280133485794,
0.10191172361373901,
0.3001607060432434,
0.3549228012561798,
0.4629628658294678,
-0.07809486240148544,
0.326348215341568,
-0.08266382664442062,
-0.1796954870223999,
0.032943595200777054,
0.33450770378112793,
-0.3179926872253418,
-0.024890778586268425,
0.005377540364861488,
0.05117718130350113,
-0.09892972558736801,
-0.16603437066078186,
0.09468895941972733,
0.196824312210083,
-0.16618932783603668,
-0.2573060691356659,
-0.07217618823051453,
0.17769087851047516,
-0.042431723326444626,
0.11972848325967789,
-0.23244111239910126,
0.008407561108469963,
0.1450573354959488,
-0.006289597600698471,
-0.18432363867759705,
0.04044550284743309,
-0.1199219599366188,
-0.04705164581537247,
-0.411641389131546,
-0.05351852625608444,
0.10705065727233887,
0.13673138618469238,
0.35936760902404785,
0.10678976029157639,
0.19445137679576874,
0.28844478726387024,
0.15859206020832062,
0.006367621943354607,
-0.0885988399386406,
0.5141718983650208,
-0.017572684213519096,
-0.29719802737236023,
-0.2908625900745392,
-0.23975418508052826,
0.02511288784444332,
0.3155249357223511,
-0.684260904788971,
0.23378321528434753,
-0.1138516515493393,
-0.09402675926685333,
-0.3955192267894745,
0.0007258430123329163,
0.2522047758102417,
-0.07614870369434357,
0.016339777037501335,
0.09547417610883713,
0.2302767038345337,
0.1546790897846222,
-0.03878729045391083,
0.38579460978507996,
-0.4130840301513672,
0.35940811038017273,
-0.13545823097229004,
0.4855530261993408,
-0.122118279337883,
-0.2300206571817398,
0.09887474775314331,
0.15044830739498138,
-0.01711525395512581,
-0.021802209317684174,
-0.013968504965305328,
-0.25937944650650024,
-0.058237224817276,
0.0227312333881855,
0.5197213292121887,
0.01689060777425766,
-0.16558955609798431,
-0.015898926183581352,
0.06816425919532776,
0.2563197910785675,
-0.26069891452789307,
0.49052777886390686,
-0.19077889621257782,
0.01841624826192856,
-0.19967399537563324,
0.01874571293592453,
-0.20498108863830566,
-0.21508586406707764,
-0.164134681224823,
0.09344439208507538,
-0.03038274496793747,
-0.22404396533966064,
-0.2116939276456833,
0.10314016044139862,
-0.3681343197822571,
-0.0437651127576828,
0.11799006909132004,
0.22933240234851837,
0.18077029287815094,
-0.19614383578300476,
-0.08628876507282257,
-0.20187069475650787,
0.35741427540779114,
0.1934524029493332,
0.11246532201766968,
0.16325931251049042,
-0.05687852203845978,
-0.2155371457338333,
-0.17745190858840942,
-0.29045435786247253,
0.14190825819969177,
0.6505106687545776,
0.6102464199066162,
-0.21627351641654968,
-0.15859898924827576,
0.07914479076862335,
0.002603483386337757,
-0.16527341306209564,
-0.548757016658783,
-0.12850907444953918,
-0.16549962759017944,
-0.44105130434036255,
0.004606112837791443,
0.35849836468696594,
0.3558535575866699,
-0.2264459729194641,
-0.03187551349401474,
0.13872987031936646,
-0.0007013268768787384,
0.37175118923187256,
-0.12976384162902832,
0.015054157003760338,
-0.06641082465648651,
0.225828617811203,
-0.10741686820983887,
0.36735567450523376,
0.24888965487480164,
0.35636386275291443,
0.1917259395122528,
-0.31755685806274414,
0.0706881731748581,
-0.029888737946748734,
0.23143038153648376,
0.11516103148460388,
0.11022848635911942,
0.3546280860900879,
0.1289711445569992,
0.3322555422782898,
-0.19096627831459045,
0.6737229228019714,
-0.007344553247094154,
0.20682765543460846,
-0.8374910354614258,
-0.26737040281295776,
0.33145615458488464,
-0.02635771967470646,
0.19940276443958282,
0.215718075633049,
-0.40385204553604126,
-0.3216697573661804,
0.376661479473114,
0.09908346086740494,
0.7675239443778992,
-0.2972695827484131,
0.39625850319862366,
-0.1552990972995758,
0.6611965894699097,
0.12803049385547638,
-0.3813104033470154,
0.1585618406534195,
-0.39879149198532104,
-0.2663658857345581,
0.21300511062145233,
-0.09231188893318176,
0.036539800465106964,
0.16050389409065247,
-0.2905767560005188,
-0.029811730608344078,
0.0862521380186081,
0.2249334454536438,
0.13066981732845306,
0.5134936571121216,
0.12092680484056473,
-0.6006978154182434,
-0.08281297981739044,
0.02656909078359604,
-0.02340024709701538,
-0.10490188002586365,
-0.0492798313498497,
0.07994647324085236,
-0.0313267819583416,
-0.20856402814388275,
-0.028466172516345978,
0.20525774359703064,
-0.2474464625120163,
0.08661594241857529,
0.06375248730182648,
-0.07205313444137573,
0.5367995500564575,
0.10623051226139069,
-0.001361064612865448,
0.4988958239555359,
-0.039286620914936066,
0.13215835392475128,
-0.2274819314479828,
-0.1652863323688507,
0.20070844888687134,
-0.06584891676902771,
0.4217033088207245,
0.08837933093309402,
-0.0005880966782569885,
0.11410333216190338,
0.0632382407784462,
-0.046690933406353,
0.09476359188556671,
-0.36430907249450684,
0.10549724102020264,
-0.41123154759407043,
-0.21542777121067047,
-0.08843062818050385,
-0.30078285932540894,
-0.1009221225976944,
0.12310943007469177,
0.13735687732696533,
-0.46444618701934814,
0.11514545977115631,
0.2652113139629364,
-0.3750092685222626,
0.011997109279036522,
0.38382449746131897,
0.17105859518051147,
-0.10513918846845627,
0.49984270334243774,
0.4575878381729126,
-0.053361937403678894,
-0.2644973695278168,
-0.10962903499603271,
0.29444822669029236,
-0.2731435000896454,
0.0849163606762886,
-0.2455592304468155,
-0.3016006648540497,
0.209351047873497,
0.08087542653083801,
0.10009974241256714,
-0.01499941200017929,
-0.06326231360435486,
-0.25102943181991577,
-0.6380501389503479,
-0.18144388496875763,
-0.0027230940759181976,
-0.00354844331741333,
0.1460832953453064,
0.27389806509017944,
-0.3100467920303345,
0.5892773270606995,
-0.2788558602333069,
-0.05294197052717209,
-0.20760811865329742,
0.2782232165336609,
-0.055562183260917664,
-0.38554659485816956,
0.21153579652309418,
0.2033519148826599,
0.1001039668917656,
0.08059665560722351,
0.00590919703245163,
-0.22135356068611145,
-0.14351996779441833,
0.11271549016237259,
0.23647010326385498,
-0.41966331005096436,
-0.01599399372935295,
-0.312997043132782,
-0.09248970448970795,
-0.27002182602882385,
0.06606784462928772,
0.017028577625751495,
0.01394578069448471,
-0.22617922723293304,
0.009393874555826187,
0.04752609133720398,
-0.2552624046802521,
0.04206028953194618,
-0.25458529591560364,
0.12509100139141083,
0.2465714067220688,
0.1331031173467636,
0.11783083528280258,
0.0006371289491653442,
-0.3931019604206085,
0.17964592576026917,
0.6661380529403687,
-0.017532095313072205,
0.4190823435783386,
-0.43573224544525146,
-0.0715063214302063,
0.24765951931476593,
0.04980342835187912,
0.048066146671772,
-0.34167730808258057,
-0.010718589648604393,
0.2935883700847626,
0.22681888937950134,
0.015208568423986435,
-0.014733202755451202,
0.22635462880134583,
-0.41129830479621887,
0.1301487535238266,
0.3453426659107208,
-0.11192676424980164,
-0.06747587025165558,
0.1559651792049408,
0.09132310748100281,
0.5066777467727661,
0.11496534198522568,
0.005711604841053486,
0.24894991517066956,
-0.00122002512216568,
0.15485714375972748,
0.48569241166114807,
0.261119544506073,
0.23868051171302795,
0.3016282618045807,
-0.032666049897670746,
-0.04069993644952774,
-0.2312840223312378,
0.2294139564037323,
-0.435617059469223,
-0.41516661643981934,
-0.2674567401409149,
0.5044151544570923,
-0.01932355761528015,
0.12420932948589325,
-0.3350299298763275,
-0.06624119728803635,
-0.04065354913473129,
0.2541331350803375,
-0.11921557784080505,
0.2744082510471344,
-0.45309436321258545,
-0.17059893906116486,
-0.08942428231239319,
-0.12396197021007538,
0.011534325778484344,
0.18963316082954407,
-0.0558583103120327,
0.27227628231048584,
-0.5796654224395752,
0.22938616573810577,
0.05213649570941925,
0.1451501101255417,
-0.1346784234046936,
0.1227787584066391,
0.10550137609243393,
-0.5078572034835815,
0.34333521127700806,
0.23785626888275146,
0.29185950756073,
0.11540549993515015,
-0.22190696001052856,
0.34437036514282227,
0.43669766187667847,
-0.1908072531223297,
-0.04061196744441986,
-0.12098392844200134,
-0.03561992570757866,
-0.1499127894639969,
0.19743536412715912,
0.3490368723869324,
0.18789905309677124,
0.2596159875392914,
0.0557275116443634,
-0.26596614718437195,
0.27851778268814087,
0.06501396000385284,
-0.3240588903427124,
0.17866621911525726,
-0.13293880224227905,
0.4019324481487274,
-0.32858094573020935,
-0.4429645836353302,
0.00986664742231369,
-0.39412444829940796,
0.21558675169944763,
0.6670199036598206,
-0.2954224944114685,
0.28785526752471924,
-0.02548792213201523,
0.04855022579431534,
0.0018409136682748795,
0.47605016827583313,
0.46973514556884766,
0.2841596007347107,
-0.37837129831314087,
-0.025667212903499603,
-0.32888373732566833,
0.2765583097934723,
-0.2024305909872055,
0.06699749082326889,
0.022247930988669395,
0.17079433798789978,
0.16457822918891907,
-0.003302011638879776,
-0.07962261140346527,
-0.013621993362903595,
0.21880324184894562,
-0.19506913423538208,
-0.1675596684217453,
-0.12804758548736572,
0.0020943284034729004,
0.3573179543018341,
-0.025900525972247124,
-0.29754993319511414,
0.15886540710926056,
0.11506294459104538,
0.0991566851735115,
-0.3214535713195801,
0.3626996874809265,
-0.19846373796463013,
-0.02036242187023163,
0.0691281408071518,
-0.15047122538089752,
0.37920957803726196,
-0.22043859958648682,
-0.03304758667945862,
-0.08182770013809204,
0.12814156711101532,
-0.16707712411880493,
-0.22100013494491577,
0.3402222692966461,
0.38842451572418213,
-0.10763649642467499,
0.10821394622325897,
-0.25519275665283203,
-0.08646275848150253,
0.040304481983184814,
-0.36969074606895447,
-0.3087161183357239,
-0.0074881562031805515,
-0.0002531483769416809,
0.008524507284164429,
0.10309776663780212,
0.24583062529563904,
0.10533731430768967,
-0.027840254828333855,
-0.22922900319099426,
-0.1855800449848175,
0.20947544276714325,
-0.2946496903896332,
-0.31304094195365906,
-0.03537982702255249,
0.05562475696206093,
-0.16362905502319336,
0.2511020004749298,
-0.46240702271461487,
0.14574888348579407,
0.22974419593811035,
-0.025514401495456696,
-0.4540731608867645,
0.2232973277568817,
0.2540613114833832,
0.016472186893224716,
-0.20769661664962769,
0.05345691740512848,
0.1526237428188324,
-0.1369924396276474,
-0.20163996517658234,
-0.1757192611694336
] |
https://github.com/huggingface/datasets/issues/633 | Load large text file for LM pre-training resulting in OOM | I've never experienced memory issues with tokenizers so I don't know
Cc @n1t0 are you aware of any issue that would cause memory to keep increasing when the tokenizer is used in the Data Collator for language modeling ? | I tried to pretrain Longformer using transformers and datasets. But I got OOM issues with loading a large text file. My script is almost like this:
```python
from datasets import load_dataset
@dataclass
class DataCollatorForDatasetsLanguageModeling(DataCollatorForLanguageModeling):
"""
Data collator used for language modeling based on DataCollatorForLazyLanguageModeling
- collates batches of tensors, honoring their tokenizer's pad_token
- preprocesses batches for masked language modeling
"""
block_size: int = 512
def __call__(self, examples: List[dict]) -> Dict[str, torch.Tensor]:
examples = [example['text'] for example in examples]
batch, attention_mask = self._tensorize_batch(examples)
if self.mlm:
inputs, labels = self.mask_tokens(batch)
return {"input_ids": inputs, "labels": labels}
else:
labels = batch.clone().detach()
if self.tokenizer.pad_token_id is not None:
labels[labels == self.tokenizer.pad_token_id] = -100
return {"input_ids": batch, "labels": labels}
def _tensorize_batch(self, examples: List[str]) -> Tuple[torch.Tensor, torch.Tensor]:
if self.tokenizer._pad_token is None:
raise ValueError(
"You are attempting to pad samples but the tokenizer you are using"
f" ({self.tokenizer.__class__.__name__}) does not have one."
)
tensor_examples = self.tokenizer.batch_encode_plus(
[ex for ex in examples if ex],
max_length=self.block_size,
return_tensors="pt",
pad_to_max_length=True,
return_attention_mask=True,
truncation=True,
)
input_ids, attention_mask = tensor_examples["input_ids"], tensor_examples["attention_mask"]
return input_ids, attention_mask
dataset = load_dataset('text', data_files='train.txt',cache_dir="./", , split='train')
data_collator = DataCollatorForDatasetsLanguageModeling(tokenizer=tokenizer, mlm=True,
mlm_probability=0.15, block_size=tokenizer.max_len)
trainer = Trainer(model=model, args=args, data_collator=data_collator,
train_dataset=train_dataset, prediction_loss_only=True, )
trainer.train(model_path=model_path)
```
This train.txt is about 1.1GB and has 90k lines where each line is a sequence of 4k words.
During training, the memory usage increased fast as the following graph and resulted in OOM before the finish of training.

Could you please give me any suggestions on why this happened and how to fix it?
Thanks. | 39 | Load large text file for LM pre-training resulting in OOM
I tried to pretrain Longformer using transformers and datasets. But I got OOM issues with loading a large text file. My script is almost like this:
```python
from datasets import load_dataset
@dataclass
class DataCollatorForDatasetsLanguageModeling(DataCollatorForLanguageModeling):
"""
Data collator used for language modeling based on DataCollatorForLazyLanguageModeling
- collates batches of tensors, honoring their tokenizer's pad_token
- preprocesses batches for masked language modeling
"""
block_size: int = 512
def __call__(self, examples: List[dict]) -> Dict[str, torch.Tensor]:
examples = [example['text'] for example in examples]
batch, attention_mask = self._tensorize_batch(examples)
if self.mlm:
inputs, labels = self.mask_tokens(batch)
return {"input_ids": inputs, "labels": labels}
else:
labels = batch.clone().detach()
if self.tokenizer.pad_token_id is not None:
labels[labels == self.tokenizer.pad_token_id] = -100
return {"input_ids": batch, "labels": labels}
def _tensorize_batch(self, examples: List[str]) -> Tuple[torch.Tensor, torch.Tensor]:
if self.tokenizer._pad_token is None:
raise ValueError(
"You are attempting to pad samples but the tokenizer you are using"
f" ({self.tokenizer.__class__.__name__}) does not have one."
)
tensor_examples = self.tokenizer.batch_encode_plus(
[ex for ex in examples if ex],
max_length=self.block_size,
return_tensors="pt",
pad_to_max_length=True,
return_attention_mask=True,
truncation=True,
)
input_ids, attention_mask = tensor_examples["input_ids"], tensor_examples["attention_mask"]
return input_ids, attention_mask
dataset = load_dataset('text', data_files='train.txt',cache_dir="./", , split='train')
data_collator = DataCollatorForDatasetsLanguageModeling(tokenizer=tokenizer, mlm=True,
mlm_probability=0.15, block_size=tokenizer.max_len)
trainer = Trainer(model=model, args=args, data_collator=data_collator,
train_dataset=train_dataset, prediction_loss_only=True, )
trainer.train(model_path=model_path)
```
This train.txt is about 1.1GB and has 90k lines where each line is a sequence of 4k words.
During training, the memory usage increased fast as the following graph and resulted in OOM before the finish of training.

Could you please give me any suggestions on why this happened and how to fix it?
Thanks.
I've never experienced memory issues with tokenizers so I don't know
Cc @n1t0 are you aware of any issue that would cause memory to keep increasing when the tokenizer is used in the Data Collator for language modeling ? | [
-0.6339283585548401,
-0.47753778100013733,
0.010693363845348358,
0.29863524436950684,
0.36004769802093506,
-0.1518251597881317,
0.5567324757575989,
0.37380579113960266,
0.01088225468993187,
0.010719746351242065,
-0.1295929253101349,
-0.1828002780675888,
-0.26698487997055054,
-0.16208980977535248,
-0.03237204998731613,
0.023206885904073715,
-0.09982117265462875,
0.19687515497207642,
-0.2772675156593323,
-0.09666657447814941,
0.05701180547475815,
-0.07762926816940308,
-0.21276047825813293,
-0.029743991792201996,
-0.3879220187664032,
-0.06171319633722305,
0.3158179223537445,
0.12212134897708893,
-0.1640809327363968,
-0.0958080142736435,
-0.22970141470432281,
0.1197899580001831,
0.4393485188484192,
0.4340214729309082,
-0.00011477212683530524,
0.006616219878196716,
0.18904384970664978,
-0.23633266985416412,
-0.16726946830749512,
0.019216440618038177,
0.07755492627620697,
-0.3022913932800293,
-0.10640020668506622,
-0.3036171495914459,
-0.02724609524011612,
-0.10612530261278152,
-0.015682043507695198,
-0.22437302768230438,
0.4987519383430481,
0.5414043068885803,
0.15876251459121704,
0.25081300735473633,
-0.21366100013256073,
0.0723966509103775,
0.25443702936172485,
0.0488995760679245,
0.1056830957531929,
-0.27951449155807495,
0.46878406405448914,
-0.1923186331987381,
-0.47268855571746826,
0.1478176862001419,
-0.22477363049983978,
-0.20168264210224152,
-0.09508860856294632,
0.03820447996258736,
0.36608895659446716,
0.031569477170705795,
0.2641869783401489,
0.3474210202693939,
0.4272076189517975,
-0.0008120127022266388,
-0.289635568857193,
-0.3209858536720276,
-0.14262455701828003,
-0.08431586623191833,
0.18923655152320862,
0.2010769546031952,
0.059826578944921494,
0.11845916509628296,
0.10712733119726181,
-0.12533129751682281,
-0.15199026465415955,
0.07616106420755386,
-0.27480751276016235,
0.33979544043540955,
-0.20125117897987366,
-0.03804318606853485,
0.15557512640953064,
-0.09447921812534332,
0.19616937637329102,
-0.09977510571479797,
0.003403950482606888,
0.25671419501304626,
-0.245441272854805,
-0.11239507794380188,
-0.07168225198984146,
-0.5194145441055298,
0.16278403997421265,
-0.2759450674057007,
0.1981883943080902,
0.29723939299583435,
-0.08766181021928787,
-0.06761691719293594,
0.08639387786388397,
0.4202020466327667,
-0.25243741273880005,
0.26052793860435486,
0.22725635766983032,
0.16401110589504242,
-0.17170630395412445,
-0.04439859092235565,
-0.33051154017448425,
-0.19624567031860352,
0.10159362852573395,
-0.07734166085720062,
-0.011017010547220707,
-0.2546045482158661,
-0.24042175710201263,
0.05854658782482147,
-0.14076969027519226,
-0.03084544464945793,
0.2748163938522339,
0.38997286558151245,
-0.3540611267089844,
0.4294978082180023,
0.16510933637619019,
0.052328936755657196,
-0.4855332672595978,
-0.33652669191360474,
-0.17440199851989746,
0.15325728058815002,
-0.20324474573135376,
0.038975562900304794,
0.12979257106781006,
0.13963374495506287,
0.05965423583984375,
-0.04288341850042343,
-0.0625898689031601,
-0.44021931290626526,
-0.009444482624530792,
-0.024103429168462753,
0.020752981305122375,
-0.04251480475068092,
0.06302379071712494,
-0.02336559072136879,
0.23476582765579224,
-0.12499457597732544,
-0.025381658226251602,
0.3477915823459625,
-0.2762118875980377,
-0.2276410162448883,
0.05097950994968414,
0.21017630398273468,
-0.02824842929840088,
0.20915503799915314,
0.028506658971309662,
0.07685685157775879,
0.5359783172607422,
0.006653331220149994,
-0.04714777320623398,
-0.3782060742378235,
0.09452182054519653,
0.09201760590076447,
0.1619914025068283,
0.17663070559501648,
-0.042587969452142715,
-0.07260239124298096,
0.0063892244361341,
0.10358665883541107,
0.25504034757614136,
0.3907330334186554,
-0.22647030651569366,
0.2906738817691803,
0.007004471495747566,
-0.05665605142712593,
0.5319919586181641,
-0.2620989978313446,
-0.448444128036499,
0.23385274410247803,
-0.3511556386947632,
0.10818185657262802,
0.22066983580589294,
0.1759030818939209,
0.11388914287090302,
-0.1089852899312973,
0.26901498436927795,
0.3656851649284363,
0.07051589339971542,
0.1209140196442604,
-0.23662437498569489,
-0.09222844988107681,
-0.1715157926082611,
0.48420286178588867,
0.36272403597831726,
-0.02558579295873642,
-0.07308889180421829,
0.35637998580932617,
0.18339842557907104,
-0.1992236077785492,
0.13128061592578888,
0.36934155225753784,
-0.17442509531974792,
-0.1261582374572754,
0.0944812074303627,
0.06559769064188004,
-0.3000325560569763,
-0.07098697125911713,
-0.09084425866603851,
0.0828668475151062,
-0.1136055737733841,
-0.08942607045173645,
0.28255847096443176,
0.02287023328244686,
-0.0766652524471283,
0.11318020522594452,
0.03794129937887192,
-0.13182224333286285,
0.024866361171007156,
-0.07041719555854797,
0.1261971890926361,
0.015421975404024124,
-0.09320687502622604,
0.08736041188240051,
-0.2184159904718399,
-0.12394054979085922,
0.0018030330538749695,
-0.137061208486557,
0.07695000618696213,
0.17527323961257935,
-0.05118799954652786,
0.03840121626853943,
-0.17304009199142456,
0.10695729404687881,
-0.15297769010066986,
-0.2987070679664612,
-0.5071570873260498,
0.43589335680007935,
0.18647874891757965,
-0.33810955286026,
0.3402597904205322,
0.1040273904800415,
-0.029599443078041077,
-0.10627070814371109,
-0.11989574879407883,
0.5749332904815674,
0.27307116985321045,
0.019617579877376556,
0.29909294843673706,
-0.24541117250919342,
0.2542804777622223,
-0.2662392258644104,
-0.10361561179161072,
-0.09776493161916733,
0.4209232032299042,
0.03105533868074417,
0.23506294190883636,
0.14828065037727356,
-0.08694546669721603,
-0.232059508562088,
0.47038108110427856,
-0.1788094937801361,
-0.013872608542442322,
0.26652613282203674,
-0.4247211217880249,
-0.011563490144908428,
-0.34802117943763733,
-0.24947787821292877,
0.0067334845662117004,
0.17322899401187897,
-0.09441326558589935,
-0.055435195565223694,
0.008537785150110722,
-0.26279330253601074,
0.007836148142814636,
0.1532370001077652,
-0.0718524307012558,
0.31983456015586853,
0.11651500314474106,
0.10059522092342377,
-0.122891865670681,
-0.1794070154428482,
0.10284756124019623,
0.17828989028930664,
-0.27519121766090393,
0.18444325029850006,
-0.02282267063856125,
-0.013446485623717308,
-0.2862633764743805,
0.1904245764017105,
-0.12680108845233917,
0.0388152077794075,
-0.0647432953119278,
0.25868889689445496,
-0.07790280133485794,
0.10191172361373901,
0.3001607060432434,
0.3549228012561798,
0.4629628658294678,
-0.07809486240148544,
0.326348215341568,
-0.08266382664442062,
-0.1796954870223999,
0.032943595200777054,
0.33450770378112793,
-0.3179926872253418,
-0.024890778586268425,
0.005377540364861488,
0.05117718130350113,
-0.09892972558736801,
-0.16603437066078186,
0.09468895941972733,
0.196824312210083,
-0.16618932783603668,
-0.2573060691356659,
-0.07217618823051453,
0.17769087851047516,
-0.042431723326444626,
0.11972848325967789,
-0.23244111239910126,
0.008407561108469963,
0.1450573354959488,
-0.006289597600698471,
-0.18432363867759705,
0.04044550284743309,
-0.1199219599366188,
-0.04705164581537247,
-0.411641389131546,
-0.05351852625608444,
0.10705065727233887,
0.13673138618469238,
0.35936760902404785,
0.10678976029157639,
0.19445137679576874,
0.28844478726387024,
0.15859206020832062,
0.006367621943354607,
-0.0885988399386406,
0.5141718983650208,
-0.017572684213519096,
-0.29719802737236023,
-0.2908625900745392,
-0.23975418508052826,
0.02511288784444332,
0.3155249357223511,
-0.684260904788971,
0.23378321528434753,
-0.1138516515493393,
-0.09402675926685333,
-0.3955192267894745,
0.0007258430123329163,
0.2522047758102417,
-0.07614870369434357,
0.016339777037501335,
0.09547417610883713,
0.2302767038345337,
0.1546790897846222,
-0.03878729045391083,
0.38579460978507996,
-0.4130840301513672,
0.35940811038017273,
-0.13545823097229004,
0.4855530261993408,
-0.122118279337883,
-0.2300206571817398,
0.09887474775314331,
0.15044830739498138,
-0.01711525395512581,
-0.021802209317684174,
-0.013968504965305328,
-0.25937944650650024,
-0.058237224817276,
0.0227312333881855,
0.5197213292121887,
0.01689060777425766,
-0.16558955609798431,
-0.015898926183581352,
0.06816425919532776,
0.2563197910785675,
-0.26069891452789307,
0.49052777886390686,
-0.19077889621257782,
0.01841624826192856,
-0.19967399537563324,
0.01874571293592453,
-0.20498108863830566,
-0.21508586406707764,
-0.164134681224823,
0.09344439208507538,
-0.03038274496793747,
-0.22404396533966064,
-0.2116939276456833,
0.10314016044139862,
-0.3681343197822571,
-0.0437651127576828,
0.11799006909132004,
0.22933240234851837,
0.18077029287815094,
-0.19614383578300476,
-0.08628876507282257,
-0.20187069475650787,
0.35741427540779114,
0.1934524029493332,
0.11246532201766968,
0.16325931251049042,
-0.05687852203845978,
-0.2155371457338333,
-0.17745190858840942,
-0.29045435786247253,
0.14190825819969177,
0.6505106687545776,
0.6102464199066162,
-0.21627351641654968,
-0.15859898924827576,
0.07914479076862335,
0.002603483386337757,
-0.16527341306209564,
-0.548757016658783,
-0.12850907444953918,
-0.16549962759017944,
-0.44105130434036255,
0.004606112837791443,
0.35849836468696594,
0.3558535575866699,
-0.2264459729194641,
-0.03187551349401474,
0.13872987031936646,
-0.0007013268768787384,
0.37175118923187256,
-0.12976384162902832,
0.015054157003760338,
-0.06641082465648651,
0.225828617811203,
-0.10741686820983887,
0.36735567450523376,
0.24888965487480164,
0.35636386275291443,
0.1917259395122528,
-0.31755685806274414,
0.0706881731748581,
-0.029888737946748734,
0.23143038153648376,
0.11516103148460388,
0.11022848635911942,
0.3546280860900879,
0.1289711445569992,
0.3322555422782898,
-0.19096627831459045,
0.6737229228019714,
-0.007344553247094154,
0.20682765543460846,
-0.8374910354614258,
-0.26737040281295776,
0.33145615458488464,
-0.02635771967470646,
0.19940276443958282,
0.215718075633049,
-0.40385204553604126,
-0.3216697573661804,
0.376661479473114,
0.09908346086740494,
0.7675239443778992,
-0.2972695827484131,
0.39625850319862366,
-0.1552990972995758,
0.6611965894699097,
0.12803049385547638,
-0.3813104033470154,
0.1585618406534195,
-0.39879149198532104,
-0.2663658857345581,
0.21300511062145233,
-0.09231188893318176,
0.036539800465106964,
0.16050389409065247,
-0.2905767560005188,
-0.029811730608344078,
0.0862521380186081,
0.2249334454536438,
0.13066981732845306,
0.5134936571121216,
0.12092680484056473,
-0.6006978154182434,
-0.08281297981739044,
0.02656909078359604,
-0.02340024709701538,
-0.10490188002586365,
-0.0492798313498497,
0.07994647324085236,
-0.0313267819583416,
-0.20856402814388275,
-0.028466172516345978,
0.20525774359703064,
-0.2474464625120163,
0.08661594241857529,
0.06375248730182648,
-0.07205313444137573,
0.5367995500564575,
0.10623051226139069,
-0.001361064612865448,
0.4988958239555359,
-0.039286620914936066,
0.13215835392475128,
-0.2274819314479828,
-0.1652863323688507,
0.20070844888687134,
-0.06584891676902771,
0.4217033088207245,
0.08837933093309402,
-0.0005880966782569885,
0.11410333216190338,
0.0632382407784462,
-0.046690933406353,
0.09476359188556671,
-0.36430907249450684,
0.10549724102020264,
-0.41123154759407043,
-0.21542777121067047,
-0.08843062818050385,
-0.30078285932540894,
-0.1009221225976944,
0.12310943007469177,
0.13735687732696533,
-0.46444618701934814,
0.11514545977115631,
0.2652113139629364,
-0.3750092685222626,
0.011997109279036522,
0.38382449746131897,
0.17105859518051147,
-0.10513918846845627,
0.49984270334243774,
0.4575878381729126,
-0.053361937403678894,
-0.2644973695278168,
-0.10962903499603271,
0.29444822669029236,
-0.2731435000896454,
0.0849163606762886,
-0.2455592304468155,
-0.3016006648540497,
0.209351047873497,
0.08087542653083801,
0.10009974241256714,
-0.01499941200017929,
-0.06326231360435486,
-0.25102943181991577,
-0.6380501389503479,
-0.18144388496875763,
-0.0027230940759181976,
-0.00354844331741333,
0.1460832953453064,
0.27389806509017944,
-0.3100467920303345,
0.5892773270606995,
-0.2788558602333069,
-0.05294197052717209,
-0.20760811865329742,
0.2782232165336609,
-0.055562183260917664,
-0.38554659485816956,
0.21153579652309418,
0.2033519148826599,
0.1001039668917656,
0.08059665560722351,
0.00590919703245163,
-0.22135356068611145,
-0.14351996779441833,
0.11271549016237259,
0.23647010326385498,
-0.41966331005096436,
-0.01599399372935295,
-0.312997043132782,
-0.09248970448970795,
-0.27002182602882385,
0.06606784462928772,
0.017028577625751495,
0.01394578069448471,
-0.22617922723293304,
0.009393874555826187,
0.04752609133720398,
-0.2552624046802521,
0.04206028953194618,
-0.25458529591560364,
0.12509100139141083,
0.2465714067220688,
0.1331031173467636,
0.11783083528280258,
0.0006371289491653442,
-0.3931019604206085,
0.17964592576026917,
0.6661380529403687,
-0.017532095313072205,
0.4190823435783386,
-0.43573224544525146,
-0.0715063214302063,
0.24765951931476593,
0.04980342835187912,
0.048066146671772,
-0.34167730808258057,
-0.010718589648604393,
0.2935883700847626,
0.22681888937950134,
0.015208568423986435,
-0.014733202755451202,
0.22635462880134583,
-0.41129830479621887,
0.1301487535238266,
0.3453426659107208,
-0.11192676424980164,
-0.06747587025165558,
0.1559651792049408,
0.09132310748100281,
0.5066777467727661,
0.11496534198522568,
0.005711604841053486,
0.24894991517066956,
-0.00122002512216568,
0.15485714375972748,
0.48569241166114807,
0.261119544506073,
0.23868051171302795,
0.3016282618045807,
-0.032666049897670746,
-0.04069993644952774,
-0.2312840223312378,
0.2294139564037323,
-0.435617059469223,
-0.41516661643981934,
-0.2674567401409149,
0.5044151544570923,
-0.01932355761528015,
0.12420932948589325,
-0.3350299298763275,
-0.06624119728803635,
-0.04065354913473129,
0.2541331350803375,
-0.11921557784080505,
0.2744082510471344,
-0.45309436321258545,
-0.17059893906116486,
-0.08942428231239319,
-0.12396197021007538,
0.011534325778484344,
0.18963316082954407,
-0.0558583103120327,
0.27227628231048584,
-0.5796654224395752,
0.22938616573810577,
0.05213649570941925,
0.1451501101255417,
-0.1346784234046936,
0.1227787584066391,
0.10550137609243393,
-0.5078572034835815,
0.34333521127700806,
0.23785626888275146,
0.29185950756073,
0.11540549993515015,
-0.22190696001052856,
0.34437036514282227,
0.43669766187667847,
-0.1908072531223297,
-0.04061196744441986,
-0.12098392844200134,
-0.03561992570757866,
-0.1499127894639969,
0.19743536412715912,
0.3490368723869324,
0.18789905309677124,
0.2596159875392914,
0.0557275116443634,
-0.26596614718437195,
0.27851778268814087,
0.06501396000385284,
-0.3240588903427124,
0.17866621911525726,
-0.13293880224227905,
0.4019324481487274,
-0.32858094573020935,
-0.4429645836353302,
0.00986664742231369,
-0.39412444829940796,
0.21558675169944763,
0.6670199036598206,
-0.2954224944114685,
0.28785526752471924,
-0.02548792213201523,
0.04855022579431534,
0.0018409136682748795,
0.47605016827583313,
0.46973514556884766,
0.2841596007347107,
-0.37837129831314087,
-0.025667212903499603,
-0.32888373732566833,
0.2765583097934723,
-0.2024305909872055,
0.06699749082326889,
0.022247930988669395,
0.17079433798789978,
0.16457822918891907,
-0.003302011638879776,
-0.07962261140346527,
-0.013621993362903595,
0.21880324184894562,
-0.19506913423538208,
-0.1675596684217453,
-0.12804758548736572,
0.0020943284034729004,
0.3573179543018341,
-0.025900525972247124,
-0.29754993319511414,
0.15886540710926056,
0.11506294459104538,
0.0991566851735115,
-0.3214535713195801,
0.3626996874809265,
-0.19846373796463013,
-0.02036242187023163,
0.0691281408071518,
-0.15047122538089752,
0.37920957803726196,
-0.22043859958648682,
-0.03304758667945862,
-0.08182770013809204,
0.12814156711101532,
-0.16707712411880493,
-0.22100013494491577,
0.3402222692966461,
0.38842451572418213,
-0.10763649642467499,
0.10821394622325897,
-0.25519275665283203,
-0.08646275848150253,
0.040304481983184814,
-0.36969074606895447,
-0.3087161183357239,
-0.0074881562031805515,
-0.0002531483769416809,
0.008524507284164429,
0.10309776663780212,
0.24583062529563904,
0.10533731430768967,
-0.027840254828333855,
-0.22922900319099426,
-0.1855800449848175,
0.20947544276714325,
-0.2946496903896332,
-0.31304094195365906,
-0.03537982702255249,
0.05562475696206093,
-0.16362905502319336,
0.2511020004749298,
-0.46240702271461487,
0.14574888348579407,
0.22974419593811035,
-0.025514401495456696,
-0.4540731608867645,
0.2232973277568817,
0.2540613114833832,
0.016472186893224716,
-0.20769661664962769,
0.05345691740512848,
0.1526237428188324,
-0.1369924396276474,
-0.20163996517658234,
-0.1757192611694336
] |
https://github.com/huggingface/datasets/issues/633 | Load large text file for LM pre-training resulting in OOM | @lhoestq Thanks for pointing to n1t0, just to clarify. That warning was doing fine-tuning, without collator:
```
from datasets import load_dataset, load_metric
import numpy as np
GLUE_TASKS = [
"cola",
"mnli",
"mnli-mm",
"mrpc",
"qnli",
"qqp",
"rte",
"sst2",
"stsb",
"wnli",
]
task = "mnli"
actual_task = "mnli" if task == "mnli-mm" else task
dataset = load_dataset("glue", actual_task)
metric = load_metric("glue", actual_task)
batch_size = 16
attention_type = "linear"
from transformers.models.mobilebert_mod import (
MobileBertForSequenceClassification,
MobileBertTokenizerFast,
)
from transformers.models.mobilebert_mod.configuration_mobilebert import (
MobileBertConfigMod,
)
from transformers import TrainingArguments, Trainer
num_labels = 3 if task.startswith("mnli") else 1 if task == "stsb" else 2
tokenizer = MobileBertTokenizerFast.from_pretrained(
"/media/ad/00b5422b-9d54-4449-8b5d-08eab5cdac8c/training_trfm/big_linear_layerdrop_shared/checkpoint-23000/",
max_len=512,
)
model = MobileBertForSequenceClassification.from_pretrained(
"/media/ad/00b5422b-9d54-4449-8b5d-08eab5cdac8c/training_trfm/big_linear_layerdrop_shared/checkpoint-23000/",
num_labels=num_labels,
)
print(model.num_parameters())
task_to_keys = {
"cola": ("sentence", None),
"mnli": ("premise", "hypothesis"),
"mnli-mm": ("premise", "hypothesis"),
"mrpc": ("sentence1", "sentence2"),
"qnli": ("question", "sentence"),
"qqp": ("question1", "question2"),
"rte": ("sentence1", "sentence2"),
"sst2": ("sentence", None),
"stsb": ("sentence1", "sentence2"),
"wnli": ("sentence1", "sentence2"),
}
sentence1_key, sentence2_key = task_to_keys[task]
if sentence2_key is None:
print(f"Sentence: {dataset['train'][0][sentence1_key]}")
else:
print(f"Sentence 1: {dataset['train'][0][sentence1_key]}")
print(f"Sentence 2: {dataset['train'][0][sentence2_key]}")
def preprocess_function(examples):
if sentence2_key is None:
return tokenizer(examples[sentence1_key], truncation=True)
return tokenizer(examples[sentence1_key], examples[sentence2_key], truncation=True)
encoded_dataset = dataset.map(preprocess_function, batched=True)
metric_name = (
"pearson"
if task == "stsb"
else "matthews_correlation"
if task == "cola"
else "accuracy"
)
args = TrainingArguments(
f"test-glue/{task}_{attention_type}",
evaluation_strategy="steps",
learning_rate=1e-5,
per_device_train_batch_size=batch_size,
per_device_eval_batch_size=batch_size,
logging_steps=200,
num_train_epochs=5,
gradient_accumulation_steps=1,
warmup_steps=10000,
fp16=True,
dataloader_num_workers=10,
weight_decay=0.1,
load_best_model_at_end=True,
metric_for_best_model=metric_name,
)
def compute_metrics(eval_pred):
predictions, labels = eval_pred
if task != "stsb":
predictions = np.argmax(predictions, axis=1)
else:
predictions = predictions[:, 0]
return metric.compute(predictions=predictions, references=labels)
validation_key = (
"validation_mismatched"
if task == "mnli-mm"
else "validation_matched"
if task == "mnli"
else "validation"
)
trainer = Trainer(
model,
args,
train_dataset=encoded_dataset["train"],
eval_dataset=encoded_dataset[validation_key],
tokenizer=tokenizer,
compute_metrics=compute_metrics,
)
trainer.train()
```
Now, I have come back to pre-training. The changes that I think I have done are: not formatting the dataset to torch: ~~`big_dataset.set_format(type='torch', columns=["text", "input_ids", "attention_mask", "token_type_ids"])`~~ so maybe some column is dropped and not freezed in memory and now I have not setted any validation dataset in the trainer.
My validation dataset before:
```
book_corpus_eval = load_dataset(
"bookcorpus",
"plain_text",
cache_dir="/home/ad/Desktop/bookcorpus",
split="train[98:99%]",
)
book_corpus_eval = book_corpus_eval.map(encode, batched=True)
book_corpus_eval.set_format(
type="torch", columns=["text", "input_ids", "attention_mask", "token_type_ids"]
)
**book_corpus_eval = book_corpus_eval.select([i for i in range(1500)])**
```
Maybe _selecting_ or indexing the dataset before feeding it to the trainer, do something strange.
My trainer now:
```
big_dataset = load_from_disk("/home/ad/Desktop/35percent_data.arrow/")
from transformers import DataCollatorForWholeWordMask
data_collator = DataCollatorForWholeWordMask(
tokenizer=tokenizer, mlm=True, mlm_probability=0.15)
from transformers import Trainer, TrainingArguments
training_args = TrainingArguments(
output_dir="./big_linear_layerdrop_shared_silu_secondtry",
overwrite_output_dir=True,
per_device_train_batch_size=60,
per_device_eval_batch_size=60,
save_steps=500,
save_total_limit=10,
logging_first_step=True,
logging_steps=100,
# evaluation_strategy='steps',
# eval_steps=250,
gradient_accumulation_steps=8,
fp16=True,
dataloader_num_workers=10,
warmup_steps=15000,
learning_rate=6e-4,
adam_epsilon=1e-6,
adam_beta2=0.98,
weight_decay=0.01,
max_grad_norm=1.0,
max_steps=500000,
)
trainer = Trainer(
model=model,
args=training_args,
data_collator=data_collator,
train_dataset=big_dataset,
# eval_dataset=book_corpus_eval,
tokenizer=tokenizer)
import wandb
wandb.login()
trainer.train()
```
And surprisingly, the ram now keeps going up and down. The training is up now for 12h without collapse the ram. I don't know what could cause the leakage. :mag:
Edit: I didn't see the swap memory, that keeps increasing. So the problem persist. | I tried to pretrain Longformer using transformers and datasets. But I got OOM issues with loading a large text file. My script is almost like this:
```python
from datasets import load_dataset
@dataclass
class DataCollatorForDatasetsLanguageModeling(DataCollatorForLanguageModeling):
"""
Data collator used for language modeling based on DataCollatorForLazyLanguageModeling
- collates batches of tensors, honoring their tokenizer's pad_token
- preprocesses batches for masked language modeling
"""
block_size: int = 512
def __call__(self, examples: List[dict]) -> Dict[str, torch.Tensor]:
examples = [example['text'] for example in examples]
batch, attention_mask = self._tensorize_batch(examples)
if self.mlm:
inputs, labels = self.mask_tokens(batch)
return {"input_ids": inputs, "labels": labels}
else:
labels = batch.clone().detach()
if self.tokenizer.pad_token_id is not None:
labels[labels == self.tokenizer.pad_token_id] = -100
return {"input_ids": batch, "labels": labels}
def _tensorize_batch(self, examples: List[str]) -> Tuple[torch.Tensor, torch.Tensor]:
if self.tokenizer._pad_token is None:
raise ValueError(
"You are attempting to pad samples but the tokenizer you are using"
f" ({self.tokenizer.__class__.__name__}) does not have one."
)
tensor_examples = self.tokenizer.batch_encode_plus(
[ex for ex in examples if ex],
max_length=self.block_size,
return_tensors="pt",
pad_to_max_length=True,
return_attention_mask=True,
truncation=True,
)
input_ids, attention_mask = tensor_examples["input_ids"], tensor_examples["attention_mask"]
return input_ids, attention_mask
dataset = load_dataset('text', data_files='train.txt',cache_dir="./", , split='train')
data_collator = DataCollatorForDatasetsLanguageModeling(tokenizer=tokenizer, mlm=True,
mlm_probability=0.15, block_size=tokenizer.max_len)
trainer = Trainer(model=model, args=args, data_collator=data_collator,
train_dataset=train_dataset, prediction_loss_only=True, )
trainer.train(model_path=model_path)
```
This train.txt is about 1.1GB and has 90k lines where each line is a sequence of 4k words.
During training, the memory usage increased fast as the following graph and resulted in OOM before the finish of training.

Could you please give me any suggestions on why this happened and how to fix it?
Thanks. | 468 | Load large text file for LM pre-training resulting in OOM
I tried to pretrain Longformer using transformers and datasets. But I got OOM issues with loading a large text file. My script is almost like this:
```python
from datasets import load_dataset
@dataclass
class DataCollatorForDatasetsLanguageModeling(DataCollatorForLanguageModeling):
"""
Data collator used for language modeling based on DataCollatorForLazyLanguageModeling
- collates batches of tensors, honoring their tokenizer's pad_token
- preprocesses batches for masked language modeling
"""
block_size: int = 512
def __call__(self, examples: List[dict]) -> Dict[str, torch.Tensor]:
examples = [example['text'] for example in examples]
batch, attention_mask = self._tensorize_batch(examples)
if self.mlm:
inputs, labels = self.mask_tokens(batch)
return {"input_ids": inputs, "labels": labels}
else:
labels = batch.clone().detach()
if self.tokenizer.pad_token_id is not None:
labels[labels == self.tokenizer.pad_token_id] = -100
return {"input_ids": batch, "labels": labels}
def _tensorize_batch(self, examples: List[str]) -> Tuple[torch.Tensor, torch.Tensor]:
if self.tokenizer._pad_token is None:
raise ValueError(
"You are attempting to pad samples but the tokenizer you are using"
f" ({self.tokenizer.__class__.__name__}) does not have one."
)
tensor_examples = self.tokenizer.batch_encode_plus(
[ex for ex in examples if ex],
max_length=self.block_size,
return_tensors="pt",
pad_to_max_length=True,
return_attention_mask=True,
truncation=True,
)
input_ids, attention_mask = tensor_examples["input_ids"], tensor_examples["attention_mask"]
return input_ids, attention_mask
dataset = load_dataset('text', data_files='train.txt',cache_dir="./", , split='train')
data_collator = DataCollatorForDatasetsLanguageModeling(tokenizer=tokenizer, mlm=True,
mlm_probability=0.15, block_size=tokenizer.max_len)
trainer = Trainer(model=model, args=args, data_collator=data_collator,
train_dataset=train_dataset, prediction_loss_only=True, )
trainer.train(model_path=model_path)
```
This train.txt is about 1.1GB and has 90k lines where each line is a sequence of 4k words.
During training, the memory usage increased fast as the following graph and resulted in OOM before the finish of training.

Could you please give me any suggestions on why this happened and how to fix it?
Thanks.
@lhoestq Thanks for pointing to n1t0, just to clarify. That warning was doing fine-tuning, without collator:
```
from datasets import load_dataset, load_metric
import numpy as np
GLUE_TASKS = [
"cola",
"mnli",
"mnli-mm",
"mrpc",
"qnli",
"qqp",
"rte",
"sst2",
"stsb",
"wnli",
]
task = "mnli"
actual_task = "mnli" if task == "mnli-mm" else task
dataset = load_dataset("glue", actual_task)
metric = load_metric("glue", actual_task)
batch_size = 16
attention_type = "linear"
from transformers.models.mobilebert_mod import (
MobileBertForSequenceClassification,
MobileBertTokenizerFast,
)
from transformers.models.mobilebert_mod.configuration_mobilebert import (
MobileBertConfigMod,
)
from transformers import TrainingArguments, Trainer
num_labels = 3 if task.startswith("mnli") else 1 if task == "stsb" else 2
tokenizer = MobileBertTokenizerFast.from_pretrained(
"/media/ad/00b5422b-9d54-4449-8b5d-08eab5cdac8c/training_trfm/big_linear_layerdrop_shared/checkpoint-23000/",
max_len=512,
)
model = MobileBertForSequenceClassification.from_pretrained(
"/media/ad/00b5422b-9d54-4449-8b5d-08eab5cdac8c/training_trfm/big_linear_layerdrop_shared/checkpoint-23000/",
num_labels=num_labels,
)
print(model.num_parameters())
task_to_keys = {
"cola": ("sentence", None),
"mnli": ("premise", "hypothesis"),
"mnli-mm": ("premise", "hypothesis"),
"mrpc": ("sentence1", "sentence2"),
"qnli": ("question", "sentence"),
"qqp": ("question1", "question2"),
"rte": ("sentence1", "sentence2"),
"sst2": ("sentence", None),
"stsb": ("sentence1", "sentence2"),
"wnli": ("sentence1", "sentence2"),
}
sentence1_key, sentence2_key = task_to_keys[task]
if sentence2_key is None:
print(f"Sentence: {dataset['train'][0][sentence1_key]}")
else:
print(f"Sentence 1: {dataset['train'][0][sentence1_key]}")
print(f"Sentence 2: {dataset['train'][0][sentence2_key]}")
def preprocess_function(examples):
if sentence2_key is None:
return tokenizer(examples[sentence1_key], truncation=True)
return tokenizer(examples[sentence1_key], examples[sentence2_key], truncation=True)
encoded_dataset = dataset.map(preprocess_function, batched=True)
metric_name = (
"pearson"
if task == "stsb"
else "matthews_correlation"
if task == "cola"
else "accuracy"
)
args = TrainingArguments(
f"test-glue/{task}_{attention_type}",
evaluation_strategy="steps",
learning_rate=1e-5,
per_device_train_batch_size=batch_size,
per_device_eval_batch_size=batch_size,
logging_steps=200,
num_train_epochs=5,
gradient_accumulation_steps=1,
warmup_steps=10000,
fp16=True,
dataloader_num_workers=10,
weight_decay=0.1,
load_best_model_at_end=True,
metric_for_best_model=metric_name,
)
def compute_metrics(eval_pred):
predictions, labels = eval_pred
if task != "stsb":
predictions = np.argmax(predictions, axis=1)
else:
predictions = predictions[:, 0]
return metric.compute(predictions=predictions, references=labels)
validation_key = (
"validation_mismatched"
if task == "mnli-mm"
else "validation_matched"
if task == "mnli"
else "validation"
)
trainer = Trainer(
model,
args,
train_dataset=encoded_dataset["train"],
eval_dataset=encoded_dataset[validation_key],
tokenizer=tokenizer,
compute_metrics=compute_metrics,
)
trainer.train()
```
Now, I have come back to pre-training. The changes that I think I have done are: not formatting the dataset to torch: ~~`big_dataset.set_format(type='torch', columns=["text", "input_ids", "attention_mask", "token_type_ids"])`~~ so maybe some column is dropped and not freezed in memory and now I have not setted any validation dataset in the trainer.
My validation dataset before:
```
book_corpus_eval = load_dataset(
"bookcorpus",
"plain_text",
cache_dir="/home/ad/Desktop/bookcorpus",
split="train[98:99%]",
)
book_corpus_eval = book_corpus_eval.map(encode, batched=True)
book_corpus_eval.set_format(
type="torch", columns=["text", "input_ids", "attention_mask", "token_type_ids"]
)
**book_corpus_eval = book_corpus_eval.select([i for i in range(1500)])**
```
Maybe _selecting_ or indexing the dataset before feeding it to the trainer, do something strange.
My trainer now:
```
big_dataset = load_from_disk("/home/ad/Desktop/35percent_data.arrow/")
from transformers import DataCollatorForWholeWordMask
data_collator = DataCollatorForWholeWordMask(
tokenizer=tokenizer, mlm=True, mlm_probability=0.15)
from transformers import Trainer, TrainingArguments
training_args = TrainingArguments(
output_dir="./big_linear_layerdrop_shared_silu_secondtry",
overwrite_output_dir=True,
per_device_train_batch_size=60,
per_device_eval_batch_size=60,
save_steps=500,
save_total_limit=10,
logging_first_step=True,
logging_steps=100,
# evaluation_strategy='steps',
# eval_steps=250,
gradient_accumulation_steps=8,
fp16=True,
dataloader_num_workers=10,
warmup_steps=15000,
learning_rate=6e-4,
adam_epsilon=1e-6,
adam_beta2=0.98,
weight_decay=0.01,
max_grad_norm=1.0,
max_steps=500000,
)
trainer = Trainer(
model=model,
args=training_args,
data_collator=data_collator,
train_dataset=big_dataset,
# eval_dataset=book_corpus_eval,
tokenizer=tokenizer)
import wandb
wandb.login()
trainer.train()
```
And surprisingly, the ram now keeps going up and down. The training is up now for 12h without collapse the ram. I don't know what could cause the leakage. :mag:
Edit: I didn't see the swap memory, that keeps increasing. So the problem persist. | [
-0.6339283585548401,
-0.47753778100013733,
0.010693363845348358,
0.29863524436950684,
0.36004769802093506,
-0.1518251597881317,
0.5567324757575989,
0.37380579113960266,
0.01088225468993187,
0.010719746351242065,
-0.1295929253101349,
-0.1828002780675888,
-0.26698487997055054,
-0.16208980977535248,
-0.03237204998731613,
0.023206885904073715,
-0.09982117265462875,
0.19687515497207642,
-0.2772675156593323,
-0.09666657447814941,
0.05701180547475815,
-0.07762926816940308,
-0.21276047825813293,
-0.029743991792201996,
-0.3879220187664032,
-0.06171319633722305,
0.3158179223537445,
0.12212134897708893,
-0.1640809327363968,
-0.0958080142736435,
-0.22970141470432281,
0.1197899580001831,
0.4393485188484192,
0.4340214729309082,
-0.00011477212683530524,
0.006616219878196716,
0.18904384970664978,
-0.23633266985416412,
-0.16726946830749512,
0.019216440618038177,
0.07755492627620697,
-0.3022913932800293,
-0.10640020668506622,
-0.3036171495914459,
-0.02724609524011612,
-0.10612530261278152,
-0.015682043507695198,
-0.22437302768230438,
0.4987519383430481,
0.5414043068885803,
0.15876251459121704,
0.25081300735473633,
-0.21366100013256073,
0.0723966509103775,
0.25443702936172485,
0.0488995760679245,
0.1056830957531929,
-0.27951449155807495,
0.46878406405448914,
-0.1923186331987381,
-0.47268855571746826,
0.1478176862001419,
-0.22477363049983978,
-0.20168264210224152,
-0.09508860856294632,
0.03820447996258736,
0.36608895659446716,
0.031569477170705795,
0.2641869783401489,
0.3474210202693939,
0.4272076189517975,
-0.0008120127022266388,
-0.289635568857193,
-0.3209858536720276,
-0.14262455701828003,
-0.08431586623191833,
0.18923655152320862,
0.2010769546031952,
0.059826578944921494,
0.11845916509628296,
0.10712733119726181,
-0.12533129751682281,
-0.15199026465415955,
0.07616106420755386,
-0.27480751276016235,
0.33979544043540955,
-0.20125117897987366,
-0.03804318606853485,
0.15557512640953064,
-0.09447921812534332,
0.19616937637329102,
-0.09977510571479797,
0.003403950482606888,
0.25671419501304626,
-0.245441272854805,
-0.11239507794380188,
-0.07168225198984146,
-0.5194145441055298,
0.16278403997421265,
-0.2759450674057007,
0.1981883943080902,
0.29723939299583435,
-0.08766181021928787,
-0.06761691719293594,
0.08639387786388397,
0.4202020466327667,
-0.25243741273880005,
0.26052793860435486,
0.22725635766983032,
0.16401110589504242,
-0.17170630395412445,
-0.04439859092235565,
-0.33051154017448425,
-0.19624567031860352,
0.10159362852573395,
-0.07734166085720062,
-0.011017010547220707,
-0.2546045482158661,
-0.24042175710201263,
0.05854658782482147,
-0.14076969027519226,
-0.03084544464945793,
0.2748163938522339,
0.38997286558151245,
-0.3540611267089844,
0.4294978082180023,
0.16510933637619019,
0.052328936755657196,
-0.4855332672595978,
-0.33652669191360474,
-0.17440199851989746,
0.15325728058815002,
-0.20324474573135376,
0.038975562900304794,
0.12979257106781006,
0.13963374495506287,
0.05965423583984375,
-0.04288341850042343,
-0.0625898689031601,
-0.44021931290626526,
-0.009444482624530792,
-0.024103429168462753,
0.020752981305122375,
-0.04251480475068092,
0.06302379071712494,
-0.02336559072136879,
0.23476582765579224,
-0.12499457597732544,
-0.025381658226251602,
0.3477915823459625,
-0.2762118875980377,
-0.2276410162448883,
0.05097950994968414,
0.21017630398273468,
-0.02824842929840088,
0.20915503799915314,
0.028506658971309662,
0.07685685157775879,
0.5359783172607422,
0.006653331220149994,
-0.04714777320623398,
-0.3782060742378235,
0.09452182054519653,
0.09201760590076447,
0.1619914025068283,
0.17663070559501648,
-0.042587969452142715,
-0.07260239124298096,
0.0063892244361341,
0.10358665883541107,
0.25504034757614136,
0.3907330334186554,
-0.22647030651569366,
0.2906738817691803,
0.007004471495747566,
-0.05665605142712593,
0.5319919586181641,
-0.2620989978313446,
-0.448444128036499,
0.23385274410247803,
-0.3511556386947632,
0.10818185657262802,
0.22066983580589294,
0.1759030818939209,
0.11388914287090302,
-0.1089852899312973,
0.26901498436927795,
0.3656851649284363,
0.07051589339971542,
0.1209140196442604,
-0.23662437498569489,
-0.09222844988107681,
-0.1715157926082611,
0.48420286178588867,
0.36272403597831726,
-0.02558579295873642,
-0.07308889180421829,
0.35637998580932617,
0.18339842557907104,
-0.1992236077785492,
0.13128061592578888,
0.36934155225753784,
-0.17442509531974792,
-0.1261582374572754,
0.0944812074303627,
0.06559769064188004,
-0.3000325560569763,
-0.07098697125911713,
-0.09084425866603851,
0.0828668475151062,
-0.1136055737733841,
-0.08942607045173645,
0.28255847096443176,
0.02287023328244686,
-0.0766652524471283,
0.11318020522594452,
0.03794129937887192,
-0.13182224333286285,
0.024866361171007156,
-0.07041719555854797,
0.1261971890926361,
0.015421975404024124,
-0.09320687502622604,
0.08736041188240051,
-0.2184159904718399,
-0.12394054979085922,
0.0018030330538749695,
-0.137061208486557,
0.07695000618696213,
0.17527323961257935,
-0.05118799954652786,
0.03840121626853943,
-0.17304009199142456,
0.10695729404687881,
-0.15297769010066986,
-0.2987070679664612,
-0.5071570873260498,
0.43589335680007935,
0.18647874891757965,
-0.33810955286026,
0.3402597904205322,
0.1040273904800415,
-0.029599443078041077,
-0.10627070814371109,
-0.11989574879407883,
0.5749332904815674,
0.27307116985321045,
0.019617579877376556,
0.29909294843673706,
-0.24541117250919342,
0.2542804777622223,
-0.2662392258644104,
-0.10361561179161072,
-0.09776493161916733,
0.4209232032299042,
0.03105533868074417,
0.23506294190883636,
0.14828065037727356,
-0.08694546669721603,
-0.232059508562088,
0.47038108110427856,
-0.1788094937801361,
-0.013872608542442322,
0.26652613282203674,
-0.4247211217880249,
-0.011563490144908428,
-0.34802117943763733,
-0.24947787821292877,
0.0067334845662117004,
0.17322899401187897,
-0.09441326558589935,
-0.055435195565223694,
0.008537785150110722,
-0.26279330253601074,
0.007836148142814636,
0.1532370001077652,
-0.0718524307012558,
0.31983456015586853,
0.11651500314474106,
0.10059522092342377,
-0.122891865670681,
-0.1794070154428482,
0.10284756124019623,
0.17828989028930664,
-0.27519121766090393,
0.18444325029850006,
-0.02282267063856125,
-0.013446485623717308,
-0.2862633764743805,
0.1904245764017105,
-0.12680108845233917,
0.0388152077794075,
-0.0647432953119278,
0.25868889689445496,
-0.07790280133485794,
0.10191172361373901,
0.3001607060432434,
0.3549228012561798,
0.4629628658294678,
-0.07809486240148544,
0.326348215341568,
-0.08266382664442062,
-0.1796954870223999,
0.032943595200777054,
0.33450770378112793,
-0.3179926872253418,
-0.024890778586268425,
0.005377540364861488,
0.05117718130350113,
-0.09892972558736801,
-0.16603437066078186,
0.09468895941972733,
0.196824312210083,
-0.16618932783603668,
-0.2573060691356659,
-0.07217618823051453,
0.17769087851047516,
-0.042431723326444626,
0.11972848325967789,
-0.23244111239910126,
0.008407561108469963,
0.1450573354959488,
-0.006289597600698471,
-0.18432363867759705,
0.04044550284743309,
-0.1199219599366188,
-0.04705164581537247,
-0.411641389131546,
-0.05351852625608444,
0.10705065727233887,
0.13673138618469238,
0.35936760902404785,
0.10678976029157639,
0.19445137679576874,
0.28844478726387024,
0.15859206020832062,
0.006367621943354607,
-0.0885988399386406,
0.5141718983650208,
-0.017572684213519096,
-0.29719802737236023,
-0.2908625900745392,
-0.23975418508052826,
0.02511288784444332,
0.3155249357223511,
-0.684260904788971,
0.23378321528434753,
-0.1138516515493393,
-0.09402675926685333,
-0.3955192267894745,
0.0007258430123329163,
0.2522047758102417,
-0.07614870369434357,
0.016339777037501335,
0.09547417610883713,
0.2302767038345337,
0.1546790897846222,
-0.03878729045391083,
0.38579460978507996,
-0.4130840301513672,
0.35940811038017273,
-0.13545823097229004,
0.4855530261993408,
-0.122118279337883,
-0.2300206571817398,
0.09887474775314331,
0.15044830739498138,
-0.01711525395512581,
-0.021802209317684174,
-0.013968504965305328,
-0.25937944650650024,
-0.058237224817276,
0.0227312333881855,
0.5197213292121887,
0.01689060777425766,
-0.16558955609798431,
-0.015898926183581352,
0.06816425919532776,
0.2563197910785675,
-0.26069891452789307,
0.49052777886390686,
-0.19077889621257782,
0.01841624826192856,
-0.19967399537563324,
0.01874571293592453,
-0.20498108863830566,
-0.21508586406707764,
-0.164134681224823,
0.09344439208507538,
-0.03038274496793747,
-0.22404396533966064,
-0.2116939276456833,
0.10314016044139862,
-0.3681343197822571,
-0.0437651127576828,
0.11799006909132004,
0.22933240234851837,
0.18077029287815094,
-0.19614383578300476,
-0.08628876507282257,
-0.20187069475650787,
0.35741427540779114,
0.1934524029493332,
0.11246532201766968,
0.16325931251049042,
-0.05687852203845978,
-0.2155371457338333,
-0.17745190858840942,
-0.29045435786247253,
0.14190825819969177,
0.6505106687545776,
0.6102464199066162,
-0.21627351641654968,
-0.15859898924827576,
0.07914479076862335,
0.002603483386337757,
-0.16527341306209564,
-0.548757016658783,
-0.12850907444953918,
-0.16549962759017944,
-0.44105130434036255,
0.004606112837791443,
0.35849836468696594,
0.3558535575866699,
-0.2264459729194641,
-0.03187551349401474,
0.13872987031936646,
-0.0007013268768787384,
0.37175118923187256,
-0.12976384162902832,
0.015054157003760338,
-0.06641082465648651,
0.225828617811203,
-0.10741686820983887,
0.36735567450523376,
0.24888965487480164,
0.35636386275291443,
0.1917259395122528,
-0.31755685806274414,
0.0706881731748581,
-0.029888737946748734,
0.23143038153648376,
0.11516103148460388,
0.11022848635911942,
0.3546280860900879,
0.1289711445569992,
0.3322555422782898,
-0.19096627831459045,
0.6737229228019714,
-0.007344553247094154,
0.20682765543460846,
-0.8374910354614258,
-0.26737040281295776,
0.33145615458488464,
-0.02635771967470646,
0.19940276443958282,
0.215718075633049,
-0.40385204553604126,
-0.3216697573661804,
0.376661479473114,
0.09908346086740494,
0.7675239443778992,
-0.2972695827484131,
0.39625850319862366,
-0.1552990972995758,
0.6611965894699097,
0.12803049385547638,
-0.3813104033470154,
0.1585618406534195,
-0.39879149198532104,
-0.2663658857345581,
0.21300511062145233,
-0.09231188893318176,
0.036539800465106964,
0.16050389409065247,
-0.2905767560005188,
-0.029811730608344078,
0.0862521380186081,
0.2249334454536438,
0.13066981732845306,
0.5134936571121216,
0.12092680484056473,
-0.6006978154182434,
-0.08281297981739044,
0.02656909078359604,
-0.02340024709701538,
-0.10490188002586365,
-0.0492798313498497,
0.07994647324085236,
-0.0313267819583416,
-0.20856402814388275,
-0.028466172516345978,
0.20525774359703064,
-0.2474464625120163,
0.08661594241857529,
0.06375248730182648,
-0.07205313444137573,
0.5367995500564575,
0.10623051226139069,
-0.001361064612865448,
0.4988958239555359,
-0.039286620914936066,
0.13215835392475128,
-0.2274819314479828,
-0.1652863323688507,
0.20070844888687134,
-0.06584891676902771,
0.4217033088207245,
0.08837933093309402,
-0.0005880966782569885,
0.11410333216190338,
0.0632382407784462,
-0.046690933406353,
0.09476359188556671,
-0.36430907249450684,
0.10549724102020264,
-0.41123154759407043,
-0.21542777121067047,
-0.08843062818050385,
-0.30078285932540894,
-0.1009221225976944,
0.12310943007469177,
0.13735687732696533,
-0.46444618701934814,
0.11514545977115631,
0.2652113139629364,
-0.3750092685222626,
0.011997109279036522,
0.38382449746131897,
0.17105859518051147,
-0.10513918846845627,
0.49984270334243774,
0.4575878381729126,
-0.053361937403678894,
-0.2644973695278168,
-0.10962903499603271,
0.29444822669029236,
-0.2731435000896454,
0.0849163606762886,
-0.2455592304468155,
-0.3016006648540497,
0.209351047873497,
0.08087542653083801,
0.10009974241256714,
-0.01499941200017929,
-0.06326231360435486,
-0.25102943181991577,
-0.6380501389503479,
-0.18144388496875763,
-0.0027230940759181976,
-0.00354844331741333,
0.1460832953453064,
0.27389806509017944,
-0.3100467920303345,
0.5892773270606995,
-0.2788558602333069,
-0.05294197052717209,
-0.20760811865329742,
0.2782232165336609,
-0.055562183260917664,
-0.38554659485816956,
0.21153579652309418,
0.2033519148826599,
0.1001039668917656,
0.08059665560722351,
0.00590919703245163,
-0.22135356068611145,
-0.14351996779441833,
0.11271549016237259,
0.23647010326385498,
-0.41966331005096436,
-0.01599399372935295,
-0.312997043132782,
-0.09248970448970795,
-0.27002182602882385,
0.06606784462928772,
0.017028577625751495,
0.01394578069448471,
-0.22617922723293304,
0.009393874555826187,
0.04752609133720398,
-0.2552624046802521,
0.04206028953194618,
-0.25458529591560364,
0.12509100139141083,
0.2465714067220688,
0.1331031173467636,
0.11783083528280258,
0.0006371289491653442,
-0.3931019604206085,
0.17964592576026917,
0.6661380529403687,
-0.017532095313072205,
0.4190823435783386,
-0.43573224544525146,
-0.0715063214302063,
0.24765951931476593,
0.04980342835187912,
0.048066146671772,
-0.34167730808258057,
-0.010718589648604393,
0.2935883700847626,
0.22681888937950134,
0.015208568423986435,
-0.014733202755451202,
0.22635462880134583,
-0.41129830479621887,
0.1301487535238266,
0.3453426659107208,
-0.11192676424980164,
-0.06747587025165558,
0.1559651792049408,
0.09132310748100281,
0.5066777467727661,
0.11496534198522568,
0.005711604841053486,
0.24894991517066956,
-0.00122002512216568,
0.15485714375972748,
0.48569241166114807,
0.261119544506073,
0.23868051171302795,
0.3016282618045807,
-0.032666049897670746,
-0.04069993644952774,
-0.2312840223312378,
0.2294139564037323,
-0.435617059469223,
-0.41516661643981934,
-0.2674567401409149,
0.5044151544570923,
-0.01932355761528015,
0.12420932948589325,
-0.3350299298763275,
-0.06624119728803635,
-0.04065354913473129,
0.2541331350803375,
-0.11921557784080505,
0.2744082510471344,
-0.45309436321258545,
-0.17059893906116486,
-0.08942428231239319,
-0.12396197021007538,
0.011534325778484344,
0.18963316082954407,
-0.0558583103120327,
0.27227628231048584,
-0.5796654224395752,
0.22938616573810577,
0.05213649570941925,
0.1451501101255417,
-0.1346784234046936,
0.1227787584066391,
0.10550137609243393,
-0.5078572034835815,
0.34333521127700806,
0.23785626888275146,
0.29185950756073,
0.11540549993515015,
-0.22190696001052856,
0.34437036514282227,
0.43669766187667847,
-0.1908072531223297,
-0.04061196744441986,
-0.12098392844200134,
-0.03561992570757866,
-0.1499127894639969,
0.19743536412715912,
0.3490368723869324,
0.18789905309677124,
0.2596159875392914,
0.0557275116443634,
-0.26596614718437195,
0.27851778268814087,
0.06501396000385284,
-0.3240588903427124,
0.17866621911525726,
-0.13293880224227905,
0.4019324481487274,
-0.32858094573020935,
-0.4429645836353302,
0.00986664742231369,
-0.39412444829940796,
0.21558675169944763,
0.6670199036598206,
-0.2954224944114685,
0.28785526752471924,
-0.02548792213201523,
0.04855022579431534,
0.0018409136682748795,
0.47605016827583313,
0.46973514556884766,
0.2841596007347107,
-0.37837129831314087,
-0.025667212903499603,
-0.32888373732566833,
0.2765583097934723,
-0.2024305909872055,
0.06699749082326889,
0.022247930988669395,
0.17079433798789978,
0.16457822918891907,
-0.003302011638879776,
-0.07962261140346527,
-0.013621993362903595,
0.21880324184894562,
-0.19506913423538208,
-0.1675596684217453,
-0.12804758548736572,
0.0020943284034729004,
0.3573179543018341,
-0.025900525972247124,
-0.29754993319511414,
0.15886540710926056,
0.11506294459104538,
0.0991566851735115,
-0.3214535713195801,
0.3626996874809265,
-0.19846373796463013,
-0.02036242187023163,
0.0691281408071518,
-0.15047122538089752,
0.37920957803726196,
-0.22043859958648682,
-0.03304758667945862,
-0.08182770013809204,
0.12814156711101532,
-0.16707712411880493,
-0.22100013494491577,
0.3402222692966461,
0.38842451572418213,
-0.10763649642467499,
0.10821394622325897,
-0.25519275665283203,
-0.08646275848150253,
0.040304481983184814,
-0.36969074606895447,
-0.3087161183357239,
-0.0074881562031805515,
-0.0002531483769416809,
0.008524507284164429,
0.10309776663780212,
0.24583062529563904,
0.10533731430768967,
-0.027840254828333855,
-0.22922900319099426,
-0.1855800449848175,
0.20947544276714325,
-0.2946496903896332,
-0.31304094195365906,
-0.03537982702255249,
0.05562475696206093,
-0.16362905502319336,
0.2511020004749298,
-0.46240702271461487,
0.14574888348579407,
0.22974419593811035,
-0.025514401495456696,
-0.4540731608867645,
0.2232973277568817,
0.2540613114833832,
0.016472186893224716,
-0.20769661664962769,
0.05345691740512848,
0.1526237428188324,
-0.1369924396276474,
-0.20163996517658234,
-0.1757192611694336
] |
https://github.com/huggingface/datasets/issues/633 | Load large text file for LM pre-training resulting in OOM | Thanks for sharing your results.
So you still had the issue for fine-tuning ?
And the issue still appears with a bare-bone dataset from an arrow file... | I tried to pretrain Longformer using transformers and datasets. But I got OOM issues with loading a large text file. My script is almost like this:
```python
from datasets import load_dataset
@dataclass
class DataCollatorForDatasetsLanguageModeling(DataCollatorForLanguageModeling):
"""
Data collator used for language modeling based on DataCollatorForLazyLanguageModeling
- collates batches of tensors, honoring their tokenizer's pad_token
- preprocesses batches for masked language modeling
"""
block_size: int = 512
def __call__(self, examples: List[dict]) -> Dict[str, torch.Tensor]:
examples = [example['text'] for example in examples]
batch, attention_mask = self._tensorize_batch(examples)
if self.mlm:
inputs, labels = self.mask_tokens(batch)
return {"input_ids": inputs, "labels": labels}
else:
labels = batch.clone().detach()
if self.tokenizer.pad_token_id is not None:
labels[labels == self.tokenizer.pad_token_id] = -100
return {"input_ids": batch, "labels": labels}
def _tensorize_batch(self, examples: List[str]) -> Tuple[torch.Tensor, torch.Tensor]:
if self.tokenizer._pad_token is None:
raise ValueError(
"You are attempting to pad samples but the tokenizer you are using"
f" ({self.tokenizer.__class__.__name__}) does not have one."
)
tensor_examples = self.tokenizer.batch_encode_plus(
[ex for ex in examples if ex],
max_length=self.block_size,
return_tensors="pt",
pad_to_max_length=True,
return_attention_mask=True,
truncation=True,
)
input_ids, attention_mask = tensor_examples["input_ids"], tensor_examples["attention_mask"]
return input_ids, attention_mask
dataset = load_dataset('text', data_files='train.txt',cache_dir="./", , split='train')
data_collator = DataCollatorForDatasetsLanguageModeling(tokenizer=tokenizer, mlm=True,
mlm_probability=0.15, block_size=tokenizer.max_len)
trainer = Trainer(model=model, args=args, data_collator=data_collator,
train_dataset=train_dataset, prediction_loss_only=True, )
trainer.train(model_path=model_path)
```
This train.txt is about 1.1GB and has 90k lines where each line is a sequence of 4k words.
During training, the memory usage increased fast as the following graph and resulted in OOM before the finish of training.

Could you please give me any suggestions on why this happened and how to fix it?
Thanks. | 27 | Load large text file for LM pre-training resulting in OOM
I tried to pretrain Longformer using transformers and datasets. But I got OOM issues with loading a large text file. My script is almost like this:
```python
from datasets import load_dataset
@dataclass
class DataCollatorForDatasetsLanguageModeling(DataCollatorForLanguageModeling):
"""
Data collator used for language modeling based on DataCollatorForLazyLanguageModeling
- collates batches of tensors, honoring their tokenizer's pad_token
- preprocesses batches for masked language modeling
"""
block_size: int = 512
def __call__(self, examples: List[dict]) -> Dict[str, torch.Tensor]:
examples = [example['text'] for example in examples]
batch, attention_mask = self._tensorize_batch(examples)
if self.mlm:
inputs, labels = self.mask_tokens(batch)
return {"input_ids": inputs, "labels": labels}
else:
labels = batch.clone().detach()
if self.tokenizer.pad_token_id is not None:
labels[labels == self.tokenizer.pad_token_id] = -100
return {"input_ids": batch, "labels": labels}
def _tensorize_batch(self, examples: List[str]) -> Tuple[torch.Tensor, torch.Tensor]:
if self.tokenizer._pad_token is None:
raise ValueError(
"You are attempting to pad samples but the tokenizer you are using"
f" ({self.tokenizer.__class__.__name__}) does not have one."
)
tensor_examples = self.tokenizer.batch_encode_plus(
[ex for ex in examples if ex],
max_length=self.block_size,
return_tensors="pt",
pad_to_max_length=True,
return_attention_mask=True,
truncation=True,
)
input_ids, attention_mask = tensor_examples["input_ids"], tensor_examples["attention_mask"]
return input_ids, attention_mask
dataset = load_dataset('text', data_files='train.txt',cache_dir="./", , split='train')
data_collator = DataCollatorForDatasetsLanguageModeling(tokenizer=tokenizer, mlm=True,
mlm_probability=0.15, block_size=tokenizer.max_len)
trainer = Trainer(model=model, args=args, data_collator=data_collator,
train_dataset=train_dataset, prediction_loss_only=True, )
trainer.train(model_path=model_path)
```
This train.txt is about 1.1GB and has 90k lines where each line is a sequence of 4k words.
During training, the memory usage increased fast as the following graph and resulted in OOM before the finish of training.

Could you please give me any suggestions on why this happened and how to fix it?
Thanks.
Thanks for sharing your results.
So you still had the issue for fine-tuning ?
And the issue still appears with a bare-bone dataset from an arrow file... | [
-0.6339283585548401,
-0.47753778100013733,
0.010693363845348358,
0.29863524436950684,
0.36004769802093506,
-0.1518251597881317,
0.5567324757575989,
0.37380579113960266,
0.01088225468993187,
0.010719746351242065,
-0.1295929253101349,
-0.1828002780675888,
-0.26698487997055054,
-0.16208980977535248,
-0.03237204998731613,
0.023206885904073715,
-0.09982117265462875,
0.19687515497207642,
-0.2772675156593323,
-0.09666657447814941,
0.05701180547475815,
-0.07762926816940308,
-0.21276047825813293,
-0.029743991792201996,
-0.3879220187664032,
-0.06171319633722305,
0.3158179223537445,
0.12212134897708893,
-0.1640809327363968,
-0.0958080142736435,
-0.22970141470432281,
0.1197899580001831,
0.4393485188484192,
0.4340214729309082,
-0.00011477212683530524,
0.006616219878196716,
0.18904384970664978,
-0.23633266985416412,
-0.16726946830749512,
0.019216440618038177,
0.07755492627620697,
-0.3022913932800293,
-0.10640020668506622,
-0.3036171495914459,
-0.02724609524011612,
-0.10612530261278152,
-0.015682043507695198,
-0.22437302768230438,
0.4987519383430481,
0.5414043068885803,
0.15876251459121704,
0.25081300735473633,
-0.21366100013256073,
0.0723966509103775,
0.25443702936172485,
0.0488995760679245,
0.1056830957531929,
-0.27951449155807495,
0.46878406405448914,
-0.1923186331987381,
-0.47268855571746826,
0.1478176862001419,
-0.22477363049983978,
-0.20168264210224152,
-0.09508860856294632,
0.03820447996258736,
0.36608895659446716,
0.031569477170705795,
0.2641869783401489,
0.3474210202693939,
0.4272076189517975,
-0.0008120127022266388,
-0.289635568857193,
-0.3209858536720276,
-0.14262455701828003,
-0.08431586623191833,
0.18923655152320862,
0.2010769546031952,
0.059826578944921494,
0.11845916509628296,
0.10712733119726181,
-0.12533129751682281,
-0.15199026465415955,
0.07616106420755386,
-0.27480751276016235,
0.33979544043540955,
-0.20125117897987366,
-0.03804318606853485,
0.15557512640953064,
-0.09447921812534332,
0.19616937637329102,
-0.09977510571479797,
0.003403950482606888,
0.25671419501304626,
-0.245441272854805,
-0.11239507794380188,
-0.07168225198984146,
-0.5194145441055298,
0.16278403997421265,
-0.2759450674057007,
0.1981883943080902,
0.29723939299583435,
-0.08766181021928787,
-0.06761691719293594,
0.08639387786388397,
0.4202020466327667,
-0.25243741273880005,
0.26052793860435486,
0.22725635766983032,
0.16401110589504242,
-0.17170630395412445,
-0.04439859092235565,
-0.33051154017448425,
-0.19624567031860352,
0.10159362852573395,
-0.07734166085720062,
-0.011017010547220707,
-0.2546045482158661,
-0.24042175710201263,
0.05854658782482147,
-0.14076969027519226,
-0.03084544464945793,
0.2748163938522339,
0.38997286558151245,
-0.3540611267089844,
0.4294978082180023,
0.16510933637619019,
0.052328936755657196,
-0.4855332672595978,
-0.33652669191360474,
-0.17440199851989746,
0.15325728058815002,
-0.20324474573135376,
0.038975562900304794,
0.12979257106781006,
0.13963374495506287,
0.05965423583984375,
-0.04288341850042343,
-0.0625898689031601,
-0.44021931290626526,
-0.009444482624530792,
-0.024103429168462753,
0.020752981305122375,
-0.04251480475068092,
0.06302379071712494,
-0.02336559072136879,
0.23476582765579224,
-0.12499457597732544,
-0.025381658226251602,
0.3477915823459625,
-0.2762118875980377,
-0.2276410162448883,
0.05097950994968414,
0.21017630398273468,
-0.02824842929840088,
0.20915503799915314,
0.028506658971309662,
0.07685685157775879,
0.5359783172607422,
0.006653331220149994,
-0.04714777320623398,
-0.3782060742378235,
0.09452182054519653,
0.09201760590076447,
0.1619914025068283,
0.17663070559501648,
-0.042587969452142715,
-0.07260239124298096,
0.0063892244361341,
0.10358665883541107,
0.25504034757614136,
0.3907330334186554,
-0.22647030651569366,
0.2906738817691803,
0.007004471495747566,
-0.05665605142712593,
0.5319919586181641,
-0.2620989978313446,
-0.448444128036499,
0.23385274410247803,
-0.3511556386947632,
0.10818185657262802,
0.22066983580589294,
0.1759030818939209,
0.11388914287090302,
-0.1089852899312973,
0.26901498436927795,
0.3656851649284363,
0.07051589339971542,
0.1209140196442604,
-0.23662437498569489,
-0.09222844988107681,
-0.1715157926082611,
0.48420286178588867,
0.36272403597831726,
-0.02558579295873642,
-0.07308889180421829,
0.35637998580932617,
0.18339842557907104,
-0.1992236077785492,
0.13128061592578888,
0.36934155225753784,
-0.17442509531974792,
-0.1261582374572754,
0.0944812074303627,
0.06559769064188004,
-0.3000325560569763,
-0.07098697125911713,
-0.09084425866603851,
0.0828668475151062,
-0.1136055737733841,
-0.08942607045173645,
0.28255847096443176,
0.02287023328244686,
-0.0766652524471283,
0.11318020522594452,
0.03794129937887192,
-0.13182224333286285,
0.024866361171007156,
-0.07041719555854797,
0.1261971890926361,
0.015421975404024124,
-0.09320687502622604,
0.08736041188240051,
-0.2184159904718399,
-0.12394054979085922,
0.0018030330538749695,
-0.137061208486557,
0.07695000618696213,
0.17527323961257935,
-0.05118799954652786,
0.03840121626853943,
-0.17304009199142456,
0.10695729404687881,
-0.15297769010066986,
-0.2987070679664612,
-0.5071570873260498,
0.43589335680007935,
0.18647874891757965,
-0.33810955286026,
0.3402597904205322,
0.1040273904800415,
-0.029599443078041077,
-0.10627070814371109,
-0.11989574879407883,
0.5749332904815674,
0.27307116985321045,
0.019617579877376556,
0.29909294843673706,
-0.24541117250919342,
0.2542804777622223,
-0.2662392258644104,
-0.10361561179161072,
-0.09776493161916733,
0.4209232032299042,
0.03105533868074417,
0.23506294190883636,
0.14828065037727356,
-0.08694546669721603,
-0.232059508562088,
0.47038108110427856,
-0.1788094937801361,
-0.013872608542442322,
0.26652613282203674,
-0.4247211217880249,
-0.011563490144908428,
-0.34802117943763733,
-0.24947787821292877,
0.0067334845662117004,
0.17322899401187897,
-0.09441326558589935,
-0.055435195565223694,
0.008537785150110722,
-0.26279330253601074,
0.007836148142814636,
0.1532370001077652,
-0.0718524307012558,
0.31983456015586853,
0.11651500314474106,
0.10059522092342377,
-0.122891865670681,
-0.1794070154428482,
0.10284756124019623,
0.17828989028930664,
-0.27519121766090393,
0.18444325029850006,
-0.02282267063856125,
-0.013446485623717308,
-0.2862633764743805,
0.1904245764017105,
-0.12680108845233917,
0.0388152077794075,
-0.0647432953119278,
0.25868889689445496,
-0.07790280133485794,
0.10191172361373901,
0.3001607060432434,
0.3549228012561798,
0.4629628658294678,
-0.07809486240148544,
0.326348215341568,
-0.08266382664442062,
-0.1796954870223999,
0.032943595200777054,
0.33450770378112793,
-0.3179926872253418,
-0.024890778586268425,
0.005377540364861488,
0.05117718130350113,
-0.09892972558736801,
-0.16603437066078186,
0.09468895941972733,
0.196824312210083,
-0.16618932783603668,
-0.2573060691356659,
-0.07217618823051453,
0.17769087851047516,
-0.042431723326444626,
0.11972848325967789,
-0.23244111239910126,
0.008407561108469963,
0.1450573354959488,
-0.006289597600698471,
-0.18432363867759705,
0.04044550284743309,
-0.1199219599366188,
-0.04705164581537247,
-0.411641389131546,
-0.05351852625608444,
0.10705065727233887,
0.13673138618469238,
0.35936760902404785,
0.10678976029157639,
0.19445137679576874,
0.28844478726387024,
0.15859206020832062,
0.006367621943354607,
-0.0885988399386406,
0.5141718983650208,
-0.017572684213519096,
-0.29719802737236023,
-0.2908625900745392,
-0.23975418508052826,
0.02511288784444332,
0.3155249357223511,
-0.684260904788971,
0.23378321528434753,
-0.1138516515493393,
-0.09402675926685333,
-0.3955192267894745,
0.0007258430123329163,
0.2522047758102417,
-0.07614870369434357,
0.016339777037501335,
0.09547417610883713,
0.2302767038345337,
0.1546790897846222,
-0.03878729045391083,
0.38579460978507996,
-0.4130840301513672,
0.35940811038017273,
-0.13545823097229004,
0.4855530261993408,
-0.122118279337883,
-0.2300206571817398,
0.09887474775314331,
0.15044830739498138,
-0.01711525395512581,
-0.021802209317684174,
-0.013968504965305328,
-0.25937944650650024,
-0.058237224817276,
0.0227312333881855,
0.5197213292121887,
0.01689060777425766,
-0.16558955609798431,
-0.015898926183581352,
0.06816425919532776,
0.2563197910785675,
-0.26069891452789307,
0.49052777886390686,
-0.19077889621257782,
0.01841624826192856,
-0.19967399537563324,
0.01874571293592453,
-0.20498108863830566,
-0.21508586406707764,
-0.164134681224823,
0.09344439208507538,
-0.03038274496793747,
-0.22404396533966064,
-0.2116939276456833,
0.10314016044139862,
-0.3681343197822571,
-0.0437651127576828,
0.11799006909132004,
0.22933240234851837,
0.18077029287815094,
-0.19614383578300476,
-0.08628876507282257,
-0.20187069475650787,
0.35741427540779114,
0.1934524029493332,
0.11246532201766968,
0.16325931251049042,
-0.05687852203845978,
-0.2155371457338333,
-0.17745190858840942,
-0.29045435786247253,
0.14190825819969177,
0.6505106687545776,
0.6102464199066162,
-0.21627351641654968,
-0.15859898924827576,
0.07914479076862335,
0.002603483386337757,
-0.16527341306209564,
-0.548757016658783,
-0.12850907444953918,
-0.16549962759017944,
-0.44105130434036255,
0.004606112837791443,
0.35849836468696594,
0.3558535575866699,
-0.2264459729194641,
-0.03187551349401474,
0.13872987031936646,
-0.0007013268768787384,
0.37175118923187256,
-0.12976384162902832,
0.015054157003760338,
-0.06641082465648651,
0.225828617811203,
-0.10741686820983887,
0.36735567450523376,
0.24888965487480164,
0.35636386275291443,
0.1917259395122528,
-0.31755685806274414,
0.0706881731748581,
-0.029888737946748734,
0.23143038153648376,
0.11516103148460388,
0.11022848635911942,
0.3546280860900879,
0.1289711445569992,
0.3322555422782898,
-0.19096627831459045,
0.6737229228019714,
-0.007344553247094154,
0.20682765543460846,
-0.8374910354614258,
-0.26737040281295776,
0.33145615458488464,
-0.02635771967470646,
0.19940276443958282,
0.215718075633049,
-0.40385204553604126,
-0.3216697573661804,
0.376661479473114,
0.09908346086740494,
0.7675239443778992,
-0.2972695827484131,
0.39625850319862366,
-0.1552990972995758,
0.6611965894699097,
0.12803049385547638,
-0.3813104033470154,
0.1585618406534195,
-0.39879149198532104,
-0.2663658857345581,
0.21300511062145233,
-0.09231188893318176,
0.036539800465106964,
0.16050389409065247,
-0.2905767560005188,
-0.029811730608344078,
0.0862521380186081,
0.2249334454536438,
0.13066981732845306,
0.5134936571121216,
0.12092680484056473,
-0.6006978154182434,
-0.08281297981739044,
0.02656909078359604,
-0.02340024709701538,
-0.10490188002586365,
-0.0492798313498497,
0.07994647324085236,
-0.0313267819583416,
-0.20856402814388275,
-0.028466172516345978,
0.20525774359703064,
-0.2474464625120163,
0.08661594241857529,
0.06375248730182648,
-0.07205313444137573,
0.5367995500564575,
0.10623051226139069,
-0.001361064612865448,
0.4988958239555359,
-0.039286620914936066,
0.13215835392475128,
-0.2274819314479828,
-0.1652863323688507,
0.20070844888687134,
-0.06584891676902771,
0.4217033088207245,
0.08837933093309402,
-0.0005880966782569885,
0.11410333216190338,
0.0632382407784462,
-0.046690933406353,
0.09476359188556671,
-0.36430907249450684,
0.10549724102020264,
-0.41123154759407043,
-0.21542777121067047,
-0.08843062818050385,
-0.30078285932540894,
-0.1009221225976944,
0.12310943007469177,
0.13735687732696533,
-0.46444618701934814,
0.11514545977115631,
0.2652113139629364,
-0.3750092685222626,
0.011997109279036522,
0.38382449746131897,
0.17105859518051147,
-0.10513918846845627,
0.49984270334243774,
0.4575878381729126,
-0.053361937403678894,
-0.2644973695278168,
-0.10962903499603271,
0.29444822669029236,
-0.2731435000896454,
0.0849163606762886,
-0.2455592304468155,
-0.3016006648540497,
0.209351047873497,
0.08087542653083801,
0.10009974241256714,
-0.01499941200017929,
-0.06326231360435486,
-0.25102943181991577,
-0.6380501389503479,
-0.18144388496875763,
-0.0027230940759181976,
-0.00354844331741333,
0.1460832953453064,
0.27389806509017944,
-0.3100467920303345,
0.5892773270606995,
-0.2788558602333069,
-0.05294197052717209,
-0.20760811865329742,
0.2782232165336609,
-0.055562183260917664,
-0.38554659485816956,
0.21153579652309418,
0.2033519148826599,
0.1001039668917656,
0.08059665560722351,
0.00590919703245163,
-0.22135356068611145,
-0.14351996779441833,
0.11271549016237259,
0.23647010326385498,
-0.41966331005096436,
-0.01599399372935295,
-0.312997043132782,
-0.09248970448970795,
-0.27002182602882385,
0.06606784462928772,
0.017028577625751495,
0.01394578069448471,
-0.22617922723293304,
0.009393874555826187,
0.04752609133720398,
-0.2552624046802521,
0.04206028953194618,
-0.25458529591560364,
0.12509100139141083,
0.2465714067220688,
0.1331031173467636,
0.11783083528280258,
0.0006371289491653442,
-0.3931019604206085,
0.17964592576026917,
0.6661380529403687,
-0.017532095313072205,
0.4190823435783386,
-0.43573224544525146,
-0.0715063214302063,
0.24765951931476593,
0.04980342835187912,
0.048066146671772,
-0.34167730808258057,
-0.010718589648604393,
0.2935883700847626,
0.22681888937950134,
0.015208568423986435,
-0.014733202755451202,
0.22635462880134583,
-0.41129830479621887,
0.1301487535238266,
0.3453426659107208,
-0.11192676424980164,
-0.06747587025165558,
0.1559651792049408,
0.09132310748100281,
0.5066777467727661,
0.11496534198522568,
0.005711604841053486,
0.24894991517066956,
-0.00122002512216568,
0.15485714375972748,
0.48569241166114807,
0.261119544506073,
0.23868051171302795,
0.3016282618045807,
-0.032666049897670746,
-0.04069993644952774,
-0.2312840223312378,
0.2294139564037323,
-0.435617059469223,
-0.41516661643981934,
-0.2674567401409149,
0.5044151544570923,
-0.01932355761528015,
0.12420932948589325,
-0.3350299298763275,
-0.06624119728803635,
-0.04065354913473129,
0.2541331350803375,
-0.11921557784080505,
0.2744082510471344,
-0.45309436321258545,
-0.17059893906116486,
-0.08942428231239319,
-0.12396197021007538,
0.011534325778484344,
0.18963316082954407,
-0.0558583103120327,
0.27227628231048584,
-0.5796654224395752,
0.22938616573810577,
0.05213649570941925,
0.1451501101255417,
-0.1346784234046936,
0.1227787584066391,
0.10550137609243393,
-0.5078572034835815,
0.34333521127700806,
0.23785626888275146,
0.29185950756073,
0.11540549993515015,
-0.22190696001052856,
0.34437036514282227,
0.43669766187667847,
-0.1908072531223297,
-0.04061196744441986,
-0.12098392844200134,
-0.03561992570757866,
-0.1499127894639969,
0.19743536412715912,
0.3490368723869324,
0.18789905309677124,
0.2596159875392914,
0.0557275116443634,
-0.26596614718437195,
0.27851778268814087,
0.06501396000385284,
-0.3240588903427124,
0.17866621911525726,
-0.13293880224227905,
0.4019324481487274,
-0.32858094573020935,
-0.4429645836353302,
0.00986664742231369,
-0.39412444829940796,
0.21558675169944763,
0.6670199036598206,
-0.2954224944114685,
0.28785526752471924,
-0.02548792213201523,
0.04855022579431534,
0.0018409136682748795,
0.47605016827583313,
0.46973514556884766,
0.2841596007347107,
-0.37837129831314087,
-0.025667212903499603,
-0.32888373732566833,
0.2765583097934723,
-0.2024305909872055,
0.06699749082326889,
0.022247930988669395,
0.17079433798789978,
0.16457822918891907,
-0.003302011638879776,
-0.07962261140346527,
-0.013621993362903595,
0.21880324184894562,
-0.19506913423538208,
-0.1675596684217453,
-0.12804758548736572,
0.0020943284034729004,
0.3573179543018341,
-0.025900525972247124,
-0.29754993319511414,
0.15886540710926056,
0.11506294459104538,
0.0991566851735115,
-0.3214535713195801,
0.3626996874809265,
-0.19846373796463013,
-0.02036242187023163,
0.0691281408071518,
-0.15047122538089752,
0.37920957803726196,
-0.22043859958648682,
-0.03304758667945862,
-0.08182770013809204,
0.12814156711101532,
-0.16707712411880493,
-0.22100013494491577,
0.3402222692966461,
0.38842451572418213,
-0.10763649642467499,
0.10821394622325897,
-0.25519275665283203,
-0.08646275848150253,
0.040304481983184814,
-0.36969074606895447,
-0.3087161183357239,
-0.0074881562031805515,
-0.0002531483769416809,
0.008524507284164429,
0.10309776663780212,
0.24583062529563904,
0.10533731430768967,
-0.027840254828333855,
-0.22922900319099426,
-0.1855800449848175,
0.20947544276714325,
-0.2946496903896332,
-0.31304094195365906,
-0.03537982702255249,
0.05562475696206093,
-0.16362905502319336,
0.2511020004749298,
-0.46240702271461487,
0.14574888348579407,
0.22974419593811035,
-0.025514401495456696,
-0.4540731608867645,
0.2232973277568817,
0.2540613114833832,
0.016472186893224716,
-0.20769661664962769,
0.05345691740512848,
0.1526237428188324,
-0.1369924396276474,
-0.20163996517658234,
-0.1757192611694336
] |
https://github.com/huggingface/datasets/issues/633 | Load large text file for LM pre-training resulting in OOM | Yes, on both cases. Fine-tuning a pre-trained model and pre-training from scratch with a local arrow file already pre-processed. | I tried to pretrain Longformer using transformers and datasets. But I got OOM issues with loading a large text file. My script is almost like this:
```python
from datasets import load_dataset
@dataclass
class DataCollatorForDatasetsLanguageModeling(DataCollatorForLanguageModeling):
"""
Data collator used for language modeling based on DataCollatorForLazyLanguageModeling
- collates batches of tensors, honoring their tokenizer's pad_token
- preprocesses batches for masked language modeling
"""
block_size: int = 512
def __call__(self, examples: List[dict]) -> Dict[str, torch.Tensor]:
examples = [example['text'] for example in examples]
batch, attention_mask = self._tensorize_batch(examples)
if self.mlm:
inputs, labels = self.mask_tokens(batch)
return {"input_ids": inputs, "labels": labels}
else:
labels = batch.clone().detach()
if self.tokenizer.pad_token_id is not None:
labels[labels == self.tokenizer.pad_token_id] = -100
return {"input_ids": batch, "labels": labels}
def _tensorize_batch(self, examples: List[str]) -> Tuple[torch.Tensor, torch.Tensor]:
if self.tokenizer._pad_token is None:
raise ValueError(
"You are attempting to pad samples but the tokenizer you are using"
f" ({self.tokenizer.__class__.__name__}) does not have one."
)
tensor_examples = self.tokenizer.batch_encode_plus(
[ex for ex in examples if ex],
max_length=self.block_size,
return_tensors="pt",
pad_to_max_length=True,
return_attention_mask=True,
truncation=True,
)
input_ids, attention_mask = tensor_examples["input_ids"], tensor_examples["attention_mask"]
return input_ids, attention_mask
dataset = load_dataset('text', data_files='train.txt',cache_dir="./", , split='train')
data_collator = DataCollatorForDatasetsLanguageModeling(tokenizer=tokenizer, mlm=True,
mlm_probability=0.15, block_size=tokenizer.max_len)
trainer = Trainer(model=model, args=args, data_collator=data_collator,
train_dataset=train_dataset, prediction_loss_only=True, )
trainer.train(model_path=model_path)
```
This train.txt is about 1.1GB and has 90k lines where each line is a sequence of 4k words.
During training, the memory usage increased fast as the following graph and resulted in OOM before the finish of training.

Could you please give me any suggestions on why this happened and how to fix it?
Thanks. | 19 | Load large text file for LM pre-training resulting in OOM
I tried to pretrain Longformer using transformers and datasets. But I got OOM issues with loading a large text file. My script is almost like this:
```python
from datasets import load_dataset
@dataclass
class DataCollatorForDatasetsLanguageModeling(DataCollatorForLanguageModeling):
"""
Data collator used for language modeling based on DataCollatorForLazyLanguageModeling
- collates batches of tensors, honoring their tokenizer's pad_token
- preprocesses batches for masked language modeling
"""
block_size: int = 512
def __call__(self, examples: List[dict]) -> Dict[str, torch.Tensor]:
examples = [example['text'] for example in examples]
batch, attention_mask = self._tensorize_batch(examples)
if self.mlm:
inputs, labels = self.mask_tokens(batch)
return {"input_ids": inputs, "labels": labels}
else:
labels = batch.clone().detach()
if self.tokenizer.pad_token_id is not None:
labels[labels == self.tokenizer.pad_token_id] = -100
return {"input_ids": batch, "labels": labels}
def _tensorize_batch(self, examples: List[str]) -> Tuple[torch.Tensor, torch.Tensor]:
if self.tokenizer._pad_token is None:
raise ValueError(
"You are attempting to pad samples but the tokenizer you are using"
f" ({self.tokenizer.__class__.__name__}) does not have one."
)
tensor_examples = self.tokenizer.batch_encode_plus(
[ex for ex in examples if ex],
max_length=self.block_size,
return_tensors="pt",
pad_to_max_length=True,
return_attention_mask=True,
truncation=True,
)
input_ids, attention_mask = tensor_examples["input_ids"], tensor_examples["attention_mask"]
return input_ids, attention_mask
dataset = load_dataset('text', data_files='train.txt',cache_dir="./", , split='train')
data_collator = DataCollatorForDatasetsLanguageModeling(tokenizer=tokenizer, mlm=True,
mlm_probability=0.15, block_size=tokenizer.max_len)
trainer = Trainer(model=model, args=args, data_collator=data_collator,
train_dataset=train_dataset, prediction_loss_only=True, )
trainer.train(model_path=model_path)
```
This train.txt is about 1.1GB and has 90k lines where each line is a sequence of 4k words.
During training, the memory usage increased fast as the following graph and resulted in OOM before the finish of training.

Could you please give me any suggestions on why this happened and how to fix it?
Thanks.
Yes, on both cases. Fine-tuning a pre-trained model and pre-training from scratch with a local arrow file already pre-processed. | [
-0.6339283585548401,
-0.47753778100013733,
0.010693363845348358,
0.29863524436950684,
0.36004769802093506,
-0.1518251597881317,
0.5567324757575989,
0.37380579113960266,
0.01088225468993187,
0.010719746351242065,
-0.1295929253101349,
-0.1828002780675888,
-0.26698487997055054,
-0.16208980977535248,
-0.03237204998731613,
0.023206885904073715,
-0.09982117265462875,
0.19687515497207642,
-0.2772675156593323,
-0.09666657447814941,
0.05701180547475815,
-0.07762926816940308,
-0.21276047825813293,
-0.029743991792201996,
-0.3879220187664032,
-0.06171319633722305,
0.3158179223537445,
0.12212134897708893,
-0.1640809327363968,
-0.0958080142736435,
-0.22970141470432281,
0.1197899580001831,
0.4393485188484192,
0.4340214729309082,
-0.00011477212683530524,
0.006616219878196716,
0.18904384970664978,
-0.23633266985416412,
-0.16726946830749512,
0.019216440618038177,
0.07755492627620697,
-0.3022913932800293,
-0.10640020668506622,
-0.3036171495914459,
-0.02724609524011612,
-0.10612530261278152,
-0.015682043507695198,
-0.22437302768230438,
0.4987519383430481,
0.5414043068885803,
0.15876251459121704,
0.25081300735473633,
-0.21366100013256073,
0.0723966509103775,
0.25443702936172485,
0.0488995760679245,
0.1056830957531929,
-0.27951449155807495,
0.46878406405448914,
-0.1923186331987381,
-0.47268855571746826,
0.1478176862001419,
-0.22477363049983978,
-0.20168264210224152,
-0.09508860856294632,
0.03820447996258736,
0.36608895659446716,
0.031569477170705795,
0.2641869783401489,
0.3474210202693939,
0.4272076189517975,
-0.0008120127022266388,
-0.289635568857193,
-0.3209858536720276,
-0.14262455701828003,
-0.08431586623191833,
0.18923655152320862,
0.2010769546031952,
0.059826578944921494,
0.11845916509628296,
0.10712733119726181,
-0.12533129751682281,
-0.15199026465415955,
0.07616106420755386,
-0.27480751276016235,
0.33979544043540955,
-0.20125117897987366,
-0.03804318606853485,
0.15557512640953064,
-0.09447921812534332,
0.19616937637329102,
-0.09977510571479797,
0.003403950482606888,
0.25671419501304626,
-0.245441272854805,
-0.11239507794380188,
-0.07168225198984146,
-0.5194145441055298,
0.16278403997421265,
-0.2759450674057007,
0.1981883943080902,
0.29723939299583435,
-0.08766181021928787,
-0.06761691719293594,
0.08639387786388397,
0.4202020466327667,
-0.25243741273880005,
0.26052793860435486,
0.22725635766983032,
0.16401110589504242,
-0.17170630395412445,
-0.04439859092235565,
-0.33051154017448425,
-0.19624567031860352,
0.10159362852573395,
-0.07734166085720062,
-0.011017010547220707,
-0.2546045482158661,
-0.24042175710201263,
0.05854658782482147,
-0.14076969027519226,
-0.03084544464945793,
0.2748163938522339,
0.38997286558151245,
-0.3540611267089844,
0.4294978082180023,
0.16510933637619019,
0.052328936755657196,
-0.4855332672595978,
-0.33652669191360474,
-0.17440199851989746,
0.15325728058815002,
-0.20324474573135376,
0.038975562900304794,
0.12979257106781006,
0.13963374495506287,
0.05965423583984375,
-0.04288341850042343,
-0.0625898689031601,
-0.44021931290626526,
-0.009444482624530792,
-0.024103429168462753,
0.020752981305122375,
-0.04251480475068092,
0.06302379071712494,
-0.02336559072136879,
0.23476582765579224,
-0.12499457597732544,
-0.025381658226251602,
0.3477915823459625,
-0.2762118875980377,
-0.2276410162448883,
0.05097950994968414,
0.21017630398273468,
-0.02824842929840088,
0.20915503799915314,
0.028506658971309662,
0.07685685157775879,
0.5359783172607422,
0.006653331220149994,
-0.04714777320623398,
-0.3782060742378235,
0.09452182054519653,
0.09201760590076447,
0.1619914025068283,
0.17663070559501648,
-0.042587969452142715,
-0.07260239124298096,
0.0063892244361341,
0.10358665883541107,
0.25504034757614136,
0.3907330334186554,
-0.22647030651569366,
0.2906738817691803,
0.007004471495747566,
-0.05665605142712593,
0.5319919586181641,
-0.2620989978313446,
-0.448444128036499,
0.23385274410247803,
-0.3511556386947632,
0.10818185657262802,
0.22066983580589294,
0.1759030818939209,
0.11388914287090302,
-0.1089852899312973,
0.26901498436927795,
0.3656851649284363,
0.07051589339971542,
0.1209140196442604,
-0.23662437498569489,
-0.09222844988107681,
-0.1715157926082611,
0.48420286178588867,
0.36272403597831726,
-0.02558579295873642,
-0.07308889180421829,
0.35637998580932617,
0.18339842557907104,
-0.1992236077785492,
0.13128061592578888,
0.36934155225753784,
-0.17442509531974792,
-0.1261582374572754,
0.0944812074303627,
0.06559769064188004,
-0.3000325560569763,
-0.07098697125911713,
-0.09084425866603851,
0.0828668475151062,
-0.1136055737733841,
-0.08942607045173645,
0.28255847096443176,
0.02287023328244686,
-0.0766652524471283,
0.11318020522594452,
0.03794129937887192,
-0.13182224333286285,
0.024866361171007156,
-0.07041719555854797,
0.1261971890926361,
0.015421975404024124,
-0.09320687502622604,
0.08736041188240051,
-0.2184159904718399,
-0.12394054979085922,
0.0018030330538749695,
-0.137061208486557,
0.07695000618696213,
0.17527323961257935,
-0.05118799954652786,
0.03840121626853943,
-0.17304009199142456,
0.10695729404687881,
-0.15297769010066986,
-0.2987070679664612,
-0.5071570873260498,
0.43589335680007935,
0.18647874891757965,
-0.33810955286026,
0.3402597904205322,
0.1040273904800415,
-0.029599443078041077,
-0.10627070814371109,
-0.11989574879407883,
0.5749332904815674,
0.27307116985321045,
0.019617579877376556,
0.29909294843673706,
-0.24541117250919342,
0.2542804777622223,
-0.2662392258644104,
-0.10361561179161072,
-0.09776493161916733,
0.4209232032299042,
0.03105533868074417,
0.23506294190883636,
0.14828065037727356,
-0.08694546669721603,
-0.232059508562088,
0.47038108110427856,
-0.1788094937801361,
-0.013872608542442322,
0.26652613282203674,
-0.4247211217880249,
-0.011563490144908428,
-0.34802117943763733,
-0.24947787821292877,
0.0067334845662117004,
0.17322899401187897,
-0.09441326558589935,
-0.055435195565223694,
0.008537785150110722,
-0.26279330253601074,
0.007836148142814636,
0.1532370001077652,
-0.0718524307012558,
0.31983456015586853,
0.11651500314474106,
0.10059522092342377,
-0.122891865670681,
-0.1794070154428482,
0.10284756124019623,
0.17828989028930664,
-0.27519121766090393,
0.18444325029850006,
-0.02282267063856125,
-0.013446485623717308,
-0.2862633764743805,
0.1904245764017105,
-0.12680108845233917,
0.0388152077794075,
-0.0647432953119278,
0.25868889689445496,
-0.07790280133485794,
0.10191172361373901,
0.3001607060432434,
0.3549228012561798,
0.4629628658294678,
-0.07809486240148544,
0.326348215341568,
-0.08266382664442062,
-0.1796954870223999,
0.032943595200777054,
0.33450770378112793,
-0.3179926872253418,
-0.024890778586268425,
0.005377540364861488,
0.05117718130350113,
-0.09892972558736801,
-0.16603437066078186,
0.09468895941972733,
0.196824312210083,
-0.16618932783603668,
-0.2573060691356659,
-0.07217618823051453,
0.17769087851047516,
-0.042431723326444626,
0.11972848325967789,
-0.23244111239910126,
0.008407561108469963,
0.1450573354959488,
-0.006289597600698471,
-0.18432363867759705,
0.04044550284743309,
-0.1199219599366188,
-0.04705164581537247,
-0.411641389131546,
-0.05351852625608444,
0.10705065727233887,
0.13673138618469238,
0.35936760902404785,
0.10678976029157639,
0.19445137679576874,
0.28844478726387024,
0.15859206020832062,
0.006367621943354607,
-0.0885988399386406,
0.5141718983650208,
-0.017572684213519096,
-0.29719802737236023,
-0.2908625900745392,
-0.23975418508052826,
0.02511288784444332,
0.3155249357223511,
-0.684260904788971,
0.23378321528434753,
-0.1138516515493393,
-0.09402675926685333,
-0.3955192267894745,
0.0007258430123329163,
0.2522047758102417,
-0.07614870369434357,
0.016339777037501335,
0.09547417610883713,
0.2302767038345337,
0.1546790897846222,
-0.03878729045391083,
0.38579460978507996,
-0.4130840301513672,
0.35940811038017273,
-0.13545823097229004,
0.4855530261993408,
-0.122118279337883,
-0.2300206571817398,
0.09887474775314331,
0.15044830739498138,
-0.01711525395512581,
-0.021802209317684174,
-0.013968504965305328,
-0.25937944650650024,
-0.058237224817276,
0.0227312333881855,
0.5197213292121887,
0.01689060777425766,
-0.16558955609798431,
-0.015898926183581352,
0.06816425919532776,
0.2563197910785675,
-0.26069891452789307,
0.49052777886390686,
-0.19077889621257782,
0.01841624826192856,
-0.19967399537563324,
0.01874571293592453,
-0.20498108863830566,
-0.21508586406707764,
-0.164134681224823,
0.09344439208507538,
-0.03038274496793747,
-0.22404396533966064,
-0.2116939276456833,
0.10314016044139862,
-0.3681343197822571,
-0.0437651127576828,
0.11799006909132004,
0.22933240234851837,
0.18077029287815094,
-0.19614383578300476,
-0.08628876507282257,
-0.20187069475650787,
0.35741427540779114,
0.1934524029493332,
0.11246532201766968,
0.16325931251049042,
-0.05687852203845978,
-0.2155371457338333,
-0.17745190858840942,
-0.29045435786247253,
0.14190825819969177,
0.6505106687545776,
0.6102464199066162,
-0.21627351641654968,
-0.15859898924827576,
0.07914479076862335,
0.002603483386337757,
-0.16527341306209564,
-0.548757016658783,
-0.12850907444953918,
-0.16549962759017944,
-0.44105130434036255,
0.004606112837791443,
0.35849836468696594,
0.3558535575866699,
-0.2264459729194641,
-0.03187551349401474,
0.13872987031936646,
-0.0007013268768787384,
0.37175118923187256,
-0.12976384162902832,
0.015054157003760338,
-0.06641082465648651,
0.225828617811203,
-0.10741686820983887,
0.36735567450523376,
0.24888965487480164,
0.35636386275291443,
0.1917259395122528,
-0.31755685806274414,
0.0706881731748581,
-0.029888737946748734,
0.23143038153648376,
0.11516103148460388,
0.11022848635911942,
0.3546280860900879,
0.1289711445569992,
0.3322555422782898,
-0.19096627831459045,
0.6737229228019714,
-0.007344553247094154,
0.20682765543460846,
-0.8374910354614258,
-0.26737040281295776,
0.33145615458488464,
-0.02635771967470646,
0.19940276443958282,
0.215718075633049,
-0.40385204553604126,
-0.3216697573661804,
0.376661479473114,
0.09908346086740494,
0.7675239443778992,
-0.2972695827484131,
0.39625850319862366,
-0.1552990972995758,
0.6611965894699097,
0.12803049385547638,
-0.3813104033470154,
0.1585618406534195,
-0.39879149198532104,
-0.2663658857345581,
0.21300511062145233,
-0.09231188893318176,
0.036539800465106964,
0.16050389409065247,
-0.2905767560005188,
-0.029811730608344078,
0.0862521380186081,
0.2249334454536438,
0.13066981732845306,
0.5134936571121216,
0.12092680484056473,
-0.6006978154182434,
-0.08281297981739044,
0.02656909078359604,
-0.02340024709701538,
-0.10490188002586365,
-0.0492798313498497,
0.07994647324085236,
-0.0313267819583416,
-0.20856402814388275,
-0.028466172516345978,
0.20525774359703064,
-0.2474464625120163,
0.08661594241857529,
0.06375248730182648,
-0.07205313444137573,
0.5367995500564575,
0.10623051226139069,
-0.001361064612865448,
0.4988958239555359,
-0.039286620914936066,
0.13215835392475128,
-0.2274819314479828,
-0.1652863323688507,
0.20070844888687134,
-0.06584891676902771,
0.4217033088207245,
0.08837933093309402,
-0.0005880966782569885,
0.11410333216190338,
0.0632382407784462,
-0.046690933406353,
0.09476359188556671,
-0.36430907249450684,
0.10549724102020264,
-0.41123154759407043,
-0.21542777121067047,
-0.08843062818050385,
-0.30078285932540894,
-0.1009221225976944,
0.12310943007469177,
0.13735687732696533,
-0.46444618701934814,
0.11514545977115631,
0.2652113139629364,
-0.3750092685222626,
0.011997109279036522,
0.38382449746131897,
0.17105859518051147,
-0.10513918846845627,
0.49984270334243774,
0.4575878381729126,
-0.053361937403678894,
-0.2644973695278168,
-0.10962903499603271,
0.29444822669029236,
-0.2731435000896454,
0.0849163606762886,
-0.2455592304468155,
-0.3016006648540497,
0.209351047873497,
0.08087542653083801,
0.10009974241256714,
-0.01499941200017929,
-0.06326231360435486,
-0.25102943181991577,
-0.6380501389503479,
-0.18144388496875763,
-0.0027230940759181976,
-0.00354844331741333,
0.1460832953453064,
0.27389806509017944,
-0.3100467920303345,
0.5892773270606995,
-0.2788558602333069,
-0.05294197052717209,
-0.20760811865329742,
0.2782232165336609,
-0.055562183260917664,
-0.38554659485816956,
0.21153579652309418,
0.2033519148826599,
0.1001039668917656,
0.08059665560722351,
0.00590919703245163,
-0.22135356068611145,
-0.14351996779441833,
0.11271549016237259,
0.23647010326385498,
-0.41966331005096436,
-0.01599399372935295,
-0.312997043132782,
-0.09248970448970795,
-0.27002182602882385,
0.06606784462928772,
0.017028577625751495,
0.01394578069448471,
-0.22617922723293304,
0.009393874555826187,
0.04752609133720398,
-0.2552624046802521,
0.04206028953194618,
-0.25458529591560364,
0.12509100139141083,
0.2465714067220688,
0.1331031173467636,
0.11783083528280258,
0.0006371289491653442,
-0.3931019604206085,
0.17964592576026917,
0.6661380529403687,
-0.017532095313072205,
0.4190823435783386,
-0.43573224544525146,
-0.0715063214302063,
0.24765951931476593,
0.04980342835187912,
0.048066146671772,
-0.34167730808258057,
-0.010718589648604393,
0.2935883700847626,
0.22681888937950134,
0.015208568423986435,
-0.014733202755451202,
0.22635462880134583,
-0.41129830479621887,
0.1301487535238266,
0.3453426659107208,
-0.11192676424980164,
-0.06747587025165558,
0.1559651792049408,
0.09132310748100281,
0.5066777467727661,
0.11496534198522568,
0.005711604841053486,
0.24894991517066956,
-0.00122002512216568,
0.15485714375972748,
0.48569241166114807,
0.261119544506073,
0.23868051171302795,
0.3016282618045807,
-0.032666049897670746,
-0.04069993644952774,
-0.2312840223312378,
0.2294139564037323,
-0.435617059469223,
-0.41516661643981934,
-0.2674567401409149,
0.5044151544570923,
-0.01932355761528015,
0.12420932948589325,
-0.3350299298763275,
-0.06624119728803635,
-0.04065354913473129,
0.2541331350803375,
-0.11921557784080505,
0.2744082510471344,
-0.45309436321258545,
-0.17059893906116486,
-0.08942428231239319,
-0.12396197021007538,
0.011534325778484344,
0.18963316082954407,
-0.0558583103120327,
0.27227628231048584,
-0.5796654224395752,
0.22938616573810577,
0.05213649570941925,
0.1451501101255417,
-0.1346784234046936,
0.1227787584066391,
0.10550137609243393,
-0.5078572034835815,
0.34333521127700806,
0.23785626888275146,
0.29185950756073,
0.11540549993515015,
-0.22190696001052856,
0.34437036514282227,
0.43669766187667847,
-0.1908072531223297,
-0.04061196744441986,
-0.12098392844200134,
-0.03561992570757866,
-0.1499127894639969,
0.19743536412715912,
0.3490368723869324,
0.18789905309677124,
0.2596159875392914,
0.0557275116443634,
-0.26596614718437195,
0.27851778268814087,
0.06501396000385284,
-0.3240588903427124,
0.17866621911525726,
-0.13293880224227905,
0.4019324481487274,
-0.32858094573020935,
-0.4429645836353302,
0.00986664742231369,
-0.39412444829940796,
0.21558675169944763,
0.6670199036598206,
-0.2954224944114685,
0.28785526752471924,
-0.02548792213201523,
0.04855022579431534,
0.0018409136682748795,
0.47605016827583313,
0.46973514556884766,
0.2841596007347107,
-0.37837129831314087,
-0.025667212903499603,
-0.32888373732566833,
0.2765583097934723,
-0.2024305909872055,
0.06699749082326889,
0.022247930988669395,
0.17079433798789978,
0.16457822918891907,
-0.003302011638879776,
-0.07962261140346527,
-0.013621993362903595,
0.21880324184894562,
-0.19506913423538208,
-0.1675596684217453,
-0.12804758548736572,
0.0020943284034729004,
0.3573179543018341,
-0.025900525972247124,
-0.29754993319511414,
0.15886540710926056,
0.11506294459104538,
0.0991566851735115,
-0.3214535713195801,
0.3626996874809265,
-0.19846373796463013,
-0.02036242187023163,
0.0691281408071518,
-0.15047122538089752,
0.37920957803726196,
-0.22043859958648682,
-0.03304758667945862,
-0.08182770013809204,
0.12814156711101532,
-0.16707712411880493,
-0.22100013494491577,
0.3402222692966461,
0.38842451572418213,
-0.10763649642467499,
0.10821394622325897,
-0.25519275665283203,
-0.08646275848150253,
0.040304481983184814,
-0.36969074606895447,
-0.3087161183357239,
-0.0074881562031805515,
-0.0002531483769416809,
0.008524507284164429,
0.10309776663780212,
0.24583062529563904,
0.10533731430768967,
-0.027840254828333855,
-0.22922900319099426,
-0.1855800449848175,
0.20947544276714325,
-0.2946496903896332,
-0.31304094195365906,
-0.03537982702255249,
0.05562475696206093,
-0.16362905502319336,
0.2511020004749298,
-0.46240702271461487,
0.14574888348579407,
0.22974419593811035,
-0.025514401495456696,
-0.4540731608867645,
0.2232973277568817,
0.2540613114833832,
0.016472186893224716,
-0.20769661664962769,
0.05345691740512848,
0.1526237428188324,
-0.1369924396276474,
-0.20163996517658234,
-0.1757192611694336
] |
https://github.com/huggingface/datasets/issues/630 | Text dataset not working with large files | Basically ~600MB txt files(UTF-8) * 59.
contents like ```안녕하세요, 이것은 예제로 한번 말해보는 텍스트입니다. 그냥 이렇다고요.<|endoftext|>\n```
Also, it gets stuck for a loooong time at ```Testing the mapped function outputs```, for more than 12 hours(currently ongoing) | ```
Traceback (most recent call last):
File "examples/language-modeling/run_language_modeling.py", line 333, in <module>
main()
File "examples/language-modeling/run_language_modeling.py", line 262, in main
get_dataset(data_args, tokenizer=tokenizer, cache_dir=model_args.cache_dir) if training_args.do_train else None
File "examples/language-modeling/run_language_modeling.py", line 144, in get_dataset
dataset = load_dataset("text", data_files=file_path, split='train+test')
File "/home/ksjae/.local/lib/python3.7/site-packages/datasets/load.py", line 611, in load_dataset
ignore_verifications=ignore_verifications,
File "/home/ksjae/.local/lib/python3.7/site-packages/datasets/builder.py", line 469, in download_and_prepare
dl_manager=dl_manager, verify_infos=verify_infos, **download_and_prepare_kwargs
File "/home/ksjae/.local/lib/python3.7/site-packages/datasets/builder.py", line 546, in _download_and_prepare
self._prepare_split(split_generator, **prepare_split_kwargs)
File "/home/ksjae/.local/lib/python3.7/site-packages/datasets/builder.py", line 888, in _prepare_split
for key, table in utils.tqdm(generator, unit=" tables", leave=False, disable=not_verbose):
File "/home/ksjae/.local/lib/python3.7/site-packages/tqdm/std.py", line 1129, in __iter__
for obj in iterable:
File "/home/ksjae/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py", line 104, in _generate_tables
convert_options=self.config.convert_options,
File "pyarrow/_csv.pyx", line 714, in pyarrow._csv.read_csv
File "pyarrow/error.pxi", line 122, in pyarrow.lib.pyarrow_internal_check_status
File "pyarrow/error.pxi", line 84, in pyarrow.lib.check_status
```
**pyarrow.lib.ArrowInvalid: straddling object straddles two block boundaries (try to increase block size?)**
It gives the same message for both 200MB, 10GB .tx files but not for 700MB file.
Can't upload due to size & copyright problem. sorry. | 36 | Text dataset not working with large files
```
Traceback (most recent call last):
File "examples/language-modeling/run_language_modeling.py", line 333, in <module>
main()
File "examples/language-modeling/run_language_modeling.py", line 262, in main
get_dataset(data_args, tokenizer=tokenizer, cache_dir=model_args.cache_dir) if training_args.do_train else None
File "examples/language-modeling/run_language_modeling.py", line 144, in get_dataset
dataset = load_dataset("text", data_files=file_path, split='train+test')
File "/home/ksjae/.local/lib/python3.7/site-packages/datasets/load.py", line 611, in load_dataset
ignore_verifications=ignore_verifications,
File "/home/ksjae/.local/lib/python3.7/site-packages/datasets/builder.py", line 469, in download_and_prepare
dl_manager=dl_manager, verify_infos=verify_infos, **download_and_prepare_kwargs
File "/home/ksjae/.local/lib/python3.7/site-packages/datasets/builder.py", line 546, in _download_and_prepare
self._prepare_split(split_generator, **prepare_split_kwargs)
File "/home/ksjae/.local/lib/python3.7/site-packages/datasets/builder.py", line 888, in _prepare_split
for key, table in utils.tqdm(generator, unit=" tables", leave=False, disable=not_verbose):
File "/home/ksjae/.local/lib/python3.7/site-packages/tqdm/std.py", line 1129, in __iter__
for obj in iterable:
File "/home/ksjae/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py", line 104, in _generate_tables
convert_options=self.config.convert_options,
File "pyarrow/_csv.pyx", line 714, in pyarrow._csv.read_csv
File "pyarrow/error.pxi", line 122, in pyarrow.lib.pyarrow_internal_check_status
File "pyarrow/error.pxi", line 84, in pyarrow.lib.check_status
```
**pyarrow.lib.ArrowInvalid: straddling object straddles two block boundaries (try to increase block size?)**
It gives the same message for both 200MB, 10GB .tx files but not for 700MB file.
Can't upload due to size & copyright problem. sorry.
Basically ~600MB txt files(UTF-8) * 59.
contents like ```안녕하세요, 이것은 예제로 한번 말해보는 텍스트입니다. 그냥 이렇다고요.<|endoftext|>\n```
Also, it gets stuck for a loooong time at ```Testing the mapped function outputs```, for more than 12 hours(currently ongoing) | [
-0.4925670027732849,
-0.23102402687072754,
-0.11986441910266876,
0.28360170125961304,
0.46635645627975464,
-0.0735015794634819,
0.305368036031723,
0.5961019992828369,
-0.11382582783699036,
0.04616520553827286,
-0.06241992115974426,
-0.030405322089791298,
-0.10334224998950958,
0.31017932295799255,
-0.1062139943242073,
-0.038950130343437195,
-0.22788456082344055,
0.11306402087211609,
-0.09469194710254669,
0.049916721880435944,
-0.11255110055208206,
0.11109991371631622,
-0.1209786981344223,
-0.09560258686542511,
-0.4804548919200897,
-0.08299517631530762,
0.11853118240833282,
0.2535656690597534,
-0.29201096296310425,
-0.30531421303749084,
-0.16570709645748138,
0.09658567607402802,
0.11220498383045197,
0.6015899777412415,
-0.00010376208228990436,
0.1294623464345932,
0.2131115049123764,
-0.1573348045349121,
-0.22658251225948334,
-0.0314558744430542,
0.15594887733459473,
-0.4493688642978668,
-0.18238908052444458,
-0.2179643213748932,
0.02615135908126831,
-0.06274445354938507,
-0.10828742384910583,
-0.11755962669849396,
0.26533523201942444,
0.5598003268241882,
0.34120333194732666,
0.17075856029987335,
0.13216975331306458,
-0.11296090483665466,
0.250753790140152,
-0.08724960684776306,
-0.08874448388814926,
0.08485007286071777,
0.31081804633140564,
0.026577329263091087,
-0.2564011812210083,
0.3199438154697418,
0.010172003880143166,
0.03770069405436516,
0.00031413882970809937,
-0.02406269684433937,
-0.08279385417699814,
-0.29400500655174255,
0.37119466066360474,
0.23214656114578247,
0.5224136710166931,
-0.31693607568740845,
-0.16412782669067383,
-0.32884305715560913,
-0.18244099617004395,
-0.35125598311424255,
0.22663253545761108,
0.18455395102500916,
-0.11133106052875519,
0.11612716317176819,
-0.14361807703971863,
-0.10148565471172333,
-0.20639726519584656,
-0.0293157696723938,
-0.2615340054035187,
0.10227341949939728,
-0.21058689057826996,
-0.10046204179525375,
0.25758007168769836,
-0.27024781703948975,
0.010829675942659378,
-0.10562211275100708,
-0.13078303635120392,
-0.006805417127907276,
-0.2472129911184311,
-0.08402222394943237,
0.24685075879096985,
-0.19907799363136292,
0.28894200921058655,
-0.04899824410676956,
-0.05042092502117157,
0.22476103901863098,
-0.07966753095388412,
-0.030213192105293274,
0.005493609234690666,
0.3368757665157318,
0.004112988710403442,
0.06385742127895355,
0.4085860252380371,
0.23562848567962646,
-0.3793579936027527,
-0.2320612072944641,
-0.14962677657604218,
-0.5145173668861389,
-0.029356157407164574,
-0.11771722882986069,
0.01687188819050789,
-0.045236922800540924,
-0.12102539837360382,
0.1521078199148178,
0.1642943024635315,
0.15479476749897003,
0.10596621781587601,
0.4816173017024994,
0.10491445660591125,
0.2937651574611664,
-0.164946049451828,
0.17703935503959656,
-0.1443265825510025,
-0.172270730137825,
-0.2492274045944214,
-0.04561186954379082,
-0.057916440069675446,
-0.09268886595964432,
0.2676639258861542,
0.13385112583637238,
0.2967093586921692,
-0.13958050310611725,
0.19085338711738586,
-0.10901589691638947,
0.11681430041790009,
-0.5029687881469727,
0.14769625663757324,
0.1410786211490631,
-0.0354771725833416,
0.16869360208511353,
0.22878293693065643,
-0.17886953055858612,
-0.10239109396934509,
0.050235599279403687,
-0.10356039553880692,
-0.29712870717048645,
0.1772405207157135,
0.3213210701942444,
0.13477429747581482,
-0.003003045916557312,
-0.018904902040958405,
0.2770770192146301,
0.3757719397544861,
-0.21763959527015686,
0.028100714087486267,
-0.177321657538414,
-0.2569279670715332,
-0.1258028894662857,
0.2650003433227539,
0.43938207626342773,
-0.42506060004234314,
0.20901402831077576,
0.06901604682207108,
0.1223086565732956,
0.08902444690465927,
0.3739468455314636,
-0.06507308781147003,
0.31435954570770264,
-0.11457157880067825,
0.2009439319372177,
0.3094799518585205,
-0.2855849862098694,
-0.5090751051902771,
0.5406067967414856,
-0.18592986464500427,
-0.11818693578243256,
0.09925701469182968,
-0.044451307505369186,
0.10349185764789581,
0.13587255775928497,
0.30473989248275757,
0.27934038639068604,
0.011319583281874657,
0.26673009991645813,
-0.26045045256614685,
-0.08325029164552689,
-0.050114214420318604,
0.15593983232975006,
0.3121376931667328,
-0.20806992053985596,
0.1951688975095749,
-0.017231537029147148,
0.1943761706352234,
-0.044446270912885666,
0.21288302540779114,
0.5059319138526917,
0.12715761363506317,
-0.007840372622013092,
-0.01236867904663086,
-0.2239851951599121,
0.0316573791205883,
0.1751382052898407,
0.12100903689861298,
0.08430736511945724,
-0.2666850686073303,
-0.08223278820514679,
-0.30924513936042786,
-0.134145587682724,
-0.2703465223312378,
-0.1933860182762146,
0.28360530734062195,
0.08132393658161163,
-0.011476056650280952,
0.25513970851898193,
-0.016701530665159225,
0.025312982499599457,
-0.1602134257555008,
-0.0655839741230011,
-0.012096773833036423,
-0.0018736571073532104,
-0.09108380228281021,
-0.2782086431980133,
0.12294897437095642,
0.11027294397354126,
-0.041142746806144714,
-0.061668265610933304,
-0.1109171137213707,
0.3928831219673157,
-0.0020209033973515034,
-0.08106143772602081,
-0.036070093512535095,
-0.03006117045879364,
0.1020016148686409,
-0.0952065959572792,
0.07194626331329346,
0.0007551498711109161,
0.13880528509616852,
-0.10531303286552429,
-0.18016177415847778,
0.3006141483783722,
-0.13981524109840393,
0.20316290855407715,
0.3438575267791748,
-0.20907394587993622,
0.2556621730327606,
-0.06635111570358276,
0.22766588628292084,
-0.1381169557571411,
0.2406681329011917,
0.0831318348646164,
0.13632160425186157,
-0.0013490226119756699,
-0.2719841003417969,
-0.012743011116981506,
0.689583957195282,
0.17106518149375916,
0.09289268404245377,
0.1747955083847046,
-0.24533984065055847,
-0.017957307398319244,
-0.2034236490726471,
0.1299688071012497,
0.3976373076438904,
0.2744441032409668,
0.2679811418056488,
0.03577557951211929,
0.18700522184371948,
-0.37400296330451965,
0.13971075415611267,
0.00324847549200058,
0.011184905655682087,
0.5398926734924316,
0.2758920192718506,
-0.12958043813705444,
-0.4534207582473755,
-0.15636895596981049,
0.10577581822872162,
0.3134024739265442,
-0.08958758413791656,
0.019882122054696083,
-0.21556280553340912,
-0.2920286953449249,
-0.2959759533405304,
0.21032747626304626,
-0.2627323269844055,
-0.22531758248806,
0.0694885328412056,
0.001854587346315384,
-0.00965346023440361,
0.09686631709337234,
0.059420328587293625,
0.14542452991008759,
0.3997488021850586,
-0.19882483780384064,
-0.06151032820343971,
-0.2715905010700226,
-0.1730494201183319,
0.1567440927028656,
0.24218787252902985,
-0.01231520064175129,
0.10664252936840057,
-0.1534675806760788,
-0.10159619897603989,
0.003862651064991951,
-0.28537610173225403,
0.0006909370422363281,
-0.029189959168434143,
0.1006607785820961,
-0.05716460943222046,
0.2626273036003113,
0.1662752330303192,
0.07698307931423187,
0.3128008246421814,
-0.12974913418293,
-0.0807747021317482,
0.22336417436599731,
0.09067574143409729,
-0.06526526808738708,
-0.17057353258132935,
-0.4048938751220703,
-0.15303708612918854,
-0.6100062131881714,
0.3575114607810974,
0.09556648135185242,
0.038003552705049515,
0.40225842595100403,
0.3181685507297516,
0.2154986411333084,
-0.02120117098093033,
0.21249309182167053,
0.10026468336582184,
-0.19501852989196777,
0.2925727367401123,
-0.2248302549123764,
-0.3832399547100067,
-0.0998249500989914,
0.16060329973697662,
0.16261537373065948,
0.0072623370215296745,
-0.523443341255188,
0.030241087079048157,
-0.43688228726387024,
0.16236768662929535,
-0.06379617750644684,
0.1686919629573822,
0.08140815794467926,
-0.068488709628582,
-0.2522607743740082,
-0.08427543938159943,
0.08302126824855804,
0.04674498364329338,
-0.0724341943860054,
0.0489533469080925,
-0.1854184865951538,
0.41218438744544983,
0.24029558897018433,
0.4626798629760742,
0.16378207504749298,
0.08145051449537277,
0.3938988149166107,
-0.12170656770467758,
0.42712289094924927,
-0.353285551071167,
-0.3265115022659302,
0.1239759549498558,
-0.09124578535556793,
-0.03290253505110741,
0.2716790437698364,
0.08628013730049133,
0.26993563771247864,
-0.08009670674800873,
-0.21920713782310486,
0.08489612489938736,
-0.27935341000556946,
0.2020106166601181,
-0.1586160659790039,
0.158182293176651,
-0.13573935627937317,
-0.024103175848722458,
-0.07673823833465576,
-0.13111597299575806,
-0.03386951982975006,
0.18008708953857422,
-0.24061143398284912,
-0.025057753548026085,
-0.34338465332984924,
0.06488210707902908,
-0.4402943253517151,
0.11626070737838745,
-0.0008667679503560066,
0.33177903294563293,
-0.16607806086540222,
-0.15486931800842285,
-0.10844495892524719,
-0.15747174620628357,
0.558742344379425,
-0.07002851366996765,
0.050007011741399765,
0.06284362077713013,
-0.09194844961166382,
-0.3191089332103729,
0.16093701124191284,
-0.27350154519081116,
0.15883025527000427,
0.3647179901599884,
0.5645073652267456,
-0.3012341260910034,
-0.05097787827253342,
-0.03999730199575424,
0.3442743122577667,
0.016783621162176132,
-0.03344845771789551,
-0.2761994004249573,
-0.17115014791488647,
-0.479754775762558,
0.13883376121520996,
0.2979472875595093,
0.28462928533554077,
-0.2693779766559601,
0.07181067764759064,
0.006769764237105846,
-0.24167132377624512,
0.21428701281547546,
0.004094982519745827,
0.1445523202419281,
-0.0965576246380806,
0.22559228539466858,
-0.11081492900848389,
0.1980491578578949,
0.1853601634502411,
0.5712106227874756,
-0.03319813683629036,
-0.18376705050468445,
-0.10033683478832245,
-0.19775772094726562,
0.35022130608558655,
0.32108274102211,
-0.12260875850915909,
0.2475552260875702,
-0.04689199477434158,
0.20478081703186035,
0.016252687200903893,
0.37144094705581665,
0.2987755239009857,
-0.0353546105325222,
-0.2595382034778595,
-0.2792068123817444,
0.11155571788549423,
-0.08455014228820801,
0.18670086562633514,
0.14084039628505707,
-0.3193206787109375,
-0.25578510761260986,
0.08038311451673508,
-0.31555503606796265,
0.581957995891571,
0.09366241097450256,
0.3404352366924286,
-0.05666738748550415,
0.1961900144815445,
0.06290748715400696,
-0.5295384526252747,
0.2434755116701126,
-0.33936843276023865,
-0.2687772810459137,
0.08404745161533356,
-0.001982681453227997,
0.08260998129844666,
0.1538456678390503,
-0.270569771528244,
0.09973536431789398,
0.11994169652462006,
0.10925504565238953,
-0.2874218225479126,
0.3836098313331604,
-0.40400704741477966,
-0.120232954621315,
-0.31708869338035583,
0.18089659512043,
0.03846214711666107,
-0.15849192440509796,
-0.012326336465775967,
-0.11951793730258942,
0.020361650735139847,
-0.2523367404937744,
-0.14524796605110168,
-0.04931566119194031,
-0.41980400681495667,
0.18225449323654175,
0.039506085216999054,
-0.33519911766052246,
0.24350827932357788,
0.17777115106582642,
0.07175565510988235,
0.45078524947166443,
-0.23751425743103027,
0.17865891754627228,
0.011979680508375168,
-0.027082400396466255,
0.15663877129554749,
-0.002052192110568285,
0.3159703314304352,
-0.012490535154938698,
-0.22674140334129333,
0.09105018526315689,
-0.02672802284359932,
0.10022516548633575,
-0.02117358148097992,
0.005435124039649963,
-0.04170331358909607,
-0.3602181375026703,
-0.24734868109226227,
-0.12215757369995117,
-0.24486114084720612,
-0.30070412158966064,
0.22550034523010254,
-0.05333781987428665,
-0.05440139025449753,
0.16801418364048004,
0.07098978757858276,
-0.3310469686985016,
-0.16335467994213104,
0.32585275173187256,
-0.19543474912643433,
0.17897029221057892,
0.5283613801002502,
0.3944675922393799,
-0.2252093255519867,
-0.32895269989967346,
0.3111717402935028,
-0.02889079600572586,
-0.3540939688682556,
0.27591240406036377,
0.027021314948797226,
-0.06967999786138535,
0.12655551731586456,
0.2427477389574051,
-0.14057697355747223,
-0.3056276738643646,
-0.12778893113136292,
-0.23810873925685883,
-0.43041083216667175,
0.07364131510257721,
-0.014685843139886856,
0.14289841055870056,
-0.012018360197544098,
0.21348373591899872,
0.11327877640724182,
0.21397390961647034,
-0.4020756185054779,
0.14234788715839386,
-0.17718617618083954,
0.09960086643695831,
0.09315408766269684,
-0.13554859161376953,
0.1392204463481903,
0.051814910024404526,
0.11126954853534698,
0.2546558380126953,
-0.07314927130937576,
-0.3498375415802002,
-0.11043192446231842,
0.08029373735189438,
0.04296475276350975,
-0.12139826267957687,
-0.018652942031621933,
-0.3757631778717041,
-0.25712159276008606,
-0.2619505524635315,
0.20553825795650482,
-0.05955670028924942,
-0.10602714121341705,
0.17889057099819183,
-0.14844489097595215,
-0.05947142094373703,
0.11627981066703796,
-0.030737467110157013,
-0.2113562822341919,
0.11350301653146744,
0.17233796417713165,
0.03541186824440956,
0.007398670539259911,
0.0013167411088943481,
-0.31594744324684143,
0.0826844722032547,
0.1583465337753296,
-0.07415562123060226,
0.3244626820087433,
-0.37572717666625977,
-0.05665460228919983,
0.17693735659122467,
0.3609246015548706,
0.41158416867256165,
-0.2069200575351715,
-0.02834312990307808,
0.24290448427200317,
0.29815369844436646,
-0.25329941511154175,
-0.10016856342554092,
0.09493423998355865,
-0.27480506896972656,
0.30034834146499634,
0.12265083938837051,
0.10554638504981995,
-0.08647502958774567,
-0.10739181935787201,
0.22338134050369263,
0.1748349517583847,
-0.0378282368183136,
-0.14958788454532623,
0.34078478813171387,
0.11782075464725494,
-0.04993074759840965,
0.3016178011894226,
0.18213890492916107,
0.301396906375885,
0.7971210479736328,
0.07851167023181915,
0.25384676456451416,
-0.21107330918312073,
-0.09380136430263519,
-0.13657546043395996,
-0.4474603831768036,
0.022837109863758087,
-0.08015626668930054,
-0.03529869019985199,
-0.12467657774686813,
-0.20569443702697754,
0.20495110750198364,
-0.015431790612637997,
0.22015485167503357,
-0.14909659326076508,
0.043684691190719604,
-0.24865233898162842,
-0.1612086296081543,
0.04362469166517258,
-0.3107735514640808,
-0.0689435601234436,
0.10619263350963593,
-0.10688285529613495,
0.3263958692550659,
0.12429416179656982,
0.06238064542412758,
0.10222384333610535,
-0.4294131398200989,
0.20355626940727234,
-0.06269001960754395,
0.08767058700323105,
-0.362539142370224,
0.28398585319519043,
0.26131293177604675,
0.18963372707366943,
0.15717817842960358,
0.19094763696193695,
0.5729643702507019,
0.39447149634361267,
-0.13633108139038086,
-0.08099353313446045,
-0.27559906244277954,
-0.1103980764746666,
-0.4154096245765686,
0.28591975569725037,
0.19795739650726318,
0.3553822636604309,
0.46433591842651367,
0.20754824578762054,
-0.26809021830558777,
-0.06607875227928162,
0.1920684427022934,
-0.2637651860713959,
-0.2234545648097992,
0.10479047149419785,
0.06799925118684769,
-0.28635135293006897,
-0.3225554823875427,
-0.018377088010311127,
-0.43382272124290466,
-0.004564874805510044,
0.5934925079345703,
-0.11358815431594849,
0.309125691652298,
-0.3395165205001831,
0.14480556547641754,
0.0051999278366565704,
0.60579913854599,
0.295389324426651,
-0.017811313271522522,
-0.2954344153404236,
-0.019515685737133026,
-0.6181399822235107,
0.1262810379266739,
-0.1511761099100113,
0.012333894148468971,
-0.011653732508420944,
0.14253626763820648,
0.17389264702796936,
-0.03305090218782425,
-0.0051005929708480835,
0.03629682958126068,
-0.1498091071844101,
-0.10970120131969452,
-0.3313083350658417,
-0.2676610052585602,
-0.2250266820192337,
0.1569494754076004,
-0.0014629364013671875,
-0.3760659694671631,
0.15508276224136353,
-0.0955091044306755,
0.23003354668617249,
-0.17938651144504547,
0.0802161693572998,
-0.020627746358513832,
-0.035598188638687134,
0.15784423053264618,
0.03406703844666481,
0.3657599985599518,
-0.2838608920574188,
0.03404554724693298,
-0.13461974263191223,
-0.06317558884620667,
-0.17006678879261017,
0.1941983699798584,
0.2527383267879486,
0.26540833711624146,
-0.09622174501419067,
-0.17070834338665009,
-0.13808800280094147,
0.15670296549797058,
0.05871815234422684,
0.03713503107428551,
0.14296384155750275,
-0.05074285715818405,
0.1262890100479126,
0.05871701240539551,
0.18636725842952728,
0.4029746949672699,
-0.11137630045413971,
-0.034302711486816406,
-0.3506343960762024,
-0.5414938926696777,
0.2185375988483429,
-0.11808157712221146,
-0.5158481001853943,
0.010307740420103073,
0.13004052639007568,
0.18110820651054382,
0.0267860759049654,
-0.5836288928985596,
0.30677682161331177,
0.30969324707984924,
0.133999302983284,
-0.35290077328681946,
0.2580335736274719,
-0.05051710084080696,
0.05834290757775307,
0.011916577816009521,
0.12013280391693115,
0.024264071136713028,
-0.27022451162338257,
-0.2056572139263153,
-0.03220142796635628
] |
https://github.com/huggingface/datasets/issues/630 | Text dataset not working with large files | It gets stuck while doing `.map()` ? Are you using multiprocessing ?
If you could provide a code snippet it could be very useful | ```
Traceback (most recent call last):
File "examples/language-modeling/run_language_modeling.py", line 333, in <module>
main()
File "examples/language-modeling/run_language_modeling.py", line 262, in main
get_dataset(data_args, tokenizer=tokenizer, cache_dir=model_args.cache_dir) if training_args.do_train else None
File "examples/language-modeling/run_language_modeling.py", line 144, in get_dataset
dataset = load_dataset("text", data_files=file_path, split='train+test')
File "/home/ksjae/.local/lib/python3.7/site-packages/datasets/load.py", line 611, in load_dataset
ignore_verifications=ignore_verifications,
File "/home/ksjae/.local/lib/python3.7/site-packages/datasets/builder.py", line 469, in download_and_prepare
dl_manager=dl_manager, verify_infos=verify_infos, **download_and_prepare_kwargs
File "/home/ksjae/.local/lib/python3.7/site-packages/datasets/builder.py", line 546, in _download_and_prepare
self._prepare_split(split_generator, **prepare_split_kwargs)
File "/home/ksjae/.local/lib/python3.7/site-packages/datasets/builder.py", line 888, in _prepare_split
for key, table in utils.tqdm(generator, unit=" tables", leave=False, disable=not_verbose):
File "/home/ksjae/.local/lib/python3.7/site-packages/tqdm/std.py", line 1129, in __iter__
for obj in iterable:
File "/home/ksjae/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py", line 104, in _generate_tables
convert_options=self.config.convert_options,
File "pyarrow/_csv.pyx", line 714, in pyarrow._csv.read_csv
File "pyarrow/error.pxi", line 122, in pyarrow.lib.pyarrow_internal_check_status
File "pyarrow/error.pxi", line 84, in pyarrow.lib.check_status
```
**pyarrow.lib.ArrowInvalid: straddling object straddles two block boundaries (try to increase block size?)**
It gives the same message for both 200MB, 10GB .tx files but not for 700MB file.
Can't upload due to size & copyright problem. sorry. | 24 | Text dataset not working with large files
```
Traceback (most recent call last):
File "examples/language-modeling/run_language_modeling.py", line 333, in <module>
main()
File "examples/language-modeling/run_language_modeling.py", line 262, in main
get_dataset(data_args, tokenizer=tokenizer, cache_dir=model_args.cache_dir) if training_args.do_train else None
File "examples/language-modeling/run_language_modeling.py", line 144, in get_dataset
dataset = load_dataset("text", data_files=file_path, split='train+test')
File "/home/ksjae/.local/lib/python3.7/site-packages/datasets/load.py", line 611, in load_dataset
ignore_verifications=ignore_verifications,
File "/home/ksjae/.local/lib/python3.7/site-packages/datasets/builder.py", line 469, in download_and_prepare
dl_manager=dl_manager, verify_infos=verify_infos, **download_and_prepare_kwargs
File "/home/ksjae/.local/lib/python3.7/site-packages/datasets/builder.py", line 546, in _download_and_prepare
self._prepare_split(split_generator, **prepare_split_kwargs)
File "/home/ksjae/.local/lib/python3.7/site-packages/datasets/builder.py", line 888, in _prepare_split
for key, table in utils.tqdm(generator, unit=" tables", leave=False, disable=not_verbose):
File "/home/ksjae/.local/lib/python3.7/site-packages/tqdm/std.py", line 1129, in __iter__
for obj in iterable:
File "/home/ksjae/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py", line 104, in _generate_tables
convert_options=self.config.convert_options,
File "pyarrow/_csv.pyx", line 714, in pyarrow._csv.read_csv
File "pyarrow/error.pxi", line 122, in pyarrow.lib.pyarrow_internal_check_status
File "pyarrow/error.pxi", line 84, in pyarrow.lib.check_status
```
**pyarrow.lib.ArrowInvalid: straddling object straddles two block boundaries (try to increase block size?)**
It gives the same message for both 200MB, 10GB .tx files but not for 700MB file.
Can't upload due to size & copyright problem. sorry.
It gets stuck while doing `.map()` ? Are you using multiprocessing ?
If you could provide a code snippet it could be very useful | [
-0.4925670027732849,
-0.23102402687072754,
-0.11986441910266876,
0.28360170125961304,
0.46635645627975464,
-0.0735015794634819,
0.305368036031723,
0.5961019992828369,
-0.11382582783699036,
0.04616520553827286,
-0.06241992115974426,
-0.030405322089791298,
-0.10334224998950958,
0.31017932295799255,
-0.1062139943242073,
-0.038950130343437195,
-0.22788456082344055,
0.11306402087211609,
-0.09469194710254669,
0.049916721880435944,
-0.11255110055208206,
0.11109991371631622,
-0.1209786981344223,
-0.09560258686542511,
-0.4804548919200897,
-0.08299517631530762,
0.11853118240833282,
0.2535656690597534,
-0.29201096296310425,
-0.30531421303749084,
-0.16570709645748138,
0.09658567607402802,
0.11220498383045197,
0.6015899777412415,
-0.00010376208228990436,
0.1294623464345932,
0.2131115049123764,
-0.1573348045349121,
-0.22658251225948334,
-0.0314558744430542,
0.15594887733459473,
-0.4493688642978668,
-0.18238908052444458,
-0.2179643213748932,
0.02615135908126831,
-0.06274445354938507,
-0.10828742384910583,
-0.11755962669849396,
0.26533523201942444,
0.5598003268241882,
0.34120333194732666,
0.17075856029987335,
0.13216975331306458,
-0.11296090483665466,
0.250753790140152,
-0.08724960684776306,
-0.08874448388814926,
0.08485007286071777,
0.31081804633140564,
0.026577329263091087,
-0.2564011812210083,
0.3199438154697418,
0.010172003880143166,
0.03770069405436516,
0.00031413882970809937,
-0.02406269684433937,
-0.08279385417699814,
-0.29400500655174255,
0.37119466066360474,
0.23214656114578247,
0.5224136710166931,
-0.31693607568740845,
-0.16412782669067383,
-0.32884305715560913,
-0.18244099617004395,
-0.35125598311424255,
0.22663253545761108,
0.18455395102500916,
-0.11133106052875519,
0.11612716317176819,
-0.14361807703971863,
-0.10148565471172333,
-0.20639726519584656,
-0.0293157696723938,
-0.2615340054035187,
0.10227341949939728,
-0.21058689057826996,
-0.10046204179525375,
0.25758007168769836,
-0.27024781703948975,
0.010829675942659378,
-0.10562211275100708,
-0.13078303635120392,
-0.006805417127907276,
-0.2472129911184311,
-0.08402222394943237,
0.24685075879096985,
-0.19907799363136292,
0.28894200921058655,
-0.04899824410676956,
-0.05042092502117157,
0.22476103901863098,
-0.07966753095388412,
-0.030213192105293274,
0.005493609234690666,
0.3368757665157318,
0.004112988710403442,
0.06385742127895355,
0.4085860252380371,
0.23562848567962646,
-0.3793579936027527,
-0.2320612072944641,
-0.14962677657604218,
-0.5145173668861389,
-0.029356157407164574,
-0.11771722882986069,
0.01687188819050789,
-0.045236922800540924,
-0.12102539837360382,
0.1521078199148178,
0.1642943024635315,
0.15479476749897003,
0.10596621781587601,
0.4816173017024994,
0.10491445660591125,
0.2937651574611664,
-0.164946049451828,
0.17703935503959656,
-0.1443265825510025,
-0.172270730137825,
-0.2492274045944214,
-0.04561186954379082,
-0.057916440069675446,
-0.09268886595964432,
0.2676639258861542,
0.13385112583637238,
0.2967093586921692,
-0.13958050310611725,
0.19085338711738586,
-0.10901589691638947,
0.11681430041790009,
-0.5029687881469727,
0.14769625663757324,
0.1410786211490631,
-0.0354771725833416,
0.16869360208511353,
0.22878293693065643,
-0.17886953055858612,
-0.10239109396934509,
0.050235599279403687,
-0.10356039553880692,
-0.29712870717048645,
0.1772405207157135,
0.3213210701942444,
0.13477429747581482,
-0.003003045916557312,
-0.018904902040958405,
0.2770770192146301,
0.3757719397544861,
-0.21763959527015686,
0.028100714087486267,
-0.177321657538414,
-0.2569279670715332,
-0.1258028894662857,
0.2650003433227539,
0.43938207626342773,
-0.42506060004234314,
0.20901402831077576,
0.06901604682207108,
0.1223086565732956,
0.08902444690465927,
0.3739468455314636,
-0.06507308781147003,
0.31435954570770264,
-0.11457157880067825,
0.2009439319372177,
0.3094799518585205,
-0.2855849862098694,
-0.5090751051902771,
0.5406067967414856,
-0.18592986464500427,
-0.11818693578243256,
0.09925701469182968,
-0.044451307505369186,
0.10349185764789581,
0.13587255775928497,
0.30473989248275757,
0.27934038639068604,
0.011319583281874657,
0.26673009991645813,
-0.26045045256614685,
-0.08325029164552689,
-0.050114214420318604,
0.15593983232975006,
0.3121376931667328,
-0.20806992053985596,
0.1951688975095749,
-0.017231537029147148,
0.1943761706352234,
-0.044446270912885666,
0.21288302540779114,
0.5059319138526917,
0.12715761363506317,
-0.007840372622013092,
-0.01236867904663086,
-0.2239851951599121,
0.0316573791205883,
0.1751382052898407,
0.12100903689861298,
0.08430736511945724,
-0.2666850686073303,
-0.08223278820514679,
-0.30924513936042786,
-0.134145587682724,
-0.2703465223312378,
-0.1933860182762146,
0.28360530734062195,
0.08132393658161163,
-0.011476056650280952,
0.25513970851898193,
-0.016701530665159225,
0.025312982499599457,
-0.1602134257555008,
-0.0655839741230011,
-0.012096773833036423,
-0.0018736571073532104,
-0.09108380228281021,
-0.2782086431980133,
0.12294897437095642,
0.11027294397354126,
-0.041142746806144714,
-0.061668265610933304,
-0.1109171137213707,
0.3928831219673157,
-0.0020209033973515034,
-0.08106143772602081,
-0.036070093512535095,
-0.03006117045879364,
0.1020016148686409,
-0.0952065959572792,
0.07194626331329346,
0.0007551498711109161,
0.13880528509616852,
-0.10531303286552429,
-0.18016177415847778,
0.3006141483783722,
-0.13981524109840393,
0.20316290855407715,
0.3438575267791748,
-0.20907394587993622,
0.2556621730327606,
-0.06635111570358276,
0.22766588628292084,
-0.1381169557571411,
0.2406681329011917,
0.0831318348646164,
0.13632160425186157,
-0.0013490226119756699,
-0.2719841003417969,
-0.012743011116981506,
0.689583957195282,
0.17106518149375916,
0.09289268404245377,
0.1747955083847046,
-0.24533984065055847,
-0.017957307398319244,
-0.2034236490726471,
0.1299688071012497,
0.3976373076438904,
0.2744441032409668,
0.2679811418056488,
0.03577557951211929,
0.18700522184371948,
-0.37400296330451965,
0.13971075415611267,
0.00324847549200058,
0.011184905655682087,
0.5398926734924316,
0.2758920192718506,
-0.12958043813705444,
-0.4534207582473755,
-0.15636895596981049,
0.10577581822872162,
0.3134024739265442,
-0.08958758413791656,
0.019882122054696083,
-0.21556280553340912,
-0.2920286953449249,
-0.2959759533405304,
0.21032747626304626,
-0.2627323269844055,
-0.22531758248806,
0.0694885328412056,
0.001854587346315384,
-0.00965346023440361,
0.09686631709337234,
0.059420328587293625,
0.14542452991008759,
0.3997488021850586,
-0.19882483780384064,
-0.06151032820343971,
-0.2715905010700226,
-0.1730494201183319,
0.1567440927028656,
0.24218787252902985,
-0.01231520064175129,
0.10664252936840057,
-0.1534675806760788,
-0.10159619897603989,
0.003862651064991951,
-0.28537610173225403,
0.0006909370422363281,
-0.029189959168434143,
0.1006607785820961,
-0.05716460943222046,
0.2626273036003113,
0.1662752330303192,
0.07698307931423187,
0.3128008246421814,
-0.12974913418293,
-0.0807747021317482,
0.22336417436599731,
0.09067574143409729,
-0.06526526808738708,
-0.17057353258132935,
-0.4048938751220703,
-0.15303708612918854,
-0.6100062131881714,
0.3575114607810974,
0.09556648135185242,
0.038003552705049515,
0.40225842595100403,
0.3181685507297516,
0.2154986411333084,
-0.02120117098093033,
0.21249309182167053,
0.10026468336582184,
-0.19501852989196777,
0.2925727367401123,
-0.2248302549123764,
-0.3832399547100067,
-0.0998249500989914,
0.16060329973697662,
0.16261537373065948,
0.0072623370215296745,
-0.523443341255188,
0.030241087079048157,
-0.43688228726387024,
0.16236768662929535,
-0.06379617750644684,
0.1686919629573822,
0.08140815794467926,
-0.068488709628582,
-0.2522607743740082,
-0.08427543938159943,
0.08302126824855804,
0.04674498364329338,
-0.0724341943860054,
0.0489533469080925,
-0.1854184865951538,
0.41218438744544983,
0.24029558897018433,
0.4626798629760742,
0.16378207504749298,
0.08145051449537277,
0.3938988149166107,
-0.12170656770467758,
0.42712289094924927,
-0.353285551071167,
-0.3265115022659302,
0.1239759549498558,
-0.09124578535556793,
-0.03290253505110741,
0.2716790437698364,
0.08628013730049133,
0.26993563771247864,
-0.08009670674800873,
-0.21920713782310486,
0.08489612489938736,
-0.27935341000556946,
0.2020106166601181,
-0.1586160659790039,
0.158182293176651,
-0.13573935627937317,
-0.024103175848722458,
-0.07673823833465576,
-0.13111597299575806,
-0.03386951982975006,
0.18008708953857422,
-0.24061143398284912,
-0.025057753548026085,
-0.34338465332984924,
0.06488210707902908,
-0.4402943253517151,
0.11626070737838745,
-0.0008667679503560066,
0.33177903294563293,
-0.16607806086540222,
-0.15486931800842285,
-0.10844495892524719,
-0.15747174620628357,
0.558742344379425,
-0.07002851366996765,
0.050007011741399765,
0.06284362077713013,
-0.09194844961166382,
-0.3191089332103729,
0.16093701124191284,
-0.27350154519081116,
0.15883025527000427,
0.3647179901599884,
0.5645073652267456,
-0.3012341260910034,
-0.05097787827253342,
-0.03999730199575424,
0.3442743122577667,
0.016783621162176132,
-0.03344845771789551,
-0.2761994004249573,
-0.17115014791488647,
-0.479754775762558,
0.13883376121520996,
0.2979472875595093,
0.28462928533554077,
-0.2693779766559601,
0.07181067764759064,
0.006769764237105846,
-0.24167132377624512,
0.21428701281547546,
0.004094982519745827,
0.1445523202419281,
-0.0965576246380806,
0.22559228539466858,
-0.11081492900848389,
0.1980491578578949,
0.1853601634502411,
0.5712106227874756,
-0.03319813683629036,
-0.18376705050468445,
-0.10033683478832245,
-0.19775772094726562,
0.35022130608558655,
0.32108274102211,
-0.12260875850915909,
0.2475552260875702,
-0.04689199477434158,
0.20478081703186035,
0.016252687200903893,
0.37144094705581665,
0.2987755239009857,
-0.0353546105325222,
-0.2595382034778595,
-0.2792068123817444,
0.11155571788549423,
-0.08455014228820801,
0.18670086562633514,
0.14084039628505707,
-0.3193206787109375,
-0.25578510761260986,
0.08038311451673508,
-0.31555503606796265,
0.581957995891571,
0.09366241097450256,
0.3404352366924286,
-0.05666738748550415,
0.1961900144815445,
0.06290748715400696,
-0.5295384526252747,
0.2434755116701126,
-0.33936843276023865,
-0.2687772810459137,
0.08404745161533356,
-0.001982681453227997,
0.08260998129844666,
0.1538456678390503,
-0.270569771528244,
0.09973536431789398,
0.11994169652462006,
0.10925504565238953,
-0.2874218225479126,
0.3836098313331604,
-0.40400704741477966,
-0.120232954621315,
-0.31708869338035583,
0.18089659512043,
0.03846214711666107,
-0.15849192440509796,
-0.012326336465775967,
-0.11951793730258942,
0.020361650735139847,
-0.2523367404937744,
-0.14524796605110168,
-0.04931566119194031,
-0.41980400681495667,
0.18225449323654175,
0.039506085216999054,
-0.33519911766052246,
0.24350827932357788,
0.17777115106582642,
0.07175565510988235,
0.45078524947166443,
-0.23751425743103027,
0.17865891754627228,
0.011979680508375168,
-0.027082400396466255,
0.15663877129554749,
-0.002052192110568285,
0.3159703314304352,
-0.012490535154938698,
-0.22674140334129333,
0.09105018526315689,
-0.02672802284359932,
0.10022516548633575,
-0.02117358148097992,
0.005435124039649963,
-0.04170331358909607,
-0.3602181375026703,
-0.24734868109226227,
-0.12215757369995117,
-0.24486114084720612,
-0.30070412158966064,
0.22550034523010254,
-0.05333781987428665,
-0.05440139025449753,
0.16801418364048004,
0.07098978757858276,
-0.3310469686985016,
-0.16335467994213104,
0.32585275173187256,
-0.19543474912643433,
0.17897029221057892,
0.5283613801002502,
0.3944675922393799,
-0.2252093255519867,
-0.32895269989967346,
0.3111717402935028,
-0.02889079600572586,
-0.3540939688682556,
0.27591240406036377,
0.027021314948797226,
-0.06967999786138535,
0.12655551731586456,
0.2427477389574051,
-0.14057697355747223,
-0.3056276738643646,
-0.12778893113136292,
-0.23810873925685883,
-0.43041083216667175,
0.07364131510257721,
-0.014685843139886856,
0.14289841055870056,
-0.012018360197544098,
0.21348373591899872,
0.11327877640724182,
0.21397390961647034,
-0.4020756185054779,
0.14234788715839386,
-0.17718617618083954,
0.09960086643695831,
0.09315408766269684,
-0.13554859161376953,
0.1392204463481903,
0.051814910024404526,
0.11126954853534698,
0.2546558380126953,
-0.07314927130937576,
-0.3498375415802002,
-0.11043192446231842,
0.08029373735189438,
0.04296475276350975,
-0.12139826267957687,
-0.018652942031621933,
-0.3757631778717041,
-0.25712159276008606,
-0.2619505524635315,
0.20553825795650482,
-0.05955670028924942,
-0.10602714121341705,
0.17889057099819183,
-0.14844489097595215,
-0.05947142094373703,
0.11627981066703796,
-0.030737467110157013,
-0.2113562822341919,
0.11350301653146744,
0.17233796417713165,
0.03541186824440956,
0.007398670539259911,
0.0013167411088943481,
-0.31594744324684143,
0.0826844722032547,
0.1583465337753296,
-0.07415562123060226,
0.3244626820087433,
-0.37572717666625977,
-0.05665460228919983,
0.17693735659122467,
0.3609246015548706,
0.41158416867256165,
-0.2069200575351715,
-0.02834312990307808,
0.24290448427200317,
0.29815369844436646,
-0.25329941511154175,
-0.10016856342554092,
0.09493423998355865,
-0.27480506896972656,
0.30034834146499634,
0.12265083938837051,
0.10554638504981995,
-0.08647502958774567,
-0.10739181935787201,
0.22338134050369263,
0.1748349517583847,
-0.0378282368183136,
-0.14958788454532623,
0.34078478813171387,
0.11782075464725494,
-0.04993074759840965,
0.3016178011894226,
0.18213890492916107,
0.301396906375885,
0.7971210479736328,
0.07851167023181915,
0.25384676456451416,
-0.21107330918312073,
-0.09380136430263519,
-0.13657546043395996,
-0.4474603831768036,
0.022837109863758087,
-0.08015626668930054,
-0.03529869019985199,
-0.12467657774686813,
-0.20569443702697754,
0.20495110750198364,
-0.015431790612637997,
0.22015485167503357,
-0.14909659326076508,
0.043684691190719604,
-0.24865233898162842,
-0.1612086296081543,
0.04362469166517258,
-0.3107735514640808,
-0.0689435601234436,
0.10619263350963593,
-0.10688285529613495,
0.3263958692550659,
0.12429416179656982,
0.06238064542412758,
0.10222384333610535,
-0.4294131398200989,
0.20355626940727234,
-0.06269001960754395,
0.08767058700323105,
-0.362539142370224,
0.28398585319519043,
0.26131293177604675,
0.18963372707366943,
0.15717817842960358,
0.19094763696193695,
0.5729643702507019,
0.39447149634361267,
-0.13633108139038086,
-0.08099353313446045,
-0.27559906244277954,
-0.1103980764746666,
-0.4154096245765686,
0.28591975569725037,
0.19795739650726318,
0.3553822636604309,
0.46433591842651367,
0.20754824578762054,
-0.26809021830558777,
-0.06607875227928162,
0.1920684427022934,
-0.2637651860713959,
-0.2234545648097992,
0.10479047149419785,
0.06799925118684769,
-0.28635135293006897,
-0.3225554823875427,
-0.018377088010311127,
-0.43382272124290466,
-0.004564874805510044,
0.5934925079345703,
-0.11358815431594849,
0.309125691652298,
-0.3395165205001831,
0.14480556547641754,
0.0051999278366565704,
0.60579913854599,
0.295389324426651,
-0.017811313271522522,
-0.2954344153404236,
-0.019515685737133026,
-0.6181399822235107,
0.1262810379266739,
-0.1511761099100113,
0.012333894148468971,
-0.011653732508420944,
0.14253626763820648,
0.17389264702796936,
-0.03305090218782425,
-0.0051005929708480835,
0.03629682958126068,
-0.1498091071844101,
-0.10970120131969452,
-0.3313083350658417,
-0.2676610052585602,
-0.2250266820192337,
0.1569494754076004,
-0.0014629364013671875,
-0.3760659694671631,
0.15508276224136353,
-0.0955091044306755,
0.23003354668617249,
-0.17938651144504547,
0.0802161693572998,
-0.020627746358513832,
-0.035598188638687134,
0.15784423053264618,
0.03406703844666481,
0.3657599985599518,
-0.2838608920574188,
0.03404554724693298,
-0.13461974263191223,
-0.06317558884620667,
-0.17006678879261017,
0.1941983699798584,
0.2527383267879486,
0.26540833711624146,
-0.09622174501419067,
-0.17070834338665009,
-0.13808800280094147,
0.15670296549797058,
0.05871815234422684,
0.03713503107428551,
0.14296384155750275,
-0.05074285715818405,
0.1262890100479126,
0.05871701240539551,
0.18636725842952728,
0.4029746949672699,
-0.11137630045413971,
-0.034302711486816406,
-0.3506343960762024,
-0.5414938926696777,
0.2185375988483429,
-0.11808157712221146,
-0.5158481001853943,
0.010307740420103073,
0.13004052639007568,
0.18110820651054382,
0.0267860759049654,
-0.5836288928985596,
0.30677682161331177,
0.30969324707984924,
0.133999302983284,
-0.35290077328681946,
0.2580335736274719,
-0.05051710084080696,
0.05834290757775307,
0.011916577816009521,
0.12013280391693115,
0.024264071136713028,
-0.27022451162338257,
-0.2056572139263153,
-0.03220142796635628
] |
https://github.com/huggingface/datasets/issues/630 | Text dataset not working with large files | From transformers/examples/language-modeling/run-language-modeling.py :
```
def get_dataset(
args: DataTrainingArguments,
tokenizer: PreTrainedTokenizer,
evaluate: bool = False,
cache_dir: Optional[str] = None,
):
file_path = args.eval_data_file if evaluate else args.train_data_file
if True:
dataset = load_dataset("text", data_files=glob.glob(file_path), split='train', use_threads=True,
ignore_verifications=True, save_infos=True, block_size=104857600)
dataset = dataset.map(lambda ex: tokenizer(ex["text"], add_special_tokens=True,
truncation=True, max_length=args.block_size), batched=True)
dataset.set_format(type='torch', columns=['input_ids'])
return dataset
if args.line_by_line:
return LineByLineTextDataset(tokenizer=tokenizer, file_path=file_path, block_size=args.block_size)
else:
return TextDataset(
tokenizer=tokenizer,
file_path=file_path,
block_size=args.block_size,
overwrite_cache=args.overwrite_cache,
cache_dir=cache_dir,
)
```
No, I'm not using multiprocessing. | ```
Traceback (most recent call last):
File "examples/language-modeling/run_language_modeling.py", line 333, in <module>
main()
File "examples/language-modeling/run_language_modeling.py", line 262, in main
get_dataset(data_args, tokenizer=tokenizer, cache_dir=model_args.cache_dir) if training_args.do_train else None
File "examples/language-modeling/run_language_modeling.py", line 144, in get_dataset
dataset = load_dataset("text", data_files=file_path, split='train+test')
File "/home/ksjae/.local/lib/python3.7/site-packages/datasets/load.py", line 611, in load_dataset
ignore_verifications=ignore_verifications,
File "/home/ksjae/.local/lib/python3.7/site-packages/datasets/builder.py", line 469, in download_and_prepare
dl_manager=dl_manager, verify_infos=verify_infos, **download_and_prepare_kwargs
File "/home/ksjae/.local/lib/python3.7/site-packages/datasets/builder.py", line 546, in _download_and_prepare
self._prepare_split(split_generator, **prepare_split_kwargs)
File "/home/ksjae/.local/lib/python3.7/site-packages/datasets/builder.py", line 888, in _prepare_split
for key, table in utils.tqdm(generator, unit=" tables", leave=False, disable=not_verbose):
File "/home/ksjae/.local/lib/python3.7/site-packages/tqdm/std.py", line 1129, in __iter__
for obj in iterable:
File "/home/ksjae/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py", line 104, in _generate_tables
convert_options=self.config.convert_options,
File "pyarrow/_csv.pyx", line 714, in pyarrow._csv.read_csv
File "pyarrow/error.pxi", line 122, in pyarrow.lib.pyarrow_internal_check_status
File "pyarrow/error.pxi", line 84, in pyarrow.lib.check_status
```
**pyarrow.lib.ArrowInvalid: straddling object straddles two block boundaries (try to increase block size?)**
It gives the same message for both 200MB, 10GB .tx files but not for 700MB file.
Can't upload due to size & copyright problem. sorry. | 71 | Text dataset not working with large files
```
Traceback (most recent call last):
File "examples/language-modeling/run_language_modeling.py", line 333, in <module>
main()
File "examples/language-modeling/run_language_modeling.py", line 262, in main
get_dataset(data_args, tokenizer=tokenizer, cache_dir=model_args.cache_dir) if training_args.do_train else None
File "examples/language-modeling/run_language_modeling.py", line 144, in get_dataset
dataset = load_dataset("text", data_files=file_path, split='train+test')
File "/home/ksjae/.local/lib/python3.7/site-packages/datasets/load.py", line 611, in load_dataset
ignore_verifications=ignore_verifications,
File "/home/ksjae/.local/lib/python3.7/site-packages/datasets/builder.py", line 469, in download_and_prepare
dl_manager=dl_manager, verify_infos=verify_infos, **download_and_prepare_kwargs
File "/home/ksjae/.local/lib/python3.7/site-packages/datasets/builder.py", line 546, in _download_and_prepare
self._prepare_split(split_generator, **prepare_split_kwargs)
File "/home/ksjae/.local/lib/python3.7/site-packages/datasets/builder.py", line 888, in _prepare_split
for key, table in utils.tqdm(generator, unit=" tables", leave=False, disable=not_verbose):
File "/home/ksjae/.local/lib/python3.7/site-packages/tqdm/std.py", line 1129, in __iter__
for obj in iterable:
File "/home/ksjae/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py", line 104, in _generate_tables
convert_options=self.config.convert_options,
File "pyarrow/_csv.pyx", line 714, in pyarrow._csv.read_csv
File "pyarrow/error.pxi", line 122, in pyarrow.lib.pyarrow_internal_check_status
File "pyarrow/error.pxi", line 84, in pyarrow.lib.check_status
```
**pyarrow.lib.ArrowInvalid: straddling object straddles two block boundaries (try to increase block size?)**
It gives the same message for both 200MB, 10GB .tx files but not for 700MB file.
Can't upload due to size & copyright problem. sorry.
From transformers/examples/language-modeling/run-language-modeling.py :
```
def get_dataset(
args: DataTrainingArguments,
tokenizer: PreTrainedTokenizer,
evaluate: bool = False,
cache_dir: Optional[str] = None,
):
file_path = args.eval_data_file if evaluate else args.train_data_file
if True:
dataset = load_dataset("text", data_files=glob.glob(file_path), split='train', use_threads=True,
ignore_verifications=True, save_infos=True, block_size=104857600)
dataset = dataset.map(lambda ex: tokenizer(ex["text"], add_special_tokens=True,
truncation=True, max_length=args.block_size), batched=True)
dataset.set_format(type='torch', columns=['input_ids'])
return dataset
if args.line_by_line:
return LineByLineTextDataset(tokenizer=tokenizer, file_path=file_path, block_size=args.block_size)
else:
return TextDataset(
tokenizer=tokenizer,
file_path=file_path,
block_size=args.block_size,
overwrite_cache=args.overwrite_cache,
cache_dir=cache_dir,
)
```
No, I'm not using multiprocessing. | [
-0.4925670027732849,
-0.23102402687072754,
-0.11986441910266876,
0.28360170125961304,
0.46635645627975464,
-0.0735015794634819,
0.305368036031723,
0.5961019992828369,
-0.11382582783699036,
0.04616520553827286,
-0.06241992115974426,
-0.030405322089791298,
-0.10334224998950958,
0.31017932295799255,
-0.1062139943242073,
-0.038950130343437195,
-0.22788456082344055,
0.11306402087211609,
-0.09469194710254669,
0.049916721880435944,
-0.11255110055208206,
0.11109991371631622,
-0.1209786981344223,
-0.09560258686542511,
-0.4804548919200897,
-0.08299517631530762,
0.11853118240833282,
0.2535656690597534,
-0.29201096296310425,
-0.30531421303749084,
-0.16570709645748138,
0.09658567607402802,
0.11220498383045197,
0.6015899777412415,
-0.00010376208228990436,
0.1294623464345932,
0.2131115049123764,
-0.1573348045349121,
-0.22658251225948334,
-0.0314558744430542,
0.15594887733459473,
-0.4493688642978668,
-0.18238908052444458,
-0.2179643213748932,
0.02615135908126831,
-0.06274445354938507,
-0.10828742384910583,
-0.11755962669849396,
0.26533523201942444,
0.5598003268241882,
0.34120333194732666,
0.17075856029987335,
0.13216975331306458,
-0.11296090483665466,
0.250753790140152,
-0.08724960684776306,
-0.08874448388814926,
0.08485007286071777,
0.31081804633140564,
0.026577329263091087,
-0.2564011812210083,
0.3199438154697418,
0.010172003880143166,
0.03770069405436516,
0.00031413882970809937,
-0.02406269684433937,
-0.08279385417699814,
-0.29400500655174255,
0.37119466066360474,
0.23214656114578247,
0.5224136710166931,
-0.31693607568740845,
-0.16412782669067383,
-0.32884305715560913,
-0.18244099617004395,
-0.35125598311424255,
0.22663253545761108,
0.18455395102500916,
-0.11133106052875519,
0.11612716317176819,
-0.14361807703971863,
-0.10148565471172333,
-0.20639726519584656,
-0.0293157696723938,
-0.2615340054035187,
0.10227341949939728,
-0.21058689057826996,
-0.10046204179525375,
0.25758007168769836,
-0.27024781703948975,
0.010829675942659378,
-0.10562211275100708,
-0.13078303635120392,
-0.006805417127907276,
-0.2472129911184311,
-0.08402222394943237,
0.24685075879096985,
-0.19907799363136292,
0.28894200921058655,
-0.04899824410676956,
-0.05042092502117157,
0.22476103901863098,
-0.07966753095388412,
-0.030213192105293274,
0.005493609234690666,
0.3368757665157318,
0.004112988710403442,
0.06385742127895355,
0.4085860252380371,
0.23562848567962646,
-0.3793579936027527,
-0.2320612072944641,
-0.14962677657604218,
-0.5145173668861389,
-0.029356157407164574,
-0.11771722882986069,
0.01687188819050789,
-0.045236922800540924,
-0.12102539837360382,
0.1521078199148178,
0.1642943024635315,
0.15479476749897003,
0.10596621781587601,
0.4816173017024994,
0.10491445660591125,
0.2937651574611664,
-0.164946049451828,
0.17703935503959656,
-0.1443265825510025,
-0.172270730137825,
-0.2492274045944214,
-0.04561186954379082,
-0.057916440069675446,
-0.09268886595964432,
0.2676639258861542,
0.13385112583637238,
0.2967093586921692,
-0.13958050310611725,
0.19085338711738586,
-0.10901589691638947,
0.11681430041790009,
-0.5029687881469727,
0.14769625663757324,
0.1410786211490631,
-0.0354771725833416,
0.16869360208511353,
0.22878293693065643,
-0.17886953055858612,
-0.10239109396934509,
0.050235599279403687,
-0.10356039553880692,
-0.29712870717048645,
0.1772405207157135,
0.3213210701942444,
0.13477429747581482,
-0.003003045916557312,
-0.018904902040958405,
0.2770770192146301,
0.3757719397544861,
-0.21763959527015686,
0.028100714087486267,
-0.177321657538414,
-0.2569279670715332,
-0.1258028894662857,
0.2650003433227539,
0.43938207626342773,
-0.42506060004234314,
0.20901402831077576,
0.06901604682207108,
0.1223086565732956,
0.08902444690465927,
0.3739468455314636,
-0.06507308781147003,
0.31435954570770264,
-0.11457157880067825,
0.2009439319372177,
0.3094799518585205,
-0.2855849862098694,
-0.5090751051902771,
0.5406067967414856,
-0.18592986464500427,
-0.11818693578243256,
0.09925701469182968,
-0.044451307505369186,
0.10349185764789581,
0.13587255775928497,
0.30473989248275757,
0.27934038639068604,
0.011319583281874657,
0.26673009991645813,
-0.26045045256614685,
-0.08325029164552689,
-0.050114214420318604,
0.15593983232975006,
0.3121376931667328,
-0.20806992053985596,
0.1951688975095749,
-0.017231537029147148,
0.1943761706352234,
-0.044446270912885666,
0.21288302540779114,
0.5059319138526917,
0.12715761363506317,
-0.007840372622013092,
-0.01236867904663086,
-0.2239851951599121,
0.0316573791205883,
0.1751382052898407,
0.12100903689861298,
0.08430736511945724,
-0.2666850686073303,
-0.08223278820514679,
-0.30924513936042786,
-0.134145587682724,
-0.2703465223312378,
-0.1933860182762146,
0.28360530734062195,
0.08132393658161163,
-0.011476056650280952,
0.25513970851898193,
-0.016701530665159225,
0.025312982499599457,
-0.1602134257555008,
-0.0655839741230011,
-0.012096773833036423,
-0.0018736571073532104,
-0.09108380228281021,
-0.2782086431980133,
0.12294897437095642,
0.11027294397354126,
-0.041142746806144714,
-0.061668265610933304,
-0.1109171137213707,
0.3928831219673157,
-0.0020209033973515034,
-0.08106143772602081,
-0.036070093512535095,
-0.03006117045879364,
0.1020016148686409,
-0.0952065959572792,
0.07194626331329346,
0.0007551498711109161,
0.13880528509616852,
-0.10531303286552429,
-0.18016177415847778,
0.3006141483783722,
-0.13981524109840393,
0.20316290855407715,
0.3438575267791748,
-0.20907394587993622,
0.2556621730327606,
-0.06635111570358276,
0.22766588628292084,
-0.1381169557571411,
0.2406681329011917,
0.0831318348646164,
0.13632160425186157,
-0.0013490226119756699,
-0.2719841003417969,
-0.012743011116981506,
0.689583957195282,
0.17106518149375916,
0.09289268404245377,
0.1747955083847046,
-0.24533984065055847,
-0.017957307398319244,
-0.2034236490726471,
0.1299688071012497,
0.3976373076438904,
0.2744441032409668,
0.2679811418056488,
0.03577557951211929,
0.18700522184371948,
-0.37400296330451965,
0.13971075415611267,
0.00324847549200058,
0.011184905655682087,
0.5398926734924316,
0.2758920192718506,
-0.12958043813705444,
-0.4534207582473755,
-0.15636895596981049,
0.10577581822872162,
0.3134024739265442,
-0.08958758413791656,
0.019882122054696083,
-0.21556280553340912,
-0.2920286953449249,
-0.2959759533405304,
0.21032747626304626,
-0.2627323269844055,
-0.22531758248806,
0.0694885328412056,
0.001854587346315384,
-0.00965346023440361,
0.09686631709337234,
0.059420328587293625,
0.14542452991008759,
0.3997488021850586,
-0.19882483780384064,
-0.06151032820343971,
-0.2715905010700226,
-0.1730494201183319,
0.1567440927028656,
0.24218787252902985,
-0.01231520064175129,
0.10664252936840057,
-0.1534675806760788,
-0.10159619897603989,
0.003862651064991951,
-0.28537610173225403,
0.0006909370422363281,
-0.029189959168434143,
0.1006607785820961,
-0.05716460943222046,
0.2626273036003113,
0.1662752330303192,
0.07698307931423187,
0.3128008246421814,
-0.12974913418293,
-0.0807747021317482,
0.22336417436599731,
0.09067574143409729,
-0.06526526808738708,
-0.17057353258132935,
-0.4048938751220703,
-0.15303708612918854,
-0.6100062131881714,
0.3575114607810974,
0.09556648135185242,
0.038003552705049515,
0.40225842595100403,
0.3181685507297516,
0.2154986411333084,
-0.02120117098093033,
0.21249309182167053,
0.10026468336582184,
-0.19501852989196777,
0.2925727367401123,
-0.2248302549123764,
-0.3832399547100067,
-0.0998249500989914,
0.16060329973697662,
0.16261537373065948,
0.0072623370215296745,
-0.523443341255188,
0.030241087079048157,
-0.43688228726387024,
0.16236768662929535,
-0.06379617750644684,
0.1686919629573822,
0.08140815794467926,
-0.068488709628582,
-0.2522607743740082,
-0.08427543938159943,
0.08302126824855804,
0.04674498364329338,
-0.0724341943860054,
0.0489533469080925,
-0.1854184865951538,
0.41218438744544983,
0.24029558897018433,
0.4626798629760742,
0.16378207504749298,
0.08145051449537277,
0.3938988149166107,
-0.12170656770467758,
0.42712289094924927,
-0.353285551071167,
-0.3265115022659302,
0.1239759549498558,
-0.09124578535556793,
-0.03290253505110741,
0.2716790437698364,
0.08628013730049133,
0.26993563771247864,
-0.08009670674800873,
-0.21920713782310486,
0.08489612489938736,
-0.27935341000556946,
0.2020106166601181,
-0.1586160659790039,
0.158182293176651,
-0.13573935627937317,
-0.024103175848722458,
-0.07673823833465576,
-0.13111597299575806,
-0.03386951982975006,
0.18008708953857422,
-0.24061143398284912,
-0.025057753548026085,
-0.34338465332984924,
0.06488210707902908,
-0.4402943253517151,
0.11626070737838745,
-0.0008667679503560066,
0.33177903294563293,
-0.16607806086540222,
-0.15486931800842285,
-0.10844495892524719,
-0.15747174620628357,
0.558742344379425,
-0.07002851366996765,
0.050007011741399765,
0.06284362077713013,
-0.09194844961166382,
-0.3191089332103729,
0.16093701124191284,
-0.27350154519081116,
0.15883025527000427,
0.3647179901599884,
0.5645073652267456,
-0.3012341260910034,
-0.05097787827253342,
-0.03999730199575424,
0.3442743122577667,
0.016783621162176132,
-0.03344845771789551,
-0.2761994004249573,
-0.17115014791488647,
-0.479754775762558,
0.13883376121520996,
0.2979472875595093,
0.28462928533554077,
-0.2693779766559601,
0.07181067764759064,
0.006769764237105846,
-0.24167132377624512,
0.21428701281547546,
0.004094982519745827,
0.1445523202419281,
-0.0965576246380806,
0.22559228539466858,
-0.11081492900848389,
0.1980491578578949,
0.1853601634502411,
0.5712106227874756,
-0.03319813683629036,
-0.18376705050468445,
-0.10033683478832245,
-0.19775772094726562,
0.35022130608558655,
0.32108274102211,
-0.12260875850915909,
0.2475552260875702,
-0.04689199477434158,
0.20478081703186035,
0.016252687200903893,
0.37144094705581665,
0.2987755239009857,
-0.0353546105325222,
-0.2595382034778595,
-0.2792068123817444,
0.11155571788549423,
-0.08455014228820801,
0.18670086562633514,
0.14084039628505707,
-0.3193206787109375,
-0.25578510761260986,
0.08038311451673508,
-0.31555503606796265,
0.581957995891571,
0.09366241097450256,
0.3404352366924286,
-0.05666738748550415,
0.1961900144815445,
0.06290748715400696,
-0.5295384526252747,
0.2434755116701126,
-0.33936843276023865,
-0.2687772810459137,
0.08404745161533356,
-0.001982681453227997,
0.08260998129844666,
0.1538456678390503,
-0.270569771528244,
0.09973536431789398,
0.11994169652462006,
0.10925504565238953,
-0.2874218225479126,
0.3836098313331604,
-0.40400704741477966,
-0.120232954621315,
-0.31708869338035583,
0.18089659512043,
0.03846214711666107,
-0.15849192440509796,
-0.012326336465775967,
-0.11951793730258942,
0.020361650735139847,
-0.2523367404937744,
-0.14524796605110168,
-0.04931566119194031,
-0.41980400681495667,
0.18225449323654175,
0.039506085216999054,
-0.33519911766052246,
0.24350827932357788,
0.17777115106582642,
0.07175565510988235,
0.45078524947166443,
-0.23751425743103027,
0.17865891754627228,
0.011979680508375168,
-0.027082400396466255,
0.15663877129554749,
-0.002052192110568285,
0.3159703314304352,
-0.012490535154938698,
-0.22674140334129333,
0.09105018526315689,
-0.02672802284359932,
0.10022516548633575,
-0.02117358148097992,
0.005435124039649963,
-0.04170331358909607,
-0.3602181375026703,
-0.24734868109226227,
-0.12215757369995117,
-0.24486114084720612,
-0.30070412158966064,
0.22550034523010254,
-0.05333781987428665,
-0.05440139025449753,
0.16801418364048004,
0.07098978757858276,
-0.3310469686985016,
-0.16335467994213104,
0.32585275173187256,
-0.19543474912643433,
0.17897029221057892,
0.5283613801002502,
0.3944675922393799,
-0.2252093255519867,
-0.32895269989967346,
0.3111717402935028,
-0.02889079600572586,
-0.3540939688682556,
0.27591240406036377,
0.027021314948797226,
-0.06967999786138535,
0.12655551731586456,
0.2427477389574051,
-0.14057697355747223,
-0.3056276738643646,
-0.12778893113136292,
-0.23810873925685883,
-0.43041083216667175,
0.07364131510257721,
-0.014685843139886856,
0.14289841055870056,
-0.012018360197544098,
0.21348373591899872,
0.11327877640724182,
0.21397390961647034,
-0.4020756185054779,
0.14234788715839386,
-0.17718617618083954,
0.09960086643695831,
0.09315408766269684,
-0.13554859161376953,
0.1392204463481903,
0.051814910024404526,
0.11126954853534698,
0.2546558380126953,
-0.07314927130937576,
-0.3498375415802002,
-0.11043192446231842,
0.08029373735189438,
0.04296475276350975,
-0.12139826267957687,
-0.018652942031621933,
-0.3757631778717041,
-0.25712159276008606,
-0.2619505524635315,
0.20553825795650482,
-0.05955670028924942,
-0.10602714121341705,
0.17889057099819183,
-0.14844489097595215,
-0.05947142094373703,
0.11627981066703796,
-0.030737467110157013,
-0.2113562822341919,
0.11350301653146744,
0.17233796417713165,
0.03541186824440956,
0.007398670539259911,
0.0013167411088943481,
-0.31594744324684143,
0.0826844722032547,
0.1583465337753296,
-0.07415562123060226,
0.3244626820087433,
-0.37572717666625977,
-0.05665460228919983,
0.17693735659122467,
0.3609246015548706,
0.41158416867256165,
-0.2069200575351715,
-0.02834312990307808,
0.24290448427200317,
0.29815369844436646,
-0.25329941511154175,
-0.10016856342554092,
0.09493423998355865,
-0.27480506896972656,
0.30034834146499634,
0.12265083938837051,
0.10554638504981995,
-0.08647502958774567,
-0.10739181935787201,
0.22338134050369263,
0.1748349517583847,
-0.0378282368183136,
-0.14958788454532623,
0.34078478813171387,
0.11782075464725494,
-0.04993074759840965,
0.3016178011894226,
0.18213890492916107,
0.301396906375885,
0.7971210479736328,
0.07851167023181915,
0.25384676456451416,
-0.21107330918312073,
-0.09380136430263519,
-0.13657546043395996,
-0.4474603831768036,
0.022837109863758087,
-0.08015626668930054,
-0.03529869019985199,
-0.12467657774686813,
-0.20569443702697754,
0.20495110750198364,
-0.015431790612637997,
0.22015485167503357,
-0.14909659326076508,
0.043684691190719604,
-0.24865233898162842,
-0.1612086296081543,
0.04362469166517258,
-0.3107735514640808,
-0.0689435601234436,
0.10619263350963593,
-0.10688285529613495,
0.3263958692550659,
0.12429416179656982,
0.06238064542412758,
0.10222384333610535,
-0.4294131398200989,
0.20355626940727234,
-0.06269001960754395,
0.08767058700323105,
-0.362539142370224,
0.28398585319519043,
0.26131293177604675,
0.18963372707366943,
0.15717817842960358,
0.19094763696193695,
0.5729643702507019,
0.39447149634361267,
-0.13633108139038086,
-0.08099353313446045,
-0.27559906244277954,
-0.1103980764746666,
-0.4154096245765686,
0.28591975569725037,
0.19795739650726318,
0.3553822636604309,
0.46433591842651367,
0.20754824578762054,
-0.26809021830558777,
-0.06607875227928162,
0.1920684427022934,
-0.2637651860713959,
-0.2234545648097992,
0.10479047149419785,
0.06799925118684769,
-0.28635135293006897,
-0.3225554823875427,
-0.018377088010311127,
-0.43382272124290466,
-0.004564874805510044,
0.5934925079345703,
-0.11358815431594849,
0.309125691652298,
-0.3395165205001831,
0.14480556547641754,
0.0051999278366565704,
0.60579913854599,
0.295389324426651,
-0.017811313271522522,
-0.2954344153404236,
-0.019515685737133026,
-0.6181399822235107,
0.1262810379266739,
-0.1511761099100113,
0.012333894148468971,
-0.011653732508420944,
0.14253626763820648,
0.17389264702796936,
-0.03305090218782425,
-0.0051005929708480835,
0.03629682958126068,
-0.1498091071844101,
-0.10970120131969452,
-0.3313083350658417,
-0.2676610052585602,
-0.2250266820192337,
0.1569494754076004,
-0.0014629364013671875,
-0.3760659694671631,
0.15508276224136353,
-0.0955091044306755,
0.23003354668617249,
-0.17938651144504547,
0.0802161693572998,
-0.020627746358513832,
-0.035598188638687134,
0.15784423053264618,
0.03406703844666481,
0.3657599985599518,
-0.2838608920574188,
0.03404554724693298,
-0.13461974263191223,
-0.06317558884620667,
-0.17006678879261017,
0.1941983699798584,
0.2527383267879486,
0.26540833711624146,
-0.09622174501419067,
-0.17070834338665009,
-0.13808800280094147,
0.15670296549797058,
0.05871815234422684,
0.03713503107428551,
0.14296384155750275,
-0.05074285715818405,
0.1262890100479126,
0.05871701240539551,
0.18636725842952728,
0.4029746949672699,
-0.11137630045413971,
-0.034302711486816406,
-0.3506343960762024,
-0.5414938926696777,
0.2185375988483429,
-0.11808157712221146,
-0.5158481001853943,
0.010307740420103073,
0.13004052639007568,
0.18110820651054382,
0.0267860759049654,
-0.5836288928985596,
0.30677682161331177,
0.30969324707984924,
0.133999302983284,
-0.35290077328681946,
0.2580335736274719,
-0.05051710084080696,
0.05834290757775307,
0.011916577816009521,
0.12013280391693115,
0.024264071136713028,
-0.27022451162338257,
-0.2056572139263153,
-0.03220142796635628
] |
https://github.com/huggingface/datasets/issues/630 | Text dataset not working with large files | I am not able to reproduce on my side :/
Could you send the version of `datasets` and `pyarrow` you're using ?
Could you try to update the lib and try again ?
Or do you think you could try to reproduce it on google colab ? | ```
Traceback (most recent call last):
File "examples/language-modeling/run_language_modeling.py", line 333, in <module>
main()
File "examples/language-modeling/run_language_modeling.py", line 262, in main
get_dataset(data_args, tokenizer=tokenizer, cache_dir=model_args.cache_dir) if training_args.do_train else None
File "examples/language-modeling/run_language_modeling.py", line 144, in get_dataset
dataset = load_dataset("text", data_files=file_path, split='train+test')
File "/home/ksjae/.local/lib/python3.7/site-packages/datasets/load.py", line 611, in load_dataset
ignore_verifications=ignore_verifications,
File "/home/ksjae/.local/lib/python3.7/site-packages/datasets/builder.py", line 469, in download_and_prepare
dl_manager=dl_manager, verify_infos=verify_infos, **download_and_prepare_kwargs
File "/home/ksjae/.local/lib/python3.7/site-packages/datasets/builder.py", line 546, in _download_and_prepare
self._prepare_split(split_generator, **prepare_split_kwargs)
File "/home/ksjae/.local/lib/python3.7/site-packages/datasets/builder.py", line 888, in _prepare_split
for key, table in utils.tqdm(generator, unit=" tables", leave=False, disable=not_verbose):
File "/home/ksjae/.local/lib/python3.7/site-packages/tqdm/std.py", line 1129, in __iter__
for obj in iterable:
File "/home/ksjae/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py", line 104, in _generate_tables
convert_options=self.config.convert_options,
File "pyarrow/_csv.pyx", line 714, in pyarrow._csv.read_csv
File "pyarrow/error.pxi", line 122, in pyarrow.lib.pyarrow_internal_check_status
File "pyarrow/error.pxi", line 84, in pyarrow.lib.check_status
```
**pyarrow.lib.ArrowInvalid: straddling object straddles two block boundaries (try to increase block size?)**
It gives the same message for both 200MB, 10GB .tx files but not for 700MB file.
Can't upload due to size & copyright problem. sorry. | 47 | Text dataset not working with large files
```
Traceback (most recent call last):
File "examples/language-modeling/run_language_modeling.py", line 333, in <module>
main()
File "examples/language-modeling/run_language_modeling.py", line 262, in main
get_dataset(data_args, tokenizer=tokenizer, cache_dir=model_args.cache_dir) if training_args.do_train else None
File "examples/language-modeling/run_language_modeling.py", line 144, in get_dataset
dataset = load_dataset("text", data_files=file_path, split='train+test')
File "/home/ksjae/.local/lib/python3.7/site-packages/datasets/load.py", line 611, in load_dataset
ignore_verifications=ignore_verifications,
File "/home/ksjae/.local/lib/python3.7/site-packages/datasets/builder.py", line 469, in download_and_prepare
dl_manager=dl_manager, verify_infos=verify_infos, **download_and_prepare_kwargs
File "/home/ksjae/.local/lib/python3.7/site-packages/datasets/builder.py", line 546, in _download_and_prepare
self._prepare_split(split_generator, **prepare_split_kwargs)
File "/home/ksjae/.local/lib/python3.7/site-packages/datasets/builder.py", line 888, in _prepare_split
for key, table in utils.tqdm(generator, unit=" tables", leave=False, disable=not_verbose):
File "/home/ksjae/.local/lib/python3.7/site-packages/tqdm/std.py", line 1129, in __iter__
for obj in iterable:
File "/home/ksjae/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py", line 104, in _generate_tables
convert_options=self.config.convert_options,
File "pyarrow/_csv.pyx", line 714, in pyarrow._csv.read_csv
File "pyarrow/error.pxi", line 122, in pyarrow.lib.pyarrow_internal_check_status
File "pyarrow/error.pxi", line 84, in pyarrow.lib.check_status
```
**pyarrow.lib.ArrowInvalid: straddling object straddles two block boundaries (try to increase block size?)**
It gives the same message for both 200MB, 10GB .tx files but not for 700MB file.
Can't upload due to size & copyright problem. sorry.
I am not able to reproduce on my side :/
Could you send the version of `datasets` and `pyarrow` you're using ?
Could you try to update the lib and try again ?
Or do you think you could try to reproduce it on google colab ? | [
-0.4925670027732849,
-0.23102402687072754,
-0.11986441910266876,
0.28360170125961304,
0.46635645627975464,
-0.0735015794634819,
0.305368036031723,
0.5961019992828369,
-0.11382582783699036,
0.04616520553827286,
-0.06241992115974426,
-0.030405322089791298,
-0.10334224998950958,
0.31017932295799255,
-0.1062139943242073,
-0.038950130343437195,
-0.22788456082344055,
0.11306402087211609,
-0.09469194710254669,
0.049916721880435944,
-0.11255110055208206,
0.11109991371631622,
-0.1209786981344223,
-0.09560258686542511,
-0.4804548919200897,
-0.08299517631530762,
0.11853118240833282,
0.2535656690597534,
-0.29201096296310425,
-0.30531421303749084,
-0.16570709645748138,
0.09658567607402802,
0.11220498383045197,
0.6015899777412415,
-0.00010376208228990436,
0.1294623464345932,
0.2131115049123764,
-0.1573348045349121,
-0.22658251225948334,
-0.0314558744430542,
0.15594887733459473,
-0.4493688642978668,
-0.18238908052444458,
-0.2179643213748932,
0.02615135908126831,
-0.06274445354938507,
-0.10828742384910583,
-0.11755962669849396,
0.26533523201942444,
0.5598003268241882,
0.34120333194732666,
0.17075856029987335,
0.13216975331306458,
-0.11296090483665466,
0.250753790140152,
-0.08724960684776306,
-0.08874448388814926,
0.08485007286071777,
0.31081804633140564,
0.026577329263091087,
-0.2564011812210083,
0.3199438154697418,
0.010172003880143166,
0.03770069405436516,
0.00031413882970809937,
-0.02406269684433937,
-0.08279385417699814,
-0.29400500655174255,
0.37119466066360474,
0.23214656114578247,
0.5224136710166931,
-0.31693607568740845,
-0.16412782669067383,
-0.32884305715560913,
-0.18244099617004395,
-0.35125598311424255,
0.22663253545761108,
0.18455395102500916,
-0.11133106052875519,
0.11612716317176819,
-0.14361807703971863,
-0.10148565471172333,
-0.20639726519584656,
-0.0293157696723938,
-0.2615340054035187,
0.10227341949939728,
-0.21058689057826996,
-0.10046204179525375,
0.25758007168769836,
-0.27024781703948975,
0.010829675942659378,
-0.10562211275100708,
-0.13078303635120392,
-0.006805417127907276,
-0.2472129911184311,
-0.08402222394943237,
0.24685075879096985,
-0.19907799363136292,
0.28894200921058655,
-0.04899824410676956,
-0.05042092502117157,
0.22476103901863098,
-0.07966753095388412,
-0.030213192105293274,
0.005493609234690666,
0.3368757665157318,
0.004112988710403442,
0.06385742127895355,
0.4085860252380371,
0.23562848567962646,
-0.3793579936027527,
-0.2320612072944641,
-0.14962677657604218,
-0.5145173668861389,
-0.029356157407164574,
-0.11771722882986069,
0.01687188819050789,
-0.045236922800540924,
-0.12102539837360382,
0.1521078199148178,
0.1642943024635315,
0.15479476749897003,
0.10596621781587601,
0.4816173017024994,
0.10491445660591125,
0.2937651574611664,
-0.164946049451828,
0.17703935503959656,
-0.1443265825510025,
-0.172270730137825,
-0.2492274045944214,
-0.04561186954379082,
-0.057916440069675446,
-0.09268886595964432,
0.2676639258861542,
0.13385112583637238,
0.2967093586921692,
-0.13958050310611725,
0.19085338711738586,
-0.10901589691638947,
0.11681430041790009,
-0.5029687881469727,
0.14769625663757324,
0.1410786211490631,
-0.0354771725833416,
0.16869360208511353,
0.22878293693065643,
-0.17886953055858612,
-0.10239109396934509,
0.050235599279403687,
-0.10356039553880692,
-0.29712870717048645,
0.1772405207157135,
0.3213210701942444,
0.13477429747581482,
-0.003003045916557312,
-0.018904902040958405,
0.2770770192146301,
0.3757719397544861,
-0.21763959527015686,
0.028100714087486267,
-0.177321657538414,
-0.2569279670715332,
-0.1258028894662857,
0.2650003433227539,
0.43938207626342773,
-0.42506060004234314,
0.20901402831077576,
0.06901604682207108,
0.1223086565732956,
0.08902444690465927,
0.3739468455314636,
-0.06507308781147003,
0.31435954570770264,
-0.11457157880067825,
0.2009439319372177,
0.3094799518585205,
-0.2855849862098694,
-0.5090751051902771,
0.5406067967414856,
-0.18592986464500427,
-0.11818693578243256,
0.09925701469182968,
-0.044451307505369186,
0.10349185764789581,
0.13587255775928497,
0.30473989248275757,
0.27934038639068604,
0.011319583281874657,
0.26673009991645813,
-0.26045045256614685,
-0.08325029164552689,
-0.050114214420318604,
0.15593983232975006,
0.3121376931667328,
-0.20806992053985596,
0.1951688975095749,
-0.017231537029147148,
0.1943761706352234,
-0.044446270912885666,
0.21288302540779114,
0.5059319138526917,
0.12715761363506317,
-0.007840372622013092,
-0.01236867904663086,
-0.2239851951599121,
0.0316573791205883,
0.1751382052898407,
0.12100903689861298,
0.08430736511945724,
-0.2666850686073303,
-0.08223278820514679,
-0.30924513936042786,
-0.134145587682724,
-0.2703465223312378,
-0.1933860182762146,
0.28360530734062195,
0.08132393658161163,
-0.011476056650280952,
0.25513970851898193,
-0.016701530665159225,
0.025312982499599457,
-0.1602134257555008,
-0.0655839741230011,
-0.012096773833036423,
-0.0018736571073532104,
-0.09108380228281021,
-0.2782086431980133,
0.12294897437095642,
0.11027294397354126,
-0.041142746806144714,
-0.061668265610933304,
-0.1109171137213707,
0.3928831219673157,
-0.0020209033973515034,
-0.08106143772602081,
-0.036070093512535095,
-0.03006117045879364,
0.1020016148686409,
-0.0952065959572792,
0.07194626331329346,
0.0007551498711109161,
0.13880528509616852,
-0.10531303286552429,
-0.18016177415847778,
0.3006141483783722,
-0.13981524109840393,
0.20316290855407715,
0.3438575267791748,
-0.20907394587993622,
0.2556621730327606,
-0.06635111570358276,
0.22766588628292084,
-0.1381169557571411,
0.2406681329011917,
0.0831318348646164,
0.13632160425186157,
-0.0013490226119756699,
-0.2719841003417969,
-0.012743011116981506,
0.689583957195282,
0.17106518149375916,
0.09289268404245377,
0.1747955083847046,
-0.24533984065055847,
-0.017957307398319244,
-0.2034236490726471,
0.1299688071012497,
0.3976373076438904,
0.2744441032409668,
0.2679811418056488,
0.03577557951211929,
0.18700522184371948,
-0.37400296330451965,
0.13971075415611267,
0.00324847549200058,
0.011184905655682087,
0.5398926734924316,
0.2758920192718506,
-0.12958043813705444,
-0.4534207582473755,
-0.15636895596981049,
0.10577581822872162,
0.3134024739265442,
-0.08958758413791656,
0.019882122054696083,
-0.21556280553340912,
-0.2920286953449249,
-0.2959759533405304,
0.21032747626304626,
-0.2627323269844055,
-0.22531758248806,
0.0694885328412056,
0.001854587346315384,
-0.00965346023440361,
0.09686631709337234,
0.059420328587293625,
0.14542452991008759,
0.3997488021850586,
-0.19882483780384064,
-0.06151032820343971,
-0.2715905010700226,
-0.1730494201183319,
0.1567440927028656,
0.24218787252902985,
-0.01231520064175129,
0.10664252936840057,
-0.1534675806760788,
-0.10159619897603989,
0.003862651064991951,
-0.28537610173225403,
0.0006909370422363281,
-0.029189959168434143,
0.1006607785820961,
-0.05716460943222046,
0.2626273036003113,
0.1662752330303192,
0.07698307931423187,
0.3128008246421814,
-0.12974913418293,
-0.0807747021317482,
0.22336417436599731,
0.09067574143409729,
-0.06526526808738708,
-0.17057353258132935,
-0.4048938751220703,
-0.15303708612918854,
-0.6100062131881714,
0.3575114607810974,
0.09556648135185242,
0.038003552705049515,
0.40225842595100403,
0.3181685507297516,
0.2154986411333084,
-0.02120117098093033,
0.21249309182167053,
0.10026468336582184,
-0.19501852989196777,
0.2925727367401123,
-0.2248302549123764,
-0.3832399547100067,
-0.0998249500989914,
0.16060329973697662,
0.16261537373065948,
0.0072623370215296745,
-0.523443341255188,
0.030241087079048157,
-0.43688228726387024,
0.16236768662929535,
-0.06379617750644684,
0.1686919629573822,
0.08140815794467926,
-0.068488709628582,
-0.2522607743740082,
-0.08427543938159943,
0.08302126824855804,
0.04674498364329338,
-0.0724341943860054,
0.0489533469080925,
-0.1854184865951538,
0.41218438744544983,
0.24029558897018433,
0.4626798629760742,
0.16378207504749298,
0.08145051449537277,
0.3938988149166107,
-0.12170656770467758,
0.42712289094924927,
-0.353285551071167,
-0.3265115022659302,
0.1239759549498558,
-0.09124578535556793,
-0.03290253505110741,
0.2716790437698364,
0.08628013730049133,
0.26993563771247864,
-0.08009670674800873,
-0.21920713782310486,
0.08489612489938736,
-0.27935341000556946,
0.2020106166601181,
-0.1586160659790039,
0.158182293176651,
-0.13573935627937317,
-0.024103175848722458,
-0.07673823833465576,
-0.13111597299575806,
-0.03386951982975006,
0.18008708953857422,
-0.24061143398284912,
-0.025057753548026085,
-0.34338465332984924,
0.06488210707902908,
-0.4402943253517151,
0.11626070737838745,
-0.0008667679503560066,
0.33177903294563293,
-0.16607806086540222,
-0.15486931800842285,
-0.10844495892524719,
-0.15747174620628357,
0.558742344379425,
-0.07002851366996765,
0.050007011741399765,
0.06284362077713013,
-0.09194844961166382,
-0.3191089332103729,
0.16093701124191284,
-0.27350154519081116,
0.15883025527000427,
0.3647179901599884,
0.5645073652267456,
-0.3012341260910034,
-0.05097787827253342,
-0.03999730199575424,
0.3442743122577667,
0.016783621162176132,
-0.03344845771789551,
-0.2761994004249573,
-0.17115014791488647,
-0.479754775762558,
0.13883376121520996,
0.2979472875595093,
0.28462928533554077,
-0.2693779766559601,
0.07181067764759064,
0.006769764237105846,
-0.24167132377624512,
0.21428701281547546,
0.004094982519745827,
0.1445523202419281,
-0.0965576246380806,
0.22559228539466858,
-0.11081492900848389,
0.1980491578578949,
0.1853601634502411,
0.5712106227874756,
-0.03319813683629036,
-0.18376705050468445,
-0.10033683478832245,
-0.19775772094726562,
0.35022130608558655,
0.32108274102211,
-0.12260875850915909,
0.2475552260875702,
-0.04689199477434158,
0.20478081703186035,
0.016252687200903893,
0.37144094705581665,
0.2987755239009857,
-0.0353546105325222,
-0.2595382034778595,
-0.2792068123817444,
0.11155571788549423,
-0.08455014228820801,
0.18670086562633514,
0.14084039628505707,
-0.3193206787109375,
-0.25578510761260986,
0.08038311451673508,
-0.31555503606796265,
0.581957995891571,
0.09366241097450256,
0.3404352366924286,
-0.05666738748550415,
0.1961900144815445,
0.06290748715400696,
-0.5295384526252747,
0.2434755116701126,
-0.33936843276023865,
-0.2687772810459137,
0.08404745161533356,
-0.001982681453227997,
0.08260998129844666,
0.1538456678390503,
-0.270569771528244,
0.09973536431789398,
0.11994169652462006,
0.10925504565238953,
-0.2874218225479126,
0.3836098313331604,
-0.40400704741477966,
-0.120232954621315,
-0.31708869338035583,
0.18089659512043,
0.03846214711666107,
-0.15849192440509796,
-0.012326336465775967,
-0.11951793730258942,
0.020361650735139847,
-0.2523367404937744,
-0.14524796605110168,
-0.04931566119194031,
-0.41980400681495667,
0.18225449323654175,
0.039506085216999054,
-0.33519911766052246,
0.24350827932357788,
0.17777115106582642,
0.07175565510988235,
0.45078524947166443,
-0.23751425743103027,
0.17865891754627228,
0.011979680508375168,
-0.027082400396466255,
0.15663877129554749,
-0.002052192110568285,
0.3159703314304352,
-0.012490535154938698,
-0.22674140334129333,
0.09105018526315689,
-0.02672802284359932,
0.10022516548633575,
-0.02117358148097992,
0.005435124039649963,
-0.04170331358909607,
-0.3602181375026703,
-0.24734868109226227,
-0.12215757369995117,
-0.24486114084720612,
-0.30070412158966064,
0.22550034523010254,
-0.05333781987428665,
-0.05440139025449753,
0.16801418364048004,
0.07098978757858276,
-0.3310469686985016,
-0.16335467994213104,
0.32585275173187256,
-0.19543474912643433,
0.17897029221057892,
0.5283613801002502,
0.3944675922393799,
-0.2252093255519867,
-0.32895269989967346,
0.3111717402935028,
-0.02889079600572586,
-0.3540939688682556,
0.27591240406036377,
0.027021314948797226,
-0.06967999786138535,
0.12655551731586456,
0.2427477389574051,
-0.14057697355747223,
-0.3056276738643646,
-0.12778893113136292,
-0.23810873925685883,
-0.43041083216667175,
0.07364131510257721,
-0.014685843139886856,
0.14289841055870056,
-0.012018360197544098,
0.21348373591899872,
0.11327877640724182,
0.21397390961647034,
-0.4020756185054779,
0.14234788715839386,
-0.17718617618083954,
0.09960086643695831,
0.09315408766269684,
-0.13554859161376953,
0.1392204463481903,
0.051814910024404526,
0.11126954853534698,
0.2546558380126953,
-0.07314927130937576,
-0.3498375415802002,
-0.11043192446231842,
0.08029373735189438,
0.04296475276350975,
-0.12139826267957687,
-0.018652942031621933,
-0.3757631778717041,
-0.25712159276008606,
-0.2619505524635315,
0.20553825795650482,
-0.05955670028924942,
-0.10602714121341705,
0.17889057099819183,
-0.14844489097595215,
-0.05947142094373703,
0.11627981066703796,
-0.030737467110157013,
-0.2113562822341919,
0.11350301653146744,
0.17233796417713165,
0.03541186824440956,
0.007398670539259911,
0.0013167411088943481,
-0.31594744324684143,
0.0826844722032547,
0.1583465337753296,
-0.07415562123060226,
0.3244626820087433,
-0.37572717666625977,
-0.05665460228919983,
0.17693735659122467,
0.3609246015548706,
0.41158416867256165,
-0.2069200575351715,
-0.02834312990307808,
0.24290448427200317,
0.29815369844436646,
-0.25329941511154175,
-0.10016856342554092,
0.09493423998355865,
-0.27480506896972656,
0.30034834146499634,
0.12265083938837051,
0.10554638504981995,
-0.08647502958774567,
-0.10739181935787201,
0.22338134050369263,
0.1748349517583847,
-0.0378282368183136,
-0.14958788454532623,
0.34078478813171387,
0.11782075464725494,
-0.04993074759840965,
0.3016178011894226,
0.18213890492916107,
0.301396906375885,
0.7971210479736328,
0.07851167023181915,
0.25384676456451416,
-0.21107330918312073,
-0.09380136430263519,
-0.13657546043395996,
-0.4474603831768036,
0.022837109863758087,
-0.08015626668930054,
-0.03529869019985199,
-0.12467657774686813,
-0.20569443702697754,
0.20495110750198364,
-0.015431790612637997,
0.22015485167503357,
-0.14909659326076508,
0.043684691190719604,
-0.24865233898162842,
-0.1612086296081543,
0.04362469166517258,
-0.3107735514640808,
-0.0689435601234436,
0.10619263350963593,
-0.10688285529613495,
0.3263958692550659,
0.12429416179656982,
0.06238064542412758,
0.10222384333610535,
-0.4294131398200989,
0.20355626940727234,
-0.06269001960754395,
0.08767058700323105,
-0.362539142370224,
0.28398585319519043,
0.26131293177604675,
0.18963372707366943,
0.15717817842960358,
0.19094763696193695,
0.5729643702507019,
0.39447149634361267,
-0.13633108139038086,
-0.08099353313446045,
-0.27559906244277954,
-0.1103980764746666,
-0.4154096245765686,
0.28591975569725037,
0.19795739650726318,
0.3553822636604309,
0.46433591842651367,
0.20754824578762054,
-0.26809021830558777,
-0.06607875227928162,
0.1920684427022934,
-0.2637651860713959,
-0.2234545648097992,
0.10479047149419785,
0.06799925118684769,
-0.28635135293006897,
-0.3225554823875427,
-0.018377088010311127,
-0.43382272124290466,
-0.004564874805510044,
0.5934925079345703,
-0.11358815431594849,
0.309125691652298,
-0.3395165205001831,
0.14480556547641754,
0.0051999278366565704,
0.60579913854599,
0.295389324426651,
-0.017811313271522522,
-0.2954344153404236,
-0.019515685737133026,
-0.6181399822235107,
0.1262810379266739,
-0.1511761099100113,
0.012333894148468971,
-0.011653732508420944,
0.14253626763820648,
0.17389264702796936,
-0.03305090218782425,
-0.0051005929708480835,
0.03629682958126068,
-0.1498091071844101,
-0.10970120131969452,
-0.3313083350658417,
-0.2676610052585602,
-0.2250266820192337,
0.1569494754076004,
-0.0014629364013671875,
-0.3760659694671631,
0.15508276224136353,
-0.0955091044306755,
0.23003354668617249,
-0.17938651144504547,
0.0802161693572998,
-0.020627746358513832,
-0.035598188638687134,
0.15784423053264618,
0.03406703844666481,
0.3657599985599518,
-0.2838608920574188,
0.03404554724693298,
-0.13461974263191223,
-0.06317558884620667,
-0.17006678879261017,
0.1941983699798584,
0.2527383267879486,
0.26540833711624146,
-0.09622174501419067,
-0.17070834338665009,
-0.13808800280094147,
0.15670296549797058,
0.05871815234422684,
0.03713503107428551,
0.14296384155750275,
-0.05074285715818405,
0.1262890100479126,
0.05871701240539551,
0.18636725842952728,
0.4029746949672699,
-0.11137630045413971,
-0.034302711486816406,
-0.3506343960762024,
-0.5414938926696777,
0.2185375988483429,
-0.11808157712221146,
-0.5158481001853943,
0.010307740420103073,
0.13004052639007568,
0.18110820651054382,
0.0267860759049654,
-0.5836288928985596,
0.30677682161331177,
0.30969324707984924,
0.133999302983284,
-0.35290077328681946,
0.2580335736274719,
-0.05051710084080696,
0.05834290757775307,
0.011916577816009521,
0.12013280391693115,
0.024264071136713028,
-0.27022451162338257,
-0.2056572139263153,
-0.03220142796635628
] |
https://github.com/huggingface/datasets/issues/630 | Text dataset not working with large files | Huh, weird. It's fixed on my side too.
But now ```Caching processed dataset``` is taking forever - how can I disable it? Any flags? | ```
Traceback (most recent call last):
File "examples/language-modeling/run_language_modeling.py", line 333, in <module>
main()
File "examples/language-modeling/run_language_modeling.py", line 262, in main
get_dataset(data_args, tokenizer=tokenizer, cache_dir=model_args.cache_dir) if training_args.do_train else None
File "examples/language-modeling/run_language_modeling.py", line 144, in get_dataset
dataset = load_dataset("text", data_files=file_path, split='train+test')
File "/home/ksjae/.local/lib/python3.7/site-packages/datasets/load.py", line 611, in load_dataset
ignore_verifications=ignore_verifications,
File "/home/ksjae/.local/lib/python3.7/site-packages/datasets/builder.py", line 469, in download_and_prepare
dl_manager=dl_manager, verify_infos=verify_infos, **download_and_prepare_kwargs
File "/home/ksjae/.local/lib/python3.7/site-packages/datasets/builder.py", line 546, in _download_and_prepare
self._prepare_split(split_generator, **prepare_split_kwargs)
File "/home/ksjae/.local/lib/python3.7/site-packages/datasets/builder.py", line 888, in _prepare_split
for key, table in utils.tqdm(generator, unit=" tables", leave=False, disable=not_verbose):
File "/home/ksjae/.local/lib/python3.7/site-packages/tqdm/std.py", line 1129, in __iter__
for obj in iterable:
File "/home/ksjae/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py", line 104, in _generate_tables
convert_options=self.config.convert_options,
File "pyarrow/_csv.pyx", line 714, in pyarrow._csv.read_csv
File "pyarrow/error.pxi", line 122, in pyarrow.lib.pyarrow_internal_check_status
File "pyarrow/error.pxi", line 84, in pyarrow.lib.check_status
```
**pyarrow.lib.ArrowInvalid: straddling object straddles two block boundaries (try to increase block size?)**
It gives the same message for both 200MB, 10GB .tx files but not for 700MB file.
Can't upload due to size & copyright problem. sorry. | 24 | Text dataset not working with large files
```
Traceback (most recent call last):
File "examples/language-modeling/run_language_modeling.py", line 333, in <module>
main()
File "examples/language-modeling/run_language_modeling.py", line 262, in main
get_dataset(data_args, tokenizer=tokenizer, cache_dir=model_args.cache_dir) if training_args.do_train else None
File "examples/language-modeling/run_language_modeling.py", line 144, in get_dataset
dataset = load_dataset("text", data_files=file_path, split='train+test')
File "/home/ksjae/.local/lib/python3.7/site-packages/datasets/load.py", line 611, in load_dataset
ignore_verifications=ignore_verifications,
File "/home/ksjae/.local/lib/python3.7/site-packages/datasets/builder.py", line 469, in download_and_prepare
dl_manager=dl_manager, verify_infos=verify_infos, **download_and_prepare_kwargs
File "/home/ksjae/.local/lib/python3.7/site-packages/datasets/builder.py", line 546, in _download_and_prepare
self._prepare_split(split_generator, **prepare_split_kwargs)
File "/home/ksjae/.local/lib/python3.7/site-packages/datasets/builder.py", line 888, in _prepare_split
for key, table in utils.tqdm(generator, unit=" tables", leave=False, disable=not_verbose):
File "/home/ksjae/.local/lib/python3.7/site-packages/tqdm/std.py", line 1129, in __iter__
for obj in iterable:
File "/home/ksjae/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py", line 104, in _generate_tables
convert_options=self.config.convert_options,
File "pyarrow/_csv.pyx", line 714, in pyarrow._csv.read_csv
File "pyarrow/error.pxi", line 122, in pyarrow.lib.pyarrow_internal_check_status
File "pyarrow/error.pxi", line 84, in pyarrow.lib.check_status
```
**pyarrow.lib.ArrowInvalid: straddling object straddles two block boundaries (try to increase block size?)**
It gives the same message for both 200MB, 10GB .tx files but not for 700MB file.
Can't upload due to size & copyright problem. sorry.
Huh, weird. It's fixed on my side too.
But now ```Caching processed dataset``` is taking forever - how can I disable it? Any flags? | [
-0.4925670027732849,
-0.23102402687072754,
-0.11986441910266876,
0.28360170125961304,
0.46635645627975464,
-0.0735015794634819,
0.305368036031723,
0.5961019992828369,
-0.11382582783699036,
0.04616520553827286,
-0.06241992115974426,
-0.030405322089791298,
-0.10334224998950958,
0.31017932295799255,
-0.1062139943242073,
-0.038950130343437195,
-0.22788456082344055,
0.11306402087211609,
-0.09469194710254669,
0.049916721880435944,
-0.11255110055208206,
0.11109991371631622,
-0.1209786981344223,
-0.09560258686542511,
-0.4804548919200897,
-0.08299517631530762,
0.11853118240833282,
0.2535656690597534,
-0.29201096296310425,
-0.30531421303749084,
-0.16570709645748138,
0.09658567607402802,
0.11220498383045197,
0.6015899777412415,
-0.00010376208228990436,
0.1294623464345932,
0.2131115049123764,
-0.1573348045349121,
-0.22658251225948334,
-0.0314558744430542,
0.15594887733459473,
-0.4493688642978668,
-0.18238908052444458,
-0.2179643213748932,
0.02615135908126831,
-0.06274445354938507,
-0.10828742384910583,
-0.11755962669849396,
0.26533523201942444,
0.5598003268241882,
0.34120333194732666,
0.17075856029987335,
0.13216975331306458,
-0.11296090483665466,
0.250753790140152,
-0.08724960684776306,
-0.08874448388814926,
0.08485007286071777,
0.31081804633140564,
0.026577329263091087,
-0.2564011812210083,
0.3199438154697418,
0.010172003880143166,
0.03770069405436516,
0.00031413882970809937,
-0.02406269684433937,
-0.08279385417699814,
-0.29400500655174255,
0.37119466066360474,
0.23214656114578247,
0.5224136710166931,
-0.31693607568740845,
-0.16412782669067383,
-0.32884305715560913,
-0.18244099617004395,
-0.35125598311424255,
0.22663253545761108,
0.18455395102500916,
-0.11133106052875519,
0.11612716317176819,
-0.14361807703971863,
-0.10148565471172333,
-0.20639726519584656,
-0.0293157696723938,
-0.2615340054035187,
0.10227341949939728,
-0.21058689057826996,
-0.10046204179525375,
0.25758007168769836,
-0.27024781703948975,
0.010829675942659378,
-0.10562211275100708,
-0.13078303635120392,
-0.006805417127907276,
-0.2472129911184311,
-0.08402222394943237,
0.24685075879096985,
-0.19907799363136292,
0.28894200921058655,
-0.04899824410676956,
-0.05042092502117157,
0.22476103901863098,
-0.07966753095388412,
-0.030213192105293274,
0.005493609234690666,
0.3368757665157318,
0.004112988710403442,
0.06385742127895355,
0.4085860252380371,
0.23562848567962646,
-0.3793579936027527,
-0.2320612072944641,
-0.14962677657604218,
-0.5145173668861389,
-0.029356157407164574,
-0.11771722882986069,
0.01687188819050789,
-0.045236922800540924,
-0.12102539837360382,
0.1521078199148178,
0.1642943024635315,
0.15479476749897003,
0.10596621781587601,
0.4816173017024994,
0.10491445660591125,
0.2937651574611664,
-0.164946049451828,
0.17703935503959656,
-0.1443265825510025,
-0.172270730137825,
-0.2492274045944214,
-0.04561186954379082,
-0.057916440069675446,
-0.09268886595964432,
0.2676639258861542,
0.13385112583637238,
0.2967093586921692,
-0.13958050310611725,
0.19085338711738586,
-0.10901589691638947,
0.11681430041790009,
-0.5029687881469727,
0.14769625663757324,
0.1410786211490631,
-0.0354771725833416,
0.16869360208511353,
0.22878293693065643,
-0.17886953055858612,
-0.10239109396934509,
0.050235599279403687,
-0.10356039553880692,
-0.29712870717048645,
0.1772405207157135,
0.3213210701942444,
0.13477429747581482,
-0.003003045916557312,
-0.018904902040958405,
0.2770770192146301,
0.3757719397544861,
-0.21763959527015686,
0.028100714087486267,
-0.177321657538414,
-0.2569279670715332,
-0.1258028894662857,
0.2650003433227539,
0.43938207626342773,
-0.42506060004234314,
0.20901402831077576,
0.06901604682207108,
0.1223086565732956,
0.08902444690465927,
0.3739468455314636,
-0.06507308781147003,
0.31435954570770264,
-0.11457157880067825,
0.2009439319372177,
0.3094799518585205,
-0.2855849862098694,
-0.5090751051902771,
0.5406067967414856,
-0.18592986464500427,
-0.11818693578243256,
0.09925701469182968,
-0.044451307505369186,
0.10349185764789581,
0.13587255775928497,
0.30473989248275757,
0.27934038639068604,
0.011319583281874657,
0.26673009991645813,
-0.26045045256614685,
-0.08325029164552689,
-0.050114214420318604,
0.15593983232975006,
0.3121376931667328,
-0.20806992053985596,
0.1951688975095749,
-0.017231537029147148,
0.1943761706352234,
-0.044446270912885666,
0.21288302540779114,
0.5059319138526917,
0.12715761363506317,
-0.007840372622013092,
-0.01236867904663086,
-0.2239851951599121,
0.0316573791205883,
0.1751382052898407,
0.12100903689861298,
0.08430736511945724,
-0.2666850686073303,
-0.08223278820514679,
-0.30924513936042786,
-0.134145587682724,
-0.2703465223312378,
-0.1933860182762146,
0.28360530734062195,
0.08132393658161163,
-0.011476056650280952,
0.25513970851898193,
-0.016701530665159225,
0.025312982499599457,
-0.1602134257555008,
-0.0655839741230011,
-0.012096773833036423,
-0.0018736571073532104,
-0.09108380228281021,
-0.2782086431980133,
0.12294897437095642,
0.11027294397354126,
-0.041142746806144714,
-0.061668265610933304,
-0.1109171137213707,
0.3928831219673157,
-0.0020209033973515034,
-0.08106143772602081,
-0.036070093512535095,
-0.03006117045879364,
0.1020016148686409,
-0.0952065959572792,
0.07194626331329346,
0.0007551498711109161,
0.13880528509616852,
-0.10531303286552429,
-0.18016177415847778,
0.3006141483783722,
-0.13981524109840393,
0.20316290855407715,
0.3438575267791748,
-0.20907394587993622,
0.2556621730327606,
-0.06635111570358276,
0.22766588628292084,
-0.1381169557571411,
0.2406681329011917,
0.0831318348646164,
0.13632160425186157,
-0.0013490226119756699,
-0.2719841003417969,
-0.012743011116981506,
0.689583957195282,
0.17106518149375916,
0.09289268404245377,
0.1747955083847046,
-0.24533984065055847,
-0.017957307398319244,
-0.2034236490726471,
0.1299688071012497,
0.3976373076438904,
0.2744441032409668,
0.2679811418056488,
0.03577557951211929,
0.18700522184371948,
-0.37400296330451965,
0.13971075415611267,
0.00324847549200058,
0.011184905655682087,
0.5398926734924316,
0.2758920192718506,
-0.12958043813705444,
-0.4534207582473755,
-0.15636895596981049,
0.10577581822872162,
0.3134024739265442,
-0.08958758413791656,
0.019882122054696083,
-0.21556280553340912,
-0.2920286953449249,
-0.2959759533405304,
0.21032747626304626,
-0.2627323269844055,
-0.22531758248806,
0.0694885328412056,
0.001854587346315384,
-0.00965346023440361,
0.09686631709337234,
0.059420328587293625,
0.14542452991008759,
0.3997488021850586,
-0.19882483780384064,
-0.06151032820343971,
-0.2715905010700226,
-0.1730494201183319,
0.1567440927028656,
0.24218787252902985,
-0.01231520064175129,
0.10664252936840057,
-0.1534675806760788,
-0.10159619897603989,
0.003862651064991951,
-0.28537610173225403,
0.0006909370422363281,
-0.029189959168434143,
0.1006607785820961,
-0.05716460943222046,
0.2626273036003113,
0.1662752330303192,
0.07698307931423187,
0.3128008246421814,
-0.12974913418293,
-0.0807747021317482,
0.22336417436599731,
0.09067574143409729,
-0.06526526808738708,
-0.17057353258132935,
-0.4048938751220703,
-0.15303708612918854,
-0.6100062131881714,
0.3575114607810974,
0.09556648135185242,
0.038003552705049515,
0.40225842595100403,
0.3181685507297516,
0.2154986411333084,
-0.02120117098093033,
0.21249309182167053,
0.10026468336582184,
-0.19501852989196777,
0.2925727367401123,
-0.2248302549123764,
-0.3832399547100067,
-0.0998249500989914,
0.16060329973697662,
0.16261537373065948,
0.0072623370215296745,
-0.523443341255188,
0.030241087079048157,
-0.43688228726387024,
0.16236768662929535,
-0.06379617750644684,
0.1686919629573822,
0.08140815794467926,
-0.068488709628582,
-0.2522607743740082,
-0.08427543938159943,
0.08302126824855804,
0.04674498364329338,
-0.0724341943860054,
0.0489533469080925,
-0.1854184865951538,
0.41218438744544983,
0.24029558897018433,
0.4626798629760742,
0.16378207504749298,
0.08145051449537277,
0.3938988149166107,
-0.12170656770467758,
0.42712289094924927,
-0.353285551071167,
-0.3265115022659302,
0.1239759549498558,
-0.09124578535556793,
-0.03290253505110741,
0.2716790437698364,
0.08628013730049133,
0.26993563771247864,
-0.08009670674800873,
-0.21920713782310486,
0.08489612489938736,
-0.27935341000556946,
0.2020106166601181,
-0.1586160659790039,
0.158182293176651,
-0.13573935627937317,
-0.024103175848722458,
-0.07673823833465576,
-0.13111597299575806,
-0.03386951982975006,
0.18008708953857422,
-0.24061143398284912,
-0.025057753548026085,
-0.34338465332984924,
0.06488210707902908,
-0.4402943253517151,
0.11626070737838745,
-0.0008667679503560066,
0.33177903294563293,
-0.16607806086540222,
-0.15486931800842285,
-0.10844495892524719,
-0.15747174620628357,
0.558742344379425,
-0.07002851366996765,
0.050007011741399765,
0.06284362077713013,
-0.09194844961166382,
-0.3191089332103729,
0.16093701124191284,
-0.27350154519081116,
0.15883025527000427,
0.3647179901599884,
0.5645073652267456,
-0.3012341260910034,
-0.05097787827253342,
-0.03999730199575424,
0.3442743122577667,
0.016783621162176132,
-0.03344845771789551,
-0.2761994004249573,
-0.17115014791488647,
-0.479754775762558,
0.13883376121520996,
0.2979472875595093,
0.28462928533554077,
-0.2693779766559601,
0.07181067764759064,
0.006769764237105846,
-0.24167132377624512,
0.21428701281547546,
0.004094982519745827,
0.1445523202419281,
-0.0965576246380806,
0.22559228539466858,
-0.11081492900848389,
0.1980491578578949,
0.1853601634502411,
0.5712106227874756,
-0.03319813683629036,
-0.18376705050468445,
-0.10033683478832245,
-0.19775772094726562,
0.35022130608558655,
0.32108274102211,
-0.12260875850915909,
0.2475552260875702,
-0.04689199477434158,
0.20478081703186035,
0.016252687200903893,
0.37144094705581665,
0.2987755239009857,
-0.0353546105325222,
-0.2595382034778595,
-0.2792068123817444,
0.11155571788549423,
-0.08455014228820801,
0.18670086562633514,
0.14084039628505707,
-0.3193206787109375,
-0.25578510761260986,
0.08038311451673508,
-0.31555503606796265,
0.581957995891571,
0.09366241097450256,
0.3404352366924286,
-0.05666738748550415,
0.1961900144815445,
0.06290748715400696,
-0.5295384526252747,
0.2434755116701126,
-0.33936843276023865,
-0.2687772810459137,
0.08404745161533356,
-0.001982681453227997,
0.08260998129844666,
0.1538456678390503,
-0.270569771528244,
0.09973536431789398,
0.11994169652462006,
0.10925504565238953,
-0.2874218225479126,
0.3836098313331604,
-0.40400704741477966,
-0.120232954621315,
-0.31708869338035583,
0.18089659512043,
0.03846214711666107,
-0.15849192440509796,
-0.012326336465775967,
-0.11951793730258942,
0.020361650735139847,
-0.2523367404937744,
-0.14524796605110168,
-0.04931566119194031,
-0.41980400681495667,
0.18225449323654175,
0.039506085216999054,
-0.33519911766052246,
0.24350827932357788,
0.17777115106582642,
0.07175565510988235,
0.45078524947166443,
-0.23751425743103027,
0.17865891754627228,
0.011979680508375168,
-0.027082400396466255,
0.15663877129554749,
-0.002052192110568285,
0.3159703314304352,
-0.012490535154938698,
-0.22674140334129333,
0.09105018526315689,
-0.02672802284359932,
0.10022516548633575,
-0.02117358148097992,
0.005435124039649963,
-0.04170331358909607,
-0.3602181375026703,
-0.24734868109226227,
-0.12215757369995117,
-0.24486114084720612,
-0.30070412158966064,
0.22550034523010254,
-0.05333781987428665,
-0.05440139025449753,
0.16801418364048004,
0.07098978757858276,
-0.3310469686985016,
-0.16335467994213104,
0.32585275173187256,
-0.19543474912643433,
0.17897029221057892,
0.5283613801002502,
0.3944675922393799,
-0.2252093255519867,
-0.32895269989967346,
0.3111717402935028,
-0.02889079600572586,
-0.3540939688682556,
0.27591240406036377,
0.027021314948797226,
-0.06967999786138535,
0.12655551731586456,
0.2427477389574051,
-0.14057697355747223,
-0.3056276738643646,
-0.12778893113136292,
-0.23810873925685883,
-0.43041083216667175,
0.07364131510257721,
-0.014685843139886856,
0.14289841055870056,
-0.012018360197544098,
0.21348373591899872,
0.11327877640724182,
0.21397390961647034,
-0.4020756185054779,
0.14234788715839386,
-0.17718617618083954,
0.09960086643695831,
0.09315408766269684,
-0.13554859161376953,
0.1392204463481903,
0.051814910024404526,
0.11126954853534698,
0.2546558380126953,
-0.07314927130937576,
-0.3498375415802002,
-0.11043192446231842,
0.08029373735189438,
0.04296475276350975,
-0.12139826267957687,
-0.018652942031621933,
-0.3757631778717041,
-0.25712159276008606,
-0.2619505524635315,
0.20553825795650482,
-0.05955670028924942,
-0.10602714121341705,
0.17889057099819183,
-0.14844489097595215,
-0.05947142094373703,
0.11627981066703796,
-0.030737467110157013,
-0.2113562822341919,
0.11350301653146744,
0.17233796417713165,
0.03541186824440956,
0.007398670539259911,
0.0013167411088943481,
-0.31594744324684143,
0.0826844722032547,
0.1583465337753296,
-0.07415562123060226,
0.3244626820087433,
-0.37572717666625977,
-0.05665460228919983,
0.17693735659122467,
0.3609246015548706,
0.41158416867256165,
-0.2069200575351715,
-0.02834312990307808,
0.24290448427200317,
0.29815369844436646,
-0.25329941511154175,
-0.10016856342554092,
0.09493423998355865,
-0.27480506896972656,
0.30034834146499634,
0.12265083938837051,
0.10554638504981995,
-0.08647502958774567,
-0.10739181935787201,
0.22338134050369263,
0.1748349517583847,
-0.0378282368183136,
-0.14958788454532623,
0.34078478813171387,
0.11782075464725494,
-0.04993074759840965,
0.3016178011894226,
0.18213890492916107,
0.301396906375885,
0.7971210479736328,
0.07851167023181915,
0.25384676456451416,
-0.21107330918312073,
-0.09380136430263519,
-0.13657546043395996,
-0.4474603831768036,
0.022837109863758087,
-0.08015626668930054,
-0.03529869019985199,
-0.12467657774686813,
-0.20569443702697754,
0.20495110750198364,
-0.015431790612637997,
0.22015485167503357,
-0.14909659326076508,
0.043684691190719604,
-0.24865233898162842,
-0.1612086296081543,
0.04362469166517258,
-0.3107735514640808,
-0.0689435601234436,
0.10619263350963593,
-0.10688285529613495,
0.3263958692550659,
0.12429416179656982,
0.06238064542412758,
0.10222384333610535,
-0.4294131398200989,
0.20355626940727234,
-0.06269001960754395,
0.08767058700323105,
-0.362539142370224,
0.28398585319519043,
0.26131293177604675,
0.18963372707366943,
0.15717817842960358,
0.19094763696193695,
0.5729643702507019,
0.39447149634361267,
-0.13633108139038086,
-0.08099353313446045,
-0.27559906244277954,
-0.1103980764746666,
-0.4154096245765686,
0.28591975569725037,
0.19795739650726318,
0.3553822636604309,
0.46433591842651367,
0.20754824578762054,
-0.26809021830558777,
-0.06607875227928162,
0.1920684427022934,
-0.2637651860713959,
-0.2234545648097992,
0.10479047149419785,
0.06799925118684769,
-0.28635135293006897,
-0.3225554823875427,
-0.018377088010311127,
-0.43382272124290466,
-0.004564874805510044,
0.5934925079345703,
-0.11358815431594849,
0.309125691652298,
-0.3395165205001831,
0.14480556547641754,
0.0051999278366565704,
0.60579913854599,
0.295389324426651,
-0.017811313271522522,
-0.2954344153404236,
-0.019515685737133026,
-0.6181399822235107,
0.1262810379266739,
-0.1511761099100113,
0.012333894148468971,
-0.011653732508420944,
0.14253626763820648,
0.17389264702796936,
-0.03305090218782425,
-0.0051005929708480835,
0.03629682958126068,
-0.1498091071844101,
-0.10970120131969452,
-0.3313083350658417,
-0.2676610052585602,
-0.2250266820192337,
0.1569494754076004,
-0.0014629364013671875,
-0.3760659694671631,
0.15508276224136353,
-0.0955091044306755,
0.23003354668617249,
-0.17938651144504547,
0.0802161693572998,
-0.020627746358513832,
-0.035598188638687134,
0.15784423053264618,
0.03406703844666481,
0.3657599985599518,
-0.2838608920574188,
0.03404554724693298,
-0.13461974263191223,
-0.06317558884620667,
-0.17006678879261017,
0.1941983699798584,
0.2527383267879486,
0.26540833711624146,
-0.09622174501419067,
-0.17070834338665009,
-0.13808800280094147,
0.15670296549797058,
0.05871815234422684,
0.03713503107428551,
0.14296384155750275,
-0.05074285715818405,
0.1262890100479126,
0.05871701240539551,
0.18636725842952728,
0.4029746949672699,
-0.11137630045413971,
-0.034302711486816406,
-0.3506343960762024,
-0.5414938926696777,
0.2185375988483429,
-0.11808157712221146,
-0.5158481001853943,
0.010307740420103073,
0.13004052639007568,
0.18110820651054382,
0.0267860759049654,
-0.5836288928985596,
0.30677682161331177,
0.30969324707984924,
0.133999302983284,
-0.35290077328681946,
0.2580335736274719,
-0.05051710084080696,
0.05834290757775307,
0.011916577816009521,
0.12013280391693115,
0.024264071136713028,
-0.27022451162338257,
-0.2056572139263153,
-0.03220142796635628
] |
https://github.com/huggingface/datasets/issues/630 | Text dataset not working with large files | Right after `Caching processed dataset`, your function is applied to the dataset and there's a progress bar that shows how much time is left. How much time does it take for you ?
Also caching isn't supposed to slow down your processing. But if you still want to disable it you can do `.map(..., load_from_cache_file=False)` | ```
Traceback (most recent call last):
File "examples/language-modeling/run_language_modeling.py", line 333, in <module>
main()
File "examples/language-modeling/run_language_modeling.py", line 262, in main
get_dataset(data_args, tokenizer=tokenizer, cache_dir=model_args.cache_dir) if training_args.do_train else None
File "examples/language-modeling/run_language_modeling.py", line 144, in get_dataset
dataset = load_dataset("text", data_files=file_path, split='train+test')
File "/home/ksjae/.local/lib/python3.7/site-packages/datasets/load.py", line 611, in load_dataset
ignore_verifications=ignore_verifications,
File "/home/ksjae/.local/lib/python3.7/site-packages/datasets/builder.py", line 469, in download_and_prepare
dl_manager=dl_manager, verify_infos=verify_infos, **download_and_prepare_kwargs
File "/home/ksjae/.local/lib/python3.7/site-packages/datasets/builder.py", line 546, in _download_and_prepare
self._prepare_split(split_generator, **prepare_split_kwargs)
File "/home/ksjae/.local/lib/python3.7/site-packages/datasets/builder.py", line 888, in _prepare_split
for key, table in utils.tqdm(generator, unit=" tables", leave=False, disable=not_verbose):
File "/home/ksjae/.local/lib/python3.7/site-packages/tqdm/std.py", line 1129, in __iter__
for obj in iterable:
File "/home/ksjae/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py", line 104, in _generate_tables
convert_options=self.config.convert_options,
File "pyarrow/_csv.pyx", line 714, in pyarrow._csv.read_csv
File "pyarrow/error.pxi", line 122, in pyarrow.lib.pyarrow_internal_check_status
File "pyarrow/error.pxi", line 84, in pyarrow.lib.check_status
```
**pyarrow.lib.ArrowInvalid: straddling object straddles two block boundaries (try to increase block size?)**
It gives the same message for both 200MB, 10GB .tx files but not for 700MB file.
Can't upload due to size & copyright problem. sorry. | 55 | Text dataset not working with large files
```
Traceback (most recent call last):
File "examples/language-modeling/run_language_modeling.py", line 333, in <module>
main()
File "examples/language-modeling/run_language_modeling.py", line 262, in main
get_dataset(data_args, tokenizer=tokenizer, cache_dir=model_args.cache_dir) if training_args.do_train else None
File "examples/language-modeling/run_language_modeling.py", line 144, in get_dataset
dataset = load_dataset("text", data_files=file_path, split='train+test')
File "/home/ksjae/.local/lib/python3.7/site-packages/datasets/load.py", line 611, in load_dataset
ignore_verifications=ignore_verifications,
File "/home/ksjae/.local/lib/python3.7/site-packages/datasets/builder.py", line 469, in download_and_prepare
dl_manager=dl_manager, verify_infos=verify_infos, **download_and_prepare_kwargs
File "/home/ksjae/.local/lib/python3.7/site-packages/datasets/builder.py", line 546, in _download_and_prepare
self._prepare_split(split_generator, **prepare_split_kwargs)
File "/home/ksjae/.local/lib/python3.7/site-packages/datasets/builder.py", line 888, in _prepare_split
for key, table in utils.tqdm(generator, unit=" tables", leave=False, disable=not_verbose):
File "/home/ksjae/.local/lib/python3.7/site-packages/tqdm/std.py", line 1129, in __iter__
for obj in iterable:
File "/home/ksjae/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py", line 104, in _generate_tables
convert_options=self.config.convert_options,
File "pyarrow/_csv.pyx", line 714, in pyarrow._csv.read_csv
File "pyarrow/error.pxi", line 122, in pyarrow.lib.pyarrow_internal_check_status
File "pyarrow/error.pxi", line 84, in pyarrow.lib.check_status
```
**pyarrow.lib.ArrowInvalid: straddling object straddles two block boundaries (try to increase block size?)**
It gives the same message for both 200MB, 10GB .tx files but not for 700MB file.
Can't upload due to size & copyright problem. sorry.
Right after `Caching processed dataset`, your function is applied to the dataset and there's a progress bar that shows how much time is left. How much time does it take for you ?
Also caching isn't supposed to slow down your processing. But if you still want to disable it you can do `.map(..., load_from_cache_file=False)` | [
-0.4925670027732849,
-0.23102402687072754,
-0.11986441910266876,
0.28360170125961304,
0.46635645627975464,
-0.0735015794634819,
0.305368036031723,
0.5961019992828369,
-0.11382582783699036,
0.04616520553827286,
-0.06241992115974426,
-0.030405322089791298,
-0.10334224998950958,
0.31017932295799255,
-0.1062139943242073,
-0.038950130343437195,
-0.22788456082344055,
0.11306402087211609,
-0.09469194710254669,
0.049916721880435944,
-0.11255110055208206,
0.11109991371631622,
-0.1209786981344223,
-0.09560258686542511,
-0.4804548919200897,
-0.08299517631530762,
0.11853118240833282,
0.2535656690597534,
-0.29201096296310425,
-0.30531421303749084,
-0.16570709645748138,
0.09658567607402802,
0.11220498383045197,
0.6015899777412415,
-0.00010376208228990436,
0.1294623464345932,
0.2131115049123764,
-0.1573348045349121,
-0.22658251225948334,
-0.0314558744430542,
0.15594887733459473,
-0.4493688642978668,
-0.18238908052444458,
-0.2179643213748932,
0.02615135908126831,
-0.06274445354938507,
-0.10828742384910583,
-0.11755962669849396,
0.26533523201942444,
0.5598003268241882,
0.34120333194732666,
0.17075856029987335,
0.13216975331306458,
-0.11296090483665466,
0.250753790140152,
-0.08724960684776306,
-0.08874448388814926,
0.08485007286071777,
0.31081804633140564,
0.026577329263091087,
-0.2564011812210083,
0.3199438154697418,
0.010172003880143166,
0.03770069405436516,
0.00031413882970809937,
-0.02406269684433937,
-0.08279385417699814,
-0.29400500655174255,
0.37119466066360474,
0.23214656114578247,
0.5224136710166931,
-0.31693607568740845,
-0.16412782669067383,
-0.32884305715560913,
-0.18244099617004395,
-0.35125598311424255,
0.22663253545761108,
0.18455395102500916,
-0.11133106052875519,
0.11612716317176819,
-0.14361807703971863,
-0.10148565471172333,
-0.20639726519584656,
-0.0293157696723938,
-0.2615340054035187,
0.10227341949939728,
-0.21058689057826996,
-0.10046204179525375,
0.25758007168769836,
-0.27024781703948975,
0.010829675942659378,
-0.10562211275100708,
-0.13078303635120392,
-0.006805417127907276,
-0.2472129911184311,
-0.08402222394943237,
0.24685075879096985,
-0.19907799363136292,
0.28894200921058655,
-0.04899824410676956,
-0.05042092502117157,
0.22476103901863098,
-0.07966753095388412,
-0.030213192105293274,
0.005493609234690666,
0.3368757665157318,
0.004112988710403442,
0.06385742127895355,
0.4085860252380371,
0.23562848567962646,
-0.3793579936027527,
-0.2320612072944641,
-0.14962677657604218,
-0.5145173668861389,
-0.029356157407164574,
-0.11771722882986069,
0.01687188819050789,
-0.045236922800540924,
-0.12102539837360382,
0.1521078199148178,
0.1642943024635315,
0.15479476749897003,
0.10596621781587601,
0.4816173017024994,
0.10491445660591125,
0.2937651574611664,
-0.164946049451828,
0.17703935503959656,
-0.1443265825510025,
-0.172270730137825,
-0.2492274045944214,
-0.04561186954379082,
-0.057916440069675446,
-0.09268886595964432,
0.2676639258861542,
0.13385112583637238,
0.2967093586921692,
-0.13958050310611725,
0.19085338711738586,
-0.10901589691638947,
0.11681430041790009,
-0.5029687881469727,
0.14769625663757324,
0.1410786211490631,
-0.0354771725833416,
0.16869360208511353,
0.22878293693065643,
-0.17886953055858612,
-0.10239109396934509,
0.050235599279403687,
-0.10356039553880692,
-0.29712870717048645,
0.1772405207157135,
0.3213210701942444,
0.13477429747581482,
-0.003003045916557312,
-0.018904902040958405,
0.2770770192146301,
0.3757719397544861,
-0.21763959527015686,
0.028100714087486267,
-0.177321657538414,
-0.2569279670715332,
-0.1258028894662857,
0.2650003433227539,
0.43938207626342773,
-0.42506060004234314,
0.20901402831077576,
0.06901604682207108,
0.1223086565732956,
0.08902444690465927,
0.3739468455314636,
-0.06507308781147003,
0.31435954570770264,
-0.11457157880067825,
0.2009439319372177,
0.3094799518585205,
-0.2855849862098694,
-0.5090751051902771,
0.5406067967414856,
-0.18592986464500427,
-0.11818693578243256,
0.09925701469182968,
-0.044451307505369186,
0.10349185764789581,
0.13587255775928497,
0.30473989248275757,
0.27934038639068604,
0.011319583281874657,
0.26673009991645813,
-0.26045045256614685,
-0.08325029164552689,
-0.050114214420318604,
0.15593983232975006,
0.3121376931667328,
-0.20806992053985596,
0.1951688975095749,
-0.017231537029147148,
0.1943761706352234,
-0.044446270912885666,
0.21288302540779114,
0.5059319138526917,
0.12715761363506317,
-0.007840372622013092,
-0.01236867904663086,
-0.2239851951599121,
0.0316573791205883,
0.1751382052898407,
0.12100903689861298,
0.08430736511945724,
-0.2666850686073303,
-0.08223278820514679,
-0.30924513936042786,
-0.134145587682724,
-0.2703465223312378,
-0.1933860182762146,
0.28360530734062195,
0.08132393658161163,
-0.011476056650280952,
0.25513970851898193,
-0.016701530665159225,
0.025312982499599457,
-0.1602134257555008,
-0.0655839741230011,
-0.012096773833036423,
-0.0018736571073532104,
-0.09108380228281021,
-0.2782086431980133,
0.12294897437095642,
0.11027294397354126,
-0.041142746806144714,
-0.061668265610933304,
-0.1109171137213707,
0.3928831219673157,
-0.0020209033973515034,
-0.08106143772602081,
-0.036070093512535095,
-0.03006117045879364,
0.1020016148686409,
-0.0952065959572792,
0.07194626331329346,
0.0007551498711109161,
0.13880528509616852,
-0.10531303286552429,
-0.18016177415847778,
0.3006141483783722,
-0.13981524109840393,
0.20316290855407715,
0.3438575267791748,
-0.20907394587993622,
0.2556621730327606,
-0.06635111570358276,
0.22766588628292084,
-0.1381169557571411,
0.2406681329011917,
0.0831318348646164,
0.13632160425186157,
-0.0013490226119756699,
-0.2719841003417969,
-0.012743011116981506,
0.689583957195282,
0.17106518149375916,
0.09289268404245377,
0.1747955083847046,
-0.24533984065055847,
-0.017957307398319244,
-0.2034236490726471,
0.1299688071012497,
0.3976373076438904,
0.2744441032409668,
0.2679811418056488,
0.03577557951211929,
0.18700522184371948,
-0.37400296330451965,
0.13971075415611267,
0.00324847549200058,
0.011184905655682087,
0.5398926734924316,
0.2758920192718506,
-0.12958043813705444,
-0.4534207582473755,
-0.15636895596981049,
0.10577581822872162,
0.3134024739265442,
-0.08958758413791656,
0.019882122054696083,
-0.21556280553340912,
-0.2920286953449249,
-0.2959759533405304,
0.21032747626304626,
-0.2627323269844055,
-0.22531758248806,
0.0694885328412056,
0.001854587346315384,
-0.00965346023440361,
0.09686631709337234,
0.059420328587293625,
0.14542452991008759,
0.3997488021850586,
-0.19882483780384064,
-0.06151032820343971,
-0.2715905010700226,
-0.1730494201183319,
0.1567440927028656,
0.24218787252902985,
-0.01231520064175129,
0.10664252936840057,
-0.1534675806760788,
-0.10159619897603989,
0.003862651064991951,
-0.28537610173225403,
0.0006909370422363281,
-0.029189959168434143,
0.1006607785820961,
-0.05716460943222046,
0.2626273036003113,
0.1662752330303192,
0.07698307931423187,
0.3128008246421814,
-0.12974913418293,
-0.0807747021317482,
0.22336417436599731,
0.09067574143409729,
-0.06526526808738708,
-0.17057353258132935,
-0.4048938751220703,
-0.15303708612918854,
-0.6100062131881714,
0.3575114607810974,
0.09556648135185242,
0.038003552705049515,
0.40225842595100403,
0.3181685507297516,
0.2154986411333084,
-0.02120117098093033,
0.21249309182167053,
0.10026468336582184,
-0.19501852989196777,
0.2925727367401123,
-0.2248302549123764,
-0.3832399547100067,
-0.0998249500989914,
0.16060329973697662,
0.16261537373065948,
0.0072623370215296745,
-0.523443341255188,
0.030241087079048157,
-0.43688228726387024,
0.16236768662929535,
-0.06379617750644684,
0.1686919629573822,
0.08140815794467926,
-0.068488709628582,
-0.2522607743740082,
-0.08427543938159943,
0.08302126824855804,
0.04674498364329338,
-0.0724341943860054,
0.0489533469080925,
-0.1854184865951538,
0.41218438744544983,
0.24029558897018433,
0.4626798629760742,
0.16378207504749298,
0.08145051449537277,
0.3938988149166107,
-0.12170656770467758,
0.42712289094924927,
-0.353285551071167,
-0.3265115022659302,
0.1239759549498558,
-0.09124578535556793,
-0.03290253505110741,
0.2716790437698364,
0.08628013730049133,
0.26993563771247864,
-0.08009670674800873,
-0.21920713782310486,
0.08489612489938736,
-0.27935341000556946,
0.2020106166601181,
-0.1586160659790039,
0.158182293176651,
-0.13573935627937317,
-0.024103175848722458,
-0.07673823833465576,
-0.13111597299575806,
-0.03386951982975006,
0.18008708953857422,
-0.24061143398284912,
-0.025057753548026085,
-0.34338465332984924,
0.06488210707902908,
-0.4402943253517151,
0.11626070737838745,
-0.0008667679503560066,
0.33177903294563293,
-0.16607806086540222,
-0.15486931800842285,
-0.10844495892524719,
-0.15747174620628357,
0.558742344379425,
-0.07002851366996765,
0.050007011741399765,
0.06284362077713013,
-0.09194844961166382,
-0.3191089332103729,
0.16093701124191284,
-0.27350154519081116,
0.15883025527000427,
0.3647179901599884,
0.5645073652267456,
-0.3012341260910034,
-0.05097787827253342,
-0.03999730199575424,
0.3442743122577667,
0.016783621162176132,
-0.03344845771789551,
-0.2761994004249573,
-0.17115014791488647,
-0.479754775762558,
0.13883376121520996,
0.2979472875595093,
0.28462928533554077,
-0.2693779766559601,
0.07181067764759064,
0.006769764237105846,
-0.24167132377624512,
0.21428701281547546,
0.004094982519745827,
0.1445523202419281,
-0.0965576246380806,
0.22559228539466858,
-0.11081492900848389,
0.1980491578578949,
0.1853601634502411,
0.5712106227874756,
-0.03319813683629036,
-0.18376705050468445,
-0.10033683478832245,
-0.19775772094726562,
0.35022130608558655,
0.32108274102211,
-0.12260875850915909,
0.2475552260875702,
-0.04689199477434158,
0.20478081703186035,
0.016252687200903893,
0.37144094705581665,
0.2987755239009857,
-0.0353546105325222,
-0.2595382034778595,
-0.2792068123817444,
0.11155571788549423,
-0.08455014228820801,
0.18670086562633514,
0.14084039628505707,
-0.3193206787109375,
-0.25578510761260986,
0.08038311451673508,
-0.31555503606796265,
0.581957995891571,
0.09366241097450256,
0.3404352366924286,
-0.05666738748550415,
0.1961900144815445,
0.06290748715400696,
-0.5295384526252747,
0.2434755116701126,
-0.33936843276023865,
-0.2687772810459137,
0.08404745161533356,
-0.001982681453227997,
0.08260998129844666,
0.1538456678390503,
-0.270569771528244,
0.09973536431789398,
0.11994169652462006,
0.10925504565238953,
-0.2874218225479126,
0.3836098313331604,
-0.40400704741477966,
-0.120232954621315,
-0.31708869338035583,
0.18089659512043,
0.03846214711666107,
-0.15849192440509796,
-0.012326336465775967,
-0.11951793730258942,
0.020361650735139847,
-0.2523367404937744,
-0.14524796605110168,
-0.04931566119194031,
-0.41980400681495667,
0.18225449323654175,
0.039506085216999054,
-0.33519911766052246,
0.24350827932357788,
0.17777115106582642,
0.07175565510988235,
0.45078524947166443,
-0.23751425743103027,
0.17865891754627228,
0.011979680508375168,
-0.027082400396466255,
0.15663877129554749,
-0.002052192110568285,
0.3159703314304352,
-0.012490535154938698,
-0.22674140334129333,
0.09105018526315689,
-0.02672802284359932,
0.10022516548633575,
-0.02117358148097992,
0.005435124039649963,
-0.04170331358909607,
-0.3602181375026703,
-0.24734868109226227,
-0.12215757369995117,
-0.24486114084720612,
-0.30070412158966064,
0.22550034523010254,
-0.05333781987428665,
-0.05440139025449753,
0.16801418364048004,
0.07098978757858276,
-0.3310469686985016,
-0.16335467994213104,
0.32585275173187256,
-0.19543474912643433,
0.17897029221057892,
0.5283613801002502,
0.3944675922393799,
-0.2252093255519867,
-0.32895269989967346,
0.3111717402935028,
-0.02889079600572586,
-0.3540939688682556,
0.27591240406036377,
0.027021314948797226,
-0.06967999786138535,
0.12655551731586456,
0.2427477389574051,
-0.14057697355747223,
-0.3056276738643646,
-0.12778893113136292,
-0.23810873925685883,
-0.43041083216667175,
0.07364131510257721,
-0.014685843139886856,
0.14289841055870056,
-0.012018360197544098,
0.21348373591899872,
0.11327877640724182,
0.21397390961647034,
-0.4020756185054779,
0.14234788715839386,
-0.17718617618083954,
0.09960086643695831,
0.09315408766269684,
-0.13554859161376953,
0.1392204463481903,
0.051814910024404526,
0.11126954853534698,
0.2546558380126953,
-0.07314927130937576,
-0.3498375415802002,
-0.11043192446231842,
0.08029373735189438,
0.04296475276350975,
-0.12139826267957687,
-0.018652942031621933,
-0.3757631778717041,
-0.25712159276008606,
-0.2619505524635315,
0.20553825795650482,
-0.05955670028924942,
-0.10602714121341705,
0.17889057099819183,
-0.14844489097595215,
-0.05947142094373703,
0.11627981066703796,
-0.030737467110157013,
-0.2113562822341919,
0.11350301653146744,
0.17233796417713165,
0.03541186824440956,
0.007398670539259911,
0.0013167411088943481,
-0.31594744324684143,
0.0826844722032547,
0.1583465337753296,
-0.07415562123060226,
0.3244626820087433,
-0.37572717666625977,
-0.05665460228919983,
0.17693735659122467,
0.3609246015548706,
0.41158416867256165,
-0.2069200575351715,
-0.02834312990307808,
0.24290448427200317,
0.29815369844436646,
-0.25329941511154175,
-0.10016856342554092,
0.09493423998355865,
-0.27480506896972656,
0.30034834146499634,
0.12265083938837051,
0.10554638504981995,
-0.08647502958774567,
-0.10739181935787201,
0.22338134050369263,
0.1748349517583847,
-0.0378282368183136,
-0.14958788454532623,
0.34078478813171387,
0.11782075464725494,
-0.04993074759840965,
0.3016178011894226,
0.18213890492916107,
0.301396906375885,
0.7971210479736328,
0.07851167023181915,
0.25384676456451416,
-0.21107330918312073,
-0.09380136430263519,
-0.13657546043395996,
-0.4474603831768036,
0.022837109863758087,
-0.08015626668930054,
-0.03529869019985199,
-0.12467657774686813,
-0.20569443702697754,
0.20495110750198364,
-0.015431790612637997,
0.22015485167503357,
-0.14909659326076508,
0.043684691190719604,
-0.24865233898162842,
-0.1612086296081543,
0.04362469166517258,
-0.3107735514640808,
-0.0689435601234436,
0.10619263350963593,
-0.10688285529613495,
0.3263958692550659,
0.12429416179656982,
0.06238064542412758,
0.10222384333610535,
-0.4294131398200989,
0.20355626940727234,
-0.06269001960754395,
0.08767058700323105,
-0.362539142370224,
0.28398585319519043,
0.26131293177604675,
0.18963372707366943,
0.15717817842960358,
0.19094763696193695,
0.5729643702507019,
0.39447149634361267,
-0.13633108139038086,
-0.08099353313446045,
-0.27559906244277954,
-0.1103980764746666,
-0.4154096245765686,
0.28591975569725037,
0.19795739650726318,
0.3553822636604309,
0.46433591842651367,
0.20754824578762054,
-0.26809021830558777,
-0.06607875227928162,
0.1920684427022934,
-0.2637651860713959,
-0.2234545648097992,
0.10479047149419785,
0.06799925118684769,
-0.28635135293006897,
-0.3225554823875427,
-0.018377088010311127,
-0.43382272124290466,
-0.004564874805510044,
0.5934925079345703,
-0.11358815431594849,
0.309125691652298,
-0.3395165205001831,
0.14480556547641754,
0.0051999278366565704,
0.60579913854599,
0.295389324426651,
-0.017811313271522522,
-0.2954344153404236,
-0.019515685737133026,
-0.6181399822235107,
0.1262810379266739,
-0.1511761099100113,
0.012333894148468971,
-0.011653732508420944,
0.14253626763820648,
0.17389264702796936,
-0.03305090218782425,
-0.0051005929708480835,
0.03629682958126068,
-0.1498091071844101,
-0.10970120131969452,
-0.3313083350658417,
-0.2676610052585602,
-0.2250266820192337,
0.1569494754076004,
-0.0014629364013671875,
-0.3760659694671631,
0.15508276224136353,
-0.0955091044306755,
0.23003354668617249,
-0.17938651144504547,
0.0802161693572998,
-0.020627746358513832,
-0.035598188638687134,
0.15784423053264618,
0.03406703844666481,
0.3657599985599518,
-0.2838608920574188,
0.03404554724693298,
-0.13461974263191223,
-0.06317558884620667,
-0.17006678879261017,
0.1941983699798584,
0.2527383267879486,
0.26540833711624146,
-0.09622174501419067,
-0.17070834338665009,
-0.13808800280094147,
0.15670296549797058,
0.05871815234422684,
0.03713503107428551,
0.14296384155750275,
-0.05074285715818405,
0.1262890100479126,
0.05871701240539551,
0.18636725842952728,
0.4029746949672699,
-0.11137630045413971,
-0.034302711486816406,
-0.3506343960762024,
-0.5414938926696777,
0.2185375988483429,
-0.11808157712221146,
-0.5158481001853943,
0.010307740420103073,
0.13004052639007568,
0.18110820651054382,
0.0267860759049654,
-0.5836288928985596,
0.30677682161331177,
0.30969324707984924,
0.133999302983284,
-0.35290077328681946,
0.2580335736274719,
-0.05051710084080696,
0.05834290757775307,
0.011916577816009521,
0.12013280391693115,
0.024264071136713028,
-0.27022451162338257,
-0.2056572139263153,
-0.03220142796635628
] |
https://github.com/huggingface/datasets/issues/630 | Text dataset not working with large files | Ah, it’s much faster now(Takes around 15~20min).
BTW, any way to set default tensor output as plain tensors with distributed training? The ragged tensors are incompatible with tpustrategy :( | ```
Traceback (most recent call last):
File "examples/language-modeling/run_language_modeling.py", line 333, in <module>
main()
File "examples/language-modeling/run_language_modeling.py", line 262, in main
get_dataset(data_args, tokenizer=tokenizer, cache_dir=model_args.cache_dir) if training_args.do_train else None
File "examples/language-modeling/run_language_modeling.py", line 144, in get_dataset
dataset = load_dataset("text", data_files=file_path, split='train+test')
File "/home/ksjae/.local/lib/python3.7/site-packages/datasets/load.py", line 611, in load_dataset
ignore_verifications=ignore_verifications,
File "/home/ksjae/.local/lib/python3.7/site-packages/datasets/builder.py", line 469, in download_and_prepare
dl_manager=dl_manager, verify_infos=verify_infos, **download_and_prepare_kwargs
File "/home/ksjae/.local/lib/python3.7/site-packages/datasets/builder.py", line 546, in _download_and_prepare
self._prepare_split(split_generator, **prepare_split_kwargs)
File "/home/ksjae/.local/lib/python3.7/site-packages/datasets/builder.py", line 888, in _prepare_split
for key, table in utils.tqdm(generator, unit=" tables", leave=False, disable=not_verbose):
File "/home/ksjae/.local/lib/python3.7/site-packages/tqdm/std.py", line 1129, in __iter__
for obj in iterable:
File "/home/ksjae/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py", line 104, in _generate_tables
convert_options=self.config.convert_options,
File "pyarrow/_csv.pyx", line 714, in pyarrow._csv.read_csv
File "pyarrow/error.pxi", line 122, in pyarrow.lib.pyarrow_internal_check_status
File "pyarrow/error.pxi", line 84, in pyarrow.lib.check_status
```
**pyarrow.lib.ArrowInvalid: straddling object straddles two block boundaries (try to increase block size?)**
It gives the same message for both 200MB, 10GB .tx files but not for 700MB file.
Can't upload due to size & copyright problem. sorry. | 29 | Text dataset not working with large files
```
Traceback (most recent call last):
File "examples/language-modeling/run_language_modeling.py", line 333, in <module>
main()
File "examples/language-modeling/run_language_modeling.py", line 262, in main
get_dataset(data_args, tokenizer=tokenizer, cache_dir=model_args.cache_dir) if training_args.do_train else None
File "examples/language-modeling/run_language_modeling.py", line 144, in get_dataset
dataset = load_dataset("text", data_files=file_path, split='train+test')
File "/home/ksjae/.local/lib/python3.7/site-packages/datasets/load.py", line 611, in load_dataset
ignore_verifications=ignore_verifications,
File "/home/ksjae/.local/lib/python3.7/site-packages/datasets/builder.py", line 469, in download_and_prepare
dl_manager=dl_manager, verify_infos=verify_infos, **download_and_prepare_kwargs
File "/home/ksjae/.local/lib/python3.7/site-packages/datasets/builder.py", line 546, in _download_and_prepare
self._prepare_split(split_generator, **prepare_split_kwargs)
File "/home/ksjae/.local/lib/python3.7/site-packages/datasets/builder.py", line 888, in _prepare_split
for key, table in utils.tqdm(generator, unit=" tables", leave=False, disable=not_verbose):
File "/home/ksjae/.local/lib/python3.7/site-packages/tqdm/std.py", line 1129, in __iter__
for obj in iterable:
File "/home/ksjae/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py", line 104, in _generate_tables
convert_options=self.config.convert_options,
File "pyarrow/_csv.pyx", line 714, in pyarrow._csv.read_csv
File "pyarrow/error.pxi", line 122, in pyarrow.lib.pyarrow_internal_check_status
File "pyarrow/error.pxi", line 84, in pyarrow.lib.check_status
```
**pyarrow.lib.ArrowInvalid: straddling object straddles two block boundaries (try to increase block size?)**
It gives the same message for both 200MB, 10GB .tx files but not for 700MB file.
Can't upload due to size & copyright problem. sorry.
Ah, it’s much faster now(Takes around 15~20min).
BTW, any way to set default tensor output as plain tensors with distributed training? The ragged tensors are incompatible with tpustrategy :( | [
-0.4925670027732849,
-0.23102402687072754,
-0.11986441910266876,
0.28360170125961304,
0.46635645627975464,
-0.0735015794634819,
0.305368036031723,
0.5961019992828369,
-0.11382582783699036,
0.04616520553827286,
-0.06241992115974426,
-0.030405322089791298,
-0.10334224998950958,
0.31017932295799255,
-0.1062139943242073,
-0.038950130343437195,
-0.22788456082344055,
0.11306402087211609,
-0.09469194710254669,
0.049916721880435944,
-0.11255110055208206,
0.11109991371631622,
-0.1209786981344223,
-0.09560258686542511,
-0.4804548919200897,
-0.08299517631530762,
0.11853118240833282,
0.2535656690597534,
-0.29201096296310425,
-0.30531421303749084,
-0.16570709645748138,
0.09658567607402802,
0.11220498383045197,
0.6015899777412415,
-0.00010376208228990436,
0.1294623464345932,
0.2131115049123764,
-0.1573348045349121,
-0.22658251225948334,
-0.0314558744430542,
0.15594887733459473,
-0.4493688642978668,
-0.18238908052444458,
-0.2179643213748932,
0.02615135908126831,
-0.06274445354938507,
-0.10828742384910583,
-0.11755962669849396,
0.26533523201942444,
0.5598003268241882,
0.34120333194732666,
0.17075856029987335,
0.13216975331306458,
-0.11296090483665466,
0.250753790140152,
-0.08724960684776306,
-0.08874448388814926,
0.08485007286071777,
0.31081804633140564,
0.026577329263091087,
-0.2564011812210083,
0.3199438154697418,
0.010172003880143166,
0.03770069405436516,
0.00031413882970809937,
-0.02406269684433937,
-0.08279385417699814,
-0.29400500655174255,
0.37119466066360474,
0.23214656114578247,
0.5224136710166931,
-0.31693607568740845,
-0.16412782669067383,
-0.32884305715560913,
-0.18244099617004395,
-0.35125598311424255,
0.22663253545761108,
0.18455395102500916,
-0.11133106052875519,
0.11612716317176819,
-0.14361807703971863,
-0.10148565471172333,
-0.20639726519584656,
-0.0293157696723938,
-0.2615340054035187,
0.10227341949939728,
-0.21058689057826996,
-0.10046204179525375,
0.25758007168769836,
-0.27024781703948975,
0.010829675942659378,
-0.10562211275100708,
-0.13078303635120392,
-0.006805417127907276,
-0.2472129911184311,
-0.08402222394943237,
0.24685075879096985,
-0.19907799363136292,
0.28894200921058655,
-0.04899824410676956,
-0.05042092502117157,
0.22476103901863098,
-0.07966753095388412,
-0.030213192105293274,
0.005493609234690666,
0.3368757665157318,
0.004112988710403442,
0.06385742127895355,
0.4085860252380371,
0.23562848567962646,
-0.3793579936027527,
-0.2320612072944641,
-0.14962677657604218,
-0.5145173668861389,
-0.029356157407164574,
-0.11771722882986069,
0.01687188819050789,
-0.045236922800540924,
-0.12102539837360382,
0.1521078199148178,
0.1642943024635315,
0.15479476749897003,
0.10596621781587601,
0.4816173017024994,
0.10491445660591125,
0.2937651574611664,
-0.164946049451828,
0.17703935503959656,
-0.1443265825510025,
-0.172270730137825,
-0.2492274045944214,
-0.04561186954379082,
-0.057916440069675446,
-0.09268886595964432,
0.2676639258861542,
0.13385112583637238,
0.2967093586921692,
-0.13958050310611725,
0.19085338711738586,
-0.10901589691638947,
0.11681430041790009,
-0.5029687881469727,
0.14769625663757324,
0.1410786211490631,
-0.0354771725833416,
0.16869360208511353,
0.22878293693065643,
-0.17886953055858612,
-0.10239109396934509,
0.050235599279403687,
-0.10356039553880692,
-0.29712870717048645,
0.1772405207157135,
0.3213210701942444,
0.13477429747581482,
-0.003003045916557312,
-0.018904902040958405,
0.2770770192146301,
0.3757719397544861,
-0.21763959527015686,
0.028100714087486267,
-0.177321657538414,
-0.2569279670715332,
-0.1258028894662857,
0.2650003433227539,
0.43938207626342773,
-0.42506060004234314,
0.20901402831077576,
0.06901604682207108,
0.1223086565732956,
0.08902444690465927,
0.3739468455314636,
-0.06507308781147003,
0.31435954570770264,
-0.11457157880067825,
0.2009439319372177,
0.3094799518585205,
-0.2855849862098694,
-0.5090751051902771,
0.5406067967414856,
-0.18592986464500427,
-0.11818693578243256,
0.09925701469182968,
-0.044451307505369186,
0.10349185764789581,
0.13587255775928497,
0.30473989248275757,
0.27934038639068604,
0.011319583281874657,
0.26673009991645813,
-0.26045045256614685,
-0.08325029164552689,
-0.050114214420318604,
0.15593983232975006,
0.3121376931667328,
-0.20806992053985596,
0.1951688975095749,
-0.017231537029147148,
0.1943761706352234,
-0.044446270912885666,
0.21288302540779114,
0.5059319138526917,
0.12715761363506317,
-0.007840372622013092,
-0.01236867904663086,
-0.2239851951599121,
0.0316573791205883,
0.1751382052898407,
0.12100903689861298,
0.08430736511945724,
-0.2666850686073303,
-0.08223278820514679,
-0.30924513936042786,
-0.134145587682724,
-0.2703465223312378,
-0.1933860182762146,
0.28360530734062195,
0.08132393658161163,
-0.011476056650280952,
0.25513970851898193,
-0.016701530665159225,
0.025312982499599457,
-0.1602134257555008,
-0.0655839741230011,
-0.012096773833036423,
-0.0018736571073532104,
-0.09108380228281021,
-0.2782086431980133,
0.12294897437095642,
0.11027294397354126,
-0.041142746806144714,
-0.061668265610933304,
-0.1109171137213707,
0.3928831219673157,
-0.0020209033973515034,
-0.08106143772602081,
-0.036070093512535095,
-0.03006117045879364,
0.1020016148686409,
-0.0952065959572792,
0.07194626331329346,
0.0007551498711109161,
0.13880528509616852,
-0.10531303286552429,
-0.18016177415847778,
0.3006141483783722,
-0.13981524109840393,
0.20316290855407715,
0.3438575267791748,
-0.20907394587993622,
0.2556621730327606,
-0.06635111570358276,
0.22766588628292084,
-0.1381169557571411,
0.2406681329011917,
0.0831318348646164,
0.13632160425186157,
-0.0013490226119756699,
-0.2719841003417969,
-0.012743011116981506,
0.689583957195282,
0.17106518149375916,
0.09289268404245377,
0.1747955083847046,
-0.24533984065055847,
-0.017957307398319244,
-0.2034236490726471,
0.1299688071012497,
0.3976373076438904,
0.2744441032409668,
0.2679811418056488,
0.03577557951211929,
0.18700522184371948,
-0.37400296330451965,
0.13971075415611267,
0.00324847549200058,
0.011184905655682087,
0.5398926734924316,
0.2758920192718506,
-0.12958043813705444,
-0.4534207582473755,
-0.15636895596981049,
0.10577581822872162,
0.3134024739265442,
-0.08958758413791656,
0.019882122054696083,
-0.21556280553340912,
-0.2920286953449249,
-0.2959759533405304,
0.21032747626304626,
-0.2627323269844055,
-0.22531758248806,
0.0694885328412056,
0.001854587346315384,
-0.00965346023440361,
0.09686631709337234,
0.059420328587293625,
0.14542452991008759,
0.3997488021850586,
-0.19882483780384064,
-0.06151032820343971,
-0.2715905010700226,
-0.1730494201183319,
0.1567440927028656,
0.24218787252902985,
-0.01231520064175129,
0.10664252936840057,
-0.1534675806760788,
-0.10159619897603989,
0.003862651064991951,
-0.28537610173225403,
0.0006909370422363281,
-0.029189959168434143,
0.1006607785820961,
-0.05716460943222046,
0.2626273036003113,
0.1662752330303192,
0.07698307931423187,
0.3128008246421814,
-0.12974913418293,
-0.0807747021317482,
0.22336417436599731,
0.09067574143409729,
-0.06526526808738708,
-0.17057353258132935,
-0.4048938751220703,
-0.15303708612918854,
-0.6100062131881714,
0.3575114607810974,
0.09556648135185242,
0.038003552705049515,
0.40225842595100403,
0.3181685507297516,
0.2154986411333084,
-0.02120117098093033,
0.21249309182167053,
0.10026468336582184,
-0.19501852989196777,
0.2925727367401123,
-0.2248302549123764,
-0.3832399547100067,
-0.0998249500989914,
0.16060329973697662,
0.16261537373065948,
0.0072623370215296745,
-0.523443341255188,
0.030241087079048157,
-0.43688228726387024,
0.16236768662929535,
-0.06379617750644684,
0.1686919629573822,
0.08140815794467926,
-0.068488709628582,
-0.2522607743740082,
-0.08427543938159943,
0.08302126824855804,
0.04674498364329338,
-0.0724341943860054,
0.0489533469080925,
-0.1854184865951538,
0.41218438744544983,
0.24029558897018433,
0.4626798629760742,
0.16378207504749298,
0.08145051449537277,
0.3938988149166107,
-0.12170656770467758,
0.42712289094924927,
-0.353285551071167,
-0.3265115022659302,
0.1239759549498558,
-0.09124578535556793,
-0.03290253505110741,
0.2716790437698364,
0.08628013730049133,
0.26993563771247864,
-0.08009670674800873,
-0.21920713782310486,
0.08489612489938736,
-0.27935341000556946,
0.2020106166601181,
-0.1586160659790039,
0.158182293176651,
-0.13573935627937317,
-0.024103175848722458,
-0.07673823833465576,
-0.13111597299575806,
-0.03386951982975006,
0.18008708953857422,
-0.24061143398284912,
-0.025057753548026085,
-0.34338465332984924,
0.06488210707902908,
-0.4402943253517151,
0.11626070737838745,
-0.0008667679503560066,
0.33177903294563293,
-0.16607806086540222,
-0.15486931800842285,
-0.10844495892524719,
-0.15747174620628357,
0.558742344379425,
-0.07002851366996765,
0.050007011741399765,
0.06284362077713013,
-0.09194844961166382,
-0.3191089332103729,
0.16093701124191284,
-0.27350154519081116,
0.15883025527000427,
0.3647179901599884,
0.5645073652267456,
-0.3012341260910034,
-0.05097787827253342,
-0.03999730199575424,
0.3442743122577667,
0.016783621162176132,
-0.03344845771789551,
-0.2761994004249573,
-0.17115014791488647,
-0.479754775762558,
0.13883376121520996,
0.2979472875595093,
0.28462928533554077,
-0.2693779766559601,
0.07181067764759064,
0.006769764237105846,
-0.24167132377624512,
0.21428701281547546,
0.004094982519745827,
0.1445523202419281,
-0.0965576246380806,
0.22559228539466858,
-0.11081492900848389,
0.1980491578578949,
0.1853601634502411,
0.5712106227874756,
-0.03319813683629036,
-0.18376705050468445,
-0.10033683478832245,
-0.19775772094726562,
0.35022130608558655,
0.32108274102211,
-0.12260875850915909,
0.2475552260875702,
-0.04689199477434158,
0.20478081703186035,
0.016252687200903893,
0.37144094705581665,
0.2987755239009857,
-0.0353546105325222,
-0.2595382034778595,
-0.2792068123817444,
0.11155571788549423,
-0.08455014228820801,
0.18670086562633514,
0.14084039628505707,
-0.3193206787109375,
-0.25578510761260986,
0.08038311451673508,
-0.31555503606796265,
0.581957995891571,
0.09366241097450256,
0.3404352366924286,
-0.05666738748550415,
0.1961900144815445,
0.06290748715400696,
-0.5295384526252747,
0.2434755116701126,
-0.33936843276023865,
-0.2687772810459137,
0.08404745161533356,
-0.001982681453227997,
0.08260998129844666,
0.1538456678390503,
-0.270569771528244,
0.09973536431789398,
0.11994169652462006,
0.10925504565238953,
-0.2874218225479126,
0.3836098313331604,
-0.40400704741477966,
-0.120232954621315,
-0.31708869338035583,
0.18089659512043,
0.03846214711666107,
-0.15849192440509796,
-0.012326336465775967,
-0.11951793730258942,
0.020361650735139847,
-0.2523367404937744,
-0.14524796605110168,
-0.04931566119194031,
-0.41980400681495667,
0.18225449323654175,
0.039506085216999054,
-0.33519911766052246,
0.24350827932357788,
0.17777115106582642,
0.07175565510988235,
0.45078524947166443,
-0.23751425743103027,
0.17865891754627228,
0.011979680508375168,
-0.027082400396466255,
0.15663877129554749,
-0.002052192110568285,
0.3159703314304352,
-0.012490535154938698,
-0.22674140334129333,
0.09105018526315689,
-0.02672802284359932,
0.10022516548633575,
-0.02117358148097992,
0.005435124039649963,
-0.04170331358909607,
-0.3602181375026703,
-0.24734868109226227,
-0.12215757369995117,
-0.24486114084720612,
-0.30070412158966064,
0.22550034523010254,
-0.05333781987428665,
-0.05440139025449753,
0.16801418364048004,
0.07098978757858276,
-0.3310469686985016,
-0.16335467994213104,
0.32585275173187256,
-0.19543474912643433,
0.17897029221057892,
0.5283613801002502,
0.3944675922393799,
-0.2252093255519867,
-0.32895269989967346,
0.3111717402935028,
-0.02889079600572586,
-0.3540939688682556,
0.27591240406036377,
0.027021314948797226,
-0.06967999786138535,
0.12655551731586456,
0.2427477389574051,
-0.14057697355747223,
-0.3056276738643646,
-0.12778893113136292,
-0.23810873925685883,
-0.43041083216667175,
0.07364131510257721,
-0.014685843139886856,
0.14289841055870056,
-0.012018360197544098,
0.21348373591899872,
0.11327877640724182,
0.21397390961647034,
-0.4020756185054779,
0.14234788715839386,
-0.17718617618083954,
0.09960086643695831,
0.09315408766269684,
-0.13554859161376953,
0.1392204463481903,
0.051814910024404526,
0.11126954853534698,
0.2546558380126953,
-0.07314927130937576,
-0.3498375415802002,
-0.11043192446231842,
0.08029373735189438,
0.04296475276350975,
-0.12139826267957687,
-0.018652942031621933,
-0.3757631778717041,
-0.25712159276008606,
-0.2619505524635315,
0.20553825795650482,
-0.05955670028924942,
-0.10602714121341705,
0.17889057099819183,
-0.14844489097595215,
-0.05947142094373703,
0.11627981066703796,
-0.030737467110157013,
-0.2113562822341919,
0.11350301653146744,
0.17233796417713165,
0.03541186824440956,
0.007398670539259911,
0.0013167411088943481,
-0.31594744324684143,
0.0826844722032547,
0.1583465337753296,
-0.07415562123060226,
0.3244626820087433,
-0.37572717666625977,
-0.05665460228919983,
0.17693735659122467,
0.3609246015548706,
0.41158416867256165,
-0.2069200575351715,
-0.02834312990307808,
0.24290448427200317,
0.29815369844436646,
-0.25329941511154175,
-0.10016856342554092,
0.09493423998355865,
-0.27480506896972656,
0.30034834146499634,
0.12265083938837051,
0.10554638504981995,
-0.08647502958774567,
-0.10739181935787201,
0.22338134050369263,
0.1748349517583847,
-0.0378282368183136,
-0.14958788454532623,
0.34078478813171387,
0.11782075464725494,
-0.04993074759840965,
0.3016178011894226,
0.18213890492916107,
0.301396906375885,
0.7971210479736328,
0.07851167023181915,
0.25384676456451416,
-0.21107330918312073,
-0.09380136430263519,
-0.13657546043395996,
-0.4474603831768036,
0.022837109863758087,
-0.08015626668930054,
-0.03529869019985199,
-0.12467657774686813,
-0.20569443702697754,
0.20495110750198364,
-0.015431790612637997,
0.22015485167503357,
-0.14909659326076508,
0.043684691190719604,
-0.24865233898162842,
-0.1612086296081543,
0.04362469166517258,
-0.3107735514640808,
-0.0689435601234436,
0.10619263350963593,
-0.10688285529613495,
0.3263958692550659,
0.12429416179656982,
0.06238064542412758,
0.10222384333610535,
-0.4294131398200989,
0.20355626940727234,
-0.06269001960754395,
0.08767058700323105,
-0.362539142370224,
0.28398585319519043,
0.26131293177604675,
0.18963372707366943,
0.15717817842960358,
0.19094763696193695,
0.5729643702507019,
0.39447149634361267,
-0.13633108139038086,
-0.08099353313446045,
-0.27559906244277954,
-0.1103980764746666,
-0.4154096245765686,
0.28591975569725037,
0.19795739650726318,
0.3553822636604309,
0.46433591842651367,
0.20754824578762054,
-0.26809021830558777,
-0.06607875227928162,
0.1920684427022934,
-0.2637651860713959,
-0.2234545648097992,
0.10479047149419785,
0.06799925118684769,
-0.28635135293006897,
-0.3225554823875427,
-0.018377088010311127,
-0.43382272124290466,
-0.004564874805510044,
0.5934925079345703,
-0.11358815431594849,
0.309125691652298,
-0.3395165205001831,
0.14480556547641754,
0.0051999278366565704,
0.60579913854599,
0.295389324426651,
-0.017811313271522522,
-0.2954344153404236,
-0.019515685737133026,
-0.6181399822235107,
0.1262810379266739,
-0.1511761099100113,
0.012333894148468971,
-0.011653732508420944,
0.14253626763820648,
0.17389264702796936,
-0.03305090218782425,
-0.0051005929708480835,
0.03629682958126068,
-0.1498091071844101,
-0.10970120131969452,
-0.3313083350658417,
-0.2676610052585602,
-0.2250266820192337,
0.1569494754076004,
-0.0014629364013671875,
-0.3760659694671631,
0.15508276224136353,
-0.0955091044306755,
0.23003354668617249,
-0.17938651144504547,
0.0802161693572998,
-0.020627746358513832,
-0.035598188638687134,
0.15784423053264618,
0.03406703844666481,
0.3657599985599518,
-0.2838608920574188,
0.03404554724693298,
-0.13461974263191223,
-0.06317558884620667,
-0.17006678879261017,
0.1941983699798584,
0.2527383267879486,
0.26540833711624146,
-0.09622174501419067,
-0.17070834338665009,
-0.13808800280094147,
0.15670296549797058,
0.05871815234422684,
0.03713503107428551,
0.14296384155750275,
-0.05074285715818405,
0.1262890100479126,
0.05871701240539551,
0.18636725842952728,
0.4029746949672699,
-0.11137630045413971,
-0.034302711486816406,
-0.3506343960762024,
-0.5414938926696777,
0.2185375988483429,
-0.11808157712221146,
-0.5158481001853943,
0.010307740420103073,
0.13004052639007568,
0.18110820651054382,
0.0267860759049654,
-0.5836288928985596,
0.30677682161331177,
0.30969324707984924,
0.133999302983284,
-0.35290077328681946,
0.2580335736274719,
-0.05051710084080696,
0.05834290757775307,
0.011916577816009521,
0.12013280391693115,
0.024264071136713028,
-0.27022451162338257,
-0.2056572139263153,
-0.03220142796635628
] |
https://github.com/huggingface/datasets/issues/630 | Text dataset not working with large files | > Ah, it’s much faster now(Takes around 15~20min).
Glad to see that it's faster now. What did you change exactly ?
> BTW, any way to set default tensor output as plain tensors with distributed training? The ragged tensors are incompatible with tpustrategy :(
Oh I didn't know about that. Feel free to open an issue to mention that.
I guess what you can do for now is set the dataset format to numpy instead of tensorflow, and use a wrapper of the dataset that converts the numpy arrays to tf tensors.
| ```
Traceback (most recent call last):
File "examples/language-modeling/run_language_modeling.py", line 333, in <module>
main()
File "examples/language-modeling/run_language_modeling.py", line 262, in main
get_dataset(data_args, tokenizer=tokenizer, cache_dir=model_args.cache_dir) if training_args.do_train else None
File "examples/language-modeling/run_language_modeling.py", line 144, in get_dataset
dataset = load_dataset("text", data_files=file_path, split='train+test')
File "/home/ksjae/.local/lib/python3.7/site-packages/datasets/load.py", line 611, in load_dataset
ignore_verifications=ignore_verifications,
File "/home/ksjae/.local/lib/python3.7/site-packages/datasets/builder.py", line 469, in download_and_prepare
dl_manager=dl_manager, verify_infos=verify_infos, **download_and_prepare_kwargs
File "/home/ksjae/.local/lib/python3.7/site-packages/datasets/builder.py", line 546, in _download_and_prepare
self._prepare_split(split_generator, **prepare_split_kwargs)
File "/home/ksjae/.local/lib/python3.7/site-packages/datasets/builder.py", line 888, in _prepare_split
for key, table in utils.tqdm(generator, unit=" tables", leave=False, disable=not_verbose):
File "/home/ksjae/.local/lib/python3.7/site-packages/tqdm/std.py", line 1129, in __iter__
for obj in iterable:
File "/home/ksjae/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py", line 104, in _generate_tables
convert_options=self.config.convert_options,
File "pyarrow/_csv.pyx", line 714, in pyarrow._csv.read_csv
File "pyarrow/error.pxi", line 122, in pyarrow.lib.pyarrow_internal_check_status
File "pyarrow/error.pxi", line 84, in pyarrow.lib.check_status
```
**pyarrow.lib.ArrowInvalid: straddling object straddles two block boundaries (try to increase block size?)**
It gives the same message for both 200MB, 10GB .tx files but not for 700MB file.
Can't upload due to size & copyright problem. sorry. | 92 | Text dataset not working with large files
```
Traceback (most recent call last):
File "examples/language-modeling/run_language_modeling.py", line 333, in <module>
main()
File "examples/language-modeling/run_language_modeling.py", line 262, in main
get_dataset(data_args, tokenizer=tokenizer, cache_dir=model_args.cache_dir) if training_args.do_train else None
File "examples/language-modeling/run_language_modeling.py", line 144, in get_dataset
dataset = load_dataset("text", data_files=file_path, split='train+test')
File "/home/ksjae/.local/lib/python3.7/site-packages/datasets/load.py", line 611, in load_dataset
ignore_verifications=ignore_verifications,
File "/home/ksjae/.local/lib/python3.7/site-packages/datasets/builder.py", line 469, in download_and_prepare
dl_manager=dl_manager, verify_infos=verify_infos, **download_and_prepare_kwargs
File "/home/ksjae/.local/lib/python3.7/site-packages/datasets/builder.py", line 546, in _download_and_prepare
self._prepare_split(split_generator, **prepare_split_kwargs)
File "/home/ksjae/.local/lib/python3.7/site-packages/datasets/builder.py", line 888, in _prepare_split
for key, table in utils.tqdm(generator, unit=" tables", leave=False, disable=not_verbose):
File "/home/ksjae/.local/lib/python3.7/site-packages/tqdm/std.py", line 1129, in __iter__
for obj in iterable:
File "/home/ksjae/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py", line 104, in _generate_tables
convert_options=self.config.convert_options,
File "pyarrow/_csv.pyx", line 714, in pyarrow._csv.read_csv
File "pyarrow/error.pxi", line 122, in pyarrow.lib.pyarrow_internal_check_status
File "pyarrow/error.pxi", line 84, in pyarrow.lib.check_status
```
**pyarrow.lib.ArrowInvalid: straddling object straddles two block boundaries (try to increase block size?)**
It gives the same message for both 200MB, 10GB .tx files but not for 700MB file.
Can't upload due to size & copyright problem. sorry.
> Ah, it’s much faster now(Takes around 15~20min).
Glad to see that it's faster now. What did you change exactly ?
> BTW, any way to set default tensor output as plain tensors with distributed training? The ragged tensors are incompatible with tpustrategy :(
Oh I didn't know about that. Feel free to open an issue to mention that.
I guess what you can do for now is set the dataset format to numpy instead of tensorflow, and use a wrapper of the dataset that converts the numpy arrays to tf tensors.
| [
-0.4925670027732849,
-0.23102402687072754,
-0.11986441910266876,
0.28360170125961304,
0.46635645627975464,
-0.0735015794634819,
0.305368036031723,
0.5961019992828369,
-0.11382582783699036,
0.04616520553827286,
-0.06241992115974426,
-0.030405322089791298,
-0.10334224998950958,
0.31017932295799255,
-0.1062139943242073,
-0.038950130343437195,
-0.22788456082344055,
0.11306402087211609,
-0.09469194710254669,
0.049916721880435944,
-0.11255110055208206,
0.11109991371631622,
-0.1209786981344223,
-0.09560258686542511,
-0.4804548919200897,
-0.08299517631530762,
0.11853118240833282,
0.2535656690597534,
-0.29201096296310425,
-0.30531421303749084,
-0.16570709645748138,
0.09658567607402802,
0.11220498383045197,
0.6015899777412415,
-0.00010376208228990436,
0.1294623464345932,
0.2131115049123764,
-0.1573348045349121,
-0.22658251225948334,
-0.0314558744430542,
0.15594887733459473,
-0.4493688642978668,
-0.18238908052444458,
-0.2179643213748932,
0.02615135908126831,
-0.06274445354938507,
-0.10828742384910583,
-0.11755962669849396,
0.26533523201942444,
0.5598003268241882,
0.34120333194732666,
0.17075856029987335,
0.13216975331306458,
-0.11296090483665466,
0.250753790140152,
-0.08724960684776306,
-0.08874448388814926,
0.08485007286071777,
0.31081804633140564,
0.026577329263091087,
-0.2564011812210083,
0.3199438154697418,
0.010172003880143166,
0.03770069405436516,
0.00031413882970809937,
-0.02406269684433937,
-0.08279385417699814,
-0.29400500655174255,
0.37119466066360474,
0.23214656114578247,
0.5224136710166931,
-0.31693607568740845,
-0.16412782669067383,
-0.32884305715560913,
-0.18244099617004395,
-0.35125598311424255,
0.22663253545761108,
0.18455395102500916,
-0.11133106052875519,
0.11612716317176819,
-0.14361807703971863,
-0.10148565471172333,
-0.20639726519584656,
-0.0293157696723938,
-0.2615340054035187,
0.10227341949939728,
-0.21058689057826996,
-0.10046204179525375,
0.25758007168769836,
-0.27024781703948975,
0.010829675942659378,
-0.10562211275100708,
-0.13078303635120392,
-0.006805417127907276,
-0.2472129911184311,
-0.08402222394943237,
0.24685075879096985,
-0.19907799363136292,
0.28894200921058655,
-0.04899824410676956,
-0.05042092502117157,
0.22476103901863098,
-0.07966753095388412,
-0.030213192105293274,
0.005493609234690666,
0.3368757665157318,
0.004112988710403442,
0.06385742127895355,
0.4085860252380371,
0.23562848567962646,
-0.3793579936027527,
-0.2320612072944641,
-0.14962677657604218,
-0.5145173668861389,
-0.029356157407164574,
-0.11771722882986069,
0.01687188819050789,
-0.045236922800540924,
-0.12102539837360382,
0.1521078199148178,
0.1642943024635315,
0.15479476749897003,
0.10596621781587601,
0.4816173017024994,
0.10491445660591125,
0.2937651574611664,
-0.164946049451828,
0.17703935503959656,
-0.1443265825510025,
-0.172270730137825,
-0.2492274045944214,
-0.04561186954379082,
-0.057916440069675446,
-0.09268886595964432,
0.2676639258861542,
0.13385112583637238,
0.2967093586921692,
-0.13958050310611725,
0.19085338711738586,
-0.10901589691638947,
0.11681430041790009,
-0.5029687881469727,
0.14769625663757324,
0.1410786211490631,
-0.0354771725833416,
0.16869360208511353,
0.22878293693065643,
-0.17886953055858612,
-0.10239109396934509,
0.050235599279403687,
-0.10356039553880692,
-0.29712870717048645,
0.1772405207157135,
0.3213210701942444,
0.13477429747581482,
-0.003003045916557312,
-0.018904902040958405,
0.2770770192146301,
0.3757719397544861,
-0.21763959527015686,
0.028100714087486267,
-0.177321657538414,
-0.2569279670715332,
-0.1258028894662857,
0.2650003433227539,
0.43938207626342773,
-0.42506060004234314,
0.20901402831077576,
0.06901604682207108,
0.1223086565732956,
0.08902444690465927,
0.3739468455314636,
-0.06507308781147003,
0.31435954570770264,
-0.11457157880067825,
0.2009439319372177,
0.3094799518585205,
-0.2855849862098694,
-0.5090751051902771,
0.5406067967414856,
-0.18592986464500427,
-0.11818693578243256,
0.09925701469182968,
-0.044451307505369186,
0.10349185764789581,
0.13587255775928497,
0.30473989248275757,
0.27934038639068604,
0.011319583281874657,
0.26673009991645813,
-0.26045045256614685,
-0.08325029164552689,
-0.050114214420318604,
0.15593983232975006,
0.3121376931667328,
-0.20806992053985596,
0.1951688975095749,
-0.017231537029147148,
0.1943761706352234,
-0.044446270912885666,
0.21288302540779114,
0.5059319138526917,
0.12715761363506317,
-0.007840372622013092,
-0.01236867904663086,
-0.2239851951599121,
0.0316573791205883,
0.1751382052898407,
0.12100903689861298,
0.08430736511945724,
-0.2666850686073303,
-0.08223278820514679,
-0.30924513936042786,
-0.134145587682724,
-0.2703465223312378,
-0.1933860182762146,
0.28360530734062195,
0.08132393658161163,
-0.011476056650280952,
0.25513970851898193,
-0.016701530665159225,
0.025312982499599457,
-0.1602134257555008,
-0.0655839741230011,
-0.012096773833036423,
-0.0018736571073532104,
-0.09108380228281021,
-0.2782086431980133,
0.12294897437095642,
0.11027294397354126,
-0.041142746806144714,
-0.061668265610933304,
-0.1109171137213707,
0.3928831219673157,
-0.0020209033973515034,
-0.08106143772602081,
-0.036070093512535095,
-0.03006117045879364,
0.1020016148686409,
-0.0952065959572792,
0.07194626331329346,
0.0007551498711109161,
0.13880528509616852,
-0.10531303286552429,
-0.18016177415847778,
0.3006141483783722,
-0.13981524109840393,
0.20316290855407715,
0.3438575267791748,
-0.20907394587993622,
0.2556621730327606,
-0.06635111570358276,
0.22766588628292084,
-0.1381169557571411,
0.2406681329011917,
0.0831318348646164,
0.13632160425186157,
-0.0013490226119756699,
-0.2719841003417969,
-0.012743011116981506,
0.689583957195282,
0.17106518149375916,
0.09289268404245377,
0.1747955083847046,
-0.24533984065055847,
-0.017957307398319244,
-0.2034236490726471,
0.1299688071012497,
0.3976373076438904,
0.2744441032409668,
0.2679811418056488,
0.03577557951211929,
0.18700522184371948,
-0.37400296330451965,
0.13971075415611267,
0.00324847549200058,
0.011184905655682087,
0.5398926734924316,
0.2758920192718506,
-0.12958043813705444,
-0.4534207582473755,
-0.15636895596981049,
0.10577581822872162,
0.3134024739265442,
-0.08958758413791656,
0.019882122054696083,
-0.21556280553340912,
-0.2920286953449249,
-0.2959759533405304,
0.21032747626304626,
-0.2627323269844055,
-0.22531758248806,
0.0694885328412056,
0.001854587346315384,
-0.00965346023440361,
0.09686631709337234,
0.059420328587293625,
0.14542452991008759,
0.3997488021850586,
-0.19882483780384064,
-0.06151032820343971,
-0.2715905010700226,
-0.1730494201183319,
0.1567440927028656,
0.24218787252902985,
-0.01231520064175129,
0.10664252936840057,
-0.1534675806760788,
-0.10159619897603989,
0.003862651064991951,
-0.28537610173225403,
0.0006909370422363281,
-0.029189959168434143,
0.1006607785820961,
-0.05716460943222046,
0.2626273036003113,
0.1662752330303192,
0.07698307931423187,
0.3128008246421814,
-0.12974913418293,
-0.0807747021317482,
0.22336417436599731,
0.09067574143409729,
-0.06526526808738708,
-0.17057353258132935,
-0.4048938751220703,
-0.15303708612918854,
-0.6100062131881714,
0.3575114607810974,
0.09556648135185242,
0.038003552705049515,
0.40225842595100403,
0.3181685507297516,
0.2154986411333084,
-0.02120117098093033,
0.21249309182167053,
0.10026468336582184,
-0.19501852989196777,
0.2925727367401123,
-0.2248302549123764,
-0.3832399547100067,
-0.0998249500989914,
0.16060329973697662,
0.16261537373065948,
0.0072623370215296745,
-0.523443341255188,
0.030241087079048157,
-0.43688228726387024,
0.16236768662929535,
-0.06379617750644684,
0.1686919629573822,
0.08140815794467926,
-0.068488709628582,
-0.2522607743740082,
-0.08427543938159943,
0.08302126824855804,
0.04674498364329338,
-0.0724341943860054,
0.0489533469080925,
-0.1854184865951538,
0.41218438744544983,
0.24029558897018433,
0.4626798629760742,
0.16378207504749298,
0.08145051449537277,
0.3938988149166107,
-0.12170656770467758,
0.42712289094924927,
-0.353285551071167,
-0.3265115022659302,
0.1239759549498558,
-0.09124578535556793,
-0.03290253505110741,
0.2716790437698364,
0.08628013730049133,
0.26993563771247864,
-0.08009670674800873,
-0.21920713782310486,
0.08489612489938736,
-0.27935341000556946,
0.2020106166601181,
-0.1586160659790039,
0.158182293176651,
-0.13573935627937317,
-0.024103175848722458,
-0.07673823833465576,
-0.13111597299575806,
-0.03386951982975006,
0.18008708953857422,
-0.24061143398284912,
-0.025057753548026085,
-0.34338465332984924,
0.06488210707902908,
-0.4402943253517151,
0.11626070737838745,
-0.0008667679503560066,
0.33177903294563293,
-0.16607806086540222,
-0.15486931800842285,
-0.10844495892524719,
-0.15747174620628357,
0.558742344379425,
-0.07002851366996765,
0.050007011741399765,
0.06284362077713013,
-0.09194844961166382,
-0.3191089332103729,
0.16093701124191284,
-0.27350154519081116,
0.15883025527000427,
0.3647179901599884,
0.5645073652267456,
-0.3012341260910034,
-0.05097787827253342,
-0.03999730199575424,
0.3442743122577667,
0.016783621162176132,
-0.03344845771789551,
-0.2761994004249573,
-0.17115014791488647,
-0.479754775762558,
0.13883376121520996,
0.2979472875595093,
0.28462928533554077,
-0.2693779766559601,
0.07181067764759064,
0.006769764237105846,
-0.24167132377624512,
0.21428701281547546,
0.004094982519745827,
0.1445523202419281,
-0.0965576246380806,
0.22559228539466858,
-0.11081492900848389,
0.1980491578578949,
0.1853601634502411,
0.5712106227874756,
-0.03319813683629036,
-0.18376705050468445,
-0.10033683478832245,
-0.19775772094726562,
0.35022130608558655,
0.32108274102211,
-0.12260875850915909,
0.2475552260875702,
-0.04689199477434158,
0.20478081703186035,
0.016252687200903893,
0.37144094705581665,
0.2987755239009857,
-0.0353546105325222,
-0.2595382034778595,
-0.2792068123817444,
0.11155571788549423,
-0.08455014228820801,
0.18670086562633514,
0.14084039628505707,
-0.3193206787109375,
-0.25578510761260986,
0.08038311451673508,
-0.31555503606796265,
0.581957995891571,
0.09366241097450256,
0.3404352366924286,
-0.05666738748550415,
0.1961900144815445,
0.06290748715400696,
-0.5295384526252747,
0.2434755116701126,
-0.33936843276023865,
-0.2687772810459137,
0.08404745161533356,
-0.001982681453227997,
0.08260998129844666,
0.1538456678390503,
-0.270569771528244,
0.09973536431789398,
0.11994169652462006,
0.10925504565238953,
-0.2874218225479126,
0.3836098313331604,
-0.40400704741477966,
-0.120232954621315,
-0.31708869338035583,
0.18089659512043,
0.03846214711666107,
-0.15849192440509796,
-0.012326336465775967,
-0.11951793730258942,
0.020361650735139847,
-0.2523367404937744,
-0.14524796605110168,
-0.04931566119194031,
-0.41980400681495667,
0.18225449323654175,
0.039506085216999054,
-0.33519911766052246,
0.24350827932357788,
0.17777115106582642,
0.07175565510988235,
0.45078524947166443,
-0.23751425743103027,
0.17865891754627228,
0.011979680508375168,
-0.027082400396466255,
0.15663877129554749,
-0.002052192110568285,
0.3159703314304352,
-0.012490535154938698,
-0.22674140334129333,
0.09105018526315689,
-0.02672802284359932,
0.10022516548633575,
-0.02117358148097992,
0.005435124039649963,
-0.04170331358909607,
-0.3602181375026703,
-0.24734868109226227,
-0.12215757369995117,
-0.24486114084720612,
-0.30070412158966064,
0.22550034523010254,
-0.05333781987428665,
-0.05440139025449753,
0.16801418364048004,
0.07098978757858276,
-0.3310469686985016,
-0.16335467994213104,
0.32585275173187256,
-0.19543474912643433,
0.17897029221057892,
0.5283613801002502,
0.3944675922393799,
-0.2252093255519867,
-0.32895269989967346,
0.3111717402935028,
-0.02889079600572586,
-0.3540939688682556,
0.27591240406036377,
0.027021314948797226,
-0.06967999786138535,
0.12655551731586456,
0.2427477389574051,
-0.14057697355747223,
-0.3056276738643646,
-0.12778893113136292,
-0.23810873925685883,
-0.43041083216667175,
0.07364131510257721,
-0.014685843139886856,
0.14289841055870056,
-0.012018360197544098,
0.21348373591899872,
0.11327877640724182,
0.21397390961647034,
-0.4020756185054779,
0.14234788715839386,
-0.17718617618083954,
0.09960086643695831,
0.09315408766269684,
-0.13554859161376953,
0.1392204463481903,
0.051814910024404526,
0.11126954853534698,
0.2546558380126953,
-0.07314927130937576,
-0.3498375415802002,
-0.11043192446231842,
0.08029373735189438,
0.04296475276350975,
-0.12139826267957687,
-0.018652942031621933,
-0.3757631778717041,
-0.25712159276008606,
-0.2619505524635315,
0.20553825795650482,
-0.05955670028924942,
-0.10602714121341705,
0.17889057099819183,
-0.14844489097595215,
-0.05947142094373703,
0.11627981066703796,
-0.030737467110157013,
-0.2113562822341919,
0.11350301653146744,
0.17233796417713165,
0.03541186824440956,
0.007398670539259911,
0.0013167411088943481,
-0.31594744324684143,
0.0826844722032547,
0.1583465337753296,
-0.07415562123060226,
0.3244626820087433,
-0.37572717666625977,
-0.05665460228919983,
0.17693735659122467,
0.3609246015548706,
0.41158416867256165,
-0.2069200575351715,
-0.02834312990307808,
0.24290448427200317,
0.29815369844436646,
-0.25329941511154175,
-0.10016856342554092,
0.09493423998355865,
-0.27480506896972656,
0.30034834146499634,
0.12265083938837051,
0.10554638504981995,
-0.08647502958774567,
-0.10739181935787201,
0.22338134050369263,
0.1748349517583847,
-0.0378282368183136,
-0.14958788454532623,
0.34078478813171387,
0.11782075464725494,
-0.04993074759840965,
0.3016178011894226,
0.18213890492916107,
0.301396906375885,
0.7971210479736328,
0.07851167023181915,
0.25384676456451416,
-0.21107330918312073,
-0.09380136430263519,
-0.13657546043395996,
-0.4474603831768036,
0.022837109863758087,
-0.08015626668930054,
-0.03529869019985199,
-0.12467657774686813,
-0.20569443702697754,
0.20495110750198364,
-0.015431790612637997,
0.22015485167503357,
-0.14909659326076508,
0.043684691190719604,
-0.24865233898162842,
-0.1612086296081543,
0.04362469166517258,
-0.3107735514640808,
-0.0689435601234436,
0.10619263350963593,
-0.10688285529613495,
0.3263958692550659,
0.12429416179656982,
0.06238064542412758,
0.10222384333610535,
-0.4294131398200989,
0.20355626940727234,
-0.06269001960754395,
0.08767058700323105,
-0.362539142370224,
0.28398585319519043,
0.26131293177604675,
0.18963372707366943,
0.15717817842960358,
0.19094763696193695,
0.5729643702507019,
0.39447149634361267,
-0.13633108139038086,
-0.08099353313446045,
-0.27559906244277954,
-0.1103980764746666,
-0.4154096245765686,
0.28591975569725037,
0.19795739650726318,
0.3553822636604309,
0.46433591842651367,
0.20754824578762054,
-0.26809021830558777,
-0.06607875227928162,
0.1920684427022934,
-0.2637651860713959,
-0.2234545648097992,
0.10479047149419785,
0.06799925118684769,
-0.28635135293006897,
-0.3225554823875427,
-0.018377088010311127,
-0.43382272124290466,
-0.004564874805510044,
0.5934925079345703,
-0.11358815431594849,
0.309125691652298,
-0.3395165205001831,
0.14480556547641754,
0.0051999278366565704,
0.60579913854599,
0.295389324426651,
-0.017811313271522522,
-0.2954344153404236,
-0.019515685737133026,
-0.6181399822235107,
0.1262810379266739,
-0.1511761099100113,
0.012333894148468971,
-0.011653732508420944,
0.14253626763820648,
0.17389264702796936,
-0.03305090218782425,
-0.0051005929708480835,
0.03629682958126068,
-0.1498091071844101,
-0.10970120131969452,
-0.3313083350658417,
-0.2676610052585602,
-0.2250266820192337,
0.1569494754076004,
-0.0014629364013671875,
-0.3760659694671631,
0.15508276224136353,
-0.0955091044306755,
0.23003354668617249,
-0.17938651144504547,
0.0802161693572998,
-0.020627746358513832,
-0.035598188638687134,
0.15784423053264618,
0.03406703844666481,
0.3657599985599518,
-0.2838608920574188,
0.03404554724693298,
-0.13461974263191223,
-0.06317558884620667,
-0.17006678879261017,
0.1941983699798584,
0.2527383267879486,
0.26540833711624146,
-0.09622174501419067,
-0.17070834338665009,
-0.13808800280094147,
0.15670296549797058,
0.05871815234422684,
0.03713503107428551,
0.14296384155750275,
-0.05074285715818405,
0.1262890100479126,
0.05871701240539551,
0.18636725842952728,
0.4029746949672699,
-0.11137630045413971,
-0.034302711486816406,
-0.3506343960762024,
-0.5414938926696777,
0.2185375988483429,
-0.11808157712221146,
-0.5158481001853943,
0.010307740420103073,
0.13004052639007568,
0.18110820651054382,
0.0267860759049654,
-0.5836288928985596,
0.30677682161331177,
0.30969324707984924,
0.133999302983284,
-0.35290077328681946,
0.2580335736274719,
-0.05051710084080696,
0.05834290757775307,
0.011916577816009521,
0.12013280391693115,
0.024264071136713028,
-0.27022451162338257,
-0.2056572139263153,
-0.03220142796635628
] |
https://github.com/huggingface/datasets/issues/630 | Text dataset not working with large files | >>> Glad to see that it's faster now. What did you change exactly ?
I don't know, it just worked...? Sorry I couldn't be more helpful.
Setting with numpy array is a great idea! Thanks. | ```
Traceback (most recent call last):
File "examples/language-modeling/run_language_modeling.py", line 333, in <module>
main()
File "examples/language-modeling/run_language_modeling.py", line 262, in main
get_dataset(data_args, tokenizer=tokenizer, cache_dir=model_args.cache_dir) if training_args.do_train else None
File "examples/language-modeling/run_language_modeling.py", line 144, in get_dataset
dataset = load_dataset("text", data_files=file_path, split='train+test')
File "/home/ksjae/.local/lib/python3.7/site-packages/datasets/load.py", line 611, in load_dataset
ignore_verifications=ignore_verifications,
File "/home/ksjae/.local/lib/python3.7/site-packages/datasets/builder.py", line 469, in download_and_prepare
dl_manager=dl_manager, verify_infos=verify_infos, **download_and_prepare_kwargs
File "/home/ksjae/.local/lib/python3.7/site-packages/datasets/builder.py", line 546, in _download_and_prepare
self._prepare_split(split_generator, **prepare_split_kwargs)
File "/home/ksjae/.local/lib/python3.7/site-packages/datasets/builder.py", line 888, in _prepare_split
for key, table in utils.tqdm(generator, unit=" tables", leave=False, disable=not_verbose):
File "/home/ksjae/.local/lib/python3.7/site-packages/tqdm/std.py", line 1129, in __iter__
for obj in iterable:
File "/home/ksjae/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py", line 104, in _generate_tables
convert_options=self.config.convert_options,
File "pyarrow/_csv.pyx", line 714, in pyarrow._csv.read_csv
File "pyarrow/error.pxi", line 122, in pyarrow.lib.pyarrow_internal_check_status
File "pyarrow/error.pxi", line 84, in pyarrow.lib.check_status
```
**pyarrow.lib.ArrowInvalid: straddling object straddles two block boundaries (try to increase block size?)**
It gives the same message for both 200MB, 10GB .tx files but not for 700MB file.
Can't upload due to size & copyright problem. sorry. | 35 | Text dataset not working with large files
```
Traceback (most recent call last):
File "examples/language-modeling/run_language_modeling.py", line 333, in <module>
main()
File "examples/language-modeling/run_language_modeling.py", line 262, in main
get_dataset(data_args, tokenizer=tokenizer, cache_dir=model_args.cache_dir) if training_args.do_train else None
File "examples/language-modeling/run_language_modeling.py", line 144, in get_dataset
dataset = load_dataset("text", data_files=file_path, split='train+test')
File "/home/ksjae/.local/lib/python3.7/site-packages/datasets/load.py", line 611, in load_dataset
ignore_verifications=ignore_verifications,
File "/home/ksjae/.local/lib/python3.7/site-packages/datasets/builder.py", line 469, in download_and_prepare
dl_manager=dl_manager, verify_infos=verify_infos, **download_and_prepare_kwargs
File "/home/ksjae/.local/lib/python3.7/site-packages/datasets/builder.py", line 546, in _download_and_prepare
self._prepare_split(split_generator, **prepare_split_kwargs)
File "/home/ksjae/.local/lib/python3.7/site-packages/datasets/builder.py", line 888, in _prepare_split
for key, table in utils.tqdm(generator, unit=" tables", leave=False, disable=not_verbose):
File "/home/ksjae/.local/lib/python3.7/site-packages/tqdm/std.py", line 1129, in __iter__
for obj in iterable:
File "/home/ksjae/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py", line 104, in _generate_tables
convert_options=self.config.convert_options,
File "pyarrow/_csv.pyx", line 714, in pyarrow._csv.read_csv
File "pyarrow/error.pxi", line 122, in pyarrow.lib.pyarrow_internal_check_status
File "pyarrow/error.pxi", line 84, in pyarrow.lib.check_status
```
**pyarrow.lib.ArrowInvalid: straddling object straddles two block boundaries (try to increase block size?)**
It gives the same message for both 200MB, 10GB .tx files but not for 700MB file.
Can't upload due to size & copyright problem. sorry.
>>> Glad to see that it's faster now. What did you change exactly ?
I don't know, it just worked...? Sorry I couldn't be more helpful.
Setting with numpy array is a great idea! Thanks. | [
-0.4925670027732849,
-0.23102402687072754,
-0.11986441910266876,
0.28360170125961304,
0.46635645627975464,
-0.0735015794634819,
0.305368036031723,
0.5961019992828369,
-0.11382582783699036,
0.04616520553827286,
-0.06241992115974426,
-0.030405322089791298,
-0.10334224998950958,
0.31017932295799255,
-0.1062139943242073,
-0.038950130343437195,
-0.22788456082344055,
0.11306402087211609,
-0.09469194710254669,
0.049916721880435944,
-0.11255110055208206,
0.11109991371631622,
-0.1209786981344223,
-0.09560258686542511,
-0.4804548919200897,
-0.08299517631530762,
0.11853118240833282,
0.2535656690597534,
-0.29201096296310425,
-0.30531421303749084,
-0.16570709645748138,
0.09658567607402802,
0.11220498383045197,
0.6015899777412415,
-0.00010376208228990436,
0.1294623464345932,
0.2131115049123764,
-0.1573348045349121,
-0.22658251225948334,
-0.0314558744430542,
0.15594887733459473,
-0.4493688642978668,
-0.18238908052444458,
-0.2179643213748932,
0.02615135908126831,
-0.06274445354938507,
-0.10828742384910583,
-0.11755962669849396,
0.26533523201942444,
0.5598003268241882,
0.34120333194732666,
0.17075856029987335,
0.13216975331306458,
-0.11296090483665466,
0.250753790140152,
-0.08724960684776306,
-0.08874448388814926,
0.08485007286071777,
0.31081804633140564,
0.026577329263091087,
-0.2564011812210083,
0.3199438154697418,
0.010172003880143166,
0.03770069405436516,
0.00031413882970809937,
-0.02406269684433937,
-0.08279385417699814,
-0.29400500655174255,
0.37119466066360474,
0.23214656114578247,
0.5224136710166931,
-0.31693607568740845,
-0.16412782669067383,
-0.32884305715560913,
-0.18244099617004395,
-0.35125598311424255,
0.22663253545761108,
0.18455395102500916,
-0.11133106052875519,
0.11612716317176819,
-0.14361807703971863,
-0.10148565471172333,
-0.20639726519584656,
-0.0293157696723938,
-0.2615340054035187,
0.10227341949939728,
-0.21058689057826996,
-0.10046204179525375,
0.25758007168769836,
-0.27024781703948975,
0.010829675942659378,
-0.10562211275100708,
-0.13078303635120392,
-0.006805417127907276,
-0.2472129911184311,
-0.08402222394943237,
0.24685075879096985,
-0.19907799363136292,
0.28894200921058655,
-0.04899824410676956,
-0.05042092502117157,
0.22476103901863098,
-0.07966753095388412,
-0.030213192105293274,
0.005493609234690666,
0.3368757665157318,
0.004112988710403442,
0.06385742127895355,
0.4085860252380371,
0.23562848567962646,
-0.3793579936027527,
-0.2320612072944641,
-0.14962677657604218,
-0.5145173668861389,
-0.029356157407164574,
-0.11771722882986069,
0.01687188819050789,
-0.045236922800540924,
-0.12102539837360382,
0.1521078199148178,
0.1642943024635315,
0.15479476749897003,
0.10596621781587601,
0.4816173017024994,
0.10491445660591125,
0.2937651574611664,
-0.164946049451828,
0.17703935503959656,
-0.1443265825510025,
-0.172270730137825,
-0.2492274045944214,
-0.04561186954379082,
-0.057916440069675446,
-0.09268886595964432,
0.2676639258861542,
0.13385112583637238,
0.2967093586921692,
-0.13958050310611725,
0.19085338711738586,
-0.10901589691638947,
0.11681430041790009,
-0.5029687881469727,
0.14769625663757324,
0.1410786211490631,
-0.0354771725833416,
0.16869360208511353,
0.22878293693065643,
-0.17886953055858612,
-0.10239109396934509,
0.050235599279403687,
-0.10356039553880692,
-0.29712870717048645,
0.1772405207157135,
0.3213210701942444,
0.13477429747581482,
-0.003003045916557312,
-0.018904902040958405,
0.2770770192146301,
0.3757719397544861,
-0.21763959527015686,
0.028100714087486267,
-0.177321657538414,
-0.2569279670715332,
-0.1258028894662857,
0.2650003433227539,
0.43938207626342773,
-0.42506060004234314,
0.20901402831077576,
0.06901604682207108,
0.1223086565732956,
0.08902444690465927,
0.3739468455314636,
-0.06507308781147003,
0.31435954570770264,
-0.11457157880067825,
0.2009439319372177,
0.3094799518585205,
-0.2855849862098694,
-0.5090751051902771,
0.5406067967414856,
-0.18592986464500427,
-0.11818693578243256,
0.09925701469182968,
-0.044451307505369186,
0.10349185764789581,
0.13587255775928497,
0.30473989248275757,
0.27934038639068604,
0.011319583281874657,
0.26673009991645813,
-0.26045045256614685,
-0.08325029164552689,
-0.050114214420318604,
0.15593983232975006,
0.3121376931667328,
-0.20806992053985596,
0.1951688975095749,
-0.017231537029147148,
0.1943761706352234,
-0.044446270912885666,
0.21288302540779114,
0.5059319138526917,
0.12715761363506317,
-0.007840372622013092,
-0.01236867904663086,
-0.2239851951599121,
0.0316573791205883,
0.1751382052898407,
0.12100903689861298,
0.08430736511945724,
-0.2666850686073303,
-0.08223278820514679,
-0.30924513936042786,
-0.134145587682724,
-0.2703465223312378,
-0.1933860182762146,
0.28360530734062195,
0.08132393658161163,
-0.011476056650280952,
0.25513970851898193,
-0.016701530665159225,
0.025312982499599457,
-0.1602134257555008,
-0.0655839741230011,
-0.012096773833036423,
-0.0018736571073532104,
-0.09108380228281021,
-0.2782086431980133,
0.12294897437095642,
0.11027294397354126,
-0.041142746806144714,
-0.061668265610933304,
-0.1109171137213707,
0.3928831219673157,
-0.0020209033973515034,
-0.08106143772602081,
-0.036070093512535095,
-0.03006117045879364,
0.1020016148686409,
-0.0952065959572792,
0.07194626331329346,
0.0007551498711109161,
0.13880528509616852,
-0.10531303286552429,
-0.18016177415847778,
0.3006141483783722,
-0.13981524109840393,
0.20316290855407715,
0.3438575267791748,
-0.20907394587993622,
0.2556621730327606,
-0.06635111570358276,
0.22766588628292084,
-0.1381169557571411,
0.2406681329011917,
0.0831318348646164,
0.13632160425186157,
-0.0013490226119756699,
-0.2719841003417969,
-0.012743011116981506,
0.689583957195282,
0.17106518149375916,
0.09289268404245377,
0.1747955083847046,
-0.24533984065055847,
-0.017957307398319244,
-0.2034236490726471,
0.1299688071012497,
0.3976373076438904,
0.2744441032409668,
0.2679811418056488,
0.03577557951211929,
0.18700522184371948,
-0.37400296330451965,
0.13971075415611267,
0.00324847549200058,
0.011184905655682087,
0.5398926734924316,
0.2758920192718506,
-0.12958043813705444,
-0.4534207582473755,
-0.15636895596981049,
0.10577581822872162,
0.3134024739265442,
-0.08958758413791656,
0.019882122054696083,
-0.21556280553340912,
-0.2920286953449249,
-0.2959759533405304,
0.21032747626304626,
-0.2627323269844055,
-0.22531758248806,
0.0694885328412056,
0.001854587346315384,
-0.00965346023440361,
0.09686631709337234,
0.059420328587293625,
0.14542452991008759,
0.3997488021850586,
-0.19882483780384064,
-0.06151032820343971,
-0.2715905010700226,
-0.1730494201183319,
0.1567440927028656,
0.24218787252902985,
-0.01231520064175129,
0.10664252936840057,
-0.1534675806760788,
-0.10159619897603989,
0.003862651064991951,
-0.28537610173225403,
0.0006909370422363281,
-0.029189959168434143,
0.1006607785820961,
-0.05716460943222046,
0.2626273036003113,
0.1662752330303192,
0.07698307931423187,
0.3128008246421814,
-0.12974913418293,
-0.0807747021317482,
0.22336417436599731,
0.09067574143409729,
-0.06526526808738708,
-0.17057353258132935,
-0.4048938751220703,
-0.15303708612918854,
-0.6100062131881714,
0.3575114607810974,
0.09556648135185242,
0.038003552705049515,
0.40225842595100403,
0.3181685507297516,
0.2154986411333084,
-0.02120117098093033,
0.21249309182167053,
0.10026468336582184,
-0.19501852989196777,
0.2925727367401123,
-0.2248302549123764,
-0.3832399547100067,
-0.0998249500989914,
0.16060329973697662,
0.16261537373065948,
0.0072623370215296745,
-0.523443341255188,
0.030241087079048157,
-0.43688228726387024,
0.16236768662929535,
-0.06379617750644684,
0.1686919629573822,
0.08140815794467926,
-0.068488709628582,
-0.2522607743740082,
-0.08427543938159943,
0.08302126824855804,
0.04674498364329338,
-0.0724341943860054,
0.0489533469080925,
-0.1854184865951538,
0.41218438744544983,
0.24029558897018433,
0.4626798629760742,
0.16378207504749298,
0.08145051449537277,
0.3938988149166107,
-0.12170656770467758,
0.42712289094924927,
-0.353285551071167,
-0.3265115022659302,
0.1239759549498558,
-0.09124578535556793,
-0.03290253505110741,
0.2716790437698364,
0.08628013730049133,
0.26993563771247864,
-0.08009670674800873,
-0.21920713782310486,
0.08489612489938736,
-0.27935341000556946,
0.2020106166601181,
-0.1586160659790039,
0.158182293176651,
-0.13573935627937317,
-0.024103175848722458,
-0.07673823833465576,
-0.13111597299575806,
-0.03386951982975006,
0.18008708953857422,
-0.24061143398284912,
-0.025057753548026085,
-0.34338465332984924,
0.06488210707902908,
-0.4402943253517151,
0.11626070737838745,
-0.0008667679503560066,
0.33177903294563293,
-0.16607806086540222,
-0.15486931800842285,
-0.10844495892524719,
-0.15747174620628357,
0.558742344379425,
-0.07002851366996765,
0.050007011741399765,
0.06284362077713013,
-0.09194844961166382,
-0.3191089332103729,
0.16093701124191284,
-0.27350154519081116,
0.15883025527000427,
0.3647179901599884,
0.5645073652267456,
-0.3012341260910034,
-0.05097787827253342,
-0.03999730199575424,
0.3442743122577667,
0.016783621162176132,
-0.03344845771789551,
-0.2761994004249573,
-0.17115014791488647,
-0.479754775762558,
0.13883376121520996,
0.2979472875595093,
0.28462928533554077,
-0.2693779766559601,
0.07181067764759064,
0.006769764237105846,
-0.24167132377624512,
0.21428701281547546,
0.004094982519745827,
0.1445523202419281,
-0.0965576246380806,
0.22559228539466858,
-0.11081492900848389,
0.1980491578578949,
0.1853601634502411,
0.5712106227874756,
-0.03319813683629036,
-0.18376705050468445,
-0.10033683478832245,
-0.19775772094726562,
0.35022130608558655,
0.32108274102211,
-0.12260875850915909,
0.2475552260875702,
-0.04689199477434158,
0.20478081703186035,
0.016252687200903893,
0.37144094705581665,
0.2987755239009857,
-0.0353546105325222,
-0.2595382034778595,
-0.2792068123817444,
0.11155571788549423,
-0.08455014228820801,
0.18670086562633514,
0.14084039628505707,
-0.3193206787109375,
-0.25578510761260986,
0.08038311451673508,
-0.31555503606796265,
0.581957995891571,
0.09366241097450256,
0.3404352366924286,
-0.05666738748550415,
0.1961900144815445,
0.06290748715400696,
-0.5295384526252747,
0.2434755116701126,
-0.33936843276023865,
-0.2687772810459137,
0.08404745161533356,
-0.001982681453227997,
0.08260998129844666,
0.1538456678390503,
-0.270569771528244,
0.09973536431789398,
0.11994169652462006,
0.10925504565238953,
-0.2874218225479126,
0.3836098313331604,
-0.40400704741477966,
-0.120232954621315,
-0.31708869338035583,
0.18089659512043,
0.03846214711666107,
-0.15849192440509796,
-0.012326336465775967,
-0.11951793730258942,
0.020361650735139847,
-0.2523367404937744,
-0.14524796605110168,
-0.04931566119194031,
-0.41980400681495667,
0.18225449323654175,
0.039506085216999054,
-0.33519911766052246,
0.24350827932357788,
0.17777115106582642,
0.07175565510988235,
0.45078524947166443,
-0.23751425743103027,
0.17865891754627228,
0.011979680508375168,
-0.027082400396466255,
0.15663877129554749,
-0.002052192110568285,
0.3159703314304352,
-0.012490535154938698,
-0.22674140334129333,
0.09105018526315689,
-0.02672802284359932,
0.10022516548633575,
-0.02117358148097992,
0.005435124039649963,
-0.04170331358909607,
-0.3602181375026703,
-0.24734868109226227,
-0.12215757369995117,
-0.24486114084720612,
-0.30070412158966064,
0.22550034523010254,
-0.05333781987428665,
-0.05440139025449753,
0.16801418364048004,
0.07098978757858276,
-0.3310469686985016,
-0.16335467994213104,
0.32585275173187256,
-0.19543474912643433,
0.17897029221057892,
0.5283613801002502,
0.3944675922393799,
-0.2252093255519867,
-0.32895269989967346,
0.3111717402935028,
-0.02889079600572586,
-0.3540939688682556,
0.27591240406036377,
0.027021314948797226,
-0.06967999786138535,
0.12655551731586456,
0.2427477389574051,
-0.14057697355747223,
-0.3056276738643646,
-0.12778893113136292,
-0.23810873925685883,
-0.43041083216667175,
0.07364131510257721,
-0.014685843139886856,
0.14289841055870056,
-0.012018360197544098,
0.21348373591899872,
0.11327877640724182,
0.21397390961647034,
-0.4020756185054779,
0.14234788715839386,
-0.17718617618083954,
0.09960086643695831,
0.09315408766269684,
-0.13554859161376953,
0.1392204463481903,
0.051814910024404526,
0.11126954853534698,
0.2546558380126953,
-0.07314927130937576,
-0.3498375415802002,
-0.11043192446231842,
0.08029373735189438,
0.04296475276350975,
-0.12139826267957687,
-0.018652942031621933,
-0.3757631778717041,
-0.25712159276008606,
-0.2619505524635315,
0.20553825795650482,
-0.05955670028924942,
-0.10602714121341705,
0.17889057099819183,
-0.14844489097595215,
-0.05947142094373703,
0.11627981066703796,
-0.030737467110157013,
-0.2113562822341919,
0.11350301653146744,
0.17233796417713165,
0.03541186824440956,
0.007398670539259911,
0.0013167411088943481,
-0.31594744324684143,
0.0826844722032547,
0.1583465337753296,
-0.07415562123060226,
0.3244626820087433,
-0.37572717666625977,
-0.05665460228919983,
0.17693735659122467,
0.3609246015548706,
0.41158416867256165,
-0.2069200575351715,
-0.02834312990307808,
0.24290448427200317,
0.29815369844436646,
-0.25329941511154175,
-0.10016856342554092,
0.09493423998355865,
-0.27480506896972656,
0.30034834146499634,
0.12265083938837051,
0.10554638504981995,
-0.08647502958774567,
-0.10739181935787201,
0.22338134050369263,
0.1748349517583847,
-0.0378282368183136,
-0.14958788454532623,
0.34078478813171387,
0.11782075464725494,
-0.04993074759840965,
0.3016178011894226,
0.18213890492916107,
0.301396906375885,
0.7971210479736328,
0.07851167023181915,
0.25384676456451416,
-0.21107330918312073,
-0.09380136430263519,
-0.13657546043395996,
-0.4474603831768036,
0.022837109863758087,
-0.08015626668930054,
-0.03529869019985199,
-0.12467657774686813,
-0.20569443702697754,
0.20495110750198364,
-0.015431790612637997,
0.22015485167503357,
-0.14909659326076508,
0.043684691190719604,
-0.24865233898162842,
-0.1612086296081543,
0.04362469166517258,
-0.3107735514640808,
-0.0689435601234436,
0.10619263350963593,
-0.10688285529613495,
0.3263958692550659,
0.12429416179656982,
0.06238064542412758,
0.10222384333610535,
-0.4294131398200989,
0.20355626940727234,
-0.06269001960754395,
0.08767058700323105,
-0.362539142370224,
0.28398585319519043,
0.26131293177604675,
0.18963372707366943,
0.15717817842960358,
0.19094763696193695,
0.5729643702507019,
0.39447149634361267,
-0.13633108139038086,
-0.08099353313446045,
-0.27559906244277954,
-0.1103980764746666,
-0.4154096245765686,
0.28591975569725037,
0.19795739650726318,
0.3553822636604309,
0.46433591842651367,
0.20754824578762054,
-0.26809021830558777,
-0.06607875227928162,
0.1920684427022934,
-0.2637651860713959,
-0.2234545648097992,
0.10479047149419785,
0.06799925118684769,
-0.28635135293006897,
-0.3225554823875427,
-0.018377088010311127,
-0.43382272124290466,
-0.004564874805510044,
0.5934925079345703,
-0.11358815431594849,
0.309125691652298,
-0.3395165205001831,
0.14480556547641754,
0.0051999278366565704,
0.60579913854599,
0.295389324426651,
-0.017811313271522522,
-0.2954344153404236,
-0.019515685737133026,
-0.6181399822235107,
0.1262810379266739,
-0.1511761099100113,
0.012333894148468971,
-0.011653732508420944,
0.14253626763820648,
0.17389264702796936,
-0.03305090218782425,
-0.0051005929708480835,
0.03629682958126068,
-0.1498091071844101,
-0.10970120131969452,
-0.3313083350658417,
-0.2676610052585602,
-0.2250266820192337,
0.1569494754076004,
-0.0014629364013671875,
-0.3760659694671631,
0.15508276224136353,
-0.0955091044306755,
0.23003354668617249,
-0.17938651144504547,
0.0802161693572998,
-0.020627746358513832,
-0.035598188638687134,
0.15784423053264618,
0.03406703844666481,
0.3657599985599518,
-0.2838608920574188,
0.03404554724693298,
-0.13461974263191223,
-0.06317558884620667,
-0.17006678879261017,
0.1941983699798584,
0.2527383267879486,
0.26540833711624146,
-0.09622174501419067,
-0.17070834338665009,
-0.13808800280094147,
0.15670296549797058,
0.05871815234422684,
0.03713503107428551,
0.14296384155750275,
-0.05074285715818405,
0.1262890100479126,
0.05871701240539551,
0.18636725842952728,
0.4029746949672699,
-0.11137630045413971,
-0.034302711486816406,
-0.3506343960762024,
-0.5414938926696777,
0.2185375988483429,
-0.11808157712221146,
-0.5158481001853943,
0.010307740420103073,
0.13004052639007568,
0.18110820651054382,
0.0267860759049654,
-0.5836288928985596,
0.30677682161331177,
0.30969324707984924,
0.133999302983284,
-0.35290077328681946,
0.2580335736274719,
-0.05051710084080696,
0.05834290757775307,
0.011916577816009521,
0.12013280391693115,
0.024264071136713028,
-0.27022451162338257,
-0.2056572139263153,
-0.03220142796635628
] |
https://github.com/huggingface/datasets/issues/625 | dtype of tensors should be preserved | Indeed we convert tensors to list to be able to write in arrow format. Because of this conversion we lose the dtype information. We should add the dtype detection when we do type inference. However it would require a bit of refactoring since currently the conversion happens before the type inference..
And then for your information, when reading from arrow format we have to cast from arrow to numpy (which is fast since pyarrow has a numpy integration), and then to torch.
However there's one thing that can help you: we make sure that the dtypes correspond to what is defined in `features`.
Therefore what you can do is provide `features` in `.map(preprocess, feature=...)` to specify the output types.
For example in your case:
```python
from datasets import Features, Value, Sequence
features = Features({
"input_ids": Sequence(Value("int32")),
"sembedding": Sequence(Value("float32"))
})
preprocessed_dataset = dataset.map(preprocess, features=features)
preprocessed_dataset.set_format("torch", columns=["input_ids", "sembedding"])
print(preprocessed_dataset[0]["sembedding"].dtype)
# "torch.float32"
```
Let me know if it helps | After switching to `datasets` my model just broke. After a weekend of debugging, the issue was that my model could not handle the double that the Dataset provided, as it expected a float (but didn't give a warning, which seems a [PyTorch issue](https://discuss.pytorch.org/t/is-it-required-that-input-and-hidden-for-gru-have-the-same-dtype-float32/96221)).
As a user I did not expect this bug. I have a `map` function that I call on the Dataset that looks like this:
```python
def preprocess(sentences: List[str]):
token_ids = [[vocab.to_index(t) for t in s.split()] for s in sentences]
sembeddings = stransformer.encode(sentences)
print(sembeddings.dtype)
return {"input_ids": token_ids, "sembedding": sembeddings}
```
Given a list of `sentences` (`List[str]`), it converts those into token_ids on the one hand (list of lists of ints; `List[List[int]]`) and into sentence embeddings on the other (Tensor of dtype `torch.float32`). That means that I actually set the column "sembedding" to a tensor that I as a user expect to be a float32.
It appears though that behind the scenes, this tensor is converted into a **list**. I did not find this documented anywhere but I might have missed it. From a user's perspective this is incredibly important though, because it means you cannot do any data_type or tensor casting yourself in a mapping function! Furthermore, this can lead to issues, as was my case.
My model expected float32 precision, which I thought `sembedding` was because that is what `stransformer.encode` outputs. But behind the scenes this tensor is first cast to a list, and when we then set its format, as below, this column is cast not to float32 but to double precision float64.
```python
dataset.set_format(type="torch", columns=["input_ids", "sembedding"])
```
This happens because apparently there is an intermediate step of casting to a **numpy** array (?) **whose dtype creation/deduction is different from torch dtypes** (see the snippet below). As you can see, this means that the dtype is not preserved: if I got it right, the dataset goes from torch.float32 -> list -> float64 (numpy) -> torch.float64.
```python
import torch
import numpy as np
l = [-0.03010837361216545, -0.035979013890028, -0.016949838027358055]
torch_tensor = torch.tensor(l)
np_array = np.array(l)
np_to_torch = torch.from_numpy(np_array)
print(torch_tensor.dtype)
# torch.float32
print(np_array.dtype)
# float64
print(np_to_torch.dtype)
# torch.float64
```
This might lead to unwanted behaviour. I understand that the whole library is probably built around casting from numpy to other frameworks, so this might be difficult to solve. Perhaps `set_format` should include a `dtypes` option where for each input column the user can specify the wanted precision.
The alternative is that the user needs to cast manually after loading data from the dataset but that does not seem user-friendly, makes the dataset less portable, and might use more space in memory as well as on disk than is actually needed. | 156 | dtype of tensors should be preserved
After switching to `datasets` my model just broke. After a weekend of debugging, the issue was that my model could not handle the double that the Dataset provided, as it expected a float (but didn't give a warning, which seems a [PyTorch issue](https://discuss.pytorch.org/t/is-it-required-that-input-and-hidden-for-gru-have-the-same-dtype-float32/96221)).
As a user I did not expect this bug. I have a `map` function that I call on the Dataset that looks like this:
```python
def preprocess(sentences: List[str]):
token_ids = [[vocab.to_index(t) for t in s.split()] for s in sentences]
sembeddings = stransformer.encode(sentences)
print(sembeddings.dtype)
return {"input_ids": token_ids, "sembedding": sembeddings}
```
Given a list of `sentences` (`List[str]`), it converts those into token_ids on the one hand (list of lists of ints; `List[List[int]]`) and into sentence embeddings on the other (Tensor of dtype `torch.float32`). That means that I actually set the column "sembedding" to a tensor that I as a user expect to be a float32.
It appears though that behind the scenes, this tensor is converted into a **list**. I did not find this documented anywhere but I might have missed it. From a user's perspective this is incredibly important though, because it means you cannot do any data_type or tensor casting yourself in a mapping function! Furthermore, this can lead to issues, as was my case.
My model expected float32 precision, which I thought `sembedding` was because that is what `stransformer.encode` outputs. But behind the scenes this tensor is first cast to a list, and when we then set its format, as below, this column is cast not to float32 but to double precision float64.
```python
dataset.set_format(type="torch", columns=["input_ids", "sembedding"])
```
This happens because apparently there is an intermediate step of casting to a **numpy** array (?) **whose dtype creation/deduction is different from torch dtypes** (see the snippet below). As you can see, this means that the dtype is not preserved: if I got it right, the dataset goes from torch.float32 -> list -> float64 (numpy) -> torch.float64.
```python
import torch
import numpy as np
l = [-0.03010837361216545, -0.035979013890028, -0.016949838027358055]
torch_tensor = torch.tensor(l)
np_array = np.array(l)
np_to_torch = torch.from_numpy(np_array)
print(torch_tensor.dtype)
# torch.float32
print(np_array.dtype)
# float64
print(np_to_torch.dtype)
# torch.float64
```
This might lead to unwanted behaviour. I understand that the whole library is probably built around casting from numpy to other frameworks, so this might be difficult to solve. Perhaps `set_format` should include a `dtypes` option where for each input column the user can specify the wanted precision.
The alternative is that the user needs to cast manually after loading data from the dataset but that does not seem user-friendly, makes the dataset less portable, and might use more space in memory as well as on disk than is actually needed.
Indeed we convert tensors to list to be able to write in arrow format. Because of this conversion we lose the dtype information. We should add the dtype detection when we do type inference. However it would require a bit of refactoring since currently the conversion happens before the type inference..
And then for your information, when reading from arrow format we have to cast from arrow to numpy (which is fast since pyarrow has a numpy integration), and then to torch.
However there's one thing that can help you: we make sure that the dtypes correspond to what is defined in `features`.
Therefore what you can do is provide `features` in `.map(preprocess, feature=...)` to specify the output types.
For example in your case:
```python
from datasets import Features, Value, Sequence
features = Features({
"input_ids": Sequence(Value("int32")),
"sembedding": Sequence(Value("float32"))
})
preprocessed_dataset = dataset.map(preprocess, features=features)
preprocessed_dataset.set_format("torch", columns=["input_ids", "sembedding"])
print(preprocessed_dataset[0]["sembedding"].dtype)
# "torch.float32"
```
Let me know if it helps | [
-0.11343346536159515,
-0.22111466526985168,
-0.009710624814033508,
0.2073049545288086,
0.5532287955284119,
0.17301321029663086,
0.5313699841499329,
0.12258078157901764,
0.150482639670372,
-0.06653907895088196,
-0.08439914882183075,
0.24571450054645538,
-0.11755191534757614,
-0.1751451939344406,
0.10261566936969757,
-0.2025274932384491,
0.22825294733047485,
-0.06525659561157227,
-0.14417359232902527,
-0.2050461322069168,
-0.2274056226015091,
-0.08883131295442581,
-0.002708733081817627,
-0.20827312767505646,
-0.16018420457839966,
-0.16405940055847168,
0.24031659960746765,
-0.1392814815044403,
-0.1851637363433838,
-0.0010072011500597,
0.18012771010398865,
-0.16522276401519775,
0.4167291522026062,
0.5717642903327942,
-0.00011631557572400197,
0.2217250019311905,
-0.02668493241071701,
-0.07542597502470016,
-0.18863649666309357,
-0.00015363097190856934,
0.004606880247592926,
-0.1931508630514145,
-0.07237699627876282,
-0.1798606812953949,
-0.15412107110023499,
-0.18332535028457642,
-0.08451487869024277,
-0.7935450673103333,
0.288948655128479,
0.41082698106765747,
0.15193253755569458,
0.25708258152008057,
0.07120189070701599,
0.15259341895580292,
-0.1351296603679657,
0.2725161015987396,
-0.10301314294338226,
0.2802619934082031,
-0.02087704837322235,
0.3604665994644165,
-0.061481691896915436,
0.4459064304828644,
-0.3614790737628937,
-0.07507336139678955,
0.02915721759200096,
0.11278904974460602,
0.054124899208545685,
-0.4639113247394562,
-0.06628388911485672,
0.1654171347618103,
0.19734224677085876,
-0.23208093643188477,
-0.28436514735221863,
-0.16728922724723816,
-0.09335697442293167,
-0.36716192960739136,
0.06623804569244385,
-0.08458168804645538,
0.14548705518245697,
0.10315454006195068,
-0.08470848947763443,
-0.17156894505023956,
-0.03456921875476837,
0.132096529006958,
-0.47534000873565674,
0.21858203411102295,
-0.008936329744756222,
0.14741915464401245,
-0.10354362428188324,
-0.03271909058094025,
0.07431841641664505,
-0.11595109105110168,
0.22098515927791595,
-0.03320378065109253,
-0.17000536620616913,
-0.22360140085220337,
0.10681065917015076,
-0.4505300223827362,
-0.12784722447395325,
-0.4818670153617859,
0.22826427221298218,
0.1562221348285675,
-0.2183919996023178,
-0.027490384876728058,
0.21015053987503052,
0.3317386209964752,
-0.2976427674293518,
0.367876261472702,
0.2994464635848999,
-0.04473838582634926,
0.21113258600234985,
0.09851904213428497,
0.12822936475276947,
0.04643381014466286,
-0.011537410318851471,
0.10379434376955032,
0.5391174554824829,
-0.10612718760967255,
-0.31569528579711914,
0.24234473705291748,
-0.46409177780151367,
0.08543962985277176,
0.02905038744211197,
0.07622194290161133,
-0.15806791186332703,
0.44691890478134155,
0.1909368336200714,
0.08564047515392303,
-0.1537807136774063,
-0.048210855573415756,
-0.14087049663066864,
-0.24633057415485382,
0.0493122898042202,
-0.1757226288318634,
0.04734824225306511,
0.11107712984085083,
-0.05568140000104904,
0.29098451137542725,
0.13049538433551788,
0.16166114807128906,
-0.06239528954029083,
-0.14682485163211823,
0.5156334042549133,
0.29439330101013184,
-0.33007940649986267,
0.1609635055065155,
0.2148125320672989,
-0.35004568099975586,
-0.19412371516227722,
0.341382771730423,
-0.2835558354854584,
0.0002671480178833008,
-0.2552972733974457,
0.08967358618974686,
-0.06263385713100433,
-0.19429704546928406,
0.03833760321140289,
0.5168797969818115,
0.594578206539154,
0.07454080879688263,
0.3335525393486023,
-0.525503933429718,
-0.24441909790039062,
-0.21210946142673492,
0.06510867923498154,
-0.002308860421180725,
-0.46514448523521423,
-0.008492697030305862,
0.2366487979888916,
0.18429549038410187,
0.35619020462036133,
0.41371461749076843,
0.07049202919006348,
0.1077740415930748,
0.07491090148687363,
-0.005354985594749451,
0.4220856726169586,
0.11171625554561615,
-0.2204674929380417,
-0.0649489089846611,
-0.05865521728992462,
0.36356672644615173,
-0.0807047113776207,
0.007956146262586117,
0.31949523091316223,
-0.20357292890548706,
0.20783179998397827,
0.025410441681742668,
-0.27681705355644226,
0.08152221888303757,
-0.20613977313041687,
0.03879286348819733,
0.46476227045059204,
-0.08255188167095184,
-0.03550124540925026,
-0.03818029910326004,
-0.3315746784210205,
0.36261260509490967,
0.24249041080474854,
-0.13688836991786957,
0.03684653341770172,
0.04497833922505379,
0.05481328070163727,
-0.03281647711992264,
0.08329568803310394,
-0.08288977295160294,
-0.523478627204895,
-0.04705696925520897,
0.03621000051498413,
0.2670900523662567,
-0.05031956732273102,
-0.13625404238700867,
0.2245902121067047,
0.0831875205039978,
-0.010378997772932053,
0.039142340421676636,
0.06815090030431747,
-0.17175228893756866,
-0.42560845613479614,
0.07235339283943176,
-0.09666511416435242,
-0.21991173923015594,
-0.0393039844930172,
0.10643459856510162,
-0.4977482557296753,
0.08081146329641342,
0.007505254819989204,
-0.19667010009288788,
-0.2570154368877411,
0.28515398502349854,
0.02317342907190323,
-0.08918611705303192,
-0.23232731223106384,
0.0862705409526825,
0.19311130046844482,
-0.09235554933547974,
-0.6234656572341919,
0.5602859854698181,
0.5223328471183777,
0.02266843244433403,
0.19698143005371094,
0.41789913177490234,
0.01675347238779068,
0.06688133627176285,
-0.1525682806968689,
0.1664799302816391,
0.10833801329135895,
0.018407508730888367,
-0.2958195209503174,
0.06973261386156082,
0.24973002076148987,
0.17612649500370026,
-0.26090702414512634,
-0.1829361915588379,
-0.140511617064476,
-0.07615639269351959,
-0.02798193320631981,
0.13874343037605286,
-0.41208702325820923,
0.3359062671661377,
0.693458080291748,
-0.032273564487695694,
0.2642436921596527,
0.030832065269351006,
-0.3138764202594757,
-0.153360515832901,
0.22853298485279083,
-0.12157607823610306,
0.24705453217029572,
0.08514054864645004,
0.360852986574173,
-0.19991673529148102,
-0.16252516210079193,
-0.07482728362083435,
0.2153988778591156,
0.04692120477557182,
0.06636040657758713,
0.004941482096910477,
0.07510095089673996,
0.15419165790081024,
-0.10572898387908936,
0.2709602117538452,
-0.05039932578802109,
0.20320752263069153,
-0.42591342329978943,
0.21711808443069458,
-0.40165436267852783,
0.05126923322677612,
-0.22967557609081268,
-0.0917816013097763,
-0.07778926193714142,
-0.24561366438865662,
-0.029358524829149246,
0.0008399300277233124,
-0.2700946033000946,
0.3935126066207886,
0.26148757338523865,
0.11669249087572098,
0.08734393864870071,
-0.2350945919752121,
-0.11461342871189117,
-0.17242290079593658,
-0.2385483682155609,
0.040034521371126175,
0.20835444331169128,
-0.3795826733112335,
0.18495666980743408,
0.3574528694152832,
-0.2676811218261719,
-0.2696791887283325,
-0.7421141266822815,
0.04859907925128937,
-0.23554815351963043,
0.09608180820941925,
0.03812190517783165,
0.1293121576309204,
-0.024639245122671127,
0.051053427159786224,
0.02547403797507286,
0.09447668492794037,
-0.018104158341884613,
0.11803428828716278,
-0.19163598120212555,
0.02913101576268673,
-0.287290096282959,
-0.2801528573036194,
-0.03678306192159653,
-0.12199549376964569,
0.1812552809715271,
-0.07983054220676422,
-0.0676226019859314,
0.0514865443110466,
0.09122968465089798,
0.03105081617832184,
-0.05812995508313179,
0.23108986020088196,
-0.4207530915737152,
0.0914393961429596,
0.33490559458732605,
-0.15973693132400513,
-0.30688580870628357,
-0.14327839016914368,
0.023463808000087738,
-0.018258456140756607,
0.07451378554105759,
-0.2800920903682709,
-0.05703340843319893,
-0.21576252579689026,
0.26583534479141235,
-0.014034342020750046,
-0.1009145975112915,
0.5142834186553955,
0.23295871913433075,
0.07127039134502411,
-0.06039189174771309,
0.015321716666221619,
0.0630330741405487,
0.21779149770736694,
0.27216044068336487,
-0.009419813752174377,
0.3699360191822052,
0.1042172908782959,
0.3581047058105469,
0.29433825612068176,
-0.694893479347229,
-0.12603655457496643,
-0.05735335499048233,
0.21538463234901428,
-0.21745023131370544,
-0.2911490797996521,
0.03200322762131691,
-0.2955261766910553,
-0.19893890619277954,
0.00653453916311264,
-0.2766372561454773,
-0.2770918905735016,
0.11846509575843811,
0.23312193155288696,
0.13384196162223816,
-0.4014646112918854,
0.40340670943260193,
-0.30552613735198975,
-0.01881040632724762,
0.07031956315040588,
0.17255306243896484,
-0.1366494745016098,
-0.15400725603103638,
0.12495569884777069,
0.0767139345407486,
0.1390782594680786,
-0.04523887485265732,
-0.15606249868869781,
-0.1616584062576294,
-0.557334303855896,
0.2960478663444519,
0.07333878427743912,
0.399868369102478,
-0.1019989401102066,
-0.3138107657432556,
-0.12368954718112946,
0.26585084199905396,
0.3583010137081146,
-0.06517994403839111,
-0.30855584144592285,
-0.034075189381837845,
0.04683981090784073,
-0.11190840601921082,
0.09082196652889252,
-0.3705390393733978,
0.13999749720096588,
0.15985997021198273,
0.479920893907547,
-0.3152984380722046,
-0.15012376010417938,
0.34070873260498047,
0.09900666773319244,
-0.2651865482330322,
0.12570028007030487,
-0.3059803247451782,
-0.21725383400917053,
0.10291963815689087,
-0.1605294644832611,
0.32184264063835144,
-0.11301393061876297,
-0.16299845278263092,
-0.14211608469486237,
-0.18874917924404144,
-0.05938663333654404,
0.30244043469429016,
-0.05379674583673477,
0.17465460300445557,
0.2735580503940582,
-0.0524262934923172,
0.1738079935312271,
0.44847333431243896,
0.07103908807039261,
0.3958069980144501,
-0.2539946138858795,
-0.4725272059440613,
0.12058957666158676,
0.26259979605674744,
0.2191857099533081,
0.33603811264038086,
-0.06650428473949432,
-0.010750748217105865,
0.0495242178440094,
0.20130294561386108,
-0.41523611545562744,
0.14507253468036652,
0.30020561814308167,
0.43954455852508545,
-0.38180649280548096,
-0.3916044533252716,
0.33989906311035156,
0.10490445792675018,
-0.11184938251972198,
0.34528648853302,
-0.3406515121459961,
-0.4210638403892517,
0.4126031994819641,
0.48667266964912415,
0.9439163208007812,
-0.05152450501918793,
0.3623064160346985,
0.38867637515068054,
0.03951222449541092,
0.7027944922447205,
-0.21958842873573303,
0.09537244588136673,
-0.10928860306739807,
-0.20033836364746094,
-0.18212716281414032,
0.028335582464933395,
0.19228142499923706,
-0.17682752013206482,
-0.393464058637619,
-0.01142326183617115,
0.04501514136791229,
0.3950946629047394,
0.0918084904551506,
0.13700740039348602,
0.13373522460460663,
-0.3839353322982788,
0.0010392051190137863,
0.09620776772499084,
-0.14209260046482086,
-0.024558335542678833,
0.025837071239948273,
-0.12961609661579132,
-0.22719772160053253,
-0.03885548934340477,
-0.2351929396390915,
-0.2038242518901825,
-0.6721231341362,
0.22790579497814178,
-0.21128948032855988,
-0.3824329376220703,
0.21191668510437012,
0.3805316090583801,
0.4986087679862976,
0.06994155794382095,
-0.1444130837917328,
-0.05410018935799599,
0.14069318771362305,
0.250490665435791,
0.36745238304138184,
-0.3385370671749115,
0.5262500047683716,
0.1788806915283203,
-0.01704501360654831,
-0.05232264846563339,
0.01902991160750389,
0.11957865953445435,
-0.3839370012283325,
-0.04443635791540146,
0.010446440428495407,
-0.44863080978393555,
0.018025822937488556,
0.05181959271430969,
0.1929474025964737,
-0.07191915810108185,
0.08035727590322495,
0.00331946462392807,
0.06042002514004707,
0.43908897042274475,
-0.2384054809808731,
-0.20494019985198975,
-0.13601775467395782,
0.2581448554992676,
0.3120487332344055,
-0.027679068967700005,
0.3316820561885834,
0.17486529052257538,
-0.21990616619586945,
-0.13260075449943542,
0.26966220140457153,
0.09624751657247543,
-0.27186885476112366,
0.2938763201236725,
-0.22945858538150787,
-0.3275020122528076,
-0.40293389558792114,
0.0242936871945858,
0.12961499392986298,
0.020083393901586533,
-0.4275782108306885,
0.04812207072973251,
-0.4269220530986786,
0.19557899236679077,
0.1994590312242508,
0.22949692606925964,
-0.09680332988500595,
0.29025861620903015,
-0.18622124195098877,
-0.07525873929262161,
-0.27885961532592773,
-0.14547114074230194,
0.20151643455028534,
0.16078563034534454,
-0.04805085062980652,
-0.06225915253162384,
0.21537847816944122,
-0.2433135062456131,
0.0800854042172432,
0.09557824581861496,
0.08322387933731079,
-0.16887640953063965,
-0.13380040228366852,
0.08440303057432175,
-0.072153240442276,
-0.16313090920448303,
-0.020984705537557602,
-0.19534604251384735,
-0.18672753870487213,
-0.16780447959899902,
0.11266642808914185,
0.27993541955947876,
0.10184212028980255,
0.2763630449771881,
0.04173284024000168,
0.1626678705215454,
0.3086153268814087,
0.005494935438036919,
-0.1270996630191803,
0.2509423494338989,
0.06355921924114227,
0.33679789304733276,
0.01930283196270466,
-0.052214138209819794,
-0.1994486153125763,
0.2303502857685089,
0.050255488604307175,
-0.08984201401472092,
0.4385259449481964,
-0.18629160523414612,
-0.13802745938301086,
0.011326875537633896,
0.18398956954479218,
0.2505353093147278,
-0.31219640374183655,
-0.14360462129116058,
-0.027120452374219894,
0.10801446437835693,
-0.18460536003112793,
0.10111138969659805,
0.192087322473526,
-0.10860477387905121,
0.1267400085926056,
0.4136991500854492,
-0.029626328498125076,
0.5634446144104004,
-0.03976212441921234,
-0.007464313879609108,
0.1605871468782425,
-0.20024597644805908,
0.27978575229644775,
0.26319921016693115,
-0.08982723951339722,
0.15767043828964233,
0.2914581596851349,
0.0799153670668602,
0.13572201132774353,
0.14333833754062653,
0.04752008616924286,
0.20890893042087555,
0.05979480221867561,
0.02784871682524681,
0.4162575602531433,
-0.1557866632938385,
0.12274248898029327,
0.09084928035736084,
-0.43979018926620483,
0.2601422369480133,
0.3826686441898346,
0.07512034475803375,
-0.3052259087562561,
-0.23599055409431458,
-0.1305057853460312,
0.1503942310810089,
-0.4149083197116852,
0.00258022453635931,
-0.2539517879486084,
0.08597511798143387,
-0.061961494386196136,
-0.24506394565105438,
-0.2087458372116089,
-0.04735669493675232,
0.20736268162727356,
0.20336312055587769,
-0.1458740234375,
0.09162641316652298,
-0.2127763032913208,
-0.1652701497077942,
0.0895995944738388,
0.046989139169454575,
0.3118058741092682,
0.39766836166381836,
-0.1903301477432251,
-0.16406285762786865,
0.2795582711696625,
0.26088911294937134,
0.19008904695510864,
-0.25510039925575256,
0.31881317496299744,
0.13687826693058014,
-0.2822490930557251,
0.0019034910947084427,
0.2594357132911682,
0.02231227606534958,
-0.018162522464990616,
0.21527060866355896,
0.10371076315641403,
-0.02872312441468239,
0.15876781940460205,
-0.08291377127170563,
0.23464332520961761,
0.01977112516760826,
0.6455353498458862,
-0.04291380196809769,
-0.14672376215457916,
-0.07847489416599274,
-0.20738574862480164,
-0.21239537000656128,
-0.22240635752677917,
0.7710813283920288,
-0.1710176169872284,
0.2005576491355896,
-0.0775001272559166,
0.06579103320837021,
0.2825329303741455,
0.3724643290042877,
0.08754625916481018,
-0.05230213701725006,
-0.2187703549861908,
0.3671228885650635,
-0.27810391783714294,
0.10558496415615082,
0.21418455243110657,
-0.047855645418167114,
-0.021830562502145767,
0.22368447482585907,
0.4392271637916565,
0.25887101888656616,
0.044760867953300476,
-0.4173411726951599,
0.21641117334365845,
0.033113352954387665,
-0.10542528331279755,
-0.2507250905036926,
-0.4146488904953003,
0.18060946464538574,
0.02940572053194046,
-0.3498017489910126,
0.33164361119270325,
0.13302673399448395,
-0.024106845259666443,
-0.4745326638221741,
0.0894954651594162,
-0.005397513508796692,
0.21871206164360046,
0.23784981667995453,
0.43774640560150146,
0.12689939141273499,
-0.1296064257621765,
-0.25559261441230774,
0.1482960283756256,
-0.05249197781085968,
-0.48035117983818054,
0.411639004945755,
-0.16013497114181519,
0.3657142221927643,
-0.30115121603012085,
-0.29076364636421204,
-0.1951594054698944,
0.02586054801940918,
0.08516983687877655,
-0.43646594882011414,
-0.5503329634666443,
0.3894611895084381,
-0.1322181671857834,
-0.08450661599636078,
0.2017909586429596,
0.48029494285583496,
0.0986783504486084,
0.3818567395210266,
-0.2019927054643631,
-0.34192362427711487,
0.6405491828918457,
-0.26909732818603516,
-0.04120266065001488,
-0.06233583763241768,
-0.07256360352039337,
-0.06485878676176071,
0.050931334495544434,
-0.8520141839981079,
-0.23993265628814697,
0.29742977023124695,
-0.2665523886680603,
-0.248223677277565,
0.30915889143943787,
0.11968289315700531,
0.13414564728736877,
-0.3145247995853424,
0.5315725803375244,
-0.04561431705951691,
-0.15220040082931519,
0.09404595196247101,
-0.18822573125362396
] |
https://github.com/huggingface/datasets/issues/625 | dtype of tensors should be preserved | If the arrow format is basically lists, why is the intermediate step to numpy necessary? I am a bit confused about that part.
Thanks for your suggestion. as I have currently implemented this, I cast to torch.Tensor in my collate_fn to save disk space (so I do not have to save padded tensors to max_len but can pad up to max batch len in collate_fn) at the cost of a bit slower processing. So for me this is not relevant anymore, but I am sure it is for others! | After switching to `datasets` my model just broke. After a weekend of debugging, the issue was that my model could not handle the double that the Dataset provided, as it expected a float (but didn't give a warning, which seems a [PyTorch issue](https://discuss.pytorch.org/t/is-it-required-that-input-and-hidden-for-gru-have-the-same-dtype-float32/96221)).
As a user I did not expect this bug. I have a `map` function that I call on the Dataset that looks like this:
```python
def preprocess(sentences: List[str]):
token_ids = [[vocab.to_index(t) for t in s.split()] for s in sentences]
sembeddings = stransformer.encode(sentences)
print(sembeddings.dtype)
return {"input_ids": token_ids, "sembedding": sembeddings}
```
Given a list of `sentences` (`List[str]`), it converts those into token_ids on the one hand (list of lists of ints; `List[List[int]]`) and into sentence embeddings on the other (Tensor of dtype `torch.float32`). That means that I actually set the column "sembedding" to a tensor that I as a user expect to be a float32.
It appears though that behind the scenes, this tensor is converted into a **list**. I did not find this documented anywhere but I might have missed it. From a user's perspective this is incredibly important though, because it means you cannot do any data_type or tensor casting yourself in a mapping function! Furthermore, this can lead to issues, as was my case.
My model expected float32 precision, which I thought `sembedding` was because that is what `stransformer.encode` outputs. But behind the scenes this tensor is first cast to a list, and when we then set its format, as below, this column is cast not to float32 but to double precision float64.
```python
dataset.set_format(type="torch", columns=["input_ids", "sembedding"])
```
This happens because apparently there is an intermediate step of casting to a **numpy** array (?) **whose dtype creation/deduction is different from torch dtypes** (see the snippet below). As you can see, this means that the dtype is not preserved: if I got it right, the dataset goes from torch.float32 -> list -> float64 (numpy) -> torch.float64.
```python
import torch
import numpy as np
l = [-0.03010837361216545, -0.035979013890028, -0.016949838027358055]
torch_tensor = torch.tensor(l)
np_array = np.array(l)
np_to_torch = torch.from_numpy(np_array)
print(torch_tensor.dtype)
# torch.float32
print(np_array.dtype)
# float64
print(np_to_torch.dtype)
# torch.float64
```
This might lead to unwanted behaviour. I understand that the whole library is probably built around casting from numpy to other frameworks, so this might be difficult to solve. Perhaps `set_format` should include a `dtypes` option where for each input column the user can specify the wanted precision.
The alternative is that the user needs to cast manually after loading data from the dataset but that does not seem user-friendly, makes the dataset less portable, and might use more space in memory as well as on disk than is actually needed. | 89 | dtype of tensors should be preserved
After switching to `datasets` my model just broke. After a weekend of debugging, the issue was that my model could not handle the double that the Dataset provided, as it expected a float (but didn't give a warning, which seems a [PyTorch issue](https://discuss.pytorch.org/t/is-it-required-that-input-and-hidden-for-gru-have-the-same-dtype-float32/96221)).
As a user I did not expect this bug. I have a `map` function that I call on the Dataset that looks like this:
```python
def preprocess(sentences: List[str]):
token_ids = [[vocab.to_index(t) for t in s.split()] for s in sentences]
sembeddings = stransformer.encode(sentences)
print(sembeddings.dtype)
return {"input_ids": token_ids, "sembedding": sembeddings}
```
Given a list of `sentences` (`List[str]`), it converts those into token_ids on the one hand (list of lists of ints; `List[List[int]]`) and into sentence embeddings on the other (Tensor of dtype `torch.float32`). That means that I actually set the column "sembedding" to a tensor that I as a user expect to be a float32.
It appears though that behind the scenes, this tensor is converted into a **list**. I did not find this documented anywhere but I might have missed it. From a user's perspective this is incredibly important though, because it means you cannot do any data_type or tensor casting yourself in a mapping function! Furthermore, this can lead to issues, as was my case.
My model expected float32 precision, which I thought `sembedding` was because that is what `stransformer.encode` outputs. But behind the scenes this tensor is first cast to a list, and when we then set its format, as below, this column is cast not to float32 but to double precision float64.
```python
dataset.set_format(type="torch", columns=["input_ids", "sembedding"])
```
This happens because apparently there is an intermediate step of casting to a **numpy** array (?) **whose dtype creation/deduction is different from torch dtypes** (see the snippet below). As you can see, this means that the dtype is not preserved: if I got it right, the dataset goes from torch.float32 -> list -> float64 (numpy) -> torch.float64.
```python
import torch
import numpy as np
l = [-0.03010837361216545, -0.035979013890028, -0.016949838027358055]
torch_tensor = torch.tensor(l)
np_array = np.array(l)
np_to_torch = torch.from_numpy(np_array)
print(torch_tensor.dtype)
# torch.float32
print(np_array.dtype)
# float64
print(np_to_torch.dtype)
# torch.float64
```
This might lead to unwanted behaviour. I understand that the whole library is probably built around casting from numpy to other frameworks, so this might be difficult to solve. Perhaps `set_format` should include a `dtypes` option where for each input column the user can specify the wanted precision.
The alternative is that the user needs to cast manually after loading data from the dataset but that does not seem user-friendly, makes the dataset less portable, and might use more space in memory as well as on disk than is actually needed.
If the arrow format is basically lists, why is the intermediate step to numpy necessary? I am a bit confused about that part.
Thanks for your suggestion. as I have currently implemented this, I cast to torch.Tensor in my collate_fn to save disk space (so I do not have to save padded tensors to max_len but can pad up to max batch len in collate_fn) at the cost of a bit slower processing. So for me this is not relevant anymore, but I am sure it is for others! | [
-0.11343346536159515,
-0.22111466526985168,
-0.009710624814033508,
0.2073049545288086,
0.5532287955284119,
0.17301321029663086,
0.5313699841499329,
0.12258078157901764,
0.150482639670372,
-0.06653907895088196,
-0.08439914882183075,
0.24571450054645538,
-0.11755191534757614,
-0.1751451939344406,
0.10261566936969757,
-0.2025274932384491,
0.22825294733047485,
-0.06525659561157227,
-0.14417359232902527,
-0.2050461322069168,
-0.2274056226015091,
-0.08883131295442581,
-0.002708733081817627,
-0.20827312767505646,
-0.16018420457839966,
-0.16405940055847168,
0.24031659960746765,
-0.1392814815044403,
-0.1851637363433838,
-0.0010072011500597,
0.18012771010398865,
-0.16522276401519775,
0.4167291522026062,
0.5717642903327942,
-0.00011631557572400197,
0.2217250019311905,
-0.02668493241071701,
-0.07542597502470016,
-0.18863649666309357,
-0.00015363097190856934,
0.004606880247592926,
-0.1931508630514145,
-0.07237699627876282,
-0.1798606812953949,
-0.15412107110023499,
-0.18332535028457642,
-0.08451487869024277,
-0.7935450673103333,
0.288948655128479,
0.41082698106765747,
0.15193253755569458,
0.25708258152008057,
0.07120189070701599,
0.15259341895580292,
-0.1351296603679657,
0.2725161015987396,
-0.10301314294338226,
0.2802619934082031,
-0.02087704837322235,
0.3604665994644165,
-0.061481691896915436,
0.4459064304828644,
-0.3614790737628937,
-0.07507336139678955,
0.02915721759200096,
0.11278904974460602,
0.054124899208545685,
-0.4639113247394562,
-0.06628388911485672,
0.1654171347618103,
0.19734224677085876,
-0.23208093643188477,
-0.28436514735221863,
-0.16728922724723816,
-0.09335697442293167,
-0.36716192960739136,
0.06623804569244385,
-0.08458168804645538,
0.14548705518245697,
0.10315454006195068,
-0.08470848947763443,
-0.17156894505023956,
-0.03456921875476837,
0.132096529006958,
-0.47534000873565674,
0.21858203411102295,
-0.008936329744756222,
0.14741915464401245,
-0.10354362428188324,
-0.03271909058094025,
0.07431841641664505,
-0.11595109105110168,
0.22098515927791595,
-0.03320378065109253,
-0.17000536620616913,
-0.22360140085220337,
0.10681065917015076,
-0.4505300223827362,
-0.12784722447395325,
-0.4818670153617859,
0.22826427221298218,
0.1562221348285675,
-0.2183919996023178,
-0.027490384876728058,
0.21015053987503052,
0.3317386209964752,
-0.2976427674293518,
0.367876261472702,
0.2994464635848999,
-0.04473838582634926,
0.21113258600234985,
0.09851904213428497,
0.12822936475276947,
0.04643381014466286,
-0.011537410318851471,
0.10379434376955032,
0.5391174554824829,
-0.10612718760967255,
-0.31569528579711914,
0.24234473705291748,
-0.46409177780151367,
0.08543962985277176,
0.02905038744211197,
0.07622194290161133,
-0.15806791186332703,
0.44691890478134155,
0.1909368336200714,
0.08564047515392303,
-0.1537807136774063,
-0.048210855573415756,
-0.14087049663066864,
-0.24633057415485382,
0.0493122898042202,
-0.1757226288318634,
0.04734824225306511,
0.11107712984085083,
-0.05568140000104904,
0.29098451137542725,
0.13049538433551788,
0.16166114807128906,
-0.06239528954029083,
-0.14682485163211823,
0.5156334042549133,
0.29439330101013184,
-0.33007940649986267,
0.1609635055065155,
0.2148125320672989,
-0.35004568099975586,
-0.19412371516227722,
0.341382771730423,
-0.2835558354854584,
0.0002671480178833008,
-0.2552972733974457,
0.08967358618974686,
-0.06263385713100433,
-0.19429704546928406,
0.03833760321140289,
0.5168797969818115,
0.594578206539154,
0.07454080879688263,
0.3335525393486023,
-0.525503933429718,
-0.24441909790039062,
-0.21210946142673492,
0.06510867923498154,
-0.002308860421180725,
-0.46514448523521423,
-0.008492697030305862,
0.2366487979888916,
0.18429549038410187,
0.35619020462036133,
0.41371461749076843,
0.07049202919006348,
0.1077740415930748,
0.07491090148687363,
-0.005354985594749451,
0.4220856726169586,
0.11171625554561615,
-0.2204674929380417,
-0.0649489089846611,
-0.05865521728992462,
0.36356672644615173,
-0.0807047113776207,
0.007956146262586117,
0.31949523091316223,
-0.20357292890548706,
0.20783179998397827,
0.025410441681742668,
-0.27681705355644226,
0.08152221888303757,
-0.20613977313041687,
0.03879286348819733,
0.46476227045059204,
-0.08255188167095184,
-0.03550124540925026,
-0.03818029910326004,
-0.3315746784210205,
0.36261260509490967,
0.24249041080474854,
-0.13688836991786957,
0.03684653341770172,
0.04497833922505379,
0.05481328070163727,
-0.03281647711992264,
0.08329568803310394,
-0.08288977295160294,
-0.523478627204895,
-0.04705696925520897,
0.03621000051498413,
0.2670900523662567,
-0.05031956732273102,
-0.13625404238700867,
0.2245902121067047,
0.0831875205039978,
-0.010378997772932053,
0.039142340421676636,
0.06815090030431747,
-0.17175228893756866,
-0.42560845613479614,
0.07235339283943176,
-0.09666511416435242,
-0.21991173923015594,
-0.0393039844930172,
0.10643459856510162,
-0.4977482557296753,
0.08081146329641342,
0.007505254819989204,
-0.19667010009288788,
-0.2570154368877411,
0.28515398502349854,
0.02317342907190323,
-0.08918611705303192,
-0.23232731223106384,
0.0862705409526825,
0.19311130046844482,
-0.09235554933547974,
-0.6234656572341919,
0.5602859854698181,
0.5223328471183777,
0.02266843244433403,
0.19698143005371094,
0.41789913177490234,
0.01675347238779068,
0.06688133627176285,
-0.1525682806968689,
0.1664799302816391,
0.10833801329135895,
0.018407508730888367,
-0.2958195209503174,
0.06973261386156082,
0.24973002076148987,
0.17612649500370026,
-0.26090702414512634,
-0.1829361915588379,
-0.140511617064476,
-0.07615639269351959,
-0.02798193320631981,
0.13874343037605286,
-0.41208702325820923,
0.3359062671661377,
0.693458080291748,
-0.032273564487695694,
0.2642436921596527,
0.030832065269351006,
-0.3138764202594757,
-0.153360515832901,
0.22853298485279083,
-0.12157607823610306,
0.24705453217029572,
0.08514054864645004,
0.360852986574173,
-0.19991673529148102,
-0.16252516210079193,
-0.07482728362083435,
0.2153988778591156,
0.04692120477557182,
0.06636040657758713,
0.004941482096910477,
0.07510095089673996,
0.15419165790081024,
-0.10572898387908936,
0.2709602117538452,
-0.05039932578802109,
0.20320752263069153,
-0.42591342329978943,
0.21711808443069458,
-0.40165436267852783,
0.05126923322677612,
-0.22967557609081268,
-0.0917816013097763,
-0.07778926193714142,
-0.24561366438865662,
-0.029358524829149246,
0.0008399300277233124,
-0.2700946033000946,
0.3935126066207886,
0.26148757338523865,
0.11669249087572098,
0.08734393864870071,
-0.2350945919752121,
-0.11461342871189117,
-0.17242290079593658,
-0.2385483682155609,
0.040034521371126175,
0.20835444331169128,
-0.3795826733112335,
0.18495666980743408,
0.3574528694152832,
-0.2676811218261719,
-0.2696791887283325,
-0.7421141266822815,
0.04859907925128937,
-0.23554815351963043,
0.09608180820941925,
0.03812190517783165,
0.1293121576309204,
-0.024639245122671127,
0.051053427159786224,
0.02547403797507286,
0.09447668492794037,
-0.018104158341884613,
0.11803428828716278,
-0.19163598120212555,
0.02913101576268673,
-0.287290096282959,
-0.2801528573036194,
-0.03678306192159653,
-0.12199549376964569,
0.1812552809715271,
-0.07983054220676422,
-0.0676226019859314,
0.0514865443110466,
0.09122968465089798,
0.03105081617832184,
-0.05812995508313179,
0.23108986020088196,
-0.4207530915737152,
0.0914393961429596,
0.33490559458732605,
-0.15973693132400513,
-0.30688580870628357,
-0.14327839016914368,
0.023463808000087738,
-0.018258456140756607,
0.07451378554105759,
-0.2800920903682709,
-0.05703340843319893,
-0.21576252579689026,
0.26583534479141235,
-0.014034342020750046,
-0.1009145975112915,
0.5142834186553955,
0.23295871913433075,
0.07127039134502411,
-0.06039189174771309,
0.015321716666221619,
0.0630330741405487,
0.21779149770736694,
0.27216044068336487,
-0.009419813752174377,
0.3699360191822052,
0.1042172908782959,
0.3581047058105469,
0.29433825612068176,
-0.694893479347229,
-0.12603655457496643,
-0.05735335499048233,
0.21538463234901428,
-0.21745023131370544,
-0.2911490797996521,
0.03200322762131691,
-0.2955261766910553,
-0.19893890619277954,
0.00653453916311264,
-0.2766372561454773,
-0.2770918905735016,
0.11846509575843811,
0.23312193155288696,
0.13384196162223816,
-0.4014646112918854,
0.40340670943260193,
-0.30552613735198975,
-0.01881040632724762,
0.07031956315040588,
0.17255306243896484,
-0.1366494745016098,
-0.15400725603103638,
0.12495569884777069,
0.0767139345407486,
0.1390782594680786,
-0.04523887485265732,
-0.15606249868869781,
-0.1616584062576294,
-0.557334303855896,
0.2960478663444519,
0.07333878427743912,
0.399868369102478,
-0.1019989401102066,
-0.3138107657432556,
-0.12368954718112946,
0.26585084199905396,
0.3583010137081146,
-0.06517994403839111,
-0.30855584144592285,
-0.034075189381837845,
0.04683981090784073,
-0.11190840601921082,
0.09082196652889252,
-0.3705390393733978,
0.13999749720096588,
0.15985997021198273,
0.479920893907547,
-0.3152984380722046,
-0.15012376010417938,
0.34070873260498047,
0.09900666773319244,
-0.2651865482330322,
0.12570028007030487,
-0.3059803247451782,
-0.21725383400917053,
0.10291963815689087,
-0.1605294644832611,
0.32184264063835144,
-0.11301393061876297,
-0.16299845278263092,
-0.14211608469486237,
-0.18874917924404144,
-0.05938663333654404,
0.30244043469429016,
-0.05379674583673477,
0.17465460300445557,
0.2735580503940582,
-0.0524262934923172,
0.1738079935312271,
0.44847333431243896,
0.07103908807039261,
0.3958069980144501,
-0.2539946138858795,
-0.4725272059440613,
0.12058957666158676,
0.26259979605674744,
0.2191857099533081,
0.33603811264038086,
-0.06650428473949432,
-0.010750748217105865,
0.0495242178440094,
0.20130294561386108,
-0.41523611545562744,
0.14507253468036652,
0.30020561814308167,
0.43954455852508545,
-0.38180649280548096,
-0.3916044533252716,
0.33989906311035156,
0.10490445792675018,
-0.11184938251972198,
0.34528648853302,
-0.3406515121459961,
-0.4210638403892517,
0.4126031994819641,
0.48667266964912415,
0.9439163208007812,
-0.05152450501918793,
0.3623064160346985,
0.38867637515068054,
0.03951222449541092,
0.7027944922447205,
-0.21958842873573303,
0.09537244588136673,
-0.10928860306739807,
-0.20033836364746094,
-0.18212716281414032,
0.028335582464933395,
0.19228142499923706,
-0.17682752013206482,
-0.393464058637619,
-0.01142326183617115,
0.04501514136791229,
0.3950946629047394,
0.0918084904551506,
0.13700740039348602,
0.13373522460460663,
-0.3839353322982788,
0.0010392051190137863,
0.09620776772499084,
-0.14209260046482086,
-0.024558335542678833,
0.025837071239948273,
-0.12961609661579132,
-0.22719772160053253,
-0.03885548934340477,
-0.2351929396390915,
-0.2038242518901825,
-0.6721231341362,
0.22790579497814178,
-0.21128948032855988,
-0.3824329376220703,
0.21191668510437012,
0.3805316090583801,
0.4986087679862976,
0.06994155794382095,
-0.1444130837917328,
-0.05410018935799599,
0.14069318771362305,
0.250490665435791,
0.36745238304138184,
-0.3385370671749115,
0.5262500047683716,
0.1788806915283203,
-0.01704501360654831,
-0.05232264846563339,
0.01902991160750389,
0.11957865953445435,
-0.3839370012283325,
-0.04443635791540146,
0.010446440428495407,
-0.44863080978393555,
0.018025822937488556,
0.05181959271430969,
0.1929474025964737,
-0.07191915810108185,
0.08035727590322495,
0.00331946462392807,
0.06042002514004707,
0.43908897042274475,
-0.2384054809808731,
-0.20494019985198975,
-0.13601775467395782,
0.2581448554992676,
0.3120487332344055,
-0.027679068967700005,
0.3316820561885834,
0.17486529052257538,
-0.21990616619586945,
-0.13260075449943542,
0.26966220140457153,
0.09624751657247543,
-0.27186885476112366,
0.2938763201236725,
-0.22945858538150787,
-0.3275020122528076,
-0.40293389558792114,
0.0242936871945858,
0.12961499392986298,
0.020083393901586533,
-0.4275782108306885,
0.04812207072973251,
-0.4269220530986786,
0.19557899236679077,
0.1994590312242508,
0.22949692606925964,
-0.09680332988500595,
0.29025861620903015,
-0.18622124195098877,
-0.07525873929262161,
-0.27885961532592773,
-0.14547114074230194,
0.20151643455028534,
0.16078563034534454,
-0.04805085062980652,
-0.06225915253162384,
0.21537847816944122,
-0.2433135062456131,
0.0800854042172432,
0.09557824581861496,
0.08322387933731079,
-0.16887640953063965,
-0.13380040228366852,
0.08440303057432175,
-0.072153240442276,
-0.16313090920448303,
-0.020984705537557602,
-0.19534604251384735,
-0.18672753870487213,
-0.16780447959899902,
0.11266642808914185,
0.27993541955947876,
0.10184212028980255,
0.2763630449771881,
0.04173284024000168,
0.1626678705215454,
0.3086153268814087,
0.005494935438036919,
-0.1270996630191803,
0.2509423494338989,
0.06355921924114227,
0.33679789304733276,
0.01930283196270466,
-0.052214138209819794,
-0.1994486153125763,
0.2303502857685089,
0.050255488604307175,
-0.08984201401472092,
0.4385259449481964,
-0.18629160523414612,
-0.13802745938301086,
0.011326875537633896,
0.18398956954479218,
0.2505353093147278,
-0.31219640374183655,
-0.14360462129116058,
-0.027120452374219894,
0.10801446437835693,
-0.18460536003112793,
0.10111138969659805,
0.192087322473526,
-0.10860477387905121,
0.1267400085926056,
0.4136991500854492,
-0.029626328498125076,
0.5634446144104004,
-0.03976212441921234,
-0.007464313879609108,
0.1605871468782425,
-0.20024597644805908,
0.27978575229644775,
0.26319921016693115,
-0.08982723951339722,
0.15767043828964233,
0.2914581596851349,
0.0799153670668602,
0.13572201132774353,
0.14333833754062653,
0.04752008616924286,
0.20890893042087555,
0.05979480221867561,
0.02784871682524681,
0.4162575602531433,
-0.1557866632938385,
0.12274248898029327,
0.09084928035736084,
-0.43979018926620483,
0.2601422369480133,
0.3826686441898346,
0.07512034475803375,
-0.3052259087562561,
-0.23599055409431458,
-0.1305057853460312,
0.1503942310810089,
-0.4149083197116852,
0.00258022453635931,
-0.2539517879486084,
0.08597511798143387,
-0.061961494386196136,
-0.24506394565105438,
-0.2087458372116089,
-0.04735669493675232,
0.20736268162727356,
0.20336312055587769,
-0.1458740234375,
0.09162641316652298,
-0.2127763032913208,
-0.1652701497077942,
0.0895995944738388,
0.046989139169454575,
0.3118058741092682,
0.39766836166381836,
-0.1903301477432251,
-0.16406285762786865,
0.2795582711696625,
0.26088911294937134,
0.19008904695510864,
-0.25510039925575256,
0.31881317496299744,
0.13687826693058014,
-0.2822490930557251,
0.0019034910947084427,
0.2594357132911682,
0.02231227606534958,
-0.018162522464990616,
0.21527060866355896,
0.10371076315641403,
-0.02872312441468239,
0.15876781940460205,
-0.08291377127170563,
0.23464332520961761,
0.01977112516760826,
0.6455353498458862,
-0.04291380196809769,
-0.14672376215457916,
-0.07847489416599274,
-0.20738574862480164,
-0.21239537000656128,
-0.22240635752677917,
0.7710813283920288,
-0.1710176169872284,
0.2005576491355896,
-0.0775001272559166,
0.06579103320837021,
0.2825329303741455,
0.3724643290042877,
0.08754625916481018,
-0.05230213701725006,
-0.2187703549861908,
0.3671228885650635,
-0.27810391783714294,
0.10558496415615082,
0.21418455243110657,
-0.047855645418167114,
-0.021830562502145767,
0.22368447482585907,
0.4392271637916565,
0.25887101888656616,
0.044760867953300476,
-0.4173411726951599,
0.21641117334365845,
0.033113352954387665,
-0.10542528331279755,
-0.2507250905036926,
-0.4146488904953003,
0.18060946464538574,
0.02940572053194046,
-0.3498017489910126,
0.33164361119270325,
0.13302673399448395,
-0.024106845259666443,
-0.4745326638221741,
0.0894954651594162,
-0.005397513508796692,
0.21871206164360046,
0.23784981667995453,
0.43774640560150146,
0.12689939141273499,
-0.1296064257621765,
-0.25559261441230774,
0.1482960283756256,
-0.05249197781085968,
-0.48035117983818054,
0.411639004945755,
-0.16013497114181519,
0.3657142221927643,
-0.30115121603012085,
-0.29076364636421204,
-0.1951594054698944,
0.02586054801940918,
0.08516983687877655,
-0.43646594882011414,
-0.5503329634666443,
0.3894611895084381,
-0.1322181671857834,
-0.08450661599636078,
0.2017909586429596,
0.48029494285583496,
0.0986783504486084,
0.3818567395210266,
-0.2019927054643631,
-0.34192362427711487,
0.6405491828918457,
-0.26909732818603516,
-0.04120266065001488,
-0.06233583763241768,
-0.07256360352039337,
-0.06485878676176071,
0.050931334495544434,
-0.8520141839981079,
-0.23993265628814697,
0.29742977023124695,
-0.2665523886680603,
-0.248223677277565,
0.30915889143943787,
0.11968289315700531,
0.13414564728736877,
-0.3145247995853424,
0.5315725803375244,
-0.04561431705951691,
-0.15220040082931519,
0.09404595196247101,
-0.18822573125362396
] |
https://github.com/huggingface/datasets/issues/625 | dtype of tensors should be preserved | I'm glad you managed to figure something out :)
Casting from arrow to numpy can be 100x faster than casting from arrow to list.
This is because arrow has an integration with numpy that allows it to instantiate numpy arrays with zero-copy from arrow.
On the other hand to create python lists it is slow since it has to recreate the list object by iterating through each element in python. | After switching to `datasets` my model just broke. After a weekend of debugging, the issue was that my model could not handle the double that the Dataset provided, as it expected a float (but didn't give a warning, which seems a [PyTorch issue](https://discuss.pytorch.org/t/is-it-required-that-input-and-hidden-for-gru-have-the-same-dtype-float32/96221)).
As a user I did not expect this bug. I have a `map` function that I call on the Dataset that looks like this:
```python
def preprocess(sentences: List[str]):
token_ids = [[vocab.to_index(t) for t in s.split()] for s in sentences]
sembeddings = stransformer.encode(sentences)
print(sembeddings.dtype)
return {"input_ids": token_ids, "sembedding": sembeddings}
```
Given a list of `sentences` (`List[str]`), it converts those into token_ids on the one hand (list of lists of ints; `List[List[int]]`) and into sentence embeddings on the other (Tensor of dtype `torch.float32`). That means that I actually set the column "sembedding" to a tensor that I as a user expect to be a float32.
It appears though that behind the scenes, this tensor is converted into a **list**. I did not find this documented anywhere but I might have missed it. From a user's perspective this is incredibly important though, because it means you cannot do any data_type or tensor casting yourself in a mapping function! Furthermore, this can lead to issues, as was my case.
My model expected float32 precision, which I thought `sembedding` was because that is what `stransformer.encode` outputs. But behind the scenes this tensor is first cast to a list, and when we then set its format, as below, this column is cast not to float32 but to double precision float64.
```python
dataset.set_format(type="torch", columns=["input_ids", "sembedding"])
```
This happens because apparently there is an intermediate step of casting to a **numpy** array (?) **whose dtype creation/deduction is different from torch dtypes** (see the snippet below). As you can see, this means that the dtype is not preserved: if I got it right, the dataset goes from torch.float32 -> list -> float64 (numpy) -> torch.float64.
```python
import torch
import numpy as np
l = [-0.03010837361216545, -0.035979013890028, -0.016949838027358055]
torch_tensor = torch.tensor(l)
np_array = np.array(l)
np_to_torch = torch.from_numpy(np_array)
print(torch_tensor.dtype)
# torch.float32
print(np_array.dtype)
# float64
print(np_to_torch.dtype)
# torch.float64
```
This might lead to unwanted behaviour. I understand that the whole library is probably built around casting from numpy to other frameworks, so this might be difficult to solve. Perhaps `set_format` should include a `dtypes` option where for each input column the user can specify the wanted precision.
The alternative is that the user needs to cast manually after loading data from the dataset but that does not seem user-friendly, makes the dataset less portable, and might use more space in memory as well as on disk than is actually needed. | 70 | dtype of tensors should be preserved
After switching to `datasets` my model just broke. After a weekend of debugging, the issue was that my model could not handle the double that the Dataset provided, as it expected a float (but didn't give a warning, which seems a [PyTorch issue](https://discuss.pytorch.org/t/is-it-required-that-input-and-hidden-for-gru-have-the-same-dtype-float32/96221)).
As a user I did not expect this bug. I have a `map` function that I call on the Dataset that looks like this:
```python
def preprocess(sentences: List[str]):
token_ids = [[vocab.to_index(t) for t in s.split()] for s in sentences]
sembeddings = stransformer.encode(sentences)
print(sembeddings.dtype)
return {"input_ids": token_ids, "sembedding": sembeddings}
```
Given a list of `sentences` (`List[str]`), it converts those into token_ids on the one hand (list of lists of ints; `List[List[int]]`) and into sentence embeddings on the other (Tensor of dtype `torch.float32`). That means that I actually set the column "sembedding" to a tensor that I as a user expect to be a float32.
It appears though that behind the scenes, this tensor is converted into a **list**. I did not find this documented anywhere but I might have missed it. From a user's perspective this is incredibly important though, because it means you cannot do any data_type or tensor casting yourself in a mapping function! Furthermore, this can lead to issues, as was my case.
My model expected float32 precision, which I thought `sembedding` was because that is what `stransformer.encode` outputs. But behind the scenes this tensor is first cast to a list, and when we then set its format, as below, this column is cast not to float32 but to double precision float64.
```python
dataset.set_format(type="torch", columns=["input_ids", "sembedding"])
```
This happens because apparently there is an intermediate step of casting to a **numpy** array (?) **whose dtype creation/deduction is different from torch dtypes** (see the snippet below). As you can see, this means that the dtype is not preserved: if I got it right, the dataset goes from torch.float32 -> list -> float64 (numpy) -> torch.float64.
```python
import torch
import numpy as np
l = [-0.03010837361216545, -0.035979013890028, -0.016949838027358055]
torch_tensor = torch.tensor(l)
np_array = np.array(l)
np_to_torch = torch.from_numpy(np_array)
print(torch_tensor.dtype)
# torch.float32
print(np_array.dtype)
# float64
print(np_to_torch.dtype)
# torch.float64
```
This might lead to unwanted behaviour. I understand that the whole library is probably built around casting from numpy to other frameworks, so this might be difficult to solve. Perhaps `set_format` should include a `dtypes` option where for each input column the user can specify the wanted precision.
The alternative is that the user needs to cast manually after loading data from the dataset but that does not seem user-friendly, makes the dataset less portable, and might use more space in memory as well as on disk than is actually needed.
I'm glad you managed to figure something out :)
Casting from arrow to numpy can be 100x faster than casting from arrow to list.
This is because arrow has an integration with numpy that allows it to instantiate numpy arrays with zero-copy from arrow.
On the other hand to create python lists it is slow since it has to recreate the list object by iterating through each element in python. | [
-0.11343346536159515,
-0.22111466526985168,
-0.009710624814033508,
0.2073049545288086,
0.5532287955284119,
0.17301321029663086,
0.5313699841499329,
0.12258078157901764,
0.150482639670372,
-0.06653907895088196,
-0.08439914882183075,
0.24571450054645538,
-0.11755191534757614,
-0.1751451939344406,
0.10261566936969757,
-0.2025274932384491,
0.22825294733047485,
-0.06525659561157227,
-0.14417359232902527,
-0.2050461322069168,
-0.2274056226015091,
-0.08883131295442581,
-0.002708733081817627,
-0.20827312767505646,
-0.16018420457839966,
-0.16405940055847168,
0.24031659960746765,
-0.1392814815044403,
-0.1851637363433838,
-0.0010072011500597,
0.18012771010398865,
-0.16522276401519775,
0.4167291522026062,
0.5717642903327942,
-0.00011631557572400197,
0.2217250019311905,
-0.02668493241071701,
-0.07542597502470016,
-0.18863649666309357,
-0.00015363097190856934,
0.004606880247592926,
-0.1931508630514145,
-0.07237699627876282,
-0.1798606812953949,
-0.15412107110023499,
-0.18332535028457642,
-0.08451487869024277,
-0.7935450673103333,
0.288948655128479,
0.41082698106765747,
0.15193253755569458,
0.25708258152008057,
0.07120189070701599,
0.15259341895580292,
-0.1351296603679657,
0.2725161015987396,
-0.10301314294338226,
0.2802619934082031,
-0.02087704837322235,
0.3604665994644165,
-0.061481691896915436,
0.4459064304828644,
-0.3614790737628937,
-0.07507336139678955,
0.02915721759200096,
0.11278904974460602,
0.054124899208545685,
-0.4639113247394562,
-0.06628388911485672,
0.1654171347618103,
0.19734224677085876,
-0.23208093643188477,
-0.28436514735221863,
-0.16728922724723816,
-0.09335697442293167,
-0.36716192960739136,
0.06623804569244385,
-0.08458168804645538,
0.14548705518245697,
0.10315454006195068,
-0.08470848947763443,
-0.17156894505023956,
-0.03456921875476837,
0.132096529006958,
-0.47534000873565674,
0.21858203411102295,
-0.008936329744756222,
0.14741915464401245,
-0.10354362428188324,
-0.03271909058094025,
0.07431841641664505,
-0.11595109105110168,
0.22098515927791595,
-0.03320378065109253,
-0.17000536620616913,
-0.22360140085220337,
0.10681065917015076,
-0.4505300223827362,
-0.12784722447395325,
-0.4818670153617859,
0.22826427221298218,
0.1562221348285675,
-0.2183919996023178,
-0.027490384876728058,
0.21015053987503052,
0.3317386209964752,
-0.2976427674293518,
0.367876261472702,
0.2994464635848999,
-0.04473838582634926,
0.21113258600234985,
0.09851904213428497,
0.12822936475276947,
0.04643381014466286,
-0.011537410318851471,
0.10379434376955032,
0.5391174554824829,
-0.10612718760967255,
-0.31569528579711914,
0.24234473705291748,
-0.46409177780151367,
0.08543962985277176,
0.02905038744211197,
0.07622194290161133,
-0.15806791186332703,
0.44691890478134155,
0.1909368336200714,
0.08564047515392303,
-0.1537807136774063,
-0.048210855573415756,
-0.14087049663066864,
-0.24633057415485382,
0.0493122898042202,
-0.1757226288318634,
0.04734824225306511,
0.11107712984085083,
-0.05568140000104904,
0.29098451137542725,
0.13049538433551788,
0.16166114807128906,
-0.06239528954029083,
-0.14682485163211823,
0.5156334042549133,
0.29439330101013184,
-0.33007940649986267,
0.1609635055065155,
0.2148125320672989,
-0.35004568099975586,
-0.19412371516227722,
0.341382771730423,
-0.2835558354854584,
0.0002671480178833008,
-0.2552972733974457,
0.08967358618974686,
-0.06263385713100433,
-0.19429704546928406,
0.03833760321140289,
0.5168797969818115,
0.594578206539154,
0.07454080879688263,
0.3335525393486023,
-0.525503933429718,
-0.24441909790039062,
-0.21210946142673492,
0.06510867923498154,
-0.002308860421180725,
-0.46514448523521423,
-0.008492697030305862,
0.2366487979888916,
0.18429549038410187,
0.35619020462036133,
0.41371461749076843,
0.07049202919006348,
0.1077740415930748,
0.07491090148687363,
-0.005354985594749451,
0.4220856726169586,
0.11171625554561615,
-0.2204674929380417,
-0.0649489089846611,
-0.05865521728992462,
0.36356672644615173,
-0.0807047113776207,
0.007956146262586117,
0.31949523091316223,
-0.20357292890548706,
0.20783179998397827,
0.025410441681742668,
-0.27681705355644226,
0.08152221888303757,
-0.20613977313041687,
0.03879286348819733,
0.46476227045059204,
-0.08255188167095184,
-0.03550124540925026,
-0.03818029910326004,
-0.3315746784210205,
0.36261260509490967,
0.24249041080474854,
-0.13688836991786957,
0.03684653341770172,
0.04497833922505379,
0.05481328070163727,
-0.03281647711992264,
0.08329568803310394,
-0.08288977295160294,
-0.523478627204895,
-0.04705696925520897,
0.03621000051498413,
0.2670900523662567,
-0.05031956732273102,
-0.13625404238700867,
0.2245902121067047,
0.0831875205039978,
-0.010378997772932053,
0.039142340421676636,
0.06815090030431747,
-0.17175228893756866,
-0.42560845613479614,
0.07235339283943176,
-0.09666511416435242,
-0.21991173923015594,
-0.0393039844930172,
0.10643459856510162,
-0.4977482557296753,
0.08081146329641342,
0.007505254819989204,
-0.19667010009288788,
-0.2570154368877411,
0.28515398502349854,
0.02317342907190323,
-0.08918611705303192,
-0.23232731223106384,
0.0862705409526825,
0.19311130046844482,
-0.09235554933547974,
-0.6234656572341919,
0.5602859854698181,
0.5223328471183777,
0.02266843244433403,
0.19698143005371094,
0.41789913177490234,
0.01675347238779068,
0.06688133627176285,
-0.1525682806968689,
0.1664799302816391,
0.10833801329135895,
0.018407508730888367,
-0.2958195209503174,
0.06973261386156082,
0.24973002076148987,
0.17612649500370026,
-0.26090702414512634,
-0.1829361915588379,
-0.140511617064476,
-0.07615639269351959,
-0.02798193320631981,
0.13874343037605286,
-0.41208702325820923,
0.3359062671661377,
0.693458080291748,
-0.032273564487695694,
0.2642436921596527,
0.030832065269351006,
-0.3138764202594757,
-0.153360515832901,
0.22853298485279083,
-0.12157607823610306,
0.24705453217029572,
0.08514054864645004,
0.360852986574173,
-0.19991673529148102,
-0.16252516210079193,
-0.07482728362083435,
0.2153988778591156,
0.04692120477557182,
0.06636040657758713,
0.004941482096910477,
0.07510095089673996,
0.15419165790081024,
-0.10572898387908936,
0.2709602117538452,
-0.05039932578802109,
0.20320752263069153,
-0.42591342329978943,
0.21711808443069458,
-0.40165436267852783,
0.05126923322677612,
-0.22967557609081268,
-0.0917816013097763,
-0.07778926193714142,
-0.24561366438865662,
-0.029358524829149246,
0.0008399300277233124,
-0.2700946033000946,
0.3935126066207886,
0.26148757338523865,
0.11669249087572098,
0.08734393864870071,
-0.2350945919752121,
-0.11461342871189117,
-0.17242290079593658,
-0.2385483682155609,
0.040034521371126175,
0.20835444331169128,
-0.3795826733112335,
0.18495666980743408,
0.3574528694152832,
-0.2676811218261719,
-0.2696791887283325,
-0.7421141266822815,
0.04859907925128937,
-0.23554815351963043,
0.09608180820941925,
0.03812190517783165,
0.1293121576309204,
-0.024639245122671127,
0.051053427159786224,
0.02547403797507286,
0.09447668492794037,
-0.018104158341884613,
0.11803428828716278,
-0.19163598120212555,
0.02913101576268673,
-0.287290096282959,
-0.2801528573036194,
-0.03678306192159653,
-0.12199549376964569,
0.1812552809715271,
-0.07983054220676422,
-0.0676226019859314,
0.0514865443110466,
0.09122968465089798,
0.03105081617832184,
-0.05812995508313179,
0.23108986020088196,
-0.4207530915737152,
0.0914393961429596,
0.33490559458732605,
-0.15973693132400513,
-0.30688580870628357,
-0.14327839016914368,
0.023463808000087738,
-0.018258456140756607,
0.07451378554105759,
-0.2800920903682709,
-0.05703340843319893,
-0.21576252579689026,
0.26583534479141235,
-0.014034342020750046,
-0.1009145975112915,
0.5142834186553955,
0.23295871913433075,
0.07127039134502411,
-0.06039189174771309,
0.015321716666221619,
0.0630330741405487,
0.21779149770736694,
0.27216044068336487,
-0.009419813752174377,
0.3699360191822052,
0.1042172908782959,
0.3581047058105469,
0.29433825612068176,
-0.694893479347229,
-0.12603655457496643,
-0.05735335499048233,
0.21538463234901428,
-0.21745023131370544,
-0.2911490797996521,
0.03200322762131691,
-0.2955261766910553,
-0.19893890619277954,
0.00653453916311264,
-0.2766372561454773,
-0.2770918905735016,
0.11846509575843811,
0.23312193155288696,
0.13384196162223816,
-0.4014646112918854,
0.40340670943260193,
-0.30552613735198975,
-0.01881040632724762,
0.07031956315040588,
0.17255306243896484,
-0.1366494745016098,
-0.15400725603103638,
0.12495569884777069,
0.0767139345407486,
0.1390782594680786,
-0.04523887485265732,
-0.15606249868869781,
-0.1616584062576294,
-0.557334303855896,
0.2960478663444519,
0.07333878427743912,
0.399868369102478,
-0.1019989401102066,
-0.3138107657432556,
-0.12368954718112946,
0.26585084199905396,
0.3583010137081146,
-0.06517994403839111,
-0.30855584144592285,
-0.034075189381837845,
0.04683981090784073,
-0.11190840601921082,
0.09082196652889252,
-0.3705390393733978,
0.13999749720096588,
0.15985997021198273,
0.479920893907547,
-0.3152984380722046,
-0.15012376010417938,
0.34070873260498047,
0.09900666773319244,
-0.2651865482330322,
0.12570028007030487,
-0.3059803247451782,
-0.21725383400917053,
0.10291963815689087,
-0.1605294644832611,
0.32184264063835144,
-0.11301393061876297,
-0.16299845278263092,
-0.14211608469486237,
-0.18874917924404144,
-0.05938663333654404,
0.30244043469429016,
-0.05379674583673477,
0.17465460300445557,
0.2735580503940582,
-0.0524262934923172,
0.1738079935312271,
0.44847333431243896,
0.07103908807039261,
0.3958069980144501,
-0.2539946138858795,
-0.4725272059440613,
0.12058957666158676,
0.26259979605674744,
0.2191857099533081,
0.33603811264038086,
-0.06650428473949432,
-0.010750748217105865,
0.0495242178440094,
0.20130294561386108,
-0.41523611545562744,
0.14507253468036652,
0.30020561814308167,
0.43954455852508545,
-0.38180649280548096,
-0.3916044533252716,
0.33989906311035156,
0.10490445792675018,
-0.11184938251972198,
0.34528648853302,
-0.3406515121459961,
-0.4210638403892517,
0.4126031994819641,
0.48667266964912415,
0.9439163208007812,
-0.05152450501918793,
0.3623064160346985,
0.38867637515068054,
0.03951222449541092,
0.7027944922447205,
-0.21958842873573303,
0.09537244588136673,
-0.10928860306739807,
-0.20033836364746094,
-0.18212716281414032,
0.028335582464933395,
0.19228142499923706,
-0.17682752013206482,
-0.393464058637619,
-0.01142326183617115,
0.04501514136791229,
0.3950946629047394,
0.0918084904551506,
0.13700740039348602,
0.13373522460460663,
-0.3839353322982788,
0.0010392051190137863,
0.09620776772499084,
-0.14209260046482086,
-0.024558335542678833,
0.025837071239948273,
-0.12961609661579132,
-0.22719772160053253,
-0.03885548934340477,
-0.2351929396390915,
-0.2038242518901825,
-0.6721231341362,
0.22790579497814178,
-0.21128948032855988,
-0.3824329376220703,
0.21191668510437012,
0.3805316090583801,
0.4986087679862976,
0.06994155794382095,
-0.1444130837917328,
-0.05410018935799599,
0.14069318771362305,
0.250490665435791,
0.36745238304138184,
-0.3385370671749115,
0.5262500047683716,
0.1788806915283203,
-0.01704501360654831,
-0.05232264846563339,
0.01902991160750389,
0.11957865953445435,
-0.3839370012283325,
-0.04443635791540146,
0.010446440428495407,
-0.44863080978393555,
0.018025822937488556,
0.05181959271430969,
0.1929474025964737,
-0.07191915810108185,
0.08035727590322495,
0.00331946462392807,
0.06042002514004707,
0.43908897042274475,
-0.2384054809808731,
-0.20494019985198975,
-0.13601775467395782,
0.2581448554992676,
0.3120487332344055,
-0.027679068967700005,
0.3316820561885834,
0.17486529052257538,
-0.21990616619586945,
-0.13260075449943542,
0.26966220140457153,
0.09624751657247543,
-0.27186885476112366,
0.2938763201236725,
-0.22945858538150787,
-0.3275020122528076,
-0.40293389558792114,
0.0242936871945858,
0.12961499392986298,
0.020083393901586533,
-0.4275782108306885,
0.04812207072973251,
-0.4269220530986786,
0.19557899236679077,
0.1994590312242508,
0.22949692606925964,
-0.09680332988500595,
0.29025861620903015,
-0.18622124195098877,
-0.07525873929262161,
-0.27885961532592773,
-0.14547114074230194,
0.20151643455028534,
0.16078563034534454,
-0.04805085062980652,
-0.06225915253162384,
0.21537847816944122,
-0.2433135062456131,
0.0800854042172432,
0.09557824581861496,
0.08322387933731079,
-0.16887640953063965,
-0.13380040228366852,
0.08440303057432175,
-0.072153240442276,
-0.16313090920448303,
-0.020984705537557602,
-0.19534604251384735,
-0.18672753870487213,
-0.16780447959899902,
0.11266642808914185,
0.27993541955947876,
0.10184212028980255,
0.2763630449771881,
0.04173284024000168,
0.1626678705215454,
0.3086153268814087,
0.005494935438036919,
-0.1270996630191803,
0.2509423494338989,
0.06355921924114227,
0.33679789304733276,
0.01930283196270466,
-0.052214138209819794,
-0.1994486153125763,
0.2303502857685089,
0.050255488604307175,
-0.08984201401472092,
0.4385259449481964,
-0.18629160523414612,
-0.13802745938301086,
0.011326875537633896,
0.18398956954479218,
0.2505353093147278,
-0.31219640374183655,
-0.14360462129116058,
-0.027120452374219894,
0.10801446437835693,
-0.18460536003112793,
0.10111138969659805,
0.192087322473526,
-0.10860477387905121,
0.1267400085926056,
0.4136991500854492,
-0.029626328498125076,
0.5634446144104004,
-0.03976212441921234,
-0.007464313879609108,
0.1605871468782425,
-0.20024597644805908,
0.27978575229644775,
0.26319921016693115,
-0.08982723951339722,
0.15767043828964233,
0.2914581596851349,
0.0799153670668602,
0.13572201132774353,
0.14333833754062653,
0.04752008616924286,
0.20890893042087555,
0.05979480221867561,
0.02784871682524681,
0.4162575602531433,
-0.1557866632938385,
0.12274248898029327,
0.09084928035736084,
-0.43979018926620483,
0.2601422369480133,
0.3826686441898346,
0.07512034475803375,
-0.3052259087562561,
-0.23599055409431458,
-0.1305057853460312,
0.1503942310810089,
-0.4149083197116852,
0.00258022453635931,
-0.2539517879486084,
0.08597511798143387,
-0.061961494386196136,
-0.24506394565105438,
-0.2087458372116089,
-0.04735669493675232,
0.20736268162727356,
0.20336312055587769,
-0.1458740234375,
0.09162641316652298,
-0.2127763032913208,
-0.1652701497077942,
0.0895995944738388,
0.046989139169454575,
0.3118058741092682,
0.39766836166381836,
-0.1903301477432251,
-0.16406285762786865,
0.2795582711696625,
0.26088911294937134,
0.19008904695510864,
-0.25510039925575256,
0.31881317496299744,
0.13687826693058014,
-0.2822490930557251,
0.0019034910947084427,
0.2594357132911682,
0.02231227606534958,
-0.018162522464990616,
0.21527060866355896,
0.10371076315641403,
-0.02872312441468239,
0.15876781940460205,
-0.08291377127170563,
0.23464332520961761,
0.01977112516760826,
0.6455353498458862,
-0.04291380196809769,
-0.14672376215457916,
-0.07847489416599274,
-0.20738574862480164,
-0.21239537000656128,
-0.22240635752677917,
0.7710813283920288,
-0.1710176169872284,
0.2005576491355896,
-0.0775001272559166,
0.06579103320837021,
0.2825329303741455,
0.3724643290042877,
0.08754625916481018,
-0.05230213701725006,
-0.2187703549861908,
0.3671228885650635,
-0.27810391783714294,
0.10558496415615082,
0.21418455243110657,
-0.047855645418167114,
-0.021830562502145767,
0.22368447482585907,
0.4392271637916565,
0.25887101888656616,
0.044760867953300476,
-0.4173411726951599,
0.21641117334365845,
0.033113352954387665,
-0.10542528331279755,
-0.2507250905036926,
-0.4146488904953003,
0.18060946464538574,
0.02940572053194046,
-0.3498017489910126,
0.33164361119270325,
0.13302673399448395,
-0.024106845259666443,
-0.4745326638221741,
0.0894954651594162,
-0.005397513508796692,
0.21871206164360046,
0.23784981667995453,
0.43774640560150146,
0.12689939141273499,
-0.1296064257621765,
-0.25559261441230774,
0.1482960283756256,
-0.05249197781085968,
-0.48035117983818054,
0.411639004945755,
-0.16013497114181519,
0.3657142221927643,
-0.30115121603012085,
-0.29076364636421204,
-0.1951594054698944,
0.02586054801940918,
0.08516983687877655,
-0.43646594882011414,
-0.5503329634666443,
0.3894611895084381,
-0.1322181671857834,
-0.08450661599636078,
0.2017909586429596,
0.48029494285583496,
0.0986783504486084,
0.3818567395210266,
-0.2019927054643631,
-0.34192362427711487,
0.6405491828918457,
-0.26909732818603516,
-0.04120266065001488,
-0.06233583763241768,
-0.07256360352039337,
-0.06485878676176071,
0.050931334495544434,
-0.8520141839981079,
-0.23993265628814697,
0.29742977023124695,
-0.2665523886680603,
-0.248223677277565,
0.30915889143943787,
0.11968289315700531,
0.13414564728736877,
-0.3145247995853424,
0.5315725803375244,
-0.04561431705951691,
-0.15220040082931519,
0.09404595196247101,
-0.18822573125362396
] |
https://github.com/huggingface/datasets/issues/625 | dtype of tensors should be preserved | I encountered a simliar issue: `datasets` converted my float numpy array to `torch.float64` tensors, while many pytorch operations require `torch.float32` inputs and it's very troublesome.
I tried @lhoestq 's solution, but since it's mixed with the preprocess function, it's not very intuitive.
I just want to share another possible simpler solution: directly cast the dtype of the processed dataset.
Now I want to change the type of `labels` in `train_dataset` from float64 to float32, I can do this.
```
from datasets import Value, Sequence, Features
feats = train_dataset.features.copy()
feats['labels'].feature = Value(dtype='float32')
feats = Features(feats)
train_dataset.cast_(feats)
```
| After switching to `datasets` my model just broke. After a weekend of debugging, the issue was that my model could not handle the double that the Dataset provided, as it expected a float (but didn't give a warning, which seems a [PyTorch issue](https://discuss.pytorch.org/t/is-it-required-that-input-and-hidden-for-gru-have-the-same-dtype-float32/96221)).
As a user I did not expect this bug. I have a `map` function that I call on the Dataset that looks like this:
```python
def preprocess(sentences: List[str]):
token_ids = [[vocab.to_index(t) for t in s.split()] for s in sentences]
sembeddings = stransformer.encode(sentences)
print(sembeddings.dtype)
return {"input_ids": token_ids, "sembedding": sembeddings}
```
Given a list of `sentences` (`List[str]`), it converts those into token_ids on the one hand (list of lists of ints; `List[List[int]]`) and into sentence embeddings on the other (Tensor of dtype `torch.float32`). That means that I actually set the column "sembedding" to a tensor that I as a user expect to be a float32.
It appears though that behind the scenes, this tensor is converted into a **list**. I did not find this documented anywhere but I might have missed it. From a user's perspective this is incredibly important though, because it means you cannot do any data_type or tensor casting yourself in a mapping function! Furthermore, this can lead to issues, as was my case.
My model expected float32 precision, which I thought `sembedding` was because that is what `stransformer.encode` outputs. But behind the scenes this tensor is first cast to a list, and when we then set its format, as below, this column is cast not to float32 but to double precision float64.
```python
dataset.set_format(type="torch", columns=["input_ids", "sembedding"])
```
This happens because apparently there is an intermediate step of casting to a **numpy** array (?) **whose dtype creation/deduction is different from torch dtypes** (see the snippet below). As you can see, this means that the dtype is not preserved: if I got it right, the dataset goes from torch.float32 -> list -> float64 (numpy) -> torch.float64.
```python
import torch
import numpy as np
l = [-0.03010837361216545, -0.035979013890028, -0.016949838027358055]
torch_tensor = torch.tensor(l)
np_array = np.array(l)
np_to_torch = torch.from_numpy(np_array)
print(torch_tensor.dtype)
# torch.float32
print(np_array.dtype)
# float64
print(np_to_torch.dtype)
# torch.float64
```
This might lead to unwanted behaviour. I understand that the whole library is probably built around casting from numpy to other frameworks, so this might be difficult to solve. Perhaps `set_format` should include a `dtypes` option where for each input column the user can specify the wanted precision.
The alternative is that the user needs to cast manually after loading data from the dataset but that does not seem user-friendly, makes the dataset less portable, and might use more space in memory as well as on disk than is actually needed. | 96 | dtype of tensors should be preserved
After switching to `datasets` my model just broke. After a weekend of debugging, the issue was that my model could not handle the double that the Dataset provided, as it expected a float (but didn't give a warning, which seems a [PyTorch issue](https://discuss.pytorch.org/t/is-it-required-that-input-and-hidden-for-gru-have-the-same-dtype-float32/96221)).
As a user I did not expect this bug. I have a `map` function that I call on the Dataset that looks like this:
```python
def preprocess(sentences: List[str]):
token_ids = [[vocab.to_index(t) for t in s.split()] for s in sentences]
sembeddings = stransformer.encode(sentences)
print(sembeddings.dtype)
return {"input_ids": token_ids, "sembedding": sembeddings}
```
Given a list of `sentences` (`List[str]`), it converts those into token_ids on the one hand (list of lists of ints; `List[List[int]]`) and into sentence embeddings on the other (Tensor of dtype `torch.float32`). That means that I actually set the column "sembedding" to a tensor that I as a user expect to be a float32.
It appears though that behind the scenes, this tensor is converted into a **list**. I did not find this documented anywhere but I might have missed it. From a user's perspective this is incredibly important though, because it means you cannot do any data_type or tensor casting yourself in a mapping function! Furthermore, this can lead to issues, as was my case.
My model expected float32 precision, which I thought `sembedding` was because that is what `stransformer.encode` outputs. But behind the scenes this tensor is first cast to a list, and when we then set its format, as below, this column is cast not to float32 but to double precision float64.
```python
dataset.set_format(type="torch", columns=["input_ids", "sembedding"])
```
This happens because apparently there is an intermediate step of casting to a **numpy** array (?) **whose dtype creation/deduction is different from torch dtypes** (see the snippet below). As you can see, this means that the dtype is not preserved: if I got it right, the dataset goes from torch.float32 -> list -> float64 (numpy) -> torch.float64.
```python
import torch
import numpy as np
l = [-0.03010837361216545, -0.035979013890028, -0.016949838027358055]
torch_tensor = torch.tensor(l)
np_array = np.array(l)
np_to_torch = torch.from_numpy(np_array)
print(torch_tensor.dtype)
# torch.float32
print(np_array.dtype)
# float64
print(np_to_torch.dtype)
# torch.float64
```
This might lead to unwanted behaviour. I understand that the whole library is probably built around casting from numpy to other frameworks, so this might be difficult to solve. Perhaps `set_format` should include a `dtypes` option where for each input column the user can specify the wanted precision.
The alternative is that the user needs to cast manually after loading data from the dataset but that does not seem user-friendly, makes the dataset less portable, and might use more space in memory as well as on disk than is actually needed.
I encountered a simliar issue: `datasets` converted my float numpy array to `torch.float64` tensors, while many pytorch operations require `torch.float32` inputs and it's very troublesome.
I tried @lhoestq 's solution, but since it's mixed with the preprocess function, it's not very intuitive.
I just want to share another possible simpler solution: directly cast the dtype of the processed dataset.
Now I want to change the type of `labels` in `train_dataset` from float64 to float32, I can do this.
```
from datasets import Value, Sequence, Features
feats = train_dataset.features.copy()
feats['labels'].feature = Value(dtype='float32')
feats = Features(feats)
train_dataset.cast_(feats)
```
| [
-0.11343346536159515,
-0.22111466526985168,
-0.009710624814033508,
0.2073049545288086,
0.5532287955284119,
0.17301321029663086,
0.5313699841499329,
0.12258078157901764,
0.150482639670372,
-0.06653907895088196,
-0.08439914882183075,
0.24571450054645538,
-0.11755191534757614,
-0.1751451939344406,
0.10261566936969757,
-0.2025274932384491,
0.22825294733047485,
-0.06525659561157227,
-0.14417359232902527,
-0.2050461322069168,
-0.2274056226015091,
-0.08883131295442581,
-0.002708733081817627,
-0.20827312767505646,
-0.16018420457839966,
-0.16405940055847168,
0.24031659960746765,
-0.1392814815044403,
-0.1851637363433838,
-0.0010072011500597,
0.18012771010398865,
-0.16522276401519775,
0.4167291522026062,
0.5717642903327942,
-0.00011631557572400197,
0.2217250019311905,
-0.02668493241071701,
-0.07542597502470016,
-0.18863649666309357,
-0.00015363097190856934,
0.004606880247592926,
-0.1931508630514145,
-0.07237699627876282,
-0.1798606812953949,
-0.15412107110023499,
-0.18332535028457642,
-0.08451487869024277,
-0.7935450673103333,
0.288948655128479,
0.41082698106765747,
0.15193253755569458,
0.25708258152008057,
0.07120189070701599,
0.15259341895580292,
-0.1351296603679657,
0.2725161015987396,
-0.10301314294338226,
0.2802619934082031,
-0.02087704837322235,
0.3604665994644165,
-0.061481691896915436,
0.4459064304828644,
-0.3614790737628937,
-0.07507336139678955,
0.02915721759200096,
0.11278904974460602,
0.054124899208545685,
-0.4639113247394562,
-0.06628388911485672,
0.1654171347618103,
0.19734224677085876,
-0.23208093643188477,
-0.28436514735221863,
-0.16728922724723816,
-0.09335697442293167,
-0.36716192960739136,
0.06623804569244385,
-0.08458168804645538,
0.14548705518245697,
0.10315454006195068,
-0.08470848947763443,
-0.17156894505023956,
-0.03456921875476837,
0.132096529006958,
-0.47534000873565674,
0.21858203411102295,
-0.008936329744756222,
0.14741915464401245,
-0.10354362428188324,
-0.03271909058094025,
0.07431841641664505,
-0.11595109105110168,
0.22098515927791595,
-0.03320378065109253,
-0.17000536620616913,
-0.22360140085220337,
0.10681065917015076,
-0.4505300223827362,
-0.12784722447395325,
-0.4818670153617859,
0.22826427221298218,
0.1562221348285675,
-0.2183919996023178,
-0.027490384876728058,
0.21015053987503052,
0.3317386209964752,
-0.2976427674293518,
0.367876261472702,
0.2994464635848999,
-0.04473838582634926,
0.21113258600234985,
0.09851904213428497,
0.12822936475276947,
0.04643381014466286,
-0.011537410318851471,
0.10379434376955032,
0.5391174554824829,
-0.10612718760967255,
-0.31569528579711914,
0.24234473705291748,
-0.46409177780151367,
0.08543962985277176,
0.02905038744211197,
0.07622194290161133,
-0.15806791186332703,
0.44691890478134155,
0.1909368336200714,
0.08564047515392303,
-0.1537807136774063,
-0.048210855573415756,
-0.14087049663066864,
-0.24633057415485382,
0.0493122898042202,
-0.1757226288318634,
0.04734824225306511,
0.11107712984085083,
-0.05568140000104904,
0.29098451137542725,
0.13049538433551788,
0.16166114807128906,
-0.06239528954029083,
-0.14682485163211823,
0.5156334042549133,
0.29439330101013184,
-0.33007940649986267,
0.1609635055065155,
0.2148125320672989,
-0.35004568099975586,
-0.19412371516227722,
0.341382771730423,
-0.2835558354854584,
0.0002671480178833008,
-0.2552972733974457,
0.08967358618974686,
-0.06263385713100433,
-0.19429704546928406,
0.03833760321140289,
0.5168797969818115,
0.594578206539154,
0.07454080879688263,
0.3335525393486023,
-0.525503933429718,
-0.24441909790039062,
-0.21210946142673492,
0.06510867923498154,
-0.002308860421180725,
-0.46514448523521423,
-0.008492697030305862,
0.2366487979888916,
0.18429549038410187,
0.35619020462036133,
0.41371461749076843,
0.07049202919006348,
0.1077740415930748,
0.07491090148687363,
-0.005354985594749451,
0.4220856726169586,
0.11171625554561615,
-0.2204674929380417,
-0.0649489089846611,
-0.05865521728992462,
0.36356672644615173,
-0.0807047113776207,
0.007956146262586117,
0.31949523091316223,
-0.20357292890548706,
0.20783179998397827,
0.025410441681742668,
-0.27681705355644226,
0.08152221888303757,
-0.20613977313041687,
0.03879286348819733,
0.46476227045059204,
-0.08255188167095184,
-0.03550124540925026,
-0.03818029910326004,
-0.3315746784210205,
0.36261260509490967,
0.24249041080474854,
-0.13688836991786957,
0.03684653341770172,
0.04497833922505379,
0.05481328070163727,
-0.03281647711992264,
0.08329568803310394,
-0.08288977295160294,
-0.523478627204895,
-0.04705696925520897,
0.03621000051498413,
0.2670900523662567,
-0.05031956732273102,
-0.13625404238700867,
0.2245902121067047,
0.0831875205039978,
-0.010378997772932053,
0.039142340421676636,
0.06815090030431747,
-0.17175228893756866,
-0.42560845613479614,
0.07235339283943176,
-0.09666511416435242,
-0.21991173923015594,
-0.0393039844930172,
0.10643459856510162,
-0.4977482557296753,
0.08081146329641342,
0.007505254819989204,
-0.19667010009288788,
-0.2570154368877411,
0.28515398502349854,
0.02317342907190323,
-0.08918611705303192,
-0.23232731223106384,
0.0862705409526825,
0.19311130046844482,
-0.09235554933547974,
-0.6234656572341919,
0.5602859854698181,
0.5223328471183777,
0.02266843244433403,
0.19698143005371094,
0.41789913177490234,
0.01675347238779068,
0.06688133627176285,
-0.1525682806968689,
0.1664799302816391,
0.10833801329135895,
0.018407508730888367,
-0.2958195209503174,
0.06973261386156082,
0.24973002076148987,
0.17612649500370026,
-0.26090702414512634,
-0.1829361915588379,
-0.140511617064476,
-0.07615639269351959,
-0.02798193320631981,
0.13874343037605286,
-0.41208702325820923,
0.3359062671661377,
0.693458080291748,
-0.032273564487695694,
0.2642436921596527,
0.030832065269351006,
-0.3138764202594757,
-0.153360515832901,
0.22853298485279083,
-0.12157607823610306,
0.24705453217029572,
0.08514054864645004,
0.360852986574173,
-0.19991673529148102,
-0.16252516210079193,
-0.07482728362083435,
0.2153988778591156,
0.04692120477557182,
0.06636040657758713,
0.004941482096910477,
0.07510095089673996,
0.15419165790081024,
-0.10572898387908936,
0.2709602117538452,
-0.05039932578802109,
0.20320752263069153,
-0.42591342329978943,
0.21711808443069458,
-0.40165436267852783,
0.05126923322677612,
-0.22967557609081268,
-0.0917816013097763,
-0.07778926193714142,
-0.24561366438865662,
-0.029358524829149246,
0.0008399300277233124,
-0.2700946033000946,
0.3935126066207886,
0.26148757338523865,
0.11669249087572098,
0.08734393864870071,
-0.2350945919752121,
-0.11461342871189117,
-0.17242290079593658,
-0.2385483682155609,
0.040034521371126175,
0.20835444331169128,
-0.3795826733112335,
0.18495666980743408,
0.3574528694152832,
-0.2676811218261719,
-0.2696791887283325,
-0.7421141266822815,
0.04859907925128937,
-0.23554815351963043,
0.09608180820941925,
0.03812190517783165,
0.1293121576309204,
-0.024639245122671127,
0.051053427159786224,
0.02547403797507286,
0.09447668492794037,
-0.018104158341884613,
0.11803428828716278,
-0.19163598120212555,
0.02913101576268673,
-0.287290096282959,
-0.2801528573036194,
-0.03678306192159653,
-0.12199549376964569,
0.1812552809715271,
-0.07983054220676422,
-0.0676226019859314,
0.0514865443110466,
0.09122968465089798,
0.03105081617832184,
-0.05812995508313179,
0.23108986020088196,
-0.4207530915737152,
0.0914393961429596,
0.33490559458732605,
-0.15973693132400513,
-0.30688580870628357,
-0.14327839016914368,
0.023463808000087738,
-0.018258456140756607,
0.07451378554105759,
-0.2800920903682709,
-0.05703340843319893,
-0.21576252579689026,
0.26583534479141235,
-0.014034342020750046,
-0.1009145975112915,
0.5142834186553955,
0.23295871913433075,
0.07127039134502411,
-0.06039189174771309,
0.015321716666221619,
0.0630330741405487,
0.21779149770736694,
0.27216044068336487,
-0.009419813752174377,
0.3699360191822052,
0.1042172908782959,
0.3581047058105469,
0.29433825612068176,
-0.694893479347229,
-0.12603655457496643,
-0.05735335499048233,
0.21538463234901428,
-0.21745023131370544,
-0.2911490797996521,
0.03200322762131691,
-0.2955261766910553,
-0.19893890619277954,
0.00653453916311264,
-0.2766372561454773,
-0.2770918905735016,
0.11846509575843811,
0.23312193155288696,
0.13384196162223816,
-0.4014646112918854,
0.40340670943260193,
-0.30552613735198975,
-0.01881040632724762,
0.07031956315040588,
0.17255306243896484,
-0.1366494745016098,
-0.15400725603103638,
0.12495569884777069,
0.0767139345407486,
0.1390782594680786,
-0.04523887485265732,
-0.15606249868869781,
-0.1616584062576294,
-0.557334303855896,
0.2960478663444519,
0.07333878427743912,
0.399868369102478,
-0.1019989401102066,
-0.3138107657432556,
-0.12368954718112946,
0.26585084199905396,
0.3583010137081146,
-0.06517994403839111,
-0.30855584144592285,
-0.034075189381837845,
0.04683981090784073,
-0.11190840601921082,
0.09082196652889252,
-0.3705390393733978,
0.13999749720096588,
0.15985997021198273,
0.479920893907547,
-0.3152984380722046,
-0.15012376010417938,
0.34070873260498047,
0.09900666773319244,
-0.2651865482330322,
0.12570028007030487,
-0.3059803247451782,
-0.21725383400917053,
0.10291963815689087,
-0.1605294644832611,
0.32184264063835144,
-0.11301393061876297,
-0.16299845278263092,
-0.14211608469486237,
-0.18874917924404144,
-0.05938663333654404,
0.30244043469429016,
-0.05379674583673477,
0.17465460300445557,
0.2735580503940582,
-0.0524262934923172,
0.1738079935312271,
0.44847333431243896,
0.07103908807039261,
0.3958069980144501,
-0.2539946138858795,
-0.4725272059440613,
0.12058957666158676,
0.26259979605674744,
0.2191857099533081,
0.33603811264038086,
-0.06650428473949432,
-0.010750748217105865,
0.0495242178440094,
0.20130294561386108,
-0.41523611545562744,
0.14507253468036652,
0.30020561814308167,
0.43954455852508545,
-0.38180649280548096,
-0.3916044533252716,
0.33989906311035156,
0.10490445792675018,
-0.11184938251972198,
0.34528648853302,
-0.3406515121459961,
-0.4210638403892517,
0.4126031994819641,
0.48667266964912415,
0.9439163208007812,
-0.05152450501918793,
0.3623064160346985,
0.38867637515068054,
0.03951222449541092,
0.7027944922447205,
-0.21958842873573303,
0.09537244588136673,
-0.10928860306739807,
-0.20033836364746094,
-0.18212716281414032,
0.028335582464933395,
0.19228142499923706,
-0.17682752013206482,
-0.393464058637619,
-0.01142326183617115,
0.04501514136791229,
0.3950946629047394,
0.0918084904551506,
0.13700740039348602,
0.13373522460460663,
-0.3839353322982788,
0.0010392051190137863,
0.09620776772499084,
-0.14209260046482086,
-0.024558335542678833,
0.025837071239948273,
-0.12961609661579132,
-0.22719772160053253,
-0.03885548934340477,
-0.2351929396390915,
-0.2038242518901825,
-0.6721231341362,
0.22790579497814178,
-0.21128948032855988,
-0.3824329376220703,
0.21191668510437012,
0.3805316090583801,
0.4986087679862976,
0.06994155794382095,
-0.1444130837917328,
-0.05410018935799599,
0.14069318771362305,
0.250490665435791,
0.36745238304138184,
-0.3385370671749115,
0.5262500047683716,
0.1788806915283203,
-0.01704501360654831,
-0.05232264846563339,
0.01902991160750389,
0.11957865953445435,
-0.3839370012283325,
-0.04443635791540146,
0.010446440428495407,
-0.44863080978393555,
0.018025822937488556,
0.05181959271430969,
0.1929474025964737,
-0.07191915810108185,
0.08035727590322495,
0.00331946462392807,
0.06042002514004707,
0.43908897042274475,
-0.2384054809808731,
-0.20494019985198975,
-0.13601775467395782,
0.2581448554992676,
0.3120487332344055,
-0.027679068967700005,
0.3316820561885834,
0.17486529052257538,
-0.21990616619586945,
-0.13260075449943542,
0.26966220140457153,
0.09624751657247543,
-0.27186885476112366,
0.2938763201236725,
-0.22945858538150787,
-0.3275020122528076,
-0.40293389558792114,
0.0242936871945858,
0.12961499392986298,
0.020083393901586533,
-0.4275782108306885,
0.04812207072973251,
-0.4269220530986786,
0.19557899236679077,
0.1994590312242508,
0.22949692606925964,
-0.09680332988500595,
0.29025861620903015,
-0.18622124195098877,
-0.07525873929262161,
-0.27885961532592773,
-0.14547114074230194,
0.20151643455028534,
0.16078563034534454,
-0.04805085062980652,
-0.06225915253162384,
0.21537847816944122,
-0.2433135062456131,
0.0800854042172432,
0.09557824581861496,
0.08322387933731079,
-0.16887640953063965,
-0.13380040228366852,
0.08440303057432175,
-0.072153240442276,
-0.16313090920448303,
-0.020984705537557602,
-0.19534604251384735,
-0.18672753870487213,
-0.16780447959899902,
0.11266642808914185,
0.27993541955947876,
0.10184212028980255,
0.2763630449771881,
0.04173284024000168,
0.1626678705215454,
0.3086153268814087,
0.005494935438036919,
-0.1270996630191803,
0.2509423494338989,
0.06355921924114227,
0.33679789304733276,
0.01930283196270466,
-0.052214138209819794,
-0.1994486153125763,
0.2303502857685089,
0.050255488604307175,
-0.08984201401472092,
0.4385259449481964,
-0.18629160523414612,
-0.13802745938301086,
0.011326875537633896,
0.18398956954479218,
0.2505353093147278,
-0.31219640374183655,
-0.14360462129116058,
-0.027120452374219894,
0.10801446437835693,
-0.18460536003112793,
0.10111138969659805,
0.192087322473526,
-0.10860477387905121,
0.1267400085926056,
0.4136991500854492,
-0.029626328498125076,
0.5634446144104004,
-0.03976212441921234,
-0.007464313879609108,
0.1605871468782425,
-0.20024597644805908,
0.27978575229644775,
0.26319921016693115,
-0.08982723951339722,
0.15767043828964233,
0.2914581596851349,
0.0799153670668602,
0.13572201132774353,
0.14333833754062653,
0.04752008616924286,
0.20890893042087555,
0.05979480221867561,
0.02784871682524681,
0.4162575602531433,
-0.1557866632938385,
0.12274248898029327,
0.09084928035736084,
-0.43979018926620483,
0.2601422369480133,
0.3826686441898346,
0.07512034475803375,
-0.3052259087562561,
-0.23599055409431458,
-0.1305057853460312,
0.1503942310810089,
-0.4149083197116852,
0.00258022453635931,
-0.2539517879486084,
0.08597511798143387,
-0.061961494386196136,
-0.24506394565105438,
-0.2087458372116089,
-0.04735669493675232,
0.20736268162727356,
0.20336312055587769,
-0.1458740234375,
0.09162641316652298,
-0.2127763032913208,
-0.1652701497077942,
0.0895995944738388,
0.046989139169454575,
0.3118058741092682,
0.39766836166381836,
-0.1903301477432251,
-0.16406285762786865,
0.2795582711696625,
0.26088911294937134,
0.19008904695510864,
-0.25510039925575256,
0.31881317496299744,
0.13687826693058014,
-0.2822490930557251,
0.0019034910947084427,
0.2594357132911682,
0.02231227606534958,
-0.018162522464990616,
0.21527060866355896,
0.10371076315641403,
-0.02872312441468239,
0.15876781940460205,
-0.08291377127170563,
0.23464332520961761,
0.01977112516760826,
0.6455353498458862,
-0.04291380196809769,
-0.14672376215457916,
-0.07847489416599274,
-0.20738574862480164,
-0.21239537000656128,
-0.22240635752677917,
0.7710813283920288,
-0.1710176169872284,
0.2005576491355896,
-0.0775001272559166,
0.06579103320837021,
0.2825329303741455,
0.3724643290042877,
0.08754625916481018,
-0.05230213701725006,
-0.2187703549861908,
0.3671228885650635,
-0.27810391783714294,
0.10558496415615082,
0.21418455243110657,
-0.047855645418167114,
-0.021830562502145767,
0.22368447482585907,
0.4392271637916565,
0.25887101888656616,
0.044760867953300476,
-0.4173411726951599,
0.21641117334365845,
0.033113352954387665,
-0.10542528331279755,
-0.2507250905036926,
-0.4146488904953003,
0.18060946464538574,
0.02940572053194046,
-0.3498017489910126,
0.33164361119270325,
0.13302673399448395,
-0.024106845259666443,
-0.4745326638221741,
0.0894954651594162,
-0.005397513508796692,
0.21871206164360046,
0.23784981667995453,
0.43774640560150146,
0.12689939141273499,
-0.1296064257621765,
-0.25559261441230774,
0.1482960283756256,
-0.05249197781085968,
-0.48035117983818054,
0.411639004945755,
-0.16013497114181519,
0.3657142221927643,
-0.30115121603012085,
-0.29076364636421204,
-0.1951594054698944,
0.02586054801940918,
0.08516983687877655,
-0.43646594882011414,
-0.5503329634666443,
0.3894611895084381,
-0.1322181671857834,
-0.08450661599636078,
0.2017909586429596,
0.48029494285583496,
0.0986783504486084,
0.3818567395210266,
-0.2019927054643631,
-0.34192362427711487,
0.6405491828918457,
-0.26909732818603516,
-0.04120266065001488,
-0.06233583763241768,
-0.07256360352039337,
-0.06485878676176071,
0.050931334495544434,
-0.8520141839981079,
-0.23993265628814697,
0.29742977023124695,
-0.2665523886680603,
-0.248223677277565,
0.30915889143943787,
0.11968289315700531,
0.13414564728736877,
-0.3145247995853424,
0.5315725803375244,
-0.04561431705951691,
-0.15220040082931519,
0.09404595196247101,
-0.18822573125362396
] |
https://github.com/huggingface/datasets/issues/625 | dtype of tensors should be preserved | Reopening since @bhavitvyamalik started looking into it !
Also I'm posting here a function that could be helpful to support preserving the dtype of tensors.
It's used to build a pyarrow array out of a numpy array and:
- it doesn't convert the numpy array to a python list
- it keeps the precision of the numpy array for the pyarrow array
- it works with multidimensional arrays (while `pa.array` can only take a 1D array as input)
- it builds the pyarrow ListArray from offsets created on-the-fly and values that come from the flattened numpy array
```python
from functools import reduce
from operator import mul
import numpy as np
import pyarrow as pa
def pa_ndarray(a):
"""Build a PyArrow ListArray from a multidimensional NumPy array"""
values = pa.array(a.flatten())
for i in range(a.ndim - 1):
n_offsets = reduce(mul, a.shape[:a.ndim - i - 1], 1)
step_offsets = a.shape[a.ndim - i - 1]
offsets = pa.array(np.arange(n_offsets + 1) * step_offsets, type=pa.int32())
values = pa.ListArray.from_arrays(offsets, values)
return values
narr = np.arange(42).reshape(7, 2, 3).astype(np.uint8)
parr = pa_ndarray(narr)
assert isinstance(parr, pa.Array)
assert parr.type == pa.list_(pa.list_(pa.uint8()))
assert narr.tolist() == parr.to_pylist()
```
The only costly operation is the offsets computations. Since it doesn't iterate on the numpy array values this function is pretty fast. | After switching to `datasets` my model just broke. After a weekend of debugging, the issue was that my model could not handle the double that the Dataset provided, as it expected a float (but didn't give a warning, which seems a [PyTorch issue](https://discuss.pytorch.org/t/is-it-required-that-input-and-hidden-for-gru-have-the-same-dtype-float32/96221)).
As a user I did not expect this bug. I have a `map` function that I call on the Dataset that looks like this:
```python
def preprocess(sentences: List[str]):
token_ids = [[vocab.to_index(t) for t in s.split()] for s in sentences]
sembeddings = stransformer.encode(sentences)
print(sembeddings.dtype)
return {"input_ids": token_ids, "sembedding": sembeddings}
```
Given a list of `sentences` (`List[str]`), it converts those into token_ids on the one hand (list of lists of ints; `List[List[int]]`) and into sentence embeddings on the other (Tensor of dtype `torch.float32`). That means that I actually set the column "sembedding" to a tensor that I as a user expect to be a float32.
It appears though that behind the scenes, this tensor is converted into a **list**. I did not find this documented anywhere but I might have missed it. From a user's perspective this is incredibly important though, because it means you cannot do any data_type or tensor casting yourself in a mapping function! Furthermore, this can lead to issues, as was my case.
My model expected float32 precision, which I thought `sembedding` was because that is what `stransformer.encode` outputs. But behind the scenes this tensor is first cast to a list, and when we then set its format, as below, this column is cast not to float32 but to double precision float64.
```python
dataset.set_format(type="torch", columns=["input_ids", "sembedding"])
```
This happens because apparently there is an intermediate step of casting to a **numpy** array (?) **whose dtype creation/deduction is different from torch dtypes** (see the snippet below). As you can see, this means that the dtype is not preserved: if I got it right, the dataset goes from torch.float32 -> list -> float64 (numpy) -> torch.float64.
```python
import torch
import numpy as np
l = [-0.03010837361216545, -0.035979013890028, -0.016949838027358055]
torch_tensor = torch.tensor(l)
np_array = np.array(l)
np_to_torch = torch.from_numpy(np_array)
print(torch_tensor.dtype)
# torch.float32
print(np_array.dtype)
# float64
print(np_to_torch.dtype)
# torch.float64
```
This might lead to unwanted behaviour. I understand that the whole library is probably built around casting from numpy to other frameworks, so this might be difficult to solve. Perhaps `set_format` should include a `dtypes` option where for each input column the user can specify the wanted precision.
The alternative is that the user needs to cast manually after loading data from the dataset but that does not seem user-friendly, makes the dataset less portable, and might use more space in memory as well as on disk than is actually needed. | 206 | dtype of tensors should be preserved
After switching to `datasets` my model just broke. After a weekend of debugging, the issue was that my model could not handle the double that the Dataset provided, as it expected a float (but didn't give a warning, which seems a [PyTorch issue](https://discuss.pytorch.org/t/is-it-required-that-input-and-hidden-for-gru-have-the-same-dtype-float32/96221)).
As a user I did not expect this bug. I have a `map` function that I call on the Dataset that looks like this:
```python
def preprocess(sentences: List[str]):
token_ids = [[vocab.to_index(t) for t in s.split()] for s in sentences]
sembeddings = stransformer.encode(sentences)
print(sembeddings.dtype)
return {"input_ids": token_ids, "sembedding": sembeddings}
```
Given a list of `sentences` (`List[str]`), it converts those into token_ids on the one hand (list of lists of ints; `List[List[int]]`) and into sentence embeddings on the other (Tensor of dtype `torch.float32`). That means that I actually set the column "sembedding" to a tensor that I as a user expect to be a float32.
It appears though that behind the scenes, this tensor is converted into a **list**. I did not find this documented anywhere but I might have missed it. From a user's perspective this is incredibly important though, because it means you cannot do any data_type or tensor casting yourself in a mapping function! Furthermore, this can lead to issues, as was my case.
My model expected float32 precision, which I thought `sembedding` was because that is what `stransformer.encode` outputs. But behind the scenes this tensor is first cast to a list, and when we then set its format, as below, this column is cast not to float32 but to double precision float64.
```python
dataset.set_format(type="torch", columns=["input_ids", "sembedding"])
```
This happens because apparently there is an intermediate step of casting to a **numpy** array (?) **whose dtype creation/deduction is different from torch dtypes** (see the snippet below). As you can see, this means that the dtype is not preserved: if I got it right, the dataset goes from torch.float32 -> list -> float64 (numpy) -> torch.float64.
```python
import torch
import numpy as np
l = [-0.03010837361216545, -0.035979013890028, -0.016949838027358055]
torch_tensor = torch.tensor(l)
np_array = np.array(l)
np_to_torch = torch.from_numpy(np_array)
print(torch_tensor.dtype)
# torch.float32
print(np_array.dtype)
# float64
print(np_to_torch.dtype)
# torch.float64
```
This might lead to unwanted behaviour. I understand that the whole library is probably built around casting from numpy to other frameworks, so this might be difficult to solve. Perhaps `set_format` should include a `dtypes` option where for each input column the user can specify the wanted precision.
The alternative is that the user needs to cast manually after loading data from the dataset but that does not seem user-friendly, makes the dataset less portable, and might use more space in memory as well as on disk than is actually needed.
Reopening since @bhavitvyamalik started looking into it !
Also I'm posting here a function that could be helpful to support preserving the dtype of tensors.
It's used to build a pyarrow array out of a numpy array and:
- it doesn't convert the numpy array to a python list
- it keeps the precision of the numpy array for the pyarrow array
- it works with multidimensional arrays (while `pa.array` can only take a 1D array as input)
- it builds the pyarrow ListArray from offsets created on-the-fly and values that come from the flattened numpy array
```python
from functools import reduce
from operator import mul
import numpy as np
import pyarrow as pa
def pa_ndarray(a):
"""Build a PyArrow ListArray from a multidimensional NumPy array"""
values = pa.array(a.flatten())
for i in range(a.ndim - 1):
n_offsets = reduce(mul, a.shape[:a.ndim - i - 1], 1)
step_offsets = a.shape[a.ndim - i - 1]
offsets = pa.array(np.arange(n_offsets + 1) * step_offsets, type=pa.int32())
values = pa.ListArray.from_arrays(offsets, values)
return values
narr = np.arange(42).reshape(7, 2, 3).astype(np.uint8)
parr = pa_ndarray(narr)
assert isinstance(parr, pa.Array)
assert parr.type == pa.list_(pa.list_(pa.uint8()))
assert narr.tolist() == parr.to_pylist()
```
The only costly operation is the offsets computations. Since it doesn't iterate on the numpy array values this function is pretty fast. | [
-0.11343346536159515,
-0.22111466526985168,
-0.009710624814033508,
0.2073049545288086,
0.5532287955284119,
0.17301321029663086,
0.5313699841499329,
0.12258078157901764,
0.150482639670372,
-0.06653907895088196,
-0.08439914882183075,
0.24571450054645538,
-0.11755191534757614,
-0.1751451939344406,
0.10261566936969757,
-0.2025274932384491,
0.22825294733047485,
-0.06525659561157227,
-0.14417359232902527,
-0.2050461322069168,
-0.2274056226015091,
-0.08883131295442581,
-0.002708733081817627,
-0.20827312767505646,
-0.16018420457839966,
-0.16405940055847168,
0.24031659960746765,
-0.1392814815044403,
-0.1851637363433838,
-0.0010072011500597,
0.18012771010398865,
-0.16522276401519775,
0.4167291522026062,
0.5717642903327942,
-0.00011631557572400197,
0.2217250019311905,
-0.02668493241071701,
-0.07542597502470016,
-0.18863649666309357,
-0.00015363097190856934,
0.004606880247592926,
-0.1931508630514145,
-0.07237699627876282,
-0.1798606812953949,
-0.15412107110023499,
-0.18332535028457642,
-0.08451487869024277,
-0.7935450673103333,
0.288948655128479,
0.41082698106765747,
0.15193253755569458,
0.25708258152008057,
0.07120189070701599,
0.15259341895580292,
-0.1351296603679657,
0.2725161015987396,
-0.10301314294338226,
0.2802619934082031,
-0.02087704837322235,
0.3604665994644165,
-0.061481691896915436,
0.4459064304828644,
-0.3614790737628937,
-0.07507336139678955,
0.02915721759200096,
0.11278904974460602,
0.054124899208545685,
-0.4639113247394562,
-0.06628388911485672,
0.1654171347618103,
0.19734224677085876,
-0.23208093643188477,
-0.28436514735221863,
-0.16728922724723816,
-0.09335697442293167,
-0.36716192960739136,
0.06623804569244385,
-0.08458168804645538,
0.14548705518245697,
0.10315454006195068,
-0.08470848947763443,
-0.17156894505023956,
-0.03456921875476837,
0.132096529006958,
-0.47534000873565674,
0.21858203411102295,
-0.008936329744756222,
0.14741915464401245,
-0.10354362428188324,
-0.03271909058094025,
0.07431841641664505,
-0.11595109105110168,
0.22098515927791595,
-0.03320378065109253,
-0.17000536620616913,
-0.22360140085220337,
0.10681065917015076,
-0.4505300223827362,
-0.12784722447395325,
-0.4818670153617859,
0.22826427221298218,
0.1562221348285675,
-0.2183919996023178,
-0.027490384876728058,
0.21015053987503052,
0.3317386209964752,
-0.2976427674293518,
0.367876261472702,
0.2994464635848999,
-0.04473838582634926,
0.21113258600234985,
0.09851904213428497,
0.12822936475276947,
0.04643381014466286,
-0.011537410318851471,
0.10379434376955032,
0.5391174554824829,
-0.10612718760967255,
-0.31569528579711914,
0.24234473705291748,
-0.46409177780151367,
0.08543962985277176,
0.02905038744211197,
0.07622194290161133,
-0.15806791186332703,
0.44691890478134155,
0.1909368336200714,
0.08564047515392303,
-0.1537807136774063,
-0.048210855573415756,
-0.14087049663066864,
-0.24633057415485382,
0.0493122898042202,
-0.1757226288318634,
0.04734824225306511,
0.11107712984085083,
-0.05568140000104904,
0.29098451137542725,
0.13049538433551788,
0.16166114807128906,
-0.06239528954029083,
-0.14682485163211823,
0.5156334042549133,
0.29439330101013184,
-0.33007940649986267,
0.1609635055065155,
0.2148125320672989,
-0.35004568099975586,
-0.19412371516227722,
0.341382771730423,
-0.2835558354854584,
0.0002671480178833008,
-0.2552972733974457,
0.08967358618974686,
-0.06263385713100433,
-0.19429704546928406,
0.03833760321140289,
0.5168797969818115,
0.594578206539154,
0.07454080879688263,
0.3335525393486023,
-0.525503933429718,
-0.24441909790039062,
-0.21210946142673492,
0.06510867923498154,
-0.002308860421180725,
-0.46514448523521423,
-0.008492697030305862,
0.2366487979888916,
0.18429549038410187,
0.35619020462036133,
0.41371461749076843,
0.07049202919006348,
0.1077740415930748,
0.07491090148687363,
-0.005354985594749451,
0.4220856726169586,
0.11171625554561615,
-0.2204674929380417,
-0.0649489089846611,
-0.05865521728992462,
0.36356672644615173,
-0.0807047113776207,
0.007956146262586117,
0.31949523091316223,
-0.20357292890548706,
0.20783179998397827,
0.025410441681742668,
-0.27681705355644226,
0.08152221888303757,
-0.20613977313041687,
0.03879286348819733,
0.46476227045059204,
-0.08255188167095184,
-0.03550124540925026,
-0.03818029910326004,
-0.3315746784210205,
0.36261260509490967,
0.24249041080474854,
-0.13688836991786957,
0.03684653341770172,
0.04497833922505379,
0.05481328070163727,
-0.03281647711992264,
0.08329568803310394,
-0.08288977295160294,
-0.523478627204895,
-0.04705696925520897,
0.03621000051498413,
0.2670900523662567,
-0.05031956732273102,
-0.13625404238700867,
0.2245902121067047,
0.0831875205039978,
-0.010378997772932053,
0.039142340421676636,
0.06815090030431747,
-0.17175228893756866,
-0.42560845613479614,
0.07235339283943176,
-0.09666511416435242,
-0.21991173923015594,
-0.0393039844930172,
0.10643459856510162,
-0.4977482557296753,
0.08081146329641342,
0.007505254819989204,
-0.19667010009288788,
-0.2570154368877411,
0.28515398502349854,
0.02317342907190323,
-0.08918611705303192,
-0.23232731223106384,
0.0862705409526825,
0.19311130046844482,
-0.09235554933547974,
-0.6234656572341919,
0.5602859854698181,
0.5223328471183777,
0.02266843244433403,
0.19698143005371094,
0.41789913177490234,
0.01675347238779068,
0.06688133627176285,
-0.1525682806968689,
0.1664799302816391,
0.10833801329135895,
0.018407508730888367,
-0.2958195209503174,
0.06973261386156082,
0.24973002076148987,
0.17612649500370026,
-0.26090702414512634,
-0.1829361915588379,
-0.140511617064476,
-0.07615639269351959,
-0.02798193320631981,
0.13874343037605286,
-0.41208702325820923,
0.3359062671661377,
0.693458080291748,
-0.032273564487695694,
0.2642436921596527,
0.030832065269351006,
-0.3138764202594757,
-0.153360515832901,
0.22853298485279083,
-0.12157607823610306,
0.24705453217029572,
0.08514054864645004,
0.360852986574173,
-0.19991673529148102,
-0.16252516210079193,
-0.07482728362083435,
0.2153988778591156,
0.04692120477557182,
0.06636040657758713,
0.004941482096910477,
0.07510095089673996,
0.15419165790081024,
-0.10572898387908936,
0.2709602117538452,
-0.05039932578802109,
0.20320752263069153,
-0.42591342329978943,
0.21711808443069458,
-0.40165436267852783,
0.05126923322677612,
-0.22967557609081268,
-0.0917816013097763,
-0.07778926193714142,
-0.24561366438865662,
-0.029358524829149246,
0.0008399300277233124,
-0.2700946033000946,
0.3935126066207886,
0.26148757338523865,
0.11669249087572098,
0.08734393864870071,
-0.2350945919752121,
-0.11461342871189117,
-0.17242290079593658,
-0.2385483682155609,
0.040034521371126175,
0.20835444331169128,
-0.3795826733112335,
0.18495666980743408,
0.3574528694152832,
-0.2676811218261719,
-0.2696791887283325,
-0.7421141266822815,
0.04859907925128937,
-0.23554815351963043,
0.09608180820941925,
0.03812190517783165,
0.1293121576309204,
-0.024639245122671127,
0.051053427159786224,
0.02547403797507286,
0.09447668492794037,
-0.018104158341884613,
0.11803428828716278,
-0.19163598120212555,
0.02913101576268673,
-0.287290096282959,
-0.2801528573036194,
-0.03678306192159653,
-0.12199549376964569,
0.1812552809715271,
-0.07983054220676422,
-0.0676226019859314,
0.0514865443110466,
0.09122968465089798,
0.03105081617832184,
-0.05812995508313179,
0.23108986020088196,
-0.4207530915737152,
0.0914393961429596,
0.33490559458732605,
-0.15973693132400513,
-0.30688580870628357,
-0.14327839016914368,
0.023463808000087738,
-0.018258456140756607,
0.07451378554105759,
-0.2800920903682709,
-0.05703340843319893,
-0.21576252579689026,
0.26583534479141235,
-0.014034342020750046,
-0.1009145975112915,
0.5142834186553955,
0.23295871913433075,
0.07127039134502411,
-0.06039189174771309,
0.015321716666221619,
0.0630330741405487,
0.21779149770736694,
0.27216044068336487,
-0.009419813752174377,
0.3699360191822052,
0.1042172908782959,
0.3581047058105469,
0.29433825612068176,
-0.694893479347229,
-0.12603655457496643,
-0.05735335499048233,
0.21538463234901428,
-0.21745023131370544,
-0.2911490797996521,
0.03200322762131691,
-0.2955261766910553,
-0.19893890619277954,
0.00653453916311264,
-0.2766372561454773,
-0.2770918905735016,
0.11846509575843811,
0.23312193155288696,
0.13384196162223816,
-0.4014646112918854,
0.40340670943260193,
-0.30552613735198975,
-0.01881040632724762,
0.07031956315040588,
0.17255306243896484,
-0.1366494745016098,
-0.15400725603103638,
0.12495569884777069,
0.0767139345407486,
0.1390782594680786,
-0.04523887485265732,
-0.15606249868869781,
-0.1616584062576294,
-0.557334303855896,
0.2960478663444519,
0.07333878427743912,
0.399868369102478,
-0.1019989401102066,
-0.3138107657432556,
-0.12368954718112946,
0.26585084199905396,
0.3583010137081146,
-0.06517994403839111,
-0.30855584144592285,
-0.034075189381837845,
0.04683981090784073,
-0.11190840601921082,
0.09082196652889252,
-0.3705390393733978,
0.13999749720096588,
0.15985997021198273,
0.479920893907547,
-0.3152984380722046,
-0.15012376010417938,
0.34070873260498047,
0.09900666773319244,
-0.2651865482330322,
0.12570028007030487,
-0.3059803247451782,
-0.21725383400917053,
0.10291963815689087,
-0.1605294644832611,
0.32184264063835144,
-0.11301393061876297,
-0.16299845278263092,
-0.14211608469486237,
-0.18874917924404144,
-0.05938663333654404,
0.30244043469429016,
-0.05379674583673477,
0.17465460300445557,
0.2735580503940582,
-0.0524262934923172,
0.1738079935312271,
0.44847333431243896,
0.07103908807039261,
0.3958069980144501,
-0.2539946138858795,
-0.4725272059440613,
0.12058957666158676,
0.26259979605674744,
0.2191857099533081,
0.33603811264038086,
-0.06650428473949432,
-0.010750748217105865,
0.0495242178440094,
0.20130294561386108,
-0.41523611545562744,
0.14507253468036652,
0.30020561814308167,
0.43954455852508545,
-0.38180649280548096,
-0.3916044533252716,
0.33989906311035156,
0.10490445792675018,
-0.11184938251972198,
0.34528648853302,
-0.3406515121459961,
-0.4210638403892517,
0.4126031994819641,
0.48667266964912415,
0.9439163208007812,
-0.05152450501918793,
0.3623064160346985,
0.38867637515068054,
0.03951222449541092,
0.7027944922447205,
-0.21958842873573303,
0.09537244588136673,
-0.10928860306739807,
-0.20033836364746094,
-0.18212716281414032,
0.028335582464933395,
0.19228142499923706,
-0.17682752013206482,
-0.393464058637619,
-0.01142326183617115,
0.04501514136791229,
0.3950946629047394,
0.0918084904551506,
0.13700740039348602,
0.13373522460460663,
-0.3839353322982788,
0.0010392051190137863,
0.09620776772499084,
-0.14209260046482086,
-0.024558335542678833,
0.025837071239948273,
-0.12961609661579132,
-0.22719772160053253,
-0.03885548934340477,
-0.2351929396390915,
-0.2038242518901825,
-0.6721231341362,
0.22790579497814178,
-0.21128948032855988,
-0.3824329376220703,
0.21191668510437012,
0.3805316090583801,
0.4986087679862976,
0.06994155794382095,
-0.1444130837917328,
-0.05410018935799599,
0.14069318771362305,
0.250490665435791,
0.36745238304138184,
-0.3385370671749115,
0.5262500047683716,
0.1788806915283203,
-0.01704501360654831,
-0.05232264846563339,
0.01902991160750389,
0.11957865953445435,
-0.3839370012283325,
-0.04443635791540146,
0.010446440428495407,
-0.44863080978393555,
0.018025822937488556,
0.05181959271430969,
0.1929474025964737,
-0.07191915810108185,
0.08035727590322495,
0.00331946462392807,
0.06042002514004707,
0.43908897042274475,
-0.2384054809808731,
-0.20494019985198975,
-0.13601775467395782,
0.2581448554992676,
0.3120487332344055,
-0.027679068967700005,
0.3316820561885834,
0.17486529052257538,
-0.21990616619586945,
-0.13260075449943542,
0.26966220140457153,
0.09624751657247543,
-0.27186885476112366,
0.2938763201236725,
-0.22945858538150787,
-0.3275020122528076,
-0.40293389558792114,
0.0242936871945858,
0.12961499392986298,
0.020083393901586533,
-0.4275782108306885,
0.04812207072973251,
-0.4269220530986786,
0.19557899236679077,
0.1994590312242508,
0.22949692606925964,
-0.09680332988500595,
0.29025861620903015,
-0.18622124195098877,
-0.07525873929262161,
-0.27885961532592773,
-0.14547114074230194,
0.20151643455028534,
0.16078563034534454,
-0.04805085062980652,
-0.06225915253162384,
0.21537847816944122,
-0.2433135062456131,
0.0800854042172432,
0.09557824581861496,
0.08322387933731079,
-0.16887640953063965,
-0.13380040228366852,
0.08440303057432175,
-0.072153240442276,
-0.16313090920448303,
-0.020984705537557602,
-0.19534604251384735,
-0.18672753870487213,
-0.16780447959899902,
0.11266642808914185,
0.27993541955947876,
0.10184212028980255,
0.2763630449771881,
0.04173284024000168,
0.1626678705215454,
0.3086153268814087,
0.005494935438036919,
-0.1270996630191803,
0.2509423494338989,
0.06355921924114227,
0.33679789304733276,
0.01930283196270466,
-0.052214138209819794,
-0.1994486153125763,
0.2303502857685089,
0.050255488604307175,
-0.08984201401472092,
0.4385259449481964,
-0.18629160523414612,
-0.13802745938301086,
0.011326875537633896,
0.18398956954479218,
0.2505353093147278,
-0.31219640374183655,
-0.14360462129116058,
-0.027120452374219894,
0.10801446437835693,
-0.18460536003112793,
0.10111138969659805,
0.192087322473526,
-0.10860477387905121,
0.1267400085926056,
0.4136991500854492,
-0.029626328498125076,
0.5634446144104004,
-0.03976212441921234,
-0.007464313879609108,
0.1605871468782425,
-0.20024597644805908,
0.27978575229644775,
0.26319921016693115,
-0.08982723951339722,
0.15767043828964233,
0.2914581596851349,
0.0799153670668602,
0.13572201132774353,
0.14333833754062653,
0.04752008616924286,
0.20890893042087555,
0.05979480221867561,
0.02784871682524681,
0.4162575602531433,
-0.1557866632938385,
0.12274248898029327,
0.09084928035736084,
-0.43979018926620483,
0.2601422369480133,
0.3826686441898346,
0.07512034475803375,
-0.3052259087562561,
-0.23599055409431458,
-0.1305057853460312,
0.1503942310810089,
-0.4149083197116852,
0.00258022453635931,
-0.2539517879486084,
0.08597511798143387,
-0.061961494386196136,
-0.24506394565105438,
-0.2087458372116089,
-0.04735669493675232,
0.20736268162727356,
0.20336312055587769,
-0.1458740234375,
0.09162641316652298,
-0.2127763032913208,
-0.1652701497077942,
0.0895995944738388,
0.046989139169454575,
0.3118058741092682,
0.39766836166381836,
-0.1903301477432251,
-0.16406285762786865,
0.2795582711696625,
0.26088911294937134,
0.19008904695510864,
-0.25510039925575256,
0.31881317496299744,
0.13687826693058014,
-0.2822490930557251,
0.0019034910947084427,
0.2594357132911682,
0.02231227606534958,
-0.018162522464990616,
0.21527060866355896,
0.10371076315641403,
-0.02872312441468239,
0.15876781940460205,
-0.08291377127170563,
0.23464332520961761,
0.01977112516760826,
0.6455353498458862,
-0.04291380196809769,
-0.14672376215457916,
-0.07847489416599274,
-0.20738574862480164,
-0.21239537000656128,
-0.22240635752677917,
0.7710813283920288,
-0.1710176169872284,
0.2005576491355896,
-0.0775001272559166,
0.06579103320837021,
0.2825329303741455,
0.3724643290042877,
0.08754625916481018,
-0.05230213701725006,
-0.2187703549861908,
0.3671228885650635,
-0.27810391783714294,
0.10558496415615082,
0.21418455243110657,
-0.047855645418167114,
-0.021830562502145767,
0.22368447482585907,
0.4392271637916565,
0.25887101888656616,
0.044760867953300476,
-0.4173411726951599,
0.21641117334365845,
0.033113352954387665,
-0.10542528331279755,
-0.2507250905036926,
-0.4146488904953003,
0.18060946464538574,
0.02940572053194046,
-0.3498017489910126,
0.33164361119270325,
0.13302673399448395,
-0.024106845259666443,
-0.4745326638221741,
0.0894954651594162,
-0.005397513508796692,
0.21871206164360046,
0.23784981667995453,
0.43774640560150146,
0.12689939141273499,
-0.1296064257621765,
-0.25559261441230774,
0.1482960283756256,
-0.05249197781085968,
-0.48035117983818054,
0.411639004945755,
-0.16013497114181519,
0.3657142221927643,
-0.30115121603012085,
-0.29076364636421204,
-0.1951594054698944,
0.02586054801940918,
0.08516983687877655,
-0.43646594882011414,
-0.5503329634666443,
0.3894611895084381,
-0.1322181671857834,
-0.08450661599636078,
0.2017909586429596,
0.48029494285583496,
0.0986783504486084,
0.3818567395210266,
-0.2019927054643631,
-0.34192362427711487,
0.6405491828918457,
-0.26909732818603516,
-0.04120266065001488,
-0.06233583763241768,
-0.07256360352039337,
-0.06485878676176071,
0.050931334495544434,
-0.8520141839981079,
-0.23993265628814697,
0.29742977023124695,
-0.2665523886680603,
-0.248223677277565,
0.30915889143943787,
0.11968289315700531,
0.13414564728736877,
-0.3145247995853424,
0.5315725803375244,
-0.04561431705951691,
-0.15220040082931519,
0.09404595196247101,
-0.18822573125362396
] |
https://github.com/huggingface/datasets/issues/625 | dtype of tensors should be preserved | @lhoestq Have you thought about this further?
We have a use case where we're attempting to load data containing numpy arrays using the `datasets` library.
When using one of the "standard" methods (`[Value(...)]` or `Sequence()`) we see ~200 samples processed per second during the call to `_prepare_split`. This slowdown is caused by the vast number of calls to `encode_nested_example` (each sequence is converted to a list, and each element in the sequence...).
Using the `Feature` `ArrayND` improves this somewhat to ~500/s as it now uses numpy's `tolist()` rather than iterating over each value in the array and converting them individually.
However, it's still pretty slow and in theory it should be possible to avoid the `numpy -> python -> arrow` dance altogether. To demonstrate this, if you keep the `Feature` set to an `ArrayND` but instead return a `pa_ndarray(...)` in `_generate_examples` it skips the conversion (`return obj, False`) and hits ~11_000/s. Two orders of magnitude speed up! The problem is this then fails later on when the `ArrowWriter` tries to write the examples to disk :-(
It would be nice to have first-class support for user-defined PyArrow objects. Is this a possibility? We have _large_ datasets where even an order of magnitude difference is important so settling on the middle ~500/s is less than ideal!
Is there a workaround for this or another method that should be used instead that gets near-to or equal performance to returning PyArrow arrays? | After switching to `datasets` my model just broke. After a weekend of debugging, the issue was that my model could not handle the double that the Dataset provided, as it expected a float (but didn't give a warning, which seems a [PyTorch issue](https://discuss.pytorch.org/t/is-it-required-that-input-and-hidden-for-gru-have-the-same-dtype-float32/96221)).
As a user I did not expect this bug. I have a `map` function that I call on the Dataset that looks like this:
```python
def preprocess(sentences: List[str]):
token_ids = [[vocab.to_index(t) for t in s.split()] for s in sentences]
sembeddings = stransformer.encode(sentences)
print(sembeddings.dtype)
return {"input_ids": token_ids, "sembedding": sembeddings}
```
Given a list of `sentences` (`List[str]`), it converts those into token_ids on the one hand (list of lists of ints; `List[List[int]]`) and into sentence embeddings on the other (Tensor of dtype `torch.float32`). That means that I actually set the column "sembedding" to a tensor that I as a user expect to be a float32.
It appears though that behind the scenes, this tensor is converted into a **list**. I did not find this documented anywhere but I might have missed it. From a user's perspective this is incredibly important though, because it means you cannot do any data_type or tensor casting yourself in a mapping function! Furthermore, this can lead to issues, as was my case.
My model expected float32 precision, which I thought `sembedding` was because that is what `stransformer.encode` outputs. But behind the scenes this tensor is first cast to a list, and when we then set its format, as below, this column is cast not to float32 but to double precision float64.
```python
dataset.set_format(type="torch", columns=["input_ids", "sembedding"])
```
This happens because apparently there is an intermediate step of casting to a **numpy** array (?) **whose dtype creation/deduction is different from torch dtypes** (see the snippet below). As you can see, this means that the dtype is not preserved: if I got it right, the dataset goes from torch.float32 -> list -> float64 (numpy) -> torch.float64.
```python
import torch
import numpy as np
l = [-0.03010837361216545, -0.035979013890028, -0.016949838027358055]
torch_tensor = torch.tensor(l)
np_array = np.array(l)
np_to_torch = torch.from_numpy(np_array)
print(torch_tensor.dtype)
# torch.float32
print(np_array.dtype)
# float64
print(np_to_torch.dtype)
# torch.float64
```
This might lead to unwanted behaviour. I understand that the whole library is probably built around casting from numpy to other frameworks, so this might be difficult to solve. Perhaps `set_format` should include a `dtypes` option where for each input column the user can specify the wanted precision.
The alternative is that the user needs to cast manually after loading data from the dataset but that does not seem user-friendly, makes the dataset less portable, and might use more space in memory as well as on disk than is actually needed. | 239 | dtype of tensors should be preserved
After switching to `datasets` my model just broke. After a weekend of debugging, the issue was that my model could not handle the double that the Dataset provided, as it expected a float (but didn't give a warning, which seems a [PyTorch issue](https://discuss.pytorch.org/t/is-it-required-that-input-and-hidden-for-gru-have-the-same-dtype-float32/96221)).
As a user I did not expect this bug. I have a `map` function that I call on the Dataset that looks like this:
```python
def preprocess(sentences: List[str]):
token_ids = [[vocab.to_index(t) for t in s.split()] for s in sentences]
sembeddings = stransformer.encode(sentences)
print(sembeddings.dtype)
return {"input_ids": token_ids, "sembedding": sembeddings}
```
Given a list of `sentences` (`List[str]`), it converts those into token_ids on the one hand (list of lists of ints; `List[List[int]]`) and into sentence embeddings on the other (Tensor of dtype `torch.float32`). That means that I actually set the column "sembedding" to a tensor that I as a user expect to be a float32.
It appears though that behind the scenes, this tensor is converted into a **list**. I did not find this documented anywhere but I might have missed it. From a user's perspective this is incredibly important though, because it means you cannot do any data_type or tensor casting yourself in a mapping function! Furthermore, this can lead to issues, as was my case.
My model expected float32 precision, which I thought `sembedding` was because that is what `stransformer.encode` outputs. But behind the scenes this tensor is first cast to a list, and when we then set its format, as below, this column is cast not to float32 but to double precision float64.
```python
dataset.set_format(type="torch", columns=["input_ids", "sembedding"])
```
This happens because apparently there is an intermediate step of casting to a **numpy** array (?) **whose dtype creation/deduction is different from torch dtypes** (see the snippet below). As you can see, this means that the dtype is not preserved: if I got it right, the dataset goes from torch.float32 -> list -> float64 (numpy) -> torch.float64.
```python
import torch
import numpy as np
l = [-0.03010837361216545, -0.035979013890028, -0.016949838027358055]
torch_tensor = torch.tensor(l)
np_array = np.array(l)
np_to_torch = torch.from_numpy(np_array)
print(torch_tensor.dtype)
# torch.float32
print(np_array.dtype)
# float64
print(np_to_torch.dtype)
# torch.float64
```
This might lead to unwanted behaviour. I understand that the whole library is probably built around casting from numpy to other frameworks, so this might be difficult to solve. Perhaps `set_format` should include a `dtypes` option where for each input column the user can specify the wanted precision.
The alternative is that the user needs to cast manually after loading data from the dataset but that does not seem user-friendly, makes the dataset less portable, and might use more space in memory as well as on disk than is actually needed.
@lhoestq Have you thought about this further?
We have a use case where we're attempting to load data containing numpy arrays using the `datasets` library.
When using one of the "standard" methods (`[Value(...)]` or `Sequence()`) we see ~200 samples processed per second during the call to `_prepare_split`. This slowdown is caused by the vast number of calls to `encode_nested_example` (each sequence is converted to a list, and each element in the sequence...).
Using the `Feature` `ArrayND` improves this somewhat to ~500/s as it now uses numpy's `tolist()` rather than iterating over each value in the array and converting them individually.
However, it's still pretty slow and in theory it should be possible to avoid the `numpy -> python -> arrow` dance altogether. To demonstrate this, if you keep the `Feature` set to an `ArrayND` but instead return a `pa_ndarray(...)` in `_generate_examples` it skips the conversion (`return obj, False`) and hits ~11_000/s. Two orders of magnitude speed up! The problem is this then fails later on when the `ArrowWriter` tries to write the examples to disk :-(
It would be nice to have first-class support for user-defined PyArrow objects. Is this a possibility? We have _large_ datasets where even an order of magnitude difference is important so settling on the middle ~500/s is less than ideal!
Is there a workaround for this or another method that should be used instead that gets near-to or equal performance to returning PyArrow arrays? | [
-0.11343346536159515,
-0.22111466526985168,
-0.009710624814033508,
0.2073049545288086,
0.5532287955284119,
0.17301321029663086,
0.5313699841499329,
0.12258078157901764,
0.150482639670372,
-0.06653907895088196,
-0.08439914882183075,
0.24571450054645538,
-0.11755191534757614,
-0.1751451939344406,
0.10261566936969757,
-0.2025274932384491,
0.22825294733047485,
-0.06525659561157227,
-0.14417359232902527,
-0.2050461322069168,
-0.2274056226015091,
-0.08883131295442581,
-0.002708733081817627,
-0.20827312767505646,
-0.16018420457839966,
-0.16405940055847168,
0.24031659960746765,
-0.1392814815044403,
-0.1851637363433838,
-0.0010072011500597,
0.18012771010398865,
-0.16522276401519775,
0.4167291522026062,
0.5717642903327942,
-0.00011631557572400197,
0.2217250019311905,
-0.02668493241071701,
-0.07542597502470016,
-0.18863649666309357,
-0.00015363097190856934,
0.004606880247592926,
-0.1931508630514145,
-0.07237699627876282,
-0.1798606812953949,
-0.15412107110023499,
-0.18332535028457642,
-0.08451487869024277,
-0.7935450673103333,
0.288948655128479,
0.41082698106765747,
0.15193253755569458,
0.25708258152008057,
0.07120189070701599,
0.15259341895580292,
-0.1351296603679657,
0.2725161015987396,
-0.10301314294338226,
0.2802619934082031,
-0.02087704837322235,
0.3604665994644165,
-0.061481691896915436,
0.4459064304828644,
-0.3614790737628937,
-0.07507336139678955,
0.02915721759200096,
0.11278904974460602,
0.054124899208545685,
-0.4639113247394562,
-0.06628388911485672,
0.1654171347618103,
0.19734224677085876,
-0.23208093643188477,
-0.28436514735221863,
-0.16728922724723816,
-0.09335697442293167,
-0.36716192960739136,
0.06623804569244385,
-0.08458168804645538,
0.14548705518245697,
0.10315454006195068,
-0.08470848947763443,
-0.17156894505023956,
-0.03456921875476837,
0.132096529006958,
-0.47534000873565674,
0.21858203411102295,
-0.008936329744756222,
0.14741915464401245,
-0.10354362428188324,
-0.03271909058094025,
0.07431841641664505,
-0.11595109105110168,
0.22098515927791595,
-0.03320378065109253,
-0.17000536620616913,
-0.22360140085220337,
0.10681065917015076,
-0.4505300223827362,
-0.12784722447395325,
-0.4818670153617859,
0.22826427221298218,
0.1562221348285675,
-0.2183919996023178,
-0.027490384876728058,
0.21015053987503052,
0.3317386209964752,
-0.2976427674293518,
0.367876261472702,
0.2994464635848999,
-0.04473838582634926,
0.21113258600234985,
0.09851904213428497,
0.12822936475276947,
0.04643381014466286,
-0.011537410318851471,
0.10379434376955032,
0.5391174554824829,
-0.10612718760967255,
-0.31569528579711914,
0.24234473705291748,
-0.46409177780151367,
0.08543962985277176,
0.02905038744211197,
0.07622194290161133,
-0.15806791186332703,
0.44691890478134155,
0.1909368336200714,
0.08564047515392303,
-0.1537807136774063,
-0.048210855573415756,
-0.14087049663066864,
-0.24633057415485382,
0.0493122898042202,
-0.1757226288318634,
0.04734824225306511,
0.11107712984085083,
-0.05568140000104904,
0.29098451137542725,
0.13049538433551788,
0.16166114807128906,
-0.06239528954029083,
-0.14682485163211823,
0.5156334042549133,
0.29439330101013184,
-0.33007940649986267,
0.1609635055065155,
0.2148125320672989,
-0.35004568099975586,
-0.19412371516227722,
0.341382771730423,
-0.2835558354854584,
0.0002671480178833008,
-0.2552972733974457,
0.08967358618974686,
-0.06263385713100433,
-0.19429704546928406,
0.03833760321140289,
0.5168797969818115,
0.594578206539154,
0.07454080879688263,
0.3335525393486023,
-0.525503933429718,
-0.24441909790039062,
-0.21210946142673492,
0.06510867923498154,
-0.002308860421180725,
-0.46514448523521423,
-0.008492697030305862,
0.2366487979888916,
0.18429549038410187,
0.35619020462036133,
0.41371461749076843,
0.07049202919006348,
0.1077740415930748,
0.07491090148687363,
-0.005354985594749451,
0.4220856726169586,
0.11171625554561615,
-0.2204674929380417,
-0.0649489089846611,
-0.05865521728992462,
0.36356672644615173,
-0.0807047113776207,
0.007956146262586117,
0.31949523091316223,
-0.20357292890548706,
0.20783179998397827,
0.025410441681742668,
-0.27681705355644226,
0.08152221888303757,
-0.20613977313041687,
0.03879286348819733,
0.46476227045059204,
-0.08255188167095184,
-0.03550124540925026,
-0.03818029910326004,
-0.3315746784210205,
0.36261260509490967,
0.24249041080474854,
-0.13688836991786957,
0.03684653341770172,
0.04497833922505379,
0.05481328070163727,
-0.03281647711992264,
0.08329568803310394,
-0.08288977295160294,
-0.523478627204895,
-0.04705696925520897,
0.03621000051498413,
0.2670900523662567,
-0.05031956732273102,
-0.13625404238700867,
0.2245902121067047,
0.0831875205039978,
-0.010378997772932053,
0.039142340421676636,
0.06815090030431747,
-0.17175228893756866,
-0.42560845613479614,
0.07235339283943176,
-0.09666511416435242,
-0.21991173923015594,
-0.0393039844930172,
0.10643459856510162,
-0.4977482557296753,
0.08081146329641342,
0.007505254819989204,
-0.19667010009288788,
-0.2570154368877411,
0.28515398502349854,
0.02317342907190323,
-0.08918611705303192,
-0.23232731223106384,
0.0862705409526825,
0.19311130046844482,
-0.09235554933547974,
-0.6234656572341919,
0.5602859854698181,
0.5223328471183777,
0.02266843244433403,
0.19698143005371094,
0.41789913177490234,
0.01675347238779068,
0.06688133627176285,
-0.1525682806968689,
0.1664799302816391,
0.10833801329135895,
0.018407508730888367,
-0.2958195209503174,
0.06973261386156082,
0.24973002076148987,
0.17612649500370026,
-0.26090702414512634,
-0.1829361915588379,
-0.140511617064476,
-0.07615639269351959,
-0.02798193320631981,
0.13874343037605286,
-0.41208702325820923,
0.3359062671661377,
0.693458080291748,
-0.032273564487695694,
0.2642436921596527,
0.030832065269351006,
-0.3138764202594757,
-0.153360515832901,
0.22853298485279083,
-0.12157607823610306,
0.24705453217029572,
0.08514054864645004,
0.360852986574173,
-0.19991673529148102,
-0.16252516210079193,
-0.07482728362083435,
0.2153988778591156,
0.04692120477557182,
0.06636040657758713,
0.004941482096910477,
0.07510095089673996,
0.15419165790081024,
-0.10572898387908936,
0.2709602117538452,
-0.05039932578802109,
0.20320752263069153,
-0.42591342329978943,
0.21711808443069458,
-0.40165436267852783,
0.05126923322677612,
-0.22967557609081268,
-0.0917816013097763,
-0.07778926193714142,
-0.24561366438865662,
-0.029358524829149246,
0.0008399300277233124,
-0.2700946033000946,
0.3935126066207886,
0.26148757338523865,
0.11669249087572098,
0.08734393864870071,
-0.2350945919752121,
-0.11461342871189117,
-0.17242290079593658,
-0.2385483682155609,
0.040034521371126175,
0.20835444331169128,
-0.3795826733112335,
0.18495666980743408,
0.3574528694152832,
-0.2676811218261719,
-0.2696791887283325,
-0.7421141266822815,
0.04859907925128937,
-0.23554815351963043,
0.09608180820941925,
0.03812190517783165,
0.1293121576309204,
-0.024639245122671127,
0.051053427159786224,
0.02547403797507286,
0.09447668492794037,
-0.018104158341884613,
0.11803428828716278,
-0.19163598120212555,
0.02913101576268673,
-0.287290096282959,
-0.2801528573036194,
-0.03678306192159653,
-0.12199549376964569,
0.1812552809715271,
-0.07983054220676422,
-0.0676226019859314,
0.0514865443110466,
0.09122968465089798,
0.03105081617832184,
-0.05812995508313179,
0.23108986020088196,
-0.4207530915737152,
0.0914393961429596,
0.33490559458732605,
-0.15973693132400513,
-0.30688580870628357,
-0.14327839016914368,
0.023463808000087738,
-0.018258456140756607,
0.07451378554105759,
-0.2800920903682709,
-0.05703340843319893,
-0.21576252579689026,
0.26583534479141235,
-0.014034342020750046,
-0.1009145975112915,
0.5142834186553955,
0.23295871913433075,
0.07127039134502411,
-0.06039189174771309,
0.015321716666221619,
0.0630330741405487,
0.21779149770736694,
0.27216044068336487,
-0.009419813752174377,
0.3699360191822052,
0.1042172908782959,
0.3581047058105469,
0.29433825612068176,
-0.694893479347229,
-0.12603655457496643,
-0.05735335499048233,
0.21538463234901428,
-0.21745023131370544,
-0.2911490797996521,
0.03200322762131691,
-0.2955261766910553,
-0.19893890619277954,
0.00653453916311264,
-0.2766372561454773,
-0.2770918905735016,
0.11846509575843811,
0.23312193155288696,
0.13384196162223816,
-0.4014646112918854,
0.40340670943260193,
-0.30552613735198975,
-0.01881040632724762,
0.07031956315040588,
0.17255306243896484,
-0.1366494745016098,
-0.15400725603103638,
0.12495569884777069,
0.0767139345407486,
0.1390782594680786,
-0.04523887485265732,
-0.15606249868869781,
-0.1616584062576294,
-0.557334303855896,
0.2960478663444519,
0.07333878427743912,
0.399868369102478,
-0.1019989401102066,
-0.3138107657432556,
-0.12368954718112946,
0.26585084199905396,
0.3583010137081146,
-0.06517994403839111,
-0.30855584144592285,
-0.034075189381837845,
0.04683981090784073,
-0.11190840601921082,
0.09082196652889252,
-0.3705390393733978,
0.13999749720096588,
0.15985997021198273,
0.479920893907547,
-0.3152984380722046,
-0.15012376010417938,
0.34070873260498047,
0.09900666773319244,
-0.2651865482330322,
0.12570028007030487,
-0.3059803247451782,
-0.21725383400917053,
0.10291963815689087,
-0.1605294644832611,
0.32184264063835144,
-0.11301393061876297,
-0.16299845278263092,
-0.14211608469486237,
-0.18874917924404144,
-0.05938663333654404,
0.30244043469429016,
-0.05379674583673477,
0.17465460300445557,
0.2735580503940582,
-0.0524262934923172,
0.1738079935312271,
0.44847333431243896,
0.07103908807039261,
0.3958069980144501,
-0.2539946138858795,
-0.4725272059440613,
0.12058957666158676,
0.26259979605674744,
0.2191857099533081,
0.33603811264038086,
-0.06650428473949432,
-0.010750748217105865,
0.0495242178440094,
0.20130294561386108,
-0.41523611545562744,
0.14507253468036652,
0.30020561814308167,
0.43954455852508545,
-0.38180649280548096,
-0.3916044533252716,
0.33989906311035156,
0.10490445792675018,
-0.11184938251972198,
0.34528648853302,
-0.3406515121459961,
-0.4210638403892517,
0.4126031994819641,
0.48667266964912415,
0.9439163208007812,
-0.05152450501918793,
0.3623064160346985,
0.38867637515068054,
0.03951222449541092,
0.7027944922447205,
-0.21958842873573303,
0.09537244588136673,
-0.10928860306739807,
-0.20033836364746094,
-0.18212716281414032,
0.028335582464933395,
0.19228142499923706,
-0.17682752013206482,
-0.393464058637619,
-0.01142326183617115,
0.04501514136791229,
0.3950946629047394,
0.0918084904551506,
0.13700740039348602,
0.13373522460460663,
-0.3839353322982788,
0.0010392051190137863,
0.09620776772499084,
-0.14209260046482086,
-0.024558335542678833,
0.025837071239948273,
-0.12961609661579132,
-0.22719772160053253,
-0.03885548934340477,
-0.2351929396390915,
-0.2038242518901825,
-0.6721231341362,
0.22790579497814178,
-0.21128948032855988,
-0.3824329376220703,
0.21191668510437012,
0.3805316090583801,
0.4986087679862976,
0.06994155794382095,
-0.1444130837917328,
-0.05410018935799599,
0.14069318771362305,
0.250490665435791,
0.36745238304138184,
-0.3385370671749115,
0.5262500047683716,
0.1788806915283203,
-0.01704501360654831,
-0.05232264846563339,
0.01902991160750389,
0.11957865953445435,
-0.3839370012283325,
-0.04443635791540146,
0.010446440428495407,
-0.44863080978393555,
0.018025822937488556,
0.05181959271430969,
0.1929474025964737,
-0.07191915810108185,
0.08035727590322495,
0.00331946462392807,
0.06042002514004707,
0.43908897042274475,
-0.2384054809808731,
-0.20494019985198975,
-0.13601775467395782,
0.2581448554992676,
0.3120487332344055,
-0.027679068967700005,
0.3316820561885834,
0.17486529052257538,
-0.21990616619586945,
-0.13260075449943542,
0.26966220140457153,
0.09624751657247543,
-0.27186885476112366,
0.2938763201236725,
-0.22945858538150787,
-0.3275020122528076,
-0.40293389558792114,
0.0242936871945858,
0.12961499392986298,
0.020083393901586533,
-0.4275782108306885,
0.04812207072973251,
-0.4269220530986786,
0.19557899236679077,
0.1994590312242508,
0.22949692606925964,
-0.09680332988500595,
0.29025861620903015,
-0.18622124195098877,
-0.07525873929262161,
-0.27885961532592773,
-0.14547114074230194,
0.20151643455028534,
0.16078563034534454,
-0.04805085062980652,
-0.06225915253162384,
0.21537847816944122,
-0.2433135062456131,
0.0800854042172432,
0.09557824581861496,
0.08322387933731079,
-0.16887640953063965,
-0.13380040228366852,
0.08440303057432175,
-0.072153240442276,
-0.16313090920448303,
-0.020984705537557602,
-0.19534604251384735,
-0.18672753870487213,
-0.16780447959899902,
0.11266642808914185,
0.27993541955947876,
0.10184212028980255,
0.2763630449771881,
0.04173284024000168,
0.1626678705215454,
0.3086153268814087,
0.005494935438036919,
-0.1270996630191803,
0.2509423494338989,
0.06355921924114227,
0.33679789304733276,
0.01930283196270466,
-0.052214138209819794,
-0.1994486153125763,
0.2303502857685089,
0.050255488604307175,
-0.08984201401472092,
0.4385259449481964,
-0.18629160523414612,
-0.13802745938301086,
0.011326875537633896,
0.18398956954479218,
0.2505353093147278,
-0.31219640374183655,
-0.14360462129116058,
-0.027120452374219894,
0.10801446437835693,
-0.18460536003112793,
0.10111138969659805,
0.192087322473526,
-0.10860477387905121,
0.1267400085926056,
0.4136991500854492,
-0.029626328498125076,
0.5634446144104004,
-0.03976212441921234,
-0.007464313879609108,
0.1605871468782425,
-0.20024597644805908,
0.27978575229644775,
0.26319921016693115,
-0.08982723951339722,
0.15767043828964233,
0.2914581596851349,
0.0799153670668602,
0.13572201132774353,
0.14333833754062653,
0.04752008616924286,
0.20890893042087555,
0.05979480221867561,
0.02784871682524681,
0.4162575602531433,
-0.1557866632938385,
0.12274248898029327,
0.09084928035736084,
-0.43979018926620483,
0.2601422369480133,
0.3826686441898346,
0.07512034475803375,
-0.3052259087562561,
-0.23599055409431458,
-0.1305057853460312,
0.1503942310810089,
-0.4149083197116852,
0.00258022453635931,
-0.2539517879486084,
0.08597511798143387,
-0.061961494386196136,
-0.24506394565105438,
-0.2087458372116089,
-0.04735669493675232,
0.20736268162727356,
0.20336312055587769,
-0.1458740234375,
0.09162641316652298,
-0.2127763032913208,
-0.1652701497077942,
0.0895995944738388,
0.046989139169454575,
0.3118058741092682,
0.39766836166381836,
-0.1903301477432251,
-0.16406285762786865,
0.2795582711696625,
0.26088911294937134,
0.19008904695510864,
-0.25510039925575256,
0.31881317496299744,
0.13687826693058014,
-0.2822490930557251,
0.0019034910947084427,
0.2594357132911682,
0.02231227606534958,
-0.018162522464990616,
0.21527060866355896,
0.10371076315641403,
-0.02872312441468239,
0.15876781940460205,
-0.08291377127170563,
0.23464332520961761,
0.01977112516760826,
0.6455353498458862,
-0.04291380196809769,
-0.14672376215457916,
-0.07847489416599274,
-0.20738574862480164,
-0.21239537000656128,
-0.22240635752677917,
0.7710813283920288,
-0.1710176169872284,
0.2005576491355896,
-0.0775001272559166,
0.06579103320837021,
0.2825329303741455,
0.3724643290042877,
0.08754625916481018,
-0.05230213701725006,
-0.2187703549861908,
0.3671228885650635,
-0.27810391783714294,
0.10558496415615082,
0.21418455243110657,
-0.047855645418167114,
-0.021830562502145767,
0.22368447482585907,
0.4392271637916565,
0.25887101888656616,
0.044760867953300476,
-0.4173411726951599,
0.21641117334365845,
0.033113352954387665,
-0.10542528331279755,
-0.2507250905036926,
-0.4146488904953003,
0.18060946464538574,
0.02940572053194046,
-0.3498017489910126,
0.33164361119270325,
0.13302673399448395,
-0.024106845259666443,
-0.4745326638221741,
0.0894954651594162,
-0.005397513508796692,
0.21871206164360046,
0.23784981667995453,
0.43774640560150146,
0.12689939141273499,
-0.1296064257621765,
-0.25559261441230774,
0.1482960283756256,
-0.05249197781085968,
-0.48035117983818054,
0.411639004945755,
-0.16013497114181519,
0.3657142221927643,
-0.30115121603012085,
-0.29076364636421204,
-0.1951594054698944,
0.02586054801940918,
0.08516983687877655,
-0.43646594882011414,
-0.5503329634666443,
0.3894611895084381,
-0.1322181671857834,
-0.08450661599636078,
0.2017909586429596,
0.48029494285583496,
0.0986783504486084,
0.3818567395210266,
-0.2019927054643631,
-0.34192362427711487,
0.6405491828918457,
-0.26909732818603516,
-0.04120266065001488,
-0.06233583763241768,
-0.07256360352039337,
-0.06485878676176071,
0.050931334495544434,
-0.8520141839981079,
-0.23993265628814697,
0.29742977023124695,
-0.2665523886680603,
-0.248223677277565,
0.30915889143943787,
0.11968289315700531,
0.13414564728736877,
-0.3145247995853424,
0.5315725803375244,
-0.04561431705951691,
-0.15220040082931519,
0.09404595196247101,
-0.18822573125362396
] |
https://github.com/huggingface/datasets/issues/625 | dtype of tensors should be preserved | Hi !
It would be awesome to achieve this speed for numpy arrays !
For now we have to use `encode_nested_example` to convert numpy arrays to python lists since pyarrow doesn't support multidimensional numpy arrays (only 1D).
Maybe let's start a new PR from your PR @bhavitvyamalik (idk why we didn't answer your PR at that time, sorry about that).
Basically the idea is to allow `TypedSequence` to support numpy arrays as you did, and remove the numpy->python casting in `_cast_to_python_objects`.
This is really important since we are starting to have a focus on other modalities than text as well (audio, images).
Though until then @samgd, there is another feature that may interest you and that may give you the speed you want:
In a dataset script you can subclass either a GeneratorBasedBuilder (with the `_generate_examples ` method) or an ArrowBasedBuilder if you want. the ArrowBasedBuilder allows to yield arrow data by implementing the `_generate_tables` method (it's the same as `_generate_examples` except you must yield arrow tables). Since the data are already in arrow format, it doesn't call `encode_nested_example`. Let me know if that helps. | After switching to `datasets` my model just broke. After a weekend of debugging, the issue was that my model could not handle the double that the Dataset provided, as it expected a float (but didn't give a warning, which seems a [PyTorch issue](https://discuss.pytorch.org/t/is-it-required-that-input-and-hidden-for-gru-have-the-same-dtype-float32/96221)).
As a user I did not expect this bug. I have a `map` function that I call on the Dataset that looks like this:
```python
def preprocess(sentences: List[str]):
token_ids = [[vocab.to_index(t) for t in s.split()] for s in sentences]
sembeddings = stransformer.encode(sentences)
print(sembeddings.dtype)
return {"input_ids": token_ids, "sembedding": sembeddings}
```
Given a list of `sentences` (`List[str]`), it converts those into token_ids on the one hand (list of lists of ints; `List[List[int]]`) and into sentence embeddings on the other (Tensor of dtype `torch.float32`). That means that I actually set the column "sembedding" to a tensor that I as a user expect to be a float32.
It appears though that behind the scenes, this tensor is converted into a **list**. I did not find this documented anywhere but I might have missed it. From a user's perspective this is incredibly important though, because it means you cannot do any data_type or tensor casting yourself in a mapping function! Furthermore, this can lead to issues, as was my case.
My model expected float32 precision, which I thought `sembedding` was because that is what `stransformer.encode` outputs. But behind the scenes this tensor is first cast to a list, and when we then set its format, as below, this column is cast not to float32 but to double precision float64.
```python
dataset.set_format(type="torch", columns=["input_ids", "sembedding"])
```
This happens because apparently there is an intermediate step of casting to a **numpy** array (?) **whose dtype creation/deduction is different from torch dtypes** (see the snippet below). As you can see, this means that the dtype is not preserved: if I got it right, the dataset goes from torch.float32 -> list -> float64 (numpy) -> torch.float64.
```python
import torch
import numpy as np
l = [-0.03010837361216545, -0.035979013890028, -0.016949838027358055]
torch_tensor = torch.tensor(l)
np_array = np.array(l)
np_to_torch = torch.from_numpy(np_array)
print(torch_tensor.dtype)
# torch.float32
print(np_array.dtype)
# float64
print(np_to_torch.dtype)
# torch.float64
```
This might lead to unwanted behaviour. I understand that the whole library is probably built around casting from numpy to other frameworks, so this might be difficult to solve. Perhaps `set_format` should include a `dtypes` option where for each input column the user can specify the wanted precision.
The alternative is that the user needs to cast manually after loading data from the dataset but that does not seem user-friendly, makes the dataset less portable, and might use more space in memory as well as on disk than is actually needed. | 185 | dtype of tensors should be preserved
After switching to `datasets` my model just broke. After a weekend of debugging, the issue was that my model could not handle the double that the Dataset provided, as it expected a float (but didn't give a warning, which seems a [PyTorch issue](https://discuss.pytorch.org/t/is-it-required-that-input-and-hidden-for-gru-have-the-same-dtype-float32/96221)).
As a user I did not expect this bug. I have a `map` function that I call on the Dataset that looks like this:
```python
def preprocess(sentences: List[str]):
token_ids = [[vocab.to_index(t) for t in s.split()] for s in sentences]
sembeddings = stransformer.encode(sentences)
print(sembeddings.dtype)
return {"input_ids": token_ids, "sembedding": sembeddings}
```
Given a list of `sentences` (`List[str]`), it converts those into token_ids on the one hand (list of lists of ints; `List[List[int]]`) and into sentence embeddings on the other (Tensor of dtype `torch.float32`). That means that I actually set the column "sembedding" to a tensor that I as a user expect to be a float32.
It appears though that behind the scenes, this tensor is converted into a **list**. I did not find this documented anywhere but I might have missed it. From a user's perspective this is incredibly important though, because it means you cannot do any data_type or tensor casting yourself in a mapping function! Furthermore, this can lead to issues, as was my case.
My model expected float32 precision, which I thought `sembedding` was because that is what `stransformer.encode` outputs. But behind the scenes this tensor is first cast to a list, and when we then set its format, as below, this column is cast not to float32 but to double precision float64.
```python
dataset.set_format(type="torch", columns=["input_ids", "sembedding"])
```
This happens because apparently there is an intermediate step of casting to a **numpy** array (?) **whose dtype creation/deduction is different from torch dtypes** (see the snippet below). As you can see, this means that the dtype is not preserved: if I got it right, the dataset goes from torch.float32 -> list -> float64 (numpy) -> torch.float64.
```python
import torch
import numpy as np
l = [-0.03010837361216545, -0.035979013890028, -0.016949838027358055]
torch_tensor = torch.tensor(l)
np_array = np.array(l)
np_to_torch = torch.from_numpy(np_array)
print(torch_tensor.dtype)
# torch.float32
print(np_array.dtype)
# float64
print(np_to_torch.dtype)
# torch.float64
```
This might lead to unwanted behaviour. I understand that the whole library is probably built around casting from numpy to other frameworks, so this might be difficult to solve. Perhaps `set_format` should include a `dtypes` option where for each input column the user can specify the wanted precision.
The alternative is that the user needs to cast manually after loading data from the dataset but that does not seem user-friendly, makes the dataset less portable, and might use more space in memory as well as on disk than is actually needed.
Hi !
It would be awesome to achieve this speed for numpy arrays !
For now we have to use `encode_nested_example` to convert numpy arrays to python lists since pyarrow doesn't support multidimensional numpy arrays (only 1D).
Maybe let's start a new PR from your PR @bhavitvyamalik (idk why we didn't answer your PR at that time, sorry about that).
Basically the idea is to allow `TypedSequence` to support numpy arrays as you did, and remove the numpy->python casting in `_cast_to_python_objects`.
This is really important since we are starting to have a focus on other modalities than text as well (audio, images).
Though until then @samgd, there is another feature that may interest you and that may give you the speed you want:
In a dataset script you can subclass either a GeneratorBasedBuilder (with the `_generate_examples ` method) or an ArrowBasedBuilder if you want. the ArrowBasedBuilder allows to yield arrow data by implementing the `_generate_tables` method (it's the same as `_generate_examples` except you must yield arrow tables). Since the data are already in arrow format, it doesn't call `encode_nested_example`. Let me know if that helps. | [
-0.11343346536159515,
-0.22111466526985168,
-0.009710624814033508,
0.2073049545288086,
0.5532287955284119,
0.17301321029663086,
0.5313699841499329,
0.12258078157901764,
0.150482639670372,
-0.06653907895088196,
-0.08439914882183075,
0.24571450054645538,
-0.11755191534757614,
-0.1751451939344406,
0.10261566936969757,
-0.2025274932384491,
0.22825294733047485,
-0.06525659561157227,
-0.14417359232902527,
-0.2050461322069168,
-0.2274056226015091,
-0.08883131295442581,
-0.002708733081817627,
-0.20827312767505646,
-0.16018420457839966,
-0.16405940055847168,
0.24031659960746765,
-0.1392814815044403,
-0.1851637363433838,
-0.0010072011500597,
0.18012771010398865,
-0.16522276401519775,
0.4167291522026062,
0.5717642903327942,
-0.00011631557572400197,
0.2217250019311905,
-0.02668493241071701,
-0.07542597502470016,
-0.18863649666309357,
-0.00015363097190856934,
0.004606880247592926,
-0.1931508630514145,
-0.07237699627876282,
-0.1798606812953949,
-0.15412107110023499,
-0.18332535028457642,
-0.08451487869024277,
-0.7935450673103333,
0.288948655128479,
0.41082698106765747,
0.15193253755569458,
0.25708258152008057,
0.07120189070701599,
0.15259341895580292,
-0.1351296603679657,
0.2725161015987396,
-0.10301314294338226,
0.2802619934082031,
-0.02087704837322235,
0.3604665994644165,
-0.061481691896915436,
0.4459064304828644,
-0.3614790737628937,
-0.07507336139678955,
0.02915721759200096,
0.11278904974460602,
0.054124899208545685,
-0.4639113247394562,
-0.06628388911485672,
0.1654171347618103,
0.19734224677085876,
-0.23208093643188477,
-0.28436514735221863,
-0.16728922724723816,
-0.09335697442293167,
-0.36716192960739136,
0.06623804569244385,
-0.08458168804645538,
0.14548705518245697,
0.10315454006195068,
-0.08470848947763443,
-0.17156894505023956,
-0.03456921875476837,
0.132096529006958,
-0.47534000873565674,
0.21858203411102295,
-0.008936329744756222,
0.14741915464401245,
-0.10354362428188324,
-0.03271909058094025,
0.07431841641664505,
-0.11595109105110168,
0.22098515927791595,
-0.03320378065109253,
-0.17000536620616913,
-0.22360140085220337,
0.10681065917015076,
-0.4505300223827362,
-0.12784722447395325,
-0.4818670153617859,
0.22826427221298218,
0.1562221348285675,
-0.2183919996023178,
-0.027490384876728058,
0.21015053987503052,
0.3317386209964752,
-0.2976427674293518,
0.367876261472702,
0.2994464635848999,
-0.04473838582634926,
0.21113258600234985,
0.09851904213428497,
0.12822936475276947,
0.04643381014466286,
-0.011537410318851471,
0.10379434376955032,
0.5391174554824829,
-0.10612718760967255,
-0.31569528579711914,
0.24234473705291748,
-0.46409177780151367,
0.08543962985277176,
0.02905038744211197,
0.07622194290161133,
-0.15806791186332703,
0.44691890478134155,
0.1909368336200714,
0.08564047515392303,
-0.1537807136774063,
-0.048210855573415756,
-0.14087049663066864,
-0.24633057415485382,
0.0493122898042202,
-0.1757226288318634,
0.04734824225306511,
0.11107712984085083,
-0.05568140000104904,
0.29098451137542725,
0.13049538433551788,
0.16166114807128906,
-0.06239528954029083,
-0.14682485163211823,
0.5156334042549133,
0.29439330101013184,
-0.33007940649986267,
0.1609635055065155,
0.2148125320672989,
-0.35004568099975586,
-0.19412371516227722,
0.341382771730423,
-0.2835558354854584,
0.0002671480178833008,
-0.2552972733974457,
0.08967358618974686,
-0.06263385713100433,
-0.19429704546928406,
0.03833760321140289,
0.5168797969818115,
0.594578206539154,
0.07454080879688263,
0.3335525393486023,
-0.525503933429718,
-0.24441909790039062,
-0.21210946142673492,
0.06510867923498154,
-0.002308860421180725,
-0.46514448523521423,
-0.008492697030305862,
0.2366487979888916,
0.18429549038410187,
0.35619020462036133,
0.41371461749076843,
0.07049202919006348,
0.1077740415930748,
0.07491090148687363,
-0.005354985594749451,
0.4220856726169586,
0.11171625554561615,
-0.2204674929380417,
-0.0649489089846611,
-0.05865521728992462,
0.36356672644615173,
-0.0807047113776207,
0.007956146262586117,
0.31949523091316223,
-0.20357292890548706,
0.20783179998397827,
0.025410441681742668,
-0.27681705355644226,
0.08152221888303757,
-0.20613977313041687,
0.03879286348819733,
0.46476227045059204,
-0.08255188167095184,
-0.03550124540925026,
-0.03818029910326004,
-0.3315746784210205,
0.36261260509490967,
0.24249041080474854,
-0.13688836991786957,
0.03684653341770172,
0.04497833922505379,
0.05481328070163727,
-0.03281647711992264,
0.08329568803310394,
-0.08288977295160294,
-0.523478627204895,
-0.04705696925520897,
0.03621000051498413,
0.2670900523662567,
-0.05031956732273102,
-0.13625404238700867,
0.2245902121067047,
0.0831875205039978,
-0.010378997772932053,
0.039142340421676636,
0.06815090030431747,
-0.17175228893756866,
-0.42560845613479614,
0.07235339283943176,
-0.09666511416435242,
-0.21991173923015594,
-0.0393039844930172,
0.10643459856510162,
-0.4977482557296753,
0.08081146329641342,
0.007505254819989204,
-0.19667010009288788,
-0.2570154368877411,
0.28515398502349854,
0.02317342907190323,
-0.08918611705303192,
-0.23232731223106384,
0.0862705409526825,
0.19311130046844482,
-0.09235554933547974,
-0.6234656572341919,
0.5602859854698181,
0.5223328471183777,
0.02266843244433403,
0.19698143005371094,
0.41789913177490234,
0.01675347238779068,
0.06688133627176285,
-0.1525682806968689,
0.1664799302816391,
0.10833801329135895,
0.018407508730888367,
-0.2958195209503174,
0.06973261386156082,
0.24973002076148987,
0.17612649500370026,
-0.26090702414512634,
-0.1829361915588379,
-0.140511617064476,
-0.07615639269351959,
-0.02798193320631981,
0.13874343037605286,
-0.41208702325820923,
0.3359062671661377,
0.693458080291748,
-0.032273564487695694,
0.2642436921596527,
0.030832065269351006,
-0.3138764202594757,
-0.153360515832901,
0.22853298485279083,
-0.12157607823610306,
0.24705453217029572,
0.08514054864645004,
0.360852986574173,
-0.19991673529148102,
-0.16252516210079193,
-0.07482728362083435,
0.2153988778591156,
0.04692120477557182,
0.06636040657758713,
0.004941482096910477,
0.07510095089673996,
0.15419165790081024,
-0.10572898387908936,
0.2709602117538452,
-0.05039932578802109,
0.20320752263069153,
-0.42591342329978943,
0.21711808443069458,
-0.40165436267852783,
0.05126923322677612,
-0.22967557609081268,
-0.0917816013097763,
-0.07778926193714142,
-0.24561366438865662,
-0.029358524829149246,
0.0008399300277233124,
-0.2700946033000946,
0.3935126066207886,
0.26148757338523865,
0.11669249087572098,
0.08734393864870071,
-0.2350945919752121,
-0.11461342871189117,
-0.17242290079593658,
-0.2385483682155609,
0.040034521371126175,
0.20835444331169128,
-0.3795826733112335,
0.18495666980743408,
0.3574528694152832,
-0.2676811218261719,
-0.2696791887283325,
-0.7421141266822815,
0.04859907925128937,
-0.23554815351963043,
0.09608180820941925,
0.03812190517783165,
0.1293121576309204,
-0.024639245122671127,
0.051053427159786224,
0.02547403797507286,
0.09447668492794037,
-0.018104158341884613,
0.11803428828716278,
-0.19163598120212555,
0.02913101576268673,
-0.287290096282959,
-0.2801528573036194,
-0.03678306192159653,
-0.12199549376964569,
0.1812552809715271,
-0.07983054220676422,
-0.0676226019859314,
0.0514865443110466,
0.09122968465089798,
0.03105081617832184,
-0.05812995508313179,
0.23108986020088196,
-0.4207530915737152,
0.0914393961429596,
0.33490559458732605,
-0.15973693132400513,
-0.30688580870628357,
-0.14327839016914368,
0.023463808000087738,
-0.018258456140756607,
0.07451378554105759,
-0.2800920903682709,
-0.05703340843319893,
-0.21576252579689026,
0.26583534479141235,
-0.014034342020750046,
-0.1009145975112915,
0.5142834186553955,
0.23295871913433075,
0.07127039134502411,
-0.06039189174771309,
0.015321716666221619,
0.0630330741405487,
0.21779149770736694,
0.27216044068336487,
-0.009419813752174377,
0.3699360191822052,
0.1042172908782959,
0.3581047058105469,
0.29433825612068176,
-0.694893479347229,
-0.12603655457496643,
-0.05735335499048233,
0.21538463234901428,
-0.21745023131370544,
-0.2911490797996521,
0.03200322762131691,
-0.2955261766910553,
-0.19893890619277954,
0.00653453916311264,
-0.2766372561454773,
-0.2770918905735016,
0.11846509575843811,
0.23312193155288696,
0.13384196162223816,
-0.4014646112918854,
0.40340670943260193,
-0.30552613735198975,
-0.01881040632724762,
0.07031956315040588,
0.17255306243896484,
-0.1366494745016098,
-0.15400725603103638,
0.12495569884777069,
0.0767139345407486,
0.1390782594680786,
-0.04523887485265732,
-0.15606249868869781,
-0.1616584062576294,
-0.557334303855896,
0.2960478663444519,
0.07333878427743912,
0.399868369102478,
-0.1019989401102066,
-0.3138107657432556,
-0.12368954718112946,
0.26585084199905396,
0.3583010137081146,
-0.06517994403839111,
-0.30855584144592285,
-0.034075189381837845,
0.04683981090784073,
-0.11190840601921082,
0.09082196652889252,
-0.3705390393733978,
0.13999749720096588,
0.15985997021198273,
0.479920893907547,
-0.3152984380722046,
-0.15012376010417938,
0.34070873260498047,
0.09900666773319244,
-0.2651865482330322,
0.12570028007030487,
-0.3059803247451782,
-0.21725383400917053,
0.10291963815689087,
-0.1605294644832611,
0.32184264063835144,
-0.11301393061876297,
-0.16299845278263092,
-0.14211608469486237,
-0.18874917924404144,
-0.05938663333654404,
0.30244043469429016,
-0.05379674583673477,
0.17465460300445557,
0.2735580503940582,
-0.0524262934923172,
0.1738079935312271,
0.44847333431243896,
0.07103908807039261,
0.3958069980144501,
-0.2539946138858795,
-0.4725272059440613,
0.12058957666158676,
0.26259979605674744,
0.2191857099533081,
0.33603811264038086,
-0.06650428473949432,
-0.010750748217105865,
0.0495242178440094,
0.20130294561386108,
-0.41523611545562744,
0.14507253468036652,
0.30020561814308167,
0.43954455852508545,
-0.38180649280548096,
-0.3916044533252716,
0.33989906311035156,
0.10490445792675018,
-0.11184938251972198,
0.34528648853302,
-0.3406515121459961,
-0.4210638403892517,
0.4126031994819641,
0.48667266964912415,
0.9439163208007812,
-0.05152450501918793,
0.3623064160346985,
0.38867637515068054,
0.03951222449541092,
0.7027944922447205,
-0.21958842873573303,
0.09537244588136673,
-0.10928860306739807,
-0.20033836364746094,
-0.18212716281414032,
0.028335582464933395,
0.19228142499923706,
-0.17682752013206482,
-0.393464058637619,
-0.01142326183617115,
0.04501514136791229,
0.3950946629047394,
0.0918084904551506,
0.13700740039348602,
0.13373522460460663,
-0.3839353322982788,
0.0010392051190137863,
0.09620776772499084,
-0.14209260046482086,
-0.024558335542678833,
0.025837071239948273,
-0.12961609661579132,
-0.22719772160053253,
-0.03885548934340477,
-0.2351929396390915,
-0.2038242518901825,
-0.6721231341362,
0.22790579497814178,
-0.21128948032855988,
-0.3824329376220703,
0.21191668510437012,
0.3805316090583801,
0.4986087679862976,
0.06994155794382095,
-0.1444130837917328,
-0.05410018935799599,
0.14069318771362305,
0.250490665435791,
0.36745238304138184,
-0.3385370671749115,
0.5262500047683716,
0.1788806915283203,
-0.01704501360654831,
-0.05232264846563339,
0.01902991160750389,
0.11957865953445435,
-0.3839370012283325,
-0.04443635791540146,
0.010446440428495407,
-0.44863080978393555,
0.018025822937488556,
0.05181959271430969,
0.1929474025964737,
-0.07191915810108185,
0.08035727590322495,
0.00331946462392807,
0.06042002514004707,
0.43908897042274475,
-0.2384054809808731,
-0.20494019985198975,
-0.13601775467395782,
0.2581448554992676,
0.3120487332344055,
-0.027679068967700005,
0.3316820561885834,
0.17486529052257538,
-0.21990616619586945,
-0.13260075449943542,
0.26966220140457153,
0.09624751657247543,
-0.27186885476112366,
0.2938763201236725,
-0.22945858538150787,
-0.3275020122528076,
-0.40293389558792114,
0.0242936871945858,
0.12961499392986298,
0.020083393901586533,
-0.4275782108306885,
0.04812207072973251,
-0.4269220530986786,
0.19557899236679077,
0.1994590312242508,
0.22949692606925964,
-0.09680332988500595,
0.29025861620903015,
-0.18622124195098877,
-0.07525873929262161,
-0.27885961532592773,
-0.14547114074230194,
0.20151643455028534,
0.16078563034534454,
-0.04805085062980652,
-0.06225915253162384,
0.21537847816944122,
-0.2433135062456131,
0.0800854042172432,
0.09557824581861496,
0.08322387933731079,
-0.16887640953063965,
-0.13380040228366852,
0.08440303057432175,
-0.072153240442276,
-0.16313090920448303,
-0.020984705537557602,
-0.19534604251384735,
-0.18672753870487213,
-0.16780447959899902,
0.11266642808914185,
0.27993541955947876,
0.10184212028980255,
0.2763630449771881,
0.04173284024000168,
0.1626678705215454,
0.3086153268814087,
0.005494935438036919,
-0.1270996630191803,
0.2509423494338989,
0.06355921924114227,
0.33679789304733276,
0.01930283196270466,
-0.052214138209819794,
-0.1994486153125763,
0.2303502857685089,
0.050255488604307175,
-0.08984201401472092,
0.4385259449481964,
-0.18629160523414612,
-0.13802745938301086,
0.011326875537633896,
0.18398956954479218,
0.2505353093147278,
-0.31219640374183655,
-0.14360462129116058,
-0.027120452374219894,
0.10801446437835693,
-0.18460536003112793,
0.10111138969659805,
0.192087322473526,
-0.10860477387905121,
0.1267400085926056,
0.4136991500854492,
-0.029626328498125076,
0.5634446144104004,
-0.03976212441921234,
-0.007464313879609108,
0.1605871468782425,
-0.20024597644805908,
0.27978575229644775,
0.26319921016693115,
-0.08982723951339722,
0.15767043828964233,
0.2914581596851349,
0.0799153670668602,
0.13572201132774353,
0.14333833754062653,
0.04752008616924286,
0.20890893042087555,
0.05979480221867561,
0.02784871682524681,
0.4162575602531433,
-0.1557866632938385,
0.12274248898029327,
0.09084928035736084,
-0.43979018926620483,
0.2601422369480133,
0.3826686441898346,
0.07512034475803375,
-0.3052259087562561,
-0.23599055409431458,
-0.1305057853460312,
0.1503942310810089,
-0.4149083197116852,
0.00258022453635931,
-0.2539517879486084,
0.08597511798143387,
-0.061961494386196136,
-0.24506394565105438,
-0.2087458372116089,
-0.04735669493675232,
0.20736268162727356,
0.20336312055587769,
-0.1458740234375,
0.09162641316652298,
-0.2127763032913208,
-0.1652701497077942,
0.0895995944738388,
0.046989139169454575,
0.3118058741092682,
0.39766836166381836,
-0.1903301477432251,
-0.16406285762786865,
0.2795582711696625,
0.26088911294937134,
0.19008904695510864,
-0.25510039925575256,
0.31881317496299744,
0.13687826693058014,
-0.2822490930557251,
0.0019034910947084427,
0.2594357132911682,
0.02231227606534958,
-0.018162522464990616,
0.21527060866355896,
0.10371076315641403,
-0.02872312441468239,
0.15876781940460205,
-0.08291377127170563,
0.23464332520961761,
0.01977112516760826,
0.6455353498458862,
-0.04291380196809769,
-0.14672376215457916,
-0.07847489416599274,
-0.20738574862480164,
-0.21239537000656128,
-0.22240635752677917,
0.7710813283920288,
-0.1710176169872284,
0.2005576491355896,
-0.0775001272559166,
0.06579103320837021,
0.2825329303741455,
0.3724643290042877,
0.08754625916481018,
-0.05230213701725006,
-0.2187703549861908,
0.3671228885650635,
-0.27810391783714294,
0.10558496415615082,
0.21418455243110657,
-0.047855645418167114,
-0.021830562502145767,
0.22368447482585907,
0.4392271637916565,
0.25887101888656616,
0.044760867953300476,
-0.4173411726951599,
0.21641117334365845,
0.033113352954387665,
-0.10542528331279755,
-0.2507250905036926,
-0.4146488904953003,
0.18060946464538574,
0.02940572053194046,
-0.3498017489910126,
0.33164361119270325,
0.13302673399448395,
-0.024106845259666443,
-0.4745326638221741,
0.0894954651594162,
-0.005397513508796692,
0.21871206164360046,
0.23784981667995453,
0.43774640560150146,
0.12689939141273499,
-0.1296064257621765,
-0.25559261441230774,
0.1482960283756256,
-0.05249197781085968,
-0.48035117983818054,
0.411639004945755,
-0.16013497114181519,
0.3657142221927643,
-0.30115121603012085,
-0.29076364636421204,
-0.1951594054698944,
0.02586054801940918,
0.08516983687877655,
-0.43646594882011414,
-0.5503329634666443,
0.3894611895084381,
-0.1322181671857834,
-0.08450661599636078,
0.2017909586429596,
0.48029494285583496,
0.0986783504486084,
0.3818567395210266,
-0.2019927054643631,
-0.34192362427711487,
0.6405491828918457,
-0.26909732818603516,
-0.04120266065001488,
-0.06233583763241768,
-0.07256360352039337,
-0.06485878676176071,
0.050931334495544434,
-0.8520141839981079,
-0.23993265628814697,
0.29742977023124695,
-0.2665523886680603,
-0.248223677277565,
0.30915889143943787,
0.11968289315700531,
0.13414564728736877,
-0.3145247995853424,
0.5315725803375244,
-0.04561431705951691,
-0.15220040082931519,
0.09404595196247101,
-0.18822573125362396
] |
https://github.com/huggingface/datasets/issues/623 | Custom feature types in `load_dataset` from CSV | Currently `csv` doesn't support the `features` attribute (unlike `json`).
What you can do for now is cast the features using the in-place transform `cast_`
```python
from datasets import load_dataset
dataset = load_dataset('csv', data_files=file_dict, delimiter=';', column_names=['text', 'label'])
dataset.cast_(emotion_features)
```
| I am trying to load a local file with the `load_dataset` function and I want to predefine the feature types with the `features` argument. However, the types are always the same independent of the value of `features`.
I am working with the local files from the emotion dataset. To get the data you can use the following code:
```Python
from pathlib import Path
import wget
EMOTION_PATH = Path("./data/emotion")
DOWNLOAD_URLS = [
"https://www.dropbox.com/s/1pzkadrvffbqw6o/train.txt?dl=1",
"https://www.dropbox.com/s/2mzialpsgf9k5l3/val.txt?dl=1",
"https://www.dropbox.com/s/ikkqxfdbdec3fuj/test.txt?dl=1",
]
if not Path.is_dir(EMOTION_PATH):
Path.mkdir(EMOTION_PATH)
for url in DOWNLOAD_URLS:
wget.download(url, str(EMOTION_PATH))
```
The first five lines of the train set are:
```
i didnt feel humiliated;sadness
i can go from feeling so hopeless to so damned hopeful just from being around someone who cares and is awake;sadness
im grabbing a minute to post i feel greedy wrong;anger
i am ever feeling nostalgic about the fireplace i will know that it is still on the property;love
i am feeling grouchy;anger
```
Here the code to reproduce the issue:
```Python
from datasets import Features, Value, ClassLabel, load_dataset
class_names = ["sadness", "joy", "love", "anger", "fear", "surprise"]
emotion_features = Features({'text': Value('string'), 'label': ClassLabel(names=class_names)})
file_dict = {'train': EMOTION_PATH/'train.txt'}
dataset = load_dataset('csv', data_files=file_dict, delimiter=';', column_names=['text', 'label'], features=emotion_features)
```
**Observed behaviour:**
```Python
dataset['train'].features
```
```Python
{'text': Value(dtype='string', id=None),
'label': Value(dtype='string', id=None)}
```
**Expected behaviour:**
```Python
dataset['train'].features
```
```Python
{'text': Value(dtype='string', id=None),
'label': ClassLabel(num_classes=6, names=['sadness', 'joy', 'love', 'anger', 'fear', 'surprise'], names_file=None, id=None)}
```
**Things I've tried:**
- deleting the cache
- trying other types such as `int64`
Am I missing anything? Thanks for any pointer in the right direction. | 38 | Custom feature types in `load_dataset` from CSV
I am trying to load a local file with the `load_dataset` function and I want to predefine the feature types with the `features` argument. However, the types are always the same independent of the value of `features`.
I am working with the local files from the emotion dataset. To get the data you can use the following code:
```Python
from pathlib import Path
import wget
EMOTION_PATH = Path("./data/emotion")
DOWNLOAD_URLS = [
"https://www.dropbox.com/s/1pzkadrvffbqw6o/train.txt?dl=1",
"https://www.dropbox.com/s/2mzialpsgf9k5l3/val.txt?dl=1",
"https://www.dropbox.com/s/ikkqxfdbdec3fuj/test.txt?dl=1",
]
if not Path.is_dir(EMOTION_PATH):
Path.mkdir(EMOTION_PATH)
for url in DOWNLOAD_URLS:
wget.download(url, str(EMOTION_PATH))
```
The first five lines of the train set are:
```
i didnt feel humiliated;sadness
i can go from feeling so hopeless to so damned hopeful just from being around someone who cares and is awake;sadness
im grabbing a minute to post i feel greedy wrong;anger
i am ever feeling nostalgic about the fireplace i will know that it is still on the property;love
i am feeling grouchy;anger
```
Here the code to reproduce the issue:
```Python
from datasets import Features, Value, ClassLabel, load_dataset
class_names = ["sadness", "joy", "love", "anger", "fear", "surprise"]
emotion_features = Features({'text': Value('string'), 'label': ClassLabel(names=class_names)})
file_dict = {'train': EMOTION_PATH/'train.txt'}
dataset = load_dataset('csv', data_files=file_dict, delimiter=';', column_names=['text', 'label'], features=emotion_features)
```
**Observed behaviour:**
```Python
dataset['train'].features
```
```Python
{'text': Value(dtype='string', id=None),
'label': Value(dtype='string', id=None)}
```
**Expected behaviour:**
```Python
dataset['train'].features
```
```Python
{'text': Value(dtype='string', id=None),
'label': ClassLabel(num_classes=6, names=['sadness', 'joy', 'love', 'anger', 'fear', 'surprise'], names_file=None, id=None)}
```
**Things I've tried:**
- deleting the cache
- trying other types such as `int64`
Am I missing anything? Thanks for any pointer in the right direction.
Currently `csv` doesn't support the `features` attribute (unlike `json`).
What you can do for now is cast the features using the in-place transform `cast_`
```python
from datasets import load_dataset
dataset = load_dataset('csv', data_files=file_dict, delimiter=';', column_names=['text', 'label'])
dataset.cast_(emotion_features)
```
| [
0.08020319044589996,
-0.2782894968986511,
-0.053178947418928146,
0.35092276334762573,
0.31722939014434814,
-0.19431041181087494,
0.5701335072517395,
0.11138424277305603,
0.44612523913383484,
0.025330446660518646,
0.09474451839923859,
0.31617727875709534,
-0.09191003441810608,
0.3901154696941376,
-0.05818796902894974,
0.02672041580080986,
-0.16127455234527588,
0.3348046541213989,
-0.009121887385845184,
-0.34979408979415894,
-0.27132484316825867,
0.17995382845401764,
-0.09304702281951904,
-0.013486474752426147,
-0.30721715092658997,
0.33958908915519714,
0.2221691608428955,
0.14343854784965515,
0.05831192433834076,
-0.37657761573791504,
0.42371055483818054,
0.14869432151317596,
0.3030690848827362,
0.0801391750574112,
-0.0001151108808699064,
0.07688309252262115,
0.029359731823205948,
-0.17400509119033813,
-0.004085496999323368,
-0.3799193501472473,
-0.0387842059135437,
-0.20290648937225342,
0.42470839619636536,
-0.36515292525291443,
-0.23857346177101135,
-0.456402987241745,
-0.2810545265674591,
-0.12927214801311493,
0.28692296147346497,
0.32929107546806335,
0.15120229125022888,
-0.050267722457647324,
-0.2750738859176636,
0.21849468350410461,
0.3587995767593384,
0.675533652305603,
-0.25238850712776184,
0.18702061474323273,
-0.04063430428504944,
-0.11236550658941269,
0.09397374838590622,
-0.10228602588176727,
-0.14386388659477234,
0.3534232974052429,
0.4926105737686157,
0.17106154561042786,
-0.06439170986413956,
-0.13034990429878235,
-0.17332810163497925,
0.2814248204231262,
0.3474106192588806,
0.05629391968250275,
-0.04643578082323074,
-0.32319653034210205,
-0.12386300414800644,
-0.29732847213745117,
0.38241714239120483,
0.08485995978116989,
-0.18184904754161835,
0.16044257581233978,
-0.07894118875265121,
0.4355746805667877,
-0.05815010890364647,
0.3252907991409302,
0.01868792623281479,
-0.07154957950115204,
-0.23921124637126923,
0.10553407669067383,
0.030826978385448456,
-0.2173108011484146,
0.09743644297122955,
-0.34916192293167114,
0.2218388170003891,
0.11720125377178192,
-0.0551007054746151,
0.09958437085151672,
0.0039358437061309814,
-0.060464777052402496,
-0.12108003348112106,
0.03523246571421623,
0.2292756736278534,
0.19328251481056213,
-0.1932465136051178,
0.03171404451131821,
0.27778980135917664,
0.24418304860591888,
0.20021119713783264,
-0.23178315162658691,
0.15273761749267578,
0.10471565276384354,
-0.4232787489891052,
0.01833326183259487,
0.027789399027824402,
-0.30801817774772644,
0.3964598774909973,
0.08695531636476517,
0.5022855997085571,
-0.2398281991481781,
0.057662419974803925,
-0.09801171720027924,
0.04280947893857956,
-0.03219163790345192,
0.1175670325756073,
0.18355709314346313,
-0.026265598833560944,
0.5809870958328247,
-0.06561408936977386,
0.14888787269592285,
-0.32117989659309387,
0.1283436417579651,
-0.05812723934650421,
-0.22264732420444489,
-0.037468601018190384,
-0.04932039976119995,
0.4030340313911438,
0.09410491585731506,
0.24783360958099365,
0.19902630150318146,
-0.023702308535575867,
-0.31866830587387085,
-0.1270064264535904,
-0.09595637023448944,
0.12454555928707123,
0.044335413724184036,
-0.4416731894016266,
0.3375263214111328,
0.24123597145080566,
-0.2255859524011612,
-0.24441105127334595,
0.0952860563993454,
-0.2509177029132843,
-0.23280072212219238,
0.19703692197799683,
0.15558329224586487,
-0.1784612238407135,
-0.02096249908208847,
-0.1068919226527214,
0.09889619052410126,
0.128010556101799,
0.2582724988460541,
0.02637217938899994,
-0.48641693592071533,
-0.38099443912506104,
-0.32497772574424744,
-0.025487009435892105,
0.39543235301971436,
-0.41543903946876526,
-0.20390428602695465,
0.0394425094127655,
-0.046308305114507675,
0.13855910301208496,
0.2530902028083801,
-0.36610090732574463,
0.14516150951385498,
-0.23930533230304718,
0.2845744490623474,
0.5265450477600098,
0.04339839145541191,
-0.21772050857543945,
0.4294430613517761,
0.1565900593996048,
0.32675492763519287,
0.18606749176979065,
0.07426096498966217,
0.07759345322847366,
0.12609170377254486,
0.15949954092502594,
0.4206007122993469,
0.16572034358978271,
0.0673818588256836,
-0.18377676606178284,
-0.15538354218006134,
0.1656046360731125,
-0.003071276471018791,
-0.32881680130958557,
0.30902567505836487,
0.22570013999938965,
-0.5133964419364929,
0.21711164712905884,
-0.1282680630683899,
-0.22640524804592133,
-0.04688984900712967,
0.40307924151420593,
0.5202862620353699,
0.005792484153062105,
-0.01924356073141098,
-0.4824973940849304,
0.22463351488113403,
-0.14934855699539185,
-0.052252352237701416,
-0.006795674562454224,
-0.3252953290939331,
-0.49349355697631836,
-0.05676678568124771,
-0.24717001616954803,
0.1995169073343277,
0.06466422230005264,
0.3136294484138489,
-0.33587250113487244,
0.15885278582572937,
-0.0870927944779396,
0.07098172605037689,
-0.20888769626617432,
-0.25216370820999146,
-0.08015565574169159,
-0.021776655688881874,
0.17207813262939453,
-0.0900508239865303,
0.015792354941368103,
0.07750292867422104,
0.2781899571418762,
0.07674763351678848,
-0.38832810521125793,
0.1277148723602295,
0.2795608937740326,
0.161346897482872,
-0.11299610882997513,
0.21160788834095,
-0.0030284151434898376,
-0.00951404869556427,
-0.027855737134814262,
0.17322678864002228,
0.19356311857700348,
-0.09370467066764832,
-0.029085107147693634,
0.6565466523170471,
0.15393102169036865,
0.24897870421409607,
-0.26784762740135193,
-0.11285305768251419,
0.2808350920677185,
-0.0006698556244373322,
-0.1841067671775818,
-0.06700606644153595,
-0.21463529765605927,
-0.04852097108960152,
0.0014962106943130493,
0.4216480255126953,
-0.3299655318260193,
-0.11577790230512619,
0.47889086604118347,
0.0954587459564209,
0.12916254997253418,
-0.08040373772382736,
-0.01727820187807083,
-0.029092837125062943,
0.016722898930311203,
-0.23705069720745087,
0.4729238748550415,
-0.06108245998620987,
-0.08036521077156067,
-0.008282242342829704,
0.019212326034903526,
-0.22433672845363617,
0.05999976024031639,
-0.13949863612651825,
-0.1910199224948883,
0.29157182574272156,
0.034326471388339996,
-0.15791592001914978,
-0.3376888930797577,
0.24125266075134277,
-0.14660760760307312,
-0.20588712394237518,
-0.6342834234237671,
-0.09906260669231415,
-0.5823048949241638,
0.16830328106880188,
-0.463762104511261,
-0.08222924917936325,
-0.06979547441005707,
0.016335880383849144,
-0.21201938390731812,
0.10337863117456436,
-0.03539653494954109,
0.0900430679321289,
-0.17844770848751068,
0.36256298422813416,
0.06430789828300476,
-0.8123733401298523,
0.22221189737319946,
0.1188192367553711,
-0.44998106360435486,
-0.05817404016852379,
0.17499123513698578,
0.2886112332344055,
0.03556009382009506,
0.028964178636670113,
-0.2870355248451233,
0.008076325990259647,
-0.013293303549289703,
-0.13991805911064148,
0.17074517905712128,
0.5402770638465881,
0.17327070236206055,
0.17569196224212646,
0.13940311968326569,
-0.12606726586818695,
0.39837393164634705,
-0.01311698742210865,
0.05912253260612488,
-0.12502333521842957,
-0.0263376422226429,
0.11143165081739426,
-0.24287070333957672,
-0.6793344616889954,
-0.15019726753234863,
-0.20031385123729706,
0.2844245433807373,
0.21396160125732422,
0.05112592130899429,
0.19712679088115692,
0.36830517649650574,
-0.2396499365568161,
0.15469659864902496,
-0.026357116177678108,
-0.20738594233989716,
-0.07251214981079102,
0.44383475184440613,
-0.17480483651161194,
-0.21861512959003448,
0.009301472455263138,
-0.3093705177307129,
-0.3122234344482422,
0.13407231867313385,
-0.3119173049926758,
0.06121731922030449,
-0.3492913842201233,
0.5237390398979187,
0.05411292612552643,
0.024073880165815353,
0.10822631418704987,
-0.1130082979798317,
0.03962411731481552,
-0.17586392164230347,
-0.3381883203983307,
0.452170729637146,
0.3127177059650421,
0.09914903342723846,
0.42452624440193176,
-0.025254566222429276,
-0.41299712657928467,
0.49855363368988037,
-0.28556209802627563,
-0.1919134110212326,
0.5953596830368042,
-0.18008989095687866,
0.17871904373168945,
-0.07286901026964188,
-0.2670246362686157,
-0.11260268092155457,
-0.04256470501422882,
-0.11165682971477509,
0.22369107604026794,
-0.008556760847568512,
-0.27002429962158203,
-0.18102994561195374,
0.212380513548851,
-0.21761766076087952,
-0.260853111743927,
0.2379056215286255,
0.14739906787872314,
-0.010513409972190857,
-0.21220113337039948,
-0.05629822984337807,
-0.30477461218833923,
-0.0011159474961459637,
-0.05512382462620735,
0.47220367193222046,
-0.11994955688714981,
-0.0018578693270683289,
-0.3208262026309967,
0.28465911746025085,
0.0782865360379219,
0.1430097222328186,
0.20520517230033875,
0.08873329311609268,
0.051434654742479324,
-0.2681930661201477,
-0.024144001305103302,
0.19902314245700836,
0.2873644232749939,
0.026908118277788162,
0.11575476080179214,
0.20871874690055847,
-0.12256963551044464,
-0.04852676764130592,
-0.36835548281669617,
0.10468459129333496,
-0.09802457690238953,
-0.14561446011066437,
0.427383154630661,
-0.017468847334384918,
-0.20474036037921906,
0.06899408996105194,
0.1473541110754013,
-0.32371965050697327,
-0.3246999979019165,
-0.07667800039052963,
-0.1038026362657547,
0.06630460172891617,
-0.1572968065738678,
0.05665150284767151,
0.26379579305648804,
-0.4567129611968994,
-0.294929563999176,
-0.3002612292766571,
-0.06693945080041885,
0.42771977186203003,
0.027220770716667175,
0.36088570952415466,
0.03426084294915199,
-0.16829833388328552,
-0.09195056557655334,
0.3646993935108185,
-0.2676112651824951,
0.5217868089675903,
-0.02730764076113701,
-0.3972117006778717,
-0.13561385869979858,
-0.2784285545349121,
0.16924835741519928,
0.21227943897247314,
-0.35400739312171936,
0.010641202330589294,
0.05374879390001297,
-0.12742026150226593,
-0.34628909826278687,
0.4716668426990509,
0.4681006073951721,
-0.135997474193573,
0.17050795257091522,
-0.7704423069953918,
0.39510974287986755,
-0.2586807608604431,
-0.19359123706817627,
-0.023342624306678772,
-0.2719200849533081,
-0.23257140815258026,
0.3815222382545471,
0.08112413436174393,
0.603358268737793,
-0.10631638765335083,
0.11004380136728287,
0.233169287443161,
0.2517562508583069,
0.07678407430648804,
0.01934884488582611,
-0.11554735898971558,
-0.22503337264060974,
0.10444686561822891,
-0.020427921786904335,
-0.028499385342001915,
0.19873663783073425,
0.4217337369918823,
0.06123023107647896,
0.07632381469011307,
-0.2039123773574829,
0.46270322799682617,
-0.14511288702487946,
0.10123436152935028,
0.08265168964862823,
-0.20629040896892548,
-0.14086563885211945,
0.0782320499420166,
-0.07954151928424835,
0.27586984634399414,
0.06769561022520065,
-0.16896496713161469,
0.0029447004199028015,
-0.21685217320919037,
0.09004946053028107,
-0.11801248788833618,
-0.35445651412010193,
0.10298692435026169,
-0.09035851061344147,
-0.1665308028459549,
0.04942493513226509,
0.4377081096172333,
0.04539550095796585,
0.07247445732355118,
0.0026917997747659683,
-0.08924327790737152,
0.3455888628959656,
0.07239270955324173,
-0.36520180106163025,
0.00031020306050777435,
0.12502337992191315,
0.10948873311281204,
-0.41654595732688904,
-0.22296300530433655,
0.024659600108861923,
-0.2354821264743805,
-0.11751893162727356,
-0.1140049397945404,
-0.007531933486461639,
-0.5912172198295593,
-0.5814690589904785,
-0.2086249589920044,
0.15753604471683502,
0.02306024357676506,
0.08655346930027008,
-0.15369205176830292,
0.05449352413415909,
0.4086306393146515,
0.02565624751150608,
-0.29368656873703003,
-0.2414158433675766,
0.10970386862754822,
0.09344354271888733,
-0.1074574664235115,
0.4937066435813904,
-0.15851688385009766,
0.06756765395402908,
-0.23340150713920593,
0.16567587852478027,
0.029134739190340042,
-0.2786063551902771,
0.16518095135688782,
0.22463522851467133,
-0.26103854179382324,
-0.12856870889663696,
0.6697033643722534,
0.09921859204769135,
0.3524077832698822,
0.08559761941432953,
-0.312406450510025,
-0.3024979531764984,
-0.16609551012516022,
0.11887729167938232,
0.3957426846027374,
0.04644900560379028,
0.16528332233428955,
0.14162375032901764,
-0.20599712431430817,
-0.24833804368972778,
0.03338845819234848,
0.11516384035348892,
0.017148833721876144,
0.16088755428791046,
0.17931431531906128,
0.07332082837820053,
0.27795103192329407,
0.15589310228824615,
-0.07447446882724762,
-0.05494268983602524,
-0.1906137764453888,
-0.24372921884059906,
0.1428411304950714,
-0.10141093283891678,
0.20732370018959045,
-0.19023840129375458,
-0.29172855615615845,
0.1587086021900177,
-0.22860848903656006,
0.16304969787597656,
0.26925644278526306,
-0.05843399465084076,
0.5097589492797852,
-0.10746647417545319,
0.2579500079154968,
-0.039613690227270126,
0.3279566168785095,
-0.1831429898738861,
0.09116338938474655,
0.2839568853378296,
-0.10681383311748505,
-0.09509408473968506,
0.08662009239196777,
-0.1387924700975418,
-0.20920053124427795,
-0.23662324249744415,
0.34779849648475647,
-0.0584283322095871,
-0.14881660044193268,
-0.04047288000583649,
0.2657979130744934,
0.16559332609176636,
0.4483643174171448,
-0.06759028136730194,
0.03379952162504196,
0.17001989483833313,
0.20138587057590485,
-0.13736185431480408,
0.06107277795672417,
0.24826215207576752,
0.05782336741685867,
0.12595219910144806,
0.5288023948669434,
0.41630056500434875,
-0.06095472723245621,
-0.12633731961250305,
-0.29106825590133667,
0.14250296354293823,
0.19378288090229034,
0.14872954785823822,
0.3334580361843109,
0.012265283614397049,
-0.05835147574543953,
0.04397090524435043,
0.16079342365264893,
0.15201663970947266,
0.3418108820915222,
0.029278229922056198,
-0.2028435468673706,
0.0008464083075523376,
0.187326580286026,
0.022054679691791534,
-0.6729874610900879,
0.33623626828193665,
0.14519082009792328,
-0.2824924886226654,
0.39878612756729126,
0.02774156630039215,
0.3040842115879059,
-0.22176100313663483,
-0.22265948355197906,
-0.1894536018371582,
0.05150013417005539,
-0.07371125370264053,
-0.23479634523391724,
-0.11696820706129074,
-0.19612449407577515,
-0.30869776010513306,
-0.12007996439933777,
0.04037514328956604,
0.12981095910072327,
0.040961772203445435,
0.06779663264751434,
-0.05713966488838196,
-0.16465327143669128,
0.1864989995956421,
-0.2584419250488281,
0.28581804037094116,
0.031247977167367935,
0.04544086381793022,
-0.08017756044864655,
0.17684990167617798,
0.26354101300239563,
-0.09228657931089401,
-0.05887802317738533,
0.6529517769813538,
-0.07087858021259308,
-0.21274542808532715,
-0.08279645442962646,
0.049259886145591736,
-0.14791744947433472,
-0.1888006031513214,
-0.059249281883239746,
0.5324172377586365,
0.27398306131362915,
0.12942275404930115,
-0.12482216954231262,
0.22676099836826324,
-0.2451615184545517,
0.2631818652153015,
-0.6641117930412292,
0.30682897567749023,
0.24612003564834595,
0.07787442952394485,
-0.1524757593870163,
0.06743215024471283,
-0.17035344243049622,
-0.19334107637405396,
0.40789341926574707,
0.38877272605895996,
0.5386595129966736,
0.09471650421619415,
0.058899588882923126,
-0.29397135972976685,
0.2791743874549866,
-0.28403952717781067,
0.08614014834165573,
-0.05749617516994476,
0.29927903413772583,
-0.7319201827049255,
-0.09876324981451035,
0.2255541980266571,
-0.12115827947854996,
0.12163203954696655,
0.2576981484889984,
0.04177554324269295,
0.11881018429994583,
-0.15572614967823029,
-0.053257010877132416,
0.3186095654964447,
0.08250554651021957,
-0.13044612109661102,
-0.26804155111312866,
-0.13971592485904694,
0.1819896101951599,
0.09783877432346344,
-0.3734225034713745,
-0.044604670256376266,
0.09304548054933548,
0.025538861751556396,
-0.03830336406826973,
-0.2225392758846283,
0.011350523680448532,
0.05099823698401451,
0.22697973251342773,
0.041954874992370605,
0.1949174851179123,
-0.010964816436171532,
0.11669269949197769,
-0.2026652991771698,
-0.08161205053329468,
-0.15529537200927734,
0.05464436858892441,
-0.24560463428497314,
0.5321154594421387,
-0.3866826891899109,
0.5693590044975281,
-0.44075244665145874,
0.17381753027439117,
0.23102377355098724,
-0.4541361629962921,
0.09614069014787674,
-0.09455056488513947,
-0.1327081322669983,
-0.125972718000412,
0.06285480409860611,
0.3869292438030243,
-0.1089814156293869,
0.1471092849969864,
0.14298643171787262,
-0.31179752945899963,
0.34757083654403687,
-0.06038224697113037,
-0.22318020462989807,
-0.09939232468605042,
0.22442936897277832,
0.11835092306137085,
0.32812148332595825,
-0.3093108832836151,
-0.03717947378754616,
0.49520838260650635,
-0.1033606305718422,
0.2260012924671173,
0.1840548813343048,
-0.3150683045387268,
0.056316111236810684,
-0.18133530020713806,
0.14254531264305115,
0.0503486804664135,
0.24225448071956635,
-0.23904773592948914,
-0.4779428243637085
] |
https://github.com/huggingface/datasets/issues/623 | Custom feature types in `load_dataset` from CSV | Hi @lhoestq we've tried out your suggestion but are now running into the following error:
```
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-163-81ffd5ac18c9> in <module>
----> 1 dataset.cast_(emotion_features)
/usr/local/lib/python3.6/dist-packages/datasets/dataset_dict.py in cast_(self, features)
125 self._check_values_type()
126 for dataset in self.values():
--> 127 dataset.cast_(features=features)
128
129 def remove_columns_(self, column_names: Union[str, List[str]]):
/usr/local/lib/python3.6/dist-packages/datasets/fingerprint.py in wrapper(*args, **kwargs)
161 # Call actual function
162
--> 163 out = func(self, *args, **kwargs)
164
165 # Update fingerprint of in-place transforms + update in-place history of transforms
/usr/local/lib/python3.6/dist-packages/datasets/arrow_dataset.py in cast_(self, features)
602 self._info.features = features
603 schema = pa.schema(features.type)
--> 604 self._data = self._data.cast(schema)
605
606 @fingerprint(inplace=True)
/usr/local/lib/python3.6/dist-packages/pyarrow/table.pxi in pyarrow.lib.Table.cast()
ValueError: Target schema's field names are not matching the table's field names: ['text', 'label'], ['label', 'text']
```
Looking at the types in `emotion_features` we see that `label` and `text` appear to be swapped in the Arrow table:
```
emotion_features.type
StructType(struct<label: int64, text: string>)
```
Did we define the `emotion_features` incorrectly? We just followed the instructions from the [docs](https://huggingface.co/docs/datasets/features.html?highlight=features#dataset-features), but perhaps we misunderstood something 😬
| I am trying to load a local file with the `load_dataset` function and I want to predefine the feature types with the `features` argument. However, the types are always the same independent of the value of `features`.
I am working with the local files from the emotion dataset. To get the data you can use the following code:
```Python
from pathlib import Path
import wget
EMOTION_PATH = Path("./data/emotion")
DOWNLOAD_URLS = [
"https://www.dropbox.com/s/1pzkadrvffbqw6o/train.txt?dl=1",
"https://www.dropbox.com/s/2mzialpsgf9k5l3/val.txt?dl=1",
"https://www.dropbox.com/s/ikkqxfdbdec3fuj/test.txt?dl=1",
]
if not Path.is_dir(EMOTION_PATH):
Path.mkdir(EMOTION_PATH)
for url in DOWNLOAD_URLS:
wget.download(url, str(EMOTION_PATH))
```
The first five lines of the train set are:
```
i didnt feel humiliated;sadness
i can go from feeling so hopeless to so damned hopeful just from being around someone who cares and is awake;sadness
im grabbing a minute to post i feel greedy wrong;anger
i am ever feeling nostalgic about the fireplace i will know that it is still on the property;love
i am feeling grouchy;anger
```
Here the code to reproduce the issue:
```Python
from datasets import Features, Value, ClassLabel, load_dataset
class_names = ["sadness", "joy", "love", "anger", "fear", "surprise"]
emotion_features = Features({'text': Value('string'), 'label': ClassLabel(names=class_names)})
file_dict = {'train': EMOTION_PATH/'train.txt'}
dataset = load_dataset('csv', data_files=file_dict, delimiter=';', column_names=['text', 'label'], features=emotion_features)
```
**Observed behaviour:**
```Python
dataset['train'].features
```
```Python
{'text': Value(dtype='string', id=None),
'label': Value(dtype='string', id=None)}
```
**Expected behaviour:**
```Python
dataset['train'].features
```
```Python
{'text': Value(dtype='string', id=None),
'label': ClassLabel(num_classes=6, names=['sadness', 'joy', 'love', 'anger', 'fear', 'surprise'], names_file=None, id=None)}
```
**Things I've tried:**
- deleting the cache
- trying other types such as `int64`
Am I missing anything? Thanks for any pointer in the right direction. | 168 | Custom feature types in `load_dataset` from CSV
I am trying to load a local file with the `load_dataset` function and I want to predefine the feature types with the `features` argument. However, the types are always the same independent of the value of `features`.
I am working with the local files from the emotion dataset. To get the data you can use the following code:
```Python
from pathlib import Path
import wget
EMOTION_PATH = Path("./data/emotion")
DOWNLOAD_URLS = [
"https://www.dropbox.com/s/1pzkadrvffbqw6o/train.txt?dl=1",
"https://www.dropbox.com/s/2mzialpsgf9k5l3/val.txt?dl=1",
"https://www.dropbox.com/s/ikkqxfdbdec3fuj/test.txt?dl=1",
]
if not Path.is_dir(EMOTION_PATH):
Path.mkdir(EMOTION_PATH)
for url in DOWNLOAD_URLS:
wget.download(url, str(EMOTION_PATH))
```
The first five lines of the train set are:
```
i didnt feel humiliated;sadness
i can go from feeling so hopeless to so damned hopeful just from being around someone who cares and is awake;sadness
im grabbing a minute to post i feel greedy wrong;anger
i am ever feeling nostalgic about the fireplace i will know that it is still on the property;love
i am feeling grouchy;anger
```
Here the code to reproduce the issue:
```Python
from datasets import Features, Value, ClassLabel, load_dataset
class_names = ["sadness", "joy", "love", "anger", "fear", "surprise"]
emotion_features = Features({'text': Value('string'), 'label': ClassLabel(names=class_names)})
file_dict = {'train': EMOTION_PATH/'train.txt'}
dataset = load_dataset('csv', data_files=file_dict, delimiter=';', column_names=['text', 'label'], features=emotion_features)
```
**Observed behaviour:**
```Python
dataset['train'].features
```
```Python
{'text': Value(dtype='string', id=None),
'label': Value(dtype='string', id=None)}
```
**Expected behaviour:**
```Python
dataset['train'].features
```
```Python
{'text': Value(dtype='string', id=None),
'label': ClassLabel(num_classes=6, names=['sadness', 'joy', 'love', 'anger', 'fear', 'surprise'], names_file=None, id=None)}
```
**Things I've tried:**
- deleting the cache
- trying other types such as `int64`
Am I missing anything? Thanks for any pointer in the right direction.
Hi @lhoestq we've tried out your suggestion but are now running into the following error:
```
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-163-81ffd5ac18c9> in <module>
----> 1 dataset.cast_(emotion_features)
/usr/local/lib/python3.6/dist-packages/datasets/dataset_dict.py in cast_(self, features)
125 self._check_values_type()
126 for dataset in self.values():
--> 127 dataset.cast_(features=features)
128
129 def remove_columns_(self, column_names: Union[str, List[str]]):
/usr/local/lib/python3.6/dist-packages/datasets/fingerprint.py in wrapper(*args, **kwargs)
161 # Call actual function
162
--> 163 out = func(self, *args, **kwargs)
164
165 # Update fingerprint of in-place transforms + update in-place history of transforms
/usr/local/lib/python3.6/dist-packages/datasets/arrow_dataset.py in cast_(self, features)
602 self._info.features = features
603 schema = pa.schema(features.type)
--> 604 self._data = self._data.cast(schema)
605
606 @fingerprint(inplace=True)
/usr/local/lib/python3.6/dist-packages/pyarrow/table.pxi in pyarrow.lib.Table.cast()
ValueError: Target schema's field names are not matching the table's field names: ['text', 'label'], ['label', 'text']
```
Looking at the types in `emotion_features` we see that `label` and `text` appear to be swapped in the Arrow table:
```
emotion_features.type
StructType(struct<label: int64, text: string>)
```
Did we define the `emotion_features` incorrectly? We just followed the instructions from the [docs](https://huggingface.co/docs/datasets/features.html?highlight=features#dataset-features), but perhaps we misunderstood something 😬
| [
0.08020319044589996,
-0.2782894968986511,
-0.053178947418928146,
0.35092276334762573,
0.31722939014434814,
-0.19431041181087494,
0.5701335072517395,
0.11138424277305603,
0.44612523913383484,
0.025330446660518646,
0.09474451839923859,
0.31617727875709534,
-0.09191003441810608,
0.3901154696941376,
-0.05818796902894974,
0.02672041580080986,
-0.16127455234527588,
0.3348046541213989,
-0.009121887385845184,
-0.34979408979415894,
-0.27132484316825867,
0.17995382845401764,
-0.09304702281951904,
-0.013486474752426147,
-0.30721715092658997,
0.33958908915519714,
0.2221691608428955,
0.14343854784965515,
0.05831192433834076,
-0.37657761573791504,
0.42371055483818054,
0.14869432151317596,
0.3030690848827362,
0.0801391750574112,
-0.0001151108808699064,
0.07688309252262115,
0.029359731823205948,
-0.17400509119033813,
-0.004085496999323368,
-0.3799193501472473,
-0.0387842059135437,
-0.20290648937225342,
0.42470839619636536,
-0.36515292525291443,
-0.23857346177101135,
-0.456402987241745,
-0.2810545265674591,
-0.12927214801311493,
0.28692296147346497,
0.32929107546806335,
0.15120229125022888,
-0.050267722457647324,
-0.2750738859176636,
0.21849468350410461,
0.3587995767593384,
0.675533652305603,
-0.25238850712776184,
0.18702061474323273,
-0.04063430428504944,
-0.11236550658941269,
0.09397374838590622,
-0.10228602588176727,
-0.14386388659477234,
0.3534232974052429,
0.4926105737686157,
0.17106154561042786,
-0.06439170986413956,
-0.13034990429878235,
-0.17332810163497925,
0.2814248204231262,
0.3474106192588806,
0.05629391968250275,
-0.04643578082323074,
-0.32319653034210205,
-0.12386300414800644,
-0.29732847213745117,
0.38241714239120483,
0.08485995978116989,
-0.18184904754161835,
0.16044257581233978,
-0.07894118875265121,
0.4355746805667877,
-0.05815010890364647,
0.3252907991409302,
0.01868792623281479,
-0.07154957950115204,
-0.23921124637126923,
0.10553407669067383,
0.030826978385448456,
-0.2173108011484146,
0.09743644297122955,
-0.34916192293167114,
0.2218388170003891,
0.11720125377178192,
-0.0551007054746151,
0.09958437085151672,
0.0039358437061309814,
-0.060464777052402496,
-0.12108003348112106,
0.03523246571421623,
0.2292756736278534,
0.19328251481056213,
-0.1932465136051178,
0.03171404451131821,
0.27778980135917664,
0.24418304860591888,
0.20021119713783264,
-0.23178315162658691,
0.15273761749267578,
0.10471565276384354,
-0.4232787489891052,
0.01833326183259487,
0.027789399027824402,
-0.30801817774772644,
0.3964598774909973,
0.08695531636476517,
0.5022855997085571,
-0.2398281991481781,
0.057662419974803925,
-0.09801171720027924,
0.04280947893857956,
-0.03219163790345192,
0.1175670325756073,
0.18355709314346313,
-0.026265598833560944,
0.5809870958328247,
-0.06561408936977386,
0.14888787269592285,
-0.32117989659309387,
0.1283436417579651,
-0.05812723934650421,
-0.22264732420444489,
-0.037468601018190384,
-0.04932039976119995,
0.4030340313911438,
0.09410491585731506,
0.24783360958099365,
0.19902630150318146,
-0.023702308535575867,
-0.31866830587387085,
-0.1270064264535904,
-0.09595637023448944,
0.12454555928707123,
0.044335413724184036,
-0.4416731894016266,
0.3375263214111328,
0.24123597145080566,
-0.2255859524011612,
-0.24441105127334595,
0.0952860563993454,
-0.2509177029132843,
-0.23280072212219238,
0.19703692197799683,
0.15558329224586487,
-0.1784612238407135,
-0.02096249908208847,
-0.1068919226527214,
0.09889619052410126,
0.128010556101799,
0.2582724988460541,
0.02637217938899994,
-0.48641693592071533,
-0.38099443912506104,
-0.32497772574424744,
-0.025487009435892105,
0.39543235301971436,
-0.41543903946876526,
-0.20390428602695465,
0.0394425094127655,
-0.046308305114507675,
0.13855910301208496,
0.2530902028083801,
-0.36610090732574463,
0.14516150951385498,
-0.23930533230304718,
0.2845744490623474,
0.5265450477600098,
0.04339839145541191,
-0.21772050857543945,
0.4294430613517761,
0.1565900593996048,
0.32675492763519287,
0.18606749176979065,
0.07426096498966217,
0.07759345322847366,
0.12609170377254486,
0.15949954092502594,
0.4206007122993469,
0.16572034358978271,
0.0673818588256836,
-0.18377676606178284,
-0.15538354218006134,
0.1656046360731125,
-0.003071276471018791,
-0.32881680130958557,
0.30902567505836487,
0.22570013999938965,
-0.5133964419364929,
0.21711164712905884,
-0.1282680630683899,
-0.22640524804592133,
-0.04688984900712967,
0.40307924151420593,
0.5202862620353699,
0.005792484153062105,
-0.01924356073141098,
-0.4824973940849304,
0.22463351488113403,
-0.14934855699539185,
-0.052252352237701416,
-0.006795674562454224,
-0.3252953290939331,
-0.49349355697631836,
-0.05676678568124771,
-0.24717001616954803,
0.1995169073343277,
0.06466422230005264,
0.3136294484138489,
-0.33587250113487244,
0.15885278582572937,
-0.0870927944779396,
0.07098172605037689,
-0.20888769626617432,
-0.25216370820999146,
-0.08015565574169159,
-0.021776655688881874,
0.17207813262939453,
-0.0900508239865303,
0.015792354941368103,
0.07750292867422104,
0.2781899571418762,
0.07674763351678848,
-0.38832810521125793,
0.1277148723602295,
0.2795608937740326,
0.161346897482872,
-0.11299610882997513,
0.21160788834095,
-0.0030284151434898376,
-0.00951404869556427,
-0.027855737134814262,
0.17322678864002228,
0.19356311857700348,
-0.09370467066764832,
-0.029085107147693634,
0.6565466523170471,
0.15393102169036865,
0.24897870421409607,
-0.26784762740135193,
-0.11285305768251419,
0.2808350920677185,
-0.0006698556244373322,
-0.1841067671775818,
-0.06700606644153595,
-0.21463529765605927,
-0.04852097108960152,
0.0014962106943130493,
0.4216480255126953,
-0.3299655318260193,
-0.11577790230512619,
0.47889086604118347,
0.0954587459564209,
0.12916254997253418,
-0.08040373772382736,
-0.01727820187807083,
-0.029092837125062943,
0.016722898930311203,
-0.23705069720745087,
0.4729238748550415,
-0.06108245998620987,
-0.08036521077156067,
-0.008282242342829704,
0.019212326034903526,
-0.22433672845363617,
0.05999976024031639,
-0.13949863612651825,
-0.1910199224948883,
0.29157182574272156,
0.034326471388339996,
-0.15791592001914978,
-0.3376888930797577,
0.24125266075134277,
-0.14660760760307312,
-0.20588712394237518,
-0.6342834234237671,
-0.09906260669231415,
-0.5823048949241638,
0.16830328106880188,
-0.463762104511261,
-0.08222924917936325,
-0.06979547441005707,
0.016335880383849144,
-0.21201938390731812,
0.10337863117456436,
-0.03539653494954109,
0.0900430679321289,
-0.17844770848751068,
0.36256298422813416,
0.06430789828300476,
-0.8123733401298523,
0.22221189737319946,
0.1188192367553711,
-0.44998106360435486,
-0.05817404016852379,
0.17499123513698578,
0.2886112332344055,
0.03556009382009506,
0.028964178636670113,
-0.2870355248451233,
0.008076325990259647,
-0.013293303549289703,
-0.13991805911064148,
0.17074517905712128,
0.5402770638465881,
0.17327070236206055,
0.17569196224212646,
0.13940311968326569,
-0.12606726586818695,
0.39837393164634705,
-0.01311698742210865,
0.05912253260612488,
-0.12502333521842957,
-0.0263376422226429,
0.11143165081739426,
-0.24287070333957672,
-0.6793344616889954,
-0.15019726753234863,
-0.20031385123729706,
0.2844245433807373,
0.21396160125732422,
0.05112592130899429,
0.19712679088115692,
0.36830517649650574,
-0.2396499365568161,
0.15469659864902496,
-0.026357116177678108,
-0.20738594233989716,
-0.07251214981079102,
0.44383475184440613,
-0.17480483651161194,
-0.21861512959003448,
0.009301472455263138,
-0.3093705177307129,
-0.3122234344482422,
0.13407231867313385,
-0.3119173049926758,
0.06121731922030449,
-0.3492913842201233,
0.5237390398979187,
0.05411292612552643,
0.024073880165815353,
0.10822631418704987,
-0.1130082979798317,
0.03962411731481552,
-0.17586392164230347,
-0.3381883203983307,
0.452170729637146,
0.3127177059650421,
0.09914903342723846,
0.42452624440193176,
-0.025254566222429276,
-0.41299712657928467,
0.49855363368988037,
-0.28556209802627563,
-0.1919134110212326,
0.5953596830368042,
-0.18008989095687866,
0.17871904373168945,
-0.07286901026964188,
-0.2670246362686157,
-0.11260268092155457,
-0.04256470501422882,
-0.11165682971477509,
0.22369107604026794,
-0.008556760847568512,
-0.27002429962158203,
-0.18102994561195374,
0.212380513548851,
-0.21761766076087952,
-0.260853111743927,
0.2379056215286255,
0.14739906787872314,
-0.010513409972190857,
-0.21220113337039948,
-0.05629822984337807,
-0.30477461218833923,
-0.0011159474961459637,
-0.05512382462620735,
0.47220367193222046,
-0.11994955688714981,
-0.0018578693270683289,
-0.3208262026309967,
0.28465911746025085,
0.0782865360379219,
0.1430097222328186,
0.20520517230033875,
0.08873329311609268,
0.051434654742479324,
-0.2681930661201477,
-0.024144001305103302,
0.19902314245700836,
0.2873644232749939,
0.026908118277788162,
0.11575476080179214,
0.20871874690055847,
-0.12256963551044464,
-0.04852676764130592,
-0.36835548281669617,
0.10468459129333496,
-0.09802457690238953,
-0.14561446011066437,
0.427383154630661,
-0.017468847334384918,
-0.20474036037921906,
0.06899408996105194,
0.1473541110754013,
-0.32371965050697327,
-0.3246999979019165,
-0.07667800039052963,
-0.1038026362657547,
0.06630460172891617,
-0.1572968065738678,
0.05665150284767151,
0.26379579305648804,
-0.4567129611968994,
-0.294929563999176,
-0.3002612292766571,
-0.06693945080041885,
0.42771977186203003,
0.027220770716667175,
0.36088570952415466,
0.03426084294915199,
-0.16829833388328552,
-0.09195056557655334,
0.3646993935108185,
-0.2676112651824951,
0.5217868089675903,
-0.02730764076113701,
-0.3972117006778717,
-0.13561385869979858,
-0.2784285545349121,
0.16924835741519928,
0.21227943897247314,
-0.35400739312171936,
0.010641202330589294,
0.05374879390001297,
-0.12742026150226593,
-0.34628909826278687,
0.4716668426990509,
0.4681006073951721,
-0.135997474193573,
0.17050795257091522,
-0.7704423069953918,
0.39510974287986755,
-0.2586807608604431,
-0.19359123706817627,
-0.023342624306678772,
-0.2719200849533081,
-0.23257140815258026,
0.3815222382545471,
0.08112413436174393,
0.603358268737793,
-0.10631638765335083,
0.11004380136728287,
0.233169287443161,
0.2517562508583069,
0.07678407430648804,
0.01934884488582611,
-0.11554735898971558,
-0.22503337264060974,
0.10444686561822891,
-0.020427921786904335,
-0.028499385342001915,
0.19873663783073425,
0.4217337369918823,
0.06123023107647896,
0.07632381469011307,
-0.2039123773574829,
0.46270322799682617,
-0.14511288702487946,
0.10123436152935028,
0.08265168964862823,
-0.20629040896892548,
-0.14086563885211945,
0.0782320499420166,
-0.07954151928424835,
0.27586984634399414,
0.06769561022520065,
-0.16896496713161469,
0.0029447004199028015,
-0.21685217320919037,
0.09004946053028107,
-0.11801248788833618,
-0.35445651412010193,
0.10298692435026169,
-0.09035851061344147,
-0.1665308028459549,
0.04942493513226509,
0.4377081096172333,
0.04539550095796585,
0.07247445732355118,
0.0026917997747659683,
-0.08924327790737152,
0.3455888628959656,
0.07239270955324173,
-0.36520180106163025,
0.00031020306050777435,
0.12502337992191315,
0.10948873311281204,
-0.41654595732688904,
-0.22296300530433655,
0.024659600108861923,
-0.2354821264743805,
-0.11751893162727356,
-0.1140049397945404,
-0.007531933486461639,
-0.5912172198295593,
-0.5814690589904785,
-0.2086249589920044,
0.15753604471683502,
0.02306024357676506,
0.08655346930027008,
-0.15369205176830292,
0.05449352413415909,
0.4086306393146515,
0.02565624751150608,
-0.29368656873703003,
-0.2414158433675766,
0.10970386862754822,
0.09344354271888733,
-0.1074574664235115,
0.4937066435813904,
-0.15851688385009766,
0.06756765395402908,
-0.23340150713920593,
0.16567587852478027,
0.029134739190340042,
-0.2786063551902771,
0.16518095135688782,
0.22463522851467133,
-0.26103854179382324,
-0.12856870889663696,
0.6697033643722534,
0.09921859204769135,
0.3524077832698822,
0.08559761941432953,
-0.312406450510025,
-0.3024979531764984,
-0.16609551012516022,
0.11887729167938232,
0.3957426846027374,
0.04644900560379028,
0.16528332233428955,
0.14162375032901764,
-0.20599712431430817,
-0.24833804368972778,
0.03338845819234848,
0.11516384035348892,
0.017148833721876144,
0.16088755428791046,
0.17931431531906128,
0.07332082837820053,
0.27795103192329407,
0.15589310228824615,
-0.07447446882724762,
-0.05494268983602524,
-0.1906137764453888,
-0.24372921884059906,
0.1428411304950714,
-0.10141093283891678,
0.20732370018959045,
-0.19023840129375458,
-0.29172855615615845,
0.1587086021900177,
-0.22860848903656006,
0.16304969787597656,
0.26925644278526306,
-0.05843399465084076,
0.5097589492797852,
-0.10746647417545319,
0.2579500079154968,
-0.039613690227270126,
0.3279566168785095,
-0.1831429898738861,
0.09116338938474655,
0.2839568853378296,
-0.10681383311748505,
-0.09509408473968506,
0.08662009239196777,
-0.1387924700975418,
-0.20920053124427795,
-0.23662324249744415,
0.34779849648475647,
-0.0584283322095871,
-0.14881660044193268,
-0.04047288000583649,
0.2657979130744934,
0.16559332609176636,
0.4483643174171448,
-0.06759028136730194,
0.03379952162504196,
0.17001989483833313,
0.20138587057590485,
-0.13736185431480408,
0.06107277795672417,
0.24826215207576752,
0.05782336741685867,
0.12595219910144806,
0.5288023948669434,
0.41630056500434875,
-0.06095472723245621,
-0.12633731961250305,
-0.29106825590133667,
0.14250296354293823,
0.19378288090229034,
0.14872954785823822,
0.3334580361843109,
0.012265283614397049,
-0.05835147574543953,
0.04397090524435043,
0.16079342365264893,
0.15201663970947266,
0.3418108820915222,
0.029278229922056198,
-0.2028435468673706,
0.0008464083075523376,
0.187326580286026,
0.022054679691791534,
-0.6729874610900879,
0.33623626828193665,
0.14519082009792328,
-0.2824924886226654,
0.39878612756729126,
0.02774156630039215,
0.3040842115879059,
-0.22176100313663483,
-0.22265948355197906,
-0.1894536018371582,
0.05150013417005539,
-0.07371125370264053,
-0.23479634523391724,
-0.11696820706129074,
-0.19612449407577515,
-0.30869776010513306,
-0.12007996439933777,
0.04037514328956604,
0.12981095910072327,
0.040961772203445435,
0.06779663264751434,
-0.05713966488838196,
-0.16465327143669128,
0.1864989995956421,
-0.2584419250488281,
0.28581804037094116,
0.031247977167367935,
0.04544086381793022,
-0.08017756044864655,
0.17684990167617798,
0.26354101300239563,
-0.09228657931089401,
-0.05887802317738533,
0.6529517769813538,
-0.07087858021259308,
-0.21274542808532715,
-0.08279645442962646,
0.049259886145591736,
-0.14791744947433472,
-0.1888006031513214,
-0.059249281883239746,
0.5324172377586365,
0.27398306131362915,
0.12942275404930115,
-0.12482216954231262,
0.22676099836826324,
-0.2451615184545517,
0.2631818652153015,
-0.6641117930412292,
0.30682897567749023,
0.24612003564834595,
0.07787442952394485,
-0.1524757593870163,
0.06743215024471283,
-0.17035344243049622,
-0.19334107637405396,
0.40789341926574707,
0.38877272605895996,
0.5386595129966736,
0.09471650421619415,
0.058899588882923126,
-0.29397135972976685,
0.2791743874549866,
-0.28403952717781067,
0.08614014834165573,
-0.05749617516994476,
0.29927903413772583,
-0.7319201827049255,
-0.09876324981451035,
0.2255541980266571,
-0.12115827947854996,
0.12163203954696655,
0.2576981484889984,
0.04177554324269295,
0.11881018429994583,
-0.15572614967823029,
-0.053257010877132416,
0.3186095654964447,
0.08250554651021957,
-0.13044612109661102,
-0.26804155111312866,
-0.13971592485904694,
0.1819896101951599,
0.09783877432346344,
-0.3734225034713745,
-0.044604670256376266,
0.09304548054933548,
0.025538861751556396,
-0.03830336406826973,
-0.2225392758846283,
0.011350523680448532,
0.05099823698401451,
0.22697973251342773,
0.041954874992370605,
0.1949174851179123,
-0.010964816436171532,
0.11669269949197769,
-0.2026652991771698,
-0.08161205053329468,
-0.15529537200927734,
0.05464436858892441,
-0.24560463428497314,
0.5321154594421387,
-0.3866826891899109,
0.5693590044975281,
-0.44075244665145874,
0.17381753027439117,
0.23102377355098724,
-0.4541361629962921,
0.09614069014787674,
-0.09455056488513947,
-0.1327081322669983,
-0.125972718000412,
0.06285480409860611,
0.3869292438030243,
-0.1089814156293869,
0.1471092849969864,
0.14298643171787262,
-0.31179752945899963,
0.34757083654403687,
-0.06038224697113037,
-0.22318020462989807,
-0.09939232468605042,
0.22442936897277832,
0.11835092306137085,
0.32812148332595825,
-0.3093108832836151,
-0.03717947378754616,
0.49520838260650635,
-0.1033606305718422,
0.2260012924671173,
0.1840548813343048,
-0.3150683045387268,
0.056316111236810684,
-0.18133530020713806,
0.14254531264305115,
0.0503486804664135,
0.24225448071956635,
-0.23904773592948914,
-0.4779428243637085
] |
https://github.com/huggingface/datasets/issues/623 | Custom feature types in `load_dataset` from CSV | In general, I don't think there is any hard reason we don't allow to use `features` in the csv script, right @lhoestq?
Should I add it? | I am trying to load a local file with the `load_dataset` function and I want to predefine the feature types with the `features` argument. However, the types are always the same independent of the value of `features`.
I am working with the local files from the emotion dataset. To get the data you can use the following code:
```Python
from pathlib import Path
import wget
EMOTION_PATH = Path("./data/emotion")
DOWNLOAD_URLS = [
"https://www.dropbox.com/s/1pzkadrvffbqw6o/train.txt?dl=1",
"https://www.dropbox.com/s/2mzialpsgf9k5l3/val.txt?dl=1",
"https://www.dropbox.com/s/ikkqxfdbdec3fuj/test.txt?dl=1",
]
if not Path.is_dir(EMOTION_PATH):
Path.mkdir(EMOTION_PATH)
for url in DOWNLOAD_URLS:
wget.download(url, str(EMOTION_PATH))
```
The first five lines of the train set are:
```
i didnt feel humiliated;sadness
i can go from feeling so hopeless to so damned hopeful just from being around someone who cares and is awake;sadness
im grabbing a minute to post i feel greedy wrong;anger
i am ever feeling nostalgic about the fireplace i will know that it is still on the property;love
i am feeling grouchy;anger
```
Here the code to reproduce the issue:
```Python
from datasets import Features, Value, ClassLabel, load_dataset
class_names = ["sadness", "joy", "love", "anger", "fear", "surprise"]
emotion_features = Features({'text': Value('string'), 'label': ClassLabel(names=class_names)})
file_dict = {'train': EMOTION_PATH/'train.txt'}
dataset = load_dataset('csv', data_files=file_dict, delimiter=';', column_names=['text', 'label'], features=emotion_features)
```
**Observed behaviour:**
```Python
dataset['train'].features
```
```Python
{'text': Value(dtype='string', id=None),
'label': Value(dtype='string', id=None)}
```
**Expected behaviour:**
```Python
dataset['train'].features
```
```Python
{'text': Value(dtype='string', id=None),
'label': ClassLabel(num_classes=6, names=['sadness', 'joy', 'love', 'anger', 'fear', 'surprise'], names_file=None, id=None)}
```
**Things I've tried:**
- deleting the cache
- trying other types such as `int64`
Am I missing anything? Thanks for any pointer in the right direction. | 26 | Custom feature types in `load_dataset` from CSV
I am trying to load a local file with the `load_dataset` function and I want to predefine the feature types with the `features` argument. However, the types are always the same independent of the value of `features`.
I am working with the local files from the emotion dataset. To get the data you can use the following code:
```Python
from pathlib import Path
import wget
EMOTION_PATH = Path("./data/emotion")
DOWNLOAD_URLS = [
"https://www.dropbox.com/s/1pzkadrvffbqw6o/train.txt?dl=1",
"https://www.dropbox.com/s/2mzialpsgf9k5l3/val.txt?dl=1",
"https://www.dropbox.com/s/ikkqxfdbdec3fuj/test.txt?dl=1",
]
if not Path.is_dir(EMOTION_PATH):
Path.mkdir(EMOTION_PATH)
for url in DOWNLOAD_URLS:
wget.download(url, str(EMOTION_PATH))
```
The first five lines of the train set are:
```
i didnt feel humiliated;sadness
i can go from feeling so hopeless to so damned hopeful just from being around someone who cares and is awake;sadness
im grabbing a minute to post i feel greedy wrong;anger
i am ever feeling nostalgic about the fireplace i will know that it is still on the property;love
i am feeling grouchy;anger
```
Here the code to reproduce the issue:
```Python
from datasets import Features, Value, ClassLabel, load_dataset
class_names = ["sadness", "joy", "love", "anger", "fear", "surprise"]
emotion_features = Features({'text': Value('string'), 'label': ClassLabel(names=class_names)})
file_dict = {'train': EMOTION_PATH/'train.txt'}
dataset = load_dataset('csv', data_files=file_dict, delimiter=';', column_names=['text', 'label'], features=emotion_features)
```
**Observed behaviour:**
```Python
dataset['train'].features
```
```Python
{'text': Value(dtype='string', id=None),
'label': Value(dtype='string', id=None)}
```
**Expected behaviour:**
```Python
dataset['train'].features
```
```Python
{'text': Value(dtype='string', id=None),
'label': ClassLabel(num_classes=6, names=['sadness', 'joy', 'love', 'anger', 'fear', 'surprise'], names_file=None, id=None)}
```
**Things I've tried:**
- deleting the cache
- trying other types such as `int64`
Am I missing anything? Thanks for any pointer in the right direction.
In general, I don't think there is any hard reason we don't allow to use `features` in the csv script, right @lhoestq?
Should I add it? | [
0.08020319044589996,
-0.2782894968986511,
-0.053178947418928146,
0.35092276334762573,
0.31722939014434814,
-0.19431041181087494,
0.5701335072517395,
0.11138424277305603,
0.44612523913383484,
0.025330446660518646,
0.09474451839923859,
0.31617727875709534,
-0.09191003441810608,
0.3901154696941376,
-0.05818796902894974,
0.02672041580080986,
-0.16127455234527588,
0.3348046541213989,
-0.009121887385845184,
-0.34979408979415894,
-0.27132484316825867,
0.17995382845401764,
-0.09304702281951904,
-0.013486474752426147,
-0.30721715092658997,
0.33958908915519714,
0.2221691608428955,
0.14343854784965515,
0.05831192433834076,
-0.37657761573791504,
0.42371055483818054,
0.14869432151317596,
0.3030690848827362,
0.0801391750574112,
-0.0001151108808699064,
0.07688309252262115,
0.029359731823205948,
-0.17400509119033813,
-0.004085496999323368,
-0.3799193501472473,
-0.0387842059135437,
-0.20290648937225342,
0.42470839619636536,
-0.36515292525291443,
-0.23857346177101135,
-0.456402987241745,
-0.2810545265674591,
-0.12927214801311493,
0.28692296147346497,
0.32929107546806335,
0.15120229125022888,
-0.050267722457647324,
-0.2750738859176636,
0.21849468350410461,
0.3587995767593384,
0.675533652305603,
-0.25238850712776184,
0.18702061474323273,
-0.04063430428504944,
-0.11236550658941269,
0.09397374838590622,
-0.10228602588176727,
-0.14386388659477234,
0.3534232974052429,
0.4926105737686157,
0.17106154561042786,
-0.06439170986413956,
-0.13034990429878235,
-0.17332810163497925,
0.2814248204231262,
0.3474106192588806,
0.05629391968250275,
-0.04643578082323074,
-0.32319653034210205,
-0.12386300414800644,
-0.29732847213745117,
0.38241714239120483,
0.08485995978116989,
-0.18184904754161835,
0.16044257581233978,
-0.07894118875265121,
0.4355746805667877,
-0.05815010890364647,
0.3252907991409302,
0.01868792623281479,
-0.07154957950115204,
-0.23921124637126923,
0.10553407669067383,
0.030826978385448456,
-0.2173108011484146,
0.09743644297122955,
-0.34916192293167114,
0.2218388170003891,
0.11720125377178192,
-0.0551007054746151,
0.09958437085151672,
0.0039358437061309814,
-0.060464777052402496,
-0.12108003348112106,
0.03523246571421623,
0.2292756736278534,
0.19328251481056213,
-0.1932465136051178,
0.03171404451131821,
0.27778980135917664,
0.24418304860591888,
0.20021119713783264,
-0.23178315162658691,
0.15273761749267578,
0.10471565276384354,
-0.4232787489891052,
0.01833326183259487,
0.027789399027824402,
-0.30801817774772644,
0.3964598774909973,
0.08695531636476517,
0.5022855997085571,
-0.2398281991481781,
0.057662419974803925,
-0.09801171720027924,
0.04280947893857956,
-0.03219163790345192,
0.1175670325756073,
0.18355709314346313,
-0.026265598833560944,
0.5809870958328247,
-0.06561408936977386,
0.14888787269592285,
-0.32117989659309387,
0.1283436417579651,
-0.05812723934650421,
-0.22264732420444489,
-0.037468601018190384,
-0.04932039976119995,
0.4030340313911438,
0.09410491585731506,
0.24783360958099365,
0.19902630150318146,
-0.023702308535575867,
-0.31866830587387085,
-0.1270064264535904,
-0.09595637023448944,
0.12454555928707123,
0.044335413724184036,
-0.4416731894016266,
0.3375263214111328,
0.24123597145080566,
-0.2255859524011612,
-0.24441105127334595,
0.0952860563993454,
-0.2509177029132843,
-0.23280072212219238,
0.19703692197799683,
0.15558329224586487,
-0.1784612238407135,
-0.02096249908208847,
-0.1068919226527214,
0.09889619052410126,
0.128010556101799,
0.2582724988460541,
0.02637217938899994,
-0.48641693592071533,
-0.38099443912506104,
-0.32497772574424744,
-0.025487009435892105,
0.39543235301971436,
-0.41543903946876526,
-0.20390428602695465,
0.0394425094127655,
-0.046308305114507675,
0.13855910301208496,
0.2530902028083801,
-0.36610090732574463,
0.14516150951385498,
-0.23930533230304718,
0.2845744490623474,
0.5265450477600098,
0.04339839145541191,
-0.21772050857543945,
0.4294430613517761,
0.1565900593996048,
0.32675492763519287,
0.18606749176979065,
0.07426096498966217,
0.07759345322847366,
0.12609170377254486,
0.15949954092502594,
0.4206007122993469,
0.16572034358978271,
0.0673818588256836,
-0.18377676606178284,
-0.15538354218006134,
0.1656046360731125,
-0.003071276471018791,
-0.32881680130958557,
0.30902567505836487,
0.22570013999938965,
-0.5133964419364929,
0.21711164712905884,
-0.1282680630683899,
-0.22640524804592133,
-0.04688984900712967,
0.40307924151420593,
0.5202862620353699,
0.005792484153062105,
-0.01924356073141098,
-0.4824973940849304,
0.22463351488113403,
-0.14934855699539185,
-0.052252352237701416,
-0.006795674562454224,
-0.3252953290939331,
-0.49349355697631836,
-0.05676678568124771,
-0.24717001616954803,
0.1995169073343277,
0.06466422230005264,
0.3136294484138489,
-0.33587250113487244,
0.15885278582572937,
-0.0870927944779396,
0.07098172605037689,
-0.20888769626617432,
-0.25216370820999146,
-0.08015565574169159,
-0.021776655688881874,
0.17207813262939453,
-0.0900508239865303,
0.015792354941368103,
0.07750292867422104,
0.2781899571418762,
0.07674763351678848,
-0.38832810521125793,
0.1277148723602295,
0.2795608937740326,
0.161346897482872,
-0.11299610882997513,
0.21160788834095,
-0.0030284151434898376,
-0.00951404869556427,
-0.027855737134814262,
0.17322678864002228,
0.19356311857700348,
-0.09370467066764832,
-0.029085107147693634,
0.6565466523170471,
0.15393102169036865,
0.24897870421409607,
-0.26784762740135193,
-0.11285305768251419,
0.2808350920677185,
-0.0006698556244373322,
-0.1841067671775818,
-0.06700606644153595,
-0.21463529765605927,
-0.04852097108960152,
0.0014962106943130493,
0.4216480255126953,
-0.3299655318260193,
-0.11577790230512619,
0.47889086604118347,
0.0954587459564209,
0.12916254997253418,
-0.08040373772382736,
-0.01727820187807083,
-0.029092837125062943,
0.016722898930311203,
-0.23705069720745087,
0.4729238748550415,
-0.06108245998620987,
-0.08036521077156067,
-0.008282242342829704,
0.019212326034903526,
-0.22433672845363617,
0.05999976024031639,
-0.13949863612651825,
-0.1910199224948883,
0.29157182574272156,
0.034326471388339996,
-0.15791592001914978,
-0.3376888930797577,
0.24125266075134277,
-0.14660760760307312,
-0.20588712394237518,
-0.6342834234237671,
-0.09906260669231415,
-0.5823048949241638,
0.16830328106880188,
-0.463762104511261,
-0.08222924917936325,
-0.06979547441005707,
0.016335880383849144,
-0.21201938390731812,
0.10337863117456436,
-0.03539653494954109,
0.0900430679321289,
-0.17844770848751068,
0.36256298422813416,
0.06430789828300476,
-0.8123733401298523,
0.22221189737319946,
0.1188192367553711,
-0.44998106360435486,
-0.05817404016852379,
0.17499123513698578,
0.2886112332344055,
0.03556009382009506,
0.028964178636670113,
-0.2870355248451233,
0.008076325990259647,
-0.013293303549289703,
-0.13991805911064148,
0.17074517905712128,
0.5402770638465881,
0.17327070236206055,
0.17569196224212646,
0.13940311968326569,
-0.12606726586818695,
0.39837393164634705,
-0.01311698742210865,
0.05912253260612488,
-0.12502333521842957,
-0.0263376422226429,
0.11143165081739426,
-0.24287070333957672,
-0.6793344616889954,
-0.15019726753234863,
-0.20031385123729706,
0.2844245433807373,
0.21396160125732422,
0.05112592130899429,
0.19712679088115692,
0.36830517649650574,
-0.2396499365568161,
0.15469659864902496,
-0.026357116177678108,
-0.20738594233989716,
-0.07251214981079102,
0.44383475184440613,
-0.17480483651161194,
-0.21861512959003448,
0.009301472455263138,
-0.3093705177307129,
-0.3122234344482422,
0.13407231867313385,
-0.3119173049926758,
0.06121731922030449,
-0.3492913842201233,
0.5237390398979187,
0.05411292612552643,
0.024073880165815353,
0.10822631418704987,
-0.1130082979798317,
0.03962411731481552,
-0.17586392164230347,
-0.3381883203983307,
0.452170729637146,
0.3127177059650421,
0.09914903342723846,
0.42452624440193176,
-0.025254566222429276,
-0.41299712657928467,
0.49855363368988037,
-0.28556209802627563,
-0.1919134110212326,
0.5953596830368042,
-0.18008989095687866,
0.17871904373168945,
-0.07286901026964188,
-0.2670246362686157,
-0.11260268092155457,
-0.04256470501422882,
-0.11165682971477509,
0.22369107604026794,
-0.008556760847568512,
-0.27002429962158203,
-0.18102994561195374,
0.212380513548851,
-0.21761766076087952,
-0.260853111743927,
0.2379056215286255,
0.14739906787872314,
-0.010513409972190857,
-0.21220113337039948,
-0.05629822984337807,
-0.30477461218833923,
-0.0011159474961459637,
-0.05512382462620735,
0.47220367193222046,
-0.11994955688714981,
-0.0018578693270683289,
-0.3208262026309967,
0.28465911746025085,
0.0782865360379219,
0.1430097222328186,
0.20520517230033875,
0.08873329311609268,
0.051434654742479324,
-0.2681930661201477,
-0.024144001305103302,
0.19902314245700836,
0.2873644232749939,
0.026908118277788162,
0.11575476080179214,
0.20871874690055847,
-0.12256963551044464,
-0.04852676764130592,
-0.36835548281669617,
0.10468459129333496,
-0.09802457690238953,
-0.14561446011066437,
0.427383154630661,
-0.017468847334384918,
-0.20474036037921906,
0.06899408996105194,
0.1473541110754013,
-0.32371965050697327,
-0.3246999979019165,
-0.07667800039052963,
-0.1038026362657547,
0.06630460172891617,
-0.1572968065738678,
0.05665150284767151,
0.26379579305648804,
-0.4567129611968994,
-0.294929563999176,
-0.3002612292766571,
-0.06693945080041885,
0.42771977186203003,
0.027220770716667175,
0.36088570952415466,
0.03426084294915199,
-0.16829833388328552,
-0.09195056557655334,
0.3646993935108185,
-0.2676112651824951,
0.5217868089675903,
-0.02730764076113701,
-0.3972117006778717,
-0.13561385869979858,
-0.2784285545349121,
0.16924835741519928,
0.21227943897247314,
-0.35400739312171936,
0.010641202330589294,
0.05374879390001297,
-0.12742026150226593,
-0.34628909826278687,
0.4716668426990509,
0.4681006073951721,
-0.135997474193573,
0.17050795257091522,
-0.7704423069953918,
0.39510974287986755,
-0.2586807608604431,
-0.19359123706817627,
-0.023342624306678772,
-0.2719200849533081,
-0.23257140815258026,
0.3815222382545471,
0.08112413436174393,
0.603358268737793,
-0.10631638765335083,
0.11004380136728287,
0.233169287443161,
0.2517562508583069,
0.07678407430648804,
0.01934884488582611,
-0.11554735898971558,
-0.22503337264060974,
0.10444686561822891,
-0.020427921786904335,
-0.028499385342001915,
0.19873663783073425,
0.4217337369918823,
0.06123023107647896,
0.07632381469011307,
-0.2039123773574829,
0.46270322799682617,
-0.14511288702487946,
0.10123436152935028,
0.08265168964862823,
-0.20629040896892548,
-0.14086563885211945,
0.0782320499420166,
-0.07954151928424835,
0.27586984634399414,
0.06769561022520065,
-0.16896496713161469,
0.0029447004199028015,
-0.21685217320919037,
0.09004946053028107,
-0.11801248788833618,
-0.35445651412010193,
0.10298692435026169,
-0.09035851061344147,
-0.1665308028459549,
0.04942493513226509,
0.4377081096172333,
0.04539550095796585,
0.07247445732355118,
0.0026917997747659683,
-0.08924327790737152,
0.3455888628959656,
0.07239270955324173,
-0.36520180106163025,
0.00031020306050777435,
0.12502337992191315,
0.10948873311281204,
-0.41654595732688904,
-0.22296300530433655,
0.024659600108861923,
-0.2354821264743805,
-0.11751893162727356,
-0.1140049397945404,
-0.007531933486461639,
-0.5912172198295593,
-0.5814690589904785,
-0.2086249589920044,
0.15753604471683502,
0.02306024357676506,
0.08655346930027008,
-0.15369205176830292,
0.05449352413415909,
0.4086306393146515,
0.02565624751150608,
-0.29368656873703003,
-0.2414158433675766,
0.10970386862754822,
0.09344354271888733,
-0.1074574664235115,
0.4937066435813904,
-0.15851688385009766,
0.06756765395402908,
-0.23340150713920593,
0.16567587852478027,
0.029134739190340042,
-0.2786063551902771,
0.16518095135688782,
0.22463522851467133,
-0.26103854179382324,
-0.12856870889663696,
0.6697033643722534,
0.09921859204769135,
0.3524077832698822,
0.08559761941432953,
-0.312406450510025,
-0.3024979531764984,
-0.16609551012516022,
0.11887729167938232,
0.3957426846027374,
0.04644900560379028,
0.16528332233428955,
0.14162375032901764,
-0.20599712431430817,
-0.24833804368972778,
0.03338845819234848,
0.11516384035348892,
0.017148833721876144,
0.16088755428791046,
0.17931431531906128,
0.07332082837820053,
0.27795103192329407,
0.15589310228824615,
-0.07447446882724762,
-0.05494268983602524,
-0.1906137764453888,
-0.24372921884059906,
0.1428411304950714,
-0.10141093283891678,
0.20732370018959045,
-0.19023840129375458,
-0.29172855615615845,
0.1587086021900177,
-0.22860848903656006,
0.16304969787597656,
0.26925644278526306,
-0.05843399465084076,
0.5097589492797852,
-0.10746647417545319,
0.2579500079154968,
-0.039613690227270126,
0.3279566168785095,
-0.1831429898738861,
0.09116338938474655,
0.2839568853378296,
-0.10681383311748505,
-0.09509408473968506,
0.08662009239196777,
-0.1387924700975418,
-0.20920053124427795,
-0.23662324249744415,
0.34779849648475647,
-0.0584283322095871,
-0.14881660044193268,
-0.04047288000583649,
0.2657979130744934,
0.16559332609176636,
0.4483643174171448,
-0.06759028136730194,
0.03379952162504196,
0.17001989483833313,
0.20138587057590485,
-0.13736185431480408,
0.06107277795672417,
0.24826215207576752,
0.05782336741685867,
0.12595219910144806,
0.5288023948669434,
0.41630056500434875,
-0.06095472723245621,
-0.12633731961250305,
-0.29106825590133667,
0.14250296354293823,
0.19378288090229034,
0.14872954785823822,
0.3334580361843109,
0.012265283614397049,
-0.05835147574543953,
0.04397090524435043,
0.16079342365264893,
0.15201663970947266,
0.3418108820915222,
0.029278229922056198,
-0.2028435468673706,
0.0008464083075523376,
0.187326580286026,
0.022054679691791534,
-0.6729874610900879,
0.33623626828193665,
0.14519082009792328,
-0.2824924886226654,
0.39878612756729126,
0.02774156630039215,
0.3040842115879059,
-0.22176100313663483,
-0.22265948355197906,
-0.1894536018371582,
0.05150013417005539,
-0.07371125370264053,
-0.23479634523391724,
-0.11696820706129074,
-0.19612449407577515,
-0.30869776010513306,
-0.12007996439933777,
0.04037514328956604,
0.12981095910072327,
0.040961772203445435,
0.06779663264751434,
-0.05713966488838196,
-0.16465327143669128,
0.1864989995956421,
-0.2584419250488281,
0.28581804037094116,
0.031247977167367935,
0.04544086381793022,
-0.08017756044864655,
0.17684990167617798,
0.26354101300239563,
-0.09228657931089401,
-0.05887802317738533,
0.6529517769813538,
-0.07087858021259308,
-0.21274542808532715,
-0.08279645442962646,
0.049259886145591736,
-0.14791744947433472,
-0.1888006031513214,
-0.059249281883239746,
0.5324172377586365,
0.27398306131362915,
0.12942275404930115,
-0.12482216954231262,
0.22676099836826324,
-0.2451615184545517,
0.2631818652153015,
-0.6641117930412292,
0.30682897567749023,
0.24612003564834595,
0.07787442952394485,
-0.1524757593870163,
0.06743215024471283,
-0.17035344243049622,
-0.19334107637405396,
0.40789341926574707,
0.38877272605895996,
0.5386595129966736,
0.09471650421619415,
0.058899588882923126,
-0.29397135972976685,
0.2791743874549866,
-0.28403952717781067,
0.08614014834165573,
-0.05749617516994476,
0.29927903413772583,
-0.7319201827049255,
-0.09876324981451035,
0.2255541980266571,
-0.12115827947854996,
0.12163203954696655,
0.2576981484889984,
0.04177554324269295,
0.11881018429994583,
-0.15572614967823029,
-0.053257010877132416,
0.3186095654964447,
0.08250554651021957,
-0.13044612109661102,
-0.26804155111312866,
-0.13971592485904694,
0.1819896101951599,
0.09783877432346344,
-0.3734225034713745,
-0.044604670256376266,
0.09304548054933548,
0.025538861751556396,
-0.03830336406826973,
-0.2225392758846283,
0.011350523680448532,
0.05099823698401451,
0.22697973251342773,
0.041954874992370605,
0.1949174851179123,
-0.010964816436171532,
0.11669269949197769,
-0.2026652991771698,
-0.08161205053329468,
-0.15529537200927734,
0.05464436858892441,
-0.24560463428497314,
0.5321154594421387,
-0.3866826891899109,
0.5693590044975281,
-0.44075244665145874,
0.17381753027439117,
0.23102377355098724,
-0.4541361629962921,
0.09614069014787674,
-0.09455056488513947,
-0.1327081322669983,
-0.125972718000412,
0.06285480409860611,
0.3869292438030243,
-0.1089814156293869,
0.1471092849969864,
0.14298643171787262,
-0.31179752945899963,
0.34757083654403687,
-0.06038224697113037,
-0.22318020462989807,
-0.09939232468605042,
0.22442936897277832,
0.11835092306137085,
0.32812148332595825,
-0.3093108832836151,
-0.03717947378754616,
0.49520838260650635,
-0.1033606305718422,
0.2260012924671173,
0.1840548813343048,
-0.3150683045387268,
0.056316111236810684,
-0.18133530020713806,
0.14254531264305115,
0.0503486804664135,
0.24225448071956635,
-0.23904773592948914,
-0.4779428243637085
] |
https://github.com/huggingface/datasets/issues/623 | Custom feature types in `load_dataset` from CSV | > In general, I don't think there is any hard reason we don't allow to use `features` in the csv script, right @lhoestq?
>
> Should I add it?
Sure let's add it. Setting the convert options should do the job
> Hi @lhoestq we've tried out your suggestion but are now running into the following error:
>
> ```
> ---------------------------------------------------------------------------
> ValueError Traceback (most recent call last)
> <ipython-input-163-81ffd5ac18c9> in <module>
> ----> 1 dataset.cast_(emotion_features)
>
> /usr/local/lib/python3.6/dist-packages/pyarrow/table.pxi in pyarrow.lib.Table.cast()
>
> ValueError: Target schema's field names are not matching the table's field names: ['text', 'label'], ['label', 'text']
> ```
>
> Did we define the `emotion_features` incorrectly? We just followed the instructions from the [docs](https://huggingface.co/docs/datasets/features.html?highlight=features#dataset-features), but perhaps we misunderstood something 😬
Thanks for reporting, that's a bug :) I'm fixing it right now | I am trying to load a local file with the `load_dataset` function and I want to predefine the feature types with the `features` argument. However, the types are always the same independent of the value of `features`.
I am working with the local files from the emotion dataset. To get the data you can use the following code:
```Python
from pathlib import Path
import wget
EMOTION_PATH = Path("./data/emotion")
DOWNLOAD_URLS = [
"https://www.dropbox.com/s/1pzkadrvffbqw6o/train.txt?dl=1",
"https://www.dropbox.com/s/2mzialpsgf9k5l3/val.txt?dl=1",
"https://www.dropbox.com/s/ikkqxfdbdec3fuj/test.txt?dl=1",
]
if not Path.is_dir(EMOTION_PATH):
Path.mkdir(EMOTION_PATH)
for url in DOWNLOAD_URLS:
wget.download(url, str(EMOTION_PATH))
```
The first five lines of the train set are:
```
i didnt feel humiliated;sadness
i can go from feeling so hopeless to so damned hopeful just from being around someone who cares and is awake;sadness
im grabbing a minute to post i feel greedy wrong;anger
i am ever feeling nostalgic about the fireplace i will know that it is still on the property;love
i am feeling grouchy;anger
```
Here the code to reproduce the issue:
```Python
from datasets import Features, Value, ClassLabel, load_dataset
class_names = ["sadness", "joy", "love", "anger", "fear", "surprise"]
emotion_features = Features({'text': Value('string'), 'label': ClassLabel(names=class_names)})
file_dict = {'train': EMOTION_PATH/'train.txt'}
dataset = load_dataset('csv', data_files=file_dict, delimiter=';', column_names=['text', 'label'], features=emotion_features)
```
**Observed behaviour:**
```Python
dataset['train'].features
```
```Python
{'text': Value(dtype='string', id=None),
'label': Value(dtype='string', id=None)}
```
**Expected behaviour:**
```Python
dataset['train'].features
```
```Python
{'text': Value(dtype='string', id=None),
'label': ClassLabel(num_classes=6, names=['sadness', 'joy', 'love', 'anger', 'fear', 'surprise'], names_file=None, id=None)}
```
**Things I've tried:**
- deleting the cache
- trying other types such as `int64`
Am I missing anything? Thanks for any pointer in the right direction. | 136 | Custom feature types in `load_dataset` from CSV
I am trying to load a local file with the `load_dataset` function and I want to predefine the feature types with the `features` argument. However, the types are always the same independent of the value of `features`.
I am working with the local files from the emotion dataset. To get the data you can use the following code:
```Python
from pathlib import Path
import wget
EMOTION_PATH = Path("./data/emotion")
DOWNLOAD_URLS = [
"https://www.dropbox.com/s/1pzkadrvffbqw6o/train.txt?dl=1",
"https://www.dropbox.com/s/2mzialpsgf9k5l3/val.txt?dl=1",
"https://www.dropbox.com/s/ikkqxfdbdec3fuj/test.txt?dl=1",
]
if not Path.is_dir(EMOTION_PATH):
Path.mkdir(EMOTION_PATH)
for url in DOWNLOAD_URLS:
wget.download(url, str(EMOTION_PATH))
```
The first five lines of the train set are:
```
i didnt feel humiliated;sadness
i can go from feeling so hopeless to so damned hopeful just from being around someone who cares and is awake;sadness
im grabbing a minute to post i feel greedy wrong;anger
i am ever feeling nostalgic about the fireplace i will know that it is still on the property;love
i am feeling grouchy;anger
```
Here the code to reproduce the issue:
```Python
from datasets import Features, Value, ClassLabel, load_dataset
class_names = ["sadness", "joy", "love", "anger", "fear", "surprise"]
emotion_features = Features({'text': Value('string'), 'label': ClassLabel(names=class_names)})
file_dict = {'train': EMOTION_PATH/'train.txt'}
dataset = load_dataset('csv', data_files=file_dict, delimiter=';', column_names=['text', 'label'], features=emotion_features)
```
**Observed behaviour:**
```Python
dataset['train'].features
```
```Python
{'text': Value(dtype='string', id=None),
'label': Value(dtype='string', id=None)}
```
**Expected behaviour:**
```Python
dataset['train'].features
```
```Python
{'text': Value(dtype='string', id=None),
'label': ClassLabel(num_classes=6, names=['sadness', 'joy', 'love', 'anger', 'fear', 'surprise'], names_file=None, id=None)}
```
**Things I've tried:**
- deleting the cache
- trying other types such as `int64`
Am I missing anything? Thanks for any pointer in the right direction.
> In general, I don't think there is any hard reason we don't allow to use `features` in the csv script, right @lhoestq?
>
> Should I add it?
Sure let's add it. Setting the convert options should do the job
> Hi @lhoestq we've tried out your suggestion but are now running into the following error:
>
> ```
> ---------------------------------------------------------------------------
> ValueError Traceback (most recent call last)
> <ipython-input-163-81ffd5ac18c9> in <module>
> ----> 1 dataset.cast_(emotion_features)
>
> /usr/local/lib/python3.6/dist-packages/pyarrow/table.pxi in pyarrow.lib.Table.cast()
>
> ValueError: Target schema's field names are not matching the table's field names: ['text', 'label'], ['label', 'text']
> ```
>
> Did we define the `emotion_features` incorrectly? We just followed the instructions from the [docs](https://huggingface.co/docs/datasets/features.html?highlight=features#dataset-features), but perhaps we misunderstood something 😬
Thanks for reporting, that's a bug :) I'm fixing it right now | [
0.08020319044589996,
-0.2782894968986511,
-0.053178947418928146,
0.35092276334762573,
0.31722939014434814,
-0.19431041181087494,
0.5701335072517395,
0.11138424277305603,
0.44612523913383484,
0.025330446660518646,
0.09474451839923859,
0.31617727875709534,
-0.09191003441810608,
0.3901154696941376,
-0.05818796902894974,
0.02672041580080986,
-0.16127455234527588,
0.3348046541213989,
-0.009121887385845184,
-0.34979408979415894,
-0.27132484316825867,
0.17995382845401764,
-0.09304702281951904,
-0.013486474752426147,
-0.30721715092658997,
0.33958908915519714,
0.2221691608428955,
0.14343854784965515,
0.05831192433834076,
-0.37657761573791504,
0.42371055483818054,
0.14869432151317596,
0.3030690848827362,
0.0801391750574112,
-0.0001151108808699064,
0.07688309252262115,
0.029359731823205948,
-0.17400509119033813,
-0.004085496999323368,
-0.3799193501472473,
-0.0387842059135437,
-0.20290648937225342,
0.42470839619636536,
-0.36515292525291443,
-0.23857346177101135,
-0.456402987241745,
-0.2810545265674591,
-0.12927214801311493,
0.28692296147346497,
0.32929107546806335,
0.15120229125022888,
-0.050267722457647324,
-0.2750738859176636,
0.21849468350410461,
0.3587995767593384,
0.675533652305603,
-0.25238850712776184,
0.18702061474323273,
-0.04063430428504944,
-0.11236550658941269,
0.09397374838590622,
-0.10228602588176727,
-0.14386388659477234,
0.3534232974052429,
0.4926105737686157,
0.17106154561042786,
-0.06439170986413956,
-0.13034990429878235,
-0.17332810163497925,
0.2814248204231262,
0.3474106192588806,
0.05629391968250275,
-0.04643578082323074,
-0.32319653034210205,
-0.12386300414800644,
-0.29732847213745117,
0.38241714239120483,
0.08485995978116989,
-0.18184904754161835,
0.16044257581233978,
-0.07894118875265121,
0.4355746805667877,
-0.05815010890364647,
0.3252907991409302,
0.01868792623281479,
-0.07154957950115204,
-0.23921124637126923,
0.10553407669067383,
0.030826978385448456,
-0.2173108011484146,
0.09743644297122955,
-0.34916192293167114,
0.2218388170003891,
0.11720125377178192,
-0.0551007054746151,
0.09958437085151672,
0.0039358437061309814,
-0.060464777052402496,
-0.12108003348112106,
0.03523246571421623,
0.2292756736278534,
0.19328251481056213,
-0.1932465136051178,
0.03171404451131821,
0.27778980135917664,
0.24418304860591888,
0.20021119713783264,
-0.23178315162658691,
0.15273761749267578,
0.10471565276384354,
-0.4232787489891052,
0.01833326183259487,
0.027789399027824402,
-0.30801817774772644,
0.3964598774909973,
0.08695531636476517,
0.5022855997085571,
-0.2398281991481781,
0.057662419974803925,
-0.09801171720027924,
0.04280947893857956,
-0.03219163790345192,
0.1175670325756073,
0.18355709314346313,
-0.026265598833560944,
0.5809870958328247,
-0.06561408936977386,
0.14888787269592285,
-0.32117989659309387,
0.1283436417579651,
-0.05812723934650421,
-0.22264732420444489,
-0.037468601018190384,
-0.04932039976119995,
0.4030340313911438,
0.09410491585731506,
0.24783360958099365,
0.19902630150318146,
-0.023702308535575867,
-0.31866830587387085,
-0.1270064264535904,
-0.09595637023448944,
0.12454555928707123,
0.044335413724184036,
-0.4416731894016266,
0.3375263214111328,
0.24123597145080566,
-0.2255859524011612,
-0.24441105127334595,
0.0952860563993454,
-0.2509177029132843,
-0.23280072212219238,
0.19703692197799683,
0.15558329224586487,
-0.1784612238407135,
-0.02096249908208847,
-0.1068919226527214,
0.09889619052410126,
0.128010556101799,
0.2582724988460541,
0.02637217938899994,
-0.48641693592071533,
-0.38099443912506104,
-0.32497772574424744,
-0.025487009435892105,
0.39543235301971436,
-0.41543903946876526,
-0.20390428602695465,
0.0394425094127655,
-0.046308305114507675,
0.13855910301208496,
0.2530902028083801,
-0.36610090732574463,
0.14516150951385498,
-0.23930533230304718,
0.2845744490623474,
0.5265450477600098,
0.04339839145541191,
-0.21772050857543945,
0.4294430613517761,
0.1565900593996048,
0.32675492763519287,
0.18606749176979065,
0.07426096498966217,
0.07759345322847366,
0.12609170377254486,
0.15949954092502594,
0.4206007122993469,
0.16572034358978271,
0.0673818588256836,
-0.18377676606178284,
-0.15538354218006134,
0.1656046360731125,
-0.003071276471018791,
-0.32881680130958557,
0.30902567505836487,
0.22570013999938965,
-0.5133964419364929,
0.21711164712905884,
-0.1282680630683899,
-0.22640524804592133,
-0.04688984900712967,
0.40307924151420593,
0.5202862620353699,
0.005792484153062105,
-0.01924356073141098,
-0.4824973940849304,
0.22463351488113403,
-0.14934855699539185,
-0.052252352237701416,
-0.006795674562454224,
-0.3252953290939331,
-0.49349355697631836,
-0.05676678568124771,
-0.24717001616954803,
0.1995169073343277,
0.06466422230005264,
0.3136294484138489,
-0.33587250113487244,
0.15885278582572937,
-0.0870927944779396,
0.07098172605037689,
-0.20888769626617432,
-0.25216370820999146,
-0.08015565574169159,
-0.021776655688881874,
0.17207813262939453,
-0.0900508239865303,
0.015792354941368103,
0.07750292867422104,
0.2781899571418762,
0.07674763351678848,
-0.38832810521125793,
0.1277148723602295,
0.2795608937740326,
0.161346897482872,
-0.11299610882997513,
0.21160788834095,
-0.0030284151434898376,
-0.00951404869556427,
-0.027855737134814262,
0.17322678864002228,
0.19356311857700348,
-0.09370467066764832,
-0.029085107147693634,
0.6565466523170471,
0.15393102169036865,
0.24897870421409607,
-0.26784762740135193,
-0.11285305768251419,
0.2808350920677185,
-0.0006698556244373322,
-0.1841067671775818,
-0.06700606644153595,
-0.21463529765605927,
-0.04852097108960152,
0.0014962106943130493,
0.4216480255126953,
-0.3299655318260193,
-0.11577790230512619,
0.47889086604118347,
0.0954587459564209,
0.12916254997253418,
-0.08040373772382736,
-0.01727820187807083,
-0.029092837125062943,
0.016722898930311203,
-0.23705069720745087,
0.4729238748550415,
-0.06108245998620987,
-0.08036521077156067,
-0.008282242342829704,
0.019212326034903526,
-0.22433672845363617,
0.05999976024031639,
-0.13949863612651825,
-0.1910199224948883,
0.29157182574272156,
0.034326471388339996,
-0.15791592001914978,
-0.3376888930797577,
0.24125266075134277,
-0.14660760760307312,
-0.20588712394237518,
-0.6342834234237671,
-0.09906260669231415,
-0.5823048949241638,
0.16830328106880188,
-0.463762104511261,
-0.08222924917936325,
-0.06979547441005707,
0.016335880383849144,
-0.21201938390731812,
0.10337863117456436,
-0.03539653494954109,
0.0900430679321289,
-0.17844770848751068,
0.36256298422813416,
0.06430789828300476,
-0.8123733401298523,
0.22221189737319946,
0.1188192367553711,
-0.44998106360435486,
-0.05817404016852379,
0.17499123513698578,
0.2886112332344055,
0.03556009382009506,
0.028964178636670113,
-0.2870355248451233,
0.008076325990259647,
-0.013293303549289703,
-0.13991805911064148,
0.17074517905712128,
0.5402770638465881,
0.17327070236206055,
0.17569196224212646,
0.13940311968326569,
-0.12606726586818695,
0.39837393164634705,
-0.01311698742210865,
0.05912253260612488,
-0.12502333521842957,
-0.0263376422226429,
0.11143165081739426,
-0.24287070333957672,
-0.6793344616889954,
-0.15019726753234863,
-0.20031385123729706,
0.2844245433807373,
0.21396160125732422,
0.05112592130899429,
0.19712679088115692,
0.36830517649650574,
-0.2396499365568161,
0.15469659864902496,
-0.026357116177678108,
-0.20738594233989716,
-0.07251214981079102,
0.44383475184440613,
-0.17480483651161194,
-0.21861512959003448,
0.009301472455263138,
-0.3093705177307129,
-0.3122234344482422,
0.13407231867313385,
-0.3119173049926758,
0.06121731922030449,
-0.3492913842201233,
0.5237390398979187,
0.05411292612552643,
0.024073880165815353,
0.10822631418704987,
-0.1130082979798317,
0.03962411731481552,
-0.17586392164230347,
-0.3381883203983307,
0.452170729637146,
0.3127177059650421,
0.09914903342723846,
0.42452624440193176,
-0.025254566222429276,
-0.41299712657928467,
0.49855363368988037,
-0.28556209802627563,
-0.1919134110212326,
0.5953596830368042,
-0.18008989095687866,
0.17871904373168945,
-0.07286901026964188,
-0.2670246362686157,
-0.11260268092155457,
-0.04256470501422882,
-0.11165682971477509,
0.22369107604026794,
-0.008556760847568512,
-0.27002429962158203,
-0.18102994561195374,
0.212380513548851,
-0.21761766076087952,
-0.260853111743927,
0.2379056215286255,
0.14739906787872314,
-0.010513409972190857,
-0.21220113337039948,
-0.05629822984337807,
-0.30477461218833923,
-0.0011159474961459637,
-0.05512382462620735,
0.47220367193222046,
-0.11994955688714981,
-0.0018578693270683289,
-0.3208262026309967,
0.28465911746025085,
0.0782865360379219,
0.1430097222328186,
0.20520517230033875,
0.08873329311609268,
0.051434654742479324,
-0.2681930661201477,
-0.024144001305103302,
0.19902314245700836,
0.2873644232749939,
0.026908118277788162,
0.11575476080179214,
0.20871874690055847,
-0.12256963551044464,
-0.04852676764130592,
-0.36835548281669617,
0.10468459129333496,
-0.09802457690238953,
-0.14561446011066437,
0.427383154630661,
-0.017468847334384918,
-0.20474036037921906,
0.06899408996105194,
0.1473541110754013,
-0.32371965050697327,
-0.3246999979019165,
-0.07667800039052963,
-0.1038026362657547,
0.06630460172891617,
-0.1572968065738678,
0.05665150284767151,
0.26379579305648804,
-0.4567129611968994,
-0.294929563999176,
-0.3002612292766571,
-0.06693945080041885,
0.42771977186203003,
0.027220770716667175,
0.36088570952415466,
0.03426084294915199,
-0.16829833388328552,
-0.09195056557655334,
0.3646993935108185,
-0.2676112651824951,
0.5217868089675903,
-0.02730764076113701,
-0.3972117006778717,
-0.13561385869979858,
-0.2784285545349121,
0.16924835741519928,
0.21227943897247314,
-0.35400739312171936,
0.010641202330589294,
0.05374879390001297,
-0.12742026150226593,
-0.34628909826278687,
0.4716668426990509,
0.4681006073951721,
-0.135997474193573,
0.17050795257091522,
-0.7704423069953918,
0.39510974287986755,
-0.2586807608604431,
-0.19359123706817627,
-0.023342624306678772,
-0.2719200849533081,
-0.23257140815258026,
0.3815222382545471,
0.08112413436174393,
0.603358268737793,
-0.10631638765335083,
0.11004380136728287,
0.233169287443161,
0.2517562508583069,
0.07678407430648804,
0.01934884488582611,
-0.11554735898971558,
-0.22503337264060974,
0.10444686561822891,
-0.020427921786904335,
-0.028499385342001915,
0.19873663783073425,
0.4217337369918823,
0.06123023107647896,
0.07632381469011307,
-0.2039123773574829,
0.46270322799682617,
-0.14511288702487946,
0.10123436152935028,
0.08265168964862823,
-0.20629040896892548,
-0.14086563885211945,
0.0782320499420166,
-0.07954151928424835,
0.27586984634399414,
0.06769561022520065,
-0.16896496713161469,
0.0029447004199028015,
-0.21685217320919037,
0.09004946053028107,
-0.11801248788833618,
-0.35445651412010193,
0.10298692435026169,
-0.09035851061344147,
-0.1665308028459549,
0.04942493513226509,
0.4377081096172333,
0.04539550095796585,
0.07247445732355118,
0.0026917997747659683,
-0.08924327790737152,
0.3455888628959656,
0.07239270955324173,
-0.36520180106163025,
0.00031020306050777435,
0.12502337992191315,
0.10948873311281204,
-0.41654595732688904,
-0.22296300530433655,
0.024659600108861923,
-0.2354821264743805,
-0.11751893162727356,
-0.1140049397945404,
-0.007531933486461639,
-0.5912172198295593,
-0.5814690589904785,
-0.2086249589920044,
0.15753604471683502,
0.02306024357676506,
0.08655346930027008,
-0.15369205176830292,
0.05449352413415909,
0.4086306393146515,
0.02565624751150608,
-0.29368656873703003,
-0.2414158433675766,
0.10970386862754822,
0.09344354271888733,
-0.1074574664235115,
0.4937066435813904,
-0.15851688385009766,
0.06756765395402908,
-0.23340150713920593,
0.16567587852478027,
0.029134739190340042,
-0.2786063551902771,
0.16518095135688782,
0.22463522851467133,
-0.26103854179382324,
-0.12856870889663696,
0.6697033643722534,
0.09921859204769135,
0.3524077832698822,
0.08559761941432953,
-0.312406450510025,
-0.3024979531764984,
-0.16609551012516022,
0.11887729167938232,
0.3957426846027374,
0.04644900560379028,
0.16528332233428955,
0.14162375032901764,
-0.20599712431430817,
-0.24833804368972778,
0.03338845819234848,
0.11516384035348892,
0.017148833721876144,
0.16088755428791046,
0.17931431531906128,
0.07332082837820053,
0.27795103192329407,
0.15589310228824615,
-0.07447446882724762,
-0.05494268983602524,
-0.1906137764453888,
-0.24372921884059906,
0.1428411304950714,
-0.10141093283891678,
0.20732370018959045,
-0.19023840129375458,
-0.29172855615615845,
0.1587086021900177,
-0.22860848903656006,
0.16304969787597656,
0.26925644278526306,
-0.05843399465084076,
0.5097589492797852,
-0.10746647417545319,
0.2579500079154968,
-0.039613690227270126,
0.3279566168785095,
-0.1831429898738861,
0.09116338938474655,
0.2839568853378296,
-0.10681383311748505,
-0.09509408473968506,
0.08662009239196777,
-0.1387924700975418,
-0.20920053124427795,
-0.23662324249744415,
0.34779849648475647,
-0.0584283322095871,
-0.14881660044193268,
-0.04047288000583649,
0.2657979130744934,
0.16559332609176636,
0.4483643174171448,
-0.06759028136730194,
0.03379952162504196,
0.17001989483833313,
0.20138587057590485,
-0.13736185431480408,
0.06107277795672417,
0.24826215207576752,
0.05782336741685867,
0.12595219910144806,
0.5288023948669434,
0.41630056500434875,
-0.06095472723245621,
-0.12633731961250305,
-0.29106825590133667,
0.14250296354293823,
0.19378288090229034,
0.14872954785823822,
0.3334580361843109,
0.012265283614397049,
-0.05835147574543953,
0.04397090524435043,
0.16079342365264893,
0.15201663970947266,
0.3418108820915222,
0.029278229922056198,
-0.2028435468673706,
0.0008464083075523376,
0.187326580286026,
0.022054679691791534,
-0.6729874610900879,
0.33623626828193665,
0.14519082009792328,
-0.2824924886226654,
0.39878612756729126,
0.02774156630039215,
0.3040842115879059,
-0.22176100313663483,
-0.22265948355197906,
-0.1894536018371582,
0.05150013417005539,
-0.07371125370264053,
-0.23479634523391724,
-0.11696820706129074,
-0.19612449407577515,
-0.30869776010513306,
-0.12007996439933777,
0.04037514328956604,
0.12981095910072327,
0.040961772203445435,
0.06779663264751434,
-0.05713966488838196,
-0.16465327143669128,
0.1864989995956421,
-0.2584419250488281,
0.28581804037094116,
0.031247977167367935,
0.04544086381793022,
-0.08017756044864655,
0.17684990167617798,
0.26354101300239563,
-0.09228657931089401,
-0.05887802317738533,
0.6529517769813538,
-0.07087858021259308,
-0.21274542808532715,
-0.08279645442962646,
0.049259886145591736,
-0.14791744947433472,
-0.1888006031513214,
-0.059249281883239746,
0.5324172377586365,
0.27398306131362915,
0.12942275404930115,
-0.12482216954231262,
0.22676099836826324,
-0.2451615184545517,
0.2631818652153015,
-0.6641117930412292,
0.30682897567749023,
0.24612003564834595,
0.07787442952394485,
-0.1524757593870163,
0.06743215024471283,
-0.17035344243049622,
-0.19334107637405396,
0.40789341926574707,
0.38877272605895996,
0.5386595129966736,
0.09471650421619415,
0.058899588882923126,
-0.29397135972976685,
0.2791743874549866,
-0.28403952717781067,
0.08614014834165573,
-0.05749617516994476,
0.29927903413772583,
-0.7319201827049255,
-0.09876324981451035,
0.2255541980266571,
-0.12115827947854996,
0.12163203954696655,
0.2576981484889984,
0.04177554324269295,
0.11881018429994583,
-0.15572614967823029,
-0.053257010877132416,
0.3186095654964447,
0.08250554651021957,
-0.13044612109661102,
-0.26804155111312866,
-0.13971592485904694,
0.1819896101951599,
0.09783877432346344,
-0.3734225034713745,
-0.044604670256376266,
0.09304548054933548,
0.025538861751556396,
-0.03830336406826973,
-0.2225392758846283,
0.011350523680448532,
0.05099823698401451,
0.22697973251342773,
0.041954874992370605,
0.1949174851179123,
-0.010964816436171532,
0.11669269949197769,
-0.2026652991771698,
-0.08161205053329468,
-0.15529537200927734,
0.05464436858892441,
-0.24560463428497314,
0.5321154594421387,
-0.3866826891899109,
0.5693590044975281,
-0.44075244665145874,
0.17381753027439117,
0.23102377355098724,
-0.4541361629962921,
0.09614069014787674,
-0.09455056488513947,
-0.1327081322669983,
-0.125972718000412,
0.06285480409860611,
0.3869292438030243,
-0.1089814156293869,
0.1471092849969864,
0.14298643171787262,
-0.31179752945899963,
0.34757083654403687,
-0.06038224697113037,
-0.22318020462989807,
-0.09939232468605042,
0.22442936897277832,
0.11835092306137085,
0.32812148332595825,
-0.3093108832836151,
-0.03717947378754616,
0.49520838260650635,
-0.1033606305718422,
0.2260012924671173,
0.1840548813343048,
-0.3150683045387268,
0.056316111236810684,
-0.18133530020713806,
0.14254531264305115,
0.0503486804664135,
0.24225448071956635,
-0.23904773592948914,
-0.4779428243637085
] |
https://github.com/huggingface/datasets/issues/623 | Custom feature types in `load_dataset` from CSV | PR is open for the `ValueError: Target schema's field names are not matching the table's field names` error.
I'm adding the features parameter to csv | I am trying to load a local file with the `load_dataset` function and I want to predefine the feature types with the `features` argument. However, the types are always the same independent of the value of `features`.
I am working with the local files from the emotion dataset. To get the data you can use the following code:
```Python
from pathlib import Path
import wget
EMOTION_PATH = Path("./data/emotion")
DOWNLOAD_URLS = [
"https://www.dropbox.com/s/1pzkadrvffbqw6o/train.txt?dl=1",
"https://www.dropbox.com/s/2mzialpsgf9k5l3/val.txt?dl=1",
"https://www.dropbox.com/s/ikkqxfdbdec3fuj/test.txt?dl=1",
]
if not Path.is_dir(EMOTION_PATH):
Path.mkdir(EMOTION_PATH)
for url in DOWNLOAD_URLS:
wget.download(url, str(EMOTION_PATH))
```
The first five lines of the train set are:
```
i didnt feel humiliated;sadness
i can go from feeling so hopeless to so damned hopeful just from being around someone who cares and is awake;sadness
im grabbing a minute to post i feel greedy wrong;anger
i am ever feeling nostalgic about the fireplace i will know that it is still on the property;love
i am feeling grouchy;anger
```
Here the code to reproduce the issue:
```Python
from datasets import Features, Value, ClassLabel, load_dataset
class_names = ["sadness", "joy", "love", "anger", "fear", "surprise"]
emotion_features = Features({'text': Value('string'), 'label': ClassLabel(names=class_names)})
file_dict = {'train': EMOTION_PATH/'train.txt'}
dataset = load_dataset('csv', data_files=file_dict, delimiter=';', column_names=['text', 'label'], features=emotion_features)
```
**Observed behaviour:**
```Python
dataset['train'].features
```
```Python
{'text': Value(dtype='string', id=None),
'label': Value(dtype='string', id=None)}
```
**Expected behaviour:**
```Python
dataset['train'].features
```
```Python
{'text': Value(dtype='string', id=None),
'label': ClassLabel(num_classes=6, names=['sadness', 'joy', 'love', 'anger', 'fear', 'surprise'], names_file=None, id=None)}
```
**Things I've tried:**
- deleting the cache
- trying other types such as `int64`
Am I missing anything? Thanks for any pointer in the right direction. | 25 | Custom feature types in `load_dataset` from CSV
I am trying to load a local file with the `load_dataset` function and I want to predefine the feature types with the `features` argument. However, the types are always the same independent of the value of `features`.
I am working with the local files from the emotion dataset. To get the data you can use the following code:
```Python
from pathlib import Path
import wget
EMOTION_PATH = Path("./data/emotion")
DOWNLOAD_URLS = [
"https://www.dropbox.com/s/1pzkadrvffbqw6o/train.txt?dl=1",
"https://www.dropbox.com/s/2mzialpsgf9k5l3/val.txt?dl=1",
"https://www.dropbox.com/s/ikkqxfdbdec3fuj/test.txt?dl=1",
]
if not Path.is_dir(EMOTION_PATH):
Path.mkdir(EMOTION_PATH)
for url in DOWNLOAD_URLS:
wget.download(url, str(EMOTION_PATH))
```
The first five lines of the train set are:
```
i didnt feel humiliated;sadness
i can go from feeling so hopeless to so damned hopeful just from being around someone who cares and is awake;sadness
im grabbing a minute to post i feel greedy wrong;anger
i am ever feeling nostalgic about the fireplace i will know that it is still on the property;love
i am feeling grouchy;anger
```
Here the code to reproduce the issue:
```Python
from datasets import Features, Value, ClassLabel, load_dataset
class_names = ["sadness", "joy", "love", "anger", "fear", "surprise"]
emotion_features = Features({'text': Value('string'), 'label': ClassLabel(names=class_names)})
file_dict = {'train': EMOTION_PATH/'train.txt'}
dataset = load_dataset('csv', data_files=file_dict, delimiter=';', column_names=['text', 'label'], features=emotion_features)
```
**Observed behaviour:**
```Python
dataset['train'].features
```
```Python
{'text': Value(dtype='string', id=None),
'label': Value(dtype='string', id=None)}
```
**Expected behaviour:**
```Python
dataset['train'].features
```
```Python
{'text': Value(dtype='string', id=None),
'label': ClassLabel(num_classes=6, names=['sadness', 'joy', 'love', 'anger', 'fear', 'surprise'], names_file=None, id=None)}
```
**Things I've tried:**
- deleting the cache
- trying other types such as `int64`
Am I missing anything? Thanks for any pointer in the right direction.
PR is open for the `ValueError: Target schema's field names are not matching the table's field names` error.
I'm adding the features parameter to csv | [
0.08020319044589996,
-0.2782894968986511,
-0.053178947418928146,
0.35092276334762573,
0.31722939014434814,
-0.19431041181087494,
0.5701335072517395,
0.11138424277305603,
0.44612523913383484,
0.025330446660518646,
0.09474451839923859,
0.31617727875709534,
-0.09191003441810608,
0.3901154696941376,
-0.05818796902894974,
0.02672041580080986,
-0.16127455234527588,
0.3348046541213989,
-0.009121887385845184,
-0.34979408979415894,
-0.27132484316825867,
0.17995382845401764,
-0.09304702281951904,
-0.013486474752426147,
-0.30721715092658997,
0.33958908915519714,
0.2221691608428955,
0.14343854784965515,
0.05831192433834076,
-0.37657761573791504,
0.42371055483818054,
0.14869432151317596,
0.3030690848827362,
0.0801391750574112,
-0.0001151108808699064,
0.07688309252262115,
0.029359731823205948,
-0.17400509119033813,
-0.004085496999323368,
-0.3799193501472473,
-0.0387842059135437,
-0.20290648937225342,
0.42470839619636536,
-0.36515292525291443,
-0.23857346177101135,
-0.456402987241745,
-0.2810545265674591,
-0.12927214801311493,
0.28692296147346497,
0.32929107546806335,
0.15120229125022888,
-0.050267722457647324,
-0.2750738859176636,
0.21849468350410461,
0.3587995767593384,
0.675533652305603,
-0.25238850712776184,
0.18702061474323273,
-0.04063430428504944,
-0.11236550658941269,
0.09397374838590622,
-0.10228602588176727,
-0.14386388659477234,
0.3534232974052429,
0.4926105737686157,
0.17106154561042786,
-0.06439170986413956,
-0.13034990429878235,
-0.17332810163497925,
0.2814248204231262,
0.3474106192588806,
0.05629391968250275,
-0.04643578082323074,
-0.32319653034210205,
-0.12386300414800644,
-0.29732847213745117,
0.38241714239120483,
0.08485995978116989,
-0.18184904754161835,
0.16044257581233978,
-0.07894118875265121,
0.4355746805667877,
-0.05815010890364647,
0.3252907991409302,
0.01868792623281479,
-0.07154957950115204,
-0.23921124637126923,
0.10553407669067383,
0.030826978385448456,
-0.2173108011484146,
0.09743644297122955,
-0.34916192293167114,
0.2218388170003891,
0.11720125377178192,
-0.0551007054746151,
0.09958437085151672,
0.0039358437061309814,
-0.060464777052402496,
-0.12108003348112106,
0.03523246571421623,
0.2292756736278534,
0.19328251481056213,
-0.1932465136051178,
0.03171404451131821,
0.27778980135917664,
0.24418304860591888,
0.20021119713783264,
-0.23178315162658691,
0.15273761749267578,
0.10471565276384354,
-0.4232787489891052,
0.01833326183259487,
0.027789399027824402,
-0.30801817774772644,
0.3964598774909973,
0.08695531636476517,
0.5022855997085571,
-0.2398281991481781,
0.057662419974803925,
-0.09801171720027924,
0.04280947893857956,
-0.03219163790345192,
0.1175670325756073,
0.18355709314346313,
-0.026265598833560944,
0.5809870958328247,
-0.06561408936977386,
0.14888787269592285,
-0.32117989659309387,
0.1283436417579651,
-0.05812723934650421,
-0.22264732420444489,
-0.037468601018190384,
-0.04932039976119995,
0.4030340313911438,
0.09410491585731506,
0.24783360958099365,
0.19902630150318146,
-0.023702308535575867,
-0.31866830587387085,
-0.1270064264535904,
-0.09595637023448944,
0.12454555928707123,
0.044335413724184036,
-0.4416731894016266,
0.3375263214111328,
0.24123597145080566,
-0.2255859524011612,
-0.24441105127334595,
0.0952860563993454,
-0.2509177029132843,
-0.23280072212219238,
0.19703692197799683,
0.15558329224586487,
-0.1784612238407135,
-0.02096249908208847,
-0.1068919226527214,
0.09889619052410126,
0.128010556101799,
0.2582724988460541,
0.02637217938899994,
-0.48641693592071533,
-0.38099443912506104,
-0.32497772574424744,
-0.025487009435892105,
0.39543235301971436,
-0.41543903946876526,
-0.20390428602695465,
0.0394425094127655,
-0.046308305114507675,
0.13855910301208496,
0.2530902028083801,
-0.36610090732574463,
0.14516150951385498,
-0.23930533230304718,
0.2845744490623474,
0.5265450477600098,
0.04339839145541191,
-0.21772050857543945,
0.4294430613517761,
0.1565900593996048,
0.32675492763519287,
0.18606749176979065,
0.07426096498966217,
0.07759345322847366,
0.12609170377254486,
0.15949954092502594,
0.4206007122993469,
0.16572034358978271,
0.0673818588256836,
-0.18377676606178284,
-0.15538354218006134,
0.1656046360731125,
-0.003071276471018791,
-0.32881680130958557,
0.30902567505836487,
0.22570013999938965,
-0.5133964419364929,
0.21711164712905884,
-0.1282680630683899,
-0.22640524804592133,
-0.04688984900712967,
0.40307924151420593,
0.5202862620353699,
0.005792484153062105,
-0.01924356073141098,
-0.4824973940849304,
0.22463351488113403,
-0.14934855699539185,
-0.052252352237701416,
-0.006795674562454224,
-0.3252953290939331,
-0.49349355697631836,
-0.05676678568124771,
-0.24717001616954803,
0.1995169073343277,
0.06466422230005264,
0.3136294484138489,
-0.33587250113487244,
0.15885278582572937,
-0.0870927944779396,
0.07098172605037689,
-0.20888769626617432,
-0.25216370820999146,
-0.08015565574169159,
-0.021776655688881874,
0.17207813262939453,
-0.0900508239865303,
0.015792354941368103,
0.07750292867422104,
0.2781899571418762,
0.07674763351678848,
-0.38832810521125793,
0.1277148723602295,
0.2795608937740326,
0.161346897482872,
-0.11299610882997513,
0.21160788834095,
-0.0030284151434898376,
-0.00951404869556427,
-0.027855737134814262,
0.17322678864002228,
0.19356311857700348,
-0.09370467066764832,
-0.029085107147693634,
0.6565466523170471,
0.15393102169036865,
0.24897870421409607,
-0.26784762740135193,
-0.11285305768251419,
0.2808350920677185,
-0.0006698556244373322,
-0.1841067671775818,
-0.06700606644153595,
-0.21463529765605927,
-0.04852097108960152,
0.0014962106943130493,
0.4216480255126953,
-0.3299655318260193,
-0.11577790230512619,
0.47889086604118347,
0.0954587459564209,
0.12916254997253418,
-0.08040373772382736,
-0.01727820187807083,
-0.029092837125062943,
0.016722898930311203,
-0.23705069720745087,
0.4729238748550415,
-0.06108245998620987,
-0.08036521077156067,
-0.008282242342829704,
0.019212326034903526,
-0.22433672845363617,
0.05999976024031639,
-0.13949863612651825,
-0.1910199224948883,
0.29157182574272156,
0.034326471388339996,
-0.15791592001914978,
-0.3376888930797577,
0.24125266075134277,
-0.14660760760307312,
-0.20588712394237518,
-0.6342834234237671,
-0.09906260669231415,
-0.5823048949241638,
0.16830328106880188,
-0.463762104511261,
-0.08222924917936325,
-0.06979547441005707,
0.016335880383849144,
-0.21201938390731812,
0.10337863117456436,
-0.03539653494954109,
0.0900430679321289,
-0.17844770848751068,
0.36256298422813416,
0.06430789828300476,
-0.8123733401298523,
0.22221189737319946,
0.1188192367553711,
-0.44998106360435486,
-0.05817404016852379,
0.17499123513698578,
0.2886112332344055,
0.03556009382009506,
0.028964178636670113,
-0.2870355248451233,
0.008076325990259647,
-0.013293303549289703,
-0.13991805911064148,
0.17074517905712128,
0.5402770638465881,
0.17327070236206055,
0.17569196224212646,
0.13940311968326569,
-0.12606726586818695,
0.39837393164634705,
-0.01311698742210865,
0.05912253260612488,
-0.12502333521842957,
-0.0263376422226429,
0.11143165081739426,
-0.24287070333957672,
-0.6793344616889954,
-0.15019726753234863,
-0.20031385123729706,
0.2844245433807373,
0.21396160125732422,
0.05112592130899429,
0.19712679088115692,
0.36830517649650574,
-0.2396499365568161,
0.15469659864902496,
-0.026357116177678108,
-0.20738594233989716,
-0.07251214981079102,
0.44383475184440613,
-0.17480483651161194,
-0.21861512959003448,
0.009301472455263138,
-0.3093705177307129,
-0.3122234344482422,
0.13407231867313385,
-0.3119173049926758,
0.06121731922030449,
-0.3492913842201233,
0.5237390398979187,
0.05411292612552643,
0.024073880165815353,
0.10822631418704987,
-0.1130082979798317,
0.03962411731481552,
-0.17586392164230347,
-0.3381883203983307,
0.452170729637146,
0.3127177059650421,
0.09914903342723846,
0.42452624440193176,
-0.025254566222429276,
-0.41299712657928467,
0.49855363368988037,
-0.28556209802627563,
-0.1919134110212326,
0.5953596830368042,
-0.18008989095687866,
0.17871904373168945,
-0.07286901026964188,
-0.2670246362686157,
-0.11260268092155457,
-0.04256470501422882,
-0.11165682971477509,
0.22369107604026794,
-0.008556760847568512,
-0.27002429962158203,
-0.18102994561195374,
0.212380513548851,
-0.21761766076087952,
-0.260853111743927,
0.2379056215286255,
0.14739906787872314,
-0.010513409972190857,
-0.21220113337039948,
-0.05629822984337807,
-0.30477461218833923,
-0.0011159474961459637,
-0.05512382462620735,
0.47220367193222046,
-0.11994955688714981,
-0.0018578693270683289,
-0.3208262026309967,
0.28465911746025085,
0.0782865360379219,
0.1430097222328186,
0.20520517230033875,
0.08873329311609268,
0.051434654742479324,
-0.2681930661201477,
-0.024144001305103302,
0.19902314245700836,
0.2873644232749939,
0.026908118277788162,
0.11575476080179214,
0.20871874690055847,
-0.12256963551044464,
-0.04852676764130592,
-0.36835548281669617,
0.10468459129333496,
-0.09802457690238953,
-0.14561446011066437,
0.427383154630661,
-0.017468847334384918,
-0.20474036037921906,
0.06899408996105194,
0.1473541110754013,
-0.32371965050697327,
-0.3246999979019165,
-0.07667800039052963,
-0.1038026362657547,
0.06630460172891617,
-0.1572968065738678,
0.05665150284767151,
0.26379579305648804,
-0.4567129611968994,
-0.294929563999176,
-0.3002612292766571,
-0.06693945080041885,
0.42771977186203003,
0.027220770716667175,
0.36088570952415466,
0.03426084294915199,
-0.16829833388328552,
-0.09195056557655334,
0.3646993935108185,
-0.2676112651824951,
0.5217868089675903,
-0.02730764076113701,
-0.3972117006778717,
-0.13561385869979858,
-0.2784285545349121,
0.16924835741519928,
0.21227943897247314,
-0.35400739312171936,
0.010641202330589294,
0.05374879390001297,
-0.12742026150226593,
-0.34628909826278687,
0.4716668426990509,
0.4681006073951721,
-0.135997474193573,
0.17050795257091522,
-0.7704423069953918,
0.39510974287986755,
-0.2586807608604431,
-0.19359123706817627,
-0.023342624306678772,
-0.2719200849533081,
-0.23257140815258026,
0.3815222382545471,
0.08112413436174393,
0.603358268737793,
-0.10631638765335083,
0.11004380136728287,
0.233169287443161,
0.2517562508583069,
0.07678407430648804,
0.01934884488582611,
-0.11554735898971558,
-0.22503337264060974,
0.10444686561822891,
-0.020427921786904335,
-0.028499385342001915,
0.19873663783073425,
0.4217337369918823,
0.06123023107647896,
0.07632381469011307,
-0.2039123773574829,
0.46270322799682617,
-0.14511288702487946,
0.10123436152935028,
0.08265168964862823,
-0.20629040896892548,
-0.14086563885211945,
0.0782320499420166,
-0.07954151928424835,
0.27586984634399414,
0.06769561022520065,
-0.16896496713161469,
0.0029447004199028015,
-0.21685217320919037,
0.09004946053028107,
-0.11801248788833618,
-0.35445651412010193,
0.10298692435026169,
-0.09035851061344147,
-0.1665308028459549,
0.04942493513226509,
0.4377081096172333,
0.04539550095796585,
0.07247445732355118,
0.0026917997747659683,
-0.08924327790737152,
0.3455888628959656,
0.07239270955324173,
-0.36520180106163025,
0.00031020306050777435,
0.12502337992191315,
0.10948873311281204,
-0.41654595732688904,
-0.22296300530433655,
0.024659600108861923,
-0.2354821264743805,
-0.11751893162727356,
-0.1140049397945404,
-0.007531933486461639,
-0.5912172198295593,
-0.5814690589904785,
-0.2086249589920044,
0.15753604471683502,
0.02306024357676506,
0.08655346930027008,
-0.15369205176830292,
0.05449352413415909,
0.4086306393146515,
0.02565624751150608,
-0.29368656873703003,
-0.2414158433675766,
0.10970386862754822,
0.09344354271888733,
-0.1074574664235115,
0.4937066435813904,
-0.15851688385009766,
0.06756765395402908,
-0.23340150713920593,
0.16567587852478027,
0.029134739190340042,
-0.2786063551902771,
0.16518095135688782,
0.22463522851467133,
-0.26103854179382324,
-0.12856870889663696,
0.6697033643722534,
0.09921859204769135,
0.3524077832698822,
0.08559761941432953,
-0.312406450510025,
-0.3024979531764984,
-0.16609551012516022,
0.11887729167938232,
0.3957426846027374,
0.04644900560379028,
0.16528332233428955,
0.14162375032901764,
-0.20599712431430817,
-0.24833804368972778,
0.03338845819234848,
0.11516384035348892,
0.017148833721876144,
0.16088755428791046,
0.17931431531906128,
0.07332082837820053,
0.27795103192329407,
0.15589310228824615,
-0.07447446882724762,
-0.05494268983602524,
-0.1906137764453888,
-0.24372921884059906,
0.1428411304950714,
-0.10141093283891678,
0.20732370018959045,
-0.19023840129375458,
-0.29172855615615845,
0.1587086021900177,
-0.22860848903656006,
0.16304969787597656,
0.26925644278526306,
-0.05843399465084076,
0.5097589492797852,
-0.10746647417545319,
0.2579500079154968,
-0.039613690227270126,
0.3279566168785095,
-0.1831429898738861,
0.09116338938474655,
0.2839568853378296,
-0.10681383311748505,
-0.09509408473968506,
0.08662009239196777,
-0.1387924700975418,
-0.20920053124427795,
-0.23662324249744415,
0.34779849648475647,
-0.0584283322095871,
-0.14881660044193268,
-0.04047288000583649,
0.2657979130744934,
0.16559332609176636,
0.4483643174171448,
-0.06759028136730194,
0.03379952162504196,
0.17001989483833313,
0.20138587057590485,
-0.13736185431480408,
0.06107277795672417,
0.24826215207576752,
0.05782336741685867,
0.12595219910144806,
0.5288023948669434,
0.41630056500434875,
-0.06095472723245621,
-0.12633731961250305,
-0.29106825590133667,
0.14250296354293823,
0.19378288090229034,
0.14872954785823822,
0.3334580361843109,
0.012265283614397049,
-0.05835147574543953,
0.04397090524435043,
0.16079342365264893,
0.15201663970947266,
0.3418108820915222,
0.029278229922056198,
-0.2028435468673706,
0.0008464083075523376,
0.187326580286026,
0.022054679691791534,
-0.6729874610900879,
0.33623626828193665,
0.14519082009792328,
-0.2824924886226654,
0.39878612756729126,
0.02774156630039215,
0.3040842115879059,
-0.22176100313663483,
-0.22265948355197906,
-0.1894536018371582,
0.05150013417005539,
-0.07371125370264053,
-0.23479634523391724,
-0.11696820706129074,
-0.19612449407577515,
-0.30869776010513306,
-0.12007996439933777,
0.04037514328956604,
0.12981095910072327,
0.040961772203445435,
0.06779663264751434,
-0.05713966488838196,
-0.16465327143669128,
0.1864989995956421,
-0.2584419250488281,
0.28581804037094116,
0.031247977167367935,
0.04544086381793022,
-0.08017756044864655,
0.17684990167617798,
0.26354101300239563,
-0.09228657931089401,
-0.05887802317738533,
0.6529517769813538,
-0.07087858021259308,
-0.21274542808532715,
-0.08279645442962646,
0.049259886145591736,
-0.14791744947433472,
-0.1888006031513214,
-0.059249281883239746,
0.5324172377586365,
0.27398306131362915,
0.12942275404930115,
-0.12482216954231262,
0.22676099836826324,
-0.2451615184545517,
0.2631818652153015,
-0.6641117930412292,
0.30682897567749023,
0.24612003564834595,
0.07787442952394485,
-0.1524757593870163,
0.06743215024471283,
-0.17035344243049622,
-0.19334107637405396,
0.40789341926574707,
0.38877272605895996,
0.5386595129966736,
0.09471650421619415,
0.058899588882923126,
-0.29397135972976685,
0.2791743874549866,
-0.28403952717781067,
0.08614014834165573,
-0.05749617516994476,
0.29927903413772583,
-0.7319201827049255,
-0.09876324981451035,
0.2255541980266571,
-0.12115827947854996,
0.12163203954696655,
0.2576981484889984,
0.04177554324269295,
0.11881018429994583,
-0.15572614967823029,
-0.053257010877132416,
0.3186095654964447,
0.08250554651021957,
-0.13044612109661102,
-0.26804155111312866,
-0.13971592485904694,
0.1819896101951599,
0.09783877432346344,
-0.3734225034713745,
-0.044604670256376266,
0.09304548054933548,
0.025538861751556396,
-0.03830336406826973,
-0.2225392758846283,
0.011350523680448532,
0.05099823698401451,
0.22697973251342773,
0.041954874992370605,
0.1949174851179123,
-0.010964816436171532,
0.11669269949197769,
-0.2026652991771698,
-0.08161205053329468,
-0.15529537200927734,
0.05464436858892441,
-0.24560463428497314,
0.5321154594421387,
-0.3866826891899109,
0.5693590044975281,
-0.44075244665145874,
0.17381753027439117,
0.23102377355098724,
-0.4541361629962921,
0.09614069014787674,
-0.09455056488513947,
-0.1327081322669983,
-0.125972718000412,
0.06285480409860611,
0.3869292438030243,
-0.1089814156293869,
0.1471092849969864,
0.14298643171787262,
-0.31179752945899963,
0.34757083654403687,
-0.06038224697113037,
-0.22318020462989807,
-0.09939232468605042,
0.22442936897277832,
0.11835092306137085,
0.32812148332595825,
-0.3093108832836151,
-0.03717947378754616,
0.49520838260650635,
-0.1033606305718422,
0.2260012924671173,
0.1840548813343048,
-0.3150683045387268,
0.056316111236810684,
-0.18133530020713806,
0.14254531264305115,
0.0503486804664135,
0.24225448071956635,
-0.23904773592948914,
-0.4779428243637085
] |
https://github.com/huggingface/datasets/issues/622 | load_dataset for text files not working | @thomwolf Sure. I'll try downgrading to 3.7 now even though Arrow say they support >=3.5.
Linux (Ubuntu 18.04) - Python 3.8
======================
Package - Version
---------------------
certifi 2020.6.20
chardet 3.0.4
click 7.1.2
datasets 1.0.1
dill 0.3.2
fasttext 0.9.2
filelock 3.0.12
future 0.18.2
idna 2.10
joblib 0.16.0
nltk 3.5
numpy 1.19.1
packaging 20.4
pandas 1.1.2
pip 20.0.2
protobuf 3.13.0
pyarrow 1.0.1
pybind11 2.5.0
pyparsing 2.4.7
python-dateutil 2.8.1
pytz 2020.1
regex 2020.7.14
requests 2.24.0
sacremoses 0.0.43
scikit-learn 0.23.2
scipy 1.5.2
sentence-transformers 0.3.6
sentencepiece 0.1.91
setuptools 46.1.3
six 1.15.0
stanza 1.1.1
threadpoolctl 2.1.0
tokenizers 0.8.1rc2
torch 1.6.0+cu101
tqdm 4.48.2
transformers 3.1.0
urllib3 1.25.10
wheel 0.34.2
xxhash 2.0.0
Windows 10 - Python 3.8
================
Package - Version
----------------------------
certifi 2020.6.20
chardet 3.0.4
click 7.1.2
datasets 1.0.1
dill 0.3.2
fasttext 0.9.2
filelock 3.0.12
future 0.18.2
idna 2.10
joblib 0.16.0
nlp 0.4.0
nltk 3.5
numpy 1.19.1
packaging 20.4
pandas 1.1.1
pip 20.0.2
protobuf 3.13.0
pyarrow 1.0.1
pybind11 2.5.0
pyparsing 2.4.7
python-dateutil 2.8.1
pytz 2020.1
regex 2020.7.14
requests 2.24.0
sacremoses 0.0.43
scikit-learn 0.23.2
scipy 1.5.2
sentence-transformers 0.3.5.1
sentencepiece 0.1.91
setuptools 46.1.3
six 1.15.0
stanza 1.1.1
threadpoolctl 2.1.0
tokenizers 0.8.1rc1
torch 1.6.0+cu101
tqdm 4.48.2
transformers 3.0.2
urllib3 1.25.10
wheel 0.34.2
xxhash 2.0.0 | Trying the following snippet, I get different problems on Linux and Windows.
```python
dataset = load_dataset("text", data_files="data.txt")
# or
dataset = load_dataset("text", data_files=["data.txt"])
```
(ps [This example](https://huggingface.co/docs/datasets/loading_datasets.html#json-files) shows that you can use a string as input for data_files, but the signature is `Union[Dict, List]`.)
The problem on Linux is that the script crashes with a CSV error (even though it isn't a CSV file). On Windows the script just seems to freeze or get stuck after loading the config file.
Linux stack trace:
```
PyTorch version 1.6.0+cu101 available.
Checking /home/bram/.cache/huggingface/datasets/b1d50a0e74da9a7b9822cea8ff4e4f217dd892e09eb14f6274a2169e5436e2ea.30c25842cda32b0540d88b7195147decf9671ee442f4bc2fb6ad74016852978e.py for additional imports.
Found main folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text
Found specific version folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7
Found script file from https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py to /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py
Couldn't find dataset infos file at https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/dataset_infos.json
Found metadata file for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.json
Using custom data configuration default
Generating dataset text (/home/bram/.cache/huggingface/datasets/text/default-0907112cc6cd2a38/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7)
Downloading and preparing dataset text/default-0907112cc6cd2a38 (download: Unknown size, generated: Unknown size, post-processed: Unknown size, total: Unknown size) to /home/bram/.cache/huggingface/datasets/text/default-0907112cc6cd2a38/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7...
Dataset not on Hf google storage. Downloading and preparing it from source
Downloading took 0.0 min
Checksum Computation took 0.0 min
Unable to verify checksums.
Generating split train
Traceback (most recent call last):
File "/home/bram/Python/projects/dutch-simplification/utils.py", line 45, in prepare_data
dataset = load_dataset("text", data_files=dataset_f)
File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/load.py", line 608, in load_dataset
builder_instance.download_and_prepare(
File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 468, in download_and_prepare
self._download_and_prepare(
File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 546, in _download_and_prepare
self._prepare_split(split_generator, **prepare_split_kwargs)
File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 888, in _prepare_split
for key, table in utils.tqdm(generator, unit=" tables", leave=False, disable=not_verbose):
File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/tqdm/std.py", line 1130, in __iter__
for obj in iterable:
File "/home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py", line 100, in _generate_tables
pa_table = pac.read_csv(
File "pyarrow/_csv.pyx", line 714, in pyarrow._csv.read_csv
File "pyarrow/error.pxi", line 122, in pyarrow.lib.pyarrow_internal_check_status
File "pyarrow/error.pxi", line 84, in pyarrow.lib.check_status
pyarrow.lib.ArrowInvalid: CSV parse error: Expected 1 columns, got 2
```
Windows just seems to get stuck. Even with a tiny dataset of 10 lines, it has been stuck for 15 minutes already at this message:
```
Checking C:\Users\bramv\.cache\huggingface\datasets\b1d50a0e74da9a7b9822cea8ff4e4f217dd892e09eb14f6274a2169e5436e2ea.30c25842cda32b0540d88b7195147decf9671ee442f4bc2fb6ad74016852978e.py for additional imports.
Found main folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text
Found specific version folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7
Found script file from https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py to C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7\text.py
Couldn't find dataset infos file at https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text\dataset_infos.json
Found metadata file for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7\text.json
Using custom data configuration default
```
| 194 | load_dataset for text files not working
Trying the following snippet, I get different problems on Linux and Windows.
```python
dataset = load_dataset("text", data_files="data.txt")
# or
dataset = load_dataset("text", data_files=["data.txt"])
```
(ps [This example](https://huggingface.co/docs/datasets/loading_datasets.html#json-files) shows that you can use a string as input for data_files, but the signature is `Union[Dict, List]`.)
The problem on Linux is that the script crashes with a CSV error (even though it isn't a CSV file). On Windows the script just seems to freeze or get stuck after loading the config file.
Linux stack trace:
```
PyTorch version 1.6.0+cu101 available.
Checking /home/bram/.cache/huggingface/datasets/b1d50a0e74da9a7b9822cea8ff4e4f217dd892e09eb14f6274a2169e5436e2ea.30c25842cda32b0540d88b7195147decf9671ee442f4bc2fb6ad74016852978e.py for additional imports.
Found main folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text
Found specific version folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7
Found script file from https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py to /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py
Couldn't find dataset infos file at https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/dataset_infos.json
Found metadata file for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.json
Using custom data configuration default
Generating dataset text (/home/bram/.cache/huggingface/datasets/text/default-0907112cc6cd2a38/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7)
Downloading and preparing dataset text/default-0907112cc6cd2a38 (download: Unknown size, generated: Unknown size, post-processed: Unknown size, total: Unknown size) to /home/bram/.cache/huggingface/datasets/text/default-0907112cc6cd2a38/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7...
Dataset not on Hf google storage. Downloading and preparing it from source
Downloading took 0.0 min
Checksum Computation took 0.0 min
Unable to verify checksums.
Generating split train
Traceback (most recent call last):
File "/home/bram/Python/projects/dutch-simplification/utils.py", line 45, in prepare_data
dataset = load_dataset("text", data_files=dataset_f)
File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/load.py", line 608, in load_dataset
builder_instance.download_and_prepare(
File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 468, in download_and_prepare
self._download_and_prepare(
File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 546, in _download_and_prepare
self._prepare_split(split_generator, **prepare_split_kwargs)
File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 888, in _prepare_split
for key, table in utils.tqdm(generator, unit=" tables", leave=False, disable=not_verbose):
File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/tqdm/std.py", line 1130, in __iter__
for obj in iterable:
File "/home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py", line 100, in _generate_tables
pa_table = pac.read_csv(
File "pyarrow/_csv.pyx", line 714, in pyarrow._csv.read_csv
File "pyarrow/error.pxi", line 122, in pyarrow.lib.pyarrow_internal_check_status
File "pyarrow/error.pxi", line 84, in pyarrow.lib.check_status
pyarrow.lib.ArrowInvalid: CSV parse error: Expected 1 columns, got 2
```
Windows just seems to get stuck. Even with a tiny dataset of 10 lines, it has been stuck for 15 minutes already at this message:
```
Checking C:\Users\bramv\.cache\huggingface\datasets\b1d50a0e74da9a7b9822cea8ff4e4f217dd892e09eb14f6274a2169e5436e2ea.30c25842cda32b0540d88b7195147decf9671ee442f4bc2fb6ad74016852978e.py for additional imports.
Found main folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text
Found specific version folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7
Found script file from https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py to C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7\text.py
Couldn't find dataset infos file at https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text\dataset_infos.json
Found metadata file for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7\text.json
Using custom data configuration default
```
@thomwolf Sure. I'll try downgrading to 3.7 now even though Arrow say they support >=3.5.
Linux (Ubuntu 18.04) - Python 3.8
======================
Package - Version
---------------------
certifi 2020.6.20
chardet 3.0.4
click 7.1.2
datasets 1.0.1
dill 0.3.2
fasttext 0.9.2
filelock 3.0.12
future 0.18.2
idna 2.10
joblib 0.16.0
nltk 3.5
numpy 1.19.1
packaging 20.4
pandas 1.1.2
pip 20.0.2
protobuf 3.13.0
pyarrow 1.0.1
pybind11 2.5.0
pyparsing 2.4.7
python-dateutil 2.8.1
pytz 2020.1
regex 2020.7.14
requests 2.24.0
sacremoses 0.0.43
scikit-learn 0.23.2
scipy 1.5.2
sentence-transformers 0.3.6
sentencepiece 0.1.91
setuptools 46.1.3
six 1.15.0
stanza 1.1.1
threadpoolctl 2.1.0
tokenizers 0.8.1rc2
torch 1.6.0+cu101
tqdm 4.48.2
transformers 3.1.0
urllib3 1.25.10
wheel 0.34.2
xxhash 2.0.0
Windows 10 - Python 3.8
================
Package - Version
----------------------------
certifi 2020.6.20
chardet 3.0.4
click 7.1.2
datasets 1.0.1
dill 0.3.2
fasttext 0.9.2
filelock 3.0.12
future 0.18.2
idna 2.10
joblib 0.16.0
nlp 0.4.0
nltk 3.5
numpy 1.19.1
packaging 20.4
pandas 1.1.1
pip 20.0.2
protobuf 3.13.0
pyarrow 1.0.1
pybind11 2.5.0
pyparsing 2.4.7
python-dateutil 2.8.1
pytz 2020.1
regex 2020.7.14
requests 2.24.0
sacremoses 0.0.43
scikit-learn 0.23.2
scipy 1.5.2
sentence-transformers 0.3.5.1
sentencepiece 0.1.91
setuptools 46.1.3
six 1.15.0
stanza 1.1.1
threadpoolctl 2.1.0
tokenizers 0.8.1rc1
torch 1.6.0+cu101
tqdm 4.48.2
transformers 3.0.2
urllib3 1.25.10
wheel 0.34.2
xxhash 2.0.0 | [
-0.27466508746147156,
-0.4020572602748871,
0.01756073161959648,
0.38725215196609497,
0.26964259147644043,
-0.038661353290081024,
0.318887859582901,
-0.05435653403401375,
0.4263593256473541,
-0.058048903942108154,
0.06597194820642471,
0.14552471041679382,
-0.15576286613941193,
0.27420055866241455,
0.06355622410774231,
-0.03507590293884277,
0.15718327462673187,
-0.013841032981872559,
-0.29144343733787537,
0.04024842381477356,
-0.11445463448762894,
0.34312117099761963,
-0.2153358906507492,
-0.14693012833595276,
-0.4160703420639038,
0.27400466799736023,
-0.10501692444086075,
0.453878253698349,
-0.07426194846630096,
-0.2378564178943634,
0.2710002362728119,
0.12820816040039062,
0.16396383941173553,
0.6136502027511597,
-0.00012696169142145663,
0.11003263294696808,
0.27564769983291626,
-0.16101115942001343,
-0.2998278737068176,
-0.5695475935935974,
0.15851548314094543,
-0.22943682968616486,
0.20884843170642853,
-0.02878069132566452,
0.13019275665283203,
-0.00452867615967989,
0.1527262032032013,
-0.3340619206428528,
0.3551647365093231,
0.325478196144104,
0.1009778082370758,
0.31933706998825073,
0.062094781547784805,
-0.014658169820904732,
0.06096186861395836,
0.476550817489624,
-0.09174498170614243,
0.39064982533454895,
0.3137863278388977,
-0.19428719580173492,
0.11695243418216705,
-0.08240078389644623,
-0.17309308052062988,
-0.16965323686599731,
0.3285274803638458,
0.28717073798179626,
-0.6134480834007263,
-0.20572631061077118,
0.07684162259101868,
0.18599191308021545,
0.43523305654525757,
-0.43391847610473633,
-0.22174830734729767,
-0.15912951529026031,
-0.0756906047463417,
-0.12547838687896729,
0.4388751983642578,
0.1783991903066635,
-0.19857299327850342,
0.058120787143707275,
-0.25035667419433594,
-0.06923972815275192,
-0.1769828498363495,
0.32306575775146484,
-0.008430525660514832,
0.050888918340206146,
-0.21918228268623352,
0.10400895774364471,
0.3328261077404022,
-0.07093829661607742,
-0.20637576282024384,
-0.2793428301811218,
-0.029353488236665726,
0.06112753972411156,
-0.26616689562797546,
0.15572930872440338,
-0.26587602496147156,
-0.02452719211578369,
0.11175438016653061,
0.17476198077201843,
-0.004768398590385914,
0.14171989262104034,
0.09514429420232773,
0.23060673475265503,
0.20078730583190918,
0.0978599488735199,
0.4081539809703827,
0.08435465395450592,
0.26157498359680176,
0.026359327137470245,
-0.016058051958680153,
-0.09524741023778915,
-0.19634290039539337,
-0.5441904664039612,
-0.06979077309370041,
-0.23005294799804688,
0.47970032691955566,
-0.2050441950559616,
-0.17903532087802887,
-0.04985557496547699,
-0.08081233501434326,
-0.04559389874339104,
0.21613672375679016,
0.619709312915802,
-0.08433903753757477,
0.03387746959924698,
0.1204904317855835,
0.31828367710113525,
-0.11680151522159576,
0.1911226063966751,
0.04757927358150482,
-0.06042690947651863,
-0.08892598003149033,
0.17952533066272736,
0.5387117862701416,
-0.37219706177711487,
0.3424330949783325,
0.1996888369321823,
0.46710360050201416,
-0.19052858650684357,
-0.1514507532119751,
-0.18654794991016388,
-0.01740100234746933,
0.18869464099407196,
0.007627781480550766,
0.04194001853466034,
0.24052883684635162,
-0.15900498628616333,
-0.11470441520214081,
0.09400743246078491,
-0.2652539610862732,
-0.09384723007678986,
0.03227796033024788,
0.04484368488192558,
-0.09525851160287857,
-0.2330176830291748,
-0.3073217272758484,
0.09292526543140411,
0.037364594638347626,
-0.10542857646942139,
0.09388474375009537,
-0.18031029403209686,
-0.23808330297470093,
-0.1588560938835144,
0.271628737449646,
0.6603160500526428,
-0.29885390400886536,
-0.14544497430324554,
0.32554319500923157,
-0.12255604565143585,
-0.11927320808172226,
0.2550254762172699,
-0.09432854503393173,
0.009946838021278381,
-0.26102373003959656,
0.19931451976299286,
0.18748818337917328,
-0.4092429578304291,
-0.14655740559101105,
0.396353542804718,
0.058407098054885864,
0.13573025166988373,
0.20805758237838745,
0.06181078031659126,
0.04158390685915947,
0.04601143300533295,
0.28067803382873535,
0.008305852301418781,
0.10472077131271362,
-0.09153573960065842,
-0.003415212035179138,
-0.20375406742095947,
0.09107531607151031,
0.3670077919960022,
-0.21133868396282196,
0.05503413826227188,
0.10750479996204376,
-0.11178306490182877,
0.17654049396514893,
-0.10396623611450195,
-0.03444817662239075,
0.5095411539077759,
0.13623763620853424,
0.32014578580856323,
0.07939956337213516,
-0.21166938543319702,
-0.5979294180870056,
0.13661986589431763,
0.2275741994380951,
-0.053531721234321594,
-0.26386529207229614,
-0.09572690725326538,
-0.1770210564136505,
0.060134559869766235,
-0.20953930914402008,
-0.014112904667854309,
-0.07209601998329163,
0.15332286059856415,
0.2246880829334259,
0.0292828232049942,
-0.2047475129365921,
0.4062136113643646,
-0.16938132047653198,
0.245487779378891,
-0.2644481062889099,
0.17883147299289703,
-0.03566547483205795,
-0.20230185985565186,
-0.05179573595523834,
0.1018906682729721,
-0.004675917327404022,
-0.2937566936016083,
0.09547410160303116,
0.46329742670059204,
0.05469230189919472,
0.08568492531776428,
-0.18478921055793762,
-0.09530840814113617,
0.22696512937545776,
-0.08083350211381912,
-0.027376921847462654,
0.29197049140930176,
0.20263512432575226,
-0.19178074598312378,
-0.2744138240814209,
0.19127023220062256,
-0.33558428287506104,
0.16342973709106445,
0.029872238636016846,
-0.10833264142274857,
-0.048433803021907806,
0.10796989500522614,
-0.30235612392425537,
-0.06359688192605972,
0.4508513808250427,
-0.24545635282993317,
0.26050445437431335,
0.001822158694267273,
-0.4244135022163391,
-0.2174912393093109,
0.41966497898101807,
-0.04605230689048767,
0.1226552426815033,
0.18774020671844482,
-0.21470129489898682,
0.2120124101638794,
-0.08776815235614777,
-0.041977427899837494,
0.5764286518096924,
0.1378009170293808,
-0.29834991693496704,
0.22981514036655426,
-0.11662109941244125,
-0.22127966582775116,
0.28909584879875183,
-0.04727776348590851,
-0.0982486680150032,
0.09601173549890518,
-0.1998824030160904,
0.008325614035129547,
-0.26002970337867737,
-0.06789300590753555,
-0.10154349356889725,
0.07152579724788666,
-0.412751168012619,
0.22236080467700958,
-0.3261348307132721,
-0.16208136081695557,
-0.353361576795578,
0.11997043341398239,
-0.29344743490219116,
-0.035253237932920456,
-0.2882404327392578,
0.2256356030702591,
0.16318251192569733,
0.036844104528427124,
-0.0255984365940094,
0.00393328070640564,
0.10042867064476013,
-0.5494061708450317,
-0.19856739044189453,
0.008163602091372013,
-0.23089352250099182,
-0.09342408180236816,
0.38237711787223816,
0.044111475348472595,
0.23747751116752625,
-0.3961958587169647,
-0.10942899435758591,
-0.09859373420476913,
-0.1599084585905075,
0.05576726794242859,
-0.06142425537109375,
0.19603170454502106,
0.05316426232457161,
0.22801974415779114,
-0.12375231087207794,
-0.13104702532291412,
0.4299977123737335,
-0.03813391551375389,
-0.1885630488395691,
0.2453443706035614,
0.41844668984413147,
-0.30971813201904297,
-0.2610921263694763,
-0.3623769283294678,
-0.1279265582561493,
-0.2842009663581848,
0.35814857482910156,
0.15591806173324585,
-0.02956918627023697,
0.5024074912071228,
0.42875543236732483,
0.15696276724338531,
-0.18035155534744263,
0.21657925844192505,
0.06529708951711655,
-0.168305441737175,
0.47165095806121826,
-0.16438469290733337,
-0.6319025158882141,
0.07756011188030243,
0.4496116042137146,
-0.2843746244907379,
0.21754126250743866,
-0.4422394633293152,
-0.06208041310310364,
-0.11925515532493591,
0.09208999574184418,
0.04108500853180885,
0.3046550154685974,
0.18646186590194702,
0.08041266351938248,
0.09567829221487045,
-0.05449400842189789,
-0.32142069935798645,
0.11587603390216827,
-0.21104341745376587,
0.03335344046354294,
0.2350960075855255,
0.3713708221912384,
-0.20123478770256042,
0.4552718997001648,
0.3391938805580139,
-0.06640851497650146,
0.2473822683095932,
-0.5043379664421082,
0.5094944834709167,
-0.1640397310256958,
-0.5347826480865479,
0.05617336183786392,
-0.21773487329483032,
0.1750391721725464,
0.27665549516677856,
0.1536443829536438,
0.3985491394996643,
-0.3371798098087311,
0.10423095524311066,
-0.07458600401878357,
-0.19977344572544098,
0.2598342299461365,
-0.11723457276821136,
0.07948076725006104,
-0.1508023738861084,
0.1711592972278595,
0.1823590099811554,
-0.23288646340370178,
0.03903879597783089,
0.6069951057434082,
-0.1873316764831543,
0.051549434661865234,
-0.39870980381965637,
0.0692128986120224,
-0.3697613775730133,
0.3847951889038086,
-0.04406869783997536,
0.3335779309272766,
-0.27299389243125916,
-0.10511372238397598,
0.01776283234357834,
-0.037272900342941284,
0.5544432401657104,
0.3075839877128601,
-0.19523999094963074,
0.017645690590143204,
-0.25824272632598877,
-0.3879300057888031,
0.0970630943775177,
-0.2831108272075653,
0.39122483134269714,
0.17978160083293915,
0.6442822217941284,
-0.30025559663772583,
-0.2145058959722519,
-0.09112641215324402,
0.4764972925186157,
-0.022832082584500313,
-0.31148800253868103,
-0.2785246968269348,
-0.16343708336353302,
-0.32626476883888245,
-0.24235379695892334,
0.02418855018913746,
0.2216685563325882,
-0.18151506781578064,
0.2211252897977829,
-0.05780911445617676,
-0.1648257076740265,
0.2988143563270569,
-0.030988162383437157,
0.2692626416683197,
-0.32836395502090454,
0.23207390308380127,
0.10623225569725037,
0.4693126380443573,
0.29696276783943176,
0.551525890827179,
-0.08975723385810852,
-0.46018892526626587,
0.020805126056075096,
-0.15819226205348969,
0.3489820659160614,
0.16609907150268555,
-0.27159419655799866,
0.14265033602714539,
0.2977319359779358,
0.11018599569797516,
-0.4385163486003876,
-0.0669691190123558,
0.5130975842475891,
0.2113116830587387,
-0.2971879243850708,
-0.4682973325252533,
0.36469128727912903,
0.028174743056297302,
0.14996710419654846,
0.27160051465034485,
0.17438693344593048,
-0.29298001527786255,
0.018115131184458733,
-0.3032904863357544,
0.8145564794540405,
-0.13513001799583435,
0.4673895835876465,
0.23452234268188477,
-0.08719875663518906,
0.397825688123703,
-0.053324341773986816,
0.06563602387905121,
-0.2903502881526947,
-0.014762661419808865,
-0.012935230508446693,
-0.17483539879322052,
0.4434725344181061,
0.17013514041900635,
-0.4242365062236786,
0.21922776103019714,
-0.013385012745857239,
0.31011340022087097,
-0.2710381746292114,
0.18515266478061676,
-0.4233771562576294,
-0.30676761269569397,
-0.34613505005836487,
0.03141036629676819,
0.14703771471977234,
0.3159361481666565,
-0.019304631277918816,
0.068677619099617,
-0.17888011038303375,
-0.2796393632888794,
-0.3666660785675049,
0.05740419775247574,
-0.32172903418540955,
0.05843834578990936,
0.21080191433429718,
-0.34539371728897095,
0.3396162986755371,
0.44701316952705383,
0.2227247804403305,
0.12587442994117737,
-0.16990654170513153,
-0.088034987449646,
-0.22852873802185059,
-0.10756894946098328,
0.001793119590729475,
-0.2334613800048828,
0.025620169937610626,
0.08667146414518356,
-0.27068498730659485,
-0.034228309988975525,
-0.0761411264538765,
-0.1780477911233902,
-0.011277124285697937,
0.13029271364212036,
-0.35141658782958984,
-0.4001733064651489,
-0.4443773031234741,
-0.16439521312713623,
0.1622946709394455,
-0.062214985489845276,
0.012506451457738876,
0.12515521049499512,
0.15351563692092896,
0.04247341305017471,
0.08630746603012085,
-0.1513926088809967,
-0.10639512538909912,
0.3808281421661377,
-0.4325576722621918,
-0.2435595542192459,
0.6115918159484863,
0.44780296087265015,
-0.1363862305879593,
-0.2047024667263031,
0.3153444230556488,
-0.02410351298749447,
-0.47063779830932617,
0.060029350221157074,
0.3476565480232239,
0.046982020139694214,
0.021084846928715706,
0.2753243148326874,
0.04095536470413208,
-0.1721467673778534,
0.10798409581184387,
-0.5703993439674377,
-0.3437374532222748,
0.19584468007087708,
0.29915693402290344,
0.13245421648025513,
0.22470954060554504,
-0.15168331563472748,
-0.01446075364947319,
-0.21246680617332458,
-0.1799510419368744,
0.028362778946757317,
0.07118233293294907,
-0.20901280641555786,
0.4280432164669037,
0.08135491609573364,
0.34466132521629333,
-0.242889866232872,
0.018016835674643517,
-0.008255444467067719,
0.06141901761293411,
-0.055910781025886536,
-0.13231714069843292,
0.13573800027370453,
-0.07649707794189453,
-0.18019047379493713,
-0.16954435408115387,
-0.3009037971496582,
-0.005444547161459923,
-0.30615487694740295,
0.1830039918422699,
0.4905685782432556,
-0.13221722841262817,
0.16604216396808624,
-0.2308713048696518,
0.24027419090270996,
-0.3294675946235657,
0.2159643918275833,
-0.33016255497932434,
0.3099440634250641,
0.11999452114105225,
0.06452429294586182,
-0.0035629512276500463,
0.07621486485004425,
-0.17964790761470795,
0.28044652938842773,
0.19380606710910797,
-0.08764828741550446,
0.2333926260471344,
-0.41730326414108276,
0.1791359931230545,
-0.1308647096157074,
0.4586465358734131,
0.6418233513832092,
-0.2389523833990097,
0.17709243297576904,
0.323751300573349,
0.0375068373978138,
-0.10668563842773438,
0.025385616347193718,
0.1342611461877823,
-0.07563222944736481,
0.05577952042222023,
0.2839002311229706,
-0.10994723439216614,
-0.07677105069160461,
0.014085404574871063,
0.04201062023639679,
0.3017368018627167,
0.1350492686033249,
0.04224539175629616,
0.31792572140693665,
0.28218626976013184,
0.21729479730129242,
-0.07895780354738235,
0.3243650197982788,
0.168809711933136,
0.3248772621154785,
-0.12702417373657227,
0.12640246748924255,
-0.18793323636054993,
0.3269268870353699,
-0.05856538563966751,
-0.3316076695919037,
0.12361234426498413,
0.054044149816036224,
-0.2286888062953949,
0.0388123095035553,
-0.21605685353279114,
0.5491749048233032,
-0.5157119035720825,
-0.009049078449606895,
-0.1283322274684906,
0.06846510618925095,
-0.050738804042339325,
-0.3157408833503723,
0.03204023092985153,
-0.23804622888565063,
-0.031142953783273697,
0.02466117963194847,
-0.0586087740957737,
-0.13547711074352264,
0.06375180184841156,
0.12601828575134277,
-0.033776625990867615,
-0.3310146629810333,
0.12166766077280045,
0.017429785802960396,
0.014899447560310364,
0.004908401519060135,
0.271010160446167,
0.15193212032318115,
0.21965689957141876,
0.3230520784854889,
0.3475780189037323,
0.5777649283409119,
0.4073307514190674,
0.10604949295520782,
0.24757611751556396,
-0.26939257979393005,
-0.012606486678123474,
-0.03941423445940018,
0.3580523133277893,
0.11281471699476242,
0.037804875522851944,
0.21644532680511475,
0.0713128075003624,
-0.03739205747842789,
-0.05451435223221779,
0.0653119832277298,
-0.11782512068748474,
-0.29895487427711487,
0.23282304406166077,
-0.2536523938179016,
-0.12917304039001465,
-0.17007729411125183,
-0.04674641042947769,
-0.44124355912208557,
-0.03883911296725273,
0.5237541794776917,
0.26585763692855835,
0.1927785575389862,
-0.042704228311777115,
0.02653927356004715,
0.3400239050388336,
0.4671337604522705,
0.38308992981910706,
0.23772022128105164,
-0.057062745094299316,
-0.011146128177642822,
-0.6012915968894958,
-0.011561572551727295,
0.009720947593450546,
-0.13737620413303375,
-0.2386874556541443,
-0.1536639928817749,
0.19780229032039642,
0.15514986217021942,
0.052321359515190125,
-0.1281723529100418,
0.2108141928911209,
-0.012030869722366333,
-0.05344913899898529,
-0.1669253706932068,
-0.015177987515926361,
0.13818711042404175,
0.004907839000225067,
-0.3023654520511627,
0.06138338893651962,
-0.10898315161466599,
-0.05648649111390114,
-0.3146934509277344,
0.42382538318634033,
-0.10585279762744904,
-0.33554357290267944,
0.13646440207958221,
-0.07306482642889023,
0.4701797068119049,
0.04250940680503845,
-0.16549621522426605,
-0.17986448109149933,
-0.23826564848423004,
0.021349098533391953,
0.43025344610214233,
0.15453454852104187,
0.005093453451991081,
-0.4908643364906311,
-0.49262502789497375,
-0.2662898600101471,
0.24394312500953674,
-0.059263601899147034,
-0.37303411960601807,
0.02461392618715763,
-0.018650636076927185,
-0.03545805811882019,
0.001153341494500637,
0.23331274092197418,
0.47853729128837585,
-0.27210986614227295,
0.010619590058922768,
-0.14781954884529114,
-0.12781193852424622,
0.3023917078971863,
-0.4510454535484314,
-0.2669309973716736,
0.030796915292739868,
0.008957751095294952,
0.015702150762081146,
0.049648672342300415,
-0.5663859248161316,
0.12508678436279297,
0.13597729802131653,
-0.10330649465322495,
-0.13997501134872437,
0.053034666925668716,
-0.18257488310337067,
-0.03638375550508499,
-0.1389525681734085,
0.454903244972229,
0.08838391304016113,
-0.25883957743644714,
0.09736847877502441,
-0.20569591224193573
] |
https://github.com/huggingface/datasets/issues/622 | load_dataset for text files not working | Downgrading to 3.7 does not help. Here is a dummy text file:
```text
Verzekering weigert vaker te betalen
Bedrijven van verzekeringen erkennen steeds minder arbeidsongevallen .
In 2012 weigerden de bedrijven te betalen voor 21.055 ongevallen op het werk .
Dat is 11,8 % van alle ongevallen op het werk .
Nog nooit weigerden verzekeraars zoveel zaken .
In 2012 hadden 135.118 mensen een ongeval op het werk .
Dat zijn elke werkdag 530 mensen .
Bij die ongevallen stierven 67 mensen .
Bijna 12.000 hebben een handicap na het ongeval .
Geen echt arbeidsongeval Bedrijven moeten een verzekering hebben voor hun werknemers .
```
A temporary work around for the "text" type, is
```python
dataset = Dataset.from_dict({"text": Path(dataset_f).read_text().splitlines()})
``` | Trying the following snippet, I get different problems on Linux and Windows.
```python
dataset = load_dataset("text", data_files="data.txt")
# or
dataset = load_dataset("text", data_files=["data.txt"])
```
(ps [This example](https://huggingface.co/docs/datasets/loading_datasets.html#json-files) shows that you can use a string as input for data_files, but the signature is `Union[Dict, List]`.)
The problem on Linux is that the script crashes with a CSV error (even though it isn't a CSV file). On Windows the script just seems to freeze or get stuck after loading the config file.
Linux stack trace:
```
PyTorch version 1.6.0+cu101 available.
Checking /home/bram/.cache/huggingface/datasets/b1d50a0e74da9a7b9822cea8ff4e4f217dd892e09eb14f6274a2169e5436e2ea.30c25842cda32b0540d88b7195147decf9671ee442f4bc2fb6ad74016852978e.py for additional imports.
Found main folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text
Found specific version folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7
Found script file from https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py to /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py
Couldn't find dataset infos file at https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/dataset_infos.json
Found metadata file for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.json
Using custom data configuration default
Generating dataset text (/home/bram/.cache/huggingface/datasets/text/default-0907112cc6cd2a38/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7)
Downloading and preparing dataset text/default-0907112cc6cd2a38 (download: Unknown size, generated: Unknown size, post-processed: Unknown size, total: Unknown size) to /home/bram/.cache/huggingface/datasets/text/default-0907112cc6cd2a38/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7...
Dataset not on Hf google storage. Downloading and preparing it from source
Downloading took 0.0 min
Checksum Computation took 0.0 min
Unable to verify checksums.
Generating split train
Traceback (most recent call last):
File "/home/bram/Python/projects/dutch-simplification/utils.py", line 45, in prepare_data
dataset = load_dataset("text", data_files=dataset_f)
File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/load.py", line 608, in load_dataset
builder_instance.download_and_prepare(
File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 468, in download_and_prepare
self._download_and_prepare(
File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 546, in _download_and_prepare
self._prepare_split(split_generator, **prepare_split_kwargs)
File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 888, in _prepare_split
for key, table in utils.tqdm(generator, unit=" tables", leave=False, disable=not_verbose):
File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/tqdm/std.py", line 1130, in __iter__
for obj in iterable:
File "/home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py", line 100, in _generate_tables
pa_table = pac.read_csv(
File "pyarrow/_csv.pyx", line 714, in pyarrow._csv.read_csv
File "pyarrow/error.pxi", line 122, in pyarrow.lib.pyarrow_internal_check_status
File "pyarrow/error.pxi", line 84, in pyarrow.lib.check_status
pyarrow.lib.ArrowInvalid: CSV parse error: Expected 1 columns, got 2
```
Windows just seems to get stuck. Even with a tiny dataset of 10 lines, it has been stuck for 15 minutes already at this message:
```
Checking C:\Users\bramv\.cache\huggingface\datasets\b1d50a0e74da9a7b9822cea8ff4e4f217dd892e09eb14f6274a2169e5436e2ea.30c25842cda32b0540d88b7195147decf9671ee442f4bc2fb6ad74016852978e.py for additional imports.
Found main folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text
Found specific version folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7
Found script file from https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py to C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7\text.py
Couldn't find dataset infos file at https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text\dataset_infos.json
Found metadata file for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7\text.json
Using custom data configuration default
```
| 120 | load_dataset for text files not working
Trying the following snippet, I get different problems on Linux and Windows.
```python
dataset = load_dataset("text", data_files="data.txt")
# or
dataset = load_dataset("text", data_files=["data.txt"])
```
(ps [This example](https://huggingface.co/docs/datasets/loading_datasets.html#json-files) shows that you can use a string as input for data_files, but the signature is `Union[Dict, List]`.)
The problem on Linux is that the script crashes with a CSV error (even though it isn't a CSV file). On Windows the script just seems to freeze or get stuck after loading the config file.
Linux stack trace:
```
PyTorch version 1.6.0+cu101 available.
Checking /home/bram/.cache/huggingface/datasets/b1d50a0e74da9a7b9822cea8ff4e4f217dd892e09eb14f6274a2169e5436e2ea.30c25842cda32b0540d88b7195147decf9671ee442f4bc2fb6ad74016852978e.py for additional imports.
Found main folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text
Found specific version folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7
Found script file from https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py to /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py
Couldn't find dataset infos file at https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/dataset_infos.json
Found metadata file for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.json
Using custom data configuration default
Generating dataset text (/home/bram/.cache/huggingface/datasets/text/default-0907112cc6cd2a38/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7)
Downloading and preparing dataset text/default-0907112cc6cd2a38 (download: Unknown size, generated: Unknown size, post-processed: Unknown size, total: Unknown size) to /home/bram/.cache/huggingface/datasets/text/default-0907112cc6cd2a38/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7...
Dataset not on Hf google storage. Downloading and preparing it from source
Downloading took 0.0 min
Checksum Computation took 0.0 min
Unable to verify checksums.
Generating split train
Traceback (most recent call last):
File "/home/bram/Python/projects/dutch-simplification/utils.py", line 45, in prepare_data
dataset = load_dataset("text", data_files=dataset_f)
File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/load.py", line 608, in load_dataset
builder_instance.download_and_prepare(
File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 468, in download_and_prepare
self._download_and_prepare(
File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 546, in _download_and_prepare
self._prepare_split(split_generator, **prepare_split_kwargs)
File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 888, in _prepare_split
for key, table in utils.tqdm(generator, unit=" tables", leave=False, disable=not_verbose):
File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/tqdm/std.py", line 1130, in __iter__
for obj in iterable:
File "/home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py", line 100, in _generate_tables
pa_table = pac.read_csv(
File "pyarrow/_csv.pyx", line 714, in pyarrow._csv.read_csv
File "pyarrow/error.pxi", line 122, in pyarrow.lib.pyarrow_internal_check_status
File "pyarrow/error.pxi", line 84, in pyarrow.lib.check_status
pyarrow.lib.ArrowInvalid: CSV parse error: Expected 1 columns, got 2
```
Windows just seems to get stuck. Even with a tiny dataset of 10 lines, it has been stuck for 15 minutes already at this message:
```
Checking C:\Users\bramv\.cache\huggingface\datasets\b1d50a0e74da9a7b9822cea8ff4e4f217dd892e09eb14f6274a2169e5436e2ea.30c25842cda32b0540d88b7195147decf9671ee442f4bc2fb6ad74016852978e.py for additional imports.
Found main folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text
Found specific version folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7
Found script file from https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py to C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7\text.py
Couldn't find dataset infos file at https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text\dataset_infos.json
Found metadata file for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7\text.json
Using custom data configuration default
```
Downgrading to 3.7 does not help. Here is a dummy text file:
```text
Verzekering weigert vaker te betalen
Bedrijven van verzekeringen erkennen steeds minder arbeidsongevallen .
In 2012 weigerden de bedrijven te betalen voor 21.055 ongevallen op het werk .
Dat is 11,8 % van alle ongevallen op het werk .
Nog nooit weigerden verzekeraars zoveel zaken .
In 2012 hadden 135.118 mensen een ongeval op het werk .
Dat zijn elke werkdag 530 mensen .
Bij die ongevallen stierven 67 mensen .
Bijna 12.000 hebben een handicap na het ongeval .
Geen echt arbeidsongeval Bedrijven moeten een verzekering hebben voor hun werknemers .
```
A temporary work around for the "text" type, is
```python
dataset = Dataset.from_dict({"text": Path(dataset_f).read_text().splitlines()})
``` | [
-0.27466508746147156,
-0.4020572602748871,
0.01756073161959648,
0.38725215196609497,
0.26964259147644043,
-0.038661353290081024,
0.318887859582901,
-0.05435653403401375,
0.4263593256473541,
-0.058048903942108154,
0.06597194820642471,
0.14552471041679382,
-0.15576286613941193,
0.27420055866241455,
0.06355622410774231,
-0.03507590293884277,
0.15718327462673187,
-0.013841032981872559,
-0.29144343733787537,
0.04024842381477356,
-0.11445463448762894,
0.34312117099761963,
-0.2153358906507492,
-0.14693012833595276,
-0.4160703420639038,
0.27400466799736023,
-0.10501692444086075,
0.453878253698349,
-0.07426194846630096,
-0.2378564178943634,
0.2710002362728119,
0.12820816040039062,
0.16396383941173553,
0.6136502027511597,
-0.00012696169142145663,
0.11003263294696808,
0.27564769983291626,
-0.16101115942001343,
-0.2998278737068176,
-0.5695475935935974,
0.15851548314094543,
-0.22943682968616486,
0.20884843170642853,
-0.02878069132566452,
0.13019275665283203,
-0.00452867615967989,
0.1527262032032013,
-0.3340619206428528,
0.3551647365093231,
0.325478196144104,
0.1009778082370758,
0.31933706998825073,
0.062094781547784805,
-0.014658169820904732,
0.06096186861395836,
0.476550817489624,
-0.09174498170614243,
0.39064982533454895,
0.3137863278388977,
-0.19428719580173492,
0.11695243418216705,
-0.08240078389644623,
-0.17309308052062988,
-0.16965323686599731,
0.3285274803638458,
0.28717073798179626,
-0.6134480834007263,
-0.20572631061077118,
0.07684162259101868,
0.18599191308021545,
0.43523305654525757,
-0.43391847610473633,
-0.22174830734729767,
-0.15912951529026031,
-0.0756906047463417,
-0.12547838687896729,
0.4388751983642578,
0.1783991903066635,
-0.19857299327850342,
0.058120787143707275,
-0.25035667419433594,
-0.06923972815275192,
-0.1769828498363495,
0.32306575775146484,
-0.008430525660514832,
0.050888918340206146,
-0.21918228268623352,
0.10400895774364471,
0.3328261077404022,
-0.07093829661607742,
-0.20637576282024384,
-0.2793428301811218,
-0.029353488236665726,
0.06112753972411156,
-0.26616689562797546,
0.15572930872440338,
-0.26587602496147156,
-0.02452719211578369,
0.11175438016653061,
0.17476198077201843,
-0.004768398590385914,
0.14171989262104034,
0.09514429420232773,
0.23060673475265503,
0.20078730583190918,
0.0978599488735199,
0.4081539809703827,
0.08435465395450592,
0.26157498359680176,
0.026359327137470245,
-0.016058051958680153,
-0.09524741023778915,
-0.19634290039539337,
-0.5441904664039612,
-0.06979077309370041,
-0.23005294799804688,
0.47970032691955566,
-0.2050441950559616,
-0.17903532087802887,
-0.04985557496547699,
-0.08081233501434326,
-0.04559389874339104,
0.21613672375679016,
0.619709312915802,
-0.08433903753757477,
0.03387746959924698,
0.1204904317855835,
0.31828367710113525,
-0.11680151522159576,
0.1911226063966751,
0.04757927358150482,
-0.06042690947651863,
-0.08892598003149033,
0.17952533066272736,
0.5387117862701416,
-0.37219706177711487,
0.3424330949783325,
0.1996888369321823,
0.46710360050201416,
-0.19052858650684357,
-0.1514507532119751,
-0.18654794991016388,
-0.01740100234746933,
0.18869464099407196,
0.007627781480550766,
0.04194001853466034,
0.24052883684635162,
-0.15900498628616333,
-0.11470441520214081,
0.09400743246078491,
-0.2652539610862732,
-0.09384723007678986,
0.03227796033024788,
0.04484368488192558,
-0.09525851160287857,
-0.2330176830291748,
-0.3073217272758484,
0.09292526543140411,
0.037364594638347626,
-0.10542857646942139,
0.09388474375009537,
-0.18031029403209686,
-0.23808330297470093,
-0.1588560938835144,
0.271628737449646,
0.6603160500526428,
-0.29885390400886536,
-0.14544497430324554,
0.32554319500923157,
-0.12255604565143585,
-0.11927320808172226,
0.2550254762172699,
-0.09432854503393173,
0.009946838021278381,
-0.26102373003959656,
0.19931451976299286,
0.18748818337917328,
-0.4092429578304291,
-0.14655740559101105,
0.396353542804718,
0.058407098054885864,
0.13573025166988373,
0.20805758237838745,
0.06181078031659126,
0.04158390685915947,
0.04601143300533295,
0.28067803382873535,
0.008305852301418781,
0.10472077131271362,
-0.09153573960065842,
-0.003415212035179138,
-0.20375406742095947,
0.09107531607151031,
0.3670077919960022,
-0.21133868396282196,
0.05503413826227188,
0.10750479996204376,
-0.11178306490182877,
0.17654049396514893,
-0.10396623611450195,
-0.03444817662239075,
0.5095411539077759,
0.13623763620853424,
0.32014578580856323,
0.07939956337213516,
-0.21166938543319702,
-0.5979294180870056,
0.13661986589431763,
0.2275741994380951,
-0.053531721234321594,
-0.26386529207229614,
-0.09572690725326538,
-0.1770210564136505,
0.060134559869766235,
-0.20953930914402008,
-0.014112904667854309,
-0.07209601998329163,
0.15332286059856415,
0.2246880829334259,
0.0292828232049942,
-0.2047475129365921,
0.4062136113643646,
-0.16938132047653198,
0.245487779378891,
-0.2644481062889099,
0.17883147299289703,
-0.03566547483205795,
-0.20230185985565186,
-0.05179573595523834,
0.1018906682729721,
-0.004675917327404022,
-0.2937566936016083,
0.09547410160303116,
0.46329742670059204,
0.05469230189919472,
0.08568492531776428,
-0.18478921055793762,
-0.09530840814113617,
0.22696512937545776,
-0.08083350211381912,
-0.027376921847462654,
0.29197049140930176,
0.20263512432575226,
-0.19178074598312378,
-0.2744138240814209,
0.19127023220062256,
-0.33558428287506104,
0.16342973709106445,
0.029872238636016846,
-0.10833264142274857,
-0.048433803021907806,
0.10796989500522614,
-0.30235612392425537,
-0.06359688192605972,
0.4508513808250427,
-0.24545635282993317,
0.26050445437431335,
0.001822158694267273,
-0.4244135022163391,
-0.2174912393093109,
0.41966497898101807,
-0.04605230689048767,
0.1226552426815033,
0.18774020671844482,
-0.21470129489898682,
0.2120124101638794,
-0.08776815235614777,
-0.041977427899837494,
0.5764286518096924,
0.1378009170293808,
-0.29834991693496704,
0.22981514036655426,
-0.11662109941244125,
-0.22127966582775116,
0.28909584879875183,
-0.04727776348590851,
-0.0982486680150032,
0.09601173549890518,
-0.1998824030160904,
0.008325614035129547,
-0.26002970337867737,
-0.06789300590753555,
-0.10154349356889725,
0.07152579724788666,
-0.412751168012619,
0.22236080467700958,
-0.3261348307132721,
-0.16208136081695557,
-0.353361576795578,
0.11997043341398239,
-0.29344743490219116,
-0.035253237932920456,
-0.2882404327392578,
0.2256356030702591,
0.16318251192569733,
0.036844104528427124,
-0.0255984365940094,
0.00393328070640564,
0.10042867064476013,
-0.5494061708450317,
-0.19856739044189453,
0.008163602091372013,
-0.23089352250099182,
-0.09342408180236816,
0.38237711787223816,
0.044111475348472595,
0.23747751116752625,
-0.3961958587169647,
-0.10942899435758591,
-0.09859373420476913,
-0.1599084585905075,
0.05576726794242859,
-0.06142425537109375,
0.19603170454502106,
0.05316426232457161,
0.22801974415779114,
-0.12375231087207794,
-0.13104702532291412,
0.4299977123737335,
-0.03813391551375389,
-0.1885630488395691,
0.2453443706035614,
0.41844668984413147,
-0.30971813201904297,
-0.2610921263694763,
-0.3623769283294678,
-0.1279265582561493,
-0.2842009663581848,
0.35814857482910156,
0.15591806173324585,
-0.02956918627023697,
0.5024074912071228,
0.42875543236732483,
0.15696276724338531,
-0.18035155534744263,
0.21657925844192505,
0.06529708951711655,
-0.168305441737175,
0.47165095806121826,
-0.16438469290733337,
-0.6319025158882141,
0.07756011188030243,
0.4496116042137146,
-0.2843746244907379,
0.21754126250743866,
-0.4422394633293152,
-0.06208041310310364,
-0.11925515532493591,
0.09208999574184418,
0.04108500853180885,
0.3046550154685974,
0.18646186590194702,
0.08041266351938248,
0.09567829221487045,
-0.05449400842189789,
-0.32142069935798645,
0.11587603390216827,
-0.21104341745376587,
0.03335344046354294,
0.2350960075855255,
0.3713708221912384,
-0.20123478770256042,
0.4552718997001648,
0.3391938805580139,
-0.06640851497650146,
0.2473822683095932,
-0.5043379664421082,
0.5094944834709167,
-0.1640397310256958,
-0.5347826480865479,
0.05617336183786392,
-0.21773487329483032,
0.1750391721725464,
0.27665549516677856,
0.1536443829536438,
0.3985491394996643,
-0.3371798098087311,
0.10423095524311066,
-0.07458600401878357,
-0.19977344572544098,
0.2598342299461365,
-0.11723457276821136,
0.07948076725006104,
-0.1508023738861084,
0.1711592972278595,
0.1823590099811554,
-0.23288646340370178,
0.03903879597783089,
0.6069951057434082,
-0.1873316764831543,
0.051549434661865234,
-0.39870980381965637,
0.0692128986120224,
-0.3697613775730133,
0.3847951889038086,
-0.04406869783997536,
0.3335779309272766,
-0.27299389243125916,
-0.10511372238397598,
0.01776283234357834,
-0.037272900342941284,
0.5544432401657104,
0.3075839877128601,
-0.19523999094963074,
0.017645690590143204,
-0.25824272632598877,
-0.3879300057888031,
0.0970630943775177,
-0.2831108272075653,
0.39122483134269714,
0.17978160083293915,
0.6442822217941284,
-0.30025559663772583,
-0.2145058959722519,
-0.09112641215324402,
0.4764972925186157,
-0.022832082584500313,
-0.31148800253868103,
-0.2785246968269348,
-0.16343708336353302,
-0.32626476883888245,
-0.24235379695892334,
0.02418855018913746,
0.2216685563325882,
-0.18151506781578064,
0.2211252897977829,
-0.05780911445617676,
-0.1648257076740265,
0.2988143563270569,
-0.030988162383437157,
0.2692626416683197,
-0.32836395502090454,
0.23207390308380127,
0.10623225569725037,
0.4693126380443573,
0.29696276783943176,
0.551525890827179,
-0.08975723385810852,
-0.46018892526626587,
0.020805126056075096,
-0.15819226205348969,
0.3489820659160614,
0.16609907150268555,
-0.27159419655799866,
0.14265033602714539,
0.2977319359779358,
0.11018599569797516,
-0.4385163486003876,
-0.0669691190123558,
0.5130975842475891,
0.2113116830587387,
-0.2971879243850708,
-0.4682973325252533,
0.36469128727912903,
0.028174743056297302,
0.14996710419654846,
0.27160051465034485,
0.17438693344593048,
-0.29298001527786255,
0.018115131184458733,
-0.3032904863357544,
0.8145564794540405,
-0.13513001799583435,
0.4673895835876465,
0.23452234268188477,
-0.08719875663518906,
0.397825688123703,
-0.053324341773986816,
0.06563602387905121,
-0.2903502881526947,
-0.014762661419808865,
-0.012935230508446693,
-0.17483539879322052,
0.4434725344181061,
0.17013514041900635,
-0.4242365062236786,
0.21922776103019714,
-0.013385012745857239,
0.31011340022087097,
-0.2710381746292114,
0.18515266478061676,
-0.4233771562576294,
-0.30676761269569397,
-0.34613505005836487,
0.03141036629676819,
0.14703771471977234,
0.3159361481666565,
-0.019304631277918816,
0.068677619099617,
-0.17888011038303375,
-0.2796393632888794,
-0.3666660785675049,
0.05740419775247574,
-0.32172903418540955,
0.05843834578990936,
0.21080191433429718,
-0.34539371728897095,
0.3396162986755371,
0.44701316952705383,
0.2227247804403305,
0.12587442994117737,
-0.16990654170513153,
-0.088034987449646,
-0.22852873802185059,
-0.10756894946098328,
0.001793119590729475,
-0.2334613800048828,
0.025620169937610626,
0.08667146414518356,
-0.27068498730659485,
-0.034228309988975525,
-0.0761411264538765,
-0.1780477911233902,
-0.011277124285697937,
0.13029271364212036,
-0.35141658782958984,
-0.4001733064651489,
-0.4443773031234741,
-0.16439521312713623,
0.1622946709394455,
-0.062214985489845276,
0.012506451457738876,
0.12515521049499512,
0.15351563692092896,
0.04247341305017471,
0.08630746603012085,
-0.1513926088809967,
-0.10639512538909912,
0.3808281421661377,
-0.4325576722621918,
-0.2435595542192459,
0.6115918159484863,
0.44780296087265015,
-0.1363862305879593,
-0.2047024667263031,
0.3153444230556488,
-0.02410351298749447,
-0.47063779830932617,
0.060029350221157074,
0.3476565480232239,
0.046982020139694214,
0.021084846928715706,
0.2753243148326874,
0.04095536470413208,
-0.1721467673778534,
0.10798409581184387,
-0.5703993439674377,
-0.3437374532222748,
0.19584468007087708,
0.29915693402290344,
0.13245421648025513,
0.22470954060554504,
-0.15168331563472748,
-0.01446075364947319,
-0.21246680617332458,
-0.1799510419368744,
0.028362778946757317,
0.07118233293294907,
-0.20901280641555786,
0.4280432164669037,
0.08135491609573364,
0.34466132521629333,
-0.242889866232872,
0.018016835674643517,
-0.008255444467067719,
0.06141901761293411,
-0.055910781025886536,
-0.13231714069843292,
0.13573800027370453,
-0.07649707794189453,
-0.18019047379493713,
-0.16954435408115387,
-0.3009037971496582,
-0.005444547161459923,
-0.30615487694740295,
0.1830039918422699,
0.4905685782432556,
-0.13221722841262817,
0.16604216396808624,
-0.2308713048696518,
0.24027419090270996,
-0.3294675946235657,
0.2159643918275833,
-0.33016255497932434,
0.3099440634250641,
0.11999452114105225,
0.06452429294586182,
-0.0035629512276500463,
0.07621486485004425,
-0.17964790761470795,
0.28044652938842773,
0.19380606710910797,
-0.08764828741550446,
0.2333926260471344,
-0.41730326414108276,
0.1791359931230545,
-0.1308647096157074,
0.4586465358734131,
0.6418233513832092,
-0.2389523833990097,
0.17709243297576904,
0.323751300573349,
0.0375068373978138,
-0.10668563842773438,
0.025385616347193718,
0.1342611461877823,
-0.07563222944736481,
0.05577952042222023,
0.2839002311229706,
-0.10994723439216614,
-0.07677105069160461,
0.014085404574871063,
0.04201062023639679,
0.3017368018627167,
0.1350492686033249,
0.04224539175629616,
0.31792572140693665,
0.28218626976013184,
0.21729479730129242,
-0.07895780354738235,
0.3243650197982788,
0.168809711933136,
0.3248772621154785,
-0.12702417373657227,
0.12640246748924255,
-0.18793323636054993,
0.3269268870353699,
-0.05856538563966751,
-0.3316076695919037,
0.12361234426498413,
0.054044149816036224,
-0.2286888062953949,
0.0388123095035553,
-0.21605685353279114,
0.5491749048233032,
-0.5157119035720825,
-0.009049078449606895,
-0.1283322274684906,
0.06846510618925095,
-0.050738804042339325,
-0.3157408833503723,
0.03204023092985153,
-0.23804622888565063,
-0.031142953783273697,
0.02466117963194847,
-0.0586087740957737,
-0.13547711074352264,
0.06375180184841156,
0.12601828575134277,
-0.033776625990867615,
-0.3310146629810333,
0.12166766077280045,
0.017429785802960396,
0.014899447560310364,
0.004908401519060135,
0.271010160446167,
0.15193212032318115,
0.21965689957141876,
0.3230520784854889,
0.3475780189037323,
0.5777649283409119,
0.4073307514190674,
0.10604949295520782,
0.24757611751556396,
-0.26939257979393005,
-0.012606486678123474,
-0.03941423445940018,
0.3580523133277893,
0.11281471699476242,
0.037804875522851944,
0.21644532680511475,
0.0713128075003624,
-0.03739205747842789,
-0.05451435223221779,
0.0653119832277298,
-0.11782512068748474,
-0.29895487427711487,
0.23282304406166077,
-0.2536523938179016,
-0.12917304039001465,
-0.17007729411125183,
-0.04674641042947769,
-0.44124355912208557,
-0.03883911296725273,
0.5237541794776917,
0.26585763692855835,
0.1927785575389862,
-0.042704228311777115,
0.02653927356004715,
0.3400239050388336,
0.4671337604522705,
0.38308992981910706,
0.23772022128105164,
-0.057062745094299316,
-0.011146128177642822,
-0.6012915968894958,
-0.011561572551727295,
0.009720947593450546,
-0.13737620413303375,
-0.2386874556541443,
-0.1536639928817749,
0.19780229032039642,
0.15514986217021942,
0.052321359515190125,
-0.1281723529100418,
0.2108141928911209,
-0.012030869722366333,
-0.05344913899898529,
-0.1669253706932068,
-0.015177987515926361,
0.13818711042404175,
0.004907839000225067,
-0.3023654520511627,
0.06138338893651962,
-0.10898315161466599,
-0.05648649111390114,
-0.3146934509277344,
0.42382538318634033,
-0.10585279762744904,
-0.33554357290267944,
0.13646440207958221,
-0.07306482642889023,
0.4701797068119049,
0.04250940680503845,
-0.16549621522426605,
-0.17986448109149933,
-0.23826564848423004,
0.021349098533391953,
0.43025344610214233,
0.15453454852104187,
0.005093453451991081,
-0.4908643364906311,
-0.49262502789497375,
-0.2662898600101471,
0.24394312500953674,
-0.059263601899147034,
-0.37303411960601807,
0.02461392618715763,
-0.018650636076927185,
-0.03545805811882019,
0.001153341494500637,
0.23331274092197418,
0.47853729128837585,
-0.27210986614227295,
0.010619590058922768,
-0.14781954884529114,
-0.12781193852424622,
0.3023917078971863,
-0.4510454535484314,
-0.2669309973716736,
0.030796915292739868,
0.008957751095294952,
0.015702150762081146,
0.049648672342300415,
-0.5663859248161316,
0.12508678436279297,
0.13597729802131653,
-0.10330649465322495,
-0.13997501134872437,
0.053034666925668716,
-0.18257488310337067,
-0.03638375550508499,
-0.1389525681734085,
0.454903244972229,
0.08838391304016113,
-0.25883957743644714,
0.09736847877502441,
-0.20569591224193573
] |
https://github.com/huggingface/datasets/issues/622 | load_dataset for text files not working | @banunitte Please do not post screenshots in the future but copy-paste your code and the errors. That allows others to copy-and-paste your code and test it. You may also want to provide the Python version that you are using. | Trying the following snippet, I get different problems on Linux and Windows.
```python
dataset = load_dataset("text", data_files="data.txt")
# or
dataset = load_dataset("text", data_files=["data.txt"])
```
(ps [This example](https://huggingface.co/docs/datasets/loading_datasets.html#json-files) shows that you can use a string as input for data_files, but the signature is `Union[Dict, List]`.)
The problem on Linux is that the script crashes with a CSV error (even though it isn't a CSV file). On Windows the script just seems to freeze or get stuck after loading the config file.
Linux stack trace:
```
PyTorch version 1.6.0+cu101 available.
Checking /home/bram/.cache/huggingface/datasets/b1d50a0e74da9a7b9822cea8ff4e4f217dd892e09eb14f6274a2169e5436e2ea.30c25842cda32b0540d88b7195147decf9671ee442f4bc2fb6ad74016852978e.py for additional imports.
Found main folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text
Found specific version folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7
Found script file from https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py to /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py
Couldn't find dataset infos file at https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/dataset_infos.json
Found metadata file for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.json
Using custom data configuration default
Generating dataset text (/home/bram/.cache/huggingface/datasets/text/default-0907112cc6cd2a38/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7)
Downloading and preparing dataset text/default-0907112cc6cd2a38 (download: Unknown size, generated: Unknown size, post-processed: Unknown size, total: Unknown size) to /home/bram/.cache/huggingface/datasets/text/default-0907112cc6cd2a38/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7...
Dataset not on Hf google storage. Downloading and preparing it from source
Downloading took 0.0 min
Checksum Computation took 0.0 min
Unable to verify checksums.
Generating split train
Traceback (most recent call last):
File "/home/bram/Python/projects/dutch-simplification/utils.py", line 45, in prepare_data
dataset = load_dataset("text", data_files=dataset_f)
File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/load.py", line 608, in load_dataset
builder_instance.download_and_prepare(
File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 468, in download_and_prepare
self._download_and_prepare(
File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 546, in _download_and_prepare
self._prepare_split(split_generator, **prepare_split_kwargs)
File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 888, in _prepare_split
for key, table in utils.tqdm(generator, unit=" tables", leave=False, disable=not_verbose):
File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/tqdm/std.py", line 1130, in __iter__
for obj in iterable:
File "/home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py", line 100, in _generate_tables
pa_table = pac.read_csv(
File "pyarrow/_csv.pyx", line 714, in pyarrow._csv.read_csv
File "pyarrow/error.pxi", line 122, in pyarrow.lib.pyarrow_internal_check_status
File "pyarrow/error.pxi", line 84, in pyarrow.lib.check_status
pyarrow.lib.ArrowInvalid: CSV parse error: Expected 1 columns, got 2
```
Windows just seems to get stuck. Even with a tiny dataset of 10 lines, it has been stuck for 15 minutes already at this message:
```
Checking C:\Users\bramv\.cache\huggingface\datasets\b1d50a0e74da9a7b9822cea8ff4e4f217dd892e09eb14f6274a2169e5436e2ea.30c25842cda32b0540d88b7195147decf9671ee442f4bc2fb6ad74016852978e.py for additional imports.
Found main folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text
Found specific version folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7
Found script file from https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py to C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7\text.py
Couldn't find dataset infos file at https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text\dataset_infos.json
Found metadata file for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7\text.json
Using custom data configuration default
```
| 39 | load_dataset for text files not working
Trying the following snippet, I get different problems on Linux and Windows.
```python
dataset = load_dataset("text", data_files="data.txt")
# or
dataset = load_dataset("text", data_files=["data.txt"])
```
(ps [This example](https://huggingface.co/docs/datasets/loading_datasets.html#json-files) shows that you can use a string as input for data_files, but the signature is `Union[Dict, List]`.)
The problem on Linux is that the script crashes with a CSV error (even though it isn't a CSV file). On Windows the script just seems to freeze or get stuck after loading the config file.
Linux stack trace:
```
PyTorch version 1.6.0+cu101 available.
Checking /home/bram/.cache/huggingface/datasets/b1d50a0e74da9a7b9822cea8ff4e4f217dd892e09eb14f6274a2169e5436e2ea.30c25842cda32b0540d88b7195147decf9671ee442f4bc2fb6ad74016852978e.py for additional imports.
Found main folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text
Found specific version folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7
Found script file from https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py to /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py
Couldn't find dataset infos file at https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/dataset_infos.json
Found metadata file for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.json
Using custom data configuration default
Generating dataset text (/home/bram/.cache/huggingface/datasets/text/default-0907112cc6cd2a38/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7)
Downloading and preparing dataset text/default-0907112cc6cd2a38 (download: Unknown size, generated: Unknown size, post-processed: Unknown size, total: Unknown size) to /home/bram/.cache/huggingface/datasets/text/default-0907112cc6cd2a38/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7...
Dataset not on Hf google storage. Downloading and preparing it from source
Downloading took 0.0 min
Checksum Computation took 0.0 min
Unable to verify checksums.
Generating split train
Traceback (most recent call last):
File "/home/bram/Python/projects/dutch-simplification/utils.py", line 45, in prepare_data
dataset = load_dataset("text", data_files=dataset_f)
File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/load.py", line 608, in load_dataset
builder_instance.download_and_prepare(
File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 468, in download_and_prepare
self._download_and_prepare(
File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 546, in _download_and_prepare
self._prepare_split(split_generator, **prepare_split_kwargs)
File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 888, in _prepare_split
for key, table in utils.tqdm(generator, unit=" tables", leave=False, disable=not_verbose):
File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/tqdm/std.py", line 1130, in __iter__
for obj in iterable:
File "/home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py", line 100, in _generate_tables
pa_table = pac.read_csv(
File "pyarrow/_csv.pyx", line 714, in pyarrow._csv.read_csv
File "pyarrow/error.pxi", line 122, in pyarrow.lib.pyarrow_internal_check_status
File "pyarrow/error.pxi", line 84, in pyarrow.lib.check_status
pyarrow.lib.ArrowInvalid: CSV parse error: Expected 1 columns, got 2
```
Windows just seems to get stuck. Even with a tiny dataset of 10 lines, it has been stuck for 15 minutes already at this message:
```
Checking C:\Users\bramv\.cache\huggingface\datasets\b1d50a0e74da9a7b9822cea8ff4e4f217dd892e09eb14f6274a2169e5436e2ea.30c25842cda32b0540d88b7195147decf9671ee442f4bc2fb6ad74016852978e.py for additional imports.
Found main folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text
Found specific version folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7
Found script file from https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py to C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7\text.py
Couldn't find dataset infos file at https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text\dataset_infos.json
Found metadata file for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7\text.json
Using custom data configuration default
```
@banunitte Please do not post screenshots in the future but copy-paste your code and the errors. That allows others to copy-and-paste your code and test it. You may also want to provide the Python version that you are using. | [
-0.27466508746147156,
-0.4020572602748871,
0.01756073161959648,
0.38725215196609497,
0.26964259147644043,
-0.038661353290081024,
0.318887859582901,
-0.05435653403401375,
0.4263593256473541,
-0.058048903942108154,
0.06597194820642471,
0.14552471041679382,
-0.15576286613941193,
0.27420055866241455,
0.06355622410774231,
-0.03507590293884277,
0.15718327462673187,
-0.013841032981872559,
-0.29144343733787537,
0.04024842381477356,
-0.11445463448762894,
0.34312117099761963,
-0.2153358906507492,
-0.14693012833595276,
-0.4160703420639038,
0.27400466799736023,
-0.10501692444086075,
0.453878253698349,
-0.07426194846630096,
-0.2378564178943634,
0.2710002362728119,
0.12820816040039062,
0.16396383941173553,
0.6136502027511597,
-0.00012696169142145663,
0.11003263294696808,
0.27564769983291626,
-0.16101115942001343,
-0.2998278737068176,
-0.5695475935935974,
0.15851548314094543,
-0.22943682968616486,
0.20884843170642853,
-0.02878069132566452,
0.13019275665283203,
-0.00452867615967989,
0.1527262032032013,
-0.3340619206428528,
0.3551647365093231,
0.325478196144104,
0.1009778082370758,
0.31933706998825073,
0.062094781547784805,
-0.014658169820904732,
0.06096186861395836,
0.476550817489624,
-0.09174498170614243,
0.39064982533454895,
0.3137863278388977,
-0.19428719580173492,
0.11695243418216705,
-0.08240078389644623,
-0.17309308052062988,
-0.16965323686599731,
0.3285274803638458,
0.28717073798179626,
-0.6134480834007263,
-0.20572631061077118,
0.07684162259101868,
0.18599191308021545,
0.43523305654525757,
-0.43391847610473633,
-0.22174830734729767,
-0.15912951529026031,
-0.0756906047463417,
-0.12547838687896729,
0.4388751983642578,
0.1783991903066635,
-0.19857299327850342,
0.058120787143707275,
-0.25035667419433594,
-0.06923972815275192,
-0.1769828498363495,
0.32306575775146484,
-0.008430525660514832,
0.050888918340206146,
-0.21918228268623352,
0.10400895774364471,
0.3328261077404022,
-0.07093829661607742,
-0.20637576282024384,
-0.2793428301811218,
-0.029353488236665726,
0.06112753972411156,
-0.26616689562797546,
0.15572930872440338,
-0.26587602496147156,
-0.02452719211578369,
0.11175438016653061,
0.17476198077201843,
-0.004768398590385914,
0.14171989262104034,
0.09514429420232773,
0.23060673475265503,
0.20078730583190918,
0.0978599488735199,
0.4081539809703827,
0.08435465395450592,
0.26157498359680176,
0.026359327137470245,
-0.016058051958680153,
-0.09524741023778915,
-0.19634290039539337,
-0.5441904664039612,
-0.06979077309370041,
-0.23005294799804688,
0.47970032691955566,
-0.2050441950559616,
-0.17903532087802887,
-0.04985557496547699,
-0.08081233501434326,
-0.04559389874339104,
0.21613672375679016,
0.619709312915802,
-0.08433903753757477,
0.03387746959924698,
0.1204904317855835,
0.31828367710113525,
-0.11680151522159576,
0.1911226063966751,
0.04757927358150482,
-0.06042690947651863,
-0.08892598003149033,
0.17952533066272736,
0.5387117862701416,
-0.37219706177711487,
0.3424330949783325,
0.1996888369321823,
0.46710360050201416,
-0.19052858650684357,
-0.1514507532119751,
-0.18654794991016388,
-0.01740100234746933,
0.18869464099407196,
0.007627781480550766,
0.04194001853466034,
0.24052883684635162,
-0.15900498628616333,
-0.11470441520214081,
0.09400743246078491,
-0.2652539610862732,
-0.09384723007678986,
0.03227796033024788,
0.04484368488192558,
-0.09525851160287857,
-0.2330176830291748,
-0.3073217272758484,
0.09292526543140411,
0.037364594638347626,
-0.10542857646942139,
0.09388474375009537,
-0.18031029403209686,
-0.23808330297470093,
-0.1588560938835144,
0.271628737449646,
0.6603160500526428,
-0.29885390400886536,
-0.14544497430324554,
0.32554319500923157,
-0.12255604565143585,
-0.11927320808172226,
0.2550254762172699,
-0.09432854503393173,
0.009946838021278381,
-0.26102373003959656,
0.19931451976299286,
0.18748818337917328,
-0.4092429578304291,
-0.14655740559101105,
0.396353542804718,
0.058407098054885864,
0.13573025166988373,
0.20805758237838745,
0.06181078031659126,
0.04158390685915947,
0.04601143300533295,
0.28067803382873535,
0.008305852301418781,
0.10472077131271362,
-0.09153573960065842,
-0.003415212035179138,
-0.20375406742095947,
0.09107531607151031,
0.3670077919960022,
-0.21133868396282196,
0.05503413826227188,
0.10750479996204376,
-0.11178306490182877,
0.17654049396514893,
-0.10396623611450195,
-0.03444817662239075,
0.5095411539077759,
0.13623763620853424,
0.32014578580856323,
0.07939956337213516,
-0.21166938543319702,
-0.5979294180870056,
0.13661986589431763,
0.2275741994380951,
-0.053531721234321594,
-0.26386529207229614,
-0.09572690725326538,
-0.1770210564136505,
0.060134559869766235,
-0.20953930914402008,
-0.014112904667854309,
-0.07209601998329163,
0.15332286059856415,
0.2246880829334259,
0.0292828232049942,
-0.2047475129365921,
0.4062136113643646,
-0.16938132047653198,
0.245487779378891,
-0.2644481062889099,
0.17883147299289703,
-0.03566547483205795,
-0.20230185985565186,
-0.05179573595523834,
0.1018906682729721,
-0.004675917327404022,
-0.2937566936016083,
0.09547410160303116,
0.46329742670059204,
0.05469230189919472,
0.08568492531776428,
-0.18478921055793762,
-0.09530840814113617,
0.22696512937545776,
-0.08083350211381912,
-0.027376921847462654,
0.29197049140930176,
0.20263512432575226,
-0.19178074598312378,
-0.2744138240814209,
0.19127023220062256,
-0.33558428287506104,
0.16342973709106445,
0.029872238636016846,
-0.10833264142274857,
-0.048433803021907806,
0.10796989500522614,
-0.30235612392425537,
-0.06359688192605972,
0.4508513808250427,
-0.24545635282993317,
0.26050445437431335,
0.001822158694267273,
-0.4244135022163391,
-0.2174912393093109,
0.41966497898101807,
-0.04605230689048767,
0.1226552426815033,
0.18774020671844482,
-0.21470129489898682,
0.2120124101638794,
-0.08776815235614777,
-0.041977427899837494,
0.5764286518096924,
0.1378009170293808,
-0.29834991693496704,
0.22981514036655426,
-0.11662109941244125,
-0.22127966582775116,
0.28909584879875183,
-0.04727776348590851,
-0.0982486680150032,
0.09601173549890518,
-0.1998824030160904,
0.008325614035129547,
-0.26002970337867737,
-0.06789300590753555,
-0.10154349356889725,
0.07152579724788666,
-0.412751168012619,
0.22236080467700958,
-0.3261348307132721,
-0.16208136081695557,
-0.353361576795578,
0.11997043341398239,
-0.29344743490219116,
-0.035253237932920456,
-0.2882404327392578,
0.2256356030702591,
0.16318251192569733,
0.036844104528427124,
-0.0255984365940094,
0.00393328070640564,
0.10042867064476013,
-0.5494061708450317,
-0.19856739044189453,
0.008163602091372013,
-0.23089352250099182,
-0.09342408180236816,
0.38237711787223816,
0.044111475348472595,
0.23747751116752625,
-0.3961958587169647,
-0.10942899435758591,
-0.09859373420476913,
-0.1599084585905075,
0.05576726794242859,
-0.06142425537109375,
0.19603170454502106,
0.05316426232457161,
0.22801974415779114,
-0.12375231087207794,
-0.13104702532291412,
0.4299977123737335,
-0.03813391551375389,
-0.1885630488395691,
0.2453443706035614,
0.41844668984413147,
-0.30971813201904297,
-0.2610921263694763,
-0.3623769283294678,
-0.1279265582561493,
-0.2842009663581848,
0.35814857482910156,
0.15591806173324585,
-0.02956918627023697,
0.5024074912071228,
0.42875543236732483,
0.15696276724338531,
-0.18035155534744263,
0.21657925844192505,
0.06529708951711655,
-0.168305441737175,
0.47165095806121826,
-0.16438469290733337,
-0.6319025158882141,
0.07756011188030243,
0.4496116042137146,
-0.2843746244907379,
0.21754126250743866,
-0.4422394633293152,
-0.06208041310310364,
-0.11925515532493591,
0.09208999574184418,
0.04108500853180885,
0.3046550154685974,
0.18646186590194702,
0.08041266351938248,
0.09567829221487045,
-0.05449400842189789,
-0.32142069935798645,
0.11587603390216827,
-0.21104341745376587,
0.03335344046354294,
0.2350960075855255,
0.3713708221912384,
-0.20123478770256042,
0.4552718997001648,
0.3391938805580139,
-0.06640851497650146,
0.2473822683095932,
-0.5043379664421082,
0.5094944834709167,
-0.1640397310256958,
-0.5347826480865479,
0.05617336183786392,
-0.21773487329483032,
0.1750391721725464,
0.27665549516677856,
0.1536443829536438,
0.3985491394996643,
-0.3371798098087311,
0.10423095524311066,
-0.07458600401878357,
-0.19977344572544098,
0.2598342299461365,
-0.11723457276821136,
0.07948076725006104,
-0.1508023738861084,
0.1711592972278595,
0.1823590099811554,
-0.23288646340370178,
0.03903879597783089,
0.6069951057434082,
-0.1873316764831543,
0.051549434661865234,
-0.39870980381965637,
0.0692128986120224,
-0.3697613775730133,
0.3847951889038086,
-0.04406869783997536,
0.3335779309272766,
-0.27299389243125916,
-0.10511372238397598,
0.01776283234357834,
-0.037272900342941284,
0.5544432401657104,
0.3075839877128601,
-0.19523999094963074,
0.017645690590143204,
-0.25824272632598877,
-0.3879300057888031,
0.0970630943775177,
-0.2831108272075653,
0.39122483134269714,
0.17978160083293915,
0.6442822217941284,
-0.30025559663772583,
-0.2145058959722519,
-0.09112641215324402,
0.4764972925186157,
-0.022832082584500313,
-0.31148800253868103,
-0.2785246968269348,
-0.16343708336353302,
-0.32626476883888245,
-0.24235379695892334,
0.02418855018913746,
0.2216685563325882,
-0.18151506781578064,
0.2211252897977829,
-0.05780911445617676,
-0.1648257076740265,
0.2988143563270569,
-0.030988162383437157,
0.2692626416683197,
-0.32836395502090454,
0.23207390308380127,
0.10623225569725037,
0.4693126380443573,
0.29696276783943176,
0.551525890827179,
-0.08975723385810852,
-0.46018892526626587,
0.020805126056075096,
-0.15819226205348969,
0.3489820659160614,
0.16609907150268555,
-0.27159419655799866,
0.14265033602714539,
0.2977319359779358,
0.11018599569797516,
-0.4385163486003876,
-0.0669691190123558,
0.5130975842475891,
0.2113116830587387,
-0.2971879243850708,
-0.4682973325252533,
0.36469128727912903,
0.028174743056297302,
0.14996710419654846,
0.27160051465034485,
0.17438693344593048,
-0.29298001527786255,
0.018115131184458733,
-0.3032904863357544,
0.8145564794540405,
-0.13513001799583435,
0.4673895835876465,
0.23452234268188477,
-0.08719875663518906,
0.397825688123703,
-0.053324341773986816,
0.06563602387905121,
-0.2903502881526947,
-0.014762661419808865,
-0.012935230508446693,
-0.17483539879322052,
0.4434725344181061,
0.17013514041900635,
-0.4242365062236786,
0.21922776103019714,
-0.013385012745857239,
0.31011340022087097,
-0.2710381746292114,
0.18515266478061676,
-0.4233771562576294,
-0.30676761269569397,
-0.34613505005836487,
0.03141036629676819,
0.14703771471977234,
0.3159361481666565,
-0.019304631277918816,
0.068677619099617,
-0.17888011038303375,
-0.2796393632888794,
-0.3666660785675049,
0.05740419775247574,
-0.32172903418540955,
0.05843834578990936,
0.21080191433429718,
-0.34539371728897095,
0.3396162986755371,
0.44701316952705383,
0.2227247804403305,
0.12587442994117737,
-0.16990654170513153,
-0.088034987449646,
-0.22852873802185059,
-0.10756894946098328,
0.001793119590729475,
-0.2334613800048828,
0.025620169937610626,
0.08667146414518356,
-0.27068498730659485,
-0.034228309988975525,
-0.0761411264538765,
-0.1780477911233902,
-0.011277124285697937,
0.13029271364212036,
-0.35141658782958984,
-0.4001733064651489,
-0.4443773031234741,
-0.16439521312713623,
0.1622946709394455,
-0.062214985489845276,
0.012506451457738876,
0.12515521049499512,
0.15351563692092896,
0.04247341305017471,
0.08630746603012085,
-0.1513926088809967,
-0.10639512538909912,
0.3808281421661377,
-0.4325576722621918,
-0.2435595542192459,
0.6115918159484863,
0.44780296087265015,
-0.1363862305879593,
-0.2047024667263031,
0.3153444230556488,
-0.02410351298749447,
-0.47063779830932617,
0.060029350221157074,
0.3476565480232239,
0.046982020139694214,
0.021084846928715706,
0.2753243148326874,
0.04095536470413208,
-0.1721467673778534,
0.10798409581184387,
-0.5703993439674377,
-0.3437374532222748,
0.19584468007087708,
0.29915693402290344,
0.13245421648025513,
0.22470954060554504,
-0.15168331563472748,
-0.01446075364947319,
-0.21246680617332458,
-0.1799510419368744,
0.028362778946757317,
0.07118233293294907,
-0.20901280641555786,
0.4280432164669037,
0.08135491609573364,
0.34466132521629333,
-0.242889866232872,
0.018016835674643517,
-0.008255444467067719,
0.06141901761293411,
-0.055910781025886536,
-0.13231714069843292,
0.13573800027370453,
-0.07649707794189453,
-0.18019047379493713,
-0.16954435408115387,
-0.3009037971496582,
-0.005444547161459923,
-0.30615487694740295,
0.1830039918422699,
0.4905685782432556,
-0.13221722841262817,
0.16604216396808624,
-0.2308713048696518,
0.24027419090270996,
-0.3294675946235657,
0.2159643918275833,
-0.33016255497932434,
0.3099440634250641,
0.11999452114105225,
0.06452429294586182,
-0.0035629512276500463,
0.07621486485004425,
-0.17964790761470795,
0.28044652938842773,
0.19380606710910797,
-0.08764828741550446,
0.2333926260471344,
-0.41730326414108276,
0.1791359931230545,
-0.1308647096157074,
0.4586465358734131,
0.6418233513832092,
-0.2389523833990097,
0.17709243297576904,
0.323751300573349,
0.0375068373978138,
-0.10668563842773438,
0.025385616347193718,
0.1342611461877823,
-0.07563222944736481,
0.05577952042222023,
0.2839002311229706,
-0.10994723439216614,
-0.07677105069160461,
0.014085404574871063,
0.04201062023639679,
0.3017368018627167,
0.1350492686033249,
0.04224539175629616,
0.31792572140693665,
0.28218626976013184,
0.21729479730129242,
-0.07895780354738235,
0.3243650197982788,
0.168809711933136,
0.3248772621154785,
-0.12702417373657227,
0.12640246748924255,
-0.18793323636054993,
0.3269268870353699,
-0.05856538563966751,
-0.3316076695919037,
0.12361234426498413,
0.054044149816036224,
-0.2286888062953949,
0.0388123095035553,
-0.21605685353279114,
0.5491749048233032,
-0.5157119035720825,
-0.009049078449606895,
-0.1283322274684906,
0.06846510618925095,
-0.050738804042339325,
-0.3157408833503723,
0.03204023092985153,
-0.23804622888565063,
-0.031142953783273697,
0.02466117963194847,
-0.0586087740957737,
-0.13547711074352264,
0.06375180184841156,
0.12601828575134277,
-0.033776625990867615,
-0.3310146629810333,
0.12166766077280045,
0.017429785802960396,
0.014899447560310364,
0.004908401519060135,
0.271010160446167,
0.15193212032318115,
0.21965689957141876,
0.3230520784854889,
0.3475780189037323,
0.5777649283409119,
0.4073307514190674,
0.10604949295520782,
0.24757611751556396,
-0.26939257979393005,
-0.012606486678123474,
-0.03941423445940018,
0.3580523133277893,
0.11281471699476242,
0.037804875522851944,
0.21644532680511475,
0.0713128075003624,
-0.03739205747842789,
-0.05451435223221779,
0.0653119832277298,
-0.11782512068748474,
-0.29895487427711487,
0.23282304406166077,
-0.2536523938179016,
-0.12917304039001465,
-0.17007729411125183,
-0.04674641042947769,
-0.44124355912208557,
-0.03883911296725273,
0.5237541794776917,
0.26585763692855835,
0.1927785575389862,
-0.042704228311777115,
0.02653927356004715,
0.3400239050388336,
0.4671337604522705,
0.38308992981910706,
0.23772022128105164,
-0.057062745094299316,
-0.011146128177642822,
-0.6012915968894958,
-0.011561572551727295,
0.009720947593450546,
-0.13737620413303375,
-0.2386874556541443,
-0.1536639928817749,
0.19780229032039642,
0.15514986217021942,
0.052321359515190125,
-0.1281723529100418,
0.2108141928911209,
-0.012030869722366333,
-0.05344913899898529,
-0.1669253706932068,
-0.015177987515926361,
0.13818711042404175,
0.004907839000225067,
-0.3023654520511627,
0.06138338893651962,
-0.10898315161466599,
-0.05648649111390114,
-0.3146934509277344,
0.42382538318634033,
-0.10585279762744904,
-0.33554357290267944,
0.13646440207958221,
-0.07306482642889023,
0.4701797068119049,
0.04250940680503845,
-0.16549621522426605,
-0.17986448109149933,
-0.23826564848423004,
0.021349098533391953,
0.43025344610214233,
0.15453454852104187,
0.005093453451991081,
-0.4908643364906311,
-0.49262502789497375,
-0.2662898600101471,
0.24394312500953674,
-0.059263601899147034,
-0.37303411960601807,
0.02461392618715763,
-0.018650636076927185,
-0.03545805811882019,
0.001153341494500637,
0.23331274092197418,
0.47853729128837585,
-0.27210986614227295,
0.010619590058922768,
-0.14781954884529114,
-0.12781193852424622,
0.3023917078971863,
-0.4510454535484314,
-0.2669309973716736,
0.030796915292739868,
0.008957751095294952,
0.015702150762081146,
0.049648672342300415,
-0.5663859248161316,
0.12508678436279297,
0.13597729802131653,
-0.10330649465322495,
-0.13997501134872437,
0.053034666925668716,
-0.18257488310337067,
-0.03638375550508499,
-0.1389525681734085,
0.454903244972229,
0.08838391304016113,
-0.25883957743644714,
0.09736847877502441,
-0.20569591224193573
] |
https://github.com/huggingface/datasets/issues/622 | load_dataset for text files not working | I have the same problem on Linux of the script crashing with a CSV error. This may be caused by 'CRLF', when changed 'CRLF' to 'LF', the problem solved. | Trying the following snippet, I get different problems on Linux and Windows.
```python
dataset = load_dataset("text", data_files="data.txt")
# or
dataset = load_dataset("text", data_files=["data.txt"])
```
(ps [This example](https://huggingface.co/docs/datasets/loading_datasets.html#json-files) shows that you can use a string as input for data_files, but the signature is `Union[Dict, List]`.)
The problem on Linux is that the script crashes with a CSV error (even though it isn't a CSV file). On Windows the script just seems to freeze or get stuck after loading the config file.
Linux stack trace:
```
PyTorch version 1.6.0+cu101 available.
Checking /home/bram/.cache/huggingface/datasets/b1d50a0e74da9a7b9822cea8ff4e4f217dd892e09eb14f6274a2169e5436e2ea.30c25842cda32b0540d88b7195147decf9671ee442f4bc2fb6ad74016852978e.py for additional imports.
Found main folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text
Found specific version folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7
Found script file from https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py to /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py
Couldn't find dataset infos file at https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/dataset_infos.json
Found metadata file for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.json
Using custom data configuration default
Generating dataset text (/home/bram/.cache/huggingface/datasets/text/default-0907112cc6cd2a38/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7)
Downloading and preparing dataset text/default-0907112cc6cd2a38 (download: Unknown size, generated: Unknown size, post-processed: Unknown size, total: Unknown size) to /home/bram/.cache/huggingface/datasets/text/default-0907112cc6cd2a38/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7...
Dataset not on Hf google storage. Downloading and preparing it from source
Downloading took 0.0 min
Checksum Computation took 0.0 min
Unable to verify checksums.
Generating split train
Traceback (most recent call last):
File "/home/bram/Python/projects/dutch-simplification/utils.py", line 45, in prepare_data
dataset = load_dataset("text", data_files=dataset_f)
File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/load.py", line 608, in load_dataset
builder_instance.download_and_prepare(
File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 468, in download_and_prepare
self._download_and_prepare(
File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 546, in _download_and_prepare
self._prepare_split(split_generator, **prepare_split_kwargs)
File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 888, in _prepare_split
for key, table in utils.tqdm(generator, unit=" tables", leave=False, disable=not_verbose):
File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/tqdm/std.py", line 1130, in __iter__
for obj in iterable:
File "/home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py", line 100, in _generate_tables
pa_table = pac.read_csv(
File "pyarrow/_csv.pyx", line 714, in pyarrow._csv.read_csv
File "pyarrow/error.pxi", line 122, in pyarrow.lib.pyarrow_internal_check_status
File "pyarrow/error.pxi", line 84, in pyarrow.lib.check_status
pyarrow.lib.ArrowInvalid: CSV parse error: Expected 1 columns, got 2
```
Windows just seems to get stuck. Even with a tiny dataset of 10 lines, it has been stuck for 15 minutes already at this message:
```
Checking C:\Users\bramv\.cache\huggingface\datasets\b1d50a0e74da9a7b9822cea8ff4e4f217dd892e09eb14f6274a2169e5436e2ea.30c25842cda32b0540d88b7195147decf9671ee442f4bc2fb6ad74016852978e.py for additional imports.
Found main folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text
Found specific version folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7
Found script file from https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py to C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7\text.py
Couldn't find dataset infos file at https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text\dataset_infos.json
Found metadata file for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7\text.json
Using custom data configuration default
```
| 29 | load_dataset for text files not working
Trying the following snippet, I get different problems on Linux and Windows.
```python
dataset = load_dataset("text", data_files="data.txt")
# or
dataset = load_dataset("text", data_files=["data.txt"])
```
(ps [This example](https://huggingface.co/docs/datasets/loading_datasets.html#json-files) shows that you can use a string as input for data_files, but the signature is `Union[Dict, List]`.)
The problem on Linux is that the script crashes with a CSV error (even though it isn't a CSV file). On Windows the script just seems to freeze or get stuck after loading the config file.
Linux stack trace:
```
PyTorch version 1.6.0+cu101 available.
Checking /home/bram/.cache/huggingface/datasets/b1d50a0e74da9a7b9822cea8ff4e4f217dd892e09eb14f6274a2169e5436e2ea.30c25842cda32b0540d88b7195147decf9671ee442f4bc2fb6ad74016852978e.py for additional imports.
Found main folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text
Found specific version folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7
Found script file from https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py to /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py
Couldn't find dataset infos file at https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/dataset_infos.json
Found metadata file for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.json
Using custom data configuration default
Generating dataset text (/home/bram/.cache/huggingface/datasets/text/default-0907112cc6cd2a38/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7)
Downloading and preparing dataset text/default-0907112cc6cd2a38 (download: Unknown size, generated: Unknown size, post-processed: Unknown size, total: Unknown size) to /home/bram/.cache/huggingface/datasets/text/default-0907112cc6cd2a38/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7...
Dataset not on Hf google storage. Downloading and preparing it from source
Downloading took 0.0 min
Checksum Computation took 0.0 min
Unable to verify checksums.
Generating split train
Traceback (most recent call last):
File "/home/bram/Python/projects/dutch-simplification/utils.py", line 45, in prepare_data
dataset = load_dataset("text", data_files=dataset_f)
File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/load.py", line 608, in load_dataset
builder_instance.download_and_prepare(
File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 468, in download_and_prepare
self._download_and_prepare(
File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 546, in _download_and_prepare
self._prepare_split(split_generator, **prepare_split_kwargs)
File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 888, in _prepare_split
for key, table in utils.tqdm(generator, unit=" tables", leave=False, disable=not_verbose):
File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/tqdm/std.py", line 1130, in __iter__
for obj in iterable:
File "/home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py", line 100, in _generate_tables
pa_table = pac.read_csv(
File "pyarrow/_csv.pyx", line 714, in pyarrow._csv.read_csv
File "pyarrow/error.pxi", line 122, in pyarrow.lib.pyarrow_internal_check_status
File "pyarrow/error.pxi", line 84, in pyarrow.lib.check_status
pyarrow.lib.ArrowInvalid: CSV parse error: Expected 1 columns, got 2
```
Windows just seems to get stuck. Even with a tiny dataset of 10 lines, it has been stuck for 15 minutes already at this message:
```
Checking C:\Users\bramv\.cache\huggingface\datasets\b1d50a0e74da9a7b9822cea8ff4e4f217dd892e09eb14f6274a2169e5436e2ea.30c25842cda32b0540d88b7195147decf9671ee442f4bc2fb6ad74016852978e.py for additional imports.
Found main folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text
Found specific version folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7
Found script file from https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py to C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7\text.py
Couldn't find dataset infos file at https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text\dataset_infos.json
Found metadata file for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7\text.json
Using custom data configuration default
```
I have the same problem on Linux of the script crashing with a CSV error. This may be caused by 'CRLF', when changed 'CRLF' to 'LF', the problem solved. | [
-0.27466508746147156,
-0.4020572602748871,
0.01756073161959648,
0.38725215196609497,
0.26964259147644043,
-0.038661353290081024,
0.318887859582901,
-0.05435653403401375,
0.4263593256473541,
-0.058048903942108154,
0.06597194820642471,
0.14552471041679382,
-0.15576286613941193,
0.27420055866241455,
0.06355622410774231,
-0.03507590293884277,
0.15718327462673187,
-0.013841032981872559,
-0.29144343733787537,
0.04024842381477356,
-0.11445463448762894,
0.34312117099761963,
-0.2153358906507492,
-0.14693012833595276,
-0.4160703420639038,
0.27400466799736023,
-0.10501692444086075,
0.453878253698349,
-0.07426194846630096,
-0.2378564178943634,
0.2710002362728119,
0.12820816040039062,
0.16396383941173553,
0.6136502027511597,
-0.00012696169142145663,
0.11003263294696808,
0.27564769983291626,
-0.16101115942001343,
-0.2998278737068176,
-0.5695475935935974,
0.15851548314094543,
-0.22943682968616486,
0.20884843170642853,
-0.02878069132566452,
0.13019275665283203,
-0.00452867615967989,
0.1527262032032013,
-0.3340619206428528,
0.3551647365093231,
0.325478196144104,
0.1009778082370758,
0.31933706998825073,
0.062094781547784805,
-0.014658169820904732,
0.06096186861395836,
0.476550817489624,
-0.09174498170614243,
0.39064982533454895,
0.3137863278388977,
-0.19428719580173492,
0.11695243418216705,
-0.08240078389644623,
-0.17309308052062988,
-0.16965323686599731,
0.3285274803638458,
0.28717073798179626,
-0.6134480834007263,
-0.20572631061077118,
0.07684162259101868,
0.18599191308021545,
0.43523305654525757,
-0.43391847610473633,
-0.22174830734729767,
-0.15912951529026031,
-0.0756906047463417,
-0.12547838687896729,
0.4388751983642578,
0.1783991903066635,
-0.19857299327850342,
0.058120787143707275,
-0.25035667419433594,
-0.06923972815275192,
-0.1769828498363495,
0.32306575775146484,
-0.008430525660514832,
0.050888918340206146,
-0.21918228268623352,
0.10400895774364471,
0.3328261077404022,
-0.07093829661607742,
-0.20637576282024384,
-0.2793428301811218,
-0.029353488236665726,
0.06112753972411156,
-0.26616689562797546,
0.15572930872440338,
-0.26587602496147156,
-0.02452719211578369,
0.11175438016653061,
0.17476198077201843,
-0.004768398590385914,
0.14171989262104034,
0.09514429420232773,
0.23060673475265503,
0.20078730583190918,
0.0978599488735199,
0.4081539809703827,
0.08435465395450592,
0.26157498359680176,
0.026359327137470245,
-0.016058051958680153,
-0.09524741023778915,
-0.19634290039539337,
-0.5441904664039612,
-0.06979077309370041,
-0.23005294799804688,
0.47970032691955566,
-0.2050441950559616,
-0.17903532087802887,
-0.04985557496547699,
-0.08081233501434326,
-0.04559389874339104,
0.21613672375679016,
0.619709312915802,
-0.08433903753757477,
0.03387746959924698,
0.1204904317855835,
0.31828367710113525,
-0.11680151522159576,
0.1911226063966751,
0.04757927358150482,
-0.06042690947651863,
-0.08892598003149033,
0.17952533066272736,
0.5387117862701416,
-0.37219706177711487,
0.3424330949783325,
0.1996888369321823,
0.46710360050201416,
-0.19052858650684357,
-0.1514507532119751,
-0.18654794991016388,
-0.01740100234746933,
0.18869464099407196,
0.007627781480550766,
0.04194001853466034,
0.24052883684635162,
-0.15900498628616333,
-0.11470441520214081,
0.09400743246078491,
-0.2652539610862732,
-0.09384723007678986,
0.03227796033024788,
0.04484368488192558,
-0.09525851160287857,
-0.2330176830291748,
-0.3073217272758484,
0.09292526543140411,
0.037364594638347626,
-0.10542857646942139,
0.09388474375009537,
-0.18031029403209686,
-0.23808330297470093,
-0.1588560938835144,
0.271628737449646,
0.6603160500526428,
-0.29885390400886536,
-0.14544497430324554,
0.32554319500923157,
-0.12255604565143585,
-0.11927320808172226,
0.2550254762172699,
-0.09432854503393173,
0.009946838021278381,
-0.26102373003959656,
0.19931451976299286,
0.18748818337917328,
-0.4092429578304291,
-0.14655740559101105,
0.396353542804718,
0.058407098054885864,
0.13573025166988373,
0.20805758237838745,
0.06181078031659126,
0.04158390685915947,
0.04601143300533295,
0.28067803382873535,
0.008305852301418781,
0.10472077131271362,
-0.09153573960065842,
-0.003415212035179138,
-0.20375406742095947,
0.09107531607151031,
0.3670077919960022,
-0.21133868396282196,
0.05503413826227188,
0.10750479996204376,
-0.11178306490182877,
0.17654049396514893,
-0.10396623611450195,
-0.03444817662239075,
0.5095411539077759,
0.13623763620853424,
0.32014578580856323,
0.07939956337213516,
-0.21166938543319702,
-0.5979294180870056,
0.13661986589431763,
0.2275741994380951,
-0.053531721234321594,
-0.26386529207229614,
-0.09572690725326538,
-0.1770210564136505,
0.060134559869766235,
-0.20953930914402008,
-0.014112904667854309,
-0.07209601998329163,
0.15332286059856415,
0.2246880829334259,
0.0292828232049942,
-0.2047475129365921,
0.4062136113643646,
-0.16938132047653198,
0.245487779378891,
-0.2644481062889099,
0.17883147299289703,
-0.03566547483205795,
-0.20230185985565186,
-0.05179573595523834,
0.1018906682729721,
-0.004675917327404022,
-0.2937566936016083,
0.09547410160303116,
0.46329742670059204,
0.05469230189919472,
0.08568492531776428,
-0.18478921055793762,
-0.09530840814113617,
0.22696512937545776,
-0.08083350211381912,
-0.027376921847462654,
0.29197049140930176,
0.20263512432575226,
-0.19178074598312378,
-0.2744138240814209,
0.19127023220062256,
-0.33558428287506104,
0.16342973709106445,
0.029872238636016846,
-0.10833264142274857,
-0.048433803021907806,
0.10796989500522614,
-0.30235612392425537,
-0.06359688192605972,
0.4508513808250427,
-0.24545635282993317,
0.26050445437431335,
0.001822158694267273,
-0.4244135022163391,
-0.2174912393093109,
0.41966497898101807,
-0.04605230689048767,
0.1226552426815033,
0.18774020671844482,
-0.21470129489898682,
0.2120124101638794,
-0.08776815235614777,
-0.041977427899837494,
0.5764286518096924,
0.1378009170293808,
-0.29834991693496704,
0.22981514036655426,
-0.11662109941244125,
-0.22127966582775116,
0.28909584879875183,
-0.04727776348590851,
-0.0982486680150032,
0.09601173549890518,
-0.1998824030160904,
0.008325614035129547,
-0.26002970337867737,
-0.06789300590753555,
-0.10154349356889725,
0.07152579724788666,
-0.412751168012619,
0.22236080467700958,
-0.3261348307132721,
-0.16208136081695557,
-0.353361576795578,
0.11997043341398239,
-0.29344743490219116,
-0.035253237932920456,
-0.2882404327392578,
0.2256356030702591,
0.16318251192569733,
0.036844104528427124,
-0.0255984365940094,
0.00393328070640564,
0.10042867064476013,
-0.5494061708450317,
-0.19856739044189453,
0.008163602091372013,
-0.23089352250099182,
-0.09342408180236816,
0.38237711787223816,
0.044111475348472595,
0.23747751116752625,
-0.3961958587169647,
-0.10942899435758591,
-0.09859373420476913,
-0.1599084585905075,
0.05576726794242859,
-0.06142425537109375,
0.19603170454502106,
0.05316426232457161,
0.22801974415779114,
-0.12375231087207794,
-0.13104702532291412,
0.4299977123737335,
-0.03813391551375389,
-0.1885630488395691,
0.2453443706035614,
0.41844668984413147,
-0.30971813201904297,
-0.2610921263694763,
-0.3623769283294678,
-0.1279265582561493,
-0.2842009663581848,
0.35814857482910156,
0.15591806173324585,
-0.02956918627023697,
0.5024074912071228,
0.42875543236732483,
0.15696276724338531,
-0.18035155534744263,
0.21657925844192505,
0.06529708951711655,
-0.168305441737175,
0.47165095806121826,
-0.16438469290733337,
-0.6319025158882141,
0.07756011188030243,
0.4496116042137146,
-0.2843746244907379,
0.21754126250743866,
-0.4422394633293152,
-0.06208041310310364,
-0.11925515532493591,
0.09208999574184418,
0.04108500853180885,
0.3046550154685974,
0.18646186590194702,
0.08041266351938248,
0.09567829221487045,
-0.05449400842189789,
-0.32142069935798645,
0.11587603390216827,
-0.21104341745376587,
0.03335344046354294,
0.2350960075855255,
0.3713708221912384,
-0.20123478770256042,
0.4552718997001648,
0.3391938805580139,
-0.06640851497650146,
0.2473822683095932,
-0.5043379664421082,
0.5094944834709167,
-0.1640397310256958,
-0.5347826480865479,
0.05617336183786392,
-0.21773487329483032,
0.1750391721725464,
0.27665549516677856,
0.1536443829536438,
0.3985491394996643,
-0.3371798098087311,
0.10423095524311066,
-0.07458600401878357,
-0.19977344572544098,
0.2598342299461365,
-0.11723457276821136,
0.07948076725006104,
-0.1508023738861084,
0.1711592972278595,
0.1823590099811554,
-0.23288646340370178,
0.03903879597783089,
0.6069951057434082,
-0.1873316764831543,
0.051549434661865234,
-0.39870980381965637,
0.0692128986120224,
-0.3697613775730133,
0.3847951889038086,
-0.04406869783997536,
0.3335779309272766,
-0.27299389243125916,
-0.10511372238397598,
0.01776283234357834,
-0.037272900342941284,
0.5544432401657104,
0.3075839877128601,
-0.19523999094963074,
0.017645690590143204,
-0.25824272632598877,
-0.3879300057888031,
0.0970630943775177,
-0.2831108272075653,
0.39122483134269714,
0.17978160083293915,
0.6442822217941284,
-0.30025559663772583,
-0.2145058959722519,
-0.09112641215324402,
0.4764972925186157,
-0.022832082584500313,
-0.31148800253868103,
-0.2785246968269348,
-0.16343708336353302,
-0.32626476883888245,
-0.24235379695892334,
0.02418855018913746,
0.2216685563325882,
-0.18151506781578064,
0.2211252897977829,
-0.05780911445617676,
-0.1648257076740265,
0.2988143563270569,
-0.030988162383437157,
0.2692626416683197,
-0.32836395502090454,
0.23207390308380127,
0.10623225569725037,
0.4693126380443573,
0.29696276783943176,
0.551525890827179,
-0.08975723385810852,
-0.46018892526626587,
0.020805126056075096,
-0.15819226205348969,
0.3489820659160614,
0.16609907150268555,
-0.27159419655799866,
0.14265033602714539,
0.2977319359779358,
0.11018599569797516,
-0.4385163486003876,
-0.0669691190123558,
0.5130975842475891,
0.2113116830587387,
-0.2971879243850708,
-0.4682973325252533,
0.36469128727912903,
0.028174743056297302,
0.14996710419654846,
0.27160051465034485,
0.17438693344593048,
-0.29298001527786255,
0.018115131184458733,
-0.3032904863357544,
0.8145564794540405,
-0.13513001799583435,
0.4673895835876465,
0.23452234268188477,
-0.08719875663518906,
0.397825688123703,
-0.053324341773986816,
0.06563602387905121,
-0.2903502881526947,
-0.014762661419808865,
-0.012935230508446693,
-0.17483539879322052,
0.4434725344181061,
0.17013514041900635,
-0.4242365062236786,
0.21922776103019714,
-0.013385012745857239,
0.31011340022087097,
-0.2710381746292114,
0.18515266478061676,
-0.4233771562576294,
-0.30676761269569397,
-0.34613505005836487,
0.03141036629676819,
0.14703771471977234,
0.3159361481666565,
-0.019304631277918816,
0.068677619099617,
-0.17888011038303375,
-0.2796393632888794,
-0.3666660785675049,
0.05740419775247574,
-0.32172903418540955,
0.05843834578990936,
0.21080191433429718,
-0.34539371728897095,
0.3396162986755371,
0.44701316952705383,
0.2227247804403305,
0.12587442994117737,
-0.16990654170513153,
-0.088034987449646,
-0.22852873802185059,
-0.10756894946098328,
0.001793119590729475,
-0.2334613800048828,
0.025620169937610626,
0.08667146414518356,
-0.27068498730659485,
-0.034228309988975525,
-0.0761411264538765,
-0.1780477911233902,
-0.011277124285697937,
0.13029271364212036,
-0.35141658782958984,
-0.4001733064651489,
-0.4443773031234741,
-0.16439521312713623,
0.1622946709394455,
-0.062214985489845276,
0.012506451457738876,
0.12515521049499512,
0.15351563692092896,
0.04247341305017471,
0.08630746603012085,
-0.1513926088809967,
-0.10639512538909912,
0.3808281421661377,
-0.4325576722621918,
-0.2435595542192459,
0.6115918159484863,
0.44780296087265015,
-0.1363862305879593,
-0.2047024667263031,
0.3153444230556488,
-0.02410351298749447,
-0.47063779830932617,
0.060029350221157074,
0.3476565480232239,
0.046982020139694214,
0.021084846928715706,
0.2753243148326874,
0.04095536470413208,
-0.1721467673778534,
0.10798409581184387,
-0.5703993439674377,
-0.3437374532222748,
0.19584468007087708,
0.29915693402290344,
0.13245421648025513,
0.22470954060554504,
-0.15168331563472748,
-0.01446075364947319,
-0.21246680617332458,
-0.1799510419368744,
0.028362778946757317,
0.07118233293294907,
-0.20901280641555786,
0.4280432164669037,
0.08135491609573364,
0.34466132521629333,
-0.242889866232872,
0.018016835674643517,
-0.008255444467067719,
0.06141901761293411,
-0.055910781025886536,
-0.13231714069843292,
0.13573800027370453,
-0.07649707794189453,
-0.18019047379493713,
-0.16954435408115387,
-0.3009037971496582,
-0.005444547161459923,
-0.30615487694740295,
0.1830039918422699,
0.4905685782432556,
-0.13221722841262817,
0.16604216396808624,
-0.2308713048696518,
0.24027419090270996,
-0.3294675946235657,
0.2159643918275833,
-0.33016255497932434,
0.3099440634250641,
0.11999452114105225,
0.06452429294586182,
-0.0035629512276500463,
0.07621486485004425,
-0.17964790761470795,
0.28044652938842773,
0.19380606710910797,
-0.08764828741550446,
0.2333926260471344,
-0.41730326414108276,
0.1791359931230545,
-0.1308647096157074,
0.4586465358734131,
0.6418233513832092,
-0.2389523833990097,
0.17709243297576904,
0.323751300573349,
0.0375068373978138,
-0.10668563842773438,
0.025385616347193718,
0.1342611461877823,
-0.07563222944736481,
0.05577952042222023,
0.2839002311229706,
-0.10994723439216614,
-0.07677105069160461,
0.014085404574871063,
0.04201062023639679,
0.3017368018627167,
0.1350492686033249,
0.04224539175629616,
0.31792572140693665,
0.28218626976013184,
0.21729479730129242,
-0.07895780354738235,
0.3243650197982788,
0.168809711933136,
0.3248772621154785,
-0.12702417373657227,
0.12640246748924255,
-0.18793323636054993,
0.3269268870353699,
-0.05856538563966751,
-0.3316076695919037,
0.12361234426498413,
0.054044149816036224,
-0.2286888062953949,
0.0388123095035553,
-0.21605685353279114,
0.5491749048233032,
-0.5157119035720825,
-0.009049078449606895,
-0.1283322274684906,
0.06846510618925095,
-0.050738804042339325,
-0.3157408833503723,
0.03204023092985153,
-0.23804622888565063,
-0.031142953783273697,
0.02466117963194847,
-0.0586087740957737,
-0.13547711074352264,
0.06375180184841156,
0.12601828575134277,
-0.033776625990867615,
-0.3310146629810333,
0.12166766077280045,
0.017429785802960396,
0.014899447560310364,
0.004908401519060135,
0.271010160446167,
0.15193212032318115,
0.21965689957141876,
0.3230520784854889,
0.3475780189037323,
0.5777649283409119,
0.4073307514190674,
0.10604949295520782,
0.24757611751556396,
-0.26939257979393005,
-0.012606486678123474,
-0.03941423445940018,
0.3580523133277893,
0.11281471699476242,
0.037804875522851944,
0.21644532680511475,
0.0713128075003624,
-0.03739205747842789,
-0.05451435223221779,
0.0653119832277298,
-0.11782512068748474,
-0.29895487427711487,
0.23282304406166077,
-0.2536523938179016,
-0.12917304039001465,
-0.17007729411125183,
-0.04674641042947769,
-0.44124355912208557,
-0.03883911296725273,
0.5237541794776917,
0.26585763692855835,
0.1927785575389862,
-0.042704228311777115,
0.02653927356004715,
0.3400239050388336,
0.4671337604522705,
0.38308992981910706,
0.23772022128105164,
-0.057062745094299316,
-0.011146128177642822,
-0.6012915968894958,
-0.011561572551727295,
0.009720947593450546,
-0.13737620413303375,
-0.2386874556541443,
-0.1536639928817749,
0.19780229032039642,
0.15514986217021942,
0.052321359515190125,
-0.1281723529100418,
0.2108141928911209,
-0.012030869722366333,
-0.05344913899898529,
-0.1669253706932068,
-0.015177987515926361,
0.13818711042404175,
0.004907839000225067,
-0.3023654520511627,
0.06138338893651962,
-0.10898315161466599,
-0.05648649111390114,
-0.3146934509277344,
0.42382538318634033,
-0.10585279762744904,
-0.33554357290267944,
0.13646440207958221,
-0.07306482642889023,
0.4701797068119049,
0.04250940680503845,
-0.16549621522426605,
-0.17986448109149933,
-0.23826564848423004,
0.021349098533391953,
0.43025344610214233,
0.15453454852104187,
0.005093453451991081,
-0.4908643364906311,
-0.49262502789497375,
-0.2662898600101471,
0.24394312500953674,
-0.059263601899147034,
-0.37303411960601807,
0.02461392618715763,
-0.018650636076927185,
-0.03545805811882019,
0.001153341494500637,
0.23331274092197418,
0.47853729128837585,
-0.27210986614227295,
0.010619590058922768,
-0.14781954884529114,
-0.12781193852424622,
0.3023917078971863,
-0.4510454535484314,
-0.2669309973716736,
0.030796915292739868,
0.008957751095294952,
0.015702150762081146,
0.049648672342300415,
-0.5663859248161316,
0.12508678436279297,
0.13597729802131653,
-0.10330649465322495,
-0.13997501134872437,
0.053034666925668716,
-0.18257488310337067,
-0.03638375550508499,
-0.1389525681734085,
0.454903244972229,
0.08838391304016113,
-0.25883957743644714,
0.09736847877502441,
-0.20569591224193573
] |
https://github.com/huggingface/datasets/issues/622 | load_dataset for text files not working | I pushed a fix for `pyarrow.lib.ArrowInvalid: CSV parse error`. Let me know if you still have this issue.
Not sure about the windows one yet | Trying the following snippet, I get different problems on Linux and Windows.
```python
dataset = load_dataset("text", data_files="data.txt")
# or
dataset = load_dataset("text", data_files=["data.txt"])
```
(ps [This example](https://huggingface.co/docs/datasets/loading_datasets.html#json-files) shows that you can use a string as input for data_files, but the signature is `Union[Dict, List]`.)
The problem on Linux is that the script crashes with a CSV error (even though it isn't a CSV file). On Windows the script just seems to freeze or get stuck after loading the config file.
Linux stack trace:
```
PyTorch version 1.6.0+cu101 available.
Checking /home/bram/.cache/huggingface/datasets/b1d50a0e74da9a7b9822cea8ff4e4f217dd892e09eb14f6274a2169e5436e2ea.30c25842cda32b0540d88b7195147decf9671ee442f4bc2fb6ad74016852978e.py for additional imports.
Found main folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text
Found specific version folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7
Found script file from https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py to /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py
Couldn't find dataset infos file at https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/dataset_infos.json
Found metadata file for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.json
Using custom data configuration default
Generating dataset text (/home/bram/.cache/huggingface/datasets/text/default-0907112cc6cd2a38/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7)
Downloading and preparing dataset text/default-0907112cc6cd2a38 (download: Unknown size, generated: Unknown size, post-processed: Unknown size, total: Unknown size) to /home/bram/.cache/huggingface/datasets/text/default-0907112cc6cd2a38/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7...
Dataset not on Hf google storage. Downloading and preparing it from source
Downloading took 0.0 min
Checksum Computation took 0.0 min
Unable to verify checksums.
Generating split train
Traceback (most recent call last):
File "/home/bram/Python/projects/dutch-simplification/utils.py", line 45, in prepare_data
dataset = load_dataset("text", data_files=dataset_f)
File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/load.py", line 608, in load_dataset
builder_instance.download_and_prepare(
File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 468, in download_and_prepare
self._download_and_prepare(
File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 546, in _download_and_prepare
self._prepare_split(split_generator, **prepare_split_kwargs)
File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 888, in _prepare_split
for key, table in utils.tqdm(generator, unit=" tables", leave=False, disable=not_verbose):
File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/tqdm/std.py", line 1130, in __iter__
for obj in iterable:
File "/home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py", line 100, in _generate_tables
pa_table = pac.read_csv(
File "pyarrow/_csv.pyx", line 714, in pyarrow._csv.read_csv
File "pyarrow/error.pxi", line 122, in pyarrow.lib.pyarrow_internal_check_status
File "pyarrow/error.pxi", line 84, in pyarrow.lib.check_status
pyarrow.lib.ArrowInvalid: CSV parse error: Expected 1 columns, got 2
```
Windows just seems to get stuck. Even with a tiny dataset of 10 lines, it has been stuck for 15 minutes already at this message:
```
Checking C:\Users\bramv\.cache\huggingface\datasets\b1d50a0e74da9a7b9822cea8ff4e4f217dd892e09eb14f6274a2169e5436e2ea.30c25842cda32b0540d88b7195147decf9671ee442f4bc2fb6ad74016852978e.py for additional imports.
Found main folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text
Found specific version folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7
Found script file from https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py to C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7\text.py
Couldn't find dataset infos file at https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text\dataset_infos.json
Found metadata file for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7\text.json
Using custom data configuration default
```
| 25 | load_dataset for text files not working
Trying the following snippet, I get different problems on Linux and Windows.
```python
dataset = load_dataset("text", data_files="data.txt")
# or
dataset = load_dataset("text", data_files=["data.txt"])
```
(ps [This example](https://huggingface.co/docs/datasets/loading_datasets.html#json-files) shows that you can use a string as input for data_files, but the signature is `Union[Dict, List]`.)
The problem on Linux is that the script crashes with a CSV error (even though it isn't a CSV file). On Windows the script just seems to freeze or get stuck after loading the config file.
Linux stack trace:
```
PyTorch version 1.6.0+cu101 available.
Checking /home/bram/.cache/huggingface/datasets/b1d50a0e74da9a7b9822cea8ff4e4f217dd892e09eb14f6274a2169e5436e2ea.30c25842cda32b0540d88b7195147decf9671ee442f4bc2fb6ad74016852978e.py for additional imports.
Found main folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text
Found specific version folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7
Found script file from https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py to /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py
Couldn't find dataset infos file at https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/dataset_infos.json
Found metadata file for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.json
Using custom data configuration default
Generating dataset text (/home/bram/.cache/huggingface/datasets/text/default-0907112cc6cd2a38/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7)
Downloading and preparing dataset text/default-0907112cc6cd2a38 (download: Unknown size, generated: Unknown size, post-processed: Unknown size, total: Unknown size) to /home/bram/.cache/huggingface/datasets/text/default-0907112cc6cd2a38/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7...
Dataset not on Hf google storage. Downloading and preparing it from source
Downloading took 0.0 min
Checksum Computation took 0.0 min
Unable to verify checksums.
Generating split train
Traceback (most recent call last):
File "/home/bram/Python/projects/dutch-simplification/utils.py", line 45, in prepare_data
dataset = load_dataset("text", data_files=dataset_f)
File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/load.py", line 608, in load_dataset
builder_instance.download_and_prepare(
File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 468, in download_and_prepare
self._download_and_prepare(
File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 546, in _download_and_prepare
self._prepare_split(split_generator, **prepare_split_kwargs)
File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 888, in _prepare_split
for key, table in utils.tqdm(generator, unit=" tables", leave=False, disable=not_verbose):
File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/tqdm/std.py", line 1130, in __iter__
for obj in iterable:
File "/home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py", line 100, in _generate_tables
pa_table = pac.read_csv(
File "pyarrow/_csv.pyx", line 714, in pyarrow._csv.read_csv
File "pyarrow/error.pxi", line 122, in pyarrow.lib.pyarrow_internal_check_status
File "pyarrow/error.pxi", line 84, in pyarrow.lib.check_status
pyarrow.lib.ArrowInvalid: CSV parse error: Expected 1 columns, got 2
```
Windows just seems to get stuck. Even with a tiny dataset of 10 lines, it has been stuck for 15 minutes already at this message:
```
Checking C:\Users\bramv\.cache\huggingface\datasets\b1d50a0e74da9a7b9822cea8ff4e4f217dd892e09eb14f6274a2169e5436e2ea.30c25842cda32b0540d88b7195147decf9671ee442f4bc2fb6ad74016852978e.py for additional imports.
Found main folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text
Found specific version folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7
Found script file from https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py to C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7\text.py
Couldn't find dataset infos file at https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text\dataset_infos.json
Found metadata file for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7\text.json
Using custom data configuration default
```
I pushed a fix for `pyarrow.lib.ArrowInvalid: CSV parse error`. Let me know if you still have this issue.
Not sure about the windows one yet | [
-0.27466508746147156,
-0.4020572602748871,
0.01756073161959648,
0.38725215196609497,
0.26964259147644043,
-0.038661353290081024,
0.318887859582901,
-0.05435653403401375,
0.4263593256473541,
-0.058048903942108154,
0.06597194820642471,
0.14552471041679382,
-0.15576286613941193,
0.27420055866241455,
0.06355622410774231,
-0.03507590293884277,
0.15718327462673187,
-0.013841032981872559,
-0.29144343733787537,
0.04024842381477356,
-0.11445463448762894,
0.34312117099761963,
-0.2153358906507492,
-0.14693012833595276,
-0.4160703420639038,
0.27400466799736023,
-0.10501692444086075,
0.453878253698349,
-0.07426194846630096,
-0.2378564178943634,
0.2710002362728119,
0.12820816040039062,
0.16396383941173553,
0.6136502027511597,
-0.00012696169142145663,
0.11003263294696808,
0.27564769983291626,
-0.16101115942001343,
-0.2998278737068176,
-0.5695475935935974,
0.15851548314094543,
-0.22943682968616486,
0.20884843170642853,
-0.02878069132566452,
0.13019275665283203,
-0.00452867615967989,
0.1527262032032013,
-0.3340619206428528,
0.3551647365093231,
0.325478196144104,
0.1009778082370758,
0.31933706998825073,
0.062094781547784805,
-0.014658169820904732,
0.06096186861395836,
0.476550817489624,
-0.09174498170614243,
0.39064982533454895,
0.3137863278388977,
-0.19428719580173492,
0.11695243418216705,
-0.08240078389644623,
-0.17309308052062988,
-0.16965323686599731,
0.3285274803638458,
0.28717073798179626,
-0.6134480834007263,
-0.20572631061077118,
0.07684162259101868,
0.18599191308021545,
0.43523305654525757,
-0.43391847610473633,
-0.22174830734729767,
-0.15912951529026031,
-0.0756906047463417,
-0.12547838687896729,
0.4388751983642578,
0.1783991903066635,
-0.19857299327850342,
0.058120787143707275,
-0.25035667419433594,
-0.06923972815275192,
-0.1769828498363495,
0.32306575775146484,
-0.008430525660514832,
0.050888918340206146,
-0.21918228268623352,
0.10400895774364471,
0.3328261077404022,
-0.07093829661607742,
-0.20637576282024384,
-0.2793428301811218,
-0.029353488236665726,
0.06112753972411156,
-0.26616689562797546,
0.15572930872440338,
-0.26587602496147156,
-0.02452719211578369,
0.11175438016653061,
0.17476198077201843,
-0.004768398590385914,
0.14171989262104034,
0.09514429420232773,
0.23060673475265503,
0.20078730583190918,
0.0978599488735199,
0.4081539809703827,
0.08435465395450592,
0.26157498359680176,
0.026359327137470245,
-0.016058051958680153,
-0.09524741023778915,
-0.19634290039539337,
-0.5441904664039612,
-0.06979077309370041,
-0.23005294799804688,
0.47970032691955566,
-0.2050441950559616,
-0.17903532087802887,
-0.04985557496547699,
-0.08081233501434326,
-0.04559389874339104,
0.21613672375679016,
0.619709312915802,
-0.08433903753757477,
0.03387746959924698,
0.1204904317855835,
0.31828367710113525,
-0.11680151522159576,
0.1911226063966751,
0.04757927358150482,
-0.06042690947651863,
-0.08892598003149033,
0.17952533066272736,
0.5387117862701416,
-0.37219706177711487,
0.3424330949783325,
0.1996888369321823,
0.46710360050201416,
-0.19052858650684357,
-0.1514507532119751,
-0.18654794991016388,
-0.01740100234746933,
0.18869464099407196,
0.007627781480550766,
0.04194001853466034,
0.24052883684635162,
-0.15900498628616333,
-0.11470441520214081,
0.09400743246078491,
-0.2652539610862732,
-0.09384723007678986,
0.03227796033024788,
0.04484368488192558,
-0.09525851160287857,
-0.2330176830291748,
-0.3073217272758484,
0.09292526543140411,
0.037364594638347626,
-0.10542857646942139,
0.09388474375009537,
-0.18031029403209686,
-0.23808330297470093,
-0.1588560938835144,
0.271628737449646,
0.6603160500526428,
-0.29885390400886536,
-0.14544497430324554,
0.32554319500923157,
-0.12255604565143585,
-0.11927320808172226,
0.2550254762172699,
-0.09432854503393173,
0.009946838021278381,
-0.26102373003959656,
0.19931451976299286,
0.18748818337917328,
-0.4092429578304291,
-0.14655740559101105,
0.396353542804718,
0.058407098054885864,
0.13573025166988373,
0.20805758237838745,
0.06181078031659126,
0.04158390685915947,
0.04601143300533295,
0.28067803382873535,
0.008305852301418781,
0.10472077131271362,
-0.09153573960065842,
-0.003415212035179138,
-0.20375406742095947,
0.09107531607151031,
0.3670077919960022,
-0.21133868396282196,
0.05503413826227188,
0.10750479996204376,
-0.11178306490182877,
0.17654049396514893,
-0.10396623611450195,
-0.03444817662239075,
0.5095411539077759,
0.13623763620853424,
0.32014578580856323,
0.07939956337213516,
-0.21166938543319702,
-0.5979294180870056,
0.13661986589431763,
0.2275741994380951,
-0.053531721234321594,
-0.26386529207229614,
-0.09572690725326538,
-0.1770210564136505,
0.060134559869766235,
-0.20953930914402008,
-0.014112904667854309,
-0.07209601998329163,
0.15332286059856415,
0.2246880829334259,
0.0292828232049942,
-0.2047475129365921,
0.4062136113643646,
-0.16938132047653198,
0.245487779378891,
-0.2644481062889099,
0.17883147299289703,
-0.03566547483205795,
-0.20230185985565186,
-0.05179573595523834,
0.1018906682729721,
-0.004675917327404022,
-0.2937566936016083,
0.09547410160303116,
0.46329742670059204,
0.05469230189919472,
0.08568492531776428,
-0.18478921055793762,
-0.09530840814113617,
0.22696512937545776,
-0.08083350211381912,
-0.027376921847462654,
0.29197049140930176,
0.20263512432575226,
-0.19178074598312378,
-0.2744138240814209,
0.19127023220062256,
-0.33558428287506104,
0.16342973709106445,
0.029872238636016846,
-0.10833264142274857,
-0.048433803021907806,
0.10796989500522614,
-0.30235612392425537,
-0.06359688192605972,
0.4508513808250427,
-0.24545635282993317,
0.26050445437431335,
0.001822158694267273,
-0.4244135022163391,
-0.2174912393093109,
0.41966497898101807,
-0.04605230689048767,
0.1226552426815033,
0.18774020671844482,
-0.21470129489898682,
0.2120124101638794,
-0.08776815235614777,
-0.041977427899837494,
0.5764286518096924,
0.1378009170293808,
-0.29834991693496704,
0.22981514036655426,
-0.11662109941244125,
-0.22127966582775116,
0.28909584879875183,
-0.04727776348590851,
-0.0982486680150032,
0.09601173549890518,
-0.1998824030160904,
0.008325614035129547,
-0.26002970337867737,
-0.06789300590753555,
-0.10154349356889725,
0.07152579724788666,
-0.412751168012619,
0.22236080467700958,
-0.3261348307132721,
-0.16208136081695557,
-0.353361576795578,
0.11997043341398239,
-0.29344743490219116,
-0.035253237932920456,
-0.2882404327392578,
0.2256356030702591,
0.16318251192569733,
0.036844104528427124,
-0.0255984365940094,
0.00393328070640564,
0.10042867064476013,
-0.5494061708450317,
-0.19856739044189453,
0.008163602091372013,
-0.23089352250099182,
-0.09342408180236816,
0.38237711787223816,
0.044111475348472595,
0.23747751116752625,
-0.3961958587169647,
-0.10942899435758591,
-0.09859373420476913,
-0.1599084585905075,
0.05576726794242859,
-0.06142425537109375,
0.19603170454502106,
0.05316426232457161,
0.22801974415779114,
-0.12375231087207794,
-0.13104702532291412,
0.4299977123737335,
-0.03813391551375389,
-0.1885630488395691,
0.2453443706035614,
0.41844668984413147,
-0.30971813201904297,
-0.2610921263694763,
-0.3623769283294678,
-0.1279265582561493,
-0.2842009663581848,
0.35814857482910156,
0.15591806173324585,
-0.02956918627023697,
0.5024074912071228,
0.42875543236732483,
0.15696276724338531,
-0.18035155534744263,
0.21657925844192505,
0.06529708951711655,
-0.168305441737175,
0.47165095806121826,
-0.16438469290733337,
-0.6319025158882141,
0.07756011188030243,
0.4496116042137146,
-0.2843746244907379,
0.21754126250743866,
-0.4422394633293152,
-0.06208041310310364,
-0.11925515532493591,
0.09208999574184418,
0.04108500853180885,
0.3046550154685974,
0.18646186590194702,
0.08041266351938248,
0.09567829221487045,
-0.05449400842189789,
-0.32142069935798645,
0.11587603390216827,
-0.21104341745376587,
0.03335344046354294,
0.2350960075855255,
0.3713708221912384,
-0.20123478770256042,
0.4552718997001648,
0.3391938805580139,
-0.06640851497650146,
0.2473822683095932,
-0.5043379664421082,
0.5094944834709167,
-0.1640397310256958,
-0.5347826480865479,
0.05617336183786392,
-0.21773487329483032,
0.1750391721725464,
0.27665549516677856,
0.1536443829536438,
0.3985491394996643,
-0.3371798098087311,
0.10423095524311066,
-0.07458600401878357,
-0.19977344572544098,
0.2598342299461365,
-0.11723457276821136,
0.07948076725006104,
-0.1508023738861084,
0.1711592972278595,
0.1823590099811554,
-0.23288646340370178,
0.03903879597783089,
0.6069951057434082,
-0.1873316764831543,
0.051549434661865234,
-0.39870980381965637,
0.0692128986120224,
-0.3697613775730133,
0.3847951889038086,
-0.04406869783997536,
0.3335779309272766,
-0.27299389243125916,
-0.10511372238397598,
0.01776283234357834,
-0.037272900342941284,
0.5544432401657104,
0.3075839877128601,
-0.19523999094963074,
0.017645690590143204,
-0.25824272632598877,
-0.3879300057888031,
0.0970630943775177,
-0.2831108272075653,
0.39122483134269714,
0.17978160083293915,
0.6442822217941284,
-0.30025559663772583,
-0.2145058959722519,
-0.09112641215324402,
0.4764972925186157,
-0.022832082584500313,
-0.31148800253868103,
-0.2785246968269348,
-0.16343708336353302,
-0.32626476883888245,
-0.24235379695892334,
0.02418855018913746,
0.2216685563325882,
-0.18151506781578064,
0.2211252897977829,
-0.05780911445617676,
-0.1648257076740265,
0.2988143563270569,
-0.030988162383437157,
0.2692626416683197,
-0.32836395502090454,
0.23207390308380127,
0.10623225569725037,
0.4693126380443573,
0.29696276783943176,
0.551525890827179,
-0.08975723385810852,
-0.46018892526626587,
0.020805126056075096,
-0.15819226205348969,
0.3489820659160614,
0.16609907150268555,
-0.27159419655799866,
0.14265033602714539,
0.2977319359779358,
0.11018599569797516,
-0.4385163486003876,
-0.0669691190123558,
0.5130975842475891,
0.2113116830587387,
-0.2971879243850708,
-0.4682973325252533,
0.36469128727912903,
0.028174743056297302,
0.14996710419654846,
0.27160051465034485,
0.17438693344593048,
-0.29298001527786255,
0.018115131184458733,
-0.3032904863357544,
0.8145564794540405,
-0.13513001799583435,
0.4673895835876465,
0.23452234268188477,
-0.08719875663518906,
0.397825688123703,
-0.053324341773986816,
0.06563602387905121,
-0.2903502881526947,
-0.014762661419808865,
-0.012935230508446693,
-0.17483539879322052,
0.4434725344181061,
0.17013514041900635,
-0.4242365062236786,
0.21922776103019714,
-0.013385012745857239,
0.31011340022087097,
-0.2710381746292114,
0.18515266478061676,
-0.4233771562576294,
-0.30676761269569397,
-0.34613505005836487,
0.03141036629676819,
0.14703771471977234,
0.3159361481666565,
-0.019304631277918816,
0.068677619099617,
-0.17888011038303375,
-0.2796393632888794,
-0.3666660785675049,
0.05740419775247574,
-0.32172903418540955,
0.05843834578990936,
0.21080191433429718,
-0.34539371728897095,
0.3396162986755371,
0.44701316952705383,
0.2227247804403305,
0.12587442994117737,
-0.16990654170513153,
-0.088034987449646,
-0.22852873802185059,
-0.10756894946098328,
0.001793119590729475,
-0.2334613800048828,
0.025620169937610626,
0.08667146414518356,
-0.27068498730659485,
-0.034228309988975525,
-0.0761411264538765,
-0.1780477911233902,
-0.011277124285697937,
0.13029271364212036,
-0.35141658782958984,
-0.4001733064651489,
-0.4443773031234741,
-0.16439521312713623,
0.1622946709394455,
-0.062214985489845276,
0.012506451457738876,
0.12515521049499512,
0.15351563692092896,
0.04247341305017471,
0.08630746603012085,
-0.1513926088809967,
-0.10639512538909912,
0.3808281421661377,
-0.4325576722621918,
-0.2435595542192459,
0.6115918159484863,
0.44780296087265015,
-0.1363862305879593,
-0.2047024667263031,
0.3153444230556488,
-0.02410351298749447,
-0.47063779830932617,
0.060029350221157074,
0.3476565480232239,
0.046982020139694214,
0.021084846928715706,
0.2753243148326874,
0.04095536470413208,
-0.1721467673778534,
0.10798409581184387,
-0.5703993439674377,
-0.3437374532222748,
0.19584468007087708,
0.29915693402290344,
0.13245421648025513,
0.22470954060554504,
-0.15168331563472748,
-0.01446075364947319,
-0.21246680617332458,
-0.1799510419368744,
0.028362778946757317,
0.07118233293294907,
-0.20901280641555786,
0.4280432164669037,
0.08135491609573364,
0.34466132521629333,
-0.242889866232872,
0.018016835674643517,
-0.008255444467067719,
0.06141901761293411,
-0.055910781025886536,
-0.13231714069843292,
0.13573800027370453,
-0.07649707794189453,
-0.18019047379493713,
-0.16954435408115387,
-0.3009037971496582,
-0.005444547161459923,
-0.30615487694740295,
0.1830039918422699,
0.4905685782432556,
-0.13221722841262817,
0.16604216396808624,
-0.2308713048696518,
0.24027419090270996,
-0.3294675946235657,
0.2159643918275833,
-0.33016255497932434,
0.3099440634250641,
0.11999452114105225,
0.06452429294586182,
-0.0035629512276500463,
0.07621486485004425,
-0.17964790761470795,
0.28044652938842773,
0.19380606710910797,
-0.08764828741550446,
0.2333926260471344,
-0.41730326414108276,
0.1791359931230545,
-0.1308647096157074,
0.4586465358734131,
0.6418233513832092,
-0.2389523833990097,
0.17709243297576904,
0.323751300573349,
0.0375068373978138,
-0.10668563842773438,
0.025385616347193718,
0.1342611461877823,
-0.07563222944736481,
0.05577952042222023,
0.2839002311229706,
-0.10994723439216614,
-0.07677105069160461,
0.014085404574871063,
0.04201062023639679,
0.3017368018627167,
0.1350492686033249,
0.04224539175629616,
0.31792572140693665,
0.28218626976013184,
0.21729479730129242,
-0.07895780354738235,
0.3243650197982788,
0.168809711933136,
0.3248772621154785,
-0.12702417373657227,
0.12640246748924255,
-0.18793323636054993,
0.3269268870353699,
-0.05856538563966751,
-0.3316076695919037,
0.12361234426498413,
0.054044149816036224,
-0.2286888062953949,
0.0388123095035553,
-0.21605685353279114,
0.5491749048233032,
-0.5157119035720825,
-0.009049078449606895,
-0.1283322274684906,
0.06846510618925095,
-0.050738804042339325,
-0.3157408833503723,
0.03204023092985153,
-0.23804622888565063,
-0.031142953783273697,
0.02466117963194847,
-0.0586087740957737,
-0.13547711074352264,
0.06375180184841156,
0.12601828575134277,
-0.033776625990867615,
-0.3310146629810333,
0.12166766077280045,
0.017429785802960396,
0.014899447560310364,
0.004908401519060135,
0.271010160446167,
0.15193212032318115,
0.21965689957141876,
0.3230520784854889,
0.3475780189037323,
0.5777649283409119,
0.4073307514190674,
0.10604949295520782,
0.24757611751556396,
-0.26939257979393005,
-0.012606486678123474,
-0.03941423445940018,
0.3580523133277893,
0.11281471699476242,
0.037804875522851944,
0.21644532680511475,
0.0713128075003624,
-0.03739205747842789,
-0.05451435223221779,
0.0653119832277298,
-0.11782512068748474,
-0.29895487427711487,
0.23282304406166077,
-0.2536523938179016,
-0.12917304039001465,
-0.17007729411125183,
-0.04674641042947769,
-0.44124355912208557,
-0.03883911296725273,
0.5237541794776917,
0.26585763692855835,
0.1927785575389862,
-0.042704228311777115,
0.02653927356004715,
0.3400239050388336,
0.4671337604522705,
0.38308992981910706,
0.23772022128105164,
-0.057062745094299316,
-0.011146128177642822,
-0.6012915968894958,
-0.011561572551727295,
0.009720947593450546,
-0.13737620413303375,
-0.2386874556541443,
-0.1536639928817749,
0.19780229032039642,
0.15514986217021942,
0.052321359515190125,
-0.1281723529100418,
0.2108141928911209,
-0.012030869722366333,
-0.05344913899898529,
-0.1669253706932068,
-0.015177987515926361,
0.13818711042404175,
0.004907839000225067,
-0.3023654520511627,
0.06138338893651962,
-0.10898315161466599,
-0.05648649111390114,
-0.3146934509277344,
0.42382538318634033,
-0.10585279762744904,
-0.33554357290267944,
0.13646440207958221,
-0.07306482642889023,
0.4701797068119049,
0.04250940680503845,
-0.16549621522426605,
-0.17986448109149933,
-0.23826564848423004,
0.021349098533391953,
0.43025344610214233,
0.15453454852104187,
0.005093453451991081,
-0.4908643364906311,
-0.49262502789497375,
-0.2662898600101471,
0.24394312500953674,
-0.059263601899147034,
-0.37303411960601807,
0.02461392618715763,
-0.018650636076927185,
-0.03545805811882019,
0.001153341494500637,
0.23331274092197418,
0.47853729128837585,
-0.27210986614227295,
0.010619590058922768,
-0.14781954884529114,
-0.12781193852424622,
0.3023917078971863,
-0.4510454535484314,
-0.2669309973716736,
0.030796915292739868,
0.008957751095294952,
0.015702150762081146,
0.049648672342300415,
-0.5663859248161316,
0.12508678436279297,
0.13597729802131653,
-0.10330649465322495,
-0.13997501134872437,
0.053034666925668716,
-0.18257488310337067,
-0.03638375550508499,
-0.1389525681734085,
0.454903244972229,
0.08838391304016113,
-0.25883957743644714,
0.09736847877502441,
-0.20569591224193573
] |
https://github.com/huggingface/datasets/issues/622 | load_dataset for text files not working | To complete what @lhoestq is saying, I think that to use the new version of the `text` processing script (which is on master right now) you need to either specify the version of the script to be the `master` one or to install the lib from source (in which case it uses the `master` version of the script by default):
```python
dataset = load_dataset('text', script_version='master', data_files=XXX)
```
We do versioning by default, i.e. your version of the dataset lib will use the script with the same version by default (i.e. only the `1.0.1` version of the script if you have the PyPI version `1.0.1` of the lib). | Trying the following snippet, I get different problems on Linux and Windows.
```python
dataset = load_dataset("text", data_files="data.txt")
# or
dataset = load_dataset("text", data_files=["data.txt"])
```
(ps [This example](https://huggingface.co/docs/datasets/loading_datasets.html#json-files) shows that you can use a string as input for data_files, but the signature is `Union[Dict, List]`.)
The problem on Linux is that the script crashes with a CSV error (even though it isn't a CSV file). On Windows the script just seems to freeze or get stuck after loading the config file.
Linux stack trace:
```
PyTorch version 1.6.0+cu101 available.
Checking /home/bram/.cache/huggingface/datasets/b1d50a0e74da9a7b9822cea8ff4e4f217dd892e09eb14f6274a2169e5436e2ea.30c25842cda32b0540d88b7195147decf9671ee442f4bc2fb6ad74016852978e.py for additional imports.
Found main folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text
Found specific version folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7
Found script file from https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py to /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py
Couldn't find dataset infos file at https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/dataset_infos.json
Found metadata file for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.json
Using custom data configuration default
Generating dataset text (/home/bram/.cache/huggingface/datasets/text/default-0907112cc6cd2a38/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7)
Downloading and preparing dataset text/default-0907112cc6cd2a38 (download: Unknown size, generated: Unknown size, post-processed: Unknown size, total: Unknown size) to /home/bram/.cache/huggingface/datasets/text/default-0907112cc6cd2a38/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7...
Dataset not on Hf google storage. Downloading and preparing it from source
Downloading took 0.0 min
Checksum Computation took 0.0 min
Unable to verify checksums.
Generating split train
Traceback (most recent call last):
File "/home/bram/Python/projects/dutch-simplification/utils.py", line 45, in prepare_data
dataset = load_dataset("text", data_files=dataset_f)
File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/load.py", line 608, in load_dataset
builder_instance.download_and_prepare(
File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 468, in download_and_prepare
self._download_and_prepare(
File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 546, in _download_and_prepare
self._prepare_split(split_generator, **prepare_split_kwargs)
File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 888, in _prepare_split
for key, table in utils.tqdm(generator, unit=" tables", leave=False, disable=not_verbose):
File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/tqdm/std.py", line 1130, in __iter__
for obj in iterable:
File "/home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py", line 100, in _generate_tables
pa_table = pac.read_csv(
File "pyarrow/_csv.pyx", line 714, in pyarrow._csv.read_csv
File "pyarrow/error.pxi", line 122, in pyarrow.lib.pyarrow_internal_check_status
File "pyarrow/error.pxi", line 84, in pyarrow.lib.check_status
pyarrow.lib.ArrowInvalid: CSV parse error: Expected 1 columns, got 2
```
Windows just seems to get stuck. Even with a tiny dataset of 10 lines, it has been stuck for 15 minutes already at this message:
```
Checking C:\Users\bramv\.cache\huggingface\datasets\b1d50a0e74da9a7b9822cea8ff4e4f217dd892e09eb14f6274a2169e5436e2ea.30c25842cda32b0540d88b7195147decf9671ee442f4bc2fb6ad74016852978e.py for additional imports.
Found main folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text
Found specific version folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7
Found script file from https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py to C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7\text.py
Couldn't find dataset infos file at https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text\dataset_infos.json
Found metadata file for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7\text.json
Using custom data configuration default
```
| 107 | load_dataset for text files not working
Trying the following snippet, I get different problems on Linux and Windows.
```python
dataset = load_dataset("text", data_files="data.txt")
# or
dataset = load_dataset("text", data_files=["data.txt"])
```
(ps [This example](https://huggingface.co/docs/datasets/loading_datasets.html#json-files) shows that you can use a string as input for data_files, but the signature is `Union[Dict, List]`.)
The problem on Linux is that the script crashes with a CSV error (even though it isn't a CSV file). On Windows the script just seems to freeze or get stuck after loading the config file.
Linux stack trace:
```
PyTorch version 1.6.0+cu101 available.
Checking /home/bram/.cache/huggingface/datasets/b1d50a0e74da9a7b9822cea8ff4e4f217dd892e09eb14f6274a2169e5436e2ea.30c25842cda32b0540d88b7195147decf9671ee442f4bc2fb6ad74016852978e.py for additional imports.
Found main folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text
Found specific version folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7
Found script file from https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py to /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py
Couldn't find dataset infos file at https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/dataset_infos.json
Found metadata file for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.json
Using custom data configuration default
Generating dataset text (/home/bram/.cache/huggingface/datasets/text/default-0907112cc6cd2a38/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7)
Downloading and preparing dataset text/default-0907112cc6cd2a38 (download: Unknown size, generated: Unknown size, post-processed: Unknown size, total: Unknown size) to /home/bram/.cache/huggingface/datasets/text/default-0907112cc6cd2a38/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7...
Dataset not on Hf google storage. Downloading and preparing it from source
Downloading took 0.0 min
Checksum Computation took 0.0 min
Unable to verify checksums.
Generating split train
Traceback (most recent call last):
File "/home/bram/Python/projects/dutch-simplification/utils.py", line 45, in prepare_data
dataset = load_dataset("text", data_files=dataset_f)
File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/load.py", line 608, in load_dataset
builder_instance.download_and_prepare(
File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 468, in download_and_prepare
self._download_and_prepare(
File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 546, in _download_and_prepare
self._prepare_split(split_generator, **prepare_split_kwargs)
File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 888, in _prepare_split
for key, table in utils.tqdm(generator, unit=" tables", leave=False, disable=not_verbose):
File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/tqdm/std.py", line 1130, in __iter__
for obj in iterable:
File "/home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py", line 100, in _generate_tables
pa_table = pac.read_csv(
File "pyarrow/_csv.pyx", line 714, in pyarrow._csv.read_csv
File "pyarrow/error.pxi", line 122, in pyarrow.lib.pyarrow_internal_check_status
File "pyarrow/error.pxi", line 84, in pyarrow.lib.check_status
pyarrow.lib.ArrowInvalid: CSV parse error: Expected 1 columns, got 2
```
Windows just seems to get stuck. Even with a tiny dataset of 10 lines, it has been stuck for 15 minutes already at this message:
```
Checking C:\Users\bramv\.cache\huggingface\datasets\b1d50a0e74da9a7b9822cea8ff4e4f217dd892e09eb14f6274a2169e5436e2ea.30c25842cda32b0540d88b7195147decf9671ee442f4bc2fb6ad74016852978e.py for additional imports.
Found main folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text
Found specific version folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7
Found script file from https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py to C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7\text.py
Couldn't find dataset infos file at https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text\dataset_infos.json
Found metadata file for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7\text.json
Using custom data configuration default
```
To complete what @lhoestq is saying, I think that to use the new version of the `text` processing script (which is on master right now) you need to either specify the version of the script to be the `master` one or to install the lib from source (in which case it uses the `master` version of the script by default):
```python
dataset = load_dataset('text', script_version='master', data_files=XXX)
```
We do versioning by default, i.e. your version of the dataset lib will use the script with the same version by default (i.e. only the `1.0.1` version of the script if you have the PyPI version `1.0.1` of the lib). | [
-0.27466508746147156,
-0.4020572602748871,
0.01756073161959648,
0.38725215196609497,
0.26964259147644043,
-0.038661353290081024,
0.318887859582901,
-0.05435653403401375,
0.4263593256473541,
-0.058048903942108154,
0.06597194820642471,
0.14552471041679382,
-0.15576286613941193,
0.27420055866241455,
0.06355622410774231,
-0.03507590293884277,
0.15718327462673187,
-0.013841032981872559,
-0.29144343733787537,
0.04024842381477356,
-0.11445463448762894,
0.34312117099761963,
-0.2153358906507492,
-0.14693012833595276,
-0.4160703420639038,
0.27400466799736023,
-0.10501692444086075,
0.453878253698349,
-0.07426194846630096,
-0.2378564178943634,
0.2710002362728119,
0.12820816040039062,
0.16396383941173553,
0.6136502027511597,
-0.00012696169142145663,
0.11003263294696808,
0.27564769983291626,
-0.16101115942001343,
-0.2998278737068176,
-0.5695475935935974,
0.15851548314094543,
-0.22943682968616486,
0.20884843170642853,
-0.02878069132566452,
0.13019275665283203,
-0.00452867615967989,
0.1527262032032013,
-0.3340619206428528,
0.3551647365093231,
0.325478196144104,
0.1009778082370758,
0.31933706998825073,
0.062094781547784805,
-0.014658169820904732,
0.06096186861395836,
0.476550817489624,
-0.09174498170614243,
0.39064982533454895,
0.3137863278388977,
-0.19428719580173492,
0.11695243418216705,
-0.08240078389644623,
-0.17309308052062988,
-0.16965323686599731,
0.3285274803638458,
0.28717073798179626,
-0.6134480834007263,
-0.20572631061077118,
0.07684162259101868,
0.18599191308021545,
0.43523305654525757,
-0.43391847610473633,
-0.22174830734729767,
-0.15912951529026031,
-0.0756906047463417,
-0.12547838687896729,
0.4388751983642578,
0.1783991903066635,
-0.19857299327850342,
0.058120787143707275,
-0.25035667419433594,
-0.06923972815275192,
-0.1769828498363495,
0.32306575775146484,
-0.008430525660514832,
0.050888918340206146,
-0.21918228268623352,
0.10400895774364471,
0.3328261077404022,
-0.07093829661607742,
-0.20637576282024384,
-0.2793428301811218,
-0.029353488236665726,
0.06112753972411156,
-0.26616689562797546,
0.15572930872440338,
-0.26587602496147156,
-0.02452719211578369,
0.11175438016653061,
0.17476198077201843,
-0.004768398590385914,
0.14171989262104034,
0.09514429420232773,
0.23060673475265503,
0.20078730583190918,
0.0978599488735199,
0.4081539809703827,
0.08435465395450592,
0.26157498359680176,
0.026359327137470245,
-0.016058051958680153,
-0.09524741023778915,
-0.19634290039539337,
-0.5441904664039612,
-0.06979077309370041,
-0.23005294799804688,
0.47970032691955566,
-0.2050441950559616,
-0.17903532087802887,
-0.04985557496547699,
-0.08081233501434326,
-0.04559389874339104,
0.21613672375679016,
0.619709312915802,
-0.08433903753757477,
0.03387746959924698,
0.1204904317855835,
0.31828367710113525,
-0.11680151522159576,
0.1911226063966751,
0.04757927358150482,
-0.06042690947651863,
-0.08892598003149033,
0.17952533066272736,
0.5387117862701416,
-0.37219706177711487,
0.3424330949783325,
0.1996888369321823,
0.46710360050201416,
-0.19052858650684357,
-0.1514507532119751,
-0.18654794991016388,
-0.01740100234746933,
0.18869464099407196,
0.007627781480550766,
0.04194001853466034,
0.24052883684635162,
-0.15900498628616333,
-0.11470441520214081,
0.09400743246078491,
-0.2652539610862732,
-0.09384723007678986,
0.03227796033024788,
0.04484368488192558,
-0.09525851160287857,
-0.2330176830291748,
-0.3073217272758484,
0.09292526543140411,
0.037364594638347626,
-0.10542857646942139,
0.09388474375009537,
-0.18031029403209686,
-0.23808330297470093,
-0.1588560938835144,
0.271628737449646,
0.6603160500526428,
-0.29885390400886536,
-0.14544497430324554,
0.32554319500923157,
-0.12255604565143585,
-0.11927320808172226,
0.2550254762172699,
-0.09432854503393173,
0.009946838021278381,
-0.26102373003959656,
0.19931451976299286,
0.18748818337917328,
-0.4092429578304291,
-0.14655740559101105,
0.396353542804718,
0.058407098054885864,
0.13573025166988373,
0.20805758237838745,
0.06181078031659126,
0.04158390685915947,
0.04601143300533295,
0.28067803382873535,
0.008305852301418781,
0.10472077131271362,
-0.09153573960065842,
-0.003415212035179138,
-0.20375406742095947,
0.09107531607151031,
0.3670077919960022,
-0.21133868396282196,
0.05503413826227188,
0.10750479996204376,
-0.11178306490182877,
0.17654049396514893,
-0.10396623611450195,
-0.03444817662239075,
0.5095411539077759,
0.13623763620853424,
0.32014578580856323,
0.07939956337213516,
-0.21166938543319702,
-0.5979294180870056,
0.13661986589431763,
0.2275741994380951,
-0.053531721234321594,
-0.26386529207229614,
-0.09572690725326538,
-0.1770210564136505,
0.060134559869766235,
-0.20953930914402008,
-0.014112904667854309,
-0.07209601998329163,
0.15332286059856415,
0.2246880829334259,
0.0292828232049942,
-0.2047475129365921,
0.4062136113643646,
-0.16938132047653198,
0.245487779378891,
-0.2644481062889099,
0.17883147299289703,
-0.03566547483205795,
-0.20230185985565186,
-0.05179573595523834,
0.1018906682729721,
-0.004675917327404022,
-0.2937566936016083,
0.09547410160303116,
0.46329742670059204,
0.05469230189919472,
0.08568492531776428,
-0.18478921055793762,
-0.09530840814113617,
0.22696512937545776,
-0.08083350211381912,
-0.027376921847462654,
0.29197049140930176,
0.20263512432575226,
-0.19178074598312378,
-0.2744138240814209,
0.19127023220062256,
-0.33558428287506104,
0.16342973709106445,
0.029872238636016846,
-0.10833264142274857,
-0.048433803021907806,
0.10796989500522614,
-0.30235612392425537,
-0.06359688192605972,
0.4508513808250427,
-0.24545635282993317,
0.26050445437431335,
0.001822158694267273,
-0.4244135022163391,
-0.2174912393093109,
0.41966497898101807,
-0.04605230689048767,
0.1226552426815033,
0.18774020671844482,
-0.21470129489898682,
0.2120124101638794,
-0.08776815235614777,
-0.041977427899837494,
0.5764286518096924,
0.1378009170293808,
-0.29834991693496704,
0.22981514036655426,
-0.11662109941244125,
-0.22127966582775116,
0.28909584879875183,
-0.04727776348590851,
-0.0982486680150032,
0.09601173549890518,
-0.1998824030160904,
0.008325614035129547,
-0.26002970337867737,
-0.06789300590753555,
-0.10154349356889725,
0.07152579724788666,
-0.412751168012619,
0.22236080467700958,
-0.3261348307132721,
-0.16208136081695557,
-0.353361576795578,
0.11997043341398239,
-0.29344743490219116,
-0.035253237932920456,
-0.2882404327392578,
0.2256356030702591,
0.16318251192569733,
0.036844104528427124,
-0.0255984365940094,
0.00393328070640564,
0.10042867064476013,
-0.5494061708450317,
-0.19856739044189453,
0.008163602091372013,
-0.23089352250099182,
-0.09342408180236816,
0.38237711787223816,
0.044111475348472595,
0.23747751116752625,
-0.3961958587169647,
-0.10942899435758591,
-0.09859373420476913,
-0.1599084585905075,
0.05576726794242859,
-0.06142425537109375,
0.19603170454502106,
0.05316426232457161,
0.22801974415779114,
-0.12375231087207794,
-0.13104702532291412,
0.4299977123737335,
-0.03813391551375389,
-0.1885630488395691,
0.2453443706035614,
0.41844668984413147,
-0.30971813201904297,
-0.2610921263694763,
-0.3623769283294678,
-0.1279265582561493,
-0.2842009663581848,
0.35814857482910156,
0.15591806173324585,
-0.02956918627023697,
0.5024074912071228,
0.42875543236732483,
0.15696276724338531,
-0.18035155534744263,
0.21657925844192505,
0.06529708951711655,
-0.168305441737175,
0.47165095806121826,
-0.16438469290733337,
-0.6319025158882141,
0.07756011188030243,
0.4496116042137146,
-0.2843746244907379,
0.21754126250743866,
-0.4422394633293152,
-0.06208041310310364,
-0.11925515532493591,
0.09208999574184418,
0.04108500853180885,
0.3046550154685974,
0.18646186590194702,
0.08041266351938248,
0.09567829221487045,
-0.05449400842189789,
-0.32142069935798645,
0.11587603390216827,
-0.21104341745376587,
0.03335344046354294,
0.2350960075855255,
0.3713708221912384,
-0.20123478770256042,
0.4552718997001648,
0.3391938805580139,
-0.06640851497650146,
0.2473822683095932,
-0.5043379664421082,
0.5094944834709167,
-0.1640397310256958,
-0.5347826480865479,
0.05617336183786392,
-0.21773487329483032,
0.1750391721725464,
0.27665549516677856,
0.1536443829536438,
0.3985491394996643,
-0.3371798098087311,
0.10423095524311066,
-0.07458600401878357,
-0.19977344572544098,
0.2598342299461365,
-0.11723457276821136,
0.07948076725006104,
-0.1508023738861084,
0.1711592972278595,
0.1823590099811554,
-0.23288646340370178,
0.03903879597783089,
0.6069951057434082,
-0.1873316764831543,
0.051549434661865234,
-0.39870980381965637,
0.0692128986120224,
-0.3697613775730133,
0.3847951889038086,
-0.04406869783997536,
0.3335779309272766,
-0.27299389243125916,
-0.10511372238397598,
0.01776283234357834,
-0.037272900342941284,
0.5544432401657104,
0.3075839877128601,
-0.19523999094963074,
0.017645690590143204,
-0.25824272632598877,
-0.3879300057888031,
0.0970630943775177,
-0.2831108272075653,
0.39122483134269714,
0.17978160083293915,
0.6442822217941284,
-0.30025559663772583,
-0.2145058959722519,
-0.09112641215324402,
0.4764972925186157,
-0.022832082584500313,
-0.31148800253868103,
-0.2785246968269348,
-0.16343708336353302,
-0.32626476883888245,
-0.24235379695892334,
0.02418855018913746,
0.2216685563325882,
-0.18151506781578064,
0.2211252897977829,
-0.05780911445617676,
-0.1648257076740265,
0.2988143563270569,
-0.030988162383437157,
0.2692626416683197,
-0.32836395502090454,
0.23207390308380127,
0.10623225569725037,
0.4693126380443573,
0.29696276783943176,
0.551525890827179,
-0.08975723385810852,
-0.46018892526626587,
0.020805126056075096,
-0.15819226205348969,
0.3489820659160614,
0.16609907150268555,
-0.27159419655799866,
0.14265033602714539,
0.2977319359779358,
0.11018599569797516,
-0.4385163486003876,
-0.0669691190123558,
0.5130975842475891,
0.2113116830587387,
-0.2971879243850708,
-0.4682973325252533,
0.36469128727912903,
0.028174743056297302,
0.14996710419654846,
0.27160051465034485,
0.17438693344593048,
-0.29298001527786255,
0.018115131184458733,
-0.3032904863357544,
0.8145564794540405,
-0.13513001799583435,
0.4673895835876465,
0.23452234268188477,
-0.08719875663518906,
0.397825688123703,
-0.053324341773986816,
0.06563602387905121,
-0.2903502881526947,
-0.014762661419808865,
-0.012935230508446693,
-0.17483539879322052,
0.4434725344181061,
0.17013514041900635,
-0.4242365062236786,
0.21922776103019714,
-0.013385012745857239,
0.31011340022087097,
-0.2710381746292114,
0.18515266478061676,
-0.4233771562576294,
-0.30676761269569397,
-0.34613505005836487,
0.03141036629676819,
0.14703771471977234,
0.3159361481666565,
-0.019304631277918816,
0.068677619099617,
-0.17888011038303375,
-0.2796393632888794,
-0.3666660785675049,
0.05740419775247574,
-0.32172903418540955,
0.05843834578990936,
0.21080191433429718,
-0.34539371728897095,
0.3396162986755371,
0.44701316952705383,
0.2227247804403305,
0.12587442994117737,
-0.16990654170513153,
-0.088034987449646,
-0.22852873802185059,
-0.10756894946098328,
0.001793119590729475,
-0.2334613800048828,
0.025620169937610626,
0.08667146414518356,
-0.27068498730659485,
-0.034228309988975525,
-0.0761411264538765,
-0.1780477911233902,
-0.011277124285697937,
0.13029271364212036,
-0.35141658782958984,
-0.4001733064651489,
-0.4443773031234741,
-0.16439521312713623,
0.1622946709394455,
-0.062214985489845276,
0.012506451457738876,
0.12515521049499512,
0.15351563692092896,
0.04247341305017471,
0.08630746603012085,
-0.1513926088809967,
-0.10639512538909912,
0.3808281421661377,
-0.4325576722621918,
-0.2435595542192459,
0.6115918159484863,
0.44780296087265015,
-0.1363862305879593,
-0.2047024667263031,
0.3153444230556488,
-0.02410351298749447,
-0.47063779830932617,
0.060029350221157074,
0.3476565480232239,
0.046982020139694214,
0.021084846928715706,
0.2753243148326874,
0.04095536470413208,
-0.1721467673778534,
0.10798409581184387,
-0.5703993439674377,
-0.3437374532222748,
0.19584468007087708,
0.29915693402290344,
0.13245421648025513,
0.22470954060554504,
-0.15168331563472748,
-0.01446075364947319,
-0.21246680617332458,
-0.1799510419368744,
0.028362778946757317,
0.07118233293294907,
-0.20901280641555786,
0.4280432164669037,
0.08135491609573364,
0.34466132521629333,
-0.242889866232872,
0.018016835674643517,
-0.008255444467067719,
0.06141901761293411,
-0.055910781025886536,
-0.13231714069843292,
0.13573800027370453,
-0.07649707794189453,
-0.18019047379493713,
-0.16954435408115387,
-0.3009037971496582,
-0.005444547161459923,
-0.30615487694740295,
0.1830039918422699,
0.4905685782432556,
-0.13221722841262817,
0.16604216396808624,
-0.2308713048696518,
0.24027419090270996,
-0.3294675946235657,
0.2159643918275833,
-0.33016255497932434,
0.3099440634250641,
0.11999452114105225,
0.06452429294586182,
-0.0035629512276500463,
0.07621486485004425,
-0.17964790761470795,
0.28044652938842773,
0.19380606710910797,
-0.08764828741550446,
0.2333926260471344,
-0.41730326414108276,
0.1791359931230545,
-0.1308647096157074,
0.4586465358734131,
0.6418233513832092,
-0.2389523833990097,
0.17709243297576904,
0.323751300573349,
0.0375068373978138,
-0.10668563842773438,
0.025385616347193718,
0.1342611461877823,
-0.07563222944736481,
0.05577952042222023,
0.2839002311229706,
-0.10994723439216614,
-0.07677105069160461,
0.014085404574871063,
0.04201062023639679,
0.3017368018627167,
0.1350492686033249,
0.04224539175629616,
0.31792572140693665,
0.28218626976013184,
0.21729479730129242,
-0.07895780354738235,
0.3243650197982788,
0.168809711933136,
0.3248772621154785,
-0.12702417373657227,
0.12640246748924255,
-0.18793323636054993,
0.3269268870353699,
-0.05856538563966751,
-0.3316076695919037,
0.12361234426498413,
0.054044149816036224,
-0.2286888062953949,
0.0388123095035553,
-0.21605685353279114,
0.5491749048233032,
-0.5157119035720825,
-0.009049078449606895,
-0.1283322274684906,
0.06846510618925095,
-0.050738804042339325,
-0.3157408833503723,
0.03204023092985153,
-0.23804622888565063,
-0.031142953783273697,
0.02466117963194847,
-0.0586087740957737,
-0.13547711074352264,
0.06375180184841156,
0.12601828575134277,
-0.033776625990867615,
-0.3310146629810333,
0.12166766077280045,
0.017429785802960396,
0.014899447560310364,
0.004908401519060135,
0.271010160446167,
0.15193212032318115,
0.21965689957141876,
0.3230520784854889,
0.3475780189037323,
0.5777649283409119,
0.4073307514190674,
0.10604949295520782,
0.24757611751556396,
-0.26939257979393005,
-0.012606486678123474,
-0.03941423445940018,
0.3580523133277893,
0.11281471699476242,
0.037804875522851944,
0.21644532680511475,
0.0713128075003624,
-0.03739205747842789,
-0.05451435223221779,
0.0653119832277298,
-0.11782512068748474,
-0.29895487427711487,
0.23282304406166077,
-0.2536523938179016,
-0.12917304039001465,
-0.17007729411125183,
-0.04674641042947769,
-0.44124355912208557,
-0.03883911296725273,
0.5237541794776917,
0.26585763692855835,
0.1927785575389862,
-0.042704228311777115,
0.02653927356004715,
0.3400239050388336,
0.4671337604522705,
0.38308992981910706,
0.23772022128105164,
-0.057062745094299316,
-0.011146128177642822,
-0.6012915968894958,
-0.011561572551727295,
0.009720947593450546,
-0.13737620413303375,
-0.2386874556541443,
-0.1536639928817749,
0.19780229032039642,
0.15514986217021942,
0.052321359515190125,
-0.1281723529100418,
0.2108141928911209,
-0.012030869722366333,
-0.05344913899898529,
-0.1669253706932068,
-0.015177987515926361,
0.13818711042404175,
0.004907839000225067,
-0.3023654520511627,
0.06138338893651962,
-0.10898315161466599,
-0.05648649111390114,
-0.3146934509277344,
0.42382538318634033,
-0.10585279762744904,
-0.33554357290267944,
0.13646440207958221,
-0.07306482642889023,
0.4701797068119049,
0.04250940680503845,
-0.16549621522426605,
-0.17986448109149933,
-0.23826564848423004,
0.021349098533391953,
0.43025344610214233,
0.15453454852104187,
0.005093453451991081,
-0.4908643364906311,
-0.49262502789497375,
-0.2662898600101471,
0.24394312500953674,
-0.059263601899147034,
-0.37303411960601807,
0.02461392618715763,
-0.018650636076927185,
-0.03545805811882019,
0.001153341494500637,
0.23331274092197418,
0.47853729128837585,
-0.27210986614227295,
0.010619590058922768,
-0.14781954884529114,
-0.12781193852424622,
0.3023917078971863,
-0.4510454535484314,
-0.2669309973716736,
0.030796915292739868,
0.008957751095294952,
0.015702150762081146,
0.049648672342300415,
-0.5663859248161316,
0.12508678436279297,
0.13597729802131653,
-0.10330649465322495,
-0.13997501134872437,
0.053034666925668716,
-0.18257488310337067,
-0.03638375550508499,
-0.1389525681734085,
0.454903244972229,
0.08838391304016113,
-0.25883957743644714,
0.09736847877502441,
-0.20569591224193573
] |
https://github.com/huggingface/datasets/issues/622 | load_dataset for text files not working | 
win10, py3.6
```
from datasets import Features, Value, ClassLabel, load_dataset
features = Features({'text': Value('string'), 'ctext': Value('string')})
file_dict = {'train': PATH/'summary.csv'}
dataset = load_dataset('csv', data_files=file_dict, script_version='master', delimiter='\t', column_names=['text', 'ctext'], features=features)
``` | Trying the following snippet, I get different problems on Linux and Windows.
```python
dataset = load_dataset("text", data_files="data.txt")
# or
dataset = load_dataset("text", data_files=["data.txt"])
```
(ps [This example](https://huggingface.co/docs/datasets/loading_datasets.html#json-files) shows that you can use a string as input for data_files, but the signature is `Union[Dict, List]`.)
The problem on Linux is that the script crashes with a CSV error (even though it isn't a CSV file). On Windows the script just seems to freeze or get stuck after loading the config file.
Linux stack trace:
```
PyTorch version 1.6.0+cu101 available.
Checking /home/bram/.cache/huggingface/datasets/b1d50a0e74da9a7b9822cea8ff4e4f217dd892e09eb14f6274a2169e5436e2ea.30c25842cda32b0540d88b7195147decf9671ee442f4bc2fb6ad74016852978e.py for additional imports.
Found main folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text
Found specific version folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7
Found script file from https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py to /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py
Couldn't find dataset infos file at https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/dataset_infos.json
Found metadata file for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.json
Using custom data configuration default
Generating dataset text (/home/bram/.cache/huggingface/datasets/text/default-0907112cc6cd2a38/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7)
Downloading and preparing dataset text/default-0907112cc6cd2a38 (download: Unknown size, generated: Unknown size, post-processed: Unknown size, total: Unknown size) to /home/bram/.cache/huggingface/datasets/text/default-0907112cc6cd2a38/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7...
Dataset not on Hf google storage. Downloading and preparing it from source
Downloading took 0.0 min
Checksum Computation took 0.0 min
Unable to verify checksums.
Generating split train
Traceback (most recent call last):
File "/home/bram/Python/projects/dutch-simplification/utils.py", line 45, in prepare_data
dataset = load_dataset("text", data_files=dataset_f)
File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/load.py", line 608, in load_dataset
builder_instance.download_and_prepare(
File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 468, in download_and_prepare
self._download_and_prepare(
File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 546, in _download_and_prepare
self._prepare_split(split_generator, **prepare_split_kwargs)
File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 888, in _prepare_split
for key, table in utils.tqdm(generator, unit=" tables", leave=False, disable=not_verbose):
File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/tqdm/std.py", line 1130, in __iter__
for obj in iterable:
File "/home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py", line 100, in _generate_tables
pa_table = pac.read_csv(
File "pyarrow/_csv.pyx", line 714, in pyarrow._csv.read_csv
File "pyarrow/error.pxi", line 122, in pyarrow.lib.pyarrow_internal_check_status
File "pyarrow/error.pxi", line 84, in pyarrow.lib.check_status
pyarrow.lib.ArrowInvalid: CSV parse error: Expected 1 columns, got 2
```
Windows just seems to get stuck. Even with a tiny dataset of 10 lines, it has been stuck for 15 minutes already at this message:
```
Checking C:\Users\bramv\.cache\huggingface\datasets\b1d50a0e74da9a7b9822cea8ff4e4f217dd892e09eb14f6274a2169e5436e2ea.30c25842cda32b0540d88b7195147decf9671ee442f4bc2fb6ad74016852978e.py for additional imports.
Found main folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text
Found specific version folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7
Found script file from https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py to C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7\text.py
Couldn't find dataset infos file at https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text\dataset_infos.json
Found metadata file for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7\text.json
Using custom data configuration default
```
| 31 | load_dataset for text files not working
Trying the following snippet, I get different problems on Linux and Windows.
```python
dataset = load_dataset("text", data_files="data.txt")
# or
dataset = load_dataset("text", data_files=["data.txt"])
```
(ps [This example](https://huggingface.co/docs/datasets/loading_datasets.html#json-files) shows that you can use a string as input for data_files, but the signature is `Union[Dict, List]`.)
The problem on Linux is that the script crashes with a CSV error (even though it isn't a CSV file). On Windows the script just seems to freeze or get stuck after loading the config file.
Linux stack trace:
```
PyTorch version 1.6.0+cu101 available.
Checking /home/bram/.cache/huggingface/datasets/b1d50a0e74da9a7b9822cea8ff4e4f217dd892e09eb14f6274a2169e5436e2ea.30c25842cda32b0540d88b7195147decf9671ee442f4bc2fb6ad74016852978e.py for additional imports.
Found main folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text
Found specific version folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7
Found script file from https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py to /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py
Couldn't find dataset infos file at https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/dataset_infos.json
Found metadata file for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.json
Using custom data configuration default
Generating dataset text (/home/bram/.cache/huggingface/datasets/text/default-0907112cc6cd2a38/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7)
Downloading and preparing dataset text/default-0907112cc6cd2a38 (download: Unknown size, generated: Unknown size, post-processed: Unknown size, total: Unknown size) to /home/bram/.cache/huggingface/datasets/text/default-0907112cc6cd2a38/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7...
Dataset not on Hf google storage. Downloading and preparing it from source
Downloading took 0.0 min
Checksum Computation took 0.0 min
Unable to verify checksums.
Generating split train
Traceback (most recent call last):
File "/home/bram/Python/projects/dutch-simplification/utils.py", line 45, in prepare_data
dataset = load_dataset("text", data_files=dataset_f)
File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/load.py", line 608, in load_dataset
builder_instance.download_and_prepare(
File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 468, in download_and_prepare
self._download_and_prepare(
File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 546, in _download_and_prepare
self._prepare_split(split_generator, **prepare_split_kwargs)
File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 888, in _prepare_split
for key, table in utils.tqdm(generator, unit=" tables", leave=False, disable=not_verbose):
File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/tqdm/std.py", line 1130, in __iter__
for obj in iterable:
File "/home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py", line 100, in _generate_tables
pa_table = pac.read_csv(
File "pyarrow/_csv.pyx", line 714, in pyarrow._csv.read_csv
File "pyarrow/error.pxi", line 122, in pyarrow.lib.pyarrow_internal_check_status
File "pyarrow/error.pxi", line 84, in pyarrow.lib.check_status
pyarrow.lib.ArrowInvalid: CSV parse error: Expected 1 columns, got 2
```
Windows just seems to get stuck. Even with a tiny dataset of 10 lines, it has been stuck for 15 minutes already at this message:
```
Checking C:\Users\bramv\.cache\huggingface\datasets\b1d50a0e74da9a7b9822cea8ff4e4f217dd892e09eb14f6274a2169e5436e2ea.30c25842cda32b0540d88b7195147decf9671ee442f4bc2fb6ad74016852978e.py for additional imports.
Found main folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text
Found specific version folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7
Found script file from https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py to C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7\text.py
Couldn't find dataset infos file at https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text\dataset_infos.json
Found metadata file for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7\text.json
Using custom data configuration default
```

win10, py3.6
```
from datasets import Features, Value, ClassLabel, load_dataset
features = Features({'text': Value('string'), 'ctext': Value('string')})
file_dict = {'train': PATH/'summary.csv'}
dataset = load_dataset('csv', data_files=file_dict, script_version='master', delimiter='\t', column_names=['text', 'ctext'], features=features)
``` | [
-0.27466508746147156,
-0.4020572602748871,
0.01756073161959648,
0.38725215196609497,
0.26964259147644043,
-0.038661353290081024,
0.318887859582901,
-0.05435653403401375,
0.4263593256473541,
-0.058048903942108154,
0.06597194820642471,
0.14552471041679382,
-0.15576286613941193,
0.27420055866241455,
0.06355622410774231,
-0.03507590293884277,
0.15718327462673187,
-0.013841032981872559,
-0.29144343733787537,
0.04024842381477356,
-0.11445463448762894,
0.34312117099761963,
-0.2153358906507492,
-0.14693012833595276,
-0.4160703420639038,
0.27400466799736023,
-0.10501692444086075,
0.453878253698349,
-0.07426194846630096,
-0.2378564178943634,
0.2710002362728119,
0.12820816040039062,
0.16396383941173553,
0.6136502027511597,
-0.00012696169142145663,
0.11003263294696808,
0.27564769983291626,
-0.16101115942001343,
-0.2998278737068176,
-0.5695475935935974,
0.15851548314094543,
-0.22943682968616486,
0.20884843170642853,
-0.02878069132566452,
0.13019275665283203,
-0.00452867615967989,
0.1527262032032013,
-0.3340619206428528,
0.3551647365093231,
0.325478196144104,
0.1009778082370758,
0.31933706998825073,
0.062094781547784805,
-0.014658169820904732,
0.06096186861395836,
0.476550817489624,
-0.09174498170614243,
0.39064982533454895,
0.3137863278388977,
-0.19428719580173492,
0.11695243418216705,
-0.08240078389644623,
-0.17309308052062988,
-0.16965323686599731,
0.3285274803638458,
0.28717073798179626,
-0.6134480834007263,
-0.20572631061077118,
0.07684162259101868,
0.18599191308021545,
0.43523305654525757,
-0.43391847610473633,
-0.22174830734729767,
-0.15912951529026031,
-0.0756906047463417,
-0.12547838687896729,
0.4388751983642578,
0.1783991903066635,
-0.19857299327850342,
0.058120787143707275,
-0.25035667419433594,
-0.06923972815275192,
-0.1769828498363495,
0.32306575775146484,
-0.008430525660514832,
0.050888918340206146,
-0.21918228268623352,
0.10400895774364471,
0.3328261077404022,
-0.07093829661607742,
-0.20637576282024384,
-0.2793428301811218,
-0.029353488236665726,
0.06112753972411156,
-0.26616689562797546,
0.15572930872440338,
-0.26587602496147156,
-0.02452719211578369,
0.11175438016653061,
0.17476198077201843,
-0.004768398590385914,
0.14171989262104034,
0.09514429420232773,
0.23060673475265503,
0.20078730583190918,
0.0978599488735199,
0.4081539809703827,
0.08435465395450592,
0.26157498359680176,
0.026359327137470245,
-0.016058051958680153,
-0.09524741023778915,
-0.19634290039539337,
-0.5441904664039612,
-0.06979077309370041,
-0.23005294799804688,
0.47970032691955566,
-0.2050441950559616,
-0.17903532087802887,
-0.04985557496547699,
-0.08081233501434326,
-0.04559389874339104,
0.21613672375679016,
0.619709312915802,
-0.08433903753757477,
0.03387746959924698,
0.1204904317855835,
0.31828367710113525,
-0.11680151522159576,
0.1911226063966751,
0.04757927358150482,
-0.06042690947651863,
-0.08892598003149033,
0.17952533066272736,
0.5387117862701416,
-0.37219706177711487,
0.3424330949783325,
0.1996888369321823,
0.46710360050201416,
-0.19052858650684357,
-0.1514507532119751,
-0.18654794991016388,
-0.01740100234746933,
0.18869464099407196,
0.007627781480550766,
0.04194001853466034,
0.24052883684635162,
-0.15900498628616333,
-0.11470441520214081,
0.09400743246078491,
-0.2652539610862732,
-0.09384723007678986,
0.03227796033024788,
0.04484368488192558,
-0.09525851160287857,
-0.2330176830291748,
-0.3073217272758484,
0.09292526543140411,
0.037364594638347626,
-0.10542857646942139,
0.09388474375009537,
-0.18031029403209686,
-0.23808330297470093,
-0.1588560938835144,
0.271628737449646,
0.6603160500526428,
-0.29885390400886536,
-0.14544497430324554,
0.32554319500923157,
-0.12255604565143585,
-0.11927320808172226,
0.2550254762172699,
-0.09432854503393173,
0.009946838021278381,
-0.26102373003959656,
0.19931451976299286,
0.18748818337917328,
-0.4092429578304291,
-0.14655740559101105,
0.396353542804718,
0.058407098054885864,
0.13573025166988373,
0.20805758237838745,
0.06181078031659126,
0.04158390685915947,
0.04601143300533295,
0.28067803382873535,
0.008305852301418781,
0.10472077131271362,
-0.09153573960065842,
-0.003415212035179138,
-0.20375406742095947,
0.09107531607151031,
0.3670077919960022,
-0.21133868396282196,
0.05503413826227188,
0.10750479996204376,
-0.11178306490182877,
0.17654049396514893,
-0.10396623611450195,
-0.03444817662239075,
0.5095411539077759,
0.13623763620853424,
0.32014578580856323,
0.07939956337213516,
-0.21166938543319702,
-0.5979294180870056,
0.13661986589431763,
0.2275741994380951,
-0.053531721234321594,
-0.26386529207229614,
-0.09572690725326538,
-0.1770210564136505,
0.060134559869766235,
-0.20953930914402008,
-0.014112904667854309,
-0.07209601998329163,
0.15332286059856415,
0.2246880829334259,
0.0292828232049942,
-0.2047475129365921,
0.4062136113643646,
-0.16938132047653198,
0.245487779378891,
-0.2644481062889099,
0.17883147299289703,
-0.03566547483205795,
-0.20230185985565186,
-0.05179573595523834,
0.1018906682729721,
-0.004675917327404022,
-0.2937566936016083,
0.09547410160303116,
0.46329742670059204,
0.05469230189919472,
0.08568492531776428,
-0.18478921055793762,
-0.09530840814113617,
0.22696512937545776,
-0.08083350211381912,
-0.027376921847462654,
0.29197049140930176,
0.20263512432575226,
-0.19178074598312378,
-0.2744138240814209,
0.19127023220062256,
-0.33558428287506104,
0.16342973709106445,
0.029872238636016846,
-0.10833264142274857,
-0.048433803021907806,
0.10796989500522614,
-0.30235612392425537,
-0.06359688192605972,
0.4508513808250427,
-0.24545635282993317,
0.26050445437431335,
0.001822158694267273,
-0.4244135022163391,
-0.2174912393093109,
0.41966497898101807,
-0.04605230689048767,
0.1226552426815033,
0.18774020671844482,
-0.21470129489898682,
0.2120124101638794,
-0.08776815235614777,
-0.041977427899837494,
0.5764286518096924,
0.1378009170293808,
-0.29834991693496704,
0.22981514036655426,
-0.11662109941244125,
-0.22127966582775116,
0.28909584879875183,
-0.04727776348590851,
-0.0982486680150032,
0.09601173549890518,
-0.1998824030160904,
0.008325614035129547,
-0.26002970337867737,
-0.06789300590753555,
-0.10154349356889725,
0.07152579724788666,
-0.412751168012619,
0.22236080467700958,
-0.3261348307132721,
-0.16208136081695557,
-0.353361576795578,
0.11997043341398239,
-0.29344743490219116,
-0.035253237932920456,
-0.2882404327392578,
0.2256356030702591,
0.16318251192569733,
0.036844104528427124,
-0.0255984365940094,
0.00393328070640564,
0.10042867064476013,
-0.5494061708450317,
-0.19856739044189453,
0.008163602091372013,
-0.23089352250099182,
-0.09342408180236816,
0.38237711787223816,
0.044111475348472595,
0.23747751116752625,
-0.3961958587169647,
-0.10942899435758591,
-0.09859373420476913,
-0.1599084585905075,
0.05576726794242859,
-0.06142425537109375,
0.19603170454502106,
0.05316426232457161,
0.22801974415779114,
-0.12375231087207794,
-0.13104702532291412,
0.4299977123737335,
-0.03813391551375389,
-0.1885630488395691,
0.2453443706035614,
0.41844668984413147,
-0.30971813201904297,
-0.2610921263694763,
-0.3623769283294678,
-0.1279265582561493,
-0.2842009663581848,
0.35814857482910156,
0.15591806173324585,
-0.02956918627023697,
0.5024074912071228,
0.42875543236732483,
0.15696276724338531,
-0.18035155534744263,
0.21657925844192505,
0.06529708951711655,
-0.168305441737175,
0.47165095806121826,
-0.16438469290733337,
-0.6319025158882141,
0.07756011188030243,
0.4496116042137146,
-0.2843746244907379,
0.21754126250743866,
-0.4422394633293152,
-0.06208041310310364,
-0.11925515532493591,
0.09208999574184418,
0.04108500853180885,
0.3046550154685974,
0.18646186590194702,
0.08041266351938248,
0.09567829221487045,
-0.05449400842189789,
-0.32142069935798645,
0.11587603390216827,
-0.21104341745376587,
0.03335344046354294,
0.2350960075855255,
0.3713708221912384,
-0.20123478770256042,
0.4552718997001648,
0.3391938805580139,
-0.06640851497650146,
0.2473822683095932,
-0.5043379664421082,
0.5094944834709167,
-0.1640397310256958,
-0.5347826480865479,
0.05617336183786392,
-0.21773487329483032,
0.1750391721725464,
0.27665549516677856,
0.1536443829536438,
0.3985491394996643,
-0.3371798098087311,
0.10423095524311066,
-0.07458600401878357,
-0.19977344572544098,
0.2598342299461365,
-0.11723457276821136,
0.07948076725006104,
-0.1508023738861084,
0.1711592972278595,
0.1823590099811554,
-0.23288646340370178,
0.03903879597783089,
0.6069951057434082,
-0.1873316764831543,
0.051549434661865234,
-0.39870980381965637,
0.0692128986120224,
-0.3697613775730133,
0.3847951889038086,
-0.04406869783997536,
0.3335779309272766,
-0.27299389243125916,
-0.10511372238397598,
0.01776283234357834,
-0.037272900342941284,
0.5544432401657104,
0.3075839877128601,
-0.19523999094963074,
0.017645690590143204,
-0.25824272632598877,
-0.3879300057888031,
0.0970630943775177,
-0.2831108272075653,
0.39122483134269714,
0.17978160083293915,
0.6442822217941284,
-0.30025559663772583,
-0.2145058959722519,
-0.09112641215324402,
0.4764972925186157,
-0.022832082584500313,
-0.31148800253868103,
-0.2785246968269348,
-0.16343708336353302,
-0.32626476883888245,
-0.24235379695892334,
0.02418855018913746,
0.2216685563325882,
-0.18151506781578064,
0.2211252897977829,
-0.05780911445617676,
-0.1648257076740265,
0.2988143563270569,
-0.030988162383437157,
0.2692626416683197,
-0.32836395502090454,
0.23207390308380127,
0.10623225569725037,
0.4693126380443573,
0.29696276783943176,
0.551525890827179,
-0.08975723385810852,
-0.46018892526626587,
0.020805126056075096,
-0.15819226205348969,
0.3489820659160614,
0.16609907150268555,
-0.27159419655799866,
0.14265033602714539,
0.2977319359779358,
0.11018599569797516,
-0.4385163486003876,
-0.0669691190123558,
0.5130975842475891,
0.2113116830587387,
-0.2971879243850708,
-0.4682973325252533,
0.36469128727912903,
0.028174743056297302,
0.14996710419654846,
0.27160051465034485,
0.17438693344593048,
-0.29298001527786255,
0.018115131184458733,
-0.3032904863357544,
0.8145564794540405,
-0.13513001799583435,
0.4673895835876465,
0.23452234268188477,
-0.08719875663518906,
0.397825688123703,
-0.053324341773986816,
0.06563602387905121,
-0.2903502881526947,
-0.014762661419808865,
-0.012935230508446693,
-0.17483539879322052,
0.4434725344181061,
0.17013514041900635,
-0.4242365062236786,
0.21922776103019714,
-0.013385012745857239,
0.31011340022087097,
-0.2710381746292114,
0.18515266478061676,
-0.4233771562576294,
-0.30676761269569397,
-0.34613505005836487,
0.03141036629676819,
0.14703771471977234,
0.3159361481666565,
-0.019304631277918816,
0.068677619099617,
-0.17888011038303375,
-0.2796393632888794,
-0.3666660785675049,
0.05740419775247574,
-0.32172903418540955,
0.05843834578990936,
0.21080191433429718,
-0.34539371728897095,
0.3396162986755371,
0.44701316952705383,
0.2227247804403305,
0.12587442994117737,
-0.16990654170513153,
-0.088034987449646,
-0.22852873802185059,
-0.10756894946098328,
0.001793119590729475,
-0.2334613800048828,
0.025620169937610626,
0.08667146414518356,
-0.27068498730659485,
-0.034228309988975525,
-0.0761411264538765,
-0.1780477911233902,
-0.011277124285697937,
0.13029271364212036,
-0.35141658782958984,
-0.4001733064651489,
-0.4443773031234741,
-0.16439521312713623,
0.1622946709394455,
-0.062214985489845276,
0.012506451457738876,
0.12515521049499512,
0.15351563692092896,
0.04247341305017471,
0.08630746603012085,
-0.1513926088809967,
-0.10639512538909912,
0.3808281421661377,
-0.4325576722621918,
-0.2435595542192459,
0.6115918159484863,
0.44780296087265015,
-0.1363862305879593,
-0.2047024667263031,
0.3153444230556488,
-0.02410351298749447,
-0.47063779830932617,
0.060029350221157074,
0.3476565480232239,
0.046982020139694214,
0.021084846928715706,
0.2753243148326874,
0.04095536470413208,
-0.1721467673778534,
0.10798409581184387,
-0.5703993439674377,
-0.3437374532222748,
0.19584468007087708,
0.29915693402290344,
0.13245421648025513,
0.22470954060554504,
-0.15168331563472748,
-0.01446075364947319,
-0.21246680617332458,
-0.1799510419368744,
0.028362778946757317,
0.07118233293294907,
-0.20901280641555786,
0.4280432164669037,
0.08135491609573364,
0.34466132521629333,
-0.242889866232872,
0.018016835674643517,
-0.008255444467067719,
0.06141901761293411,
-0.055910781025886536,
-0.13231714069843292,
0.13573800027370453,
-0.07649707794189453,
-0.18019047379493713,
-0.16954435408115387,
-0.3009037971496582,
-0.005444547161459923,
-0.30615487694740295,
0.1830039918422699,
0.4905685782432556,
-0.13221722841262817,
0.16604216396808624,
-0.2308713048696518,
0.24027419090270996,
-0.3294675946235657,
0.2159643918275833,
-0.33016255497932434,
0.3099440634250641,
0.11999452114105225,
0.06452429294586182,
-0.0035629512276500463,
0.07621486485004425,
-0.17964790761470795,
0.28044652938842773,
0.19380606710910797,
-0.08764828741550446,
0.2333926260471344,
-0.41730326414108276,
0.1791359931230545,
-0.1308647096157074,
0.4586465358734131,
0.6418233513832092,
-0.2389523833990097,
0.17709243297576904,
0.323751300573349,
0.0375068373978138,
-0.10668563842773438,
0.025385616347193718,
0.1342611461877823,
-0.07563222944736481,
0.05577952042222023,
0.2839002311229706,
-0.10994723439216614,
-0.07677105069160461,
0.014085404574871063,
0.04201062023639679,
0.3017368018627167,
0.1350492686033249,
0.04224539175629616,
0.31792572140693665,
0.28218626976013184,
0.21729479730129242,
-0.07895780354738235,
0.3243650197982788,
0.168809711933136,
0.3248772621154785,
-0.12702417373657227,
0.12640246748924255,
-0.18793323636054993,
0.3269268870353699,
-0.05856538563966751,
-0.3316076695919037,
0.12361234426498413,
0.054044149816036224,
-0.2286888062953949,
0.0388123095035553,
-0.21605685353279114,
0.5491749048233032,
-0.5157119035720825,
-0.009049078449606895,
-0.1283322274684906,
0.06846510618925095,
-0.050738804042339325,
-0.3157408833503723,
0.03204023092985153,
-0.23804622888565063,
-0.031142953783273697,
0.02466117963194847,
-0.0586087740957737,
-0.13547711074352264,
0.06375180184841156,
0.12601828575134277,
-0.033776625990867615,
-0.3310146629810333,
0.12166766077280045,
0.017429785802960396,
0.014899447560310364,
0.004908401519060135,
0.271010160446167,
0.15193212032318115,
0.21965689957141876,
0.3230520784854889,
0.3475780189037323,
0.5777649283409119,
0.4073307514190674,
0.10604949295520782,
0.24757611751556396,
-0.26939257979393005,
-0.012606486678123474,
-0.03941423445940018,
0.3580523133277893,
0.11281471699476242,
0.037804875522851944,
0.21644532680511475,
0.0713128075003624,
-0.03739205747842789,
-0.05451435223221779,
0.0653119832277298,
-0.11782512068748474,
-0.29895487427711487,
0.23282304406166077,
-0.2536523938179016,
-0.12917304039001465,
-0.17007729411125183,
-0.04674641042947769,
-0.44124355912208557,
-0.03883911296725273,
0.5237541794776917,
0.26585763692855835,
0.1927785575389862,
-0.042704228311777115,
0.02653927356004715,
0.3400239050388336,
0.4671337604522705,
0.38308992981910706,
0.23772022128105164,
-0.057062745094299316,
-0.011146128177642822,
-0.6012915968894958,
-0.011561572551727295,
0.009720947593450546,
-0.13737620413303375,
-0.2386874556541443,
-0.1536639928817749,
0.19780229032039642,
0.15514986217021942,
0.052321359515190125,
-0.1281723529100418,
0.2108141928911209,
-0.012030869722366333,
-0.05344913899898529,
-0.1669253706932068,
-0.015177987515926361,
0.13818711042404175,
0.004907839000225067,
-0.3023654520511627,
0.06138338893651962,
-0.10898315161466599,
-0.05648649111390114,
-0.3146934509277344,
0.42382538318634033,
-0.10585279762744904,
-0.33554357290267944,
0.13646440207958221,
-0.07306482642889023,
0.4701797068119049,
0.04250940680503845,
-0.16549621522426605,
-0.17986448109149933,
-0.23826564848423004,
0.021349098533391953,
0.43025344610214233,
0.15453454852104187,
0.005093453451991081,
-0.4908643364906311,
-0.49262502789497375,
-0.2662898600101471,
0.24394312500953674,
-0.059263601899147034,
-0.37303411960601807,
0.02461392618715763,
-0.018650636076927185,
-0.03545805811882019,
0.001153341494500637,
0.23331274092197418,
0.47853729128837585,
-0.27210986614227295,
0.010619590058922768,
-0.14781954884529114,
-0.12781193852424622,
0.3023917078971863,
-0.4510454535484314,
-0.2669309973716736,
0.030796915292739868,
0.008957751095294952,
0.015702150762081146,
0.049648672342300415,
-0.5663859248161316,
0.12508678436279297,
0.13597729802131653,
-0.10330649465322495,
-0.13997501134872437,
0.053034666925668716,
-0.18257488310337067,
-0.03638375550508499,
-0.1389525681734085,
0.454903244972229,
0.08838391304016113,
-0.25883957743644714,
0.09736847877502441,
-0.20569591224193573
] |
https://github.com/huggingface/datasets/issues/622 | load_dataset for text files not working | ```python
Traceback` (most recent call last):
File "main.py", line 281, in <module>
main()
File "main.py", line 190, in main
train_data, test_data = data_factory(
File "main.py", line 129, in data_factory
train_data = load_dataset('text',
File "/home/me/Downloads/datasets/src/datasets/load.py", line 608, in load_dataset
builder_instance.download_and_prepare(
File "/home/me/Downloads/datasets/src/datasets/builder.py", line 468, in download_and_prepare
self._download_and_prepare(
File "/home/me/Downloads/datasets/src/datasets/builder.py", line 546, in _download_and_prepare
self._prepare_split(split_generator, **prepare_split_kwargs)
File "/home/me/Downloads/datasets/src/datasets/builder.py", line 888, in _prepare_split
for key, table in utils.tqdm(generator, unit=" tables", leave=False, disable=not_verbose):
File "/home/me/.local/lib/python3.8/site-packages/tqdm/std.py", line 1130, in __iter__
for obj in iterable:
File "/home/me/.cache/huggingface/modules/datasets_modules/datasets/text/512f465342e4f4cd07a8791428a629c043bb89d55ad7817cbf7fcc649178b014/text.py", line 103, in _generate_tables
pa_table = pac.read_csv(
File "pyarrow/_csv.pyx", line 617, in pyarrow._csv.read_csv
File "pyarrow/error.pxi", line 123, in pyarrow.lib.pyarrow_internal_check_status
File "pyarrow/error.pxi", line 85, in pyarrow.lib.check_status
pyarrow.lib.ArrowInvalid: CSV parse error: Expected 1 columns, got 2
```
Unfortunately i am still getting this issue on Linux. I installed datasets from source and specified script_version to master.
| Trying the following snippet, I get different problems on Linux and Windows.
```python
dataset = load_dataset("text", data_files="data.txt")
# or
dataset = load_dataset("text", data_files=["data.txt"])
```
(ps [This example](https://huggingface.co/docs/datasets/loading_datasets.html#json-files) shows that you can use a string as input for data_files, but the signature is `Union[Dict, List]`.)
The problem on Linux is that the script crashes with a CSV error (even though it isn't a CSV file). On Windows the script just seems to freeze or get stuck after loading the config file.
Linux stack trace:
```
PyTorch version 1.6.0+cu101 available.
Checking /home/bram/.cache/huggingface/datasets/b1d50a0e74da9a7b9822cea8ff4e4f217dd892e09eb14f6274a2169e5436e2ea.30c25842cda32b0540d88b7195147decf9671ee442f4bc2fb6ad74016852978e.py for additional imports.
Found main folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text
Found specific version folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7
Found script file from https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py to /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py
Couldn't find dataset infos file at https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/dataset_infos.json
Found metadata file for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.json
Using custom data configuration default
Generating dataset text (/home/bram/.cache/huggingface/datasets/text/default-0907112cc6cd2a38/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7)
Downloading and preparing dataset text/default-0907112cc6cd2a38 (download: Unknown size, generated: Unknown size, post-processed: Unknown size, total: Unknown size) to /home/bram/.cache/huggingface/datasets/text/default-0907112cc6cd2a38/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7...
Dataset not on Hf google storage. Downloading and preparing it from source
Downloading took 0.0 min
Checksum Computation took 0.0 min
Unable to verify checksums.
Generating split train
Traceback (most recent call last):
File "/home/bram/Python/projects/dutch-simplification/utils.py", line 45, in prepare_data
dataset = load_dataset("text", data_files=dataset_f)
File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/load.py", line 608, in load_dataset
builder_instance.download_and_prepare(
File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 468, in download_and_prepare
self._download_and_prepare(
File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 546, in _download_and_prepare
self._prepare_split(split_generator, **prepare_split_kwargs)
File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 888, in _prepare_split
for key, table in utils.tqdm(generator, unit=" tables", leave=False, disable=not_verbose):
File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/tqdm/std.py", line 1130, in __iter__
for obj in iterable:
File "/home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py", line 100, in _generate_tables
pa_table = pac.read_csv(
File "pyarrow/_csv.pyx", line 714, in pyarrow._csv.read_csv
File "pyarrow/error.pxi", line 122, in pyarrow.lib.pyarrow_internal_check_status
File "pyarrow/error.pxi", line 84, in pyarrow.lib.check_status
pyarrow.lib.ArrowInvalid: CSV parse error: Expected 1 columns, got 2
```
Windows just seems to get stuck. Even with a tiny dataset of 10 lines, it has been stuck for 15 minutes already at this message:
```
Checking C:\Users\bramv\.cache\huggingface\datasets\b1d50a0e74da9a7b9822cea8ff4e4f217dd892e09eb14f6274a2169e5436e2ea.30c25842cda32b0540d88b7195147decf9671ee442f4bc2fb6ad74016852978e.py for additional imports.
Found main folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text
Found specific version folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7
Found script file from https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py to C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7\text.py
Couldn't find dataset infos file at https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text\dataset_infos.json
Found metadata file for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7\text.json
Using custom data configuration default
```
| 135 | load_dataset for text files not working
Trying the following snippet, I get different problems on Linux and Windows.
```python
dataset = load_dataset("text", data_files="data.txt")
# or
dataset = load_dataset("text", data_files=["data.txt"])
```
(ps [This example](https://huggingface.co/docs/datasets/loading_datasets.html#json-files) shows that you can use a string as input for data_files, but the signature is `Union[Dict, List]`.)
The problem on Linux is that the script crashes with a CSV error (even though it isn't a CSV file). On Windows the script just seems to freeze or get stuck after loading the config file.
Linux stack trace:
```
PyTorch version 1.6.0+cu101 available.
Checking /home/bram/.cache/huggingface/datasets/b1d50a0e74da9a7b9822cea8ff4e4f217dd892e09eb14f6274a2169e5436e2ea.30c25842cda32b0540d88b7195147decf9671ee442f4bc2fb6ad74016852978e.py for additional imports.
Found main folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text
Found specific version folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7
Found script file from https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py to /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py
Couldn't find dataset infos file at https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/dataset_infos.json
Found metadata file for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.json
Using custom data configuration default
Generating dataset text (/home/bram/.cache/huggingface/datasets/text/default-0907112cc6cd2a38/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7)
Downloading and preparing dataset text/default-0907112cc6cd2a38 (download: Unknown size, generated: Unknown size, post-processed: Unknown size, total: Unknown size) to /home/bram/.cache/huggingface/datasets/text/default-0907112cc6cd2a38/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7...
Dataset not on Hf google storage. Downloading and preparing it from source
Downloading took 0.0 min
Checksum Computation took 0.0 min
Unable to verify checksums.
Generating split train
Traceback (most recent call last):
File "/home/bram/Python/projects/dutch-simplification/utils.py", line 45, in prepare_data
dataset = load_dataset("text", data_files=dataset_f)
File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/load.py", line 608, in load_dataset
builder_instance.download_and_prepare(
File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 468, in download_and_prepare
self._download_and_prepare(
File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 546, in _download_and_prepare
self._prepare_split(split_generator, **prepare_split_kwargs)
File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 888, in _prepare_split
for key, table in utils.tqdm(generator, unit=" tables", leave=False, disable=not_verbose):
File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/tqdm/std.py", line 1130, in __iter__
for obj in iterable:
File "/home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py", line 100, in _generate_tables
pa_table = pac.read_csv(
File "pyarrow/_csv.pyx", line 714, in pyarrow._csv.read_csv
File "pyarrow/error.pxi", line 122, in pyarrow.lib.pyarrow_internal_check_status
File "pyarrow/error.pxi", line 84, in pyarrow.lib.check_status
pyarrow.lib.ArrowInvalid: CSV parse error: Expected 1 columns, got 2
```
Windows just seems to get stuck. Even with a tiny dataset of 10 lines, it has been stuck for 15 minutes already at this message:
```
Checking C:\Users\bramv\.cache\huggingface\datasets\b1d50a0e74da9a7b9822cea8ff4e4f217dd892e09eb14f6274a2169e5436e2ea.30c25842cda32b0540d88b7195147decf9671ee442f4bc2fb6ad74016852978e.py for additional imports.
Found main folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text
Found specific version folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7
Found script file from https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py to C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7\text.py
Couldn't find dataset infos file at https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text\dataset_infos.json
Found metadata file for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7\text.json
Using custom data configuration default
```
```python
Traceback` (most recent call last):
File "main.py", line 281, in <module>
main()
File "main.py", line 190, in main
train_data, test_data = data_factory(
File "main.py", line 129, in data_factory
train_data = load_dataset('text',
File "/home/me/Downloads/datasets/src/datasets/load.py", line 608, in load_dataset
builder_instance.download_and_prepare(
File "/home/me/Downloads/datasets/src/datasets/builder.py", line 468, in download_and_prepare
self._download_and_prepare(
File "/home/me/Downloads/datasets/src/datasets/builder.py", line 546, in _download_and_prepare
self._prepare_split(split_generator, **prepare_split_kwargs)
File "/home/me/Downloads/datasets/src/datasets/builder.py", line 888, in _prepare_split
for key, table in utils.tqdm(generator, unit=" tables", leave=False, disable=not_verbose):
File "/home/me/.local/lib/python3.8/site-packages/tqdm/std.py", line 1130, in __iter__
for obj in iterable:
File "/home/me/.cache/huggingface/modules/datasets_modules/datasets/text/512f465342e4f4cd07a8791428a629c043bb89d55ad7817cbf7fcc649178b014/text.py", line 103, in _generate_tables
pa_table = pac.read_csv(
File "pyarrow/_csv.pyx", line 617, in pyarrow._csv.read_csv
File "pyarrow/error.pxi", line 123, in pyarrow.lib.pyarrow_internal_check_status
File "pyarrow/error.pxi", line 85, in pyarrow.lib.check_status
pyarrow.lib.ArrowInvalid: CSV parse error: Expected 1 columns, got 2
```
Unfortunately i am still getting this issue on Linux. I installed datasets from source and specified script_version to master.
| [
-0.27466508746147156,
-0.4020572602748871,
0.01756073161959648,
0.38725215196609497,
0.26964259147644043,
-0.038661353290081024,
0.318887859582901,
-0.05435653403401375,
0.4263593256473541,
-0.058048903942108154,
0.06597194820642471,
0.14552471041679382,
-0.15576286613941193,
0.27420055866241455,
0.06355622410774231,
-0.03507590293884277,
0.15718327462673187,
-0.013841032981872559,
-0.29144343733787537,
0.04024842381477356,
-0.11445463448762894,
0.34312117099761963,
-0.2153358906507492,
-0.14693012833595276,
-0.4160703420639038,
0.27400466799736023,
-0.10501692444086075,
0.453878253698349,
-0.07426194846630096,
-0.2378564178943634,
0.2710002362728119,
0.12820816040039062,
0.16396383941173553,
0.6136502027511597,
-0.00012696169142145663,
0.11003263294696808,
0.27564769983291626,
-0.16101115942001343,
-0.2998278737068176,
-0.5695475935935974,
0.15851548314094543,
-0.22943682968616486,
0.20884843170642853,
-0.02878069132566452,
0.13019275665283203,
-0.00452867615967989,
0.1527262032032013,
-0.3340619206428528,
0.3551647365093231,
0.325478196144104,
0.1009778082370758,
0.31933706998825073,
0.062094781547784805,
-0.014658169820904732,
0.06096186861395836,
0.476550817489624,
-0.09174498170614243,
0.39064982533454895,
0.3137863278388977,
-0.19428719580173492,
0.11695243418216705,
-0.08240078389644623,
-0.17309308052062988,
-0.16965323686599731,
0.3285274803638458,
0.28717073798179626,
-0.6134480834007263,
-0.20572631061077118,
0.07684162259101868,
0.18599191308021545,
0.43523305654525757,
-0.43391847610473633,
-0.22174830734729767,
-0.15912951529026031,
-0.0756906047463417,
-0.12547838687896729,
0.4388751983642578,
0.1783991903066635,
-0.19857299327850342,
0.058120787143707275,
-0.25035667419433594,
-0.06923972815275192,
-0.1769828498363495,
0.32306575775146484,
-0.008430525660514832,
0.050888918340206146,
-0.21918228268623352,
0.10400895774364471,
0.3328261077404022,
-0.07093829661607742,
-0.20637576282024384,
-0.2793428301811218,
-0.029353488236665726,
0.06112753972411156,
-0.26616689562797546,
0.15572930872440338,
-0.26587602496147156,
-0.02452719211578369,
0.11175438016653061,
0.17476198077201843,
-0.004768398590385914,
0.14171989262104034,
0.09514429420232773,
0.23060673475265503,
0.20078730583190918,
0.0978599488735199,
0.4081539809703827,
0.08435465395450592,
0.26157498359680176,
0.026359327137470245,
-0.016058051958680153,
-0.09524741023778915,
-0.19634290039539337,
-0.5441904664039612,
-0.06979077309370041,
-0.23005294799804688,
0.47970032691955566,
-0.2050441950559616,
-0.17903532087802887,
-0.04985557496547699,
-0.08081233501434326,
-0.04559389874339104,
0.21613672375679016,
0.619709312915802,
-0.08433903753757477,
0.03387746959924698,
0.1204904317855835,
0.31828367710113525,
-0.11680151522159576,
0.1911226063966751,
0.04757927358150482,
-0.06042690947651863,
-0.08892598003149033,
0.17952533066272736,
0.5387117862701416,
-0.37219706177711487,
0.3424330949783325,
0.1996888369321823,
0.46710360050201416,
-0.19052858650684357,
-0.1514507532119751,
-0.18654794991016388,
-0.01740100234746933,
0.18869464099407196,
0.007627781480550766,
0.04194001853466034,
0.24052883684635162,
-0.15900498628616333,
-0.11470441520214081,
0.09400743246078491,
-0.2652539610862732,
-0.09384723007678986,
0.03227796033024788,
0.04484368488192558,
-0.09525851160287857,
-0.2330176830291748,
-0.3073217272758484,
0.09292526543140411,
0.037364594638347626,
-0.10542857646942139,
0.09388474375009537,
-0.18031029403209686,
-0.23808330297470093,
-0.1588560938835144,
0.271628737449646,
0.6603160500526428,
-0.29885390400886536,
-0.14544497430324554,
0.32554319500923157,
-0.12255604565143585,
-0.11927320808172226,
0.2550254762172699,
-0.09432854503393173,
0.009946838021278381,
-0.26102373003959656,
0.19931451976299286,
0.18748818337917328,
-0.4092429578304291,
-0.14655740559101105,
0.396353542804718,
0.058407098054885864,
0.13573025166988373,
0.20805758237838745,
0.06181078031659126,
0.04158390685915947,
0.04601143300533295,
0.28067803382873535,
0.008305852301418781,
0.10472077131271362,
-0.09153573960065842,
-0.003415212035179138,
-0.20375406742095947,
0.09107531607151031,
0.3670077919960022,
-0.21133868396282196,
0.05503413826227188,
0.10750479996204376,
-0.11178306490182877,
0.17654049396514893,
-0.10396623611450195,
-0.03444817662239075,
0.5095411539077759,
0.13623763620853424,
0.32014578580856323,
0.07939956337213516,
-0.21166938543319702,
-0.5979294180870056,
0.13661986589431763,
0.2275741994380951,
-0.053531721234321594,
-0.26386529207229614,
-0.09572690725326538,
-0.1770210564136505,
0.060134559869766235,
-0.20953930914402008,
-0.014112904667854309,
-0.07209601998329163,
0.15332286059856415,
0.2246880829334259,
0.0292828232049942,
-0.2047475129365921,
0.4062136113643646,
-0.16938132047653198,
0.245487779378891,
-0.2644481062889099,
0.17883147299289703,
-0.03566547483205795,
-0.20230185985565186,
-0.05179573595523834,
0.1018906682729721,
-0.004675917327404022,
-0.2937566936016083,
0.09547410160303116,
0.46329742670059204,
0.05469230189919472,
0.08568492531776428,
-0.18478921055793762,
-0.09530840814113617,
0.22696512937545776,
-0.08083350211381912,
-0.027376921847462654,
0.29197049140930176,
0.20263512432575226,
-0.19178074598312378,
-0.2744138240814209,
0.19127023220062256,
-0.33558428287506104,
0.16342973709106445,
0.029872238636016846,
-0.10833264142274857,
-0.048433803021907806,
0.10796989500522614,
-0.30235612392425537,
-0.06359688192605972,
0.4508513808250427,
-0.24545635282993317,
0.26050445437431335,
0.001822158694267273,
-0.4244135022163391,
-0.2174912393093109,
0.41966497898101807,
-0.04605230689048767,
0.1226552426815033,
0.18774020671844482,
-0.21470129489898682,
0.2120124101638794,
-0.08776815235614777,
-0.041977427899837494,
0.5764286518096924,
0.1378009170293808,
-0.29834991693496704,
0.22981514036655426,
-0.11662109941244125,
-0.22127966582775116,
0.28909584879875183,
-0.04727776348590851,
-0.0982486680150032,
0.09601173549890518,
-0.1998824030160904,
0.008325614035129547,
-0.26002970337867737,
-0.06789300590753555,
-0.10154349356889725,
0.07152579724788666,
-0.412751168012619,
0.22236080467700958,
-0.3261348307132721,
-0.16208136081695557,
-0.353361576795578,
0.11997043341398239,
-0.29344743490219116,
-0.035253237932920456,
-0.2882404327392578,
0.2256356030702591,
0.16318251192569733,
0.036844104528427124,
-0.0255984365940094,
0.00393328070640564,
0.10042867064476013,
-0.5494061708450317,
-0.19856739044189453,
0.008163602091372013,
-0.23089352250099182,
-0.09342408180236816,
0.38237711787223816,
0.044111475348472595,
0.23747751116752625,
-0.3961958587169647,
-0.10942899435758591,
-0.09859373420476913,
-0.1599084585905075,
0.05576726794242859,
-0.06142425537109375,
0.19603170454502106,
0.05316426232457161,
0.22801974415779114,
-0.12375231087207794,
-0.13104702532291412,
0.4299977123737335,
-0.03813391551375389,
-0.1885630488395691,
0.2453443706035614,
0.41844668984413147,
-0.30971813201904297,
-0.2610921263694763,
-0.3623769283294678,
-0.1279265582561493,
-0.2842009663581848,
0.35814857482910156,
0.15591806173324585,
-0.02956918627023697,
0.5024074912071228,
0.42875543236732483,
0.15696276724338531,
-0.18035155534744263,
0.21657925844192505,
0.06529708951711655,
-0.168305441737175,
0.47165095806121826,
-0.16438469290733337,
-0.6319025158882141,
0.07756011188030243,
0.4496116042137146,
-0.2843746244907379,
0.21754126250743866,
-0.4422394633293152,
-0.06208041310310364,
-0.11925515532493591,
0.09208999574184418,
0.04108500853180885,
0.3046550154685974,
0.18646186590194702,
0.08041266351938248,
0.09567829221487045,
-0.05449400842189789,
-0.32142069935798645,
0.11587603390216827,
-0.21104341745376587,
0.03335344046354294,
0.2350960075855255,
0.3713708221912384,
-0.20123478770256042,
0.4552718997001648,
0.3391938805580139,
-0.06640851497650146,
0.2473822683095932,
-0.5043379664421082,
0.5094944834709167,
-0.1640397310256958,
-0.5347826480865479,
0.05617336183786392,
-0.21773487329483032,
0.1750391721725464,
0.27665549516677856,
0.1536443829536438,
0.3985491394996643,
-0.3371798098087311,
0.10423095524311066,
-0.07458600401878357,
-0.19977344572544098,
0.2598342299461365,
-0.11723457276821136,
0.07948076725006104,
-0.1508023738861084,
0.1711592972278595,
0.1823590099811554,
-0.23288646340370178,
0.03903879597783089,
0.6069951057434082,
-0.1873316764831543,
0.051549434661865234,
-0.39870980381965637,
0.0692128986120224,
-0.3697613775730133,
0.3847951889038086,
-0.04406869783997536,
0.3335779309272766,
-0.27299389243125916,
-0.10511372238397598,
0.01776283234357834,
-0.037272900342941284,
0.5544432401657104,
0.3075839877128601,
-0.19523999094963074,
0.017645690590143204,
-0.25824272632598877,
-0.3879300057888031,
0.0970630943775177,
-0.2831108272075653,
0.39122483134269714,
0.17978160083293915,
0.6442822217941284,
-0.30025559663772583,
-0.2145058959722519,
-0.09112641215324402,
0.4764972925186157,
-0.022832082584500313,
-0.31148800253868103,
-0.2785246968269348,
-0.16343708336353302,
-0.32626476883888245,
-0.24235379695892334,
0.02418855018913746,
0.2216685563325882,
-0.18151506781578064,
0.2211252897977829,
-0.05780911445617676,
-0.1648257076740265,
0.2988143563270569,
-0.030988162383437157,
0.2692626416683197,
-0.32836395502090454,
0.23207390308380127,
0.10623225569725037,
0.4693126380443573,
0.29696276783943176,
0.551525890827179,
-0.08975723385810852,
-0.46018892526626587,
0.020805126056075096,
-0.15819226205348969,
0.3489820659160614,
0.16609907150268555,
-0.27159419655799866,
0.14265033602714539,
0.2977319359779358,
0.11018599569797516,
-0.4385163486003876,
-0.0669691190123558,
0.5130975842475891,
0.2113116830587387,
-0.2971879243850708,
-0.4682973325252533,
0.36469128727912903,
0.028174743056297302,
0.14996710419654846,
0.27160051465034485,
0.17438693344593048,
-0.29298001527786255,
0.018115131184458733,
-0.3032904863357544,
0.8145564794540405,
-0.13513001799583435,
0.4673895835876465,
0.23452234268188477,
-0.08719875663518906,
0.397825688123703,
-0.053324341773986816,
0.06563602387905121,
-0.2903502881526947,
-0.014762661419808865,
-0.012935230508446693,
-0.17483539879322052,
0.4434725344181061,
0.17013514041900635,
-0.4242365062236786,
0.21922776103019714,
-0.013385012745857239,
0.31011340022087097,
-0.2710381746292114,
0.18515266478061676,
-0.4233771562576294,
-0.30676761269569397,
-0.34613505005836487,
0.03141036629676819,
0.14703771471977234,
0.3159361481666565,
-0.019304631277918816,
0.068677619099617,
-0.17888011038303375,
-0.2796393632888794,
-0.3666660785675049,
0.05740419775247574,
-0.32172903418540955,
0.05843834578990936,
0.21080191433429718,
-0.34539371728897095,
0.3396162986755371,
0.44701316952705383,
0.2227247804403305,
0.12587442994117737,
-0.16990654170513153,
-0.088034987449646,
-0.22852873802185059,
-0.10756894946098328,
0.001793119590729475,
-0.2334613800048828,
0.025620169937610626,
0.08667146414518356,
-0.27068498730659485,
-0.034228309988975525,
-0.0761411264538765,
-0.1780477911233902,
-0.011277124285697937,
0.13029271364212036,
-0.35141658782958984,
-0.4001733064651489,
-0.4443773031234741,
-0.16439521312713623,
0.1622946709394455,
-0.062214985489845276,
0.012506451457738876,
0.12515521049499512,
0.15351563692092896,
0.04247341305017471,
0.08630746603012085,
-0.1513926088809967,
-0.10639512538909912,
0.3808281421661377,
-0.4325576722621918,
-0.2435595542192459,
0.6115918159484863,
0.44780296087265015,
-0.1363862305879593,
-0.2047024667263031,
0.3153444230556488,
-0.02410351298749447,
-0.47063779830932617,
0.060029350221157074,
0.3476565480232239,
0.046982020139694214,
0.021084846928715706,
0.2753243148326874,
0.04095536470413208,
-0.1721467673778534,
0.10798409581184387,
-0.5703993439674377,
-0.3437374532222748,
0.19584468007087708,
0.29915693402290344,
0.13245421648025513,
0.22470954060554504,
-0.15168331563472748,
-0.01446075364947319,
-0.21246680617332458,
-0.1799510419368744,
0.028362778946757317,
0.07118233293294907,
-0.20901280641555786,
0.4280432164669037,
0.08135491609573364,
0.34466132521629333,
-0.242889866232872,
0.018016835674643517,
-0.008255444467067719,
0.06141901761293411,
-0.055910781025886536,
-0.13231714069843292,
0.13573800027370453,
-0.07649707794189453,
-0.18019047379493713,
-0.16954435408115387,
-0.3009037971496582,
-0.005444547161459923,
-0.30615487694740295,
0.1830039918422699,
0.4905685782432556,
-0.13221722841262817,
0.16604216396808624,
-0.2308713048696518,
0.24027419090270996,
-0.3294675946235657,
0.2159643918275833,
-0.33016255497932434,
0.3099440634250641,
0.11999452114105225,
0.06452429294586182,
-0.0035629512276500463,
0.07621486485004425,
-0.17964790761470795,
0.28044652938842773,
0.19380606710910797,
-0.08764828741550446,
0.2333926260471344,
-0.41730326414108276,
0.1791359931230545,
-0.1308647096157074,
0.4586465358734131,
0.6418233513832092,
-0.2389523833990097,
0.17709243297576904,
0.323751300573349,
0.0375068373978138,
-0.10668563842773438,
0.025385616347193718,
0.1342611461877823,
-0.07563222944736481,
0.05577952042222023,
0.2839002311229706,
-0.10994723439216614,
-0.07677105069160461,
0.014085404574871063,
0.04201062023639679,
0.3017368018627167,
0.1350492686033249,
0.04224539175629616,
0.31792572140693665,
0.28218626976013184,
0.21729479730129242,
-0.07895780354738235,
0.3243650197982788,
0.168809711933136,
0.3248772621154785,
-0.12702417373657227,
0.12640246748924255,
-0.18793323636054993,
0.3269268870353699,
-0.05856538563966751,
-0.3316076695919037,
0.12361234426498413,
0.054044149816036224,
-0.2286888062953949,
0.0388123095035553,
-0.21605685353279114,
0.5491749048233032,
-0.5157119035720825,
-0.009049078449606895,
-0.1283322274684906,
0.06846510618925095,
-0.050738804042339325,
-0.3157408833503723,
0.03204023092985153,
-0.23804622888565063,
-0.031142953783273697,
0.02466117963194847,
-0.0586087740957737,
-0.13547711074352264,
0.06375180184841156,
0.12601828575134277,
-0.033776625990867615,
-0.3310146629810333,
0.12166766077280045,
0.017429785802960396,
0.014899447560310364,
0.004908401519060135,
0.271010160446167,
0.15193212032318115,
0.21965689957141876,
0.3230520784854889,
0.3475780189037323,
0.5777649283409119,
0.4073307514190674,
0.10604949295520782,
0.24757611751556396,
-0.26939257979393005,
-0.012606486678123474,
-0.03941423445940018,
0.3580523133277893,
0.11281471699476242,
0.037804875522851944,
0.21644532680511475,
0.0713128075003624,
-0.03739205747842789,
-0.05451435223221779,
0.0653119832277298,
-0.11782512068748474,
-0.29895487427711487,
0.23282304406166077,
-0.2536523938179016,
-0.12917304039001465,
-0.17007729411125183,
-0.04674641042947769,
-0.44124355912208557,
-0.03883911296725273,
0.5237541794776917,
0.26585763692855835,
0.1927785575389862,
-0.042704228311777115,
0.02653927356004715,
0.3400239050388336,
0.4671337604522705,
0.38308992981910706,
0.23772022128105164,
-0.057062745094299316,
-0.011146128177642822,
-0.6012915968894958,
-0.011561572551727295,
0.009720947593450546,
-0.13737620413303375,
-0.2386874556541443,
-0.1536639928817749,
0.19780229032039642,
0.15514986217021942,
0.052321359515190125,
-0.1281723529100418,
0.2108141928911209,
-0.012030869722366333,
-0.05344913899898529,
-0.1669253706932068,
-0.015177987515926361,
0.13818711042404175,
0.004907839000225067,
-0.3023654520511627,
0.06138338893651962,
-0.10898315161466599,
-0.05648649111390114,
-0.3146934509277344,
0.42382538318634033,
-0.10585279762744904,
-0.33554357290267944,
0.13646440207958221,
-0.07306482642889023,
0.4701797068119049,
0.04250940680503845,
-0.16549621522426605,
-0.17986448109149933,
-0.23826564848423004,
0.021349098533391953,
0.43025344610214233,
0.15453454852104187,
0.005093453451991081,
-0.4908643364906311,
-0.49262502789497375,
-0.2662898600101471,
0.24394312500953674,
-0.059263601899147034,
-0.37303411960601807,
0.02461392618715763,
-0.018650636076927185,
-0.03545805811882019,
0.001153341494500637,
0.23331274092197418,
0.47853729128837585,
-0.27210986614227295,
0.010619590058922768,
-0.14781954884529114,
-0.12781193852424622,
0.3023917078971863,
-0.4510454535484314,
-0.2669309973716736,
0.030796915292739868,
0.008957751095294952,
0.015702150762081146,
0.049648672342300415,
-0.5663859248161316,
0.12508678436279297,
0.13597729802131653,
-0.10330649465322495,
-0.13997501134872437,
0.053034666925668716,
-0.18257488310337067,
-0.03638375550508499,
-0.1389525681734085,
0.454903244972229,
0.08838391304016113,
-0.25883957743644714,
0.09736847877502441,
-0.20569591224193573
] |
https://github.com/huggingface/datasets/issues/622 | load_dataset for text files not working | > 
> win10, py3.6
>
> ```
> from datasets import Features, Value, ClassLabel, load_dataset
>
>
> features = Features({'text': Value('string'), 'ctext': Value('string')})
> file_dict = {'train': PATH/'summary.csv'}
>
> dataset = load_dataset('csv', data_files=file_dict, script_version='master', delimiter='\t', column_names=['text', 'ctext'], features=features)
> ```
Since #644 it should now work on windows @ScottishFold007
> Trying the following snippet, I get different problems on Linux and Windows.
>
> ```python
> dataset = load_dataset("text", data_files="data.txt")
> # or
> dataset = load_dataset("text", data_files=["data.txt"])
> ```
>
> Windows just seems to get stuck. Even with a tiny dataset of 10 lines, it has been stuck for 15 minutes already at this message:
>
> ```
> Checking C:\Users\bramv\.cache\huggingface\datasets\b1d50a0e74da9a7b9822cea8ff4e4f217dd892e09eb14f6274a2169e5436e2ea.30c25842cda32b0540d88b7195147decf9671ee442f4bc2fb6ad74016852978e.py for additional imports.
> Found main folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text
> Found specific version folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7
> Found script file from https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py to C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7\text.py
> Couldn't find dataset infos file at https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text\dataset_infos.json
> Found metadata file for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7\text.json
> Using custom data configuration default
> ```
Same for you @BramVanroy .
Not sure about the one on linux though | Trying the following snippet, I get different problems on Linux and Windows.
```python
dataset = load_dataset("text", data_files="data.txt")
# or
dataset = load_dataset("text", data_files=["data.txt"])
```
(ps [This example](https://huggingface.co/docs/datasets/loading_datasets.html#json-files) shows that you can use a string as input for data_files, but the signature is `Union[Dict, List]`.)
The problem on Linux is that the script crashes with a CSV error (even though it isn't a CSV file). On Windows the script just seems to freeze or get stuck after loading the config file.
Linux stack trace:
```
PyTorch version 1.6.0+cu101 available.
Checking /home/bram/.cache/huggingface/datasets/b1d50a0e74da9a7b9822cea8ff4e4f217dd892e09eb14f6274a2169e5436e2ea.30c25842cda32b0540d88b7195147decf9671ee442f4bc2fb6ad74016852978e.py for additional imports.
Found main folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text
Found specific version folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7
Found script file from https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py to /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py
Couldn't find dataset infos file at https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/dataset_infos.json
Found metadata file for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.json
Using custom data configuration default
Generating dataset text (/home/bram/.cache/huggingface/datasets/text/default-0907112cc6cd2a38/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7)
Downloading and preparing dataset text/default-0907112cc6cd2a38 (download: Unknown size, generated: Unknown size, post-processed: Unknown size, total: Unknown size) to /home/bram/.cache/huggingface/datasets/text/default-0907112cc6cd2a38/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7...
Dataset not on Hf google storage. Downloading and preparing it from source
Downloading took 0.0 min
Checksum Computation took 0.0 min
Unable to verify checksums.
Generating split train
Traceback (most recent call last):
File "/home/bram/Python/projects/dutch-simplification/utils.py", line 45, in prepare_data
dataset = load_dataset("text", data_files=dataset_f)
File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/load.py", line 608, in load_dataset
builder_instance.download_and_prepare(
File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 468, in download_and_prepare
self._download_and_prepare(
File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 546, in _download_and_prepare
self._prepare_split(split_generator, **prepare_split_kwargs)
File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 888, in _prepare_split
for key, table in utils.tqdm(generator, unit=" tables", leave=False, disable=not_verbose):
File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/tqdm/std.py", line 1130, in __iter__
for obj in iterable:
File "/home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py", line 100, in _generate_tables
pa_table = pac.read_csv(
File "pyarrow/_csv.pyx", line 714, in pyarrow._csv.read_csv
File "pyarrow/error.pxi", line 122, in pyarrow.lib.pyarrow_internal_check_status
File "pyarrow/error.pxi", line 84, in pyarrow.lib.check_status
pyarrow.lib.ArrowInvalid: CSV parse error: Expected 1 columns, got 2
```
Windows just seems to get stuck. Even with a tiny dataset of 10 lines, it has been stuck for 15 minutes already at this message:
```
Checking C:\Users\bramv\.cache\huggingface\datasets\b1d50a0e74da9a7b9822cea8ff4e4f217dd892e09eb14f6274a2169e5436e2ea.30c25842cda32b0540d88b7195147decf9671ee442f4bc2fb6ad74016852978e.py for additional imports.
Found main folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text
Found specific version folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7
Found script file from https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py to C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7\text.py
Couldn't find dataset infos file at https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text\dataset_infos.json
Found metadata file for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7\text.json
Using custom data configuration default
```
| 184 | load_dataset for text files not working
Trying the following snippet, I get different problems on Linux and Windows.
```python
dataset = load_dataset("text", data_files="data.txt")
# or
dataset = load_dataset("text", data_files=["data.txt"])
```
(ps [This example](https://huggingface.co/docs/datasets/loading_datasets.html#json-files) shows that you can use a string as input for data_files, but the signature is `Union[Dict, List]`.)
The problem on Linux is that the script crashes with a CSV error (even though it isn't a CSV file). On Windows the script just seems to freeze or get stuck after loading the config file.
Linux stack trace:
```
PyTorch version 1.6.0+cu101 available.
Checking /home/bram/.cache/huggingface/datasets/b1d50a0e74da9a7b9822cea8ff4e4f217dd892e09eb14f6274a2169e5436e2ea.30c25842cda32b0540d88b7195147decf9671ee442f4bc2fb6ad74016852978e.py for additional imports.
Found main folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text
Found specific version folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7
Found script file from https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py to /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py
Couldn't find dataset infos file at https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/dataset_infos.json
Found metadata file for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.json
Using custom data configuration default
Generating dataset text (/home/bram/.cache/huggingface/datasets/text/default-0907112cc6cd2a38/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7)
Downloading and preparing dataset text/default-0907112cc6cd2a38 (download: Unknown size, generated: Unknown size, post-processed: Unknown size, total: Unknown size) to /home/bram/.cache/huggingface/datasets/text/default-0907112cc6cd2a38/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7...
Dataset not on Hf google storage. Downloading and preparing it from source
Downloading took 0.0 min
Checksum Computation took 0.0 min
Unable to verify checksums.
Generating split train
Traceback (most recent call last):
File "/home/bram/Python/projects/dutch-simplification/utils.py", line 45, in prepare_data
dataset = load_dataset("text", data_files=dataset_f)
File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/load.py", line 608, in load_dataset
builder_instance.download_and_prepare(
File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 468, in download_and_prepare
self._download_and_prepare(
File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 546, in _download_and_prepare
self._prepare_split(split_generator, **prepare_split_kwargs)
File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 888, in _prepare_split
for key, table in utils.tqdm(generator, unit=" tables", leave=False, disable=not_verbose):
File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/tqdm/std.py", line 1130, in __iter__
for obj in iterable:
File "/home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py", line 100, in _generate_tables
pa_table = pac.read_csv(
File "pyarrow/_csv.pyx", line 714, in pyarrow._csv.read_csv
File "pyarrow/error.pxi", line 122, in pyarrow.lib.pyarrow_internal_check_status
File "pyarrow/error.pxi", line 84, in pyarrow.lib.check_status
pyarrow.lib.ArrowInvalid: CSV parse error: Expected 1 columns, got 2
```
Windows just seems to get stuck. Even with a tiny dataset of 10 lines, it has been stuck for 15 minutes already at this message:
```
Checking C:\Users\bramv\.cache\huggingface\datasets\b1d50a0e74da9a7b9822cea8ff4e4f217dd892e09eb14f6274a2169e5436e2ea.30c25842cda32b0540d88b7195147decf9671ee442f4bc2fb6ad74016852978e.py for additional imports.
Found main folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text
Found specific version folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7
Found script file from https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py to C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7\text.py
Couldn't find dataset infos file at https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text\dataset_infos.json
Found metadata file for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7\text.json
Using custom data configuration default
```
> 
> win10, py3.6
>
> ```
> from datasets import Features, Value, ClassLabel, load_dataset
>
>
> features = Features({'text': Value('string'), 'ctext': Value('string')})
> file_dict = {'train': PATH/'summary.csv'}
>
> dataset = load_dataset('csv', data_files=file_dict, script_version='master', delimiter='\t', column_names=['text', 'ctext'], features=features)
> ```
Since #644 it should now work on windows @ScottishFold007
> Trying the following snippet, I get different problems on Linux and Windows.
>
> ```python
> dataset = load_dataset("text", data_files="data.txt")
> # or
> dataset = load_dataset("text", data_files=["data.txt"])
> ```
>
> Windows just seems to get stuck. Even with a tiny dataset of 10 lines, it has been stuck for 15 minutes already at this message:
>
> ```
> Checking C:\Users\bramv\.cache\huggingface\datasets\b1d50a0e74da9a7b9822cea8ff4e4f217dd892e09eb14f6274a2169e5436e2ea.30c25842cda32b0540d88b7195147decf9671ee442f4bc2fb6ad74016852978e.py for additional imports.
> Found main folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text
> Found specific version folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7
> Found script file from https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py to C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7\text.py
> Couldn't find dataset infos file at https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text\dataset_infos.json
> Found metadata file for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7\text.json
> Using custom data configuration default
> ```
Same for you @BramVanroy .
Not sure about the one on linux though | [
-0.27466508746147156,
-0.4020572602748871,
0.01756073161959648,
0.38725215196609497,
0.26964259147644043,
-0.038661353290081024,
0.318887859582901,
-0.05435653403401375,
0.4263593256473541,
-0.058048903942108154,
0.06597194820642471,
0.14552471041679382,
-0.15576286613941193,
0.27420055866241455,
0.06355622410774231,
-0.03507590293884277,
0.15718327462673187,
-0.013841032981872559,
-0.29144343733787537,
0.04024842381477356,
-0.11445463448762894,
0.34312117099761963,
-0.2153358906507492,
-0.14693012833595276,
-0.4160703420639038,
0.27400466799736023,
-0.10501692444086075,
0.453878253698349,
-0.07426194846630096,
-0.2378564178943634,
0.2710002362728119,
0.12820816040039062,
0.16396383941173553,
0.6136502027511597,
-0.00012696169142145663,
0.11003263294696808,
0.27564769983291626,
-0.16101115942001343,
-0.2998278737068176,
-0.5695475935935974,
0.15851548314094543,
-0.22943682968616486,
0.20884843170642853,
-0.02878069132566452,
0.13019275665283203,
-0.00452867615967989,
0.1527262032032013,
-0.3340619206428528,
0.3551647365093231,
0.325478196144104,
0.1009778082370758,
0.31933706998825073,
0.062094781547784805,
-0.014658169820904732,
0.06096186861395836,
0.476550817489624,
-0.09174498170614243,
0.39064982533454895,
0.3137863278388977,
-0.19428719580173492,
0.11695243418216705,
-0.08240078389644623,
-0.17309308052062988,
-0.16965323686599731,
0.3285274803638458,
0.28717073798179626,
-0.6134480834007263,
-0.20572631061077118,
0.07684162259101868,
0.18599191308021545,
0.43523305654525757,
-0.43391847610473633,
-0.22174830734729767,
-0.15912951529026031,
-0.0756906047463417,
-0.12547838687896729,
0.4388751983642578,
0.1783991903066635,
-0.19857299327850342,
0.058120787143707275,
-0.25035667419433594,
-0.06923972815275192,
-0.1769828498363495,
0.32306575775146484,
-0.008430525660514832,
0.050888918340206146,
-0.21918228268623352,
0.10400895774364471,
0.3328261077404022,
-0.07093829661607742,
-0.20637576282024384,
-0.2793428301811218,
-0.029353488236665726,
0.06112753972411156,
-0.26616689562797546,
0.15572930872440338,
-0.26587602496147156,
-0.02452719211578369,
0.11175438016653061,
0.17476198077201843,
-0.004768398590385914,
0.14171989262104034,
0.09514429420232773,
0.23060673475265503,
0.20078730583190918,
0.0978599488735199,
0.4081539809703827,
0.08435465395450592,
0.26157498359680176,
0.026359327137470245,
-0.016058051958680153,
-0.09524741023778915,
-0.19634290039539337,
-0.5441904664039612,
-0.06979077309370041,
-0.23005294799804688,
0.47970032691955566,
-0.2050441950559616,
-0.17903532087802887,
-0.04985557496547699,
-0.08081233501434326,
-0.04559389874339104,
0.21613672375679016,
0.619709312915802,
-0.08433903753757477,
0.03387746959924698,
0.1204904317855835,
0.31828367710113525,
-0.11680151522159576,
0.1911226063966751,
0.04757927358150482,
-0.06042690947651863,
-0.08892598003149033,
0.17952533066272736,
0.5387117862701416,
-0.37219706177711487,
0.3424330949783325,
0.1996888369321823,
0.46710360050201416,
-0.19052858650684357,
-0.1514507532119751,
-0.18654794991016388,
-0.01740100234746933,
0.18869464099407196,
0.007627781480550766,
0.04194001853466034,
0.24052883684635162,
-0.15900498628616333,
-0.11470441520214081,
0.09400743246078491,
-0.2652539610862732,
-0.09384723007678986,
0.03227796033024788,
0.04484368488192558,
-0.09525851160287857,
-0.2330176830291748,
-0.3073217272758484,
0.09292526543140411,
0.037364594638347626,
-0.10542857646942139,
0.09388474375009537,
-0.18031029403209686,
-0.23808330297470093,
-0.1588560938835144,
0.271628737449646,
0.6603160500526428,
-0.29885390400886536,
-0.14544497430324554,
0.32554319500923157,
-0.12255604565143585,
-0.11927320808172226,
0.2550254762172699,
-0.09432854503393173,
0.009946838021278381,
-0.26102373003959656,
0.19931451976299286,
0.18748818337917328,
-0.4092429578304291,
-0.14655740559101105,
0.396353542804718,
0.058407098054885864,
0.13573025166988373,
0.20805758237838745,
0.06181078031659126,
0.04158390685915947,
0.04601143300533295,
0.28067803382873535,
0.008305852301418781,
0.10472077131271362,
-0.09153573960065842,
-0.003415212035179138,
-0.20375406742095947,
0.09107531607151031,
0.3670077919960022,
-0.21133868396282196,
0.05503413826227188,
0.10750479996204376,
-0.11178306490182877,
0.17654049396514893,
-0.10396623611450195,
-0.03444817662239075,
0.5095411539077759,
0.13623763620853424,
0.32014578580856323,
0.07939956337213516,
-0.21166938543319702,
-0.5979294180870056,
0.13661986589431763,
0.2275741994380951,
-0.053531721234321594,
-0.26386529207229614,
-0.09572690725326538,
-0.1770210564136505,
0.060134559869766235,
-0.20953930914402008,
-0.014112904667854309,
-0.07209601998329163,
0.15332286059856415,
0.2246880829334259,
0.0292828232049942,
-0.2047475129365921,
0.4062136113643646,
-0.16938132047653198,
0.245487779378891,
-0.2644481062889099,
0.17883147299289703,
-0.03566547483205795,
-0.20230185985565186,
-0.05179573595523834,
0.1018906682729721,
-0.004675917327404022,
-0.2937566936016083,
0.09547410160303116,
0.46329742670059204,
0.05469230189919472,
0.08568492531776428,
-0.18478921055793762,
-0.09530840814113617,
0.22696512937545776,
-0.08083350211381912,
-0.027376921847462654,
0.29197049140930176,
0.20263512432575226,
-0.19178074598312378,
-0.2744138240814209,
0.19127023220062256,
-0.33558428287506104,
0.16342973709106445,
0.029872238636016846,
-0.10833264142274857,
-0.048433803021907806,
0.10796989500522614,
-0.30235612392425537,
-0.06359688192605972,
0.4508513808250427,
-0.24545635282993317,
0.26050445437431335,
0.001822158694267273,
-0.4244135022163391,
-0.2174912393093109,
0.41966497898101807,
-0.04605230689048767,
0.1226552426815033,
0.18774020671844482,
-0.21470129489898682,
0.2120124101638794,
-0.08776815235614777,
-0.041977427899837494,
0.5764286518096924,
0.1378009170293808,
-0.29834991693496704,
0.22981514036655426,
-0.11662109941244125,
-0.22127966582775116,
0.28909584879875183,
-0.04727776348590851,
-0.0982486680150032,
0.09601173549890518,
-0.1998824030160904,
0.008325614035129547,
-0.26002970337867737,
-0.06789300590753555,
-0.10154349356889725,
0.07152579724788666,
-0.412751168012619,
0.22236080467700958,
-0.3261348307132721,
-0.16208136081695557,
-0.353361576795578,
0.11997043341398239,
-0.29344743490219116,
-0.035253237932920456,
-0.2882404327392578,
0.2256356030702591,
0.16318251192569733,
0.036844104528427124,
-0.0255984365940094,
0.00393328070640564,
0.10042867064476013,
-0.5494061708450317,
-0.19856739044189453,
0.008163602091372013,
-0.23089352250099182,
-0.09342408180236816,
0.38237711787223816,
0.044111475348472595,
0.23747751116752625,
-0.3961958587169647,
-0.10942899435758591,
-0.09859373420476913,
-0.1599084585905075,
0.05576726794242859,
-0.06142425537109375,
0.19603170454502106,
0.05316426232457161,
0.22801974415779114,
-0.12375231087207794,
-0.13104702532291412,
0.4299977123737335,
-0.03813391551375389,
-0.1885630488395691,
0.2453443706035614,
0.41844668984413147,
-0.30971813201904297,
-0.2610921263694763,
-0.3623769283294678,
-0.1279265582561493,
-0.2842009663581848,
0.35814857482910156,
0.15591806173324585,
-0.02956918627023697,
0.5024074912071228,
0.42875543236732483,
0.15696276724338531,
-0.18035155534744263,
0.21657925844192505,
0.06529708951711655,
-0.168305441737175,
0.47165095806121826,
-0.16438469290733337,
-0.6319025158882141,
0.07756011188030243,
0.4496116042137146,
-0.2843746244907379,
0.21754126250743866,
-0.4422394633293152,
-0.06208041310310364,
-0.11925515532493591,
0.09208999574184418,
0.04108500853180885,
0.3046550154685974,
0.18646186590194702,
0.08041266351938248,
0.09567829221487045,
-0.05449400842189789,
-0.32142069935798645,
0.11587603390216827,
-0.21104341745376587,
0.03335344046354294,
0.2350960075855255,
0.3713708221912384,
-0.20123478770256042,
0.4552718997001648,
0.3391938805580139,
-0.06640851497650146,
0.2473822683095932,
-0.5043379664421082,
0.5094944834709167,
-0.1640397310256958,
-0.5347826480865479,
0.05617336183786392,
-0.21773487329483032,
0.1750391721725464,
0.27665549516677856,
0.1536443829536438,
0.3985491394996643,
-0.3371798098087311,
0.10423095524311066,
-0.07458600401878357,
-0.19977344572544098,
0.2598342299461365,
-0.11723457276821136,
0.07948076725006104,
-0.1508023738861084,
0.1711592972278595,
0.1823590099811554,
-0.23288646340370178,
0.03903879597783089,
0.6069951057434082,
-0.1873316764831543,
0.051549434661865234,
-0.39870980381965637,
0.0692128986120224,
-0.3697613775730133,
0.3847951889038086,
-0.04406869783997536,
0.3335779309272766,
-0.27299389243125916,
-0.10511372238397598,
0.01776283234357834,
-0.037272900342941284,
0.5544432401657104,
0.3075839877128601,
-0.19523999094963074,
0.017645690590143204,
-0.25824272632598877,
-0.3879300057888031,
0.0970630943775177,
-0.2831108272075653,
0.39122483134269714,
0.17978160083293915,
0.6442822217941284,
-0.30025559663772583,
-0.2145058959722519,
-0.09112641215324402,
0.4764972925186157,
-0.022832082584500313,
-0.31148800253868103,
-0.2785246968269348,
-0.16343708336353302,
-0.32626476883888245,
-0.24235379695892334,
0.02418855018913746,
0.2216685563325882,
-0.18151506781578064,
0.2211252897977829,
-0.05780911445617676,
-0.1648257076740265,
0.2988143563270569,
-0.030988162383437157,
0.2692626416683197,
-0.32836395502090454,
0.23207390308380127,
0.10623225569725037,
0.4693126380443573,
0.29696276783943176,
0.551525890827179,
-0.08975723385810852,
-0.46018892526626587,
0.020805126056075096,
-0.15819226205348969,
0.3489820659160614,
0.16609907150268555,
-0.27159419655799866,
0.14265033602714539,
0.2977319359779358,
0.11018599569797516,
-0.4385163486003876,
-0.0669691190123558,
0.5130975842475891,
0.2113116830587387,
-0.2971879243850708,
-0.4682973325252533,
0.36469128727912903,
0.028174743056297302,
0.14996710419654846,
0.27160051465034485,
0.17438693344593048,
-0.29298001527786255,
0.018115131184458733,
-0.3032904863357544,
0.8145564794540405,
-0.13513001799583435,
0.4673895835876465,
0.23452234268188477,
-0.08719875663518906,
0.397825688123703,
-0.053324341773986816,
0.06563602387905121,
-0.2903502881526947,
-0.014762661419808865,
-0.012935230508446693,
-0.17483539879322052,
0.4434725344181061,
0.17013514041900635,
-0.4242365062236786,
0.21922776103019714,
-0.013385012745857239,
0.31011340022087097,
-0.2710381746292114,
0.18515266478061676,
-0.4233771562576294,
-0.30676761269569397,
-0.34613505005836487,
0.03141036629676819,
0.14703771471977234,
0.3159361481666565,
-0.019304631277918816,
0.068677619099617,
-0.17888011038303375,
-0.2796393632888794,
-0.3666660785675049,
0.05740419775247574,
-0.32172903418540955,
0.05843834578990936,
0.21080191433429718,
-0.34539371728897095,
0.3396162986755371,
0.44701316952705383,
0.2227247804403305,
0.12587442994117737,
-0.16990654170513153,
-0.088034987449646,
-0.22852873802185059,
-0.10756894946098328,
0.001793119590729475,
-0.2334613800048828,
0.025620169937610626,
0.08667146414518356,
-0.27068498730659485,
-0.034228309988975525,
-0.0761411264538765,
-0.1780477911233902,
-0.011277124285697937,
0.13029271364212036,
-0.35141658782958984,
-0.4001733064651489,
-0.4443773031234741,
-0.16439521312713623,
0.1622946709394455,
-0.062214985489845276,
0.012506451457738876,
0.12515521049499512,
0.15351563692092896,
0.04247341305017471,
0.08630746603012085,
-0.1513926088809967,
-0.10639512538909912,
0.3808281421661377,
-0.4325576722621918,
-0.2435595542192459,
0.6115918159484863,
0.44780296087265015,
-0.1363862305879593,
-0.2047024667263031,
0.3153444230556488,
-0.02410351298749447,
-0.47063779830932617,
0.060029350221157074,
0.3476565480232239,
0.046982020139694214,
0.021084846928715706,
0.2753243148326874,
0.04095536470413208,
-0.1721467673778534,
0.10798409581184387,
-0.5703993439674377,
-0.3437374532222748,
0.19584468007087708,
0.29915693402290344,
0.13245421648025513,
0.22470954060554504,
-0.15168331563472748,
-0.01446075364947319,
-0.21246680617332458,
-0.1799510419368744,
0.028362778946757317,
0.07118233293294907,
-0.20901280641555786,
0.4280432164669037,
0.08135491609573364,
0.34466132521629333,
-0.242889866232872,
0.018016835674643517,
-0.008255444467067719,
0.06141901761293411,
-0.055910781025886536,
-0.13231714069843292,
0.13573800027370453,
-0.07649707794189453,
-0.18019047379493713,
-0.16954435408115387,
-0.3009037971496582,
-0.005444547161459923,
-0.30615487694740295,
0.1830039918422699,
0.4905685782432556,
-0.13221722841262817,
0.16604216396808624,
-0.2308713048696518,
0.24027419090270996,
-0.3294675946235657,
0.2159643918275833,
-0.33016255497932434,
0.3099440634250641,
0.11999452114105225,
0.06452429294586182,
-0.0035629512276500463,
0.07621486485004425,
-0.17964790761470795,
0.28044652938842773,
0.19380606710910797,
-0.08764828741550446,
0.2333926260471344,
-0.41730326414108276,
0.1791359931230545,
-0.1308647096157074,
0.4586465358734131,
0.6418233513832092,
-0.2389523833990097,
0.17709243297576904,
0.323751300573349,
0.0375068373978138,
-0.10668563842773438,
0.025385616347193718,
0.1342611461877823,
-0.07563222944736481,
0.05577952042222023,
0.2839002311229706,
-0.10994723439216614,
-0.07677105069160461,
0.014085404574871063,
0.04201062023639679,
0.3017368018627167,
0.1350492686033249,
0.04224539175629616,
0.31792572140693665,
0.28218626976013184,
0.21729479730129242,
-0.07895780354738235,
0.3243650197982788,
0.168809711933136,
0.3248772621154785,
-0.12702417373657227,
0.12640246748924255,
-0.18793323636054993,
0.3269268870353699,
-0.05856538563966751,
-0.3316076695919037,
0.12361234426498413,
0.054044149816036224,
-0.2286888062953949,
0.0388123095035553,
-0.21605685353279114,
0.5491749048233032,
-0.5157119035720825,
-0.009049078449606895,
-0.1283322274684906,
0.06846510618925095,
-0.050738804042339325,
-0.3157408833503723,
0.03204023092985153,
-0.23804622888565063,
-0.031142953783273697,
0.02466117963194847,
-0.0586087740957737,
-0.13547711074352264,
0.06375180184841156,
0.12601828575134277,
-0.033776625990867615,
-0.3310146629810333,
0.12166766077280045,
0.017429785802960396,
0.014899447560310364,
0.004908401519060135,
0.271010160446167,
0.15193212032318115,
0.21965689957141876,
0.3230520784854889,
0.3475780189037323,
0.5777649283409119,
0.4073307514190674,
0.10604949295520782,
0.24757611751556396,
-0.26939257979393005,
-0.012606486678123474,
-0.03941423445940018,
0.3580523133277893,
0.11281471699476242,
0.037804875522851944,
0.21644532680511475,
0.0713128075003624,
-0.03739205747842789,
-0.05451435223221779,
0.0653119832277298,
-0.11782512068748474,
-0.29895487427711487,
0.23282304406166077,
-0.2536523938179016,
-0.12917304039001465,
-0.17007729411125183,
-0.04674641042947769,
-0.44124355912208557,
-0.03883911296725273,
0.5237541794776917,
0.26585763692855835,
0.1927785575389862,
-0.042704228311777115,
0.02653927356004715,
0.3400239050388336,
0.4671337604522705,
0.38308992981910706,
0.23772022128105164,
-0.057062745094299316,
-0.011146128177642822,
-0.6012915968894958,
-0.011561572551727295,
0.009720947593450546,
-0.13737620413303375,
-0.2386874556541443,
-0.1536639928817749,
0.19780229032039642,
0.15514986217021942,
0.052321359515190125,
-0.1281723529100418,
0.2108141928911209,
-0.012030869722366333,
-0.05344913899898529,
-0.1669253706932068,
-0.015177987515926361,
0.13818711042404175,
0.004907839000225067,
-0.3023654520511627,
0.06138338893651962,
-0.10898315161466599,
-0.05648649111390114,
-0.3146934509277344,
0.42382538318634033,
-0.10585279762744904,
-0.33554357290267944,
0.13646440207958221,
-0.07306482642889023,
0.4701797068119049,
0.04250940680503845,
-0.16549621522426605,
-0.17986448109149933,
-0.23826564848423004,
0.021349098533391953,
0.43025344610214233,
0.15453454852104187,
0.005093453451991081,
-0.4908643364906311,
-0.49262502789497375,
-0.2662898600101471,
0.24394312500953674,
-0.059263601899147034,
-0.37303411960601807,
0.02461392618715763,
-0.018650636076927185,
-0.03545805811882019,
0.001153341494500637,
0.23331274092197418,
0.47853729128837585,
-0.27210986614227295,
0.010619590058922768,
-0.14781954884529114,
-0.12781193852424622,
0.3023917078971863,
-0.4510454535484314,
-0.2669309973716736,
0.030796915292739868,
0.008957751095294952,
0.015702150762081146,
0.049648672342300415,
-0.5663859248161316,
0.12508678436279297,
0.13597729802131653,
-0.10330649465322495,
-0.13997501134872437,
0.053034666925668716,
-0.18257488310337067,
-0.03638375550508499,
-0.1389525681734085,
0.454903244972229,
0.08838391304016113,
-0.25883957743644714,
0.09736847877502441,
-0.20569591224193573
] |
https://github.com/huggingface/datasets/issues/622 | load_dataset for text files not working | > To complete what @lhoestq is saying, I think that to use the new version of the `text` processing script (which is on master right now) you need to either specify the version of the script to be the `master` one or to install the lib from source (in which case it uses the `master` version of the script by default):
>
> ```python
> dataset = load_dataset('text', script_version='master', data_files=XXX)
> ```
>
> We do versioning by default, i.e. your version of the dataset lib will use the script with the same version by default (i.e. only the `1.0.1` version of the script if you have the PyPI version `1.0.1` of the lib).
Linux here:
I was using the 0.4.0 nlp library load_dataset to load a text dataset of 9-10Gb without collapsing the RAM memory. However, today I got the csv error message mentioned in this issue. After installing the new (datasets) library from source and specifying the script_verson = 'master' I'm still having this same error message. Furthermore, I cannot use the dictionary "trick" to load the dataset since the system kills the process due to a RAM out of memory problem. Is there any other solution to this error? Thank you in advance. | Trying the following snippet, I get different problems on Linux and Windows.
```python
dataset = load_dataset("text", data_files="data.txt")
# or
dataset = load_dataset("text", data_files=["data.txt"])
```
(ps [This example](https://huggingface.co/docs/datasets/loading_datasets.html#json-files) shows that you can use a string as input for data_files, but the signature is `Union[Dict, List]`.)
The problem on Linux is that the script crashes with a CSV error (even though it isn't a CSV file). On Windows the script just seems to freeze or get stuck after loading the config file.
Linux stack trace:
```
PyTorch version 1.6.0+cu101 available.
Checking /home/bram/.cache/huggingface/datasets/b1d50a0e74da9a7b9822cea8ff4e4f217dd892e09eb14f6274a2169e5436e2ea.30c25842cda32b0540d88b7195147decf9671ee442f4bc2fb6ad74016852978e.py for additional imports.
Found main folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text
Found specific version folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7
Found script file from https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py to /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py
Couldn't find dataset infos file at https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/dataset_infos.json
Found metadata file for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.json
Using custom data configuration default
Generating dataset text (/home/bram/.cache/huggingface/datasets/text/default-0907112cc6cd2a38/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7)
Downloading and preparing dataset text/default-0907112cc6cd2a38 (download: Unknown size, generated: Unknown size, post-processed: Unknown size, total: Unknown size) to /home/bram/.cache/huggingface/datasets/text/default-0907112cc6cd2a38/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7...
Dataset not on Hf google storage. Downloading and preparing it from source
Downloading took 0.0 min
Checksum Computation took 0.0 min
Unable to verify checksums.
Generating split train
Traceback (most recent call last):
File "/home/bram/Python/projects/dutch-simplification/utils.py", line 45, in prepare_data
dataset = load_dataset("text", data_files=dataset_f)
File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/load.py", line 608, in load_dataset
builder_instance.download_and_prepare(
File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 468, in download_and_prepare
self._download_and_prepare(
File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 546, in _download_and_prepare
self._prepare_split(split_generator, **prepare_split_kwargs)
File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 888, in _prepare_split
for key, table in utils.tqdm(generator, unit=" tables", leave=False, disable=not_verbose):
File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/tqdm/std.py", line 1130, in __iter__
for obj in iterable:
File "/home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py", line 100, in _generate_tables
pa_table = pac.read_csv(
File "pyarrow/_csv.pyx", line 714, in pyarrow._csv.read_csv
File "pyarrow/error.pxi", line 122, in pyarrow.lib.pyarrow_internal_check_status
File "pyarrow/error.pxi", line 84, in pyarrow.lib.check_status
pyarrow.lib.ArrowInvalid: CSV parse error: Expected 1 columns, got 2
```
Windows just seems to get stuck. Even with a tiny dataset of 10 lines, it has been stuck for 15 minutes already at this message:
```
Checking C:\Users\bramv\.cache\huggingface\datasets\b1d50a0e74da9a7b9822cea8ff4e4f217dd892e09eb14f6274a2169e5436e2ea.30c25842cda32b0540d88b7195147decf9671ee442f4bc2fb6ad74016852978e.py for additional imports.
Found main folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text
Found specific version folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7
Found script file from https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py to C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7\text.py
Couldn't find dataset infos file at https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text\dataset_infos.json
Found metadata file for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7\text.json
Using custom data configuration default
```
| 206 | load_dataset for text files not working
Trying the following snippet, I get different problems on Linux and Windows.
```python
dataset = load_dataset("text", data_files="data.txt")
# or
dataset = load_dataset("text", data_files=["data.txt"])
```
(ps [This example](https://huggingface.co/docs/datasets/loading_datasets.html#json-files) shows that you can use a string as input for data_files, but the signature is `Union[Dict, List]`.)
The problem on Linux is that the script crashes with a CSV error (even though it isn't a CSV file). On Windows the script just seems to freeze or get stuck after loading the config file.
Linux stack trace:
```
PyTorch version 1.6.0+cu101 available.
Checking /home/bram/.cache/huggingface/datasets/b1d50a0e74da9a7b9822cea8ff4e4f217dd892e09eb14f6274a2169e5436e2ea.30c25842cda32b0540d88b7195147decf9671ee442f4bc2fb6ad74016852978e.py for additional imports.
Found main folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text
Found specific version folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7
Found script file from https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py to /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py
Couldn't find dataset infos file at https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/dataset_infos.json
Found metadata file for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at /home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.json
Using custom data configuration default
Generating dataset text (/home/bram/.cache/huggingface/datasets/text/default-0907112cc6cd2a38/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7)
Downloading and preparing dataset text/default-0907112cc6cd2a38 (download: Unknown size, generated: Unknown size, post-processed: Unknown size, total: Unknown size) to /home/bram/.cache/huggingface/datasets/text/default-0907112cc6cd2a38/0.0.0/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7...
Dataset not on Hf google storage. Downloading and preparing it from source
Downloading took 0.0 min
Checksum Computation took 0.0 min
Unable to verify checksums.
Generating split train
Traceback (most recent call last):
File "/home/bram/Python/projects/dutch-simplification/utils.py", line 45, in prepare_data
dataset = load_dataset("text", data_files=dataset_f)
File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/load.py", line 608, in load_dataset
builder_instance.download_and_prepare(
File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 468, in download_and_prepare
self._download_and_prepare(
File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 546, in _download_and_prepare
self._prepare_split(split_generator, **prepare_split_kwargs)
File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/datasets/builder.py", line 888, in _prepare_split
for key, table in utils.tqdm(generator, unit=" tables", leave=False, disable=not_verbose):
File "/home/bram/.local/share/virtualenvs/dutch-simplification-NcpPZtDF/lib/python3.8/site-packages/tqdm/std.py", line 1130, in __iter__
for obj in iterable:
File "/home/bram/.cache/huggingface/modules/datasets_modules/datasets/text/7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7/text.py", line 100, in _generate_tables
pa_table = pac.read_csv(
File "pyarrow/_csv.pyx", line 714, in pyarrow._csv.read_csv
File "pyarrow/error.pxi", line 122, in pyarrow.lib.pyarrow_internal_check_status
File "pyarrow/error.pxi", line 84, in pyarrow.lib.check_status
pyarrow.lib.ArrowInvalid: CSV parse error: Expected 1 columns, got 2
```
Windows just seems to get stuck. Even with a tiny dataset of 10 lines, it has been stuck for 15 minutes already at this message:
```
Checking C:\Users\bramv\.cache\huggingface\datasets\b1d50a0e74da9a7b9822cea8ff4e4f217dd892e09eb14f6274a2169e5436e2ea.30c25842cda32b0540d88b7195147decf9671ee442f4bc2fb6ad74016852978e.py for additional imports.
Found main folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text
Found specific version folder for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7
Found script file from https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py to C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7\text.py
Couldn't find dataset infos file at https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text\dataset_infos.json
Found metadata file for dataset https://raw.githubusercontent.com/huggingface/datasets/1.0.1/datasets/text/text.py at C:\Users\bramv\.cache\huggingface\modules\datasets_modules\datasets\text\7e13bc0fa76783d4ef197f079dc8acfe54c3efda980f2c9adfab046ede2f0ff7\text.json
Using custom data configuration default
```
> To complete what @lhoestq is saying, I think that to use the new version of the `text` processing script (which is on master right now) you need to either specify the version of the script to be the `master` one or to install the lib from source (in which case it uses the `master` version of the script by default):
>
> ```python
> dataset = load_dataset('text', script_version='master', data_files=XXX)
> ```
>
> We do versioning by default, i.e. your version of the dataset lib will use the script with the same version by default (i.e. only the `1.0.1` version of the script if you have the PyPI version `1.0.1` of the lib).
Linux here:
I was using the 0.4.0 nlp library load_dataset to load a text dataset of 9-10Gb without collapsing the RAM memory. However, today I got the csv error message mentioned in this issue. After installing the new (datasets) library from source and specifying the script_verson = 'master' I'm still having this same error message. Furthermore, I cannot use the dictionary "trick" to load the dataset since the system kills the process due to a RAM out of memory problem. Is there any other solution to this error? Thank you in advance. | [
-0.27466508746147156,
-0.4020572602748871,
0.01756073161959648,
0.38725215196609497,
0.26964259147644043,
-0.038661353290081024,
0.318887859582901,
-0.05435653403401375,
0.4263593256473541,
-0.058048903942108154,
0.06597194820642471,
0.14552471041679382,
-0.15576286613941193,
0.27420055866241455,
0.06355622410774231,
-0.03507590293884277,
0.15718327462673187,
-0.013841032981872559,
-0.29144343733787537,
0.04024842381477356,
-0.11445463448762894,
0.34312117099761963,
-0.2153358906507492,
-0.14693012833595276,
-0.4160703420639038,
0.27400466799736023,
-0.10501692444086075,
0.453878253698349,
-0.07426194846630096,
-0.2378564178943634,
0.2710002362728119,
0.12820816040039062,
0.16396383941173553,
0.6136502027511597,
-0.00012696169142145663,
0.11003263294696808,
0.27564769983291626,
-0.16101115942001343,
-0.2998278737068176,
-0.5695475935935974,
0.15851548314094543,
-0.22943682968616486,
0.20884843170642853,
-0.02878069132566452,
0.13019275665283203,
-0.00452867615967989,
0.1527262032032013,
-0.3340619206428528,
0.3551647365093231,
0.325478196144104,
0.1009778082370758,
0.31933706998825073,
0.062094781547784805,
-0.014658169820904732,
0.06096186861395836,
0.476550817489624,
-0.09174498170614243,
0.39064982533454895,
0.3137863278388977,
-0.19428719580173492,
0.11695243418216705,
-0.08240078389644623,
-0.17309308052062988,
-0.16965323686599731,
0.3285274803638458,
0.28717073798179626,
-0.6134480834007263,
-0.20572631061077118,
0.07684162259101868,
0.18599191308021545,
0.43523305654525757,
-0.43391847610473633,
-0.22174830734729767,
-0.15912951529026031,
-0.0756906047463417,
-0.12547838687896729,
0.4388751983642578,
0.1783991903066635,
-0.19857299327850342,
0.058120787143707275,
-0.25035667419433594,
-0.06923972815275192,
-0.1769828498363495,
0.32306575775146484,
-0.008430525660514832,
0.050888918340206146,
-0.21918228268623352,
0.10400895774364471,
0.3328261077404022,
-0.07093829661607742,
-0.20637576282024384,
-0.2793428301811218,
-0.029353488236665726,
0.06112753972411156,
-0.26616689562797546,
0.15572930872440338,
-0.26587602496147156,
-0.02452719211578369,
0.11175438016653061,
0.17476198077201843,
-0.004768398590385914,
0.14171989262104034,
0.09514429420232773,
0.23060673475265503,
0.20078730583190918,
0.0978599488735199,
0.4081539809703827,
0.08435465395450592,
0.26157498359680176,
0.026359327137470245,
-0.016058051958680153,
-0.09524741023778915,
-0.19634290039539337,
-0.5441904664039612,
-0.06979077309370041,
-0.23005294799804688,
0.47970032691955566,
-0.2050441950559616,
-0.17903532087802887,
-0.04985557496547699,
-0.08081233501434326,
-0.04559389874339104,
0.21613672375679016,
0.619709312915802,
-0.08433903753757477,
0.03387746959924698,
0.1204904317855835,
0.31828367710113525,
-0.11680151522159576,
0.1911226063966751,
0.04757927358150482,
-0.06042690947651863,
-0.08892598003149033,
0.17952533066272736,
0.5387117862701416,
-0.37219706177711487,
0.3424330949783325,
0.1996888369321823,
0.46710360050201416,
-0.19052858650684357,
-0.1514507532119751,
-0.18654794991016388,
-0.01740100234746933,
0.18869464099407196,
0.007627781480550766,
0.04194001853466034,
0.24052883684635162,
-0.15900498628616333,
-0.11470441520214081,
0.09400743246078491,
-0.2652539610862732,
-0.09384723007678986,
0.03227796033024788,
0.04484368488192558,
-0.09525851160287857,
-0.2330176830291748,
-0.3073217272758484,
0.09292526543140411,
0.037364594638347626,
-0.10542857646942139,
0.09388474375009537,
-0.18031029403209686,
-0.23808330297470093,
-0.1588560938835144,
0.271628737449646,
0.6603160500526428,
-0.29885390400886536,
-0.14544497430324554,
0.32554319500923157,
-0.12255604565143585,
-0.11927320808172226,
0.2550254762172699,
-0.09432854503393173,
0.009946838021278381,
-0.26102373003959656,
0.19931451976299286,
0.18748818337917328,
-0.4092429578304291,
-0.14655740559101105,
0.396353542804718,
0.058407098054885864,
0.13573025166988373,
0.20805758237838745,
0.06181078031659126,
0.04158390685915947,
0.04601143300533295,
0.28067803382873535,
0.008305852301418781,
0.10472077131271362,
-0.09153573960065842,
-0.003415212035179138,
-0.20375406742095947,
0.09107531607151031,
0.3670077919960022,
-0.21133868396282196,
0.05503413826227188,
0.10750479996204376,
-0.11178306490182877,
0.17654049396514893,
-0.10396623611450195,
-0.03444817662239075,
0.5095411539077759,
0.13623763620853424,
0.32014578580856323,
0.07939956337213516,
-0.21166938543319702,
-0.5979294180870056,
0.13661986589431763,
0.2275741994380951,
-0.053531721234321594,
-0.26386529207229614,
-0.09572690725326538,
-0.1770210564136505,
0.060134559869766235,
-0.20953930914402008,
-0.014112904667854309,
-0.07209601998329163,
0.15332286059856415,
0.2246880829334259,
0.0292828232049942,
-0.2047475129365921,
0.4062136113643646,
-0.16938132047653198,
0.245487779378891,
-0.2644481062889099,
0.17883147299289703,
-0.03566547483205795,
-0.20230185985565186,
-0.05179573595523834,
0.1018906682729721,
-0.004675917327404022,
-0.2937566936016083,
0.09547410160303116,
0.46329742670059204,
0.05469230189919472,
0.08568492531776428,
-0.18478921055793762,
-0.09530840814113617,
0.22696512937545776,
-0.08083350211381912,
-0.027376921847462654,
0.29197049140930176,
0.20263512432575226,
-0.19178074598312378,
-0.2744138240814209,
0.19127023220062256,
-0.33558428287506104,
0.16342973709106445,
0.029872238636016846,
-0.10833264142274857,
-0.048433803021907806,
0.10796989500522614,
-0.30235612392425537,
-0.06359688192605972,
0.4508513808250427,
-0.24545635282993317,
0.26050445437431335,
0.001822158694267273,
-0.4244135022163391,
-0.2174912393093109,
0.41966497898101807,
-0.04605230689048767,
0.1226552426815033,
0.18774020671844482,
-0.21470129489898682,
0.2120124101638794,
-0.08776815235614777,
-0.041977427899837494,
0.5764286518096924,
0.1378009170293808,
-0.29834991693496704,
0.22981514036655426,
-0.11662109941244125,
-0.22127966582775116,
0.28909584879875183,
-0.04727776348590851,
-0.0982486680150032,
0.09601173549890518,
-0.1998824030160904,
0.008325614035129547,
-0.26002970337867737,
-0.06789300590753555,
-0.10154349356889725,
0.07152579724788666,
-0.412751168012619,
0.22236080467700958,
-0.3261348307132721,
-0.16208136081695557,
-0.353361576795578,
0.11997043341398239,
-0.29344743490219116,
-0.035253237932920456,
-0.2882404327392578,
0.2256356030702591,
0.16318251192569733,
0.036844104528427124,
-0.0255984365940094,
0.00393328070640564,
0.10042867064476013,
-0.5494061708450317,
-0.19856739044189453,
0.008163602091372013,
-0.23089352250099182,
-0.09342408180236816,
0.38237711787223816,
0.044111475348472595,
0.23747751116752625,
-0.3961958587169647,
-0.10942899435758591,
-0.09859373420476913,
-0.1599084585905075,
0.05576726794242859,
-0.06142425537109375,
0.19603170454502106,
0.05316426232457161,
0.22801974415779114,
-0.12375231087207794,
-0.13104702532291412,
0.4299977123737335,
-0.03813391551375389,
-0.1885630488395691,
0.2453443706035614,
0.41844668984413147,
-0.30971813201904297,
-0.2610921263694763,
-0.3623769283294678,
-0.1279265582561493,
-0.2842009663581848,
0.35814857482910156,
0.15591806173324585,
-0.02956918627023697,
0.5024074912071228,
0.42875543236732483,
0.15696276724338531,
-0.18035155534744263,
0.21657925844192505,
0.06529708951711655,
-0.168305441737175,
0.47165095806121826,
-0.16438469290733337,
-0.6319025158882141,
0.07756011188030243,
0.4496116042137146,
-0.2843746244907379,
0.21754126250743866,
-0.4422394633293152,
-0.06208041310310364,
-0.11925515532493591,
0.09208999574184418,
0.04108500853180885,
0.3046550154685974,
0.18646186590194702,
0.08041266351938248,
0.09567829221487045,
-0.05449400842189789,
-0.32142069935798645,
0.11587603390216827,
-0.21104341745376587,
0.03335344046354294,
0.2350960075855255,
0.3713708221912384,
-0.20123478770256042,
0.4552718997001648,
0.3391938805580139,
-0.06640851497650146,
0.2473822683095932,
-0.5043379664421082,
0.5094944834709167,
-0.1640397310256958,
-0.5347826480865479,
0.05617336183786392,
-0.21773487329483032,
0.1750391721725464,
0.27665549516677856,
0.1536443829536438,
0.3985491394996643,
-0.3371798098087311,
0.10423095524311066,
-0.07458600401878357,
-0.19977344572544098,
0.2598342299461365,
-0.11723457276821136,
0.07948076725006104,
-0.1508023738861084,
0.1711592972278595,
0.1823590099811554,
-0.23288646340370178,
0.03903879597783089,
0.6069951057434082,
-0.1873316764831543,
0.051549434661865234,
-0.39870980381965637,
0.0692128986120224,
-0.3697613775730133,
0.3847951889038086,
-0.04406869783997536,
0.3335779309272766,
-0.27299389243125916,
-0.10511372238397598,
0.01776283234357834,
-0.037272900342941284,
0.5544432401657104,
0.3075839877128601,
-0.19523999094963074,
0.017645690590143204,
-0.25824272632598877,
-0.3879300057888031,
0.0970630943775177,
-0.2831108272075653,
0.39122483134269714,
0.17978160083293915,
0.6442822217941284,
-0.30025559663772583,
-0.2145058959722519,
-0.09112641215324402,
0.4764972925186157,
-0.022832082584500313,
-0.31148800253868103,
-0.2785246968269348,
-0.16343708336353302,
-0.32626476883888245,
-0.24235379695892334,
0.02418855018913746,
0.2216685563325882,
-0.18151506781578064,
0.2211252897977829,
-0.05780911445617676,
-0.1648257076740265,
0.2988143563270569,
-0.030988162383437157,
0.2692626416683197,
-0.32836395502090454,
0.23207390308380127,
0.10623225569725037,
0.4693126380443573,
0.29696276783943176,
0.551525890827179,
-0.08975723385810852,
-0.46018892526626587,
0.020805126056075096,
-0.15819226205348969,
0.3489820659160614,
0.16609907150268555,
-0.27159419655799866,
0.14265033602714539,
0.2977319359779358,
0.11018599569797516,
-0.4385163486003876,
-0.0669691190123558,
0.5130975842475891,
0.2113116830587387,
-0.2971879243850708,
-0.4682973325252533,
0.36469128727912903,
0.028174743056297302,
0.14996710419654846,
0.27160051465034485,
0.17438693344593048,
-0.29298001527786255,
0.018115131184458733,
-0.3032904863357544,
0.8145564794540405,
-0.13513001799583435,
0.4673895835876465,
0.23452234268188477,
-0.08719875663518906,
0.397825688123703,
-0.053324341773986816,
0.06563602387905121,
-0.2903502881526947,
-0.014762661419808865,
-0.012935230508446693,
-0.17483539879322052,
0.4434725344181061,
0.17013514041900635,
-0.4242365062236786,
0.21922776103019714,
-0.013385012745857239,
0.31011340022087097,
-0.2710381746292114,
0.18515266478061676,
-0.4233771562576294,
-0.30676761269569397,
-0.34613505005836487,
0.03141036629676819,
0.14703771471977234,
0.3159361481666565,
-0.019304631277918816,
0.068677619099617,
-0.17888011038303375,
-0.2796393632888794,
-0.3666660785675049,
0.05740419775247574,
-0.32172903418540955,
0.05843834578990936,
0.21080191433429718,
-0.34539371728897095,
0.3396162986755371,
0.44701316952705383,
0.2227247804403305,
0.12587442994117737,
-0.16990654170513153,
-0.088034987449646,
-0.22852873802185059,
-0.10756894946098328,
0.001793119590729475,
-0.2334613800048828,
0.025620169937610626,
0.08667146414518356,
-0.27068498730659485,
-0.034228309988975525,
-0.0761411264538765,
-0.1780477911233902,
-0.011277124285697937,
0.13029271364212036,
-0.35141658782958984,
-0.4001733064651489,
-0.4443773031234741,
-0.16439521312713623,
0.1622946709394455,
-0.062214985489845276,
0.012506451457738876,
0.12515521049499512,
0.15351563692092896,
0.04247341305017471,
0.08630746603012085,
-0.1513926088809967,
-0.10639512538909912,
0.3808281421661377,
-0.4325576722621918,
-0.2435595542192459,
0.6115918159484863,
0.44780296087265015,
-0.1363862305879593,
-0.2047024667263031,
0.3153444230556488,
-0.02410351298749447,
-0.47063779830932617,
0.060029350221157074,
0.3476565480232239,
0.046982020139694214,
0.021084846928715706,
0.2753243148326874,
0.04095536470413208,
-0.1721467673778534,
0.10798409581184387,
-0.5703993439674377,
-0.3437374532222748,
0.19584468007087708,
0.29915693402290344,
0.13245421648025513,
0.22470954060554504,
-0.15168331563472748,
-0.01446075364947319,
-0.21246680617332458,
-0.1799510419368744,
0.028362778946757317,
0.07118233293294907,
-0.20901280641555786,
0.4280432164669037,
0.08135491609573364,
0.34466132521629333,
-0.242889866232872,
0.018016835674643517,
-0.008255444467067719,
0.06141901761293411,
-0.055910781025886536,
-0.13231714069843292,
0.13573800027370453,
-0.07649707794189453,
-0.18019047379493713,
-0.16954435408115387,
-0.3009037971496582,
-0.005444547161459923,
-0.30615487694740295,
0.1830039918422699,
0.4905685782432556,
-0.13221722841262817,
0.16604216396808624,
-0.2308713048696518,
0.24027419090270996,
-0.3294675946235657,
0.2159643918275833,
-0.33016255497932434,
0.3099440634250641,
0.11999452114105225,
0.06452429294586182,
-0.0035629512276500463,
0.07621486485004425,
-0.17964790761470795,
0.28044652938842773,
0.19380606710910797,
-0.08764828741550446,
0.2333926260471344,
-0.41730326414108276,
0.1791359931230545,
-0.1308647096157074,
0.4586465358734131,
0.6418233513832092,
-0.2389523833990097,
0.17709243297576904,
0.323751300573349,
0.0375068373978138,
-0.10668563842773438,
0.025385616347193718,
0.1342611461877823,
-0.07563222944736481,
0.05577952042222023,
0.2839002311229706,
-0.10994723439216614,
-0.07677105069160461,
0.014085404574871063,
0.04201062023639679,
0.3017368018627167,
0.1350492686033249,
0.04224539175629616,
0.31792572140693665,
0.28218626976013184,
0.21729479730129242,
-0.07895780354738235,
0.3243650197982788,
0.168809711933136,
0.3248772621154785,
-0.12702417373657227,
0.12640246748924255,
-0.18793323636054993,
0.3269268870353699,
-0.05856538563966751,
-0.3316076695919037,
0.12361234426498413,
0.054044149816036224,
-0.2286888062953949,
0.0388123095035553,
-0.21605685353279114,
0.5491749048233032,
-0.5157119035720825,
-0.009049078449606895,
-0.1283322274684906,
0.06846510618925095,
-0.050738804042339325,
-0.3157408833503723,
0.03204023092985153,
-0.23804622888565063,
-0.031142953783273697,
0.02466117963194847,
-0.0586087740957737,
-0.13547711074352264,
0.06375180184841156,
0.12601828575134277,
-0.033776625990867615,
-0.3310146629810333,
0.12166766077280045,
0.017429785802960396,
0.014899447560310364,
0.004908401519060135,
0.271010160446167,
0.15193212032318115,
0.21965689957141876,
0.3230520784854889,
0.3475780189037323,
0.5777649283409119,
0.4073307514190674,
0.10604949295520782,
0.24757611751556396,
-0.26939257979393005,
-0.012606486678123474,
-0.03941423445940018,
0.3580523133277893,
0.11281471699476242,
0.037804875522851944,
0.21644532680511475,
0.0713128075003624,
-0.03739205747842789,
-0.05451435223221779,
0.0653119832277298,
-0.11782512068748474,
-0.29895487427711487,
0.23282304406166077,
-0.2536523938179016,
-0.12917304039001465,
-0.17007729411125183,
-0.04674641042947769,
-0.44124355912208557,
-0.03883911296725273,
0.5237541794776917,
0.26585763692855835,
0.1927785575389862,
-0.042704228311777115,
0.02653927356004715,
0.3400239050388336,
0.4671337604522705,
0.38308992981910706,
0.23772022128105164,
-0.057062745094299316,
-0.011146128177642822,
-0.6012915968894958,
-0.011561572551727295,
0.009720947593450546,
-0.13737620413303375,
-0.2386874556541443,
-0.1536639928817749,
0.19780229032039642,
0.15514986217021942,
0.052321359515190125,
-0.1281723529100418,
0.2108141928911209,
-0.012030869722366333,
-0.05344913899898529,
-0.1669253706932068,
-0.015177987515926361,
0.13818711042404175,
0.004907839000225067,
-0.3023654520511627,
0.06138338893651962,
-0.10898315161466599,
-0.05648649111390114,
-0.3146934509277344,
0.42382538318634033,
-0.10585279762744904,
-0.33554357290267944,
0.13646440207958221,
-0.07306482642889023,
0.4701797068119049,
0.04250940680503845,
-0.16549621522426605,
-0.17986448109149933,
-0.23826564848423004,
0.021349098533391953,
0.43025344610214233,
0.15453454852104187,
0.005093453451991081,
-0.4908643364906311,
-0.49262502789497375,
-0.2662898600101471,
0.24394312500953674,
-0.059263601899147034,
-0.37303411960601807,
0.02461392618715763,
-0.018650636076927185,
-0.03545805811882019,
0.001153341494500637,
0.23331274092197418,
0.47853729128837585,
-0.27210986614227295,
0.010619590058922768,
-0.14781954884529114,
-0.12781193852424622,
0.3023917078971863,
-0.4510454535484314,
-0.2669309973716736,
0.030796915292739868,
0.008957751095294952,
0.015702150762081146,
0.049648672342300415,
-0.5663859248161316,
0.12508678436279297,
0.13597729802131653,
-0.10330649465322495,
-0.13997501134872437,
0.053034666925668716,
-0.18257488310337067,
-0.03638375550508499,
-0.1389525681734085,
0.454903244972229,
0.08838391304016113,
-0.25883957743644714,
0.09736847877502441,
-0.20569591224193573
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.