html_url
stringlengths 51
51
| title
stringlengths 6
280
| comments
stringlengths 67
24.7k
| body
stringlengths 51
36.2k
| __index_level_0__
int64 1
1.17k
| comment_length
int64 16
1.45k
| text
stringlengths 190
38.3k
| embeddings
sequence |
---|---|---|---|---|---|---|---|
https://github.com/huggingface/datasets/issues/6109 | Problems in downloading Amazon reviews from HF | Thanks for reporting, @610v4nn1.
Indeed, the source data files are no longer available. We have contacted the authors of the dataset and they report that Amazon has decided to stop distributing the multilingual reviews dataset.
We are adding a notification about this issue to the dataset card.
See: https://huggingface.co/datasets/amazon_reviews_multi/discussions/4#64c3898db63057f1fd3ce1a0 | ### Describe the bug
I have a script downloading `amazon_reviews_multi`.
When the download starts, I get
```
Downloading data files: 0%| | 0/1 [00:00<?, ?it/s]
Downloading data: 243B [00:00, 1.43MB/s]
Downloading data files: 100%|ββββββββββ| 1/1 [00:01<00:00, 1.54s/it]
Extracting data files: 100%|ββββββββββ| 1/1 [00:00<00:00, 842.40it/s]
Downloading data files: 0%| | 0/1 [00:00<?, ?it/s]
Downloading data: 243B [00:00, 928kB/s]
Downloading data files: 100%|ββββββββββ| 1/1 [00:01<00:00, 1.42s/it]
Extracting data files: 100%|ββββββββββ| 1/1 [00:00<00:00, 832.70it/s]
Downloading data files: 0%| | 0/1 [00:00<?, ?it/s]
Downloading data: 243B [00:00, 1.81MB/s]
Downloading data files: 100%|ββββββββββ| 1/1 [00:01<00:00, 1.40s/it]
Extracting data files: 100%|ββββββββββ| 1/1 [00:00<00:00, 1294.14it/s]
Generating train split: 0%| | 0/200000 [00:00<?, ? examples/s]
```
the file is clearly too small to contain the requested dataset, in fact it contains en error message:
```
<?xml version="1.0" encoding="UTF-8"?>
<Error><Code>AccessDenied</Code><Message>Access Denied</Message><RequestId>AGJWSY3ZADT2QVWE</RequestId><HostId>Gx1O2KXnxtQFqvzDLxyVSTq3+TTJuTnuVFnJL3SP89Yp8UzvYLPTVwd1PpniE4EvQzT3tCaqEJw=</HostId></Error>
```
obviously the script fails:
```
> raise DatasetGenerationError("An error occurred while generating the dataset") from e
E datasets.builder.DatasetGenerationError: An error occurred while generating the dataset
```
### Steps to reproduce the bug
1. load_dataset("amazon_reviews_multi", name="en", split="train", cache_dir="ADDYOURPATHHERE")
### Expected behavior
I would expect the dataset to be downloaded and processed
### Environment info
* The problem is present with both datasets 2.12.0 and 2.14.2
* python version 3.10.12 | 1 | 49 | Problems in downloading Amazon reviews from HF
### Describe the bug
I have a script downloading `amazon_reviews_multi`.
When the download starts, I get
```
Downloading data files: 0%| | 0/1 [00:00<?, ?it/s]
Downloading data: 243B [00:00, 1.43MB/s]
Downloading data files: 100%|ββββββββββ| 1/1 [00:01<00:00, 1.54s/it]
Extracting data files: 100%|ββββββββββ| 1/1 [00:00<00:00, 842.40it/s]
Downloading data files: 0%| | 0/1 [00:00<?, ?it/s]
Downloading data: 243B [00:00, 928kB/s]
Downloading data files: 100%|ββββββββββ| 1/1 [00:01<00:00, 1.42s/it]
Extracting data files: 100%|ββββββββββ| 1/1 [00:00<00:00, 832.70it/s]
Downloading data files: 0%| | 0/1 [00:00<?, ?it/s]
Downloading data: 243B [00:00, 1.81MB/s]
Downloading data files: 100%|ββββββββββ| 1/1 [00:01<00:00, 1.40s/it]
Extracting data files: 100%|ββββββββββ| 1/1 [00:00<00:00, 1294.14it/s]
Generating train split: 0%| | 0/200000 [00:00<?, ? examples/s]
```
the file is clearly too small to contain the requested dataset, in fact it contains en error message:
```
<?xml version="1.0" encoding="UTF-8"?>
<Error><Code>AccessDenied</Code><Message>Access Denied</Message><RequestId>AGJWSY3ZADT2QVWE</RequestId><HostId>Gx1O2KXnxtQFqvzDLxyVSTq3+TTJuTnuVFnJL3SP89Yp8UzvYLPTVwd1PpniE4EvQzT3tCaqEJw=</HostId></Error>
```
obviously the script fails:
```
> raise DatasetGenerationError("An error occurred while generating the dataset") from e
E datasets.builder.DatasetGenerationError: An error occurred while generating the dataset
```
### Steps to reproduce the bug
1. load_dataset("amazon_reviews_multi", name="en", split="train", cache_dir="ADDYOURPATHHERE")
### Expected behavior
I would expect the dataset to be downloaded and processed
### Environment info
* The problem is present with both datasets 2.12.0 and 2.14.2
* python version 3.10.12
Thanks for reporting, @610v4nn1.
Indeed, the source data files are no longer available. We have contacted the authors of the dataset and they report that Amazon has decided to stop distributing the multilingual reviews dataset.
We are adding a notification about this issue to the dataset card.
See: https://huggingface.co/datasets/amazon_reviews_multi/discussions/4#64c3898db63057f1fd3ce1a0 | [
-1.1749063730239868,
-0.8698778748512268,
-0.8900013566017151,
1.4243459701538086,
-0.13573047518730164,
-1.2226994037628174,
0.15154093503952026,
-1.2511365413665771,
1.432878017425537,
-0.6011939644813538,
0.4040875732898712,
-1.727347731590271,
0.04589912295341492,
-0.4552827477455139,
-0.8431816697120667,
-0.9063414931297302,
-0.48868969082832336,
-0.8219608664512634,
0.97809898853302,
2.5221447944641113,
1.2454487085342407,
-1.4582936763763428,
2.7142021656036377,
0.6927785277366638,
-0.17263635993003845,
-0.89736008644104,
0.6637338399887085,
0.12301131337881088,
-1.3747620582580566,
-0.35270318388938904,
-0.8864206671714783,
-0.2087256908416748,
-0.6776193976402283,
-0.3735634386539459,
0.07718082517385483,
0.36934807896614075,
-0.3336281180381775,
-0.39881977438926697,
-0.5040537118911743,
-0.7731653451919556,
0.4934993088245392,
-0.32639068365097046,
0.9452347755432129,
-0.3145279288291931,
1.7314435243606567,
-0.6894515156745911,
0.33928388357162476,
0.8193453550338745,
1.272710919380188,
0.13429616391658783,
0.06353253871202469,
0.4447978138923645,
0.3506908118724823,
-0.05120202898979187,
0.41016343235969543,
1.257990837097168,
0.5390438437461853,
0.39969515800476074,
0.8323001265525818,
-2.1086618900299072,
1.214141607284546,
-0.9440236687660217,
0.3650023639202118,
1.2934412956237793,
-0.6883390545845032,
0.26393094658851624,
-1.8103132247924805,
-0.11476963013410568,
0.6600466370582581,
-2.1344153881073,
0.3564904034137726,
-1.2919360399246216,
-0.443464457988739,
0.823783278465271,
0.31505170464515686,
-1.0992859601974487,
0.1924101710319519,
-0.6111176609992981,
1.0263460874557495,
0.37969839572906494,
1.2355438470840454,
-1.6439788341522217,
0.034126706421375275,
-0.3567346930503845,
0.15840794146060944,
-1.2842997312545776,
-1.517490267753601,
0.6225483417510986,
0.5877630114555359,
0.5768107175827026,
-0.05366376042366028,
1.0444368124008179,
-0.990924596786499,
0.9438011050224304,
-1.067526936531067,
-1.7909425497055054,
-1.4233341217041016,
-2.2656028270721436,
-2.1752960681915283,
0.675883948802948,
-0.5190905928611755,
-0.5248356461524963,
2.0744285583496094,
-0.8218443989753723,
-1.6847647428512573,
1.0912985801696777,
0.3453565239906311,
-0.025715110823512077,
2.38901424407959,
0.2334384322166443,
-0.8005092144012451,
0.4655986428260803,
-0.7721642851829529,
0.8532306551933289,
-0.17334415018558502,
1.3294612169265747,
0.3952501118183136,
-0.817322313785553,
1.544211983680725,
-0.4773818254470825,
0.5181127190589905,
-0.7069194316864014,
-0.510952889919281,
-0.7492472529411316,
0.1645050048828125,
1.8872120380401611,
-0.39235642552375793,
1.621995449066162,
-0.3711506724357605,
-1.59600830078125,
-1.4015074968338013,
0.8548070192337036,
0.6230926513671875,
-0.9188022017478943,
0.04255623370409012,
-0.312197744846344,
0.18259593844413757,
-0.03362133726477623,
1.1139637231826782,
1.307114839553833,
0.6890169978141785,
-0.32089683413505554,
-0.9190853834152222,
0.09913426637649536,
-0.11919127404689789,
-0.926041305065155,
-1.757145881652832,
-0.23652704060077667,
0.05040449649095535,
0.7428519129753113,
-1.3149826526641846,
1.7849582433700562,
0.8830626010894775,
2.0343971252441406,
0.9405912160873413,
-0.5310664176940918,
1.528465747833252,
-0.02817205712199211,
1.8298226594924927,
-0.5771598815917969,
0.5628949403762817,
-0.5365077257156372,
-1.0460240840911865,
0.9805912971496582,
-0.2174881398677826,
-2.0183277130126953,
-0.8027382493019104,
-0.769136369228363,
-0.19887733459472656,
-0.7266181707382202,
0.955259382724762,
-0.30016273260116577,
-1.4182432889938354,
0.3275747001171112,
-0.802653968334198,
-0.06346053630113602,
-1.2230960130691528,
0.21879997849464417,
0.6387523412704468,
-0.5716357827186584,
0.10249320417642593,
-0.18729642033576965,
-1.2710916996002197,
-0.46968838572502136,
0.24482746422290802,
1.9398324489593506,
-0.7667686939239502,
0.9073495864868164,
1.0570815801620483,
-0.7027702331542969,
0.11184503883123398,
0.32686859369277954,
-0.3282639980316162,
0.7790002822875977,
-1.212141513824463,
-0.45656725764274597,
0.9662719964981079,
0.019504353404045105,
-0.5435457825660706,
1.439026951789856,
0.7922056913375854,
-1.0924997329711914,
-0.255426287651062,
-0.05488476902246475,
-0.8365159630775452,
0.04429824650287628,
-1.6403957605361938,
-0.09435681998729706,
0.36852845549583435,
-1.5204956531524658,
-0.520672082901001,
-0.30619966983795166,
1.1053617000579834,
-0.16894057393074036,
1.449000597000122,
-0.33248600363731384,
-0.12077055126428604,
-0.4024658203125,
-0.4306328296661377,
0.028902584686875343,
-0.3652535378932953,
-0.5527934432029724,
0.21421217918395996,
-0.7657608389854431,
0.30679628252983093,
1.4845154285430908,
0.2737617492675781,
0.05507075786590576,
0.34547150135040283,
1.0786222219467163,
0.4417434334754944,
0.21143725514411926,
-0.8282603621482849,
-1.4216673374176025,
2.001316785812378,
-1.6400216817855835,
1.97896409034729,
0.8372073769569397,
0.10715823620557785,
-1.8509061336517334,
-1.8962409496307373,
1.4369205236434937,
1.1241850852966309,
2.342564582824707,
0.6500725150108337,
0.46998539566993713,
-0.7195444703102112,
-0.6453754901885986,
0.2754843533039093,
-1.0210009813308716,
-0.7155759930610657,
0.2578126788139343,
2.471956729888916,
1.6470394134521484,
-0.5214792490005493,
-0.17199569940567017,
-0.726438045501709,
1.41366708278656,
0.02663044072687626,
0.17419280111789703,
2.0852012634277344,
-0.14341290295124054,
-1.1473554372787476,
1.229561448097229,
-2.429577589035034,
0.11797221750020981,
2.026836633682251,
0.33073946833610535,
0.1609681099653244,
-1.3836150169372559,
-0.6281418800354004,
-0.34391096234321594,
-0.5338645577430725,
-1.253321647644043,
0.6753658652305603,
-0.2650602161884308,
-0.8386390209197998,
-1.5096698999404907,
0.07277022302150726,
-1.1515365839004517,
-1.7260724306106567,
0.3418128192424774,
1.9635727405548096,
2.0626156330108643,
-0.7349366545677185,
1.5515421628952026,
-0.46477410197257996,
0.06370186805725098,
1.160245418548584,
1.2401493787765503,
3.013157606124878,
1.9559723138809204,
-1.2183310985565186,
0.6750320196151733,
-0.17713816463947296,
-0.48272407054901123,
1.0716792345046997,
-1.0915265083312988,
1.1454932689666748,
-0.1399167776107788,
-1.2038884162902832,
-1.1128901243209839,
1.024552822113037,
0.3550156354904175,
0.07617446780204773,
-0.5558145046234131,
1.327270746231079,
0.1391824632883072,
1.2307887077331543,
0.5341731309890747,
-0.1452437937259674,
0.48335760831832886,
-0.28818443417549133,
-0.4738817512989044,
1.7171871662139893,
0.18697428703308105,
-1.403245210647583,
-2.6771697998046875,
-0.2849111557006836,
-0.7995128035545349,
0.1759852021932602,
-0.6112654209136963,
-1.1723847389221191,
1.7169674634933472,
0.37367063760757446,
-1.300646185874939,
-0.28371724486351013,
-0.3797154426574707,
-0.6097359657287598,
2.5670199394226074,
-1.522599220275879,
-0.14569053053855896,
-0.8972037434577942,
-0.5274658203125,
1.6276670694351196,
-1.16399085521698,
-0.24738053977489471,
-1.1193861961364746,
-0.4329818785190582,
-1.2882039546966553,
-0.5998615622520447,
0.04517434537410736,
-0.8486844897270203,
0.8810341954231262,
0.17199794948101044,
-1.1709035634994507,
-0.2558881342411041,
-0.9568411111831665,
0.9307446479797363,
-0.004411451518535614,
0.2978185713291168,
1.9085617065429688,
0.43369096517562866,
-0.38061612844467163,
0.7590588927268982,
1.2261155843734741,
0.6379969120025635,
-0.6504539251327515,
0.048221126198768616,
-0.5984328389167786,
0.29778769612312317,
-1.3792881965637207,
0.2372063398361206,
-2.7560176849365234,
0.7453198432922363,
-0.05306008458137512,
-0.0012062229216098785,
-0.0062557402998209,
-1.3259267807006836,
1.3471084833145142,
2.6281445026397705,
-1.0753347873687744,
0.509250283241272,
0.26455456018447876,
1.213883876800537,
-1.4652806520462036,
0.22578002512454987,
-0.42742154002189636,
2.0522332191467285,
0.0634976252913475,
1.2297056913375854,
-0.49968522787094116,
-2.3146586418151855,
0.6550517678260803,
-1.2991814613342285,
-1.169844388961792,
0.8891038298606873,
-0.8532733917236328,
0.12605108320713043,
-1.6003309488296509,
-0.30556127429008484,
-1.1059569120407104,
-1.1736315488815308,
0.702142596244812,
0.1604469120502472,
0.49357786774635315,
-0.6802213191986084,
0.2678016722202301,
-2.3527588844299316,
-1.5775625705718994,
-0.13285784423351288,
-0.976338267326355,
0.4916875660419464,
-0.31461939215660095,
0.7881571054458618,
-0.05842374265193939,
0.09893082827329636,
0.33207783102989197,
1.313600778579712,
3.3900725841522217,
0.13425490260124207,
0.3289279639720917,
-0.2453550100326538,
-0.9432889819145203,
1.3924176692962646,
0.9624536633491516,
-0.09571674466133118,
-0.5251305103302002,
-0.9654964804649353,
1.0446335077285767,
2.0447933673858643,
0.9815633296966553,
-0.11216336488723755,
-0.9068440198898315,
-0.6823462247848511,
0.013829611241817474,
0.3419812023639679,
0.6237654685974121,
0.9773992896080017,
-0.06411025673151016,
0.07526399195194244,
1.5079127550125122,
1.0406867265701294,
-0.5091202855110168,
0.4486495554447174,
-0.8737609386444092,
-0.46648311614990234,
0.48972436785697937,
0.19705016911029816,
0.031112490221858025,
0.4918842017650604,
-1.0256251096725464,
-0.3616351783275604,
-0.36704379320144653,
-0.8895605802536011,
-0.6549792885780334,
-0.4287479519844055,
-0.3269796073436737,
1.5699057579040527,
0.04413481801748276,
-0.5010541677474976,
0.1614539921283722,
-0.6754230856895447,
-0.10202861577272415,
-1.3057773113250732,
0.20541483163833618,
-0.26072943210601807,
0.0065366774797439575,
-0.0023635383695364,
1.9241080284118652,
-0.9698752760887146,
-1.9168039560317993,
0.2004893571138382,
0.403947651386261,
-0.3661003112792969,
0.3881734311580658,
1.6930071115493774,
0.5842180252075195,
1.2753126621246338,
1.3034780025482178,
0.8723704218864441,
-0.7261286973953247,
-1.2361035346984863,
0.5439016222953796,
1.08719801902771,
-1.2915257215499878,
0.7012451887130737,
-0.0630924329161644,
-0.5183945298194885,
0.6135463714599609,
1.4494212865829468,
0.3749685287475586,
-2.180995225906372,
0.8861059546470642,
-0.7711797952651978,
0.8514716625213623,
0.7089487910270691,
0.6530497074127197,
0.3052757978439331,
0.6766644716262817,
-1.118167519569397,
-1.0680818557739258,
-0.8698973059654236,
-0.6775707602500916,
1.7960538864135742,
-0.27029961347579956,
0.43506860733032227,
-0.11611712723970413,
-1.2624850273132324,
-0.1284356713294983,
0.6547434329986572,
0.4356273114681244,
-0.4624168276786804,
0.7512735724449158,
-0.428268164396286,
-1.1904680728912354,
-1.1483370065689087,
-0.5058434009552002,
-0.9808135628700256,
-0.9432345032691956,
0.9743722677230835,
0.7490095496177673,
0.420931339263916,
1.926198959350586,
0.7165632843971252,
0.14710691571235657,
-2.670243263244629,
0.9915008544921875,
0.28491300344467163,
-0.06686930358409882,
0.9719860553741455,
0.37943747639656067,
1.052603840827942,
-0.034848377108573914,
0.5963867902755737,
-2.400886058807373,
2.3612658977508545,
-0.2599206566810608,
0.6600669622421265,
-0.1086355447769165,
-0.20519514381885529,
1.1235383749008179,
0.5166551470756531,
0.4817787706851959,
-0.9962317943572998,
0.5859125256538391,
-0.7333405613899231,
1.1650338172912598,
0.9196140170097351,
-0.8361541032791138,
0.018627917394042015,
1.2779581546783447,
0.4864630103111267,
-0.4330287575721741,
-0.9519603252410889,
-0.7767674326896667,
1.0227484703063965,
1.683639645576477,
-0.07323424518108368,
0.08754280209541321,
0.8934969902038574,
0.6156206727027893,
-1.3229339122772217,
0.055977821350097656,
-0.7545779943466187,
-0.907872200012207,
1.6536048650741577,
2.0839149951934814,
-0.1205463632941246,
0.021734243258833885,
-0.8252241611480713,
-1.3167014122009277,
0.7425965070724487,
-0.17083707451820374,
0.18411923944950104,
0.45829933881759644,
-0.656634509563446,
1.2142598628997803,
0.5997609496116638,
0.986761748790741,
0.11728135496377945,
0.4458767771720886,
0.24338839948177338,
-0.3179394602775574,
-1.0832067728042603,
-0.3249373137950897,
-1.0838896036148071,
-2.2904796600341797,
0.52424156665802,
-0.21073390543460846,
-1.3744832277297974,
-0.02304096892476082,
-0.9917129278182983,
0.9223828315734863,
-0.48330777883529663,
-0.9368158578872681,
-1.5146100521087646,
0.3025817573070526,
-0.09076005220413208,
1.0534881353378296,
-1.5762221813201904,
-0.03417372703552246,
1.1516927480697632,
0.8605188131332397,
-0.7732939124107361,
1.0082519054412842,
0.3876810371875763,
0.9994192123413086,
0.8226906061172485,
-0.36857882142066956,
0.5117658376693726,
0.06349264830350876,
-1.2483450174331665,
0.46806854009628296,
1.2031885385513306,
0.12669433653354645,
1.5066381692886353,
-0.5424774885177612,
-0.011214332655072212,
0.32395392656326294,
-0.4468333125114441,
-0.4209158718585968,
-0.6392322182655334,
0.49837884306907654,
0.25439348816871643,
-1.112237572669983,
-0.10711278021335602,
-0.17153599858283997,
-0.18383373320102692,
0.170433908700943,
-1.5421189069747925,
-0.18722622096538544,
-0.41582077741622925,
-0.44554540514945984,
-1.2355560064315796,
0.06996677070856094,
1.3724253177642822,
-0.6274109482765198,
-0.1869422346353531,
0.3332890272140503,
0.37544775009155273,
0.5870568156242371,
0.7086239457130432,
-0.5479984283447266,
-0.5137966871261597,
-0.23742985725402832,
-0.30978673696517944,
0.2596223056316376,
1.1794403791427612,
-0.1745225340127945,
-1.105182409286499,
0.702405571937561,
-0.5013771653175354,
0.049570463597774506,
1.8833175897598267,
-0.06828796863555908,
-0.7380130887031555,
0.36028555035591125,
-0.6250954270362854,
1.9332237243652344,
1.8173826932907104,
1.2196736335754395,
-0.2901609241962433,
-0.842371940612793,
0.7425133585929871,
-0.33716896176338196,
-0.2693370282649994,
0.8291410803794861,
0.4381887912750244,
-0.22366578876972198,
-1.4877485036849976,
0.4916926324367523,
1.4167733192443848,
-0.9389976859092712,
-0.870064914226532,
0.1323280930519104,
-0.7855961918830872,
1.0304479598999023,
0.7645847797393799,
0.44430482387542725,
0.3458085358142853,
1.5211031436920166,
0.7765263319015503,
-0.6272578239440918,
0.6429024934768677,
0.45383989810943604,
-0.08577540516853333,
-2.1807284355163574,
-1.1870324611663818,
0.4299168884754181,
-0.24187006056308746,
-1.696832299232483,
1.4447414875030518,
-1.1204994916915894,
-0.9449774026870728,
0.6065897941589355,
-0.06010836362838745,
1.230065107345581,
0.32079073786735535,
1.6275465488433838,
1.9664108753204346,
0.8042439818382263,
0.39815935492515564,
1.2853138446807861,
-0.1474265307188034,
-0.513806164264679,
1.8543224334716797,
-0.47428587079048157,
0.4634801745414734,
1.0229524374008179,
-0.3728414475917816,
-0.9823172688484192,
-0.8187183141708374,
-1.3299754858016968,
-0.7629167437553406,
1.1637600660324097,
0.03620796650648117,
-1.3189409971237183,
0.3655114471912384,
1.6347835063934326,
0.06513488292694092,
-0.3514992594718933,
0.6760244965553284,
0.3992891013622284,
-0.8479978442192078,
-0.1642470508813858,
-0.9876759648323059,
0.537920355796814,
-0.145241379737854,
-0.24066293239593506,
0.2359304279088974,
0.4693142771720886,
1.3625298738479614,
-0.01677818037569523,
0.039165399968624115,
1.216313123703003,
-1.4624488353729248,
1.5417484045028687,
-0.5445027351379395,
0.2758335769176483,
-2.3994669914245605,
1.3979970216751099,
-0.6765440106391907,
1.853250503540039,
-2.619835376739502,
0.32321223616600037,
-0.6381409168243408,
-0.4672563970088959,
0.3043384552001953,
-0.205017551779747,
0.2684471011161804,
-0.19107462465763092,
-1.0291002988815308,
-0.0881328210234642,
-0.7291483879089355,
0.5036725401878357,
1.0193406343460083,
1.3601882457733154,
-0.9946949481964111,
-0.2365916222333908,
-1.6586750745773315,
-0.13133998215198517,
-0.5098843574523926,
0.2868131995201111,
-2.0849008560180664,
-0.16860906779766083,
-2.0005064010620117,
-2.2517220973968506,
-1.481083631515503,
-0.8616116046905518,
1.0225462913513184,
0.22008147835731506,
-1.00897216796875,
1.109222412109375,
-0.41303274035453796,
-1.7098373174667358,
1.1003553867340088,
-2.0465312004089355
] |
https://github.com/huggingface/datasets/issues/6108 | Loading local datasets got strangely stuck | Yesterday I waited for more than 12 hours to make sure it was really **stuck** instead of proceeding too slow. | ### Describe the bug
I try to use `load_dataset()` to load several local `.jsonl` files as a dataset. Every line of these files is a json structure only containing one key `text` (yeah it is a dataset for NLP model). The code snippet is as:
```python
ds = load_dataset("json", data_files=LIST_OF_FILE_PATHS, num_proc=16)['train']
```
However, I found that the loading process can get stuck -- the progress bar `Generating train split` no more proceed. When I was trying to find the cause and solution, I found a really strange behavior. If I load the dataset in this way:
```python
dlist = list()
for _ in LIST_OF_FILE_PATHS:
dlist.append(load_dataset("json", data_files=_)['train'])
ds = concatenate_datasets(dlist)
```
I can actually successfully load all the files despite its slow speed. But if I load them in batch like above, things go wrong. I did try to use Control-C to trace the stuck point but the program cannot be terminated in this way when `num_proc` is set to `None`. The only thing I can do is use Control-Z to hang it up then kill it. If I use more than 2 cpus, a Control-C would simply cause the following error:
```bash
^C
Process ForkPoolWorker-1:
Traceback (most recent call last):
File "/usr/local/lib/python3.10/dist-packages/multiprocess/process.py", line 314, in _bootstrap
self.run()
File "/usr/local/lib/python3.10/dist-packages/multiprocess/process.py", line 108, in run
self._target(*self._args, **self._kwargs)
File "/usr/local/lib/python3.10/dist-packages/multiprocess/pool.py", line 114, in worker
task = get()
File "/usr/local/lib/python3.10/dist-packages/multiprocess/queues.py", line 368, in get
res = self._reader.recv_bytes()
File "/usr/local/lib/python3.10/dist-packages/multiprocess/connection.py", line 224, in recv_bytes
buf = self._recv_bytes(maxlength)
File "/usr/local/lib/python3.10/dist-packages/multiprocess/connection.py", line 422, in _recv_bytes
buf = self._recv(4)
File "/usr/local/lib/python3.10/dist-packages/multiprocess/connection.py", line 387, in _recv
chunk = read(handle, remaining)
KeyboardInterrupt
Generating train split: 92431 examples [01:23, 1104.25 examples/s]
Traceback (most recent call last):
File "/usr/local/lib/python3.10/dist-packages/datasets/utils/py_utils.py", line 1373, in iflatmap_unordered
yield queue.get(timeout=0.05)
File "<string>", line 2, in get
File "/usr/local/lib/python3.10/dist-packages/multiprocess/managers.py", line 818, in _callmethod
kind, result = conn.recv()
File "/usr/local/lib/python3.10/dist-packages/multiprocess/connection.py", line 258, in recv
buf = self._recv_bytes()
File "/usr/local/lib/python3.10/dist-packages/multiprocess/connection.py", line 422, in _recv_bytes
buf = self._recv(4)
File "/usr/local/lib/python3.10/dist-packages/multiprocess/connection.py", line 387, in _recv
chunk = read(handle, remaining)
KeyboardInterrupt
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/mnt/data/liyongyuan/source/batch_load.py", line 11, in <module>
a = load_dataset(
File "/usr/local/lib/python3.10/dist-packages/datasets/load.py", line 2133, in load_dataset
builder_instance.download_and_prepare(
File "/usr/local/lib/python3.10/dist-packages/datasets/builder.py", line 954, in download_and_prepare
self._download_and_prepare(
File "/usr/local/lib/python3.10/dist-packages/datasets/builder.py", line 1049, in _download_and_prepare
self._prepare_split(split_generator, **prepare_split_kwargs)
File "/usr/local/lib/python3.10/dist-packages/datasets/builder.py", line 1842, in _prepare_split
for job_id, done, content in iflatmap_unordered(
File "/usr/local/lib/python3.10/dist-packages/datasets/utils/py_utils.py", line 1387, in iflatmap_unordered
[async_result.get(timeout=0.05) for async_result in async_results]
File "/usr/local/lib/python3.10/dist-packages/datasets/utils/py_utils.py", line 1387, in <listcomp>
[async_result.get(timeout=0.05) for async_result in async_results]
File "/usr/local/lib/python3.10/dist-packages/multiprocess/pool.py", line 770, in get
raise TimeoutError
multiprocess.context.TimeoutError
```
I have validated the basic correctness of these `.jsonl` files. They are correctly formatted (or they cannot be loaded singly by `load_dataset`) though some of the json may contain too long text (more than 1e7 characters). I do not know if this could be the problem. And there should not be any bottleneck in system's resource. The whole dataset is ~300GB, and I am using a cloud server with plenty of storage and 1TB ram.
Thanks for your efforts and patience! Any suggestion or help would be appreciated.
### Steps to reproduce the bug
1. use load_dataset() with `data_files = LIST_OF_FILES`
### Expected behavior
All the files should be smoothly loaded.
### Environment info
- Datasets: A private dataset. ~2500 `.jsonl` files. ~300GB in total. Each json structure only contains one key: `text`. Format checked.
- `datasets` version: 2.14.2
- Platform: Linux-4.19.91-014.kangaroo.alios7.x86_64-x86_64-with-glibc2.35
- Python version: 3.10.6
- Huggingface_hub version: 0.15.1
- PyArrow version: 10.0.1.dev0+ga6eabc2b.d20230609
- Pandas version: 1.5.2 | 2 | 20 | Loading local datasets got strangely stuck
### Describe the bug
I try to use `load_dataset()` to load several local `.jsonl` files as a dataset. Every line of these files is a json structure only containing one key `text` (yeah it is a dataset for NLP model). The code snippet is as:
```python
ds = load_dataset("json", data_files=LIST_OF_FILE_PATHS, num_proc=16)['train']
```
However, I found that the loading process can get stuck -- the progress bar `Generating train split` no more proceed. When I was trying to find the cause and solution, I found a really strange behavior. If I load the dataset in this way:
```python
dlist = list()
for _ in LIST_OF_FILE_PATHS:
dlist.append(load_dataset("json", data_files=_)['train'])
ds = concatenate_datasets(dlist)
```
I can actually successfully load all the files despite its slow speed. But if I load them in batch like above, things go wrong. I did try to use Control-C to trace the stuck point but the program cannot be terminated in this way when `num_proc` is set to `None`. The only thing I can do is use Control-Z to hang it up then kill it. If I use more than 2 cpus, a Control-C would simply cause the following error:
```bash
^C
Process ForkPoolWorker-1:
Traceback (most recent call last):
File "/usr/local/lib/python3.10/dist-packages/multiprocess/process.py", line 314, in _bootstrap
self.run()
File "/usr/local/lib/python3.10/dist-packages/multiprocess/process.py", line 108, in run
self._target(*self._args, **self._kwargs)
File "/usr/local/lib/python3.10/dist-packages/multiprocess/pool.py", line 114, in worker
task = get()
File "/usr/local/lib/python3.10/dist-packages/multiprocess/queues.py", line 368, in get
res = self._reader.recv_bytes()
File "/usr/local/lib/python3.10/dist-packages/multiprocess/connection.py", line 224, in recv_bytes
buf = self._recv_bytes(maxlength)
File "/usr/local/lib/python3.10/dist-packages/multiprocess/connection.py", line 422, in _recv_bytes
buf = self._recv(4)
File "/usr/local/lib/python3.10/dist-packages/multiprocess/connection.py", line 387, in _recv
chunk = read(handle, remaining)
KeyboardInterrupt
Generating train split: 92431 examples [01:23, 1104.25 examples/s]
Traceback (most recent call last):
File "/usr/local/lib/python3.10/dist-packages/datasets/utils/py_utils.py", line 1373, in iflatmap_unordered
yield queue.get(timeout=0.05)
File "<string>", line 2, in get
File "/usr/local/lib/python3.10/dist-packages/multiprocess/managers.py", line 818, in _callmethod
kind, result = conn.recv()
File "/usr/local/lib/python3.10/dist-packages/multiprocess/connection.py", line 258, in recv
buf = self._recv_bytes()
File "/usr/local/lib/python3.10/dist-packages/multiprocess/connection.py", line 422, in _recv_bytes
buf = self._recv(4)
File "/usr/local/lib/python3.10/dist-packages/multiprocess/connection.py", line 387, in _recv
chunk = read(handle, remaining)
KeyboardInterrupt
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/mnt/data/liyongyuan/source/batch_load.py", line 11, in <module>
a = load_dataset(
File "/usr/local/lib/python3.10/dist-packages/datasets/load.py", line 2133, in load_dataset
builder_instance.download_and_prepare(
File "/usr/local/lib/python3.10/dist-packages/datasets/builder.py", line 954, in download_and_prepare
self._download_and_prepare(
File "/usr/local/lib/python3.10/dist-packages/datasets/builder.py", line 1049, in _download_and_prepare
self._prepare_split(split_generator, **prepare_split_kwargs)
File "/usr/local/lib/python3.10/dist-packages/datasets/builder.py", line 1842, in _prepare_split
for job_id, done, content in iflatmap_unordered(
File "/usr/local/lib/python3.10/dist-packages/datasets/utils/py_utils.py", line 1387, in iflatmap_unordered
[async_result.get(timeout=0.05) for async_result in async_results]
File "/usr/local/lib/python3.10/dist-packages/datasets/utils/py_utils.py", line 1387, in <listcomp>
[async_result.get(timeout=0.05) for async_result in async_results]
File "/usr/local/lib/python3.10/dist-packages/multiprocess/pool.py", line 770, in get
raise TimeoutError
multiprocess.context.TimeoutError
```
I have validated the basic correctness of these `.jsonl` files. They are correctly formatted (or they cannot be loaded singly by `load_dataset`) though some of the json may contain too long text (more than 1e7 characters). I do not know if this could be the problem. And there should not be any bottleneck in system's resource. The whole dataset is ~300GB, and I am using a cloud server with plenty of storage and 1TB ram.
Thanks for your efforts and patience! Any suggestion or help would be appreciated.
### Steps to reproduce the bug
1. use load_dataset() with `data_files = LIST_OF_FILES`
### Expected behavior
All the files should be smoothly loaded.
### Environment info
- Datasets: A private dataset. ~2500 `.jsonl` files. ~300GB in total. Each json structure only contains one key: `text`. Format checked.
- `datasets` version: 2.14.2
- Platform: Linux-4.19.91-014.kangaroo.alios7.x86_64-x86_64-with-glibc2.35
- Python version: 3.10.6
- Huggingface_hub version: 0.15.1
- PyArrow version: 10.0.1.dev0+ga6eabc2b.d20230609
- Pandas version: 1.5.2
Yesterday I waited for more than 12 hours to make sure it was really **stuck** instead of proceeding too slow. | [
-1.1857736110687256,
-0.9407454133033752,
-0.7441576719284058,
1.4746325016021729,
-0.11657063663005829,
-1.2399708032608032,
0.11755771934986115,
-1.0479322671890259,
1.7225706577301025,
-0.7684071063995361,
0.38269880414009094,
-1.6014268398284912,
0.03821048140525818,
-0.6209810972213745,
-0.7727939486503601,
-0.8944603800773621,
-0.4088424742221832,
-0.8194125294685364,
1.0283896923065186,
2.462496757507324,
1.2099568843841553,
-1.403232216835022,
2.7265608310699463,
0.6924651861190796,
-0.2164050042629242,
-1.0413557291030884,
0.5166077613830566,
-0.010159664787352085,
-1.1726576089859009,
-0.4255408048629761,
-0.9635022878646851,
-0.10558275878429413,
-0.6585036516189575,
-0.5079758167266846,
0.05268178880214691,
0.4019443094730377,
-0.24002186954021454,
-0.3776376247406006,
-0.57227623462677,
-0.7602928280830383,
0.5162822604179382,
-0.3317278325557709,
0.972929060459137,
-0.28395286202430725,
1.8031069040298462,
-0.6038073301315308,
0.46886107325553894,
0.7760091423988342,
1.354609489440918,
0.2248118817806244,
-0.0016446355730295181,
0.3432528078556061,
0.3676868677139282,
0.04271122068166733,
0.5380293726921082,
1.1995790004730225,
0.6081677675247192,
0.5152134895324707,
0.7276692390441895,
-2.184246063232422,
1.2898826599121094,
-1.0188233852386475,
0.3503153324127197,
1.2698777914047241,
-0.9048412442207336,
0.3893762230873108,
-1.8603965044021606,
-0.04896062612533569,
0.6037646532058716,
-2.244311571121216,
0.2338779866695404,
-1.3310497999191284,
-0.49006420373916626,
0.9795165061950684,
0.3442109227180481,
-1.3024133443832397,
0.18255537748336792,
-0.42121222615242004,
1.051797866821289,
0.4166954457759857,
1.1190639734268188,
-1.6669014692306519,
-0.009774336591362953,
-0.3293585479259491,
0.1635141670703888,
-1.2263544797897339,
-1.5070654153823853,
0.5729089975357056,
0.6171499490737915,
0.5612480640411377,
-0.13687685132026672,
1.0765891075134277,
-1.0261775255203247,
0.8335713744163513,
-0.9632993936538696,
-1.7179174423217773,
-1.4542927742004395,
-2.2724311351776123,
-2.305119037628174,
0.8332210779190063,
-0.48154833912849426,
-0.4861609935760498,
2.066084861755371,
-0.9672607183456421,
-1.760550856590271,
1.1019209623336792,
0.2541908919811249,
0.0005201064050197601,
2.344029188156128,
0.1405647099018097,
-0.7619856595993042,
0.4461615979671478,
-0.719220757484436,
0.8046331405639648,
-0.3599391579627991,
1.3694673776626587,
0.4728565514087677,
-1.0297503471374512,
1.5947773456573486,
-0.4017045795917511,
0.5501520037651062,
-0.6440993547439575,
-0.5337281823158264,
-0.7929158806800842,
0.33021658658981323,
1.9039069414138794,
-0.30433639883995056,
1.5482233762741089,
-0.34435856342315674,
-1.5470677614212036,
-1.564254879951477,
0.888276219367981,
0.48914024233818054,
-0.8056665658950806,
0.10974583774805069,
-0.39614608883857727,
0.15515007078647614,
-0.05539649724960327,
1.18917715549469,
1.2156568765640259,
0.746762752532959,
-0.36024799942970276,
-0.8663837909698486,
0.1407097578048706,
-0.06023271381855011,
-0.7152811884880066,
-1.8659703731536865,
-0.3546149730682373,
0.1788507103919983,
0.6218679547309875,
-1.193255066871643,
1.7748363018035889,
0.92495197057724,
1.9225759506225586,
1.0170502662658691,
-0.3195354640483856,
1.516502857208252,
-0.03558150306344032,
1.8763700723648071,
-0.4583948850631714,
0.5885534286499023,
-0.360810786485672,
-1.196715235710144,
0.8377751708030701,
-0.29318201541900635,
-2.038484573364258,
-0.7103738784790039,
-0.834315299987793,
-0.17930953204631805,
-0.7523581385612488,
0.8580973744392395,
-0.3118514120578766,
-1.4367921352386475,
0.17469334602355957,
-0.6502706408500671,
0.114289291203022,
-1.2390071153640747,
0.29432353377342224,
0.6449299454689026,
-0.7074230909347534,
0.07158519327640533,
-0.3197842836380005,
-1.2106208801269531,
-0.549460768699646,
0.2689276933670044,
1.8636901378631592,
-0.7478760480880737,
0.9734770655632019,
1.032645583152771,
-0.6845254302024841,
-0.028486648574471474,
0.3420042097568512,
-0.29361337423324585,
0.8849694728851318,
-1.0835940837860107,
-0.4671410620212555,
1.1719520092010498,
-0.16941338777542114,
-0.6102598905563354,
1.4208518266677856,
0.7856005430221558,
-1.054190993309021,
-0.24877195060253143,
-0.2335503250360489,
-0.8555761575698853,
0.04584003984928131,
-1.586504340171814,
-0.11513541638851166,
0.4020754098892212,
-1.5483136177062988,
-0.38727813959121704,
-0.20324184000492096,
1.27974271774292,
-0.22253526747226715,
1.4569973945617676,
-0.33041122555732727,
-0.24466556310653687,
-0.32929882407188416,
-0.4515054523944855,
0.16523446142673492,
-0.11603590846061707,
-0.6699464917182922,
0.16696299612522125,
-0.7458930611610413,
0.3739664554595947,
1.4462465047836304,
0.3052820861339569,
0.036311499774456024,
0.5148871541023254,
1.1212682723999023,
0.3424697816371918,
0.044216401875019073,
-0.9726801514625549,
-1.5047413110733032,
2.0229122638702393,
-1.439529299736023,
1.9469588994979858,
0.7661038637161255,
-0.06159823387861252,
-1.8067489862442017,
-1.8054803609848022,
1.3576617240905762,
1.1666648387908936,
2.3743810653686523,
0.5515940189361572,
0.38672754168510437,
-0.8191073536872864,
-0.6778033971786499,
0.3580164611339569,
-1.0762383937835693,
-0.7609761357307434,
0.12679025530815125,
2.3991148471832275,
1.8205279111862183,
-0.502000093460083,
-0.2354866862297058,
-1.0072424411773682,
1.381729006767273,
-0.22363805770874023,
0.2667018473148346,
2.015361785888672,
-0.2953281104564667,
-1.0586005449295044,
1.2469573020935059,
-2.3405649662017822,
0.18798625469207764,
2.040473699569702,
0.2513265609741211,
0.1753658950328827,
-1.4550968408584595,
-0.6100200414657593,
-0.19842049479484558,
-0.4470710754394531,
-1.256653904914856,
0.5058630108833313,
-0.27943867444992065,
-0.7859964966773987,
-1.4496008157730103,
0.15890000760555267,
-1.1547420024871826,
-1.689998745918274,
0.2607925534248352,
1.9289904832839966,
2.0340874195098877,
-0.7462478876113892,
1.5081462860107422,
-0.3079971373081207,
0.18657687306404114,
1.286574363708496,
1.286323070526123,
3.098590850830078,
1.9048638343811035,
-1.2199252843856812,
0.6274429559707642,
-0.21113325655460358,
-0.49390748143196106,
1.138333797454834,
-1.1720070838928223,
1.1568132638931274,
-0.1872391402721405,
-1.1009259223937988,
-1.19161057472229,
1.007169485092163,
0.47824111580848694,
0.02073085308074951,
-0.5081774592399597,
1.2130450010299683,
0.09992562979459763,
1.3254599571228027,
0.5691626071929932,
-0.3873027265071869,
0.6314074993133545,
-0.3668352961540222,
-0.4965443015098572,
1.613722324371338,
0.1891213208436966,
-1.384263277053833,
-2.328956127166748,
-0.18701601028442383,
-0.9365720152854919,
0.045867085456848145,
-0.580862283706665,
-0.958073616027832,
1.6262056827545166,
0.34906628727912903,
-1.2879420518875122,
-0.2250802218914032,
-0.3236059546470642,
-0.6110820174217224,
2.636465072631836,
-1.3133381605148315,
-0.21953465044498444,
-0.9799793362617493,
-0.6194500923156738,
1.666200041770935,
-1.160622477531433,
-0.24824216961860657,
-1.0042481422424316,
-0.5782238841056824,
-1.3139687776565552,
-0.504253089427948,
0.006970008835196495,
-0.9177166819572449,
0.8342537879943848,
0.17317669093608856,
-1.152393102645874,
-0.3344455063343048,
-0.8396942615509033,
0.9102033972740173,
-0.10824748873710632,
0.16855069994926453,
1.856787085533142,
0.35888707637786865,
-0.39788252115249634,
0.7186763882637024,
1.1461787223815918,
0.6140767931938171,
-0.5669205784797668,
0.20943814516067505,
-0.6787242889404297,
0.28269535303115845,
-1.2839521169662476,
0.3277348577976227,
-2.8885583877563477,
0.7232061624526978,
-0.09950622171163559,
-0.08384138345718384,
-0.08552236109972,
-1.3513370752334595,
1.0464576482772827,
2.6293892860412598,
-1.1441740989685059,
0.47064316272735596,
0.32985731959342957,
1.160235047340393,
-1.6788133382797241,
0.2724669575691223,
-0.4323078393936157,
2.1404330730438232,
0.15187376737594604,
1.2186286449432373,
-0.40442413091659546,
-2.308438539505005,
0.5948107242584229,
-1.2602182626724243,
-1.1369141340255737,
0.7923150658607483,
-0.7879585027694702,
0.13558050990104675,
-1.4016728401184082,
-0.21533024311065674,
-0.9284399747848511,
-1.179283618927002,
0.7575048208236694,
0.1545705497264862,
0.4516685903072357,
-0.6421931982040405,
0.32089704275131226,
-2.166081190109253,
-1.3812161684036255,
-0.20191077888011932,
-0.935924232006073,
0.48065775632858276,
-0.3313238322734833,
0.6799854040145874,
-0.1405913531780243,
0.048482559621334076,
0.33047324419021606,
1.4958500862121582,
3.4104464054107666,
0.15938714146614075,
0.31089693307876587,
-0.19146916270256042,
-0.893835186958313,
1.4162228107452393,
0.88791823387146,
-0.14496727287769318,
-0.5868193507194519,
-1.0717086791992188,
1.253820776939392,
2.0058417320251465,
1.0297530889511108,
0.10569362342357635,
-0.7883124351501465,
-0.722813069820404,
-0.060019999742507935,
0.17492865025997162,
0.4602712392807007,
0.8696073889732361,
0.0407901257276535,
0.09817802906036377,
1.3810077905654907,
1.1756192445755005,
-0.41315758228302,
0.3348855674266815,
-0.8387416005134583,
-0.42695140838623047,
0.4968971610069275,
0.2145848572254181,
-0.009452552534639835,
0.3268333077430725,
-1.0249592065811157,
-0.2579589784145355,
-0.3388806879520416,
-0.9548298120498657,
-0.7445858120918274,
-0.4307718276977539,
-0.3861316740512848,
1.6309629678726196,
0.07657036930322647,
-0.5334811210632324,
-0.028085755184292793,
-0.6963358521461487,
-0.08608516305685043,
-1.0765913724899292,
0.16933338344097137,
-0.09807632118463516,
-0.1379164606332779,
-0.142483651638031,
1.7149851322174072,
-0.8927140235900879,
-2.033263921737671,
0.2613278925418854,
0.24954141676425934,
-0.34509292244911194,
0.24373771250247955,
1.6935194730758667,
0.48897215723991394,
1.4522329568862915,
1.3573921918869019,
0.9454881548881531,
-0.6484937071800232,
-1.262046456336975,
0.6607219576835632,
0.980215311050415,
-1.4375168085098267,
0.7953000068664551,
-0.020188678056001663,
-0.45730048418045044,
0.6360543966293335,
1.311997890472412,
0.45368754863739014,
-2.05928635597229,
0.8549001812934875,
-0.941453754901886,
0.7588342428207397,
0.6597298383712769,
0.6531943082809448,
0.20979832112789154,
0.8596407771110535,
-1.1750915050506592,
-1.1869553327560425,
-0.6938489675521851,
-0.6629811525344849,
1.99611496925354,
-0.20582151412963867,
0.6047783493995667,
-0.166952446103096,
-1.2926483154296875,
-0.16168172657489777,
0.7285361886024475,
0.40200361609458923,
-0.44407919049263,
0.7771522402763367,
-0.6781615018844604,
-1.0751254558563232,
-1.4056015014648438,
-0.45740246772766113,
-1.0413670539855957,
-0.8711357712745667,
1.0231027603149414,
0.7878109216690063,
0.3527986705303192,
1.924103021621704,
0.6656416058540344,
0.2717441916465759,
-2.5978899002075195,
0.868948757648468,
0.3302416503429413,
-0.08382503688335419,
0.8692384362220764,
0.29761430621147156,
1.0661942958831787,
-0.0428975373506546,
0.5640226006507874,
-2.350654125213623,
2.2765297889709473,
-0.18213337659835815,
0.6861506700515747,
0.032333776354789734,
-0.2379818707704544,
1.1013121604919434,
0.5840322375297546,
0.576834499835968,
-1.1082333326339722,
0.6316280961036682,
-0.5855826139450073,
1.1901038885116577,
0.8488075733184814,
-0.7871677875518799,
-0.0008683111518621445,
1.3502707481384277,
0.47497960925102234,
-0.5334844589233398,
-0.9547038078308105,
-0.9876457452774048,
0.945563018321991,
1.6805723905563354,
-0.10287394374608994,
-0.003921165131032467,
0.8386645317077637,
0.6805384159088135,
-1.250244379043579,
0.08274426311254501,
-0.7560269832611084,
-0.761878252029419,
1.6453862190246582,
2.032870054244995,
-0.197617307305336,
-0.18333464860916138,
-0.7866719365119934,
-1.277175784111023,
0.7839676141738892,
-0.04455278813838959,
0.05087999999523163,
0.6562317609786987,
-0.6419892311096191,
1.123640775680542,
0.8160219788551331,
0.9518329501152039,
0.20252229273319244,
0.2989584803581238,
0.3617345988750458,
-0.3324471116065979,
-1.1187938451766968,
-0.24678991734981537,
-1.0892280340194702,
-2.576108455657959,
0.4648890495300293,
-0.21890562772750854,
-1.4016669988632202,
0.009480543434619904,
-0.9739300012588501,
0.8982905149459839,
-0.5727550983428955,
-1.1180434226989746,
-1.472895860671997,
0.2954536974430084,
-0.07155786454677582,
0.9305890202522278,
-1.6270309686660767,
-0.07700309157371521,
1.2112900018692017,
0.9251077771186829,
-0.654590904712677,
0.9605237245559692,
0.22694525122642517,
1.0173345804214478,
0.8269578218460083,
-0.3999858796596527,
0.5398796200752258,
-0.016454163938760757,
-1.3011225461959839,
0.4794811010360718,
1.1388471126556396,
0.13864414393901825,
1.4678304195404053,
-0.5136696100234985,
0.02861284278333187,
0.403213769197464,
-0.5807628035545349,
-0.5130099058151245,
-0.5472197532653809,
0.6829068064689636,
-0.017210179939866066,
-0.9211769104003906,
0.025153568014502525,
-0.06269404292106628,
-0.21011319756507874,
0.24059095978736877,
-1.4828931093215942,
-0.1599954515695572,
-0.35624977946281433,
-0.5556564927101135,
-1.276471734046936,
-0.050106480717659,
1.351976752281189,
-0.7318329811096191,
-0.21917471289634705,
0.48565927147865295,
0.4128744602203369,
0.49645423889160156,
0.5929173827171326,
-0.7269665598869324,
-0.36162298917770386,
-0.24627771973609924,
-0.36984002590179443,
0.28233668208122253,
1.316089391708374,
-0.14444801211357117,
-0.9992629885673523,
0.699063777923584,
-0.38259032368659973,
0.0544123649597168,
1.9495508670806885,
0.12797223031520844,
-0.7993029952049255,
0.3344654142856598,
-0.7151427268981934,
1.8554134368896484,
1.807225227355957,
1.2634577751159668,
-0.13580471277236938,
-0.8974276185035706,
0.6457607746124268,
-0.38154345750808716,
-0.3979913592338562,
0.9249047636985779,
0.3525339365005493,
-0.20610910654067993,
-1.426829218864441,
0.7358364462852478,
1.3347903490066528,
-0.8025565147399902,
-0.8295329213142395,
0.09899698197841644,
-0.8371274471282959,
1.0565483570098877,
0.6693841814994812,
0.38482269644737244,
0.24250520765781403,
1.6328611373901367,
0.7659339308738708,
-0.49272406101226807,
0.56073397397995,
0.5103975534439087,
-0.17157547175884247,
-2.113798141479492,
-1.1865376234054565,
0.2917010486125946,
-0.5235059261322021,
-1.6518900394439697,
1.3959109783172607,
-1.0905125141143799,
-0.981827437877655,
0.612024188041687,
0.058938995003700256,
1.4035661220550537,
0.3737771213054657,
1.610931634902954,
2.113927125930786,
0.8295891284942627,
0.3936780095100403,
1.265575647354126,
-0.11900375038385391,
-0.48769399523735046,
1.8852075338363647,
-0.4626515805721283,
0.48724365234375,
1.056398630142212,
-0.34424537420272827,
-1.0873662233352661,
-0.8167374730110168,
-1.1755986213684082,
-0.6811343431472778,
1.1421849727630615,
0.09619375318288803,
-1.0854218006134033,
0.29008960723876953,
1.6480762958526611,
0.10531748086214066,
-0.28998473286628723,
0.6317206621170044,
0.35889267921447754,
-0.771394670009613,
-0.014612091705203056,
-0.959479570388794,
0.5414214134216309,
-0.20882725715637207,
-0.35919004678726196,
0.3234575688838959,
0.46947768330574036,
1.3138418197631836,
-0.032530803233385086,
0.11772935092449188,
1.1937856674194336,
-1.434771180152893,
1.4975249767303467,
-0.6596755385398865,
0.3768799304962158,
-2.4442501068115234,
1.382062554359436,
-0.8422481417655945,
1.948033332824707,
-2.6141459941864014,
0.3736844062805176,
-0.5740783214569092,
-0.4890991151332855,
0.27379336953163147,
-0.33868926763534546,
0.1370794028043747,
-0.1191677451133728,
-1.1200543642044067,
0.018972571939229965,
-0.7024657130241394,
0.5896080136299133,
1.1115639209747314,
1.3885365724563599,
-1.0890425443649292,
-0.2629130780696869,
-1.751060128211975,
-0.1562928855419159,
-0.641274094581604,
0.3397183120250702,
-2.0135340690612793,
-0.18938960134983063,
-1.9122422933578491,
-2.310183048248291,
-1.3322786092758179,
-0.8734745383262634,
1.0172775983810425,
0.14468906819820404,
-0.9001511335372925,
1.1617234945297241,
-0.3717103898525238,
-1.868216633796692,
1.133630633354187,
-2.1540725231170654
] |
https://github.com/huggingface/datasets/issues/6108 | Loading local datasets got strangely stuck | I've had similar weird issues with `load_dataset` as well. Not multiple files, but dataset is quite big, about 50G. | ### Describe the bug
I try to use `load_dataset()` to load several local `.jsonl` files as a dataset. Every line of these files is a json structure only containing one key `text` (yeah it is a dataset for NLP model). The code snippet is as:
```python
ds = load_dataset("json", data_files=LIST_OF_FILE_PATHS, num_proc=16)['train']
```
However, I found that the loading process can get stuck -- the progress bar `Generating train split` no more proceed. When I was trying to find the cause and solution, I found a really strange behavior. If I load the dataset in this way:
```python
dlist = list()
for _ in LIST_OF_FILE_PATHS:
dlist.append(load_dataset("json", data_files=_)['train'])
ds = concatenate_datasets(dlist)
```
I can actually successfully load all the files despite its slow speed. But if I load them in batch like above, things go wrong. I did try to use Control-C to trace the stuck point but the program cannot be terminated in this way when `num_proc` is set to `None`. The only thing I can do is use Control-Z to hang it up then kill it. If I use more than 2 cpus, a Control-C would simply cause the following error:
```bash
^C
Process ForkPoolWorker-1:
Traceback (most recent call last):
File "/usr/local/lib/python3.10/dist-packages/multiprocess/process.py", line 314, in _bootstrap
self.run()
File "/usr/local/lib/python3.10/dist-packages/multiprocess/process.py", line 108, in run
self._target(*self._args, **self._kwargs)
File "/usr/local/lib/python3.10/dist-packages/multiprocess/pool.py", line 114, in worker
task = get()
File "/usr/local/lib/python3.10/dist-packages/multiprocess/queues.py", line 368, in get
res = self._reader.recv_bytes()
File "/usr/local/lib/python3.10/dist-packages/multiprocess/connection.py", line 224, in recv_bytes
buf = self._recv_bytes(maxlength)
File "/usr/local/lib/python3.10/dist-packages/multiprocess/connection.py", line 422, in _recv_bytes
buf = self._recv(4)
File "/usr/local/lib/python3.10/dist-packages/multiprocess/connection.py", line 387, in _recv
chunk = read(handle, remaining)
KeyboardInterrupt
Generating train split: 92431 examples [01:23, 1104.25 examples/s]
Traceback (most recent call last):
File "/usr/local/lib/python3.10/dist-packages/datasets/utils/py_utils.py", line 1373, in iflatmap_unordered
yield queue.get(timeout=0.05)
File "<string>", line 2, in get
File "/usr/local/lib/python3.10/dist-packages/multiprocess/managers.py", line 818, in _callmethod
kind, result = conn.recv()
File "/usr/local/lib/python3.10/dist-packages/multiprocess/connection.py", line 258, in recv
buf = self._recv_bytes()
File "/usr/local/lib/python3.10/dist-packages/multiprocess/connection.py", line 422, in _recv_bytes
buf = self._recv(4)
File "/usr/local/lib/python3.10/dist-packages/multiprocess/connection.py", line 387, in _recv
chunk = read(handle, remaining)
KeyboardInterrupt
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/mnt/data/liyongyuan/source/batch_load.py", line 11, in <module>
a = load_dataset(
File "/usr/local/lib/python3.10/dist-packages/datasets/load.py", line 2133, in load_dataset
builder_instance.download_and_prepare(
File "/usr/local/lib/python3.10/dist-packages/datasets/builder.py", line 954, in download_and_prepare
self._download_and_prepare(
File "/usr/local/lib/python3.10/dist-packages/datasets/builder.py", line 1049, in _download_and_prepare
self._prepare_split(split_generator, **prepare_split_kwargs)
File "/usr/local/lib/python3.10/dist-packages/datasets/builder.py", line 1842, in _prepare_split
for job_id, done, content in iflatmap_unordered(
File "/usr/local/lib/python3.10/dist-packages/datasets/utils/py_utils.py", line 1387, in iflatmap_unordered
[async_result.get(timeout=0.05) for async_result in async_results]
File "/usr/local/lib/python3.10/dist-packages/datasets/utils/py_utils.py", line 1387, in <listcomp>
[async_result.get(timeout=0.05) for async_result in async_results]
File "/usr/local/lib/python3.10/dist-packages/multiprocess/pool.py", line 770, in get
raise TimeoutError
multiprocess.context.TimeoutError
```
I have validated the basic correctness of these `.jsonl` files. They are correctly formatted (or they cannot be loaded singly by `load_dataset`) though some of the json may contain too long text (more than 1e7 characters). I do not know if this could be the problem. And there should not be any bottleneck in system's resource. The whole dataset is ~300GB, and I am using a cloud server with plenty of storage and 1TB ram.
Thanks for your efforts and patience! Any suggestion or help would be appreciated.
### Steps to reproduce the bug
1. use load_dataset() with `data_files = LIST_OF_FILES`
### Expected behavior
All the files should be smoothly loaded.
### Environment info
- Datasets: A private dataset. ~2500 `.jsonl` files. ~300GB in total. Each json structure only contains one key: `text`. Format checked.
- `datasets` version: 2.14.2
- Platform: Linux-4.19.91-014.kangaroo.alios7.x86_64-x86_64-with-glibc2.35
- Python version: 3.10.6
- Huggingface_hub version: 0.15.1
- PyArrow version: 10.0.1.dev0+ga6eabc2b.d20230609
- Pandas version: 1.5.2 | 2 | 19 | Loading local datasets got strangely stuck
### Describe the bug
I try to use `load_dataset()` to load several local `.jsonl` files as a dataset. Every line of these files is a json structure only containing one key `text` (yeah it is a dataset for NLP model). The code snippet is as:
```python
ds = load_dataset("json", data_files=LIST_OF_FILE_PATHS, num_proc=16)['train']
```
However, I found that the loading process can get stuck -- the progress bar `Generating train split` no more proceed. When I was trying to find the cause and solution, I found a really strange behavior. If I load the dataset in this way:
```python
dlist = list()
for _ in LIST_OF_FILE_PATHS:
dlist.append(load_dataset("json", data_files=_)['train'])
ds = concatenate_datasets(dlist)
```
I can actually successfully load all the files despite its slow speed. But if I load them in batch like above, things go wrong. I did try to use Control-C to trace the stuck point but the program cannot be terminated in this way when `num_proc` is set to `None`. The only thing I can do is use Control-Z to hang it up then kill it. If I use more than 2 cpus, a Control-C would simply cause the following error:
```bash
^C
Process ForkPoolWorker-1:
Traceback (most recent call last):
File "/usr/local/lib/python3.10/dist-packages/multiprocess/process.py", line 314, in _bootstrap
self.run()
File "/usr/local/lib/python3.10/dist-packages/multiprocess/process.py", line 108, in run
self._target(*self._args, **self._kwargs)
File "/usr/local/lib/python3.10/dist-packages/multiprocess/pool.py", line 114, in worker
task = get()
File "/usr/local/lib/python3.10/dist-packages/multiprocess/queues.py", line 368, in get
res = self._reader.recv_bytes()
File "/usr/local/lib/python3.10/dist-packages/multiprocess/connection.py", line 224, in recv_bytes
buf = self._recv_bytes(maxlength)
File "/usr/local/lib/python3.10/dist-packages/multiprocess/connection.py", line 422, in _recv_bytes
buf = self._recv(4)
File "/usr/local/lib/python3.10/dist-packages/multiprocess/connection.py", line 387, in _recv
chunk = read(handle, remaining)
KeyboardInterrupt
Generating train split: 92431 examples [01:23, 1104.25 examples/s]
Traceback (most recent call last):
File "/usr/local/lib/python3.10/dist-packages/datasets/utils/py_utils.py", line 1373, in iflatmap_unordered
yield queue.get(timeout=0.05)
File "<string>", line 2, in get
File "/usr/local/lib/python3.10/dist-packages/multiprocess/managers.py", line 818, in _callmethod
kind, result = conn.recv()
File "/usr/local/lib/python3.10/dist-packages/multiprocess/connection.py", line 258, in recv
buf = self._recv_bytes()
File "/usr/local/lib/python3.10/dist-packages/multiprocess/connection.py", line 422, in _recv_bytes
buf = self._recv(4)
File "/usr/local/lib/python3.10/dist-packages/multiprocess/connection.py", line 387, in _recv
chunk = read(handle, remaining)
KeyboardInterrupt
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/mnt/data/liyongyuan/source/batch_load.py", line 11, in <module>
a = load_dataset(
File "/usr/local/lib/python3.10/dist-packages/datasets/load.py", line 2133, in load_dataset
builder_instance.download_and_prepare(
File "/usr/local/lib/python3.10/dist-packages/datasets/builder.py", line 954, in download_and_prepare
self._download_and_prepare(
File "/usr/local/lib/python3.10/dist-packages/datasets/builder.py", line 1049, in _download_and_prepare
self._prepare_split(split_generator, **prepare_split_kwargs)
File "/usr/local/lib/python3.10/dist-packages/datasets/builder.py", line 1842, in _prepare_split
for job_id, done, content in iflatmap_unordered(
File "/usr/local/lib/python3.10/dist-packages/datasets/utils/py_utils.py", line 1387, in iflatmap_unordered
[async_result.get(timeout=0.05) for async_result in async_results]
File "/usr/local/lib/python3.10/dist-packages/datasets/utils/py_utils.py", line 1387, in <listcomp>
[async_result.get(timeout=0.05) for async_result in async_results]
File "/usr/local/lib/python3.10/dist-packages/multiprocess/pool.py", line 770, in get
raise TimeoutError
multiprocess.context.TimeoutError
```
I have validated the basic correctness of these `.jsonl` files. They are correctly formatted (or they cannot be loaded singly by `load_dataset`) though some of the json may contain too long text (more than 1e7 characters). I do not know if this could be the problem. And there should not be any bottleneck in system's resource. The whole dataset is ~300GB, and I am using a cloud server with plenty of storage and 1TB ram.
Thanks for your efforts and patience! Any suggestion or help would be appreciated.
### Steps to reproduce the bug
1. use load_dataset() with `data_files = LIST_OF_FILES`
### Expected behavior
All the files should be smoothly loaded.
### Environment info
- Datasets: A private dataset. ~2500 `.jsonl` files. ~300GB in total. Each json structure only contains one key: `text`. Format checked.
- `datasets` version: 2.14.2
- Platform: Linux-4.19.91-014.kangaroo.alios7.x86_64-x86_64-with-glibc2.35
- Python version: 3.10.6
- Huggingface_hub version: 0.15.1
- PyArrow version: 10.0.1.dev0+ga6eabc2b.d20230609
- Pandas version: 1.5.2
I've had similar weird issues with `load_dataset` as well. Not multiple files, but dataset is quite big, about 50G. | [
-1.1857736110687256,
-0.9407454133033752,
-0.7441576719284058,
1.4746325016021729,
-0.11657063663005829,
-1.2399708032608032,
0.11755771934986115,
-1.0479322671890259,
1.7225706577301025,
-0.7684071063995361,
0.38269880414009094,
-1.6014268398284912,
0.03821048140525818,
-0.6209810972213745,
-0.7727939486503601,
-0.8944603800773621,
-0.4088424742221832,
-0.8194125294685364,
1.0283896923065186,
2.462496757507324,
1.2099568843841553,
-1.403232216835022,
2.7265608310699463,
0.6924651861190796,
-0.2164050042629242,
-1.0413557291030884,
0.5166077613830566,
-0.010159664787352085,
-1.1726576089859009,
-0.4255408048629761,
-0.9635022878646851,
-0.10558275878429413,
-0.6585036516189575,
-0.5079758167266846,
0.05268178880214691,
0.4019443094730377,
-0.24002186954021454,
-0.3776376247406006,
-0.57227623462677,
-0.7602928280830383,
0.5162822604179382,
-0.3317278325557709,
0.972929060459137,
-0.28395286202430725,
1.8031069040298462,
-0.6038073301315308,
0.46886107325553894,
0.7760091423988342,
1.354609489440918,
0.2248118817806244,
-0.0016446355730295181,
0.3432528078556061,
0.3676868677139282,
0.04271122068166733,
0.5380293726921082,
1.1995790004730225,
0.6081677675247192,
0.5152134895324707,
0.7276692390441895,
-2.184246063232422,
1.2898826599121094,
-1.0188233852386475,
0.3503153324127197,
1.2698777914047241,
-0.9048412442207336,
0.3893762230873108,
-1.8603965044021606,
-0.04896062612533569,
0.6037646532058716,
-2.244311571121216,
0.2338779866695404,
-1.3310497999191284,
-0.49006420373916626,
0.9795165061950684,
0.3442109227180481,
-1.3024133443832397,
0.18255537748336792,
-0.42121222615242004,
1.051797866821289,
0.4166954457759857,
1.1190639734268188,
-1.6669014692306519,
-0.009774336591362953,
-0.3293585479259491,
0.1635141670703888,
-1.2263544797897339,
-1.5070654153823853,
0.5729089975357056,
0.6171499490737915,
0.5612480640411377,
-0.13687685132026672,
1.0765891075134277,
-1.0261775255203247,
0.8335713744163513,
-0.9632993936538696,
-1.7179174423217773,
-1.4542927742004395,
-2.2724311351776123,
-2.305119037628174,
0.8332210779190063,
-0.48154833912849426,
-0.4861609935760498,
2.066084861755371,
-0.9672607183456421,
-1.760550856590271,
1.1019209623336792,
0.2541908919811249,
0.0005201064050197601,
2.344029188156128,
0.1405647099018097,
-0.7619856595993042,
0.4461615979671478,
-0.719220757484436,
0.8046331405639648,
-0.3599391579627991,
1.3694673776626587,
0.4728565514087677,
-1.0297503471374512,
1.5947773456573486,
-0.4017045795917511,
0.5501520037651062,
-0.6440993547439575,
-0.5337281823158264,
-0.7929158806800842,
0.33021658658981323,
1.9039069414138794,
-0.30433639883995056,
1.5482233762741089,
-0.34435856342315674,
-1.5470677614212036,
-1.564254879951477,
0.888276219367981,
0.48914024233818054,
-0.8056665658950806,
0.10974583774805069,
-0.39614608883857727,
0.15515007078647614,
-0.05539649724960327,
1.18917715549469,
1.2156568765640259,
0.746762752532959,
-0.36024799942970276,
-0.8663837909698486,
0.1407097578048706,
-0.06023271381855011,
-0.7152811884880066,
-1.8659703731536865,
-0.3546149730682373,
0.1788507103919983,
0.6218679547309875,
-1.193255066871643,
1.7748363018035889,
0.92495197057724,
1.9225759506225586,
1.0170502662658691,
-0.3195354640483856,
1.516502857208252,
-0.03558150306344032,
1.8763700723648071,
-0.4583948850631714,
0.5885534286499023,
-0.360810786485672,
-1.196715235710144,
0.8377751708030701,
-0.29318201541900635,
-2.038484573364258,
-0.7103738784790039,
-0.834315299987793,
-0.17930953204631805,
-0.7523581385612488,
0.8580973744392395,
-0.3118514120578766,
-1.4367921352386475,
0.17469334602355957,
-0.6502706408500671,
0.114289291203022,
-1.2390071153640747,
0.29432353377342224,
0.6449299454689026,
-0.7074230909347534,
0.07158519327640533,
-0.3197842836380005,
-1.2106208801269531,
-0.549460768699646,
0.2689276933670044,
1.8636901378631592,
-0.7478760480880737,
0.9734770655632019,
1.032645583152771,
-0.6845254302024841,
-0.028486648574471474,
0.3420042097568512,
-0.29361337423324585,
0.8849694728851318,
-1.0835940837860107,
-0.4671410620212555,
1.1719520092010498,
-0.16941338777542114,
-0.6102598905563354,
1.4208518266677856,
0.7856005430221558,
-1.054190993309021,
-0.24877195060253143,
-0.2335503250360489,
-0.8555761575698853,
0.04584003984928131,
-1.586504340171814,
-0.11513541638851166,
0.4020754098892212,
-1.5483136177062988,
-0.38727813959121704,
-0.20324184000492096,
1.27974271774292,
-0.22253526747226715,
1.4569973945617676,
-0.33041122555732727,
-0.24466556310653687,
-0.32929882407188416,
-0.4515054523944855,
0.16523446142673492,
-0.11603590846061707,
-0.6699464917182922,
0.16696299612522125,
-0.7458930611610413,
0.3739664554595947,
1.4462465047836304,
0.3052820861339569,
0.036311499774456024,
0.5148871541023254,
1.1212682723999023,
0.3424697816371918,
0.044216401875019073,
-0.9726801514625549,
-1.5047413110733032,
2.0229122638702393,
-1.439529299736023,
1.9469588994979858,
0.7661038637161255,
-0.06159823387861252,
-1.8067489862442017,
-1.8054803609848022,
1.3576617240905762,
1.1666648387908936,
2.3743810653686523,
0.5515940189361572,
0.38672754168510437,
-0.8191073536872864,
-0.6778033971786499,
0.3580164611339569,
-1.0762383937835693,
-0.7609761357307434,
0.12679025530815125,
2.3991148471832275,
1.8205279111862183,
-0.502000093460083,
-0.2354866862297058,
-1.0072424411773682,
1.381729006767273,
-0.22363805770874023,
0.2667018473148346,
2.015361785888672,
-0.2953281104564667,
-1.0586005449295044,
1.2469573020935059,
-2.3405649662017822,
0.18798625469207764,
2.040473699569702,
0.2513265609741211,
0.1753658950328827,
-1.4550968408584595,
-0.6100200414657593,
-0.19842049479484558,
-0.4470710754394531,
-1.256653904914856,
0.5058630108833313,
-0.27943867444992065,
-0.7859964966773987,
-1.4496008157730103,
0.15890000760555267,
-1.1547420024871826,
-1.689998745918274,
0.2607925534248352,
1.9289904832839966,
2.0340874195098877,
-0.7462478876113892,
1.5081462860107422,
-0.3079971373081207,
0.18657687306404114,
1.286574363708496,
1.286323070526123,
3.098590850830078,
1.9048638343811035,
-1.2199252843856812,
0.6274429559707642,
-0.21113325655460358,
-0.49390748143196106,
1.138333797454834,
-1.1720070838928223,
1.1568132638931274,
-0.1872391402721405,
-1.1009259223937988,
-1.19161057472229,
1.007169485092163,
0.47824111580848694,
0.02073085308074951,
-0.5081774592399597,
1.2130450010299683,
0.09992562979459763,
1.3254599571228027,
0.5691626071929932,
-0.3873027265071869,
0.6314074993133545,
-0.3668352961540222,
-0.4965443015098572,
1.613722324371338,
0.1891213208436966,
-1.384263277053833,
-2.328956127166748,
-0.18701601028442383,
-0.9365720152854919,
0.045867085456848145,
-0.580862283706665,
-0.958073616027832,
1.6262056827545166,
0.34906628727912903,
-1.2879420518875122,
-0.2250802218914032,
-0.3236059546470642,
-0.6110820174217224,
2.636465072631836,
-1.3133381605148315,
-0.21953465044498444,
-0.9799793362617493,
-0.6194500923156738,
1.666200041770935,
-1.160622477531433,
-0.24824216961860657,
-1.0042481422424316,
-0.5782238841056824,
-1.3139687776565552,
-0.504253089427948,
0.006970008835196495,
-0.9177166819572449,
0.8342537879943848,
0.17317669093608856,
-1.152393102645874,
-0.3344455063343048,
-0.8396942615509033,
0.9102033972740173,
-0.10824748873710632,
0.16855069994926453,
1.856787085533142,
0.35888707637786865,
-0.39788252115249634,
0.7186763882637024,
1.1461787223815918,
0.6140767931938171,
-0.5669205784797668,
0.20943814516067505,
-0.6787242889404297,
0.28269535303115845,
-1.2839521169662476,
0.3277348577976227,
-2.8885583877563477,
0.7232061624526978,
-0.09950622171163559,
-0.08384138345718384,
-0.08552236109972,
-1.3513370752334595,
1.0464576482772827,
2.6293892860412598,
-1.1441740989685059,
0.47064316272735596,
0.32985731959342957,
1.160235047340393,
-1.6788133382797241,
0.2724669575691223,
-0.4323078393936157,
2.1404330730438232,
0.15187376737594604,
1.2186286449432373,
-0.40442413091659546,
-2.308438539505005,
0.5948107242584229,
-1.2602182626724243,
-1.1369141340255737,
0.7923150658607483,
-0.7879585027694702,
0.13558050990104675,
-1.4016728401184082,
-0.21533024311065674,
-0.9284399747848511,
-1.179283618927002,
0.7575048208236694,
0.1545705497264862,
0.4516685903072357,
-0.6421931982040405,
0.32089704275131226,
-2.166081190109253,
-1.3812161684036255,
-0.20191077888011932,
-0.935924232006073,
0.48065775632858276,
-0.3313238322734833,
0.6799854040145874,
-0.1405913531780243,
0.048482559621334076,
0.33047324419021606,
1.4958500862121582,
3.4104464054107666,
0.15938714146614075,
0.31089693307876587,
-0.19146916270256042,
-0.893835186958313,
1.4162228107452393,
0.88791823387146,
-0.14496727287769318,
-0.5868193507194519,
-1.0717086791992188,
1.253820776939392,
2.0058417320251465,
1.0297530889511108,
0.10569362342357635,
-0.7883124351501465,
-0.722813069820404,
-0.060019999742507935,
0.17492865025997162,
0.4602712392807007,
0.8696073889732361,
0.0407901257276535,
0.09817802906036377,
1.3810077905654907,
1.1756192445755005,
-0.41315758228302,
0.3348855674266815,
-0.8387416005134583,
-0.42695140838623047,
0.4968971610069275,
0.2145848572254181,
-0.009452552534639835,
0.3268333077430725,
-1.0249592065811157,
-0.2579589784145355,
-0.3388806879520416,
-0.9548298120498657,
-0.7445858120918274,
-0.4307718276977539,
-0.3861316740512848,
1.6309629678726196,
0.07657036930322647,
-0.5334811210632324,
-0.028085755184292793,
-0.6963358521461487,
-0.08608516305685043,
-1.0765913724899292,
0.16933338344097137,
-0.09807632118463516,
-0.1379164606332779,
-0.142483651638031,
1.7149851322174072,
-0.8927140235900879,
-2.033263921737671,
0.2613278925418854,
0.24954141676425934,
-0.34509292244911194,
0.24373771250247955,
1.6935194730758667,
0.48897215723991394,
1.4522329568862915,
1.3573921918869019,
0.9454881548881531,
-0.6484937071800232,
-1.262046456336975,
0.6607219576835632,
0.980215311050415,
-1.4375168085098267,
0.7953000068664551,
-0.020188678056001663,
-0.45730048418045044,
0.6360543966293335,
1.311997890472412,
0.45368754863739014,
-2.05928635597229,
0.8549001812934875,
-0.941453754901886,
0.7588342428207397,
0.6597298383712769,
0.6531943082809448,
0.20979832112789154,
0.8596407771110535,
-1.1750915050506592,
-1.1869553327560425,
-0.6938489675521851,
-0.6629811525344849,
1.99611496925354,
-0.20582151412963867,
0.6047783493995667,
-0.166952446103096,
-1.2926483154296875,
-0.16168172657489777,
0.7285361886024475,
0.40200361609458923,
-0.44407919049263,
0.7771522402763367,
-0.6781615018844604,
-1.0751254558563232,
-1.4056015014648438,
-0.45740246772766113,
-1.0413670539855957,
-0.8711357712745667,
1.0231027603149414,
0.7878109216690063,
0.3527986705303192,
1.924103021621704,
0.6656416058540344,
0.2717441916465759,
-2.5978899002075195,
0.868948757648468,
0.3302416503429413,
-0.08382503688335419,
0.8692384362220764,
0.29761430621147156,
1.0661942958831787,
-0.0428975373506546,
0.5640226006507874,
-2.350654125213623,
2.2765297889709473,
-0.18213337659835815,
0.6861506700515747,
0.032333776354789734,
-0.2379818707704544,
1.1013121604919434,
0.5840322375297546,
0.576834499835968,
-1.1082333326339722,
0.6316280961036682,
-0.5855826139450073,
1.1901038885116577,
0.8488075733184814,
-0.7871677875518799,
-0.0008683111518621445,
1.3502707481384277,
0.47497960925102234,
-0.5334844589233398,
-0.9547038078308105,
-0.9876457452774048,
0.945563018321991,
1.6805723905563354,
-0.10287394374608994,
-0.003921165131032467,
0.8386645317077637,
0.6805384159088135,
-1.250244379043579,
0.08274426311254501,
-0.7560269832611084,
-0.761878252029419,
1.6453862190246582,
2.032870054244995,
-0.197617307305336,
-0.18333464860916138,
-0.7866719365119934,
-1.277175784111023,
0.7839676141738892,
-0.04455278813838959,
0.05087999999523163,
0.6562317609786987,
-0.6419892311096191,
1.123640775680542,
0.8160219788551331,
0.9518329501152039,
0.20252229273319244,
0.2989584803581238,
0.3617345988750458,
-0.3324471116065979,
-1.1187938451766968,
-0.24678991734981537,
-1.0892280340194702,
-2.576108455657959,
0.4648890495300293,
-0.21890562772750854,
-1.4016669988632202,
0.009480543434619904,
-0.9739300012588501,
0.8982905149459839,
-0.5727550983428955,
-1.1180434226989746,
-1.472895860671997,
0.2954536974430084,
-0.07155786454677582,
0.9305890202522278,
-1.6270309686660767,
-0.07700309157371521,
1.2112900018692017,
0.9251077771186829,
-0.654590904712677,
0.9605237245559692,
0.22694525122642517,
1.0173345804214478,
0.8269578218460083,
-0.3999858796596527,
0.5398796200752258,
-0.016454163938760757,
-1.3011225461959839,
0.4794811010360718,
1.1388471126556396,
0.13864414393901825,
1.4678304195404053,
-0.5136696100234985,
0.02861284278333187,
0.403213769197464,
-0.5807628035545349,
-0.5130099058151245,
-0.5472197532653809,
0.6829068064689636,
-0.017210179939866066,
-0.9211769104003906,
0.025153568014502525,
-0.06269404292106628,
-0.21011319756507874,
0.24059095978736877,
-1.4828931093215942,
-0.1599954515695572,
-0.35624977946281433,
-0.5556564927101135,
-1.276471734046936,
-0.050106480717659,
1.351976752281189,
-0.7318329811096191,
-0.21917471289634705,
0.48565927147865295,
0.4128744602203369,
0.49645423889160156,
0.5929173827171326,
-0.7269665598869324,
-0.36162298917770386,
-0.24627771973609924,
-0.36984002590179443,
0.28233668208122253,
1.316089391708374,
-0.14444801211357117,
-0.9992629885673523,
0.699063777923584,
-0.38259032368659973,
0.0544123649597168,
1.9495508670806885,
0.12797223031520844,
-0.7993029952049255,
0.3344654142856598,
-0.7151427268981934,
1.8554134368896484,
1.807225227355957,
1.2634577751159668,
-0.13580471277236938,
-0.8974276185035706,
0.6457607746124268,
-0.38154345750808716,
-0.3979913592338562,
0.9249047636985779,
0.3525339365005493,
-0.20610910654067993,
-1.426829218864441,
0.7358364462852478,
1.3347903490066528,
-0.8025565147399902,
-0.8295329213142395,
0.09899698197841644,
-0.8371274471282959,
1.0565483570098877,
0.6693841814994812,
0.38482269644737244,
0.24250520765781403,
1.6328611373901367,
0.7659339308738708,
-0.49272406101226807,
0.56073397397995,
0.5103975534439087,
-0.17157547175884247,
-2.113798141479492,
-1.1865376234054565,
0.2917010486125946,
-0.5235059261322021,
-1.6518900394439697,
1.3959109783172607,
-1.0905125141143799,
-0.981827437877655,
0.612024188041687,
0.058938995003700256,
1.4035661220550537,
0.3737771213054657,
1.610931634902954,
2.113927125930786,
0.8295891284942627,
0.3936780095100403,
1.265575647354126,
-0.11900375038385391,
-0.48769399523735046,
1.8852075338363647,
-0.4626515805721283,
0.48724365234375,
1.056398630142212,
-0.34424537420272827,
-1.0873662233352661,
-0.8167374730110168,
-1.1755986213684082,
-0.6811343431472778,
1.1421849727630615,
0.09619375318288803,
-1.0854218006134033,
0.29008960723876953,
1.6480762958526611,
0.10531748086214066,
-0.28998473286628723,
0.6317206621170044,
0.35889267921447754,
-0.771394670009613,
-0.014612091705203056,
-0.959479570388794,
0.5414214134216309,
-0.20882725715637207,
-0.35919004678726196,
0.3234575688838959,
0.46947768330574036,
1.3138418197631836,
-0.032530803233385086,
0.11772935092449188,
1.1937856674194336,
-1.434771180152893,
1.4975249767303467,
-0.6596755385398865,
0.3768799304962158,
-2.4442501068115234,
1.382062554359436,
-0.8422481417655945,
1.948033332824707,
-2.6141459941864014,
0.3736844062805176,
-0.5740783214569092,
-0.4890991151332855,
0.27379336953163147,
-0.33868926763534546,
0.1370794028043747,
-0.1191677451133728,
-1.1200543642044067,
0.018972571939229965,
-0.7024657130241394,
0.5896080136299133,
1.1115639209747314,
1.3885365724563599,
-1.0890425443649292,
-0.2629130780696869,
-1.751060128211975,
-0.1562928855419159,
-0.641274094581604,
0.3397183120250702,
-2.0135340690612793,
-0.18938960134983063,
-1.9122422933578491,
-2.310183048248291,
-1.3322786092758179,
-0.8734745383262634,
1.0172775983810425,
0.14468906819820404,
-0.9001511335372925,
1.1617234945297241,
-0.3717103898525238,
-1.868216633796692,
1.133630633354187,
-2.1540725231170654
] |
https://github.com/huggingface/datasets/issues/6099 | How do i get "amazon_us_reviews | Seems like the problem isn't with the library, but the dataset itself hosted on AWS S3.
Its [homepage](https://s3.amazonaws.com/amazon-reviews-pds/readme.html) returns an `AccessDenied` XML response, which is the same thing you get if you try to log the `record` that triggers the exception
```python
try:
example = self.info.features.encode_example(record) if self.info.features is not None else record
except Exception as e:
print(record)
```
β¬οΈ
```
{'<?xml version="1.0" encoding="UTF-8"?>': '<Error><Code>AccessDenied</Code><Message>Access Denied</Message><RequestId>N2HFJ82ZV8SZW9BV</RequestId><HostId>Zw2DQ0V2GdRmvH5qWEpumK4uj5+W8YPcilQbN9fLBr3VqQOcKPHOhUZLG3LcM9X5fkOetxp48Os=</HostId></Error>'}
``` | ### Feature request
I have been trying to load 'amazon_us_dataset" but unable to do so.
`amazon_us_reviews = load_dataset('amazon_us_reviews')`
`print(amazon_us_reviews)`
> [ValueError: Config name is missing.
Please pick one among the available configs: ['Wireless_v1_00', 'Watches_v1_00', 'Video_Games_v1_00', 'Video_DVD_v1_00', 'Video_v1_00', 'Toys_v1_00', 'Tools_v1_00', 'Sports_v1_00', 'Software_v1_00', 'Shoes_v1_00', 'Pet_Products_v1_00', 'Personal_Care_Appliances_v1_00', 'PC_v1_00', 'Outdoors_v1_00', 'Office_Products_v1_00', 'Musical_Instruments_v1_00', 'Music_v1_00', 'Mobile_Electronics_v1_00', 'Mobile_Apps_v1_00', 'Major_Appliances_v1_00', 'Luggage_v1_00', 'Lawn_and_Garden_v1_00', 'Kitchen_v1_00', 'Jewelry_v1_00', 'Home_Improvement_v1_00', 'Home_Entertainment_v1_00', 'Home_v1_00', 'Health_Personal_Care_v1_00', 'Grocery_v1_00', 'Gift_Card_v1_00', 'Furniture_v1_00', 'Electronics_v1_00', 'Digital_Video_Games_v1_00', 'Digital_Video_Download_v1_00', 'Digital_Software_v1_00', 'Digital_Music_Purchase_v1_00', 'Digital_Ebook_Purchase_v1_00', 'Camera_v1_00', 'Books_v1_00', 'Beauty_v1_00', 'Baby_v1_00', 'Automotive_v1_00', 'Apparel_v1_00', 'Digital_Ebook_Purchase_v1_01', 'Books_v1_01', 'Books_v1_02']
Example of usage:
`load_dataset('amazon_us_reviews', 'Wireless_v1_00')`]
__________________________________________________________________________
`amazon_us_reviews = load_dataset('amazon_us_reviews', 'Watches_v1_00')
print(amazon_us_reviews)`
**ERROR**
`Generating` train split: 0%
0/960872 [00:00<?, ? examples/s]
---------------------------------------------------------------------------
KeyError Traceback (most recent call last)
/usr/local/lib/python3.10/dist-packages/datasets/builder.py in _prepare_split_single(self, gen_kwargs, fpath, file_format, max_shard_size, split_info, check_duplicate_keys, job_id)
1692 )
-> 1693 example = self.info.features.encode_example(record) if self.info.features is not None else record
1694 writer.write(example, key)
11 frames
KeyError: 'marketplace'
The above exception was the direct cause of the following exception:
DatasetGenerationError Traceback (most recent call last)
/usr/local/lib/python3.10/dist-packages/datasets/builder.py in _prepare_split_single(self, gen_kwargs, fpath, file_format, max_shard_size, split_info, check_duplicate_keys, job_id)
1710 if isinstance(e, SchemaInferenceError) and e.__context__ is not None:
1711 e = e.__context__
-> 1712 raise DatasetGenerationError("An error occurred while generating the dataset") from e
1713
1714 yield job_id, True, (total_num_examples, total_num_bytes, writer._features, num_shards, shard_lengths)
DatasetGenerationError: An error occurred while generating the dataset
### Motivation
The dataset I'm using
https://huggingface.co/datasets/amazon_us_reviews
### Your contribution
What is the best way to load this data | 5 | 67 | How do i get "amazon_us_reviews
### Feature request
I have been trying to load 'amazon_us_dataset" but unable to do so.
`amazon_us_reviews = load_dataset('amazon_us_reviews')`
`print(amazon_us_reviews)`
> [ValueError: Config name is missing.
Please pick one among the available configs: ['Wireless_v1_00', 'Watches_v1_00', 'Video_Games_v1_00', 'Video_DVD_v1_00', 'Video_v1_00', 'Toys_v1_00', 'Tools_v1_00', 'Sports_v1_00', 'Software_v1_00', 'Shoes_v1_00', 'Pet_Products_v1_00', 'Personal_Care_Appliances_v1_00', 'PC_v1_00', 'Outdoors_v1_00', 'Office_Products_v1_00', 'Musical_Instruments_v1_00', 'Music_v1_00', 'Mobile_Electronics_v1_00', 'Mobile_Apps_v1_00', 'Major_Appliances_v1_00', 'Luggage_v1_00', 'Lawn_and_Garden_v1_00', 'Kitchen_v1_00', 'Jewelry_v1_00', 'Home_Improvement_v1_00', 'Home_Entertainment_v1_00', 'Home_v1_00', 'Health_Personal_Care_v1_00', 'Grocery_v1_00', 'Gift_Card_v1_00', 'Furniture_v1_00', 'Electronics_v1_00', 'Digital_Video_Games_v1_00', 'Digital_Video_Download_v1_00', 'Digital_Software_v1_00', 'Digital_Music_Purchase_v1_00', 'Digital_Ebook_Purchase_v1_00', 'Camera_v1_00', 'Books_v1_00', 'Beauty_v1_00', 'Baby_v1_00', 'Automotive_v1_00', 'Apparel_v1_00', 'Digital_Ebook_Purchase_v1_01', 'Books_v1_01', 'Books_v1_02']
Example of usage:
`load_dataset('amazon_us_reviews', 'Wireless_v1_00')`]
__________________________________________________________________________
`amazon_us_reviews = load_dataset('amazon_us_reviews', 'Watches_v1_00')
print(amazon_us_reviews)`
**ERROR**
`Generating` train split: 0%
0/960872 [00:00<?, ? examples/s]
---------------------------------------------------------------------------
KeyError Traceback (most recent call last)
/usr/local/lib/python3.10/dist-packages/datasets/builder.py in _prepare_split_single(self, gen_kwargs, fpath, file_format, max_shard_size, split_info, check_duplicate_keys, job_id)
1692 )
-> 1693 example = self.info.features.encode_example(record) if self.info.features is not None else record
1694 writer.write(example, key)
11 frames
KeyError: 'marketplace'
The above exception was the direct cause of the following exception:
DatasetGenerationError Traceback (most recent call last)
/usr/local/lib/python3.10/dist-packages/datasets/builder.py in _prepare_split_single(self, gen_kwargs, fpath, file_format, max_shard_size, split_info, check_duplicate_keys, job_id)
1710 if isinstance(e, SchemaInferenceError) and e.__context__ is not None:
1711 e = e.__context__
-> 1712 raise DatasetGenerationError("An error occurred while generating the dataset") from e
1713
1714 yield job_id, True, (total_num_examples, total_num_bytes, writer._features, num_shards, shard_lengths)
DatasetGenerationError: An error occurred while generating the dataset
### Motivation
The dataset I'm using
https://huggingface.co/datasets/amazon_us_reviews
### Your contribution
What is the best way to load this data
Seems like the problem isn't with the library, but the dataset itself hosted on AWS S3.
Its [homepage](https://s3.amazonaws.com/amazon-reviews-pds/readme.html) returns an `AccessDenied` XML response, which is the same thing you get if you try to log the `record` that triggers the exception
```python
try:
example = self.info.features.encode_example(record) if self.info.features is not None else record
except Exception as e:
print(record)
```
β¬οΈ
```
{'<?xml version="1.0" encoding="UTF-8"?>': '<Error><Code>AccessDenied</Code><Message>Access Denied</Message><RequestId>N2HFJ82ZV8SZW9BV</RequestId><HostId>Zw2DQ0V2GdRmvH5qWEpumK4uj5+W8YPcilQbN9fLBr3VqQOcKPHOhUZLG3LcM9X5fkOetxp48Os=</HostId></Error>'}
``` | [
-1.210225224494934,
-1.2076855897903442,
-0.5899178385734558,
1.6656270027160645,
0.004276080057024956,
-1.407726764678955,
0.13049446046352386,
-1.0258605480194092,
1.3568669557571411,
-0.8192351460456848,
0.10499061644077301,
-1.3370153903961182,
-0.003387860022485256,
-0.7357089519500732,
-0.5535927414894104,
-0.645135760307312,
-0.1984367072582245,
-0.8439528346061707,
1.4069613218307495,
2.210432291030884,
1.0771844387054443,
-1.2784123420715332,
2.874554395675659,
0.7134087681770325,
-0.0638667643070221,
-1.1538865566253662,
0.4330454468727112,
-0.2653447985649109,
-0.9392576217651367,
-0.5149978995323181,
-0.850578248500824,
-0.09525898844003677,
-0.7634775638580322,
-0.09788039326667786,
-0.15268194675445557,
0.6361565589904785,
-0.4678264856338501,
-0.44046521186828613,
-0.6344451308250427,
-0.7170416116714478,
0.4539276361465454,
-0.33075350522994995,
0.9608746767044067,
-0.23293602466583252,
1.681182622909546,
-0.47491174936294556,
0.2851182818412781,
0.784346878528595,
1.278829574584961,
0.1633814126253128,
0.14690861105918884,
0.38026928901672363,
0.22397121787071228,
-0.03365974500775337,
0.6068795919418335,
1.001813530921936,
0.5345300436019897,
0.23699675500392914,
0.7897163033485413,
-2.433513641357422,
1.290249228477478,
-1.1158027648925781,
0.1610543578863144,
1.3842651844024658,
-0.5954002737998962,
0.3272398114204407,
-1.5675562620162964,
0.04536373168230057,
0.7079699039459229,
-1.9616398811340332,
0.5900647044181824,
-1.1617034673690796,
-0.4066806435585022,
0.5939295887947083,
0.5372082591056824,
-1.1958670616149902,
-0.10249854624271393,
-0.4080660343170166,
1.128000259399414,
0.5118468999862671,
0.4748923182487488,
-1.699906826019287,
0.054819270968437195,
0.033914122730493546,
0.3473580479621887,
-1.2458455562591553,
-1.705798625946045,
0.5336384773254395,
0.42615222930908203,
0.9004007577896118,
-0.06082773581147194,
1.1512850522994995,
-1.3419617414474487,
0.6575153470039368,
-1.2884385585784912,
-1.5539414882659912,
-1.262231469154358,
-2.63409686088562,
-2.2260830402374268,
0.5782156586647034,
-0.4969367980957031,
-0.6304066181182861,
2.0096817016601562,
-0.8032044768333435,
-1.5205976963043213,
1.2951574325561523,
0.16630414128303528,
0.12891386449337006,
2.5492637157440186,
0.14445346593856812,
-0.874646782875061,
0.6491203308105469,
-0.9307577610015869,
0.8942434787750244,
-0.27523595094680786,
1.3601065874099731,
0.5195751190185547,
-0.7659162878990173,
1.4580668210983276,
-0.5078427791595459,
0.624810516834259,
-0.34090447425842285,
-0.5396624207496643,
-0.9580057859420776,
0.24867521226406097,
1.6368212699890137,
0.12380026280879974,
1.3170899152755737,
-0.4155381917953491,
-1.4781368970870972,
-1.5445414781570435,
1.2362614870071411,
0.06426393240690231,
-1.168350338935852,
0.14447782933712006,
-0.6529622673988342,
0.3697661757469177,
-0.29447436332702637,
1.4101039171218872,
1.471571922302246,
0.38914722204208374,
-0.6313988566398621,
-0.7663823366165161,
-0.12903627753257751,
-0.42137467861175537,
-0.7936902046203613,
-1.8142924308776855,
-0.08673470467329025,
0.040670957416296005,
0.6674957871437073,
-0.9456651210784912,
1.8394280672073364,
0.8803703784942627,
2.0485520362854004,
0.845221757888794,
-0.3151698112487793,
1.2785146236419678,
0.00005810242146253586,
1.720511555671692,
-0.727744996547699,
0.3888530731201172,
-0.4364479184150696,
-0.9577677845954895,
0.9937989711761475,
-0.2541348338127136,
-1.790514349937439,
-0.8596090078353882,
-0.6773314476013184,
-0.3794596791267395,
-0.717743456363678,
0.5647395253181458,
-0.4480542540550232,
-1.5472736358642578,
0.2019083946943283,
-0.7155848741531372,
0.4135091304779053,
-1.0086767673492432,
0.2829146385192871,
0.535873532295227,
-0.6549561619758606,
0.13142725825309753,
-0.02421613782644272,
-1.3086822032928467,
-0.589641809463501,
0.88921058177948,
1.8333200216293335,
-0.3410009741783142,
0.427082359790802,
1.0636069774627686,
-0.45642268657684326,
0.06618424504995346,
0.0847572386264801,
-0.15333279967308044,
0.3910595178604126,
-0.9766692519187927,
-0.8112574219703674,
1.399424433708191,
-0.4253351092338562,
-0.8040767908096313,
1.4840502738952637,
0.8294554352760315,
-1.1904504299163818,
-0.08783432841300964,
-0.2914966940879822,
-0.952640950679779,
0.19159404933452606,
-1.6431506872177124,
-0.12051217257976532,
0.8109571933746338,
-1.4818313121795654,
-0.17697036266326904,
-0.28869760036468506,
1.1779723167419434,
0.003311261534690857,
1.2718478441238403,
-0.6217518448829651,
0.041214991360902786,
0.035499658435583115,
-0.6562933921813965,
0.37938326597213745,
-0.21529383957386017,
-0.32851701974868774,
-0.3954307436943054,
-0.8601893782615662,
0.5059376955032349,
1.4699455499649048,
-0.04866672307252884,
0.07238081097602844,
0.21858654916286469,
1.2743110656738281,
0.29731273651123047,
0.30780118703842163,
-0.7257699370384216,
-1.314125657081604,
1.889410138130188,
-1.582964539527893,
2.0784246921539307,
0.4990677833557129,
-0.02205764874815941,
-1.837114691734314,
-1.6086084842681885,
1.201932668685913,
1.0154391527175903,
1.839293122291565,
0.39368391036987305,
0.27081531286239624,
-0.9781020879745483,
-0.8647156357765198,
0.0026127807796001434,
-0.7459132671356201,
-0.4674784541130066,
0.1477011740207672,
2.4664461612701416,
1.845963716506958,
-0.3466310501098633,
-0.1747690588235855,
-0.6480832695960999,
1.657706379890442,
-0.4793803095817566,
0.4831036925315857,
2.1193933486938477,
-0.25760677456855774,
-0.7761260271072388,
1.6101703643798828,
-2.6984970569610596,
0.4672843813896179,
2.372407913208008,
0.2649036645889282,
0.4158872365951538,
-1.1040525436401367,
-0.6779287457466125,
-0.6785708069801331,
-0.1327590048313141,
-1.316164255142212,
0.5729241967201233,
-0.4916074872016907,
-0.7749151587486267,
-1.3347010612487793,
0.4333084225654602,
-1.0847443342208862,
-1.5833227634429932,
0.3183261752128601,
2.103281021118164,
2.4041569232940674,
-0.6306108236312866,
1.5512393712997437,
-0.007784207817167044,
0.20612473785877228,
1.2300636768341064,
1.3499733209609985,
2.845396041870117,
1.7266435623168945,
-1.1758760213851929,
0.4977846145629883,
-0.42966365814208984,
-0.7066797018051147,
1.0213794708251953,
-1.1420575380325317,
1.1663846969604492,
-0.05476696789264679,
-1.2194428443908691,
-1.334078073501587,
1.1617594957351685,
0.5064898133277893,
-0.0215921588242054,
-0.4666362404823303,
1.2061923742294312,
-0.07301675528287888,
1.2218153476715088,
0.7493334412574768,
-0.43469029664993286,
0.2239176481962204,
-0.3820257782936096,
-0.9302724003791809,
1.4656208753585815,
0.24327035248279572,
-1.6889475584030151,
-2.0539350509643555,
-0.38808900117874146,
-0.7484136819839478,
0.11090066283941269,
-0.5279773473739624,
-1.1371877193450928,
1.4302864074707031,
0.1062920093536377,
-1.0905733108520508,
-0.19754262268543243,
-0.175728440284729,
-0.2696554660797119,
2.7831785678863525,
-0.9073716998100281,
-0.2467544674873352,
-0.9142609238624573,
-0.7358637452125549,
1.7873032093048096,
-1.318844199180603,
-0.2890281081199646,
-1.3964159488677979,
-0.35565823316574097,
-1.0720001459121704,
-0.3030719757080078,
0.08364307880401611,
-0.9669814109802246,
1.0273404121398926,
0.48243510723114014,
-1.1686762571334839,
-0.3992760181427002,
-1.1077864170074463,
1.2440744638442993,
-0.2313564419746399,
0.1320086419582367,
1.426996111869812,
-0.09177441149950027,
-0.4927833676338196,
1.0818347930908203,
1.1259385347366333,
0.5235150456428528,
-0.6695930361747742,
-0.1684689223766327,
-0.13044239580631256,
0.5572344660758972,
-1.0423877239227295,
0.459705114364624,
-3.0644073486328125,
0.6658030152320862,
-0.08722704648971558,
-0.34145885705947876,
-0.15602488815784454,
-1.7850298881530762,
1.2232521772384644,
2.292124032974243,
-1.3759785890579224,
0.8795415759086609,
0.28657811880111694,
1.236118197441101,
-1.7205818891525269,
0.4713534712791443,
-0.4212278723716736,
1.97178053855896,
0.010953184217214584,
1.3331756591796875,
-0.5974486470222473,
-2.785918712615967,
0.6235342621803284,
-1.135292887687683,
-0.9101631045341492,
0.6342471241950989,
-1.1590989828109741,
0.5013990998268127,
-1.60431969165802,
-0.5858711004257202,
-1.1055039167404175,
-1.2915143966674805,
0.47223347425460815,
0.32373547554016113,
0.30443984270095825,
-0.44573307037353516,
0.1576235592365265,
-2.4738998413085938,
-1.6853656768798828,
0.028064537793397903,
-0.9745598435401917,
0.9441985487937927,
-0.6840437054634094,
0.3939555287361145,
-0.06484653055667877,
0.16767986118793488,
0.12203171849250793,
1.9222233295440674,
3.461688280105591,
-0.038762226700782776,
0.2616981863975525,
-0.14331555366516113,
-0.8668848276138306,
1.289034366607666,
0.7618101835250854,
-0.1277521699666977,
-0.4414854645729065,
-0.9162626266479492,
1.3535770177841187,
2.1725475788116455,
0.5025514960289001,
-0.20749692618846893,
-0.669009268283844,
-0.37805110216140747,
-0.14053131639957428,
0.34876757860183716,
0.7273016571998596,
0.8370339870452881,
0.1294945627450943,
-0.1535031795501709,
1.1980621814727783,
1.021328091621399,
-0.43237918615341187,
0.33095699548721313,
-0.9550994634628296,
-0.22235724329948425,
0.5584542155265808,
-0.09988810867071152,
-0.31367379426956177,
0.6109278798103333,
-0.8184192776679993,
-0.2740359306335449,
-0.38542044162750244,
-0.5391601324081421,
-0.7834737300872803,
-0.30326974391937256,
-0.5900498032569885,
1.357992172241211,
0.5978986620903015,
-0.7652480602264404,
0.23053386807441711,
-0.36358755826950073,
-0.24375613033771515,
-1.1285080909729004,
-0.04514545947313309,
-0.22764725983142853,
-0.3169388175010681,
-0.43946605920791626,
1.6149792671203613,
-0.9094502925872803,
-1.9904204607009888,
-0.19490422308444977,
0.514474093914032,
0.1926998347043991,
0.3426697254180908,
1.8582179546356201,
0.1355520635843277,
1.5770585536956787,
1.3802621364593506,
0.8927075862884521,
-0.8777205944061279,
-1.273087501525879,
0.6913639307022095,
0.8971491456031799,
-1.3372564315795898,
0.7733129858970642,
-0.22003789246082306,
-0.4611368179321289,
0.7624301910400391,
1.3862580060958862,
0.42917704582214355,
-1.9775104522705078,
1.0535575151443481,
-1.450316309928894,
1.2817925214767456,
0.9948550462722778,
0.47844433784484863,
0.49309593439102173,
0.9611654877662659,
-1.010849952697754,
-1.006635069847107,
-0.8791612982749939,
-1.1208795309066772,
1.973947525024414,
-0.730656623840332,
0.6304389238357544,
0.19190426170825958,
-1.1622687578201294,
0.07389011979103088,
0.7545357942581177,
0.7704148292541504,
-0.32005566358566284,
0.6891259551048279,
-0.8924314975738525,
-1.0763399600982666,
-1.1235287189483643,
-0.4449293613433838,
-1.2491129636764526,
-1.074207067489624,
0.7771356105804443,
0.7565221190452576,
0.411258339881897,
1.779042363166809,
0.7999269366264343,
0.5987473130226135,
-2.3146960735321045,
1.0212346315383911,
0.14241838455200195,
0.0026575513184070587,
0.5834146738052368,
0.5550764799118042,
1.2536181211471558,
0.22779113054275513,
0.5620061159133911,
-2.252286434173584,
2.234640121459961,
-0.16716912388801575,
0.7293847799301147,
-0.3336590528488159,
-0.17689232528209686,
1.0469987392425537,
0.5857565999031067,
0.367010235786438,
-0.9330582618713379,
0.6918842792510986,
-0.344753623008728,
1.2816226482391357,
0.9383744597434998,
-0.8651370406150818,
0.09119991213083267,
1.5379867553710938,
0.13376307487487793,
-1.0344265699386597,
-1.2139235734939575,
-0.871809184551239,
0.6158676743507385,
1.128057837486267,
-0.18427661061286926,
-0.2781570553779602,
0.6295852065086365,
0.6280599236488342,
-1.0339771509170532,
0.10141491889953613,
-0.38715219497680664,
-0.6377065777778625,
1.7574594020843506,
2.0886964797973633,
-0.559212327003479,
0.28490257263183594,
-0.5996301770210266,
-1.3925811052322388,
0.5229480266571045,
-0.13023564219474792,
-0.2075139582157135,
0.17138510942459106,
-0.45400702953338623,
0.7497163414955139,
0.35222554206848145,
0.833016037940979,
-0.016863349825143814,
0.38693875074386597,
0.6733444333076477,
-0.6780864000320435,
-1.0972853899002075,
-0.6176152229309082,
-1.4139716625213623,
-2.480553150177002,
0.18748946487903595,
-0.3185712695121765,
-1.5156983137130737,
0.1472565084695816,
-0.785729169845581,
1.1074588298797607,
-0.6563748717308044,
-1.055670976638794,
-1.1924864053726196,
0.39504653215408325,
0.023491207510232925,
0.8567736148834229,
-1.9032783508300781,
-0.22709371149539948,
1.1499295234680176,
0.6834973692893982,
-0.753402054309845,
1.2836345434188843,
0.3270207643508911,
1.0520933866500854,
0.4434722065925598,
-0.4381895661354065,
0.8627181053161621,
-0.2417100965976715,
-1.3835155963897705,
0.7838159203529358,
1.1783146858215332,
0.05895195156335831,
1.3107820749282837,
0.03911576047539711,
-0.09683475643396378,
0.47304069995880127,
-0.9950792193412781,
-0.346868634223938,
0.0006741201505064964,
0.7155879735946655,
0.027320116758346558,
-0.7075086832046509,
-0.21985284984111786,
0.039648450911045074,
-0.6693775653839111,
0.23051853477954865,
-1.7220393419265747,
-0.3522859215736389,
-0.6524487137794495,
-0.26080596446990967,
-1.5924729108810425,
-0.06879851222038269,
1.3455528020858765,
-0.4729446768760681,
-0.3995169997215271,
0.44383740425109863,
0.5869684815406799,
0.5658378601074219,
0.8592292070388794,
-0.7857706546783447,
0.03455290198326111,
-0.5660000443458557,
-0.0868530124425888,
0.2608341574668884,
1.3288345336914062,
0.021441899240016937,
-1.055073857307434,
0.6635315418243408,
-0.47854989767074585,
0.1002834290266037,
1.6099050045013428,
0.027982216328382492,
-0.8110296130180359,
0.4172441363334656,
-0.9195789098739624,
1.9776335954666138,
1.6497915983200073,
1.0607073307037354,
-0.2595290541648865,
-0.9128652811050415,
0.9755042195320129,
-0.5001735687255859,
-0.12681573629379272,
0.579759418964386,
0.2589576840400696,
-0.388360857963562,
-1.1078588962554932,
1.0721962451934814,
0.9267814755439758,
-0.5810031890869141,
-0.7792497873306274,
0.14326976239681244,
-0.7258784770965576,
1.4030957221984863,
0.4255889654159546,
0.25184357166290283,
0.24630092084407806,
1.8132017850875854,
0.7934964895248413,
-0.512630045413971,
0.6426283121109009,
0.7019808888435364,
-0.45522886514663696,
-2.062368869781494,
-1.1444612741470337,
0.17180216312408447,
-0.5467655062675476,
-1.8001760244369507,
1.4187275171279907,
-0.7825311422348022,
-0.9068099856376648,
0.5307667255401611,
-0.022264765575528145,
0.936246395111084,
0.7461460828781128,
1.3585801124572754,
2.043964147567749,
0.5505794286727905,
0.9709900617599487,
1.2708516120910645,
-0.4369397759437561,
-0.4726090431213379,
1.8671215772628784,
-0.34284472465515137,
0.42558586597442627,
1.3165218830108643,
-0.3364993929862976,
-1.150960922241211,
-0.7881906628608704,
-1.086511492729187,
-0.6455144286155701,
1.1678378582000732,
0.025327980518341064,
-0.9561827778816223,
0.32384294271469116,
1.8534685373306274,
0.09782736748456955,
-0.35398048162460327,
0.7571806907653809,
0.5425701141357422,
-0.7978201508522034,
-0.10394138097763062,
-0.8120983839035034,
0.6300806403160095,
-0.5221537351608276,
-0.2146328091621399,
0.500385582447052,
0.46031898260116577,
1.2767947912216187,
-0.3941080570220947,
0.24107877910137177,
0.7182915210723877,
-1.4341745376586914,
1.2729424238204956,
-0.5982227921485901,
0.25447535514831543,
-2.2237284183502197,
0.9736270308494568,
-0.3546155095100403,
2.233795166015625,
-2.5633704662323,
0.46902984380722046,
-0.7988216876983643,
-0.7058482766151428,
0.3056824803352356,
-0.2925431728363037,
-0.23125946521759033,
0.03898214176297188,
-0.9607555866241455,
0.2775791883468628,
-0.4864264726638794,
0.48410308361053467,
1.1539243459701538,
1.334699034690857,
-0.8269096612930298,
0.039146315306425095,
-1.3482013940811157,
-0.024895060807466507,
-0.9388694763183594,
0.4137986898422241,
-2.0866646766662598,
-0.18059290945529938,
-1.9476525783538818,
-2.095041275024414,
-0.9540354013442993,
-0.8132920861244202,
1.1611050367355347,
0.17695637047290802,
-0.8647010922431946,
1.7262868881225586,
0.017691347748041153,
-1.5221697092056274,
1.1196109056472778,
-1.6851067543029785
] |
https://github.com/huggingface/datasets/issues/6089 | AssertionError: daemonic processes are not allowed to have children | We could add a "threads" parallel backend to `datasets.parallel.parallel_backend` to support downloading with threads but note that `download_and_extract` also decompresses archives, and this is a CPU-intensive task, which is not ideal for (Python) threads (good for IO-intensive tasks). | ### Describe the bug
When I load_dataset with num_proc > 0 in a deamon process, I got an error:
```python
File "/Users/codingl2k1/Work/datasets/src/datasets/download/download_manager.py", line 564, in download_and_extract
return self.extract(self.download(url_or_urls))
^^^^^^^^^^^^^^^^^
File "/Users/codingl2k1/Work/datasets/src/datasets/download/download_manager.py", line 427, in download
downloaded_path_or_paths = map_nested(
^^^^^^^^^^^^^^^^^
File "/Users/codingl2k1/Work/datasets/src/datasets/utils/py_utils.py", line 468, in map_nested
mapped = parallel_map(function, iterable, num_proc, types, disable_tqdm, desc, _single_map_nested)
^^^^^^^^^^^^^^^^^
File "/Users/codingl2k1/Work/datasets/src/datasets/utils/experimental.py", line 40, in _inner_fn
return fn(*args, **kwargs)
^^^^^^^^^^^^^^^^^
File "/Users/codingl2k1/Work/datasets/src/datasets/parallel/parallel.py", line 34, in parallel_map
return _map_with_multiprocessing_pool(
^^^^^^^^^^^^^^^^^
File "/Users/codingl2k1/Work/datasets/src/datasets/parallel/parallel.py", line 64, in _map_with_multiprocessing_pool
with Pool(num_proc, initargs=initargs, initializer=initializer) as pool:
^^^^^^^^^^^^^^^^^
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/multiprocessing/context.py", line 119, in Pool
return Pool(processes, initializer, initargs, maxtasksperchild,
^^^^^^^^^^^^^^^^^
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/multiprocessing/pool.py", line 215, in __init__
self._repopulate_pool()
^^^^^^^^^^^^^^^^^
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/multiprocessing/pool.py", line 306, in _repopulate_pool
return self._repopulate_pool_static(self._ctx, self.Process,
^^^^^^^^^^^^^^^^^
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/multiprocessing/pool.py", line 329, in _repopulate_pool_static
w.start()
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/multiprocessing/process.py", line 118, in start
assert not _current_process._config.get('daemon'), ^^^^^^^^^^^^^^^^^
AssertionError: daemonic processes are not allowed to have children
```
The download is io-intensive computing, may be datasets can replece the multi processing pool by a multi threading pool if in a deamon process.
### Steps to reproduce the bug
1. start a deamon process
2. run load_dataset with num_proc > 0
### Expected behavior
No error.
### Environment info
Python 3.11.4
datasets latest master | 8 | 38 | AssertionError: daemonic processes are not allowed to have children
### Describe the bug
When I load_dataset with num_proc > 0 in a deamon process, I got an error:
```python
File "/Users/codingl2k1/Work/datasets/src/datasets/download/download_manager.py", line 564, in download_and_extract
return self.extract(self.download(url_or_urls))
^^^^^^^^^^^^^^^^^
File "/Users/codingl2k1/Work/datasets/src/datasets/download/download_manager.py", line 427, in download
downloaded_path_or_paths = map_nested(
^^^^^^^^^^^^^^^^^
File "/Users/codingl2k1/Work/datasets/src/datasets/utils/py_utils.py", line 468, in map_nested
mapped = parallel_map(function, iterable, num_proc, types, disable_tqdm, desc, _single_map_nested)
^^^^^^^^^^^^^^^^^
File "/Users/codingl2k1/Work/datasets/src/datasets/utils/experimental.py", line 40, in _inner_fn
return fn(*args, **kwargs)
^^^^^^^^^^^^^^^^^
File "/Users/codingl2k1/Work/datasets/src/datasets/parallel/parallel.py", line 34, in parallel_map
return _map_with_multiprocessing_pool(
^^^^^^^^^^^^^^^^^
File "/Users/codingl2k1/Work/datasets/src/datasets/parallel/parallel.py", line 64, in _map_with_multiprocessing_pool
with Pool(num_proc, initargs=initargs, initializer=initializer) as pool:
^^^^^^^^^^^^^^^^^
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/multiprocessing/context.py", line 119, in Pool
return Pool(processes, initializer, initargs, maxtasksperchild,
^^^^^^^^^^^^^^^^^
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/multiprocessing/pool.py", line 215, in __init__
self._repopulate_pool()
^^^^^^^^^^^^^^^^^
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/multiprocessing/pool.py", line 306, in _repopulate_pool
return self._repopulate_pool_static(self._ctx, self.Process,
^^^^^^^^^^^^^^^^^
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/multiprocessing/pool.py", line 329, in _repopulate_pool_static
w.start()
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/multiprocessing/process.py", line 118, in start
assert not _current_process._config.get('daemon'), ^^^^^^^^^^^^^^^^^
AssertionError: daemonic processes are not allowed to have children
```
The download is io-intensive computing, may be datasets can replece the multi processing pool by a multi threading pool if in a deamon process.
### Steps to reproduce the bug
1. start a deamon process
2. run load_dataset with num_proc > 0
### Expected behavior
No error.
### Environment info
Python 3.11.4
datasets latest master
We could add a "threads" parallel backend to `datasets.parallel.parallel_backend` to support downloading with threads but note that `download_and_extract` also decompresses archives, and this is a CPU-intensive task, which is not ideal for (Python) threads (good for IO-intensive tasks). | [
-1.3304325342178345,
-0.843843400478363,
-0.6240853667259216,
1.2293169498443604,
0.023741507902741432,
-0.9174615740776062,
0.06877093762159348,
-1.0991508960723877,
1.8150602579116821,
-0.6466710567474365,
0.21736067533493042,
-1.551055669784546,
-0.1861899197101593,
-0.48568251729011536,
-0.6399885416030884,
-0.9412006735801697,
-0.28778788447380066,
-0.8252395987510681,
1.0269654989242554,
2.608595609664917,
1.2234467267990112,
-1.412387490272522,
2.707380771636963,
0.8097389936447144,
-0.3603209853172302,
-0.7776699066162109,
0.48141592741012573,
-0.0388236865401268,
-1.0951825380325317,
-0.6576300859451294,
-0.991340160369873,
0.02303980104625225,
-0.6472021341323853,
-0.3529244661331177,
-0.04204221069812775,
0.23380602896213531,
-0.2620423436164856,
-0.1918572634458542,
-0.7916498780250549,
-0.7969321608543396,
0.533761739730835,
-0.3538559079170227,
0.9927069544792175,
-0.4394308030605316,
1.7998770475387573,
-0.5881317853927612,
0.5424193739891052,
0.6860813498497009,
1.152274250984192,
0.05636809021234512,
-0.017423663288354874,
0.511515736579895,
0.3303428590297699,
-0.04301271587610245,
0.7841843962669373,
1.1911066770553589,
0.5725809335708618,
0.4992753565311432,
0.3974270224571228,
-2.302197217941284,
1.3348913192749023,
-1.050580620765686,
0.32438215613365173,
1.479893445968628,
-0.7309799194335938,
0.33590787649154663,
-1.7369120121002197,
0.08000855147838593,
0.7174645066261292,
-2.4402904510498047,
0.25283366441726685,
-1.2671724557876587,
-0.5861356258392334,
1.0325621366500854,
0.4068147540092468,
-1.1362403631210327,
0.08766410499811172,
-0.4590553641319275,
1.1769294738769531,
0.1981641948223114,
1.24491286277771,
-1.5459580421447754,
0.05796533823013306,
-0.14617295563220978,
0.30410197377204895,
-1.2460455894470215,
-1.631604790687561,
0.5121922492980957,
0.48947668075561523,
0.38065025210380554,
-0.1314806193113327,
1.021225929260254,
-0.9869500994682312,
0.56121826171875,
-0.8880736231803894,
-1.5188696384429932,
-1.5767793655395508,
-2.5290467739105225,
-2.3843014240264893,
0.7745110392570496,
-0.6072244644165039,
-0.38829123973846436,
2.145897626876831,
-1.041258692741394,
-1.5384067296981812,
0.9170845746994019,
0.20430254936218262,
0.13918863236904144,
2.285205841064453,
0.14447824656963348,
-0.7653111815452576,
0.44569167494773865,
-0.6788977384567261,
0.8515129685401917,
-0.21523532271385193,
1.4875693321228027,
0.5213677883148193,
-1.0824432373046875,
1.5163935422897339,
-0.567435622215271,
0.5559976696968079,
-0.35646435618400574,
-0.6333647966384888,
-0.8128358721733093,
0.42021554708480835,
1.839524269104004,
-0.2784726321697235,
1.6663795709609985,
-0.5081456303596497,
-1.5520739555358887,
-1.51868736743927,
0.9171946048736572,
0.4682583212852478,
-0.9406428933143616,
0.3041941821575165,
-0.7203582525253296,
0.04868388921022415,
-0.1318347156047821,
1.2593061923980713,
1.3898274898529053,
0.7518086433410645,
-0.28827860951423645,
-0.9010745286941528,
0.22031836211681366,
-0.11386659741401672,
-0.7923910021781921,
-1.8297474384307861,
-0.19696326553821564,
0.13190817832946777,
0.636823296546936,
-1.282250165939331,
1.6906061172485352,
0.9198295474052429,
1.9591645002365112,
0.9109857082366943,
-0.3728978931903839,
1.4761359691619873,
0.10673287510871887,
1.9084452390670776,
-0.5654444098472595,
0.5527309775352478,
-0.19124217331409454,
-1.1289507150650024,
0.7246089577674866,
-0.48534849286079407,
-2.0921213626861572,
-0.7997866868972778,
-0.6997547745704651,
-0.1271107792854309,
-0.8686096668243408,
0.8612416386604309,
-0.13222432136535645,
-1.3321717977523804,
0.11240497976541519,
-0.6415571570396423,
0.5206073522567749,
-1.2524265050888062,
0.13361425697803497,
0.6456899642944336,
-0.5201185345649719,
0.05386587977409363,
-0.29504573345184326,
-1.2281746864318848,
-0.4946044087409973,
0.23472467064857483,
1.8169169425964355,
-0.37691420316696167,
0.7533099055290222,
1.255135178565979,
-0.6906502842903137,
0.004110601730644703,
0.2567013204097748,
-0.35352984070777893,
0.8443289399147034,
-1.137229561805725,
-0.47272056341171265,
1.1565377712249756,
-0.2311088740825653,
-0.5889450907707214,
1.3273029327392578,
0.7584171295166016,
-1.426361322402954,
-0.2743675708770752,
-0.1860629767179489,
-0.7890440821647644,
0.10923869162797928,
-1.546199917793274,
-0.1389160007238388,
0.4691152572631836,
-1.6086301803588867,
-0.4089195728302002,
-0.22541208565235138,
1.3070464134216309,
-0.33431512117385864,
1.4996371269226074,
-0.15307632088661194,
0.03948540240526199,
-0.37946444749832153,
-0.30935782194137573,
0.22002547979354858,
-0.070368692278862,
-0.726814329624176,
0.2931024432182312,
-0.7637889981269836,
0.34078964591026306,
1.2684359550476074,
0.314466267824173,
-0.22319135069847107,
0.34985485672950745,
1.208448052406311,
0.3792874217033386,
-0.19451633095741272,
-0.7860596179962158,
-1.6238878965377808,
1.9106544256210327,
-1.2312949895858765,
1.6735492944717407,
0.882710337638855,
0.07301824539899826,
-1.904015302658081,
-1.8083924055099487,
1.0567853450775146,
1.17347252368927,
2.3897416591644287,
0.3945538103580475,
0.5212079882621765,
-0.7962680459022522,
-0.7153663635253906,
0.32411545515060425,
-0.8808351159095764,
-0.658397376537323,
0.2638431787490845,
2.325768232345581,
1.8435394763946533,
-0.5010067224502563,
-0.09748108685016632,
-0.8561185002326965,
1.0154129266738892,
-0.267787367105484,
0.06630831956863403,
1.896285891532898,
-0.32165318727493286,
-1.1571502685546875,
1.422558069229126,
-2.3560752868652344,
0.37226805090904236,
1.9141747951507568,
0.35776057839393616,
0.17264479398727417,
-1.4220460653305054,
-0.6926590800285339,
-0.30128493905067444,
-0.41479358077049255,
-1.277287483215332,
0.6041663885116577,
-0.1015416830778122,
-1.0456910133361816,
-1.4483577013015747,
0.21438878774642944,
-1.1016639471054077,
-1.6320348978042603,
0.2497943639755249,
1.74262535572052,
1.9436229467391968,
-0.8600535988807678,
1.2765384912490845,
-0.27953019738197327,
-0.036232441663742065,
1.3240114450454712,
1.3741390705108643,
3.176570415496826,
1.9271987676620483,
-1.3641002178192139,
0.7389472723007202,
-0.3500629961490631,
-0.5693926811218262,
1.316216230392456,
-1.3359416723251343,
1.0695539712905884,
-0.12884657084941864,
-1.190621018409729,
-1.1399593353271484,
1.069550633430481,
0.5209141969680786,
0.03289084881544113,
-0.4509654939174652,
1.414374589920044,
0.034260109066963196,
1.399775743484497,
0.5837323069572449,
-0.39594051241874695,
0.4622688591480255,
-0.23633889853954315,
-0.3617784082889557,
1.507798433303833,
0.09773004055023193,
-1.4869892597198486,
-2.131021022796631,
-0.3096770942211151,
-0.9774806499481201,
-0.08939408510923386,
-0.6877508163452148,
-0.9707130193710327,
1.4509782791137695,
0.37954822182655334,
-1.1028389930725098,
-0.48990923166275024,
-0.4333798885345459,
-0.647093653678894,
2.6242964267730713,
-1.3629300594329834,
-0.06571612507104874,
-1.0051853656768799,
-0.48489007353782654,
1.7633041143417358,
-1.2004141807556152,
-0.1305692046880722,
-1.0272409915924072,
-0.6267351508140564,
-1.3827251195907593,
-0.4358065128326416,
-0.07100396603345871,
-0.9514029622077942,
0.8149948716163635,
0.26542848348617554,
-1.1262437105178833,
-0.29019808769226074,
-0.6614691019058228,
0.889967143535614,
-0.10771585255861282,
0.16457884013652802,
1.7490861415863037,
0.263008713722229,
-0.5334863066673279,
0.6476188898086548,
1.3189059495925903,
0.712924063205719,
-0.7111196517944336,
-0.0608978196978569,
-0.8607925772666931,
0.34716734290122986,
-1.6915727853775024,
0.27783477306365967,
-2.791865825653076,
0.7928142547607422,
-0.24503418803215027,
-0.14064954221248627,
-0.1295304298400879,
-1.300614595413208,
1.038190245628357,
2.5224900245666504,
-1.2896816730499268,
0.3768819272518158,
0.4858514964580536,
1.0766099691390991,
-1.492147445678711,
0.18862168490886688,
-0.5654726028442383,
1.960776925086975,
0.2699415683746338,
1.315163016319275,
-0.3439314663410187,
-2.3146910667419434,
0.7290015816688538,
-1.0541572570800781,
-0.8725962042808533,
0.9658891558647156,
-0.9518654346466064,
0.116448312997818,
-1.5816192626953125,
-0.333575963973999,
-0.8868294954299927,
-1.2066816091537476,
0.4930426776409149,
0.15239349007606506,
0.4365537166595459,
-0.7645745873451233,
0.424192875623703,
-2.2163515090942383,
-1.33184814453125,
-0.1836225688457489,
-0.9917702078819275,
0.6547960042953491,
-0.3967544734477997,
0.604312002658844,
0.0047044651582837105,
0.001384655013680458,
0.402719110250473,
1.6410971879959106,
3.5147833824157715,
0.10432422906160355,
0.19333365559577942,
-0.06448661535978317,
-0.9461042881011963,
1.253973364830017,
0.7229137420654297,
-0.04985669255256653,
-0.6167373061180115,
-1.0900797843933105,
1.336202621459961,
1.9673112630844116,
1.0788379907608032,
0.08791892975568771,
-1.06276273727417,
-0.8122178912162781,
0.03616982698440552,
0.2518365979194641,
0.460421085357666,
0.8573691248893738,
0.07617837935686111,
0.13049650192260742,
1.3740532398223877,
1.1302484273910522,
-0.2700002193450928,
0.23110297322273254,
-0.7909466624259949,
-0.3855772912502289,
0.603807806968689,
0.15771855413913727,
0.10632799565792084,
0.657477080821991,
-0.9655768275260925,
-0.27442798018455505,
-0.1681918501853943,
-1.013242244720459,
-0.8219403028488159,
-0.32623812556266785,
-0.3244296908378601,
1.5983244180679321,
0.2024717479944229,
-0.5030938386917114,
0.26116225123405457,
-0.5928218960762024,
-0.22703902423381805,
-1.1583549976348877,
0.12323358654975891,
-0.09077274799346924,
-0.04799662530422211,
-0.18215234577655792,
1.4902077913284302,
-0.8088175654411316,
-1.9813148975372314,
-0.008176576346158981,
0.34217309951782227,
-0.2455287128686905,
0.22169065475463867,
1.8879523277282715,
0.4938393533229828,
1.755243182182312,
1.0864720344543457,
0.9902682900428772,
-0.5133656859397888,
-1.2994192838668823,
0.8026807904243469,
1.0153888463974,
-1.4677257537841797,
0.8137854933738708,
-0.22050611674785614,
-0.6695055961608887,
0.6376296281814575,
1.3059133291244507,
0.3961847424507141,
-1.9002597332000732,
0.9858796000480652,
-0.969140350818634,
0.853757917881012,
0.5451378226280212,
0.8596369624137878,
0.08767935633659363,
0.9139798879623413,
-1.3497358560562134,
-1.078108787536621,
-0.5733649134635925,
-0.6968100070953369,
1.8556544780731201,
-0.2858063578605652,
0.5295326113700867,
-0.2119539976119995,
-1.3135098218917847,
0.018109871074557304,
0.8673224449157715,
0.1274876892566681,
-0.4433935284614563,
1.0319651365280151,
-0.7730141282081604,
-1.123105764389038,
-1.4323285818099976,
-0.3979896605014801,
-1.0148754119873047,
-0.8398872017860413,
1.1456595659255981,
0.7872228026390076,
0.3127463161945343,
1.924622893333435,
0.6254420876502991,
0.2952345907688141,
-2.6125566959381104,
0.8509870767593384,
0.1392730474472046,
0.046217940747737885,
1.0203498601913452,
0.3005492389202118,
1.1170005798339844,
0.0032391175627708435,
0.673811674118042,
-2.2768242359161377,
2.194362163543701,
-0.007100951392203569,
0.6423404216766357,
-0.17794835567474365,
-0.212076336145401,
0.9617400765419006,
0.6102490425109863,
0.613287627696991,
-1.306123971939087,
0.8646275997161865,
-0.4506644010543823,
0.9482406973838806,
0.7787544131278992,
-0.7868632078170776,
-0.008139098063111305,
1.2191545963287354,
0.4937709867954254,
-0.3819431960582733,
-0.9944685101509094,
-0.8158558011054993,
1.1304512023925781,
1.5849108695983887,
-0.09005150943994522,
-0.04430507868528366,
0.6931808590888977,
0.6906065344810486,
-1.1092655658721924,
0.2549070119857788,
-0.5834559202194214,
-0.6531218886375427,
1.4145537614822388,
1.9952160120010376,
-0.0777973085641861,
-0.15996767580509186,
-0.7236011624336243,
-1.2243664264678955,
0.537492573261261,
-0.17085665464401245,
0.3878338038921356,
0.557312548160553,
-0.7564132213592529,
0.9139662384986877,
0.8674067854881287,
0.8068999648094177,
0.10997176915407181,
0.32557913661003113,
0.5992584228515625,
-0.4393632113933563,
-1.0181188583374023,
-0.49378350377082825,
-1.0972319841384888,
-2.8522236347198486,
0.46642035245895386,
-0.3457137644290924,
-1.663859248161316,
0.08124007284641266,
-1.1358860731124878,
0.9074070453643799,
-0.640359103679657,
-1.37736976146698,
-1.4873689413070679,
0.4605240821838379,
0.013774575665593147,
1.148634910583496,
-1.5755233764648438,
-0.14949440956115723,
1.3115029335021973,
0.8610374331474304,
-0.3759710490703583,
0.7837327122688293,
0.31124311685562134,
0.9970458149909973,
1.0012515783309937,
-0.28025946021080017,
0.6434411406517029,
0.25426772236824036,
-1.2782421112060547,
0.407392293214798,
1.2283474206924438,
0.26646697521209717,
1.461991310119629,
-0.335153728723526,
0.1906130611896515,
0.5130802989006042,
-0.656810998916626,
-0.6269012689590454,
-0.20981702208518982,
0.34184199571609497,
0.3345680832862854,
-1.1389877796173096,
-0.1431684046983719,
-0.29904818534851074,
-0.1275937408208847,
-0.03919672593474388,
-1.3286314010620117,
-0.41322559118270874,
-0.4826296865940094,
-0.5927032828330994,
-1.3926994800567627,
-0.021225053817033768,
1.3063527345657349,
-0.7382857799530029,
-0.1095348373055458,
0.4336962103843689,
0.43736159801483154,
0.565293550491333,
0.5686878561973572,
-0.8666343092918396,
-0.3904380202293396,
-0.2581252157688141,
-0.27462780475616455,
0.1479244828224182,
1.0958900451660156,
-0.05296611040830612,
-0.9762871265411377,
0.6078144907951355,
-0.2867714464664459,
0.1783452332019806,
1.8634757995605469,
0.05871466547250748,
-0.8333603143692017,
0.40666627883911133,
-0.6117690801620483,
1.8388617038726807,
1.7326231002807617,
1.3006278276443481,
-0.08563978224992752,
-0.8436257243156433,
0.5076038241386414,
-0.45449769496917725,
-0.12587770819664001,
0.9677723050117493,
0.4980567991733551,
-0.24232034385204315,
-1.422037124633789,
0.6261170506477356,
1.2530957460403442,
-0.9706339836120605,
-0.7701848745346069,
0.2805851399898529,
-0.7059683203697205,
1.2561802864074707,
0.6206027269363403,
0.11443886905908585,
0.24945810437202454,
1.6471143960952759,
0.7506341338157654,
-0.5470148324966431,
0.5543599724769592,
0.6145459413528442,
-0.35863861441612244,
-2.2973062992095947,
-1.2098214626312256,
0.38279369473457336,
-0.4236230254173279,
-1.2823652029037476,
1.3522286415100098,
-1.0345823764801025,
-1.0399971008300781,
0.6887357831001282,
0.04746463894844055,
1.172709345817566,
0.2537335455417633,
1.6408069133758545,
2.162968158721924,
0.7455012202262878,
0.23630434274673462,
1.3254626989364624,
0.039381369948387146,
-0.4057087004184723,
1.9316344261169434,
-0.27190667390823364,
0.40455687046051025,
0.9405522346496582,
-0.46543198823928833,
-1.0855823755264282,
-0.9615910053253174,
-1.1837354898452759,
-0.7762457728385925,
1.2707558870315552,
0.13283506035804749,
-0.9542081952095032,
0.3786190152168274,
1.731632947921753,
0.15428443253040314,
-0.18449193239212036,
0.606900691986084,
0.6123852133750916,
-0.8343814015388489,
-0.012178686447441578,
-1.1688764095306396,
0.6219421625137329,
-0.11869924515485764,
-0.17901313304901123,
0.0623902902007103,
0.7588491439819336,
1.3332550525665283,
0.0418490469455719,
0.033200666308403015,
1.0848162174224854,
-1.4120841026306152,
1.630340576171875,
-0.5874905586242676,
0.4320234954357147,
-2.322429895401001,
1.150725245475769,
-0.6369068622589111,
2.0224199295043945,
-2.491666793823242,
0.5016951560974121,
-0.7353502511978149,
-0.36500805616378784,
0.28895628452301025,
-0.4302225112915039,
0.2601223886013031,
-0.16327767074108124,
-1.0483405590057373,
-0.17867203056812286,
-0.9031030535697937,
0.7377070188522339,
1.1814534664154053,
1.4384634494781494,
-1.1924285888671875,
-0.13877063989639282,
-1.4063576459884644,
-0.15101483464241028,
-0.8681471347808838,
0.24899086356163025,
-1.7142791748046875,
-0.2075604498386383,
-2.1150400638580322,
-2.401919364929199,
-1.3804051876068115,
-0.7051103711128235,
1.126412034034729,
0.1817399561405182,
-0.9492645859718323,
1.1959348917007446,
-0.5891890525817871,
-1.8311340808868408,
1.0280046463012695,
-2.216505765914917
] |
https://github.com/huggingface/datasets/issues/6089 | AssertionError: daemonic processes are not allowed to have children | > We could add a "threads" parallel backend to `datasets.parallel.parallel_backend` to support downloading with threads but note that `download_and_extract` also decompresses archives, and this is a CPU-intensive task, which is not ideal for (Python) threads (good for IO-intensive tasks).
Great! Download takes more time than extract, multiple threads can download in parallel, which can speed up a lot. | ### Describe the bug
When I load_dataset with num_proc > 0 in a deamon process, I got an error:
```python
File "/Users/codingl2k1/Work/datasets/src/datasets/download/download_manager.py", line 564, in download_and_extract
return self.extract(self.download(url_or_urls))
^^^^^^^^^^^^^^^^^
File "/Users/codingl2k1/Work/datasets/src/datasets/download/download_manager.py", line 427, in download
downloaded_path_or_paths = map_nested(
^^^^^^^^^^^^^^^^^
File "/Users/codingl2k1/Work/datasets/src/datasets/utils/py_utils.py", line 468, in map_nested
mapped = parallel_map(function, iterable, num_proc, types, disable_tqdm, desc, _single_map_nested)
^^^^^^^^^^^^^^^^^
File "/Users/codingl2k1/Work/datasets/src/datasets/utils/experimental.py", line 40, in _inner_fn
return fn(*args, **kwargs)
^^^^^^^^^^^^^^^^^
File "/Users/codingl2k1/Work/datasets/src/datasets/parallel/parallel.py", line 34, in parallel_map
return _map_with_multiprocessing_pool(
^^^^^^^^^^^^^^^^^
File "/Users/codingl2k1/Work/datasets/src/datasets/parallel/parallel.py", line 64, in _map_with_multiprocessing_pool
with Pool(num_proc, initargs=initargs, initializer=initializer) as pool:
^^^^^^^^^^^^^^^^^
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/multiprocessing/context.py", line 119, in Pool
return Pool(processes, initializer, initargs, maxtasksperchild,
^^^^^^^^^^^^^^^^^
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/multiprocessing/pool.py", line 215, in __init__
self._repopulate_pool()
^^^^^^^^^^^^^^^^^
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/multiprocessing/pool.py", line 306, in _repopulate_pool
return self._repopulate_pool_static(self._ctx, self.Process,
^^^^^^^^^^^^^^^^^
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/multiprocessing/pool.py", line 329, in _repopulate_pool_static
w.start()
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/multiprocessing/process.py", line 118, in start
assert not _current_process._config.get('daemon'), ^^^^^^^^^^^^^^^^^
AssertionError: daemonic processes are not allowed to have children
```
The download is io-intensive computing, may be datasets can replece the multi processing pool by a multi threading pool if in a deamon process.
### Steps to reproduce the bug
1. start a deamon process
2. run load_dataset with num_proc > 0
### Expected behavior
No error.
### Environment info
Python 3.11.4
datasets latest master | 8 | 58 | AssertionError: daemonic processes are not allowed to have children
### Describe the bug
When I load_dataset with num_proc > 0 in a deamon process, I got an error:
```python
File "/Users/codingl2k1/Work/datasets/src/datasets/download/download_manager.py", line 564, in download_and_extract
return self.extract(self.download(url_or_urls))
^^^^^^^^^^^^^^^^^
File "/Users/codingl2k1/Work/datasets/src/datasets/download/download_manager.py", line 427, in download
downloaded_path_or_paths = map_nested(
^^^^^^^^^^^^^^^^^
File "/Users/codingl2k1/Work/datasets/src/datasets/utils/py_utils.py", line 468, in map_nested
mapped = parallel_map(function, iterable, num_proc, types, disable_tqdm, desc, _single_map_nested)
^^^^^^^^^^^^^^^^^
File "/Users/codingl2k1/Work/datasets/src/datasets/utils/experimental.py", line 40, in _inner_fn
return fn(*args, **kwargs)
^^^^^^^^^^^^^^^^^
File "/Users/codingl2k1/Work/datasets/src/datasets/parallel/parallel.py", line 34, in parallel_map
return _map_with_multiprocessing_pool(
^^^^^^^^^^^^^^^^^
File "/Users/codingl2k1/Work/datasets/src/datasets/parallel/parallel.py", line 64, in _map_with_multiprocessing_pool
with Pool(num_proc, initargs=initargs, initializer=initializer) as pool:
^^^^^^^^^^^^^^^^^
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/multiprocessing/context.py", line 119, in Pool
return Pool(processes, initializer, initargs, maxtasksperchild,
^^^^^^^^^^^^^^^^^
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/multiprocessing/pool.py", line 215, in __init__
self._repopulate_pool()
^^^^^^^^^^^^^^^^^
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/multiprocessing/pool.py", line 306, in _repopulate_pool
return self._repopulate_pool_static(self._ctx, self.Process,
^^^^^^^^^^^^^^^^^
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/multiprocessing/pool.py", line 329, in _repopulate_pool_static
w.start()
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/multiprocessing/process.py", line 118, in start
assert not _current_process._config.get('daemon'), ^^^^^^^^^^^^^^^^^
AssertionError: daemonic processes are not allowed to have children
```
The download is io-intensive computing, may be datasets can replece the multi processing pool by a multi threading pool if in a deamon process.
### Steps to reproduce the bug
1. start a deamon process
2. run load_dataset with num_proc > 0
### Expected behavior
No error.
### Environment info
Python 3.11.4
datasets latest master
> We could add a "threads" parallel backend to `datasets.parallel.parallel_backend` to support downloading with threads but note that `download_and_extract` also decompresses archives, and this is a CPU-intensive task, which is not ideal for (Python) threads (good for IO-intensive tasks).
Great! Download takes more time than extract, multiple threads can download in parallel, which can speed up a lot. | [
-1.3304325342178345,
-0.843843400478363,
-0.6240853667259216,
1.2293169498443604,
0.023741507902741432,
-0.9174615740776062,
0.06877093762159348,
-1.0991508960723877,
1.8150602579116821,
-0.6466710567474365,
0.21736067533493042,
-1.551055669784546,
-0.1861899197101593,
-0.48568251729011536,
-0.6399885416030884,
-0.9412006735801697,
-0.28778788447380066,
-0.8252395987510681,
1.0269654989242554,
2.608595609664917,
1.2234467267990112,
-1.412387490272522,
2.707380771636963,
0.8097389936447144,
-0.3603209853172302,
-0.7776699066162109,
0.48141592741012573,
-0.0388236865401268,
-1.0951825380325317,
-0.6576300859451294,
-0.991340160369873,
0.02303980104625225,
-0.6472021341323853,
-0.3529244661331177,
-0.04204221069812775,
0.23380602896213531,
-0.2620423436164856,
-0.1918572634458542,
-0.7916498780250549,
-0.7969321608543396,
0.533761739730835,
-0.3538559079170227,
0.9927069544792175,
-0.4394308030605316,
1.7998770475387573,
-0.5881317853927612,
0.5424193739891052,
0.6860813498497009,
1.152274250984192,
0.05636809021234512,
-0.017423663288354874,
0.511515736579895,
0.3303428590297699,
-0.04301271587610245,
0.7841843962669373,
1.1911066770553589,
0.5725809335708618,
0.4992753565311432,
0.3974270224571228,
-2.302197217941284,
1.3348913192749023,
-1.050580620765686,
0.32438215613365173,
1.479893445968628,
-0.7309799194335938,
0.33590787649154663,
-1.7369120121002197,
0.08000855147838593,
0.7174645066261292,
-2.4402904510498047,
0.25283366441726685,
-1.2671724557876587,
-0.5861356258392334,
1.0325621366500854,
0.4068147540092468,
-1.1362403631210327,
0.08766410499811172,
-0.4590553641319275,
1.1769294738769531,
0.1981641948223114,
1.24491286277771,
-1.5459580421447754,
0.05796533823013306,
-0.14617295563220978,
0.30410197377204895,
-1.2460455894470215,
-1.631604790687561,
0.5121922492980957,
0.48947668075561523,
0.38065025210380554,
-0.1314806193113327,
1.021225929260254,
-0.9869500994682312,
0.56121826171875,
-0.8880736231803894,
-1.5188696384429932,
-1.5767793655395508,
-2.5290467739105225,
-2.3843014240264893,
0.7745110392570496,
-0.6072244644165039,
-0.38829123973846436,
2.145897626876831,
-1.041258692741394,
-1.5384067296981812,
0.9170845746994019,
0.20430254936218262,
0.13918863236904144,
2.285205841064453,
0.14447824656963348,
-0.7653111815452576,
0.44569167494773865,
-0.6788977384567261,
0.8515129685401917,
-0.21523532271385193,
1.4875693321228027,
0.5213677883148193,
-1.0824432373046875,
1.5163935422897339,
-0.567435622215271,
0.5559976696968079,
-0.35646435618400574,
-0.6333647966384888,
-0.8128358721733093,
0.42021554708480835,
1.839524269104004,
-0.2784726321697235,
1.6663795709609985,
-0.5081456303596497,
-1.5520739555358887,
-1.51868736743927,
0.9171946048736572,
0.4682583212852478,
-0.9406428933143616,
0.3041941821575165,
-0.7203582525253296,
0.04868388921022415,
-0.1318347156047821,
1.2593061923980713,
1.3898274898529053,
0.7518086433410645,
-0.28827860951423645,
-0.9010745286941528,
0.22031836211681366,
-0.11386659741401672,
-0.7923910021781921,
-1.8297474384307861,
-0.19696326553821564,
0.13190817832946777,
0.636823296546936,
-1.282250165939331,
1.6906061172485352,
0.9198295474052429,
1.9591645002365112,
0.9109857082366943,
-0.3728978931903839,
1.4761359691619873,
0.10673287510871887,
1.9084452390670776,
-0.5654444098472595,
0.5527309775352478,
-0.19124217331409454,
-1.1289507150650024,
0.7246089577674866,
-0.48534849286079407,
-2.0921213626861572,
-0.7997866868972778,
-0.6997547745704651,
-0.1271107792854309,
-0.8686096668243408,
0.8612416386604309,
-0.13222432136535645,
-1.3321717977523804,
0.11240497976541519,
-0.6415571570396423,
0.5206073522567749,
-1.2524265050888062,
0.13361425697803497,
0.6456899642944336,
-0.5201185345649719,
0.05386587977409363,
-0.29504573345184326,
-1.2281746864318848,
-0.4946044087409973,
0.23472467064857483,
1.8169169425964355,
-0.37691420316696167,
0.7533099055290222,
1.255135178565979,
-0.6906502842903137,
0.004110601730644703,
0.2567013204097748,
-0.35352984070777893,
0.8443289399147034,
-1.137229561805725,
-0.47272056341171265,
1.1565377712249756,
-0.2311088740825653,
-0.5889450907707214,
1.3273029327392578,
0.7584171295166016,
-1.426361322402954,
-0.2743675708770752,
-0.1860629767179489,
-0.7890440821647644,
0.10923869162797928,
-1.546199917793274,
-0.1389160007238388,
0.4691152572631836,
-1.6086301803588867,
-0.4089195728302002,
-0.22541208565235138,
1.3070464134216309,
-0.33431512117385864,
1.4996371269226074,
-0.15307632088661194,
0.03948540240526199,
-0.37946444749832153,
-0.30935782194137573,
0.22002547979354858,
-0.070368692278862,
-0.726814329624176,
0.2931024432182312,
-0.7637889981269836,
0.34078964591026306,
1.2684359550476074,
0.314466267824173,
-0.22319135069847107,
0.34985485672950745,
1.208448052406311,
0.3792874217033386,
-0.19451633095741272,
-0.7860596179962158,
-1.6238878965377808,
1.9106544256210327,
-1.2312949895858765,
1.6735492944717407,
0.882710337638855,
0.07301824539899826,
-1.904015302658081,
-1.8083924055099487,
1.0567853450775146,
1.17347252368927,
2.3897416591644287,
0.3945538103580475,
0.5212079882621765,
-0.7962680459022522,
-0.7153663635253906,
0.32411545515060425,
-0.8808351159095764,
-0.658397376537323,
0.2638431787490845,
2.325768232345581,
1.8435394763946533,
-0.5010067224502563,
-0.09748108685016632,
-0.8561185002326965,
1.0154129266738892,
-0.267787367105484,
0.06630831956863403,
1.896285891532898,
-0.32165318727493286,
-1.1571502685546875,
1.422558069229126,
-2.3560752868652344,
0.37226805090904236,
1.9141747951507568,
0.35776057839393616,
0.17264479398727417,
-1.4220460653305054,
-0.6926590800285339,
-0.30128493905067444,
-0.41479358077049255,
-1.277287483215332,
0.6041663885116577,
-0.1015416830778122,
-1.0456910133361816,
-1.4483577013015747,
0.21438878774642944,
-1.1016639471054077,
-1.6320348978042603,
0.2497943639755249,
1.74262535572052,
1.9436229467391968,
-0.8600535988807678,
1.2765384912490845,
-0.27953019738197327,
-0.036232441663742065,
1.3240114450454712,
1.3741390705108643,
3.176570415496826,
1.9271987676620483,
-1.3641002178192139,
0.7389472723007202,
-0.3500629961490631,
-0.5693926811218262,
1.316216230392456,
-1.3359416723251343,
1.0695539712905884,
-0.12884657084941864,
-1.190621018409729,
-1.1399593353271484,
1.069550633430481,
0.5209141969680786,
0.03289084881544113,
-0.4509654939174652,
1.414374589920044,
0.034260109066963196,
1.399775743484497,
0.5837323069572449,
-0.39594051241874695,
0.4622688591480255,
-0.23633889853954315,
-0.3617784082889557,
1.507798433303833,
0.09773004055023193,
-1.4869892597198486,
-2.131021022796631,
-0.3096770942211151,
-0.9774806499481201,
-0.08939408510923386,
-0.6877508163452148,
-0.9707130193710327,
1.4509782791137695,
0.37954822182655334,
-1.1028389930725098,
-0.48990923166275024,
-0.4333798885345459,
-0.647093653678894,
2.6242964267730713,
-1.3629300594329834,
-0.06571612507104874,
-1.0051853656768799,
-0.48489007353782654,
1.7633041143417358,
-1.2004141807556152,
-0.1305692046880722,
-1.0272409915924072,
-0.6267351508140564,
-1.3827251195907593,
-0.4358065128326416,
-0.07100396603345871,
-0.9514029622077942,
0.8149948716163635,
0.26542848348617554,
-1.1262437105178833,
-0.29019808769226074,
-0.6614691019058228,
0.889967143535614,
-0.10771585255861282,
0.16457884013652802,
1.7490861415863037,
0.263008713722229,
-0.5334863066673279,
0.6476188898086548,
1.3189059495925903,
0.712924063205719,
-0.7111196517944336,
-0.0608978196978569,
-0.8607925772666931,
0.34716734290122986,
-1.6915727853775024,
0.27783477306365967,
-2.791865825653076,
0.7928142547607422,
-0.24503418803215027,
-0.14064954221248627,
-0.1295304298400879,
-1.300614595413208,
1.038190245628357,
2.5224900245666504,
-1.2896816730499268,
0.3768819272518158,
0.4858514964580536,
1.0766099691390991,
-1.492147445678711,
0.18862168490886688,
-0.5654726028442383,
1.960776925086975,
0.2699415683746338,
1.315163016319275,
-0.3439314663410187,
-2.3146910667419434,
0.7290015816688538,
-1.0541572570800781,
-0.8725962042808533,
0.9658891558647156,
-0.9518654346466064,
0.116448312997818,
-1.5816192626953125,
-0.333575963973999,
-0.8868294954299927,
-1.2066816091537476,
0.4930426776409149,
0.15239349007606506,
0.4365537166595459,
-0.7645745873451233,
0.424192875623703,
-2.2163515090942383,
-1.33184814453125,
-0.1836225688457489,
-0.9917702078819275,
0.6547960042953491,
-0.3967544734477997,
0.604312002658844,
0.0047044651582837105,
0.001384655013680458,
0.402719110250473,
1.6410971879959106,
3.5147833824157715,
0.10432422906160355,
0.19333365559577942,
-0.06448661535978317,
-0.9461042881011963,
1.253973364830017,
0.7229137420654297,
-0.04985669255256653,
-0.6167373061180115,
-1.0900797843933105,
1.336202621459961,
1.9673112630844116,
1.0788379907608032,
0.08791892975568771,
-1.06276273727417,
-0.8122178912162781,
0.03616982698440552,
0.2518365979194641,
0.460421085357666,
0.8573691248893738,
0.07617837935686111,
0.13049650192260742,
1.3740532398223877,
1.1302484273910522,
-0.2700002193450928,
0.23110297322273254,
-0.7909466624259949,
-0.3855772912502289,
0.603807806968689,
0.15771855413913727,
0.10632799565792084,
0.657477080821991,
-0.9655768275260925,
-0.27442798018455505,
-0.1681918501853943,
-1.013242244720459,
-0.8219403028488159,
-0.32623812556266785,
-0.3244296908378601,
1.5983244180679321,
0.2024717479944229,
-0.5030938386917114,
0.26116225123405457,
-0.5928218960762024,
-0.22703902423381805,
-1.1583549976348877,
0.12323358654975891,
-0.09077274799346924,
-0.04799662530422211,
-0.18215234577655792,
1.4902077913284302,
-0.8088175654411316,
-1.9813148975372314,
-0.008176576346158981,
0.34217309951782227,
-0.2455287128686905,
0.22169065475463867,
1.8879523277282715,
0.4938393533229828,
1.755243182182312,
1.0864720344543457,
0.9902682900428772,
-0.5133656859397888,
-1.2994192838668823,
0.8026807904243469,
1.0153888463974,
-1.4677257537841797,
0.8137854933738708,
-0.22050611674785614,
-0.6695055961608887,
0.6376296281814575,
1.3059133291244507,
0.3961847424507141,
-1.9002597332000732,
0.9858796000480652,
-0.969140350818634,
0.853757917881012,
0.5451378226280212,
0.8596369624137878,
0.08767935633659363,
0.9139798879623413,
-1.3497358560562134,
-1.078108787536621,
-0.5733649134635925,
-0.6968100070953369,
1.8556544780731201,
-0.2858063578605652,
0.5295326113700867,
-0.2119539976119995,
-1.3135098218917847,
0.018109871074557304,
0.8673224449157715,
0.1274876892566681,
-0.4433935284614563,
1.0319651365280151,
-0.7730141282081604,
-1.123105764389038,
-1.4323285818099976,
-0.3979896605014801,
-1.0148754119873047,
-0.8398872017860413,
1.1456595659255981,
0.7872228026390076,
0.3127463161945343,
1.924622893333435,
0.6254420876502991,
0.2952345907688141,
-2.6125566959381104,
0.8509870767593384,
0.1392730474472046,
0.046217940747737885,
1.0203498601913452,
0.3005492389202118,
1.1170005798339844,
0.0032391175627708435,
0.673811674118042,
-2.2768242359161377,
2.194362163543701,
-0.007100951392203569,
0.6423404216766357,
-0.17794835567474365,
-0.212076336145401,
0.9617400765419006,
0.6102490425109863,
0.613287627696991,
-1.306123971939087,
0.8646275997161865,
-0.4506644010543823,
0.9482406973838806,
0.7787544131278992,
-0.7868632078170776,
-0.008139098063111305,
1.2191545963287354,
0.4937709867954254,
-0.3819431960582733,
-0.9944685101509094,
-0.8158558011054993,
1.1304512023925781,
1.5849108695983887,
-0.09005150943994522,
-0.04430507868528366,
0.6931808590888977,
0.6906065344810486,
-1.1092655658721924,
0.2549070119857788,
-0.5834559202194214,
-0.6531218886375427,
1.4145537614822388,
1.9952160120010376,
-0.0777973085641861,
-0.15996767580509186,
-0.7236011624336243,
-1.2243664264678955,
0.537492573261261,
-0.17085665464401245,
0.3878338038921356,
0.557312548160553,
-0.7564132213592529,
0.9139662384986877,
0.8674067854881287,
0.8068999648094177,
0.10997176915407181,
0.32557913661003113,
0.5992584228515625,
-0.4393632113933563,
-1.0181188583374023,
-0.49378350377082825,
-1.0972319841384888,
-2.8522236347198486,
0.46642035245895386,
-0.3457137644290924,
-1.663859248161316,
0.08124007284641266,
-1.1358860731124878,
0.9074070453643799,
-0.640359103679657,
-1.37736976146698,
-1.4873689413070679,
0.4605240821838379,
0.013774575665593147,
1.148634910583496,
-1.5755233764648438,
-0.14949440956115723,
1.3115029335021973,
0.8610374331474304,
-0.3759710490703583,
0.7837327122688293,
0.31124311685562134,
0.9970458149909973,
1.0012515783309937,
-0.28025946021080017,
0.6434411406517029,
0.25426772236824036,
-1.2782421112060547,
0.407392293214798,
1.2283474206924438,
0.26646697521209717,
1.461991310119629,
-0.335153728723526,
0.1906130611896515,
0.5130802989006042,
-0.656810998916626,
-0.6269012689590454,
-0.20981702208518982,
0.34184199571609497,
0.3345680832862854,
-1.1389877796173096,
-0.1431684046983719,
-0.29904818534851074,
-0.1275937408208847,
-0.03919672593474388,
-1.3286314010620117,
-0.41322559118270874,
-0.4826296865940094,
-0.5927032828330994,
-1.3926994800567627,
-0.021225053817033768,
1.3063527345657349,
-0.7382857799530029,
-0.1095348373055458,
0.4336962103843689,
0.43736159801483154,
0.565293550491333,
0.5686878561973572,
-0.8666343092918396,
-0.3904380202293396,
-0.2581252157688141,
-0.27462780475616455,
0.1479244828224182,
1.0958900451660156,
-0.05296611040830612,
-0.9762871265411377,
0.6078144907951355,
-0.2867714464664459,
0.1783452332019806,
1.8634757995605469,
0.05871466547250748,
-0.8333603143692017,
0.40666627883911133,
-0.6117690801620483,
1.8388617038726807,
1.7326231002807617,
1.3006278276443481,
-0.08563978224992752,
-0.8436257243156433,
0.5076038241386414,
-0.45449769496917725,
-0.12587770819664001,
0.9677723050117493,
0.4980567991733551,
-0.24232034385204315,
-1.422037124633789,
0.6261170506477356,
1.2530957460403442,
-0.9706339836120605,
-0.7701848745346069,
0.2805851399898529,
-0.7059683203697205,
1.2561802864074707,
0.6206027269363403,
0.11443886905908585,
0.24945810437202454,
1.6471143960952759,
0.7506341338157654,
-0.5470148324966431,
0.5543599724769592,
0.6145459413528442,
-0.35863861441612244,
-2.2973062992095947,
-1.2098214626312256,
0.38279369473457336,
-0.4236230254173279,
-1.2823652029037476,
1.3522286415100098,
-1.0345823764801025,
-1.0399971008300781,
0.6887357831001282,
0.04746463894844055,
1.172709345817566,
0.2537335455417633,
1.6408069133758545,
2.162968158721924,
0.7455012202262878,
0.23630434274673462,
1.3254626989364624,
0.039381369948387146,
-0.4057087004184723,
1.9316344261169434,
-0.27190667390823364,
0.40455687046051025,
0.9405522346496582,
-0.46543198823928833,
-1.0855823755264282,
-0.9615910053253174,
-1.1837354898452759,
-0.7762457728385925,
1.2707558870315552,
0.13283506035804749,
-0.9542081952095032,
0.3786190152168274,
1.731632947921753,
0.15428443253040314,
-0.18449193239212036,
0.606900691986084,
0.6123852133750916,
-0.8343814015388489,
-0.012178686447441578,
-1.1688764095306396,
0.6219421625137329,
-0.11869924515485764,
-0.17901313304901123,
0.0623902902007103,
0.7588491439819336,
1.3332550525665283,
0.0418490469455719,
0.033200666308403015,
1.0848162174224854,
-1.4120841026306152,
1.630340576171875,
-0.5874905586242676,
0.4320234954357147,
-2.322429895401001,
1.150725245475769,
-0.6369068622589111,
2.0224199295043945,
-2.491666793823242,
0.5016951560974121,
-0.7353502511978149,
-0.36500805616378784,
0.28895628452301025,
-0.4302225112915039,
0.2601223886013031,
-0.16327767074108124,
-1.0483405590057373,
-0.17867203056812286,
-0.9031030535697937,
0.7377070188522339,
1.1814534664154053,
1.4384634494781494,
-1.1924285888671875,
-0.13877063989639282,
-1.4063576459884644,
-0.15101483464241028,
-0.8681471347808838,
0.24899086356163025,
-1.7142791748046875,
-0.2075604498386383,
-2.1150400638580322,
-2.401919364929199,
-1.3804051876068115,
-0.7051103711128235,
1.126412034034729,
0.1817399561405182,
-0.9492645859718323,
1.1959348917007446,
-0.5891890525817871,
-1.8311340808868408,
1.0280046463012695,
-2.216505765914917
] |
https://github.com/huggingface/datasets/issues/6086 | Support `fsspec` in `Dataset.to_<format>` methods | I'm assuming this should just cover `to_csv`, `to_parquet`, and `to_json`, right? As `to_list` and `to_dict` just return Python objects, `to_pandas` returns a `pandas.DataFrame` and `to_sql` just inserts into a SQL DB, is that right? | Supporting this should be fairly easy.
Requested on the forum [here](https://discuss.huggingface.co/t/how-can-i-convert-a-loaded-dataset-in-to-a-parquet-file-and-save-it-to-the-s3/48353). | 10 | 34 | Support `fsspec` in `Dataset.to_<format>` methods
Supporting this should be fairly easy.
Requested on the forum [here](https://discuss.huggingface.co/t/how-can-i-convert-a-loaded-dataset-in-to-a-parquet-file-and-save-it-to-the-s3/48353).
I'm assuming this should just cover `to_csv`, `to_parquet`, and `to_json`, right? As `to_list` and `to_dict` just return Python objects, `to_pandas` returns a `pandas.DataFrame` and `to_sql` just inserts into a SQL DB, is that right? | [
-1.0311846733093262,
-0.7468673586845398,
-0.7434991002082825,
1.6008455753326416,
-0.025689486414194107,
-1.4986146688461304,
0.25253990292549133,
-1.046440601348877,
1.7896806001663208,
-0.9305419921875,
0.49904119968414307,
-1.5891073942184448,
0.06446303427219391,
-0.7518453001976013,
-0.7872912883758545,
-0.7511021494865417,
-0.4038705825805664,
-0.7116568684577942,
0.9539511799812317,
2.4297983646392822,
1.0920487642288208,
-1.367638349533081,
2.633028984069824,
0.6873296499252319,
-0.1886100023984909,
-0.9285821914672852,
0.39385753870010376,
0.04693584889173508,
-1.2781950235366821,
-0.30774179100990295,
-0.9090712666511536,
-0.13143087923526764,
-0.6696197986602783,
-0.6520727872848511,
-0.0006529707461595535,
0.5667701959609985,
-0.25414878129959106,
-0.4599475562572479,
-0.3815772235393524,
-0.8414917588233948,
0.5927425026893616,
-0.3488776683807373,
0.9343873858451843,
-0.3979126214981079,
1.8151334524154663,
-0.632334291934967,
0.49572569131851196,
0.6970608830451965,
1.3591004610061646,
0.07623255997896194,
-0.10126954317092896,
0.26150959730148315,
0.2577661871910095,
0.03411267697811127,
0.5024210214614868,
1.1258461475372314,
0.540841817855835,
0.756013810634613,
0.7747696042060852,
-2.2371129989624023,
1.3808374404907227,
-1.0805364847183228,
0.3131685256958008,
1.2217379808425903,
-1.0496230125427246,
0.4055265188217163,
-1.8383861780166626,
-0.0715438649058342,
0.46096011996269226,
-2.2705130577087402,
0.2569184899330139,
-1.2213753461837769,
-0.47138068079948425,
0.9672091603279114,
0.4141950309276581,
-1.2365020513534546,
0.03402671962976456,
-0.2825125753879547,
0.90022873878479,
0.36013808846473694,
1.0146458148956299,
-1.74468195438385,
0.20397284626960754,
-0.37738466262817383,
0.15125156939029694,
-1.309295892715454,
-1.4459741115570068,
0.5735391974449158,
0.7186286449432373,
0.7160276770591736,
-0.08355212956666946,
0.913183331489563,
-0.9650971293449402,
0.7443498373031616,
-0.9610983729362488,
-1.6971232891082764,
-1.1793125867843628,
-2.1830875873565674,
-2.4093616008758545,
0.6942539215087891,
-0.4203471839427948,
-0.4304131269454956,
2.0836985111236572,
-0.9351942539215088,
-1.7907750606536865,
1.0440289974212646,
0.2871205508708954,
-0.06814891844987869,
2.2880306243896484,
0.22876285016536713,
-0.7850550413131714,
0.6122066378593445,
-0.7389885783195496,
0.7494356036186218,
-0.4870719313621521,
1.2817306518554688,
0.4633559286594391,
-1.1748167276382446,
1.6279970407485962,
-0.31174108386039734,
0.6738209128379822,
-0.8112573623657227,
-0.450918585062027,
-0.751257061958313,
0.3534623980522156,
1.8708000183105469,
-0.15815481543540955,
1.4927929639816284,
-0.18753103911876678,
-1.464478850364685,
-1.5552380084991455,
0.9272975325584412,
0.4568360149860382,
-0.7663368582725525,
0.19169074296951294,
-0.41247087717056274,
0.13604377210140228,
0.056000031530857086,
1.285321831703186,
1.2342051267623901,
0.7837735414505005,
-0.13687339425086975,
-0.8175977468490601,
0.15940457582473755,
0.03878430277109146,
-0.6391791701316833,
-1.802850604057312,
-0.3576070964336395,
0.18551674485206604,
0.5082694292068481,
-1.012515664100647,
1.9779413938522339,
0.8559084534645081,
1.9685626029968262,
0.9858341217041016,
-0.18149308860301971,
1.5237483978271484,
-0.13669006526470184,
2.061505079269409,
-0.29504862427711487,
0.6838434934616089,
-0.4581368565559387,
-1.1752760410308838,
0.8723451495170593,
-0.4031623899936676,
-2.028400182723999,
-0.6011122465133667,
-0.9377759099006653,
-0.11116080731153488,
-0.7302972674369812,
1.0616427659988403,
-0.22476699948310852,
-1.349278450012207,
0.16369594633579254,
-0.5901599526405334,
0.11955679953098297,
-1.208953857421875,
0.2851184904575348,
0.7307882308959961,
-0.7838570475578308,
0.07637767493724823,
-0.39684104919433594,
-1.4570338726043701,
-0.5263999700546265,
0.43355289101600647,
1.9122503995895386,
-0.7403901219367981,
0.9439982175827026,
1.0709867477416992,
-0.7082209587097168,
-0.13754220306873322,
0.40074336528778076,
-0.3607213497161865,
0.760130763053894,
-1.0897928476333618,
-0.42891925573349,
1.120383381843567,
-0.2640671730041504,
-0.73497074842453,
1.4524290561676025,
0.7151802182197571,
-0.9426925182342529,
-0.11593740433454514,
-0.30562859773635864,
-0.7195753455162048,
0.08628275990486145,
-1.5923752784729004,
0.048712410032749176,
0.3549637496471405,
-1.4594452381134033,
-0.527899980545044,
-0.10617503523826599,
1.2887884378433228,
-0.10823941975831985,
1.2414312362670898,
-0.1288134753704071,
-0.25678855180740356,
-0.4895918667316437,
-0.621989369392395,
0.12179216742515564,
-0.06383271515369415,
-0.6703035831451416,
0.30251145362854004,
-0.6090611815452576,
0.3489435613155365,
1.4058823585510254,
0.05448513478040695,
0.1501488834619522,
0.6031059622764587,
1.162345051765442,
0.31434500217437744,
-0.07028130441904068,
-0.8880873918533325,
-1.5489224195480347,
2.0352280139923096,
-1.5260392427444458,
1.9590867757797241,
0.6959922909736633,
0.022378990426659584,
-1.7795391082763672,
-1.8551520109176636,
1.562363862991333,
1.2358784675598145,
2.3948469161987305,
0.6509842872619629,
0.3892945349216461,
-0.9516984820365906,
-0.5767883062362671,
0.4632100760936737,
-0.9730199575424194,
-0.7813267111778259,
0.09770939499139786,
2.2969412803649902,
1.7447386980056763,
-0.486691951751709,
-0.2658335864543915,
-0.9953901171684265,
1.3366411924362183,
-0.2808118164539337,
0.24051296710968018,
2.039733409881592,
-0.46958044171333313,
-1.086803674697876,
1.3051514625549316,
-2.435231924057007,
0.14307595789432526,
2.012620449066162,
0.157754048705101,
0.11761443316936493,
-1.3043994903564453,
-0.6110158562660217,
-0.10509585589170456,
-0.41709259152412415,
-1.2983216047286987,
0.5182120203971863,
-0.18492379784584045,
-0.7485464215278625,
-1.3825136423110962,
0.29011380672454834,
-1.1106868982315063,
-1.6156715154647827,
0.38280048966407776,
1.7690130472183228,
2.0650410652160645,
-0.7120133638381958,
1.542420744895935,
-0.25070056319236755,
0.22469066083431244,
1.187914252281189,
1.2224647998809814,
3.185880184173584,
1.9281325340270996,
-1.121960997581482,
0.6213773488998413,
-0.18979117274284363,
-0.6948937177658081,
1.2329185009002686,
-0.9523786306381226,
1.223442554473877,
-0.3182758390903473,
-1.1289342641830444,
-1.4016687870025635,
0.8522231578826904,
0.4911021590232849,
0.10203371196985245,
-0.4258534014225006,
1.2898730039596558,
0.18749134242534637,
1.1810660362243652,
0.5020827054977417,
-0.3392035663127899,
0.535226047039032,
-0.43510541319847107,
-0.560795783996582,
1.6005349159240723,
0.2876759171485901,
-1.321081280708313,
-2.342036008834839,
-0.0888218805193901,
-0.9378473162651062,
-0.03411206603050232,
-0.7310322523117065,
-0.9013141989707947,
1.6955589056015015,
0.41810867190361023,
-1.127138614654541,
-0.061521582305431366,
-0.24637319147586823,
-0.7178144454956055,
2.710242748260498,
-1.3497428894042969,
-0.2669191360473633,
-0.9521215558052063,
-0.6141371130943298,
1.7573330402374268,
-1.2938175201416016,
-0.3093017339706421,
-0.9769707322120667,
-0.43793046474456787,
-1.2696353197097778,
-0.4425352215766907,
-0.07978151738643646,
-0.8822391629219055,
0.8195427656173706,
0.05445154756307602,
-1.357331395149231,
-0.28928330540657043,
-0.9670947790145874,
0.8023878335952759,
-0.18802687525749207,
0.19376662373542786,
1.7587472200393677,
0.33254528045654297,
-0.3512442111968994,
0.8180245757102966,
1.1610350608825684,
0.6268407702445984,
-0.5679292678833008,
0.40178680419921875,
-0.574028491973877,
0.327702134847641,
-1.255971074104309,
0.37335461378097534,
-2.9499762058258057,
0.60151207447052,
-0.02923624962568283,
-0.0005049761384725571,
-0.08287745714187622,
-1.4072265625,
0.9489310383796692,
2.593306541442871,
-1.192398190498352,
0.49450135231018066,
0.21047860383987427,
1.2707006931304932,
-1.4431620836257935,
0.14877250790596008,
-0.49093097448349,
2.1110339164733887,
-0.00189200509339571,
1.0809745788574219,
-0.4505214989185333,
-2.2459561824798584,
0.5577208995819092,
-1.3066859245300293,
-1.2237118482589722,
0.7863438725471497,
-0.8105216026306152,
-0.017146345227956772,
-1.140865445137024,
-0.09000245481729507,
-0.9308052062988281,
-1.2405989170074463,
0.7230727672576904,
0.10711325705051422,
0.58734130859375,
-0.6665359139442444,
0.21079587936401367,
-2.091083526611328,
-1.449954867362976,
-0.2925177812576294,
-0.9279530048370361,
0.3669600784778595,
-0.2455393522977829,
0.6795682311058044,
-0.1718607097864151,
0.13227114081382751,
0.23640219867229462,
1.5448784828186035,
3.2818679809570312,
0.03880062699317932,
0.4497041702270508,
-0.32571133971214294,
-0.927437961101532,
1.4224324226379395,
0.983643651008606,
-0.11725552380084991,
-0.6625562906265259,
-0.9732936024665833,
1.2739626169204712,
2.0449156761169434,
1.0365865230560303,
0.04606379568576813,
-0.9361605048179626,
-0.6823583841323853,
0.0006385073065757751,
0.11483410000801086,
0.4837978780269623,
0.8847295641899109,
0.2611158788204193,
0.0419769287109375,
1.311327338218689,
1.184311032295227,
-0.3496541976928711,
0.4373803436756134,
-0.831731379032135,
-0.2566119432449341,
0.581648588180542,
0.40036043524742126,
0.05102328956127167,
0.16345703601837158,
-0.9163808822631836,
-0.2792079746723175,
-0.2910311222076416,
-0.8557658195495605,
-0.8000630736351013,
-0.5598137974739075,
-0.4488255977630615,
1.792555809020996,
-0.04391390085220337,
-0.606208086013794,
0.04149545729160309,
-0.7449566125869751,
-0.018144745379686356,
-0.8954284191131592,
0.1687370389699936,
-0.18684034049510956,
-0.0776677280664444,
-0.07175939530134201,
1.692878007888794,
-1.0759968757629395,
-2.167210578918457,
0.2658972442150116,
0.180581197142601,
-0.44408759474754333,
0.10268346965312958,
1.6493189334869385,
0.5059884786605835,
1.4429287910461426,
1.4949852228164673,
1.0954363346099854,
-0.7497663497924805,
-1.3672761917114258,
0.5957707166671753,
0.9304563999176025,
-1.4280022382736206,
0.8445965647697449,
0.03916478157043457,
-0.4918813705444336,
0.6301395893096924,
1.130682349205017,
0.48527026176452637,
-2.0588080883026123,
0.6480648517608643,
-1.053032398223877,
0.8814969062805176,
0.7773020267486572,
0.7098017930984497,
0.24982386827468872,
0.8502117991447449,
-1.1150100231170654,
-1.1100555658340454,
-0.6730359792709351,
-0.78318852186203,
1.8263239860534668,
-0.2909870445728302,
0.47882598638534546,
-0.10939743369817734,
-1.39250910282135,
-0.035461507737636566,
0.8382387161254883,
0.48413243889808655,
-0.428843230009079,
0.6966724991798401,
-0.7349783182144165,
-0.9682136178016663,
-1.3383851051330566,
-0.5542756915092468,
-1.0891687870025635,
-0.8658617734909058,
1.0359234809875488,
0.7629672884941101,
0.4022490084171295,
1.9204357862472534,
0.7648157477378845,
0.29282987117767334,
-2.579186201095581,
0.7762705087661743,
0.40048080682754517,
-0.054036930203437805,
0.7443328499794006,
0.41995224356651306,
1.1319808959960938,
-0.21135099232196808,
0.6403719186782837,
-2.3530759811401367,
2.333211660385132,
-0.1370251625776291,
0.4786926805973053,
0.10623596608638763,
-0.19299232959747314,
1.006563425064087,
0.31354406476020813,
0.5860433578491211,
-1.1479134559631348,
0.675491213798523,
-0.6334611773490906,
1.2628521919250488,
0.8484469652175903,
-0.8609784841537476,
-0.030834902077913284,
1.280379056930542,
0.425979346036911,
-0.5791371464729309,
-0.9440838098526001,
-1.0280288457870483,
0.8963196873664856,
1.6936609745025635,
-0.18470250070095062,
-0.04585249722003937,
0.8810791969299316,
0.6071562170982361,
-1.290384292602539,
0.03877352923154831,
-0.7558311223983765,
-0.8272343277931213,
1.7024227380752563,
1.9026880264282227,
-0.1370132565498352,
-0.007200396619737148,
-1.0073857307434082,
-1.2873492240905762,
0.8592326641082764,
0.16058821976184845,
-0.2241358757019043,
0.6322028040885925,
-0.596577525138855,
1.2061694860458374,
0.9510679841041565,
0.8697524666786194,
0.08248762041330338,
0.3136027455329895,
0.47591397166252136,
-0.380668967962265,
-1.2346128225326538,
-0.43774116039276123,
-1.0658912658691406,
-2.6909146308898926,
0.43003198504447937,
-0.33367034792900085,
-1.4243639707565308,
-0.053561821579933167,
-1.0388864278793335,
0.7736572623252869,
-0.49723196029663086,
-1.0866122245788574,
-1.4211639165878296,
0.24019131064414978,
-0.10715183615684509,
0.7993367314338684,
-1.592594027519226,
0.009094279259443283,
1.153560757637024,
0.886236310005188,
-0.909438967704773,
0.8859118819236755,
0.21709772944450378,
0.9724435806274414,
0.9651288986206055,
-0.4744311273097992,
0.5442780256271362,
0.2432233691215515,
-1.351495385169983,
0.45074862241744995,
1.2484279870986938,
0.060148850083351135,
1.22441565990448,
-0.48885753750801086,
-0.03814565762877464,
0.3253905475139618,
-0.3536842465400696,
-0.5116509795188904,
-0.8552283048629761,
0.7172725796699524,
-0.053692832589149475,
-0.8814384937286377,
0.1440623253583908,
0.08625023812055588,
-0.214590385556221,
0.28260523080825806,
-1.610128402709961,
-0.18954475224018097,
-0.3043857216835022,
-0.5751615762710571,
-1.327745795249939,
-0.015219058841466904,
1.2065447568893433,
-0.533894419670105,
-0.13232579827308655,
0.5154678821563721,
0.35872551798820496,
0.49345922470092773,
0.5339822173118591,
-0.7257595062255859,
-0.3129577338695526,
-0.30664825439453125,
-0.4185170829296112,
0.455379456281662,
1.3569276332855225,
-0.10675525665283203,
-0.987647533416748,
0.6964558959007263,
-0.35441216826438904,
0.05879107862710953,
1.9892488718032837,
0.11754383146762848,
-0.9220280051231384,
0.35287028551101685,
-0.7000250220298767,
1.903503179550171,
1.753708004951477,
1.1376174688339233,
-0.06406019628047943,
-0.9378640055656433,
0.6721527576446533,
-0.41316941380500793,
-0.33429622650146484,
0.9179376363754272,
0.3194987177848816,
-0.2957267463207245,
-1.3201228380203247,
0.730625569820404,
1.3855689764022827,
-0.6580642461776733,
-0.9855395555496216,
0.00955580547451973,
-0.8168652653694153,
1.1164212226867676,
0.7476875185966492,
0.48486682772636414,
0.29679280519485474,
1.6505271196365356,
0.7231155633926392,
-0.5049136281013489,
0.5236325263977051,
0.4419235289096832,
-0.11762331426143646,
-1.9457916021347046,
-1.2687222957611084,
0.34080636501312256,
-0.554248034954071,
-1.6311782598495483,
1.451022982597351,
-1.2639130353927612,
-0.9000133872032166,
0.5821887850761414,
0.1202993243932724,
1.5022671222686768,
0.3400416374206543,
1.506836175918579,
1.999670147895813,
0.8631007671356201,
0.4819384217262268,
1.3225620985031128,
-0.29983776807785034,
-0.4721458852291107,
1.8264727592468262,
-0.5362122058868408,
0.47594764828681946,
1.1747989654541016,
-0.3375115692615509,
-1.0446916818618774,
-0.8681375980377197,
-1.1679368019104004,
-0.7377256751060486,
1.114472508430481,
0.16573892533779144,
-1.2651447057724,
0.3853166997432709,
1.655564308166504,
0.08362219482660294,
-0.25970518589019775,
0.6672642827033997,
0.28360119462013245,
-0.8629522323608398,
0.026372158899903297,
-1.0230865478515625,
0.6450616121292114,
-0.30020323395729065,
-0.2972605228424072,
0.408645361661911,
0.447602242231369,
1.078729271888733,
0.03243829309940338,
0.28402963280677795,
1.1318817138671875,
-1.3994684219360352,
1.3689656257629395,
-0.7004972696304321,
0.3862513303756714,
-2.3553307056427,
1.421385645866394,
-0.7425707578659058,
1.9371651411056519,
-2.6623358726501465,
0.2992704212665558,
-0.4795609414577484,
-0.5737990140914917,
0.3507530987262726,
-0.17623332142829895,
0.0650356262922287,
-0.205826997756958,
-1.2052801847457886,
0.009211046621203423,
-0.7550836801528931,
0.49369192123413086,
1.0945736169815063,
1.2969255447387695,
-0.9470831751823425,
-0.3234291672706604,
-1.701683759689331,
-0.11834229528903961,
-0.4523393511772156,
0.22952567040920258,
-1.9894633293151855,
-0.18082097172737122,
-1.9898457527160645,
-2.407313346862793,
-1.3626718521118164,
-0.8761484026908875,
1.2614431381225586,
0.077280692756176,
-0.7900288105010986,
1.1040292978286743,
-0.3218081593513489,
-1.859232783317566,
1.1391003131866455,
-2.0518248081207275
] |
https://github.com/huggingface/datasets/issues/6079 | Iterating over DataLoader based on HF datasets is stuck forever | When the process starts to hang, can you interrupt it with CTRL + C and paste the error stack trace here? | ### Describe the bug
I am using Amazon Sagemaker notebook (Amazon Linux 2) with python 3.10 based Conda environment.
I have a dataset in parquet format locally. When I try to iterate over it, the loader is stuck forever. Note that the same code is working for python 3.6 based conda environment seamlessly. What should be my next steps here?
### Steps to reproduce the bug
```
train_dataset = load_dataset(
"parquet", data_files = {'train': tr_data_path + '*.parquet'},
split = 'train',
collate_fn = streaming_data_collate_fn,
streaming = True
).with_format('torch')
train_dataloader = DataLoader(train_dataset, batch_size = 2, num_workers = 0)
t = time.time()
iter_ = 0
for batch in train_dataloader:
iter_ += 1
if iter_ == 1000:
break
print (time.time() - t)
```
### Expected behavior
The snippet should work normally and load the next batch of data.
### Environment info
datasets: '2.14.0'
pyarrow: '12.0.0'
torch: '2.0.0'
Python: 3.10.10 | packaged by conda-forge | (main, Mar 24 2023, 20:08:06) [GCC 11.3.0]
!uname -r
5.10.178-162.673.amzn2.x86_64 | 11 | 21 | Iterating over DataLoader based on HF datasets is stuck forever
### Describe the bug
I am using Amazon Sagemaker notebook (Amazon Linux 2) with python 3.10 based Conda environment.
I have a dataset in parquet format locally. When I try to iterate over it, the loader is stuck forever. Note that the same code is working for python 3.6 based conda environment seamlessly. What should be my next steps here?
### Steps to reproduce the bug
```
train_dataset = load_dataset(
"parquet", data_files = {'train': tr_data_path + '*.parquet'},
split = 'train',
collate_fn = streaming_data_collate_fn,
streaming = True
).with_format('torch')
train_dataloader = DataLoader(train_dataset, batch_size = 2, num_workers = 0)
t = time.time()
iter_ = 0
for batch in train_dataloader:
iter_ += 1
if iter_ == 1000:
break
print (time.time() - t)
```
### Expected behavior
The snippet should work normally and load the next batch of data.
### Environment info
datasets: '2.14.0'
pyarrow: '12.0.0'
torch: '2.0.0'
Python: 3.10.10 | packaged by conda-forge | (main, Mar 24 2023, 20:08:06) [GCC 11.3.0]
!uname -r
5.10.178-162.673.amzn2.x86_64
When the process starts to hang, can you interrupt it with CTRL + C and paste the error stack trace here? | [
-1.2703862190246582,
-1.0200567245483398,
-0.7282028198242188,
1.5863037109375,
-0.22804024815559387,
-1.1206165552139282,
0.14635612070560455,
-0.9283672571182251,
1.6327399015426636,
-0.8532999157905579,
0.25511327385902405,
-1.5935802459716797,
0.06626027077436447,
-0.5541383624076843,
-0.6710367798805237,
-0.9019896984100342,
-0.39769357442855835,
-0.7906194925308228,
1.2152239084243774,
2.4792754650115967,
1.1767481565475464,
-1.4330624341964722,
2.7466118335723877,
0.6844868659973145,
-0.17716172337532043,
-1.0545680522918701,
0.45236873626708984,
0.011621950194239616,
-1.303383469581604,
-0.47269389033317566,
-0.9854139089584351,
-0.10184447467327118,
-0.5849422812461853,
-0.43242427706718445,
0.031229667365550995,
0.3751274347305298,
-0.3097801208496094,
-0.473556250333786,
-0.5225887894630432,
-0.7543569207191467,
0.4138980507850647,
-0.4091336131095886,
0.9121178388595581,
-0.3322283625602722,
1.8646512031555176,
-0.44648393988609314,
0.4723714292049408,
0.740240216255188,
1.2310529947280884,
0.19101235270500183,
-0.061486128717660904,
0.4019983410835266,
0.40199148654937744,
-0.03395163267850876,
0.5568444132804871,
1.112541675567627,
0.6121524572372437,
0.43153220415115356,
0.6674896478652954,
-2.2594614028930664,
1.3508073091506958,
-1.0539847612380981,
0.3160218894481659,
1.3426822423934937,
-1.0169873237609863,
0.40661099553108215,
-1.7052521705627441,
-0.03219630569219589,
0.6527529954910278,
-2.2229976654052734,
0.31867483258247375,
-1.3309470415115356,
-0.5061382055282593,
1.0579190254211426,
0.37080633640289307,
-1.2101249694824219,
0.08242490887641907,
-0.46905308961868286,
1.0823975801467896,
0.405666708946228,
1.086157202720642,
-1.6750189065933228,
-0.09977629780769348,
-0.2952594459056854,
0.0820297971367836,
-1.360903024673462,
-1.5300941467285156,
0.545491099357605,
0.7014057636260986,
0.5633761882781982,
-0.12729158997535706,
1.126304268836975,
-1.051946997642517,
0.7918419241905212,
-1.054456353187561,
-1.6907122135162354,
-1.4646062850952148,
-2.426743268966675,
-2.34340238571167,
0.7109238505363464,
-0.3870485723018646,
-0.5291550159454346,
2.1213815212249756,
-1.0183073282241821,
-1.7146294116973877,
1.2295945882797241,
0.20865119993686676,
-0.01793459802865982,
2.3642048835754395,
0.20573250949382782,
-0.735796332359314,
0.41250771284103394,
-0.823825478553772,
0.7673927545547485,
-0.3535959720611572,
1.3685827255249023,
0.4158584773540497,
-1.0192694664001465,
1.566381573677063,
-0.27558696269989014,
0.5738387107849121,
-0.5994521975517273,
-0.5265457034111023,
-0.7651427388191223,
0.2725522518157959,
1.9890624284744263,
-0.26922130584716797,
1.4972985982894897,
-0.3141382336616516,
-1.5104280710220337,
-1.614240050315857,
0.9431660175323486,
0.4184652864933014,
-0.7832295894622803,
0.16958367824554443,
-0.29936233162879944,
0.17780359089374542,
-0.09599873423576355,
1.135988473892212,
1.2540297508239746,
0.661910355091095,
-0.4068514108657837,
-0.9580122828483582,
0.2457752823829651,
-0.19125349819660187,
-0.6388253569602966,
-1.7693486213684082,
-0.3928391635417938,
0.003830372355878353,
0.6714229583740234,
-1.2429225444793701,
1.640195369720459,
0.9186469912528992,
1.8952792882919312,
1.0373010635375977,
-0.32901260256767273,
1.4938896894454956,
0.1489226222038269,
1.7987804412841797,
-0.48651060461997986,
0.6303344368934631,
-0.3957127332687378,
-1.1346262693405151,
0.7571297287940979,
-0.30230218172073364,
-1.9857853651046753,
-0.7314308881759644,
-0.8195823431015015,
-0.22460857033729553,
-0.7727138996124268,
0.9088981747627258,
-0.2878906726837158,
-1.460631012916565,
0.32449567317962646,
-0.7310112714767456,
0.1958143562078476,
-1.2123395204544067,
0.395111620426178,
0.6907099485397339,
-0.5267525315284729,
0.11855506896972656,
-0.27504226565361023,
-1.2725237607955933,
-0.45877203345298767,
0.3289075791835785,
1.856755256652832,
-0.7664968371391296,
0.9108681678771973,
1.1084643602371216,
-0.6924868226051331,
0.019573837518692017,
0.26403751969337463,
-0.23922018706798553,
0.8693661093711853,
-0.9898128509521484,
-0.46799516677856445,
1.2221249341964722,
-0.34786251187324524,
-0.6127305030822754,
1.4814071655273438,
0.7415249943733215,
-1.0217437744140625,
-0.25684529542922974,
-0.09715654700994492,
-0.7770324349403381,
0.10685914754867554,
-1.607828140258789,
-0.15883266925811768,
0.4460715055465698,
-1.5786781311035156,
-0.4429323375225067,
-0.22039929032325745,
1.3957363367080688,
-0.09679817408323288,
1.5038902759552002,
-0.3827415406703949,
-0.21682804822921753,
-0.2948243021965027,
-0.39469006657600403,
0.2126920223236084,
-0.18063202500343323,
-0.5854507684707642,
0.183577299118042,
-0.7566635012626648,
0.3451472520828247,
1.418308973312378,
0.3428877890110016,
0.012665154412388802,
0.5042246580123901,
1.0517922639846802,
0.4361526370048523,
-0.01440795511007309,
-0.8900279998779297,
-1.5050073862075806,
1.9882922172546387,
-1.4387753009796143,
2.0444085597991943,
0.751244068145752,
0.006243592128157616,
-1.7774544954299927,
-1.8524779081344604,
1.3661456108093262,
1.0736184120178223,
2.27195143699646,
0.5371049642562866,
0.3737678825855255,
-0.8768037557601929,
-0.6783195734024048,
0.25457867980003357,
-0.9948505163192749,
-0.7738151550292969,
0.1565236747264862,
2.4632973670959473,
1.7346285581588745,
-0.3745049238204956,
-0.10219302028417587,
-0.9748493432998657,
1.4332410097122192,
-0.17354242503643036,
0.26637914776802063,
1.9964344501495361,
-0.2026226967573166,
-1.0046178102493286,
1.2048265933990479,
-2.4078547954559326,
0.15919072926044464,
2.057342767715454,
0.2915995419025421,
0.08237925916910172,
-1.4065937995910645,
-0.6566792130470276,
-0.2889803349971771,
-0.43177077174186707,
-1.2126868963241577,
0.5420443415641785,
-0.3322942852973938,
-0.7989603877067566,
-1.4294886589050293,
0.21874544024467468,
-1.0786625146865845,
-1.6343810558319092,
0.17432256042957306,
1.8816293478012085,
2.0486223697662354,
-0.7394067049026489,
1.573058009147644,
-0.31703507900238037,
0.22263431549072266,
1.243443250656128,
1.2356737852096558,
3.1221001148223877,
1.9922723770141602,
-1.2340881824493408,
0.646368145942688,
-0.11059167981147766,
-0.4361998736858368,
1.1215158700942993,
-1.2102861404418945,
1.3687944412231445,
-0.09323257952928543,
-1.2024167776107788,
-1.1870838403701782,
1.0016605854034424,
0.5748013257980347,
0.009488558396697044,
-0.4487866461277008,
1.2264584302902222,
0.07229287922382355,
1.2745572328567505,
0.46248283982276917,
-0.34409573674201965,
0.6241487860679626,
-0.4325432777404785,
-0.5262516140937805,
1.5442783832550049,
0.179292693734169,
-1.4374271631240845,
-2.2231285572052,
-0.3053877353668213,
-0.8388472199440002,
0.00040428899228572845,
-0.6317750811576843,
-0.9766393899917603,
1.6148477792739868,
0.3497506380081177,
-1.2448102235794067,
-0.23902662098407745,
-0.3667314648628235,
-0.594429612159729,
2.7342543601989746,
-1.300215244293213,
-0.27645888924598694,
-0.9477863311767578,
-0.6512316465377808,
1.6509292125701904,
-1.2321795225143433,
-0.2519448697566986,
-1.01023268699646,
-0.6210387349128723,
-1.2560739517211914,
-0.5465933084487915,
-0.0340912900865078,
-0.9389357566833496,
0.8830350041389465,
0.15667535364627838,
-1.1915464401245117,
-0.31377720832824707,
-0.9291141033172607,
0.8733447790145874,
-0.015085543505847454,
0.20138490200042725,
1.7835066318511963,
0.31587862968444824,
-0.43602800369262695,
0.7711191177368164,
1.109412670135498,
0.6569945216178894,
-0.7114329934120178,
0.21549704670906067,
-0.639967679977417,
0.33332860469818115,
-1.166379690170288,
0.3617279529571533,
-2.940078020095825,
0.6160194873809814,
-0.02417723834514618,
-0.05372264236211777,
-0.05303379148244858,
-1.2435613870620728,
1.1592228412628174,
2.5316905975341797,
-1.1599867343902588,
0.5330909490585327,
0.36675530672073364,
1.1973267793655396,
-1.599210262298584,
0.36012494564056396,
-0.4399902820587158,
2.129509449005127,
0.2263702005147934,
1.2296056747436523,
-0.43472930788993835,
-2.341657876968384,
0.6637955904006958,
-1.2730214595794678,
-1.1811329126358032,
0.7181239128112793,
-0.9457309246063232,
0.10698641091585159,
-1.3595820665359497,
-0.2595587968826294,
-0.8108721971511841,
-1.1869735717773438,
0.6704214215278625,
0.18699075281620026,
0.4101960062980652,
-0.5451969504356384,
0.3398195207118988,
-2.217848062515259,
-1.3330833911895752,
-0.23853689432144165,
-0.9883919358253479,
0.46435925364494324,
-0.3864234387874603,
0.723870038986206,
-0.19503958523273468,
0.05545087903738022,
0.3346658945083618,
1.426460862159729,
3.35093355178833,
0.08663385361433029,
0.32711538672447205,
-0.1662033498287201,
-0.9254851341247559,
1.4863619804382324,
0.9310508370399475,
-0.14118877053260803,
-0.47848594188690186,
-1.1359503269195557,
1.2681918144226074,
1.9578182697296143,
0.964282214641571,
-0.0029162075370550156,
-0.7668343782424927,
-0.6691989302635193,
-0.06934203952550888,
0.14624114334583282,
0.5122901201248169,
0.8726454973220825,
0.06489525735378265,
0.11245114356279373,
1.450420618057251,
1.1771173477172852,
-0.4693325459957123,
0.3176693618297577,
-0.8384205102920532,
-0.47165635228157043,
0.4588860869407654,
0.24981200695037842,
-0.033401016145944595,
0.291052907705307,
-0.9630688428878784,
-0.1935492306947708,
-0.43424469232559204,
-0.949222981929779,
-0.6995052099227905,
-0.41822606325149536,
-0.4140550494194031,
1.6399096250534058,
0.17909683287143707,
-0.5281315445899963,
-0.013116162270307541,
-0.7296276092529297,
-0.042648397386074066,
-1.1368954181671143,
0.2380051612854004,
-0.10869992524385452,
-0.12224888801574707,
-0.1499549001455307,
1.7764824628829956,
-0.9104666113853455,
-2.083815336227417,
0.18810027837753296,
0.21468615531921387,
-0.19710776209831238,
0.2825556993484497,
1.636252760887146,
0.49497872591018677,
1.511309266090393,
1.299277901649475,
0.9824410676956177,
-0.6532245874404907,
-1.3590373992919922,
0.7358136177062988,
1.0105249881744385,
-1.4153169393539429,
0.7653864622116089,
0.0059120506048202515,
-0.4785408079624176,
0.6788317561149597,
1.2529094219207764,
0.5003352165222168,
-2.073185920715332,
0.8337283730506897,
-1.0196824073791504,
0.7778860330581665,
0.687258780002594,
0.6341608166694641,
0.20434285700321198,
0.8310564160346985,
-1.180774211883545,
-1.1132886409759521,
-0.725138783454895,
-0.7020883560180664,
1.9726675748825073,
-0.3179275691509247,
0.5739007592201233,
-0.20499758422374725,
-1.3709590435028076,
0.017508992925286293,
0.6558765172958374,
0.34706389904022217,
-0.4277585744857788,
0.7986032366752625,
-0.762241005897522,
-1.2146183252334595,
-1.410323977470398,
-0.43737202882766724,
-1.07272207736969,
-1.01042902469635,
1.0790698528289795,
0.7350091934204102,
0.2288089394569397,
1.8366214036941528,
0.579835832118988,
0.29235342144966125,
-2.6122186183929443,
0.9967628717422485,
0.22806115448474884,
-0.03857649862766266,
0.8437507152557373,
0.24389702081680298,
1.0736430883407593,
0.00009798351675271988,
0.5092971324920654,
-2.3786094188690186,
2.292348861694336,
-0.23931849002838135,
0.6711820363998413,
0.019374055787920952,
-0.09978099167346954,
1.0775611400604248,
0.6020369529724121,
0.6547490954399109,
-1.0470515489578247,
0.7032753229141235,
-0.5939795970916748,
1.289718747138977,
0.8580099940299988,
-0.785834789276123,
-0.0647682398557663,
1.2956478595733643,
0.45721426606178284,
-0.5334159135818481,
-0.9314931631088257,
-1.0642616748809814,
0.9375760555267334,
1.6632041931152344,
-0.09586623311042786,
-0.04089934378862381,
0.8207515478134155,
0.6526916027069092,
-1.3223484754562378,
0.06194198131561279,
-0.7181742191314697,
-0.7226234674453735,
1.5229676961898804,
2.0825297832489014,
-0.15675637125968933,
-0.21801993250846863,
-0.7181618213653564,
-1.303465485572815,
0.7057399153709412,
-0.08454877138137817,
0.07320751249790192,
0.6206866502761841,
-0.5469963550567627,
0.9519345164299011,
0.8332300782203674,
0.890402615070343,
0.18421414494514465,
0.2312939614057541,
0.3720000684261322,
-0.33420342206954956,
-1.2019357681274414,
-0.24655109643936157,
-0.9993166327476501,
-2.5993082523345947,
0.4401411712169647,
-0.15443389117717743,
-1.3636798858642578,
0.04804083704948425,
-1.0458478927612305,
0.9548082947731018,
-0.5497004985809326,
-1.1285866498947144,
-1.492067575454712,
0.07712852209806442,
-0.08160728216171265,
0.9161662459373474,
-1.5962311029434204,
-0.11612749844789505,
1.2998344898223877,
0.905302107334137,
-0.6949282884597778,
1.1393598318099976,
0.2765551507472992,
1.0223251581192017,
0.8004650473594666,
-0.36835166811943054,
0.6099039912223816,
0.057775259017944336,
-1.3702472448349,
0.5118402242660522,
1.161612868309021,
0.25127407908439636,
1.5377132892608643,
-0.6369185447692871,
-0.07489747554063797,
0.43556877970695496,
-0.6598762273788452,
-0.43065428733825684,
-0.49863868951797485,
0.7044742107391357,
-0.059762317687273026,
-0.8690316081047058,
0.053008392453193665,
-0.08602244406938553,
-0.1944335252046585,
0.1129060760140419,
-1.4900660514831543,
-0.10857226699590683,
-0.3305414021015167,
-0.6443291902542114,
-1.3088690042495728,
-0.022847730666399002,
1.4261952638626099,
-0.8287856578826904,
-0.22520457208156586,
0.39243265986442566,
0.4298798441886902,
0.5205701589584351,
0.6849004030227661,
-0.6297410726547241,
-0.29111358523368835,
-0.18237313628196716,
-0.29901835322380066,
0.35390663146972656,
1.4076448678970337,
-0.12418949604034424,
-0.9984703063964844,
0.7447238564491272,
-0.3212330937385559,
0.07376054674386978,
1.917019248008728,
0.11616790294647217,
-0.8219470381736755,
0.2730754315853119,
-0.7509710788726807,
1.9687995910644531,
1.657674789428711,
1.3370026350021362,
-0.22311443090438843,
-0.9359429478645325,
0.6253951787948608,
-0.39307111501693726,
-0.38142654299736023,
0.8846217393875122,
0.43858301639556885,
-0.2205999195575714,
-1.2919963598251343,
0.7201113104820251,
1.222514271736145,
-0.8710130453109741,
-0.8461534380912781,
0.21387141942977905,
-0.7629655599594116,
1.0719643831253052,
0.6774079203605652,
0.39983507990837097,
0.24147549271583557,
1.606113314628601,
0.8039195537567139,
-0.5606020092964172,
0.5551372170448303,
0.5044341087341309,
-0.25143003463745117,
-2.1217989921569824,
-1.1059330701828003,
0.38332727551460266,
-0.605298638343811,
-1.6160612106323242,
1.3816465139389038,
-1.0602988004684448,
-1.016188621520996,
0.5362488627433777,
0.04867292568087578,
1.4239052534103394,
0.3737947940826416,
1.5541837215423584,
2.035438299179077,
0.8507381081581116,
0.4612227976322174,
1.2828835248947144,
-0.18621918559074402,
-0.5037094354629517,
1.8264073133468628,
-0.45663192868232727,
0.45534732937812805,
1.1414353847503662,
-0.3212839365005493,
-1.03104567527771,
-0.7355055809020996,
-1.1753686666488647,
-0.6607353091239929,
1.1003668308258057,
0.16910292208194733,
-1.0955718755722046,
0.24426904320716858,
1.4897537231445312,
0.12844321131706238,
-0.3664528727531433,
0.6440498232841492,
0.3222862184047699,
-0.7857758402824402,
0.004406985826790333,
-0.9806360602378845,
0.5440222024917603,
-0.2870256006717682,
-0.32590872049331665,
0.32279351353645325,
0.39824730157852173,
1.3347840309143066,
-0.045614153146743774,
0.17215335369110107,
1.1572118997573853,
-1.3649075031280518,
1.4894636869430542,
-0.6449925899505615,
0.2688893973827362,
-2.2688262462615967,
1.2844533920288086,
-0.8029929399490356,
1.9737588167190552,
-2.69169020652771,
0.45761406421661377,
-0.6762818694114685,
-0.45407700538635254,
0.3321778178215027,
-0.35529905557632446,
0.07486776262521744,
-0.14165228605270386,
-1.15927255153656,
-0.0519951730966568,
-0.7132949829101562,
0.5527268052101135,
1.112611174583435,
1.2983803749084473,
-1.1032793521881104,
-0.25698357820510864,
-1.7158437967300415,
-0.16393354535102844,
-0.8286408185958862,
0.4721251428127289,
-2.0392322540283203,
-0.20911775529384613,
-1.8904272317886353,
-2.339359998703003,
-1.1872934103012085,
-0.8320444822311401,
1.1487255096435547,
0.16628381609916687,
-0.8474240303039551,
1.24372136592865,
-0.2978067398071289,
-1.8446353673934937,
1.0334973335266113,
-2.079883337020874
] |
https://github.com/huggingface/datasets/issues/6079 | Iterating over DataLoader based on HF datasets is stuck forever | Thanks @mariosasko for your prompt response, here's the stack trace:
```
KeyboardInterrupt Traceback (most recent call last)
Cell In[12], line 4
2 t = time.time()
3 iter_ = 0
----> 4 for batch in train_dataloader:
5 #batch_proc = streaming_obj.collect_streaming_data_batch(batch)
6 iter_ += 1
8 if iter_ == 1:
File ~/anaconda3/envs/pytorch_p310/lib/python3.10/site-packages/torch/utils/data/dataloader.py:634, in _BaseDataLoaderIter.__next__(self)
631 if self._sampler_iter is None:
632 # TODO(https://github.com/pytorch/pytorch/issues/76750)
633 self._reset() # type: ignore[call-arg]
--> 634 data = self._next_data()
635 self._num_yielded += 1
636 if self._dataset_kind == _DatasetKind.Iterable and \
637 self._IterableDataset_len_called is not None and \
638 self._num_yielded > self._IterableDataset_len_called:
File ~/anaconda3/envs/pytorch_p310/lib/python3.10/site-packages/torch/utils/data/dataloader.py:678, in _SingleProcessDataLoaderIter._next_data(self)
676 def _next_data(self):
677 index = self._next_index() # may raise StopIteration
--> 678 data = self._dataset_fetcher.fetch(index) # may raise StopIteration
679 if self._pin_memory:
680 data = _utils.pin_memory.pin_memory(data, self._pin_memory_device)
File ~/anaconda3/envs/pytorch_p310/lib/python3.10/site-packages/torch/utils/data/_utils/fetch.py:32, in _IterableDatasetFetcher.fetch(self, possibly_batched_index)
30 for _ in possibly_batched_index:
31 try:
---> 32 data.append(next(self.dataset_iter))
33 except StopIteration:
34 self.ended = True
File ~/anaconda3/envs/pytorch_p310/lib/python3.10/site-packages/datasets/iterable_dataset.py:1353, in IterableDataset.__iter__(self)
1350 yield formatter.format_row(pa_table)
1351 return
-> 1353 for key, example in ex_iterable:
1354 if self.features:
1355 # `IterableDataset` automatically fills missing columns with None.
1356 # This is done with `_apply_feature_types_on_example`.
1357 example = _apply_feature_types_on_example(
1358 example, self.features, token_per_repo_id=self._token_per_repo_id
1359 )
File ~/anaconda3/envs/pytorch_p310/lib/python3.10/site-packages/datasets/iterable_dataset.py:956, in BufferShuffledExamplesIterable.__iter__(self)
954 # this is the shuffle buffer that we keep in memory
955 mem_buffer = []
--> 956 for x in self.ex_iterable:
957 if len(mem_buffer) == buffer_size: # if the buffer is full, pick and example from it
958 i = next(indices_iterator)
File ~/anaconda3/envs/pytorch_p310/lib/python3.10/site-packages/datasets/iterable_dataset.py:296, in ShuffledDataSourcesArrowExamplesIterable.__iter__(self)
294 for key, pa_table in self.generate_tables_fn(**kwargs_with_shuffled_shards):
295 for pa_subtable in pa_table.to_reader(max_chunksize=config.ARROW_READER_BATCH_SIZE_IN_DATASET_ITER):
--> 296 formatted_batch = formatter.format_batch(pa_subtable)
297 for example in _batch_to_examples(formatted_batch):
298 yield key, example
File ~/anaconda3/envs/pytorch_p310/lib/python3.10/site-packages/datasets/formatting/formatting.py:448, in PythonFormatter.format_batch(self, pa_table)
446 if self.lazy:
447 return LazyBatch(pa_table, self)
--> 448 batch = self.python_arrow_extractor().extract_batch(pa_table)
449 batch = self.python_features_decoder.decode_batch(batch)
450 return batch
File ~/anaconda3/envs/pytorch_p310/lib/python3.10/site-packages/datasets/formatting/formatting.py:150, in PythonArrowExtractor.extract_batch(self, pa_table)
149 def extract_batch(self, pa_table: pa.Table) -> dict:
--> 150 return pa_table.to_pydict()
KeyboardInterrupt:
```
| ### Describe the bug
I am using Amazon Sagemaker notebook (Amazon Linux 2) with python 3.10 based Conda environment.
I have a dataset in parquet format locally. When I try to iterate over it, the loader is stuck forever. Note that the same code is working for python 3.6 based conda environment seamlessly. What should be my next steps here?
### Steps to reproduce the bug
```
train_dataset = load_dataset(
"parquet", data_files = {'train': tr_data_path + '*.parquet'},
split = 'train',
collate_fn = streaming_data_collate_fn,
streaming = True
).with_format('torch')
train_dataloader = DataLoader(train_dataset, batch_size = 2, num_workers = 0)
t = time.time()
iter_ = 0
for batch in train_dataloader:
iter_ += 1
if iter_ == 1000:
break
print (time.time() - t)
```
### Expected behavior
The snippet should work normally and load the next batch of data.
### Environment info
datasets: '2.14.0'
pyarrow: '12.0.0'
torch: '2.0.0'
Python: 3.10.10 | packaged by conda-forge | (main, Mar 24 2023, 20:08:06) [GCC 11.3.0]
!uname -r
5.10.178-162.673.amzn2.x86_64 | 11 | 308 | Iterating over DataLoader based on HF datasets is stuck forever
### Describe the bug
I am using Amazon Sagemaker notebook (Amazon Linux 2) with python 3.10 based Conda environment.
I have a dataset in parquet format locally. When I try to iterate over it, the loader is stuck forever. Note that the same code is working for python 3.6 based conda environment seamlessly. What should be my next steps here?
### Steps to reproduce the bug
```
train_dataset = load_dataset(
"parquet", data_files = {'train': tr_data_path + '*.parquet'},
split = 'train',
collate_fn = streaming_data_collate_fn,
streaming = True
).with_format('torch')
train_dataloader = DataLoader(train_dataset, batch_size = 2, num_workers = 0)
t = time.time()
iter_ = 0
for batch in train_dataloader:
iter_ += 1
if iter_ == 1000:
break
print (time.time() - t)
```
### Expected behavior
The snippet should work normally and load the next batch of data.
### Environment info
datasets: '2.14.0'
pyarrow: '12.0.0'
torch: '2.0.0'
Python: 3.10.10 | packaged by conda-forge | (main, Mar 24 2023, 20:08:06) [GCC 11.3.0]
!uname -r
5.10.178-162.673.amzn2.x86_64
Thanks @mariosasko for your prompt response, here's the stack trace:
```
KeyboardInterrupt Traceback (most recent call last)
Cell In[12], line 4
2 t = time.time()
3 iter_ = 0
----> 4 for batch in train_dataloader:
5 #batch_proc = streaming_obj.collect_streaming_data_batch(batch)
6 iter_ += 1
8 if iter_ == 1:
File ~/anaconda3/envs/pytorch_p310/lib/python3.10/site-packages/torch/utils/data/dataloader.py:634, in _BaseDataLoaderIter.__next__(self)
631 if self._sampler_iter is None:
632 # TODO(https://github.com/pytorch/pytorch/issues/76750)
633 self._reset() # type: ignore[call-arg]
--> 634 data = self._next_data()
635 self._num_yielded += 1
636 if self._dataset_kind == _DatasetKind.Iterable and \
637 self._IterableDataset_len_called is not None and \
638 self._num_yielded > self._IterableDataset_len_called:
File ~/anaconda3/envs/pytorch_p310/lib/python3.10/site-packages/torch/utils/data/dataloader.py:678, in _SingleProcessDataLoaderIter._next_data(self)
676 def _next_data(self):
677 index = self._next_index() # may raise StopIteration
--> 678 data = self._dataset_fetcher.fetch(index) # may raise StopIteration
679 if self._pin_memory:
680 data = _utils.pin_memory.pin_memory(data, self._pin_memory_device)
File ~/anaconda3/envs/pytorch_p310/lib/python3.10/site-packages/torch/utils/data/_utils/fetch.py:32, in _IterableDatasetFetcher.fetch(self, possibly_batched_index)
30 for _ in possibly_batched_index:
31 try:
---> 32 data.append(next(self.dataset_iter))
33 except StopIteration:
34 self.ended = True
File ~/anaconda3/envs/pytorch_p310/lib/python3.10/site-packages/datasets/iterable_dataset.py:1353, in IterableDataset.__iter__(self)
1350 yield formatter.format_row(pa_table)
1351 return
-> 1353 for key, example in ex_iterable:
1354 if self.features:
1355 # `IterableDataset` automatically fills missing columns with None.
1356 # This is done with `_apply_feature_types_on_example`.
1357 example = _apply_feature_types_on_example(
1358 example, self.features, token_per_repo_id=self._token_per_repo_id
1359 )
File ~/anaconda3/envs/pytorch_p310/lib/python3.10/site-packages/datasets/iterable_dataset.py:956, in BufferShuffledExamplesIterable.__iter__(self)
954 # this is the shuffle buffer that we keep in memory
955 mem_buffer = []
--> 956 for x in self.ex_iterable:
957 if len(mem_buffer) == buffer_size: # if the buffer is full, pick and example from it
958 i = next(indices_iterator)
File ~/anaconda3/envs/pytorch_p310/lib/python3.10/site-packages/datasets/iterable_dataset.py:296, in ShuffledDataSourcesArrowExamplesIterable.__iter__(self)
294 for key, pa_table in self.generate_tables_fn(**kwargs_with_shuffled_shards):
295 for pa_subtable in pa_table.to_reader(max_chunksize=config.ARROW_READER_BATCH_SIZE_IN_DATASET_ITER):
--> 296 formatted_batch = formatter.format_batch(pa_subtable)
297 for example in _batch_to_examples(formatted_batch):
298 yield key, example
File ~/anaconda3/envs/pytorch_p310/lib/python3.10/site-packages/datasets/formatting/formatting.py:448, in PythonFormatter.format_batch(self, pa_table)
446 if self.lazy:
447 return LazyBatch(pa_table, self)
--> 448 batch = self.python_arrow_extractor().extract_batch(pa_table)
449 batch = self.python_features_decoder.decode_batch(batch)
450 return batch
File ~/anaconda3/envs/pytorch_p310/lib/python3.10/site-packages/datasets/formatting/formatting.py:150, in PythonArrowExtractor.extract_batch(self, pa_table)
149 def extract_batch(self, pa_table: pa.Table) -> dict:
--> 150 return pa_table.to_pydict()
KeyboardInterrupt:
```
| [
-1.2974315881729126,
-1.0190706253051758,
-0.664889931678772,
1.5647151470184326,
-0.20822866261005402,
-1.1625877618789673,
0.14594830572605133,
-0.9586323499679565,
1.6330128908157349,
-0.8328601121902466,
0.23161981999874115,
-1.5734355449676514,
0.07717040926218033,
-0.5745692253112793,
-0.6595275402069092,
-0.8466547727584839,
-0.39662471413612366,
-0.7842761278152466,
1.2154903411865234,
2.4511895179748535,
1.237916111946106,
-1.4425482749938965,
2.78933048248291,
0.7293189764022827,
-0.20174670219421387,
-1.0366055965423584,
0.4464857578277588,
-0.0007076840847730637,
-1.3154724836349487,
-0.4695713222026825,
-0.9860295057296753,
-0.08348206430673599,
-0.5744655132293701,
-0.41258174180984497,
0.002774057909846306,
0.3928353488445282,
-0.28975141048431396,
-0.4741595983505249,
-0.5439647436141968,
-0.7093861103057861,
0.43302735686302185,
-0.39043575525283813,
0.9140236377716064,
-0.3093401789665222,
1.8050541877746582,
-0.4824230968952179,
0.4806284010410309,
0.7403391599655151,
1.2507603168487549,
0.19071391224861145,
-0.047029878944158554,
0.37540730834007263,
0.41215452551841736,
-0.02031799592077732,
0.5861753225326538,
1.1431115865707397,
0.6457462310791016,
0.44389820098876953,
0.6579923629760742,
-2.2479546070098877,
1.3083926439285278,
-1.0043361186981201,
0.2921927571296692,
1.3213930130004883,
-1.0259860754013062,
0.4218312203884125,
-1.7281049489974976,
-0.011900633573532104,
0.6921530961990356,
-2.2300031185150146,
0.32679232954978943,
-1.3494404554367065,
-0.5030272006988525,
1.0448921918869019,
0.35023263096809387,
-1.1999526023864746,
0.07853835076093674,
-0.48854026198387146,
1.1119210720062256,
0.3932235538959503,
1.0699409246444702,
-1.6642804145812988,
-0.07834865152835846,
-0.2794768810272217,
0.12058286368846893,
-1.3335446119308472,
-1.5475013256072998,
0.5616384744644165,
0.7034008502960205,
0.5724160671234131,
-0.11761819571256638,
1.1313377618789673,
-1.0776281356811523,
0.7713961601257324,
-1.1007808446884155,
-1.7119488716125488,
-1.4597465991973877,
-2.4179627895355225,
-2.292955160140991,
0.6830970048904419,
-0.39806365966796875,
-0.5272600650787354,
2.1069302558898926,
-1.0400196313858032,
-1.705418348312378,
1.1887396574020386,
0.17578700184822083,
0.022946961224079132,
2.3559136390686035,
0.1920415610074997,
-0.765386700630188,
0.46486955881118774,
-0.8092259168624878,
0.6966451406478882,
-0.3308613896369934,
1.3453669548034668,
0.38290274143218994,
-1.0034589767456055,
1.5773460865020752,
-0.3131062686443329,
0.585328221321106,
-0.6357043981552124,
-0.508878231048584,
-0.7354837656021118,
0.24571484327316284,
1.9951517581939697,
-0.25977861881256104,
1.4806616306304932,
-0.3340049386024475,
-1.5114643573760986,
-1.6016238927841187,
0.931921124458313,
0.43781712651252747,
-0.7742691040039062,
0.15491105616092682,
-0.3656656742095947,
0.17815904319286346,
-0.09961570054292679,
1.1182377338409424,
1.275490403175354,
0.6725599765777588,
-0.39291298389434814,
-0.9345260858535767,
0.22334550321102142,
-0.17127320170402527,
-0.6492434740066528,
-1.7915822267532349,
-0.34437307715415955,
0.03302781656384468,
0.6869486570358276,
-1.214296817779541,
1.6929903030395508,
0.9106225967407227,
1.9142582416534424,
1.0374977588653564,
-0.32771873474121094,
1.5117660760879517,
0.15192483365535736,
1.8245221376419067,
-0.4701645076274872,
0.6367555856704712,
-0.39354103803634644,
-1.1332824230194092,
0.7346843481063843,
-0.33168160915374756,
-1.9986943006515503,
-0.6729686260223389,
-0.7714685201644897,
-0.21216441690921783,
-0.7946441173553467,
0.8935492038726807,
-0.280135840177536,
-1.4753475189208984,
0.29628786444664,
-0.7360696792602539,
0.20007754862308502,
-1.2035003900527954,
0.38214147090911865,
0.6870520114898682,
-0.55238938331604,
0.1074657067656517,
-0.2864062786102295,
-1.257946491241455,
-0.4712546169757843,
0.3664557933807373,
1.8429837226867676,
-0.7364523410797119,
0.8943115472793579,
1.1183193922042847,
-0.6793093681335449,
0.022726833820343018,
0.286374032497406,
-0.23834820091724396,
0.8519396781921387,
-1.0283764600753784,
-0.46608999371528625,
1.2272589206695557,
-0.3373734652996063,
-0.5997359752655029,
1.488410472869873,
0.7421954870223999,
-1.0281431674957275,
-0.2913720905780792,
-0.08610827475786209,
-0.7972085475921631,
0.1255784034729004,
-1.5994362831115723,
-0.1683555394411087,
0.4468134343624115,
-1.5731736421585083,
-0.43235689401626587,
-0.20999504625797272,
1.4142119884490967,
-0.09522038698196411,
1.500401496887207,
-0.3596504032611847,
-0.16738206148147583,
-0.2917817234992981,
-0.39426255226135254,
0.19034990668296814,
-0.18658055365085602,
-0.5768311023712158,
0.13995225727558136,
-0.7734682559967041,
0.3371564447879791,
1.4466079473495483,
0.3223623037338257,
0.02454768866300583,
0.4766293168067932,
1.0540162324905396,
0.43001917004585266,
-0.020220180973410606,
-0.8831686973571777,
-1.5278433561325073,
1.9414390325546265,
-1.46524977684021,
2.065664291381836,
0.7966251373291016,
-0.03148699179291725,
-1.7717210054397583,
-1.8430423736572266,
1.3789745569229126,
1.0823893547058105,
2.3323378562927246,
0.5119791030883789,
0.3722262978553772,
-0.8693242073059082,
-0.6737273931503296,
0.2784413993358612,
-0.9613075256347656,
-0.7678860425949097,
0.18558314442634583,
2.46087384223938,
1.7614370584487915,
-0.35076820850372314,
-0.12249372899532318,
-0.9562599658966064,
1.4128732681274414,
-0.16201330721378326,
0.2993030250072479,
1.9830257892608643,
-0.2261635810136795,
-0.9870784282684326,
1.237268090248108,
-2.425037145614624,
0.1866775006055832,
2.0674188137054443,
0.2805667817592621,
0.12595194578170776,
-1.3875333070755005,
-0.6270977258682251,
-0.3028932809829712,
-0.4568064510822296,
-1.2132331132888794,
0.528445839881897,
-0.3495781421661377,
-0.7751508951187134,
-1.4387212991714478,
0.21036259829998016,
-1.0730477571487427,
-1.6561133861541748,
0.18457263708114624,
1.8898676633834839,
2.0517802238464355,
-0.77681565284729,
1.5526061058044434,
-0.3596724569797516,
0.21321387588977814,
1.244329810142517,
1.239706039428711,
3.1417713165283203,
1.9815956354141235,
-1.2584534883499146,
0.6730904579162598,
-0.15262708067893982,
-0.4433174431324005,
1.0921788215637207,
-1.2360126972198486,
1.3534902334213257,
-0.12275800853967667,
-1.2071703672409058,
-1.1936264038085938,
0.9830225706100464,
0.5702880620956421,
-0.0039474014192819595,
-0.46414196491241455,
1.1965686082839966,
0.0817684680223465,
1.291514277458191,
0.4820803105831146,
-0.3591058850288391,
0.6448630094528198,
-0.4228191077709198,
-0.4979744553565979,
1.542911171913147,
0.16641990840435028,
-1.445759892463684,
-2.2055087089538574,
-0.25104618072509766,
-0.8699507713317871,
0.007389534264802933,
-0.6748964786529541,
-0.9920562505722046,
1.6028532981872559,
0.32562512159347534,
-1.2264509201049805,
-0.2215774804353714,
-0.3327009379863739,
-0.5217937231063843,
2.703495979309082,
-1.2969717979431152,
-0.27301424741744995,
-0.9633967876434326,
-0.6414002180099487,
1.6460157632827759,
-1.2173091173171997,
-0.2823849320411682,
-0.9916144609451294,
-0.6121084690093994,
-1.2310702800750732,
-0.49312272667884827,
-0.013487457297742367,
-0.8998270034790039,
0.8830004930496216,
0.1841505467891693,
-1.2417614459991455,
-0.32991838455200195,
-0.9354161024093628,
0.9293602705001831,
-0.05915849655866623,
0.1919061243534088,
1.7894272804260254,
0.26145729422569275,
-0.4672712981700897,
0.7624393701553345,
1.1166250705718994,
0.6360664367675781,
-0.6843897104263306,
0.20604147017002106,
-0.6426552534103394,
0.37114253640174866,
-1.2035964727401733,
0.34845468401908875,
-2.960057258605957,
0.6312177181243896,
-0.009770376607775688,
-0.041609473526477814,
-0.050903063267469406,
-1.2995798587799072,
1.1160783767700195,
2.549694299697876,
-1.152135968208313,
0.5242035388946533,
0.4052266478538513,
1.2138795852661133,
-1.5841577053070068,
0.3113504946231842,
-0.44616955518722534,
2.10622501373291,
0.21061865985393524,
1.2435986995697021,
-0.4241533577442169,
-2.355393648147583,
0.6719157695770264,
-1.2532589435577393,
-1.1517608165740967,
0.740466833114624,
-0.951149582862854,
0.12970459461212158,
-1.3532981872558594,
-0.27820056676864624,
-0.8494549989700317,
-1.1703068017959595,
0.6605517864227295,
0.19532738626003265,
0.4015110731124878,
-0.5882132053375244,
0.31360840797424316,
-2.198518991470337,
-1.3115651607513428,
-0.20542481541633606,
-0.9809938669204712,
0.45399603247642517,
-0.4049965441226959,
0.6766836643218994,
-0.17170177400112152,
0.027229156345129013,
0.31388023495674133,
1.4174591302871704,
3.3344380855560303,
0.09112998098134995,
0.3093468248844147,
-0.19747653603553772,
-0.9254173040390015,
1.4991672039031982,
0.8865240812301636,
-0.14270009100437164,
-0.4922974109649658,
-1.1263760328292847,
1.2723448276519775,
1.9096494913101196,
0.9586502313613892,
0.02348141372203827,
-0.7994235754013062,
-0.7034412622451782,
-0.07220598310232162,
0.13964134454727173,
0.4972018897533417,
0.9051336050033569,
0.051836639642715454,
0.10717020183801651,
1.4481327533721924,
1.1444321870803833,
-0.45602989196777344,
0.3242008686065674,
-0.8552771806716919,
-0.47204646468162537,
0.462861567735672,
0.2674572169780731,
-0.01140761747956276,
0.2616954743862152,
-0.9798003435134888,
-0.19734638929367065,
-0.4073490500450134,
-0.914859414100647,
-0.6889843940734863,
-0.41088101267814636,
-0.3630508482456207,
1.620431661605835,
0.16484655439853668,
-0.5099267959594727,
-0.021090425550937653,
-0.742570161819458,
-0.08113440871238708,
-1.1182055473327637,
0.26265057921409607,
-0.12230090796947479,
-0.10812405496835709,
-0.16154897212982178,
1.7069978713989258,
-0.9098165035247803,
-2.082085609436035,
0.18326891958713531,
0.19539563357830048,
-0.2030942738056183,
0.2828911244869232,
1.6777479648590088,
0.4934982359409332,
1.474306583404541,
1.3193210363388062,
0.9977390766143799,
-0.6242878437042236,
-1.341513752937317,
0.7503904104232788,
0.9886714220046997,
-1.4026501178741455,
0.8068922758102417,
-0.03409628942608833,
-0.5097527503967285,
0.6658357381820679,
1.281624674797058,
0.49682942032814026,
-2.0842509269714355,
0.8261981010437012,
-1.0345215797424316,
0.775672197341919,
0.7252103090286255,
0.6593869924545288,
0.21586906909942627,
0.8628050088882446,
-1.1530572175979614,
-1.1376219987869263,
-0.6996839046478271,
-0.7225641012191772,
1.9848476648330688,
-0.3296138048171997,
0.5628201961517334,
-0.198027566075325,
-1.3615005016326904,
0.009760832414031029,
0.668104887008667,
0.3455798327922821,
-0.4636423587799072,
0.7962764501571655,
-0.7743848562240601,
-1.1914671659469604,
-1.3486230373382568,
-0.46238648891448975,
-1.0717453956604004,
-0.9823184013366699,
1.0737836360931396,
0.7329951524734497,
0.2999485731124878,
1.8899658918380737,
0.6049156188964844,
0.2987484931945801,
-2.6060850620269775,
0.9720355272293091,
0.21737666428089142,
-0.05081312730908394,
0.8372375965118408,
0.25154948234558105,
1.0437827110290527,
0.024465616792440414,
0.5154883861541748,
-2.3992927074432373,
2.3001954555511475,
-0.2276591658592224,
0.657784104347229,
-0.011395727284252644,
-0.1130533516407013,
1.0781478881835938,
0.6164729595184326,
0.6271088123321533,
-1.0225616693496704,
0.7308287620544434,
-0.5704690217971802,
1.2804566621780396,
0.8171708583831787,
-0.8166124820709229,
-0.06528323888778687,
1.2711116075515747,
0.432098388671875,
-0.5609716176986694,
-0.92247474193573,
-1.0596727132797241,
0.9370721578598022,
1.6832667589187622,
-0.06290261447429657,
-0.030089907348155975,
0.8181744813919067,
0.6693830490112305,
-1.2592216730117798,
0.03864346444606781,
-0.7042809724807739,
-0.7071369886398315,
1.5619490146636963,
2.060899019241333,
-0.1671404242515564,
-0.20244130492210388,
-0.7099497318267822,
-1.3029723167419434,
0.7419188022613525,
-0.08203078806400299,
0.05741816759109497,
0.6271876096725464,
-0.5704121589660645,
0.9741095304489136,
0.7935813665390015,
0.8971580266952515,
0.16694359481334686,
0.2219746708869934,
0.4009399712085724,
-0.3587762117385864,
-1.2118083238601685,
-0.25831007957458496,
-1.0014817714691162,
-2.544210195541382,
0.4239689111709595,
-0.12097016721963882,
-1.3572509288787842,
0.07000209391117096,
-1.0495102405548096,
0.9120780229568481,
-0.5535584688186646,
-1.1449333429336548,
-1.4706090688705444,
0.08204201608896255,
-0.10747477412223816,
0.9028313159942627,
-1.6043668985366821,
-0.0987391248345375,
1.2640069723129272,
0.9058187007904053,
-0.6740248203277588,
1.1002376079559326,
0.2887752652168274,
1.043515682220459,
0.840786337852478,
-0.371063232421875,
0.5943365097045898,
0.05355599522590637,
-1.3454481363296509,
0.5073436498641968,
1.1872164011001587,
0.2508043944835663,
1.5639854669570923,
-0.6105499267578125,
-0.08315184712409973,
0.4376988112926483,
-0.6721184253692627,
-0.45088446140289307,
-0.5130777359008789,
0.7196526527404785,
-0.0630444884300232,
-0.8875824213027954,
-0.011190256103873253,
-0.12696465849876404,
-0.20857401192188263,
0.0945534035563469,
-1.5000231266021729,
-0.07255498319864273,
-0.34967562556266785,
-0.6303430795669556,
-1.3228659629821777,
-0.019764654338359833,
1.4293354749679565,
-0.8177623748779297,
-0.2548235058784485,
0.3891848623752594,
0.40680456161499023,
0.5039209127426147,
0.6839631795883179,
-0.6587836742401123,
-0.29087695479393005,
-0.15814559161663055,
-0.3228982388973236,
0.3624856173992157,
1.4135997295379639,
-0.10769721120595932,
-0.9860594272613525,
0.704243540763855,
-0.3554786443710327,
0.08115480095148087,
1.9146473407745361,
0.10111267864704132,
-0.7790087461471558,
0.27839961647987366,
-0.7783399820327759,
1.950376272201538,
1.6746764183044434,
1.3469010591506958,
-0.22584085166454315,
-0.9031214714050293,
0.628567099571228,
-0.43571481108665466,
-0.38213425874710083,
0.8721033334732056,
0.41456761956214905,
-0.25996625423431396,
-1.329418659210205,
0.7269880771636963,
1.2084258794784546,
-0.8532381057739258,
-0.7835807800292969,
0.18013109266757965,
-0.7536741495132446,
1.1136720180511475,
0.6783825159072876,
0.3761061429977417,
0.26443350315093994,
1.6063339710235596,
0.7943588495254517,
-0.5305664539337158,
0.5592383146286011,
0.48734936118125916,
-0.2412204146385193,
-2.1619086265563965,
-1.1275370121002197,
0.3625762164592743,
-0.569381594657898,
-1.6054171323776245,
1.3758591413497925,
-1.0798474550247192,
-1.0278271436691284,
0.507063627243042,
0.06218058615922928,
1.389482021331787,
0.3866254687309265,
1.5667616128921509,
2.0799031257629395,
0.8709074258804321,
0.48542162775993347,
1.2611982822418213,
-0.21516883373260498,
-0.4960423409938812,
1.8438345193862915,
-0.4678105413913727,
0.4639221131801605,
1.1142040491104126,
-0.312423437833786,
-1.0783714056015015,
-0.7584275007247925,
-1.2116954326629639,
-0.6679356098175049,
1.1171327829360962,
0.12617790699005127,
-1.0921059846878052,
0.2544533610343933,
1.491093397140503,
0.12469863891601562,
-0.3442084789276123,
0.6723824739456177,
0.3098609745502472,
-0.761608362197876,
-0.012444091960787773,
-0.928748607635498,
0.5588490962982178,
-0.31223198771476746,
-0.32909563183784485,
0.3080487549304962,
0.45684143900871277,
1.3419287204742432,
-0.041716400533914566,
0.12988914549350739,
1.1802091598510742,
-1.3884761333465576,
1.4788414239883423,
-0.679023027420044,
0.28262484073638916,
-2.291278839111328,
1.297744870185852,
-0.819218635559082,
1.9794038534164429,
-2.7184412479400635,
0.47755947709083557,
-0.6317075490951538,
-0.48454800248146057,
0.3110902011394501,
-0.3236274719238281,
0.05860303342342377,
-0.14126934111118317,
-1.1567353010177612,
-0.02646554820239544,
-0.6725512742996216,
0.5580421686172485,
1.1093693971633911,
1.309055209159851,
-1.1293411254882812,
-0.219875767827034,
-1.7445155382156372,
-0.1464066058397293,
-0.8403385877609253,
0.43298739194869995,
-2.030527114868164,
-0.2145586460828781,
-1.9183084964752197,
-2.340012788772583,
-1.1703801155090332,
-0.8103485107421875,
1.141724705696106,
0.178611159324646,
-0.8698126077651978,
1.260519027709961,
-0.33546456694602966,
-1.8333860635757446,
1.0353522300720215,
-2.085683584213257
] |
https://github.com/huggingface/datasets/issues/6079 | Iterating over DataLoader based on HF datasets is stuck forever | Update: If i let it run, it eventually fails with:
```
RuntimeError Traceback (most recent call last)
Cell In[16], line 4
2 t = time.time()
3 iter_ = 0
----> 4 for batch in train_dataloader:
5 #batch_proc = streaming_obj.collect_streaming_data_batch(batch)
6 iter_ += 1
8 if iter_ == 1:
File ~/anaconda3/envs/pytorch_p310/lib/python3.10/site-packages/torch/utils/data/dataloader.py:634, in _BaseDataLoaderIter.__next__(self)
631 if self._sampler_iter is None:
632 # TODO(https://github.com/pytorch/pytorch/issues/76750)
633 self._reset() # type: ignore[call-arg]
--> 634 data = self._next_data()
635 self._num_yielded += 1
636 if self._dataset_kind == _DatasetKind.Iterable and \
637 self._IterableDataset_len_called is not None and \
638 self._num_yielded > self._IterableDataset_len_called:
File ~/anaconda3/envs/pytorch_p310/lib/python3.10/site-packages/torch/utils/data/dataloader.py:678, in _SingleProcessDataLoaderIter._next_data(self)
676 def _next_data(self):
677 index = self._next_index() # may raise StopIteration
--> 678 data = self._dataset_fetcher.fetch(index) # may raise StopIteration
679 if self._pin_memory:
680 data = _utils.pin_memory.pin_memory(data, self._pin_memory_device)
File ~/anaconda3/envs/pytorch_p310/lib/python3.10/site-packages/torch/utils/data/_utils/fetch.py:32, in _IterableDatasetFetcher.fetch(self, possibly_batched_index)
30 for _ in possibly_batched_index:
31 try:
---> 32 data.append(next(self.dataset_iter))
33 except StopIteration:
34 self.ended = True
File ~/anaconda3/envs/pytorch_p310/lib/python3.10/site-packages/datasets/iterable_dataset.py:1360, in IterableDataset.__iter__(self)
1354 if self.features:
1355 # `IterableDataset` automatically fills missing columns with None.
1356 # This is done with `_apply_feature_types_on_example`.
1357 example = _apply_feature_types_on_example(
1358 example, self.features, token_per_repo_id=self._token_per_repo_id
1359 )
-> 1360 yield format_dict(example) if format_dict else example
File ~/anaconda3/envs/pytorch_p310/lib/python3.10/site-packages/datasets/formatting/torch_formatter.py:85, in TorchFormatter.recursive_tensorize(self, data_struct)
84 def recursive_tensorize(self, data_struct: dict):
---> 85 return map_nested(self._recursive_tensorize, data_struct, map_list=False)
File ~/anaconda3/envs/pytorch_p310/lib/python3.10/site-packages/datasets/utils/py_utils.py:463, in map_nested(function, data_struct, dict_only, map_list, map_tuple, map_numpy, num_proc, parallel_min_length, types, disable_tqdm, desc)
461 num_proc = 1
462 if num_proc != -1 and num_proc <= 1 or len(iterable) < parallel_min_length:
--> 463 mapped = [
464 _single_map_nested((function, obj, types, None, True, None))
465 for obj in logging.tqdm(iterable, disable=disable_tqdm, desc=desc)
466 ]
467 else:
468 mapped = parallel_map(function, iterable, num_proc, types, disable_tqdm, desc, _single_map_nested)
File ~/anaconda3/envs/pytorch_p310/lib/python3.10/site-packages/datasets/utils/py_utils.py:464, in <listcomp>(.0)
461 num_proc = 1
462 if num_proc != -1 and num_proc <= 1 or len(iterable) < parallel_min_length:
463 mapped = [
--> 464 _single_map_nested((function, obj, types, None, True, None))
465 for obj in logging.tqdm(iterable, disable=disable_tqdm, desc=desc)
466 ]
467 else:
468 mapped = parallel_map(function, iterable, num_proc, types, disable_tqdm, desc, _single_map_nested)
File ~/anaconda3/envs/pytorch_p310/lib/python3.10/site-packages/datasets/utils/py_utils.py:366, in _single_map_nested(args)
364 # Singleton first to spare some computation
365 if not isinstance(data_struct, dict) and not isinstance(data_struct, types):
--> 366 return function(data_struct)
368 # Reduce logging to keep things readable in multiprocessing with tqdm
369 if rank is not None and logging.get_verbosity() < logging.WARNING:
File ~/anaconda3/envs/pytorch_p310/lib/python3.10/site-packages/datasets/formatting/torch_formatter.py:82, in TorchFormatter._recursive_tensorize(self, data_struct)
80 elif isinstance(data_struct, (list, tuple)):
81 return self._consolidate([self.recursive_tensorize(substruct) for substruct in data_struct])
---> 82 return self._tensorize(data_struct)
File ~/anaconda3/envs/pytorch_p310/lib/python3.10/site-packages/datasets/formatting/torch_formatter.py:68, in TorchFormatter._tensorize(self, value)
66 if isinstance(value, PIL.Image.Image):
67 value = np.asarray(value)
---> 68 return torch.tensor(value, **{**default_dtype, **self.torch_tensor_kwargs})
RuntimeError: Could not infer dtype of decimal.Decimal
``` | ### Describe the bug
I am using Amazon Sagemaker notebook (Amazon Linux 2) with python 3.10 based Conda environment.
I have a dataset in parquet format locally. When I try to iterate over it, the loader is stuck forever. Note that the same code is working for python 3.6 based conda environment seamlessly. What should be my next steps here?
### Steps to reproduce the bug
```
train_dataset = load_dataset(
"parquet", data_files = {'train': tr_data_path + '*.parquet'},
split = 'train',
collate_fn = streaming_data_collate_fn,
streaming = True
).with_format('torch')
train_dataloader = DataLoader(train_dataset, batch_size = 2, num_workers = 0)
t = time.time()
iter_ = 0
for batch in train_dataloader:
iter_ += 1
if iter_ == 1000:
break
print (time.time() - t)
```
### Expected behavior
The snippet should work normally and load the next batch of data.
### Environment info
datasets: '2.14.0'
pyarrow: '12.0.0'
torch: '2.0.0'
Python: 3.10.10 | packaged by conda-forge | (main, Mar 24 2023, 20:08:06) [GCC 11.3.0]
!uname -r
5.10.178-162.673.amzn2.x86_64 | 11 | 416 | Iterating over DataLoader based on HF datasets is stuck forever
### Describe the bug
I am using Amazon Sagemaker notebook (Amazon Linux 2) with python 3.10 based Conda environment.
I have a dataset in parquet format locally. When I try to iterate over it, the loader is stuck forever. Note that the same code is working for python 3.6 based conda environment seamlessly. What should be my next steps here?
### Steps to reproduce the bug
```
train_dataset = load_dataset(
"parquet", data_files = {'train': tr_data_path + '*.parquet'},
split = 'train',
collate_fn = streaming_data_collate_fn,
streaming = True
).with_format('torch')
train_dataloader = DataLoader(train_dataset, batch_size = 2, num_workers = 0)
t = time.time()
iter_ = 0
for batch in train_dataloader:
iter_ += 1
if iter_ == 1000:
break
print (time.time() - t)
```
### Expected behavior
The snippet should work normally and load the next batch of data.
### Environment info
datasets: '2.14.0'
pyarrow: '12.0.0'
torch: '2.0.0'
Python: 3.10.10 | packaged by conda-forge | (main, Mar 24 2023, 20:08:06) [GCC 11.3.0]
!uname -r
5.10.178-162.673.amzn2.x86_64
Update: If i let it run, it eventually fails with:
```
RuntimeError Traceback (most recent call last)
Cell In[16], line 4
2 t = time.time()
3 iter_ = 0
----> 4 for batch in train_dataloader:
5 #batch_proc = streaming_obj.collect_streaming_data_batch(batch)
6 iter_ += 1
8 if iter_ == 1:
File ~/anaconda3/envs/pytorch_p310/lib/python3.10/site-packages/torch/utils/data/dataloader.py:634, in _BaseDataLoaderIter.__next__(self)
631 if self._sampler_iter is None:
632 # TODO(https://github.com/pytorch/pytorch/issues/76750)
633 self._reset() # type: ignore[call-arg]
--> 634 data = self._next_data()
635 self._num_yielded += 1
636 if self._dataset_kind == _DatasetKind.Iterable and \
637 self._IterableDataset_len_called is not None and \
638 self._num_yielded > self._IterableDataset_len_called:
File ~/anaconda3/envs/pytorch_p310/lib/python3.10/site-packages/torch/utils/data/dataloader.py:678, in _SingleProcessDataLoaderIter._next_data(self)
676 def _next_data(self):
677 index = self._next_index() # may raise StopIteration
--> 678 data = self._dataset_fetcher.fetch(index) # may raise StopIteration
679 if self._pin_memory:
680 data = _utils.pin_memory.pin_memory(data, self._pin_memory_device)
File ~/anaconda3/envs/pytorch_p310/lib/python3.10/site-packages/torch/utils/data/_utils/fetch.py:32, in _IterableDatasetFetcher.fetch(self, possibly_batched_index)
30 for _ in possibly_batched_index:
31 try:
---> 32 data.append(next(self.dataset_iter))
33 except StopIteration:
34 self.ended = True
File ~/anaconda3/envs/pytorch_p310/lib/python3.10/site-packages/datasets/iterable_dataset.py:1360, in IterableDataset.__iter__(self)
1354 if self.features:
1355 # `IterableDataset` automatically fills missing columns with None.
1356 # This is done with `_apply_feature_types_on_example`.
1357 example = _apply_feature_types_on_example(
1358 example, self.features, token_per_repo_id=self._token_per_repo_id
1359 )
-> 1360 yield format_dict(example) if format_dict else example
File ~/anaconda3/envs/pytorch_p310/lib/python3.10/site-packages/datasets/formatting/torch_formatter.py:85, in TorchFormatter.recursive_tensorize(self, data_struct)
84 def recursive_tensorize(self, data_struct: dict):
---> 85 return map_nested(self._recursive_tensorize, data_struct, map_list=False)
File ~/anaconda3/envs/pytorch_p310/lib/python3.10/site-packages/datasets/utils/py_utils.py:463, in map_nested(function, data_struct, dict_only, map_list, map_tuple, map_numpy, num_proc, parallel_min_length, types, disable_tqdm, desc)
461 num_proc = 1
462 if num_proc != -1 and num_proc <= 1 or len(iterable) < parallel_min_length:
--> 463 mapped = [
464 _single_map_nested((function, obj, types, None, True, None))
465 for obj in logging.tqdm(iterable, disable=disable_tqdm, desc=desc)
466 ]
467 else:
468 mapped = parallel_map(function, iterable, num_proc, types, disable_tqdm, desc, _single_map_nested)
File ~/anaconda3/envs/pytorch_p310/lib/python3.10/site-packages/datasets/utils/py_utils.py:464, in <listcomp>(.0)
461 num_proc = 1
462 if num_proc != -1 and num_proc <= 1 or len(iterable) < parallel_min_length:
463 mapped = [
--> 464 _single_map_nested((function, obj, types, None, True, None))
465 for obj in logging.tqdm(iterable, disable=disable_tqdm, desc=desc)
466 ]
467 else:
468 mapped = parallel_map(function, iterable, num_proc, types, disable_tqdm, desc, _single_map_nested)
File ~/anaconda3/envs/pytorch_p310/lib/python3.10/site-packages/datasets/utils/py_utils.py:366, in _single_map_nested(args)
364 # Singleton first to spare some computation
365 if not isinstance(data_struct, dict) and not isinstance(data_struct, types):
--> 366 return function(data_struct)
368 # Reduce logging to keep things readable in multiprocessing with tqdm
369 if rank is not None and logging.get_verbosity() < logging.WARNING:
File ~/anaconda3/envs/pytorch_p310/lib/python3.10/site-packages/datasets/formatting/torch_formatter.py:82, in TorchFormatter._recursive_tensorize(self, data_struct)
80 elif isinstance(data_struct, (list, tuple)):
81 return self._consolidate([self.recursive_tensorize(substruct) for substruct in data_struct])
---> 82 return self._tensorize(data_struct)
File ~/anaconda3/envs/pytorch_p310/lib/python3.10/site-packages/datasets/formatting/torch_formatter.py:68, in TorchFormatter._tensorize(self, value)
66 if isinstance(value, PIL.Image.Image):
67 value = np.asarray(value)
---> 68 return torch.tensor(value, **{**default_dtype, **self.torch_tensor_kwargs})
RuntimeError: Could not infer dtype of decimal.Decimal
``` | [
-1.270894169807434,
-1.0062732696533203,
-0.6609833240509033,
1.563029408454895,
-0.22833463549613953,
-1.170157790184021,
0.1303490400314331,
-0.9474954009056091,
1.6263947486877441,
-0.8306624889373779,
0.2395327091217041,
-1.5603952407836914,
0.07044895738363266,
-0.571514368057251,
-0.6682233810424805,
-0.8481132984161377,
-0.38888058066368103,
-0.7900111079216003,
1.2113761901855469,
2.447726011276245,
1.2367141246795654,
-1.4530816078186035,
2.7924020290374756,
0.7135749459266663,
-0.20393212139606476,
-1.0507735013961792,
0.4612964987754822,
0.003531821072101593,
-1.3130756616592407,
-0.45410963892936707,
-0.9846562147140503,
-0.08980898559093475,
-0.565320611000061,
-0.40126684308052063,
0.0046327076852321625,
0.384545236825943,
-0.2962914705276489,
-0.4764353334903717,
-0.5384969115257263,
-0.7073339223861694,
0.4402586817741394,
-0.38911867141723633,
0.9184447526931763,
-0.3024829030036926,
1.7972410917282104,
-0.47743141651153564,
0.47781845927238464,
0.745629608631134,
1.2453103065490723,
0.17432767152786255,
-0.049333758652210236,
0.3675185441970825,
0.40944740176200867,
-0.007601087912917137,
0.6044696569442749,
1.1289790868759155,
0.6601251363754272,
0.4477449357509613,
0.6471210718154907,
-2.2443552017211914,
1.3069473505020142,
-1.0050619840621948,
0.290302038192749,
1.2976293563842773,
-1.0123246908187866,
0.4160405397415161,
-1.7251654863357544,
0.00004809163510799408,
0.7029612064361572,
-2.2184715270996094,
0.33911147713661194,
-1.3608454465866089,
-0.4934326708316803,
1.0572134256362915,
0.3500279188156128,
-1.1894656419754028,
0.0842573419213295,
-0.47912076115608215,
1.1190842390060425,
0.3912138342857361,
1.07615065574646,
-1.6805851459503174,
-0.06945937871932983,
-0.27610164880752563,
0.12851503491401672,
-1.318652629852295,
-1.5538134574890137,
0.5647025108337402,
0.7004023790359497,
0.5847771763801575,
-0.12181401252746582,
1.1296182870864868,
-1.0824995040893555,
0.768073558807373,
-1.102979302406311,
-1.69515860080719,
-1.4599180221557617,
-2.418236494064331,
-2.281320333480835,
0.6895415782928467,
-0.4150552749633789,
-0.5149688124656677,
2.1127562522888184,
-1.0301551818847656,
-1.6964021921157837,
1.183211088180542,
0.17434704303741455,
0.027889354154467583,
2.355116367340088,
0.19400650262832642,
-0.7802871465682983,
0.478014200925827,
-0.8134035468101501,
0.7135195732116699,
-0.32809340953826904,
1.3309855461120605,
0.3884616494178772,
-1.0150443315505981,
1.588991641998291,
-0.31828027963638306,
0.5769893527030945,
-0.6200705170631409,
-0.5191239714622498,
-0.7269240617752075,
0.26792454719543457,
1.9941998720169067,
-0.2612859010696411,
1.4838275909423828,
-0.32985517382621765,
-1.5130033493041992,
-1.6050615310668945,
0.9251100420951843,
0.44473063945770264,
-0.7605310082435608,
0.15301114320755005,
-0.3754974603652954,
0.18391475081443787,
-0.10372576117515564,
1.1226850748062134,
1.2597877979278564,
0.6783378720283508,
-0.39477822184562683,
-0.9385807514190674,
0.22632889449596405,
-0.18310023844242096,
-0.6355907917022705,
-1.809810757637024,
-0.3633653223514557,
0.026327496394515038,
0.6923292875289917,
-1.2198795080184937,
1.69111967086792,
0.9162483811378479,
1.903982162475586,
1.0388109683990479,
-0.3243962228298187,
1.5095149278640747,
0.1470445841550827,
1.824945330619812,
-0.47435668110847473,
0.6385324001312256,
-0.39192137122154236,
-1.13716721534729,
0.7187038660049438,
-0.3372196853160858,
-1.9981194734573364,
-0.6887897849082947,
-0.7639445066452026,
-0.20613059401512146,
-0.7932495474815369,
0.8972295522689819,
-0.286155104637146,
-1.4697133302688599,
0.2899286448955536,
-0.7566102147102356,
0.18656764924526215,
-1.2037022113800049,
0.3663537800312042,
0.6884532570838928,
-0.5547046065330505,
0.10183856636285782,
-0.2824554741382599,
-1.236413598060608,
-0.46842893958091736,
0.3536496162414551,
1.8563995361328125,
-0.7293033003807068,
0.9056708216667175,
1.112858533859253,
-0.6751074194908142,
0.00886542722582817,
0.27951523661613464,
-0.2328183650970459,
0.845333993434906,
-1.0388966798782349,
-0.469249963760376,
1.2229046821594238,
-0.33799993991851807,
-0.6053189635276794,
1.4841231107711792,
0.7455310821533203,
-1.0539219379425049,
-0.289532870054245,
-0.08718257397413254,
-0.7891075611114502,
0.1490219235420227,
-1.6053634881973267,
-0.16084933280944824,
0.45094209909439087,
-1.5700863599777222,
-0.42247483134269714,
-0.2140621840953827,
1.4204282760620117,
-0.0978449359536171,
1.5038111209869385,
-0.36796334385871887,
-0.1750011146068573,
-0.29004573822021484,
-0.4050784707069397,
0.19086459279060364,
-0.19149574637413025,
-0.5790479183197021,
0.13548409938812256,
-0.7747557759284973,
0.32987573742866516,
1.435961365699768,
0.31933826208114624,
0.033542558550834656,
0.4824218451976776,
1.0425211191177368,
0.44222986698150635,
-0.016116824001073837,
-0.89936763048172,
-1.5041756629943848,
1.935494065284729,
-1.4650412797927856,
2.06492018699646,
0.8193979859352112,
-0.03665413707494736,
-1.7657263278961182,
-1.8347795009613037,
1.3613286018371582,
1.0841681957244873,
2.3238344192504883,
0.4999658167362213,
0.3629433810710907,
-0.8731787800788879,
-0.67985999584198,
0.280615895986557,
-0.9605448246002197,
-0.7805091142654419,
0.1891888678073883,
2.476578712463379,
1.7557711601257324,
-0.322103351354599,
-0.13071094453334808,
-0.9604265093803406,
1.40438711643219,
-0.14691056311130524,
0.30898401141166687,
2.002153158187866,
-0.22112971544265747,
-0.9941376447677612,
1.2353025674819946,
-2.4277987480163574,
0.19165100157260895,
2.0654807090759277,
0.27055078744888306,
0.1340130716562271,
-1.4090951681137085,
-0.6299431920051575,
-0.29440802335739136,
-0.448049396276474,
-1.2264139652252197,
0.5394156575202942,
-0.34626567363739014,
-0.7866477966308594,
-1.4188717603683472,
0.22466057538986206,
-1.0824586153030396,
-1.675197720527649,
0.19115857779979706,
1.8932909965515137,
2.05416202545166,
-0.7922845482826233,
1.5521248579025269,
-0.36083295941352844,
0.20854990184307098,
1.2484372854232788,
1.2579889297485352,
3.140294313430786,
1.9926289319992065,
-1.26912260055542,
0.6562321186065674,
-0.16041092574596405,
-0.4563203752040863,
1.0899486541748047,
-1.2394053936004639,
1.3336678743362427,
-0.13529902696609497,
-1.2076112031936646,
-1.174291968345642,
0.9907230734825134,
0.5773016810417175,
0.0037780776619911194,
-0.470251202583313,
1.2023485898971558,
0.09207946807146072,
1.314733862876892,
0.48432251811027527,
-0.34909865260124207,
0.6434304118156433,
-0.43249279260635376,
-0.4888746738433838,
1.5366872549057007,
0.15793026983737946,
-1.4479917287826538,
-2.2052114009857178,
-0.26490870118141174,
-0.8883536458015442,
-0.008457927033305168,
-0.6731036901473999,
-0.9928057193756104,
1.5942586660385132,
0.31853461265563965,
-1.227491021156311,
-0.22862210869789124,
-0.32255956530570984,
-0.514264702796936,
2.6932005882263184,
-1.290658950805664,
-0.27765020728111267,
-0.9695496559143066,
-0.646495521068573,
1.6445937156677246,
-1.213698387145996,
-0.2902386784553528,
-1.0014889240264893,
-0.6211761832237244,
-1.2465921640396118,
-0.5047557353973389,
-0.014813993126153946,
-0.913104772567749,
0.8748486042022705,
0.18675178289413452,
-1.24868905544281,
-0.3153795897960663,
-0.9350735545158386,
0.9212428331375122,
-0.044026121497154236,
0.19477996230125427,
1.7761716842651367,
0.23896300792694092,
-0.45711439847946167,
0.7581691145896912,
1.1144293546676636,
0.6522783041000366,
-0.6980969309806824,
0.2172802835702896,
-0.6457921862602234,
0.36730310320854187,
-1.2105940580368042,
0.3456765115261078,
-2.962660551071167,
0.6434297561645508,
0.0016549136489629745,
-0.02593393437564373,
-0.07277154922485352,
-1.2842652797698975,
1.1173659563064575,
2.5451321601867676,
-1.1354405879974365,
0.5254817605018616,
0.42163366079330444,
1.2076352834701538,
-1.597961664199829,
0.31569966673851013,
-0.44860219955444336,
2.104597568511963,
0.21977964043617249,
1.2754498720169067,
-0.42582836747169495,
-2.373715877532959,
0.6739951372146606,
-1.261953592300415,
-1.147359848022461,
0.7453715801239014,
-0.9324014782905579,
0.14106115698814392,
-1.3467626571655273,
-0.2617977559566498,
-0.8363502621650696,
-1.1798980236053467,
0.6530994772911072,
0.18635360896587372,
0.39421969652175903,
-0.5779764652252197,
0.31828561425209045,
-2.1818130016326904,
-1.3327046632766724,
-0.207257479429245,
-0.9944257736206055,
0.46826329827308655,
-0.40472039580345154,
0.6776514649391174,
-0.17187801003456116,
0.02747468091547489,
0.33678001165390015,
1.4232627153396606,
3.3444581031799316,
0.10421094298362732,
0.30304038524627686,
-0.19965849816799164,
-0.9206398129463196,
1.4932854175567627,
0.8964812755584717,
-0.1433396339416504,
-0.4795241057872772,
-1.1316487789154053,
1.2713243961334229,
1.9326814413070679,
0.9703618884086609,
0.02088441513478756,
-0.7870215773582458,
-0.7102424502372742,
-0.06900513917207718,
0.1248612180352211,
0.4937489330768585,
0.8942493200302124,
0.057604819536209106,
0.10577480494976044,
1.4413065910339355,
1.1547070741653442,
-0.4464757740497589,
0.32450348138809204,
-0.8594956398010254,
-0.4618885815143585,
0.48616164922714233,
0.2659998834133148,
-0.009357803501188755,
0.2746897339820862,
-0.9969372153282166,
-0.20868493616580963,
-0.4061471223831177,
-0.892126202583313,
-0.6857156753540039,
-0.4097684621810913,
-0.3535694479942322,
1.6124916076660156,
0.16152824461460114,
-0.4978736639022827,
-0.014707650989294052,
-0.732373833656311,
-0.0743270069360733,
-1.1137354373931885,
0.24079909920692444,
-0.1238875612616539,
-0.12171860784292221,
-0.1788395643234253,
1.7286394834518433,
-0.8910698890686035,
-2.0737969875335693,
0.1764032393693924,
0.2123928666114807,
-0.1916373372077942,
0.2767508625984192,
1.6756103038787842,
0.48910778760910034,
1.4774339199066162,
1.3071788549423218,
1.0007317066192627,
-0.6170224547386169,
-1.3278188705444336,
0.7513521909713745,
1.0019394159317017,
-1.4173911809921265,
0.79366135597229,
-0.05285077542066574,
-0.5136072039604187,
0.6752049922943115,
1.2889961004257202,
0.516312837600708,
-2.0949857234954834,
0.8127655386924744,
-1.0157948732376099,
0.7888049483299255,
0.7188963890075684,
0.6601808667182922,
0.2128511369228363,
0.8456658720970154,
-1.160256028175354,
-1.1228595972061157,
-0.6922293901443481,
-0.7363936901092529,
1.9765113592147827,
-0.3323929011821747,
0.574192225933075,
-0.1988290697336197,
-1.3674176931381226,
-0.012714940123260021,
0.6781772971153259,
0.346954882144928,
-0.47686371207237244,
0.8071022033691406,
-0.776736855506897,
-1.1752746105194092,
-1.3571560382843018,
-0.45490700006484985,
-1.05168616771698,
-0.9909352660179138,
1.0587420463562012,
0.727665364742279,
0.29281458258628845,
1.8867239952087402,
0.6063570380210876,
0.2845653295516968,
-2.6019022464752197,
0.976696789264679,
0.22149820625782013,
-0.044006675481796265,
0.8378030061721802,
0.25655028223991394,
1.051729679107666,
0.029476473107933998,
0.5308452844619751,
-2.4179775714874268,
2.309243679046631,
-0.22571301460266113,
0.6449066996574402,
0.015111135318875313,
-0.13168281316757202,
1.071824550628662,
0.6080565452575684,
0.6229678988456726,
-1.0301852226257324,
0.735278844833374,
-0.5783988237380981,
1.2909770011901855,
0.8103681206703186,
-0.8172921538352966,
-0.06753237545490265,
1.2640478610992432,
0.43061384558677673,
-0.5539657473564148,
-0.9225743412971497,
-1.0745246410369873,
0.9354702830314636,
1.6810131072998047,
-0.05474860966205597,
-0.03961652144789696,
0.8343479037284851,
0.6669244766235352,
-1.2413076162338257,
0.013651538640260696,
-0.7066936492919922,
-0.7084217071533203,
1.5757073163986206,
2.068037509918213,
-0.16806741058826447,
-0.2198592722415924,
-0.7028729319572449,
-1.290052890777588,
0.7375674843788147,
-0.09911787509918213,
0.05183578282594681,
0.6269273161888123,
-0.553286075592041,
0.9795721173286438,
0.7930015325546265,
0.8911049962043762,
0.1707714945077896,
0.20702992379665375,
0.3898225426673889,
-0.3683481514453888,
-1.2248495817184448,
-0.26123660802841187,
-1.0068846940994263,
-2.563929557800293,
0.4079841375350952,
-0.12346173822879791,
-1.3512203693389893,
0.06934618204832077,
-1.0415244102478027,
0.921373188495636,
-0.5494188070297241,
-1.1251375675201416,
-1.4638999700546265,
0.08262013643980026,
-0.11056893318891525,
0.9167917370796204,
-1.6134651899337769,
-0.10754994302988052,
1.2600857019424438,
0.8965988159179688,
-0.6795794367790222,
1.0960254669189453,
0.2776290476322174,
1.048514485359192,
0.8398072123527527,
-0.3679211139678955,
0.5984277725219727,
0.06269589066505432,
-1.3469812870025635,
0.4823053777217865,
1.1844736337661743,
0.24730855226516724,
1.5662294626235962,
-0.6114358901977539,
-0.07734160125255585,
0.45095589756965637,
-0.6858646273612976,
-0.4544745087623596,
-0.512500524520874,
0.725340723991394,
-0.07567884027957916,
-0.8934420943260193,
-0.005812996532768011,
-0.11416210979223251,
-0.19993364810943604,
0.10378285497426987,
-1.4874663352966309,
-0.08211486041545868,
-0.3257371187210083,
-0.6252996325492859,
-1.3249738216400146,
-0.009687556885182858,
1.4255205392837524,
-0.8221729397773743,
-0.23761533200740814,
0.38614872097969055,
0.4048817455768585,
0.49441179633140564,
0.6917943358421326,
-0.6679233908653259,
-0.3184731900691986,
-0.1516755372285843,
-0.316236287355423,
0.37905409932136536,
1.4069538116455078,
-0.07680916041135788,
-0.9991506338119507,
0.7009634971618652,
-0.36629655957221985,
0.10007932782173157,
1.9157859086990356,
0.1043984517455101,
-0.7847328782081604,
0.29208728671073914,
-0.7942682504653931,
1.9345107078552246,
1.6613504886627197,
1.3354215621948242,
-0.23687835037708282,
-0.880400538444519,
0.644775927066803,
-0.4218403100967407,
-0.3829779028892517,
0.8760978579521179,
0.4006626605987549,
-0.24200157821178436,
-1.3211297988891602,
0.7161786556243896,
1.2141401767730713,
-0.8525451421737671,
-0.7907758355140686,
0.19443565607070923,
-0.7434691190719604,
1.1067728996276855,
0.6696789860725403,
0.38152024149894714,
0.25212496519088745,
1.6077673435211182,
0.8000327944755554,
-0.531536877155304,
0.5624864101409912,
0.4732974171638489,
-0.2526099681854248,
-2.171905755996704,
-1.123667597770691,
0.3736517131328583,
-0.5893084406852722,
-1.6125643253326416,
1.3881508111953735,
-1.0743918418884277,
-1.0313217639923096,
0.5154287219047546,
0.03679888695478439,
1.372822642326355,
0.38052240014076233,
1.573861002922058,
2.067125082015991,
0.8657814860343933,
0.4840506613254547,
1.2424730062484741,
-0.2200949639081955,
-0.5044289231300354,
1.8346744775772095,
-0.4649828374385834,
0.47513073682785034,
1.1093411445617676,
-0.3076765537261963,
-1.0737075805664062,
-0.7547973990440369,
-1.2083882093429565,
-0.6733450889587402,
1.1034128665924072,
0.137526735663414,
-1.0980079174041748,
0.26302075386047363,
1.4981766939163208,
0.131122887134552,
-0.3513583242893219,
0.675832211971283,
0.3123714327812195,
-0.7705286145210266,
-0.02791377156972885,
-0.915687084197998,
0.5395777225494385,
-0.3273104429244995,
-0.32638710737228394,
0.29747599363327026,
0.4479236900806427,
1.3350573778152466,
-0.056197792291641235,
0.1373158097267151,
1.1678606271743774,
-1.3916456699371338,
1.4891669750213623,
-0.687503457069397,
0.30726149678230286,
-2.2990076541900635,
1.291118860244751,
-0.8232123255729675,
1.981629490852356,
-2.703916311264038,
0.4751673638820648,
-0.6101461052894592,
-0.48698511719703674,
0.32553258538246155,
-0.3240712881088257,
0.06954636424779892,
-0.13165533542633057,
-1.1482617855072021,
-0.03937014192342758,
-0.6969530582427979,
0.5658732652664185,
1.1070303916931152,
1.3170039653778076,
-1.132583498954773,
-0.20976682007312775,
-1.7403476238250732,
-0.15129977464675903,
-0.851711630821228,
0.40818530321121216,
-2.0244967937469482,
-0.20459166169166565,
-1.9295765161514282,
-2.3254265785217285,
-1.1794416904449463,
-0.8206544518470764,
1.142207384109497,
0.19066548347473145,
-0.8786616921424866,
1.2382049560546875,
-0.31602632999420166,
-1.8231065273284912,
1.042279839515686,
-2.086242198944092
] |
https://github.com/huggingface/datasets/issues/6079 | Iterating over DataLoader based on HF datasets is stuck forever | PyTorch tensors cannot store `Decimal` objects. Casting the column with decimals to `float` should fix the issue. | ### Describe the bug
I am using Amazon Sagemaker notebook (Amazon Linux 2) with python 3.10 based Conda environment.
I have a dataset in parquet format locally. When I try to iterate over it, the loader is stuck forever. Note that the same code is working for python 3.6 based conda environment seamlessly. What should be my next steps here?
### Steps to reproduce the bug
```
train_dataset = load_dataset(
"parquet", data_files = {'train': tr_data_path + '*.parquet'},
split = 'train',
collate_fn = streaming_data_collate_fn,
streaming = True
).with_format('torch')
train_dataloader = DataLoader(train_dataset, batch_size = 2, num_workers = 0)
t = time.time()
iter_ = 0
for batch in train_dataloader:
iter_ += 1
if iter_ == 1000:
break
print (time.time() - t)
```
### Expected behavior
The snippet should work normally and load the next batch of data.
### Environment info
datasets: '2.14.0'
pyarrow: '12.0.0'
torch: '2.0.0'
Python: 3.10.10 | packaged by conda-forge | (main, Mar 24 2023, 20:08:06) [GCC 11.3.0]
!uname -r
5.10.178-162.673.amzn2.x86_64 | 11 | 17 | Iterating over DataLoader based on HF datasets is stuck forever
### Describe the bug
I am using Amazon Sagemaker notebook (Amazon Linux 2) with python 3.10 based Conda environment.
I have a dataset in parquet format locally. When I try to iterate over it, the loader is stuck forever. Note that the same code is working for python 3.6 based conda environment seamlessly. What should be my next steps here?
### Steps to reproduce the bug
```
train_dataset = load_dataset(
"parquet", data_files = {'train': tr_data_path + '*.parquet'},
split = 'train',
collate_fn = streaming_data_collate_fn,
streaming = True
).with_format('torch')
train_dataloader = DataLoader(train_dataset, batch_size = 2, num_workers = 0)
t = time.time()
iter_ = 0
for batch in train_dataloader:
iter_ += 1
if iter_ == 1000:
break
print (time.time() - t)
```
### Expected behavior
The snippet should work normally and load the next batch of data.
### Environment info
datasets: '2.14.0'
pyarrow: '12.0.0'
torch: '2.0.0'
Python: 3.10.10 | packaged by conda-forge | (main, Mar 24 2023, 20:08:06) [GCC 11.3.0]
!uname -r
5.10.178-162.673.amzn2.x86_64
PyTorch tensors cannot store `Decimal` objects. Casting the column with decimals to `float` should fix the issue. | [
-1.2665154933929443,
-1.0163578987121582,
-0.7126186490058899,
1.5815691947937012,
-0.22405150532722473,
-1.126129150390625,
0.14313547313213348,
-0.9426345229148865,
1.658698558807373,
-0.8402796387672424,
0.2593388259410858,
-1.6109161376953125,
0.07901172339916229,
-0.5566502213478088,
-0.6711853742599487,
-0.8891609311103821,
-0.41663792729377747,
-0.7678996324539185,
1.21317458152771,
2.452268123626709,
1.193116307258606,
-1.4144567251205444,
2.738757610321045,
0.7046278119087219,
-0.16879406571388245,
-1.03397798538208,
0.46651896834373474,
0.011510382406413555,
-1.3388084173202515,
-0.4830050468444824,
-0.9689726829528809,
-0.09093113988637924,
-0.5813088417053223,
-0.4530218541622162,
0.023304186761379242,
0.3674195110797882,
-0.3304171562194824,
-0.5091057419776917,
-0.5029694437980652,
-0.7581044435501099,
0.41326063871383667,
-0.39838123321533203,
0.9017629623413086,
-0.34451815485954285,
1.8761265277862549,
-0.45407140254974365,
0.4776243567466736,
0.7587772011756897,
1.2487815618515015,
0.19433467090129852,
-0.06910432875156403,
0.39580437541007996,
0.41724881529808044,
-0.009534357115626335,
0.5657050013542175,
1.1072406768798828,
0.6110185980796814,
0.43892157077789307,
0.6654887795448303,
-2.2544171810150146,
1.3351374864578247,
-1.0477173328399658,
0.2886441946029663,
1.3448930978775024,
-1.011642575263977,
0.38359037041664124,
-1.70269775390625,
-0.011310162022709846,
0.6560035943984985,
-2.214759111404419,
0.3357897996902466,
-1.3485435247421265,
-0.5041565895080566,
1.069886326789856,
0.38653120398521423,
-1.2306609153747559,
0.05729566514492035,
-0.4514666497707367,
1.0816431045532227,
0.415793776512146,
1.1149475574493408,
-1.6716797351837158,
-0.10523770749568939,
-0.3176797926425934,
0.08180972188711166,
-1.346245288848877,
-1.5135804414749146,
0.5559232831001282,
0.6939054131507874,
0.5497555136680603,
-0.11769724637269974,
1.112166166305542,
-1.0517250299453735,
0.7964093089103699,
-1.0665744543075562,
-1.7096123695373535,
-1.4701507091522217,
-2.3903424739837646,
-2.344334363937378,
0.7175324559211731,
-0.37808454036712646,
-0.5269692540168762,
2.1116490364074707,
-1.025730848312378,
-1.7213833332061768,
1.2174253463745117,
0.21236452460289001,
-0.02073873206973076,
2.364199161529541,
0.212211012840271,
-0.7363021373748779,
0.4032915532588959,
-0.8218201398849487,
0.7404487729072571,
-0.36165690422058105,
1.378841757774353,
0.4201945662498474,
-1.0254135131835938,
1.5805479288101196,
-0.2798483669757843,
0.5716120600700378,
-0.6193895936012268,
-0.5122408270835876,
-0.7376856803894043,
0.252835214138031,
1.998952865600586,
-0.2723873555660248,
1.4877996444702148,
-0.3234756886959076,
-1.504496455192566,
-1.6168022155761719,
0.9450416564941406,
0.42872539162635803,
-0.7559083700180054,
0.15929152071475983,
-0.3054995536804199,
0.19160714745521545,
-0.10110925883054733,
1.1298792362213135,
1.262790560722351,
0.6965834498405457,
-0.4080411493778229,
-0.9526225328445435,
0.23405654728412628,
-0.17036935687065125,
-0.646268367767334,
-1.768128514289856,
-0.3823179304599762,
-0.008631161414086819,
0.6722081303596497,
-1.219274640083313,
1.6597687005996704,
0.9169154763221741,
1.8723639249801636,
1.0267524719238281,
-0.32951346039772034,
1.4903032779693604,
0.1563442498445511,
1.8072501420974731,
-0.46952998638153076,
0.6332188248634338,
-0.40016061067581177,
-1.1258876323699951,
0.7607283592224121,
-0.288255900144577,
-2.0005617141723633,
-0.7309930920600891,
-0.8144193291664124,
-0.21676267683506012,
-0.7889464497566223,
0.9223271608352661,
-0.26752033829689026,
-1.4527665376663208,
0.33220598101615906,
-0.7426109910011292,
0.1844612956047058,
-1.225849986076355,
0.40300360321998596,
0.6910614967346191,
-0.5135796666145325,
0.1371220499277115,
-0.28073546290397644,
-1.2816144227981567,
-0.4488655924797058,
0.3362935185432434,
1.8574726581573486,
-0.7859358191490173,
0.9161737561225891,
1.1113728284835815,
-0.6968299746513367,
0.007960288785398006,
0.27749794721603394,
-0.2375195324420929,
0.8604943752288818,
-1.0004429817199707,
-0.4429115355014801,
1.23159921169281,
-0.3321801424026489,
-0.6146910786628723,
1.5008375644683838,
0.7592177987098694,
-1.0241378545761108,
-0.2435925006866455,
-0.10438903421163559,
-0.7682681679725647,
0.11971493065357208,
-1.614971399307251,
-0.13564616441726685,
0.4398578107357025,
-1.5709717273712158,
-0.45650848746299744,
-0.20944689214229584,
1.4027140140533447,
-0.10378824174404144,
1.5054365396499634,
-0.3682989478111267,
-0.22196543216705322,
-0.3070918023586273,
-0.38019227981567383,
0.20601841807365417,
-0.17674098908901215,
-0.5984565019607544,
0.16626210510730743,
-0.7583849430084229,
0.34250250458717346,
1.4039888381958008,
0.3375852704048157,
-0.005259432829916477,
0.5031711459159851,
1.0538991689682007,
0.42066195607185364,
-0.004997848998755217,
-0.8989189863204956,
-1.5171269178390503,
1.9762085676193237,
-1.4544540643692017,
2.03723406791687,
0.7298499345779419,
0.017993170768022537,
-1.7805922031402588,
-1.8680212497711182,
1.3864713907241821,
1.070887804031372,
2.266014814376831,
0.5373873710632324,
0.3917044699192047,
-0.8810553550720215,
-0.667303204536438,
0.27717772126197815,
-1.0015748739242554,
-0.7609319090843201,
0.15892261266708374,
2.456469774246216,
1.7331606149673462,
-0.37647634744644165,
-0.10352890193462372,
-0.9861610531806946,
1.441802740097046,
-0.16424067318439484,
0.24746599793434143,
1.9965813159942627,
-0.21734043955802917,
-0.992488443851471,
1.2072951793670654,
-2.3928186893463135,
0.16987527906894684,
2.03309965133667,
0.258670836687088,
0.08959081768989563,
-1.404106616973877,
-0.6591642498970032,
-0.28616422414779663,
-0.4382839500904083,
-1.199843406677246,
0.5394490957260132,
-0.32586607336997986,
-0.798004686832428,
-1.4143251180648804,
0.2380182445049286,
-1.0798206329345703,
-1.627658724784851,
0.1667918860912323,
1.8965266942977905,
2.0256662368774414,
-0.7560994625091553,
1.5819038152694702,
-0.3276459872722626,
0.1981741040945053,
1.2769999504089355,
1.22199285030365,
3.1205573081970215,
1.979193925857544,
-1.2437995672225952,
0.6594950556755066,
-0.10738164186477661,
-0.4459663927555084,
1.1327317953109741,
-1.215749979019165,
1.366804838180542,
-0.11243390291929245,
-1.1871196031570435,
-1.1906338930130005,
0.9804148077964783,
0.5819227695465088,
0.030600804835557938,
-0.43520087003707886,
1.2071232795715332,
0.06164877861738205,
1.2850100994110107,
0.459764301776886,
-0.3470495641231537,
0.6556670069694519,
-0.4404168426990509,
-0.49846675992012024,
1.5102795362472534,
0.19276268780231476,
-1.410396695137024,
-2.2209455966949463,
-0.28779900074005127,
-0.8387860059738159,
0.01395417284220457,
-0.6161141991615295,
-0.9758028984069824,
1.6218174695968628,
0.36678433418273926,
-1.2464051246643066,
-0.23770321905612946,
-0.3515413701534271,
-0.5826142430305481,
2.736156702041626,
-1.3168694972991943,
-0.28129830956459045,
-0.972428560256958,
-0.6388689279556274,
1.6699143648147583,
-1.2118114233016968,
-0.25702470541000366,
-1.0038659572601318,
-0.6162976622581482,
-1.2766987085342407,
-0.5592951774597168,
-0.0344993993639946,
-0.9312883615493774,
0.8806595802307129,
0.15498650074005127,
-1.2005528211593628,
-0.32315292954444885,
-0.9310685992240906,
0.855065107345581,
-0.018910463899374008,
0.20947253704071045,
1.7940409183502197,
0.3269440829753876,
-0.44621774554252625,
0.7403936386108398,
1.103582739830017,
0.6513206362724304,
-0.6898954510688782,
0.24286046624183655,
-0.6426758766174316,
0.3374771177768707,
-1.1638234853744507,
0.3476593792438507,
-2.9195609092712402,
0.6211771368980408,
-0.022976897656917572,
-0.037176020443439484,
-0.06581497937440872,
-1.2571039199829102,
1.183210849761963,
2.537513017654419,
-1.169463872909546,
0.5242208242416382,
0.3479917645454407,
1.1855708360671997,
-1.5905263423919678,
0.34495389461517334,
-0.4274173676967621,
2.120103359222412,
0.2269093245267868,
1.2321637868881226,
-0.4189278483390808,
-2.334939479827881,
0.6854420304298401,
-1.2674133777618408,
-1.1887494325637817,
0.7470002174377441,
-0.9324772357940674,
0.09536008536815643,
-1.3636939525604248,
-0.2707582116127014,
-0.8094578981399536,
-1.192335844039917,
0.660318911075592,
0.18506085872650146,
0.4159523844718933,
-0.5661275386810303,
0.3404752016067505,
-2.215472459793091,
-1.327735424041748,
-0.23134377598762512,
-0.9943316578865051,
0.4682610034942627,
-0.3661602735519409,
0.702019989490509,
-0.19749587774276733,
0.052637964487075806,
0.3587922155857086,
1.427971601486206,
3.3709447383880615,
0.08471091836690903,
0.3315051794052124,
-0.16155876219272614,
-0.9228637218475342,
1.4808259010314941,
0.9263674020767212,
-0.13601192831993103,
-0.4829833209514618,
-1.142417311668396,
1.2541730403900146,
1.9452595710754395,
0.9584054350852966,
-0.010561566799879074,
-0.7586783766746521,
-0.6798732876777649,
-0.08079290390014648,
0.13124120235443115,
0.5126022100448608,
0.8686554431915283,
0.08405919373035431,
0.1211746335029602,
1.4272037744522095,
1.1702357530593872,
-0.48106810450553894,
0.31874245405197144,
-0.8432776927947998,
-0.4685649573802948,
0.4819718897342682,
0.255923330783844,
-0.0321100689470768,
0.2525607645511627,
-0.9731397032737732,
-0.18293583393096924,
-0.43231716752052307,
-0.9455738067626953,
-0.7130976915359497,
-0.4060038924217224,
-0.4045495092868805,
1.6280330419540405,
0.17091962695121765,
-0.5220518708229065,
-0.03190930560231209,
-0.7493223547935486,
-0.02156206965446472,
-1.1283352375030518,
0.2495177984237671,
-0.12596918642520905,
-0.12062974274158478,
-0.1585218608379364,
1.7642494440078735,
-0.9280194044113159,
-2.057673931121826,
0.19688381254673004,
0.21890099346637726,
-0.2149597406387329,
0.30037054419517517,
1.635040044784546,
0.5100590586662292,
1.4980005025863647,
1.3068435192108154,
0.9843977689743042,
-0.6552549600601196,
-1.3760381937026978,
0.7107420563697815,
1.0095683336257935,
-1.4158965349197388,
0.7506682872772217,
0.038807839155197144,
-0.4738506078720093,
0.6668360233306885,
1.2639752626419067,
0.5214405655860901,
-2.0683326721191406,
0.8163440823554993,
-0.9990065097808838,
0.769373893737793,
0.6816782355308533,
0.6467036008834839,
0.20479777455329895,
0.815567135810852,
-1.1632434129714966,
-1.1259750127792358,
-0.7031359076499939,
-0.7227370142936707,
1.950997233390808,
-0.3121348023414612,
0.5536082983016968,
-0.19279120862483978,
-1.384964108467102,
0.013519798405468464,
0.6658922433853149,
0.34993624687194824,
-0.4455745816230774,
0.7818751931190491,
-0.7351991534233093,
-1.2261719703674316,
-1.4070842266082764,
-0.44494521617889404,
-1.0627598762512207,
-0.9946032166481018,
1.0713731050491333,
0.7577628493309021,
0.24684107303619385,
1.8496536016464233,
0.5931968688964844,
0.2949940860271454,
-2.6103501319885254,
0.9863877892494202,
0.24848362803459167,
-0.039516616612672806,
0.8437551259994507,
0.24406704306602478,
1.0404000282287598,
-0.021647285670042038,
0.5045292377471924,
-2.374232769012451,
2.320509433746338,
-0.2536807954311371,
0.6595773696899414,
0.014141961000859737,
-0.10508005321025848,
1.0867701768875122,
0.6094995737075806,
0.6607446670532227,
-1.0483672618865967,
0.7159472703933716,
-0.6169186234474182,
1.3019721508026123,
0.835611879825592,
-0.7959364652633667,
-0.09026549011468887,
1.2917970418930054,
0.4431680142879486,
-0.5350160598754883,
-0.9237317442893982,
-1.0879335403442383,
0.9339609146118164,
1.672671914100647,
-0.0944562628865242,
-0.050812091678380966,
0.8269956111907959,
0.6479606628417969,
-1.322851300239563,
0.057149410247802734,
-0.7223665714263916,
-0.7153902053833008,
1.540331482887268,
2.0684897899627686,
-0.151530921459198,
-0.24518327414989471,
-0.7507790327072144,
-1.2954832315444946,
0.7251570820808411,
-0.0722959116101265,
0.06087882071733475,
0.6088371276855469,
-0.5551573634147644,
0.9849734902381897,
0.841499924659729,
0.8970031142234802,
0.18355728685855865,
0.25445449352264404,
0.34737715125083923,
-0.3336631953716278,
-1.2253180742263794,
-0.25886645913124084,
-0.9836421608924866,
-2.606123447418213,
0.43529683351516724,
-0.18304337561130524,
-1.3685410022735596,
0.029362741857767105,
-1.074892520904541,
0.9382098913192749,
-0.5287304520606995,
-1.114364504814148,
-1.4826841354370117,
0.07024185359477997,
-0.07194784283638,
0.9307631850242615,
-1.5959594249725342,
-0.08334586769342422,
1.319761872291565,
0.9110318422317505,
-0.6928939819335938,
1.1387569904327393,
0.28522589802742004,
1.0312665700912476,
0.8081250190734863,
-0.3575526177883148,
0.6069363951683044,
0.04350863769650459,
-1.3602122068405151,
0.5178315043449402,
1.177288293838501,
0.25576886534690857,
1.5360761880874634,
-0.6495680212974548,
-0.0702231302857399,
0.43261703848838806,
-0.6681753993034363,
-0.43810874223709106,
-0.5103091597557068,
0.7176939845085144,
-0.05846710503101349,
-0.8746771812438965,
0.058025144040584564,
-0.09915309399366379,
-0.17745842039585114,
0.12363339960575104,
-1.486038088798523,
-0.12475208193063736,
-0.3180084228515625,
-0.6549585461616516,
-1.2915796041488647,
-0.03472231701016426,
1.426408290863037,
-0.8155657052993774,
-0.22659039497375488,
0.40056297183036804,
0.3939891755580902,
0.5202118158340454,
0.678760290145874,
-0.6153991222381592,
-0.30089783668518066,
-0.18412598967552185,
-0.2884615957736969,
0.3416935205459595,
1.4273194074630737,
-0.13051530718803406,
-0.9958993792533875,
0.7465226650238037,
-0.3118319809436798,
0.07225830107927322,
1.9274587631225586,
0.10848090797662735,
-0.834527313709259,
0.2749936282634735,
-0.7557676434516907,
1.9688133001327515,
1.6791224479675293,
1.3394463062286377,
-0.2247193455696106,
-0.9665102958679199,
0.6101062297821045,
-0.41079485416412354,
-0.3747389316558838,
0.8773409128189087,
0.43103334307670593,
-0.23499803245067596,
-1.2767446041107178,
0.707895040512085,
1.2173285484313965,
-0.8735648393630981,
-0.86415034532547,
0.20289738476276398,
-0.7557830810546875,
1.0605355501174927,
0.6952223777770996,
0.3995714783668518,
0.24178901314735413,
1.5906550884246826,
0.7849398255348206,
-0.5487251281738281,
0.5477087497711182,
0.48387855291366577,
-0.2441634237766266,
-2.132612705230713,
-1.100788950920105,
0.38616275787353516,
-0.6208111047744751,
-1.639485239982605,
1.3813477754592896,
-1.0648378133773804,
-1.0110100507736206,
0.5102651715278625,
0.06591065227985382,
1.4320417642593384,
0.3687475621700287,
1.5496758222579956,
2.023242473602295,
0.8631303310394287,
0.45375561714172363,
1.2704050540924072,
-0.19494108855724335,
-0.5105741024017334,
1.8183627128601074,
-0.4829278290271759,
0.45466992259025574,
1.1421164274215698,
-0.29985031485557556,
-1.0370303392410278,
-0.7433935403823853,
-1.1765233278274536,
-0.6715365052223206,
1.119499683380127,
0.14830972254276276,
-1.1116912364959717,
0.23915500938892365,
1.4966421127319336,
0.10703884810209274,
-0.3450920581817627,
0.6534717082977295,
0.3203091323375702,
-0.7922506332397461,
-0.0042849755845963955,
-0.9645588994026184,
0.5593082904815674,
-0.2544003129005432,
-0.3342287242412567,
0.3284141719341278,
0.40134909749031067,
1.365169644355774,
-0.04883212968707085,
0.1607770472764969,
1.16389000415802,
-1.3601547479629517,
1.50651216506958,
-0.6399326324462891,
0.25538963079452515,
-2.263363838195801,
1.2992067337036133,
-0.8121734261512756,
1.9420384168624878,
-2.7129709720611572,
0.4486999809741974,
-0.6443997025489807,
-0.4344804883003235,
0.31926679611206055,
-0.35422420501708984,
0.07361951470375061,
-0.15101709961891174,
-1.1617149114608765,
-0.05673045292496681,
-0.71258944272995,
0.550872802734375,
1.1039001941680908,
1.3295178413391113,
-1.1179193258285522,
-0.2538900375366211,
-1.7174396514892578,
-0.15154539048671722,
-0.8348715901374817,
0.47986918687820435,
-2.028787851333618,
-0.2059311866760254,
-1.9049018621444702,
-2.338073492050171,
-1.1945061683654785,
-0.8120555281639099,
1.1493566036224365,
0.15061356127262115,
-0.828760027885437,
1.2145628929138184,
-0.30227038264274597,
-1.8631116151809692,
1.032098412513733,
-2.0746946334838867
] |
https://github.com/huggingface/datasets/issues/6079 | Iterating over DataLoader based on HF datasets is stuck forever | I already have cast in collate_fn, in which I perform .astype(float) for each numerical field.
On the same instance, I installed a conda env with python 3.6, and this works well.
Sample:
```
def streaming_data_collate_fn(batch):
df = pd.DataFrame.from_dict(batch)
feat_vals = torch.FloatTensor(np.nan_to_num(np.array(df[feats].astype(float))))
``` | ### Describe the bug
I am using Amazon Sagemaker notebook (Amazon Linux 2) with python 3.10 based Conda environment.
I have a dataset in parquet format locally. When I try to iterate over it, the loader is stuck forever. Note that the same code is working for python 3.6 based conda environment seamlessly. What should be my next steps here?
### Steps to reproduce the bug
```
train_dataset = load_dataset(
"parquet", data_files = {'train': tr_data_path + '*.parquet'},
split = 'train',
collate_fn = streaming_data_collate_fn,
streaming = True
).with_format('torch')
train_dataloader = DataLoader(train_dataset, batch_size = 2, num_workers = 0)
t = time.time()
iter_ = 0
for batch in train_dataloader:
iter_ += 1
if iter_ == 1000:
break
print (time.time() - t)
```
### Expected behavior
The snippet should work normally and load the next batch of data.
### Environment info
datasets: '2.14.0'
pyarrow: '12.0.0'
torch: '2.0.0'
Python: 3.10.10 | packaged by conda-forge | (main, Mar 24 2023, 20:08:06) [GCC 11.3.0]
!uname -r
5.10.178-162.673.amzn2.x86_64 | 11 | 42 | Iterating over DataLoader based on HF datasets is stuck forever
### Describe the bug
I am using Amazon Sagemaker notebook (Amazon Linux 2) with python 3.10 based Conda environment.
I have a dataset in parquet format locally. When I try to iterate over it, the loader is stuck forever. Note that the same code is working for python 3.6 based conda environment seamlessly. What should be my next steps here?
### Steps to reproduce the bug
```
train_dataset = load_dataset(
"parquet", data_files = {'train': tr_data_path + '*.parquet'},
split = 'train',
collate_fn = streaming_data_collate_fn,
streaming = True
).with_format('torch')
train_dataloader = DataLoader(train_dataset, batch_size = 2, num_workers = 0)
t = time.time()
iter_ = 0
for batch in train_dataloader:
iter_ += 1
if iter_ == 1000:
break
print (time.time() - t)
```
### Expected behavior
The snippet should work normally and load the next batch of data.
### Environment info
datasets: '2.14.0'
pyarrow: '12.0.0'
torch: '2.0.0'
Python: 3.10.10 | packaged by conda-forge | (main, Mar 24 2023, 20:08:06) [GCC 11.3.0]
!uname -r
5.10.178-162.673.amzn2.x86_64
I already have cast in collate_fn, in which I perform .astype(float) for each numerical field.
On the same instance, I installed a conda env with python 3.6, and this works well.
Sample:
```
def streaming_data_collate_fn(batch):
df = pd.DataFrame.from_dict(batch)
feat_vals = torch.FloatTensor(np.nan_to_num(np.array(df[feats].astype(float))))
``` | [
-1.3096867799758911,
-1.0151026248931885,
-0.654405415058136,
1.5715867280960083,
-0.2311745584011078,
-1.1411608457565308,
0.1739429086446762,
-0.9530844688415527,
1.66796875,
-0.8388645648956299,
0.2485904097557068,
-1.5883809328079224,
0.09396015852689743,
-0.5771110653877258,
-0.6925802230834961,
-0.8570770621299744,
-0.4146874248981476,
-0.7778530120849609,
1.1896148920059204,
2.440484046936035,
1.1997114419937134,
-1.4232124090194702,
2.7564876079559326,
0.7170611023902893,
-0.19052833318710327,
-1.0805776119232178,
0.4426341652870178,
0.022535353899002075,
-1.3379639387130737,
-0.4869075119495392,
-0.9965317845344543,
-0.10414715111255646,
-0.5772668123245239,
-0.4708634614944458,
0.038312382996082306,
0.38878360390663147,
-0.3079364597797394,
-0.48243293166160583,
-0.5072847008705139,
-0.7363354563713074,
0.4595317840576172,
-0.397100031375885,
0.9219574332237244,
-0.31455114483833313,
1.8185019493103027,
-0.5105593204498291,
0.5133712887763977,
0.7263620495796204,
1.2602850198745728,
0.18532878160476685,
-0.09213219583034515,
0.4124717116355896,
0.428472638130188,
0.022085387259721756,
0.5805779695510864,
1.1483293771743774,
0.646795928478241,
0.4280564486980438,
0.685559868812561,
-2.239625930786133,
1.3267836570739746,
-1.049782156944275,
0.3482581377029419,
1.3027223348617554,
-1.0155895948410034,
0.37155404686927795,
-1.7127790451049805,
-0.030043546110391617,
0.6566373109817505,
-2.2135751247406006,
0.31556499004364014,
-1.3559396266937256,
-0.49985072016716003,
1.0694321393966675,
0.39056235551834106,
-1.2015420198440552,
0.10387592017650604,
-0.492864191532135,
1.0623021125793457,
0.394155889749527,
1.0797697305679321,
-1.637520670890808,
-0.09513060003519058,
-0.2755962908267975,
0.1251106709241867,
-1.2785418033599854,
-1.5084528923034668,
0.5647563338279724,
0.6990648508071899,
0.5402552485466003,
-0.15228404104709625,
1.1224725246429443,
-1.0848002433776855,
0.7989893555641174,
-1.0876787900924683,
-1.6750431060791016,
-1.4837896823883057,
-2.355186700820923,
-2.2997138500213623,
0.7110174894332886,
-0.3844025433063507,
-0.5116841793060303,
2.1154913902282715,
-1.0225534439086914,
-1.7204711437225342,
1.2016252279281616,
0.19644875824451447,
-0.001937052235007286,
2.326815128326416,
0.20437940955162048,
-0.7485356330871582,
0.43808165192604065,
-0.8238169550895691,
0.7423199415206909,
-0.34136494994163513,
1.3697233200073242,
0.3971323072910309,
-1.0073949098587036,
1.5982636213302612,
-0.2660088539123535,
0.5704408884048462,
-0.6104174852371216,
-0.5113963484764099,
-0.7093391418457031,
0.29076310992240906,
1.9932290315628052,
-0.26582151651382446,
1.4876220226287842,
-0.3380652964115143,
-1.5479192733764648,
-1.611925482749939,
0.9131816029548645,
0.45100584626197815,
-0.754438042640686,
0.15058633685112,
-0.3907057046890259,
0.1913667470216751,
-0.052844274789094925,
1.1355410814285278,
1.2713807821273804,
0.7208124995231628,
-0.4057602286338806,
-0.9153607487678528,
0.22066420316696167,
-0.14279145002365112,
-0.6559154987335205,
-1.7987339496612549,
-0.3849617540836334,
0.012678864412009716,
0.673972487449646,
-1.189194917678833,
1.6936300992965698,
0.9296067953109741,
1.86659836769104,
1.0454767942428589,
-0.3215910494327545,
1.504955530166626,
0.15690046548843384,
1.7970075607299805,
-0.46737468242645264,
0.6489663124084473,
-0.3799600303173065,
-1.094775676727295,
0.7641201615333557,
-0.3033905327320099,
-2.0379884243011475,
-0.7232341170310974,
-0.7498311996459961,
-0.1771305799484253,
-0.7949440479278564,
0.9277682900428772,
-0.2908604145050049,
-1.4638890027999878,
0.3192678689956665,
-0.7638530731201172,
0.21803656220436096,
-1.1803699731826782,
0.37259209156036377,
0.7193127870559692,
-0.5657587647438049,
0.16446495056152344,
-0.2708050310611725,
-1.2849242687225342,
-0.4387689232826233,
0.32452070713043213,
1.833904504776001,
-0.7913594245910645,
0.880153477191925,
1.1224287748336792,
-0.6764014959335327,
0.019964057952165604,
0.29250437021255493,
-0.24647285044193268,
0.8600201606750488,
-1.012130856513977,
-0.4555339813232422,
1.2309821844100952,
-0.3277507424354553,
-0.5755817294120789,
1.4807119369506836,
0.7400423288345337,
-1.0172529220581055,
-0.24340587854385376,
-0.07394665479660034,
-0.7957198023796082,
0.10506349056959152,
-1.5934679508209229,
-0.13750791549682617,
0.4883807897567749,
-1.5994367599487305,
-0.4130164682865143,
-0.20619472861289978,
1.385690689086914,
-0.08371934294700623,
1.5381540060043335,
-0.3749271631240845,
-0.20268578827381134,
-0.28413069248199463,
-0.344384104013443,
0.22864246368408203,
-0.18812979757785797,
-0.5996495485305786,
0.16784974932670593,
-0.7588263154029846,
0.3458423614501953,
1.4286818504333496,
0.34015530347824097,
-0.006912429351359606,
0.5074713230133057,
1.063926100730896,
0.4078480005264282,
-0.0383758619427681,
-0.8654642105102539,
-1.5201737880706787,
1.982067584991455,
-1.4465255737304688,
2.0149776935577393,
0.7362522482872009,
-0.010867360979318619,
-1.7871742248535156,
-1.8473328351974487,
1.3625379800796509,
1.0692449808120728,
2.343599557876587,
0.5037311315536499,
0.3695605993270874,
-0.8675946593284607,
-0.6586594581604004,
0.3076840341091156,
-1.011961817741394,
-0.7770019173622131,
0.12670233845710754,
2.4588582515716553,
1.7797982692718506,
-0.3705771267414093,
-0.15095429122447968,
-0.9857941269874573,
1.4406046867370605,
-0.1996246576309204,
0.2706913948059082,
1.9543639421463013,
-0.2242717742919922,
-1.0144506692886353,
1.282921314239502,
-2.3994507789611816,
0.18354758620262146,
2.0300509929656982,
0.2668898403644562,
0.09268210828304291,
-1.4265522956848145,
-0.6172072887420654,
-0.28284358978271484,
-0.452655553817749,
-1.2178746461868286,
0.5533179044723511,
-0.32018181681632996,
-0.817857027053833,
-1.4124990701675415,
0.20927688479423523,
-1.1003260612487793,
-1.6508221626281738,
0.1876768320798874,
1.8612916469573975,
2.034036874771118,
-0.724478006362915,
1.5765860080718994,
-0.3619024455547333,
0.24196302890777588,
1.2707411050796509,
1.2552002668380737,
3.1128792762756348,
1.9965015649795532,
-1.257662296295166,
0.6530164480209351,
-0.14869487285614014,
-0.45037901401519775,
1.0771147012710571,
-1.2550362348556519,
1.3548824787139893,
-0.10577500611543655,
-1.2094674110412598,
-1.1633399724960327,
1.0127887725830078,
0.5576831698417664,
0.04121774435043335,
-0.4231439530849457,
1.193319320678711,
0.07245184481143951,
1.2806693315505981,
0.4746658205986023,
-0.3288145959377289,
0.6611692309379578,
-0.42112836241722107,
-0.48642146587371826,
1.4962375164031982,
0.1905747652053833,
-1.4167802333831787,
-2.1796553134918213,
-0.25715282559394836,
-0.8605552315711975,
-0.0014183362945914268,
-0.631344735622406,
-0.9593620300292969,
1.6191457509994507,
0.3269351124763489,
-1.2655833959579468,
-0.21546494960784912,
-0.32636457681655884,
-0.5640943646430969,
2.7183356285095215,
-1.285623550415039,
-0.31190475821495056,
-0.9601651430130005,
-0.6805768013000488,
1.6439801454544067,
-1.17789888381958,
-0.2601545751094818,
-0.9860497713088989,
-0.6032830476760864,
-1.253135085105896,
-0.5685348510742188,
-0.019595738500356674,
-0.9524122476577759,
0.8660804033279419,
0.16058604419231415,
-1.222337007522583,
-0.35466936230659485,
-0.8878694176673889,
0.8984378576278687,
0.001140393316745758,
0.15612027049064636,
1.8024744987487793,
0.27738967537879944,
-0.4492111802101135,
0.7605787515640259,
1.1117537021636963,
0.6635239124298096,
-0.6730391383171082,
0.20531411468982697,
-0.6466558575630188,
0.3375701606273651,
-1.2236459255218506,
0.34499770402908325,
-2.9172942638397217,
0.6511905193328857,
-0.01496883761137724,
-0.05831747129559517,
-0.08490133285522461,
-1.2799948453903198,
1.1377201080322266,
2.5911049842834473,
-1.1442660093307495,
0.5149045586585999,
0.367108553647995,
1.1869468688964844,
-1.542433738708496,
0.3243381977081299,
-0.4398038685321808,
2.117339849472046,
0.25504249334335327,
1.264349102973938,
-0.4188854992389679,
-2.330822229385376,
0.7055357098579407,
-1.2929030656814575,
-1.1787205934524536,
0.7164074182510376,
-0.939228355884552,
0.11067450791597366,
-1.3578699827194214,
-0.2533239424228668,
-0.8075466156005859,
-1.1612147092819214,
0.6187624335289001,
0.20951497554779053,
0.3934454619884491,
-0.5939764976501465,
0.3336564004421234,
-2.1820759773254395,
-1.3125417232513428,
-0.24696284532546997,
-1.0195761919021606,
0.4633339047431946,
-0.3875660300254822,
0.6861302852630615,
-0.18798047304153442,
0.014358260668814182,
0.3599124252796173,
1.457472562789917,
3.3420045375823975,
0.07687303423881531,
0.29351842403411865,
-0.20732466876506805,
-0.9096679091453552,
1.4780648946762085,
0.9162622094154358,
-0.15231195092201233,
-0.5075994729995728,
-1.1052265167236328,
1.2425888776779175,
1.9441629648208618,
0.9471473097801208,
-0.005359059199690819,
-0.7710188627243042,
-0.7122808694839478,
-0.07779648900032043,
0.10523558408021927,
0.5024141073226929,
0.8698173761367798,
0.06695251166820526,
0.08601740747690201,
1.449414849281311,
1.1490426063537598,
-0.46128958463668823,
0.31773611903190613,
-0.8476153016090393,
-0.46765464544296265,
0.48098352551460266,
0.2641230821609497,
-0.04393169283866882,
0.2731150686740875,
-1.0010870695114136,
-0.16519072651863098,
-0.41937825083732605,
-0.9156687259674072,
-0.7279753684997559,
-0.39019787311553955,
-0.4009973704814911,
1.6290467977523804,
0.19073081016540527,
-0.5430238246917725,
-0.042199861258268356,
-0.7369109392166138,
-0.06012648344039917,
-1.0680067539215088,
0.2834434509277344,
-0.10582172870635986,
-0.10375159978866577,
-0.16803190112113953,
1.75171959400177,
-0.8789433836936951,
-2.063408374786377,
0.1920563280582428,
0.1636430025100708,
-0.2001027762889862,
0.28811830282211304,
1.6444525718688965,
0.5482082366943359,
1.4976321458816528,
1.3159505128860474,
0.9818198680877686,
-0.5918576121330261,
-1.3364665508270264,
0.7480161190032959,
0.973825216293335,
-1.4292107820510864,
0.7387123107910156,
0.003395587205886841,
-0.49301260709762573,
0.683383584022522,
1.2522608041763306,
0.5049756169319153,
-2.1029775142669678,
0.8338475227355957,
-1.0294196605682373,
0.7509717345237732,
0.6893869638442993,
0.6327909231185913,
0.2101212590932846,
0.8472387790679932,
-1.186224341392517,
-1.1241847276687622,
-0.7247899174690247,
-0.7082961201667786,
2.003720998764038,
-0.3395092785358429,
0.58784419298172,
-0.20360295474529266,
-1.3976168632507324,
-0.030337896198034286,
0.6815658807754517,
0.32251065969467163,
-0.47225457429885864,
0.8030073046684265,
-0.737337589263916,
-1.2055950164794922,
-1.3559616804122925,
-0.45478349924087524,
-1.0563220977783203,
-0.9783208966255188,
1.0435649156570435,
0.7286571860313416,
0.27796900272369385,
1.8584879636764526,
0.5829505324363708,
0.2913797199726105,
-2.611116647720337,
0.9601711630821228,
0.23863482475280762,
-0.06007896363735199,
0.8224694132804871,
0.23842552304267883,
1.0182355642318726,
-0.010052042081952095,
0.5232247710227966,
-2.407048463821411,
2.304586172103882,
-0.2229871302843094,
0.686651349067688,
0.03153439238667488,
-0.10436869412660599,
1.0988903045654297,
0.6157498359680176,
0.6566645503044128,
-1.0276247262954712,
0.6794995665550232,
-0.6268848180770874,
1.3152247667312622,
0.8154094815254211,
-0.7921879887580872,
-0.06966360658407211,
1.2974141836166382,
0.4265695810317993,
-0.5382262468338013,
-0.9316728115081787,
-1.0935112237930298,
0.9390228390693665,
1.6975547075271606,
-0.12110750377178192,
-0.05578862875699997,
0.8108376264572144,
0.6871424913406372,
-1.2849345207214355,
0.013331149704754353,
-0.7401451468467712,
-0.6849769353866577,
1.5472369194030762,
2.102914810180664,
-0.17657487094402313,
-0.22736011445522308,
-0.7189814448356628,
-1.313171625137329,
0.7133230566978455,
-0.06834103912115097,
0.08395134657621384,
0.6125223636627197,
-0.5500588417053223,
0.9716100096702576,
0.8576180338859558,
0.8913194537162781,
0.20580177009105682,
0.2509276866912842,
0.35626882314682007,
-0.35455888509750366,
-1.2143027782440186,
-0.3007303476333618,
-0.9885495901107788,
-2.597665309906006,
0.41212397813796997,
-0.15179087221622467,
-1.3913853168487549,
0.09208999574184418,
-1.0696914196014404,
0.9247003793716431,
-0.5545245409011841,
-1.1410969495773315,
-1.4941582679748535,
0.10212928056716919,
-0.05592558532953262,
0.9312624931335449,
-1.5826271772384644,
-0.07015778124332428,
1.2646918296813965,
0.9159048795700073,
-0.6864838004112244,
1.1173471212387085,
0.30985555052757263,
1.0410263538360596,
0.8386610150337219,
-0.37140634655952454,
0.6146723628044128,
0.053523000329732895,
-1.338756799697876,
0.4807835519313812,
1.1738396883010864,
0.22977963089942932,
1.522462248802185,
-0.6348821520805359,
-0.06434532254934311,
0.4614335298538208,
-0.7094549536705017,
-0.4510760009288788,
-0.4949019253253937,
0.7012420892715454,
-0.08981536328792572,
-0.8885146379470825,
-0.010145836509764194,
-0.07025176286697388,
-0.23168112337589264,
0.1479697972536087,
-1.481305718421936,
-0.0873471274971962,
-0.29904064536094666,
-0.6370779871940613,
-1.2728240489959717,
-0.030424468219280243,
1.4299489259719849,
-0.8353326320648193,
-0.24110187590122223,
0.3921838402748108,
0.387824684381485,
0.526554524898529,
0.6684823632240295,
-0.6535672545433044,
-0.3022090494632721,
-0.1799289584159851,
-0.33281683921813965,
0.3355211615562439,
1.4499897956848145,
-0.09226493537425995,
-0.9851163029670715,
0.758762776851654,
-0.3689083456993103,
0.05823814496397972,
1.9124078750610352,
0.1111425831913948,
-0.7705786228179932,
0.28006792068481445,
-0.7720562815666199,
1.9508882761001587,
1.681138515472412,
1.314363956451416,
-0.22397807240486145,
-0.9392902851104736,
0.5876840353012085,
-0.41277194023132324,
-0.37751099467277527,
0.8598676919937134,
0.41517069935798645,
-0.22136445343494415,
-1.3208187818527222,
0.7325459718704224,
1.2219070196151733,
-0.8697737455368042,
-0.8247277736663818,
0.21677906811237335,
-0.770778238773346,
1.113586664199829,
0.6826040148735046,
0.3849576711654663,
0.21249637007713318,
1.6055970191955566,
0.808402955532074,
-0.5065656900405884,
0.5554495453834534,
0.5157949328422546,
-0.23454169929027557,
-2.1692581176757812,
-1.1301467418670654,
0.3797445297241211,
-0.6007055640220642,
-1.6338762044906616,
1.34233558177948,
-1.0862547159194946,
-1.014569878578186,
0.5093922019004822,
0.0666215568780899,
1.4245282411575317,
0.39710766077041626,
1.5495400428771973,
2.0332517623901367,
0.8685562610626221,
0.47693830728530884,
1.2493268251419067,
-0.19619905948638916,
-0.5177485346794128,
1.8167401552200317,
-0.4715234637260437,
0.48986583948135376,
1.159519076347351,
-0.30135229229927063,
-1.059878945350647,
-0.7420387864112854,
-1.2042697668075562,
-0.6854161620140076,
1.093219518661499,
0.16645784676074982,
-1.130847454071045,
0.23629845678806305,
1.4901401996612549,
0.12849260866641998,
-0.33130449056625366,
0.633936882019043,
0.31753620505332947,
-0.7479194402694702,
-0.024623017758131027,
-0.9246981739997864,
0.5386685729026794,
-0.33499038219451904,
-0.3572240173816681,
0.3154282569885254,
0.4178428053855896,
1.3162903785705566,
-0.05905412137508392,
0.11860759556293488,
1.1575576066970825,
-1.4089899063110352,
1.5063002109527588,
-0.6702176928520203,
0.2968786060810089,
-2.275449514389038,
1.2960056066513062,
-0.8348955512046814,
1.9679123163223267,
-2.7297844886779785,
0.4542419910430908,
-0.6404876708984375,
-0.47464966773986816,
0.3084568977355957,
-0.33877068758010864,
0.054847780615091324,
-0.14193609356880188,
-1.175463318824768,
-0.034275464713573456,
-0.6749217510223389,
0.5701308250427246,
1.0829651355743408,
1.3376206159591675,
-1.14236319065094,
-0.26074257493019104,
-1.6994091272354126,
-0.17001332342624664,
-0.8395788669586182,
0.447392076253891,
-2.03232479095459,
-0.1845702975988388,
-1.9023187160491943,
-2.325772523880005,
-1.1956110000610352,
-0.8324244022369385,
1.1340781450271606,
0.13611923158168793,
-0.8129894137382507,
1.2636215686798096,
-0.33388423919677734,
-1.8639706373214722,
1.0305594205856323,
-2.152911424636841
] |
https://github.com/huggingface/datasets/issues/6079 | Iterating over DataLoader based on HF datasets is stuck forever | `collate_fn` is applied after the `torch` formatting step, so I think the only option when working with an `IterableDataset` is to remove the `with_format` call and perform the conversion from Python values to PyTorch tensors in `collate_fn`. The standard `Dataset` supports `with_format("numpy")`, which should make this conversion faster. | ### Describe the bug
I am using Amazon Sagemaker notebook (Amazon Linux 2) with python 3.10 based Conda environment.
I have a dataset in parquet format locally. When I try to iterate over it, the loader is stuck forever. Note that the same code is working for python 3.6 based conda environment seamlessly. What should be my next steps here?
### Steps to reproduce the bug
```
train_dataset = load_dataset(
"parquet", data_files = {'train': tr_data_path + '*.parquet'},
split = 'train',
collate_fn = streaming_data_collate_fn,
streaming = True
).with_format('torch')
train_dataloader = DataLoader(train_dataset, batch_size = 2, num_workers = 0)
t = time.time()
iter_ = 0
for batch in train_dataloader:
iter_ += 1
if iter_ == 1000:
break
print (time.time() - t)
```
### Expected behavior
The snippet should work normally and load the next batch of data.
### Environment info
datasets: '2.14.0'
pyarrow: '12.0.0'
torch: '2.0.0'
Python: 3.10.10 | packaged by conda-forge | (main, Mar 24 2023, 20:08:06) [GCC 11.3.0]
!uname -r
5.10.178-162.673.amzn2.x86_64 | 11 | 48 | Iterating over DataLoader based on HF datasets is stuck forever
### Describe the bug
I am using Amazon Sagemaker notebook (Amazon Linux 2) with python 3.10 based Conda environment.
I have a dataset in parquet format locally. When I try to iterate over it, the loader is stuck forever. Note that the same code is working for python 3.6 based conda environment seamlessly. What should be my next steps here?
### Steps to reproduce the bug
```
train_dataset = load_dataset(
"parquet", data_files = {'train': tr_data_path + '*.parquet'},
split = 'train',
collate_fn = streaming_data_collate_fn,
streaming = True
).with_format('torch')
train_dataloader = DataLoader(train_dataset, batch_size = 2, num_workers = 0)
t = time.time()
iter_ = 0
for batch in train_dataloader:
iter_ += 1
if iter_ == 1000:
break
print (time.time() - t)
```
### Expected behavior
The snippet should work normally and load the next batch of data.
### Environment info
datasets: '2.14.0'
pyarrow: '12.0.0'
torch: '2.0.0'
Python: 3.10.10 | packaged by conda-forge | (main, Mar 24 2023, 20:08:06) [GCC 11.3.0]
!uname -r
5.10.178-162.673.amzn2.x86_64
`collate_fn` is applied after the `torch` formatting step, so I think the only option when working with an `IterableDataset` is to remove the `with_format` call and perform the conversion from Python values to PyTorch tensors in `collate_fn`. The standard `Dataset` supports `with_format("numpy")`, which should make this conversion faster. | [
-1.2474640607833862,
-0.9869871735572815,
-0.7190800905227661,
1.585418462753296,
-0.23098866641521454,
-1.1668672561645508,
0.17919516563415527,
-0.9628450274467468,
1.6689121723175049,
-0.8653399348258972,
0.28742289543151855,
-1.6140029430389404,
0.06157983839511871,
-0.5838105082511902,
-0.6935099363327026,
-0.8597397208213806,
-0.39756208658218384,
-0.7837159633636475,
1.1515284776687622,
2.448878765106201,
1.2092665433883667,
-1.4228845834732056,
2.7243475914001465,
0.6874051690101624,
-0.18258148431777954,
-1.0448718070983887,
0.45862776041030884,
-0.00605046795681119,
-1.2891161441802979,
-0.502373456954956,
-0.9571503400802612,
-0.10623360425233841,
-0.5937087535858154,
-0.48667335510253906,
-0.000050358474254608154,
0.40409165620803833,
-0.34179335832595825,
-0.4883759021759033,
-0.5052530169487,
-0.7725861072540283,
0.42227673530578613,
-0.41924816370010376,
0.9328625798225403,
-0.3434752821922302,
1.843133568763733,
-0.48806846141815186,
0.4825756549835205,
0.7664220929145813,
1.2311936616897583,
0.18752826750278473,
-0.07887164503335953,
0.4001147747039795,
0.42024970054626465,
-0.007353747263550758,
0.5687352418899536,
1.1270235776901245,
0.6442726254463196,
0.4735056161880493,
0.686631977558136,
-2.269334316253662,
1.3186662197113037,
-1.0646979808807373,
0.30210864543914795,
1.3015588521957397,
-1.0044528245925903,
0.3702472448348999,
-1.7093485593795776,
-0.04163204878568649,
0.6242326498031616,
-2.232466697692871,
0.31918275356292725,
-1.3571454286575317,
-0.47422200441360474,
1.087108850479126,
0.3754867911338806,
-1.2253470420837402,
0.08011123538017273,
-0.440402090549469,
1.031000018119812,
0.39611995220184326,
1.0839323997497559,
-1.672306776046753,
-0.11116281151771545,
-0.31976014375686646,
0.10405942052602768,
-1.3195194005966187,
-1.5446962118148804,
0.5604054927825928,
0.6881610751152039,
0.5596078634262085,
-0.13842236995697021,
1.133419156074524,
-1.056888222694397,
0.7700156569480896,
-1.0893312692642212,
-1.7182776927947998,
-1.4635107517242432,
-2.3175272941589355,
-2.3029732704162598,
0.7013909220695496,
-0.41217362880706787,
-0.5083773732185364,
2.1249887943267822,
-1.0383613109588623,
-1.7130309343338013,
1.1892776489257812,
0.20772188901901245,
-0.031121348962187767,
2.3431408405303955,
0.18252180516719818,
-0.7316352725028992,
0.41385066509246826,
-0.7991268038749695,
0.756675660610199,
-0.3339640498161316,
1.336255669593811,
0.3994489908218384,
-1.0375908613204956,
1.6060655117034912,
-0.26080232858657837,
0.6029633283615112,
-0.6260465383529663,
-0.5168277621269226,
-0.7472049593925476,
0.2755047082901001,
1.9621009826660156,
-0.29148250818252563,
1.4751123189926147,
-0.3247135281562805,
-1.5244810581207275,
-1.6362156867980957,
0.9500798583030701,
0.42558616399765015,
-0.7813743352890015,
0.13585573434829712,
-0.3303183317184448,
0.19251392781734467,
-0.10896354168653488,
1.1648563146591187,
1.256186604499817,
0.7276239395141602,
-0.4130480885505676,
-0.9260453581809998,
0.21213236451148987,
-0.1307288259267807,
-0.6645070314407349,
-1.7438582181930542,
-0.3959113359451294,
0.011455671861767769,
0.6550705432891846,
-1.2065662145614624,
1.7135652303695679,
0.9360860586166382,
1.8617291450500488,
1.0465317964553833,
-0.33378905057907104,
1.4924180507659912,
0.1411384493112564,
1.822067379951477,
-0.4679350256919861,
0.6080024838447571,
-0.40171098709106445,
-1.11543607711792,
0.7870504856109619,
-0.2753050923347473,
-2.0005414485931396,
-0.7494476437568665,
-0.8042128682136536,
-0.21310918033123016,
-0.7732337117195129,
0.9123914837837219,
-0.26218080520629883,
-1.4518460035324097,
0.2990454435348511,
-0.7073299884796143,
0.17277827858924866,
-1.2019996643066406,
0.4140232801437378,
0.676556408405304,
-0.5771222710609436,
0.1486150175333023,
-0.27468663454055786,
-1.2969670295715332,
-0.4470996856689453,
0.30627328157424927,
1.8486260175704956,
-0.778964102268219,
0.9172187447547913,
1.1091117858886719,
-0.7043505907058716,
0.0047410475090146065,
0.3070604205131531,
-0.25503307580947876,
0.8653206825256348,
-1.009992241859436,
-0.46681469678878784,
1.209969401359558,
-0.30704593658447266,
-0.6236295700073242,
1.4814162254333496,
0.7409685850143433,
-1.0208957195281982,
-0.25185370445251465,
-0.09022965282201767,
-0.8098572492599487,
0.13089001178741455,
-1.6112197637557983,
-0.13188055157661438,
0.4459989666938782,
-1.5665429830551147,
-0.45753055810928345,
-0.2140558809041977,
1.3727222681045532,
-0.0834791362285614,
1.4737285375595093,
-0.3752456307411194,
-0.23666329681873322,
-0.2861192226409912,
-0.3570255637168884,
0.16348588466644287,
-0.17443247139453888,
-0.6301014423370361,
0.16559356451034546,
-0.7400254607200623,
0.34273260831832886,
1.43285071849823,
0.32514840364456177,
-0.04040218144655228,
0.5086140036582947,
1.0846586227416992,
0.41825199127197266,
0.019612926989793777,
-0.8995472192764282,
-1.485770583152771,
1.957190990447998,
-1.4645692110061646,
2.005265712738037,
0.7095295190811157,
0.0058019887655973434,
-1.779424786567688,
-1.8793774843215942,
1.3972433805465698,
1.0648037195205688,
2.2827625274658203,
0.5505614280700684,
0.3714575171470642,
-0.8525716662406921,
-0.6519990563392639,
0.31009113788604736,
-1.0111632347106934,
-0.7576391100883484,
0.16365426778793335,
2.440882444381714,
1.7283456325531006,
-0.3981253504753113,
-0.14158323407173157,
-0.9773507118225098,
1.4131630659103394,
-0.16315078735351562,
0.28899210691452026,
1.9895752668380737,
-0.24499523639678955,
-1.0119943618774414,
1.246759295463562,
-2.386451244354248,
0.16528265178203583,
2.0382583141326904,
0.2451144903898239,
0.10042791813611984,
-1.3904469013214111,
-0.6162855625152588,
-0.2677047848701477,
-0.4595683217048645,
-1.2336454391479492,
0.5121127963066101,
-0.28901833295822144,
-0.787067711353302,
-1.4075711965560913,
0.24703441560268402,
-1.1017626523971558,
-1.6417202949523926,
0.19986389577388763,
1.9120440483093262,
2.0284619331359863,
-0.7415814399719238,
1.613612174987793,
-0.34918415546417236,
0.2268165498971939,
1.266823172569275,
1.2570102214813232,
3.142592191696167,
1.980912685394287,
-1.2665717601776123,
0.664044976234436,
-0.12985628843307495,
-0.4551740884780884,
1.1390538215637207,
-1.2386618852615356,
1.3345985412597656,
-0.14246053993701935,
-1.1987639665603638,
-1.1741249561309814,
0.9618713855743408,
0.5306301116943359,
0.057508885860443115,
-0.43628740310668945,
1.1918925046920776,
0.08295298367738724,
1.253982663154602,
0.48109668493270874,
-0.3460600972175598,
0.6766624450683594,
-0.44203346967697144,
-0.49094927310943604,
1.5145344734191895,
0.18900978565216064,
-1.3790050745010376,
-2.222032308578491,
-0.25441932678222656,
-0.8479142785072327,
0.03955763950943947,
-0.633152186870575,
-0.9440646767616272,
1.6430906057357788,
0.3482569456100464,
-1.2765036821365356,
-0.25403064489364624,
-0.34032124280929565,
-0.5547398328781128,
2.7166967391967773,
-1.3040268421173096,
-0.28787416219711304,
-0.9841190576553345,
-0.6661311388015747,
1.6673153638839722,
-1.20595383644104,
-0.26321613788604736,
-0.9865807890892029,
-0.5770022869110107,
-1.2827107906341553,
-0.5599499940872192,
0.00010267924517393112,
-0.9373336434364319,
0.9051552414894104,
0.184464693069458,
-1.1930451393127441,
-0.3099372982978821,
-0.9144523739814758,
0.8753790855407715,
-0.05381230264902115,
0.20324817299842834,
1.7987408638000488,
0.3181125521659851,
-0.406002402305603,
0.7669413685798645,
1.0938336849212646,
0.6649999618530273,
-0.6544888019561768,
0.24255354702472687,
-0.6626716256141663,
0.3153829574584961,
-1.192891001701355,
0.3407357931137085,
-2.898296594619751,
0.5955909490585327,
-0.03323370963335037,
-0.03464122861623764,
-0.04792758449912071,
-1.290106177330017,
1.1428464651107788,
2.5444588661193848,
-1.1452505588531494,
0.5108366012573242,
0.3318735957145691,
1.2003871202468872,
-1.5834592580795288,
0.3494936227798462,
-0.47042423486709595,
2.13962984085083,
0.22433902323246002,
1.2369681596755981,
-0.4121100902557373,
-2.3395450115203857,
0.6588239669799805,
-1.2750425338745117,
-1.2150546312332153,
0.7660201787948608,
-0.9104652404785156,
0.08577602356672287,
-1.3595638275146484,
-0.26739567518234253,
-0.8107321262359619,
-1.1702600717544556,
0.7123395204544067,
0.19492723047733307,
0.40810245275497437,
-0.5932864546775818,
0.32967281341552734,
-2.177422285079956,
-1.3329343795776367,
-0.2426656037569046,
-0.9773141741752625,
0.479112446308136,
-0.37365156412124634,
0.6992489695549011,
-0.2018287628889084,
0.04234130680561066,
0.3489323854446411,
1.4348852634429932,
3.378411293029785,
0.10135861486196518,
0.31843870878219604,
-0.22256334125995636,
-0.9166905879974365,
1.4896554946899414,
0.91806960105896,
-0.13356703519821167,
-0.49197447299957275,
-1.1497148275375366,
1.2617583274841309,
1.9596476554870605,
0.942861020565033,
-0.0034660869278013706,
-0.7816618084907532,
-0.6723064184188843,
-0.10550449788570404,
0.14543882012367249,
0.5120168924331665,
0.8827692270278931,
0.09282791614532471,
0.10155299305915833,
1.4284805059432983,
1.1626195907592773,
-0.4478418827056885,
0.3239295482635498,
-0.8351842761039734,
-0.4506429433822632,
0.5001628398895264,
0.25410014390945435,
-0.01121532078832388,
0.26259714365005493,
-0.9687768816947937,
-0.21404513716697693,
-0.4445995092391968,
-0.9316389560699463,
-0.7163748145103455,
-0.4066988229751587,
-0.3727467656135559,
1.6377545595169067,
0.13474303483963013,
-0.5558791756629944,
-0.02837587520480156,
-0.7328405976295471,
-0.046536464244127274,
-1.0999183654785156,
0.2579811215400696,
-0.13212937116622925,
-0.1523643434047699,
-0.14756765961647034,
1.725008487701416,
-0.9213540554046631,
-2.0106794834136963,
0.20864319801330566,
0.21491695940494537,
-0.20985452830791473,
0.30889666080474854,
1.628082513809204,
0.5285189151763916,
1.4926725625991821,
1.334924578666687,
0.9860462546348572,
-0.6372338533401489,
-1.3630647659301758,
0.6926770210266113,
0.9693904519081116,
-1.4299736022949219,
0.7484232187271118,
0.02491915598511696,
-0.5052053928375244,
0.6732683181762695,
1.2326700687408447,
0.5055698156356812,
-2.101264476776123,
0.8174012899398804,
-0.9920326471328735,
0.7806317806243896,
0.6879934072494507,
0.6760692000389099,
0.24347077310085297,
0.8029547929763794,
-1.151645541191101,
-1.1486726999282837,
-0.700944721698761,
-0.7075380682945251,
1.9790153503417969,
-0.30790412425994873,
0.599754273891449,
-0.18843422830104828,
-1.3851039409637451,
-0.012661265209317207,
0.692374587059021,
0.36238986253738403,
-0.47309231758117676,
0.7503275871276855,
-0.7281761765480042,
-1.1651562452316284,
-1.397810697555542,
-0.4397784471511841,
-1.103814721107483,
-0.9959898591041565,
1.0571959018707275,
0.7456608414649963,
0.2467239946126938,
1.8652968406677246,
0.6163383722305298,
0.2971993684768677,
-2.622817277908325,
0.9865115880966187,
0.2596198320388794,
-0.07783376425504684,
0.8388906121253967,
0.2894133925437927,
1.0325313806533813,
0.00641903281211853,
0.5513051748275757,
-2.4046051502227783,
2.3271493911743164,
-0.24919679760932922,
0.6612049341201782,
-0.007827511057257652,
-0.15227507054805756,
1.0891757011413574,
0.593078076839447,
0.6316245198249817,
-1.050098180770874,
0.6876004934310913,
-0.6341161131858826,
1.2978752851486206,
0.8167362213134766,
-0.8122537732124329,
-0.08100973814725876,
1.3068323135375977,
0.4511013627052307,
-0.5423576831817627,
-0.9270167350769043,
-1.089239478111267,
0.9332448840141296,
1.6818146705627441,
-0.11492062360048294,
-0.0566791407763958,
0.8441308736801147,
0.676094651222229,
-1.2898386716842651,
0.0831441655755043,
-0.7035263776779175,
-0.7355118989944458,
1.5577585697174072,
2.050224781036377,
-0.15668019652366638,
-0.24252738058567047,
-0.7768045663833618,
-1.26671302318573,
0.7644101977348328,
-0.051354773342609406,
0.03036399558186531,
0.6227371096611023,
-0.5651997327804565,
1.0281656980514526,
0.8689557909965515,
0.9103370308876038,
0.19172537326812744,
0.26818257570266724,
0.3748551607131958,
-0.35788047313690186,
-1.1995192766189575,
-0.25195711851119995,
-0.9927976131439209,
-2.608332395553589,
0.4514732360839844,
-0.16581128537654877,
-1.3770052194595337,
0.03804823383688927,
-1.0637425184249878,
0.9387388825416565,
-0.5612536072731018,
-1.1543484926223755,
-1.51014244556427,
0.07928025722503662,
-0.06172186881303787,
0.9288385510444641,
-1.6154470443725586,
-0.07941736280918121,
1.298117756843567,
0.9275737404823303,
-0.7052536606788635,
1.0884249210357666,
0.2900769114494324,
1.0397149324417114,
0.8440152406692505,
-0.3693259358406067,
0.6060178875923157,
0.011763999238610268,
-1.3398815393447876,
0.5004757642745972,
1.1688802242279053,
0.2467469424009323,
1.5462679862976074,
-0.6296613812446594,
-0.04492015019059181,
0.43522465229034424,
-0.663314163684845,
-0.447476863861084,
-0.5254576206207275,
0.7307261824607849,
-0.06430204212665558,
-0.8690587878227234,
0.05211975425481796,
-0.0848826915025711,
-0.19112657010555267,
0.1083579808473587,
-1.473142385482788,
-0.09721556305885315,
-0.3137611150741577,
-0.6428645849227905,
-1.278188705444336,
-0.04329659789800644,
1.4126473665237427,
-0.8015118837356567,
-0.21342818439006805,
0.43907034397125244,
0.35015541315078735,
0.4794163107872009,
0.6318588256835938,
-0.6323177218437195,
-0.32844310998916626,
-0.20213426649570465,
-0.326815664768219,
0.3641378879547119,
1.4322338104248047,
-0.11443165689706802,
-0.9820363521575928,
0.7609914541244507,
-0.30624955892562866,
0.05313883721828461,
1.8994745016098022,
0.08264786005020142,
-0.7897287607192993,
0.2979999780654907,
-0.7235297560691833,
1.9531108140945435,
1.7033486366271973,
1.3187469244003296,
-0.19227972626686096,
-0.9655264616012573,
0.6222324967384338,
-0.43738478422164917,
-0.39270657300949097,
0.8871968388557434,
0.40565043687820435,
-0.20855630934238434,
-1.3082205057144165,
0.7215048670768738,
1.24862802028656,
-0.8404048681259155,
-0.8335545063018799,
0.18447136878967285,
-0.7508139610290527,
1.0766472816467285,
0.6591916680335999,
0.38862329721450806,
0.2298753261566162,
1.5579570531845093,
0.7886137366294861,
-0.49131864309310913,
0.5678753852844238,
0.49478572607040405,
-0.23211517930030823,
-2.1465141773223877,
-1.154739260673523,
0.3902283310890198,
-0.5941962003707886,
-1.6481152772903442,
1.4025294780731201,
-1.083271861076355,
-1.0146998167037964,
0.5376320481300354,
0.07652923464775085,
1.4428521394729614,
0.3954697847366333,
1.5299197435379028,
2.050313949584961,
0.8556105494499207,
0.4632120728492737,
1.2697869539260864,
-0.1993681788444519,
-0.5161789655685425,
1.8161704540252686,
-0.46405136585235596,
0.4595259428024292,
1.1490648984909058,
-0.2695114016532898,
-1.0388662815093994,
-0.7562112808227539,
-1.2351408004760742,
-0.6989173293113708,
1.1103190183639526,
0.12887026369571686,
-1.1089885234832764,
0.26655256748199463,
1.50289785861969,
0.09726061671972275,
-0.376068651676178,
0.6441118121147156,
0.3363214135169983,
-0.7691918015480042,
-0.0211297869682312,
-0.921855628490448,
0.5615823864936829,
-0.28840523958206177,
-0.32762134075164795,
0.34495317935943604,
0.3996483087539673,
1.3589544296264648,
-0.0614871047437191,
0.1497587114572525,
1.1580886840820312,
-1.4040553569793701,
1.5189646482467651,
-0.6785892248153687,
0.2680680751800537,
-2.269096851348877,
1.30478036403656,
-0.8003623485565186,
1.9696866273880005,
-2.693514585494995,
0.4387246370315552,
-0.6354899406433105,
-0.4327343702316284,
0.32940834760665894,
-0.3170322775840759,
0.08530179411172867,
-0.17494548857212067,
-1.1602388620376587,
-0.05106288194656372,
-0.6816933751106262,
0.5680938363075256,
1.0793139934539795,
1.3365437984466553,
-1.1232725381851196,
-0.2570456862449646,
-1.723242998123169,
-0.14028160274028778,
-0.7815619707107544,
0.4469468593597412,
-2.023447275161743,
-0.1761537790298462,
-1.9294718503952026,
-2.345147132873535,
-1.186707615852356,
-0.8181675672531128,
1.1414233446121216,
0.16728098690509796,
-0.8102849721908569,
1.2488447427749634,
-0.3097918629646301,
-1.8463352918624878,
1.0438182353973389,
-2.1017818450927734
] |
https://github.com/huggingface/datasets/issues/6079 | Iterating over DataLoader based on HF datasets is stuck forever | Thanks!
Python 3.10 conda-env: After replacing with_format("torch") with with_format("numpy"), the error went away. However, it was still taking over 2 minutes to load a very small batch of 64 samples with num_workers set to 32. Once I removed with_format call altogether, it is finishing in 11 seconds.
Python 3.6 based conda-env: When I switch the kernel , neither of the above work, and with_format("torch") is the only thing that works, and executes in 1.6 seconds.
I feel something else is also amiss here. | ### Describe the bug
I am using Amazon Sagemaker notebook (Amazon Linux 2) with python 3.10 based Conda environment.
I have a dataset in parquet format locally. When I try to iterate over it, the loader is stuck forever. Note that the same code is working for python 3.6 based conda environment seamlessly. What should be my next steps here?
### Steps to reproduce the bug
```
train_dataset = load_dataset(
"parquet", data_files = {'train': tr_data_path + '*.parquet'},
split = 'train',
collate_fn = streaming_data_collate_fn,
streaming = True
).with_format('torch')
train_dataloader = DataLoader(train_dataset, batch_size = 2, num_workers = 0)
t = time.time()
iter_ = 0
for batch in train_dataloader:
iter_ += 1
if iter_ == 1000:
break
print (time.time() - t)
```
### Expected behavior
The snippet should work normally and load the next batch of data.
### Environment info
datasets: '2.14.0'
pyarrow: '12.0.0'
torch: '2.0.0'
Python: 3.10.10 | packaged by conda-forge | (main, Mar 24 2023, 20:08:06) [GCC 11.3.0]
!uname -r
5.10.178-162.673.amzn2.x86_64 | 11 | 83 | Iterating over DataLoader based on HF datasets is stuck forever
### Describe the bug
I am using Amazon Sagemaker notebook (Amazon Linux 2) with python 3.10 based Conda environment.
I have a dataset in parquet format locally. When I try to iterate over it, the loader is stuck forever. Note that the same code is working for python 3.6 based conda environment seamlessly. What should be my next steps here?
### Steps to reproduce the bug
```
train_dataset = load_dataset(
"parquet", data_files = {'train': tr_data_path + '*.parquet'},
split = 'train',
collate_fn = streaming_data_collate_fn,
streaming = True
).with_format('torch')
train_dataloader = DataLoader(train_dataset, batch_size = 2, num_workers = 0)
t = time.time()
iter_ = 0
for batch in train_dataloader:
iter_ += 1
if iter_ == 1000:
break
print (time.time() - t)
```
### Expected behavior
The snippet should work normally and load the next batch of data.
### Environment info
datasets: '2.14.0'
pyarrow: '12.0.0'
torch: '2.0.0'
Python: 3.10.10 | packaged by conda-forge | (main, Mar 24 2023, 20:08:06) [GCC 11.3.0]
!uname -r
5.10.178-162.673.amzn2.x86_64
Thanks!
Python 3.10 conda-env: After replacing with_format("torch") with with_format("numpy"), the error went away. However, it was still taking over 2 minutes to load a very small batch of 64 samples with num_workers set to 32. Once I removed with_format call altogether, it is finishing in 11 seconds.
Python 3.6 based conda-env: When I switch the kernel , neither of the above work, and with_format("torch") is the only thing that works, and executes in 1.6 seconds.
I feel something else is also amiss here. | [
-1.2701588869094849,
-0.997541069984436,
-0.6988049149513245,
1.51397705078125,
-0.25449058413505554,
-1.1525267362594604,
0.17723368108272552,
-0.9602234959602356,
1.6439114809036255,
-0.8577772378921509,
0.24207332730293274,
-1.6130080223083496,
0.08785462379455566,
-0.5229309797286987,
-0.6811166405677795,
-0.8537085056304932,
-0.400129497051239,
-0.8010273575782776,
1.1871026754379272,
2.476163864135742,
1.1733671426773071,
-1.4396486282348633,
2.732360601425171,
0.7051440477371216,
-0.17561303079128265,
-1.0406826734542847,
0.49575236439704895,
0.002503238618373871,
-1.3049198389053345,
-0.4783833920955658,
-0.9716491103172302,
-0.07708154618740082,
-0.56305992603302,
-0.43802228569984436,
0.018092865124344826,
0.3574293553829193,
-0.2873089611530304,
-0.4843795597553253,
-0.5461376905441284,
-0.7368584871292114,
0.41958796977996826,
-0.4199245572090149,
0.9315210580825806,
-0.3319796621799469,
1.847409725189209,
-0.46638062596321106,
0.4906671345233917,
0.7715662717819214,
1.253271460533142,
0.18565033376216888,
-0.03796330839395523,
0.35921189188957214,
0.43123728036880493,
0.006302153691649437,
0.5781643390655518,
1.1488054990768433,
0.6594728231430054,
0.43466728925704956,
0.6654775142669678,
-2.2378880977630615,
1.3189213275909424,
-1.0267679691314697,
0.3469168543815613,
1.317851185798645,
-0.9846623539924622,
0.38176023960113525,
-1.7128181457519531,
-0.03979557752609253,
0.653580367565155,
-2.224034070968628,
0.3294602930545807,
-1.3343183994293213,
-0.5041247010231018,
1.0220146179199219,
0.37165719270706177,
-1.1922883987426758,
0.09770189225673676,
-0.4650789499282837,
1.0417280197143555,
0.4054632782936096,
1.0925238132476807,
-1.6195753812789917,
-0.08321529626846313,
-0.275983989238739,
0.12834490835666656,
-1.3108586072921753,
-1.5227161645889282,
0.574711263179779,
0.6916375160217285,
0.5379039645195007,
-0.14215746521949768,
1.1034311056137085,
-1.1029599905014038,
0.8196528553962708,
-1.0427231788635254,
-1.6792923212051392,
-1.4665696620941162,
-2.376901149749756,
-2.2732508182525635,
0.7333661913871765,
-0.39804884791374207,
-0.49667394161224365,
2.1360435485839844,
-1.0553760528564453,
-1.6779736280441284,
1.213833212852478,
0.18864218890666962,
-0.01648104377090931,
2.367807626724243,
0.19370578229427338,
-0.740320086479187,
0.45152002573013306,
-0.8162388205528259,
0.7454320192337036,
-0.3527683913707733,
1.3318248987197876,
0.38049402832984924,
-1.003005862236023,
1.5774284601211548,
-0.3059832453727722,
0.5948058366775513,
-0.5899661779403687,
-0.527621328830719,
-0.7220793962478638,
0.2674453854560852,
1.9524391889572144,
-0.27683958411216736,
1.465733289718628,
-0.32064393162727356,
-1.5348618030548096,
-1.6278679370880127,
0.9373615980148315,
0.463352233171463,
-0.7661367654800415,
0.13881102204322815,
-0.34337809681892395,
0.1774672120809555,
-0.10009114444255829,
1.1231753826141357,
1.2972475290298462,
0.7393402457237244,
-0.3880881071090698,
-0.942970335483551,
0.2182033658027649,
-0.18103322386741638,
-0.6452265381813049,
-1.7721484899520874,
-0.38322171568870544,
-0.004006808623671532,
0.6771760582923889,
-1.2144695520401,
1.716679573059082,
0.9659044146537781,
1.8842787742614746,
1.0310038328170776,
-0.33475255966186523,
1.525872826576233,
0.14535485208034515,
1.8079302310943604,
-0.4700975716114044,
0.6284343004226685,
-0.395235151052475,
-1.1112496852874756,
0.7731799483299255,
-0.30525150895118713,
-1.9916465282440186,
-0.7214903235435486,
-0.8011318445205688,
-0.23762212693691254,
-0.8037933111190796,
0.9121501445770264,
-0.2873883545398712,
-1.4314733743667603,
0.2876891791820526,
-0.7240349650382996,
0.16790291666984558,
-1.185151219367981,
0.4094178080558777,
0.6866364479064941,
-0.5590044856071472,
0.1188606321811676,
-0.24109621345996857,
-1.2746286392211914,
-0.4516345262527466,
0.31067967414855957,
1.8552254438400269,
-0.7664498686790466,
0.8937448859214783,
1.11626398563385,
-0.6781495809555054,
0.0017331279814243317,
0.28495338559150696,
-0.27585262060165405,
0.8451113700866699,
-1.022613763809204,
-0.463473916053772,
1.2111033201217651,
-0.3218679428100586,
-0.584195613861084,
1.4826488494873047,
0.703504204750061,
-1.0147500038146973,
-0.23862643539905548,
-0.06592810153961182,
-0.7831775546073914,
0.1332242339849472,
-1.5895565748214722,
-0.14722754061222076,
0.4538007080554962,
-1.5740971565246582,
-0.45052289962768555,
-0.2127598226070404,
1.3598495721817017,
-0.061550725251436234,
1.5061075687408447,
-0.3865557312965393,
-0.19610269367694855,
-0.29733502864837646,
-0.378986656665802,
0.2033340483903885,
-0.19208388030529022,
-0.6044722199440002,
0.17079564929008484,
-0.7860938906669617,
0.32049694657325745,
1.4522050619125366,
0.3385075628757477,
-0.014925235882401466,
0.5170542001724243,
1.0526115894317627,
0.4553714692592621,
-0.013398164883255959,
-0.907142162322998,
-1.5020304918289185,
1.9925936460494995,
-1.463759422302246,
2.04013991355896,
0.7614389061927795,
-0.01898888312280178,
-1.7802704572677612,
-1.8901606798171997,
1.3464577198028564,
1.0796940326690674,
2.297956943511963,
0.48755207657814026,
0.3718251585960388,
-0.850169837474823,
-0.6473580598831177,
0.2762821912765503,
-1.0193513631820679,
-0.765593945980072,
0.14762891829013824,
2.4665307998657227,
1.7268548011779785,
-0.3922407627105713,
-0.11161129176616669,
-0.9851847887039185,
1.430478811264038,
-0.14847137033939362,
0.28826725482940674,
2.0063414573669434,
-0.2248963564634323,
-1.014085292816162,
1.2307307720184326,
-2.398024082183838,
0.1770232617855072,
2.0561842918395996,
0.2609591484069824,
0.10673551261425018,
-1.3951268196105957,
-0.5940955281257629,
-0.2858896851539612,
-0.470083624124527,
-1.1987589597702026,
0.5823470950126648,
-0.3053801655769348,
-0.8077788949012756,
-1.3958492279052734,
0.20675967633724213,
-1.1191632747650146,
-1.6542097330093384,
0.20028305053710938,
1.873580813407898,
2.090379238128662,
-0.7844973206520081,
1.5643737316131592,
-0.32795408368110657,
0.19403056800365448,
1.2133690118789673,
1.252477765083313,
3.1244661808013916,
1.969364047050476,
-1.2768090963363647,
0.6224083304405212,
-0.15433529019355774,
-0.441391259431839,
1.0869204998016357,
-1.2298392057418823,
1.3371058702468872,
-0.09940895438194275,
-1.1833235025405884,
-1.1315079927444458,
0.9790199995040894,
0.5570042729377747,
0.02749495953321457,
-0.41906237602233887,
1.2068365812301636,
0.07042533159255981,
1.2900521755218506,
0.467149555683136,
-0.3340808153152466,
0.639426589012146,
-0.44310757517814636,
-0.4880206882953644,
1.537368655204773,
0.17308934032917023,
-1.4367198944091797,
-2.2222447395324707,
-0.26654893159866333,
-0.8849257826805115,
0.016620906069874763,
-0.6116673946380615,
-0.9662140011787415,
1.625877022743225,
0.31765690445899963,
-1.2384741306304932,
-0.2577003836631775,
-0.3386326730251312,
-0.5744284391403198,
2.7145142555236816,
-1.3241969347000122,
-0.2918230891227722,
-0.964407205581665,
-0.6582754254341125,
1.649120807647705,
-1.246262788772583,
-0.24607224762439728,
-1.0149670839309692,
-0.5898327827453613,
-1.257222294807434,
-0.5416624546051025,
-0.013714661821722984,
-0.9535548686981201,
0.8954765200614929,
0.19149021804332733,
-1.190814733505249,
-0.3221549093723297,
-0.930261492729187,
0.8934396505355835,
-0.01993665099143982,
0.19407673180103302,
1.771870732307434,
0.288649320602417,
-0.42249295115470886,
0.7592858076095581,
1.122753620147705,
0.6431753039360046,
-0.69842529296875,
0.18848608434200287,
-0.6796755790710449,
0.3571891486644745,
-1.2056869268417358,
0.34484368562698364,
-2.898932456970215,
0.6180151700973511,
-0.03615841642022133,
-0.05562354251742363,
-0.06001171097159386,
-1.2819812297821045,
1.1560578346252441,
2.5419371128082275,
-1.15488862991333,
0.529338002204895,
0.36845487356185913,
1.2264981269836426,
-1.5638412237167358,
0.32753831148147583,
-0.46634334325790405,
2.1161136627197266,
0.24571901559829712,
1.2138577699661255,
-0.4198884665966034,
-2.386744976043701,
0.6719309091567993,
-1.2817288637161255,
-1.1550264358520508,
0.7292847037315369,
-0.9607398509979248,
0.09721380472183228,
-1.3678561449050903,
-0.26493093371391296,
-0.8309328556060791,
-1.1566781997680664,
0.6427813768386841,
0.20667502284049988,
0.41073429584503174,
-0.6036844849586487,
0.30793896317481995,
-2.2074856758117676,
-1.332542896270752,
-0.22885450720787048,
-0.9585644602775574,
0.48808494210243225,
-0.391293466091156,
0.7258768081665039,
-0.192579984664917,
0.03596463426947594,
0.34118327498435974,
1.4308717250823975,
3.34895920753479,
0.0667768120765686,
0.3026490807533264,
-0.2189941555261612,
-0.9393515586853027,
1.488121747970581,
0.9231635332107544,
-0.14700248837471008,
-0.5028260350227356,
-1.1634390354156494,
1.25087571144104,
1.9425779581069946,
0.9486922025680542,
-0.011282362975180149,
-0.790289580821991,
-0.6650676131248474,
-0.0919489711523056,
0.13651733100414276,
0.536473274230957,
0.9091496467590332,
0.022863119840621948,
0.09523709118366241,
1.465559720993042,
1.1924430131912231,
-0.4478757679462433,
0.3257329761981964,
-0.8411945104598999,
-0.4722015857696533,
0.48376044631004333,
0.2636289894580841,
0.0017910413444042206,
0.30885517597198486,
-0.9862009286880493,
-0.2153376042842865,
-0.4039338529109955,
-0.9349409341812134,
-0.7126690149307251,
-0.3929004669189453,
-0.3690302073955536,
1.6336477994918823,
0.2013021856546402,
-0.5318806767463684,
-0.0007514813914895058,
-0.743730366230011,
-0.04516824707388878,
-1.110672950744629,
0.24140551686286926,
-0.13072264194488525,
-0.10589176416397095,
-0.14330101013183594,
1.744181513786316,
-0.9011126756668091,
-2.043588638305664,
0.19388802349567413,
0.20713701844215393,
-0.18075038492679596,
0.2904224991798401,
1.6421003341674805,
0.5198937654495239,
1.50315523147583,
1.31060791015625,
0.9799487590789795,
-0.6150308847427368,
-1.3455204963684082,
0.730927050113678,
0.9919595122337341,
-1.4380972385406494,
0.7607240676879883,
0.004187021404504776,
-0.5007767081260681,
0.6978158950805664,
1.2225512266159058,
0.5030778646469116,
-2.125922918319702,
0.8506892919540405,
-1.060181736946106,
0.8145491480827332,
0.7028776407241821,
0.6676031947135925,
0.22411026060581207,
0.8384104371070862,
-1.179531455039978,
-1.1340285539627075,
-0.7203622460365295,
-0.7368834614753723,
2.0087132453918457,
-0.3232485353946686,
0.6017305254936218,
-0.20299945771694183,
-1.3571909666061401,
-0.03106197714805603,
0.6626098155975342,
0.3293890655040741,
-0.4529348909854889,
0.7838957905769348,
-0.7734266519546509,
-1.215181827545166,
-1.4156426191329956,
-0.4404192864894867,
-1.0748103857040405,
-1.0064456462860107,
1.0857503414154053,
0.7252930998802185,
0.25578200817108154,
1.892201542854309,
0.6086226105690002,
0.293865829706192,
-2.6118874549865723,
0.9458434581756592,
0.24943459033966064,
-0.08795712888240814,
0.8430770635604858,
0.2696574330329895,
1.0548341274261475,
0.009131236001849174,
0.5393955111503601,
-2.4205474853515625,
2.302962303161621,
-0.25213801860809326,
0.6903431415557861,
0.031327541917562485,
-0.1081976592540741,
1.0910946130752563,
0.6337183117866516,
0.6292688250541687,
-1.033584713935852,
0.6829966902732849,
-0.614971399307251,
1.2921192646026611,
0.8378676772117615,
-0.8100093603134155,
-0.03985774144530296,
1.289265513420105,
0.44301894307136536,
-0.5371102690696716,
-0.9209550619125366,
-1.080225944519043,
0.9273495078086853,
1.7155797481536865,
-0.1200663149356842,
-0.016470495611429214,
0.7762956619262695,
0.6931928992271423,
-1.3176597356796265,
0.02343207225203514,
-0.7318390607833862,
-0.6911810040473938,
1.541886568069458,
2.0845835208892822,
-0.1490609347820282,
-0.19841112196445465,
-0.6964938044548035,
-1.3225892782211304,
0.7296470999717712,
-0.11357168853282928,
0.08403365314006805,
0.627517580986023,
-0.5595477223396301,
0.9747501015663147,
0.8592299222946167,
0.9232542514801025,
0.2060817927122116,
0.2203969955444336,
0.37575259804725647,
-0.3459993302822113,
-1.164647102355957,
-0.24759136140346527,
-1.0085211992263794,
-2.620873212814331,
0.4088455140590668,
-0.17523649334907532,
-1.3874887228012085,
0.04433697089552879,
-1.0176173448562622,
0.9339920878410339,
-0.5484925508499146,
-1.099399209022522,
-1.4756193161010742,
0.10371339321136475,
-0.057510923594236374,
0.948765754699707,
-1.601898193359375,
-0.14192542433738708,
1.2785991430282593,
0.94895339012146,
-0.6865915656089783,
1.113865613937378,
0.30897924304008484,
1.034326434135437,
0.801051914691925,
-0.39684557914733887,
0.6022310853004456,
0.03375778719782829,
-1.3655141592025757,
0.48736709356307983,
1.1896202564239502,
0.24454063177108765,
1.4984310865402222,
-0.6304909586906433,
-0.047668177634477615,
0.44213050603866577,
-0.6548638939857483,
-0.45071181654930115,
-0.45142027735710144,
0.7206395864486694,
-0.08988116681575775,
-0.9008637070655823,
-0.008683786727488041,
-0.09296967089176178,
-0.23182687163352966,
0.1310228854417801,
-1.456172227859497,
-0.1316920667886734,
-0.35087838768959045,
-0.623658299446106,
-1.3152827024459839,
-0.02073967084288597,
1.4213351011276245,
-0.8183154463768005,
-0.21125882863998413,
0.39052528142929077,
0.4090016484260559,
0.4866131544113159,
0.6869946718215942,
-0.6659403443336487,
-0.3232826292514801,
-0.16934604942798615,
-0.29624515771865845,
0.3412942886352539,
1.4120323657989502,
-0.14376457035541534,
-0.9874352812767029,
0.7343681454658508,
-0.32073912024497986,
0.07997995615005493,
1.893159031867981,
0.101287841796875,
-0.7885724902153015,
0.3013136386871338,
-0.7826623916625977,
1.925851821899414,
1.6538807153701782,
1.3121453523635864,
-0.20486833155155182,
-0.8981655836105347,
0.6149631142616272,
-0.4193948209285736,
-0.37298521399497986,
0.8558034896850586,
0.42177844047546387,
-0.23558495938777924,
-1.3481262922286987,
0.7215728759765625,
1.2304282188415527,
-0.8653870820999146,
-0.8130067586898804,
0.21427702903747559,
-0.770249605178833,
1.109059453010559,
0.6775920987129211,
0.39914602041244507,
0.23272329568862915,
1.5880968570709229,
0.7911633253097534,
-0.5562694072723389,
0.5574920177459717,
0.5124606490135193,
-0.21768788993358612,
-2.1672778129577637,
-1.122112512588501,
0.3721122145652771,
-0.5731427073478699,
-1.5988121032714844,
1.396072506904602,
-1.0775927305221558,
-1.0298409461975098,
0.5315649509429932,
0.0628364235162735,
1.3640702962875366,
0.41966512799263,
1.5298104286193848,
2.053187131881714,
0.8699852824211121,
0.45985957980155945,
1.2555311918258667,
-0.1913464069366455,
-0.48673662543296814,
1.8368828296661377,
-0.4372262954711914,
0.43597790598869324,
1.1273621320724487,
-0.3029140830039978,
-1.0282363891601562,
-0.7551890015602112,
-1.193136215209961,
-0.6783844828605652,
1.1053550243377686,
0.13174454867839813,
-1.0867184400558472,
0.24139544367790222,
1.4866389036178589,
0.10542373359203339,
-0.36104193329811096,
0.6427332162857056,
0.35319843888282776,
-0.7637277245521545,
-0.04235018417239189,
-0.9192513227462769,
0.5311345458030701,
-0.30180248618125916,
-0.3712029755115509,
0.3471428155899048,
0.43112316727638245,
1.3583877086639404,
-0.09026262164115906,
0.13328129053115845,
1.1725841760635376,
-1.4174890518188477,
1.4953341484069824,
-0.669546902179718,
0.247810959815979,
-2.2625296115875244,
1.2863962650299072,
-0.7946011424064636,
1.9922667741775513,
-2.679826021194458,
0.4733025133609772,
-0.643458902835846,
-0.45683014392852783,
0.3069509267807007,
-0.3196514844894409,
0.06471969187259674,
-0.13366883993148804,
-1.1456785202026367,
-0.03428398072719574,
-0.6826178431510925,
0.5653589963912964,
1.1020526885986328,
1.2961952686309814,
-1.1087595224380493,
-0.25681719183921814,
-1.7000541687011719,
-0.15369229018688202,
-0.8527008295059204,
0.41491225361824036,
-2.0457310676574707,
-0.24195364117622375,
-1.9246095418930054,
-2.3166236877441406,
-1.2268078327178955,
-0.8670639991760254,
1.168347954750061,
0.18244387209415436,
-0.8461188673973083,
1.258316993713379,
-0.3147701025009155,
-1.8611137866973877,
1.0484116077423096,
-2.1141552925109863
] |
https://github.com/huggingface/datasets/issues/6079 | Iterating over DataLoader based on HF datasets is stuck forever | Can you share the `datasets` and `torch` versions installed in these conda envs?
> Once I removed with_format call altogether, it is finishing in 11 seconds.
Hmm, that's surprising. What are your dataset's `.features`? | ### Describe the bug
I am using Amazon Sagemaker notebook (Amazon Linux 2) with python 3.10 based Conda environment.
I have a dataset in parquet format locally. When I try to iterate over it, the loader is stuck forever. Note that the same code is working for python 3.6 based conda environment seamlessly. What should be my next steps here?
### Steps to reproduce the bug
```
train_dataset = load_dataset(
"parquet", data_files = {'train': tr_data_path + '*.parquet'},
split = 'train',
collate_fn = streaming_data_collate_fn,
streaming = True
).with_format('torch')
train_dataloader = DataLoader(train_dataset, batch_size = 2, num_workers = 0)
t = time.time()
iter_ = 0
for batch in train_dataloader:
iter_ += 1
if iter_ == 1000:
break
print (time.time() - t)
```
### Expected behavior
The snippet should work normally and load the next batch of data.
### Environment info
datasets: '2.14.0'
pyarrow: '12.0.0'
torch: '2.0.0'
Python: 3.10.10 | packaged by conda-forge | (main, Mar 24 2023, 20:08:06) [GCC 11.3.0]
!uname -r
5.10.178-162.673.amzn2.x86_64 | 11 | 34 | Iterating over DataLoader based on HF datasets is stuck forever
### Describe the bug
I am using Amazon Sagemaker notebook (Amazon Linux 2) with python 3.10 based Conda environment.
I have a dataset in parquet format locally. When I try to iterate over it, the loader is stuck forever. Note that the same code is working for python 3.6 based conda environment seamlessly. What should be my next steps here?
### Steps to reproduce the bug
```
train_dataset = load_dataset(
"parquet", data_files = {'train': tr_data_path + '*.parquet'},
split = 'train',
collate_fn = streaming_data_collate_fn,
streaming = True
).with_format('torch')
train_dataloader = DataLoader(train_dataset, batch_size = 2, num_workers = 0)
t = time.time()
iter_ = 0
for batch in train_dataloader:
iter_ += 1
if iter_ == 1000:
break
print (time.time() - t)
```
### Expected behavior
The snippet should work normally and load the next batch of data.
### Environment info
datasets: '2.14.0'
pyarrow: '12.0.0'
torch: '2.0.0'
Python: 3.10.10 | packaged by conda-forge | (main, Mar 24 2023, 20:08:06) [GCC 11.3.0]
!uname -r
5.10.178-162.673.amzn2.x86_64
Can you share the `datasets` and `torch` versions installed in these conda envs?
> Once I removed with_format call altogether, it is finishing in 11 seconds.
Hmm, that's surprising. What are your dataset's `.features`? | [
-1.2404839992523193,
-1.0219470262527466,
-0.7118972539901733,
1.579450011253357,
-0.21030646562576294,
-1.133574366569519,
0.14982429146766663,
-0.9466209411621094,
1.682141661643982,
-0.8303287625312805,
0.23833730816841125,
-1.617666482925415,
0.05280683934688568,
-0.5681951642036438,
-0.6765433549880981,
-0.8709424138069153,
-0.40911856293678284,
-0.8142486810684204,
1.1847891807556152,
2.4688432216644287,
1.1770515441894531,
-1.4352710247039795,
2.7073421478271484,
0.6908104419708252,
-0.17808797955513,
-1.0589077472686768,
0.4713391065597534,
-0.002701153978705406,
-1.292872428894043,
-0.4556739926338196,
-0.9839991331100464,
-0.07232900708913803,
-0.5972049832344055,
-0.4617023169994354,
-0.0022998210042715073,
0.38970673084259033,
-0.3227047324180603,
-0.4926636219024658,
-0.5056523680686951,
-0.7612011432647705,
0.4239923655986786,
-0.4176962673664093,
0.9451056122779846,
-0.320350706577301,
1.8215566873550415,
-0.4454863965511322,
0.48263218998908997,
0.7459844350814819,
1.2221221923828125,
0.19631537795066833,
-0.03830590844154358,
0.36948874592781067,
0.4177023470401764,
-0.004733451642096043,
0.5690035820007324,
1.1230777502059937,
0.6363811492919922,
0.43472543358802795,
0.6869372129440308,
-2.2936673164367676,
1.3158998489379883,
-1.0298196077346802,
0.30665701627731323,
1.3135504722595215,
-0.9959898591041565,
0.3873594403266907,
-1.696458339691162,
-0.03455934673547745,
0.6759653091430664,
-2.2043354511260986,
0.3301529586315155,
-1.3694181442260742,
-0.48877209424972534,
1.0233591794967651,
0.3699885904788971,
-1.1977477073669434,
0.09027944505214691,
-0.43661177158355713,
1.0526472330093384,
0.426688551902771,
1.0814026594161987,
-1.6798466444015503,
-0.08257098495960236,
-0.2943214178085327,
0.10318482667207718,
-1.3159016370773315,
-1.5162644386291504,
0.5518167018890381,
0.7052726149559021,
0.5530576109886169,
-0.14719286561012268,
1.1283199787139893,
-1.0753856897354126,
0.7630365490913391,
-1.072466254234314,
-1.7207478284835815,
-1.4290082454681396,
-2.3765780925750732,
-2.3359580039978027,
0.7157936096191406,
-0.3852865397930145,
-0.5099604725837708,
2.148608446121216,
-1.00980806350708,
-1.709897518157959,
1.1957957744598389,
0.20972150564193726,
-0.014168810099363327,
2.3549513816833496,
0.21049293875694275,
-0.7559255361557007,
0.4486068785190582,
-0.8133029341697693,
0.7445334792137146,
-0.33537840843200684,
1.3808915615081787,
0.40033185482025146,
-0.9985578656196594,
1.6050193309783936,
-0.274814635515213,
0.5734860897064209,
-0.619646430015564,
-0.5202553868293762,
-0.7462583184242249,
0.24525466561317444,
1.9639490842819214,
-0.27484339475631714,
1.4852211475372314,
-0.32548296451568604,
-1.5337828397750854,
-1.623948335647583,
0.9353733658790588,
0.40405890345573425,
-0.773701012134552,
0.15280646085739136,
-0.3206230103969574,
0.19103962182998657,
-0.09836743772029877,
1.1598197221755981,
1.2749656438827515,
0.7057585120201111,
-0.42528989911079407,
-0.9605124592781067,
0.23936733603477478,
-0.18523311614990234,
-0.6590787172317505,
-1.7784948348999023,
-0.3832004964351654,
0.021108482033014297,
0.6685187816619873,
-1.2112301588058472,
1.6651746034622192,
0.9175156950950623,
1.8924237489700317,
1.0367672443389893,
-0.3425351679325104,
1.4900834560394287,
0.13206404447555542,
1.8378503322601318,
-0.45651566982269287,
0.6144590377807617,
-0.4006514549255371,
-1.1304668188095093,
0.7876016497612,
-0.2964205741882324,
-1.9621673822402954,
-0.735653817653656,
-0.831057608127594,
-0.21298381686210632,
-0.7927009463310242,
0.8984547853469849,
-0.276347815990448,
-1.45742666721344,
0.3211877942085266,
-0.7481468319892883,
0.19209563732147217,
-1.2043325901031494,
0.40026766061782837,
0.6911644339561462,
-0.5450448393821716,
0.12756651639938354,
-0.2687912583351135,
-1.2905443906784058,
-0.474135160446167,
0.34984850883483887,
1.835105538368225,
-0.7599431276321411,
0.8973667621612549,
1.1204825639724731,
-0.7088857293128967,
0.008125783875584602,
0.2568724453449249,
-0.22410675883293152,
0.8577117323875427,
-1.013865351676941,
-0.45861196517944336,
1.2180886268615723,
-0.34109553694725037,
-0.6332736611366272,
1.4872485399246216,
0.7228327393531799,
-1.013635516166687,
-0.24279636144638062,
-0.07481902837753296,
-0.77083420753479,
0.1203618273139,
-1.5901856422424316,
-0.15866094827651978,
0.47797539830207825,
-1.5835741758346558,
-0.4481205642223358,
-0.2274564504623413,
1.3996813297271729,
-0.0828721821308136,
1.4886990785598755,
-0.36719194054603577,
-0.22481733560562134,
-0.29822561144828796,
-0.3796465992927551,
0.19677236676216125,
-0.20008516311645508,
-0.6071285605430603,
0.1572774052619934,
-0.7743431329727173,
0.3433481752872467,
1.413101315498352,
0.3277679681777954,
-0.027005286887288094,
0.493884801864624,
1.0680540800094604,
0.4335803985595703,
-0.0008302181959152222,
-0.8708881735801697,
-1.491752028465271,
1.9815155267715454,
-1.4404031038284302,
2.0074052810668945,
0.7183507084846497,
-0.0026474539190530777,
-1.7855361700057983,
-1.8801376819610596,
1.3952020406723022,
1.0756515264511108,
2.285630226135254,
0.5258547067642212,
0.39291808009147644,
-0.8702539205551147,
-0.6629776954650879,
0.26976701617240906,
-0.9849939942359924,
-0.771521806716919,
0.16177105903625488,
2.464184522628784,
1.7168062925338745,
-0.38633227348327637,
-0.10762622207403183,
-0.996357262134552,
1.4288580417633057,
-0.14926794171333313,
0.2734389007091522,
2.0040132999420166,
-0.24326607584953308,
-1.016008734703064,
1.2330034971237183,
-2.3909833431243896,
0.15202677249908447,
2.059507131576538,
0.2610805630683899,
0.10768943279981613,
-1.392643690109253,
-0.6431088447570801,
-0.2840668559074402,
-0.4808625876903534,
-1.1848289966583252,
0.5629338026046753,
-0.31729695200920105,
-0.7860865592956543,
-1.4396052360534668,
0.23022907972335815,
-1.0739258527755737,
-1.6620033979415894,
0.16203030943870544,
1.894827961921692,
2.046485185623169,
-0.7547871470451355,
1.6030510663986206,
-0.31952399015426636,
0.2372312843799591,
1.2740730047225952,
1.2404627799987793,
3.1162960529327393,
2.0030465126037598,
-1.2488735914230347,
0.6604598760604858,
-0.0972241535782814,
-0.46157756447792053,
1.1278711557388306,
-1.2333999872207642,
1.326080083847046,
-0.15074190497398376,
-1.2035530805587769,
-1.1791579723358154,
0.9837841391563416,
0.5746381878852844,
0.017730113118886948,
-0.44405102729797363,
1.215837836265564,
0.07921389490365982,
1.2640175819396973,
0.4668547809123993,
-0.3347717821598053,
0.6718351244926453,
-0.4527745842933655,
-0.4864806830883026,
1.533349633216858,
0.18335527181625366,
-1.426499605178833,
-2.2117526531219482,
-0.2858714759349823,
-0.8571293354034424,
-0.009150111116468906,
-0.6174416542053223,
-0.9779652953147888,
1.6073973178863525,
0.33716100454330444,
-1.2604038715362549,
-0.2523183226585388,
-0.3232373893260956,
-0.5766150951385498,
2.7214913368225098,
-1.2914308309555054,
-0.2898692190647125,
-0.959143877029419,
-0.6694746017456055,
1.680742621421814,
-1.2123703956604004,
-0.2492700219154358,
-0.992137610912323,
-0.5979557633399963,
-1.2940212488174438,
-0.5543254613876343,
-0.033768776804208755,
-0.9315159916877747,
0.8702045679092407,
0.17586293816566467,
-1.2017160654067993,
-0.2853221297264099,
-0.9377727508544922,
0.8805773854255676,
-0.047894272953271866,
0.21109792590141296,
1.8058052062988281,
0.3211081922054291,
-0.43115532398223877,
0.7232886552810669,
1.0792460441589355,
0.6591672897338867,
-0.6904904842376709,
0.21171754598617554,
-0.6616030335426331,
0.3484114706516266,
-1.2028181552886963,
0.3354994058609009,
-2.929196834564209,
0.6173917055130005,
-0.02798370085656643,
-0.04853726550936699,
-0.04800921306014061,
-1.2711007595062256,
1.1668882369995117,
2.5011942386627197,
-1.1901333332061768,
0.5426518321037292,
0.3489154279232025,
1.2044718265533447,
-1.5754709243774414,
0.3326685428619385,
-0.437301903963089,
2.1400177478790283,
0.22496908903121948,
1.2413244247436523,
-0.39625033736228943,
-2.3212151527404785,
0.6824098229408264,
-1.2629005908966064,
-1.1823079586029053,
0.7213446497917175,
-0.9611981511116028,
0.11207866668701172,
-1.3516511917114258,
-0.2595834732055664,
-0.8092309236526489,
-1.1778134107589722,
0.692532479763031,
0.19160938262939453,
0.3926199674606323,
-0.5873554944992065,
0.3469609022140503,
-2.1902902126312256,
-1.3305988311767578,
-0.25872087478637695,
-0.9982530474662781,
0.47630441188812256,
-0.3776572346687317,
0.7027084231376648,
-0.20864799618721008,
0.03345201909542084,
0.34211671352386475,
1.4200153350830078,
3.3642797470092773,
0.09444421529769897,
0.3209697902202606,
-0.18153351545333862,
-0.9366363883018494,
1.5048054456710815,
0.9340043663978577,
-0.15295317769050598,
-0.4457966983318329,
-1.1619236469268799,
1.252238392829895,
1.95101797580719,
0.95511794090271,
0.0029531149193644524,
-0.7523399591445923,
-0.6840933561325073,
-0.0714832991361618,
0.14975756406784058,
0.5192348957061768,
0.8560516834259033,
0.07949460297822952,
0.10514038056135178,
1.4244089126586914,
1.150841236114502,
-0.4340521991252899,
0.33633124828338623,
-0.8375714421272278,
-0.48832932114601135,
0.4842342138290405,
0.2563413977622986,
-0.019272875040769577,
0.277149498462677,
-0.9894610643386841,
-0.19296085834503174,
-0.4142071306705475,
-0.9400429129600525,
-0.715405285358429,
-0.41083961725234985,
-0.36991211771965027,
1.6275678873062134,
0.17412069439888,
-0.5455135703086853,
-0.01870451681315899,
-0.7184479236602783,
-0.028691161423921585,
-1.1152369976043701,
0.24856531620025635,
-0.13065898418426514,
-0.12185470759868622,
-0.14043211936950684,
1.744508147239685,
-0.9167934060096741,
-2.054716110229492,
0.19703862071037292,
0.2109781801700592,
-0.21763551235198975,
0.315435528755188,
1.6401898860931396,
0.5128792524337769,
1.5176254510879517,
1.3083553314208984,
1.0140559673309326,
-0.6426788568496704,
-1.3403658866882324,
0.7096289396286011,
0.9870532155036926,
-1.4062169790267944,
0.7771017551422119,
0.02128569409251213,
-0.4967062175273895,
0.6672928929328918,
1.2414957284927368,
0.4936654567718506,
-2.109680414199829,
0.8256683945655823,
-1.0167269706726074,
0.7721311450004578,
0.6797981262207031,
0.6882230639457703,
0.2152937352657318,
0.8122323155403137,
-1.1590535640716553,
-1.1231930255889893,
-0.7155241370201111,
-0.735377848148346,
1.9778215885162354,
-0.3220524489879608,
0.5891772508621216,
-0.1887744963169098,
-1.3736233711242676,
-0.0031722914427518845,
0.6910238862037659,
0.35963091254234314,
-0.4717552363872528,
0.778873085975647,
-0.7418169379234314,
-1.2149654626846313,
-1.4000102281570435,
-0.44912204146385193,
-1.072259545326233,
-1.004077672958374,
1.0555527210235596,
0.7365791201591492,
0.2500673532485962,
1.8667715787887573,
0.5896375179290771,
0.2915869355201721,
-2.5992190837860107,
0.9771204590797424,
0.24141594767570496,
-0.05298352614045143,
0.8379186987876892,
0.2823549211025238,
1.0534844398498535,
-0.0335545539855957,
0.5371406078338623,
-2.379326820373535,
2.2960174083709717,
-0.23523983359336853,
0.6610020399093628,
0.020148009061813354,
-0.09528150409460068,
1.076216459274292,
0.5921005606651306,
0.6445627808570862,
-1.0418808460235596,
0.726813793182373,
-0.6156741976737976,
1.2937901020050049,
0.846942126750946,
-0.7902117967605591,
-0.05760509520769119,
1.309283971786499,
0.44588446617126465,
-0.5443635582923889,
-0.9230704307556152,
-1.0804089307785034,
0.9326514601707458,
1.6774005889892578,
-0.13879558444023132,
-0.04233500733971596,
0.8428437113761902,
0.6650099158287048,
-1.3069959878921509,
0.061006397008895874,
-0.7210120558738708,
-0.687172532081604,
1.5490354299545288,
2.0635058879852295,
-0.17008888721466064,
-0.22416642308235168,
-0.7323115468025208,
-1.296929955482483,
0.7262781858444214,
-0.060560259968042374,
0.029825709760189056,
0.6439225077629089,
-0.5715837478637695,
0.9724148511886597,
0.8499829769134521,
0.8724105954170227,
0.20327258110046387,
0.24677008390426636,
0.3800465166568756,
-0.3242975175380707,
-1.1808698177337646,
-0.22436729073524475,
-0.9896221160888672,
-2.5920541286468506,
0.4338616132736206,
-0.157233327627182,
-1.3767951726913452,
0.026615481823682785,
-1.0512787103652954,
0.9602015614509583,
-0.5414456129074097,
-1.1284855604171753,
-1.5040687322616577,
0.07442585378885269,
-0.06381052732467651,
0.9384097456932068,
-1.5809214115142822,
-0.10119231045246124,
1.3046023845672607,
0.928875207901001,
-0.7292664051055908,
1.1291224956512451,
0.2784682810306549,
1.0330365896224976,
0.8161465525627136,
-0.3768589496612549,
0.6104965209960938,
0.020448993891477585,
-1.3379063606262207,
0.49680477380752563,
1.1876451969146729,
0.23346185684204102,
1.5247317552566528,
-0.6718766689300537,
-0.09301521629095078,
0.43866676092147827,
-0.6335222721099854,
-0.42324140667915344,
-0.503722071647644,
0.7055980563163757,
-0.05505562946200371,
-0.8709168434143066,
0.03895866125822067,
-0.09099972993135452,
-0.17705437541007996,
0.12330632656812668,
-1.4812467098236084,
-0.09876496344804764,
-0.31889599561691284,
-0.6259139776229858,
-1.2773679494857788,
-0.027915671467781067,
1.423396348953247,
-0.8203861713409424,
-0.22438371181488037,
0.40761396288871765,
0.39171314239501953,
0.5214644074440002,
0.6514793038368225,
-0.6359439492225647,
-0.29869598150253296,
-0.18657192587852478,
-0.29532867670059204,
0.3557620942592621,
1.4198960065841675,
-0.10271525382995605,
-1.005256175994873,
0.7744722962379456,
-0.3366924822330475,
0.06565865874290466,
1.907729148864746,
0.08147642761468887,
-0.8183178901672363,
0.25735992193222046,
-0.7625986337661743,
1.9720720052719116,
1.6775494813919067,
1.3314372301101685,
-0.19511845707893372,
-0.9528805613517761,
0.6132036447525024,
-0.40902307629585266,
-0.39232540130615234,
0.8969259262084961,
0.4084073007106781,
-0.23827320337295532,
-1.2951889038085938,
0.7209876179695129,
1.2214566469192505,
-0.8754191994667053,
-0.8338174223899841,
0.2101222574710846,
-0.745800256729126,
1.086289405822754,
0.6778838634490967,
0.42128175497055054,
0.2245256006717682,
1.5951688289642334,
0.8024395108222961,
-0.5227312445640564,
0.569794774055481,
0.514235258102417,
-0.2346559464931488,
-2.1351749897003174,
-1.15257728099823,
0.36254456639289856,
-0.5878848433494568,
-1.6273654699325562,
1.3832311630249023,
-1.0836338996887207,
-0.9975859522819519,
0.5189939737319946,
0.052642688155174255,
1.4265892505645752,
0.38911595940589905,
1.5396714210510254,
2.0580573081970215,
0.8521215915679932,
0.47585925459861755,
1.2754979133605957,
-0.2222718894481659,
-0.5118652582168579,
1.8154047727584839,
-0.48006466031074524,
0.45666930079460144,
1.1370145082473755,
-0.29314497113227844,
-1.0264270305633545,
-0.7381383776664734,
-1.2148683071136475,
-0.6476715803146362,
1.105097770690918,
0.14037960767745972,
-1.115392804145813,
0.26010632514953613,
1.4880973100662231,
0.10874415189027786,
-0.384830117225647,
0.6548544764518738,
0.3087010085582733,
-0.784130871295929,
0.00712084025144577,
-0.9545023441314697,
0.548505425453186,
-0.29704681038856506,
-0.32277578115463257,
0.33625856041908264,
0.38941627740859985,
1.3465266227722168,
-0.04589374363422394,
0.16259080171585083,
1.1685882806777954,
-1.3843308687210083,
1.5167772769927979,
-0.6735242009162903,
0.2533511221408844,
-2.266502857208252,
1.2825214862823486,
-0.8174306750297546,
1.9889562129974365,
-2.711045026779175,
0.43311282992362976,
-0.6254880428314209,
-0.47031348943710327,
0.31813955307006836,
-0.340495228767395,
0.0710403323173523,
-0.14455783367156982,
-1.1796143054962158,
-0.04846638813614845,
-0.6946619749069214,
0.5531837344169617,
1.0988938808441162,
1.3048385381698608,
-1.114607334136963,
-0.25405892729759216,
-1.718196153640747,
-0.153367817401886,
-0.810350239276886,
0.46555233001708984,
-2.025583028793335,
-0.20583340525627136,
-1.898470401763916,
-2.356397867202759,
-1.1655454635620117,
-0.8252571225166321,
1.1304211616516113,
0.12385492771863937,
-0.8548401594161987,
1.2465832233428955,
-0.3081866204738617,
-1.865272045135498,
1.0330631732940674,
-2.0952751636505127
] |
https://github.com/huggingface/datasets/issues/6079 | Iterating over DataLoader based on HF datasets is stuck forever | Python 3.6:
datasets.__version__ 2.4.0
torch.__version__ 1.10.1+cu102
Python 3.10:
datasets.__version__ 2.14.0
torch.__version__ 2.0.0
Anonymized features are of the form (subset shown here):
{
'string_feature_i': Value(dtype='string', id=None),
'numerical_feature_i': Value(dtype='decimal128(38, 0)', id=None),
'numerical_feature_series_i': Sequence(feature=Value(dtype='float64', id=None), length=-1, id=None),
}
There is no output from .features in python 3.6 kernel BTW. | ### Describe the bug
I am using Amazon Sagemaker notebook (Amazon Linux 2) with python 3.10 based Conda environment.
I have a dataset in parquet format locally. When I try to iterate over it, the loader is stuck forever. Note that the same code is working for python 3.6 based conda environment seamlessly. What should be my next steps here?
### Steps to reproduce the bug
```
train_dataset = load_dataset(
"parquet", data_files = {'train': tr_data_path + '*.parquet'},
split = 'train',
collate_fn = streaming_data_collate_fn,
streaming = True
).with_format('torch')
train_dataloader = DataLoader(train_dataset, batch_size = 2, num_workers = 0)
t = time.time()
iter_ = 0
for batch in train_dataloader:
iter_ += 1
if iter_ == 1000:
break
print (time.time() - t)
```
### Expected behavior
The snippet should work normally and load the next batch of data.
### Environment info
datasets: '2.14.0'
pyarrow: '12.0.0'
torch: '2.0.0'
Python: 3.10.10 | packaged by conda-forge | (main, Mar 24 2023, 20:08:06) [GCC 11.3.0]
!uname -r
5.10.178-162.673.amzn2.x86_64 | 11 | 46 | Iterating over DataLoader based on HF datasets is stuck forever
### Describe the bug
I am using Amazon Sagemaker notebook (Amazon Linux 2) with python 3.10 based Conda environment.
I have a dataset in parquet format locally. When I try to iterate over it, the loader is stuck forever. Note that the same code is working for python 3.6 based conda environment seamlessly. What should be my next steps here?
### Steps to reproduce the bug
```
train_dataset = load_dataset(
"parquet", data_files = {'train': tr_data_path + '*.parquet'},
split = 'train',
collate_fn = streaming_data_collate_fn,
streaming = True
).with_format('torch')
train_dataloader = DataLoader(train_dataset, batch_size = 2, num_workers = 0)
t = time.time()
iter_ = 0
for batch in train_dataloader:
iter_ += 1
if iter_ == 1000:
break
print (time.time() - t)
```
### Expected behavior
The snippet should work normally and load the next batch of data.
### Environment info
datasets: '2.14.0'
pyarrow: '12.0.0'
torch: '2.0.0'
Python: 3.10.10 | packaged by conda-forge | (main, Mar 24 2023, 20:08:06) [GCC 11.3.0]
!uname -r
5.10.178-162.673.amzn2.x86_64
Python 3.6:
datasets.__version__ 2.4.0
torch.__version__ 1.10.1+cu102
Python 3.10:
datasets.__version__ 2.14.0
torch.__version__ 2.0.0
Anonymized features are of the form (subset shown here):
{
'string_feature_i': Value(dtype='string', id=None),
'numerical_feature_i': Value(dtype='decimal128(38, 0)', id=None),
'numerical_feature_series_i': Sequence(feature=Value(dtype='float64', id=None), length=-1, id=None),
}
There is no output from .features in python 3.6 kernel BTW. | [
-1.3298096656799316,
-1.0528417825698853,
-0.6605807542800903,
1.6113710403442383,
-0.2553796172142029,
-1.1346224546432495,
0.14628013968467712,
-0.9305062890052795,
1.6034176349639893,
-0.8199122548103333,
0.21513554453849792,
-1.5423533916473389,
0.0535685159265995,
-0.5379592776298523,
-0.6568678021430969,
-0.8877080678939819,
-0.41272836923599243,
-0.7808212041854858,
1.240541696548462,
2.4377236366271973,
1.2058030366897583,
-1.4060343503952026,
2.7201051712036133,
0.7342470288276672,
-0.16559003293514252,
-1.1063780784606934,
0.4977268576622009,
-0.01951708272099495,
-1.3277523517608643,
-0.48728951811790466,
-0.9583196043968201,
-0.0746922567486763,
-0.5892537832260132,
-0.3679662346839905,
-0.0067544542253017426,
0.388237327337265,
-0.31283870339393616,
-0.47349461913108826,
-0.5485016107559204,
-0.7462009787559509,
0.429190456867218,
-0.3966425359249115,
0.8766894936561584,
-0.31062135100364685,
1.7567558288574219,
-0.4459487795829773,
0.5164694786071777,
0.7663624286651611,
1.2304250001907349,
0.1641569286584854,
-0.014109134674072266,
0.3526906371116638,
0.443592369556427,
0.030247971415519714,
0.5706951022148132,
1.1061228513717651,
0.6443842053413391,
0.384914755821228,
0.6305557489395142,
-2.305426597595215,
1.3170167207717896,
-1.0075281858444214,
0.33009761571884155,
1.3224494457244873,
-0.9808305501937866,
0.383125901222229,
-1.6889476776123047,
0.011781119741499424,
0.7156786918640137,
-2.190356969833374,
0.3466074466705322,
-1.3672701120376587,
-0.4797239303588867,
1.0213700532913208,
0.4154771864414215,
-1.17369544506073,
0.0958121046423912,
-0.469936341047287,
1.0867087841033936,
0.41527995467185974,
1.0281050205230713,
-1.6431949138641357,
-0.11028776317834854,
-0.24587754905223846,
0.11941635608673096,
-1.3114062547683716,
-1.5344176292419434,
0.5221985578536987,
0.6808720827102661,
0.5735642313957214,
-0.14031444489955902,
1.1314897537231445,
-1.1123781204223633,
0.7844494581222534,
-1.110348105430603,
-1.7009936571121216,
-1.4750242233276367,
-2.4715611934661865,
-2.2965457439422607,
0.6591904163360596,
-0.37066879868507385,
-0.4831637442111969,
2.1217620372772217,
-1.0498279333114624,
-1.6916004419326782,
1.2090089321136475,
0.201524555683136,
0.06429339945316315,
2.3324131965637207,
0.17948728799819946,
-0.7365530729293823,
0.44389283657073975,
-0.8688836693763733,
0.6971193552017212,
-0.3116282522678375,
1.3276264667510986,
0.3858857750892639,
-0.990355372428894,
1.5281120538711548,
-0.2604154646396637,
0.6138818264007568,
-0.5770568251609802,
-0.4937233030796051,
-0.7603422999382019,
0.2457890510559082,
1.9453270435333252,
-0.23627564311027527,
1.4641101360321045,
-0.3266807198524475,
-1.5220617055892944,
-1.6265939474105835,
0.9376896023750305,
0.4239308536052704,
-0.7763253450393677,
0.12766385078430176,
-0.3682941496372223,
0.2137976884841919,
-0.13541485369205475,
1.1520415544509888,
1.2930686473846436,
0.7195678353309631,
-0.457512766122818,
-0.9251107573509216,
0.20036306977272034,
-0.18151797354221344,
-0.6472330689430237,
-1.8213599920272827,
-0.33327946066856384,
0.01547329593449831,
0.7204570770263672,
-1.1775461435317993,
1.663291096687317,
0.9508802890777588,
1.8812215328216553,
1.040842056274414,
-0.38166651129722595,
1.5006409883499146,
0.1353568732738495,
1.782106637954712,
-0.5345985293388367,
0.6371340155601501,
-0.3916819989681244,
-1.1111185550689697,
0.7930999398231506,
-0.26289770007133484,
-2.0097310543060303,
-0.7296554446220398,
-0.748384952545166,
-0.24465619027614594,
-0.7623983025550842,
0.91902095079422,
-0.30389612913131714,
-1.4598945379257202,
0.2653425931930542,
-0.7887330651283264,
0.23003911972045898,
-1.1290696859359741,
0.38064661622047424,
0.7115272283554077,
-0.5278688669204712,
0.10445426404476166,
-0.24730628728866577,
-1.2637470960617065,
-0.4578188955783844,
0.41908279061317444,
1.784500241279602,
-0.729085385799408,
0.8928185105323792,
1.108392357826233,
-0.657238781452179,
0.04793861508369446,
0.2337539792060852,
-0.21460454165935516,
0.8394777774810791,
-0.9866271615028381,
-0.5029770135879517,
1.2425585985183716,
-0.3867681622505188,
-0.6586636304855347,
1.4975367784500122,
0.7363064289093018,
-1.0253517627716064,
-0.2723301351070404,
-0.06893404573202133,
-0.7865318655967712,
0.15967358648777008,
-1.5960721969604492,
-0.15622034668922424,
0.5437184572219849,
-1.6543500423431396,
-0.4008355736732483,
-0.21027196943759918,
1.4516161680221558,
-0.04770457372069359,
1.493013620376587,
-0.3466118574142456,
-0.1735621988773346,
-0.2699161469936371,
-0.3762969374656677,
0.26039260625839233,
-0.20900453627109528,
-0.549628734588623,
0.14312446117401123,
-0.8172961473464966,
0.35519787669181824,
1.41789972782135,
0.30123233795166016,
0.010617990978062153,
0.47389766573905945,
1.049509048461914,
0.4567943215370178,
-0.012835398316383362,
-0.8815492391586304,
-1.5344336032867432,
1.9951778650283813,
-1.4366347789764404,
2.0467331409454346,
0.7327418327331543,
-0.04415244609117508,
-1.7722376585006714,
-1.8924447298049927,
1.3063515424728394,
1.014277696609497,
2.271087884902954,
0.4778875410556793,
0.3826715648174286,
-0.8967732787132263,
-0.695395827293396,
0.25370892882347107,
-0.9742234945297241,
-0.7443904876708984,
0.11583608388900757,
2.500246524810791,
1.7589675188064575,
-0.3449496030807495,
-0.139967143535614,
-0.9746915102005005,
1.4815713167190552,
-0.1475854218006134,
0.32064956426620483,
2.023254156112671,
-0.16327257454395294,
-0.9519746899604797,
1.2411925792694092,
-2.439650774002075,
0.2246776968240738,
2.0809898376464844,
0.2661683261394501,
0.1167345941066742,
-1.4474728107452393,
-0.6591652631759644,
-0.3080587387084961,
-0.46811431646347046,
-1.2145193815231323,
0.5837011337280273,
-0.33429574966430664,
-0.8078678250312805,
-1.403925895690918,
0.2203434407711029,
-1.0875221490859985,
-1.6999709606170654,
0.1864013671875,
1.896652102470398,
2.060994863510132,
-0.7472561597824097,
1.5853350162506104,
-0.3182758390903473,
0.19023658335208893,
1.2461810111999512,
1.2608230113983154,
3.084324836730957,
1.9837907552719116,
-1.2662056684494019,
0.6411632299423218,
-0.14246581494808197,
-0.40717631578445435,
1.067945122718811,
-1.2551651000976562,
1.3539741039276123,
-0.09997829794883728,
-1.1977049112319946,
-1.158055067062378,
1.0571730136871338,
0.5890811681747437,
0.02030102163553238,
-0.43865302205085754,
1.2072348594665527,
0.04305168241262436,
1.2940404415130615,
0.5118613839149475,
-0.33250346779823303,
0.6354326009750366,
-0.4520094096660614,
-0.5543413758277893,
1.5035521984100342,
0.16978125274181366,
-1.470381259918213,
-2.1955950260162354,
-0.30629679560661316,
-0.8415234088897705,
-0.02840442582964897,
-0.5973462462425232,
-0.9765687584877014,
1.5834574699401855,
0.32287028431892395,
-1.2472670078277588,
-0.2238522469997406,
-0.319909006357193,
-0.5358518958091736,
2.749755859375,
-1.247222900390625,
-0.2794698476791382,
-0.9774842858314514,
-0.657322883605957,
1.6394692659378052,
-1.2139617204666138,
-0.25972437858581543,
-1.0420377254486084,
-0.6102108359336853,
-1.2480415105819702,
-0.49600929021835327,
-0.01873777247965336,
-0.9458726048469543,
0.8809444308280945,
0.18333588540554047,
-1.2144854068756104,
-0.3508009612560272,
-0.9187620878219604,
0.9590059518814087,
0.027036864310503006,
0.1829356849193573,
1.779680848121643,
0.24416980147361755,
-0.40415292978286743,
0.7793243527412415,
1.0686781406402588,
0.6897273063659668,
-0.7000268697738647,
0.16137400269508362,
-0.6016284823417664,
0.3542580306529999,
-1.1922632455825806,
0.34162622690200806,
-2.94655442237854,
0.6389192938804626,
-0.012028021737933159,
-0.07773629575967789,
-0.08784136176109314,
-1.2962933778762817,
1.1712054014205933,
2.53718900680542,
-1.205325961112976,
0.5663360357284546,
0.39433759450912476,
1.1521528959274292,
-1.581709861755371,
0.3822462260723114,
-0.475996196269989,
2.1428327560424805,
0.2546006739139557,
1.2779309749603271,
-0.41683119535446167,
-2.3808391094207764,
0.6964200735092163,
-1.2598828077316284,
-1.149595022201538,
0.7038966417312622,
-0.97724848985672,
0.17917096614837646,
-1.3928098678588867,
-0.27770617604255676,
-0.8433841466903687,
-1.1870858669281006,
0.5930837988853455,
0.21439528465270996,
0.38807544112205505,
-0.5822017788887024,
0.3329574763774872,
-2.2248523235321045,
-1.3111988306045532,
-0.2288307100534439,
-0.9757033586502075,
0.4956132173538208,
-0.444321870803833,
0.6854671239852905,
-0.1373787224292755,
0.025658175349235535,
0.3117533326148987,
1.4553030729293823,
3.377739191055298,
0.05609909072518349,
0.26771751046180725,
-0.20958442986011505,
-0.9354488849639893,
1.489590048789978,
0.9218397736549377,
-0.11817806214094162,
-0.5024507641792297,
-1.1190820932388306,
1.2766056060791016,
1.9700708389282227,
0.9779214859008789,
-0.006018719170242548,
-0.7839645147323608,
-0.6996831297874451,
-0.04501982405781746,
0.1521109938621521,
0.562126636505127,
0.8680147528648376,
0.02625339850783348,
0.0750046893954277,
1.4804762601852417,
1.1548007726669312,
-0.38245269656181335,
0.27491873502731323,
-0.8889657855033875,
-0.4674834907054901,
0.46740469336509705,
0.23994314670562744,
-0.04806872084736824,
0.33986151218414307,
-1.0356454849243164,
-0.13198105990886688,
-0.43660926818847656,
-0.884505033493042,
-0.7055289149284363,
-0.3992696702480316,
-0.4339792728424072,
1.6008182764053345,
0.2286803275346756,
-0.5369414687156677,
-0.04523369297385216,
-0.6874812841415405,
-0.08765802532434464,
-1.095569372177124,
0.24920454621315002,
-0.13089391589164734,
-0.1081015020608902,
-0.2270200401544571,
1.726689338684082,
-0.9093944430351257,
-2.070457935333252,
0.17297445237636566,
0.1746535748243332,
-0.16217851638793945,
0.31912845373153687,
1.667334794998169,
0.5081477165222168,
1.4854249954223633,
1.2762863636016846,
0.9846380949020386,
-0.6066405773162842,
-1.3459291458129883,
0.7464095950126648,
1.0144959688186646,
-1.413762092590332,
0.7661306858062744,
-0.04651912301778793,
-0.49590209126472473,
0.6946755647659302,
1.2804813385009766,
0.49329960346221924,
-2.130812644958496,
0.8597705960273743,
-1.0498616695404053,
0.8195057511329651,
0.7052302956581116,
0.6376156806945801,
0.18726211786270142,
0.8251141309738159,
-1.1773314476013184,
-1.1050623655319214,
-0.6703108549118042,
-0.7703006267547607,
2.0114409923553467,
-0.4018096625804901,
0.6274862289428711,
-0.15150205790996552,
-1.3410056829452515,
-0.01686709001660347,
0.6916643977165222,
0.3210091292858124,
-0.4808834195137024,
0.8273507952690125,
-0.7583788633346558,
-1.2297991514205933,
-1.318325400352478,
-0.44220608472824097,
-1.040150761604309,
-1.033953070640564,
1.068847417831421,
0.722571611404419,
0.29342004656791687,
1.832108736038208,
0.5521697402000427,
0.3180943727493286,
-2.6214590072631836,
0.9472916722297668,
0.22096236050128937,
-0.03972575068473816,
0.8330690860748291,
0.22684383392333984,
1.0640571117401123,
0.015408511273562908,
0.5380109548568726,
-2.401524066925049,
2.302511692047119,
-0.218896746635437,
0.6853947639465332,
-0.023502549156546593,
-0.106397844851017,
1.0968902111053467,
0.6177587509155273,
0.6785020232200623,
-0.995236337184906,
0.7328580617904663,
-0.5633650422096252,
1.3147220611572266,
0.827781081199646,
-0.7947723865509033,
-0.09723310172557831,
1.3051114082336426,
0.4279264211654663,
-0.5532926321029663,
-0.9496206641197205,
-1.077804684638977,
0.895436704158783,
1.6800413131713867,
-0.11191610246896744,
-0.04727436602115631,
0.7646834254264832,
0.6774439215660095,
-1.2735596895217896,
0.028045304119586945,
-0.6938446164131165,
-0.6383458375930786,
1.5461015701293945,
2.0939459800720215,
-0.1997532844543457,
-0.16840456426143646,
-0.6832757592201233,
-1.3029676675796509,
0.6588305830955505,
-0.11733884364366531,
0.025679565966129303,
0.5715230703353882,
-0.4919408857822418,
0.8949763774871826,
0.7784145474433899,
0.9399704933166504,
0.14318230748176575,
0.2307431399822235,
0.37983569502830505,
-0.38713642954826355,
-1.2135926485061646,
-0.32591864466667175,
-1.0139950513839722,
-2.5760345458984375,
0.3753491938114166,
-0.1530846506357193,
-1.3808057308197021,
0.042539723217487335,
-1.0633301734924316,
0.9515658617019653,
-0.5499131083488464,
-1.1272858381271362,
-1.4447945356369019,
0.09626322239637375,
-0.061407238245010376,
0.9110473394393921,
-1.6159337759017944,
-0.09462463855743408,
1.290259599685669,
0.8784069418907166,
-0.6981659531593323,
1.1275748014450073,
0.27560561895370483,
1.0367987155914307,
0.7641754150390625,
-0.36990755796432495,
0.6086001396179199,
0.05145707353949547,
-1.3751965761184692,
0.5069304704666138,
1.1681751012802124,
0.2459210455417633,
1.5328032970428467,
-0.6631156802177429,
-0.07757197320461273,
0.4583008289337158,
-0.7249707579612732,
-0.42906391620635986,
-0.41412296891212463,
0.7390497326850891,
-0.05392669141292572,
-0.8434374928474426,
-0.0014929603785276413,
-0.10401569306850433,
-0.23244206607341766,
0.09262782335281372,
-1.4788100719451904,
-0.10588758438825607,
-0.3663123846054077,
-0.6131609082221985,
-1.322308897972107,
-0.029317818582057953,
1.411328673362732,
-0.7843737006187439,
-0.2524334490299225,
0.38625964522361755,
0.40308257937431335,
0.5273293256759644,
0.7211490273475647,
-0.6448037624359131,
-0.3057556748390198,
-0.18348747491836548,
-0.24542373418807983,
0.37649834156036377,
1.4078906774520874,
-0.0898599922657013,
-1.004345417022705,
0.7536585330963135,
-0.3786509037017822,
0.10270509123802185,
1.926637053489685,
0.07432815432548523,
-0.7624748349189758,
0.3141767382621765,
-0.7854698300361633,
1.9337375164031982,
1.6315186023712158,
1.311328649520874,
-0.24494734406471252,
-0.919948399066925,
0.625117301940918,
-0.4182640016078949,
-0.39850109815597534,
0.8498033285140991,
0.44029754400253296,
-0.2505398392677307,
-1.293412446975708,
0.7662885785102844,
1.1833970546722412,
-0.8930898308753967,
-0.8174716234207153,
0.2652268707752228,
-0.7513734698295593,
1.1552621126174927,
0.6430368423461914,
0.40662282705307007,
0.24875473976135254,
1.6164052486419678,
0.8241543173789978,
-0.5351119637489319,
0.5421974658966064,
0.49979227781295776,
-0.29725363850593567,
-2.1437041759490967,
-1.118283987045288,
0.38689470291137695,
-0.6321932077407837,
-1.63121497631073,
1.3756518363952637,
-1.0964479446411133,
-1.0149626731872559,
0.5233978629112244,
0.04549193009734154,
1.3507739305496216,
0.4390314221382141,
1.552268147468567,
2.0486526489257812,
0.8538669943809509,
0.5361213684082031,
1.282806634902954,
-0.21017926931381226,
-0.5204032063484192,
1.8099875450134277,
-0.44409775733947754,
0.48740315437316895,
1.176558494567871,
-0.3042762577533722,
-1.0417985916137695,
-0.7427499294281006,
-1.1464908123016357,
-0.6160621643066406,
1.1132698059082031,
0.14816398918628693,
-1.0764896869659424,
0.2651669979095459,
1.452521800994873,
0.12091204524040222,
-0.32126253843307495,
0.6833008527755737,
0.27429890632629395,
-0.767406702041626,
-0.05162673443555832,
-0.9318026304244995,
0.5365784764289856,
-0.38220298290252686,
-0.3226526081562042,
0.3251293897628784,
0.38493743538856506,
1.3352081775665283,
-0.09129921346902847,
0.1363583654165268,
1.1377509832382202,
-1.389758586883545,
1.5433236360549927,
-0.6438527703285217,
0.28274649381637573,
-2.262143850326538,
1.2464063167572021,
-0.7810625433921814,
2.004711627960205,
-2.701716899871826,
0.4422456622123718,
-0.6196262240409851,
-0.4831191301345825,
0.31128185987472534,
-0.33001604676246643,
0.024788323789834976,
-0.13977183401584625,
-1.1672171354293823,
0.00797990057617426,
-0.7139195799827576,
0.5417017340660095,
1.129277229309082,
1.2905826568603516,
-1.1274012327194214,
-0.22455546259880066,
-1.6999369859695435,
-0.17903757095336914,
-0.9442474842071533,
0.4567562937736511,
-2.0283055305480957,
-0.22080057859420776,
-1.8840935230255127,
-2.3409671783447266,
-1.117646336555481,
-0.8424140214920044,
1.1422998905181885,
0.1785937249660492,
-0.8024864792823792,
1.2765172719955444,
-0.2819910943508148,
-1.8465632200241089,
1.0148292779922485,
-2.097224235534668
] |
https://github.com/huggingface/datasets/issues/6079 | Iterating over DataLoader based on HF datasets is stuck forever | One more thing, in python 3.10 based kernel, interestingly increasing num_workers seem to be increasing the runtime of iterating I was trying out. In python 3.10 kernel execution, I do not even see multiple CPU cores spiking unlike in 3.6.
512 batch size on 32 workers executes in 2.4 seconds on python 3.6 kernel, while it takes ~118 seconds on 3.10! | ### Describe the bug
I am using Amazon Sagemaker notebook (Amazon Linux 2) with python 3.10 based Conda environment.
I have a dataset in parquet format locally. When I try to iterate over it, the loader is stuck forever. Note that the same code is working for python 3.6 based conda environment seamlessly. What should be my next steps here?
### Steps to reproduce the bug
```
train_dataset = load_dataset(
"parquet", data_files = {'train': tr_data_path + '*.parquet'},
split = 'train',
collate_fn = streaming_data_collate_fn,
streaming = True
).with_format('torch')
train_dataloader = DataLoader(train_dataset, batch_size = 2, num_workers = 0)
t = time.time()
iter_ = 0
for batch in train_dataloader:
iter_ += 1
if iter_ == 1000:
break
print (time.time() - t)
```
### Expected behavior
The snippet should work normally and load the next batch of data.
### Environment info
datasets: '2.14.0'
pyarrow: '12.0.0'
torch: '2.0.0'
Python: 3.10.10 | packaged by conda-forge | (main, Mar 24 2023, 20:08:06) [GCC 11.3.0]
!uname -r
5.10.178-162.673.amzn2.x86_64 | 11 | 61 | Iterating over DataLoader based on HF datasets is stuck forever
### Describe the bug
I am using Amazon Sagemaker notebook (Amazon Linux 2) with python 3.10 based Conda environment.
I have a dataset in parquet format locally. When I try to iterate over it, the loader is stuck forever. Note that the same code is working for python 3.6 based conda environment seamlessly. What should be my next steps here?
### Steps to reproduce the bug
```
train_dataset = load_dataset(
"parquet", data_files = {'train': tr_data_path + '*.parquet'},
split = 'train',
collate_fn = streaming_data_collate_fn,
streaming = True
).with_format('torch')
train_dataloader = DataLoader(train_dataset, batch_size = 2, num_workers = 0)
t = time.time()
iter_ = 0
for batch in train_dataloader:
iter_ += 1
if iter_ == 1000:
break
print (time.time() - t)
```
### Expected behavior
The snippet should work normally and load the next batch of data.
### Environment info
datasets: '2.14.0'
pyarrow: '12.0.0'
torch: '2.0.0'
Python: 3.10.10 | packaged by conda-forge | (main, Mar 24 2023, 20:08:06) [GCC 11.3.0]
!uname -r
5.10.178-162.673.amzn2.x86_64
One more thing, in python 3.10 based kernel, interestingly increasing num_workers seem to be increasing the runtime of iterating I was trying out. In python 3.10 kernel execution, I do not even see multiple CPU cores spiking unlike in 3.6.
512 batch size on 32 workers executes in 2.4 seconds on python 3.6 kernel, while it takes ~118 seconds on 3.10! | [
-1.2805341482162476,
-1.0410552024841309,
-0.6732608079910278,
1.5353178977966309,
-0.254350870847702,
-1.1552599668502808,
0.1737479567527771,
-0.9447788596153259,
1.6417279243469238,
-0.8380560278892517,
0.23958228528499603,
-1.5837104320526123,
0.048319969326257706,
-0.5743476748466492,
-0.664314866065979,
-0.8749992251396179,
-0.41995713114738464,
-0.8276289105415344,
1.1758400201797485,
2.4991390705108643,
1.1417651176452637,
-1.4546122550964355,
2.743734836578369,
0.7094669938087463,
-0.1644556075334549,
-1.0387712717056274,
0.4923863708972931,
0.02493041753768921,
-1.3528867959976196,
-0.45362213253974915,
-0.9714253544807434,
-0.06789121776819229,
-0.5696642994880676,
-0.42071443796157837,
0.04660220444202423,
0.3736344277858734,
-0.2535763084888458,
-0.4705694019794464,
-0.4817972779273987,
-0.7126510143280029,
0.4226340651512146,
-0.41017916798591614,
0.96976637840271,
-0.33517053723335266,
1.7902268171310425,
-0.4383547902107239,
0.4969234764575958,
0.7521657943725586,
1.2435963153839111,
0.21149298548698425,
-0.04546663910150528,
0.35179293155670166,
0.4224698543548584,
-0.012557362206280231,
0.5601574182510376,
1.1182173490524292,
0.6677761673927307,
0.4186140298843384,
0.663558840751648,
-2.247258186340332,
1.3527334928512573,
-1.0599876642227173,
0.3480018079280853,
1.347951889038086,
-0.9849652051925659,
0.4044513702392578,
-1.7185074090957642,
-0.030103210359811783,
0.6921164393424988,
-2.209228038787842,
0.33852484822273254,
-1.321691632270813,
-0.48441359400749207,
1.0565649271011353,
0.3737395107746124,
-1.200653076171875,
0.09883280098438263,
-0.48689785599708557,
1.058122992515564,
0.3753422200679779,
1.1155989170074463,
-1.6678792238235474,
-0.09857533872127533,
-0.293733686208725,
0.0931520164012909,
-1.3108891248703003,
-1.5293574333190918,
0.5658175945281982,
0.671680212020874,
0.5336532592773438,
-0.15386034548282623,
1.07799232006073,
-1.0924696922302246,
0.7965419292449951,
-1.0577360391616821,
-1.702448844909668,
-1.425971508026123,
-2.3804268836975098,
-2.3481016159057617,
0.7123090028762817,
-0.39402347803115845,
-0.4920765161514282,
2.1252317428588867,
-1.0290110111236572,
-1.682169795036316,
1.199485421180725,
0.21305441856384277,
0.006988536566495895,
2.337045907974243,
0.18990622460842133,
-0.7369779944419861,
0.4137668013572693,
-0.8124891519546509,
0.7203657627105713,
-0.39633601903915405,
1.3559463024139404,
0.38393428921699524,
-1.0213611125946045,
1.552427887916565,
-0.27883946895599365,
0.555475115776062,
-0.6124037504196167,
-0.5268741250038147,
-0.755713939666748,
0.28510111570358276,
1.96690034866333,
-0.2680812180042267,
1.470996618270874,
-0.3154226243495941,
-1.5632764101028442,
-1.6280654668807983,
0.9274067878723145,
0.4847026765346527,
-0.7609207630157471,
0.1170988529920578,
-0.3419704735279083,
0.18028078973293304,
-0.12330834567546844,
1.1179338693618774,
1.2829228639602661,
0.7010588049888611,
-0.39426350593566895,
-0.9668821096420288,
0.2415621429681778,
-0.22221477329730988,
-0.6342099905014038,
-1.779576063156128,
-0.38435083627700806,
0.03767911344766617,
0.6975898742675781,
-1.2395583391189575,
1.6743707656860352,
0.9639198780059814,
1.8937433958053589,
1.0078234672546387,
-0.33563387393951416,
1.5184359550476074,
0.17320261895656586,
1.8039374351501465,
-0.5085937976837158,
0.6408292651176453,
-0.4088153839111328,
-1.1196383237838745,
0.7705692648887634,
-0.30699703097343445,
-1.963602900505066,
-0.7143768072128296,
-0.7917117476463318,
-0.2224622368812561,
-0.7972252368927002,
0.920525074005127,
-0.2615356147289276,
-1.4515347480773926,
0.3240491449832916,
-0.7645562887191772,
0.17865635454654694,
-1.1764227151870728,
0.406419038772583,
0.6735956072807312,
-0.5336347222328186,
0.12779055535793304,
-0.24741753935813904,
-1.2896045446395874,
-0.4513084292411804,
0.31529495120048523,
1.8236453533172607,
-0.768692135810852,
0.9050658345222473,
1.1266493797302246,
-0.6884452700614929,
-0.0055798618122935295,
0.29078423976898193,
-0.257819265127182,
0.8777344822883606,
-1.0576517581939697,
-0.43549174070358276,
1.215962290763855,
-0.3141495883464813,
-0.5676507353782654,
1.495126724243164,
0.6974195241928101,
-1.0425317287445068,
-0.26637402176856995,
-0.08683913946151733,
-0.7905617952346802,
0.1347048431634903,
-1.6111581325531006,
-0.15014317631721497,
0.45490002632141113,
-1.6106816530227661,
-0.4169806241989136,
-0.24843987822532654,
1.3992788791656494,
-0.07969385385513306,
1.4929087162017822,
-0.31835415959358215,
-0.20383256673812866,
-0.299049973487854,
-0.38668081164360046,
0.22426095604896545,
-0.19165776669979095,
-0.5808871984481812,
0.19275154173374176,
-0.8014166355133057,
0.35375797748565674,
1.4442381858825684,
0.3145838677883148,
-0.044669605791568756,
0.5142319202423096,
1.0072942972183228,
0.4501971900463104,
-0.02514687180519104,
-0.9010090827941895,
-1.4845572710037231,
1.998814344406128,
-1.4678746461868286,
2.0145552158355713,
0.7650690078735352,
-0.010887471958994865,
-1.7736070156097412,
-1.895063877105713,
1.3374722003936768,
1.0528688430786133,
2.343888759613037,
0.5072139501571655,
0.3896237015724182,
-0.859807550907135,
-0.6625823974609375,
0.2639233469963074,
-1.0119508504867554,
-0.7705976366996765,
0.17646168172359467,
2.4672317504882812,
1.6935834884643555,
-0.39156317710876465,
-0.10136169195175171,
-0.9901569485664368,
1.4373178482055664,
-0.1282867044210434,
0.27921679615974426,
2.0238823890686035,
-0.20625202357769012,
-1.0418709516525269,
1.2179298400878906,
-2.3950867652893066,
0.15945833921432495,
2.037109851837158,
0.24330218136310577,
0.0946892499923706,
-1.4273849725723267,
-0.6381765007972717,
-0.2889968156814575,
-0.4452331066131592,
-1.2094810009002686,
0.5673689246177673,
-0.288874089717865,
-0.8234007358551025,
-1.4379634857177734,
0.18895943462848663,
-1.115624189376831,
-1.6406586170196533,
0.20235827565193176,
1.8703033924102783,
2.07818603515625,
-0.7797585725784302,
1.57099187374115,
-0.29632848501205444,
0.1928466558456421,
1.2285228967666626,
1.2132035493850708,
3.099106550216675,
1.9656428098678589,
-1.2527323961257935,
0.6519720554351807,
-0.14724555611610413,
-0.420077919960022,
1.0773698091506958,
-1.2292453050613403,
1.3256036043167114,
-0.10307386517524719,
-1.1835256814956665,
-1.163016676902771,
0.9914935827255249,
0.5583893060684204,
0.032331034541130066,
-0.42085203528404236,
1.19328773021698,
0.05211517587304115,
1.298064947128296,
0.4656996726989746,
-0.3269982933998108,
0.6726880669593811,
-0.4718559980392456,
-0.4957076907157898,
1.5488836765289307,
0.1835823357105255,
-1.4384753704071045,
-2.230836868286133,
-0.2973712384700775,
-0.8685486316680908,
-0.0026285196654498577,
-0.6199547052383423,
-0.9578381776809692,
1.6060068607330322,
0.3253142535686493,
-1.2684413194656372,
-0.2411399781703949,
-0.3287123441696167,
-0.5704256296157837,
2.7145917415618896,
-1.2835334539413452,
-0.2650720775127411,
-0.9476127624511719,
-0.6467613577842712,
1.6382476091384888,
-1.245035171508789,
-0.2612977921962738,
-0.987959623336792,
-0.6064995527267456,
-1.2638700008392334,
-0.5530682802200317,
-0.041080228984355927,
-0.9263437390327454,
0.869457483291626,
0.18818703293800354,
-1.1714640855789185,
-0.2973751723766327,
-0.9215659499168396,
0.8706616163253784,
0.04108470305800438,
0.2272619903087616,
1.766860842704773,
0.28248077630996704,
-0.38893142342567444,
0.7220298647880554,
1.1022809743881226,
0.6592662334442139,
-0.6776522397994995,
0.17654237151145935,
-0.678175687789917,
0.31313154101371765,
-1.180833339691162,
0.35379931330680847,
-2.9189186096191406,
0.6047517657279968,
-0.04045839607715607,
-0.059869229793548584,
-0.08130383491516113,
-1.2645838260650635,
1.182967185974121,
2.5395185947418213,
-1.1350696086883545,
0.5379703640937805,
0.37608057260513306,
1.1950064897537231,
-1.5633375644683838,
0.3637467622756958,
-0.4512316882610321,
2.1462693214416504,
0.2473965734243393,
1.198941946029663,
-0.41615232825279236,
-2.364956855773926,
0.6514334678649902,
-1.2864947319030762,
-1.1508679389953613,
0.6987887024879456,
-0.9637771844863892,
0.10002681612968445,
-1.378572702407837,
-0.2731183171272278,
-0.7905694246292114,
-1.2221882343292236,
0.6550838947296143,
0.17843464016914368,
0.4058671295642853,
-0.5733575820922852,
0.3448571264743805,
-2.184232711791992,
-1.2776732444763184,
-0.2603231966495514,
-0.9932346343994141,
0.47416952252388,
-0.35899022221565247,
0.7119868993759155,
-0.19509339332580566,
0.02736584097146988,
0.298305481672287,
1.387787103652954,
3.3419063091278076,
0.06939102709293365,
0.3199702799320221,
-0.18380045890808105,
-0.9514392018318176,
1.480014443397522,
0.9686934351921082,
-0.112408846616745,
-0.5243309140205383,
-1.1518185138702393,
1.2924602031707764,
1.981557846069336,
0.9712703824043274,
0.027821063995361328,
-0.7957233190536499,
-0.7073549628257751,
-0.07695294916629791,
0.14527307450771332,
0.5245596170425415,
0.8775869011878967,
0.05207858607172966,
0.07484707236289978,
1.4653822183609009,
1.1820909976959229,
-0.4459840953350067,
0.30339619517326355,
-0.8434131741523743,
-0.4546247124671936,
0.48618802428245544,
0.2643990218639374,
0.0010349154472351074,
0.30223146080970764,
-1.0011446475982666,
-0.2109910249710083,
-0.3793991506099701,
-0.9408141374588013,
-0.710233747959137,
-0.40292784571647644,
-0.368550181388855,
1.6433942317962646,
0.1763099879026413,
-0.5282343626022339,
-0.009778918698430061,
-0.7282640337944031,
-0.03867335617542267,
-1.1405811309814453,
0.25794926285743713,
-0.1396143138408661,
-0.07523711025714874,
-0.15873309969902039,
1.8097234964370728,
-0.8721884489059448,
-2.0624732971191406,
0.14626823365688324,
0.2002931535243988,
-0.21537001430988312,
0.2955687642097473,
1.6435530185699463,
0.5408247709274292,
1.5347341299057007,
1.2903395891189575,
0.9892712235450745,
-0.619868814945221,
-1.3600153923034668,
0.7233812808990479,
0.9975993633270264,
-1.438320517539978,
0.7452347278594971,
-0.014417296275496483,
-0.4823160171508789,
0.6958834528923035,
1.2204508781433105,
0.49883630871772766,
-2.134129524230957,
0.8518427610397339,
-1.0325770378112793,
0.7778832912445068,
0.6844944357872009,
0.6671465635299683,
0.2117677628993988,
0.8034690022468567,
-1.2071242332458496,
-1.0969864130020142,
-0.7185088396072388,
-0.7166057825088501,
1.9982495307922363,
-0.3050529658794403,
0.5855944156646729,
-0.21128849685192108,
-1.3532044887542725,
-0.026206117123365402,
0.6701527833938599,
0.3478614389896393,
-0.4455387592315674,
0.786140501499176,
-0.7845548987388611,
-1.2225247621536255,
-1.412111520767212,
-0.4376596212387085,
-1.057926058769226,
-0.9927344918251038,
1.0854758024215698,
0.725919783115387,
0.2716543674468994,
1.8744735717773438,
0.5755019187927246,
0.31053677201271057,
-2.6149022579193115,
0.9390975832939148,
0.25500044226646423,
-0.07689443230628967,
0.8699174523353577,
0.25561219453811646,
1.0655150413513184,
0.01705814152956009,
0.5349283814430237,
-2.419790744781494,
2.309976816177368,
-0.2329593151807785,
0.7018859386444092,
0.03229066729545593,
-0.09960214793682098,
1.0938266515731812,
0.5996899008750916,
0.6666335463523865,
-1.049027442932129,
0.7028353214263916,
-0.6217909455299377,
1.2954845428466797,
0.8290818929672241,
-0.8124316930770874,
-0.09566695988178253,
1.237954020500183,
0.46135854721069336,
-0.507944643497467,
-0.9247488975524902,
-1.1158182621002197,
0.9101192951202393,
1.6980046033859253,
-0.1494997888803482,
-0.04191873222589493,
0.8073609471321106,
0.682518482208252,
-1.3350090980529785,
-0.0017551816999912262,
-0.7423446178436279,
-0.7137042880058289,
1.5385359525680542,
2.065735101699829,
-0.13605427742004395,
-0.2140643149614334,
-0.7075560092926025,
-1.3195173740386963,
0.6914327144622803,
-0.07208770513534546,
0.06886550784111023,
0.5921539664268494,
-0.5590328574180603,
0.9848684668540955,
0.8665047287940979,
0.8983121514320374,
0.20253583788871765,
0.23911137878894806,
0.35654327273368835,
-0.35066983103752136,
-1.1852765083312988,
-0.24039216339588165,
-0.968574047088623,
-2.625389575958252,
0.44978973269462585,
-0.14364846050739288,
-1.4177775382995605,
0.02561739832162857,
-1.049800157546997,
0.9261113405227661,
-0.5342372059822083,
-1.1203233003616333,
-1.48224675655365,
0.10940474271774292,
-0.10985013842582703,
1.0061875581741333,
-1.5971782207489014,
-0.10243768990039825,
1.2654649019241333,
0.8976554274559021,
-0.6694872379302979,
1.1379423141479492,
0.30610212683677673,
1.0360640287399292,
0.8200559616088867,
-0.3339707851409912,
0.6109384894371033,
0.07288733124732971,
-1.3288713693618774,
0.5043653845787048,
1.1672345399856567,
0.2608582079410553,
1.4829641580581665,
-0.6672011017799377,
-0.043675947934389114,
0.45236310362815857,
-0.6616137027740479,
-0.43403685092926025,
-0.47867637872695923,
0.7257979512214661,
-0.06578461825847626,
-0.8710966110229492,
0.00046223588287830353,
-0.10666446387767792,
-0.19006292521953583,
0.13731540739536285,
-1.4497087001800537,
-0.14176137745380402,
-0.34053677320480347,
-0.6288045644760132,
-1.298919677734375,
-0.012500660493969917,
1.4166312217712402,
-0.8129632472991943,
-0.23913002014160156,
0.4095993638038635,
0.4286178946495056,
0.5159159898757935,
0.6809496283531189,
-0.6474449038505554,
-0.3374772369861603,
-0.1672319620847702,
-0.3225476145744324,
0.3560018539428711,
1.4217305183410645,
-0.103470578789711,
-1.0074663162231445,
0.7744458317756653,
-0.32721754908561707,
0.0498623251914978,
1.9370341300964355,
0.08657053112983704,
-0.8212680816650391,
0.2888016998767853,
-0.7656382322311401,
1.9652715921401978,
1.6691664457321167,
1.334962010383606,
-0.2118672877550125,
-0.9521753191947937,
0.6399604678153992,
-0.41499680280685425,
-0.39676788449287415,
0.8812128305435181,
0.44850993156433105,
-0.21954022347927094,
-1.3412762880325317,
0.6719543933868408,
1.227484107017517,
-0.8618736267089844,
-0.8244968056678772,
0.24644364416599274,
-0.7656531929969788,
1.1099047660827637,
0.699329137802124,
0.4250118136405945,
0.2136191874742508,
1.5990581512451172,
0.8123102784156799,
-0.5362224578857422,
0.5270728468894958,
0.49250301718711853,
-0.24696585536003113,
-2.1313655376434326,
-1.1443136930465698,
0.364197701215744,
-0.5889302492141724,
-1.5992779731750488,
1.4060395956039429,
-1.0464307069778442,
-1.0127558708190918,
0.5151165723800659,
0.03610963374376297,
1.3914368152618408,
0.4219758212566376,
1.5432544946670532,
2.0322976112365723,
0.8784877061843872,
0.4372657537460327,
1.304491400718689,
-0.19219505786895752,
-0.49593645334243774,
1.8346740007400513,
-0.4567447602748871,
0.45779651403427124,
1.1707606315612793,
-0.29412251710891724,
-1.0143283605575562,
-0.7087991237640381,
-1.1708083152770996,
-0.6507752537727356,
1.1081361770629883,
0.15114636719226837,
-1.0695130825042725,
0.2704317271709442,
1.5141260623931885,
0.10772766172885895,
-0.34636253118515015,
0.6372256875038147,
0.3345189392566681,
-0.7576704621315002,
-0.027501976117491722,
-0.9452744126319885,
0.5306039452552795,
-0.30907610058784485,
-0.360095739364624,
0.32251814007759094,
0.4130506217479706,
1.3327155113220215,
-0.07042595744132996,
0.16979123651981354,
1.1482030153274536,
-1.3953684568405151,
1.5072332620620728,
-0.6525607705116272,
0.2797866761684418,
-2.2545933723449707,
1.25023353099823,
-0.7931321859359741,
1.990022897720337,
-2.7192063331604004,
0.43402931094169617,
-0.6184158325195312,
-0.4520805776119232,
0.2929244339466095,
-0.32130542397499084,
0.0644129067659378,
-0.17117972671985626,
-1.1579214334487915,
-0.0766286551952362,
-0.6987094879150391,
0.5947861075401306,
1.0822898149490356,
1.275063157081604,
-1.1045465469360352,
-0.24892348051071167,
-1.6989141702651978,
-0.14874276518821716,
-0.8338255882263184,
0.41215309500694275,
-1.9999570846557617,
-0.20932342112064362,
-1.9136255979537964,
-2.298219680786133,
-1.2375733852386475,
-0.8154141902923584,
1.160719633102417,
0.1556089222431183,
-0.8448294401168823,
1.217685580253601,
-0.3043006360530853,
-1.8474854230880737,
1.0321398973464966,
-2.1195600032806396
] |
https://github.com/huggingface/datasets/issues/6079 | Iterating over DataLoader based on HF datasets is stuck forever | **Update**: It seems the latency part is more of a multiprocessing issue with torch and some host specific issue, and I had to scourge through relevant pytorch issues, when I stumbled across these threads:
1. https://github.com/pytorch/pytorch/issues/102494
2. https://github.com/pytorch/pytorch/issues/102269
3. https://github.com/pytorch/pytorch/issues/99625
Out of the suggested solutions, the one that worked in my case was:
```
os.environ['KMP_AFFINITY'] = "disabled"
```
It is working for now, though I have no clue why, just I hope it does not get stuck when I do actual model training, will update by tomorrow.
| ### Describe the bug
I am using Amazon Sagemaker notebook (Amazon Linux 2) with python 3.10 based Conda environment.
I have a dataset in parquet format locally. When I try to iterate over it, the loader is stuck forever. Note that the same code is working for python 3.6 based conda environment seamlessly. What should be my next steps here?
### Steps to reproduce the bug
```
train_dataset = load_dataset(
"parquet", data_files = {'train': tr_data_path + '*.parquet'},
split = 'train',
collate_fn = streaming_data_collate_fn,
streaming = True
).with_format('torch')
train_dataloader = DataLoader(train_dataset, batch_size = 2, num_workers = 0)
t = time.time()
iter_ = 0
for batch in train_dataloader:
iter_ += 1
if iter_ == 1000:
break
print (time.time() - t)
```
### Expected behavior
The snippet should work normally and load the next batch of data.
### Environment info
datasets: '2.14.0'
pyarrow: '12.0.0'
torch: '2.0.0'
Python: 3.10.10 | packaged by conda-forge | (main, Mar 24 2023, 20:08:06) [GCC 11.3.0]
!uname -r
5.10.178-162.673.amzn2.x86_64 | 11 | 87 | Iterating over DataLoader based on HF datasets is stuck forever
### Describe the bug
I am using Amazon Sagemaker notebook (Amazon Linux 2) with python 3.10 based Conda environment.
I have a dataset in parquet format locally. When I try to iterate over it, the loader is stuck forever. Note that the same code is working for python 3.6 based conda environment seamlessly. What should be my next steps here?
### Steps to reproduce the bug
```
train_dataset = load_dataset(
"parquet", data_files = {'train': tr_data_path + '*.parquet'},
split = 'train',
collate_fn = streaming_data_collate_fn,
streaming = True
).with_format('torch')
train_dataloader = DataLoader(train_dataset, batch_size = 2, num_workers = 0)
t = time.time()
iter_ = 0
for batch in train_dataloader:
iter_ += 1
if iter_ == 1000:
break
print (time.time() - t)
```
### Expected behavior
The snippet should work normally and load the next batch of data.
### Environment info
datasets: '2.14.0'
pyarrow: '12.0.0'
torch: '2.0.0'
Python: 3.10.10 | packaged by conda-forge | (main, Mar 24 2023, 20:08:06) [GCC 11.3.0]
!uname -r
5.10.178-162.673.amzn2.x86_64
**Update**: It seems the latency part is more of a multiprocessing issue with torch and some host specific issue, and I had to scourge through relevant pytorch issues, when I stumbled across these threads:
1. https://github.com/pytorch/pytorch/issues/102494
2. https://github.com/pytorch/pytorch/issues/102269
3. https://github.com/pytorch/pytorch/issues/99625
Out of the suggested solutions, the one that worked in my case was:
```
os.environ['KMP_AFFINITY'] = "disabled"
```
It is working for now, though I have no clue why, just I hope it does not get stuck when I do actual model training, will update by tomorrow.
| [
-1.2661398649215698,
-1.0214083194732666,
-0.7204177379608154,
1.5396506786346436,
-0.22598449885845184,
-1.1263196468353271,
0.09709709882736206,
-0.9557428359985352,
1.616188406944275,
-0.767447292804718,
0.2418806105852127,
-1.6014881134033203,
0.014191004447638988,
-0.5700944066047668,
-0.6887220740318298,
-0.8326528668403625,
-0.4021289646625519,
-0.8193531036376953,
1.1501058340072632,
2.461275815963745,
1.2176599502563477,
-1.4544991254806519,
2.7598564624786377,
0.7620337009429932,
-0.17896640300750732,
-1.0806305408477783,
0.47172263264656067,
0.02960026264190674,
-1.3063308000564575,
-0.48215755820274353,
-0.9501196146011353,
-0.07771357893943787,
-0.5345039367675781,
-0.43878263235092163,
0.030519139021635056,
0.4117480218410492,
-0.2464359700679779,
-0.43205609917640686,
-0.5208451151847839,
-0.7017791271209717,
0.44580066204071045,
-0.40594735741615295,
0.919200599193573,
-0.29969868063926697,
1.7587369680404663,
-0.48269906640052795,
0.4514922797679901,
0.7435368299484253,
1.2727054357528687,
0.2063780575990677,
-0.050388041883707047,
0.3330954909324646,
0.44104963541030884,
-0.03267509490251541,
0.5471842288970947,
1.1406036615371704,
0.6921442151069641,
0.40743979811668396,
0.6572169065475464,
-2.253596067428589,
1.3140475749969482,
-0.9785383343696594,
0.30980929732322693,
1.3586921691894531,
-0.9772142767906189,
0.3749275803565979,
-1.751222848892212,
-0.0002444460988044739,
0.641279399394989,
-2.2270078659057617,
0.3024257719516754,
-1.337628722190857,
-0.5098954439163208,
1.0101642608642578,
0.3457295298576355,
-1.2537873983383179,
0.08956113457679749,
-0.5129416584968567,
1.0572179555892944,
0.41459181904792786,
1.1444520950317383,
-1.6621198654174805,
-0.13273312151432037,
-0.2305729240179062,
0.09944535791873932,
-1.3262279033660889,
-1.548895001411438,
0.5410377383232117,
0.6708890199661255,
0.6119084358215332,
-0.12273968756198883,
1.0471196174621582,
-1.0779770612716675,
0.8181551098823547,
-1.0632208585739136,
-1.6464767456054688,
-1.4807904958724976,
-2.338043689727783,
-2.297668695449829,
0.7542058229446411,
-0.4272737205028534,
-0.5001287460327148,
2.0639560222625732,
-1.0415624380111694,
-1.7445831298828125,
1.148862361907959,
0.2408229559659958,
0.0347595252096653,
2.3597962856292725,
0.2127266824245453,
-0.7624620795249939,
0.44801849126815796,
-0.7654674053192139,
0.7434641122817993,
-0.3473360538482666,
1.3625200986862183,
0.40744927525520325,
-0.9695194363594055,
1.5867751836776733,
-0.3295252025127411,
0.5973964333534241,
-0.6748002767562866,
-0.4954518973827362,
-0.7531324028968811,
0.29111307859420776,
1.9835807085037231,
-0.2933020293712616,
1.5029104948043823,
-0.36904120445251465,
-1.51995050907135,
-1.596002459526062,
0.9262583255767822,
0.4716404378414154,
-0.7930783629417419,
0.11468648910522461,
-0.4113365113735199,
0.164534330368042,
-0.10122281312942505,
1.080365777015686,
1.2676255702972412,
0.726137638092041,
-0.40109044313430786,
-0.9532549381256104,
0.22727924585342407,
-0.19963109493255615,
-0.6679081916809082,
-1.79918372631073,
-0.36918917298316956,
0.07910827547311783,
0.6748710870742798,
-1.2905616760253906,
1.7026636600494385,
0.9137943983078003,
1.9346052408218384,
0.9906944036483765,
-0.4024120569229126,
1.4647021293640137,
0.12985658645629883,
1.8219050168991089,
-0.5270629525184631,
0.6341578960418701,
-0.35132578015327454,
-1.07467782497406,
0.7606831789016724,
-0.30582964420318604,
-2.0138370990753174,
-0.7012991309165955,
-0.8065555095672607,
-0.22179892659187317,
-0.7773258090019226,
0.9179975390434265,
-0.26910996437072754,
-1.4191443920135498,
0.26950857043266296,
-0.7273118495941162,
0.18509940803050995,
-1.2235487699508667,
0.3129851222038269,
0.7112163305282593,
-0.5418875813484192,
0.06646102666854858,
-0.2574272155761719,
-1.3287721872329712,
-0.45669862627983093,
0.3267654776573181,
1.8673691749572754,
-0.767615795135498,
0.9449253082275391,
1.0856345891952515,
-0.6960503458976746,
0.08574414253234863,
0.31653162837028503,
-0.2884092628955841,
0.8626006245613098,
-1.0413872003555298,
-0.42346030473709106,
1.1998469829559326,
-0.30428481101989746,
-0.5910359025001526,
1.517069697380066,
0.8164979219436646,
-1.0180408954620361,
-0.27051517367362976,
-0.0950155034661293,
-0.7669329643249512,
0.0871860533952713,
-1.5938310623168945,
-0.17479871213436127,
0.3674243688583374,
-1.52813720703125,
-0.46827200055122375,
-0.2621018886566162,
1.367405652999878,
-0.14417313039302826,
1.4946717023849487,
-0.3611934185028076,
-0.22236831486225128,
-0.327358603477478,
-0.39369136095046997,
0.15475986897945404,
-0.23005908727645874,
-0.6028856039047241,
0.19584625959396362,
-0.804782509803772,
0.32797566056251526,
1.4466149806976318,
0.3880101144313812,
-0.02658867835998535,
0.5071414113044739,
1.0451021194458008,
0.42278268933296204,
0.0037043150514364243,
-0.929458498954773,
-1.5141606330871582,
1.962631106376648,
-1.4770550727844238,
2.0139119625091553,
0.7803326845169067,
-0.029566690325737,
-1.764171838760376,
-1.87527596950531,
1.3436118364334106,
1.0997380018234253,
2.347928762435913,
0.5476515293121338,
0.40851566195487976,
-0.8564997315406799,
-0.6745644211769104,
0.2942653298377991,
-0.9805647134780884,
-0.75736403465271,
0.14880132675170898,
2.4756603240966797,
1.772615909576416,
-0.44709911942481995,
-0.13581308722496033,
-0.9809200167655945,
1.4000046253204346,
-0.15027876198291779,
0.2696882486343384,
2.033827304840088,
-0.20062431693077087,
-0.9838489890098572,
1.2618408203125,
-2.395210027694702,
0.2570475935935974,
2.0135321617126465,
0.28672000765800476,
0.1106756180524826,
-1.4232991933822632,
-0.6405819654464722,
-0.2870000898838043,
-0.485127717256546,
-1.183034896850586,
0.590377151966095,
-0.3124883472919464,
-0.8670793175697327,
-1.4327902793884277,
0.1856769174337387,
-1.1017847061157227,
-1.6522189378738403,
0.2658170461654663,
1.8899871110916138,
2.060356616973877,
-0.7937384247779846,
1.5366237163543701,
-0.3060949444770813,
0.13869038224220276,
1.2519468069076538,
1.2392323017120361,
3.121965169906616,
1.9692243337631226,
-1.2580784559249878,
0.6857168078422546,
-0.190964475274086,
-0.41012170910835266,
1.092612862586975,
-1.1975197792053223,
1.2659560441970825,
-0.1498182713985443,
-1.2176084518432617,
-1.1480343341827393,
1.0141562223434448,
0.5515347123146057,
0.06601815670728683,
-0.47180482745170593,
1.182490348815918,
0.10948411375284195,
1.296407699584961,
0.5116392970085144,
-0.3279276192188263,
0.6410213708877563,
-0.4272105395793915,
-0.48673728108406067,
1.5224416255950928,
0.16091127693653107,
-1.468116044998169,
-2.2090344429016113,
-0.2888104021549225,
-0.8784373998641968,
-0.027131028473377228,
-0.6430111527442932,
-1.0025790929794312,
1.6162091493606567,
0.3999496400356293,
-1.2759944200515747,
-0.30059030652046204,
-0.32576602697372437,
-0.5405345559120178,
2.6862411499023438,
-1.3464694023132324,
-0.28194111585617065,
-0.9862198829650879,
-0.5646004676818848,
1.6789332628250122,
-1.1844249963760376,
-0.22345200181007385,
-1.035955548286438,
-0.6614478230476379,
-1.2791142463684082,
-0.5166765451431274,
-0.02076844498515129,
-0.8897300958633423,
0.8562694787979126,
0.15939877927303314,
-1.1518532037734985,
-0.29542604088783264,
-0.9151502251625061,
0.8831623196601868,
-0.03713557496666908,
0.18145634233951569,
1.8171186447143555,
0.32503262162208557,
-0.43161648511886597,
0.7531758546829224,
1.1029629707336426,
0.6280664801597595,
-0.6830667853355408,
0.15382377803325653,
-0.6461247205734253,
0.36292022466659546,
-1.2292104959487915,
0.285148948431015,
-2.9276087284088135,
0.6712207794189453,
-0.031906139105558395,
-0.09265252202749252,
-0.08010684698820114,
-1.2679797410964966,
1.2232015132904053,
2.589531421661377,
-1.135190486907959,
0.5180268883705139,
0.3808557987213135,
1.1847373247146606,
-1.5894787311553955,
0.3131718635559082,
-0.4348173141479492,
2.104689598083496,
0.23830625414848328,
1.2629398107528687,
-0.48444390296936035,
-2.312617063522339,
0.6551191806793213,
-1.2216912508010864,
-1.1046980619430542,
0.7274972200393677,
-0.885943591594696,
0.13737349212169647,
-1.4295024871826172,
-0.21836918592453003,
-0.8653061985969543,
-1.2052522897720337,
0.6516966819763184,
0.16518065333366394,
0.3802681267261505,
-0.6147212386131287,
0.3523293137550354,
-2.1883432865142822,
-1.3666623830795288,
-0.21521447598934174,
-0.9527069330215454,
0.4839322566986084,
-0.36871257424354553,
0.7031798362731934,
-0.12699931859970093,
0.02023603394627571,
0.31344345211982727,
1.4074742794036865,
3.3873603343963623,
0.11897844821214676,
0.33217737078666687,
-0.15903258323669434,
-0.9307244420051575,
1.4724829196929932,
0.9726607799530029,
-0.10731540620326996,
-0.5156065225601196,
-1.0618473291397095,
1.2884575128555298,
1.9792377948760986,
1.0295361280441284,
0.014056467451155186,
-0.8108001947402954,
-0.6835631132125854,
-0.06653312593698502,
0.14286597073078156,
0.5023177862167358,
0.9741526246070862,
0.011970029212534428,
0.12008451670408249,
1.4980013370513916,
1.2128030061721802,
-0.4409628212451935,
0.3269074559211731,
-0.8508944511413574,
-0.4231538772583008,
0.43162015080451965,
0.2700020968914032,
0.01159267220646143,
0.3212110698223114,
-1.0313681364059448,
-0.21267470717430115,
-0.3925427794456482,
-0.9595943689346313,
-0.7154979705810547,
-0.40115347504615784,
-0.37979575991630554,
1.6253161430358887,
0.14202414453029633,
-0.5051235556602478,
0.009363248012959957,
-0.7611997723579407,
-0.06269320100545883,
-1.0948280096054077,
0.2866238057613373,
-0.13378235697746277,
-0.10627035051584244,
-0.1654457151889801,
1.7093114852905273,
-0.8985262513160706,
-2.059573173522949,
0.21624144911766052,
0.2556733787059784,
-0.27937620878219604,
0.3092968165874481,
1.6321020126342773,
0.5440384745597839,
1.4658739566802979,
1.2930229902267456,
0.9917691946029663,
-0.6183331608772278,
-1.2935278415679932,
0.6973605155944824,
0.9809533357620239,
-1.4289942979812622,
0.7606905698776245,
-0.04091315343976021,
-0.5333850383758545,
0.7008416056632996,
1.3333759307861328,
0.4630529284477234,
-2.089308023452759,
0.838503897190094,
-0.9486563801765442,
0.7855254411697388,
0.6634352207183838,
0.6684046983718872,
0.21047364175319672,
0.8185998201370239,
-1.2168686389923096,
-1.1142864227294922,
-0.7554638385772705,
-0.676693320274353,
1.9841142892837524,
-0.259631484746933,
0.5769977569580078,
-0.16104912757873535,
-1.3580152988433838,
-0.023416943848133087,
0.7170831561088562,
0.3540169894695282,
-0.43540599942207336,
0.8324915170669556,
-0.6903308629989624,
-1.1759750843048096,
-1.334680438041687,
-0.4416196644306183,
-1.0056755542755127,
-1.0054093599319458,
1.0649951696395874,
0.750251054763794,
0.29931843280792236,
1.8677254915237427,
0.6169666647911072,
0.30167755484580994,
-2.6004209518432617,
1.0001295804977417,
0.2753676772117615,
-0.07716955244541168,
0.9085175395011902,
0.21502676606178284,
1.03960120677948,
-0.00982982199639082,
0.5651879906654358,
-2.3835132122039795,
2.2767868041992188,
-0.23786181211471558,
0.6509610414505005,
-0.01666618511080742,
-0.12688671052455902,
1.1126739978790283,
0.652262806892395,
0.6337741613388062,
-1.1135801076889038,
0.7393299341201782,
-0.5824686884880066,
1.2461540699005127,
0.7982297539710999,
-0.8018156290054321,
-0.03159559145569801,
1.2784119844436646,
0.4190171957015991,
-0.507221519947052,
-0.942267894744873,
-1.0248631238937378,
0.9599552750587463,
1.7106248140335083,
-0.10634688287973404,
-0.022312365472316742,
0.8353573083877563,
0.6532204747200012,
-1.3062814474105835,
0.02959594503045082,
-0.7358414530754089,
-0.6510395407676697,
1.5990378856658936,
2.062061309814453,
-0.12136107683181763,
-0.247141495347023,
-0.6764897108078003,
-1.2955132722854614,
0.716288149356842,
-0.05106967315077782,
0.11543451994657516,
0.6484929919242859,
-0.5857858657836914,
1.04719877243042,
0.7838543057441711,
0.9409589767456055,
0.07269329577684402,
0.2543434798717499,
0.3341750204563141,
-0.3794396221637726,
-1.2213525772094727,
-0.3059470057487488,
-1.0504902601242065,
-2.5394723415374756,
0.42472052574157715,
-0.13898736238479614,
-1.386398196220398,
0.03186981379985809,
-1.0731947422027588,
0.9058120250701904,
-0.5819590091705322,
-1.1523405313491821,
-1.4512728452682495,
0.11988090723752975,
-0.15192750096321106,
0.919806718826294,
-1.600828766822815,
-0.12214198708534241,
1.2940165996551514,
0.8844506144523621,
-0.6290667653083801,
1.0988234281539917,
0.2757415771484375,
1.02842378616333,
0.7853502035140991,
-0.3741871416568756,
0.5665014982223511,
0.038694463670253754,
-1.3572072982788086,
0.49621203541755676,
1.1892671585083008,
0.27794331312179565,
1.4968914985656738,
-0.6359174251556396,
-0.021072618663311005,
0.43945178389549255,
-0.6877829432487488,
-0.4841586649417877,
-0.47574812173843384,
0.742316722869873,
-0.02374415472149849,
-0.9620405435562134,
0.022065971046686172,
-0.13885968923568726,
-0.18265877664089203,
0.12668517231941223,
-1.4752005338668823,
-0.13194136321544647,
-0.3382967412471771,
-0.5781089067459106,
-1.265682578086853,
0.026462890207767487,
1.3834444284439087,
-0.8643494844436646,
-0.23967736959457397,
0.4087892472743988,
0.3895703852176666,
0.5030287504196167,
0.6417034268379211,
-0.6322049498558044,
-0.35914093255996704,
-0.1576000154018402,
-0.31458932161331177,
0.30642059445381165,
1.360521674156189,
-0.08653496950864792,
-1.003784418106079,
0.7569956183433533,
-0.39501824975013733,
0.09992720931768417,
1.8951395750045776,
0.03851785138249397,
-0.7982884645462036,
0.32322442531585693,
-0.7523033022880554,
1.9108481407165527,
1.6485155820846558,
1.3505061864852905,
-0.21292729675769806,
-0.8805689215660095,
0.5898410677909851,
-0.3811679184436798,
-0.36740338802337646,
0.8796919584274292,
0.4080457091331482,
-0.238846555352211,
-1.340729832649231,
0.6456488966941833,
1.2221815586090088,
-0.8994668126106262,
-0.7842153906822205,
0.15658031404018402,
-0.789004385471344,
1.1299183368682861,
0.689980149269104,
0.3660755753517151,
0.22905705869197845,
1.5894780158996582,
0.7380314469337463,
-0.5100706815719604,
0.5016963481903076,
0.49852702021598816,
-0.2575012445449829,
-2.138106107711792,
-1.1053515672683716,
0.3305469751358032,
-0.5359587669372559,
-1.607171893119812,
1.3424549102783203,
-1.0972557067871094,
-1.010508418083191,
0.48702913522720337,
0.10960328578948975,
1.4014983177185059,
0.37331342697143555,
1.5532162189483643,
2.081486463546753,
0.884891927242279,
0.4175777733325958,
1.2451728582382202,
-0.1596774011850357,
-0.5256012082099915,
1.8692233562469482,
-0.46636033058166504,
0.5015011429786682,
1.0980587005615234,
-0.3303076922893524,
-1.0634912252426147,
-0.7630166411399841,
-1.1819168329238892,
-0.626997172832489,
1.2090471982955933,
0.1373305469751358,
-1.1199933290481567,
0.2143787145614624,
1.511945366859436,
0.15905173122882843,
-0.36328086256980896,
0.637513279914856,
0.3537033498287201,
-0.7637263536453247,
0.00040839798748493195,
-0.8867495059967041,
0.5414304137229919,
-0.23278330266475677,
-0.3130379915237427,
0.2860414385795593,
0.4765534996986389,
1.3549937009811401,
-0.05399887263774872,
0.10064586997032166,
1.151572585105896,
-1.3907194137573242,
1.5746294260025024,
-0.6569855809211731,
0.27879342436790466,
-2.304547071456909,
1.3296600580215454,
-0.8249362111091614,
1.9515774250030518,
-2.6879584789276123,
0.41001096367836,
-0.624035120010376,
-0.47311267256736755,
0.2970885932445526,
-0.36611244082450867,
0.06839729100465775,
-0.1355912983417511,
-1.097332239151001,
-0.039959732443094254,
-0.7608487010002136,
0.5432116985321045,
1.1315261125564575,
1.3442859649658203,
-1.166876196861267,
-0.24772107601165771,
-1.7404266595840454,
-0.16017434000968933,
-0.8667598962783813,
0.4788968563079834,
-2.024785041809082,
-0.16268645226955414,
-1.9302982091903687,
-2.254237651824951,
-1.2636827230453491,
-0.8623180985450745,
1.087289810180664,
0.15615884959697723,
-0.8654840588569641,
1.2185522317886353,
-0.34192928671836853,
-1.8179134130477905,
1.0273014307022095,
-2.143564224243164
] |
https://github.com/huggingface/datasets/issues/6078 | resume_download with streaming=True | Currently, it's not possible to efficiently resume streaming after an error. Eventually, we plan to support this for Parquet (see https://github.com/huggingface/datasets/issues/5380). | ### Describe the bug
I used:
```
dataset = load_dataset(
"oscar-corpus/OSCAR-2201",
token=True,
language="fr",
streaming=True,
split="train"
)
```
Unfortunately, the server had a problem during the training process. I saved the step my training stopped at.
But how can I resume download from step 1_000_Β΄000 without re-streaming all the first 1 million docs of the dataset?
`download_config=DownloadConfig(resume_download=True)` seems to not work with streaming=True.
### Steps to reproduce the bug
```
from datasets import load_dataset, DownloadConfig
dataset = load_dataset(
"oscar-corpus/OSCAR-2201",
token=True,
language="fr",
streaming=True, # optional
split="train",
download_config=DownloadConfig(resume_download=True)
)
# interupt the run and try to relaunch it => this restart from scratch
```
### Expected behavior
I would expect a parameter to start streaming from a given index in the dataset.
### Environment info
- `datasets` version: 2.14.0
- Platform: Linux-5.19.0-45-generic-x86_64-with-glibc2.29
- Python version: 3.8.10
- Huggingface_hub version: 0.15.1
- PyArrow version: 12.0.1
- Pandas version: 2.0.0 | 12 | 21 | resume_download with streaming=True
### Describe the bug
I used:
```
dataset = load_dataset(
"oscar-corpus/OSCAR-2201",
token=True,
language="fr",
streaming=True,
split="train"
)
```
Unfortunately, the server had a problem during the training process. I saved the step my training stopped at.
But how can I resume download from step 1_000_Β΄000 without re-streaming all the first 1 million docs of the dataset?
`download_config=DownloadConfig(resume_download=True)` seems to not work with streaming=True.
### Steps to reproduce the bug
```
from datasets import load_dataset, DownloadConfig
dataset = load_dataset(
"oscar-corpus/OSCAR-2201",
token=True,
language="fr",
streaming=True, # optional
split="train",
download_config=DownloadConfig(resume_download=True)
)
# interupt the run and try to relaunch it => this restart from scratch
```
### Expected behavior
I would expect a parameter to start streaming from a given index in the dataset.
### Environment info
- `datasets` version: 2.14.0
- Platform: Linux-5.19.0-45-generic-x86_64-with-glibc2.29
- Python version: 3.8.10
- Huggingface_hub version: 0.15.1
- PyArrow version: 12.0.1
- Pandas version: 2.0.0
Currently, it's not possible to efficiently resume streaming after an error. Eventually, we plan to support this for Parquet (see https://github.com/huggingface/datasets/issues/5380). | [
-1.2152302265167236,
-0.9335026144981384,
-0.6795473694801331,
1.4461760520935059,
-0.1448366641998291,
-1.1738520860671997,
0.18506090342998505,
-1.0231943130493164,
1.5911850929260254,
-0.8055459260940552,
0.3376910090446472,
-1.6882258653640747,
-0.015008553862571716,
-0.5544067621231079,
-0.6764162182807922,
-0.8532108664512634,
-0.4713427424430847,
-0.5966882109642029,
1.0877926349639893,
2.4938271045684814,
1.3066977262496948,
-1.3375062942504883,
2.7422995567321777,
0.7432574033737183,
-0.18866001069545746,
-0.9598947763442993,
0.5551878213882446,
0.07867555320262909,
-1.3557051420211792,
-0.35720792412757874,
-0.9592563509941101,
-0.07734367251396179,
-0.5687628388404846,
-0.5199695825576782,
-0.07902250438928604,
0.4419260621070862,
-0.36033761501312256,
-0.4101621210575104,
-0.528456449508667,
-0.8280544877052307,
0.4416472315788269,
-0.3780672550201416,
0.8595506548881531,
-0.3627651631832123,
1.7919005155563354,
-0.5693904161453247,
0.5638159513473511,
0.7221721410751343,
1.2091435194015503,
0.20429196953773499,
-0.019793439656496048,
0.35101446509361267,
0.433015376329422,
-0.09369628131389618,
0.5654848217964172,
1.1719622611999512,
0.6078616976737976,
0.454606831073761,
0.6841264963150024,
-2.162236213684082,
1.3106409311294556,
-0.953127920627594,
0.25302979350090027,
1.3869777917861938,
-0.9923610687255859,
0.377206951379776,
-1.7350797653198242,
-0.08938468247652054,
0.49600133299827576,
-2.258209228515625,
0.29298311471939087,
-1.2863259315490723,
-0.5818076729774475,
1.0235058069229126,
0.3914727568626404,
-1.2338801622390747,
0.04013660550117493,
-0.41075706481933594,
1.0590635538101196,
0.49247100949287415,
1.114829182624817,
-1.6992371082305908,
-0.046650081872940063,
-0.3145955502986908,
0.15139888226985931,
-1.2747067213058472,
-1.5303367376327515,
0.46012067794799805,
0.6020785570144653,
0.5755804181098938,
-0.1285172998905182,
1.0504354238510132,
-1.054734230041504,
0.7827142477035522,
-1.0037391185760498,
-1.6853892803192139,
-1.4638766050338745,
-2.4283318519592285,
-2.3042001724243164,
0.7224404811859131,
-0.4236210882663727,
-0.5388173460960388,
2.0398926734924316,
-1.0478321313858032,
-1.730431318283081,
1.1580796241760254,
0.22842174768447876,
-0.11994830518960953,
2.423983097076416,
0.23157525062561035,
-0.675762414932251,
0.5167130827903748,
-0.862260639667511,
0.6906998753547668,
-0.3941482901573181,
1.386156439781189,
0.5047014951705933,
-1.1053553819656372,
1.556739091873169,
-0.38618993759155273,
0.5908554196357727,
-0.7261047959327698,
-0.47112736105918884,
-0.6423441171646118,
0.19305086135864258,
1.876969575881958,
-0.31407085061073303,
1.5243463516235352,
-0.30550411343574524,
-1.5056958198547363,
-1.565452218055725,
0.9181663990020752,
0.43211114406585693,
-0.7083709836006165,
0.25211796164512634,
-0.2864833176136017,
0.04308304190635681,
-0.006846821866929531,
1.0507129430770874,
1.310271143913269,
0.7804718017578125,
-0.31781119108200073,
-0.8403688073158264,
0.17215213179588318,
-0.07216153293848038,
-0.6612434387207031,
-1.6783533096313477,
-0.3340854048728943,
0.0033622244372963905,
0.6236568689346313,
-1.2787574529647827,
1.832024097442627,
0.8853970766067505,
1.916749119758606,
0.9779251217842102,
-0.4138173758983612,
1.5175888538360596,
0.10136763751506805,
1.888539433479309,
-0.48837605118751526,
0.6418686509132385,
-0.38206446170806885,
-1.1946923732757568,
0.8367238640785217,
-0.30057835578918457,
-2.050370931625366,
-0.7028405666351318,
-0.8050686717033386,
-0.182336688041687,
-0.8294115662574768,
1.0238276720046997,
-0.21956156194210052,
-1.4199351072311401,
0.2160801738500595,
-0.7005099058151245,
0.12309743463993073,
-1.2839136123657227,
0.3729338049888611,
0.7770066261291504,
-0.6488049626350403,
0.09148965775966644,
-0.29744383692741394,
-1.2349120378494263,
-0.42418745160102844,
0.4374792277812958,
1.8387082815170288,
-0.6922329068183899,
0.9865133166313171,
1.0097006559371948,
-0.7761641144752502,
-0.06195025146007538,
0.403648316860199,
-0.2925274670124054,
0.8706820607185364,
-1.0047743320465088,
-0.52232825756073,
1.1803932189941406,
-0.26057204604148865,
-0.6224153637886047,
1.4836020469665527,
0.7087829113006592,
-1.0296590328216553,
-0.197469100356102,
-0.1394335776567459,
-0.8404703736305237,
0.08052656799554825,
-1.576693058013916,
-0.031925998628139496,
0.3743155002593994,
-1.5318355560302734,
-0.5066518187522888,
-0.16128157079219818,
1.312330722808838,
-0.1573571264743805,
1.4578273296356201,
-0.30365389585494995,
-0.14685745537281036,
-0.45225730538368225,
-0.35402601957321167,
0.15619613230228424,
-0.21242250502109528,
-0.5642135143280029,
0.2449807971715927,
-0.7277427911758423,
0.3310166299343109,
1.4411568641662598,
0.2857378423213959,
0.03681071847677231,
0.5553184151649475,
1.0533413887023926,
0.3821277618408203,
-0.1989714354276657,
-0.8686661720275879,
-1.5513527393341064,
1.965555191040039,
-1.4992032051086426,
1.9865213632583618,
0.7726855874061584,
-0.061497218906879425,
-1.7421406507492065,
-1.8530573844909668,
1.3394582271575928,
1.1679855585098267,
2.3468668460845947,
0.5187192559242249,
0.3967910706996918,
-0.8635135889053345,
-0.723146915435791,
0.24397607147693634,
-1.0291556119918823,
-0.7824226021766663,
0.22567033767700195,
2.375283718109131,
1.7615808248519897,
-0.37500667572021484,
-0.19418133795261383,
-1.120069980621338,
1.4388606548309326,
-0.211673304438591,
0.15452426671981812,
1.9054489135742188,
-0.24300101399421692,
-1.0232532024383545,
1.2525800466537476,
-2.3578097820281982,
0.14099504053592682,
1.9653080701828003,
0.30532053112983704,
0.08138490468263626,
-1.2950373888015747,
-0.7438026666641235,
-0.3297688364982605,
-0.47312676906585693,
-1.2084741592407227,
0.4653668999671936,
-0.2162027806043625,
-0.6918386220932007,
-1.4338619709014893,
0.16054478287696838,
-1.0500643253326416,
-1.7379437685012817,
0.13490578532218933,
1.8025364875793457,
2.015388250350952,
-0.7884443402290344,
1.506548285484314,
-0.2957579493522644,
0.1393580585718155,
1.2280935049057007,
1.2421578168869019,
3.1163454055786133,
1.9810051918029785,
-1.3272329568862915,
0.7171159386634827,
-0.04275035858154297,
-0.4925040304660797,
1.2333329916000366,
-1.1724025011062622,
1.4081696271896362,
-0.16174398362636566,
-1.1865910291671753,
-1.2345467805862427,
0.9529148936271667,
0.4832567870616913,
0.023088594898581505,
-0.5533115863800049,
1.1381181478500366,
0.1744001805782318,
1.373551368713379,
0.5432146787643433,
-0.30075204372406006,
0.6604874134063721,
-0.3410540819168091,
-0.5171825885772705,
1.5663710832595825,
0.22790619730949402,
-1.4601854085922241,
-2.3065671920776367,
-0.21532930433750153,
-0.8855238556861877,
0.06329041719436646,
-0.6837037205696106,
-0.9437782168388367,
1.6569627523422241,
0.5235849022865295,
-1.1427699327468872,
-0.2853957712650299,
-0.3658806085586548,
-0.6114386320114136,
2.7451086044311523,
-1.3821474313735962,
-0.1906457543373108,
-1.0118002891540527,
-0.6680620312690735,
1.5963013172149658,
-1.2098405361175537,
-0.24332483112812042,
-1.0503787994384766,
-0.5597237348556519,
-1.3347715139389038,
-0.6056067943572998,
-0.028251327574253082,
-0.8913255333900452,
0.7518514394760132,
0.12288394570350647,
-1.2823909521102905,
-0.3554604649543762,
-0.8647052049636841,
0.9476937055587769,
-0.12785179913043976,
0.2333310842514038,
1.79412043094635,
0.35986581444740295,
-0.4175155758857727,
0.7270545363426208,
1.1655519008636475,
0.6098622679710388,
-0.5461211204528809,
0.299712598323822,
-0.691704273223877,
0.35012492537498474,
-1.2266067266464233,
0.2315104752779007,
-2.855046272277832,
0.5594903230667114,
-0.047665372490882874,
-0.011979462578892708,
-0.11456239223480225,
-1.2735120058059692,
1.1285794973373413,
2.514244318008423,
-1.1835845708847046,
0.5799510478973389,
0.32331180572509766,
1.1685231924057007,
-1.5894654989242554,
0.27464795112609863,
-0.506837785243988,
2.061248540878296,
0.22779212892055511,
1.1307010650634766,
-0.5289735794067383,
-2.32114577293396,
0.6021445393562317,
-1.2753674983978271,
-1.1291700601577759,
0.815559446811676,
-0.8066407442092896,
0.11687153577804565,
-1.2335373163223267,
-0.2376933991909027,
-0.7891265153884888,
-1.1841456890106201,
0.6700118184089661,
0.06166034936904907,
0.5238075256347656,
-0.6556945443153381,
0.4018084406852722,
-2.257413864135742,
-1.2745277881622314,
-0.2721084952354431,
-0.8754205703735352,
0.40081462264060974,
-0.3751843273639679,
0.6599915027618408,
-0.17777933180332184,
-0.03420703113079071,
0.3128085434436798,
1.4329347610473633,
3.338177442550659,
0.18116465210914612,
0.3606398105621338,
-0.0931011363863945,
-0.9605443477630615,
1.528120756149292,
0.9113075137138367,
-0.15434814989566803,
-0.5743181109428406,
-1.0623633861541748,
1.1986860036849976,
1.823746681213379,
1.1277908086776733,
0.04512573033571243,
-0.8562325835227966,
-0.8179100751876831,
-0.012010086327791214,
0.10682760924100876,
0.41071969270706177,
0.9488883018493652,
0.08067857474088669,
0.09354822337627411,
1.4663938283920288,
1.1581695079803467,
-0.3693964183330536,
0.3556409180164337,
-0.8237767219543457,
-0.4855233132839203,
0.5291132926940918,
0.3107873201370239,
-0.02639114297926426,
0.3579287827014923,
-1.0671637058258057,
-0.24485988914966583,
-0.36165493726730347,
-0.864037811756134,
-0.7178500294685364,
-0.39997369050979614,
-0.38806256651878357,
1.6973234415054321,
0.022445743903517723,
-0.4745410084724426,
0.015440881252288818,
-0.8577554821968079,
-0.07407575100660324,
-1.071800708770752,
0.28187239170074463,
-0.1376981884241104,
-0.04042154178023338,
-0.09818784892559052,
1.7935956716537476,
-0.9425928592681885,
-2.170620918273926,
0.22397802770137787,
0.2432723492383957,
-0.31433016061782837,
0.15838773548603058,
1.6419497728347778,
0.5040155053138733,
1.367754340171814,
1.3101269006729126,
0.9608888030052185,
-0.6161578893661499,
-1.327601432800293,
0.716905415058136,
1.0400457382202148,
-1.3874268531799316,
0.7984371781349182,
0.04011320322751999,
-0.496084988117218,
0.5994125008583069,
1.240555763244629,
0.4713575541973114,
-1.968319296836853,
0.739179253578186,
-0.9133549928665161,
0.8316065073013306,
0.756766676902771,
0.690156102180481,
0.15544137358665466,
0.8197440505027771,
-1.250252366065979,
-1.0575085878372192,
-0.6919196248054504,
-0.6514589786529541,
1.97505784034729,
-0.3400510847568512,
0.5638233423233032,
-0.29003724455833435,
-1.3257312774658203,
0.05606068670749664,
0.636173665523529,
0.28422391414642334,
-0.5369572639465332,
0.7872794270515442,
-0.6003469824790955,
-1.1585335731506348,
-1.3238226175308228,
-0.4602028727531433,
-1.0609277486801147,
-0.9437935948371887,
1.0905256271362305,
0.7342687249183655,
0.2593647241592407,
1.9060503244400024,
0.5982105731964111,
0.20218224823474884,
-2.645624876022339,
0.8851600885391235,
0.24859340488910675,
0.07472506165504456,
0.8156249523162842,
0.3665918707847595,
1.0429344177246094,
-0.06274759024381638,
0.532737672328949,
-2.5300259590148926,
2.3585240840911865,
-0.24261005222797394,
0.6573373079299927,
0.03527519851922989,
-0.13999755680561066,
1.1037564277648926,
0.6760315299034119,
0.4222288727760315,
-1.045186161994934,
0.6462305784225464,
-0.5268282294273376,
1.2884032726287842,
0.8943775296211243,
-0.8640088438987732,
0.002394631505012512,
1.3359862565994263,
0.47202515602111816,
-0.4129452109336853,
-0.9861509203910828,
-0.9883828163146973,
1.0093475580215454,
1.7618577480316162,
0.024923088029026985,
0.08358471095561981,
0.8269375562667847,
0.7280065417289734,
-1.3202109336853027,
0.11657245457172394,
-0.7518434524536133,
-0.7351350784301758,
1.7000536918640137,
2.1430444717407227,
-0.11945410072803497,
-0.2290833294391632,
-0.750403642654419,
-1.2973586320877075,
0.8277097940444946,
0.008054044097661972,
0.18391366302967072,
0.7023034691810608,
-0.6030347943305969,
1.0662516355514526,
0.8582523465156555,
0.8478558659553528,
0.3243965208530426,
0.14563047885894775,
0.3364124596118927,
-0.3254643976688385,
-1.2495590448379517,
-0.18232811987400055,
-1.057618498802185,
-2.6239078044891357,
0.4283095896244049,
-0.2221718579530716,
-1.3980400562286377,
0.04138454794883728,
-1.0823373794555664,
0.8688141703605652,
-0.5551318526268005,
-1.147046446800232,
-1.496049165725708,
0.16760767996311188,
-0.08574362844228745,
0.9128952026367188,
-1.6081352233886719,
-0.11621299386024475,
1.2951852083206177,
0.8642752170562744,
-0.6991583704948425,
1.0267345905303955,
0.1859462857246399,
1.0745776891708374,
0.8270337581634521,
-0.3220572769641876,
0.5803820490837097,
0.08602163195610046,
-1.4245022535324097,
0.3822878301143646,
1.2046293020248413,
0.16048897802829742,
1.5560024976730347,
-0.6085581183433533,
0.012765781953930855,
0.36387836933135986,
-0.5015239715576172,
-0.6270177364349365,
-0.5614607334136963,
0.6439492702484131,
-0.01634574681520462,
-0.9227084517478943,
0.059667617082595825,
-0.07421794533729553,
-0.19960878789424896,
0.18366143107414246,
-1.4385243654251099,
-0.0974927544593811,
-0.3732087016105652,
-0.6499450206756592,
-1.3268990516662598,
-0.08504556119441986,
1.3445314168930054,
-0.7819478511810303,
-0.1495254784822464,
0.4764942228794098,
0.21996138989925385,
0.5576388835906982,
0.6777452826499939,
-0.7188628911972046,
-0.2449461817741394,
-0.18037199974060059,
-0.3575464189052582,
0.44517597556114197,
1.3336044549942017,
-0.13408321142196655,
-0.9335112571716309,
0.5741590857505798,
-0.3169000744819641,
0.18493784964084625,
1.9907430410385132,
0.0416388213634491,
-0.78263258934021,
0.31710198521614075,
-0.6997270584106445,
1.8986737728118896,
1.6918675899505615,
1.3638033866882324,
-0.1596209555864334,
-0.9233207702636719,
0.6485154628753662,
-0.2955987751483917,
-0.46497055888175964,
0.8952386975288391,
0.4143970310688019,
-0.21575963497161865,
-1.3950804471969604,
0.7008740305900574,
1.2859517335891724,
-0.8420936465263367,
-0.885495126247406,
0.1403365135192871,
-0.7658588886260986,
1.0806149244308472,
0.7276718616485596,
0.35227373242378235,
0.30216389894485474,
1.6554561853408813,
0.7934237122535706,
-0.4667719006538391,
0.596416175365448,
0.4684576392173767,
-0.1747775375843048,
-2.0544416904449463,
-1.1277446746826172,
0.3567642867565155,
-0.6356343030929565,
-1.5373082160949707,
1.3921188116073608,
-1.1753582954406738,
-1.0259805917739868,
0.5899139642715454,
0.10220751911401749,
1.411434531211853,
0.31231966614723206,
1.58790922164917,
2.031661033630371,
0.8620810508728027,
0.3892628252506256,
1.218882441520691,
-0.16676153242588043,
-0.4453224539756775,
1.7459038496017456,
-0.41513049602508545,
0.4684638977050781,
1.1277716159820557,
-0.31480878591537476,
-1.0814626216888428,
-0.7824559211730957,
-1.2289707660675049,
-0.7654608488082886,
1.1988794803619385,
0.10859449952840805,
-1.0550651550292969,
0.2635762393474579,
1.4628254175186157,
0.07203550636768341,
-0.29039466381073,
0.6761985421180725,
0.3686957359313965,
-0.7609408497810364,
-0.025927241891622543,
-1.0006458759307861,
0.5500694513320923,
-0.21195241808891296,
-0.4291739761829376,
0.25106361508369446,
0.4353479743003845,
1.3101199865341187,
0.043384552001953125,
0.19582800567150116,
1.1899396181106567,
-1.3893117904663086,
1.472706913948059,
-0.7744202613830566,
0.26952478289604187,
-2.3071365356445312,
1.4284226894378662,
-0.7923533320426941,
1.8372423648834229,
-2.6838741302490234,
0.48084571957588196,
-0.5157762765884399,
-0.43155744671821594,
0.32592493295669556,
-0.44168978929519653,
0.18463295698165894,
-0.1487545222043991,
-1.1672812700271606,
-0.09134617447853088,
-0.6796047687530518,
0.5299858450889587,
1.0839464664459229,
1.3925503492355347,
-1.1302255392074585,
-0.27682071924209595,
-1.727389931678772,
-0.08058236539363861,
-0.6980162262916565,
0.3622454106807709,
-1.9048491716384888,
-0.25896212458610535,
-1.899488925933838,
-2.4035069942474365,
-1.1900361776351929,
-0.815913200378418,
1.183335781097412,
0.15139935910701752,
-0.8207873702049255,
1.1972181797027588,
-0.44696158170700073,
-1.8034833669662476,
1.1631875038146973,
-2.224154472351074
] |
https://github.com/huggingface/datasets/issues/6077 | Mapping gets stuck at 99% | The `MAX_MAP_BATCH_SIZE = 1_000_000_000` hack is bad as it loads the entire dataset into RAM when performing `.map`. Instead, it's best to use `.iter(batch_size)` to iterate over the data batches and compute `mean` for each column. (`stddev` can be computed in another pass).
Also, these arrays are big, so it makes sense to reduce `batch_size`/`writer_batch_size` to avoid RAM issues and slow IO. | ### Describe the bug
Hi !
I'm currently working with a large (~150GB) unnormalized dataset at work.
The dataset is available on a read-only filesystem internally, and I use a [loading script](https://huggingface.co/docs/datasets/dataset_script) to retreive it.
I want to normalize the features of the dataset, meaning I need to compute the mean and standard deviation metric for each feature of the entire dataset. I cannot load the entire dataset to RAM as it is too big, so following [this discussion on the huggingface discourse](https://discuss.huggingface.co/t/copy-columns-in-a-dataset-and-compute-statistics-for-a-column/22157) I am using a [map operation](https://huggingface.co/docs/datasets/v2.14.0/en/package_reference/main_classes#datasets.Dataset.map) to first compute the metrics and a second map operation to apply them on the dataset.
The problem lies in the second mapping, as it gets stuck at ~99%. By checking what the process does (using `htop` and `strace`) it seems to be doing a lot of I/O operations, and I'm not sure why.
Obviously, I could always normalize the dataset externally and then load it using a loading script. However, since the internal dataset is updated fairly frequently, using the library to perform normalization automatically would make it much easier for me.
### Steps to reproduce the bug
I'm able to reproduce the problem using the following scripts:
```python
# random_data.py
import datasets
import torch
_VERSION = "1.0.0"
class RandomDataset(datasets.GeneratorBasedBuilder):
def _info(self):
return datasets.DatasetInfo(
version=_VERSION,
supervised_keys=None,
features=datasets.Features(
{
"positions": datasets.Array2D(
shape=(30000, 3),
dtype="float32",
),
"normals": datasets.Array2D(
shape=(30000, 3),
dtype="float32",
),
"features": datasets.Array2D(
shape=(30000, 6),
dtype="float32",
),
"scalars": datasets.Sequence(
feature=datasets.Value("float32"),
length=20,
),
},
),
)
def _split_generators(self, dl_manager):
return [
datasets.SplitGenerator(
name=datasets.Split.TRAIN, # type: ignore
gen_kwargs={"nb_samples": 1000},
),
datasets.SplitGenerator(
name=datasets.Split.TEST, # type: ignore
gen_kwargs={"nb_samples": 100},
),
]
def _generate_examples(self, nb_samples: int):
for idx in range(nb_samples):
yield idx, {
"positions": torch.randn(30000, 3),
"normals": torch.randn(30000, 3),
"features": torch.randn(30000, 6),
"scalars": torch.randn(20),
}
```
```python
# main.py
import datasets
import torch
def apply_mean_std(
dataset: datasets.Dataset,
means: dict[str, torch.Tensor],
stds: dict[str, torch.Tensor],
) -> dict[str, torch.Tensor]:
"""Normalize the dataset using the mean and standard deviation of each feature.
Args:
dataset (`Dataset`): A huggingface dataset.
mean (`dict[str, Tensor]`): A dictionary containing the mean of each feature.
std (`dict[str, Tensor]`): A dictionary containing the standard deviation of each feature.
Returns:
dict: A dictionary containing the normalized dataset.
"""
result = {}
for key in means.keys():
# extract data from dataset
data: torch.Tensor = dataset[key] # type: ignore
# extract mean and std from dict
mean = means[key] # type: ignore
std = stds[key] # type: ignore
# normalize data
normalized_data = (data - mean) / std
result[key] = normalized_data
return result
# get dataset
ds = datasets.load_dataset(
path="random_data.py",
split="train",
).with_format("torch")
# compute mean (along last axis)
means = {key: torch.zeros(ds[key][0].shape[-1]) for key in ds.column_names}
means_sq = {key: torch.zeros(ds[key][0].shape[-1]) for key in ds.column_names}
for batch in ds.iter(batch_size=8):
for key in ds.column_names:
data = batch[key]
batch_size = data.shape[0]
data = data.reshape(-1, data.shape[-1])
means[key] += data.mean(dim=0) / len(ds) * batch_size
means_sq[key] += (data**2).mean(dim=0) / len(ds) * batch_size
# compute std (along last axis)
stds = {key: torch.sqrt(means_sq[key] - means[key] ** 2) for key in ds.column_names}
# normalize each feature of the dataset
ds_normalized = ds.map(
desc="Applying mean/std", # type: ignore
function=apply_mean_std,
batched=False,
fn_kwargs={
"means": means,
"stds": stds,
},
)
```
### Expected behavior
Using the previous scripts, the `ds_normalized` mapping completes in ~5 minutes, but any subsequent use of `ds_normalized` is really really slow, for example reapplying `apply_mean_std` to `ds_normalized` takes forever. This is very strange, I'm sure I must be missing something, but I would still expect this to be faster.
### Environment info
- `datasets` version: 2.13.1
- Platform: Linux-3.10.0-1160.66.1.el7.x86_64-x86_64-with-glibc2.17
- Python version: 3.10.12
- Huggingface_hub version: 0.15.1
- PyArrow version: 12.0.0
- Pandas version: 2.0.2 | 13 | 62 | Mapping gets stuck at 99%
### Describe the bug
Hi !
I'm currently working with a large (~150GB) unnormalized dataset at work.
The dataset is available on a read-only filesystem internally, and I use a [loading script](https://huggingface.co/docs/datasets/dataset_script) to retreive it.
I want to normalize the features of the dataset, meaning I need to compute the mean and standard deviation metric for each feature of the entire dataset. I cannot load the entire dataset to RAM as it is too big, so following [this discussion on the huggingface discourse](https://discuss.huggingface.co/t/copy-columns-in-a-dataset-and-compute-statistics-for-a-column/22157) I am using a [map operation](https://huggingface.co/docs/datasets/v2.14.0/en/package_reference/main_classes#datasets.Dataset.map) to first compute the metrics and a second map operation to apply them on the dataset.
The problem lies in the second mapping, as it gets stuck at ~99%. By checking what the process does (using `htop` and `strace`) it seems to be doing a lot of I/O operations, and I'm not sure why.
Obviously, I could always normalize the dataset externally and then load it using a loading script. However, since the internal dataset is updated fairly frequently, using the library to perform normalization automatically would make it much easier for me.
### Steps to reproduce the bug
I'm able to reproduce the problem using the following scripts:
```python
# random_data.py
import datasets
import torch
_VERSION = "1.0.0"
class RandomDataset(datasets.GeneratorBasedBuilder):
def _info(self):
return datasets.DatasetInfo(
version=_VERSION,
supervised_keys=None,
features=datasets.Features(
{
"positions": datasets.Array2D(
shape=(30000, 3),
dtype="float32",
),
"normals": datasets.Array2D(
shape=(30000, 3),
dtype="float32",
),
"features": datasets.Array2D(
shape=(30000, 6),
dtype="float32",
),
"scalars": datasets.Sequence(
feature=datasets.Value("float32"),
length=20,
),
},
),
)
def _split_generators(self, dl_manager):
return [
datasets.SplitGenerator(
name=datasets.Split.TRAIN, # type: ignore
gen_kwargs={"nb_samples": 1000},
),
datasets.SplitGenerator(
name=datasets.Split.TEST, # type: ignore
gen_kwargs={"nb_samples": 100},
),
]
def _generate_examples(self, nb_samples: int):
for idx in range(nb_samples):
yield idx, {
"positions": torch.randn(30000, 3),
"normals": torch.randn(30000, 3),
"features": torch.randn(30000, 6),
"scalars": torch.randn(20),
}
```
```python
# main.py
import datasets
import torch
def apply_mean_std(
dataset: datasets.Dataset,
means: dict[str, torch.Tensor],
stds: dict[str, torch.Tensor],
) -> dict[str, torch.Tensor]:
"""Normalize the dataset using the mean and standard deviation of each feature.
Args:
dataset (`Dataset`): A huggingface dataset.
mean (`dict[str, Tensor]`): A dictionary containing the mean of each feature.
std (`dict[str, Tensor]`): A dictionary containing the standard deviation of each feature.
Returns:
dict: A dictionary containing the normalized dataset.
"""
result = {}
for key in means.keys():
# extract data from dataset
data: torch.Tensor = dataset[key] # type: ignore
# extract mean and std from dict
mean = means[key] # type: ignore
std = stds[key] # type: ignore
# normalize data
normalized_data = (data - mean) / std
result[key] = normalized_data
return result
# get dataset
ds = datasets.load_dataset(
path="random_data.py",
split="train",
).with_format("torch")
# compute mean (along last axis)
means = {key: torch.zeros(ds[key][0].shape[-1]) for key in ds.column_names}
means_sq = {key: torch.zeros(ds[key][0].shape[-1]) for key in ds.column_names}
for batch in ds.iter(batch_size=8):
for key in ds.column_names:
data = batch[key]
batch_size = data.shape[0]
data = data.reshape(-1, data.shape[-1])
means[key] += data.mean(dim=0) / len(ds) * batch_size
means_sq[key] += (data**2).mean(dim=0) / len(ds) * batch_size
# compute std (along last axis)
stds = {key: torch.sqrt(means_sq[key] - means[key] ** 2) for key in ds.column_names}
# normalize each feature of the dataset
ds_normalized = ds.map(
desc="Applying mean/std", # type: ignore
function=apply_mean_std,
batched=False,
fn_kwargs={
"means": means,
"stds": stds,
},
)
```
### Expected behavior
Using the previous scripts, the `ds_normalized` mapping completes in ~5 minutes, but any subsequent use of `ds_normalized` is really really slow, for example reapplying `apply_mean_std` to `ds_normalized` takes forever. This is very strange, I'm sure I must be missing something, but I would still expect this to be faster.
### Environment info
- `datasets` version: 2.13.1
- Platform: Linux-3.10.0-1160.66.1.el7.x86_64-x86_64-with-glibc2.17
- Python version: 3.10.12
- Huggingface_hub version: 0.15.1
- PyArrow version: 12.0.0
- Pandas version: 2.0.2
The `MAX_MAP_BATCH_SIZE = 1_000_000_000` hack is bad as it loads the entire dataset into RAM when performing `.map`. Instead, it's best to use `.iter(batch_size)` to iterate over the data batches and compute `mean` for each column. (`stddev` can be computed in another pass).
Also, these arrays are big, so it makes sense to reduce `batch_size`/`writer_batch_size` to avoid RAM issues and slow IO. | [
-1.2467619180679321,
-0.9692441821098328,
-0.7773353457450867,
1.3650438785552979,
-0.10279692709445953,
-1.2577497959136963,
0.0820453092455864,
-1.0771145820617676,
1.6699507236480713,
-0.7752376198768616,
0.2535783052444458,
-1.6741188764572144,
0.0001330627128481865,
-0.5192185044288635,
-0.7196358442306519,
-0.9292827248573303,
-0.42836281657218933,
-0.7693653106689453,
1.0682494640350342,
2.5319032669067383,
1.1663181781768799,
-1.3916829824447632,
2.7380056381225586,
0.6890181303024292,
-0.1308683305978775,
-1.0249642133712769,
0.5794615745544434,
0.014394155703485012,
-1.3597949743270874,
-0.39526140689849854,
-0.9713289737701416,
-0.01855153776705265,
-0.5624193549156189,
-0.4949333965778351,
0.034027427434921265,
0.36742085218429565,
-0.22762511670589447,
-0.4426629841327667,
-0.5897688269615173,
-0.7647039294242859,
0.46197813749313354,
-0.3146698772907257,
0.9942435622215271,
-0.3545180857181549,
1.8296427726745605,
-0.5085375308990479,
0.40375715494155884,
0.6671609878540039,
1.343123435974121,
0.2103288769721985,
0.05046398192644119,
0.32061967253685,
0.4087408781051636,
0.04270897060632706,
0.48136669397354126,
1.1971237659454346,
0.6055260896682739,
0.5078228116035461,
0.7211517691612244,
-2.174020767211914,
1.3422565460205078,
-0.9540314674377441,
0.3771088123321533,
1.3440388441085815,
-0.9014260768890381,
0.36384332180023193,
-1.7529940605163574,
-0.08630987256765366,
0.5511480569839478,
-2.256157875061035,
0.14137482643127441,
-1.2834725379943848,
-0.43197959661483765,
0.9795565009117126,
0.3522584140300751,
-1.2050758600234985,
0.18647566437721252,
-0.47631627321243286,
1.0739091634750366,
0.5062569975852966,
1.2354419231414795,
-1.7089179754257202,
0.033225126564502716,
-0.29483798146247864,
0.17447365820407867,
-1.2803961038589478,
-1.576486349105835,
0.5113226771354675,
0.6043962836265564,
0.6299614310264587,
-0.08441014587879181,
1.0067667961120605,
-1.0267763137817383,
0.7464110255241394,
-0.8652818202972412,
-1.6710386276245117,
-1.3861955404281616,
-2.301039934158325,
-2.3644816875457764,
0.8184136152267456,
-0.5005026459693909,
-0.5061028003692627,
2.0318002700805664,
-1.0828410387039185,
-1.790990948677063,
1.0765491724014282,
0.27483460307121277,
0.02147497981786728,
2.377331256866455,
0.162489116191864,
-0.7233153581619263,
0.49063411355018616,
-0.7345637083053589,
0.7893033027648926,
-0.3272707462310791,
1.3078820705413818,
0.4816489517688751,
-1.0030062198638916,
1.5656243562698364,
-0.40476158261299133,
0.5793794989585876,
-0.6556822061538696,
-0.4828268885612488,
-0.8300641775131226,
0.2967936098575592,
1.8910833597183228,
-0.3305094242095947,
1.6367286443710327,
-0.37281346321105957,
-1.6050193309783936,
-1.6232235431671143,
0.829276442527771,
0.5127225518226624,
-0.7676873207092285,
0.052157413214445114,
-0.3729911148548126,
0.06593628227710724,
0.03608138859272003,
1.1072019338607788,
1.202584981918335,
0.709801971912384,
-0.33022168278694153,
-0.8758439421653748,
0.1816616654396057,
-0.0807175561785698,
-0.6972082853317261,
-1.7582370042800903,
-0.3290409445762634,
0.12490931898355484,
0.620330274105072,
-1.1948826313018799,
1.7064586877822876,
0.8753851652145386,
1.8962076902389526,
1.0360573530197144,
-0.3524904251098633,
1.5238271951675415,
0.08224860578775406,
1.8405604362487793,
-0.49912044405937195,
0.6472380757331848,
-0.32927653193473816,
-1.170258641242981,
0.7816345691680908,
-0.3797627389431,
-2.0614588260650635,
-0.7647451758384705,
-0.8371453285217285,
-0.1527726650238037,
-0.7501168847084045,
0.951413094997406,
-0.34933069348335266,
-1.4247697591781616,
0.1697305142879486,
-0.6908698678016663,
0.10819616168737411,
-1.239892840385437,
0.2963680922985077,
0.7544494271278381,
-0.66166752576828,
-0.005780170671641827,
-0.29043665528297424,
-1.290385365486145,
-0.42731159925460815,
0.3055631220340729,
1.8546395301818848,
-0.7297377586364746,
0.9705548286437988,
1.0357428789138794,
-0.7008418440818787,
0.00022096093744039536,
0.29257071018218994,
-0.27541670203208923,
0.9122263789176941,
-1.0406187772750854,
-0.3938690721988678,
1.141351342201233,
-0.18762926757335663,
-0.6023191213607788,
1.405550479888916,
0.6929025650024414,
-1.041069746017456,
-0.212516650557518,
-0.083040252327919,
-0.8680865168571472,
0.000782831571996212,
-1.5526432991027832,
-0.14706754684448242,
0.30281320214271545,
-1.5828789472579956,
-0.509287416934967,
-0.22816458344459534,
1.2231131792068481,
-0.1552390158176422,
1.4142327308654785,
-0.365632563829422,
-0.19843073189258575,
-0.42432650923728943,
-0.4180070161819458,
0.17111988365650177,
-0.21451576054096222,
-0.6111334562301636,
0.2689812481403351,
-0.8629196882247925,
0.3410608172416687,
1.4479649066925049,
0.4027152955532074,
0.0833694264292717,
0.49972155690193176,
1.0811717510223389,
0.3805101811885834,
-0.08217080682516098,
-0.8663572669029236,
-1.5910987854003906,
2.05835223197937,
-1.4396908283233643,
1.9476808309555054,
0.7663041353225708,
-0.0760643482208252,
-1.8363510370254517,
-1.8936485052108765,
1.3488260507583618,
1.144186019897461,
2.37715744972229,
0.5074591040611267,
0.34930527210235596,
-0.783288836479187,
-0.6814500093460083,
0.34575241804122925,
-0.9749862551689148,
-0.7821716666221619,
0.10059787333011627,
2.326171875,
1.771716594696045,
-0.4542063772678375,
-0.22829017043113708,
-1.0167423486709595,
1.3656398057937622,
-0.201698437333107,
0.18882721662521362,
1.953131079673767,
-0.2971537113189697,
-1.0376105308532715,
1.3382163047790527,
-2.2815980911254883,
0.12969645857810974,
1.9696540832519531,
0.2699890732765198,
0.028413381427526474,
-1.4278004169464111,
-0.734067976474762,
-0.2700731158256531,
-0.46307164430618286,
-1.2981153726577759,
0.5094518661499023,
-0.30918145179748535,
-0.7922512888908386,
-1.4753799438476562,
0.08738581091165543,
-1.1354340314865112,
-1.708796501159668,
0.2509942948818207,
1.8835444450378418,
2.0085153579711914,
-0.7053989768028259,
1.4498223066329956,
-0.2546137869358063,
0.19014158844947815,
1.2200132608413696,
1.2179193496704102,
3.1545634269714355,
1.8570878505706787,
-1.273846983909607,
0.6684048771858215,
-0.1141929179430008,
-0.4647964835166931,
1.1711809635162354,
-1.1206079721450806,
1.273573637008667,
-0.18289639055728912,
-1.2553105354309082,
-1.2094475030899048,
1.0053393840789795,
0.45095232129096985,
0.0753774344921112,
-0.47078564763069153,
1.231424331665039,
-0.00803452730178833,
1.296268343925476,
0.5883960127830505,
-0.416258305311203,
0.6329759359359741,
-0.3883343040943146,
-0.5795652866363525,
1.5594953298568726,
0.13391847908496857,
-1.4948092699050903,
-2.2733843326568604,
-0.2512319087982178,
-0.8362984657287598,
0.061264362186193466,
-0.5851579904556274,
-1.0123529434204102,
1.6775928735733032,
0.4154697358608246,
-1.2488596439361572,
-0.26908570528030396,
-0.3993071913719177,
-0.6375272274017334,
2.6548166275024414,
-1.375285267829895,
-0.22833557426929474,
-0.9726972579956055,
-0.579551637172699,
1.555286169052124,
-1.1725170612335205,
-0.1947334259748459,
-0.9975393414497375,
-0.644557535648346,
-1.3117153644561768,
-0.5524806380271912,
-0.005474680569022894,
-0.9762184023857117,
0.7510079145431519,
0.09415651112794876,
-1.1093993186950684,
-0.21420562267303467,
-0.8925400376319885,
0.9263931512832642,
-0.11680498719215393,
0.23930753767490387,
1.9479926824569702,
0.3844825029373169,
-0.3727227449417114,
0.7020922303199768,
1.192228078842163,
0.6332438588142395,
-0.6933721899986267,
0.17940156161785126,
-0.7332433462142944,
0.2755816876888275,
-1.3079543113708496,
0.2640681564807892,
-2.8605823516845703,
0.6311547160148621,
-0.05276830494403839,
-0.058975230902433395,
0.035076286643743515,
-1.2897974252700806,
1.022388219833374,
2.627579689025879,
-1.2358187437057495,
0.4526868462562561,
0.35500675439834595,
1.1841776371002197,
-1.5929027795791626,
0.2859206199645996,
-0.45876768231391907,
2.0668561458587646,
0.2681424915790558,
1.188961148262024,
-0.4825421869754791,
-2.2171220779418945,
0.6156185865402222,
-1.2931641340255737,
-1.1424412727355957,
0.837589681148529,
-0.9084362387657166,
0.16509266197681427,
-1.4005670547485352,
-0.11599458009004593,
-0.7898463010787964,
-1.1691677570343018,
0.6727437376976013,
0.09872538596391678,
0.4813684821128845,
-0.5571417808532715,
0.3317040205001831,
-2.189272403717041,
-1.3392794132232666,
-0.22758139669895172,
-0.9479457139968872,
0.4868817627429962,
-0.3594978153705597,
0.6272926330566406,
-0.15944111347198486,
-0.00487998453900218,
0.32125017046928406,
1.3401402235031128,
3.422945022583008,
0.23287490010261536,
0.27114418148994446,
-0.09279090911149979,
-1.0096945762634277,
1.4944300651550293,
0.9546167850494385,
-0.16229791939258575,
-0.58292156457901,
-1.010434865951538,
1.332673192024231,
1.925355076789856,
1.103664755821228,
0.07600940763950348,
-0.8146185278892517,
-0.715214192867279,
0.030831746757030487,
0.20698682963848114,
0.4660505950450897,
0.943488359451294,
0.04124996066093445,
0.13615675270557404,
1.4841886758804321,
1.1912275552749634,
-0.3671254813671112,
0.3807029724121094,
-0.8676914572715759,
-0.5236761569976807,
0.501707136631012,
0.2918422520160675,
-0.006752285175025463,
0.44594258069992065,
-1.0455619096755981,
-0.24925671517848969,
-0.4486271142959595,
-0.973075807094574,
-0.6216679811477661,
-0.4124670624732971,
-0.3621116280555725,
1.637519359588623,
0.09520765393972397,
-0.5045101642608643,
-0.031103838235139847,
-0.7441604733467102,
-0.16319754719734192,
-1.0321203470230103,
0.3236604928970337,
-0.10514117777347565,
-0.09052335470914841,
-0.11579757183790207,
1.7546086311340332,
-0.9250495433807373,
-2.144601345062256,
0.2583377957344055,
0.22768360376358032,
-0.33503302931785583,
0.1973697543144226,
1.612885594367981,
0.5320526361465454,
1.4144856929779053,
1.3681854009628296,
0.9136322140693665,
-0.6243329644203186,
-1.2871012687683105,
0.6554571390151978,
1.0068215131759644,
-1.3799216747283936,
0.8822434544563293,
-0.08427087962627411,
-0.6085430979728699,
0.663037121295929,
1.2824103832244873,
0.43640318512916565,
-1.95796537399292,
0.8366286158561707,
-0.8730506300926208,
0.7851585745811462,
0.6522778868675232,
0.7634931206703186,
0.1387971043586731,
0.8068157434463501,
-1.300091028213501,
-1.1802146434783936,
-0.7512952089309692,
-0.633277952671051,
1.9603829383850098,
-0.2229035198688507,
0.6474459171295166,
-0.26533573865890503,
-1.2844253778457642,
-0.10628432780504227,
0.668134868144989,
0.2962866723537445,
-0.4588245749473572,
0.8894175291061401,
-0.6616579294204712,
-1.1329398155212402,
-1.4416307210922241,
-0.3858431279659271,
-1.0280656814575195,
-0.8643195033073425,
1.0733836889266968,
0.7522611021995544,
0.2900993227958679,
1.8616113662719727,
0.5906223058700562,
0.23343966901302338,
-2.6607463359832764,
0.8695493936538696,
0.2809373736381531,
-0.04380936548113823,
0.8599489331245422,
0.24945273995399475,
1.0215091705322266,
-0.005454744677990675,
0.5712770819664001,
-2.357414722442627,
2.238645315170288,
-0.22387544810771942,
0.7148292660713196,
-0.028256762772798538,
-0.18239955604076385,
1.1076127290725708,
0.5988099575042725,
0.6433889865875244,
-1.131514549255371,
0.7183264493942261,
-0.5575469732284546,
1.1952338218688965,
0.9183469414710999,
-0.8061854839324951,
-0.034427180886268616,
1.391994595527649,
0.5169562101364136,
-0.41163790225982666,
-0.9537155032157898,
-0.8884913325309753,
0.9732288122177124,
1.7941237688064575,
-0.017208373174071312,
0.0205356664955616,
0.8445966243743896,
0.7048121690750122,
-1.33951997756958,
0.05590561404824257,
-0.7149564623832703,
-0.6730610132217407,
1.6666510105133057,
2.0555827617645264,
-0.08342210203409195,
-0.16475918889045715,
-0.6779496669769287,
-1.2728368043899536,
0.7260436415672302,
-0.02408532053232193,
0.16788329184055328,
0.6857488751411438,
-0.6352343559265137,
1.1326508522033691,
0.8350221514701843,
0.9098381400108337,
0.16711068153381348,
0.25635331869125366,
0.38047876954078674,
-0.2753162086009979,
-1.1661970615386963,
-0.24308814108371735,
-1.0622906684875488,
-2.490513801574707,
0.39713799953460693,
-0.2678970992565155,
-1.4938024282455444,
0.0615595318377018,
-0.9970216751098633,
0.9434236884117126,
-0.5429925918579102,
-1.0938559770584106,
-1.5237315893173218,
0.2605784237384796,
-0.08075535297393799,
0.8848752379417419,
-1.5840823650360107,
-0.10325048863887787,
1.258912205696106,
0.9220340847969055,
-0.6065003275871277,
1.034543514251709,
0.25848492980003357,
0.9599147439002991,
0.8144968748092651,
-0.427222341299057,
0.4959949553012848,
0.13257567584514618,
-1.4068048000335693,
0.43835729360580444,
1.1329865455627441,
0.21448595821857452,
1.4070404767990112,
-0.5656892657279968,
0.05393088981509209,
0.4348471164703369,
-0.5174618363380432,
-0.4444368779659271,
-0.5237290263175964,
0.6564182043075562,
0.017516884952783585,
-0.9142799377441406,
-0.012896684929728508,
-0.014023944735527039,
-0.2493845522403717,
0.25133979320526123,
-1.4675674438476562,
-0.21480707824230194,
-0.4538046419620514,
-0.6116509437561035,
-1.2738367319107056,
-0.058122944086790085,
1.4391961097717285,
-0.8751161098480225,
-0.20370179414749146,
0.48616519570350647,
0.3364516496658325,
0.5443090200424194,
0.693285346031189,
-0.6777745485305786,
-0.2959807813167572,
-0.2361563742160797,
-0.3430134057998657,
0.2228562980890274,
1.2816890478134155,
-0.19853299856185913,
-0.963226854801178,
0.7401447296142578,
-0.330976665019989,
0.08073585480451584,
1.9571428298950195,
0.09340310841798782,
-0.7795586585998535,
0.28553229570388794,
-0.7227051258087158,
1.886473536491394,
1.7449703216552734,
1.4108755588531494,
-0.13359478116035461,
-0.8632180094718933,
0.5396673083305359,
-0.22204384207725525,
-0.3870353698730469,
0.968782365322113,
0.45092907547950745,
-0.14268913865089417,
-1.4336422681808472,
0.6162696480751038,
1.265200138092041,
-0.9080483317375183,
-0.7721258401870728,
0.0915364995598793,
-0.8525296449661255,
1.1124672889709473,
0.6831794381141663,
0.37242868542671204,
0.21695482730865479,
1.6378859281539917,
0.7516043782234192,
-0.4558798372745514,
0.5118764042854309,
0.5175111889839172,
-0.1697489470243454,
-2.1106138229370117,
-1.0412570238113403,
0.285397469997406,
-0.4316714107990265,
-1.575904130935669,
1.3548997640609741,
-1.1578586101531982,
-0.9238414168357849,
0.5306224226951599,
0.03838927671313286,
1.4312107563018799,
0.35462456941604614,
1.6312850713729858,
2.1382038593292236,
0.9121946096420288,
0.3359551429748535,
1.2678711414337158,
-0.054888613522052765,
-0.3838828206062317,
1.7917003631591797,
-0.38751456141471863,
0.5465928912162781,
1.0551667213439941,
-0.3655823767185211,
-1.0192077159881592,
-0.7280741333961487,
-1.2008825540542603,
-0.6306957006454468,
1.1408659219741821,
0.087174192070961,
-1.1189939975738525,
0.21593990921974182,
1.5484702587127686,
0.16591185331344604,
-0.25275304913520813,
0.6905345916748047,
0.46423640847206116,
-0.7505894303321838,
-0.09318429976701736,
-0.972011387348175,
0.5159144401550293,
-0.23220886290073395,
-0.3800661563873291,
0.3158402144908905,
0.43816208839416504,
1.280009150505066,
0.0043673086911439896,
0.16628558933734894,
1.2539658546447754,
-1.3642265796661377,
1.4609066247940063,
-0.704849123954773,
0.23544204235076904,
-2.4571473598480225,
1.4564132690429688,
-0.7929314970970154,
1.9027079343795776,
-2.627387285232544,
0.45968684554100037,
-0.6051923036575317,
-0.4301159679889679,
0.31800055503845215,
-0.4098037779331207,
0.0812394991517067,
-0.11631014943122864,
-1.098257064819336,
-0.08325605094432831,
-0.7290157675743103,
0.6102077960968018,
1.175999641418457,
1.3195080757141113,
-1.069354772567749,
-0.3195604979991913,
-1.7545759677886963,
-0.16033481061458588,
-0.7242748737335205,
0.3217547833919525,
-1.9534660577774048,
-0.16953818500041962,
-1.9060369729995728,
-2.5040366649627686,
-1.293465256690979,
-0.8021124601364136,
1.1435776948928833,
0.21453706920146942,
-0.9167917370796204,
1.2267842292785645,
-0.3773776888847351,
-1.8507046699523926,
1.1155215501785278,
-2.2504379749298096
] |
https://github.com/huggingface/datasets/issues/6077 | Mapping gets stuck at 99% | Hi @mariosasko !
I agree, it's an ugly hack, but it was convenient since the resulting `mean_std` could be cached by the library. For my large dataset (which doesn't fit in RAM), I'm actually using something similar to what you suggested. I got rid of the first mapping in the above scripts and replaced it with an iterator, but the issue with the second mapping still persists. | ### Describe the bug
Hi !
I'm currently working with a large (~150GB) unnormalized dataset at work.
The dataset is available on a read-only filesystem internally, and I use a [loading script](https://huggingface.co/docs/datasets/dataset_script) to retreive it.
I want to normalize the features of the dataset, meaning I need to compute the mean and standard deviation metric for each feature of the entire dataset. I cannot load the entire dataset to RAM as it is too big, so following [this discussion on the huggingface discourse](https://discuss.huggingface.co/t/copy-columns-in-a-dataset-and-compute-statistics-for-a-column/22157) I am using a [map operation](https://huggingface.co/docs/datasets/v2.14.0/en/package_reference/main_classes#datasets.Dataset.map) to first compute the metrics and a second map operation to apply them on the dataset.
The problem lies in the second mapping, as it gets stuck at ~99%. By checking what the process does (using `htop` and `strace`) it seems to be doing a lot of I/O operations, and I'm not sure why.
Obviously, I could always normalize the dataset externally and then load it using a loading script. However, since the internal dataset is updated fairly frequently, using the library to perform normalization automatically would make it much easier for me.
### Steps to reproduce the bug
I'm able to reproduce the problem using the following scripts:
```python
# random_data.py
import datasets
import torch
_VERSION = "1.0.0"
class RandomDataset(datasets.GeneratorBasedBuilder):
def _info(self):
return datasets.DatasetInfo(
version=_VERSION,
supervised_keys=None,
features=datasets.Features(
{
"positions": datasets.Array2D(
shape=(30000, 3),
dtype="float32",
),
"normals": datasets.Array2D(
shape=(30000, 3),
dtype="float32",
),
"features": datasets.Array2D(
shape=(30000, 6),
dtype="float32",
),
"scalars": datasets.Sequence(
feature=datasets.Value("float32"),
length=20,
),
},
),
)
def _split_generators(self, dl_manager):
return [
datasets.SplitGenerator(
name=datasets.Split.TRAIN, # type: ignore
gen_kwargs={"nb_samples": 1000},
),
datasets.SplitGenerator(
name=datasets.Split.TEST, # type: ignore
gen_kwargs={"nb_samples": 100},
),
]
def _generate_examples(self, nb_samples: int):
for idx in range(nb_samples):
yield idx, {
"positions": torch.randn(30000, 3),
"normals": torch.randn(30000, 3),
"features": torch.randn(30000, 6),
"scalars": torch.randn(20),
}
```
```python
# main.py
import datasets
import torch
def apply_mean_std(
dataset: datasets.Dataset,
means: dict[str, torch.Tensor],
stds: dict[str, torch.Tensor],
) -> dict[str, torch.Tensor]:
"""Normalize the dataset using the mean and standard deviation of each feature.
Args:
dataset (`Dataset`): A huggingface dataset.
mean (`dict[str, Tensor]`): A dictionary containing the mean of each feature.
std (`dict[str, Tensor]`): A dictionary containing the standard deviation of each feature.
Returns:
dict: A dictionary containing the normalized dataset.
"""
result = {}
for key in means.keys():
# extract data from dataset
data: torch.Tensor = dataset[key] # type: ignore
# extract mean and std from dict
mean = means[key] # type: ignore
std = stds[key] # type: ignore
# normalize data
normalized_data = (data - mean) / std
result[key] = normalized_data
return result
# get dataset
ds = datasets.load_dataset(
path="random_data.py",
split="train",
).with_format("torch")
# compute mean (along last axis)
means = {key: torch.zeros(ds[key][0].shape[-1]) for key in ds.column_names}
means_sq = {key: torch.zeros(ds[key][0].shape[-1]) for key in ds.column_names}
for batch in ds.iter(batch_size=8):
for key in ds.column_names:
data = batch[key]
batch_size = data.shape[0]
data = data.reshape(-1, data.shape[-1])
means[key] += data.mean(dim=0) / len(ds) * batch_size
means_sq[key] += (data**2).mean(dim=0) / len(ds) * batch_size
# compute std (along last axis)
stds = {key: torch.sqrt(means_sq[key] - means[key] ** 2) for key in ds.column_names}
# normalize each feature of the dataset
ds_normalized = ds.map(
desc="Applying mean/std", # type: ignore
function=apply_mean_std,
batched=False,
fn_kwargs={
"means": means,
"stds": stds,
},
)
```
### Expected behavior
Using the previous scripts, the `ds_normalized` mapping completes in ~5 minutes, but any subsequent use of `ds_normalized` is really really slow, for example reapplying `apply_mean_std` to `ds_normalized` takes forever. This is very strange, I'm sure I must be missing something, but I would still expect this to be faster.
### Environment info
- `datasets` version: 2.13.1
- Platform: Linux-3.10.0-1160.66.1.el7.x86_64-x86_64-with-glibc2.17
- Python version: 3.10.12
- Huggingface_hub version: 0.15.1
- PyArrow version: 12.0.0
- Pandas version: 2.0.2 | 13 | 67 | Mapping gets stuck at 99%
### Describe the bug
Hi !
I'm currently working with a large (~150GB) unnormalized dataset at work.
The dataset is available on a read-only filesystem internally, and I use a [loading script](https://huggingface.co/docs/datasets/dataset_script) to retreive it.
I want to normalize the features of the dataset, meaning I need to compute the mean and standard deviation metric for each feature of the entire dataset. I cannot load the entire dataset to RAM as it is too big, so following [this discussion on the huggingface discourse](https://discuss.huggingface.co/t/copy-columns-in-a-dataset-and-compute-statistics-for-a-column/22157) I am using a [map operation](https://huggingface.co/docs/datasets/v2.14.0/en/package_reference/main_classes#datasets.Dataset.map) to first compute the metrics and a second map operation to apply them on the dataset.
The problem lies in the second mapping, as it gets stuck at ~99%. By checking what the process does (using `htop` and `strace`) it seems to be doing a lot of I/O operations, and I'm not sure why.
Obviously, I could always normalize the dataset externally and then load it using a loading script. However, since the internal dataset is updated fairly frequently, using the library to perform normalization automatically would make it much easier for me.
### Steps to reproduce the bug
I'm able to reproduce the problem using the following scripts:
```python
# random_data.py
import datasets
import torch
_VERSION = "1.0.0"
class RandomDataset(datasets.GeneratorBasedBuilder):
def _info(self):
return datasets.DatasetInfo(
version=_VERSION,
supervised_keys=None,
features=datasets.Features(
{
"positions": datasets.Array2D(
shape=(30000, 3),
dtype="float32",
),
"normals": datasets.Array2D(
shape=(30000, 3),
dtype="float32",
),
"features": datasets.Array2D(
shape=(30000, 6),
dtype="float32",
),
"scalars": datasets.Sequence(
feature=datasets.Value("float32"),
length=20,
),
},
),
)
def _split_generators(self, dl_manager):
return [
datasets.SplitGenerator(
name=datasets.Split.TRAIN, # type: ignore
gen_kwargs={"nb_samples": 1000},
),
datasets.SplitGenerator(
name=datasets.Split.TEST, # type: ignore
gen_kwargs={"nb_samples": 100},
),
]
def _generate_examples(self, nb_samples: int):
for idx in range(nb_samples):
yield idx, {
"positions": torch.randn(30000, 3),
"normals": torch.randn(30000, 3),
"features": torch.randn(30000, 6),
"scalars": torch.randn(20),
}
```
```python
# main.py
import datasets
import torch
def apply_mean_std(
dataset: datasets.Dataset,
means: dict[str, torch.Tensor],
stds: dict[str, torch.Tensor],
) -> dict[str, torch.Tensor]:
"""Normalize the dataset using the mean and standard deviation of each feature.
Args:
dataset (`Dataset`): A huggingface dataset.
mean (`dict[str, Tensor]`): A dictionary containing the mean of each feature.
std (`dict[str, Tensor]`): A dictionary containing the standard deviation of each feature.
Returns:
dict: A dictionary containing the normalized dataset.
"""
result = {}
for key in means.keys():
# extract data from dataset
data: torch.Tensor = dataset[key] # type: ignore
# extract mean and std from dict
mean = means[key] # type: ignore
std = stds[key] # type: ignore
# normalize data
normalized_data = (data - mean) / std
result[key] = normalized_data
return result
# get dataset
ds = datasets.load_dataset(
path="random_data.py",
split="train",
).with_format("torch")
# compute mean (along last axis)
means = {key: torch.zeros(ds[key][0].shape[-1]) for key in ds.column_names}
means_sq = {key: torch.zeros(ds[key][0].shape[-1]) for key in ds.column_names}
for batch in ds.iter(batch_size=8):
for key in ds.column_names:
data = batch[key]
batch_size = data.shape[0]
data = data.reshape(-1, data.shape[-1])
means[key] += data.mean(dim=0) / len(ds) * batch_size
means_sq[key] += (data**2).mean(dim=0) / len(ds) * batch_size
# compute std (along last axis)
stds = {key: torch.sqrt(means_sq[key] - means[key] ** 2) for key in ds.column_names}
# normalize each feature of the dataset
ds_normalized = ds.map(
desc="Applying mean/std", # type: ignore
function=apply_mean_std,
batched=False,
fn_kwargs={
"means": means,
"stds": stds,
},
)
```
### Expected behavior
Using the previous scripts, the `ds_normalized` mapping completes in ~5 minutes, but any subsequent use of `ds_normalized` is really really slow, for example reapplying `apply_mean_std` to `ds_normalized` takes forever. This is very strange, I'm sure I must be missing something, but I would still expect this to be faster.
### Environment info
- `datasets` version: 2.13.1
- Platform: Linux-3.10.0-1160.66.1.el7.x86_64-x86_64-with-glibc2.17
- Python version: 3.10.12
- Huggingface_hub version: 0.15.1
- PyArrow version: 12.0.0
- Pandas version: 2.0.2
Hi @mariosasko !
I agree, it's an ugly hack, but it was convenient since the resulting `mean_std` could be cached by the library. For my large dataset (which doesn't fit in RAM), I'm actually using something similar to what you suggested. I got rid of the first mapping in the above scripts and replaced it with an iterator, but the issue with the second mapping still persists. | [
-1.2467619180679321,
-0.9692441821098328,
-0.7773353457450867,
1.3650438785552979,
-0.10279692709445953,
-1.2577497959136963,
0.0820453092455864,
-1.0771145820617676,
1.6699507236480713,
-0.7752376198768616,
0.2535783052444458,
-1.6741188764572144,
0.0001330627128481865,
-0.5192185044288635,
-0.7196358442306519,
-0.9292827248573303,
-0.42836281657218933,
-0.7693653106689453,
1.0682494640350342,
2.5319032669067383,
1.1663181781768799,
-1.3916829824447632,
2.7380056381225586,
0.6890181303024292,
-0.1308683305978775,
-1.0249642133712769,
0.5794615745544434,
0.014394155703485012,
-1.3597949743270874,
-0.39526140689849854,
-0.9713289737701416,
-0.01855153776705265,
-0.5624193549156189,
-0.4949333965778351,
0.034027427434921265,
0.36742085218429565,
-0.22762511670589447,
-0.4426629841327667,
-0.5897688269615173,
-0.7647039294242859,
0.46197813749313354,
-0.3146698772907257,
0.9942435622215271,
-0.3545180857181549,
1.8296427726745605,
-0.5085375308990479,
0.40375715494155884,
0.6671609878540039,
1.343123435974121,
0.2103288769721985,
0.05046398192644119,
0.32061967253685,
0.4087408781051636,
0.04270897060632706,
0.48136669397354126,
1.1971237659454346,
0.6055260896682739,
0.5078228116035461,
0.7211517691612244,
-2.174020767211914,
1.3422565460205078,
-0.9540314674377441,
0.3771088123321533,
1.3440388441085815,
-0.9014260768890381,
0.36384332180023193,
-1.7529940605163574,
-0.08630987256765366,
0.5511480569839478,
-2.256157875061035,
0.14137482643127441,
-1.2834725379943848,
-0.43197959661483765,
0.9795565009117126,
0.3522584140300751,
-1.2050758600234985,
0.18647566437721252,
-0.47631627321243286,
1.0739091634750366,
0.5062569975852966,
1.2354419231414795,
-1.7089179754257202,
0.033225126564502716,
-0.29483798146247864,
0.17447365820407867,
-1.2803961038589478,
-1.576486349105835,
0.5113226771354675,
0.6043962836265564,
0.6299614310264587,
-0.08441014587879181,
1.0067667961120605,
-1.0267763137817383,
0.7464110255241394,
-0.8652818202972412,
-1.6710386276245117,
-1.3861955404281616,
-2.301039934158325,
-2.3644816875457764,
0.8184136152267456,
-0.5005026459693909,
-0.5061028003692627,
2.0318002700805664,
-1.0828410387039185,
-1.790990948677063,
1.0765491724014282,
0.27483460307121277,
0.02147497981786728,
2.377331256866455,
0.162489116191864,
-0.7233153581619263,
0.49063411355018616,
-0.7345637083053589,
0.7893033027648926,
-0.3272707462310791,
1.3078820705413818,
0.4816489517688751,
-1.0030062198638916,
1.5656243562698364,
-0.40476158261299133,
0.5793794989585876,
-0.6556822061538696,
-0.4828268885612488,
-0.8300641775131226,
0.2967936098575592,
1.8910833597183228,
-0.3305094242095947,
1.6367286443710327,
-0.37281346321105957,
-1.6050193309783936,
-1.6232235431671143,
0.829276442527771,
0.5127225518226624,
-0.7676873207092285,
0.052157413214445114,
-0.3729911148548126,
0.06593628227710724,
0.03608138859272003,
1.1072019338607788,
1.202584981918335,
0.709801971912384,
-0.33022168278694153,
-0.8758439421653748,
0.1816616654396057,
-0.0807175561785698,
-0.6972082853317261,
-1.7582370042800903,
-0.3290409445762634,
0.12490931898355484,
0.620330274105072,
-1.1948826313018799,
1.7064586877822876,
0.8753851652145386,
1.8962076902389526,
1.0360573530197144,
-0.3524904251098633,
1.5238271951675415,
0.08224860578775406,
1.8405604362487793,
-0.49912044405937195,
0.6472380757331848,
-0.32927653193473816,
-1.170258641242981,
0.7816345691680908,
-0.3797627389431,
-2.0614588260650635,
-0.7647451758384705,
-0.8371453285217285,
-0.1527726650238037,
-0.7501168847084045,
0.951413094997406,
-0.34933069348335266,
-1.4247697591781616,
0.1697305142879486,
-0.6908698678016663,
0.10819616168737411,
-1.239892840385437,
0.2963680922985077,
0.7544494271278381,
-0.66166752576828,
-0.005780170671641827,
-0.29043665528297424,
-1.290385365486145,
-0.42731159925460815,
0.3055631220340729,
1.8546395301818848,
-0.7297377586364746,
0.9705548286437988,
1.0357428789138794,
-0.7008418440818787,
0.00022096093744039536,
0.29257071018218994,
-0.27541670203208923,
0.9122263789176941,
-1.0406187772750854,
-0.3938690721988678,
1.141351342201233,
-0.18762926757335663,
-0.6023191213607788,
1.405550479888916,
0.6929025650024414,
-1.041069746017456,
-0.212516650557518,
-0.083040252327919,
-0.8680865168571472,
0.000782831571996212,
-1.5526432991027832,
-0.14706754684448242,
0.30281320214271545,
-1.5828789472579956,
-0.509287416934967,
-0.22816458344459534,
1.2231131792068481,
-0.1552390158176422,
1.4142327308654785,
-0.365632563829422,
-0.19843073189258575,
-0.42432650923728943,
-0.4180070161819458,
0.17111988365650177,
-0.21451576054096222,
-0.6111334562301636,
0.2689812481403351,
-0.8629196882247925,
0.3410608172416687,
1.4479649066925049,
0.4027152955532074,
0.0833694264292717,
0.49972155690193176,
1.0811717510223389,
0.3805101811885834,
-0.08217080682516098,
-0.8663572669029236,
-1.5910987854003906,
2.05835223197937,
-1.4396908283233643,
1.9476808309555054,
0.7663041353225708,
-0.0760643482208252,
-1.8363510370254517,
-1.8936485052108765,
1.3488260507583618,
1.144186019897461,
2.37715744972229,
0.5074591040611267,
0.34930527210235596,
-0.783288836479187,
-0.6814500093460083,
0.34575241804122925,
-0.9749862551689148,
-0.7821716666221619,
0.10059787333011627,
2.326171875,
1.771716594696045,
-0.4542063772678375,
-0.22829017043113708,
-1.0167423486709595,
1.3656398057937622,
-0.201698437333107,
0.18882721662521362,
1.953131079673767,
-0.2971537113189697,
-1.0376105308532715,
1.3382163047790527,
-2.2815980911254883,
0.12969645857810974,
1.9696540832519531,
0.2699890732765198,
0.028413381427526474,
-1.4278004169464111,
-0.734067976474762,
-0.2700731158256531,
-0.46307164430618286,
-1.2981153726577759,
0.5094518661499023,
-0.30918145179748535,
-0.7922512888908386,
-1.4753799438476562,
0.08738581091165543,
-1.1354340314865112,
-1.708796501159668,
0.2509942948818207,
1.8835444450378418,
2.0085153579711914,
-0.7053989768028259,
1.4498223066329956,
-0.2546137869358063,
0.19014158844947815,
1.2200132608413696,
1.2179193496704102,
3.1545634269714355,
1.8570878505706787,
-1.273846983909607,
0.6684048771858215,
-0.1141929179430008,
-0.4647964835166931,
1.1711809635162354,
-1.1206079721450806,
1.273573637008667,
-0.18289639055728912,
-1.2553105354309082,
-1.2094475030899048,
1.0053393840789795,
0.45095232129096985,
0.0753774344921112,
-0.47078564763069153,
1.231424331665039,
-0.00803452730178833,
1.296268343925476,
0.5883960127830505,
-0.416258305311203,
0.6329759359359741,
-0.3883343040943146,
-0.5795652866363525,
1.5594953298568726,
0.13391847908496857,
-1.4948092699050903,
-2.2733843326568604,
-0.2512319087982178,
-0.8362984657287598,
0.061264362186193466,
-0.5851579904556274,
-1.0123529434204102,
1.6775928735733032,
0.4154697358608246,
-1.2488596439361572,
-0.26908570528030396,
-0.3993071913719177,
-0.6375272274017334,
2.6548166275024414,
-1.375285267829895,
-0.22833557426929474,
-0.9726972579956055,
-0.579551637172699,
1.555286169052124,
-1.1725170612335205,
-0.1947334259748459,
-0.9975393414497375,
-0.644557535648346,
-1.3117153644561768,
-0.5524806380271912,
-0.005474680569022894,
-0.9762184023857117,
0.7510079145431519,
0.09415651112794876,
-1.1093993186950684,
-0.21420562267303467,
-0.8925400376319885,
0.9263931512832642,
-0.11680498719215393,
0.23930753767490387,
1.9479926824569702,
0.3844825029373169,
-0.3727227449417114,
0.7020922303199768,
1.192228078842163,
0.6332438588142395,
-0.6933721899986267,
0.17940156161785126,
-0.7332433462142944,
0.2755816876888275,
-1.3079543113708496,
0.2640681564807892,
-2.8605823516845703,
0.6311547160148621,
-0.05276830494403839,
-0.058975230902433395,
0.035076286643743515,
-1.2897974252700806,
1.022388219833374,
2.627579689025879,
-1.2358187437057495,
0.4526868462562561,
0.35500675439834595,
1.1841776371002197,
-1.5929027795791626,
0.2859206199645996,
-0.45876768231391907,
2.0668561458587646,
0.2681424915790558,
1.188961148262024,
-0.4825421869754791,
-2.2171220779418945,
0.6156185865402222,
-1.2931641340255737,
-1.1424412727355957,
0.837589681148529,
-0.9084362387657166,
0.16509266197681427,
-1.4005670547485352,
-0.11599458009004593,
-0.7898463010787964,
-1.1691677570343018,
0.6727437376976013,
0.09872538596391678,
0.4813684821128845,
-0.5571417808532715,
0.3317040205001831,
-2.189272403717041,
-1.3392794132232666,
-0.22758139669895172,
-0.9479457139968872,
0.4868817627429962,
-0.3594978153705597,
0.6272926330566406,
-0.15944111347198486,
-0.00487998453900218,
0.32125017046928406,
1.3401402235031128,
3.422945022583008,
0.23287490010261536,
0.27114418148994446,
-0.09279090911149979,
-1.0096945762634277,
1.4944300651550293,
0.9546167850494385,
-0.16229791939258575,
-0.58292156457901,
-1.010434865951538,
1.332673192024231,
1.925355076789856,
1.103664755821228,
0.07600940763950348,
-0.8146185278892517,
-0.715214192867279,
0.030831746757030487,
0.20698682963848114,
0.4660505950450897,
0.943488359451294,
0.04124996066093445,
0.13615675270557404,
1.4841886758804321,
1.1912275552749634,
-0.3671254813671112,
0.3807029724121094,
-0.8676914572715759,
-0.5236761569976807,
0.501707136631012,
0.2918422520160675,
-0.006752285175025463,
0.44594258069992065,
-1.0455619096755981,
-0.24925671517848969,
-0.4486271142959595,
-0.973075807094574,
-0.6216679811477661,
-0.4124670624732971,
-0.3621116280555725,
1.637519359588623,
0.09520765393972397,
-0.5045101642608643,
-0.031103838235139847,
-0.7441604733467102,
-0.16319754719734192,
-1.0321203470230103,
0.3236604928970337,
-0.10514117777347565,
-0.09052335470914841,
-0.11579757183790207,
1.7546086311340332,
-0.9250495433807373,
-2.144601345062256,
0.2583377957344055,
0.22768360376358032,
-0.33503302931785583,
0.1973697543144226,
1.612885594367981,
0.5320526361465454,
1.4144856929779053,
1.3681854009628296,
0.9136322140693665,
-0.6243329644203186,
-1.2871012687683105,
0.6554571390151978,
1.0068215131759644,
-1.3799216747283936,
0.8822434544563293,
-0.08427087962627411,
-0.6085430979728699,
0.663037121295929,
1.2824103832244873,
0.43640318512916565,
-1.95796537399292,
0.8366286158561707,
-0.8730506300926208,
0.7851585745811462,
0.6522778868675232,
0.7634931206703186,
0.1387971043586731,
0.8068157434463501,
-1.300091028213501,
-1.1802146434783936,
-0.7512952089309692,
-0.633277952671051,
1.9603829383850098,
-0.2229035198688507,
0.6474459171295166,
-0.26533573865890503,
-1.2844253778457642,
-0.10628432780504227,
0.668134868144989,
0.2962866723537445,
-0.4588245749473572,
0.8894175291061401,
-0.6616579294204712,
-1.1329398155212402,
-1.4416307210922241,
-0.3858431279659271,
-1.0280656814575195,
-0.8643195033073425,
1.0733836889266968,
0.7522611021995544,
0.2900993227958679,
1.8616113662719727,
0.5906223058700562,
0.23343966901302338,
-2.6607463359832764,
0.8695493936538696,
0.2809373736381531,
-0.04380936548113823,
0.8599489331245422,
0.24945273995399475,
1.0215091705322266,
-0.005454744677990675,
0.5712770819664001,
-2.357414722442627,
2.238645315170288,
-0.22387544810771942,
0.7148292660713196,
-0.028256762772798538,
-0.18239955604076385,
1.1076127290725708,
0.5988099575042725,
0.6433889865875244,
-1.131514549255371,
0.7183264493942261,
-0.5575469732284546,
1.1952338218688965,
0.9183469414710999,
-0.8061854839324951,
-0.034427180886268616,
1.391994595527649,
0.5169562101364136,
-0.41163790225982666,
-0.9537155032157898,
-0.8884913325309753,
0.9732288122177124,
1.7941237688064575,
-0.017208373174071312,
0.0205356664955616,
0.8445966243743896,
0.7048121690750122,
-1.33951997756958,
0.05590561404824257,
-0.7149564623832703,
-0.6730610132217407,
1.6666510105133057,
2.0555827617645264,
-0.08342210203409195,
-0.16475918889045715,
-0.6779496669769287,
-1.2728368043899536,
0.7260436415672302,
-0.02408532053232193,
0.16788329184055328,
0.6857488751411438,
-0.6352343559265137,
1.1326508522033691,
0.8350221514701843,
0.9098381400108337,
0.16711068153381348,
0.25635331869125366,
0.38047876954078674,
-0.2753162086009979,
-1.1661970615386963,
-0.24308814108371735,
-1.0622906684875488,
-2.490513801574707,
0.39713799953460693,
-0.2678970992565155,
-1.4938024282455444,
0.0615595318377018,
-0.9970216751098633,
0.9434236884117126,
-0.5429925918579102,
-1.0938559770584106,
-1.5237315893173218,
0.2605784237384796,
-0.08075535297393799,
0.8848752379417419,
-1.5840823650360107,
-0.10325048863887787,
1.258912205696106,
0.9220340847969055,
-0.6065003275871277,
1.034543514251709,
0.25848492980003357,
0.9599147439002991,
0.8144968748092651,
-0.427222341299057,
0.4959949553012848,
0.13257567584514618,
-1.4068048000335693,
0.43835729360580444,
1.1329865455627441,
0.21448595821857452,
1.4070404767990112,
-0.5656892657279968,
0.05393088981509209,
0.4348471164703369,
-0.5174618363380432,
-0.4444368779659271,
-0.5237290263175964,
0.6564182043075562,
0.017516884952783585,
-0.9142799377441406,
-0.012896684929728508,
-0.014023944735527039,
-0.2493845522403717,
0.25133979320526123,
-1.4675674438476562,
-0.21480707824230194,
-0.4538046419620514,
-0.6116509437561035,
-1.2738367319107056,
-0.058122944086790085,
1.4391961097717285,
-0.8751161098480225,
-0.20370179414749146,
0.48616519570350647,
0.3364516496658325,
0.5443090200424194,
0.693285346031189,
-0.6777745485305786,
-0.2959807813167572,
-0.2361563742160797,
-0.3430134057998657,
0.2228562980890274,
1.2816890478134155,
-0.19853299856185913,
-0.963226854801178,
0.7401447296142578,
-0.330976665019989,
0.08073585480451584,
1.9571428298950195,
0.09340310841798782,
-0.7795586585998535,
0.28553229570388794,
-0.7227051258087158,
1.886473536491394,
1.7449703216552734,
1.4108755588531494,
-0.13359478116035461,
-0.8632180094718933,
0.5396673083305359,
-0.22204384207725525,
-0.3870353698730469,
0.968782365322113,
0.45092907547950745,
-0.14268913865089417,
-1.4336422681808472,
0.6162696480751038,
1.265200138092041,
-0.9080483317375183,
-0.7721258401870728,
0.0915364995598793,
-0.8525296449661255,
1.1124672889709473,
0.6831794381141663,
0.37242868542671204,
0.21695482730865479,
1.6378859281539917,
0.7516043782234192,
-0.4558798372745514,
0.5118764042854309,
0.5175111889839172,
-0.1697489470243454,
-2.1106138229370117,
-1.0412570238113403,
0.285397469997406,
-0.4316714107990265,
-1.575904130935669,
1.3548997640609741,
-1.1578586101531982,
-0.9238414168357849,
0.5306224226951599,
0.03838927671313286,
1.4312107563018799,
0.35462456941604614,
1.6312850713729858,
2.1382038593292236,
0.9121946096420288,
0.3359551429748535,
1.2678711414337158,
-0.054888613522052765,
-0.3838828206062317,
1.7917003631591797,
-0.38751456141471863,
0.5465928912162781,
1.0551667213439941,
-0.3655823767185211,
-1.0192077159881592,
-0.7280741333961487,
-1.2008825540542603,
-0.6306957006454468,
1.1408659219741821,
0.087174192070961,
-1.1189939975738525,
0.21593990921974182,
1.5484702587127686,
0.16591185331344604,
-0.25275304913520813,
0.6905345916748047,
0.46423640847206116,
-0.7505894303321838,
-0.09318429976701736,
-0.972011387348175,
0.5159144401550293,
-0.23220886290073395,
-0.3800661563873291,
0.3158402144908905,
0.43816208839416504,
1.280009150505066,
0.0043673086911439896,
0.16628558933734894,
1.2539658546447754,
-1.3642265796661377,
1.4609066247940063,
-0.704849123954773,
0.23544204235076904,
-2.4571473598480225,
1.4564132690429688,
-0.7929314970970154,
1.9027079343795776,
-2.627387285232544,
0.45968684554100037,
-0.6051923036575317,
-0.4301159679889679,
0.31800055503845215,
-0.4098037779331207,
0.0812394991517067,
-0.11631014943122864,
-1.098257064819336,
-0.08325605094432831,
-0.7290157675743103,
0.6102077960968018,
1.175999641418457,
1.3195080757141113,
-1.069354772567749,
-0.3195604979991913,
-1.7545759677886963,
-0.16033481061458588,
-0.7242748737335205,
0.3217547833919525,
-1.9534660577774048,
-0.16953818500041962,
-1.9060369729995728,
-2.5040366649627686,
-1.293465256690979,
-0.8021124601364136,
1.1435776948928833,
0.21453706920146942,
-0.9167917370796204,
1.2267842292785645,
-0.3773776888847351,
-1.8507046699523926,
1.1155215501785278,
-2.2504379749298096
] |
https://github.com/huggingface/datasets/issues/6077 | Mapping gets stuck at 99% | Have you tried to reduce `batch_size`/`writer_batch_size` in the 2nd `.map`? Also, can you interrupt the process when it gets stuck and share the error stack trace? | ### Describe the bug
Hi !
I'm currently working with a large (~150GB) unnormalized dataset at work.
The dataset is available on a read-only filesystem internally, and I use a [loading script](https://huggingface.co/docs/datasets/dataset_script) to retreive it.
I want to normalize the features of the dataset, meaning I need to compute the mean and standard deviation metric for each feature of the entire dataset. I cannot load the entire dataset to RAM as it is too big, so following [this discussion on the huggingface discourse](https://discuss.huggingface.co/t/copy-columns-in-a-dataset-and-compute-statistics-for-a-column/22157) I am using a [map operation](https://huggingface.co/docs/datasets/v2.14.0/en/package_reference/main_classes#datasets.Dataset.map) to first compute the metrics and a second map operation to apply them on the dataset.
The problem lies in the second mapping, as it gets stuck at ~99%. By checking what the process does (using `htop` and `strace`) it seems to be doing a lot of I/O operations, and I'm not sure why.
Obviously, I could always normalize the dataset externally and then load it using a loading script. However, since the internal dataset is updated fairly frequently, using the library to perform normalization automatically would make it much easier for me.
### Steps to reproduce the bug
I'm able to reproduce the problem using the following scripts:
```python
# random_data.py
import datasets
import torch
_VERSION = "1.0.0"
class RandomDataset(datasets.GeneratorBasedBuilder):
def _info(self):
return datasets.DatasetInfo(
version=_VERSION,
supervised_keys=None,
features=datasets.Features(
{
"positions": datasets.Array2D(
shape=(30000, 3),
dtype="float32",
),
"normals": datasets.Array2D(
shape=(30000, 3),
dtype="float32",
),
"features": datasets.Array2D(
shape=(30000, 6),
dtype="float32",
),
"scalars": datasets.Sequence(
feature=datasets.Value("float32"),
length=20,
),
},
),
)
def _split_generators(self, dl_manager):
return [
datasets.SplitGenerator(
name=datasets.Split.TRAIN, # type: ignore
gen_kwargs={"nb_samples": 1000},
),
datasets.SplitGenerator(
name=datasets.Split.TEST, # type: ignore
gen_kwargs={"nb_samples": 100},
),
]
def _generate_examples(self, nb_samples: int):
for idx in range(nb_samples):
yield idx, {
"positions": torch.randn(30000, 3),
"normals": torch.randn(30000, 3),
"features": torch.randn(30000, 6),
"scalars": torch.randn(20),
}
```
```python
# main.py
import datasets
import torch
def apply_mean_std(
dataset: datasets.Dataset,
means: dict[str, torch.Tensor],
stds: dict[str, torch.Tensor],
) -> dict[str, torch.Tensor]:
"""Normalize the dataset using the mean and standard deviation of each feature.
Args:
dataset (`Dataset`): A huggingface dataset.
mean (`dict[str, Tensor]`): A dictionary containing the mean of each feature.
std (`dict[str, Tensor]`): A dictionary containing the standard deviation of each feature.
Returns:
dict: A dictionary containing the normalized dataset.
"""
result = {}
for key in means.keys():
# extract data from dataset
data: torch.Tensor = dataset[key] # type: ignore
# extract mean and std from dict
mean = means[key] # type: ignore
std = stds[key] # type: ignore
# normalize data
normalized_data = (data - mean) / std
result[key] = normalized_data
return result
# get dataset
ds = datasets.load_dataset(
path="random_data.py",
split="train",
).with_format("torch")
# compute mean (along last axis)
means = {key: torch.zeros(ds[key][0].shape[-1]) for key in ds.column_names}
means_sq = {key: torch.zeros(ds[key][0].shape[-1]) for key in ds.column_names}
for batch in ds.iter(batch_size=8):
for key in ds.column_names:
data = batch[key]
batch_size = data.shape[0]
data = data.reshape(-1, data.shape[-1])
means[key] += data.mean(dim=0) / len(ds) * batch_size
means_sq[key] += (data**2).mean(dim=0) / len(ds) * batch_size
# compute std (along last axis)
stds = {key: torch.sqrt(means_sq[key] - means[key] ** 2) for key in ds.column_names}
# normalize each feature of the dataset
ds_normalized = ds.map(
desc="Applying mean/std", # type: ignore
function=apply_mean_std,
batched=False,
fn_kwargs={
"means": means,
"stds": stds,
},
)
```
### Expected behavior
Using the previous scripts, the `ds_normalized` mapping completes in ~5 minutes, but any subsequent use of `ds_normalized` is really really slow, for example reapplying `apply_mean_std` to `ds_normalized` takes forever. This is very strange, I'm sure I must be missing something, but I would still expect this to be faster.
### Environment info
- `datasets` version: 2.13.1
- Platform: Linux-3.10.0-1160.66.1.el7.x86_64-x86_64-with-glibc2.17
- Python version: 3.10.12
- Huggingface_hub version: 0.15.1
- PyArrow version: 12.0.0
- Pandas version: 2.0.2 | 13 | 26 | Mapping gets stuck at 99%
### Describe the bug
Hi !
I'm currently working with a large (~150GB) unnormalized dataset at work.
The dataset is available on a read-only filesystem internally, and I use a [loading script](https://huggingface.co/docs/datasets/dataset_script) to retreive it.
I want to normalize the features of the dataset, meaning I need to compute the mean and standard deviation metric for each feature of the entire dataset. I cannot load the entire dataset to RAM as it is too big, so following [this discussion on the huggingface discourse](https://discuss.huggingface.co/t/copy-columns-in-a-dataset-and-compute-statistics-for-a-column/22157) I am using a [map operation](https://huggingface.co/docs/datasets/v2.14.0/en/package_reference/main_classes#datasets.Dataset.map) to first compute the metrics and a second map operation to apply them on the dataset.
The problem lies in the second mapping, as it gets stuck at ~99%. By checking what the process does (using `htop` and `strace`) it seems to be doing a lot of I/O operations, and I'm not sure why.
Obviously, I could always normalize the dataset externally and then load it using a loading script. However, since the internal dataset is updated fairly frequently, using the library to perform normalization automatically would make it much easier for me.
### Steps to reproduce the bug
I'm able to reproduce the problem using the following scripts:
```python
# random_data.py
import datasets
import torch
_VERSION = "1.0.0"
class RandomDataset(datasets.GeneratorBasedBuilder):
def _info(self):
return datasets.DatasetInfo(
version=_VERSION,
supervised_keys=None,
features=datasets.Features(
{
"positions": datasets.Array2D(
shape=(30000, 3),
dtype="float32",
),
"normals": datasets.Array2D(
shape=(30000, 3),
dtype="float32",
),
"features": datasets.Array2D(
shape=(30000, 6),
dtype="float32",
),
"scalars": datasets.Sequence(
feature=datasets.Value("float32"),
length=20,
),
},
),
)
def _split_generators(self, dl_manager):
return [
datasets.SplitGenerator(
name=datasets.Split.TRAIN, # type: ignore
gen_kwargs={"nb_samples": 1000},
),
datasets.SplitGenerator(
name=datasets.Split.TEST, # type: ignore
gen_kwargs={"nb_samples": 100},
),
]
def _generate_examples(self, nb_samples: int):
for idx in range(nb_samples):
yield idx, {
"positions": torch.randn(30000, 3),
"normals": torch.randn(30000, 3),
"features": torch.randn(30000, 6),
"scalars": torch.randn(20),
}
```
```python
# main.py
import datasets
import torch
def apply_mean_std(
dataset: datasets.Dataset,
means: dict[str, torch.Tensor],
stds: dict[str, torch.Tensor],
) -> dict[str, torch.Tensor]:
"""Normalize the dataset using the mean and standard deviation of each feature.
Args:
dataset (`Dataset`): A huggingface dataset.
mean (`dict[str, Tensor]`): A dictionary containing the mean of each feature.
std (`dict[str, Tensor]`): A dictionary containing the standard deviation of each feature.
Returns:
dict: A dictionary containing the normalized dataset.
"""
result = {}
for key in means.keys():
# extract data from dataset
data: torch.Tensor = dataset[key] # type: ignore
# extract mean and std from dict
mean = means[key] # type: ignore
std = stds[key] # type: ignore
# normalize data
normalized_data = (data - mean) / std
result[key] = normalized_data
return result
# get dataset
ds = datasets.load_dataset(
path="random_data.py",
split="train",
).with_format("torch")
# compute mean (along last axis)
means = {key: torch.zeros(ds[key][0].shape[-1]) for key in ds.column_names}
means_sq = {key: torch.zeros(ds[key][0].shape[-1]) for key in ds.column_names}
for batch in ds.iter(batch_size=8):
for key in ds.column_names:
data = batch[key]
batch_size = data.shape[0]
data = data.reshape(-1, data.shape[-1])
means[key] += data.mean(dim=0) / len(ds) * batch_size
means_sq[key] += (data**2).mean(dim=0) / len(ds) * batch_size
# compute std (along last axis)
stds = {key: torch.sqrt(means_sq[key] - means[key] ** 2) for key in ds.column_names}
# normalize each feature of the dataset
ds_normalized = ds.map(
desc="Applying mean/std", # type: ignore
function=apply_mean_std,
batched=False,
fn_kwargs={
"means": means,
"stds": stds,
},
)
```
### Expected behavior
Using the previous scripts, the `ds_normalized` mapping completes in ~5 minutes, but any subsequent use of `ds_normalized` is really really slow, for example reapplying `apply_mean_std` to `ds_normalized` takes forever. This is very strange, I'm sure I must be missing something, but I would still expect this to be faster.
### Environment info
- `datasets` version: 2.13.1
- Platform: Linux-3.10.0-1160.66.1.el7.x86_64-x86_64-with-glibc2.17
- Python version: 3.10.12
- Huggingface_hub version: 0.15.1
- PyArrow version: 12.0.0
- Pandas version: 2.0.2
Have you tried to reduce `batch_size`/`writer_batch_size` in the 2nd `.map`? Also, can you interrupt the process when it gets stuck and share the error stack trace? | [
-1.2467619180679321,
-0.9692441821098328,
-0.7773353457450867,
1.3650438785552979,
-0.10279692709445953,
-1.2577497959136963,
0.0820453092455864,
-1.0771145820617676,
1.6699507236480713,
-0.7752376198768616,
0.2535783052444458,
-1.6741188764572144,
0.0001330627128481865,
-0.5192185044288635,
-0.7196358442306519,
-0.9292827248573303,
-0.42836281657218933,
-0.7693653106689453,
1.0682494640350342,
2.5319032669067383,
1.1663181781768799,
-1.3916829824447632,
2.7380056381225586,
0.6890181303024292,
-0.1308683305978775,
-1.0249642133712769,
0.5794615745544434,
0.014394155703485012,
-1.3597949743270874,
-0.39526140689849854,
-0.9713289737701416,
-0.01855153776705265,
-0.5624193549156189,
-0.4949333965778351,
0.034027427434921265,
0.36742085218429565,
-0.22762511670589447,
-0.4426629841327667,
-0.5897688269615173,
-0.7647039294242859,
0.46197813749313354,
-0.3146698772907257,
0.9942435622215271,
-0.3545180857181549,
1.8296427726745605,
-0.5085375308990479,
0.40375715494155884,
0.6671609878540039,
1.343123435974121,
0.2103288769721985,
0.05046398192644119,
0.32061967253685,
0.4087408781051636,
0.04270897060632706,
0.48136669397354126,
1.1971237659454346,
0.6055260896682739,
0.5078228116035461,
0.7211517691612244,
-2.174020767211914,
1.3422565460205078,
-0.9540314674377441,
0.3771088123321533,
1.3440388441085815,
-0.9014260768890381,
0.36384332180023193,
-1.7529940605163574,
-0.08630987256765366,
0.5511480569839478,
-2.256157875061035,
0.14137482643127441,
-1.2834725379943848,
-0.43197959661483765,
0.9795565009117126,
0.3522584140300751,
-1.2050758600234985,
0.18647566437721252,
-0.47631627321243286,
1.0739091634750366,
0.5062569975852966,
1.2354419231414795,
-1.7089179754257202,
0.033225126564502716,
-0.29483798146247864,
0.17447365820407867,
-1.2803961038589478,
-1.576486349105835,
0.5113226771354675,
0.6043962836265564,
0.6299614310264587,
-0.08441014587879181,
1.0067667961120605,
-1.0267763137817383,
0.7464110255241394,
-0.8652818202972412,
-1.6710386276245117,
-1.3861955404281616,
-2.301039934158325,
-2.3644816875457764,
0.8184136152267456,
-0.5005026459693909,
-0.5061028003692627,
2.0318002700805664,
-1.0828410387039185,
-1.790990948677063,
1.0765491724014282,
0.27483460307121277,
0.02147497981786728,
2.377331256866455,
0.162489116191864,
-0.7233153581619263,
0.49063411355018616,
-0.7345637083053589,
0.7893033027648926,
-0.3272707462310791,
1.3078820705413818,
0.4816489517688751,
-1.0030062198638916,
1.5656243562698364,
-0.40476158261299133,
0.5793794989585876,
-0.6556822061538696,
-0.4828268885612488,
-0.8300641775131226,
0.2967936098575592,
1.8910833597183228,
-0.3305094242095947,
1.6367286443710327,
-0.37281346321105957,
-1.6050193309783936,
-1.6232235431671143,
0.829276442527771,
0.5127225518226624,
-0.7676873207092285,
0.052157413214445114,
-0.3729911148548126,
0.06593628227710724,
0.03608138859272003,
1.1072019338607788,
1.202584981918335,
0.709801971912384,
-0.33022168278694153,
-0.8758439421653748,
0.1816616654396057,
-0.0807175561785698,
-0.6972082853317261,
-1.7582370042800903,
-0.3290409445762634,
0.12490931898355484,
0.620330274105072,
-1.1948826313018799,
1.7064586877822876,
0.8753851652145386,
1.8962076902389526,
1.0360573530197144,
-0.3524904251098633,
1.5238271951675415,
0.08224860578775406,
1.8405604362487793,
-0.49912044405937195,
0.6472380757331848,
-0.32927653193473816,
-1.170258641242981,
0.7816345691680908,
-0.3797627389431,
-2.0614588260650635,
-0.7647451758384705,
-0.8371453285217285,
-0.1527726650238037,
-0.7501168847084045,
0.951413094997406,
-0.34933069348335266,
-1.4247697591781616,
0.1697305142879486,
-0.6908698678016663,
0.10819616168737411,
-1.239892840385437,
0.2963680922985077,
0.7544494271278381,
-0.66166752576828,
-0.005780170671641827,
-0.29043665528297424,
-1.290385365486145,
-0.42731159925460815,
0.3055631220340729,
1.8546395301818848,
-0.7297377586364746,
0.9705548286437988,
1.0357428789138794,
-0.7008418440818787,
0.00022096093744039536,
0.29257071018218994,
-0.27541670203208923,
0.9122263789176941,
-1.0406187772750854,
-0.3938690721988678,
1.141351342201233,
-0.18762926757335663,
-0.6023191213607788,
1.405550479888916,
0.6929025650024414,
-1.041069746017456,
-0.212516650557518,
-0.083040252327919,
-0.8680865168571472,
0.000782831571996212,
-1.5526432991027832,
-0.14706754684448242,
0.30281320214271545,
-1.5828789472579956,
-0.509287416934967,
-0.22816458344459534,
1.2231131792068481,
-0.1552390158176422,
1.4142327308654785,
-0.365632563829422,
-0.19843073189258575,
-0.42432650923728943,
-0.4180070161819458,
0.17111988365650177,
-0.21451576054096222,
-0.6111334562301636,
0.2689812481403351,
-0.8629196882247925,
0.3410608172416687,
1.4479649066925049,
0.4027152955532074,
0.0833694264292717,
0.49972155690193176,
1.0811717510223389,
0.3805101811885834,
-0.08217080682516098,
-0.8663572669029236,
-1.5910987854003906,
2.05835223197937,
-1.4396908283233643,
1.9476808309555054,
0.7663041353225708,
-0.0760643482208252,
-1.8363510370254517,
-1.8936485052108765,
1.3488260507583618,
1.144186019897461,
2.37715744972229,
0.5074591040611267,
0.34930527210235596,
-0.783288836479187,
-0.6814500093460083,
0.34575241804122925,
-0.9749862551689148,
-0.7821716666221619,
0.10059787333011627,
2.326171875,
1.771716594696045,
-0.4542063772678375,
-0.22829017043113708,
-1.0167423486709595,
1.3656398057937622,
-0.201698437333107,
0.18882721662521362,
1.953131079673767,
-0.2971537113189697,
-1.0376105308532715,
1.3382163047790527,
-2.2815980911254883,
0.12969645857810974,
1.9696540832519531,
0.2699890732765198,
0.028413381427526474,
-1.4278004169464111,
-0.734067976474762,
-0.2700731158256531,
-0.46307164430618286,
-1.2981153726577759,
0.5094518661499023,
-0.30918145179748535,
-0.7922512888908386,
-1.4753799438476562,
0.08738581091165543,
-1.1354340314865112,
-1.708796501159668,
0.2509942948818207,
1.8835444450378418,
2.0085153579711914,
-0.7053989768028259,
1.4498223066329956,
-0.2546137869358063,
0.19014158844947815,
1.2200132608413696,
1.2179193496704102,
3.1545634269714355,
1.8570878505706787,
-1.273846983909607,
0.6684048771858215,
-0.1141929179430008,
-0.4647964835166931,
1.1711809635162354,
-1.1206079721450806,
1.273573637008667,
-0.18289639055728912,
-1.2553105354309082,
-1.2094475030899048,
1.0053393840789795,
0.45095232129096985,
0.0753774344921112,
-0.47078564763069153,
1.231424331665039,
-0.00803452730178833,
1.296268343925476,
0.5883960127830505,
-0.416258305311203,
0.6329759359359741,
-0.3883343040943146,
-0.5795652866363525,
1.5594953298568726,
0.13391847908496857,
-1.4948092699050903,
-2.2733843326568604,
-0.2512319087982178,
-0.8362984657287598,
0.061264362186193466,
-0.5851579904556274,
-1.0123529434204102,
1.6775928735733032,
0.4154697358608246,
-1.2488596439361572,
-0.26908570528030396,
-0.3993071913719177,
-0.6375272274017334,
2.6548166275024414,
-1.375285267829895,
-0.22833557426929474,
-0.9726972579956055,
-0.579551637172699,
1.555286169052124,
-1.1725170612335205,
-0.1947334259748459,
-0.9975393414497375,
-0.644557535648346,
-1.3117153644561768,
-0.5524806380271912,
-0.005474680569022894,
-0.9762184023857117,
0.7510079145431519,
0.09415651112794876,
-1.1093993186950684,
-0.21420562267303467,
-0.8925400376319885,
0.9263931512832642,
-0.11680498719215393,
0.23930753767490387,
1.9479926824569702,
0.3844825029373169,
-0.3727227449417114,
0.7020922303199768,
1.192228078842163,
0.6332438588142395,
-0.6933721899986267,
0.17940156161785126,
-0.7332433462142944,
0.2755816876888275,
-1.3079543113708496,
0.2640681564807892,
-2.8605823516845703,
0.6311547160148621,
-0.05276830494403839,
-0.058975230902433395,
0.035076286643743515,
-1.2897974252700806,
1.022388219833374,
2.627579689025879,
-1.2358187437057495,
0.4526868462562561,
0.35500675439834595,
1.1841776371002197,
-1.5929027795791626,
0.2859206199645996,
-0.45876768231391907,
2.0668561458587646,
0.2681424915790558,
1.188961148262024,
-0.4825421869754791,
-2.2171220779418945,
0.6156185865402222,
-1.2931641340255737,
-1.1424412727355957,
0.837589681148529,
-0.9084362387657166,
0.16509266197681427,
-1.4005670547485352,
-0.11599458009004593,
-0.7898463010787964,
-1.1691677570343018,
0.6727437376976013,
0.09872538596391678,
0.4813684821128845,
-0.5571417808532715,
0.3317040205001831,
-2.189272403717041,
-1.3392794132232666,
-0.22758139669895172,
-0.9479457139968872,
0.4868817627429962,
-0.3594978153705597,
0.6272926330566406,
-0.15944111347198486,
-0.00487998453900218,
0.32125017046928406,
1.3401402235031128,
3.422945022583008,
0.23287490010261536,
0.27114418148994446,
-0.09279090911149979,
-1.0096945762634277,
1.4944300651550293,
0.9546167850494385,
-0.16229791939258575,
-0.58292156457901,
-1.010434865951538,
1.332673192024231,
1.925355076789856,
1.103664755821228,
0.07600940763950348,
-0.8146185278892517,
-0.715214192867279,
0.030831746757030487,
0.20698682963848114,
0.4660505950450897,
0.943488359451294,
0.04124996066093445,
0.13615675270557404,
1.4841886758804321,
1.1912275552749634,
-0.3671254813671112,
0.3807029724121094,
-0.8676914572715759,
-0.5236761569976807,
0.501707136631012,
0.2918422520160675,
-0.006752285175025463,
0.44594258069992065,
-1.0455619096755981,
-0.24925671517848969,
-0.4486271142959595,
-0.973075807094574,
-0.6216679811477661,
-0.4124670624732971,
-0.3621116280555725,
1.637519359588623,
0.09520765393972397,
-0.5045101642608643,
-0.031103838235139847,
-0.7441604733467102,
-0.16319754719734192,
-1.0321203470230103,
0.3236604928970337,
-0.10514117777347565,
-0.09052335470914841,
-0.11579757183790207,
1.7546086311340332,
-0.9250495433807373,
-2.144601345062256,
0.2583377957344055,
0.22768360376358032,
-0.33503302931785583,
0.1973697543144226,
1.612885594367981,
0.5320526361465454,
1.4144856929779053,
1.3681854009628296,
0.9136322140693665,
-0.6243329644203186,
-1.2871012687683105,
0.6554571390151978,
1.0068215131759644,
-1.3799216747283936,
0.8822434544563293,
-0.08427087962627411,
-0.6085430979728699,
0.663037121295929,
1.2824103832244873,
0.43640318512916565,
-1.95796537399292,
0.8366286158561707,
-0.8730506300926208,
0.7851585745811462,
0.6522778868675232,
0.7634931206703186,
0.1387971043586731,
0.8068157434463501,
-1.300091028213501,
-1.1802146434783936,
-0.7512952089309692,
-0.633277952671051,
1.9603829383850098,
-0.2229035198688507,
0.6474459171295166,
-0.26533573865890503,
-1.2844253778457642,
-0.10628432780504227,
0.668134868144989,
0.2962866723537445,
-0.4588245749473572,
0.8894175291061401,
-0.6616579294204712,
-1.1329398155212402,
-1.4416307210922241,
-0.3858431279659271,
-1.0280656814575195,
-0.8643195033073425,
1.0733836889266968,
0.7522611021995544,
0.2900993227958679,
1.8616113662719727,
0.5906223058700562,
0.23343966901302338,
-2.6607463359832764,
0.8695493936538696,
0.2809373736381531,
-0.04380936548113823,
0.8599489331245422,
0.24945273995399475,
1.0215091705322266,
-0.005454744677990675,
0.5712770819664001,
-2.357414722442627,
2.238645315170288,
-0.22387544810771942,
0.7148292660713196,
-0.028256762772798538,
-0.18239955604076385,
1.1076127290725708,
0.5988099575042725,
0.6433889865875244,
-1.131514549255371,
0.7183264493942261,
-0.5575469732284546,
1.1952338218688965,
0.9183469414710999,
-0.8061854839324951,
-0.034427180886268616,
1.391994595527649,
0.5169562101364136,
-0.41163790225982666,
-0.9537155032157898,
-0.8884913325309753,
0.9732288122177124,
1.7941237688064575,
-0.017208373174071312,
0.0205356664955616,
0.8445966243743896,
0.7048121690750122,
-1.33951997756958,
0.05590561404824257,
-0.7149564623832703,
-0.6730610132217407,
1.6666510105133057,
2.0555827617645264,
-0.08342210203409195,
-0.16475918889045715,
-0.6779496669769287,
-1.2728368043899536,
0.7260436415672302,
-0.02408532053232193,
0.16788329184055328,
0.6857488751411438,
-0.6352343559265137,
1.1326508522033691,
0.8350221514701843,
0.9098381400108337,
0.16711068153381348,
0.25635331869125366,
0.38047876954078674,
-0.2753162086009979,
-1.1661970615386963,
-0.24308814108371735,
-1.0622906684875488,
-2.490513801574707,
0.39713799953460693,
-0.2678970992565155,
-1.4938024282455444,
0.0615595318377018,
-0.9970216751098633,
0.9434236884117126,
-0.5429925918579102,
-1.0938559770584106,
-1.5237315893173218,
0.2605784237384796,
-0.08075535297393799,
0.8848752379417419,
-1.5840823650360107,
-0.10325048863887787,
1.258912205696106,
0.9220340847969055,
-0.6065003275871277,
1.034543514251709,
0.25848492980003357,
0.9599147439002991,
0.8144968748092651,
-0.427222341299057,
0.4959949553012848,
0.13257567584514618,
-1.4068048000335693,
0.43835729360580444,
1.1329865455627441,
0.21448595821857452,
1.4070404767990112,
-0.5656892657279968,
0.05393088981509209,
0.4348471164703369,
-0.5174618363380432,
-0.4444368779659271,
-0.5237290263175964,
0.6564182043075562,
0.017516884952783585,
-0.9142799377441406,
-0.012896684929728508,
-0.014023944735527039,
-0.2493845522403717,
0.25133979320526123,
-1.4675674438476562,
-0.21480707824230194,
-0.4538046419620514,
-0.6116509437561035,
-1.2738367319107056,
-0.058122944086790085,
1.4391961097717285,
-0.8751161098480225,
-0.20370179414749146,
0.48616519570350647,
0.3364516496658325,
0.5443090200424194,
0.693285346031189,
-0.6777745485305786,
-0.2959807813167572,
-0.2361563742160797,
-0.3430134057998657,
0.2228562980890274,
1.2816890478134155,
-0.19853299856185913,
-0.963226854801178,
0.7401447296142578,
-0.330976665019989,
0.08073585480451584,
1.9571428298950195,
0.09340310841798782,
-0.7795586585998535,
0.28553229570388794,
-0.7227051258087158,
1.886473536491394,
1.7449703216552734,
1.4108755588531494,
-0.13359478116035461,
-0.8632180094718933,
0.5396673083305359,
-0.22204384207725525,
-0.3870353698730469,
0.968782365322113,
0.45092907547950745,
-0.14268913865089417,
-1.4336422681808472,
0.6162696480751038,
1.265200138092041,
-0.9080483317375183,
-0.7721258401870728,
0.0915364995598793,
-0.8525296449661255,
1.1124672889709473,
0.6831794381141663,
0.37242868542671204,
0.21695482730865479,
1.6378859281539917,
0.7516043782234192,
-0.4558798372745514,
0.5118764042854309,
0.5175111889839172,
-0.1697489470243454,
-2.1106138229370117,
-1.0412570238113403,
0.285397469997406,
-0.4316714107990265,
-1.575904130935669,
1.3548997640609741,
-1.1578586101531982,
-0.9238414168357849,
0.5306224226951599,
0.03838927671313286,
1.4312107563018799,
0.35462456941604614,
1.6312850713729858,
2.1382038593292236,
0.9121946096420288,
0.3359551429748535,
1.2678711414337158,
-0.054888613522052765,
-0.3838828206062317,
1.7917003631591797,
-0.38751456141471863,
0.5465928912162781,
1.0551667213439941,
-0.3655823767185211,
-1.0192077159881592,
-0.7280741333961487,
-1.2008825540542603,
-0.6306957006454468,
1.1408659219741821,
0.087174192070961,
-1.1189939975738525,
0.21593990921974182,
1.5484702587127686,
0.16591185331344604,
-0.25275304913520813,
0.6905345916748047,
0.46423640847206116,
-0.7505894303321838,
-0.09318429976701736,
-0.972011387348175,
0.5159144401550293,
-0.23220886290073395,
-0.3800661563873291,
0.3158402144908905,
0.43816208839416504,
1.280009150505066,
0.0043673086911439896,
0.16628558933734894,
1.2539658546447754,
-1.3642265796661377,
1.4609066247940063,
-0.704849123954773,
0.23544204235076904,
-2.4571473598480225,
1.4564132690429688,
-0.7929314970970154,
1.9027079343795776,
-2.627387285232544,
0.45968684554100037,
-0.6051923036575317,
-0.4301159679889679,
0.31800055503845215,
-0.4098037779331207,
0.0812394991517067,
-0.11631014943122864,
-1.098257064819336,
-0.08325605094432831,
-0.7290157675743103,
0.6102077960968018,
1.175999641418457,
1.3195080757141113,
-1.069354772567749,
-0.3195604979991913,
-1.7545759677886963,
-0.16033481061458588,
-0.7242748737335205,
0.3217547833919525,
-1.9534660577774048,
-0.16953818500041962,
-1.9060369729995728,
-2.5040366649627686,
-1.293465256690979,
-0.8021124601364136,
1.1435776948928833,
0.21453706920146942,
-0.9167917370796204,
1.2267842292785645,
-0.3773776888847351,
-1.8507046699523926,
1.1155215501785278,
-2.2504379749298096
] |
https://github.com/huggingface/datasets/issues/6077 | Mapping gets stuck at 99% | I think `batch_size/writer_batch_size` is already at its lowest in the 2nd `.map` since `batched=False` implies `batch_size=1` and `len(ds) = 1000 = writer_batch_size`.
Here is also a bunch of stack traces when I interrupted the process:
<details>
<summary>stack trace 1</summary>
```python
(pyg)[d623204@rosetta-bigviz01 stage-laurent-f]$ python src/random_scripts/uses_random_data.py
Found cached dataset random_data (/local_scratch/lfainsin/.cache/huggingface/datasets/random_data/default/0.0.0/444e214e1d0e6298cfd3f2368323ec37073dc1439f618e19395b1f421c69b066)
Applying mean/std: 97%|ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | 967/1000 [00:01<00:00, 534.87 examples/s]Traceback (most recent call last):
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_writer.py", line 179, in __arrow_array__
storage = to_pyarrow_listarray(data, pa_type)
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/features/features.py", line 1466, in to_pyarrow_listarray
return pa.array(data, pa_type.storage_dtype)
File "pyarrow/array.pxi", line 320, in pyarrow.lib.array
File "pyarrow/array.pxi", line 39, in pyarrow.lib._sequence_to_array
File "pyarrow/error.pxi", line 144, in pyarrow.lib.pyarrow_internal_check_status
File "pyarrow/error.pxi", line 123, in pyarrow.lib.check_status
pyarrow.lib.ArrowTypeError: Could not convert tensor([[-1.0273, -0.8037, -0.6860],
[-0.5034, -1.2685, -0.0558],
[-1.0908, -1.1820, -0.3178],
...,
[-0.8171, 0.1781, -0.5903],
[ 0.4370, 1.9305, 0.5899],
[-0.1426, 0.9053, -1.7559]]) with type Tensor: was not a sequence or recognized null for conversion to list type
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_dataset.py", line 3449, in _map_single
writer.write(example)
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_writer.py", line 490, in write
self.write_examples_on_file()
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_writer.py", line 448, in write_examples_on_file
self.write_batch(batch_examples=batch_examples)
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_writer.py", line 553, in write_batch
arrays.append(pa.array(typed_sequence))
File "pyarrow/array.pxi", line 236, in pyarrow.lib.array
File "pyarrow/array.pxi", line 110, in pyarrow.lib._handle_arrow_array_protocol
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_writer.py", line 223, in __arrow_array__
return pa.array(cast_to_python_objects(data, only_1d_for_numpy=True))
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/features/features.py", line 446, in cast_to_python_objects
return _cast_to_python_objects(
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/features/features.py", line 407, in _cast_to_python_objects
[
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/features/features.py", line 408, in <listcomp>
_cast_to_python_objects(
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/features/features.py", line 319, in _cast_to_python_objects
[
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/features/features.py", line 320, in <listcomp>
_cast_to_python_objects(
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/features/features.py", line 263, in _cast_to_python_objects
def _cast_to_python_objects(obj: Any, only_1d_for_numpy: bool, optimize_list_casting: bool) -> Tuple[Any, bool]:
KeyboardInterrupt
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_writer.py", line 179, in __arrow_array__
storage = to_pyarrow_listarray(data, pa_type)
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/features/features.py", line 1466, in to_pyarrow_listarray
return pa.array(data, pa_type.storage_dtype)
File "pyarrow/array.pxi", line 320, in pyarrow.lib.array
File "pyarrow/array.pxi", line 39, in pyarrow.lib._sequence_to_array
File "pyarrow/error.pxi", line 144, in pyarrow.lib.pyarrow_internal_check_status
File "pyarrow/error.pxi", line 123, in pyarrow.lib.check_status
pyarrow.lib.ArrowTypeError: Could not convert tensor([[-1.0273, -0.8037, -0.6860],
[-0.5034, -1.2685, -0.0558],
[-1.0908, -1.1820, -0.3178],
...,
[-0.8171, 0.1781, -0.5903],
[ 0.4370, 1.9305, 0.5899],
[-0.1426, 0.9053, -1.7559]]) with type Tensor: was not a sequence or recognized null for conversion to list type
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/gpfs_new/data/users/lfainsin/stage-laurent-f/src/random_scripts/uses_random_data.py", line 62, in <module>
ds_normalized = ds.map(
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_dataset.py", line 580, in wrapper
out: Union["Dataset", "DatasetDict"] = func(self, *args, **kwargs)
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_dataset.py", line 545, in wrapper
out: Union["Dataset", "DatasetDict"] = func(self, *args, **kwargs)
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_dataset.py", line 3087, in map
for rank, done, content in Dataset._map_single(**dataset_kwargs):
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_dataset.py", line 3492, in _map_single
writer.finalize()
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_writer.py", line 584, in finalize
self.write_examples_on_file()
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_writer.py", line 448, in write_examples_on_file
self.write_batch(batch_examples=batch_examples)
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_writer.py", line 553, in write_batch
arrays.append(pa.array(typed_sequence))
File "pyarrow/array.pxi", line 236, in pyarrow.lib.array
File "pyarrow/array.pxi", line 110, in pyarrow.lib._handle_arrow_array_protocol
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_writer.py", line 223, in __arrow_array__
return pa.array(cast_to_python_objects(data, only_1d_for_numpy=True))
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/features/features.py", line 446, in cast_to_python_objects
return _cast_to_python_objects(
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/features/features.py", line 407, in _cast_to_python_objects
[
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/features/features.py", line 408, in <listcomp>
_cast_to_python_objects(
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/features/features.py", line 319, in _cast_to_python_objects
[
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/features/features.py", line 319, in <listcomp>
[
KeyboardInterrupt
```
</details>
<details>
<summary>stack trace 2</summary>
```python
(pyg)[d623204@rosetta-bigviz01 stage-laurent-f]$ python src/random_scripts/uses_random_data.py
Found cached dataset random_data (/local_scratch/lfainsin/.cache/huggingface/datasets/random_data/default/0.0.0/444e214e1d0e6298cfd3f2368323ec37073dc1439f618e19395b1f421c69b066)
Applying mean/std: 99%|ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | 988/1000 [00:20<00:00, 526.19 examples/s]Applying mean/std: 100%|ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ| 999/1000 [00:21<00:00, 9.66 examples/s]Traceback (most recent call last):
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_writer.py", line 179, in __arrow_array__
storage = to_pyarrow_listarray(data, pa_type)
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/features/features.py", line 1466, in to_pyarrow_listarray
return pa.array(data, pa_type.storage_dtype)
File "pyarrow/array.pxi", line 320, in pyarrow.lib.array
File "pyarrow/array.pxi", line 39, in pyarrow.lib._sequence_to_array
File "pyarrow/error.pxi", line 144, in pyarrow.lib.pyarrow_internal_check_status
File "pyarrow/error.pxi", line 123, in pyarrow.lib.check_status
pyarrow.lib.ArrowTypeError: Could not convert tensor([[-1.0273, -0.8037, -0.6860],
[-0.5034, -1.2685, -0.0558],
[-1.0908, -1.1820, -0.3178],
...,
[-0.8171, 0.1781, -0.5903],
[ 0.4370, 1.9305, 0.5899],
[-0.1426, 0.9053, -1.7559]]) with type Tensor: was not a sequence or recognized null for conversion to list type
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_dataset.py", line 3449, in _map_single
writer.write(example)
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_writer.py", line 490, in write
self.write_examples_on_file()
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_writer.py", line 448, in write_examples_on_file
self.write_batch(batch_examples=batch_examples)
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_writer.py", line 553, in write_batch
arrays.append(pa.array(typed_sequence))
File "pyarrow/array.pxi", line 236, in pyarrow.lib.array
File "pyarrow/array.pxi", line 110, in pyarrow.lib._handle_arrow_array_protocol
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_writer.py", line 223, in __arrow_array__
return pa.array(cast_to_python_objects(data, only_1d_for_numpy=True))
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/features/features.py", line 446, in cast_to_python_objects
return _cast_to_python_objects(
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/features/features.py", line 407, in _cast_to_python_objects
[
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/features/features.py", line 408, in <listcomp>
_cast_to_python_objects(
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/features/features.py", line 319, in _cast_to_python_objects
[
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/features/features.py", line 320, in <listcomp>
_cast_to_python_objects(
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/features/features.py", line 263, in _cast_to_python_objects
def _cast_to_python_objects(obj: Any, only_1d_for_numpy: bool, optimize_list_casting: bool) -> Tuple[Any, bool]:
KeyboardInterrupt
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_writer.py", line 179, in __arrow_array__
storage = to_pyarrow_listarray(data, pa_type)
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/features/features.py", line 1466, in to_pyarrow_listarray
return pa.array(data, pa_type.storage_dtype)
File "pyarrow/array.pxi", line 320, in pyarrow.lib.array
File "pyarrow/array.pxi", line 39, in pyarrow.lib._sequence_to_array
File "pyarrow/error.pxi", line 144, in pyarrow.lib.pyarrow_internal_check_status
File "pyarrow/error.pxi", line 123, in pyarrow.lib.check_status
pyarrow.lib.ArrowTypeError: Could not convert tensor([[-1.0273, -0.8037, -0.6860],
[-0.5034, -1.2685, -0.0558],
[-1.0908, -1.1820, -0.3178],
...,
[-0.8171, 0.1781, -0.5903],
[ 0.4370, 1.9305, 0.5899],
[-0.1426, 0.9053, -1.7559]]) with type Tensor: was not a sequence or recognized null for conversion to list type
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/gpfs_new/data/users/lfainsin/stage-laurent-f/src/random_scripts/uses_random_data.py", line 62, in <module>
ds_normalized = ds.map(
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_dataset.py", line 580, in wrapper
out: Union["Dataset", "DatasetDict"] = func(self, *args, **kwargs)
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_dataset.py", line 545, in wrapper
out: Union["Dataset", "DatasetDict"] = func(self, *args, **kwargs)
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_dataset.py", line 3087, in map
for rank, done, content in Dataset._map_single(**dataset_kwargs):
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_dataset.py", line 3492, in _map_single
writer.finalize()
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_writer.py", line 584, in finalize
self.write_examples_on_file()
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_writer.py", line 448, in write_examples_on_file
self.write_batch(batch_examples=batch_examples)
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_writer.py", line 553, in write_batch
arrays.append(pa.array(typed_sequence))
File "pyarrow/array.pxi", line 236, in pyarrow.lib.array
File "pyarrow/array.pxi", line 110, in pyarrow.lib._handle_arrow_array_protocol
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_writer.py", line 223, in __arrow_array__
return pa.array(cast_to_python_objects(data, only_1d_for_numpy=True))
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/features/features.py", line 446, in cast_to_python_objects
return _cast_to_python_objects(
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/features/features.py", line 407, in _cast_to_python_objects
[
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/features/features.py", line 408, in <listcomp>
_cast_to_python_objects(
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/features/features.py", line 319, in _cast_to_python_objects
[
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/features/features.py", line 320, in <listcomp>
_cast_to_python_objects(
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/features/features.py", line 291, in _cast_to_python_objects
if config.JAX_AVAILABLE and "jax" in sys.modules:
KeyboardInterrupt
```
</details>
<details>
<summary>stack trace 3</summary>
```python
(pyg)[d623204@rosetta-bigviz01 stage-laurent-f]$ python src/random_scripts/uses_random_data.py
Found cached dataset random_data (/local_scratch/lfainsin/.cache/huggingface/datasets/random_data/default/0.0.0/444e214e1d0e6298cfd3f2368323ec37073dc1439f618e19395b1f421c69b066)
Applying mean/std: 99%|ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | 989/1000 [00:01<00:00, 504.80 examples/s]Traceback (most recent call last):
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_writer.py", line 179, in __arrow_array__
storage = to_pyarrow_listarray(data, pa_type)
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/features/features.py", line 1466, in to_pyarrow_listarray
return pa.array(data, pa_type.storage_dtype)
File "pyarrow/array.pxi", line 320, in pyarrow.lib.array
File "pyarrow/array.pxi", line 39, in pyarrow.lib._sequence_to_array
File "pyarrow/error.pxi", line 144, in pyarrow.lib.pyarrow_internal_check_status
File "pyarrow/error.pxi", line 123, in pyarrow.lib.check_status
pyarrow.lib.ArrowTypeError: Could not convert tensor([[-1.0273, -0.8037, -0.6860],
[-0.5034, -1.2685, -0.0558],
[-1.0908, -1.1820, -0.3178],
...,
[-0.8171, 0.1781, -0.5903],
[ 0.4370, 1.9305, 0.5899],
[-0.1426, 0.9053, -1.7559]]) with type Tensor: was not a sequence or recognized null for conversion to list type
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_dataset.py", line 3449, in _map_single
writer.write(example)
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_writer.py", line 490, in write
self.write_examples_on_file()
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_writer.py", line 448, in write_examples_on_file
self.write_batch(batch_examples=batch_examples)
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_writer.py", line 553, in write_batch
arrays.append(pa.array(typed_sequence))
File "pyarrow/array.pxi", line 236, in pyarrow.lib.array
File "pyarrow/array.pxi", line 110, in pyarrow.lib._handle_arrow_array_protocol
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_writer.py", line 223, in __arrow_array__
return pa.array(cast_to_python_objects(data, only_1d_for_numpy=True))
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/features/features.py", line 446, in cast_to_python_objects
return _cast_to_python_objects(
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/features/features.py", line 407, in _cast_to_python_objects
[
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/features/features.py", line 408, in <listcomp>
_cast_to_python_objects(
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/features/features.py", line 319, in _cast_to_python_objects
[
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/features/features.py", line 320, in <listcomp>
_cast_to_python_objects(
KeyboardInterrupt
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_writer.py", line 179, in __arrow_array__
storage = to_pyarrow_listarray(data, pa_type)
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/features/features.py", line 1466, in to_pyarrow_listarray
return pa.array(data, pa_type.storage_dtype)
File "pyarrow/array.pxi", line 320, in pyarrow.lib.array
File "pyarrow/array.pxi", line 39, in pyarrow.lib._sequence_to_array
File "pyarrow/error.pxi", line 144, in pyarrow.lib.pyarrow_internal_check_status
File "pyarrow/error.pxi", line 123, in pyarrow.lib.check_status
pyarrow.lib.ArrowTypeError: Could not convert tensor([[-1.0273, -0.8037, -0.6860],
[-0.5034, -1.2685, -0.0558],
[-1.0908, -1.1820, -0.3178],
...,
[-0.8171, 0.1781, -0.5903],
[ 0.4370, 1.9305, 0.5899],
[-0.1426, 0.9053, -1.7559]]) with type Tensor: was not a sequence or recognized null for conversion to list type
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/gpfs_new/data/users/lfainsin/stage-laurent-f/src/random_scripts/uses_random_data.py", line 62, in <module>
ds_normalized = ds.map(
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_dataset.py", line 580, in wrapper
out: Union["Dataset", "DatasetDict"] = func(self, *args, **kwargs)
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_dataset.py", line 545, in wrapper
out: Union["Dataset", "DatasetDict"] = func(self, *args, **kwargs)
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_dataset.py", line 3087, in map
for rank, done, content in Dataset._map_single(**dataset_kwargs):
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_dataset.py", line 3492, in _map_single
writer.finalize()
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_writer.py", line 584, in finalize
self.write_examples_on_file()
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_writer.py", line 448, in write_examples_on_file
self.write_batch(batch_examples=batch_examples)
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_writer.py", line 553, in write_batch
arrays.append(pa.array(typed_sequence))
File "pyarrow/array.pxi", line 236, in pyarrow.lib.array
File "pyarrow/array.pxi", line 110, in pyarrow.lib._handle_arrow_array_protocol
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_writer.py", line 223, in __arrow_array__
return pa.array(cast_to_python_objects(data, only_1d_for_numpy=True))
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/features/features.py", line 446, in cast_to_python_objects
return _cast_to_python_objects(
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/features/features.py", line 407, in _cast_to_python_objects
[
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/features/features.py", line 408, in <listcomp>
_cast_to_python_objects(
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/features/features.py", line 319, in _cast_to_python_objects
[
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/features/features.py", line 320, in <listcomp>
_cast_to_python_objects(
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/features/features.py", line 298, in _cast_to_python_objects
if obj.ndim == 0:
KeyboardInterrupt
```
</details>
| ### Describe the bug
Hi !
I'm currently working with a large (~150GB) unnormalized dataset at work.
The dataset is available on a read-only filesystem internally, and I use a [loading script](https://huggingface.co/docs/datasets/dataset_script) to retreive it.
I want to normalize the features of the dataset, meaning I need to compute the mean and standard deviation metric for each feature of the entire dataset. I cannot load the entire dataset to RAM as it is too big, so following [this discussion on the huggingface discourse](https://discuss.huggingface.co/t/copy-columns-in-a-dataset-and-compute-statistics-for-a-column/22157) I am using a [map operation](https://huggingface.co/docs/datasets/v2.14.0/en/package_reference/main_classes#datasets.Dataset.map) to first compute the metrics and a second map operation to apply them on the dataset.
The problem lies in the second mapping, as it gets stuck at ~99%. By checking what the process does (using `htop` and `strace`) it seems to be doing a lot of I/O operations, and I'm not sure why.
Obviously, I could always normalize the dataset externally and then load it using a loading script. However, since the internal dataset is updated fairly frequently, using the library to perform normalization automatically would make it much easier for me.
### Steps to reproduce the bug
I'm able to reproduce the problem using the following scripts:
```python
# random_data.py
import datasets
import torch
_VERSION = "1.0.0"
class RandomDataset(datasets.GeneratorBasedBuilder):
def _info(self):
return datasets.DatasetInfo(
version=_VERSION,
supervised_keys=None,
features=datasets.Features(
{
"positions": datasets.Array2D(
shape=(30000, 3),
dtype="float32",
),
"normals": datasets.Array2D(
shape=(30000, 3),
dtype="float32",
),
"features": datasets.Array2D(
shape=(30000, 6),
dtype="float32",
),
"scalars": datasets.Sequence(
feature=datasets.Value("float32"),
length=20,
),
},
),
)
def _split_generators(self, dl_manager):
return [
datasets.SplitGenerator(
name=datasets.Split.TRAIN, # type: ignore
gen_kwargs={"nb_samples": 1000},
),
datasets.SplitGenerator(
name=datasets.Split.TEST, # type: ignore
gen_kwargs={"nb_samples": 100},
),
]
def _generate_examples(self, nb_samples: int):
for idx in range(nb_samples):
yield idx, {
"positions": torch.randn(30000, 3),
"normals": torch.randn(30000, 3),
"features": torch.randn(30000, 6),
"scalars": torch.randn(20),
}
```
```python
# main.py
import datasets
import torch
def apply_mean_std(
dataset: datasets.Dataset,
means: dict[str, torch.Tensor],
stds: dict[str, torch.Tensor],
) -> dict[str, torch.Tensor]:
"""Normalize the dataset using the mean and standard deviation of each feature.
Args:
dataset (`Dataset`): A huggingface dataset.
mean (`dict[str, Tensor]`): A dictionary containing the mean of each feature.
std (`dict[str, Tensor]`): A dictionary containing the standard deviation of each feature.
Returns:
dict: A dictionary containing the normalized dataset.
"""
result = {}
for key in means.keys():
# extract data from dataset
data: torch.Tensor = dataset[key] # type: ignore
# extract mean and std from dict
mean = means[key] # type: ignore
std = stds[key] # type: ignore
# normalize data
normalized_data = (data - mean) / std
result[key] = normalized_data
return result
# get dataset
ds = datasets.load_dataset(
path="random_data.py",
split="train",
).with_format("torch")
# compute mean (along last axis)
means = {key: torch.zeros(ds[key][0].shape[-1]) for key in ds.column_names}
means_sq = {key: torch.zeros(ds[key][0].shape[-1]) for key in ds.column_names}
for batch in ds.iter(batch_size=8):
for key in ds.column_names:
data = batch[key]
batch_size = data.shape[0]
data = data.reshape(-1, data.shape[-1])
means[key] += data.mean(dim=0) / len(ds) * batch_size
means_sq[key] += (data**2).mean(dim=0) / len(ds) * batch_size
# compute std (along last axis)
stds = {key: torch.sqrt(means_sq[key] - means[key] ** 2) for key in ds.column_names}
# normalize each feature of the dataset
ds_normalized = ds.map(
desc="Applying mean/std", # type: ignore
function=apply_mean_std,
batched=False,
fn_kwargs={
"means": means,
"stds": stds,
},
)
```
### Expected behavior
Using the previous scripts, the `ds_normalized` mapping completes in ~5 minutes, but any subsequent use of `ds_normalized` is really really slow, for example reapplying `apply_mean_std` to `ds_normalized` takes forever. This is very strange, I'm sure I must be missing something, but I would still expect this to be faster.
### Environment info
- `datasets` version: 2.13.1
- Platform: Linux-3.10.0-1160.66.1.el7.x86_64-x86_64-with-glibc2.17
- Python version: 3.10.12
- Huggingface_hub version: 0.15.1
- PyArrow version: 12.0.0
- Pandas version: 2.0.2 | 13 | 1,454 | Mapping gets stuck at 99%
### Describe the bug
Hi !
I'm currently working with a large (~150GB) unnormalized dataset at work.
The dataset is available on a read-only filesystem internally, and I use a [loading script](https://huggingface.co/docs/datasets/dataset_script) to retreive it.
I want to normalize the features of the dataset, meaning I need to compute the mean and standard deviation metric for each feature of the entire dataset. I cannot load the entire dataset to RAM as it is too big, so following [this discussion on the huggingface discourse](https://discuss.huggingface.co/t/copy-columns-in-a-dataset-and-compute-statistics-for-a-column/22157) I am using a [map operation](https://huggingface.co/docs/datasets/v2.14.0/en/package_reference/main_classes#datasets.Dataset.map) to first compute the metrics and a second map operation to apply them on the dataset.
The problem lies in the second mapping, as it gets stuck at ~99%. By checking what the process does (using `htop` and `strace`) it seems to be doing a lot of I/O operations, and I'm not sure why.
Obviously, I could always normalize the dataset externally and then load it using a loading script. However, since the internal dataset is updated fairly frequently, using the library to perform normalization automatically would make it much easier for me.
### Steps to reproduce the bug
I'm able to reproduce the problem using the following scripts:
```python
# random_data.py
import datasets
import torch
_VERSION = "1.0.0"
class RandomDataset(datasets.GeneratorBasedBuilder):
def _info(self):
return datasets.DatasetInfo(
version=_VERSION,
supervised_keys=None,
features=datasets.Features(
{
"positions": datasets.Array2D(
shape=(30000, 3),
dtype="float32",
),
"normals": datasets.Array2D(
shape=(30000, 3),
dtype="float32",
),
"features": datasets.Array2D(
shape=(30000, 6),
dtype="float32",
),
"scalars": datasets.Sequence(
feature=datasets.Value("float32"),
length=20,
),
},
),
)
def _split_generators(self, dl_manager):
return [
datasets.SplitGenerator(
name=datasets.Split.TRAIN, # type: ignore
gen_kwargs={"nb_samples": 1000},
),
datasets.SplitGenerator(
name=datasets.Split.TEST, # type: ignore
gen_kwargs={"nb_samples": 100},
),
]
def _generate_examples(self, nb_samples: int):
for idx in range(nb_samples):
yield idx, {
"positions": torch.randn(30000, 3),
"normals": torch.randn(30000, 3),
"features": torch.randn(30000, 6),
"scalars": torch.randn(20),
}
```
```python
# main.py
import datasets
import torch
def apply_mean_std(
dataset: datasets.Dataset,
means: dict[str, torch.Tensor],
stds: dict[str, torch.Tensor],
) -> dict[str, torch.Tensor]:
"""Normalize the dataset using the mean and standard deviation of each feature.
Args:
dataset (`Dataset`): A huggingface dataset.
mean (`dict[str, Tensor]`): A dictionary containing the mean of each feature.
std (`dict[str, Tensor]`): A dictionary containing the standard deviation of each feature.
Returns:
dict: A dictionary containing the normalized dataset.
"""
result = {}
for key in means.keys():
# extract data from dataset
data: torch.Tensor = dataset[key] # type: ignore
# extract mean and std from dict
mean = means[key] # type: ignore
std = stds[key] # type: ignore
# normalize data
normalized_data = (data - mean) / std
result[key] = normalized_data
return result
# get dataset
ds = datasets.load_dataset(
path="random_data.py",
split="train",
).with_format("torch")
# compute mean (along last axis)
means = {key: torch.zeros(ds[key][0].shape[-1]) for key in ds.column_names}
means_sq = {key: torch.zeros(ds[key][0].shape[-1]) for key in ds.column_names}
for batch in ds.iter(batch_size=8):
for key in ds.column_names:
data = batch[key]
batch_size = data.shape[0]
data = data.reshape(-1, data.shape[-1])
means[key] += data.mean(dim=0) / len(ds) * batch_size
means_sq[key] += (data**2).mean(dim=0) / len(ds) * batch_size
# compute std (along last axis)
stds = {key: torch.sqrt(means_sq[key] - means[key] ** 2) for key in ds.column_names}
# normalize each feature of the dataset
ds_normalized = ds.map(
desc="Applying mean/std", # type: ignore
function=apply_mean_std,
batched=False,
fn_kwargs={
"means": means,
"stds": stds,
},
)
```
### Expected behavior
Using the previous scripts, the `ds_normalized` mapping completes in ~5 minutes, but any subsequent use of `ds_normalized` is really really slow, for example reapplying `apply_mean_std` to `ds_normalized` takes forever. This is very strange, I'm sure I must be missing something, but I would still expect this to be faster.
### Environment info
- `datasets` version: 2.13.1
- Platform: Linux-3.10.0-1160.66.1.el7.x86_64-x86_64-with-glibc2.17
- Python version: 3.10.12
- Huggingface_hub version: 0.15.1
- PyArrow version: 12.0.0
- Pandas version: 2.0.2
I think `batch_size/writer_batch_size` is already at its lowest in the 2nd `.map` since `batched=False` implies `batch_size=1` and `len(ds) = 1000 = writer_batch_size`.
Here is also a bunch of stack traces when I interrupted the process:
<details>
<summary>stack trace 1</summary>
```python
(pyg)[d623204@rosetta-bigviz01 stage-laurent-f]$ python src/random_scripts/uses_random_data.py
Found cached dataset random_data (/local_scratch/lfainsin/.cache/huggingface/datasets/random_data/default/0.0.0/444e214e1d0e6298cfd3f2368323ec37073dc1439f618e19395b1f421c69b066)
Applying mean/std: 97%|ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | 967/1000 [00:01<00:00, 534.87 examples/s]Traceback (most recent call last):
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_writer.py", line 179, in __arrow_array__
storage = to_pyarrow_listarray(data, pa_type)
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/features/features.py", line 1466, in to_pyarrow_listarray
return pa.array(data, pa_type.storage_dtype)
File "pyarrow/array.pxi", line 320, in pyarrow.lib.array
File "pyarrow/array.pxi", line 39, in pyarrow.lib._sequence_to_array
File "pyarrow/error.pxi", line 144, in pyarrow.lib.pyarrow_internal_check_status
File "pyarrow/error.pxi", line 123, in pyarrow.lib.check_status
pyarrow.lib.ArrowTypeError: Could not convert tensor([[-1.0273, -0.8037, -0.6860],
[-0.5034, -1.2685, -0.0558],
[-1.0908, -1.1820, -0.3178],
...,
[-0.8171, 0.1781, -0.5903],
[ 0.4370, 1.9305, 0.5899],
[-0.1426, 0.9053, -1.7559]]) with type Tensor: was not a sequence or recognized null for conversion to list type
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_dataset.py", line 3449, in _map_single
writer.write(example)
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_writer.py", line 490, in write
self.write_examples_on_file()
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_writer.py", line 448, in write_examples_on_file
self.write_batch(batch_examples=batch_examples)
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_writer.py", line 553, in write_batch
arrays.append(pa.array(typed_sequence))
File "pyarrow/array.pxi", line 236, in pyarrow.lib.array
File "pyarrow/array.pxi", line 110, in pyarrow.lib._handle_arrow_array_protocol
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_writer.py", line 223, in __arrow_array__
return pa.array(cast_to_python_objects(data, only_1d_for_numpy=True))
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/features/features.py", line 446, in cast_to_python_objects
return _cast_to_python_objects(
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/features/features.py", line 407, in _cast_to_python_objects
[
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/features/features.py", line 408, in <listcomp>
_cast_to_python_objects(
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/features/features.py", line 319, in _cast_to_python_objects
[
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/features/features.py", line 320, in <listcomp>
_cast_to_python_objects(
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/features/features.py", line 263, in _cast_to_python_objects
def _cast_to_python_objects(obj: Any, only_1d_for_numpy: bool, optimize_list_casting: bool) -> Tuple[Any, bool]:
KeyboardInterrupt
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_writer.py", line 179, in __arrow_array__
storage = to_pyarrow_listarray(data, pa_type)
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/features/features.py", line 1466, in to_pyarrow_listarray
return pa.array(data, pa_type.storage_dtype)
File "pyarrow/array.pxi", line 320, in pyarrow.lib.array
File "pyarrow/array.pxi", line 39, in pyarrow.lib._sequence_to_array
File "pyarrow/error.pxi", line 144, in pyarrow.lib.pyarrow_internal_check_status
File "pyarrow/error.pxi", line 123, in pyarrow.lib.check_status
pyarrow.lib.ArrowTypeError: Could not convert tensor([[-1.0273, -0.8037, -0.6860],
[-0.5034, -1.2685, -0.0558],
[-1.0908, -1.1820, -0.3178],
...,
[-0.8171, 0.1781, -0.5903],
[ 0.4370, 1.9305, 0.5899],
[-0.1426, 0.9053, -1.7559]]) with type Tensor: was not a sequence or recognized null for conversion to list type
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/gpfs_new/data/users/lfainsin/stage-laurent-f/src/random_scripts/uses_random_data.py", line 62, in <module>
ds_normalized = ds.map(
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_dataset.py", line 580, in wrapper
out: Union["Dataset", "DatasetDict"] = func(self, *args, **kwargs)
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_dataset.py", line 545, in wrapper
out: Union["Dataset", "DatasetDict"] = func(self, *args, **kwargs)
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_dataset.py", line 3087, in map
for rank, done, content in Dataset._map_single(**dataset_kwargs):
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_dataset.py", line 3492, in _map_single
writer.finalize()
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_writer.py", line 584, in finalize
self.write_examples_on_file()
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_writer.py", line 448, in write_examples_on_file
self.write_batch(batch_examples=batch_examples)
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_writer.py", line 553, in write_batch
arrays.append(pa.array(typed_sequence))
File "pyarrow/array.pxi", line 236, in pyarrow.lib.array
File "pyarrow/array.pxi", line 110, in pyarrow.lib._handle_arrow_array_protocol
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_writer.py", line 223, in __arrow_array__
return pa.array(cast_to_python_objects(data, only_1d_for_numpy=True))
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/features/features.py", line 446, in cast_to_python_objects
return _cast_to_python_objects(
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/features/features.py", line 407, in _cast_to_python_objects
[
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/features/features.py", line 408, in <listcomp>
_cast_to_python_objects(
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/features/features.py", line 319, in _cast_to_python_objects
[
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/features/features.py", line 319, in <listcomp>
[
KeyboardInterrupt
```
</details>
<details>
<summary>stack trace 2</summary>
```python
(pyg)[d623204@rosetta-bigviz01 stage-laurent-f]$ python src/random_scripts/uses_random_data.py
Found cached dataset random_data (/local_scratch/lfainsin/.cache/huggingface/datasets/random_data/default/0.0.0/444e214e1d0e6298cfd3f2368323ec37073dc1439f618e19395b1f421c69b066)
Applying mean/std: 99%|ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | 988/1000 [00:20<00:00, 526.19 examples/s]Applying mean/std: 100%|ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ| 999/1000 [00:21<00:00, 9.66 examples/s]Traceback (most recent call last):
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_writer.py", line 179, in __arrow_array__
storage = to_pyarrow_listarray(data, pa_type)
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/features/features.py", line 1466, in to_pyarrow_listarray
return pa.array(data, pa_type.storage_dtype)
File "pyarrow/array.pxi", line 320, in pyarrow.lib.array
File "pyarrow/array.pxi", line 39, in pyarrow.lib._sequence_to_array
File "pyarrow/error.pxi", line 144, in pyarrow.lib.pyarrow_internal_check_status
File "pyarrow/error.pxi", line 123, in pyarrow.lib.check_status
pyarrow.lib.ArrowTypeError: Could not convert tensor([[-1.0273, -0.8037, -0.6860],
[-0.5034, -1.2685, -0.0558],
[-1.0908, -1.1820, -0.3178],
...,
[-0.8171, 0.1781, -0.5903],
[ 0.4370, 1.9305, 0.5899],
[-0.1426, 0.9053, -1.7559]]) with type Tensor: was not a sequence or recognized null for conversion to list type
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_dataset.py", line 3449, in _map_single
writer.write(example)
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_writer.py", line 490, in write
self.write_examples_on_file()
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_writer.py", line 448, in write_examples_on_file
self.write_batch(batch_examples=batch_examples)
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_writer.py", line 553, in write_batch
arrays.append(pa.array(typed_sequence))
File "pyarrow/array.pxi", line 236, in pyarrow.lib.array
File "pyarrow/array.pxi", line 110, in pyarrow.lib._handle_arrow_array_protocol
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_writer.py", line 223, in __arrow_array__
return pa.array(cast_to_python_objects(data, only_1d_for_numpy=True))
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/features/features.py", line 446, in cast_to_python_objects
return _cast_to_python_objects(
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/features/features.py", line 407, in _cast_to_python_objects
[
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/features/features.py", line 408, in <listcomp>
_cast_to_python_objects(
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/features/features.py", line 319, in _cast_to_python_objects
[
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/features/features.py", line 320, in <listcomp>
_cast_to_python_objects(
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/features/features.py", line 263, in _cast_to_python_objects
def _cast_to_python_objects(obj: Any, only_1d_for_numpy: bool, optimize_list_casting: bool) -> Tuple[Any, bool]:
KeyboardInterrupt
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_writer.py", line 179, in __arrow_array__
storage = to_pyarrow_listarray(data, pa_type)
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/features/features.py", line 1466, in to_pyarrow_listarray
return pa.array(data, pa_type.storage_dtype)
File "pyarrow/array.pxi", line 320, in pyarrow.lib.array
File "pyarrow/array.pxi", line 39, in pyarrow.lib._sequence_to_array
File "pyarrow/error.pxi", line 144, in pyarrow.lib.pyarrow_internal_check_status
File "pyarrow/error.pxi", line 123, in pyarrow.lib.check_status
pyarrow.lib.ArrowTypeError: Could not convert tensor([[-1.0273, -0.8037, -0.6860],
[-0.5034, -1.2685, -0.0558],
[-1.0908, -1.1820, -0.3178],
...,
[-0.8171, 0.1781, -0.5903],
[ 0.4370, 1.9305, 0.5899],
[-0.1426, 0.9053, -1.7559]]) with type Tensor: was not a sequence or recognized null for conversion to list type
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/gpfs_new/data/users/lfainsin/stage-laurent-f/src/random_scripts/uses_random_data.py", line 62, in <module>
ds_normalized = ds.map(
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_dataset.py", line 580, in wrapper
out: Union["Dataset", "DatasetDict"] = func(self, *args, **kwargs)
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_dataset.py", line 545, in wrapper
out: Union["Dataset", "DatasetDict"] = func(self, *args, **kwargs)
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_dataset.py", line 3087, in map
for rank, done, content in Dataset._map_single(**dataset_kwargs):
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_dataset.py", line 3492, in _map_single
writer.finalize()
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_writer.py", line 584, in finalize
self.write_examples_on_file()
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_writer.py", line 448, in write_examples_on_file
self.write_batch(batch_examples=batch_examples)
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_writer.py", line 553, in write_batch
arrays.append(pa.array(typed_sequence))
File "pyarrow/array.pxi", line 236, in pyarrow.lib.array
File "pyarrow/array.pxi", line 110, in pyarrow.lib._handle_arrow_array_protocol
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_writer.py", line 223, in __arrow_array__
return pa.array(cast_to_python_objects(data, only_1d_for_numpy=True))
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/features/features.py", line 446, in cast_to_python_objects
return _cast_to_python_objects(
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/features/features.py", line 407, in _cast_to_python_objects
[
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/features/features.py", line 408, in <listcomp>
_cast_to_python_objects(
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/features/features.py", line 319, in _cast_to_python_objects
[
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/features/features.py", line 320, in <listcomp>
_cast_to_python_objects(
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/features/features.py", line 291, in _cast_to_python_objects
if config.JAX_AVAILABLE and "jax" in sys.modules:
KeyboardInterrupt
```
</details>
<details>
<summary>stack trace 3</summary>
```python
(pyg)[d623204@rosetta-bigviz01 stage-laurent-f]$ python src/random_scripts/uses_random_data.py
Found cached dataset random_data (/local_scratch/lfainsin/.cache/huggingface/datasets/random_data/default/0.0.0/444e214e1d0e6298cfd3f2368323ec37073dc1439f618e19395b1f421c69b066)
Applying mean/std: 99%|ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | 989/1000 [00:01<00:00, 504.80 examples/s]Traceback (most recent call last):
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_writer.py", line 179, in __arrow_array__
storage = to_pyarrow_listarray(data, pa_type)
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/features/features.py", line 1466, in to_pyarrow_listarray
return pa.array(data, pa_type.storage_dtype)
File "pyarrow/array.pxi", line 320, in pyarrow.lib.array
File "pyarrow/array.pxi", line 39, in pyarrow.lib._sequence_to_array
File "pyarrow/error.pxi", line 144, in pyarrow.lib.pyarrow_internal_check_status
File "pyarrow/error.pxi", line 123, in pyarrow.lib.check_status
pyarrow.lib.ArrowTypeError: Could not convert tensor([[-1.0273, -0.8037, -0.6860],
[-0.5034, -1.2685, -0.0558],
[-1.0908, -1.1820, -0.3178],
...,
[-0.8171, 0.1781, -0.5903],
[ 0.4370, 1.9305, 0.5899],
[-0.1426, 0.9053, -1.7559]]) with type Tensor: was not a sequence or recognized null for conversion to list type
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_dataset.py", line 3449, in _map_single
writer.write(example)
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_writer.py", line 490, in write
self.write_examples_on_file()
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_writer.py", line 448, in write_examples_on_file
self.write_batch(batch_examples=batch_examples)
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_writer.py", line 553, in write_batch
arrays.append(pa.array(typed_sequence))
File "pyarrow/array.pxi", line 236, in pyarrow.lib.array
File "pyarrow/array.pxi", line 110, in pyarrow.lib._handle_arrow_array_protocol
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_writer.py", line 223, in __arrow_array__
return pa.array(cast_to_python_objects(data, only_1d_for_numpy=True))
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/features/features.py", line 446, in cast_to_python_objects
return _cast_to_python_objects(
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/features/features.py", line 407, in _cast_to_python_objects
[
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/features/features.py", line 408, in <listcomp>
_cast_to_python_objects(
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/features/features.py", line 319, in _cast_to_python_objects
[
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/features/features.py", line 320, in <listcomp>
_cast_to_python_objects(
KeyboardInterrupt
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_writer.py", line 179, in __arrow_array__
storage = to_pyarrow_listarray(data, pa_type)
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/features/features.py", line 1466, in to_pyarrow_listarray
return pa.array(data, pa_type.storage_dtype)
File "pyarrow/array.pxi", line 320, in pyarrow.lib.array
File "pyarrow/array.pxi", line 39, in pyarrow.lib._sequence_to_array
File "pyarrow/error.pxi", line 144, in pyarrow.lib.pyarrow_internal_check_status
File "pyarrow/error.pxi", line 123, in pyarrow.lib.check_status
pyarrow.lib.ArrowTypeError: Could not convert tensor([[-1.0273, -0.8037, -0.6860],
[-0.5034, -1.2685, -0.0558],
[-1.0908, -1.1820, -0.3178],
...,
[-0.8171, 0.1781, -0.5903],
[ 0.4370, 1.9305, 0.5899],
[-0.1426, 0.9053, -1.7559]]) with type Tensor: was not a sequence or recognized null for conversion to list type
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/gpfs_new/data/users/lfainsin/stage-laurent-f/src/random_scripts/uses_random_data.py", line 62, in <module>
ds_normalized = ds.map(
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_dataset.py", line 580, in wrapper
out: Union["Dataset", "DatasetDict"] = func(self, *args, **kwargs)
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_dataset.py", line 545, in wrapper
out: Union["Dataset", "DatasetDict"] = func(self, *args, **kwargs)
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_dataset.py", line 3087, in map
for rank, done, content in Dataset._map_single(**dataset_kwargs):
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_dataset.py", line 3492, in _map_single
writer.finalize()
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_writer.py", line 584, in finalize
self.write_examples_on_file()
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_writer.py", line 448, in write_examples_on_file
self.write_batch(batch_examples=batch_examples)
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_writer.py", line 553, in write_batch
arrays.append(pa.array(typed_sequence))
File "pyarrow/array.pxi", line 236, in pyarrow.lib.array
File "pyarrow/array.pxi", line 110, in pyarrow.lib._handle_arrow_array_protocol
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_writer.py", line 223, in __arrow_array__
return pa.array(cast_to_python_objects(data, only_1d_for_numpy=True))
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/features/features.py", line 446, in cast_to_python_objects
return _cast_to_python_objects(
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/features/features.py", line 407, in _cast_to_python_objects
[
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/features/features.py", line 408, in <listcomp>
_cast_to_python_objects(
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/features/features.py", line 319, in _cast_to_python_objects
[
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/features/features.py", line 320, in <listcomp>
_cast_to_python_objects(
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/features/features.py", line 298, in _cast_to_python_objects
if obj.ndim == 0:
KeyboardInterrupt
```
</details>
| [
-1.2467619180679321,
-0.9692441821098328,
-0.7773353457450867,
1.3650438785552979,
-0.10279692709445953,
-1.2577497959136963,
0.0820453092455864,
-1.0771145820617676,
1.6699507236480713,
-0.7752376198768616,
0.2535783052444458,
-1.6741188764572144,
0.0001330627128481865,
-0.5192185044288635,
-0.7196358442306519,
-0.9292827248573303,
-0.42836281657218933,
-0.7693653106689453,
1.0682494640350342,
2.5319032669067383,
1.1663181781768799,
-1.3916829824447632,
2.7380056381225586,
0.6890181303024292,
-0.1308683305978775,
-1.0249642133712769,
0.5794615745544434,
0.014394155703485012,
-1.3597949743270874,
-0.39526140689849854,
-0.9713289737701416,
-0.01855153776705265,
-0.5624193549156189,
-0.4949333965778351,
0.034027427434921265,
0.36742085218429565,
-0.22762511670589447,
-0.4426629841327667,
-0.5897688269615173,
-0.7647039294242859,
0.46197813749313354,
-0.3146698772907257,
0.9942435622215271,
-0.3545180857181549,
1.8296427726745605,
-0.5085375308990479,
0.40375715494155884,
0.6671609878540039,
1.343123435974121,
0.2103288769721985,
0.05046398192644119,
0.32061967253685,
0.4087408781051636,
0.04270897060632706,
0.48136669397354126,
1.1971237659454346,
0.6055260896682739,
0.5078228116035461,
0.7211517691612244,
-2.174020767211914,
1.3422565460205078,
-0.9540314674377441,
0.3771088123321533,
1.3440388441085815,
-0.9014260768890381,
0.36384332180023193,
-1.7529940605163574,
-0.08630987256765366,
0.5511480569839478,
-2.256157875061035,
0.14137482643127441,
-1.2834725379943848,
-0.43197959661483765,
0.9795565009117126,
0.3522584140300751,
-1.2050758600234985,
0.18647566437721252,
-0.47631627321243286,
1.0739091634750366,
0.5062569975852966,
1.2354419231414795,
-1.7089179754257202,
0.033225126564502716,
-0.29483798146247864,
0.17447365820407867,
-1.2803961038589478,
-1.576486349105835,
0.5113226771354675,
0.6043962836265564,
0.6299614310264587,
-0.08441014587879181,
1.0067667961120605,
-1.0267763137817383,
0.7464110255241394,
-0.8652818202972412,
-1.6710386276245117,
-1.3861955404281616,
-2.301039934158325,
-2.3644816875457764,
0.8184136152267456,
-0.5005026459693909,
-0.5061028003692627,
2.0318002700805664,
-1.0828410387039185,
-1.790990948677063,
1.0765491724014282,
0.27483460307121277,
0.02147497981786728,
2.377331256866455,
0.162489116191864,
-0.7233153581619263,
0.49063411355018616,
-0.7345637083053589,
0.7893033027648926,
-0.3272707462310791,
1.3078820705413818,
0.4816489517688751,
-1.0030062198638916,
1.5656243562698364,
-0.40476158261299133,
0.5793794989585876,
-0.6556822061538696,
-0.4828268885612488,
-0.8300641775131226,
0.2967936098575592,
1.8910833597183228,
-0.3305094242095947,
1.6367286443710327,
-0.37281346321105957,
-1.6050193309783936,
-1.6232235431671143,
0.829276442527771,
0.5127225518226624,
-0.7676873207092285,
0.052157413214445114,
-0.3729911148548126,
0.06593628227710724,
0.03608138859272003,
1.1072019338607788,
1.202584981918335,
0.709801971912384,
-0.33022168278694153,
-0.8758439421653748,
0.1816616654396057,
-0.0807175561785698,
-0.6972082853317261,
-1.7582370042800903,
-0.3290409445762634,
0.12490931898355484,
0.620330274105072,
-1.1948826313018799,
1.7064586877822876,
0.8753851652145386,
1.8962076902389526,
1.0360573530197144,
-0.3524904251098633,
1.5238271951675415,
0.08224860578775406,
1.8405604362487793,
-0.49912044405937195,
0.6472380757331848,
-0.32927653193473816,
-1.170258641242981,
0.7816345691680908,
-0.3797627389431,
-2.0614588260650635,
-0.7647451758384705,
-0.8371453285217285,
-0.1527726650238037,
-0.7501168847084045,
0.951413094997406,
-0.34933069348335266,
-1.4247697591781616,
0.1697305142879486,
-0.6908698678016663,
0.10819616168737411,
-1.239892840385437,
0.2963680922985077,
0.7544494271278381,
-0.66166752576828,
-0.005780170671641827,
-0.29043665528297424,
-1.290385365486145,
-0.42731159925460815,
0.3055631220340729,
1.8546395301818848,
-0.7297377586364746,
0.9705548286437988,
1.0357428789138794,
-0.7008418440818787,
0.00022096093744039536,
0.29257071018218994,
-0.27541670203208923,
0.9122263789176941,
-1.0406187772750854,
-0.3938690721988678,
1.141351342201233,
-0.18762926757335663,
-0.6023191213607788,
1.405550479888916,
0.6929025650024414,
-1.041069746017456,
-0.212516650557518,
-0.083040252327919,
-0.8680865168571472,
0.000782831571996212,
-1.5526432991027832,
-0.14706754684448242,
0.30281320214271545,
-1.5828789472579956,
-0.509287416934967,
-0.22816458344459534,
1.2231131792068481,
-0.1552390158176422,
1.4142327308654785,
-0.365632563829422,
-0.19843073189258575,
-0.42432650923728943,
-0.4180070161819458,
0.17111988365650177,
-0.21451576054096222,
-0.6111334562301636,
0.2689812481403351,
-0.8629196882247925,
0.3410608172416687,
1.4479649066925049,
0.4027152955532074,
0.0833694264292717,
0.49972155690193176,
1.0811717510223389,
0.3805101811885834,
-0.08217080682516098,
-0.8663572669029236,
-1.5910987854003906,
2.05835223197937,
-1.4396908283233643,
1.9476808309555054,
0.7663041353225708,
-0.0760643482208252,
-1.8363510370254517,
-1.8936485052108765,
1.3488260507583618,
1.144186019897461,
2.37715744972229,
0.5074591040611267,
0.34930527210235596,
-0.783288836479187,
-0.6814500093460083,
0.34575241804122925,
-0.9749862551689148,
-0.7821716666221619,
0.10059787333011627,
2.326171875,
1.771716594696045,
-0.4542063772678375,
-0.22829017043113708,
-1.0167423486709595,
1.3656398057937622,
-0.201698437333107,
0.18882721662521362,
1.953131079673767,
-0.2971537113189697,
-1.0376105308532715,
1.3382163047790527,
-2.2815980911254883,
0.12969645857810974,
1.9696540832519531,
0.2699890732765198,
0.028413381427526474,
-1.4278004169464111,
-0.734067976474762,
-0.2700731158256531,
-0.46307164430618286,
-1.2981153726577759,
0.5094518661499023,
-0.30918145179748535,
-0.7922512888908386,
-1.4753799438476562,
0.08738581091165543,
-1.1354340314865112,
-1.708796501159668,
0.2509942948818207,
1.8835444450378418,
2.0085153579711914,
-0.7053989768028259,
1.4498223066329956,
-0.2546137869358063,
0.19014158844947815,
1.2200132608413696,
1.2179193496704102,
3.1545634269714355,
1.8570878505706787,
-1.273846983909607,
0.6684048771858215,
-0.1141929179430008,
-0.4647964835166931,
1.1711809635162354,
-1.1206079721450806,
1.273573637008667,
-0.18289639055728912,
-1.2553105354309082,
-1.2094475030899048,
1.0053393840789795,
0.45095232129096985,
0.0753774344921112,
-0.47078564763069153,
1.231424331665039,
-0.00803452730178833,
1.296268343925476,
0.5883960127830505,
-0.416258305311203,
0.6329759359359741,
-0.3883343040943146,
-0.5795652866363525,
1.5594953298568726,
0.13391847908496857,
-1.4948092699050903,
-2.2733843326568604,
-0.2512319087982178,
-0.8362984657287598,
0.061264362186193466,
-0.5851579904556274,
-1.0123529434204102,
1.6775928735733032,
0.4154697358608246,
-1.2488596439361572,
-0.26908570528030396,
-0.3993071913719177,
-0.6375272274017334,
2.6548166275024414,
-1.375285267829895,
-0.22833557426929474,
-0.9726972579956055,
-0.579551637172699,
1.555286169052124,
-1.1725170612335205,
-0.1947334259748459,
-0.9975393414497375,
-0.644557535648346,
-1.3117153644561768,
-0.5524806380271912,
-0.005474680569022894,
-0.9762184023857117,
0.7510079145431519,
0.09415651112794876,
-1.1093993186950684,
-0.21420562267303467,
-0.8925400376319885,
0.9263931512832642,
-0.11680498719215393,
0.23930753767490387,
1.9479926824569702,
0.3844825029373169,
-0.3727227449417114,
0.7020922303199768,
1.192228078842163,
0.6332438588142395,
-0.6933721899986267,
0.17940156161785126,
-0.7332433462142944,
0.2755816876888275,
-1.3079543113708496,
0.2640681564807892,
-2.8605823516845703,
0.6311547160148621,
-0.05276830494403839,
-0.058975230902433395,
0.035076286643743515,
-1.2897974252700806,
1.022388219833374,
2.627579689025879,
-1.2358187437057495,
0.4526868462562561,
0.35500675439834595,
1.1841776371002197,
-1.5929027795791626,
0.2859206199645996,
-0.45876768231391907,
2.0668561458587646,
0.2681424915790558,
1.188961148262024,
-0.4825421869754791,
-2.2171220779418945,
0.6156185865402222,
-1.2931641340255737,
-1.1424412727355957,
0.837589681148529,
-0.9084362387657166,
0.16509266197681427,
-1.4005670547485352,
-0.11599458009004593,
-0.7898463010787964,
-1.1691677570343018,
0.6727437376976013,
0.09872538596391678,
0.4813684821128845,
-0.5571417808532715,
0.3317040205001831,
-2.189272403717041,
-1.3392794132232666,
-0.22758139669895172,
-0.9479457139968872,
0.4868817627429962,
-0.3594978153705597,
0.6272926330566406,
-0.15944111347198486,
-0.00487998453900218,
0.32125017046928406,
1.3401402235031128,
3.422945022583008,
0.23287490010261536,
0.27114418148994446,
-0.09279090911149979,
-1.0096945762634277,
1.4944300651550293,
0.9546167850494385,
-0.16229791939258575,
-0.58292156457901,
-1.010434865951538,
1.332673192024231,
1.925355076789856,
1.103664755821228,
0.07600940763950348,
-0.8146185278892517,
-0.715214192867279,
0.030831746757030487,
0.20698682963848114,
0.4660505950450897,
0.943488359451294,
0.04124996066093445,
0.13615675270557404,
1.4841886758804321,
1.1912275552749634,
-0.3671254813671112,
0.3807029724121094,
-0.8676914572715759,
-0.5236761569976807,
0.501707136631012,
0.2918422520160675,
-0.006752285175025463,
0.44594258069992065,
-1.0455619096755981,
-0.24925671517848969,
-0.4486271142959595,
-0.973075807094574,
-0.6216679811477661,
-0.4124670624732971,
-0.3621116280555725,
1.637519359588623,
0.09520765393972397,
-0.5045101642608643,
-0.031103838235139847,
-0.7441604733467102,
-0.16319754719734192,
-1.0321203470230103,
0.3236604928970337,
-0.10514117777347565,
-0.09052335470914841,
-0.11579757183790207,
1.7546086311340332,
-0.9250495433807373,
-2.144601345062256,
0.2583377957344055,
0.22768360376358032,
-0.33503302931785583,
0.1973697543144226,
1.612885594367981,
0.5320526361465454,
1.4144856929779053,
1.3681854009628296,
0.9136322140693665,
-0.6243329644203186,
-1.2871012687683105,
0.6554571390151978,
1.0068215131759644,
-1.3799216747283936,
0.8822434544563293,
-0.08427087962627411,
-0.6085430979728699,
0.663037121295929,
1.2824103832244873,
0.43640318512916565,
-1.95796537399292,
0.8366286158561707,
-0.8730506300926208,
0.7851585745811462,
0.6522778868675232,
0.7634931206703186,
0.1387971043586731,
0.8068157434463501,
-1.300091028213501,
-1.1802146434783936,
-0.7512952089309692,
-0.633277952671051,
1.9603829383850098,
-0.2229035198688507,
0.6474459171295166,
-0.26533573865890503,
-1.2844253778457642,
-0.10628432780504227,
0.668134868144989,
0.2962866723537445,
-0.4588245749473572,
0.8894175291061401,
-0.6616579294204712,
-1.1329398155212402,
-1.4416307210922241,
-0.3858431279659271,
-1.0280656814575195,
-0.8643195033073425,
1.0733836889266968,
0.7522611021995544,
0.2900993227958679,
1.8616113662719727,
0.5906223058700562,
0.23343966901302338,
-2.6607463359832764,
0.8695493936538696,
0.2809373736381531,
-0.04380936548113823,
0.8599489331245422,
0.24945273995399475,
1.0215091705322266,
-0.005454744677990675,
0.5712770819664001,
-2.357414722442627,
2.238645315170288,
-0.22387544810771942,
0.7148292660713196,
-0.028256762772798538,
-0.18239955604076385,
1.1076127290725708,
0.5988099575042725,
0.6433889865875244,
-1.131514549255371,
0.7183264493942261,
-0.5575469732284546,
1.1952338218688965,
0.9183469414710999,
-0.8061854839324951,
-0.034427180886268616,
1.391994595527649,
0.5169562101364136,
-0.41163790225982666,
-0.9537155032157898,
-0.8884913325309753,
0.9732288122177124,
1.7941237688064575,
-0.017208373174071312,
0.0205356664955616,
0.8445966243743896,
0.7048121690750122,
-1.33951997756958,
0.05590561404824257,
-0.7149564623832703,
-0.6730610132217407,
1.6666510105133057,
2.0555827617645264,
-0.08342210203409195,
-0.16475918889045715,
-0.6779496669769287,
-1.2728368043899536,
0.7260436415672302,
-0.02408532053232193,
0.16788329184055328,
0.6857488751411438,
-0.6352343559265137,
1.1326508522033691,
0.8350221514701843,
0.9098381400108337,
0.16711068153381348,
0.25635331869125366,
0.38047876954078674,
-0.2753162086009979,
-1.1661970615386963,
-0.24308814108371735,
-1.0622906684875488,
-2.490513801574707,
0.39713799953460693,
-0.2678970992565155,
-1.4938024282455444,
0.0615595318377018,
-0.9970216751098633,
0.9434236884117126,
-0.5429925918579102,
-1.0938559770584106,
-1.5237315893173218,
0.2605784237384796,
-0.08075535297393799,
0.8848752379417419,
-1.5840823650360107,
-0.10325048863887787,
1.258912205696106,
0.9220340847969055,
-0.6065003275871277,
1.034543514251709,
0.25848492980003357,
0.9599147439002991,
0.8144968748092651,
-0.427222341299057,
0.4959949553012848,
0.13257567584514618,
-1.4068048000335693,
0.43835729360580444,
1.1329865455627441,
0.21448595821857452,
1.4070404767990112,
-0.5656892657279968,
0.05393088981509209,
0.4348471164703369,
-0.5174618363380432,
-0.4444368779659271,
-0.5237290263175964,
0.6564182043075562,
0.017516884952783585,
-0.9142799377441406,
-0.012896684929728508,
-0.014023944735527039,
-0.2493845522403717,
0.25133979320526123,
-1.4675674438476562,
-0.21480707824230194,
-0.4538046419620514,
-0.6116509437561035,
-1.2738367319107056,
-0.058122944086790085,
1.4391961097717285,
-0.8751161098480225,
-0.20370179414749146,
0.48616519570350647,
0.3364516496658325,
0.5443090200424194,
0.693285346031189,
-0.6777745485305786,
-0.2959807813167572,
-0.2361563742160797,
-0.3430134057998657,
0.2228562980890274,
1.2816890478134155,
-0.19853299856185913,
-0.963226854801178,
0.7401447296142578,
-0.330976665019989,
0.08073585480451584,
1.9571428298950195,
0.09340310841798782,
-0.7795586585998535,
0.28553229570388794,
-0.7227051258087158,
1.886473536491394,
1.7449703216552734,
1.4108755588531494,
-0.13359478116035461,
-0.8632180094718933,
0.5396673083305359,
-0.22204384207725525,
-0.3870353698730469,
0.968782365322113,
0.45092907547950745,
-0.14268913865089417,
-1.4336422681808472,
0.6162696480751038,
1.265200138092041,
-0.9080483317375183,
-0.7721258401870728,
0.0915364995598793,
-0.8525296449661255,
1.1124672889709473,
0.6831794381141663,
0.37242868542671204,
0.21695482730865479,
1.6378859281539917,
0.7516043782234192,
-0.4558798372745514,
0.5118764042854309,
0.5175111889839172,
-0.1697489470243454,
-2.1106138229370117,
-1.0412570238113403,
0.285397469997406,
-0.4316714107990265,
-1.575904130935669,
1.3548997640609741,
-1.1578586101531982,
-0.9238414168357849,
0.5306224226951599,
0.03838927671313286,
1.4312107563018799,
0.35462456941604614,
1.6312850713729858,
2.1382038593292236,
0.9121946096420288,
0.3359551429748535,
1.2678711414337158,
-0.054888613522052765,
-0.3838828206062317,
1.7917003631591797,
-0.38751456141471863,
0.5465928912162781,
1.0551667213439941,
-0.3655823767185211,
-1.0192077159881592,
-0.7280741333961487,
-1.2008825540542603,
-0.6306957006454468,
1.1408659219741821,
0.087174192070961,
-1.1189939975738525,
0.21593990921974182,
1.5484702587127686,
0.16591185331344604,
-0.25275304913520813,
0.6905345916748047,
0.46423640847206116,
-0.7505894303321838,
-0.09318429976701736,
-0.972011387348175,
0.5159144401550293,
-0.23220886290073395,
-0.3800661563873291,
0.3158402144908905,
0.43816208839416504,
1.280009150505066,
0.0043673086911439896,
0.16628558933734894,
1.2539658546447754,
-1.3642265796661377,
1.4609066247940063,
-0.704849123954773,
0.23544204235076904,
-2.4571473598480225,
1.4564132690429688,
-0.7929314970970154,
1.9027079343795776,
-2.627387285232544,
0.45968684554100037,
-0.6051923036575317,
-0.4301159679889679,
0.31800055503845215,
-0.4098037779331207,
0.0812394991517067,
-0.11631014943122864,
-1.098257064819336,
-0.08325605094432831,
-0.7290157675743103,
0.6102077960968018,
1.175999641418457,
1.3195080757141113,
-1.069354772567749,
-0.3195604979991913,
-1.7545759677886963,
-0.16033481061458588,
-0.7242748737335205,
0.3217547833919525,
-1.9534660577774048,
-0.16953818500041962,
-1.9060369729995728,
-2.5040366649627686,
-1.293465256690979,
-0.8021124601364136,
1.1435776948928833,
0.21453706920146942,
-0.9167917370796204,
1.2267842292785645,
-0.3773776888847351,
-1.8507046699523926,
1.1155215501785278,
-2.2504379749298096
] |
https://github.com/huggingface/datasets/issues/6075 | Error loading music files using `load_dataset` | This code behaves as expected on my local machine or in Colab. Which version of `soundfile` do you have installed? MP3 requires `soundfile>=0.12.1`. | ### Describe the bug
I tried to load a music file using `datasets.load_dataset()` from the repository - https://huggingface.co/datasets/susnato/pop2piano_real_music_test
I got the following error -
```
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/susnato/anaconda3/envs/p2p/lib/python3.9/site-packages/datasets/arrow_dataset.py", line 2803, in __getitem__
return self._getitem(key)
File "/home/susnato/anaconda3/envs/p2p/lib/python3.9/site-packages/datasets/arrow_dataset.py", line 2788, in _getitem
formatted_output = format_table(
File "/home/susnato/anaconda3/envs/p2p/lib/python3.9/site-packages/datasets/formatting/formatting.py", line 629, in format_table
return formatter(pa_table, query_type=query_type)
File "/home/susnato/anaconda3/envs/p2p/lib/python3.9/site-packages/datasets/formatting/formatting.py", line 398, in __call__
return self.format_column(pa_table)
File "/home/susnato/anaconda3/envs/p2p/lib/python3.9/site-packages/datasets/formatting/formatting.py", line 442, in format_column
column = self.python_features_decoder.decode_column(column, pa_table.column_names[0])
File "/home/susnato/anaconda3/envs/p2p/lib/python3.9/site-packages/datasets/formatting/formatting.py", line 218, in decode_column
return self.features.decode_column(column, column_name) if self.features else column
File "/home/susnato/anaconda3/envs/p2p/lib/python3.9/site-packages/datasets/features/features.py", line 1924, in decode_column
[decode_nested_example(self[column_name], value) if value is not None else None for value in column]
File "/home/susnato/anaconda3/envs/p2p/lib/python3.9/site-packages/datasets/features/features.py", line 1924, in <listcomp>
[decode_nested_example(self[column_name], value) if value is not None else None for value in column]
File "/home/susnato/anaconda3/envs/p2p/lib/python3.9/site-packages/datasets/features/features.py", line 1325, in decode_nested_example
return schema.decode_example(obj, token_per_repo_id=token_per_repo_id)
File "/home/susnato/anaconda3/envs/p2p/lib/python3.9/site-packages/datasets/features/audio.py", line 184, in decode_example
array, sampling_rate = sf.read(f)
File "/home/susnato/anaconda3/envs/p2p/lib/python3.9/site-packages/soundfile.py", line 372, in read
with SoundFile(file, 'r', samplerate, channels,
File "/home/susnato/anaconda3/envs/p2p/lib/python3.9/site-packages/soundfile.py", line 740, in __init__
self._file = self._open(file, mode_int, closefd)
File "/home/susnato/anaconda3/envs/p2p/lib/python3.9/site-packages/soundfile.py", line 1264, in _open
_error_check(_snd.sf_error(file_ptr),
File "/home/susnato/anaconda3/envs/p2p/lib/python3.9/site-packages/soundfile.py", line 1455, in _error_check
raise RuntimeError(prefix + _ffi.string(err_str).decode('utf-8', 'replace'))
RuntimeError: Error opening <_io.BufferedReader name='/home/susnato/.cache/huggingface/datasets/downloads/d2b09cb974b967b13f91553297c40c0f02f3c0d4c8356350743598ff48d6f29e'>: Format not recognised.
```
### Steps to reproduce the bug
Code to reproduce the error -
```python
from datasets import load_dataset
ds = load_dataset("susnato/pop2piano_real_music_test", split="test")
print(ds[0])
```
### Expected behavior
I should be able to read the music file without any error.
### Environment info
- `datasets` version: 2.14.0
- Platform: Linux-5.19.0-50-generic-x86_64-with-glibc2.35
- Python version: 3.9.16
- Huggingface_hub version: 0.15.1
- PyArrow version: 11.0.0
- Pandas version: 1.5.3
| 14 | 23 | Error loading music files using `load_dataset`
### Describe the bug
I tried to load a music file using `datasets.load_dataset()` from the repository - https://huggingface.co/datasets/susnato/pop2piano_real_music_test
I got the following error -
```
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/susnato/anaconda3/envs/p2p/lib/python3.9/site-packages/datasets/arrow_dataset.py", line 2803, in __getitem__
return self._getitem(key)
File "/home/susnato/anaconda3/envs/p2p/lib/python3.9/site-packages/datasets/arrow_dataset.py", line 2788, in _getitem
formatted_output = format_table(
File "/home/susnato/anaconda3/envs/p2p/lib/python3.9/site-packages/datasets/formatting/formatting.py", line 629, in format_table
return formatter(pa_table, query_type=query_type)
File "/home/susnato/anaconda3/envs/p2p/lib/python3.9/site-packages/datasets/formatting/formatting.py", line 398, in __call__
return self.format_column(pa_table)
File "/home/susnato/anaconda3/envs/p2p/lib/python3.9/site-packages/datasets/formatting/formatting.py", line 442, in format_column
column = self.python_features_decoder.decode_column(column, pa_table.column_names[0])
File "/home/susnato/anaconda3/envs/p2p/lib/python3.9/site-packages/datasets/formatting/formatting.py", line 218, in decode_column
return self.features.decode_column(column, column_name) if self.features else column
File "/home/susnato/anaconda3/envs/p2p/lib/python3.9/site-packages/datasets/features/features.py", line 1924, in decode_column
[decode_nested_example(self[column_name], value) if value is not None else None for value in column]
File "/home/susnato/anaconda3/envs/p2p/lib/python3.9/site-packages/datasets/features/features.py", line 1924, in <listcomp>
[decode_nested_example(self[column_name], value) if value is not None else None for value in column]
File "/home/susnato/anaconda3/envs/p2p/lib/python3.9/site-packages/datasets/features/features.py", line 1325, in decode_nested_example
return schema.decode_example(obj, token_per_repo_id=token_per_repo_id)
File "/home/susnato/anaconda3/envs/p2p/lib/python3.9/site-packages/datasets/features/audio.py", line 184, in decode_example
array, sampling_rate = sf.read(f)
File "/home/susnato/anaconda3/envs/p2p/lib/python3.9/site-packages/soundfile.py", line 372, in read
with SoundFile(file, 'r', samplerate, channels,
File "/home/susnato/anaconda3/envs/p2p/lib/python3.9/site-packages/soundfile.py", line 740, in __init__
self._file = self._open(file, mode_int, closefd)
File "/home/susnato/anaconda3/envs/p2p/lib/python3.9/site-packages/soundfile.py", line 1264, in _open
_error_check(_snd.sf_error(file_ptr),
File "/home/susnato/anaconda3/envs/p2p/lib/python3.9/site-packages/soundfile.py", line 1455, in _error_check
raise RuntimeError(prefix + _ffi.string(err_str).decode('utf-8', 'replace'))
RuntimeError: Error opening <_io.BufferedReader name='/home/susnato/.cache/huggingface/datasets/downloads/d2b09cb974b967b13f91553297c40c0f02f3c0d4c8356350743598ff48d6f29e'>: Format not recognised.
```
### Steps to reproduce the bug
Code to reproduce the error -
```python
from datasets import load_dataset
ds = load_dataset("susnato/pop2piano_real_music_test", split="test")
print(ds[0])
```
### Expected behavior
I should be able to read the music file without any error.
### Environment info
- `datasets` version: 2.14.0
- Platform: Linux-5.19.0-50-generic-x86_64-with-glibc2.35
- Python version: 3.9.16
- Huggingface_hub version: 0.15.1
- PyArrow version: 11.0.0
- Pandas version: 1.5.3
This code behaves as expected on my local machine or in Colab. Which version of `soundfile` do you have installed? MP3 requires `soundfile>=0.12.1`. | [
-1.2145147323608398,
-0.921959638595581,
-0.7346850633621216,
1.3431165218353271,
-0.05712354928255081,
-1.3600084781646729,
0.1440393477678299,
-1.0172046422958374,
1.5832189321517944,
-0.7139288187026978,
0.3244938552379608,
-1.6303914785385132,
-0.20887859165668488,
-0.43720120191574097,
-0.6327404379844666,
-0.969968855381012,
-0.3424742817878723,
-0.9954277276992798,
1.0009955167770386,
2.490220069885254,
1.4058873653411865,
-1.3310019969940186,
2.8550961017608643,
0.7156549096107483,
-0.3705293536186218,
-0.9465077519416809,
0.5035046935081482,
-0.035874057561159134,
-1.2148834466934204,
-0.5056405663490295,
-0.89205402135849,
0.007805067114531994,
-0.5706169009208679,
-0.3861691355705261,
0.09114023298025131,
0.503330647945404,
-0.3580648601055145,
-0.2530647814273834,
-0.6725223064422607,
-0.6896653771400452,
0.5623816847801208,
-0.27816376090049744,
0.9725621342658997,
-0.3517945110797882,
1.796011209487915,
-0.6089794635772705,
0.3213869035243988,
0.7298578023910522,
1.2293144464492798,
0.09232794493436813,
0.09796445816755295,
0.27282312512397766,
0.2717312276363373,
-0.0029225866310298443,
0.6049818992614746,
1.33393132686615,
0.5586262345314026,
0.5356009006500244,
0.7269602417945862,
-2.1949915885925293,
1.3558303117752075,
-0.8507000207901001,
0.28394144773483276,
1.2862223386764526,
-0.8181114792823792,
0.3374667167663574,
-1.8206592798233032,
-0.105279341340065,
0.627677321434021,
-2.2929837703704834,
0.2638455927371979,
-1.3079279661178589,
-0.546456515789032,
0.870348334312439,
0.3208597004413605,
-1.2204411029815674,
0.20656660199165344,
-0.546284019947052,
1.1120250225067139,
0.5421657562255859,
1.1146620512008667,
-1.6598701477050781,
0.026904065161943436,
-0.17105695605278015,
0.0781191736459732,
-1.23814857006073,
-1.7330660820007324,
0.6389747262001038,
0.44888201355934143,
0.8145563006401062,
-0.05502172186970711,
1.0475430488586426,
-1.0894949436187744,
0.8686932921409607,
-0.9122940897941589,
-1.5084235668182373,
-1.4134981632232666,
-2.4779927730560303,
-2.307069778442383,
0.8327377438545227,
-0.6168121099472046,
-0.4463346600532532,
2.0566213130950928,
-1.0835001468658447,
-1.7059568166732788,
0.977760910987854,
0.36791691184043884,
0.08645197004079819,
2.3095412254333496,
0.26181551814079285,
-0.7966814637184143,
0.44230371713638306,
-0.6685513854026794,
0.855521559715271,
-0.26666784286499023,
1.1755378246307373,
0.5323469042778015,
-0.97586590051651,
1.5979605913162231,
-0.5394272208213806,
0.6207029223442078,
-0.6124140620231628,
-0.5583518147468567,
-0.8629139065742493,
0.18555770814418793,
1.816785216331482,
-0.39821523427963257,
1.5948176383972168,
-0.3190654218196869,
-1.5406016111373901,
-1.5711421966552734,
0.7781834006309509,
0.4721951186656952,
-0.9928323030471802,
0.10346928238868713,
-0.6015675067901611,
0.1748298853635788,
0.024428173899650574,
1.1696735620498657,
1.1825969219207764,
0.695167601108551,
-0.3005025088787079,
-0.8372092843055725,
0.18810896575450897,
-0.1258593499660492,
-0.6460768580436707,
-1.7976635694503784,
-0.34824511408805847,
0.3065263330936432,
0.568640410900116,
-1.2196449041366577,
1.8278239965438843,
0.9120377898216248,
2.0794126987457275,
0.961685299873352,
-0.36785462498664856,
1.5549567937850952,
-0.04436120018362999,
1.8705823421478271,
-0.513343095779419,
0.5350397825241089,
-0.3289232850074768,
-1.1681569814682007,
0.9236301183700562,
-0.3758063018321991,
-2.016339063644409,
-0.8220016360282898,
-0.7086606025695801,
-0.20634058117866516,
-0.6860538125038147,
0.8411805033683777,
-0.3728550672531128,
-1.484786868095398,
0.028148822486400604,
-0.6954106688499451,
0.08651610463857651,
-1.2619905471801758,
0.18506860733032227,
0.7332507371902466,
-0.752224862575531,
-0.07785330712795258,
-0.2975698709487915,
-1.2699979543685913,
-0.43075308203697205,
0.363254189491272,
2.0114359855651855,
-0.5138764977455139,
0.9853573441505432,
0.9975060820579529,
-0.7042824029922485,
0.1973615288734436,
0.1540614515542984,
-0.38105830550193787,
0.7563339471817017,
-1.167134165763855,
-0.3795868754386902,
1.0956906080245972,
-0.21230725944042206,
-0.8060353994369507,
1.3210575580596924,
0.746856153011322,
-1.1430915594100952,
-0.2951295077800751,
-0.227019801735878,
-0.8924160003662109,
0.0008233757689595222,
-1.466294288635254,
-0.15745307505130768,
0.387681782245636,
-1.3974589109420776,
-0.3661961555480957,
-0.12479360401630402,
1.3912317752838135,
-0.20702597498893738,
1.4250317811965942,
-0.3378247320652008,
-0.15179188549518585,
-0.27921342849731445,
-0.488016277551651,
0.20704372227191925,
-0.14632683992385864,
-0.5923090577125549,
0.14371921122074127,
-0.8427867293357849,
0.20427629351615906,
1.5279289484024048,
0.34055715799331665,
0.12319937348365784,
0.4512006938457489,
1.1333658695220947,
0.3767068088054657,
-0.039191894233226776,
-0.8224508762359619,
-1.5562629699707031,
2.054365396499634,
-1.4121479988098145,
1.8833714723587036,
0.8057979345321655,
-0.06577843427658081,
-1.886149287223816,
-1.8592407703399658,
1.171419382095337,
1.1321381330490112,
2.296391725540161,
0.44315168261528015,
0.4265795052051544,
-0.7191435098648071,
-0.7959985733032227,
0.39737871289253235,
-0.9585680365562439,
-0.6052438020706177,
0.1415465772151947,
2.3186113834381104,
1.8386914730072021,
-0.6157079935073853,
-0.3228875994682312,
-0.789150059223175,
1.2763696908950806,
-0.3040889501571655,
0.247960165143013,
2.0189123153686523,
-0.36623460054397583,
-0.9091060757637024,
1.318624496459961,
-2.3961448669433594,
0.29555192589759827,
2.094651699066162,
0.2623575031757355,
0.17572742700576782,
-1.393140435218811,
-0.6698916554450989,
-0.2538515627384186,
-0.5388578176498413,
-1.281889796257019,
0.5163068771362305,
-0.33192938566207886,
-0.8989444375038147,
-1.3582688570022583,
0.006727687083184719,
-1.1926562786102295,
-1.8301830291748047,
0.352275550365448,
1.9469738006591797,
2.092149019241333,
-0.8464356064796448,
1.3579164743423462,
-0.25722673535346985,
-0.04522165283560753,
1.2679201364517212,
1.4183717966079712,
3.0658531188964844,
1.827789068222046,
-1.2817341089248657,
0.7400371432304382,
-0.19758301973342896,
-0.5149325132369995,
1.1330556869506836,
-1.1278998851776123,
1.042427659034729,
-0.17927417159080505,
-1.2801105976104736,
-1.209519386291504,
1.099568247795105,
0.5185332894325256,
-0.004876992199569941,
-0.49824315309524536,
1.4147135019302368,
0.09155670553445816,
1.3265259265899658,
0.6234763264656067,
-0.5440129041671753,
0.513374388217926,
-0.31405723094940186,
-0.6230823397636414,
1.632534384727478,
0.14964251220226288,
-1.5144575834274292,
-2.3314223289489746,
-0.23244808614253998,
-0.9239729642868042,
-0.09940881282091141,
-0.5905365347862244,
-1.0241323709487915,
1.5813696384429932,
0.4291702210903168,
-1.1378804445266724,
-0.2944768965244293,
-0.2895483076572418,
-0.4268748462200165,
2.569439172744751,
-1.2083693742752075,
-0.056473441421985626,
-0.9659532904624939,
-0.42972850799560547,
1.6739466190338135,
-1.2329185009002686,
-0.2567223906517029,
-1.0770390033721924,
-0.6882426738739014,
-1.2884868383407593,
-0.48348671197891235,
0.013915701769292355,
-0.9717223048210144,
0.7014437913894653,
0.14410442113876343,
-1.1260249614715576,
-0.15898700058460236,
-0.917896032333374,
1.1446421146392822,
-0.09643884003162384,
0.24622131884098053,
1.8623422384262085,
0.2778499126434326,
-0.49969586730003357,
0.7773320078849792,
1.2721048593521118,
0.6256400346755981,
-0.6432856917381287,
0.02183520793914795,
-0.6656873226165771,
0.37281185388565063,
-1.4146909713745117,
0.169731006026268,
-3.017423629760742,
0.7965601086616516,
-0.23017296195030212,
-0.13034334778785706,
-0.08347589522600174,
-1.3260815143585205,
1.0270041227340698,
2.56097412109375,
-1.159122109413147,
0.5073560476303101,
0.4671609103679657,
1.0971896648406982,
-1.6581366062164307,
0.285188764333725,
-0.5684064030647278,
2.043454170227051,
0.1870463639497757,
1.2883859872817993,
-0.49752306938171387,
-2.1800594329833984,
0.6065579056739807,
-1.2126643657684326,
-0.9842512607574463,
0.881281852722168,
-0.9974197149276733,
0.33368054032325745,
-1.4707398414611816,
-0.16904807090759277,
-0.9799301624298096,
-1.2612366676330566,
0.7613754272460938,
0.172255739569664,
0.3838741183280945,
-0.5459274649620056,
0.32521888613700867,
-2.1221725940704346,
-1.4122363328933716,
-0.13011246919631958,
-1.0226222276687622,
0.6585782766342163,
-0.38952091336250305,
0.57924884557724,
-0.0019321423023939133,
0.17826884984970093,
0.3261794447898865,
1.4366602897644043,
3.3780057430267334,
0.06893961131572723,
0.10695406049489975,
-0.150472953915596,
-1.0327517986297607,
1.4803853034973145,
0.9067715406417847,
-0.19432246685028076,
-0.6006911396980286,
-1.0360634326934814,
1.3862600326538086,
2.063452959060669,
1.188689112663269,
0.14577026665210724,
-0.911616861820221,
-0.78999263048172,
0.014363766647875309,
0.21523509919643402,
0.5000596046447754,
1.0006670951843262,
0.02290404960513115,
0.0865960568189621,
1.409269094467163,
1.0932550430297852,
-0.24636763334274292,
0.464597225189209,
-0.9900349378585815,
-0.3762480318546295,
0.35191190242767334,
0.16715748608112335,
0.1306619942188263,
0.5633628964424133,
-1.0441200733184814,
-0.3471543788909912,
-0.3069419264793396,
-0.79039067029953,
-0.8010618090629578,
-0.33620405197143555,
-0.44777795672416687,
1.6038113832473755,
0.09160059690475464,
-0.5274823307991028,
0.13847382366657257,
-0.6251826286315918,
-0.1575097143650055,
-1.1204863786697388,
0.15176911652088165,
-0.11321981251239777,
-0.07859660685062408,
-0.1544024795293808,
1.4923347234725952,
-0.9435173869132996,
-2.1884963512420654,
0.13894805312156677,
0.3224537670612335,
-0.2359246462583542,
0.12264849245548248,
1.7131365537643433,
0.5117936730384827,
1.3511584997177124,
1.2372910976409912,
0.9554535746574402,
-0.6400846838951111,
-1.1608519554138184,
0.7497720122337341,
0.9563322067260742,
-1.3203552961349487,
0.9632894992828369,
-0.24493518471717834,
-0.5481536984443665,
0.6954510807991028,
1.2823792695999146,
0.4154978096485138,
-2.0671889781951904,
1.0560280084609985,
-0.9468616247177124,
0.7961621284484863,
0.6636858582496643,
0.8258364200592041,
0.25887331366539,
0.9367914795875549,
-1.2797490358352661,
-1.2068367004394531,
-0.6738147139549255,
-0.6579263210296631,
1.8947110176086426,
-0.24469581246376038,
0.5609796047210693,
-0.16946162283420563,
-1.1537457704544067,
-0.1294492930173874,
0.7867245078086853,
0.32607847452163696,
-0.35668760538101196,
0.9721401333808899,
-0.6675860285758972,
-0.9043540954589844,
-1.3063334226608276,
-0.3409479856491089,
-1.0819281339645386,
-0.8706120848655701,
0.982577383518219,
0.7503696084022522,
0.49736374616622925,
1.9213751554489136,
0.5597691535949707,
0.40324631333351135,
-2.64178204536438,
0.8790004253387451,
0.27909159660339355,
-0.005346215795725584,
0.9282863140106201,
0.24712936580181122,
1.29349684715271,
-0.017239734530448914,
0.6337547302246094,
-2.3051717281341553,
2.1839120388031006,
-0.1458393633365631,
0.6211430430412292,
0.005243908613920212,
-0.27080801129341125,
1.082553744316101,
0.556845486164093,
0.5854734182357788,
-1.1405562162399292,
0.7326475381851196,
-0.5101027488708496,
1.0248007774353027,
0.9648407697677612,
-0.9778624176979065,
0.11924906075000763,
1.483449101448059,
0.47601449489593506,
-0.3987967371940613,
-1.0287504196166992,
-0.8374674320220947,
0.963699460029602,
1.668190360069275,
-0.04368089511990547,
0.007390930317342281,
0.7923048138618469,
0.646637499332428,
-1.1851660013198853,
0.09985589236021042,
-0.6561388373374939,
-0.7081656455993652,
1.7728796005249023,
2.0507943630218506,
-0.14709466695785522,
-0.14611762762069702,
-0.7255953550338745,
-1.2818553447723389,
0.7670121788978577,
-0.1754862368106842,
0.0051169851794838905,
0.6833639144897461,
-0.7384729385375977,
1.1037321090698242,
0.48713070154190063,
1.047559142112732,
-0.059054698795080185,
0.3390491008758545,
0.3545387089252472,
-0.39162832498550415,
-1.136765956878662,
-0.38236674666404724,
-1.0432981252670288,
-2.581385374069214,
0.3449607491493225,
-0.2851550579071045,
-1.4823498725891113,
0.054164640605449677,
-1.0155720710754395,
0.8869288563728333,
-0.6307979226112366,
-1.0960016250610352,
-1.364357829093933,
0.3797685503959656,
-0.13666193187236786,
0.911247968673706,
-1.6522750854492188,
-0.2246333807706833,
1.2877302169799805,
0.8790947198867798,
-0.5747159123420715,
0.9539943933486938,
0.24178530275821686,
0.869515061378479,
0.72572922706604,
-0.3953823149204254,
0.6366352438926697,
-0.006568909622728825,
-1.3780003786087036,
0.3889768719673157,
1.2723472118377686,
0.1439146101474762,
1.4242876768112183,
-0.37244969606399536,
0.1694803386926651,
0.5272530913352966,
-0.6839239597320557,
-0.51121985912323,
-0.30623507499694824,
0.7231888771057129,
0.030565813183784485,
-1.1209200620651245,
-0.2292710393667221,
-0.20175234973430634,
-0.37008801102638245,
0.18604671955108643,
-1.4671508073806763,
-0.3622679114341736,
-0.4235658645629883,
-0.4501519203186035,
-1.4079854488372803,
0.07996895909309387,
1.243454098701477,
-0.7618690133094788,
-0.2196565717458725,
0.4422876834869385,
0.4143645763397217,
0.5663611888885498,
0.5263698697090149,
-0.7854828238487244,
-0.20011074841022491,
-0.42547231912612915,
-0.2578570544719696,
0.24153529107570648,
1.1297470331192017,
-0.0169980525970459,
-1.013205647468567,
0.6535971164703369,
-0.32749518752098083,
0.20751777291297913,
2.0182831287384033,
0.045996177941560745,
-0.6775145530700684,
0.354955792427063,
-0.7072144746780396,
1.640126347541809,
1.7162055969238281,
1.2474720478057861,
-0.08157310634851456,
-0.7732272148132324,
0.530842661857605,
-0.3515503406524658,
-0.2646885812282562,
0.9469072818756104,
0.38173648715019226,
-0.23361657559871674,
-1.4578697681427002,
0.6966748833656311,
1.2724823951721191,
-0.7546454668045044,
-0.717293918132782,
0.04699771851301193,
-0.9446155428886414,
1.235607385635376,
0.5654378533363342,
0.31670302152633667,
0.2561522126197815,
1.4523484706878662,
0.7704967856407166,
-0.47902020812034607,
0.4739415645599365,
0.5403720736503601,
-0.20380540192127228,
-2.103806495666504,
-0.8980244398117065,
0.31977200508117676,
-0.3094438910484314,
-1.5951942205429077,
1.360066533088684,
-1.1258511543273926,
-1.103606939315796,
0.5355380773544312,
0.089043989777565,
1.2029906511306763,
0.3016849160194397,
1.7305959463119507,
2.172203302383423,
0.8262205123901367,
0.3485623002052307,
1.2057874202728271,
-0.04413365200161934,
-0.41267746686935425,
1.777813196182251,
-0.34887364506721497,
0.5389361381530762,
0.9206646084785461,
-0.42998453974723816,
-1.1073893308639526,
-0.8193817734718323,
-1.1687092781066895,
-0.6149203777313232,
1.1501755714416504,
0.08936281502246857,
-1.0044082403182983,
0.1948011815547943,
1.5880377292633057,
0.1453636884689331,
-0.18210431933403015,
0.7142391800880432,
0.45890992879867554,
-0.6761150360107422,
-0.10745076090097427,
-0.8852459788322449,
0.5343282222747803,
-0.09013672173023224,
-0.27749618887901306,
0.27420714497566223,
0.5800495147705078,
1.3117610216140747,
-0.09940171241760254,
0.11605577170848846,
1.1515175104141235,
-1.3301907777786255,
1.5087846517562866,
-0.6150996685028076,
0.3022671341896057,
-2.469545364379883,
1.3968123197555542,
-0.7785011529922485,
1.9963983297348022,
-2.4206418991088867,
0.42703166604042053,
-0.48726990818977356,
-0.475525438785553,
0.3096170127391815,
-0.3779629170894623,
0.07830861210823059,
-0.12785962224006653,
-0.8204134106636047,
0.009931008331477642,
-0.7474716901779175,
0.6366202235221863,
1.191378116607666,
1.381856083869934,
-1.1063071489334106,
-0.21332252025604248,
-1.6504058837890625,
-0.12765508890151978,
-0.829732358455658,
0.31930088996887207,
-2.005704402923584,
-0.15852364897727966,
-2.0713491439819336,
-2.4521450996398926,
-1.3266849517822266,
-0.8478113412857056,
1.100669264793396,
0.21990637481212616,
-0.9384037852287292,
1.2335909605026245,
-0.31964218616485596,
-1.789880394935608,
1.0974891185760498,
-2.162496566772461
] |
https://github.com/huggingface/datasets/issues/6073 | version2.3.2 load_dataset()data_files can't include .xxxx in path | Version 2.3.2 is over one year old, so please use the latest release (2.14.0) to get the expected behavior. Version 2.3.2 does not contain some fixes we made to fix resolving hidden files/directories (starting with a dot). | ### Describe the bug
First, I cd workdir.
Then, I just use load_dataset("json", data_file={"train":"/a/b/c/.d/train/train.json", "test":"/a/b/c/.d/train/test.json"})
that couldn't work and
<FileNotFoundError: Unable to find
'/a/b/c/.d/train/train.jsonl' at
/a/b/c/.d/>
And I debug, it is fine in version2.1.2
So there maybe a bug in path join.
Here is the whole bug report:
/x/datasets/loa β
β d.py:1656 in load_dataset β
β β
β 1653 β ignore_verifications = ignore_verifications or save_infos β
β 1654 β β
β 1655 β # Create a dataset builder β
β β± 1656 β builder_instance = load_dataset_builder( β
β 1657 β β path=path, β
β 1658 β β name=name, β
β 1659 β β data_dir=data_dir, β
β β
β x/datasets/loa β
β d.py:1439 in load_dataset_builder β
β β
β 1436 β if use_auth_token is not None: β
β 1437 β β download_config = download_config.copy() if download_config e β
β 1438 β β download_config.use_auth_token = use_auth_token β
β β± 1439 β dataset_module = dataset_module_factory( β
β 1440 β β path, β
β 1441 β β revision=revision, β
β 1442 β β download_config=download_config, β
β β
β x/datasets/loa β
β d.py:1097 in dataset_module_factory β
β β
β 1094 β β
β 1095 β # Try packaged β
β 1096 β if path in _PACKAGED_DATASETS_MODULES: β
β β± 1097 β β return PackagedDatasetModuleFactory( β
β 1098 β β β path, β
β 1099 β β β data_dir=data_dir, β
β 1100 β β β data_files=data_files, β
β β
βx/datasets/loa β
β d.py:743 in get_module β
β β
β 740 β β β if self.data_dir is not None β
β 741 β β β else get_patterns_locally(str(Path().resolve())) β
β 742 β β ) β
β β± 743 β β data_files = DataFilesDict.from_local_or_remote( β
β 744 β β β patterns, β
β 745 β β β use_auth_token=self.download_config.use_auth_token, β
β 746 β β β base_path=str(Path(self.data_dir).resolve()) if self.data β
β β
β x/datasets/dat β
β a_files.py:590 in from_local_or_remote β
β β
β 587 β β out = cls() β
β 588 β β for key, patterns_for_key in patterns.items(): β
β 589 β β β out[key] = ( β
β β± 590 β β β β DataFilesList.from_local_or_remote( β
β 591 β β β β β patterns_for_key, β
β 592 β β β β β base_path=base_path, β
β 593 β β β β β allowed_extensions=allowed_extensions, β
β β
β /x/datasets/dat β
β a_files.py:558 in from_local_or_remote β
β β
β 555 β β use_auth_token: Optional[Union[bool, str]] = None, β
β 556 β ) -> "DataFilesList": β
β 557 β β base_path = base_path if base_path is not None else str(Path() β
β β± 558 β β data_files = resolve_patterns_locally_or_by_urls(base_path, pa β
β 559 β β origin_metadata = _get_origin_metadata_locally_or_by_urls(data β
β 560 β β return cls(data_files, origin_metadata) β
β 561 β
β β
β /x/datasets/dat β
β a_files.py:195 in resolve_patterns_locally_or_by_urls β
β β
β 192 β β if is_remote_url(pattern): β
β 193 β β β data_files.append(Url(pattern)) β
β 194 β β else: β
β β± 195 β β β for path in _resolve_single_pattern_locally(base_path, pat β
β 196 β β β β data_files.append(path) β
β 197 β β
β 198 β if not data_files: β
β β
β /x/datasets/dat β
β a_files.py:145 in _resolve_single_pattern_locally β
β β
β 142 β β error_msg = f"Unable to find '{pattern}' at {Path(base_path).r β
β 143 β β if allowed_extensions is not None: β
β 144 β β β error_msg += f" with any supported extension {list(allowed β
β β± 145 β β raise FileNotFoundError(error_msg) β
β 146 β return sorted(out) β
β 147
### Steps to reproduce the bug
1. Version=2.3.2
2. In shell, cd workdir.(cd /a/b/c/.d/)
3. load_dataset("json", data_file={"train":"/a/b/c/.d/train/train.json", "test":"/a/b/c/.d/train/test.json"})
### Expected behavior
fix it please~
### Environment info
2.3.2 | 15 | 37 | version2.3.2 load_dataset()data_files can't include .xxxx in path
### Describe the bug
First, I cd workdir.
Then, I just use load_dataset("json", data_file={"train":"/a/b/c/.d/train/train.json", "test":"/a/b/c/.d/train/test.json"})
that couldn't work and
<FileNotFoundError: Unable to find
'/a/b/c/.d/train/train.jsonl' at
/a/b/c/.d/>
And I debug, it is fine in version2.1.2
So there maybe a bug in path join.
Here is the whole bug report:
/x/datasets/loa β
β d.py:1656 in load_dataset β
β β
β 1653 β ignore_verifications = ignore_verifications or save_infos β
β 1654 β β
β 1655 β # Create a dataset builder β
β β± 1656 β builder_instance = load_dataset_builder( β
β 1657 β β path=path, β
β 1658 β β name=name, β
β 1659 β β data_dir=data_dir, β
β β
β x/datasets/loa β
β d.py:1439 in load_dataset_builder β
β β
β 1436 β if use_auth_token is not None: β
β 1437 β β download_config = download_config.copy() if download_config e β
β 1438 β β download_config.use_auth_token = use_auth_token β
β β± 1439 β dataset_module = dataset_module_factory( β
β 1440 β β path, β
β 1441 β β revision=revision, β
β 1442 β β download_config=download_config, β
β β
β x/datasets/loa β
β d.py:1097 in dataset_module_factory β
β β
β 1094 β β
β 1095 β # Try packaged β
β 1096 β if path in _PACKAGED_DATASETS_MODULES: β
β β± 1097 β β return PackagedDatasetModuleFactory( β
β 1098 β β β path, β
β 1099 β β β data_dir=data_dir, β
β 1100 β β β data_files=data_files, β
β β
βx/datasets/loa β
β d.py:743 in get_module β
β β
β 740 β β β if self.data_dir is not None β
β 741 β β β else get_patterns_locally(str(Path().resolve())) β
β 742 β β ) β
β β± 743 β β data_files = DataFilesDict.from_local_or_remote( β
β 744 β β β patterns, β
β 745 β β β use_auth_token=self.download_config.use_auth_token, β
β 746 β β β base_path=str(Path(self.data_dir).resolve()) if self.data β
β β
β x/datasets/dat β
β a_files.py:590 in from_local_or_remote β
β β
β 587 β β out = cls() β
β 588 β β for key, patterns_for_key in patterns.items(): β
β 589 β β β out[key] = ( β
β β± 590 β β β β DataFilesList.from_local_or_remote( β
β 591 β β β β β patterns_for_key, β
β 592 β β β β β base_path=base_path, β
β 593 β β β β β allowed_extensions=allowed_extensions, β
β β
β /x/datasets/dat β
β a_files.py:558 in from_local_or_remote β
β β
β 555 β β use_auth_token: Optional[Union[bool, str]] = None, β
β 556 β ) -> "DataFilesList": β
β 557 β β base_path = base_path if base_path is not None else str(Path() β
β β± 558 β β data_files = resolve_patterns_locally_or_by_urls(base_path, pa β
β 559 β β origin_metadata = _get_origin_metadata_locally_or_by_urls(data β
β 560 β β return cls(data_files, origin_metadata) β
β 561 β
β β
β /x/datasets/dat β
β a_files.py:195 in resolve_patterns_locally_or_by_urls β
β β
β 192 β β if is_remote_url(pattern): β
β 193 β β β data_files.append(Url(pattern)) β
β 194 β β else: β
β β± 195 β β β for path in _resolve_single_pattern_locally(base_path, pat β
β 196 β β β β data_files.append(path) β
β 197 β β
β 198 β if not data_files: β
β β
β /x/datasets/dat β
β a_files.py:145 in _resolve_single_pattern_locally β
β β
β 142 β β error_msg = f"Unable to find '{pattern}' at {Path(base_path).r β
β 143 β β if allowed_extensions is not None: β
β 144 β β β error_msg += f" with any supported extension {list(allowed β
β β± 145 β β raise FileNotFoundError(error_msg) β
β 146 β return sorted(out) β
β 147
### Steps to reproduce the bug
1. Version=2.3.2
2. In shell, cd workdir.(cd /a/b/c/.d/)
3. load_dataset("json", data_file={"train":"/a/b/c/.d/train/train.json", "test":"/a/b/c/.d/train/test.json"})
### Expected behavior
fix it please~
### Environment info
2.3.2
Version 2.3.2 is over one year old, so please use the latest release (2.14.0) to get the expected behavior. Version 2.3.2 does not contain some fixes we made to fix resolving hidden files/directories (starting with a dot). | [
-1.1433175802230835,
-0.7783908247947693,
-0.4615917205810547,
1.541563630104065,
-0.12804095447063446,
-1.145755648612976,
0.23625068366527557,
-1.0691317319869995,
1.5106480121612549,
-0.679083526134491,
0.15528185665607452,
-1.651146411895752,
0.1933295875787735,
-0.5603920221328735,
-0.6208676099777222,
-1.053862452507019,
-0.6205345392227173,
-0.7658807635307312,
1.09348726272583,
2.3890442848205566,
1.2567107677459717,
-1.467777967453003,
2.71407151222229,
0.6630221009254456,
-0.32925212383270264,
-1.16678786277771,
0.48874497413635254,
0.12257836759090424,
-1.3365892171859741,
-0.3825804591178894,
-1.0062938928604126,
-0.17060339450836182,
-0.561908483505249,
-0.5359331369400024,
0.20034271478652954,
0.5296043753623962,
-0.3364591598510742,
-0.2457859069108963,
-0.6277635097503662,
-0.5660560131072998,
0.44951170682907104,
-0.3514642119407654,
0.9074559807777405,
-0.3101887106895447,
1.7080694437026978,
-0.5107011198997498,
0.3869481086730957,
0.7321131229400635,
1.264194130897522,
0.12276864051818848,
0.12371733784675598,
0.3451119065284729,
0.41155892610549927,
-0.13337759673595428,
0.37628263235092163,
1.2875127792358398,
0.8166098594665527,
0.5201098322868347,
0.6258748769760132,
-2.09464693069458,
1.4442496299743652,
-0.8770517706871033,
0.2390117347240448,
1.441699743270874,
-0.9747591018676758,
0.5405576825141907,
-1.5868300199508667,
0.06191135197877884,
0.6430503129959106,
-2.243256092071533,
0.0989067405462265,
-1.0402852296829224,
-0.3809639811515808,
1.026494026184082,
0.3208196759223938,
-1.1738617420196533,
0.25633251667022705,
-0.5135208964347839,
1.148064136505127,
0.45775026082992554,
1.1292036771774292,
-1.6685996055603027,
0.15321996808052063,
-0.09949716180562973,
0.018862223252654076,
-1.3404655456542969,
-1.5197285413742065,
0.5222591757774353,
0.5584102869033813,
0.6786911487579346,
-0.13523881137371063,
1.0434157848358154,
-1.0787614583969116,
0.7184039950370789,
-0.8524059653282166,
-1.5280561447143555,
-1.408761978149414,
-2.573152780532837,
-2.444333076477051,
0.5967075824737549,
-0.4538167715072632,
-0.5093797445297241,
1.85662043094635,
-0.8497728705406189,
-1.582666277885437,
0.8944393992424011,
0.3601294755935669,
0.11999966204166412,
2.399662733078003,
0.16470561921596527,
-0.8668646812438965,
0.27269142866134644,
-0.7423375844955444,
1.0628502368927002,
-0.4055846929550171,
1.3432120084762573,
0.5139399170875549,
-1.036974549293518,
1.3174030780792236,
-0.3352017402648926,
0.6502768993377686,
-0.6385889649391174,
-0.447820782661438,
-0.8703684210777283,
0.28617793321609497,
1.7869175672531128,
-0.24835705757141113,
1.6415170431137085,
-0.2711486220359802,
-1.5334434509277344,
-1.6444710493087769,
0.757538914680481,
0.47700077295303345,
-0.8036672472953796,
0.1939297318458557,
-0.5385656952857971,
0.02171977050602436,
0.05194485932588577,
1.0807136297225952,
1.2665162086486816,
0.6678640842437744,
-0.47129756212234497,
-0.9703578352928162,
0.09687402099370956,
-0.10762342065572739,
-0.6153995990753174,
-2.041548490524292,
-0.20548857748508453,
0.21375907957553864,
0.6382614374160767,
-1.1194829940795898,
1.677879810333252,
0.8961758613586426,
1.956886649131775,
1.078342318534851,
-0.4309709072113037,
1.6418739557266235,
-0.17875035107135773,
1.7693825960159302,
-0.6981474757194519,
0.43685001134872437,
-0.3197881579399109,
-1.3003079891204834,
0.7966429591178894,
-0.3221362829208374,
-2.1456692218780518,
-0.8797736167907715,
-0.8015998005867004,
-0.19291548430919647,
-0.7700440883636475,
0.865770161151886,
-0.28247523307800293,
-1.4933245182037354,
0.21099765598773956,
-0.46280163526535034,
0.3149711489677429,
-1.141182541847229,
0.3011922240257263,
0.747214674949646,
-0.6051100492477417,
0.02123669721186161,
-0.24250848591327667,
-1.348197102546692,
-0.4234796166419983,
0.4167308211326599,
1.5669726133346558,
-0.5984976291656494,
0.8140704035758972,
1.0542635917663574,
-0.6412621140480042,
0.2891744375228882,
-0.009586799889802933,
-0.229042187333107,
0.655518651008606,
-1.2565163373947144,
-0.3415876030921936,
1.1279326677322388,
-0.42416584491729736,
-0.6543446183204651,
1.385514259338379,
0.8304129838943481,
-1.0727909803390503,
-0.1669137179851532,
-0.11744017153978348,
-1.0445148944854736,
0.05204536393284798,
-1.5248857736587524,
-0.0704551488161087,
0.4480825662612915,
-1.5028314590454102,
-0.39667409658432007,
-0.18994371592998505,
1.2432291507720947,
-0.2104581743478775,
1.3503669500350952,
-0.39599692821502686,
-0.06608541309833527,
-0.4536980986595154,
-0.5834594964981079,
0.24576474726200104,
-0.4135704040527344,
-0.538170576095581,
0.1469910740852356,
-0.7313461899757385,
0.3353419899940491,
1.4100580215454102,
0.23609988391399384,
0.014192285016179085,
0.5951408743858337,
1.279596209526062,
0.5568059086799622,
-0.11970280855894089,
-0.7204248309135437,
-1.6473631858825684,
2.0916872024536133,
-1.3208837509155273,
1.8608697652816772,
0.7782649397850037,
0.061005301773548126,
-1.6451871395111084,
-1.6262160539627075,
1.402302861213684,
1.1460083723068237,
2.457900047302246,
0.5335890054702759,
0.23811788856983185,
-0.7806937098503113,
-0.9453248977661133,
0.3429397940635681,
-1.1159275770187378,
-0.5478407144546509,
0.2851123809814453,
2.534719944000244,
1.949310541152954,
-0.3482514023780823,
-0.1749507337808609,
-0.9969763159751892,
1.304979681968689,
-0.11610117554664612,
0.2106684446334839,
2.0151588916778564,
-0.19469109177589417,
-1.0738472938537598,
1.1781742572784424,
-2.3486201763153076,
0.2039131373167038,
2.0948474407196045,
0.3678209185600281,
0.22964417934417725,
-1.548852562904358,
-0.6873149275779724,
-0.3224978446960449,
-0.5947479605674744,
-1.3556485176086426,
0.5705642700195312,
-0.33264869451522827,
-0.6414815187454224,
-1.5382550954818726,
0.25338464975357056,
-1.2595536708831787,
-1.5855156183242798,
0.2817423343658447,
1.828268051147461,
2.137768268585205,
-0.7069783210754395,
1.444445013999939,
-0.305766224861145,
-0.009374294430017471,
1.0961445569992065,
1.204761266708374,
3.106981039047241,
1.9951032400131226,
-1.2493057250976562,
0.7413613200187683,
-0.24124924838542938,
-0.46821391582489014,
0.9499293565750122,
-1.216483235359192,
1.343974232673645,
-0.08784163743257523,
-1.2857609987258911,
-1.2436312437057495,
1.0754581689834595,
0.4395402669906616,
0.12216851115226746,
-0.51067715883255,
1.3436609506607056,
0.07315748929977417,
1.3736789226531982,
0.5596196055412292,
-0.3214079737663269,
0.4705314636230469,
-0.43935251235961914,
-0.5788266658782959,
1.4587537050247192,
0.26396942138671875,
-1.552086591720581,
-2.0852909088134766,
-0.3645908832550049,
-0.7287089824676514,
-0.03821466118097305,
-0.5663536190986633,
-1.0127445459365845,
1.642125129699707,
0.2909631133079529,
-1.1830052137374878,
-0.3144611716270447,
-0.27922916412353516,
-0.55131596326828,
2.666254997253418,
-1.5155528783798218,
-0.0940343514084816,
-0.9684396982192993,
-0.7453456521034241,
1.5491963624954224,
-0.9892292022705078,
-0.21112388372421265,
-1.0353291034698486,
-0.7220402956008911,
-1.3592267036437988,
-0.4221283197402954,
0.07506430149078369,
-0.8842755556106567,
0.7631292939186096,
0.20649296045303345,
-1.0228667259216309,
-0.2439555525779724,
-0.7342276573181152,
1.1464461088180542,
-0.24067047238349915,
0.1884220540523529,
1.8594881296157837,
0.2790706753730774,
-0.3238869309425354,
0.6429929137229919,
1.1539204120635986,
0.7112482786178589,
-0.7643589973449707,
-0.19378265738487244,
-0.676422119140625,
0.3035382032394409,
-1.2354553937911987,
0.0994625985622406,
-2.8706750869750977,
0.48449188470840454,
-0.18730109930038452,
-0.031015506014227867,
-0.006405661813914776,
-1.3231762647628784,
1.0691449642181396,
2.6920998096466064,
-1.1319478750228882,
0.3323975205421448,
0.5640577077865601,
1.170039415359497,
-1.6410157680511475,
0.26347821950912476,
-0.5299068093299866,
1.98677659034729,
0.2022097259759903,
1.2132554054260254,
-0.7660306692123413,
-2.4524316787719727,
0.46815794706344604,
-1.169437289237976,
-0.9104948043823242,
1.0055075883865356,
-0.791338324546814,
0.22265760600566864,
-1.411291241645813,
-0.3020523190498352,
-0.7435042262077332,
-1.3913887739181519,
0.5947372913360596,
0.18734252452850342,
0.3609260320663452,
-0.5765296220779419,
0.3155902624130249,
-2.1944570541381836,
-1.3039857149124146,
-0.2407706379890442,
-1.0286649465560913,
0.6625748872756958,
-0.5734204649925232,
0.7453221082687378,
-0.06429097056388855,
0.1595127433538437,
0.18426838517189026,
1.4734152555465698,
3.337317705154419,
0.14184607565402985,
0.17400166392326355,
0.00406712107360363,
-0.9108477830886841,
1.480411410331726,
0.811981201171875,
-0.030188869684934616,
-0.7291757464408875,
-0.8830650448799133,
1.2122803926467896,
2.179542064666748,
1.1755459308624268,
0.04145233333110809,
-1.1292487382888794,
-0.7506662607192993,
0.040285561233758926,
0.158619686961174,
0.47708970308303833,
0.843035101890564,
-0.10254251956939697,
-0.046476006507873535,
1.4884443283081055,
1.2684714794158936,
-0.2637357711791992,
0.291645884513855,
-0.7928797006607056,
-0.37819457054138184,
0.5322365164756775,
0.14840327203273773,
0.02584013342857361,
0.5071322321891785,
-0.8614099025726318,
0.07937661558389664,
-0.5567247867584229,
-0.9071635007858276,
-0.6944271326065063,
-0.23519757390022278,
-0.40210866928100586,
1.7205151319503784,
0.23399707674980164,
-0.6193760633468628,
0.2038303017616272,
-0.7198207378387451,
-0.39653801918029785,
-1.0320725440979004,
0.30053263902664185,
-0.16639889776706696,
-0.1066301241517067,
-0.23644204437732697,
1.6797276735305786,
-0.9623817801475525,
-2.219578266143799,
0.12659169733524323,
0.2853855490684509,
-0.3657281994819641,
0.23286819458007812,
1.6883805990219116,
0.48475325107574463,
1.4401965141296387,
1.1803058385849,
1.0496323108673096,
-0.8404018878936768,
-1.451182246208191,
0.738864004611969,
1.0320050716400146,
-1.499177098274231,
0.7836403250694275,
-0.24420768022537231,
-0.4882608652114868,
0.751820981502533,
1.2640191316604614,
0.321163535118103,
-2.2479419708251953,
0.9875538945198059,
-1.0874086618423462,
0.6763171553611755,
0.8771947026252747,
0.5962545871734619,
0.17438547313213348,
0.8081785440444946,
-1.2230339050292969,
-1.0760003328323364,
-0.7916103005409241,
-0.712085485458374,
2.0607950687408447,
-0.3183634877204895,
0.7236906290054321,
0.011688191443681717,
-1.3971452713012695,
0.076260507106781,
0.9382582306861877,
0.2435615509748459,
-0.36490803956985474,
0.9919726848602295,
-0.7913916707038879,
-0.8615766763687134,
-1.4219377040863037,
-0.4839915633201599,
-1.1013176441192627,
-1.1023237705230713,
1.3054687976837158,
0.6583678722381592,
0.5047281980514526,
1.9182929992675781,
0.7027357220649719,
0.3500640392303467,
-2.688772678375244,
0.7826105356216431,
0.12922373414039612,
0.06549215316772461,
0.7710931301116943,
0.336930513381958,
0.9676727652549744,
0.043304845690727234,
0.6863774657249451,
-2.4586102962493896,
2.411024808883667,
-0.10211415588855743,
0.75152987241745,
0.10797251015901566,
-0.20523478090763092,
1.0937721729278564,
0.6026236414909363,
0.631499707698822,
-1.2976142168045044,
0.8627831935882568,
-0.5271161198616028,
1.1068365573883057,
0.7251131534576416,
-0.9243126511573792,
-0.007673596031963825,
1.3238543272018433,
0.2807450294494629,
-0.4557957053184509,
-1.0044291019439697,
-0.9761961698532104,
0.8781264424324036,
1.66201651096344,
-0.07950704544782639,
0.0842033177614212,
0.843238115310669,
0.6616807579994202,
-1.0746686458587646,
0.06840887665748596,
-0.6054403781890869,
-0.5618144869804382,
1.6755293607711792,
2.0790188312530518,
-0.27173298597335815,
-0.0984022319316864,
-0.7967514395713806,
-1.1436957120895386,
0.713197648525238,
0.1316647231578827,
0.17560654878616333,
0.3937453627586365,
-0.8254521489143372,
1.0305428504943848,
0.5680270791053772,
0.814473032951355,
0.0760919377207756,
0.35161101818084717,
0.2987024188041687,
-0.1385045200586319,
-1.1656213998794556,
-0.4565853476524353,
-0.9574110507965088,
-2.5601696968078613,
0.15530288219451904,
-0.25485295057296753,
-1.412194013595581,
-0.024730157107114792,
-1.130873203277588,
0.9278895854949951,
-0.48881757259368896,
-1.1232030391693115,
-1.5784828662872314,
0.40402501821517944,
-0.2380954623222351,
0.8886004686355591,
-1.5127922296524048,
-0.045107483863830566,
1.2100940942764282,
0.7965191006660461,
-0.5530121326446533,
1.2314434051513672,
0.11534908413887024,
0.7141327261924744,
0.8961161971092224,
-0.20220282673835754,
0.5418989062309265,
0.22834594547748566,
-1.2939656972885132,
0.4479972720146179,
0.9857848882675171,
0.15683455765247345,
1.3609352111816406,
-0.51955646276474,
-0.09941422194242477,
0.3347753882408142,
-0.5113646984100342,
-0.43224185705184937,
-0.21581444144248962,
0.722432553768158,
0.16299906373023987,
-1.0638598203659058,
0.13292819261550903,
-0.3386511206626892,
-0.2798316478729248,
0.28675687313079834,
-1.300689935684204,
-0.24062731862068176,
-0.38886260986328125,
-0.3162307143211365,
-1.1751854419708252,
0.11144214123487473,
1.4272269010543823,
-0.5828551054000854,
-0.3786841630935669,
0.5020713210105896,
0.47242677211761475,
0.3290221691131592,
0.7905904650688171,
-0.7142037153244019,
-0.23626011610031128,
-0.27061277627944946,
-0.2725849747657776,
0.476848304271698,
1.2040166854858398,
-0.1277143657207489,
-1.0091992616653442,
0.7460378408432007,
-0.43223297595977783,
0.2143513560295105,
1.961700201034546,
0.15757036209106445,
-0.7968944311141968,
0.41459912061691284,
-0.8995100259780884,
1.7652472257614136,
1.7629393339157104,
1.3692182302474976,
-0.3112437129020691,
-1.065306544303894,
0.6313753128051758,
-0.29776531457901,
-0.4190565347671509,
0.9272786378860474,
0.4106123447418213,
-0.25118929147720337,
-1.3965026140213013,
0.6353812217712402,
1.0999560356140137,
-0.7192436456680298,
-0.5218918323516846,
0.17663757503032684,
-0.8542900085449219,
1.2681912183761597,
0.6809509992599487,
0.33513057231903076,
0.13550065457820892,
1.7892346382141113,
0.6981214880943298,
-0.5039399266242981,
0.6054010987281799,
0.5003448128700256,
-0.2676057815551758,
-2.0021235942840576,
-1.152093529701233,
0.2478000968694687,
-0.5713932514190674,
-1.5664281845092773,
1.3606148958206177,
-1.1475647687911987,
-1.0497124195098877,
0.5118897557258606,
-0.012194463051855564,
1.5253021717071533,
0.2504274249076843,
1.5945394039154053,
2.1460132598876953,
0.9340925216674805,
0.3070904016494751,
1.1874146461486816,
-0.13101842999458313,
-0.5576328635215759,
1.7492690086364746,
-0.45812803506851196,
0.2247925102710724,
1.0681493282318115,
-0.5431468486785889,
-1.0343596935272217,
-0.7031842470169067,
-1.008721113204956,
-0.5230446457862854,
1.127942442893982,
0.10865213721990585,
-1.2215286493301392,
0.3369004726409912,
1.5673261880874634,
0.011310841888189316,
-0.3086159825325012,
0.506329357624054,
0.5927850604057312,
-0.6528418064117432,
-0.1270540952682495,
-0.8835152983665466,
0.5534780621528625,
-0.2941610813140869,
-0.3307110667228699,
0.20182429254055023,
0.4331904649734497,
1.1124227046966553,
0.03334036469459534,
0.18816298246383667,
0.9872859120368958,
-1.3866702318191528,
1.515976905822754,
-0.6306281089782715,
0.15975338220596313,
-2.378561496734619,
1.3921093940734863,
-0.5997638702392578,
2.0728824138641357,
-2.4903101921081543,
0.41078436374664307,
-0.6605671644210815,
-0.4749909043312073,
0.48241734504699707,
-0.4731101393699646,
0.19991977512836456,
-0.23205851018428802,
-0.9948724508285522,
-0.1485261619091034,
-0.7073491811752319,
0.78602534532547,
1.037140965461731,
1.422731637954712,
-1.0866812467575073,
-0.37359994649887085,
-1.5690418481826782,
-0.27232837677001953,
-0.785255491733551,
0.36757510900497437,
-1.9513739347457886,
-0.2692149877548218,
-1.9282747507095337,
-2.3926422595977783,
-1.577901840209961,
-0.6960098147392273,
0.8603370785713196,
0.3509608507156372,
-0.8609230518341064,
1.2512965202331543,
-0.22122547030448914,
-1.8396207094192505,
1.198357343673706,
-2.0146214962005615
] |
https://github.com/huggingface/datasets/issues/6071 | storage_options provided to load_dataset not fully piping through since datasets 2.14.0 | Hi ! Thanks for reporting, I opened a PR to fix this
What filesystem are you using ? | ### Describe the bug
Since the latest release of `datasets` (`2.14.0`), custom filesystem `storage_options` passed to `load_dataset()` do not seem to propagate through all the way - leading to problems if loading data files that need those options to be set.
I think this is because of the new `_prepare_path_and_storage_options()` (https://github.com/huggingface/datasets/pull/6028), which returns the right `storage_options` to use given a path and a `DownloadConfig` - but which might not be taking into account the extra `storage_options` explicitly provided e.g. through `load_dataset()`
### Steps to reproduce the bug
```python
import fsspec
import pandas as pd
import datasets
# Generate mock parquet file
data_files = "demo.parquet"
pd.DataFrame({"A": [1, 2, 3], "B": [4, 5, 6]}).to_parquet(data_files)
_storage_options = {"x": 1, "y": 2}
fs = fsspec.filesystem("file", **_storage_options)
dataset = datasets.load_dataset(
"parquet",
data_files=data_files,
storage_options=fs.storage_options
)
```
Looking at the `storage_options` resolved here:
https://github.com/huggingface/datasets/blob/b0177910b32712f28d147879395e511207e39958/src/datasets/data_files.py#L331
they end up being `{}`, instead of propagating through the `storage_options` that were provided to `load_dataset` (`fs.storage_options`). As these then get used for the filesystem operation a few lines below
https://github.com/huggingface/datasets/blob/b0177910b32712f28d147879395e511207e39958/src/datasets/data_files.py#L339
the call will fail if the user-provided `storage_options` were needed.
---
A temporary workaround that seemed to work locally to bypass the problem was to bundle a duplicate of the `storage_options` into the `download_config`, so that they make their way all the way to `_prepare_path_and_storage_options()` and get extracted correctly:
```python
dataset = datasets.load_dataset(
"parquet",
data_files=data_files,
storage_options=fs.storage_options,
download_config=datasets.DownloadConfig(storage_options={fs.protocol: fs.storage_options}),
)
```
### Expected behavior
`storage_options` provided to `load_dataset` take effect in all backend filesystem operations.
### Environment info
datasets==2.14.0 | 16 | 18 | storage_options provided to load_dataset not fully piping through since datasets 2.14.0
### Describe the bug
Since the latest release of `datasets` (`2.14.0`), custom filesystem `storage_options` passed to `load_dataset()` do not seem to propagate through all the way - leading to problems if loading data files that need those options to be set.
I think this is because of the new `_prepare_path_and_storage_options()` (https://github.com/huggingface/datasets/pull/6028), which returns the right `storage_options` to use given a path and a `DownloadConfig` - but which might not be taking into account the extra `storage_options` explicitly provided e.g. through `load_dataset()`
### Steps to reproduce the bug
```python
import fsspec
import pandas as pd
import datasets
# Generate mock parquet file
data_files = "demo.parquet"
pd.DataFrame({"A": [1, 2, 3], "B": [4, 5, 6]}).to_parquet(data_files)
_storage_options = {"x": 1, "y": 2}
fs = fsspec.filesystem("file", **_storage_options)
dataset = datasets.load_dataset(
"parquet",
data_files=data_files,
storage_options=fs.storage_options
)
```
Looking at the `storage_options` resolved here:
https://github.com/huggingface/datasets/blob/b0177910b32712f28d147879395e511207e39958/src/datasets/data_files.py#L331
they end up being `{}`, instead of propagating through the `storage_options` that were provided to `load_dataset` (`fs.storage_options`). As these then get used for the filesystem operation a few lines below
https://github.com/huggingface/datasets/blob/b0177910b32712f28d147879395e511207e39958/src/datasets/data_files.py#L339
the call will fail if the user-provided `storage_options` were needed.
---
A temporary workaround that seemed to work locally to bypass the problem was to bundle a duplicate of the `storage_options` into the `download_config`, so that they make their way all the way to `_prepare_path_and_storage_options()` and get extracted correctly:
```python
dataset = datasets.load_dataset(
"parquet",
data_files=data_files,
storage_options=fs.storage_options,
download_config=datasets.DownloadConfig(storage_options={fs.protocol: fs.storage_options}),
)
```
### Expected behavior
`storage_options` provided to `load_dataset` take effect in all backend filesystem operations.
### Environment info
datasets==2.14.0
Hi ! Thanks for reporting, I opened a PR to fix this
What filesystem are you using ? | [
-1.1659444570541382,
-0.9065359830856323,
-0.6957008242607117,
1.4630454778671265,
-0.13110680878162384,
-1.281360149383545,
0.20910535752773285,
-1.0998634099960327,
1.6670114994049072,
-0.7348120808601379,
0.32562580704689026,
-1.6995145082473755,
0.009933054447174072,
-0.5755549073219299,
-0.7451911568641663,
-0.9200152158737183,
-0.43503010272979736,
-0.7541061043739319,
1.0239232778549194,
2.453195095062256,
1.23199462890625,
-1.3070883750915527,
2.6642022132873535,
0.6743002533912659,
-0.18457183241844177,
-0.9068794250488281,
0.49959325790405273,
0.0038649076595902443,
-1.2505183219909668,
-0.41628387570381165,
-0.8664965033531189,
-0.04657691717147827,
-0.5585222840309143,
-0.5525901317596436,
0.03248471021652222,
0.504227876663208,
-0.35440266132354736,
-0.42747053503990173,
-0.6089617609977722,
-0.8098547458648682,
0.4605863094329834,
-0.33858656883239746,
0.992914617061615,
-0.37326741218566895,
1.8431464433670044,
-0.6006283760070801,
0.46683046221733093,
0.6919424533843994,
1.3278636932373047,
0.1773744523525238,
0.045737698674201965,
0.3241492509841919,
0.34342798590660095,
-0.012814627960324287,
0.5123123526573181,
1.2105752229690552,
0.5993126630783081,
0.5271919369697571,
0.7502551078796387,
-2.240077495574951,
1.2622952461242676,
-1.0845729112625122,
0.2705574631690979,
1.3651924133300781,
-0.910332202911377,
0.3409532308578491,
-1.7276322841644287,
-0.04535721242427826,
0.5455270409584045,
-2.254694700241089,
0.26688018441200256,
-1.2992721796035767,
-0.48834332823753357,
1.0284085273742676,
0.37189337611198425,
-1.174432396888733,
0.2456711083650589,
-0.4405626952648163,
1.0781258344650269,
0.5000813007354736,
1.0946893692016602,
-1.6843466758728027,
-0.029793785884976387,
-0.2525196075439453,
0.09944877028465271,
-1.3129738569259644,
-1.5927908420562744,
0.5589654445648193,
0.6617507934570312,
0.5856059193611145,
-0.17196625471115112,
1.115208625793457,
-0.9909725189208984,
0.8020501136779785,
-1.0491693019866943,
-1.6829742193222046,
-1.4587209224700928,
-2.205605983734131,
-2.3218536376953125,
0.7261097431182861,
-0.5322562456130981,
-0.45678946375846863,
1.9947561025619507,
-0.9500797986984253,
-1.7153191566467285,
1.0625313520431519,
0.30063700675964355,
-0.0328979417681694,
2.289769411087036,
0.2519615888595581,
-0.6645237803459167,
0.45266109704971313,
-0.7515698075294495,
0.7564963102340698,
-0.3518557548522949,
1.3556276559829712,
0.49079805612564087,
-1.132424235343933,
1.5306822061538696,
-0.3789393901824951,
0.6335734128952026,
-0.6971195340156555,
-0.5842567682266235,
-0.7484245300292969,
0.2985270619392395,
1.9265210628509521,
-0.41254404187202454,
1.5414592027664185,
-0.3853899836540222,
-1.5460841655731201,
-1.6298134326934814,
0.9595213532447815,
0.44337210059165955,
-0.7202876806259155,
0.025889446958899498,
-0.394571453332901,
0.13117335736751556,
-0.1374489963054657,
1.2061680555343628,
1.2380439043045044,
0.6730911731719971,
-0.391326367855072,
-0.731009840965271,
0.14833422005176544,
-0.005659333895891905,
-0.6629981398582458,
-1.7539516687393188,
-0.3439052104949951,
0.19783498346805573,
0.5510625839233398,
-1.0953834056854248,
1.8166368007659912,
0.8690539002418518,
1.8995517492294312,
0.994767963886261,
-0.34485822916030884,
1.4661674499511719,
0.03795657306909561,
1.9019769430160522,
-0.5437359809875488,
0.5796456933021545,
-0.32919102907180786,
-1.2047570943832397,
0.9214071035385132,
-0.29899701476097107,
-2.1089189052581787,
-0.7046936750411987,
-0.813073456287384,
-0.21218019723892212,
-0.755550742149353,
0.8620915412902832,
-0.22855456173419952,
-1.4689557552337646,
0.09902960807085037,
-0.6323341727256775,
0.1399742066860199,
-1.1999032497406006,
0.2920125424861908,
0.772793710231781,
-0.7065248489379883,
0.03970305621623993,
-0.1690216362476349,
-1.1956127882003784,
-0.46341216564178467,
0.3694198727607727,
1.8753459453582764,
-0.7057629227638245,
0.9241506457328796,
1.1458568572998047,
-0.7819828987121582,
0.12021348625421524,
0.23232918977737427,
-0.30092868208885193,
0.8015387654304504,
-1.0967674255371094,
-0.38520926237106323,
1.2248108386993408,
-0.24267488718032837,
-0.6285050511360168,
1.4273148775100708,
0.724476158618927,
-1.0684599876403809,
-0.1536722034215927,
-0.15164080262184143,
-0.799889087677002,
0.04558263719081879,
-1.512658953666687,
-0.07650280743837357,
0.4050140678882599,
-1.5151702165603638,
-0.5061731934547424,
-0.25800442695617676,
1.2705963850021362,
-0.23596903681755066,
1.397020697593689,
-0.26413214206695557,
-0.20013462007045746,
-0.37594708800315857,
-0.44043657183647156,
0.14414598047733307,
-0.17091548442840576,
-0.5875096917152405,
0.1945618987083435,
-0.7864773869514465,
0.37010660767555237,
1.4518218040466309,
0.31364038586616516,
0.024714047089219093,
0.4891687333583832,
1.0774530172348022,
0.363523930311203,
-0.08687260746955872,
-0.8739595413208008,
-1.5523496866226196,
2.0007903575897217,
-1.3794522285461426,
1.974825143814087,
0.6670129895210266,
0.025786155834794044,
-1.7979024648666382,
-1.899811863899231,
1.384104609489441,
1.095834493637085,
2.364382266998291,
0.4770861566066742,
0.35969114303588867,
-0.8028115034103394,
-0.6933995485305786,
0.3817480802536011,
-1.0112099647521973,
-0.5707550644874573,
0.1626095175743103,
2.3748512268066406,
1.707842230796814,
-0.5465307831764221,
-0.2677600681781769,
-1.027725338935852,
1.374840259552002,
-0.22947344183921814,
0.2897781729698181,
1.977952241897583,
-0.26696860790252686,
-1.020434021949768,
1.328355073928833,
-2.387859582901001,
0.17654123902320862,
2.032555341720581,
0.2041524350643158,
0.14475350081920624,
-1.4061031341552734,
-0.598484456539154,
-0.33144354820251465,
-0.4287770688533783,
-1.2413862943649292,
0.46713709831237793,
-0.23353911936283112,
-0.7271428108215332,
-1.4437813758850098,
0.18188831210136414,
-1.183809757232666,
-1.7061208486557007,
0.25195109844207764,
1.9295107126235962,
1.9278875589370728,
-0.7214611768722534,
1.5528326034545898,
-0.34706705808639526,
0.0832754597067833,
1.3078075647354126,
1.3343238830566406,
3.1176092624664307,
1.8248577117919922,
-1.2817999124526978,
0.7030459046363831,
-0.21133026480674744,
-0.458996057510376,
1.2748608589172363,
-1.0636005401611328,
1.3398953676223755,
-0.1708829700946808,
-1.2102687358856201,
-1.3065028190612793,
1.008804440498352,
0.5318331718444824,
0.12083750218153,
-0.4757803976535797,
1.1526740789413452,
0.1457667201757431,
1.2701038122177124,
0.5914827585220337,
-0.40570950508117676,
0.6430833339691162,
-0.3056570291519165,
-0.4957660734653473,
1.4759371280670166,
0.2370975911617279,
-1.4398397207260132,
-2.2635772228240967,
-0.22832264006137848,
-0.9071337580680847,
0.001186273992061615,
-0.6397691965103149,
-1.0023554563522339,
1.671995997428894,
0.39584609866142273,
-1.2819496393203735,
-0.1898452490568161,
-0.3151082396507263,
-0.47800183296203613,
2.734839916229248,
-1.3960649967193604,
-0.1712919920682907,
-0.9812588691711426,
-0.6444106698036194,
1.6382824182510376,
-1.1913998126983643,
-0.2510741055011749,
-0.9799677729606628,
-0.5899319052696228,
-1.2991440296173096,
-0.5286481976509094,
0.07262293249368668,
-0.9515824317932129,
0.8154093027114868,
0.11915012449026108,
-1.205686330795288,
-0.3680833876132965,
-0.9034455418586731,
1.025889277458191,
-0.19231121242046356,
0.22252126038074493,
1.9029502868652344,
0.4124053716659546,
-0.38936537504196167,
0.7977638244628906,
1.1564440727233887,
0.6401094794273376,
-0.5912079811096191,
0.24278099834918976,
-0.6878613829612732,
0.23821213841438293,
-1.3615827560424805,
0.2932981848716736,
-2.8583998680114746,
0.5517027974128723,
-0.12527361512184143,
-0.04030260443687439,
0.028177442029118538,
-1.39271879196167,
1.042787790298462,
2.5953269004821777,
-1.2930599451065063,
0.3915897309780121,
0.3905852437019348,
1.1412888765335083,
-1.5681121349334717,
0.2747720181941986,
-0.3796505928039551,
2.030090808868408,
0.20766893029212952,
1.153303861618042,
-0.4855456054210663,
-2.1924357414245605,
0.5027154684066772,
-1.2824504375457764,
-1.2146724462509155,
0.7873144745826721,
-0.8596058487892151,
0.14548464119434357,
-1.4663569927215576,
-0.20848631858825684,
-0.8794965147972107,
-1.253631591796875,
0.7510566115379333,
0.06530851125717163,
0.4243695139884949,
-0.5898420810699463,
0.37910979986190796,
-2.1178629398345947,
-1.3164793252944946,
-0.25526246428489685,
-0.9115816354751587,
0.5455475449562073,
-0.3677777945995331,
0.6892713904380798,
-0.16263198852539062,
-0.0028033237904310226,
0.31784290075302124,
1.5145665407180786,
3.4831032752990723,
0.2098855972290039,
0.2480395883321762,
-0.16798388957977295,
-0.935395359992981,
1.487107276916504,
0.9539108872413635,
-0.1236734390258789,
-0.5559866428375244,
-1.0075582265853882,
1.2813113927841187,
1.9907664060592651,
1.15608811378479,
-0.03986826911568642,
-0.9014610648155212,
-0.817849338054657,
-0.03185732662677765,
0.14874300360679626,
0.4611777067184448,
0.8715522885322571,
0.10374505072832108,
0.05302125960588455,
1.3503665924072266,
1.2176110744476318,
-0.42779740691185,
0.3557065427303314,
-0.899099588394165,
-0.3959008455276489,
0.5744760036468506,
0.25054028630256653,
0.09250535070896149,
0.43459779024124146,
-1.0159388780593872,
-0.2417445182800293,
-0.47418212890625,
-0.9160240888595581,
-0.7224249839782715,
-0.4787653982639313,
-0.42400723695755005,
1.6043486595153809,
0.0728839561343193,
-0.5015122890472412,
-0.06620363146066666,
-0.7358689904212952,
-0.1944359689950943,
-1.0472192764282227,
0.26845693588256836,
-0.1461620330810547,
-0.1460549682378769,
-0.13537980616092682,
1.6183832883834839,
-1.0031733512878418,
-2.0411291122436523,
0.23090262711048126,
0.20048491656780243,
-0.3996144235134125,
0.21970972418785095,
1.6511530876159668,
0.5175144672393799,
1.4042056798934937,
1.3308229446411133,
0.9740248918533325,
-0.667956531047821,
-1.2452298402786255,
0.69199138879776,
0.9468201994895935,
-1.4579946994781494,
0.8173915147781372,
-0.03469642251729965,
-0.446915864944458,
0.6569933295249939,
1.2352854013442993,
0.45166608691215515,
-2.0259389877319336,
0.7815128564834595,
-0.9302851557731628,
0.7979668974876404,
0.7388179898262024,
0.730725109577179,
0.20356160402297974,
0.8728812336921692,
-1.1850067377090454,
-1.1212669610977173,
-0.6855574250221252,
-0.655264139175415,
1.8890734910964966,
-0.22799018025398254,
0.6525946259498596,
-0.19594375789165497,
-1.304029941558838,
-0.15484820306301117,
0.7482708692550659,
0.4177018105983734,
-0.5940617918968201,
0.8103805184364319,
-0.6660152077674866,
-0.9217057824134827,
-1.292639970779419,
-0.5282645225524902,
-1.1177271604537964,
-0.9321832060813904,
1.0173627138137817,
0.7932915091514587,
0.43345242738723755,
1.8398768901824951,
0.5848815441131592,
0.35625994205474854,
-2.7195210456848145,
0.8968212008476257,
0.28531166911125183,
-0.061417579650878906,
0.9064162969589233,
0.3370179831981659,
1.0320343971252441,
-0.05626261234283447,
0.6621289849281311,
-2.4159159660339355,
2.2729015350341797,
-0.15256449580192566,
0.6232372522354126,
-0.028093533590435982,
-0.2285543829202652,
1.1116464138031006,
0.5341112613677979,
0.45356905460357666,
-1.2126977443695068,
0.6719018220901489,
-0.5719404220581055,
1.1215133666992188,
0.8686313629150391,
-0.934180498123169,
0.009725257754325867,
1.3997339010238647,
0.5119024515151978,
-0.4996368885040283,
-0.899520993232727,
-0.9267265796661377,
0.9751957058906555,
1.6305243968963623,
-0.0377398282289505,
-0.06614959239959717,
0.9444680213928223,
0.6707217693328857,
-1.31620454788208,
0.19969692826271057,
-0.6704657673835754,
-0.6219049692153931,
1.6310195922851562,
1.9442778825759888,
-0.14044985175132751,
-0.1457175612449646,
-0.7055753469467163,
-1.1581250429153442,
0.718142032623291,
-0.0008985651656985283,
0.09508417546749115,
0.5417567491531372,
-0.6869722604751587,
1.099092960357666,
0.7936714291572571,
0.8916754722595215,
0.08954229205846786,
0.34973499178886414,
0.437507301568985,
-0.35590097308158875,
-1.145658016204834,
-0.33786681294441223,
-0.9916418790817261,
-2.610077142715454,
0.45289039611816406,
-0.2689560651779175,
-1.398077368736267,
-0.007469642907381058,
-1.0733177661895752,
0.9359637498855591,
-0.5965688824653625,
-1.1644197702407837,
-1.528243899345398,
0.23294098675251007,
0.005835957825183868,
0.9094350337982178,
-1.6343932151794434,
-0.13653336465358734,
1.1883940696716309,
0.8344906568527222,
-0.6359217166900635,
0.9947804808616638,
0.25479233264923096,
1.0168408155441284,
0.8403633832931519,
-0.3272295892238617,
0.5627529621124268,
0.08574262261390686,
-1.3486449718475342,
0.4697081446647644,
1.1918083429336548,
0.1640777438879013,
1.4351757764816284,
-0.5402096509933472,
0.11228649318218231,
0.39763614535331726,
-0.6609447002410889,
-0.5366637110710144,
-0.5396837592124939,
0.6603932976722717,
0.050245434045791626,
-0.9107567667961121,
-0.03789350390434265,
-0.049345336854457855,
-0.2406558096408844,
0.17683643102645874,
-1.5471128225326538,
-0.18781663477420807,
-0.3569713532924652,
-0.6054807901382446,
-1.2222133874893188,
-0.07798094302415848,
1.367732286453247,
-0.7083908319473267,
-0.25631505250930786,
0.5318053960800171,
0.33084192872047424,
0.49062880873680115,
0.594615638256073,
-0.6740756630897522,
-0.269922137260437,
-0.3152434229850769,
-0.36370253562927246,
0.3281751871109009,
1.3093757629394531,
-0.10295296460390091,
-0.9574870467185974,
0.7779077291488647,
-0.41320642828941345,
0.08533038198947906,
1.9537694454193115,
0.07878176122903824,
-0.768172562122345,
0.2830248475074768,
-0.6793204545974731,
1.899658441543579,
1.8147624731063843,
1.3691688776016235,
-0.10532976686954498,
-0.9598008990287781,
0.6253536939620972,
-0.33103129267692566,
-0.39735063910484314,
0.9374682903289795,
0.35365918278694153,
-0.2552782893180847,
-1.4027831554412842,
0.7283390760421753,
1.3477168083190918,
-0.9155437350273132,
-0.7710607051849365,
0.1465439647436142,
-0.8171024918556213,
1.1221683025360107,
0.5668977499008179,
0.2623887062072754,
0.2752506136894226,
1.6065400838851929,
0.7101918458938599,
-0.3682466447353363,
0.5762532949447632,
0.5033949613571167,
-0.11668884754180908,
-2.13289475440979,
-1.1726548671722412,
0.3940025269985199,
-0.5026237964630127,
-1.585331678390503,
1.3990757465362549,
-1.178464651107788,
-0.9792534708976746,
0.5608131885528564,
0.10059190541505814,
1.4739996194839478,
0.34115394949913025,
1.6442025899887085,
2.1229586601257324,
0.8614073991775513,
0.35849449038505554,
1.265771508216858,
-0.05860266089439392,
-0.45911476016044617,
1.8212453126907349,
-0.4481126666069031,
0.4862403869628906,
1.1493501663208008,
-0.34524521231651306,
-1.0472899675369263,
-0.7610039114952087,
-1.2819362878799438,
-0.670264720916748,
1.2022149562835693,
0.05027692764997482,
-1.0654053688049316,
0.2449089139699936,
1.6048229932785034,
0.056260883808135986,
-0.26802605390548706,
0.7347186207771301,
0.4120410978794098,
-0.8554090261459351,
-0.07160887867212296,
-0.8878272771835327,
0.5381397008895874,
-0.23398900032043457,
-0.37377306818962097,
0.30727246403694153,
0.4400062561035156,
1.3004765510559082,
-0.032250382006168365,
0.1393595039844513,
1.1478779315948486,
-1.4798457622528076,
1.5176715850830078,
-0.6818855404853821,
0.3232724666595459,
-2.448801279067993,
1.4098483324050903,
-0.7823773622512817,
1.946903109550476,
-2.535391330718994,
0.4673408567905426,
-0.5887161493301392,
-0.4577425718307495,
0.3067832291126251,
-0.37477609515190125,
0.07786431908607483,
-0.10048908740282059,
-1.138213038444519,
-0.018845658749341965,
-0.738040030002594,
0.6975334882736206,
1.1397093534469604,
1.430039882659912,
-1.1569777727127075,
-0.33779826760292053,
-1.7666417360305786,
-0.08965975046157837,
-0.640928328037262,
0.36095330119132996,
-1.943764567375183,
-0.1309843808412552,
-1.9216758012771606,
-2.4445579051971436,
-1.2921476364135742,
-0.7554457187652588,
1.0445443391799927,
0.06755390018224716,
-0.8661673665046692,
1.249424934387207,
-0.37920618057250977,
-1.8679145574569702,
1.1118818521499634,
-2.196014881134033
] |
https://github.com/huggingface/datasets/issues/6071 | storage_options provided to load_dataset not fully piping through since datasets 2.14.0 | Hi @lhoestq ! Thank you so much π
It's a bit of a custom setup, but in practice I am using a [pyarrow.fs.S3FileSystem](https://arrow.apache.org/docs/python/generated/pyarrow.fs.S3FileSystem.html) (wrapped in a `fsspec.implementations.arrow.ArrowFSWrapper` [to make it](https://arrow.apache.org/docs/python/filesystems.html#using-arrow-filesystems-with-fsspec) `fsspec` compatible). I also register it as an entrypoint with `fsspec` so that it's the one that gets automatically resolved when looking for filesystems for the `s3` protocol
In my case the `storage_option` that seemed not getting piped through was the filesystem's `endpoint_override` that I use in some tests to point at a mock S3 bucket | ### Describe the bug
Since the latest release of `datasets` (`2.14.0`), custom filesystem `storage_options` passed to `load_dataset()` do not seem to propagate through all the way - leading to problems if loading data files that need those options to be set.
I think this is because of the new `_prepare_path_and_storage_options()` (https://github.com/huggingface/datasets/pull/6028), which returns the right `storage_options` to use given a path and a `DownloadConfig` - but which might not be taking into account the extra `storage_options` explicitly provided e.g. through `load_dataset()`
### Steps to reproduce the bug
```python
import fsspec
import pandas as pd
import datasets
# Generate mock parquet file
data_files = "demo.parquet"
pd.DataFrame({"A": [1, 2, 3], "B": [4, 5, 6]}).to_parquet(data_files)
_storage_options = {"x": 1, "y": 2}
fs = fsspec.filesystem("file", **_storage_options)
dataset = datasets.load_dataset(
"parquet",
data_files=data_files,
storage_options=fs.storage_options
)
```
Looking at the `storage_options` resolved here:
https://github.com/huggingface/datasets/blob/b0177910b32712f28d147879395e511207e39958/src/datasets/data_files.py#L331
they end up being `{}`, instead of propagating through the `storage_options` that were provided to `load_dataset` (`fs.storage_options`). As these then get used for the filesystem operation a few lines below
https://github.com/huggingface/datasets/blob/b0177910b32712f28d147879395e511207e39958/src/datasets/data_files.py#L339
the call will fail if the user-provided `storage_options` were needed.
---
A temporary workaround that seemed to work locally to bypass the problem was to bundle a duplicate of the `storage_options` into the `download_config`, so that they make their way all the way to `_prepare_path_and_storage_options()` and get extracted correctly:
```python
dataset = datasets.load_dataset(
"parquet",
data_files=data_files,
storage_options=fs.storage_options,
download_config=datasets.DownloadConfig(storage_options={fs.protocol: fs.storage_options}),
)
```
### Expected behavior
`storage_options` provided to `load_dataset` take effect in all backend filesystem operations.
### Environment info
datasets==2.14.0 | 16 | 86 | storage_options provided to load_dataset not fully piping through since datasets 2.14.0
### Describe the bug
Since the latest release of `datasets` (`2.14.0`), custom filesystem `storage_options` passed to `load_dataset()` do not seem to propagate through all the way - leading to problems if loading data files that need those options to be set.
I think this is because of the new `_prepare_path_and_storage_options()` (https://github.com/huggingface/datasets/pull/6028), which returns the right `storage_options` to use given a path and a `DownloadConfig` - but which might not be taking into account the extra `storage_options` explicitly provided e.g. through `load_dataset()`
### Steps to reproduce the bug
```python
import fsspec
import pandas as pd
import datasets
# Generate mock parquet file
data_files = "demo.parquet"
pd.DataFrame({"A": [1, 2, 3], "B": [4, 5, 6]}).to_parquet(data_files)
_storage_options = {"x": 1, "y": 2}
fs = fsspec.filesystem("file", **_storage_options)
dataset = datasets.load_dataset(
"parquet",
data_files=data_files,
storage_options=fs.storage_options
)
```
Looking at the `storage_options` resolved here:
https://github.com/huggingface/datasets/blob/b0177910b32712f28d147879395e511207e39958/src/datasets/data_files.py#L331
they end up being `{}`, instead of propagating through the `storage_options` that were provided to `load_dataset` (`fs.storage_options`). As these then get used for the filesystem operation a few lines below
https://github.com/huggingface/datasets/blob/b0177910b32712f28d147879395e511207e39958/src/datasets/data_files.py#L339
the call will fail if the user-provided `storage_options` were needed.
---
A temporary workaround that seemed to work locally to bypass the problem was to bundle a duplicate of the `storage_options` into the `download_config`, so that they make their way all the way to `_prepare_path_and_storage_options()` and get extracted correctly:
```python
dataset = datasets.load_dataset(
"parquet",
data_files=data_files,
storage_options=fs.storage_options,
download_config=datasets.DownloadConfig(storage_options={fs.protocol: fs.storage_options}),
)
```
### Expected behavior
`storage_options` provided to `load_dataset` take effect in all backend filesystem operations.
### Environment info
datasets==2.14.0
Hi @lhoestq ! Thank you so much π
It's a bit of a custom setup, but in practice I am using a [pyarrow.fs.S3FileSystem](https://arrow.apache.org/docs/python/generated/pyarrow.fs.S3FileSystem.html) (wrapped in a `fsspec.implementations.arrow.ArrowFSWrapper` [to make it](https://arrow.apache.org/docs/python/filesystems.html#using-arrow-filesystems-with-fsspec) `fsspec` compatible). I also register it as an entrypoint with `fsspec` so that it's the one that gets automatically resolved when looking for filesystems for the `s3` protocol
In my case the `storage_option` that seemed not getting piped through was the filesystem's `endpoint_override` that I use in some tests to point at a mock S3 bucket | [
-1.1659444570541382,
-0.9065359830856323,
-0.6957008242607117,
1.4630454778671265,
-0.13110680878162384,
-1.281360149383545,
0.20910535752773285,
-1.0998634099960327,
1.6670114994049072,
-0.7348120808601379,
0.32562580704689026,
-1.6995145082473755,
0.009933054447174072,
-0.5755549073219299,
-0.7451911568641663,
-0.9200152158737183,
-0.43503010272979736,
-0.7541061043739319,
1.0239232778549194,
2.453195095062256,
1.23199462890625,
-1.3070883750915527,
2.6642022132873535,
0.6743002533912659,
-0.18457183241844177,
-0.9068794250488281,
0.49959325790405273,
0.0038649076595902443,
-1.2505183219909668,
-0.41628387570381165,
-0.8664965033531189,
-0.04657691717147827,
-0.5585222840309143,
-0.5525901317596436,
0.03248471021652222,
0.504227876663208,
-0.35440266132354736,
-0.42747053503990173,
-0.6089617609977722,
-0.8098547458648682,
0.4605863094329834,
-0.33858656883239746,
0.992914617061615,
-0.37326741218566895,
1.8431464433670044,
-0.6006283760070801,
0.46683046221733093,
0.6919424533843994,
1.3278636932373047,
0.1773744523525238,
0.045737698674201965,
0.3241492509841919,
0.34342798590660095,
-0.012814627960324287,
0.5123123526573181,
1.2105752229690552,
0.5993126630783081,
0.5271919369697571,
0.7502551078796387,
-2.240077495574951,
1.2622952461242676,
-1.0845729112625122,
0.2705574631690979,
1.3651924133300781,
-0.910332202911377,
0.3409532308578491,
-1.7276322841644287,
-0.04535721242427826,
0.5455270409584045,
-2.254694700241089,
0.26688018441200256,
-1.2992721796035767,
-0.48834332823753357,
1.0284085273742676,
0.37189337611198425,
-1.174432396888733,
0.2456711083650589,
-0.4405626952648163,
1.0781258344650269,
0.5000813007354736,
1.0946893692016602,
-1.6843466758728027,
-0.029793785884976387,
-0.2525196075439453,
0.09944877028465271,
-1.3129738569259644,
-1.5927908420562744,
0.5589654445648193,
0.6617507934570312,
0.5856059193611145,
-0.17196625471115112,
1.115208625793457,
-0.9909725189208984,
0.8020501136779785,
-1.0491693019866943,
-1.6829742193222046,
-1.4587209224700928,
-2.205605983734131,
-2.3218536376953125,
0.7261097431182861,
-0.5322562456130981,
-0.45678946375846863,
1.9947561025619507,
-0.9500797986984253,
-1.7153191566467285,
1.0625313520431519,
0.30063700675964355,
-0.0328979417681694,
2.289769411087036,
0.2519615888595581,
-0.6645237803459167,
0.45266109704971313,
-0.7515698075294495,
0.7564963102340698,
-0.3518557548522949,
1.3556276559829712,
0.49079805612564087,
-1.132424235343933,
1.5306822061538696,
-0.3789393901824951,
0.6335734128952026,
-0.6971195340156555,
-0.5842567682266235,
-0.7484245300292969,
0.2985270619392395,
1.9265210628509521,
-0.41254404187202454,
1.5414592027664185,
-0.3853899836540222,
-1.5460841655731201,
-1.6298134326934814,
0.9595213532447815,
0.44337210059165955,
-0.7202876806259155,
0.025889446958899498,
-0.394571453332901,
0.13117335736751556,
-0.1374489963054657,
1.2061680555343628,
1.2380439043045044,
0.6730911731719971,
-0.391326367855072,
-0.731009840965271,
0.14833422005176544,
-0.005659333895891905,
-0.6629981398582458,
-1.7539516687393188,
-0.3439052104949951,
0.19783498346805573,
0.5510625839233398,
-1.0953834056854248,
1.8166368007659912,
0.8690539002418518,
1.8995517492294312,
0.994767963886261,
-0.34485822916030884,
1.4661674499511719,
0.03795657306909561,
1.9019769430160522,
-0.5437359809875488,
0.5796456933021545,
-0.32919102907180786,
-1.2047570943832397,
0.9214071035385132,
-0.29899701476097107,
-2.1089189052581787,
-0.7046936750411987,
-0.813073456287384,
-0.21218019723892212,
-0.755550742149353,
0.8620915412902832,
-0.22855456173419952,
-1.4689557552337646,
0.09902960807085037,
-0.6323341727256775,
0.1399742066860199,
-1.1999032497406006,
0.2920125424861908,
0.772793710231781,
-0.7065248489379883,
0.03970305621623993,
-0.1690216362476349,
-1.1956127882003784,
-0.46341216564178467,
0.3694198727607727,
1.8753459453582764,
-0.7057629227638245,
0.9241506457328796,
1.1458568572998047,
-0.7819828987121582,
0.12021348625421524,
0.23232918977737427,
-0.30092868208885193,
0.8015387654304504,
-1.0967674255371094,
-0.38520926237106323,
1.2248108386993408,
-0.24267488718032837,
-0.6285050511360168,
1.4273148775100708,
0.724476158618927,
-1.0684599876403809,
-0.1536722034215927,
-0.15164080262184143,
-0.799889087677002,
0.04558263719081879,
-1.512658953666687,
-0.07650280743837357,
0.4050140678882599,
-1.5151702165603638,
-0.5061731934547424,
-0.25800442695617676,
1.2705963850021362,
-0.23596903681755066,
1.397020697593689,
-0.26413214206695557,
-0.20013462007045746,
-0.37594708800315857,
-0.44043657183647156,
0.14414598047733307,
-0.17091548442840576,
-0.5875096917152405,
0.1945618987083435,
-0.7864773869514465,
0.37010660767555237,
1.4518218040466309,
0.31364038586616516,
0.024714047089219093,
0.4891687333583832,
1.0774530172348022,
0.363523930311203,
-0.08687260746955872,
-0.8739595413208008,
-1.5523496866226196,
2.0007903575897217,
-1.3794522285461426,
1.974825143814087,
0.6670129895210266,
0.025786155834794044,
-1.7979024648666382,
-1.899811863899231,
1.384104609489441,
1.095834493637085,
2.364382266998291,
0.4770861566066742,
0.35969114303588867,
-0.8028115034103394,
-0.6933995485305786,
0.3817480802536011,
-1.0112099647521973,
-0.5707550644874573,
0.1626095175743103,
2.3748512268066406,
1.707842230796814,
-0.5465307831764221,
-0.2677600681781769,
-1.027725338935852,
1.374840259552002,
-0.22947344183921814,
0.2897781729698181,
1.977952241897583,
-0.26696860790252686,
-1.020434021949768,
1.328355073928833,
-2.387859582901001,
0.17654123902320862,
2.032555341720581,
0.2041524350643158,
0.14475350081920624,
-1.4061031341552734,
-0.598484456539154,
-0.33144354820251465,
-0.4287770688533783,
-1.2413862943649292,
0.46713709831237793,
-0.23353911936283112,
-0.7271428108215332,
-1.4437813758850098,
0.18188831210136414,
-1.183809757232666,
-1.7061208486557007,
0.25195109844207764,
1.9295107126235962,
1.9278875589370728,
-0.7214611768722534,
1.5528326034545898,
-0.34706705808639526,
0.0832754597067833,
1.3078075647354126,
1.3343238830566406,
3.1176092624664307,
1.8248577117919922,
-1.2817999124526978,
0.7030459046363831,
-0.21133026480674744,
-0.458996057510376,
1.2748608589172363,
-1.0636005401611328,
1.3398953676223755,
-0.1708829700946808,
-1.2102687358856201,
-1.3065028190612793,
1.008804440498352,
0.5318331718444824,
0.12083750218153,
-0.4757803976535797,
1.1526740789413452,
0.1457667201757431,
1.2701038122177124,
0.5914827585220337,
-0.40570950508117676,
0.6430833339691162,
-0.3056570291519165,
-0.4957660734653473,
1.4759371280670166,
0.2370975911617279,
-1.4398397207260132,
-2.2635772228240967,
-0.22832264006137848,
-0.9071337580680847,
0.001186273992061615,
-0.6397691965103149,
-1.0023554563522339,
1.671995997428894,
0.39584609866142273,
-1.2819496393203735,
-0.1898452490568161,
-0.3151082396507263,
-0.47800183296203613,
2.734839916229248,
-1.3960649967193604,
-0.1712919920682907,
-0.9812588691711426,
-0.6444106698036194,
1.6382824182510376,
-1.1913998126983643,
-0.2510741055011749,
-0.9799677729606628,
-0.5899319052696228,
-1.2991440296173096,
-0.5286481976509094,
0.07262293249368668,
-0.9515824317932129,
0.8154093027114868,
0.11915012449026108,
-1.205686330795288,
-0.3680833876132965,
-0.9034455418586731,
1.025889277458191,
-0.19231121242046356,
0.22252126038074493,
1.9029502868652344,
0.4124053716659546,
-0.38936537504196167,
0.7977638244628906,
1.1564440727233887,
0.6401094794273376,
-0.5912079811096191,
0.24278099834918976,
-0.6878613829612732,
0.23821213841438293,
-1.3615827560424805,
0.2932981848716736,
-2.8583998680114746,
0.5517027974128723,
-0.12527361512184143,
-0.04030260443687439,
0.028177442029118538,
-1.39271879196167,
1.042787790298462,
2.5953269004821777,
-1.2930599451065063,
0.3915897309780121,
0.3905852437019348,
1.1412888765335083,
-1.5681121349334717,
0.2747720181941986,
-0.3796505928039551,
2.030090808868408,
0.20766893029212952,
1.153303861618042,
-0.4855456054210663,
-2.1924357414245605,
0.5027154684066772,
-1.2824504375457764,
-1.2146724462509155,
0.7873144745826721,
-0.8596058487892151,
0.14548464119434357,
-1.4663569927215576,
-0.20848631858825684,
-0.8794965147972107,
-1.253631591796875,
0.7510566115379333,
0.06530851125717163,
0.4243695139884949,
-0.5898420810699463,
0.37910979986190796,
-2.1178629398345947,
-1.3164793252944946,
-0.25526246428489685,
-0.9115816354751587,
0.5455475449562073,
-0.3677777945995331,
0.6892713904380798,
-0.16263198852539062,
-0.0028033237904310226,
0.31784290075302124,
1.5145665407180786,
3.4831032752990723,
0.2098855972290039,
0.2480395883321762,
-0.16798388957977295,
-0.935395359992981,
1.487107276916504,
0.9539108872413635,
-0.1236734390258789,
-0.5559866428375244,
-1.0075582265853882,
1.2813113927841187,
1.9907664060592651,
1.15608811378479,
-0.03986826911568642,
-0.9014610648155212,
-0.817849338054657,
-0.03185732662677765,
0.14874300360679626,
0.4611777067184448,
0.8715522885322571,
0.10374505072832108,
0.05302125960588455,
1.3503665924072266,
1.2176110744476318,
-0.42779740691185,
0.3557065427303314,
-0.899099588394165,
-0.3959008455276489,
0.5744760036468506,
0.25054028630256653,
0.09250535070896149,
0.43459779024124146,
-1.0159388780593872,
-0.2417445182800293,
-0.47418212890625,
-0.9160240888595581,
-0.7224249839782715,
-0.4787653982639313,
-0.42400723695755005,
1.6043486595153809,
0.0728839561343193,
-0.5015122890472412,
-0.06620363146066666,
-0.7358689904212952,
-0.1944359689950943,
-1.0472192764282227,
0.26845693588256836,
-0.1461620330810547,
-0.1460549682378769,
-0.13537980616092682,
1.6183832883834839,
-1.0031733512878418,
-2.0411291122436523,
0.23090262711048126,
0.20048491656780243,
-0.3996144235134125,
0.21970972418785095,
1.6511530876159668,
0.5175144672393799,
1.4042056798934937,
1.3308229446411133,
0.9740248918533325,
-0.667956531047821,
-1.2452298402786255,
0.69199138879776,
0.9468201994895935,
-1.4579946994781494,
0.8173915147781372,
-0.03469642251729965,
-0.446915864944458,
0.6569933295249939,
1.2352854013442993,
0.45166608691215515,
-2.0259389877319336,
0.7815128564834595,
-0.9302851557731628,
0.7979668974876404,
0.7388179898262024,
0.730725109577179,
0.20356160402297974,
0.8728812336921692,
-1.1850067377090454,
-1.1212669610977173,
-0.6855574250221252,
-0.655264139175415,
1.8890734910964966,
-0.22799018025398254,
0.6525946259498596,
-0.19594375789165497,
-1.304029941558838,
-0.15484820306301117,
0.7482708692550659,
0.4177018105983734,
-0.5940617918968201,
0.8103805184364319,
-0.6660152077674866,
-0.9217057824134827,
-1.292639970779419,
-0.5282645225524902,
-1.1177271604537964,
-0.9321832060813904,
1.0173627138137817,
0.7932915091514587,
0.43345242738723755,
1.8398768901824951,
0.5848815441131592,
0.35625994205474854,
-2.7195210456848145,
0.8968212008476257,
0.28531166911125183,
-0.061417579650878906,
0.9064162969589233,
0.3370179831981659,
1.0320343971252441,
-0.05626261234283447,
0.6621289849281311,
-2.4159159660339355,
2.2729015350341797,
-0.15256449580192566,
0.6232372522354126,
-0.028093533590435982,
-0.2285543829202652,
1.1116464138031006,
0.5341112613677979,
0.45356905460357666,
-1.2126977443695068,
0.6719018220901489,
-0.5719404220581055,
1.1215133666992188,
0.8686313629150391,
-0.934180498123169,
0.009725257754325867,
1.3997339010238647,
0.5119024515151978,
-0.4996368885040283,
-0.899520993232727,
-0.9267265796661377,
0.9751957058906555,
1.6305243968963623,
-0.0377398282289505,
-0.06614959239959717,
0.9444680213928223,
0.6707217693328857,
-1.31620454788208,
0.19969692826271057,
-0.6704657673835754,
-0.6219049692153931,
1.6310195922851562,
1.9442778825759888,
-0.14044985175132751,
-0.1457175612449646,
-0.7055753469467163,
-1.1581250429153442,
0.718142032623291,
-0.0008985651656985283,
0.09508417546749115,
0.5417567491531372,
-0.6869722604751587,
1.099092960357666,
0.7936714291572571,
0.8916754722595215,
0.08954229205846786,
0.34973499178886414,
0.437507301568985,
-0.35590097308158875,
-1.145658016204834,
-0.33786681294441223,
-0.9916418790817261,
-2.610077142715454,
0.45289039611816406,
-0.2689560651779175,
-1.398077368736267,
-0.007469642907381058,
-1.0733177661895752,
0.9359637498855591,
-0.5965688824653625,
-1.1644197702407837,
-1.528243899345398,
0.23294098675251007,
0.005835957825183868,
0.9094350337982178,
-1.6343932151794434,
-0.13653336465358734,
1.1883940696716309,
0.8344906568527222,
-0.6359217166900635,
0.9947804808616638,
0.25479233264923096,
1.0168408155441284,
0.8403633832931519,
-0.3272295892238617,
0.5627529621124268,
0.08574262261390686,
-1.3486449718475342,
0.4697081446647644,
1.1918083429336548,
0.1640777438879013,
1.4351757764816284,
-0.5402096509933472,
0.11228649318218231,
0.39763614535331726,
-0.6609447002410889,
-0.5366637110710144,
-0.5396837592124939,
0.6603932976722717,
0.050245434045791626,
-0.9107567667961121,
-0.03789350390434265,
-0.049345336854457855,
-0.2406558096408844,
0.17683643102645874,
-1.5471128225326538,
-0.18781663477420807,
-0.3569713532924652,
-0.6054807901382446,
-1.2222133874893188,
-0.07798094302415848,
1.367732286453247,
-0.7083908319473267,
-0.25631505250930786,
0.5318053960800171,
0.33084192872047424,
0.49062880873680115,
0.594615638256073,
-0.6740756630897522,
-0.269922137260437,
-0.3152434229850769,
-0.36370253562927246,
0.3281751871109009,
1.3093757629394531,
-0.10295296460390091,
-0.9574870467185974,
0.7779077291488647,
-0.41320642828941345,
0.08533038198947906,
1.9537694454193115,
0.07878176122903824,
-0.768172562122345,
0.2830248475074768,
-0.6793204545974731,
1.899658441543579,
1.8147624731063843,
1.3691688776016235,
-0.10532976686954498,
-0.9598008990287781,
0.6253536939620972,
-0.33103129267692566,
-0.39735063910484314,
0.9374682903289795,
0.35365918278694153,
-0.2552782893180847,
-1.4027831554412842,
0.7283390760421753,
1.3477168083190918,
-0.9155437350273132,
-0.7710607051849365,
0.1465439647436142,
-0.8171024918556213,
1.1221683025360107,
0.5668977499008179,
0.2623887062072754,
0.2752506136894226,
1.6065400838851929,
0.7101918458938599,
-0.3682466447353363,
0.5762532949447632,
0.5033949613571167,
-0.11668884754180908,
-2.13289475440979,
-1.1726548671722412,
0.3940025269985199,
-0.5026237964630127,
-1.585331678390503,
1.3990757465362549,
-1.178464651107788,
-0.9792534708976746,
0.5608131885528564,
0.10059190541505814,
1.4739996194839478,
0.34115394949913025,
1.6442025899887085,
2.1229586601257324,
0.8614073991775513,
0.35849449038505554,
1.265771508216858,
-0.05860266089439392,
-0.45911476016044617,
1.8212453126907349,
-0.4481126666069031,
0.4862403869628906,
1.1493501663208008,
-0.34524521231651306,
-1.0472899675369263,
-0.7610039114952087,
-1.2819362878799438,
-0.670264720916748,
1.2022149562835693,
0.05027692764997482,
-1.0654053688049316,
0.2449089139699936,
1.6048229932785034,
0.056260883808135986,
-0.26802605390548706,
0.7347186207771301,
0.4120410978794098,
-0.8554090261459351,
-0.07160887867212296,
-0.8878272771835327,
0.5381397008895874,
-0.23398900032043457,
-0.37377306818962097,
0.30727246403694153,
0.4400062561035156,
1.3004765510559082,
-0.032250382006168365,
0.1393595039844513,
1.1478779315948486,
-1.4798457622528076,
1.5176715850830078,
-0.6818855404853821,
0.3232724666595459,
-2.448801279067993,
1.4098483324050903,
-0.7823773622512817,
1.946903109550476,
-2.535391330718994,
0.4673408567905426,
-0.5887161493301392,
-0.4577425718307495,
0.3067832291126251,
-0.37477609515190125,
0.07786431908607483,
-0.10048908740282059,
-1.138213038444519,
-0.018845658749341965,
-0.738040030002594,
0.6975334882736206,
1.1397093534469604,
1.430039882659912,
-1.1569777727127075,
-0.33779826760292053,
-1.7666417360305786,
-0.08965975046157837,
-0.640928328037262,
0.36095330119132996,
-1.943764567375183,
-0.1309843808412552,
-1.9216758012771606,
-2.4445579051971436,
-1.2921476364135742,
-0.7554457187652588,
1.0445443391799927,
0.06755390018224716,
-0.8661673665046692,
1.249424934387207,
-0.37920618057250977,
-1.8679145574569702,
1.1118818521499634,
-2.196014881134033
] |
https://github.com/huggingface/datasets/issues/6069 | KeyError: dataset has no key "image" | You can list the dataset's columns with `ds.column_names` before `.map` to check whether the dataset has an `image` column. If it doesn't, then this is a bug. Otherwise, please paste the line with the `.map` call.
| ### Describe the bug
I've loaded a local image dataset with:
`ds = laod_dataset("imagefolder", data_dir=path-to-data)`
And defined a transform to process the data, following the Datasets docs.
However, I get a keyError error, indicating there's no "image" key in my dataset. When I printed out the example_batch sent to the transformation function, it shows only the labels are being sent to the function.
For some reason, the images are not in the example batches.
### Steps to reproduce the bug
I'm using the latest stable version of datasets
### Expected behavior
I expect the example_batches to contain both images and labels
### Environment info
I'm using the latest stable version of datasets | 17 | 36 | KeyError: dataset has no key "image"
### Describe the bug
I've loaded a local image dataset with:
`ds = laod_dataset("imagefolder", data_dir=path-to-data)`
And defined a transform to process the data, following the Datasets docs.
However, I get a keyError error, indicating there's no "image" key in my dataset. When I printed out the example_batch sent to the transformation function, it shows only the labels are being sent to the function.
For some reason, the images are not in the example batches.
### Steps to reproduce the bug
I'm using the latest stable version of datasets
### Expected behavior
I expect the example_batches to contain both images and labels
### Environment info
I'm using the latest stable version of datasets
You can list the dataset's columns with `ds.column_names` before `.map` to check whether the dataset has an `image` column. If it doesn't, then this is a bug. Otherwise, please paste the line with the `.map` call.
| [
-1.17133367061615,
-0.9671884775161743,
-0.9597904086112976,
1.3718503713607788,
-0.1919693946838379,
-1.2990189790725708,
0.16572007536888123,
-1.1901322603225708,
1.7549738883972168,
-0.969964325428009,
0.27610474824905396,
-1.708359956741333,
0.08246801793575287,
-0.5398345589637756,
-0.706153929233551,
-0.9495611190795898,
-0.3414621949195862,
-0.7510542869567871,
1.001107096672058,
2.576221227645874,
1.1336803436279297,
-1.3365492820739746,
2.7054831981658936,
0.7257957458496094,
-0.10540841519832611,
-0.9627012610435486,
0.6217358708381653,
-0.10793594270944595,
-1.192529559135437,
-0.4351949691772461,
-0.9266275763511658,
-0.008450464345514774,
-0.5384441018104553,
-0.545267641544342,
-0.0457821860909462,
0.36693358421325684,
-0.3295103907585144,
-0.48003849387168884,
-0.5268958806991577,
-0.8868971467018127,
0.4290182292461395,
-0.4118172228336334,
1.0164655447006226,
-0.41145068407058716,
1.9148855209350586,
-0.4094085395336151,
0.4092038869857788,
0.781620979309082,
1.3408983945846558,
0.14164766669273376,
-0.006329881027340889,
0.2230878323316574,
0.4162255525588989,
0.022504668682813644,
0.32090404629707336,
0.9785491228103638,
0.556075394153595,
0.5840178728103638,
0.7297382950782776,
-2.270826578140259,
1.2525219917297363,
-1.0482686758041382,
0.287079393863678,
1.4030479192733765,
-0.9451649188995361,
0.33972206711769104,
-1.7361218929290771,
-0.07239121943712234,
0.5876610279083252,
-2.2171285152435303,
0.2355852723121643,
-1.2339085340499878,
-0.4683908224105835,
0.972304105758667,
0.34569481015205383,
-1.1831294298171997,
0.0946139395236969,
-0.38289421796798706,
1.0978361368179321,
0.5568019151687622,
1.1787055730819702,
-1.7322392463684082,
-0.058271728456020355,
-0.33473289012908936,
0.08691789209842682,
-1.4216212034225464,
-1.523978590965271,
0.5101463198661804,
0.6727948188781738,
0.5914025902748108,
-0.055051177740097046,
0.975202202796936,
-0.8888302445411682,
0.66400146484375,
-0.8825551867485046,
-1.7237253189086914,
-1.2578037977218628,
-2.2696352005004883,
-2.372797966003418,
0.726646900177002,
-0.4520286023616791,
-0.5588398575782776,
2.0297739505767822,
-1.0810538530349731,
-1.7526588439941406,
1.1943109035491943,
0.1938200443983078,
-0.03818012401461601,
2.4108335971832275,
0.23456068336963654,
-0.6626744866371155,
0.45644569396972656,
-0.7219120264053345,
0.8192589282989502,
-0.43989256024360657,
1.2695376873016357,
0.4991764724254608,
-1.0482532978057861,
1.6078590154647827,
-0.5252044200897217,
0.572536826133728,
-0.6588248610496521,
-0.40975111722946167,
-0.9293946623802185,
0.3258340656757355,
1.7891124486923218,
-0.319368839263916,
1.6065610647201538,
-0.36993083357810974,
-1.556734561920166,
-1.6441144943237305,
0.9025869369506836,
0.45144855976104736,
-0.782646656036377,
0.1870800405740738,
-0.24795083701610565,
0.11475329846143723,
-0.07663507014513016,
1.1343879699707031,
1.2209954261779785,
0.6660292148590088,
-0.32731860876083374,
-0.884376049041748,
0.2835472822189331,
-0.12155784666538239,
-0.7748939394950867,
-1.7618049383163452,
-0.3139440417289734,
0.08379096537828445,
0.7146629095077515,
-1.1877317428588867,
1.7057950496673584,
0.8288958668708801,
1.884993314743042,
1.0368295907974243,
-0.34485623240470886,
1.4667998552322388,
0.035225607454776764,
1.9328126907348633,
-0.4897834062576294,
0.7148158550262451,
-0.2987295091152191,
-1.1227903366088867,
0.8615630865097046,
-0.3352924585342407,
-2.0037171840667725,
-0.8839505910873413,
-0.8737770915031433,
-0.22190263867378235,
-0.7249599099159241,
0.9305211305618286,
-0.4264613687992096,
-1.3284180164337158,
0.35292673110961914,
-0.62557053565979,
0.06364596635103226,
-1.283942699432373,
0.34298574924468994,
0.6907849311828613,
-0.5947149395942688,
-0.028535492718219757,
-0.2696800231933594,
-1.3001106977462769,
-0.4583246111869812,
0.23872774839401245,
1.8882694244384766,
-0.755626380443573,
0.9850927591323853,
0.9734673500061035,
-0.7384496927261353,
-0.13407813012599945,
0.2636301517486572,
-0.30354928970336914,
0.8793269395828247,
-1.1112083196640015,
-0.5344064235687256,
1.188075304031372,
-0.27826133370399475,
-0.6537535190582275,
1.485206127166748,
0.6537100672721863,
-1.0805034637451172,
-0.13600018620491028,
-0.18161223828792572,
-0.9245836734771729,
0.08252653479576111,
-1.6576569080352783,
-0.15602466464042664,
0.32789602875709534,
-1.5159832239151,
-0.564611554145813,
-0.17399471998214722,
1.2586758136749268,
-0.14389550685882568,
1.3956109285354614,
-0.4413895010948181,
-0.29274019598960876,
-0.3899507224559784,
-0.3665097653865814,
0.19132350385189056,
-0.14079517126083374,
-0.6792939901351929,
0.13734641671180725,
-0.795643150806427,
0.3032822608947754,
1.3266433477401733,
0.35685399174690247,
0.10872698575258255,
0.5877314209938049,
1.0358467102050781,
0.3822730779647827,
-0.02056765742599964,
-0.9088057279586792,
-1.5322647094726562,
2.0133213996887207,
-1.4009464979171753,
1.8919025659561157,
0.7034560441970825,
-0.08028875291347504,
-1.8267987966537476,
-1.8058067560195923,
1.3953213691711426,
1.219870686531067,
2.150857925415039,
0.61896812915802,
0.45626315474510193,
-0.7663816809654236,
-0.680022120475769,
0.2929891049861908,
-1.037154197692871,
-0.7541900277137756,
0.13274186849594116,
2.325916051864624,
1.7377994060516357,
-0.42684227228164673,
-0.1600402146577835,
-1.0568101406097412,
1.2808136940002441,
-0.08404014259576797,
0.2126447707414627,
1.9803999662399292,
-0.3695097267627716,
-1.0920612812042236,
1.2063828706741333,
-2.252815008163452,
0.08534359931945801,
1.9821174144744873,
0.1831570714712143,
0.01504779327660799,
-1.3861750364303589,
-0.7295379042625427,
-0.20191392302513123,
-0.4134059548377991,
-1.2810460329055786,
0.529000997543335,
-0.3363432288169861,
-0.6569960117340088,
-1.4594923257827759,
0.24829956889152527,
-1.0787897109985352,
-1.6461302042007446,
0.1803857833147049,
1.9052610397338867,
2.066762685775757,
-0.714625895023346,
1.5556060075759888,
-0.2324947565793991,
0.25397488474845886,
1.2536629438400269,
1.1495157480239868,
3.087261915206909,
1.9381113052368164,
-1.3351112604141235,
0.7003053426742554,
0.00424398947507143,
-0.5068328976631165,
1.226087212562561,
-1.0991647243499756,
1.3332606554031372,
-0.14982366561889648,
-1.2008339166641235,
-1.2887266874313354,
0.8491401076316833,
0.4500053822994232,
0.08060502260923386,
-0.4262520968914032,
1.3451563119888306,
-0.09052371233701706,
1.301812767982483,
0.5798892378807068,
-0.43796059489250183,
0.6202942132949829,
-0.47839799523353577,
-0.5437460541725159,
1.5820244550704956,
0.23161041736602783,
-1.3738813400268555,
-2.347836494445801,
-0.3135007917881012,
-0.7705928087234497,
0.0550125390291214,
-0.5760089755058289,
-0.9452297687530518,
1.6678707599639893,
0.4174719750881195,
-1.1306816339492798,
-0.3722854256629944,
-0.40546345710754395,
-0.7032206654548645,
2.6576082706451416,
-1.4657316207885742,
-0.24333059787750244,
-0.9753686189651489,
-0.6680848598480225,
1.5764057636260986,
-1.2856800556182861,
-0.2150939553976059,
-1.0355144739151,
-0.5610566139221191,
-1.4012773036956787,
-0.5074103474617004,
-0.006886810529977083,
-0.9793336987495422,
0.9619913101196289,
0.20202697813510895,
-1.0628060102462769,
-0.1570199728012085,
-0.9124230146408081,
0.7804288268089294,
-0.18466393649578094,
0.31943458318710327,
1.9061118364334106,
0.5055373311042786,
-0.41235920786857605,
0.6782684326171875,
1.1453505754470825,
0.6671269536018372,
-0.6853367686271667,
0.1885152906179428,
-0.817145049571991,
0.2405506670475006,
-1.1577345132827759,
0.2549036145210266,
-2.818092107772827,
0.5783221125602722,
-0.06591635942459106,
-0.0571071021258831,
0.045582856982946396,
-1.2830078601837158,
0.9535842537879944,
2.5975141525268555,
-1.2787903547286987,
0.4730784296989441,
0.25083205103874207,
1.316194772720337,
-1.633347988128662,
0.3668023347854614,
-0.3519243896007538,
2.106874465942383,
0.22120536863803864,
1.1395879983901978,
-0.4334176480770111,
-2.2302234172821045,
0.6780554056167603,
-1.256903886795044,
-1.3096007108688354,
0.8433524966239929,
-0.7936291098594666,
0.029393229633569717,
-1.472247838973999,
-0.24877119064331055,
-0.7812214493751526,
-1.3178595304489136,
0.761279284954071,
0.15150794386863708,
0.5285516381263733,
-0.5627361536026001,
0.27937594056129456,
-2.216520309448242,
-1.4096564054489136,
-0.22294475138187408,
-0.9193025827407837,
0.39124271273612976,
-0.3399850130081177,
0.7645223140716553,
-0.24978725612163544,
0.15432317554950714,
0.3597269058227539,
1.40789794921875,
3.612074136734009,
0.34403976798057556,
0.3762441873550415,
-0.11604844778776169,
-0.9168594479560852,
1.461918830871582,
0.941592276096344,
-0.13713346421718597,
-0.49638810753822327,
-1.017823576927185,
1.2078300714492798,
1.990455985069275,
0.9662162661552429,
0.13270099461078644,
-0.7370306849479675,
-0.5139939785003662,
-0.04364318028092384,
0.17876483500003815,
0.46921443939208984,
0.8654741048812866,
0.06609200686216354,
0.08920315653085709,
1.5098997354507446,
1.1404796838760376,
-0.3575077950954437,
0.4204089939594269,
-0.7401086688041687,
-0.4674737751483917,
0.6620923280715942,
0.33532050251960754,
0.018261749297380447,
0.3396034836769104,
-0.9482625722885132,
-0.24741990864276886,
-0.5020020604133606,
-0.9920036196708679,
-0.6330535411834717,
-0.4502793848514557,
-0.3122738003730774,
1.5773206949234009,
0.14115770161151886,
-0.5475481152534485,
-0.13945777714252472,
-0.7558923363685608,
-0.12533226609230042,
-1.0757368803024292,
0.12919241189956665,
-0.22030875086784363,
-0.21209315955638885,
-0.036336030811071396,
1.7561231851577759,
-0.9758755564689636,
-2.070350408554077,
0.231466606259346,
0.28475460410118103,
-0.27357447147369385,
0.2748149335384369,
1.618691086769104,
0.47932231426239014,
1.4461396932601929,
1.3654193878173828,
0.9216713905334473,
-0.7873765826225281,
-1.3101556301116943,
0.6187462210655212,
0.9508850574493408,
-1.3936642408370972,
0.7419352531433105,
0.06454925984144211,
-0.6138707399368286,
0.7252562642097473,
1.2562193870544434,
0.4607906937599182,
-1.938795566558838,
0.8022234439849854,
-0.9247692823410034,
0.7881272435188293,
0.6916199922561646,
0.7232520580291748,
0.16858743131160736,
0.8403242230415344,
-1.19921875,
-1.1223188638687134,
-0.7610493898391724,
-0.6374256610870361,
1.9868067502975464,
-0.2467067688703537,
0.6076938509941101,
-0.17728692293167114,
-1.2792620658874512,
-0.04742148891091347,
0.6964204907417297,
0.33837053179740906,
-0.32775378227233887,
0.6989043354988098,
-0.720722496509552,
-1.039717435836792,
-1.5140812397003174,
-0.3946808874607086,
-1.0544458627700806,
-0.9003653526306152,
1.1216044425964355,
0.8435494303703308,
0.2010824978351593,
1.823788046836853,
0.6981688737869263,
0.16385819017887115,
-2.5519392490386963,
0.8501743078231812,
0.29626333713531494,
0.008023957721889019,
0.850845456123352,
0.31115829944610596,
1.0663034915924072,
-0.05002940073609352,
0.48289263248443604,
-2.3069229125976562,
2.2305703163146973,
-0.3558896780014038,
0.6164165735244751,
-0.03514175862073898,
-0.21896474063396454,
1.1391186714172363,
0.4896602928638458,
0.5911567807197571,
-1.0365803241729736,
0.6974726319313049,
-0.6060482859611511,
1.1753836870193481,
1.0084501504898071,
-0.8667058944702148,
-0.0707731693983078,
1.3840084075927734,
0.5679836273193359,
-0.5120699405670166,
-0.877886950969696,
-0.9669672846794128,
0.9345646500587463,
1.7893849611282349,
-0.05962976813316345,
-0.0054334006272256374,
0.8010329008102417,
0.6158174276351929,
-1.3175535202026367,
0.14031121134757996,
-0.7919760346412659,
-0.7814602851867676,
1.6745656728744507,
2.0290913581848145,
-0.13290788233280182,
-0.1680530607700348,
-0.7990145683288574,
-1.2454339265823364,
0.8407266139984131,
0.05473688989877701,
0.11524102836847305,
0.702813446521759,
-0.6647385954856873,
1.0327054262161255,
0.9307737350463867,
0.9567893743515015,
0.252050518989563,
0.289801687002182,
0.41865429282188416,
-0.2811817526817322,
-1.0211514234542847,
-0.19421152770519257,
-1.0634584426879883,
-2.4667365550994873,
0.5212450623512268,
-0.32708078622817993,
-1.473809838294983,
-0.035622064024209976,
-0.9211487174034119,
1.0345098972320557,
-0.5011645555496216,
-1.0606160163879395,
-1.5652422904968262,
0.29847145080566406,
-0.07636603713035583,
0.8994706273078918,
-1.5733921527862549,
-0.08538354188203812,
1.3568339347839355,
0.9741918444633484,
-0.7229355573654175,
1.0551377534866333,
0.16881319880485535,
1.035220980644226,
0.7429008483886719,
-0.43873751163482666,
0.4390879273414612,
-0.008306966163218021,
-1.3719416856765747,
0.4940955340862274,
1.037419080734253,
0.20190595090389252,
1.478476881980896,
-0.5298686623573303,
0.032458700239658356,
0.339417427778244,
-0.381973534822464,
-0.5605394840240479,
-0.5806567072868347,
0.716644823551178,
0.06801049411296844,
-0.7615117430686951,
0.1512778401374817,
-0.04343150556087494,
-0.3119453191757202,
0.20588496327400208,
-1.419695496559143,
-0.19367723166942596,
-0.4213763475418091,
-0.6560876965522766,
-1.247096300125122,
-0.07848764210939407,
1.4206509590148926,
-0.7063394784927368,
-0.19794538617134094,
0.5573899745941162,
0.5164132714271545,
0.4647786319255829,
0.6047331690788269,
-0.6338474154472351,
-0.2905898690223694,
-0.33766618371009827,
-0.3015965223312378,
0.31284189224243164,
1.3410429954528809,
-0.22704602777957916,
-1.022943139076233,
0.7486234903335571,
-0.2994247078895569,
0.05891842395067215,
1.870989441871643,
0.14761081337928772,
-0.7849798202514648,
0.22445467114448547,
-0.7432578206062317,
1.9345357418060303,
1.7376091480255127,
1.4198827743530273,
-0.04398123919963837,
-0.9811376333236694,
0.5864952206611633,
-0.24642057716846466,
-0.36430031061172485,
1.0280207395553589,
0.4784970283508301,
-0.08958189189434052,
-1.3553850650787354,
0.7228286266326904,
1.2123346328735352,
-0.8996391296386719,
-0.85012286901474,
0.039177361875772476,
-0.7637192010879517,
1.0942484140396118,
0.6960570216178894,
0.5191282629966736,
0.28660833835601807,
1.64413583278656,
0.6709526181221008,
-0.5940446853637695,
0.5223284363746643,
0.5062876343727112,
-0.13867658376693726,
-2.0567219257354736,
-1.1550531387329102,
0.384120374917984,
-0.5084260702133179,
-1.617220401763916,
1.4291592836380005,
-1.1328235864639282,
-0.8963597416877747,
0.5439198613166809,
0.14773528277873993,
1.4199267625808716,
0.3246177136898041,
1.5657082796096802,
2.0476231575012207,
0.8645638227462769,
0.32398056983947754,
1.3589870929718018,
-0.1969512701034546,
-0.3815149664878845,
1.833980917930603,
-0.36193448305130005,
0.4108961224555969,
1.1004047393798828,
-0.3890051543712616,
-0.9916788339614868,
-0.7165113091468811,
-1.1300872564315796,
-0.5980016589164734,
1.1152597665786743,
0.09415019303560257,
-1.0534688234329224,
0.17295442521572113,
1.5312004089355469,
0.1235540360212326,
-0.36193370819091797,
0.6853290796279907,
0.5080857276916504,
-0.8112942576408386,
-0.025126762688159943,
-0.9523976445198059,
0.5481646656990051,
-0.21260012686252594,
-0.3312751352787018,
0.4268477261066437,
0.434566468000412,
1.3545963764190674,
-0.08464022725820541,
0.19404397904872894,
1.2773849964141846,
-1.3227989673614502,
1.4525316953659058,
-0.6440067887306213,
0.17171688377857208,
-2.4059507846832275,
1.3230468034744263,
-0.7164851427078247,
1.8936794996261597,
-2.652022123336792,
0.35881859064102173,
-0.6739225387573242,
-0.2768138349056244,
0.3450492322444916,
-0.37305083870887756,
0.08948960155248642,
-0.19246608018875122,
-1.1297471523284912,
-0.03623548895120621,
-0.7302300930023193,
0.6114293932914734,
1.2020008563995361,
1.3743356466293335,
-1.1073318719863892,
-0.2309754490852356,
-1.76022469997406,
-0.1818356066942215,
-0.6980052590370178,
0.38392385840415955,
-1.994249939918518,
-0.23898853361606598,
-1.919569730758667,
-2.5223217010498047,
-1.3706244230270386,
-0.7556517124176025,
1.1488269567489624,
0.1629444807767868,
-0.9674549102783203,
1.1483103036880493,
-0.3953922986984253,
-1.9117090702056885,
1.1431899070739746,
-2.1586859226226807
] |
https://github.com/huggingface/datasets/issues/6069 | KeyError: dataset has no key "image" | This is the piece of code I am running:
```
data_transforms = utils.get_data_augmentation(args)
image_dataset = utils.load_image_dataset(args.dataset)
def resize(examples):
examples["pixel_values"] = [image.convert("RGB").resize((300, 300)) for image in examples["image"]]
return examples
def preprocess_train(example_batch):
print(f"Example batch: \n{example_batch}")
example_batch["pixel_values"] = [
data_transforms["train"](image.convert("RGB")) for image in example_batch["pixel_values"]
]
return example_batch
def preprocess_val(example_batch):
example_batch["pixel_values"] = [
data_transforms["val"](image.convert("RGB")) for image in example_batch["pixel_values"]
]
return example_batch
image_dataset = image_dataset.map(resize, remove_columns=["image"], batched=True)
image_dataset["train"].set_transform(preprocess_train)
image_dataset["validation"].set_transform(preprocess_val)
```
When I print ds.column_names I get the following
`{'train': ['image', 'label'], 'validation': ['image', 'label'], 'test': ['image', 'label']}`
The `print(f"Example batch: \n{example_batch}")` in the `preprocess_train` function outputs only labels without images:
```
Example batch:
{'label': [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3]}
```
The weird part of it all is that a sample code runs in a jupyter lab notebook without any bugs, but when I run my scripts from the terminal I get the bug. The same code. | ### Describe the bug
I've loaded a local image dataset with:
`ds = laod_dataset("imagefolder", data_dir=path-to-data)`
And defined a transform to process the data, following the Datasets docs.
However, I get a keyError error, indicating there's no "image" key in my dataset. When I printed out the example_batch sent to the transformation function, it shows only the labels are being sent to the function.
For some reason, the images are not in the example batches.
### Steps to reproduce the bug
I'm using the latest stable version of datasets
### Expected behavior
I expect the example_batches to contain both images and labels
### Environment info
I'm using the latest stable version of datasets | 17 | 1,035 | KeyError: dataset has no key "image"
### Describe the bug
I've loaded a local image dataset with:
`ds = laod_dataset("imagefolder", data_dir=path-to-data)`
And defined a transform to process the data, following the Datasets docs.
However, I get a keyError error, indicating there's no "image" key in my dataset. When I printed out the example_batch sent to the transformation function, it shows only the labels are being sent to the function.
For some reason, the images are not in the example batches.
### Steps to reproduce the bug
I'm using the latest stable version of datasets
### Expected behavior
I expect the example_batches to contain both images and labels
### Environment info
I'm using the latest stable version of datasets
This is the piece of code I am running:
```
data_transforms = utils.get_data_augmentation(args)
image_dataset = utils.load_image_dataset(args.dataset)
def resize(examples):
examples["pixel_values"] = [image.convert("RGB").resize((300, 300)) for image in examples["image"]]
return examples
def preprocess_train(example_batch):
print(f"Example batch: \n{example_batch}")
example_batch["pixel_values"] = [
data_transforms["train"](image.convert("RGB")) for image in example_batch["pixel_values"]
]
return example_batch
def preprocess_val(example_batch):
example_batch["pixel_values"] = [
data_transforms["val"](image.convert("RGB")) for image in example_batch["pixel_values"]
]
return example_batch
image_dataset = image_dataset.map(resize, remove_columns=["image"], batched=True)
image_dataset["train"].set_transform(preprocess_train)
image_dataset["validation"].set_transform(preprocess_val)
```
When I print ds.column_names I get the following
`{'train': ['image', 'label'], 'validation': ['image', 'label'], 'test': ['image', 'label']}`
The `print(f"Example batch: \n{example_batch}")` in the `preprocess_train` function outputs only labels without images:
```
Example batch:
{'label': [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3]}
```
The weird part of it all is that a sample code runs in a jupyter lab notebook without any bugs, but when I run my scripts from the terminal I get the bug. The same code. | [
-1.32200288772583,
-0.9935063719749451,
-0.7597574591636658,
1.4973571300506592,
-0.1484074741601944,
-1.2504184246063232,
0.17417672276496887,
-1.1684865951538086,
1.676836371421814,
-0.8942831754684448,
0.34366580843925476,
-1.6277977228164673,
0.02760835736989975,
-0.595337450504303,
-0.7549809217453003,
-0.9617453813552856,
-0.3615272045135498,
-0.7153549790382385,
1.1563044786453247,
2.4337575435638428,
1.2245985269546509,
-1.3397986888885498,
2.8036139011383057,
0.7477515935897827,
-0.14225569367408752,
-0.9857285618782043,
0.5699177384376526,
-0.005357904359698296,
-1.2369924783706665,
-0.48542413115501404,
-0.9487560987472534,
-0.02115122228860855,
-0.5049024820327759,
-0.41575896739959717,
-0.07255478948354721,
0.4051506519317627,
-0.30828288197517395,
-0.5573874115943909,
-0.6815981268882751,
-0.7656100988388062,
0.39006319642066956,
-0.3894035518169403,
0.9668353199958801,
-0.37822425365448,
1.8766236305236816,
-0.6142939329147339,
0.4652569890022278,
0.7767666578292847,
1.3072071075439453,
0.21946240961551666,
0.071721151471138,
0.3346967101097107,
0.4105490446090698,
-0.08301603049039841,
0.48971304297447205,
1.166818380355835,
0.6094017624855042,
0.5053261518478394,
0.7924914360046387,
-2.228973388671875,
1.2275104522705078,
-1.0700277090072632,
0.28812652826309204,
1.3492703437805176,
-0.8822406530380249,
0.34583061933517456,
-1.6776338815689087,
-0.06382092088460922,
0.7137361764907837,
-2.1965765953063965,
0.33238595724105835,
-1.3158537149429321,
-0.5655530691146851,
0.9878942370414734,
0.43395182490348816,
-1.1174209117889404,
0.11503869295120239,
-0.49134254455566406,
1.0824319124221802,
0.3890218734741211,
1.0949537754058838,
-1.6421301364898682,
-0.04493258520960808,
-0.26204782724380493,
0.07850703597068787,
-1.2949467897415161,
-1.5817155838012695,
0.5819595456123352,
0.5997764468193054,
0.5904183387756348,
-0.1352350413799286,
1.108616590499878,
-1.0874474048614502,
0.786742091178894,
-1.011566400527954,
-1.711814284324646,
-1.4476191997528076,
-2.293522596359253,
-2.2221763134002686,
0.6891267895698547,
-0.48497870564460754,
-0.5715678334236145,
2.0749905109405518,
-0.9872743487358093,
-1.6707831621170044,
1.193830132484436,
0.2476622611284256,
0.0433267317712307,
2.4274258613586426,
0.24659641087055206,
-0.6980528831481934,
0.5381906628608704,
-0.7470848560333252,
0.819193959236145,
-0.30229195952415466,
1.2528008222579956,
0.3406025767326355,
-0.982877254486084,
1.540136456489563,
-0.3714441955089569,
0.6485644578933716,
-0.585490345954895,
-0.430418461561203,
-0.8268729448318481,
0.3209628760814667,
1.7741520404815674,
-0.24566785991191864,
1.5780576467514038,
-0.3567369878292084,
-1.607645869255066,
-1.744858980178833,
0.871891975402832,
0.4708828628063202,
-0.7232771515846252,
0.08772154152393341,
-0.40038877725601196,
0.15803003311157227,
-0.1018662303686142,
1.3004320859909058,
1.3108611106872559,
0.7414987087249756,
-0.4829462468624115,
-0.8000015020370483,
0.11928469687700272,
-0.04732164740562439,
-0.8466143608093262,
-1.6812225580215454,
-0.3711104989051819,
0.2032640278339386,
0.6242696642875671,
-1.2303292751312256,
1.7676258087158203,
0.9254854321479797,
1.8572568893432617,
1.0719172954559326,
-0.3732896149158478,
1.4528051614761353,
0.08782456070184708,
1.800287127494812,
-0.5349398851394653,
0.6339080929756165,
-0.2511897385120392,
-1.1352505683898926,
0.800294041633606,
-0.31544533371925354,
-2.0440590381622314,
-1.0041877031326294,
-0.6863632798194885,
-0.18555350601673126,
-0.7171522378921509,
0.8641453981399536,
-0.43640902638435364,
-1.3962205648422241,
0.21459853649139404,
-0.7294276356697083,
0.04916359484195709,
-1.1622159481048584,
0.22735494375228882,
0.6219590306282043,
-0.6524142026901245,
0.06907819956541061,
-0.11416874080896378,
-1.3041579723358154,
-0.35909149050712585,
0.20267727971076965,
1.9477835893630981,
-0.7166976928710938,
0.9356309175491333,
1.0931283235549927,
-0.7087998390197754,
-0.008559166453778744,
0.18546998500823975,
-0.34274426102638245,
0.878774881362915,
-1.066840410232544,
-0.5789669752120972,
1.2487056255340576,
-0.21187636256217957,
-0.6271354556083679,
1.590315580368042,
0.6619406342506409,
-1.0424145460128784,
-0.2675149142742157,
-0.06811825931072235,
-0.8609877228736877,
0.020522672683000565,
-1.5437299013137817,
-0.15586622059345245,
0.4849940240383148,
-1.5419193506240845,
-0.5065261721611023,
-0.18010810017585754,
1.2770097255706787,
-0.2058097869157791,
1.4243125915527344,
-0.4407418370246887,
-0.17276011407375336,
-0.2962481677532196,
-0.40002232789993286,
0.18986696004867554,
-0.17491698265075684,
-0.6939389109611511,
0.07850921899080276,
-0.8197840452194214,
0.3523601293563843,
1.4506049156188965,
0.41354283690452576,
0.11261171102523804,
0.4532703161239624,
1.1068024635314941,
0.3872695565223694,
-0.02006254531443119,
-0.8632779121398926,
-1.5252965688705444,
1.9621115922927856,
-1.4357327222824097,
1.9932007789611816,
0.7963418364524841,
-0.12672226130962372,
-1.847668170928955,
-1.8493024110794067,
1.3132261037826538,
1.1931750774383545,
2.269911527633667,
0.41323035955429077,
0.39749497175216675,
-0.8276918530464172,
-0.7324581146240234,
0.28784891963005066,
-1.01736319065094,
-0.6199508309364319,
0.2340030074119568,
2.334286689758301,
1.8533951044082642,
-0.3973951041698456,
-0.11928273737430573,
-0.9847295880317688,
1.3597941398620605,
-0.23111839592456818,
0.27830907702445984,
1.941483974456787,
-0.2778418958187103,
-1.0433180332183838,
1.347650170326233,
-2.2593255043029785,
0.12838056683540344,
1.994091272354126,
0.2779148519039154,
0.03300091624259949,
-1.2742865085601807,
-0.5684598088264465,
-0.4652937054634094,
-0.3763725757598877,
-1.2265644073486328,
0.5499334335327148,
-0.24397103488445282,
-0.7991776466369629,
-1.3272793292999268,
0.13581207394599915,
-1.1072776317596436,
-1.6540974378585815,
0.2617245316505432,
1.8702468872070312,
2.1030893325805664,
-0.8194082975387573,
1.5861358642578125,
-0.3388324975967407,
0.11435811966657639,
1.090417742729187,
1.2374390363693237,
3.0489375591278076,
1.8031773567199707,
-1.32355535030365,
0.5584592819213867,
-0.15885032713413239,
-0.49709007143974304,
1.131735920906067,
-1.2127045392990112,
1.4224436283111572,
-0.08349694311618805,
-1.1885265111923218,
-1.2433491945266724,
1.043783187866211,
0.47869178652763367,
0.024477627128362656,
-0.5007179975509644,
1.1810518503189087,
0.01438406202942133,
1.3808577060699463,
0.6243520379066467,
-0.3633972108364105,
0.6067363619804382,
-0.4360937476158142,
-0.5635203123092651,
1.4921519756317139,
0.12057942897081375,
-1.5240932703018188,
-2.1897425651550293,
-0.2300342321395874,
-0.8337308764457703,
0.11804793030023575,
-0.6258479952812195,
-1.0588483810424805,
1.6973117589950562,
0.2722190320491791,
-1.2690812349319458,
-0.36856749653816223,
-0.41387656331062317,
-0.6450517773628235,
2.7750284671783447,
-1.243848204612732,
-0.198668971657753,
-0.9317384958267212,
-0.7020172476768494,
1.604265570640564,
-1.1802620887756348,
-0.20567479729652405,
-1.0188838243484497,
-0.5566931962966919,
-1.327011227607727,
-0.5037631988525391,
0.10599858313798904,
-1.0085663795471191,
0.911078691482544,
0.1507561355829239,
-1.0619181394577026,
-0.3329883813858032,
-0.86076420545578,
0.9622551798820496,
-0.24973002076148987,
0.15694604814052582,
1.8897004127502441,
0.3750573694705963,
-0.33073124289512634,
0.8372148275375366,
1.2440056800842285,
0.70142662525177,
-0.6602407097816467,
0.05075791850686073,
-0.7166978120803833,
0.3119843602180481,
-1.2119649648666382,
0.22744345664978027,
-2.8197011947631836,
0.6266904473304749,
-0.024430204182863235,
-0.08740794658660889,
0.07478801906108856,
-1.2750324010849,
1.0339354276657104,
2.624598503112793,
-1.2672183513641357,
0.4924260675907135,
0.3443443477153778,
1.1639374494552612,
-1.610426664352417,
0.3017783761024475,
-0.4522251784801483,
2.0371251106262207,
0.20949015021324158,
1.2392107248306274,
-0.5087475776672363,
-2.1185717582702637,
0.7810633182525635,
-1.2881619930267334,
-1.2262095212936401,
0.7900058627128601,
-1.0134423971176147,
0.35552242398262024,
-1.4748457670211792,
-0.36739209294319153,
-0.8506283760070801,
-1.1367764472961426,
0.5533140301704407,
0.11681833118200302,
0.3424437344074249,
-0.4885921776294708,
0.26887407898902893,
-2.274141550064087,
-1.4451887607574463,
-0.21441952884197235,
-1.0035077333450317,
0.5808043479919434,
-0.4850071668624878,
0.7461572289466858,
-0.1682639718055725,
0.06628239899873734,
0.36722832918167114,
1.4607939720153809,
3.472224473953247,
0.32368287444114685,
0.24698792397975922,
-0.18701812624931335,
-0.9263452291488647,
1.4263187646865845,
0.8701736927032471,
-0.12609416246414185,
-0.48623546957969666,
-1.0899720191955566,
1.2937783002853394,
1.9420064687728882,
0.9699433445930481,
0.002857200801372528,
-0.8500108122825623,
-0.6676489114761353,
-0.09364053606987,
0.14892198145389557,
0.4257274270057678,
0.8287645578384399,
0.03313809260725975,
0.15237407386302948,
1.5843870639801025,
1.1282711029052734,
-0.42115697264671326,
0.3171271085739136,
-0.8498275279998779,
-0.5456227660179138,
0.5615816116333008,
0.2314000129699707,
-0.0002833930775523186,
0.4136633574962616,
-1.0032079219818115,
-0.25458377599716187,
-0.5107152462005615,
-0.7839317321777344,
-0.594618022441864,
-0.35710954666137695,
-0.3434517979621887,
1.5474693775177002,
0.10890162736177444,
-0.5500428676605225,
-0.0622408390045166,
-0.7287602424621582,
-0.17180462181568146,
-1.0654939413070679,
0.188008651137352,
-0.08512619137763977,
-0.16727717220783234,
-0.22702986001968384,
1.7462040185928345,
-0.9318197965621948,
-1.9904533624649048,
0.15096671879291534,
0.2789503335952759,
-0.1922946572303772,
0.21156246960163116,
1.6731399297714233,
0.5327841639518738,
1.4688841104507446,
1.2671360969543457,
0.8237615823745728,
-0.7449976801872253,
-1.242655634880066,
0.6059844493865967,
0.9414424896240234,
-1.2546252012252808,
0.79154372215271,
-0.15112529695034027,
-0.575880229473114,
0.6558213829994202,
1.2883009910583496,
0.4900745451450348,
-1.9245781898498535,
0.8831894397735596,
-1.0249300003051758,
0.8855055570602417,
0.6784952282905579,
0.6185740232467651,
0.13824555277824402,
0.923484742641449,
-1.1201692819595337,
-1.131229281425476,
-0.7426800727844238,
-0.7217855453491211,
2.023094654083252,
-0.32882219552993774,
0.6156739592552185,
-0.30621615052223206,
-1.242126703262329,
-0.054970499128103256,
0.6082505583763123,
0.3537147343158722,
-0.40836063027381897,
0.7783010005950928,
-0.673926830291748,
-0.9879872798919678,
-1.4049174785614014,
-0.283754825592041,
-1.070666790008545,
-0.96391761302948,
1.117658257484436,
0.7430063486099243,
0.2821856439113617,
1.8598709106445312,
0.713411808013916,
0.2802862226963043,
-2.5201103687286377,
0.8920331597328186,
0.23121176660060883,
-0.08247619867324829,
0.831182062625885,
0.39086830615997314,
1.0233089923858643,
0.009864416904747486,
0.362583726644516,
-2.373856782913208,
2.2509264945983887,
-0.2748953104019165,
0.6826545000076294,
-0.11131322383880615,
-0.17539680004119873,
1.2057989835739136,
0.5999176502227783,
0.5357890725135803,
-0.9680323004722595,
0.582922101020813,
-0.393513947725296,
1.196418046951294,
0.912212610244751,
-0.7695685625076294,
-0.040202781558036804,
1.4430832862854004,
0.5088538527488708,
-0.5550251007080078,
-1.0030338764190674,
-0.875206470489502,
0.9971492886543274,
1.6871023178100586,
-0.005920453928411007,
-0.03021293133497238,
0.758058488368988,
0.6012905240058899,
-1.255530595779419,
0.03569922596216202,
-0.7745970487594604,
-0.7446670532226562,
1.68252432346344,
2.1875369548797607,
-0.22186221182346344,
-0.20437879860401154,
-0.6301231980323792,
-1.3051272630691528,
0.829322874546051,
-0.20956747233867645,
0.21379536390304565,
0.6465954780578613,
-0.6772953271865845,
1.0198891162872314,
0.8529029488563538,
0.9209989309310913,
0.20386570692062378,
0.18133556842803955,
0.42219048738479614,
-0.2778196334838867,
-1.170204758644104,
-0.21104612946510315,
-1.0021222829818726,
-2.4353737831115723,
0.3148350715637207,
-0.20732364058494568,
-1.449038028717041,
-0.03742394968867302,
-0.9503377079963684,
1.0817326307296753,
-0.5145012140274048,
-0.9842121601104736,
-1.5672636032104492,
0.25288906693458557,
0.03639257326722145,
1.0065398216247559,
-1.5422455072402954,
-0.2873195707798004,
1.1874786615371704,
0.8975549936294556,
-0.7143856883049011,
0.9846531748771667,
0.184390589594841,
1.0280166864395142,
0.7371724247932434,
-0.4366697371006012,
0.46674174070358276,
-0.07432708144187927,
-1.3595097064971924,
0.4459612965583801,
1.1207400560379028,
0.20625071227550507,
1.5465304851531982,
-0.3920820355415344,
0.04851550981402397,
0.38329389691352844,
-0.5641327500343323,
-0.5125707983970642,
-0.4105992913246155,
0.6058165431022644,
-0.005783365108072758,
-0.8546363115310669,
-0.08826673030853271,
-0.06917667388916016,
-0.37801533937454224,
0.2373560518026352,
-1.4335355758666992,
-0.06899501383304596,
-0.4673228859901428,
-0.6932662129402161,
-1.1857608556747437,
-0.048532575368881226,
1.4212045669555664,
-0.8271508812904358,
-0.24014930427074432,
0.49852821230888367,
0.36093923449516296,
0.5796162486076355,
0.6934453248977661,
-0.7197914719581604,
-0.20456774532794952,
-0.27690595388412476,
-0.27719393372535706,
0.34380272030830383,
1.400185465812683,
-0.14172181487083435,
-0.934913158416748,
0.6563848257064819,
-0.30365267395973206,
0.07000687718391418,
1.9458726644515991,
0.1438014656305313,
-0.6581496000289917,
0.3047959506511688,
-0.8313530087471008,
1.8944820165634155,
1.6920772790908813,
1.3882756233215332,
-0.10480097681283951,
-0.9324712753295898,
0.5794863700866699,
-0.3030206859111786,
-0.4183385670185089,
0.854278028011322,
0.3493356704711914,
-0.18950912356376648,
-1.4693045616149902,
0.8588505387306213,
1.19511878490448,
-0.8938280344009399,
-0.7233487963676453,
0.15334223210811615,
-0.7832848429679871,
1.151631474494934,
0.5689712762832642,
0.48300057649612427,
0.37074318528175354,
1.6566667556762695,
0.8321512341499329,
-0.5064520835876465,
0.41780582070350647,
0.6389927268028259,
-0.1586458683013916,
-2.1070189476013184,
-1.19504714012146,
0.30703306198120117,
-0.6022427678108215,
-1.6353816986083984,
1.4138532876968384,
-1.1296104192733765,
-1.0561846494674683,
0.6295404434204102,
0.052597109228372574,
1.3394966125488281,
0.4096202552318573,
1.5460959672927856,
2.077540874481201,
0.8413578867912292,
0.4382825791835785,
1.2407031059265137,
-0.1672302633523941,
-0.4507628381252289,
1.8762707710266113,
-0.4086918532848358,
0.3788471519947052,
1.0335593223571777,
-0.3387744724750519,
-1.1053096055984497,
-0.6804349422454834,
-1.2582627534866333,
-0.7917503118515015,
1.1359636783599854,
0.025601554661989212,
-1.0323470830917358,
0.18220141530036926,
1.5786184072494507,
0.14128056168556213,
-0.40031594038009644,
0.6805248260498047,
0.4453445076942444,
-0.785821259021759,
-0.03192952647805214,
-0.897585928440094,
0.5724384188652039,
-0.16347414255142212,
-0.33507537841796875,
0.2834409177303314,
0.41548478603363037,
1.4911885261535645,
-0.14421814680099487,
0.12869198620319366,
1.0938870906829834,
-1.4035450220108032,
1.4553931951522827,
-0.6259013414382935,
0.25575971603393555,
-2.40372896194458,
1.3743635416030884,
-0.7357022166252136,
1.9512313604354858,
-2.711371421813965,
0.567987859249115,
-0.6633942723274231,
-0.42388826608657837,
0.2676268517971039,
-0.3463505208492279,
0.11703584343194962,
-0.1178051009774208,
-1.1796951293945312,
-0.0017234641127288342,
-0.5941561460494995,
0.6800044178962708,
1.196908950805664,
1.396846055984497,
-1.1266460418701172,
-0.27288785576820374,
-1.6831011772155762,
-0.09546733647584915,
-0.8158230781555176,
0.300730437040329,
-2.0007548332214355,
-0.2627889811992645,
-1.8298598527908325,
-2.4343156814575195,
-1.3187445402145386,
-0.7276159524917603,
1.1616086959838867,
0.19402669370174408,
-0.9959649443626404,
1.3206099271774292,
-0.470553994178772,
-1.938821792602539,
1.1791480779647827,
-2.1777396202087402
] |
https://github.com/huggingface/datasets/issues/6069 | KeyError: dataset has no key "image" | The `remove_columns=["image"]` argument in the `.map` call removes the `image` column from the output, so drop this argument to preserve it. | ### Describe the bug
I've loaded a local image dataset with:
`ds = laod_dataset("imagefolder", data_dir=path-to-data)`
And defined a transform to process the data, following the Datasets docs.
However, I get a keyError error, indicating there's no "image" key in my dataset. When I printed out the example_batch sent to the transformation function, it shows only the labels are being sent to the function.
For some reason, the images are not in the example batches.
### Steps to reproduce the bug
I'm using the latest stable version of datasets
### Expected behavior
I expect the example_batches to contain both images and labels
### Environment info
I'm using the latest stable version of datasets | 17 | 21 | KeyError: dataset has no key "image"
### Describe the bug
I've loaded a local image dataset with:
`ds = laod_dataset("imagefolder", data_dir=path-to-data)`
And defined a transform to process the data, following the Datasets docs.
However, I get a keyError error, indicating there's no "image" key in my dataset. When I printed out the example_batch sent to the transformation function, it shows only the labels are being sent to the function.
For some reason, the images are not in the example batches.
### Steps to reproduce the bug
I'm using the latest stable version of datasets
### Expected behavior
I expect the example_batches to contain both images and labels
### Environment info
I'm using the latest stable version of datasets
The `remove_columns=["image"]` argument in the `.map` call removes the `image` column from the output, so drop this argument to preserve it. | [
-1.1705082654953003,
-0.9761772155761719,
-0.9978625178337097,
1.4372361898422241,
-0.19130155444145203,
-1.3484487533569336,
0.14734625816345215,
-1.2010046243667603,
1.7176117897033691,
-0.9727316498756409,
0.27451565861701965,
-1.7099891901016235,
0.08859211206436157,
-0.5738220810890198,
-0.701682448387146,
-0.9426342844963074,
-0.3480087220668793,
-0.7283479571342468,
1.0102790594100952,
2.5096540451049805,
1.1884801387786865,
-1.2896901369094849,
2.735440969467163,
0.7648870348930359,
-0.12253248691558838,
-0.972828209400177,
0.6166423559188843,
-0.05271654203534126,
-1.2153894901275635,
-0.4956766366958618,
-0.901776909828186,
-0.02583441324532032,
-0.46844515204429626,
-0.5089779496192932,
-0.062335990369319916,
0.4035801291465759,
-0.2880679965019226,
-0.47218671441078186,
-0.5870861411094666,
-0.8694013357162476,
0.40008267760276794,
-0.42125120759010315,
1.0326396226882935,
-0.46545401215553284,
1.9068611860275269,
-0.4457106590270996,
0.38227593898773193,
0.8100413680076599,
1.340503215789795,
0.1467057168483734,
-0.0019809268414974213,
0.223072811961174,
0.42152443528175354,
-0.012930412776768208,
0.3156391382217407,
0.968376100063324,
0.5220723152160645,
0.6037536263465881,
0.7614989876747131,
-2.218498468399048,
1.2292721271514893,
-1.0382357835769653,
0.27516767382621765,
1.4283818006515503,
-0.9896321296691895,
0.36060065031051636,
-1.7625101804733276,
-0.0798163115978241,
0.597579300403595,
-2.21449613571167,
0.2480962872505188,
-1.1979435682296753,
-0.5069314241409302,
0.9361940026283264,
0.32265719771385193,
-1.2062605619430542,
0.0847308337688446,
-0.44203245639801025,
1.055422067642212,
0.5638985633850098,
1.1386054754257202,
-1.7214744091033936,
-0.01072498969733715,
-0.3592568635940552,
0.017409799620509148,
-1.4486445188522339,
-1.5033835172653198,
0.4903813898563385,
0.6178022623062134,
0.614479660987854,
-0.09905444085597992,
0.997032105922699,
-0.8759922981262207,
0.6750573515892029,
-0.8592489361763,
-1.7414357662200928,
-1.2522915601730347,
-2.2891695499420166,
-2.297525405883789,
0.7406355142593384,
-0.4904175400733948,
-0.6020832657814026,
2.049990653991699,
-1.0687342882156372,
-1.718032956123352,
1.1845083236694336,
0.18265509605407715,
-0.007833173498511314,
2.4510490894317627,
0.23595577478408813,
-0.6148956418037415,
0.44217726588249207,
-0.7087555527687073,
0.8326401710510254,
-0.5010907649993896,
1.2696952819824219,
0.48492032289505005,
-1.0635285377502441,
1.613479495048523,
-0.48658764362335205,
0.5955509543418884,
-0.6748907566070557,
-0.40135708451271057,
-0.9660249352455139,
0.3655020594596863,
1.7648485898971558,
-0.28155338764190674,
1.6157660484313965,
-0.37078940868377686,
-1.567745327949524,
-1.7018095254898071,
0.9019357562065125,
0.41745495796203613,
-0.762988269329071,
0.25321388244628906,
-0.2533853352069855,
0.08913855254650116,
-0.0664089098572731,
1.1538641452789307,
1.240824580192566,
0.661885678768158,
-0.34224778413772583,
-0.832756519317627,
0.28105953335762024,
-0.08502659201622009,
-0.7670466899871826,
-1.6949812173843384,
-0.3273668885231018,
0.10459260642528534,
0.6716192960739136,
-1.1512352228164673,
1.7350438833236694,
0.8737611174583435,
1.8730612993240356,
1.0388325452804565,
-0.33474957942962646,
1.4368184804916382,
0.070842444896698,
1.9210559129714966,
-0.5237415432929993,
0.6996630430221558,
-0.2570311725139618,
-1.1089295148849487,
0.8612933158874512,
-0.36577296257019043,
-1.9729115962982178,
-0.9277735352516174,
-0.8546754121780396,
-0.21123935282230377,
-0.7006086111068726,
0.9328662157058716,
-0.45296797156333923,
-1.2781741619110107,
0.3409702479839325,
-0.6374394297599792,
0.04363393783569336,
-1.3013813495635986,
0.37581172585487366,
0.6871725916862488,
-0.6095049381256104,
-0.021427009254693985,
-0.24534524977207184,
-1.294745922088623,
-0.44308504462242126,
0.26606112718582153,
1.9232819080352783,
-0.7302612662315369,
0.9963327050209045,
0.9729776978492737,
-0.7801976799964905,
-0.09960216283798218,
0.27998480200767517,
-0.3187064528465271,
0.8710705041885376,
-1.1317943334579468,
-0.5443132519721985,
1.1903897523880005,
-0.28157585859298706,
-0.6578485369682312,
1.5158369541168213,
0.6749571561813354,
-1.072453498840332,
-0.17856639623641968,
-0.14893408119678497,
-0.964664876461029,
0.08887410163879395,
-1.62071692943573,
-0.12432923913002014,
0.3264448344707489,
-1.5000900030136108,
-0.5601488947868347,
-0.17115037143230438,
1.2591485977172852,
-0.1244010180234909,
1.3709664344787598,
-0.440032422542572,
-0.32884570956230164,
-0.3930351436138153,
-0.43271514773368835,
0.1963803917169571,
-0.1850689798593521,
-0.7043097615242004,
0.14352694153785706,
-0.7437850832939148,
0.2967838943004608,
1.3483028411865234,
0.35793039202690125,
0.10518397390842438,
0.5872412323951721,
1.046851634979248,
0.33111104369163513,
-0.05864718183875084,
-0.9154723882675171,
-1.5188168287277222,
1.9770324230194092,
-1.4112863540649414,
1.890008807182312,
0.7484974265098572,
-0.07869699597358704,
-1.8171871900558472,
-1.8388149738311768,
1.4196510314941406,
1.2342652082443237,
2.125288486480713,
0.6173048615455627,
0.4368601143360138,
-0.7990807294845581,
-0.7362107038497925,
0.2566588521003723,
-1.0598118305206299,
-0.7214241027832031,
0.12789978086948395,
2.304811954498291,
1.7533683776855469,
-0.4387902319431305,
-0.16567374765872955,
-1.0892890691757202,
1.2409331798553467,
-0.09038366377353668,
0.18308697640895844,
1.9695231914520264,
-0.349239706993103,
-1.0783023834228516,
1.195200800895691,
-2.2624645233154297,
0.07176028192043304,
1.9686098098754883,
0.23779675364494324,
0.008207127451896667,
-1.3651632070541382,
-0.7245022654533386,
-0.27150365710258484,
-0.3812881410121918,
-1.2873038053512573,
0.568556010723114,
-0.35143405199050903,
-0.6351412534713745,
-1.4610011577606201,
0.20630396902561188,
-1.0743247270584106,
-1.5967878103256226,
0.2089938521385193,
1.8806838989257812,
2.082812786102295,
-0.7011967301368713,
1.5874786376953125,
-0.21098117530345917,
0.20827031135559082,
1.2490465641021729,
1.1931047439575195,
3.0836284160614014,
1.9135773181915283,
-1.3212627172470093,
0.6520308256149292,
0.018188875168561935,
-0.5296123027801514,
1.2279552221298218,
-1.0602855682373047,
1.3780193328857422,
-0.14426390826702118,
-1.19296133518219,
-1.3125383853912354,
0.8189199566841125,
0.44542956352233887,
0.08680227398872375,
-0.4559703469276428,
1.308801531791687,
-0.0533449724316597,
1.3180478811264038,
0.5940808653831482,
-0.42597827315330505,
0.6170838475227356,
-0.4492008090019226,
-0.5263661742210388,
1.588178277015686,
0.21351070702075958,
-1.4137883186340332,
-2.335120439529419,
-0.3067270815372467,
-0.7650061845779419,
0.10217706859111786,
-0.6221940517425537,
-0.9676453471183777,
1.696204423904419,
0.4128897786140442,
-1.1407315731048584,
-0.3842754364013672,
-0.42282816767692566,
-0.7337626218795776,
2.6916966438293457,
-1.4722503423690796,
-0.2520412802696228,
-0.9670037031173706,
-0.6238924264907837,
1.5642714500427246,
-1.3023964166641235,
-0.19994717836380005,
-1.0760420560836792,
-0.5383725166320801,
-1.3647165298461914,
-0.5065896511077881,
0.006159747019410133,
-0.9758632183074951,
0.9847206473350525,
0.1794527918100357,
-1.0505377054214478,
-0.158784419298172,
-0.883508026599884,
0.8043684363365173,
-0.21860510110855103,
0.3341350555419922,
1.8861334323883057,
0.5566165447235107,
-0.3938756287097931,
0.7276028394699097,
1.164171576499939,
0.6784828305244446,
-0.665742039680481,
0.17781110107898712,
-0.7980358600616455,
0.22752529382705688,
-1.1558209657669067,
0.2416069507598877,
-2.827988624572754,
0.5542987585067749,
-0.0728817731142044,
-0.07789777219295502,
0.03161635622382164,
-1.277510166168213,
0.9923855662345886,
2.5909922122955322,
-1.2773001194000244,
0.4345278739929199,
0.23182906210422516,
1.3187892436981201,
-1.637089490890503,
0.37693315744400024,
-0.3701610565185547,
2.0728821754455566,
0.18147313594818115,
1.114761471748352,
-0.47164690494537354,
-2.2022531032562256,
0.6926950812339783,
-1.264341115951538,
-1.2735695838928223,
0.812906801700592,
-0.7924019694328308,
0.06191791221499443,
-1.4644962549209595,
-0.2822890281677246,
-0.7641288042068481,
-1.2868010997772217,
0.7715675830841064,
0.14850656688213348,
0.5001230239868164,
-0.5278065204620361,
0.23430757224559784,
-2.2045578956604004,
-1.4017558097839355,
-0.26915010809898376,
-0.9246041178703308,
0.4117926359176636,
-0.37678757309913635,
0.7688598036766052,
-0.24091845750808716,
0.15351340174674988,
0.3347909450531006,
1.4294991493225098,
3.599234104156494,
0.3199510872364044,
0.3992924988269806,
-0.11897246539592743,
-0.9178907871246338,
1.5052152872085571,
0.9396361708641052,
-0.08114765584468842,
-0.5199062824249268,
-1.0122331380844116,
1.2164322137832642,
1.9503644704818726,
0.9775022864341736,
0.12042993307113647,
-0.7596070766448975,
-0.5434255599975586,
-0.12452596426010132,
0.18656684458255768,
0.4425508379936218,
0.8617138266563416,
0.04712020233273506,
0.04765542969107628,
1.5453710556030273,
1.1679104566574097,
-0.4013272523880005,
0.39331886172294617,
-0.7628528475761414,
-0.43786096572875977,
0.6606765389442444,
0.32887494564056396,
0.008786620572209358,
0.32501399517059326,
-0.9571444392204285,
-0.28083181381225586,
-0.4662344753742218,
-0.9543901681900024,
-0.6061185598373413,
-0.42291733622550964,
-0.3345082104206085,
1.607456922531128,
0.1361560821533203,
-0.5581021308898926,
-0.1325514316558838,
-0.7759140133857727,
-0.14212332665920258,
-1.1188881397247314,
0.14690297842025757,
-0.1978309154510498,
-0.19651931524276733,
-0.040100276470184326,
1.8174667358398438,
-1.0266931056976318,
-2.127666473388672,
0.2356473058462143,
0.289201021194458,
-0.24299980700016022,
0.25779610872268677,
1.5886863470077515,
0.4501771628856659,
1.4608378410339355,
1.3296986818313599,
0.9371941685676575,
-0.8114861845970154,
-1.3355472087860107,
0.6195598244667053,
0.9318901300430298,
-1.3679955005645752,
0.7665260434150696,
0.03253249451518059,
-0.6252303719520569,
0.7349536418914795,
1.2459408044815063,
0.44621479511260986,
-1.9198298454284668,
0.8167243003845215,
-0.8968430757522583,
0.8547625541687012,
0.7283759117126465,
0.7436956167221069,
0.17874617874622345,
0.8433784246444702,
-1.221687912940979,
-1.184369444847107,
-0.7593655586242676,
-0.6226550340652466,
1.9590853452682495,
-0.24893081188201904,
0.6304569840431213,
-0.2082625776529312,
-1.279212236404419,
-0.04072079434990883,
0.6705963611602783,
0.36349478363990784,
-0.2922344505786896,
0.7335960865020752,
-0.7343847155570984,
-1.058453917503357,
-1.5155279636383057,
-0.37107962369918823,
-1.0318539142608643,
-0.9390556812286377,
1.1440980434417725,
0.8425918817520142,
0.20254729688167572,
1.8378713130950928,
0.7041981816291809,
0.20286139845848083,
-2.534226655960083,
0.834185779094696,
0.26558974385261536,
0.04041717201471329,
0.8439230918884277,
0.36484113335609436,
1.0884817838668823,
-0.005575312301516533,
0.41132962703704834,
-2.319424867630005,
2.2698826789855957,
-0.37302327156066895,
0.641380786895752,
-0.07624408602714539,
-0.23973968625068665,
1.1868740320205688,
0.491548091173172,
0.5470455288887024,
-1.0287396907806396,
0.6983935832977295,
-0.5640369653701782,
1.2035235166549683,
0.9936371445655823,
-0.8522992730140686,
-0.012517660856246948,
1.407240867614746,
0.6045035719871521,
-0.5376172065734863,
-0.9000958204269409,
-0.9231177568435669,
0.9480453729629517,
1.771024465560913,
0.022246241569519043,
0.03326825797557831,
0.78270423412323,
0.6110000610351562,
-1.2766658067703247,
0.13361847400665283,
-0.7923537492752075,
-0.7786345481872559,
1.6797292232513428,
2.0285983085632324,
-0.12098880112171173,
-0.19417189061641693,
-0.7899569869041443,
-1.2361373901367188,
0.8247267603874207,
0.018428685143589973,
0.1381901204586029,
0.6986647844314575,
-0.6547231674194336,
0.9950330853462219,
0.9418469667434692,
0.9642174243927002,
0.2866087257862091,
0.31468814611434937,
0.48364436626434326,
-0.30383405089378357,
-1.0464987754821777,
-0.1558365374803543,
-1.0856859683990479,
-2.476217031478882,
0.4954546391963959,
-0.3398151397705078,
-1.4755818843841553,
-0.049577221274375916,
-0.9526911973953247,
1.0641249418258667,
-0.4983651638031006,
-1.1081022024154663,
-1.6069812774658203,
0.22411814332008362,
-0.12448957562446594,
0.8992865085601807,
-1.5013505220413208,
-0.1557844877243042,
1.327258825302124,
0.95100998878479,
-0.7187322378158569,
0.9888707399368286,
0.1469048261642456,
1.0748770236968994,
0.7226306796073914,
-0.4280480146408081,
0.3866855800151825,
-0.05767137184739113,
-1.3985579013824463,
0.4869650602340698,
1.0220749378204346,
0.18669655919075012,
1.485787272453308,
-0.4811406135559082,
0.061787109822034836,
0.3451564311981201,
-0.32752111554145813,
-0.5717146396636963,
-0.5881040096282959,
0.673163890838623,
0.0433746762573719,
-0.7661015391349792,
0.12331549823284149,
-0.04586765915155411,
-0.315067857503891,
0.20111507177352905,
-1.4146075248718262,
-0.16685163974761963,
-0.45445626974105835,
-0.6699537634849548,
-1.268799901008606,
-0.03174858167767525,
1.3829995393753052,
-0.6347284317016602,
-0.18202584981918335,
0.5276080369949341,
0.4759299159049988,
0.4665720462799072,
0.590105414390564,
-0.6523979902267456,
-0.23633116483688354,
-0.3158259391784668,
-0.3007981479167938,
0.3201552927494049,
1.297043800354004,
-0.21654798090457916,
-1.010669231414795,
0.7073075771331787,
-0.26556718349456787,
0.07937109470367432,
1.9481630325317383,
0.16850832104682922,
-0.784997820854187,
0.23110555112361908,
-0.76534104347229,
1.9263452291488647,
1.69426429271698,
1.4042418003082275,
-0.07042547315359116,
-0.9783445000648499,
0.5739683508872986,
-0.2345236986875534,
-0.3406393826007843,
0.997247040271759,
0.45269355177879333,
-0.08835731446743011,
-1.4159823656082153,
0.7292499542236328,
1.2342488765716553,
-0.8777531385421753,
-0.8138231039047241,
0.04024091362953186,
-0.7774261236190796,
1.0351403951644897,
0.7057740092277527,
0.5328938364982605,
0.34137657284736633,
1.656704306602478,
0.6941885352134705,
-0.5755652785301208,
0.523308277130127,
0.5433382391929626,
-0.10649923980236053,
-2.0304791927337646,
-1.1831998825073242,
0.3727706968784332,
-0.5414822101593018,
-1.605389952659607,
1.4394627809524536,
-1.1502739191055298,
-0.9141669869422913,
0.5540972948074341,
0.17782090604305267,
1.452567219734192,
0.3103277087211609,
1.5210548639297485,
2.0245819091796875,
0.8184267282485962,
0.34163522720336914,
1.3266700506210327,
-0.17835138738155365,
-0.386951208114624,
1.8793381452560425,
-0.3675859570503235,
0.3893938660621643,
1.099941611289978,
-0.3659646213054657,
-1.1023231744766235,
-0.6908797025680542,
-1.0985158681869507,
-0.634545087814331,
1.1627445220947266,
0.07033832371234894,
-1.0262643098831177,
0.19005079567432404,
1.5141582489013672,
0.14298522472381592,
-0.3725152313709259,
0.6714550256729126,
0.5169754028320312,
-0.8252065777778625,
-0.03500943258404732,
-0.947273850440979,
0.5553775429725647,
-0.16341935098171234,
-0.35778385400772095,
0.43770262598991394,
0.4574190080165863,
1.3605854511260986,
-0.11335210502147675,
0.1969478875398636,
1.2635565996170044,
-1.31378972530365,
1.4609217643737793,
-0.6418728232383728,
0.14922551810741425,
-2.340402841567993,
1.3984633684158325,
-0.7222198843955994,
1.8778116703033447,
-2.6120545864105225,
0.3377191424369812,
-0.6653237342834473,
-0.2942347526550293,
0.3549126088619232,
-0.4160540997982025,
0.08104148507118225,
-0.20194822549819946,
-1.0983319282531738,
-0.04029808193445206,
-0.7149404883384705,
0.627565324306488,
1.2523558139801025,
1.3514187335968018,
-1.0552735328674316,
-0.2101101279258728,
-1.7310677766799927,
-0.1814642697572708,
-0.7329192161560059,
0.3761586546897888,
-2.012868642807007,
-0.26824599504470825,
-1.923254132270813,
-2.507117748260498,
-1.3562933206558228,
-0.7554112672805786,
1.1956253051757812,
0.21153700351715088,
-0.9967884421348572,
1.2003862857818604,
-0.41881468892097473,
-1.879589557647705,
1.104267954826355,
-2.183274984359741
] |
https://github.com/huggingface/datasets/issues/6069 | KeyError: dataset has no key "image" | The problem is not with the removal of the image key. The bug is why only the labels are sent to be process, instead of all the featues or dictionary keys.
P.S. I just dropped the removal argument as you've suggested, but that didn't solve the problem, because only the labels are being sent to be processed | ### Describe the bug
I've loaded a local image dataset with:
`ds = laod_dataset("imagefolder", data_dir=path-to-data)`
And defined a transform to process the data, following the Datasets docs.
However, I get a keyError error, indicating there's no "image" key in my dataset. When I printed out the example_batch sent to the transformation function, it shows only the labels are being sent to the function.
For some reason, the images are not in the example batches.
### Steps to reproduce the bug
I'm using the latest stable version of datasets
### Expected behavior
I expect the example_batches to contain both images and labels
### Environment info
I'm using the latest stable version of datasets | 17 | 57 | KeyError: dataset has no key "image"
### Describe the bug
I've loaded a local image dataset with:
`ds = laod_dataset("imagefolder", data_dir=path-to-data)`
And defined a transform to process the data, following the Datasets docs.
However, I get a keyError error, indicating there's no "image" key in my dataset. When I printed out the example_batch sent to the transformation function, it shows only the labels are being sent to the function.
For some reason, the images are not in the example batches.
### Steps to reproduce the bug
I'm using the latest stable version of datasets
### Expected behavior
I expect the example_batches to contain both images and labels
### Environment info
I'm using the latest stable version of datasets
The problem is not with the removal of the image key. The bug is why only the labels are sent to be process, instead of all the featues or dictionary keys.
P.S. I just dropped the removal argument as you've suggested, but that didn't solve the problem, because only the labels are being sent to be processed | [
-1.1786153316497803,
-0.9939639568328857,
-0.9947094917297363,
1.3766529560089111,
-0.24062664806842804,
-1.2966949939727783,
0.09172168374061584,
-1.222991704940796,
1.6651229858398438,
-0.9775608777999878,
0.26388615369796753,
-1.6799390316009521,
0.0680551677942276,
-0.5430256724357605,
-0.7078108787536621,
-0.9635455012321472,
-0.37877240777015686,
-0.772977888584137,
0.9955487847328186,
2.580137252807617,
1.1385366916656494,
-1.3377724885940552,
2.715064525604248,
0.7699050307273865,
-0.09476617723703384,
-0.9719046354293823,
0.6622390747070312,
-0.12758371233940125,
-1.2412405014038086,
-0.5399913191795349,
-0.908200740814209,
-0.009430673904716969,
-0.48693355917930603,
-0.4908277094364166,
-0.011925104074180126,
0.36250296235084534,
-0.24275441467761993,
-0.4119980037212372,
-0.6206687092781067,
-0.8999953269958496,
0.4864178001880646,
-0.4342956840991974,
1.0406655073165894,
-0.4150436818599701,
1.9079777002334595,
-0.38191482424736023,
0.33459267020225525,
0.8254538774490356,
1.3616048097610474,
0.1528584361076355,
-0.02587435394525528,
0.2347651571035385,
0.4585006535053253,
-0.015069065615534782,
0.2929585874080658,
0.9720757007598877,
0.5528084635734558,
0.5400999188423157,
0.7548627853393555,
-2.2076988220214844,
1.2713695764541626,
-1.0669687986373901,
0.28079885244369507,
1.4561636447906494,
-0.9801076650619507,
0.41094276309013367,
-1.7470269203186035,
-0.09330615401268005,
0.5820640325546265,
-2.2555699348449707,
0.2109738141298294,
-1.169692039489746,
-0.5001030564308167,
0.9371587038040161,
0.3105665445327759,
-1.2157247066497803,
0.1265726536512375,
-0.46824735403060913,
1.091543197631836,
0.5701645612716675,
1.1309702396392822,
-1.7267301082611084,
-0.06610516458749771,
-0.2968742847442627,
0.0752812996506691,
-1.4569653272628784,
-1.508529782295227,
0.4698978662490845,
0.669291615486145,
0.5197762250900269,
-0.06667246669530869,
0.9767686724662781,
-0.8807365894317627,
0.7198178768157959,
-0.8504170775413513,
-1.6939936876296997,
-1.3073217868804932,
-2.278803825378418,
-2.2894773483276367,
0.7599841952323914,
-0.4828008711338043,
-0.6431673765182495,
2.058567523956299,
-1.127137541770935,
-1.7123616933822632,
1.2444490194320679,
0.13697388768196106,
0.036746617406606674,
2.4925971031188965,
0.19734789431095123,
-0.6344534754753113,
0.4445922076702118,
-0.6871989369392395,
0.8527303338050842,
-0.4977346360683441,
1.2543938159942627,
0.47485747933387756,
-1.0083048343658447,
1.647918701171875,
-0.5233420133590698,
0.5917549729347229,
-0.6488480567932129,
-0.4566792845726013,
-0.9528099894523621,
0.40573185682296753,
1.7669026851654053,
-0.3091212809085846,
1.5829899311065674,
-0.3693346083164215,
-1.5769678354263306,
-1.7183963060379028,
0.9317945241928101,
0.3886391520500183,
-0.8378315567970276,
0.22746364772319794,
-0.2516211271286011,
0.06976459920406342,
-0.026647858321666718,
1.1154073476791382,
1.2626982927322388,
0.6364004611968994,
-0.3167131543159485,
-0.8619822859764099,
0.2954103350639343,
-0.1315915733575821,
-0.7191848754882812,
-1.729332685470581,
-0.36108773946762085,
0.08935559540987015,
0.7031299471855164,
-1.202925682067871,
1.723617434501648,
0.8919488191604614,
1.8496161699295044,
1.0428780317306519,
-0.38172447681427,
1.4401237964630127,
0.04528709501028061,
1.8825337886810303,
-0.5501512289047241,
0.7044243812561035,
-0.3118422031402588,
-1.1077556610107422,
0.8492299914360046,
-0.324165403842926,
-1.978535771369934,
-0.8879222273826599,
-0.8632210493087769,
-0.27114206552505493,
-0.6992775201797485,
0.9627887010574341,
-0.469234824180603,
-1.2325406074523926,
0.3672250807285309,
-0.6241467595100403,
0.07555384188890457,
-1.2702786922454834,
0.4122470021247864,
0.7205937504768372,
-0.5838174819946289,
-0.008739237673580647,
-0.22574441134929657,
-1.3117579221725464,
-0.435129851102829,
0.27343714237213135,
1.9116088151931763,
-0.7453129291534424,
0.9470475912094116,
0.9413137435913086,
-0.7138969898223877,
-0.10688821971416473,
0.28575241565704346,
-0.31404292583465576,
0.8436080813407898,
-1.0867934226989746,
-0.5360297560691833,
1.1755247116088867,
-0.2969208061695099,
-0.6241940259933472,
1.4681451320648193,
0.688169538974762,
-1.092209815979004,
-0.21171462535858154,
-0.18311335146427155,
-0.9760746359825134,
0.08275754749774933,
-1.6502512693405151,
-0.13650836050510406,
0.27585726976394653,
-1.575870394706726,
-0.5314016342163086,
-0.16475634276866913,
1.2503889799118042,
-0.13440760970115662,
1.4231832027435303,
-0.5160874724388123,
-0.2885797917842865,
-0.40410315990448,
-0.4172157347202301,
0.22469423711299896,
-0.18059159815311432,
-0.7086727619171143,
0.15752671658992767,
-0.8264632225036621,
0.28079378604888916,
1.375213861465454,
0.4412772059440613,
0.11144299060106277,
0.5872074365615845,
1.0331141948699951,
0.3400173485279083,
-0.061584196984767914,
-0.9248684644699097,
-1.4865803718566895,
2.0408742427825928,
-1.441138505935669,
1.876797080039978,
0.7470148801803589,
-0.05681395158171654,
-1.8019719123840332,
-1.8189761638641357,
1.3699129819869995,
1.2262537479400635,
2.0727040767669678,
0.5999653935432434,
0.42610231041908264,
-0.8302817344665527,
-0.7065634727478027,
0.2987404465675354,
-1.0993504524230957,
-0.7489031553268433,
0.07803598791360855,
2.3286728858947754,
1.7763087749481201,
-0.4444754719734192,
-0.17248982191085815,
-1.052702784538269,
1.293994665145874,
-0.10246244817972183,
0.17861999571323395,
1.9780480861663818,
-0.33018019795417786,
-1.0511597394943237,
1.176711082458496,
-2.2915074825286865,
0.10618568956851959,
1.9489526748657227,
0.24001166224479675,
0.04092010110616684,
-1.3766310214996338,
-0.7139657735824585,
-0.2430446296930313,
-0.3742400109767914,
-1.2780232429504395,
0.5859585404396057,
-0.35698238015174866,
-0.7005186080932617,
-1.4358561038970947,
0.17985749244689941,
-1.1228123903274536,
-1.6122382879257202,
0.19599159061908722,
1.8402886390686035,
2.1071133613586426,
-0.6725550293922424,
1.6085160970687866,
-0.202705979347229,
0.23078720271587372,
1.234189748764038,
1.2022064924240112,
3.1120378971099854,
1.9632354974746704,
-1.3202389478683472,
0.6168633699417114,
-0.003312331158667803,
-0.491858571767807,
1.1709728240966797,
-1.0651015043258667,
1.3777393102645874,
-0.1804419308900833,
-1.254289150238037,
-1.2208744287490845,
0.8979174494743347,
0.46504753828048706,
0.08649802207946777,
-0.46126168966293335,
1.3400182723999023,
-0.08550254255533218,
1.3151774406433105,
0.5818681120872498,
-0.433914452791214,
0.6207984089851379,
-0.4943556487560272,
-0.5791488289833069,
1.565693736076355,
0.21241483092308044,
-1.4111987352371216,
-2.3172781467437744,
-0.3399994969367981,
-0.7488008737564087,
0.053903646767139435,
-0.5868765115737915,
-0.9412263035774231,
1.6755573749542236,
0.37089335918426514,
-1.1712850332260132,
-0.4595002830028534,
-0.4772090017795563,
-0.7217670679092407,
2.6615450382232666,
-1.5736982822418213,
-0.27170705795288086,
-0.9192596673965454,
-0.58699631690979,
1.52888822555542,
-1.3511799573898315,
-0.16509297490119934,
-1.091884732246399,
-0.5894736647605896,
-1.3607510328292847,
-0.5332844257354736,
-0.0914231687784195,
-0.9974116683006287,
0.9333106875419617,
0.1965438574552536,
-1.0203875303268433,
-0.15536907315254211,
-0.8898130059242249,
0.7738508582115173,
-0.16081593930721283,
0.3159898519515991,
1.882050633430481,
0.4973008632659912,
-0.41640737652778625,
0.7063028216362,
1.1868194341659546,
0.6983816623687744,
-0.6790205836296082,
0.11114051192998886,
-0.7996887564659119,
0.25127974152565,
-1.168829083442688,
0.26687586307525635,
-2.8129093647003174,
0.5923309326171875,
-0.08173612505197525,
-0.05958562716841698,
0.02972067892551422,
-1.227514624595642,
0.9745692610740662,
2.5750906467437744,
-1.2627619504928589,
0.44524505734443665,
0.19639696180820465,
1.3124680519104004,
-1.688246726989746,
0.38082095980644226,
-0.37990421056747437,
2.1083757877349854,
0.1980835497379303,
1.1156924962997437,
-0.4568875730037689,
-2.2026379108428955,
0.6695073843002319,
-1.21979558467865,
-1.2712141275405884,
0.8260022401809692,
-0.784651517868042,
0.03122880682349205,
-1.47818922996521,
-0.22928468883037567,
-0.7857283353805542,
-1.2615936994552612,
0.8002748489379883,
0.14722250401973724,
0.5046339631080627,
-0.5302310585975647,
0.21755805611610413,
-2.1805803775787354,
-1.3923120498657227,
-0.2872432768344879,
-0.8868769407272339,
0.42152899503707886,
-0.37956878542900085,
0.763129472732544,
-0.23209044337272644,
0.12110204249620438,
0.3711299002170563,
1.391652226448059,
3.593618869781494,
0.32500970363616943,
0.41153308749198914,
-0.1454521119594574,
-0.9024775624275208,
1.473901629447937,
0.9638633131980896,
-0.1408379077911377,
-0.47913026809692383,
-0.932759165763855,
1.2550452947616577,
1.9294357299804688,
0.9474406838417053,
0.11095261573791504,
-0.7247631549835205,
-0.5076263546943665,
-0.08461043238639832,
0.19941073656082153,
0.48110151290893555,
0.8617774844169617,
-0.00147185567766428,
0.06493359804153442,
1.548879623413086,
1.1975758075714111,
-0.37283700704574585,
0.3939603269100189,
-0.7296088337898254,
-0.4543844163417816,
0.646168053150177,
0.3425792455673218,
-0.028358623385429382,
0.35471174120903015,
-0.9132561683654785,
-0.25300613045692444,
-0.4494606554508209,
-1.0173932313919067,
-0.5887869000434875,
-0.40215760469436646,
-0.3104798495769501,
1.6049741506576538,
0.2045028954744339,
-0.5577015280723572,
-0.10190047323703766,
-0.770176887512207,
-0.17515654861927032,
-1.1159154176712036,
0.1505981683731079,
-0.18468274176120758,
-0.20862528681755066,
-0.09472765773534775,
1.7869404554367065,
-0.9723242521286011,
-2.1236531734466553,
0.22571143507957458,
0.2771329879760742,
-0.26112228631973267,
0.25907737016677856,
1.5675517320632935,
0.40821993350982666,
1.4877057075500488,
1.3531471490859985,
0.8910672664642334,
-0.792549192905426,
-1.2695499658584595,
0.602306604385376,
0.919489860534668,
-1.438661813735962,
0.7957078814506531,
0.01512907724827528,
-0.6215924024581909,
0.7577768564224243,
1.258553147315979,
0.40226805210113525,
-1.940020203590393,
0.8639476895332336,
-0.8969338536262512,
0.8283388614654541,
0.6933006644248962,
0.7460220456123352,
0.21552518010139465,
0.8424738049507141,
-1.2306592464447021,
-1.211668610572815,
-0.7874065637588501,
-0.5897834300994873,
2.0118539333343506,
-0.252871036529541,
0.6259364485740662,
-0.15665091574192047,
-1.2966973781585693,
-0.055184006690979004,
0.6756835579872131,
0.34290120005607605,
-0.26606225967407227,
0.7782056331634521,
-0.7204170227050781,
-1.1250828504562378,
-1.485033392906189,
-0.3497945964336395,
-1.017996907234192,
-0.9194231033325195,
1.1688646078109741,
0.8562129735946655,
0.14903400838375092,
1.8482054471969604,
0.6367053985595703,
0.1755467802286148,
-2.533519983291626,
0.8385719656944275,
0.2958708703517914,
0.02870301529765129,
0.8807543516159058,
0.2825593948364258,
1.0665457248687744,
0.009763299487531185,
0.4164733290672302,
-2.298839569091797,
2.2405779361724854,
-0.37021955847740173,
0.6996712684631348,
-0.07130640745162964,
-0.22329406440258026,
1.1502137184143066,
0.5254483222961426,
0.6134944558143616,
-1.035888910293579,
0.6990929841995239,
-0.6161413192749023,
1.1686580181121826,
1.0111042261123657,
-0.8270638585090637,
0.017031904309988022,
1.3737432956695557,
0.5821468234062195,
-0.5709722638130188,
-0.939004123210907,
-0.867266058921814,
0.9406470060348511,
1.8102612495422363,
-0.006519756279885769,
-0.006615506950765848,
0.7462783455848694,
0.6414218544960022,
-1.3021738529205322,
0.1898028552532196,
-0.7995542287826538,
-0.7994721531867981,
1.6121456623077393,
2.0301547050476074,
-0.14109069108963013,
-0.14328695833683014,
-0.7528708577156067,
-1.2508050203323364,
0.8180590271949768,
0.005497689358890057,
0.1994456648826599,
0.672758162021637,
-0.679837703704834,
1.0293394327163696,
0.920981228351593,
0.9501258134841919,
0.24731509387493134,
0.312779039144516,
0.4302563965320587,
-0.29291579127311707,
-1.0145357847213745,
-0.19354791939258575,
-1.079854130744934,
-2.4771013259887695,
0.5067405104637146,
-0.3483405113220215,
-1.4833687543869019,
-0.004084257408976555,
-0.9244435429573059,
1.0687615871429443,
-0.5147899389266968,
-1.0943284034729004,
-1.619478702545166,
0.25974076986312866,
-0.07978505641222,
0.8989534378051758,
-1.536217451095581,
-0.10559576749801636,
1.3371381759643555,
0.956059992313385,
-0.6531107425689697,
1.0317221879959106,
0.20036306977272034,
1.102043628692627,
0.7087883949279785,
-0.41684743762016296,
0.3729041516780853,
-0.02599553018808365,
-1.373935580253601,
0.4792294204235077,
1.0365025997161865,
0.21232090890407562,
1.4346717596054077,
-0.5248634815216064,
0.05930487811565399,
0.3482908308506012,
-0.3985603451728821,
-0.5403459072113037,
-0.5437778234481812,
0.7115463614463806,
0.057468481361866,
-0.725251317024231,
0.11870358139276505,
-0.11701266467571259,
-0.3219607472419739,
0.21889160573482513,
-1.3924094438552856,
-0.22952231764793396,
-0.4725213646888733,
-0.5947048664093018,
-1.297735333442688,
-0.06190938502550125,
1.411278486251831,
-0.64382004737854,
-0.17261788249015808,
0.5556009411811829,
0.533512532711029,
0.46544939279556274,
0.6206798553466797,
-0.6386094689369202,
-0.24873889982700348,
-0.28268370032310486,
-0.2818761169910431,
0.2965807318687439,
1.2866240739822388,
-0.22227542102336884,
-0.971031129360199,
0.7461649179458618,
-0.29443642497062683,
0.06077723205089569,
1.9313743114471436,
0.17546966671943665,
-0.7566700577735901,
0.25924208760261536,
-0.7582448720932007,
1.906366229057312,
1.7209653854370117,
1.3964335918426514,
-0.07756607234477997,
-0.9852796196937561,
0.5903064012527466,
-0.22638443112373352,
-0.33264440298080444,
1.0070850849151611,
0.4937717914581299,
-0.11014172434806824,
-1.385662317276001,
0.7249521017074585,
1.1645314693450928,
-0.8727999329566956,
-0.7840605974197388,
0.03461071103811264,
-0.7657725214958191,
1.0522719621658325,
0.6789928674697876,
0.5588052868843079,
0.245435431599617,
1.6795212030410767,
0.6948917508125305,
-0.6199702620506287,
0.52037513256073,
0.5655012130737305,
-0.15977932512760162,
-2.036674737930298,
-1.1584289073944092,
0.3715924024581909,
-0.4531523585319519,
-1.621317744255066,
1.3965222835540771,
-1.1466152667999268,
-0.9068245887756348,
0.5233815908432007,
0.1652321070432663,
1.3986738920211792,
0.295550137758255,
1.5428701639175415,
2.067657709121704,
0.8340109586715698,
0.346464604139328,
1.3692141771316528,
-0.16575978696346283,
-0.32158371806144714,
1.8636107444763184,
-0.37219327688217163,
0.4017012119293213,
1.1193394660949707,
-0.40260645747184753,
-1.0386396646499634,
-0.6793844103813171,
-1.0733238458633423,
-0.5887347459793091,
1.1617982387542725,
0.06934874504804611,
-1.003699779510498,
0.1974998414516449,
1.518312692642212,
0.11135990917682648,
-0.3864098787307739,
0.6277115345001221,
0.5502204895019531,
-0.773430347442627,
-0.024107281118631363,
-0.9712260365486145,
0.5468153953552246,
-0.2050677388906479,
-0.35033151507377625,
0.49547648429870605,
0.41814538836479187,
1.296157956123352,
-0.08723928779363632,
0.21427874267101288,
1.2573195695877075,
-1.3355225324630737,
1.4403659105300903,
-0.6605411171913147,
0.14918826520442963,
-2.329361915588379,
1.3981255292892456,
-0.7077589631080627,
1.9132969379425049,
-2.5898680686950684,
0.34127387404441833,
-0.737879753112793,
-0.33160480856895447,
0.38174137473106384,
-0.37664029002189636,
0.049786277115345,
-0.184667706489563,
-1.0637023448944092,
0.014937830157577991,
-0.6716722846031189,
0.6183544993400574,
1.2461587190628052,
1.3726550340652466,
-1.0629264116287231,
-0.20181229710578918,
-1.7602471113204956,
-0.19819574058055878,
-0.7584353089332581,
0.3977851867675781,
-2.023073673248291,
-0.22973760962486267,
-1.9581714868545532,
-2.475163698196411,
-1.4261966943740845,
-0.7473171949386597,
1.1642255783081055,
0.22691087424755096,
-0.9697116017341614,
1.202702522277832,
-0.45203685760498047,
-1.8525460958480835,
1.1083743572235107,
-2.189915657043457
] |
https://github.com/huggingface/datasets/issues/6069 | KeyError: dataset has no key "image" | All the `image_dataset.column_names` after the `map` call should also be present in `preprocess_train `/`preprocess_val` unless (input) `columns` in `set_transform` are specified.
If that's not the case, we need a full reproducer (not snippets) with the environment info. | ### Describe the bug
I've loaded a local image dataset with:
`ds = laod_dataset("imagefolder", data_dir=path-to-data)`
And defined a transform to process the data, following the Datasets docs.
However, I get a keyError error, indicating there's no "image" key in my dataset. When I printed out the example_batch sent to the transformation function, it shows only the labels are being sent to the function.
For some reason, the images are not in the example batches.
### Steps to reproduce the bug
I'm using the latest stable version of datasets
### Expected behavior
I expect the example_batches to contain both images and labels
### Environment info
I'm using the latest stable version of datasets | 17 | 37 | KeyError: dataset has no key "image"
### Describe the bug
I've loaded a local image dataset with:
`ds = laod_dataset("imagefolder", data_dir=path-to-data)`
And defined a transform to process the data, following the Datasets docs.
However, I get a keyError error, indicating there's no "image" key in my dataset. When I printed out the example_batch sent to the transformation function, it shows only the labels are being sent to the function.
For some reason, the images are not in the example batches.
### Steps to reproduce the bug
I'm using the latest stable version of datasets
### Expected behavior
I expect the example_batches to contain both images and labels
### Environment info
I'm using the latest stable version of datasets
All the `image_dataset.column_names` after the `map` call should also be present in `preprocess_train `/`preprocess_val` unless (input) `columns` in `set_transform` are specified.
If that's not the case, we need a full reproducer (not snippets) with the environment info. | [
-1.1579222679138184,
-0.939723789691925,
-0.9462810754776001,
1.4220147132873535,
-0.1891966313123703,
-1.2969825267791748,
0.16110125184059143,
-1.1809947490692139,
1.7300562858581543,
-1.0112223625183105,
0.29581353068351746,
-1.6760975122451782,
0.04168058559298515,
-0.615085780620575,
-0.7548807859420776,
-0.9561278820037842,
-0.3603673279285431,
-0.7472550272941589,
0.9984289407730103,
2.5039374828338623,
1.166009545326233,
-1.3192211389541626,
2.7076985836029053,
0.7415801286697388,
-0.1552356332540512,
-0.9843882322311401,
0.5801583528518677,
-0.14514108002185822,
-1.1804418563842773,
-0.49666157364845276,
-0.9065219759941101,
-0.022723564878106117,
-0.5435464978218079,
-0.5403812527656555,
-0.006974207237362862,
0.4191204309463501,
-0.32311269640922546,
-0.44608911871910095,
-0.5443940758705139,
-0.8821299076080322,
0.44844675064086914,
-0.42024925351142883,
1.0280355215072632,
-0.436563640832901,
1.9023804664611816,
-0.4656156003475189,
0.397553414106369,
0.7657536864280701,
1.3631402254104614,
0.1853141188621521,
-0.03171234950423241,
0.27504026889801025,
0.41482141613960266,
0.008490712381899357,
0.36857083439826965,
1.0441436767578125,
0.5071980357170105,
0.5611781477928162,
0.761684775352478,
-2.244374990463257,
1.242404580116272,
-1.0252504348754883,
0.26855748891830444,
1.3586490154266357,
-0.9421122670173645,
0.31421172618865967,
-1.733701229095459,
-0.05790406093001366,
0.6234806776046753,
-2.275953531265259,
0.2538365423679352,
-1.2632665634155273,
-0.4837833642959595,
1.0177967548370361,
0.38350844383239746,
-1.1712291240692139,
0.0995410680770874,
-0.38712453842163086,
1.087441086769104,
0.5673169493675232,
1.1561686992645264,
-1.6841909885406494,
-0.07494553178548813,
-0.2921016812324524,
0.05745373293757439,
-1.3856488466262817,
-1.4971749782562256,
0.47775766253471375,
0.6590061187744141,
0.5559875965118408,
-0.09801433235406876,
1.0438611507415771,
-0.891497015953064,
0.6872172951698303,
-0.9328980445861816,
-1.7341889142990112,
-1.2891727685928345,
-2.255685806274414,
-2.315509080886841,
0.7511945962905884,
-0.4667462706565857,
-0.583820104598999,
2.057013750076294,
-1.05256986618042,
-1.7822331190109253,
1.1756125688552856,
0.23624183237552643,
0.011326047591865063,
2.3762547969818115,
0.2625819146633148,
-0.6558173894882202,
0.4761888086795807,
-0.7019979357719421,
0.8347474932670593,
-0.477193146944046,
1.2897995710372925,
0.4715219736099243,
-1.0476078987121582,
1.592929720878601,
-0.556690514087677,
0.6176192164421082,
-0.6564374566078186,
-0.40599483251571655,
-0.9127641916275024,
0.396007239818573,
1.8011236190795898,
-0.30289119482040405,
1.5921741724014282,
-0.3607349395751953,
-1.5719408988952637,
-1.713562250137329,
0.8945847153663635,
0.4183688461780548,
-0.7938517928123474,
0.19709843397140503,
-0.3199766278266907,
0.1192847341299057,
-0.08173811435699463,
1.195407509803772,
1.231260895729065,
0.6953005790710449,
-0.3085687756538391,
-0.8433327078819275,
0.2671564221382141,
-0.07070342451334,
-0.7626532912254333,
-1.7535531520843506,
-0.36776071786880493,
0.15268133580684662,
0.6569579243659973,
-1.1290470361709595,
1.7160494327545166,
0.8492037653923035,
1.8934519290924072,
1.0214438438415527,
-0.3192874789237976,
1.4865686893463135,
0.02695910632610321,
1.9514952898025513,
-0.46373504400253296,
0.6640326380729675,
-0.2958199679851532,
-1.1312328577041626,
0.8278923034667969,
-0.36937984824180603,
-1.986890435218811,
-0.8900443315505981,
-0.8767604231834412,
-0.18511533737182617,
-0.7035633325576782,
0.9392288327217102,
-0.3978147506713867,
-1.302668809890747,
0.2945570945739746,
-0.7154088616371155,
0.08829355239868164,
-1.274849772453308,
0.3608064651489258,
0.7259184718132019,
-0.6514776349067688,
-0.0013308655470609665,
-0.2631593346595764,
-1.2904999256134033,
-0.4585234224796295,
0.2900611162185669,
1.9452760219573975,
-0.8092789649963379,
0.9795234799385071,
0.9625864028930664,
-0.727833092212677,
-0.08867442607879639,
0.25413036346435547,
-0.332533061504364,
0.8542625904083252,
-1.0984148979187012,
-0.470959335565567,
1.2107683420181274,
-0.26476073265075684,
-0.6748222708702087,
1.4811344146728516,
0.7363343238830566,
-1.1135315895080566,
-0.1456567496061325,
-0.21389582753181458,
-0.9014398455619812,
0.07132639735937119,
-1.6301476955413818,
-0.13260313868522644,
0.3688042163848877,
-1.5180364847183228,
-0.5588350892066956,
-0.1742498129606247,
1.2921825647354126,
-0.14803893864154816,
1.438597321510315,
-0.4637240469455719,
-0.22295595705509186,
-0.38170698285102844,
-0.4208274185657501,
0.21304413676261902,
-0.17689228057861328,
-0.7046688795089722,
0.10188271105289459,
-0.7350177764892578,
0.28766560554504395,
1.3602044582366943,
0.35742369294166565,
0.11195801198482513,
0.5551339983940125,
1.1017789840698242,
0.34520936012268066,
-0.002563584130257368,
-0.8888566493988037,
-1.5102189779281616,
2.0445094108581543,
-1.3951404094696045,
1.8836991786956787,
0.7012295722961426,
-0.09036170691251755,
-1.7869791984558105,
-1.874458909034729,
1.4145749807357788,
1.2006816864013672,
2.1551034450531006,
0.5985462069511414,
0.4485856294631958,
-0.8321638107299805,
-0.701816976070404,
0.3589212894439697,
-1.014883041381836,
-0.6994816064834595,
0.06424813717603683,
2.3261711597442627,
1.7926719188690186,
-0.4580919146537781,
-0.19745171070098877,
-1.0310629606246948,
1.3534713983535767,
-0.1791328340768814,
0.2109711915254593,
1.9713293313980103,
-0.3101048171520233,
-1.074963092803955,
1.2077922821044922,
-2.266418218612671,
0.09782443940639496,
2.00020694732666,
0.17671369016170502,
0.04288258031010628,
-1.385101079940796,
-0.6655957698822021,
-0.26763537526130676,
-0.34236621856689453,
-1.2643588781356812,
0.5355009436607361,
-0.2993023097515106,
-0.687774121761322,
-1.4151079654693604,
0.25477689504623413,
-1.0824023485183716,
-1.6232483386993408,
0.19398704171180725,
1.9066243171691895,
2.046124219894409,
-0.711859405040741,
1.5963855981826782,
-0.26297327876091003,
0.21060243248939514,
1.282644510269165,
1.2340630292892456,
3.1568048000335693,
1.8858692646026611,
-1.3447444438934326,
0.6260452270507812,
-0.02562858536839485,
-0.5427815914154053,
1.2391564846038818,
-1.1200271844863892,
1.3321040868759155,
-0.1765507161617279,
-1.203653335571289,
-1.3036808967590332,
0.8291240930557251,
0.507409393787384,
0.10000109672546387,
-0.46160805225372314,
1.3204083442687988,
-0.068485789000988,
1.317395567893982,
0.5907034277915955,
-0.4536491930484772,
0.6330532431602478,
-0.4566185176372528,
-0.5321748852729797,
1.5365113019943237,
0.2205904871225357,
-1.3928453922271729,
-2.2854278087615967,
-0.2766377925872803,
-0.8201526999473572,
0.06472785025835037,
-0.5986937284469604,
-0.9587311148643494,
1.6438313722610474,
0.35342177748680115,
-1.177971363067627,
-0.41583552956581116,
-0.40634849667549133,
-0.6691599488258362,
2.6915981769561768,
-1.4355311393737793,
-0.2518649697303772,
-0.9508408904075623,
-0.5883263945579529,
1.6029165983200073,
-1.2702525854110718,
-0.22184695303440094,
-1.0821807384490967,
-0.5394463539123535,
-1.3667768239974976,
-0.5276006460189819,
-0.048700083047151566,
-0.9469488263130188,
0.9620413780212402,
0.16961313784122467,
-1.1253079175949097,
-0.1978801041841507,
-0.8871910572052002,
0.848408043384552,
-0.19804799556732178,
0.27753934264183044,
1.8642195463180542,
0.508313000202179,
-0.4274449348449707,
0.7239788770675659,
1.18951416015625,
0.6615968942642212,
-0.6233466267585754,
0.19130884110927582,
-0.7716833353042603,
0.25604894757270813,
-1.2192970514297485,
0.24448445439338684,
-2.8744406700134277,
0.6143032312393188,
-0.08814731985330582,
-0.09033741801977158,
-0.022101450711488724,
-1.3129479885101318,
0.9861660599708557,
2.5893590450286865,
-1.2755277156829834,
0.4438859224319458,
0.24451971054077148,
1.2709810733795166,
-1.6637177467346191,
0.28073909878730774,
-0.3899683356285095,
2.128789186477661,
0.18259485065937042,
1.1755733489990234,
-0.41946691274642944,
-2.1894938945770264,
0.6950893402099609,
-1.2788194417953491,
-1.22956120967865,
0.8586932420730591,
-0.7750988006591797,
0.03395725414156914,
-1.4439641237258911,
-0.25206926465034485,
-0.7944368124008179,
-1.2579939365386963,
0.7807381749153137,
0.14574779570102692,
0.5112326741218567,
-0.5127867460250854,
0.27414438128471375,
-2.189652919769287,
-1.4284676313400269,
-0.2577343285083771,
-0.9425926804542542,
0.4117395877838135,
-0.38996535539627075,
0.7368360757827759,
-0.23537003993988037,
0.11055126786231995,
0.41869843006134033,
1.4211472272872925,
3.567368268966675,
0.3250664472579956,
0.3854750096797943,
-0.16548289358615875,
-0.884354829788208,
1.4522358179092407,
0.9062225222587585,
-0.18496005237102509,
-0.4418138265609741,
-0.9413161277770996,
1.230043649673462,
1.9654139280319214,
0.9824213981628418,
0.07991227507591248,
-0.7746278643608093,
-0.5904375910758972,
-0.13792899250984192,
0.12174336612224579,
0.4654461443424225,
0.8285478353500366,
0.0666903480887413,
0.06352098286151886,
1.4592983722686768,
1.1109117269515991,
-0.39512667059898376,
0.4188351333141327,
-0.7326623201370239,
-0.46258750557899475,
0.6352854371070862,
0.3094048500061035,
-0.003399995155632496,
0.3079386353492737,
-0.9236982464790344,
-0.2358182966709137,
-0.4671453833580017,
-0.8907353281974792,
-0.6631167531013489,
-0.4533092975616455,
-0.31735959649086,
1.582017421722412,
0.1152200847864151,
-0.5289713740348816,
-0.10708974301815033,
-0.7434712648391724,
-0.11271804571151733,
-1.0861622095108032,
0.15667475759983063,
-0.17647945880889893,
-0.22445932030677795,
-0.07229520380496979,
1.6596041917800903,
-1.000964641571045,
-2.0582120418548584,
0.22265702486038208,
0.2837314307689667,
-0.3133985698223114,
0.2276877611875534,
1.6596648693084717,
0.4774886667728424,
1.4658986330032349,
1.3653957843780518,
0.9307402968406677,
-0.7957717180252075,
-1.2549558877944946,
0.6391400694847107,
0.8914352059364319,
-1.4304262399673462,
0.7451016306877136,
0.05082470178604126,
-0.5913861989974976,
0.7259969711303711,
1.219023585319519,
0.4784056842327118,
-1.926387071609497,
0.840973436832428,
-0.9374285340309143,
0.7916452884674072,
0.6883025765419006,
0.7148500084877014,
0.21353428065776825,
0.8626329302787781,
-1.1492022275924683,
-1.204079270362854,
-0.7375704646110535,
-0.6654089689254761,
2.0044918060302734,
-0.23704083263874054,
0.5240200161933899,
-0.17090445756912231,
-1.2984460592269897,
-0.0997447744011879,
0.7267362475395203,
0.38213911652565,
-0.33043599128723145,
0.7147636413574219,
-0.7205907106399536,
-1.0033490657806396,
-1.4740188121795654,
-0.375367134809494,
-1.0681740045547485,
-0.9295042157173157,
1.0977553129196167,
0.8691357970237732,
0.23757275938987732,
1.855943202972412,
0.6972596645355225,
0.21938766539096832,
-2.497241973876953,
0.8593754768371582,
0.31435495615005493,
-0.061117786914110184,
0.841785192489624,
0.3368167281150818,
1.1304265260696411,
-0.03633854165673256,
0.4805786907672882,
-2.3199684619903564,
2.227609634399414,
-0.34872716665267944,
0.5961340665817261,
-0.07905028015375137,
-0.22607089579105377,
1.1758396625518799,
0.5057035684585571,
0.5404290556907654,
-1.0398361682891846,
0.7060295343399048,
-0.6170051097869873,
1.1543062925338745,
0.9355515241622925,
-0.8790075182914734,
-0.0021051610819995403,
1.4168450832366943,
0.5034867525100708,
-0.568882942199707,
-0.9295795559883118,
-0.9270278811454773,
0.9500146508216858,
1.6936413049697876,
-0.053975000977516174,
-0.03462166711688042,
0.801869809627533,
0.6426419615745544,
-1.2960083484649658,
0.19637565314769745,
-0.774634599685669,
-0.7986549139022827,
1.6570029258728027,
2.0085220336914062,
-0.16655273735523224,
-0.14310118556022644,
-0.8211778402328491,
-1.2437571287155151,
0.8228884339332581,
0.016608674079179764,
0.053722504526376724,
0.6543383002281189,
-0.675507128238678,
1.0865548849105835,
0.9510995745658875,
0.9156238436698914,
0.21994708478450775,
0.260001003742218,
0.4391992390155792,
-0.2800717353820801,
-1.0383731126785278,
-0.22199611365795135,
-1.0844484567642212,
-2.4809834957122803,
0.5137905478477478,
-0.3217936158180237,
-1.4394844770431519,
-0.013523890636861324,
-0.940747857093811,
1.0570183992385864,
-0.536442220211029,
-1.0527676343917847,
-1.5745880603790283,
0.2662408947944641,
-0.0765610933303833,
0.9045674800872803,
-1.5260673761367798,
-0.09752421826124191,
1.3403704166412354,
0.8997676372528076,
-0.740914523601532,
0.9716996550559998,
0.21482212841510773,
1.0670818090438843,
0.8273911476135254,
-0.40435004234313965,
0.4423710107803345,
-0.04158761352300644,
-1.3958724737167358,
0.5054669976234436,
1.0807181596755981,
0.17710232734680176,
1.4664169549942017,
-0.4880911707878113,
0.03683110326528549,
0.30517324805259705,
-0.42721712589263916,
-0.571427583694458,
-0.5645586848258972,
0.7029199004173279,
0.04834672436118126,
-0.7867423892021179,
0.14262638986110687,
-0.07821165025234222,
-0.32586172223091125,
0.20472975075244904,
-1.4697060585021973,
-0.1739858090877533,
-0.38053372502326965,
-0.6367030739784241,
-1.248329520225525,
-0.08553300052881241,
1.3906092643737793,
-0.6630610227584839,
-0.20867837965488434,
0.5813072323799133,
0.47119516134262085,
0.49156585335731506,
0.5933088660240173,
-0.6533443331718445,
-0.25936615467071533,
-0.3216044008731842,
-0.3112534284591675,
0.31875893473625183,
1.3374066352844238,
-0.15104396641254425,
-0.9797596335411072,
0.6985476016998291,
-0.32270485162734985,
0.03821475803852081,
1.9253119230270386,
0.14026163518428802,
-0.7826740741729736,
0.2734649181365967,
-0.7601828575134277,
1.914287805557251,
1.808862328529358,
1.3774425983428955,
-0.005918308161199093,
-1.0089318752288818,
0.5943945050239563,
-0.31337863206863403,
-0.31629687547683716,
1.032529592514038,
0.43295010924339294,
-0.13937361538410187,
-1.388035774230957,
0.7300928831100464,
1.2061901092529297,
-0.8552747368812561,
-0.8541293740272522,
0.029031168669462204,
-0.7730677127838135,
1.0545777082443237,
0.7358187437057495,
0.5355992913246155,
0.29088327288627625,
1.6365160942077637,
0.7255638241767883,
-0.5470096468925476,
0.4973829686641693,
0.5143508911132812,
-0.14152264595031738,
-2.0711734294891357,
-1.1543991565704346,
0.41534239053726196,
-0.4578284025192261,
-1.6326788663864136,
1.4048279523849487,
-1.1331820487976074,
-0.8967914581298828,
0.5364903807640076,
0.11091849952936172,
1.4189743995666504,
0.34612488746643066,
1.5512081384658813,
2.055316209793091,
0.8500124216079712,
0.3388088643550873,
1.3322447538375854,
-0.19722029566764832,
-0.3640466332435608,
1.8351346254348755,
-0.3871481716632843,
0.39486172795295715,
1.1097698211669922,
-0.4139101207256317,
-1.0635221004486084,
-0.736712634563446,
-1.1675595045089722,
-0.6384149193763733,
1.1504770517349243,
0.07817525416612625,
-1.0525802373886108,
0.2009885311126709,
1.579911708831787,
0.11595886945724487,
-0.3307439684867859,
0.6975467801094055,
0.48401790857315063,
-0.8613426089286804,
-0.003132980316877365,
-0.9777883887290955,
0.5512012839317322,
-0.15284119546413422,
-0.3389139473438263,
0.47286707162857056,
0.44950902462005615,
1.3607358932495117,
-0.07791655510663986,
0.1781442016363144,
1.210376501083374,
-1.317767858505249,
1.4461719989776611,
-0.6707832217216492,
0.21075710654258728,
-2.3596479892730713,
1.38157320022583,
-0.7525700330734253,
1.920424222946167,
-2.6076600551605225,
0.38498231768608093,
-0.6876747012138367,
-0.3572406470775604,
0.3935302495956421,
-0.3800891041755676,
0.114536814391613,
-0.17439870536327362,
-1.175289273262024,
-0.04297524318099022,
-0.7064731121063232,
0.652252733707428,
1.2380011081695557,
1.3749254941940308,
-1.1098246574401855,
-0.24232710897922516,
-1.7338329553604126,
-0.1637505292892456,
-0.6957638263702393,
0.37135326862335205,
-1.9710302352905273,
-0.21699513494968414,
-1.9438759088516235,
-2.431042194366455,
-1.3623794317245483,
-0.7274217009544373,
1.1519914865493774,
0.16506339609622955,
-0.9568078517913818,
1.2061998844146729,
-0.41803714632987976,
-1.8818333148956299,
1.0783077478408813,
-2.167205572128296
] |
https://github.com/huggingface/datasets/issues/6069 | KeyError: dataset has no key "image" | I have resolved the error after including a collate function as indicated in the Quick Start session of the Datasets docs.:
Here is what I did:
```
data_transforms = utils.get_data_augmentation(args)
image_dataset = utils.load_image_dataset(args.dataset)
def preprocess_train(example_batch):
example_batch["pixel_values"] = [
data_transforms["train"](image.convert("RGB")) for image in example_batch["image"]
]
return example_batch
def preprocess_val(example_batch):
example_batch["pixel_values"] = [
data_transforms["val"](image.convert("RGB")) for image in example_batch["image"]
]
return example_batch
def collate_fn(examples):
images = []
labels = []
for example in examples:
images.append((example["pixel_values"]))
labels.append(example["label"])
pixel_values = torch.stack(images)
labels = torch.tensor(labels)
return {"pixel_values": pixel_values, "label": labels}
train_dataset = image_dataset["train"].with_transform(preprocess_train)
val_dataset = image_dataset["validation"].with_transform(preprocess_val)
image_datasets = {
"train": train_dataset,
"val": val_dataset
}
samplers = {
"train": data.RandomSampler(train_dataset),
"val": data.SequentialSampler(val_dataset),
}
dataloaders = {
x: data.DataLoader(
image_datasets[x],
collate_fn=collate_fn,
batch_size=batch_size,
sampler=samplers[x],
num_workers=args.num_workers,
worker_init_fn=utils.set_seed_for_worker,
generator=g,
pin_memory=True,
)
for x in ["train", "val"]
}
train_loader, val_loader = dataloaders["train"], dataloaders["val"]
```
Everything runs fine without any bug now. | ### Describe the bug
I've loaded a local image dataset with:
`ds = laod_dataset("imagefolder", data_dir=path-to-data)`
And defined a transform to process the data, following the Datasets docs.
However, I get a keyError error, indicating there's no "image" key in my dataset. When I printed out the example_batch sent to the transformation function, it shows only the labels are being sent to the function.
For some reason, the images are not in the example batches.
### Steps to reproduce the bug
I'm using the latest stable version of datasets
### Expected behavior
I expect the example_batches to contain both images and labels
### Environment info
I'm using the latest stable version of datasets | 17 | 139 | KeyError: dataset has no key "image"
### Describe the bug
I've loaded a local image dataset with:
`ds = laod_dataset("imagefolder", data_dir=path-to-data)`
And defined a transform to process the data, following the Datasets docs.
However, I get a keyError error, indicating there's no "image" key in my dataset. When I printed out the example_batch sent to the transformation function, it shows only the labels are being sent to the function.
For some reason, the images are not in the example batches.
### Steps to reproduce the bug
I'm using the latest stable version of datasets
### Expected behavior
I expect the example_batches to contain both images and labels
### Environment info
I'm using the latest stable version of datasets
I have resolved the error after including a collate function as indicated in the Quick Start session of the Datasets docs.:
Here is what I did:
```
data_transforms = utils.get_data_augmentation(args)
image_dataset = utils.load_image_dataset(args.dataset)
def preprocess_train(example_batch):
example_batch["pixel_values"] = [
data_transforms["train"](image.convert("RGB")) for image in example_batch["image"]
]
return example_batch
def preprocess_val(example_batch):
example_batch["pixel_values"] = [
data_transforms["val"](image.convert("RGB")) for image in example_batch["image"]
]
return example_batch
def collate_fn(examples):
images = []
labels = []
for example in examples:
images.append((example["pixel_values"]))
labels.append(example["label"])
pixel_values = torch.stack(images)
labels = torch.tensor(labels)
return {"pixel_values": pixel_values, "label": labels}
train_dataset = image_dataset["train"].with_transform(preprocess_train)
val_dataset = image_dataset["validation"].with_transform(preprocess_val)
image_datasets = {
"train": train_dataset,
"val": val_dataset
}
samplers = {
"train": data.RandomSampler(train_dataset),
"val": data.SequentialSampler(val_dataset),
}
dataloaders = {
x: data.DataLoader(
image_datasets[x],
collate_fn=collate_fn,
batch_size=batch_size,
sampler=samplers[x],
num_workers=args.num_workers,
worker_init_fn=utils.set_seed_for_worker,
generator=g,
pin_memory=True,
)
for x in ["train", "val"]
}
train_loader, val_loader = dataloaders["train"], dataloaders["val"]
```
Everything runs fine without any bug now. | [
-1.339882731437683,
-0.9851165413856506,
-0.8010908961296082,
1.4915612936019897,
-0.19218501448631287,
-1.2128950357437134,
0.16310033202171326,
-1.1704480648040771,
1.6644611358642578,
-0.8980790972709656,
0.3183603584766388,
-1.6021389961242676,
0.006425078026950359,
-0.5804527997970581,
-0.7326551675796509,
-0.9579440355300903,
-0.3941601514816284,
-0.7174669504165649,
1.1095390319824219,
2.445794105529785,
1.2203056812286377,
-1.357608675956726,
2.782254695892334,
0.7622158527374268,
-0.16911150515079498,
-1.0011374950408936,
0.588487446308136,
-0.01786199025809765,
-1.2430508136749268,
-0.4882839322090149,
-0.9656474590301514,
-0.033090658485889435,
-0.4968354403972626,
-0.45368674397468567,
-0.05188123509287834,
0.38845425844192505,
-0.2851496636867523,
-0.5295100808143616,
-0.6669496893882751,
-0.7634566426277161,
0.40862616896629333,
-0.39763960242271423,
0.9706383347511292,
-0.39776572585105896,
1.8667635917663574,
-0.5811114311218262,
0.43803220987319946,
0.750489354133606,
1.3160110712051392,
0.218834787607193,
0.09588087350130081,
0.3213057518005371,
0.40978601574897766,
-0.08450525254011154,
0.47164711356163025,
1.1966910362243652,
0.5704813003540039,
0.482410192489624,
0.8046389818191528,
-2.2168524265289307,
1.2158509492874146,
-1.0558922290802002,
0.33622410893440247,
1.3618555068969727,
-0.914006769657135,
0.35471540689468384,
-1.6917752027511597,
-0.09727451205253601,
0.7270475625991821,
-2.222193717956543,
0.2905119061470032,
-1.2952160835266113,
-0.5827206969261169,
0.9574295878410339,
0.3932974338531494,
-1.1189647912979126,
0.11376161873340607,
-0.5420905947685242,
1.1084368228912354,
0.4129538834095001,
1.1002076864242554,
-1.6112817525863647,
-0.03292519226670265,
-0.22041445970535278,
0.08457571268081665,
-1.3119480609893799,
-1.542250394821167,
0.550337553024292,
0.6439231038093567,
0.5780363082885742,
-0.11221086978912354,
1.1216859817504883,
-1.0609691143035889,
0.7792256474494934,
-1.0072382688522339,
-1.6915165185928345,
-1.4589414596557617,
-2.310943841934204,
-2.196451187133789,
0.7022415995597839,
-0.4728085994720459,
-0.6061159372329712,
2.107631206512451,
-0.9732820391654968,
-1.685207486152649,
1.1575291156768799,
0.2242918461561203,
0.07954467833042145,
2.4312472343444824,
0.23531055450439453,
-0.7057897448539734,
0.5103488564491272,
-0.7215124368667603,
0.8126251697540283,
-0.3026975989341736,
1.2432773113250732,
0.35596325993537903,
-0.9642438888549805,
1.5695286989212036,
-0.38361093401908875,
0.6667235493659973,
-0.5774950981140137,
-0.4245903491973877,
-0.862114429473877,
0.2816278338432312,
1.7940855026245117,
-0.27126091718673706,
1.5768083333969116,
-0.3386167585849762,
-1.6509463787078857,
-1.7091516256332397,
0.8499985933303833,
0.4632777273654938,
-0.7487635612487793,
0.10730268806219101,
-0.38649892807006836,
0.14099036157131195,
-0.09031723439693451,
1.2695235013961792,
1.2838146686553955,
0.737355649471283,
-0.43437620997428894,
-0.806550920009613,
0.15003398060798645,
-0.06596565991640091,
-0.8426682353019714,
-1.662841558456421,
-0.37772616744041443,
0.20830786228179932,
0.6288784146308899,
-1.2342016696929932,
1.7601410150527954,
0.9123415946960449,
1.8340309858322144,
1.0448203086853027,
-0.38015857338905334,
1.4699413776397705,
0.05375020205974579,
1.7830748558044434,
-0.5237634181976318,
0.6147114634513855,
-0.26302671432495117,
-1.165055751800537,
0.8168497085571289,
-0.30556607246398926,
-2.049145460128784,
-0.9746851921081543,
-0.7043235301971436,
-0.17149372398853302,
-0.7312149405479431,
0.8666244149208069,
-0.4416959285736084,
-1.410341739654541,
0.24257636070251465,
-0.7343251705169678,
0.07698706537485123,
-1.1487709283828735,
0.2771196663379669,
0.6405414342880249,
-0.6398087739944458,
0.060322269797325134,
-0.11388996988534927,
-1.2861806154251099,
-0.35244300961494446,
0.21315111219882965,
1.9554888010025024,
-0.7364625930786133,
0.9124468564987183,
1.077802300453186,
-0.6917241215705872,
0.012976967729628086,
0.17554032802581787,
-0.3256385326385498,
0.910746693611145,
-1.0953826904296875,
-0.5431824326515198,
1.2372405529022217,
-0.20422302186489105,
-0.6570428013801575,
1.573737382888794,
0.6835266947746277,
-1.0090389251708984,
-0.2988661527633667,
-0.08052809536457062,
-0.9099317789077759,
-0.002292354591190815,
-1.5348609685897827,
-0.16952265799045563,
0.4878161549568176,
-1.5547244548797607,
-0.49897608160972595,
-0.19905517995357513,
1.2848894596099854,
-0.20686902105808258,
1.4659639596939087,
-0.4518047273159027,
-0.21060073375701904,
-0.2997229993343353,
-0.4067562222480774,
0.20923347771167755,
-0.19137543439865112,
-0.6870158314704895,
0.05877520143985748,
-0.847629964351654,
0.30410274863243103,
1.4403146505355835,
0.42874643206596375,
0.12530966103076935,
0.46833479404449463,
1.1226648092269897,
0.39757394790649414,
-0.043577056378126144,
-0.882617712020874,
-1.5084788799285889,
1.9952441453933716,
-1.3986860513687134,
1.9808850288391113,
0.7889285683631897,
-0.09904971718788147,
-1.8444277048110962,
-1.8724353313446045,
1.307070255279541,
1.2231603860855103,
2.2614634037017822,
0.40761473774909973,
0.4416099786758423,
-0.8378061652183533,
-0.7114445567131042,
0.2707500457763672,
-1.065819501876831,
-0.6325848698616028,
0.19989056885242462,
2.3469135761260986,
1.8406357765197754,
-0.40782031416893005,
-0.14948616921901703,
-0.9664715528488159,
1.373763918876648,
-0.22699293494224548,
0.2542109787464142,
1.936686635017395,
-0.27728286385536194,
-1.0209161043167114,
1.32530677318573,
-2.276602029800415,
0.12389062345027924,
1.99014413356781,
0.2701627314090729,
0.05415477603673935,
-1.291900396347046,
-0.5772359371185303,
-0.4353730380535126,
-0.36558571457862854,
-1.225306749343872,
0.5651018023490906,
-0.26765260100364685,
-0.7852728366851807,
-1.351009726524353,
0.13176880776882172,
-1.1203272342681885,
-1.647838830947876,
0.2603267431259155,
1.8580528497695923,
2.1169850826263428,
-0.8238587975502014,
1.5954532623291016,
-0.32845574617385864,
0.14138862490653992,
1.101224660873413,
1.2590672969818115,
3.0601677894592285,
1.809695839881897,
-1.3219830989837646,
0.5341842770576477,
-0.10617274791002274,
-0.4729171097278595,
1.11488938331604,
-1.22856867313385,
1.3869165182113647,
-0.06282749772071838,
-1.1973097324371338,
-1.2377591133117676,
1.0606704950332642,
0.5047446489334106,
0.007291550748050213,
-0.5095381140708923,
1.200055480003357,
-0.003554699942469597,
1.3882492780685425,
0.5916377902030945,
-0.3862011432647705,
0.6183197498321533,
-0.4258315861225128,
-0.5692064166069031,
1.5074471235275269,
0.11113739758729935,
-1.4819567203521729,
-2.2240145206451416,
-0.25052013993263245,
-0.8231179118156433,
0.10378523170948029,
-0.6092734932899475,
-1.0573720932006836,
1.7472199201583862,
0.29494044184684753,
-1.2761762142181396,
-0.40510129928588867,
-0.385959267616272,
-0.6661920547485352,
2.759385108947754,
-1.2512131929397583,
-0.17926254868507385,
-0.907444953918457,
-0.6795576214790344,
1.6441730260849,
-1.188053011894226,
-0.22562360763549805,
-1.0410740375518799,
-0.5677971839904785,
-1.3364160060882568,
-0.5663127899169922,
0.08118389546871185,
-1.0334656238555908,
0.9015758037567139,
0.15396226942539215,
-1.0654240846633911,
-0.27420279383659363,
-0.8574381470680237,
0.9557306170463562,
-0.24233034253120422,
0.13297955691814423,
1.8807017803192139,
0.35717397928237915,
-0.3621227741241455,
0.8001425862312317,
1.237531304359436,
0.7070631384849548,
-0.6582959890365601,
0.03607048839330673,
-0.738350510597229,
0.3016880750656128,
-1.2433847188949585,
0.2275150567293167,
-2.8345823287963867,
0.6510412096977234,
-0.045403506606817245,
-0.08493142575025558,
0.08132916688919067,
-1.2363232374191284,
1.059426188468933,
2.6316378116607666,
-1.275650143623352,
0.46677514910697937,
0.31183385848999023,
1.1597336530685425,
-1.6360645294189453,
0.3410140872001648,
-0.4242401123046875,
2.037489414215088,
0.20886121690273285,
1.2562814950942993,
-0.47461745142936707,
-2.1422171592712402,
0.7640224099159241,
-1.292949914932251,
-1.22945237159729,
0.8060464859008789,
-0.9980722069740295,
0.3149844706058502,
-1.5025454759597778,
-0.35397103428840637,
-0.8557652831077576,
-1.1457809209823608,
0.5269352197647095,
0.15589909255504608,
0.35819438099861145,
-0.5165072083473206,
0.23694318532943726,
-2.2373406887054443,
-1.397388219833374,
-0.21246843039989471,
-1.0200355052947998,
0.5644869804382324,
-0.4847754240036011,
0.7308440208435059,
-0.16314274072647095,
0.0848526731133461,
0.35196778178215027,
1.4533584117889404,
3.4871230125427246,
0.3501950204372406,
0.23231551051139832,
-0.16174568235874176,
-0.9163650870323181,
1.4485405683517456,
0.8820909261703491,
-0.14163245260715485,
-0.4612169563770294,
-1.0630098581314087,
1.274145245552063,
1.925453543663025,
0.9740909337997437,
0.008530714549124241,
-0.8385993838310242,
-0.6547790765762329,
-0.10863492637872696,
0.18460406363010406,
0.43555667996406555,
0.8504407405853271,
0.024335265159606934,
0.11323582381010056,
1.6079505681991577,
1.1191754341125488,
-0.42114582657814026,
0.29346299171447754,
-0.8823316097259521,
-0.5573506355285645,
0.5331344604492188,
0.2501004934310913,
-0.04473372548818588,
0.4201774597167969,
-1.0200068950653076,
-0.24003547430038452,
-0.5008541941642761,
-0.8109504580497742,
-0.5801876783370972,
-0.34428152441978455,
-0.3354974091053009,
1.5382336378097534,
0.13407258689403534,
-0.535563588142395,
-0.05029802769422531,
-0.7184199690818787,
-0.15208032727241516,
-1.0841058492660522,
0.20047958195209503,
-0.08993510156869888,
-0.18755897879600525,
-0.2207867056131363,
1.7313013076782227,
-0.9045934677124023,
-2.0203936100006104,
0.16349686682224274,
0.24441421031951904,
-0.22277233004570007,
0.218205988407135,
1.670060157775879,
0.5392380356788635,
1.494390606880188,
1.300112247467041,
0.8296870589256287,
-0.7660064101219177,
-1.2328438758850098,
0.6298481822013855,
0.9549115896224976,
-1.2755624055862427,
0.8138819336891174,
-0.14065292477607727,
-0.588032066822052,
0.6462461948394775,
1.2756270170211792,
0.4858047664165497,
-1.9531500339508057,
0.8824676871299744,
-0.987151563167572,
0.8461098670959473,
0.7077224850654602,
0.6150422692298889,
0.13212716579437256,
0.9137816429138184,
-1.1336076259613037,
-1.1497489213943481,
-0.7383182644844055,
-0.6841639280319214,
2.029232978820801,
-0.3736821711063385,
0.6170023679733276,
-0.305267333984375,
-1.2236652374267578,
-0.07149877399206161,
0.6297922730445862,
0.35564011335372925,
-0.3844760060310364,
0.8192082643508911,
-0.6782965064048767,
-1.0067262649536133,
-1.3720638751983643,
-0.3132324516773224,
-1.0455069541931152,
-0.9588102698326111,
1.126876711845398,
0.7484819293022156,
0.27933093905448914,
1.873724102973938,
0.7179471850395203,
0.25808006525039673,
-2.523658037185669,
0.865135133266449,
0.24471011757850647,
-0.06647054851055145,
0.8396255373954773,
0.32536593079566956,
1.0245518684387207,
-0.0029771486297249794,
0.3589571416378021,
-2.3444271087646484,
2.238647699356079,
-0.23929260671138763,
0.7099829316139221,
-0.12720708549022675,
-0.2041039764881134,
1.1990563869476318,
0.5897359251976013,
0.5795250535011292,
-0.9684501886367798,
0.5881766676902771,
-0.45790570974349976,
1.1716800928115845,
0.9075704216957092,
-0.7590293884277344,
-0.021304506808519363,
1.4559191465377808,
0.5283222198486328,
-0.5869848728179932,
-1.012044072151184,
-0.8688833713531494,
0.9706271290779114,
1.6971489191055298,
0.013180105946958065,
-0.04263179749250412,
0.7476930618286133,
0.6251948475837708,
-1.2578420639038086,
0.06366746872663498,
-0.7837948799133301,
-0.743187665939331,
1.650525450706482,
2.1593101024627686,
-0.1920158565044403,
-0.1858271062374115,
-0.5954837203025818,
-1.3251240253448486,
0.8201265335083008,
-0.18841370940208435,
0.21908697485923767,
0.6579183340072632,
-0.6319159865379333,
1.0431808233261108,
0.8548022508621216,
0.9431045651435852,
0.18937088549137115,
0.22996044158935547,
0.42389950156211853,
-0.2698693871498108,
-1.1744086742401123,
-0.197729229927063,
-0.9924429655075073,
-2.430462121963501,
0.3464811146259308,
-0.18361136317253113,
-1.4520012140274048,
-0.007179897278547287,
-0.9416091442108154,
1.0813363790512085,
-0.5287900567054749,
-1.0082286596298218,
-1.6026647090911865,
0.22825774550437927,
0.026386946439743042,
0.9838540554046631,
-1.489453673362732,
-0.2564069628715515,
1.2190446853637695,
0.9252273440361023,
-0.7178826332092285,
0.9919376373291016,
0.17244131863117218,
1.037796974182129,
0.7403044104576111,
-0.4199720025062561,
0.48396962881088257,
-0.035866089165210724,
-1.3821606636047363,
0.43293091654777527,
1.103021502494812,
0.18771657347679138,
1.5564321279525757,
-0.41388726234436035,
0.052384670823812485,
0.38256216049194336,
-0.5746726989746094,
-0.5428091287612915,
-0.41241180896759033,
0.6150419116020203,
-0.01723260059952736,
-0.8379602432250977,
-0.06728027760982513,
-0.10352642089128494,
-0.4077965021133423,
0.2435477077960968,
-1.4291775226593018,
-0.07519030570983887,
-0.4554952085018158,
-0.6712021827697754,
-1.1629090309143066,
0.007816231809556484,
1.392857313156128,
-0.8085682988166809,
-0.25095483660697937,
0.47172585129737854,
0.3985007107257843,
0.5679200291633606,
0.6659947037696838,
-0.7324791550636292,
-0.19443729519844055,
-0.29704463481903076,
-0.22565403580665588,
0.3378969132900238,
1.3400896787643433,
-0.1702178418636322,
-0.930981457233429,
0.6592016220092773,
-0.32588785886764526,
0.05622527748346329,
1.9597617387771606,
0.14237681031227112,
-0.6844158172607422,
0.3078647255897522,
-0.8231201171875,
1.8990585803985596,
1.6708900928497314,
1.390154480934143,
-0.12119341641664505,
-0.9230054020881653,
0.6045201420783997,
-0.3311660587787628,
-0.4165627658367157,
0.8517376184463501,
0.35990574955940247,
-0.1610601544380188,
-1.4503284692764282,
0.8456893563270569,
1.1876111030578613,
-0.9227926731109619,
-0.7225275635719299,
0.17091932892799377,
-0.8049538135528564,
1.1081762313842773,
0.5765491127967834,
0.4501226246356964,
0.36290815472602844,
1.6599587202072144,
0.834705650806427,
-0.5125017166137695,
0.41426587104797363,
0.659954845905304,
-0.13583262264728546,
-2.057957172393799,
-1.187387466430664,
0.3137979507446289,
-0.5749719738960266,
-1.6279228925704956,
1.4177607297897339,
-1.134568452835083,
-1.0377085208892822,
0.6076139211654663,
0.049868300557136536,
1.317331075668335,
0.39378345012664795,
1.5482600927352905,
2.0531957149505615,
0.8406184315681458,
0.40018054842948914,
1.2433961629867554,
-0.1432974487543106,
-0.3985901474952698,
1.889258861541748,
-0.4045635163784027,
0.4332362115383148,
1.0669045448303223,
-0.332061767578125,
-1.1106126308441162,
-0.6742843985557556,
-1.2444744110107422,
-0.750117838382721,
1.127044677734375,
0.04141845554113388,
-1.040052056312561,
0.1904064267873764,
1.5578595399856567,
0.1309056282043457,
-0.3922520875930786,
0.6692607402801514,
0.4190164804458618,
-0.7614217400550842,
-0.004536524415016174,
-0.9071465730667114,
0.5500465631484985,
-0.150699645280838,
-0.35957688093185425,
0.2972530126571655,
0.41423073410987854,
1.479291558265686,
-0.10432679951190948,
0.15623675286769867,
1.1179693937301636,
-1.410143256187439,
1.4670337438583374,
-0.6514564752578735,
0.24800556898117065,
-2.429887294769287,
1.379260778427124,
-0.7427778244018555,
1.9628854990005493,
-2.70932674407959,
0.5115440487861633,
-0.6389323472976685,
-0.40592947602272034,
0.28467604517936707,
-0.36299681663513184,
0.12426966428756714,
-0.07199089229106903,
-1.1991679668426514,
0.007193167693912983,
-0.5953764319419861,
0.6838774681091309,
1.1983853578567505,
1.3780796527862549,
-1.148268699645996,
-0.2652129828929901,
-1.6803311109542847,
-0.10762277245521545,
-0.8302258253097534,
0.3208133280277252,
-2.021413803100586,
-0.24789632856845856,
-1.8240808248519897,
-2.4717650413513184,
-1.2848080396652222,
-0.7293521165847778,
1.1449618339538574,
0.20339424908161163,
-0.9671533703804016,
1.3120347261428833,
-0.4533609449863434,
-1.906899333000183,
1.1683073043823242,
-2.1942851543426514
] |
https://github.com/huggingface/datasets/issues/6066 | AttributeError: '_tqdm_cls' object has no attribute '_lock' | Hi ! I opened https://github.com/huggingface/datasets/pull/6067 to add the missing `_lock`
We'll do a patch release soon, but feel free to install `datasets` from source in the meantime | ### Describe the bug
```python
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/site-packages/datasets/load.py", line 1034, in get_module
data_files = DataFilesDict.from_patterns(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/site-packages/datasets/data_files.py", line 671, in from_patterns
DataFilesList.from_patterns(
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/site-packages/datasets/data_files.py", line 586, in from_patterns
origin_metadata = _get_origin_metadata(data_files, download_config=download_config)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/site-packages/datasets/data_files.py", line 502, in _get_origin_metadata
return thread_map(
^^^^^^^^^^^
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/site-packages/tqdm/contrib/concurrent.py", line 70, in thread_map
return _executor_map(ThreadPoolExecutor, fn, *iterables, **tqdm_kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/site-packages/tqdm/contrib/concurrent.py", line 48, in _executor_map
with ensure_lock(tqdm_class, lock_name=lock_name) as lk:
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/contextlib.py", line 144, in __exit__
next(self.gen)
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/site-packages/tqdm/contrib/concurrent.py", line 25, in ensure_lock
del tqdm_class._lock
^^^^^^^^^^^^^^^^
AttributeError: '_tqdm_cls' object has no attribute '_lock'
```
### Steps to reproduce the bug
Happens ocasionally.
### Expected behavior
I added a print in tqdm `ensure_lock()`, got a `ensure_lock <datasets.utils.logging._tqdm_cls object at 0x16dddead0> ` print.
According to the code in https://github.com/tqdm/tqdm/blob/master/tqdm/contrib/concurrent.py#L24
```python
@contextmanager
def ensure_lock(tqdm_class, lock_name=""):
"""get (create if necessary) and then restore `tqdm_class`'s lock"""
print("ensure_lock", tqdm_class, lock_name)
old_lock = getattr(tqdm_class, '_lock', None) # don't create a new lock
lock = old_lock or tqdm_class.get_lock() # maybe create a new lock
lock = getattr(lock, lock_name, lock) # maybe subtype
tqdm_class.set_lock(lock)
yield lock
if old_lock is None:
del tqdm_class._lock # <-- It tries to del the `_lock` attribute from tqdm_class.
else:
tqdm_class.set_lock(old_lock)
```
But, huggingface datasets `datasets.utils.logging._tqdm_cls` does not have the field `_lock`: https://github.com/huggingface/datasets/blob/main/src/datasets/utils/logging.py#L205
```python
class _tqdm_cls:
def __call__(self, *args, disable=False, **kwargs):
if _tqdm_active and not disable:
return tqdm_lib.tqdm(*args, **kwargs)
else:
return EmptyTqdm(*args, **kwargs)
def set_lock(self, *args, **kwargs):
self._lock = None
if _tqdm_active:
return tqdm_lib.tqdm.set_lock(*args, **kwargs)
def get_lock(self):
if _tqdm_active:
return tqdm_lib.tqdm.get_lock()
```
### Environment info
Python 3.11.4
tqdm '4.65.0'
datasets master | 18 | 27 | AttributeError: '_tqdm_cls' object has no attribute '_lock'
### Describe the bug
```python
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/site-packages/datasets/load.py", line 1034, in get_module
data_files = DataFilesDict.from_patterns(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/site-packages/datasets/data_files.py", line 671, in from_patterns
DataFilesList.from_patterns(
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/site-packages/datasets/data_files.py", line 586, in from_patterns
origin_metadata = _get_origin_metadata(data_files, download_config=download_config)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/site-packages/datasets/data_files.py", line 502, in _get_origin_metadata
return thread_map(
^^^^^^^^^^^
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/site-packages/tqdm/contrib/concurrent.py", line 70, in thread_map
return _executor_map(ThreadPoolExecutor, fn, *iterables, **tqdm_kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/site-packages/tqdm/contrib/concurrent.py", line 48, in _executor_map
with ensure_lock(tqdm_class, lock_name=lock_name) as lk:
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/contextlib.py", line 144, in __exit__
next(self.gen)
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/site-packages/tqdm/contrib/concurrent.py", line 25, in ensure_lock
del tqdm_class._lock
^^^^^^^^^^^^^^^^
AttributeError: '_tqdm_cls' object has no attribute '_lock'
```
### Steps to reproduce the bug
Happens ocasionally.
### Expected behavior
I added a print in tqdm `ensure_lock()`, got a `ensure_lock <datasets.utils.logging._tqdm_cls object at 0x16dddead0> ` print.
According to the code in https://github.com/tqdm/tqdm/blob/master/tqdm/contrib/concurrent.py#L24
```python
@contextmanager
def ensure_lock(tqdm_class, lock_name=""):
"""get (create if necessary) and then restore `tqdm_class`'s lock"""
print("ensure_lock", tqdm_class, lock_name)
old_lock = getattr(tqdm_class, '_lock', None) # don't create a new lock
lock = old_lock or tqdm_class.get_lock() # maybe create a new lock
lock = getattr(lock, lock_name, lock) # maybe subtype
tqdm_class.set_lock(lock)
yield lock
if old_lock is None:
del tqdm_class._lock # <-- It tries to del the `_lock` attribute from tqdm_class.
else:
tqdm_class.set_lock(old_lock)
```
But, huggingface datasets `datasets.utils.logging._tqdm_cls` does not have the field `_lock`: https://github.com/huggingface/datasets/blob/main/src/datasets/utils/logging.py#L205
```python
class _tqdm_cls:
def __call__(self, *args, disable=False, **kwargs):
if _tqdm_active and not disable:
return tqdm_lib.tqdm(*args, **kwargs)
else:
return EmptyTqdm(*args, **kwargs)
def set_lock(self, *args, **kwargs):
self._lock = None
if _tqdm_active:
return tqdm_lib.tqdm.set_lock(*args, **kwargs)
def get_lock(self):
if _tqdm_active:
return tqdm_lib.tqdm.get_lock()
```
### Environment info
Python 3.11.4
tqdm '4.65.0'
datasets master
Hi ! I opened https://github.com/huggingface/datasets/pull/6067 to add the missing `_lock`
We'll do a patch release soon, but feel free to install `datasets` from source in the meantime | [
-1.3521512746810913,
-0.8465626835823059,
-0.5868315100669861,
1.283677339553833,
0.03677382320165634,
-0.8991362452507019,
0.05178180709481239,
-1.024348497390747,
1.9279330968856812,
-0.5640751123428345,
0.19435115158557892,
-1.4659757614135742,
-0.12366081774234772,
-0.3550596237182617,
-0.6583359837532043,
-1.0089880228042603,
-0.22304120659828186,
-0.8023163080215454,
1.1088749170303345,
2.6884775161743164,
1.156903862953186,
-1.3759241104125977,
2.642866849899292,
0.7988353967666626,
-0.24207842350006104,
-0.7284358143806458,
0.5179723501205444,
-0.011512529104948044,
-1.1826525926589966,
-0.6495604515075684,
-1.0175813436508179,
0.022053562104701996,
-0.6313120722770691,
-0.3401859402656555,
-0.02158968523144722,
0.13139449059963226,
-0.20061808824539185,
-0.2873065769672394,
-0.9021544456481934,
-0.6910043358802795,
0.548274040222168,
-0.2852327525615692,
0.962647020816803,
-0.3649974763393402,
1.8277539014816284,
-0.6605496406555176,
0.6081895232200623,
0.7097229957580566,
1.1302821636199951,
0.03843861073255539,
-0.02079499140381813,
0.534895122051239,
0.3973972499370575,
-0.030856993049383163,
0.7792328596115112,
1.1679213047027588,
0.6481515765190125,
0.5231693983078003,
0.3747190535068512,
-2.402606964111328,
1.3480474948883057,
-1.1254764795303345,
0.2611131966114044,
1.3818163871765137,
-0.7771731615066528,
0.33440378308296204,
-1.6795424222946167,
0.18649689853191376,
0.7953941226005554,
-2.4113516807556152,
0.21887235343456268,
-1.3777607679367065,
-0.6116394400596619,
1.02347731590271,
0.4455806314945221,
-1.1382908821105957,
0.04288424551486969,
-0.4744756817817688,
1.1887880563735962,
0.16459180414676666,
1.323036789894104,
-1.5153446197509766,
0.07853391021490097,
-0.16390080749988556,
0.40112704038619995,
-1.1884578466415405,
-1.63075590133667,
0.47040989995002747,
0.5899773836135864,
0.26367324590682983,
-0.20505091547966003,
1.0199583768844604,
-0.9974428415298462,
0.5892379283905029,
-0.879410445690155,
-1.5193231105804443,
-1.6370117664337158,
-2.5339717864990234,
-2.419931411743164,
0.7907775044441223,
-0.6993247866630554,
-0.3508959710597992,
2.1170456409454346,
-1.1112667322158813,
-1.5155402421951294,
0.9031490683555603,
0.1301542967557907,
0.18626834452152252,
2.1760153770446777,
0.0870685800909996,
-0.6804654598236084,
0.37824180722236633,
-0.726199746131897,
0.7385104894638062,
-0.30165982246398926,
1.4342628717422485,
0.5134738087654114,
-1.1090902090072632,
1.4783711433410645,
-0.5905486345291138,
0.5421697497367859,
-0.35697025060653687,
-0.5581348538398743,
-0.7811577320098877,
0.4774627089500427,
1.9544063806533813,
-0.3682940602302551,
1.717416763305664,
-0.5249424576759338,
-1.5466097593307495,
-1.4526327848434448,
0.8967746496200562,
0.4380446970462799,
-0.9256751537322998,
0.3436538577079773,
-0.6989375352859497,
0.06934519857168198,
-0.1274934858083725,
1.2606428861618042,
1.4358786344528198,
0.8622769117355347,
-0.28867924213409424,
-0.9380638599395752,
0.21729804575443268,
-0.180426687002182,
-0.8059960007667542,
-1.8390917778015137,
-0.16765767335891724,
0.10799171775579453,
0.6952167749404907,
-1.334524154663086,
1.5881760120391846,
0.8184784650802612,
1.9953057765960693,
0.8810362219810486,
-0.3565824329853058,
1.5788503885269165,
0.10273914039134979,
1.9695619344711304,
-0.7274723052978516,
0.6091565489768982,
-0.25802770256996155,
-1.13075590133667,
0.602349579334259,
-0.5166391730308533,
-2.019538164138794,
-0.7058054208755493,
-0.7484105825424194,
-0.07471983879804611,
-0.8735766410827637,
0.8328580856323242,
-0.07892382144927979,
-1.3269766569137573,
0.037220317870378494,
-0.6979303359985352,
0.525588870048523,
-1.268679141998291,
0.19269853830337524,
0.7282240986824036,
-0.40709948539733887,
0.19289961457252502,
-0.30141860246658325,
-1.2765871286392212,
-0.44538742303848267,
0.2148360311985016,
1.7092931270599365,
-0.3832385241985321,
0.6793234348297119,
1.2920857667922974,
-0.7202000617980957,
-0.05136673152446747,
0.24222339689731598,
-0.31593912839889526,
0.8499449491500854,
-1.213307499885559,
-0.4020674526691437,
1.103127121925354,
-0.12177959829568863,
-0.538506269454956,
1.2828400135040283,
0.7414155006408691,
-1.4261047840118408,
-0.3345857858657837,
-0.1103140339255333,
-0.800789475440979,
0.229596808552742,
-1.599118947982788,
-0.13479000329971313,
0.3764839768409729,
-1.6156822443008423,
-0.42269524931907654,
-0.2238057255744934,
1.2895721197128296,
-0.4028053879737854,
1.5293537378311157,
-0.02884598821401596,
0.03283382207155228,
-0.41834840178489685,
-0.23257780075073242,
0.32171517610549927,
-0.152330681681633,
-0.7775755524635315,
0.37977704405784607,
-0.6720184087753296,
0.2616594433784485,
1.236938238143921,
0.21759240329265594,
-0.2889638841152191,
0.292082816362381,
1.2093192338943481,
0.35908243060112,
-0.23396429419517517,
-0.8236218690872192,
-1.7396965026855469,
1.9075483083724976,
-1.2333664894104004,
1.735875129699707,
0.8410902619361877,
0.06864677369594574,
-1.9759607315063477,
-1.9344966411590576,
0.9765974283218384,
1.1564213037490845,
2.433076858520508,
0.29628849029541016,
0.5317174792289734,
-0.816351056098938,
-0.6313667893409729,
0.2908959686756134,
-0.8242727518081665,
-0.6654465198516846,
0.28600338101387024,
2.3161346912384033,
1.744185447692871,
-0.5277401804924011,
-0.16757617890834808,
-0.9070008993148804,
0.9472280740737915,
-0.1560613512992859,
0.1032833382487297,
1.8340047597885132,
-0.21770057082176208,
-1.109144926071167,
1.2990546226501465,
-2.280304193496704,
0.3642001152038574,
1.896501064300537,
0.3428557813167572,
0.14780259132385254,
-1.515293002128601,
-0.7185305953025818,
-0.2297145128250122,
-0.47209396958351135,
-1.2793437242507935,
0.5771636366844177,
-0.04452018067240715,
-1.1568613052368164,
-1.4738106727600098,
0.17234741151332855,
-1.0940903425216675,
-1.6372356414794922,
0.09702835232019424,
1.6472487449645996,
1.7815272808074951,
-0.9347864389419556,
1.2636431455612183,
-0.2786821722984314,
-0.058101311326026917,
1.3028626441955566,
1.2421928644180298,
3.1923696994781494,
2.0930440425872803,
-1.3588863611221313,
0.7501751184463501,
-0.45425325632095337,
-0.48371684551239014,
1.3359118700027466,
-1.3969383239746094,
1.0847744941711426,
-0.08317103981971741,
-1.2431195974349976,
-1.1207540035247803,
1.196039080619812,
0.49201297760009766,
-0.017637604847550392,
-0.39043474197387695,
1.4444079399108887,
0.08816592395305634,
1.329132080078125,
0.5904709696769714,
-0.3448835015296936,
0.5995341539382935,
-0.2379176914691925,
-0.3511018753051758,
1.4434895515441895,
0.16469095647335052,
-1.3172589540481567,
-2.0604515075683594,
-0.30608969926834106,
-1.092736840248108,
-0.18789948523044586,
-0.6453109383583069,
-0.8920084238052368,
1.4902311563491821,
0.4073588252067566,
-1.0816891193389893,
-0.48647788166999817,
-0.4077385365962982,
-0.694445013999939,
2.6950268745422363,
-1.438475251197815,
-0.12085571885108948,
-1.0280990600585938,
-0.37704789638519287,
1.7620261907577515,
-1.2021361589431763,
-0.1440926343202591,
-1.0291293859481812,
-0.5072453618049622,
-1.343376636505127,
-0.40150928497314453,
-0.15733928978443146,
-0.8161590695381165,
0.8386436104774475,
0.29525089263916016,
-1.2216306924819946,
-0.307094007730484,
-0.6104503870010376,
0.8233334422111511,
-0.00845920480787754,
0.21250730752944946,
1.8285976648330688,
0.20871397852897644,
-0.5204732418060303,
0.6522339582443237,
1.2864199876785278,
0.8206965327262878,
-0.7473633885383606,
0.01238060649484396,
-0.877595067024231,
0.2103065550327301,
-1.8275014162063599,
0.2577137053012848,
-2.6765716075897217,
0.745964527130127,
-0.21918867528438568,
-0.16634029150009155,
-0.1883762925863266,
-1.3646878004074097,
0.9899558424949646,
2.4431285858154297,
-1.222352147102356,
0.34013426303863525,
0.558910608291626,
1.129453420639038,
-1.52141535282135,
0.27728357911109924,
-0.5472350716590881,
1.9673813581466675,
0.3606279194355011,
1.29331374168396,
-0.26412132382392883,
-2.2942326068878174,
0.7008957862854004,
-0.9900544285774231,
-0.7993454337120056,
0.9848408699035645,
-1.036194920539856,
0.10173735022544861,
-1.6293010711669922,
-0.4484351575374603,
-0.7917584776878357,
-1.3042129278182983,
0.4027526080608368,
0.10850761830806732,
0.4813213050365448,
-0.8338385820388794,
0.4156211018562317,
-2.1256425380706787,
-1.280670166015625,
-0.14467526972293854,
-0.9829208850860596,
0.6360070705413818,
-0.3579353094100952,
0.5913558006286621,
0.045186858624219894,
0.1168600469827652,
0.3235798180103302,
1.642377257347107,
3.5620157718658447,
0.1342773586511612,
0.2802782654762268,
-0.03751535341143608,
-0.9832461476325989,
1.1756844520568848,
0.699571967124939,
-0.07713732123374939,
-0.6242050528526306,
-1.064204216003418,
1.3947227001190186,
1.9391998052597046,
1.1102224588394165,
0.11502466350793839,
-0.9782136082649231,
-0.9323775768280029,
0.11117929965257645,
0.19524629414081573,
0.45118585228919983,
0.8819080591201782,
0.14739590883255005,
0.13738112151622772,
1.4058096408843994,
1.1642804145812988,
-0.3376760482788086,
0.2272675782442093,
-0.8579511642456055,
-0.3494069278240204,
0.6956281661987305,
0.24563147127628326,
0.15718181431293488,
0.6150067448616028,
-1.0578062534332275,
-0.3040401339530945,
-0.1187351644039154,
-1.033526062965393,
-0.8469188213348389,
-0.3645491302013397,
-0.2851758599281311,
1.6337007284164429,
0.2335965484380722,
-0.48823320865631104,
0.18423989415168762,
-0.4957510828971863,
-0.13290081918239594,
-1.1375561952590942,
0.07648321986198425,
-0.10401888191699982,
0.01050268393009901,
-0.14036229252815247,
1.5430327653884888,
-0.7817375063896179,
-1.9662758111953735,
0.02723463624715805,
0.2289348542690277,
-0.28549960255622864,
0.2778286933898926,
1.876517415046692,
0.5024697780609131,
1.791791558265686,
1.02422297000885,
1.1390247344970703,
-0.47523459792137146,
-1.336104154586792,
0.7638934254646301,
1.0105618238449097,
-1.4831258058547974,
0.7561991214752197,
-0.2655555307865143,
-0.6414832472801208,
0.6192159056663513,
1.3197944164276123,
0.3682551980018616,
-1.8802424669265747,
1.0183417797088623,
-0.8876082301139832,
0.7711708545684814,
0.5310311317443848,
0.9148852229118347,
-0.02934601902961731,
0.8280729055404663,
-1.341902494430542,
-1.0763003826141357,
-0.5112506151199341,
-0.7666745781898499,
1.7777831554412842,
-0.33654695749282837,
0.47715476155281067,
-0.18093575537204742,
-1.3464833498001099,
0.04348471015691757,
0.9014179706573486,
0.09589551389217377,
-0.5071082711219788,
1.235575795173645,
-0.7955337762832642,
-1.2208199501037598,
-1.3365451097488403,
-0.4627600908279419,
-0.8945221304893494,
-0.8102182745933533,
1.1722508668899536,
0.8489481806755066,
0.3076280951499939,
1.931687593460083,
0.5728175640106201,
0.2557595372200012,
-2.676346778869629,
0.7806742787361145,
0.07530584931373596,
0.1754676252603531,
0.9270681738853455,
0.2305983155965805,
1.0851138830184937,
-0.13302747905254364,
0.6602859497070312,
-2.2139697074890137,
2.190561532974243,
-0.06898049265146255,
0.6678903698921204,
-0.27786168456077576,
-0.24984021484851837,
0.8927656412124634,
0.48498299717903137,
0.743829071521759,
-1.4213987588882446,
0.8266007900238037,
-0.4907926023006439,
0.9112980365753174,
0.6877413988113403,
-0.7418578267097473,
-0.10262042284011841,
1.0204861164093018,
0.5001095533370972,
-0.38696756958961487,
-0.9797511696815491,
-0.9291428327560425,
1.1279083490371704,
1.6088098287582397,
-0.04091116413474083,
-0.0063375914469361305,
0.7068549394607544,
0.6967776417732239,
-1.119896650314331,
0.3266255855560303,
-0.7109658718109131,
-0.6586567759513855,
1.3143470287322998,
2.0225086212158203,
-0.10523401200771332,
-0.19205746054649353,
-0.6288843154907227,
-1.1921111345291138,
0.4705393612384796,
-0.14703509211540222,
0.45896822214126587,
0.6097984910011292,
-0.6311136484146118,
0.7907437682151794,
0.853172242641449,
0.9281733632087708,
0.11423075199127197,
0.3773452043533325,
0.5226050615310669,
-0.4893872141838074,
-0.9468663334846497,
-0.5079358220100403,
-0.9944900274276733,
-2.772594928741455,
0.4865324795246124,
-0.31221452355384827,
-1.7003687620162964,
0.13714314997196198,
-1.1598178148269653,
0.9037516713142395,
-0.6062751412391663,
-1.4831300973892212,
-1.3606762886047363,
0.3976737856864929,
-0.018978750333189964,
1.126449704170227,
-1.5416712760925293,
-0.10684391856193542,
1.3499733209609985,
0.9306431412696838,
-0.20869342982769012,
0.7041609883308411,
0.3663647174835205,
1.0119878053665161,
1.1269590854644775,
-0.1746334284543991,
0.5356847643852234,
0.31965020298957825,
-1.226167917251587,
0.44694799184799194,
1.1744554042816162,
0.3333441913127899,
1.4427132606506348,
-0.35785728693008423,
0.17492975294589996,
0.5848684310913086,
-0.7010063529014587,
-0.5601987242698669,
-0.2631869614124298,
0.35074901580810547,
0.3718017339706421,
-1.1137945652008057,
-0.14256711304187775,
-0.3362291157245636,
0.004177388735115528,
-0.11863942444324493,
-1.3614659309387207,
-0.3265659213066101,
-0.3982192873954773,
-0.686803936958313,
-1.4375382661819458,
0.07430471479892731,
1.2458163499832153,
-0.7400732040405273,
-0.09871954470872879,
0.38881802558898926,
0.46149173378944397,
0.5702497959136963,
0.509876012802124,
-0.7289793491363525,
-0.45075181126594543,
-0.1696815937757492,
-0.25022801756858826,
0.1599012315273285,
1.0350897312164307,
-0.12144225835800171,
-1.0334320068359375,
0.6304041147232056,
-0.278475284576416,
0.19349141418933868,
1.8877155780792236,
0.12918412685394287,
-0.8450613021850586,
0.42738577723503113,
-0.5980470776557922,
1.7481648921966553,
1.7766462564468384,
1.4082164764404297,
-0.08475938439369202,
-0.8481414318084717,
0.4641878008842468,
-0.5516619682312012,
-0.12393351644277573,
0.9465259313583374,
0.6039053797721863,
-0.22551381587982178,
-1.3075534105300903,
0.5837433934211731,
1.3028631210327148,
-1.0849767923355103,
-0.7287118434906006,
0.353732168674469,
-0.6826037764549255,
1.322310447692871,
0.624575138092041,
0.07813600450754166,
0.2458200603723526,
1.6093138456344604,
0.7779735326766968,
-0.535224437713623,
0.5232193470001221,
0.7197362780570984,
-0.4259026348590851,
-2.314595937728882,
-1.2201613187789917,
0.3978528082370758,
-0.38476404547691345,
-1.3012583255767822,
1.393068790435791,
-1.1441254615783691,
-1.0403860807418823,
0.6296542286872864,
0.05764849856495857,
1.1507059335708618,
0.19841574132442474,
1.7154958248138428,
2.253068685531616,
0.757347583770752,
0.257707804441452,
1.313523530960083,
0.1278500258922577,
-0.47213754057884216,
1.9872981309890747,
-0.26319774985313416,
0.4560069441795349,
0.8710852265357971,
-0.5018423795700073,
-1.1134164333343506,
-1.0161212682724,
-1.1849862337112427,
-0.6824880242347717,
1.3156335353851318,
0.11360086500644684,
-0.9215918183326721,
0.4901082217693329,
1.7598676681518555,
0.16926084458827972,
-0.24960167706012726,
0.6341556310653687,
0.5583701729774475,
-0.7889825105667114,
-0.020468756556510925,
-1.2578049898147583,
0.6289879679679871,
-0.1664561629295349,
-0.09694315493106842,
0.08676231652498245,
0.7347716093063354,
1.2358806133270264,
0.09766668826341629,
-0.12577080726623535,
1.1313918828964233,
-1.4748961925506592,
1.6798367500305176,
-0.5699650049209595,
0.45263174176216125,
-2.3144304752349854,
1.1421259641647339,
-0.6715932488441467,
1.9252856969833374,
-2.450446367263794,
0.5139152407646179,
-0.7128379344940186,
-0.4163958430290222,
0.28455430269241333,
-0.4057167172431946,
0.14052660763263702,
-0.18454530835151672,
-1.046558141708374,
-0.14424367249011993,
-1.0758476257324219,
0.7310072779655457,
1.146992802619934,
1.4003256559371948,
-1.2156238555908203,
-0.0036764685064554214,
-1.3482110500335693,
-0.08654996007680893,
-0.8571937084197998,
0.23416702449321747,
-1.6697404384613037,
-0.28050923347473145,
-2.1111562252044678,
-2.304094076156616,
-1.326977252960205,
-0.7295746803283691,
1.0908632278442383,
0.22760042548179626,
-0.8652193546295166,
1.0831001996994019,
-0.6321773529052734,
-1.8993183374404907,
0.9742449522018433,
-2.2420873641967773
] |
https://github.com/huggingface/datasets/issues/6066 | AttributeError: '_tqdm_cls' object has no attribute '_lock' | I have tested the latest main, it does not work.
I add more logs to reproduce this issue, it looks like a multi threading bug:
```python
@contextmanager
def ensure_lock(tqdm_class, lock_name=""):
"""get (create if necessary) and then restore `tqdm_class`'s lock"""
import os
import threading
print(os.getpid(), threading.get_ident(), "ensure_lock", tqdm_class, lock_name)
old_lock = getattr(tqdm_class, '_lock', None) # don't create a new lock
lock = old_lock or tqdm_class.get_lock() # maybe create a new lock
lock = getattr(lock, lock_name, lock) # maybe subtype
tqdm_class.set_lock(lock)
print(os.getpid(), threading.get_ident(), "set_lock")
yield lock
if old_lock is None:
print(os.getpid(), threading.get_ident(), "del tqdm_class")
del tqdm_class._lock
else:
tqdm_class.set_lock(old_lock)
```
output
```
64943 8424758784 ensure_lock <datasets.utils.logging._tqdm_cls object at 0x2aa7fb250>
64943 8424758784 set_lock
64943 8424758784 del tqdm_class
64943 8424758784 ensure_lock <datasets.utils.logging._tqdm_cls object at 0x2aa7fb250>
64943 8424758784 set_lock
64943 8424758784 del tqdm_class
64943 11638370304 ensure_lock <datasets.utils.logging._tqdm_cls object at 0x2aa7fb250>
64943 11638370304 set_lock
64943 11568967680 ensure_lock <datasets.utils.logging._tqdm_cls object at 0x2aa7fb250>
64943 11568967680 set_lock
64943 11638370304 del tqdm_class
64943 11638370304 ensure_lock <datasets.utils.logging._tqdm_cls object at 0x2aa7fb250>
64943 11638370304 set_lock
64943 11638370304 del tqdm_class
64943 11568967680 del tqdm_class
```
Thread `11638370304` del the _lock from tqdm_class first, then thread `11568967680` del _lock failed. | ### Describe the bug
```python
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/site-packages/datasets/load.py", line 1034, in get_module
data_files = DataFilesDict.from_patterns(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/site-packages/datasets/data_files.py", line 671, in from_patterns
DataFilesList.from_patterns(
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/site-packages/datasets/data_files.py", line 586, in from_patterns
origin_metadata = _get_origin_metadata(data_files, download_config=download_config)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/site-packages/datasets/data_files.py", line 502, in _get_origin_metadata
return thread_map(
^^^^^^^^^^^
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/site-packages/tqdm/contrib/concurrent.py", line 70, in thread_map
return _executor_map(ThreadPoolExecutor, fn, *iterables, **tqdm_kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/site-packages/tqdm/contrib/concurrent.py", line 48, in _executor_map
with ensure_lock(tqdm_class, lock_name=lock_name) as lk:
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/contextlib.py", line 144, in __exit__
next(self.gen)
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/site-packages/tqdm/contrib/concurrent.py", line 25, in ensure_lock
del tqdm_class._lock
^^^^^^^^^^^^^^^^
AttributeError: '_tqdm_cls' object has no attribute '_lock'
```
### Steps to reproduce the bug
Happens ocasionally.
### Expected behavior
I added a print in tqdm `ensure_lock()`, got a `ensure_lock <datasets.utils.logging._tqdm_cls object at 0x16dddead0> ` print.
According to the code in https://github.com/tqdm/tqdm/blob/master/tqdm/contrib/concurrent.py#L24
```python
@contextmanager
def ensure_lock(tqdm_class, lock_name=""):
"""get (create if necessary) and then restore `tqdm_class`'s lock"""
print("ensure_lock", tqdm_class, lock_name)
old_lock = getattr(tqdm_class, '_lock', None) # don't create a new lock
lock = old_lock or tqdm_class.get_lock() # maybe create a new lock
lock = getattr(lock, lock_name, lock) # maybe subtype
tqdm_class.set_lock(lock)
yield lock
if old_lock is None:
del tqdm_class._lock # <-- It tries to del the `_lock` attribute from tqdm_class.
else:
tqdm_class.set_lock(old_lock)
```
But, huggingface datasets `datasets.utils.logging._tqdm_cls` does not have the field `_lock`: https://github.com/huggingface/datasets/blob/main/src/datasets/utils/logging.py#L205
```python
class _tqdm_cls:
def __call__(self, *args, disable=False, **kwargs):
if _tqdm_active and not disable:
return tqdm_lib.tqdm(*args, **kwargs)
else:
return EmptyTqdm(*args, **kwargs)
def set_lock(self, *args, **kwargs):
self._lock = None
if _tqdm_active:
return tqdm_lib.tqdm.set_lock(*args, **kwargs)
def get_lock(self):
if _tqdm_active:
return tqdm_lib.tqdm.get_lock()
```
### Environment info
Python 3.11.4
tqdm '4.65.0'
datasets master | 18 | 184 | AttributeError: '_tqdm_cls' object has no attribute '_lock'
### Describe the bug
```python
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/site-packages/datasets/load.py", line 1034, in get_module
data_files = DataFilesDict.from_patterns(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/site-packages/datasets/data_files.py", line 671, in from_patterns
DataFilesList.from_patterns(
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/site-packages/datasets/data_files.py", line 586, in from_patterns
origin_metadata = _get_origin_metadata(data_files, download_config=download_config)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/site-packages/datasets/data_files.py", line 502, in _get_origin_metadata
return thread_map(
^^^^^^^^^^^
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/site-packages/tqdm/contrib/concurrent.py", line 70, in thread_map
return _executor_map(ThreadPoolExecutor, fn, *iterables, **tqdm_kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/site-packages/tqdm/contrib/concurrent.py", line 48, in _executor_map
with ensure_lock(tqdm_class, lock_name=lock_name) as lk:
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/contextlib.py", line 144, in __exit__
next(self.gen)
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/site-packages/tqdm/contrib/concurrent.py", line 25, in ensure_lock
del tqdm_class._lock
^^^^^^^^^^^^^^^^
AttributeError: '_tqdm_cls' object has no attribute '_lock'
```
### Steps to reproduce the bug
Happens ocasionally.
### Expected behavior
I added a print in tqdm `ensure_lock()`, got a `ensure_lock <datasets.utils.logging._tqdm_cls object at 0x16dddead0> ` print.
According to the code in https://github.com/tqdm/tqdm/blob/master/tqdm/contrib/concurrent.py#L24
```python
@contextmanager
def ensure_lock(tqdm_class, lock_name=""):
"""get (create if necessary) and then restore `tqdm_class`'s lock"""
print("ensure_lock", tqdm_class, lock_name)
old_lock = getattr(tqdm_class, '_lock', None) # don't create a new lock
lock = old_lock or tqdm_class.get_lock() # maybe create a new lock
lock = getattr(lock, lock_name, lock) # maybe subtype
tqdm_class.set_lock(lock)
yield lock
if old_lock is None:
del tqdm_class._lock # <-- It tries to del the `_lock` attribute from tqdm_class.
else:
tqdm_class.set_lock(old_lock)
```
But, huggingface datasets `datasets.utils.logging._tqdm_cls` does not have the field `_lock`: https://github.com/huggingface/datasets/blob/main/src/datasets/utils/logging.py#L205
```python
class _tqdm_cls:
def __call__(self, *args, disable=False, **kwargs):
if _tqdm_active and not disable:
return tqdm_lib.tqdm(*args, **kwargs)
else:
return EmptyTqdm(*args, **kwargs)
def set_lock(self, *args, **kwargs):
self._lock = None
if _tqdm_active:
return tqdm_lib.tqdm.set_lock(*args, **kwargs)
def get_lock(self):
if _tqdm_active:
return tqdm_lib.tqdm.get_lock()
```
### Environment info
Python 3.11.4
tqdm '4.65.0'
datasets master
I have tested the latest main, it does not work.
I add more logs to reproduce this issue, it looks like a multi threading bug:
```python
@contextmanager
def ensure_lock(tqdm_class, lock_name=""):
"""get (create if necessary) and then restore `tqdm_class`'s lock"""
import os
import threading
print(os.getpid(), threading.get_ident(), "ensure_lock", tqdm_class, lock_name)
old_lock = getattr(tqdm_class, '_lock', None) # don't create a new lock
lock = old_lock or tqdm_class.get_lock() # maybe create a new lock
lock = getattr(lock, lock_name, lock) # maybe subtype
tqdm_class.set_lock(lock)
print(os.getpid(), threading.get_ident(), "set_lock")
yield lock
if old_lock is None:
print(os.getpid(), threading.get_ident(), "del tqdm_class")
del tqdm_class._lock
else:
tqdm_class.set_lock(old_lock)
```
output
```
64943 8424758784 ensure_lock <datasets.utils.logging._tqdm_cls object at 0x2aa7fb250>
64943 8424758784 set_lock
64943 8424758784 del tqdm_class
64943 8424758784 ensure_lock <datasets.utils.logging._tqdm_cls object at 0x2aa7fb250>
64943 8424758784 set_lock
64943 8424758784 del tqdm_class
64943 11638370304 ensure_lock <datasets.utils.logging._tqdm_cls object at 0x2aa7fb250>
64943 11638370304 set_lock
64943 11568967680 ensure_lock <datasets.utils.logging._tqdm_cls object at 0x2aa7fb250>
64943 11568967680 set_lock
64943 11638370304 del tqdm_class
64943 11638370304 ensure_lock <datasets.utils.logging._tqdm_cls object at 0x2aa7fb250>
64943 11638370304 set_lock
64943 11638370304 del tqdm_class
64943 11568967680 del tqdm_class
```
Thread `11638370304` del the _lock from tqdm_class first, then thread `11568967680` del _lock failed. | [
-1.3521512746810913,
-0.8465626835823059,
-0.5868315100669861,
1.283677339553833,
0.03677382320165634,
-0.8991362452507019,
0.05178180709481239,
-1.024348497390747,
1.9279330968856812,
-0.5640751123428345,
0.19435115158557892,
-1.4659757614135742,
-0.12366081774234772,
-0.3550596237182617,
-0.6583359837532043,
-1.0089880228042603,
-0.22304120659828186,
-0.8023163080215454,
1.1088749170303345,
2.6884775161743164,
1.156903862953186,
-1.3759241104125977,
2.642866849899292,
0.7988353967666626,
-0.24207842350006104,
-0.7284358143806458,
0.5179723501205444,
-0.011512529104948044,
-1.1826525926589966,
-0.6495604515075684,
-1.0175813436508179,
0.022053562104701996,
-0.6313120722770691,
-0.3401859402656555,
-0.02158968523144722,
0.13139449059963226,
-0.20061808824539185,
-0.2873065769672394,
-0.9021544456481934,
-0.6910043358802795,
0.548274040222168,
-0.2852327525615692,
0.962647020816803,
-0.3649974763393402,
1.8277539014816284,
-0.6605496406555176,
0.6081895232200623,
0.7097229957580566,
1.1302821636199951,
0.03843861073255539,
-0.02079499140381813,
0.534895122051239,
0.3973972499370575,
-0.030856993049383163,
0.7792328596115112,
1.1679213047027588,
0.6481515765190125,
0.5231693983078003,
0.3747190535068512,
-2.402606964111328,
1.3480474948883057,
-1.1254764795303345,
0.2611131966114044,
1.3818163871765137,
-0.7771731615066528,
0.33440378308296204,
-1.6795424222946167,
0.18649689853191376,
0.7953941226005554,
-2.4113516807556152,
0.21887235343456268,
-1.3777607679367065,
-0.6116394400596619,
1.02347731590271,
0.4455806314945221,
-1.1382908821105957,
0.04288424551486969,
-0.4744756817817688,
1.1887880563735962,
0.16459180414676666,
1.323036789894104,
-1.5153446197509766,
0.07853391021490097,
-0.16390080749988556,
0.40112704038619995,
-1.1884578466415405,
-1.63075590133667,
0.47040989995002747,
0.5899773836135864,
0.26367324590682983,
-0.20505091547966003,
1.0199583768844604,
-0.9974428415298462,
0.5892379283905029,
-0.879410445690155,
-1.5193231105804443,
-1.6370117664337158,
-2.5339717864990234,
-2.419931411743164,
0.7907775044441223,
-0.6993247866630554,
-0.3508959710597992,
2.1170456409454346,
-1.1112667322158813,
-1.5155402421951294,
0.9031490683555603,
0.1301542967557907,
0.18626834452152252,
2.1760153770446777,
0.0870685800909996,
-0.6804654598236084,
0.37824180722236633,
-0.726199746131897,
0.7385104894638062,
-0.30165982246398926,
1.4342628717422485,
0.5134738087654114,
-1.1090902090072632,
1.4783711433410645,
-0.5905486345291138,
0.5421697497367859,
-0.35697025060653687,
-0.5581348538398743,
-0.7811577320098877,
0.4774627089500427,
1.9544063806533813,
-0.3682940602302551,
1.717416763305664,
-0.5249424576759338,
-1.5466097593307495,
-1.4526327848434448,
0.8967746496200562,
0.4380446970462799,
-0.9256751537322998,
0.3436538577079773,
-0.6989375352859497,
0.06934519857168198,
-0.1274934858083725,
1.2606428861618042,
1.4358786344528198,
0.8622769117355347,
-0.28867924213409424,
-0.9380638599395752,
0.21729804575443268,
-0.180426687002182,
-0.8059960007667542,
-1.8390917778015137,
-0.16765767335891724,
0.10799171775579453,
0.6952167749404907,
-1.334524154663086,
1.5881760120391846,
0.8184784650802612,
1.9953057765960693,
0.8810362219810486,
-0.3565824329853058,
1.5788503885269165,
0.10273914039134979,
1.9695619344711304,
-0.7274723052978516,
0.6091565489768982,
-0.25802770256996155,
-1.13075590133667,
0.602349579334259,
-0.5166391730308533,
-2.019538164138794,
-0.7058054208755493,
-0.7484105825424194,
-0.07471983879804611,
-0.8735766410827637,
0.8328580856323242,
-0.07892382144927979,
-1.3269766569137573,
0.037220317870378494,
-0.6979303359985352,
0.525588870048523,
-1.268679141998291,
0.19269853830337524,
0.7282240986824036,
-0.40709948539733887,
0.19289961457252502,
-0.30141860246658325,
-1.2765871286392212,
-0.44538742303848267,
0.2148360311985016,
1.7092931270599365,
-0.3832385241985321,
0.6793234348297119,
1.2920857667922974,
-0.7202000617980957,
-0.05136673152446747,
0.24222339689731598,
-0.31593912839889526,
0.8499449491500854,
-1.213307499885559,
-0.4020674526691437,
1.103127121925354,
-0.12177959829568863,
-0.538506269454956,
1.2828400135040283,
0.7414155006408691,
-1.4261047840118408,
-0.3345857858657837,
-0.1103140339255333,
-0.800789475440979,
0.229596808552742,
-1.599118947982788,
-0.13479000329971313,
0.3764839768409729,
-1.6156822443008423,
-0.42269524931907654,
-0.2238057255744934,
1.2895721197128296,
-0.4028053879737854,
1.5293537378311157,
-0.02884598821401596,
0.03283382207155228,
-0.41834840178489685,
-0.23257780075073242,
0.32171517610549927,
-0.152330681681633,
-0.7775755524635315,
0.37977704405784607,
-0.6720184087753296,
0.2616594433784485,
1.236938238143921,
0.21759240329265594,
-0.2889638841152191,
0.292082816362381,
1.2093192338943481,
0.35908243060112,
-0.23396429419517517,
-0.8236218690872192,
-1.7396965026855469,
1.9075483083724976,
-1.2333664894104004,
1.735875129699707,
0.8410902619361877,
0.06864677369594574,
-1.9759607315063477,
-1.9344966411590576,
0.9765974283218384,
1.1564213037490845,
2.433076858520508,
0.29628849029541016,
0.5317174792289734,
-0.816351056098938,
-0.6313667893409729,
0.2908959686756134,
-0.8242727518081665,
-0.6654465198516846,
0.28600338101387024,
2.3161346912384033,
1.744185447692871,
-0.5277401804924011,
-0.16757617890834808,
-0.9070008993148804,
0.9472280740737915,
-0.1560613512992859,
0.1032833382487297,
1.8340047597885132,
-0.21770057082176208,
-1.109144926071167,
1.2990546226501465,
-2.280304193496704,
0.3642001152038574,
1.896501064300537,
0.3428557813167572,
0.14780259132385254,
-1.515293002128601,
-0.7185305953025818,
-0.2297145128250122,
-0.47209396958351135,
-1.2793437242507935,
0.5771636366844177,
-0.04452018067240715,
-1.1568613052368164,
-1.4738106727600098,
0.17234741151332855,
-1.0940903425216675,
-1.6372356414794922,
0.09702835232019424,
1.6472487449645996,
1.7815272808074951,
-0.9347864389419556,
1.2636431455612183,
-0.2786821722984314,
-0.058101311326026917,
1.3028626441955566,
1.2421928644180298,
3.1923696994781494,
2.0930440425872803,
-1.3588863611221313,
0.7501751184463501,
-0.45425325632095337,
-0.48371684551239014,
1.3359118700027466,
-1.3969383239746094,
1.0847744941711426,
-0.08317103981971741,
-1.2431195974349976,
-1.1207540035247803,
1.196039080619812,
0.49201297760009766,
-0.017637604847550392,
-0.39043474197387695,
1.4444079399108887,
0.08816592395305634,
1.329132080078125,
0.5904709696769714,
-0.3448835015296936,
0.5995341539382935,
-0.2379176914691925,
-0.3511018753051758,
1.4434895515441895,
0.16469095647335052,
-1.3172589540481567,
-2.0604515075683594,
-0.30608969926834106,
-1.092736840248108,
-0.18789948523044586,
-0.6453109383583069,
-0.8920084238052368,
1.4902311563491821,
0.4073588252067566,
-1.0816891193389893,
-0.48647788166999817,
-0.4077385365962982,
-0.694445013999939,
2.6950268745422363,
-1.438475251197815,
-0.12085571885108948,
-1.0280990600585938,
-0.37704789638519287,
1.7620261907577515,
-1.2021361589431763,
-0.1440926343202591,
-1.0291293859481812,
-0.5072453618049622,
-1.343376636505127,
-0.40150928497314453,
-0.15733928978443146,
-0.8161590695381165,
0.8386436104774475,
0.29525089263916016,
-1.2216306924819946,
-0.307094007730484,
-0.6104503870010376,
0.8233334422111511,
-0.00845920480787754,
0.21250730752944946,
1.8285976648330688,
0.20871397852897644,
-0.5204732418060303,
0.6522339582443237,
1.2864199876785278,
0.8206965327262878,
-0.7473633885383606,
0.01238060649484396,
-0.877595067024231,
0.2103065550327301,
-1.8275014162063599,
0.2577137053012848,
-2.6765716075897217,
0.745964527130127,
-0.21918867528438568,
-0.16634029150009155,
-0.1883762925863266,
-1.3646878004074097,
0.9899558424949646,
2.4431285858154297,
-1.222352147102356,
0.34013426303863525,
0.558910608291626,
1.129453420639038,
-1.52141535282135,
0.27728357911109924,
-0.5472350716590881,
1.9673813581466675,
0.3606279194355011,
1.29331374168396,
-0.26412132382392883,
-2.2942326068878174,
0.7008957862854004,
-0.9900544285774231,
-0.7993454337120056,
0.9848408699035645,
-1.036194920539856,
0.10173735022544861,
-1.6293010711669922,
-0.4484351575374603,
-0.7917584776878357,
-1.3042129278182983,
0.4027526080608368,
0.10850761830806732,
0.4813213050365448,
-0.8338385820388794,
0.4156211018562317,
-2.1256425380706787,
-1.280670166015625,
-0.14467526972293854,
-0.9829208850860596,
0.6360070705413818,
-0.3579353094100952,
0.5913558006286621,
0.045186858624219894,
0.1168600469827652,
0.3235798180103302,
1.642377257347107,
3.5620157718658447,
0.1342773586511612,
0.2802782654762268,
-0.03751535341143608,
-0.9832461476325989,
1.1756844520568848,
0.699571967124939,
-0.07713732123374939,
-0.6242050528526306,
-1.064204216003418,
1.3947227001190186,
1.9391998052597046,
1.1102224588394165,
0.11502466350793839,
-0.9782136082649231,
-0.9323775768280029,
0.11117929965257645,
0.19524629414081573,
0.45118585228919983,
0.8819080591201782,
0.14739590883255005,
0.13738112151622772,
1.4058096408843994,
1.1642804145812988,
-0.3376760482788086,
0.2272675782442093,
-0.8579511642456055,
-0.3494069278240204,
0.6956281661987305,
0.24563147127628326,
0.15718181431293488,
0.6150067448616028,
-1.0578062534332275,
-0.3040401339530945,
-0.1187351644039154,
-1.033526062965393,
-0.8469188213348389,
-0.3645491302013397,
-0.2851758599281311,
1.6337007284164429,
0.2335965484380722,
-0.48823320865631104,
0.18423989415168762,
-0.4957510828971863,
-0.13290081918239594,
-1.1375561952590942,
0.07648321986198425,
-0.10401888191699982,
0.01050268393009901,
-0.14036229252815247,
1.5430327653884888,
-0.7817375063896179,
-1.9662758111953735,
0.02723463624715805,
0.2289348542690277,
-0.28549960255622864,
0.2778286933898926,
1.876517415046692,
0.5024697780609131,
1.791791558265686,
1.02422297000885,
1.1390247344970703,
-0.47523459792137146,
-1.336104154586792,
0.7638934254646301,
1.0105618238449097,
-1.4831258058547974,
0.7561991214752197,
-0.2655555307865143,
-0.6414832472801208,
0.6192159056663513,
1.3197944164276123,
0.3682551980018616,
-1.8802424669265747,
1.0183417797088623,
-0.8876082301139832,
0.7711708545684814,
0.5310311317443848,
0.9148852229118347,
-0.02934601902961731,
0.8280729055404663,
-1.341902494430542,
-1.0763003826141357,
-0.5112506151199341,
-0.7666745781898499,
1.7777831554412842,
-0.33654695749282837,
0.47715476155281067,
-0.18093575537204742,
-1.3464833498001099,
0.04348471015691757,
0.9014179706573486,
0.09589551389217377,
-0.5071082711219788,
1.235575795173645,
-0.7955337762832642,
-1.2208199501037598,
-1.3365451097488403,
-0.4627600908279419,
-0.8945221304893494,
-0.8102182745933533,
1.1722508668899536,
0.8489481806755066,
0.3076280951499939,
1.931687593460083,
0.5728175640106201,
0.2557595372200012,
-2.676346778869629,
0.7806742787361145,
0.07530584931373596,
0.1754676252603531,
0.9270681738853455,
0.2305983155965805,
1.0851138830184937,
-0.13302747905254364,
0.6602859497070312,
-2.2139697074890137,
2.190561532974243,
-0.06898049265146255,
0.6678903698921204,
-0.27786168456077576,
-0.24984021484851837,
0.8927656412124634,
0.48498299717903137,
0.743829071521759,
-1.4213987588882446,
0.8266007900238037,
-0.4907926023006439,
0.9112980365753174,
0.6877413988113403,
-0.7418578267097473,
-0.10262042284011841,
1.0204861164093018,
0.5001095533370972,
-0.38696756958961487,
-0.9797511696815491,
-0.9291428327560425,
1.1279083490371704,
1.6088098287582397,
-0.04091116413474083,
-0.0063375914469361305,
0.7068549394607544,
0.6967776417732239,
-1.119896650314331,
0.3266255855560303,
-0.7109658718109131,
-0.6586567759513855,
1.3143470287322998,
2.0225086212158203,
-0.10523401200771332,
-0.19205746054649353,
-0.6288843154907227,
-1.1921111345291138,
0.4705393612384796,
-0.14703509211540222,
0.45896822214126587,
0.6097984910011292,
-0.6311136484146118,
0.7907437682151794,
0.853172242641449,
0.9281733632087708,
0.11423075199127197,
0.3773452043533325,
0.5226050615310669,
-0.4893872141838074,
-0.9468663334846497,
-0.5079358220100403,
-0.9944900274276733,
-2.772594928741455,
0.4865324795246124,
-0.31221452355384827,
-1.7003687620162964,
0.13714314997196198,
-1.1598178148269653,
0.9037516713142395,
-0.6062751412391663,
-1.4831300973892212,
-1.3606762886047363,
0.3976737856864929,
-0.018978750333189964,
1.126449704170227,
-1.5416712760925293,
-0.10684391856193542,
1.3499733209609985,
0.9306431412696838,
-0.20869342982769012,
0.7041609883308411,
0.3663647174835205,
1.0119878053665161,
1.1269590854644775,
-0.1746334284543991,
0.5356847643852234,
0.31965020298957825,
-1.226167917251587,
0.44694799184799194,
1.1744554042816162,
0.3333441913127899,
1.4427132606506348,
-0.35785728693008423,
0.17492975294589996,
0.5848684310913086,
-0.7010063529014587,
-0.5601987242698669,
-0.2631869614124298,
0.35074901580810547,
0.3718017339706421,
-1.1137945652008057,
-0.14256711304187775,
-0.3362291157245636,
0.004177388735115528,
-0.11863942444324493,
-1.3614659309387207,
-0.3265659213066101,
-0.3982192873954773,
-0.686803936958313,
-1.4375382661819458,
0.07430471479892731,
1.2458163499832153,
-0.7400732040405273,
-0.09871954470872879,
0.38881802558898926,
0.46149173378944397,
0.5702497959136963,
0.509876012802124,
-0.7289793491363525,
-0.45075181126594543,
-0.1696815937757492,
-0.25022801756858826,
0.1599012315273285,
1.0350897312164307,
-0.12144225835800171,
-1.0334320068359375,
0.6304041147232056,
-0.278475284576416,
0.19349141418933868,
1.8877155780792236,
0.12918412685394287,
-0.8450613021850586,
0.42738577723503113,
-0.5980470776557922,
1.7481648921966553,
1.7766462564468384,
1.4082164764404297,
-0.08475938439369202,
-0.8481414318084717,
0.4641878008842468,
-0.5516619682312012,
-0.12393351644277573,
0.9465259313583374,
0.6039053797721863,
-0.22551381587982178,
-1.3075534105300903,
0.5837433934211731,
1.3028631210327148,
-1.0849767923355103,
-0.7287118434906006,
0.353732168674469,
-0.6826037764549255,
1.322310447692871,
0.624575138092041,
0.07813600450754166,
0.2458200603723526,
1.6093138456344604,
0.7779735326766968,
-0.535224437713623,
0.5232193470001221,
0.7197362780570984,
-0.4259026348590851,
-2.314595937728882,
-1.2201613187789917,
0.3978528082370758,
-0.38476404547691345,
-1.3012583255767822,
1.393068790435791,
-1.1441254615783691,
-1.0403860807418823,
0.6296542286872864,
0.05764849856495857,
1.1507059335708618,
0.19841574132442474,
1.7154958248138428,
2.253068685531616,
0.757347583770752,
0.257707804441452,
1.313523530960083,
0.1278500258922577,
-0.47213754057884216,
1.9872981309890747,
-0.26319774985313416,
0.4560069441795349,
0.8710852265357971,
-0.5018423795700073,
-1.1134164333343506,
-1.0161212682724,
-1.1849862337112427,
-0.6824880242347717,
1.3156335353851318,
0.11360086500644684,
-0.9215918183326721,
0.4901082217693329,
1.7598676681518555,
0.16926084458827972,
-0.24960167706012726,
0.6341556310653687,
0.5583701729774475,
-0.7889825105667114,
-0.020468756556510925,
-1.2578049898147583,
0.6289879679679871,
-0.1664561629295349,
-0.09694315493106842,
0.08676231652498245,
0.7347716093063354,
1.2358806133270264,
0.09766668826341629,
-0.12577080726623535,
1.1313918828964233,
-1.4748961925506592,
1.6798367500305176,
-0.5699650049209595,
0.45263174176216125,
-2.3144304752349854,
1.1421259641647339,
-0.6715932488441467,
1.9252856969833374,
-2.450446367263794,
0.5139152407646179,
-0.7128379344940186,
-0.4163958430290222,
0.28455430269241333,
-0.4057167172431946,
0.14052660763263702,
-0.18454530835151672,
-1.046558141708374,
-0.14424367249011993,
-1.0758476257324219,
0.7310072779655457,
1.146992802619934,
1.4003256559371948,
-1.2156238555908203,
-0.0036764685064554214,
-1.3482110500335693,
-0.08654996007680893,
-0.8571937084197998,
0.23416702449321747,
-1.6697404384613037,
-0.28050923347473145,
-2.1111562252044678,
-2.304094076156616,
-1.326977252960205,
-0.7295746803283691,
1.0908632278442383,
0.22760042548179626,
-0.8652193546295166,
1.0831001996994019,
-0.6321773529052734,
-1.8993183374404907,
0.9742449522018433,
-2.2420873641967773
] |
https://github.com/huggingface/datasets/issues/6066 | AttributeError: '_tqdm_cls' object has no attribute '_lock' | Maybe it is a bug of tqdm? I think simply use `try ... except AttributeError ...` wraps `del tqdm_class._lock` should work. | ### Describe the bug
```python
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/site-packages/datasets/load.py", line 1034, in get_module
data_files = DataFilesDict.from_patterns(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/site-packages/datasets/data_files.py", line 671, in from_patterns
DataFilesList.from_patterns(
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/site-packages/datasets/data_files.py", line 586, in from_patterns
origin_metadata = _get_origin_metadata(data_files, download_config=download_config)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/site-packages/datasets/data_files.py", line 502, in _get_origin_metadata
return thread_map(
^^^^^^^^^^^
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/site-packages/tqdm/contrib/concurrent.py", line 70, in thread_map
return _executor_map(ThreadPoolExecutor, fn, *iterables, **tqdm_kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/site-packages/tqdm/contrib/concurrent.py", line 48, in _executor_map
with ensure_lock(tqdm_class, lock_name=lock_name) as lk:
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/contextlib.py", line 144, in __exit__
next(self.gen)
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/site-packages/tqdm/contrib/concurrent.py", line 25, in ensure_lock
del tqdm_class._lock
^^^^^^^^^^^^^^^^
AttributeError: '_tqdm_cls' object has no attribute '_lock'
```
### Steps to reproduce the bug
Happens ocasionally.
### Expected behavior
I added a print in tqdm `ensure_lock()`, got a `ensure_lock <datasets.utils.logging._tqdm_cls object at 0x16dddead0> ` print.
According to the code in https://github.com/tqdm/tqdm/blob/master/tqdm/contrib/concurrent.py#L24
```python
@contextmanager
def ensure_lock(tqdm_class, lock_name=""):
"""get (create if necessary) and then restore `tqdm_class`'s lock"""
print("ensure_lock", tqdm_class, lock_name)
old_lock = getattr(tqdm_class, '_lock', None) # don't create a new lock
lock = old_lock or tqdm_class.get_lock() # maybe create a new lock
lock = getattr(lock, lock_name, lock) # maybe subtype
tqdm_class.set_lock(lock)
yield lock
if old_lock is None:
del tqdm_class._lock # <-- It tries to del the `_lock` attribute from tqdm_class.
else:
tqdm_class.set_lock(old_lock)
```
But, huggingface datasets `datasets.utils.logging._tqdm_cls` does not have the field `_lock`: https://github.com/huggingface/datasets/blob/main/src/datasets/utils/logging.py#L205
```python
class _tqdm_cls:
def __call__(self, *args, disable=False, **kwargs):
if _tqdm_active and not disable:
return tqdm_lib.tqdm(*args, **kwargs)
else:
return EmptyTqdm(*args, **kwargs)
def set_lock(self, *args, **kwargs):
self._lock = None
if _tqdm_active:
return tqdm_lib.tqdm.set_lock(*args, **kwargs)
def get_lock(self):
if _tqdm_active:
return tqdm_lib.tqdm.get_lock()
```
### Environment info
Python 3.11.4
tqdm '4.65.0'
datasets master | 18 | 21 | AttributeError: '_tqdm_cls' object has no attribute '_lock'
### Describe the bug
```python
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/site-packages/datasets/load.py", line 1034, in get_module
data_files = DataFilesDict.from_patterns(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/site-packages/datasets/data_files.py", line 671, in from_patterns
DataFilesList.from_patterns(
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/site-packages/datasets/data_files.py", line 586, in from_patterns
origin_metadata = _get_origin_metadata(data_files, download_config=download_config)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/site-packages/datasets/data_files.py", line 502, in _get_origin_metadata
return thread_map(
^^^^^^^^^^^
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/site-packages/tqdm/contrib/concurrent.py", line 70, in thread_map
return _executor_map(ThreadPoolExecutor, fn, *iterables, **tqdm_kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/site-packages/tqdm/contrib/concurrent.py", line 48, in _executor_map
with ensure_lock(tqdm_class, lock_name=lock_name) as lk:
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/contextlib.py", line 144, in __exit__
next(self.gen)
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/site-packages/tqdm/contrib/concurrent.py", line 25, in ensure_lock
del tqdm_class._lock
^^^^^^^^^^^^^^^^
AttributeError: '_tqdm_cls' object has no attribute '_lock'
```
### Steps to reproduce the bug
Happens ocasionally.
### Expected behavior
I added a print in tqdm `ensure_lock()`, got a `ensure_lock <datasets.utils.logging._tqdm_cls object at 0x16dddead0> ` print.
According to the code in https://github.com/tqdm/tqdm/blob/master/tqdm/contrib/concurrent.py#L24
```python
@contextmanager
def ensure_lock(tqdm_class, lock_name=""):
"""get (create if necessary) and then restore `tqdm_class`'s lock"""
print("ensure_lock", tqdm_class, lock_name)
old_lock = getattr(tqdm_class, '_lock', None) # don't create a new lock
lock = old_lock or tqdm_class.get_lock() # maybe create a new lock
lock = getattr(lock, lock_name, lock) # maybe subtype
tqdm_class.set_lock(lock)
yield lock
if old_lock is None:
del tqdm_class._lock # <-- It tries to del the `_lock` attribute from tqdm_class.
else:
tqdm_class.set_lock(old_lock)
```
But, huggingface datasets `datasets.utils.logging._tqdm_cls` does not have the field `_lock`: https://github.com/huggingface/datasets/blob/main/src/datasets/utils/logging.py#L205
```python
class _tqdm_cls:
def __call__(self, *args, disable=False, **kwargs):
if _tqdm_active and not disable:
return tqdm_lib.tqdm(*args, **kwargs)
else:
return EmptyTqdm(*args, **kwargs)
def set_lock(self, *args, **kwargs):
self._lock = None
if _tqdm_active:
return tqdm_lib.tqdm.set_lock(*args, **kwargs)
def get_lock(self):
if _tqdm_active:
return tqdm_lib.tqdm.get_lock()
```
### Environment info
Python 3.11.4
tqdm '4.65.0'
datasets master
Maybe it is a bug of tqdm? I think simply use `try ... except AttributeError ...` wraps `del tqdm_class._lock` should work. | [
-1.3521512746810913,
-0.8465626835823059,
-0.5868315100669861,
1.283677339553833,
0.03677382320165634,
-0.8991362452507019,
0.05178180709481239,
-1.024348497390747,
1.9279330968856812,
-0.5640751123428345,
0.19435115158557892,
-1.4659757614135742,
-0.12366081774234772,
-0.3550596237182617,
-0.6583359837532043,
-1.0089880228042603,
-0.22304120659828186,
-0.8023163080215454,
1.1088749170303345,
2.6884775161743164,
1.156903862953186,
-1.3759241104125977,
2.642866849899292,
0.7988353967666626,
-0.24207842350006104,
-0.7284358143806458,
0.5179723501205444,
-0.011512529104948044,
-1.1826525926589966,
-0.6495604515075684,
-1.0175813436508179,
0.022053562104701996,
-0.6313120722770691,
-0.3401859402656555,
-0.02158968523144722,
0.13139449059963226,
-0.20061808824539185,
-0.2873065769672394,
-0.9021544456481934,
-0.6910043358802795,
0.548274040222168,
-0.2852327525615692,
0.962647020816803,
-0.3649974763393402,
1.8277539014816284,
-0.6605496406555176,
0.6081895232200623,
0.7097229957580566,
1.1302821636199951,
0.03843861073255539,
-0.02079499140381813,
0.534895122051239,
0.3973972499370575,
-0.030856993049383163,
0.7792328596115112,
1.1679213047027588,
0.6481515765190125,
0.5231693983078003,
0.3747190535068512,
-2.402606964111328,
1.3480474948883057,
-1.1254764795303345,
0.2611131966114044,
1.3818163871765137,
-0.7771731615066528,
0.33440378308296204,
-1.6795424222946167,
0.18649689853191376,
0.7953941226005554,
-2.4113516807556152,
0.21887235343456268,
-1.3777607679367065,
-0.6116394400596619,
1.02347731590271,
0.4455806314945221,
-1.1382908821105957,
0.04288424551486969,
-0.4744756817817688,
1.1887880563735962,
0.16459180414676666,
1.323036789894104,
-1.5153446197509766,
0.07853391021490097,
-0.16390080749988556,
0.40112704038619995,
-1.1884578466415405,
-1.63075590133667,
0.47040989995002747,
0.5899773836135864,
0.26367324590682983,
-0.20505091547966003,
1.0199583768844604,
-0.9974428415298462,
0.5892379283905029,
-0.879410445690155,
-1.5193231105804443,
-1.6370117664337158,
-2.5339717864990234,
-2.419931411743164,
0.7907775044441223,
-0.6993247866630554,
-0.3508959710597992,
2.1170456409454346,
-1.1112667322158813,
-1.5155402421951294,
0.9031490683555603,
0.1301542967557907,
0.18626834452152252,
2.1760153770446777,
0.0870685800909996,
-0.6804654598236084,
0.37824180722236633,
-0.726199746131897,
0.7385104894638062,
-0.30165982246398926,
1.4342628717422485,
0.5134738087654114,
-1.1090902090072632,
1.4783711433410645,
-0.5905486345291138,
0.5421697497367859,
-0.35697025060653687,
-0.5581348538398743,
-0.7811577320098877,
0.4774627089500427,
1.9544063806533813,
-0.3682940602302551,
1.717416763305664,
-0.5249424576759338,
-1.5466097593307495,
-1.4526327848434448,
0.8967746496200562,
0.4380446970462799,
-0.9256751537322998,
0.3436538577079773,
-0.6989375352859497,
0.06934519857168198,
-0.1274934858083725,
1.2606428861618042,
1.4358786344528198,
0.8622769117355347,
-0.28867924213409424,
-0.9380638599395752,
0.21729804575443268,
-0.180426687002182,
-0.8059960007667542,
-1.8390917778015137,
-0.16765767335891724,
0.10799171775579453,
0.6952167749404907,
-1.334524154663086,
1.5881760120391846,
0.8184784650802612,
1.9953057765960693,
0.8810362219810486,
-0.3565824329853058,
1.5788503885269165,
0.10273914039134979,
1.9695619344711304,
-0.7274723052978516,
0.6091565489768982,
-0.25802770256996155,
-1.13075590133667,
0.602349579334259,
-0.5166391730308533,
-2.019538164138794,
-0.7058054208755493,
-0.7484105825424194,
-0.07471983879804611,
-0.8735766410827637,
0.8328580856323242,
-0.07892382144927979,
-1.3269766569137573,
0.037220317870378494,
-0.6979303359985352,
0.525588870048523,
-1.268679141998291,
0.19269853830337524,
0.7282240986824036,
-0.40709948539733887,
0.19289961457252502,
-0.30141860246658325,
-1.2765871286392212,
-0.44538742303848267,
0.2148360311985016,
1.7092931270599365,
-0.3832385241985321,
0.6793234348297119,
1.2920857667922974,
-0.7202000617980957,
-0.05136673152446747,
0.24222339689731598,
-0.31593912839889526,
0.8499449491500854,
-1.213307499885559,
-0.4020674526691437,
1.103127121925354,
-0.12177959829568863,
-0.538506269454956,
1.2828400135040283,
0.7414155006408691,
-1.4261047840118408,
-0.3345857858657837,
-0.1103140339255333,
-0.800789475440979,
0.229596808552742,
-1.599118947982788,
-0.13479000329971313,
0.3764839768409729,
-1.6156822443008423,
-0.42269524931907654,
-0.2238057255744934,
1.2895721197128296,
-0.4028053879737854,
1.5293537378311157,
-0.02884598821401596,
0.03283382207155228,
-0.41834840178489685,
-0.23257780075073242,
0.32171517610549927,
-0.152330681681633,
-0.7775755524635315,
0.37977704405784607,
-0.6720184087753296,
0.2616594433784485,
1.236938238143921,
0.21759240329265594,
-0.2889638841152191,
0.292082816362381,
1.2093192338943481,
0.35908243060112,
-0.23396429419517517,
-0.8236218690872192,
-1.7396965026855469,
1.9075483083724976,
-1.2333664894104004,
1.735875129699707,
0.8410902619361877,
0.06864677369594574,
-1.9759607315063477,
-1.9344966411590576,
0.9765974283218384,
1.1564213037490845,
2.433076858520508,
0.29628849029541016,
0.5317174792289734,
-0.816351056098938,
-0.6313667893409729,
0.2908959686756134,
-0.8242727518081665,
-0.6654465198516846,
0.28600338101387024,
2.3161346912384033,
1.744185447692871,
-0.5277401804924011,
-0.16757617890834808,
-0.9070008993148804,
0.9472280740737915,
-0.1560613512992859,
0.1032833382487297,
1.8340047597885132,
-0.21770057082176208,
-1.109144926071167,
1.2990546226501465,
-2.280304193496704,
0.3642001152038574,
1.896501064300537,
0.3428557813167572,
0.14780259132385254,
-1.515293002128601,
-0.7185305953025818,
-0.2297145128250122,
-0.47209396958351135,
-1.2793437242507935,
0.5771636366844177,
-0.04452018067240715,
-1.1568613052368164,
-1.4738106727600098,
0.17234741151332855,
-1.0940903425216675,
-1.6372356414794922,
0.09702835232019424,
1.6472487449645996,
1.7815272808074951,
-0.9347864389419556,
1.2636431455612183,
-0.2786821722984314,
-0.058101311326026917,
1.3028626441955566,
1.2421928644180298,
3.1923696994781494,
2.0930440425872803,
-1.3588863611221313,
0.7501751184463501,
-0.45425325632095337,
-0.48371684551239014,
1.3359118700027466,
-1.3969383239746094,
1.0847744941711426,
-0.08317103981971741,
-1.2431195974349976,
-1.1207540035247803,
1.196039080619812,
0.49201297760009766,
-0.017637604847550392,
-0.39043474197387695,
1.4444079399108887,
0.08816592395305634,
1.329132080078125,
0.5904709696769714,
-0.3448835015296936,
0.5995341539382935,
-0.2379176914691925,
-0.3511018753051758,
1.4434895515441895,
0.16469095647335052,
-1.3172589540481567,
-2.0604515075683594,
-0.30608969926834106,
-1.092736840248108,
-0.18789948523044586,
-0.6453109383583069,
-0.8920084238052368,
1.4902311563491821,
0.4073588252067566,
-1.0816891193389893,
-0.48647788166999817,
-0.4077385365962982,
-0.694445013999939,
2.6950268745422363,
-1.438475251197815,
-0.12085571885108948,
-1.0280990600585938,
-0.37704789638519287,
1.7620261907577515,
-1.2021361589431763,
-0.1440926343202591,
-1.0291293859481812,
-0.5072453618049622,
-1.343376636505127,
-0.40150928497314453,
-0.15733928978443146,
-0.8161590695381165,
0.8386436104774475,
0.29525089263916016,
-1.2216306924819946,
-0.307094007730484,
-0.6104503870010376,
0.8233334422111511,
-0.00845920480787754,
0.21250730752944946,
1.8285976648330688,
0.20871397852897644,
-0.5204732418060303,
0.6522339582443237,
1.2864199876785278,
0.8206965327262878,
-0.7473633885383606,
0.01238060649484396,
-0.877595067024231,
0.2103065550327301,
-1.8275014162063599,
0.2577137053012848,
-2.6765716075897217,
0.745964527130127,
-0.21918867528438568,
-0.16634029150009155,
-0.1883762925863266,
-1.3646878004074097,
0.9899558424949646,
2.4431285858154297,
-1.222352147102356,
0.34013426303863525,
0.558910608291626,
1.129453420639038,
-1.52141535282135,
0.27728357911109924,
-0.5472350716590881,
1.9673813581466675,
0.3606279194355011,
1.29331374168396,
-0.26412132382392883,
-2.2942326068878174,
0.7008957862854004,
-0.9900544285774231,
-0.7993454337120056,
0.9848408699035645,
-1.036194920539856,
0.10173735022544861,
-1.6293010711669922,
-0.4484351575374603,
-0.7917584776878357,
-1.3042129278182983,
0.4027526080608368,
0.10850761830806732,
0.4813213050365448,
-0.8338385820388794,
0.4156211018562317,
-2.1256425380706787,
-1.280670166015625,
-0.14467526972293854,
-0.9829208850860596,
0.6360070705413818,
-0.3579353094100952,
0.5913558006286621,
0.045186858624219894,
0.1168600469827652,
0.3235798180103302,
1.642377257347107,
3.5620157718658447,
0.1342773586511612,
0.2802782654762268,
-0.03751535341143608,
-0.9832461476325989,
1.1756844520568848,
0.699571967124939,
-0.07713732123374939,
-0.6242050528526306,
-1.064204216003418,
1.3947227001190186,
1.9391998052597046,
1.1102224588394165,
0.11502466350793839,
-0.9782136082649231,
-0.9323775768280029,
0.11117929965257645,
0.19524629414081573,
0.45118585228919983,
0.8819080591201782,
0.14739590883255005,
0.13738112151622772,
1.4058096408843994,
1.1642804145812988,
-0.3376760482788086,
0.2272675782442093,
-0.8579511642456055,
-0.3494069278240204,
0.6956281661987305,
0.24563147127628326,
0.15718181431293488,
0.6150067448616028,
-1.0578062534332275,
-0.3040401339530945,
-0.1187351644039154,
-1.033526062965393,
-0.8469188213348389,
-0.3645491302013397,
-0.2851758599281311,
1.6337007284164429,
0.2335965484380722,
-0.48823320865631104,
0.18423989415168762,
-0.4957510828971863,
-0.13290081918239594,
-1.1375561952590942,
0.07648321986198425,
-0.10401888191699982,
0.01050268393009901,
-0.14036229252815247,
1.5430327653884888,
-0.7817375063896179,
-1.9662758111953735,
0.02723463624715805,
0.2289348542690277,
-0.28549960255622864,
0.2778286933898926,
1.876517415046692,
0.5024697780609131,
1.791791558265686,
1.02422297000885,
1.1390247344970703,
-0.47523459792137146,
-1.336104154586792,
0.7638934254646301,
1.0105618238449097,
-1.4831258058547974,
0.7561991214752197,
-0.2655555307865143,
-0.6414832472801208,
0.6192159056663513,
1.3197944164276123,
0.3682551980018616,
-1.8802424669265747,
1.0183417797088623,
-0.8876082301139832,
0.7711708545684814,
0.5310311317443848,
0.9148852229118347,
-0.02934601902961731,
0.8280729055404663,
-1.341902494430542,
-1.0763003826141357,
-0.5112506151199341,
-0.7666745781898499,
1.7777831554412842,
-0.33654695749282837,
0.47715476155281067,
-0.18093575537204742,
-1.3464833498001099,
0.04348471015691757,
0.9014179706573486,
0.09589551389217377,
-0.5071082711219788,
1.235575795173645,
-0.7955337762832642,
-1.2208199501037598,
-1.3365451097488403,
-0.4627600908279419,
-0.8945221304893494,
-0.8102182745933533,
1.1722508668899536,
0.8489481806755066,
0.3076280951499939,
1.931687593460083,
0.5728175640106201,
0.2557595372200012,
-2.676346778869629,
0.7806742787361145,
0.07530584931373596,
0.1754676252603531,
0.9270681738853455,
0.2305983155965805,
1.0851138830184937,
-0.13302747905254364,
0.6602859497070312,
-2.2139697074890137,
2.190561532974243,
-0.06898049265146255,
0.6678903698921204,
-0.27786168456077576,
-0.24984021484851837,
0.8927656412124634,
0.48498299717903137,
0.743829071521759,
-1.4213987588882446,
0.8266007900238037,
-0.4907926023006439,
0.9112980365753174,
0.6877413988113403,
-0.7418578267097473,
-0.10262042284011841,
1.0204861164093018,
0.5001095533370972,
-0.38696756958961487,
-0.9797511696815491,
-0.9291428327560425,
1.1279083490371704,
1.6088098287582397,
-0.04091116413474083,
-0.0063375914469361305,
0.7068549394607544,
0.6967776417732239,
-1.119896650314331,
0.3266255855560303,
-0.7109658718109131,
-0.6586567759513855,
1.3143470287322998,
2.0225086212158203,
-0.10523401200771332,
-0.19205746054649353,
-0.6288843154907227,
-1.1921111345291138,
0.4705393612384796,
-0.14703509211540222,
0.45896822214126587,
0.6097984910011292,
-0.6311136484146118,
0.7907437682151794,
0.853172242641449,
0.9281733632087708,
0.11423075199127197,
0.3773452043533325,
0.5226050615310669,
-0.4893872141838074,
-0.9468663334846497,
-0.5079358220100403,
-0.9944900274276733,
-2.772594928741455,
0.4865324795246124,
-0.31221452355384827,
-1.7003687620162964,
0.13714314997196198,
-1.1598178148269653,
0.9037516713142395,
-0.6062751412391663,
-1.4831300973892212,
-1.3606762886047363,
0.3976737856864929,
-0.018978750333189964,
1.126449704170227,
-1.5416712760925293,
-0.10684391856193542,
1.3499733209609985,
0.9306431412696838,
-0.20869342982769012,
0.7041609883308411,
0.3663647174835205,
1.0119878053665161,
1.1269590854644775,
-0.1746334284543991,
0.5356847643852234,
0.31965020298957825,
-1.226167917251587,
0.44694799184799194,
1.1744554042816162,
0.3333441913127899,
1.4427132606506348,
-0.35785728693008423,
0.17492975294589996,
0.5848684310913086,
-0.7010063529014587,
-0.5601987242698669,
-0.2631869614124298,
0.35074901580810547,
0.3718017339706421,
-1.1137945652008057,
-0.14256711304187775,
-0.3362291157245636,
0.004177388735115528,
-0.11863942444324493,
-1.3614659309387207,
-0.3265659213066101,
-0.3982192873954773,
-0.686803936958313,
-1.4375382661819458,
0.07430471479892731,
1.2458163499832153,
-0.7400732040405273,
-0.09871954470872879,
0.38881802558898926,
0.46149173378944397,
0.5702497959136963,
0.509876012802124,
-0.7289793491363525,
-0.45075181126594543,
-0.1696815937757492,
-0.25022801756858826,
0.1599012315273285,
1.0350897312164307,
-0.12144225835800171,
-1.0334320068359375,
0.6304041147232056,
-0.278475284576416,
0.19349141418933868,
1.8877155780792236,
0.12918412685394287,
-0.8450613021850586,
0.42738577723503113,
-0.5980470776557922,
1.7481648921966553,
1.7766462564468384,
1.4082164764404297,
-0.08475938439369202,
-0.8481414318084717,
0.4641878008842468,
-0.5516619682312012,
-0.12393351644277573,
0.9465259313583374,
0.6039053797721863,
-0.22551381587982178,
-1.3075534105300903,
0.5837433934211731,
1.3028631210327148,
-1.0849767923355103,
-0.7287118434906006,
0.353732168674469,
-0.6826037764549255,
1.322310447692871,
0.624575138092041,
0.07813600450754166,
0.2458200603723526,
1.6093138456344604,
0.7779735326766968,
-0.535224437713623,
0.5232193470001221,
0.7197362780570984,
-0.4259026348590851,
-2.314595937728882,
-1.2201613187789917,
0.3978528082370758,
-0.38476404547691345,
-1.3012583255767822,
1.393068790435791,
-1.1441254615783691,
-1.0403860807418823,
0.6296542286872864,
0.05764849856495857,
1.1507059335708618,
0.19841574132442474,
1.7154958248138428,
2.253068685531616,
0.757347583770752,
0.257707804441452,
1.313523530960083,
0.1278500258922577,
-0.47213754057884216,
1.9872981309890747,
-0.26319774985313416,
0.4560069441795349,
0.8710852265357971,
-0.5018423795700073,
-1.1134164333343506,
-1.0161212682724,
-1.1849862337112427,
-0.6824880242347717,
1.3156335353851318,
0.11360086500644684,
-0.9215918183326721,
0.4901082217693329,
1.7598676681518555,
0.16926084458827972,
-0.24960167706012726,
0.6341556310653687,
0.5583701729774475,
-0.7889825105667114,
-0.020468756556510925,
-1.2578049898147583,
0.6289879679679871,
-0.1664561629295349,
-0.09694315493106842,
0.08676231652498245,
0.7347716093063354,
1.2358806133270264,
0.09766668826341629,
-0.12577080726623535,
1.1313918828964233,
-1.4748961925506592,
1.6798367500305176,
-0.5699650049209595,
0.45263174176216125,
-2.3144304752349854,
1.1421259641647339,
-0.6715932488441467,
1.9252856969833374,
-2.450446367263794,
0.5139152407646179,
-0.7128379344940186,
-0.4163958430290222,
0.28455430269241333,
-0.4057167172431946,
0.14052660763263702,
-0.18454530835151672,
-1.046558141708374,
-0.14424367249011993,
-1.0758476257324219,
0.7310072779655457,
1.146992802619934,
1.4003256559371948,
-1.2156238555908203,
-0.0036764685064554214,
-1.3482110500335693,
-0.08654996007680893,
-0.8571937084197998,
0.23416702449321747,
-1.6697404384613037,
-0.28050923347473145,
-2.1111562252044678,
-2.304094076156616,
-1.326977252960205,
-0.7295746803283691,
1.0908632278442383,
0.22760042548179626,
-0.8652193546295166,
1.0831001996994019,
-0.6321773529052734,
-1.8993183374404907,
0.9742449522018433,
-2.2420873641967773
] |
https://github.com/huggingface/datasets/issues/6066 | AttributeError: '_tqdm_cls' object has no attribute '_lock' | Yes it looks like a bug on their end indeed, do you want to open a PR on tqdm ?
Let me see if I can find a workaround in the meantime | ### Describe the bug
```python
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/site-packages/datasets/load.py", line 1034, in get_module
data_files = DataFilesDict.from_patterns(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/site-packages/datasets/data_files.py", line 671, in from_patterns
DataFilesList.from_patterns(
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/site-packages/datasets/data_files.py", line 586, in from_patterns
origin_metadata = _get_origin_metadata(data_files, download_config=download_config)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/site-packages/datasets/data_files.py", line 502, in _get_origin_metadata
return thread_map(
^^^^^^^^^^^
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/site-packages/tqdm/contrib/concurrent.py", line 70, in thread_map
return _executor_map(ThreadPoolExecutor, fn, *iterables, **tqdm_kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/site-packages/tqdm/contrib/concurrent.py", line 48, in _executor_map
with ensure_lock(tqdm_class, lock_name=lock_name) as lk:
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/contextlib.py", line 144, in __exit__
next(self.gen)
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/site-packages/tqdm/contrib/concurrent.py", line 25, in ensure_lock
del tqdm_class._lock
^^^^^^^^^^^^^^^^
AttributeError: '_tqdm_cls' object has no attribute '_lock'
```
### Steps to reproduce the bug
Happens ocasionally.
### Expected behavior
I added a print in tqdm `ensure_lock()`, got a `ensure_lock <datasets.utils.logging._tqdm_cls object at 0x16dddead0> ` print.
According to the code in https://github.com/tqdm/tqdm/blob/master/tqdm/contrib/concurrent.py#L24
```python
@contextmanager
def ensure_lock(tqdm_class, lock_name=""):
"""get (create if necessary) and then restore `tqdm_class`'s lock"""
print("ensure_lock", tqdm_class, lock_name)
old_lock = getattr(tqdm_class, '_lock', None) # don't create a new lock
lock = old_lock or tqdm_class.get_lock() # maybe create a new lock
lock = getattr(lock, lock_name, lock) # maybe subtype
tqdm_class.set_lock(lock)
yield lock
if old_lock is None:
del tqdm_class._lock # <-- It tries to del the `_lock` attribute from tqdm_class.
else:
tqdm_class.set_lock(old_lock)
```
But, huggingface datasets `datasets.utils.logging._tqdm_cls` does not have the field `_lock`: https://github.com/huggingface/datasets/blob/main/src/datasets/utils/logging.py#L205
```python
class _tqdm_cls:
def __call__(self, *args, disable=False, **kwargs):
if _tqdm_active and not disable:
return tqdm_lib.tqdm(*args, **kwargs)
else:
return EmptyTqdm(*args, **kwargs)
def set_lock(self, *args, **kwargs):
self._lock = None
if _tqdm_active:
return tqdm_lib.tqdm.set_lock(*args, **kwargs)
def get_lock(self):
if _tqdm_active:
return tqdm_lib.tqdm.get_lock()
```
### Environment info
Python 3.11.4
tqdm '4.65.0'
datasets master | 18 | 32 | AttributeError: '_tqdm_cls' object has no attribute '_lock'
### Describe the bug
```python
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/site-packages/datasets/load.py", line 1034, in get_module
data_files = DataFilesDict.from_patterns(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/site-packages/datasets/data_files.py", line 671, in from_patterns
DataFilesList.from_patterns(
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/site-packages/datasets/data_files.py", line 586, in from_patterns
origin_metadata = _get_origin_metadata(data_files, download_config=download_config)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/site-packages/datasets/data_files.py", line 502, in _get_origin_metadata
return thread_map(
^^^^^^^^^^^
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/site-packages/tqdm/contrib/concurrent.py", line 70, in thread_map
return _executor_map(ThreadPoolExecutor, fn, *iterables, **tqdm_kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/site-packages/tqdm/contrib/concurrent.py", line 48, in _executor_map
with ensure_lock(tqdm_class, lock_name=lock_name) as lk:
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/contextlib.py", line 144, in __exit__
next(self.gen)
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/site-packages/tqdm/contrib/concurrent.py", line 25, in ensure_lock
del tqdm_class._lock
^^^^^^^^^^^^^^^^
AttributeError: '_tqdm_cls' object has no attribute '_lock'
```
### Steps to reproduce the bug
Happens ocasionally.
### Expected behavior
I added a print in tqdm `ensure_lock()`, got a `ensure_lock <datasets.utils.logging._tqdm_cls object at 0x16dddead0> ` print.
According to the code in https://github.com/tqdm/tqdm/blob/master/tqdm/contrib/concurrent.py#L24
```python
@contextmanager
def ensure_lock(tqdm_class, lock_name=""):
"""get (create if necessary) and then restore `tqdm_class`'s lock"""
print("ensure_lock", tqdm_class, lock_name)
old_lock = getattr(tqdm_class, '_lock', None) # don't create a new lock
lock = old_lock or tqdm_class.get_lock() # maybe create a new lock
lock = getattr(lock, lock_name, lock) # maybe subtype
tqdm_class.set_lock(lock)
yield lock
if old_lock is None:
del tqdm_class._lock # <-- It tries to del the `_lock` attribute from tqdm_class.
else:
tqdm_class.set_lock(old_lock)
```
But, huggingface datasets `datasets.utils.logging._tqdm_cls` does not have the field `_lock`: https://github.com/huggingface/datasets/blob/main/src/datasets/utils/logging.py#L205
```python
class _tqdm_cls:
def __call__(self, *args, disable=False, **kwargs):
if _tqdm_active and not disable:
return tqdm_lib.tqdm(*args, **kwargs)
else:
return EmptyTqdm(*args, **kwargs)
def set_lock(self, *args, **kwargs):
self._lock = None
if _tqdm_active:
return tqdm_lib.tqdm.set_lock(*args, **kwargs)
def get_lock(self):
if _tqdm_active:
return tqdm_lib.tqdm.get_lock()
```
### Environment info
Python 3.11.4
tqdm '4.65.0'
datasets master
Yes it looks like a bug on their end indeed, do you want to open a PR on tqdm ?
Let me see if I can find a workaround in the meantime | [
-1.3521512746810913,
-0.8465626835823059,
-0.5868315100669861,
1.283677339553833,
0.03677382320165634,
-0.8991362452507019,
0.05178180709481239,
-1.024348497390747,
1.9279330968856812,
-0.5640751123428345,
0.19435115158557892,
-1.4659757614135742,
-0.12366081774234772,
-0.3550596237182617,
-0.6583359837532043,
-1.0089880228042603,
-0.22304120659828186,
-0.8023163080215454,
1.1088749170303345,
2.6884775161743164,
1.156903862953186,
-1.3759241104125977,
2.642866849899292,
0.7988353967666626,
-0.24207842350006104,
-0.7284358143806458,
0.5179723501205444,
-0.011512529104948044,
-1.1826525926589966,
-0.6495604515075684,
-1.0175813436508179,
0.022053562104701996,
-0.6313120722770691,
-0.3401859402656555,
-0.02158968523144722,
0.13139449059963226,
-0.20061808824539185,
-0.2873065769672394,
-0.9021544456481934,
-0.6910043358802795,
0.548274040222168,
-0.2852327525615692,
0.962647020816803,
-0.3649974763393402,
1.8277539014816284,
-0.6605496406555176,
0.6081895232200623,
0.7097229957580566,
1.1302821636199951,
0.03843861073255539,
-0.02079499140381813,
0.534895122051239,
0.3973972499370575,
-0.030856993049383163,
0.7792328596115112,
1.1679213047027588,
0.6481515765190125,
0.5231693983078003,
0.3747190535068512,
-2.402606964111328,
1.3480474948883057,
-1.1254764795303345,
0.2611131966114044,
1.3818163871765137,
-0.7771731615066528,
0.33440378308296204,
-1.6795424222946167,
0.18649689853191376,
0.7953941226005554,
-2.4113516807556152,
0.21887235343456268,
-1.3777607679367065,
-0.6116394400596619,
1.02347731590271,
0.4455806314945221,
-1.1382908821105957,
0.04288424551486969,
-0.4744756817817688,
1.1887880563735962,
0.16459180414676666,
1.323036789894104,
-1.5153446197509766,
0.07853391021490097,
-0.16390080749988556,
0.40112704038619995,
-1.1884578466415405,
-1.63075590133667,
0.47040989995002747,
0.5899773836135864,
0.26367324590682983,
-0.20505091547966003,
1.0199583768844604,
-0.9974428415298462,
0.5892379283905029,
-0.879410445690155,
-1.5193231105804443,
-1.6370117664337158,
-2.5339717864990234,
-2.419931411743164,
0.7907775044441223,
-0.6993247866630554,
-0.3508959710597992,
2.1170456409454346,
-1.1112667322158813,
-1.5155402421951294,
0.9031490683555603,
0.1301542967557907,
0.18626834452152252,
2.1760153770446777,
0.0870685800909996,
-0.6804654598236084,
0.37824180722236633,
-0.726199746131897,
0.7385104894638062,
-0.30165982246398926,
1.4342628717422485,
0.5134738087654114,
-1.1090902090072632,
1.4783711433410645,
-0.5905486345291138,
0.5421697497367859,
-0.35697025060653687,
-0.5581348538398743,
-0.7811577320098877,
0.4774627089500427,
1.9544063806533813,
-0.3682940602302551,
1.717416763305664,
-0.5249424576759338,
-1.5466097593307495,
-1.4526327848434448,
0.8967746496200562,
0.4380446970462799,
-0.9256751537322998,
0.3436538577079773,
-0.6989375352859497,
0.06934519857168198,
-0.1274934858083725,
1.2606428861618042,
1.4358786344528198,
0.8622769117355347,
-0.28867924213409424,
-0.9380638599395752,
0.21729804575443268,
-0.180426687002182,
-0.8059960007667542,
-1.8390917778015137,
-0.16765767335891724,
0.10799171775579453,
0.6952167749404907,
-1.334524154663086,
1.5881760120391846,
0.8184784650802612,
1.9953057765960693,
0.8810362219810486,
-0.3565824329853058,
1.5788503885269165,
0.10273914039134979,
1.9695619344711304,
-0.7274723052978516,
0.6091565489768982,
-0.25802770256996155,
-1.13075590133667,
0.602349579334259,
-0.5166391730308533,
-2.019538164138794,
-0.7058054208755493,
-0.7484105825424194,
-0.07471983879804611,
-0.8735766410827637,
0.8328580856323242,
-0.07892382144927979,
-1.3269766569137573,
0.037220317870378494,
-0.6979303359985352,
0.525588870048523,
-1.268679141998291,
0.19269853830337524,
0.7282240986824036,
-0.40709948539733887,
0.19289961457252502,
-0.30141860246658325,
-1.2765871286392212,
-0.44538742303848267,
0.2148360311985016,
1.7092931270599365,
-0.3832385241985321,
0.6793234348297119,
1.2920857667922974,
-0.7202000617980957,
-0.05136673152446747,
0.24222339689731598,
-0.31593912839889526,
0.8499449491500854,
-1.213307499885559,
-0.4020674526691437,
1.103127121925354,
-0.12177959829568863,
-0.538506269454956,
1.2828400135040283,
0.7414155006408691,
-1.4261047840118408,
-0.3345857858657837,
-0.1103140339255333,
-0.800789475440979,
0.229596808552742,
-1.599118947982788,
-0.13479000329971313,
0.3764839768409729,
-1.6156822443008423,
-0.42269524931907654,
-0.2238057255744934,
1.2895721197128296,
-0.4028053879737854,
1.5293537378311157,
-0.02884598821401596,
0.03283382207155228,
-0.41834840178489685,
-0.23257780075073242,
0.32171517610549927,
-0.152330681681633,
-0.7775755524635315,
0.37977704405784607,
-0.6720184087753296,
0.2616594433784485,
1.236938238143921,
0.21759240329265594,
-0.2889638841152191,
0.292082816362381,
1.2093192338943481,
0.35908243060112,
-0.23396429419517517,
-0.8236218690872192,
-1.7396965026855469,
1.9075483083724976,
-1.2333664894104004,
1.735875129699707,
0.8410902619361877,
0.06864677369594574,
-1.9759607315063477,
-1.9344966411590576,
0.9765974283218384,
1.1564213037490845,
2.433076858520508,
0.29628849029541016,
0.5317174792289734,
-0.816351056098938,
-0.6313667893409729,
0.2908959686756134,
-0.8242727518081665,
-0.6654465198516846,
0.28600338101387024,
2.3161346912384033,
1.744185447692871,
-0.5277401804924011,
-0.16757617890834808,
-0.9070008993148804,
0.9472280740737915,
-0.1560613512992859,
0.1032833382487297,
1.8340047597885132,
-0.21770057082176208,
-1.109144926071167,
1.2990546226501465,
-2.280304193496704,
0.3642001152038574,
1.896501064300537,
0.3428557813167572,
0.14780259132385254,
-1.515293002128601,
-0.7185305953025818,
-0.2297145128250122,
-0.47209396958351135,
-1.2793437242507935,
0.5771636366844177,
-0.04452018067240715,
-1.1568613052368164,
-1.4738106727600098,
0.17234741151332855,
-1.0940903425216675,
-1.6372356414794922,
0.09702835232019424,
1.6472487449645996,
1.7815272808074951,
-0.9347864389419556,
1.2636431455612183,
-0.2786821722984314,
-0.058101311326026917,
1.3028626441955566,
1.2421928644180298,
3.1923696994781494,
2.0930440425872803,
-1.3588863611221313,
0.7501751184463501,
-0.45425325632095337,
-0.48371684551239014,
1.3359118700027466,
-1.3969383239746094,
1.0847744941711426,
-0.08317103981971741,
-1.2431195974349976,
-1.1207540035247803,
1.196039080619812,
0.49201297760009766,
-0.017637604847550392,
-0.39043474197387695,
1.4444079399108887,
0.08816592395305634,
1.329132080078125,
0.5904709696769714,
-0.3448835015296936,
0.5995341539382935,
-0.2379176914691925,
-0.3511018753051758,
1.4434895515441895,
0.16469095647335052,
-1.3172589540481567,
-2.0604515075683594,
-0.30608969926834106,
-1.092736840248108,
-0.18789948523044586,
-0.6453109383583069,
-0.8920084238052368,
1.4902311563491821,
0.4073588252067566,
-1.0816891193389893,
-0.48647788166999817,
-0.4077385365962982,
-0.694445013999939,
2.6950268745422363,
-1.438475251197815,
-0.12085571885108948,
-1.0280990600585938,
-0.37704789638519287,
1.7620261907577515,
-1.2021361589431763,
-0.1440926343202591,
-1.0291293859481812,
-0.5072453618049622,
-1.343376636505127,
-0.40150928497314453,
-0.15733928978443146,
-0.8161590695381165,
0.8386436104774475,
0.29525089263916016,
-1.2216306924819946,
-0.307094007730484,
-0.6104503870010376,
0.8233334422111511,
-0.00845920480787754,
0.21250730752944946,
1.8285976648330688,
0.20871397852897644,
-0.5204732418060303,
0.6522339582443237,
1.2864199876785278,
0.8206965327262878,
-0.7473633885383606,
0.01238060649484396,
-0.877595067024231,
0.2103065550327301,
-1.8275014162063599,
0.2577137053012848,
-2.6765716075897217,
0.745964527130127,
-0.21918867528438568,
-0.16634029150009155,
-0.1883762925863266,
-1.3646878004074097,
0.9899558424949646,
2.4431285858154297,
-1.222352147102356,
0.34013426303863525,
0.558910608291626,
1.129453420639038,
-1.52141535282135,
0.27728357911109924,
-0.5472350716590881,
1.9673813581466675,
0.3606279194355011,
1.29331374168396,
-0.26412132382392883,
-2.2942326068878174,
0.7008957862854004,
-0.9900544285774231,
-0.7993454337120056,
0.9848408699035645,
-1.036194920539856,
0.10173735022544861,
-1.6293010711669922,
-0.4484351575374603,
-0.7917584776878357,
-1.3042129278182983,
0.4027526080608368,
0.10850761830806732,
0.4813213050365448,
-0.8338385820388794,
0.4156211018562317,
-2.1256425380706787,
-1.280670166015625,
-0.14467526972293854,
-0.9829208850860596,
0.6360070705413818,
-0.3579353094100952,
0.5913558006286621,
0.045186858624219894,
0.1168600469827652,
0.3235798180103302,
1.642377257347107,
3.5620157718658447,
0.1342773586511612,
0.2802782654762268,
-0.03751535341143608,
-0.9832461476325989,
1.1756844520568848,
0.699571967124939,
-0.07713732123374939,
-0.6242050528526306,
-1.064204216003418,
1.3947227001190186,
1.9391998052597046,
1.1102224588394165,
0.11502466350793839,
-0.9782136082649231,
-0.9323775768280029,
0.11117929965257645,
0.19524629414081573,
0.45118585228919983,
0.8819080591201782,
0.14739590883255005,
0.13738112151622772,
1.4058096408843994,
1.1642804145812988,
-0.3376760482788086,
0.2272675782442093,
-0.8579511642456055,
-0.3494069278240204,
0.6956281661987305,
0.24563147127628326,
0.15718181431293488,
0.6150067448616028,
-1.0578062534332275,
-0.3040401339530945,
-0.1187351644039154,
-1.033526062965393,
-0.8469188213348389,
-0.3645491302013397,
-0.2851758599281311,
1.6337007284164429,
0.2335965484380722,
-0.48823320865631104,
0.18423989415168762,
-0.4957510828971863,
-0.13290081918239594,
-1.1375561952590942,
0.07648321986198425,
-0.10401888191699982,
0.01050268393009901,
-0.14036229252815247,
1.5430327653884888,
-0.7817375063896179,
-1.9662758111953735,
0.02723463624715805,
0.2289348542690277,
-0.28549960255622864,
0.2778286933898926,
1.876517415046692,
0.5024697780609131,
1.791791558265686,
1.02422297000885,
1.1390247344970703,
-0.47523459792137146,
-1.336104154586792,
0.7638934254646301,
1.0105618238449097,
-1.4831258058547974,
0.7561991214752197,
-0.2655555307865143,
-0.6414832472801208,
0.6192159056663513,
1.3197944164276123,
0.3682551980018616,
-1.8802424669265747,
1.0183417797088623,
-0.8876082301139832,
0.7711708545684814,
0.5310311317443848,
0.9148852229118347,
-0.02934601902961731,
0.8280729055404663,
-1.341902494430542,
-1.0763003826141357,
-0.5112506151199341,
-0.7666745781898499,
1.7777831554412842,
-0.33654695749282837,
0.47715476155281067,
-0.18093575537204742,
-1.3464833498001099,
0.04348471015691757,
0.9014179706573486,
0.09589551389217377,
-0.5071082711219788,
1.235575795173645,
-0.7955337762832642,
-1.2208199501037598,
-1.3365451097488403,
-0.4627600908279419,
-0.8945221304893494,
-0.8102182745933533,
1.1722508668899536,
0.8489481806755066,
0.3076280951499939,
1.931687593460083,
0.5728175640106201,
0.2557595372200012,
-2.676346778869629,
0.7806742787361145,
0.07530584931373596,
0.1754676252603531,
0.9270681738853455,
0.2305983155965805,
1.0851138830184937,
-0.13302747905254364,
0.6602859497070312,
-2.2139697074890137,
2.190561532974243,
-0.06898049265146255,
0.6678903698921204,
-0.27786168456077576,
-0.24984021484851837,
0.8927656412124634,
0.48498299717903137,
0.743829071521759,
-1.4213987588882446,
0.8266007900238037,
-0.4907926023006439,
0.9112980365753174,
0.6877413988113403,
-0.7418578267097473,
-0.10262042284011841,
1.0204861164093018,
0.5001095533370972,
-0.38696756958961487,
-0.9797511696815491,
-0.9291428327560425,
1.1279083490371704,
1.6088098287582397,
-0.04091116413474083,
-0.0063375914469361305,
0.7068549394607544,
0.6967776417732239,
-1.119896650314331,
0.3266255855560303,
-0.7109658718109131,
-0.6586567759513855,
1.3143470287322998,
2.0225086212158203,
-0.10523401200771332,
-0.19205746054649353,
-0.6288843154907227,
-1.1921111345291138,
0.4705393612384796,
-0.14703509211540222,
0.45896822214126587,
0.6097984910011292,
-0.6311136484146118,
0.7907437682151794,
0.853172242641449,
0.9281733632087708,
0.11423075199127197,
0.3773452043533325,
0.5226050615310669,
-0.4893872141838074,
-0.9468663334846497,
-0.5079358220100403,
-0.9944900274276733,
-2.772594928741455,
0.4865324795246124,
-0.31221452355384827,
-1.7003687620162964,
0.13714314997196198,
-1.1598178148269653,
0.9037516713142395,
-0.6062751412391663,
-1.4831300973892212,
-1.3606762886047363,
0.3976737856864929,
-0.018978750333189964,
1.126449704170227,
-1.5416712760925293,
-0.10684391856193542,
1.3499733209609985,
0.9306431412696838,
-0.20869342982769012,
0.7041609883308411,
0.3663647174835205,
1.0119878053665161,
1.1269590854644775,
-0.1746334284543991,
0.5356847643852234,
0.31965020298957825,
-1.226167917251587,
0.44694799184799194,
1.1744554042816162,
0.3333441913127899,
1.4427132606506348,
-0.35785728693008423,
0.17492975294589996,
0.5848684310913086,
-0.7010063529014587,
-0.5601987242698669,
-0.2631869614124298,
0.35074901580810547,
0.3718017339706421,
-1.1137945652008057,
-0.14256711304187775,
-0.3362291157245636,
0.004177388735115528,
-0.11863942444324493,
-1.3614659309387207,
-0.3265659213066101,
-0.3982192873954773,
-0.686803936958313,
-1.4375382661819458,
0.07430471479892731,
1.2458163499832153,
-0.7400732040405273,
-0.09871954470872879,
0.38881802558898926,
0.46149173378944397,
0.5702497959136963,
0.509876012802124,
-0.7289793491363525,
-0.45075181126594543,
-0.1696815937757492,
-0.25022801756858826,
0.1599012315273285,
1.0350897312164307,
-0.12144225835800171,
-1.0334320068359375,
0.6304041147232056,
-0.278475284576416,
0.19349141418933868,
1.8877155780792236,
0.12918412685394287,
-0.8450613021850586,
0.42738577723503113,
-0.5980470776557922,
1.7481648921966553,
1.7766462564468384,
1.4082164764404297,
-0.08475938439369202,
-0.8481414318084717,
0.4641878008842468,
-0.5516619682312012,
-0.12393351644277573,
0.9465259313583374,
0.6039053797721863,
-0.22551381587982178,
-1.3075534105300903,
0.5837433934211731,
1.3028631210327148,
-1.0849767923355103,
-0.7287118434906006,
0.353732168674469,
-0.6826037764549255,
1.322310447692871,
0.624575138092041,
0.07813600450754166,
0.2458200603723526,
1.6093138456344604,
0.7779735326766968,
-0.535224437713623,
0.5232193470001221,
0.7197362780570984,
-0.4259026348590851,
-2.314595937728882,
-1.2201613187789917,
0.3978528082370758,
-0.38476404547691345,
-1.3012583255767822,
1.393068790435791,
-1.1441254615783691,
-1.0403860807418823,
0.6296542286872864,
0.05764849856495857,
1.1507059335708618,
0.19841574132442474,
1.7154958248138428,
2.253068685531616,
0.757347583770752,
0.257707804441452,
1.313523530960083,
0.1278500258922577,
-0.47213754057884216,
1.9872981309890747,
-0.26319774985313416,
0.4560069441795349,
0.8710852265357971,
-0.5018423795700073,
-1.1134164333343506,
-1.0161212682724,
-1.1849862337112427,
-0.6824880242347717,
1.3156335353851318,
0.11360086500644684,
-0.9215918183326721,
0.4901082217693329,
1.7598676681518555,
0.16926084458827972,
-0.24960167706012726,
0.6341556310653687,
0.5583701729774475,
-0.7889825105667114,
-0.020468756556510925,
-1.2578049898147583,
0.6289879679679871,
-0.1664561629295349,
-0.09694315493106842,
0.08676231652498245,
0.7347716093063354,
1.2358806133270264,
0.09766668826341629,
-0.12577080726623535,
1.1313918828964233,
-1.4748961925506592,
1.6798367500305176,
-0.5699650049209595,
0.45263174176216125,
-2.3144304752349854,
1.1421259641647339,
-0.6715932488441467,
1.9252856969833374,
-2.450446367263794,
0.5139152407646179,
-0.7128379344940186,
-0.4163958430290222,
0.28455430269241333,
-0.4057167172431946,
0.14052660763263702,
-0.18454530835151672,
-1.046558141708374,
-0.14424367249011993,
-1.0758476257324219,
0.7310072779655457,
1.146992802619934,
1.4003256559371948,
-1.2156238555908203,
-0.0036764685064554214,
-1.3482110500335693,
-0.08654996007680893,
-0.8571937084197998,
0.23416702449321747,
-1.6697404384613037,
-0.28050923347473145,
-2.1111562252044678,
-2.304094076156616,
-1.326977252960205,
-0.7295746803283691,
1.0908632278442383,
0.22760042548179626,
-0.8652193546295166,
1.0831001996994019,
-0.6321773529052734,
-1.8993183374404907,
0.9742449522018433,
-2.2420873641967773
] |
https://github.com/huggingface/datasets/issues/6060 | Dataset.map() execute twice when in PyTorch DDP mode | Sorry for asking a duplicate question about `num_proc`, I searched the forum and find the solution.
But I still can't make the trick with `torch.distributed.barrier()` to only map at the main process work. The [post on forum]( https://discuss.huggingface.co/t/slow-processing-with-map-when-using-deepspeed-or-fairscale/7229/7) didn't help. | ### Describe the bug
I use `torchrun --standalone --nproc_per_node=2 train.py` to start training. And write the code following the [docs](https://huggingface.co/docs/datasets/process#distributed-usage). The trick about using `torch.distributed.barrier()` to only execute map at the main process doesn't always work. When I am training model, it will map twice. When I am running a test for dataset and dataloader (just print the batches), it can work. Their code about loading dataset are same.
And on another server with 30 CPU cores, I use 2 GPUs and it can't work neither.
I have tried to use `rank` and `local_rank` to check, they all didn't make sense.
### Steps to reproduce the bug
use `torchrun --standalone --nproc_per_node=2 train.py` or `torchrun --standalone train.py` to run
This is my code:
```python
if args.distributed and world_size > 1:
if args.local_rank > 0:
print(f"Rank {args.rank}: Gpu {args.gpu} waiting for main process to perform the mapping", force=True)
torch.distributed.barrier()
print("Mapping dataset")
dataset = dataset.map(lambda x: cut_reorder_keys(x, num_stations_list=args.num_stations_list, is_pad=True, is_train=True), num_proc=8, desc="cut_reorder_keys")
dataset = dataset.map(lambda x: random_shift(x, shift_range=(-160, 0), feature_scale=16), num_proc=8, desc="random_shift")
dataset_test = dataset_test.map(lambda x: cut_reorder_keys(x, num_stations_list=args.num_stations_list, is_pad=True, is_train=False), num_proc=8, desc="cut_reorder_keys")
if args.local_rank == 0:
print("Mapping finished, loading results from main process")
torch.distributed.barrier()
```
### Expected behavior
Only the main process will execute `map`, while the sub process will load cache from disk.
### Environment info
server with 64 CPU cores (AMD Ryzen Threadripper PRO 5995WX 64-Cores) and 2 RTX 4090
- `python==3.9.16`
- `datasets==2.13.1`
- `torch==2.0.1+cu117`
- `22.04.1-Ubuntu`
server with 30 CPU cores (Intel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHz) and 2 RTX 4090
- `python==3.9.0`
- `datasets==2.13.1`
- `torch==2.0.1+cu117`
- `Ubuntu 20.04` | 19 | 40 | Dataset.map() execute twice when in PyTorch DDP mode
### Describe the bug
I use `torchrun --standalone --nproc_per_node=2 train.py` to start training. And write the code following the [docs](https://huggingface.co/docs/datasets/process#distributed-usage). The trick about using `torch.distributed.barrier()` to only execute map at the main process doesn't always work. When I am training model, it will map twice. When I am running a test for dataset and dataloader (just print the batches), it can work. Their code about loading dataset are same.
And on another server with 30 CPU cores, I use 2 GPUs and it can't work neither.
I have tried to use `rank` and `local_rank` to check, they all didn't make sense.
### Steps to reproduce the bug
use `torchrun --standalone --nproc_per_node=2 train.py` or `torchrun --standalone train.py` to run
This is my code:
```python
if args.distributed and world_size > 1:
if args.local_rank > 0:
print(f"Rank {args.rank}: Gpu {args.gpu} waiting for main process to perform the mapping", force=True)
torch.distributed.barrier()
print("Mapping dataset")
dataset = dataset.map(lambda x: cut_reorder_keys(x, num_stations_list=args.num_stations_list, is_pad=True, is_train=True), num_proc=8, desc="cut_reorder_keys")
dataset = dataset.map(lambda x: random_shift(x, shift_range=(-160, 0), feature_scale=16), num_proc=8, desc="random_shift")
dataset_test = dataset_test.map(lambda x: cut_reorder_keys(x, num_stations_list=args.num_stations_list, is_pad=True, is_train=False), num_proc=8, desc="cut_reorder_keys")
if args.local_rank == 0:
print("Mapping finished, loading results from main process")
torch.distributed.barrier()
```
### Expected behavior
Only the main process will execute `map`, while the sub process will load cache from disk.
### Environment info
server with 64 CPU cores (AMD Ryzen Threadripper PRO 5995WX 64-Cores) and 2 RTX 4090
- `python==3.9.16`
- `datasets==2.13.1`
- `torch==2.0.1+cu117`
- `22.04.1-Ubuntu`
server with 30 CPU cores (Intel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHz) and 2 RTX 4090
- `python==3.9.0`
- `datasets==2.13.1`
- `torch==2.0.1+cu117`
- `Ubuntu 20.04`
Sorry for asking a duplicate question about `num_proc`, I searched the forum and find the solution.
But I still can't make the trick with `torch.distributed.barrier()` to only map at the main process work. The [post on forum]( https://discuss.huggingface.co/t/slow-processing-with-map-when-using-deepspeed-or-fairscale/7229/7) didn't help. | [
-1.3185489177703857,
-0.9868546724319458,
-0.5761328935623169,
1.4660086631774902,
-0.17576950788497925,
-1.1413180828094482,
0.1571463942527771,
-1.0458317995071411,
1.5937193632125854,
-0.8820594549179077,
0.28995469212532043,
-1.597267985343933,
0.055676743388175964,
-0.522131085395813,
-0.7138332724571228,
-0.8761380910873413,
-0.4234674870967865,
-0.7217979431152344,
1.141829013824463,
2.4612231254577637,
1.2849757671356201,
-1.398491382598877,
2.67093563079834,
0.7543821334838867,
-0.20498503744602203,
-1.0928007364273071,
0.5248920321464539,
-0.03083524852991104,
-1.2757635116577148,
-0.4112604260444641,
-0.9696189761161804,
-0.10746294260025024,
-0.635527491569519,
-0.4989524483680725,
-0.007602637633681297,
0.4371323585510254,
-0.2862488329410553,
-0.40178611874580383,
-0.5295384526252747,
-0.7151160836219788,
0.5570492148399353,
-0.38045448064804077,
0.8357682228088379,
-0.34930264949798584,
1.7143515348434448,
-0.5441546440124512,
0.5866219997406006,
0.7308601140975952,
1.243807315826416,
0.2239459753036499,
-0.03214837610721588,
0.3170872628688812,
0.44812384247779846,
-0.011264288797974586,
0.5849176049232483,
1.1607863903045654,
0.6380777359008789,
0.5038155317306519,
0.6868812441825867,
-2.2337753772735596,
1.304992914199829,
-0.9791703820228577,
0.29343491792678833,
1.3541194200515747,
-0.9579387903213501,
0.34682074189186096,
-1.7940022945404053,
-0.08815792948007584,
0.5980684161186218,
-2.1361050605773926,
0.25142213702201843,
-1.302985668182373,
-0.5520093441009521,
1.0119881629943848,
0.41355273127555847,
-1.2301959991455078,
0.07757465541362762,
-0.4694061875343323,
1.0448296070098877,
0.4817658066749573,
1.0030397176742554,
-1.6986654996871948,
-0.03533926606178284,
-0.29239848256111145,
0.20219624042510986,
-1.295846939086914,
-1.5640602111816406,
0.5681953430175781,
0.6621199250221252,
0.5541953444480896,
-0.09930382668972015,
1.1010969877243042,
-1.1244772672653198,
0.7611812949180603,
-1.02451753616333,
-1.7237087488174438,
-1.4091860055923462,
-2.305267572402954,
-2.3342113494873047,
0.6796372532844543,
-0.466689795255661,
-0.5691626667976379,
2.097825765609741,
-1.0805041790008545,
-1.6714584827423096,
1.1873505115509033,
0.1926613748073578,
0.020633099600672722,
2.4106926918029785,
0.22189858555793762,
-0.7460521459579468,
0.5121053457260132,
-0.806027352809906,
0.7235427498817444,
-0.3733515739440918,
1.3330072164535522,
0.4038764238357544,
-1.040486216545105,
1.6323401927947998,
-0.29925480484962463,
0.5695567727088928,
-0.5930342078208923,
-0.4916607141494751,
-0.6824690103530884,
0.23993462324142456,
1.941811442375183,
-0.27363619208335876,
1.4326362609863281,
-0.31212571263313293,
-1.4389164447784424,
-1.6227844953536987,
0.9633283615112305,
0.4553346633911133,
-0.7301139831542969,
0.19644999504089355,
-0.4385504722595215,
0.10513020306825638,
-0.015293145552277565,
1.067158818244934,
1.3880984783172607,
0.7153162360191345,
-0.39607349038124084,
-0.873737096786499,
0.16613857448101044,
-0.1586453914642334,
-0.6725117564201355,
-1.8027876615524292,
-0.35693588852882385,
-0.003682376816868782,
0.6947598457336426,
-1.0881465673446655,
1.8119438886642456,
0.914889395236969,
1.8795839548110962,
0.9806324243545532,
-0.36649081110954285,
1.4113882780075073,
0.11870904266834259,
1.8084332942962646,
-0.46743330359458923,
0.6822972297668457,
-0.36971530318260193,
-1.1114965677261353,
0.8890887498855591,
-0.36196380853652954,
-1.9796452522277832,
-0.7160128951072693,
-0.7349088788032532,
-0.18841055035591125,
-0.8068907260894775,
0.9268937110900879,
-0.21654927730560303,
-1.4842095375061035,
0.2380674183368683,
-0.6558262705802917,
0.220973938703537,
-1.1772081851959229,
0.37396180629730225,
0.625952959060669,
-0.666195273399353,
0.1064395159482956,
-0.3157360255718231,
-1.2339547872543335,
-0.5303803086280823,
0.2955318093299866,
1.7946771383285522,
-0.688759446144104,
0.886988639831543,
1.0791221857070923,
-0.6955977082252502,
-0.03827099874615669,
0.33103981614112854,
-0.23652631044387817,
0.7652276754379272,
-1.031660795211792,
-0.45609721541404724,
1.2792311906814575,
-0.2639072835445404,
-0.649196445941925,
1.5271841287612915,
0.7186151146888733,
-0.9755860567092896,
-0.18833619356155396,
-0.13829480111598969,
-0.7650131583213806,
0.09176883846521378,
-1.6013392210006714,
-0.08308371156454086,
0.5309829711914062,
-1.6046762466430664,
-0.4119751751422882,
-0.14134570956230164,
1.3729898929595947,
-0.17124420404434204,
1.4823791980743408,
-0.3851393163204193,
-0.1388094574213028,
-0.31988248229026794,
-0.3260335922241211,
0.15915997326374054,
-0.08836053311824799,
-0.5787795782089233,
0.18589754402637482,
-0.9104270339012146,
0.33793359994888306,
1.435483455657959,
0.30874136090278625,
0.025448491796851158,
0.4583147466182709,
1.0937607288360596,
0.38723036646842957,
-0.09777891635894775,
-0.9103565216064453,
-1.554782748222351,
1.952488899230957,
-1.5000964403152466,
2.071545124053955,
0.7519984841346741,
-0.05720613896846771,
-1.8004939556121826,
-1.7533260583877563,
1.336076021194458,
1.1100893020629883,
2.3652846813201904,
0.5270215272903442,
0.3833594024181366,
-0.8837249279022217,
-0.6555964350700378,
0.350841224193573,
-0.9814335703849792,
-0.7484713196754456,
0.1840018481016159,
2.38594913482666,
1.7939046621322632,
-0.3829582929611206,
-0.11993095278739929,
-0.9890129566192627,
1.4104223251342773,
-0.20923398435115814,
0.318727046251297,
1.966794490814209,
-0.3232051432132721,
-1.0467588901519775,
1.375346302986145,
-2.3920397758483887,
0.1258222758769989,
2.0615410804748535,
0.2759648561477661,
0.0961584821343422,
-1.3380846977233887,
-0.6491498947143555,
-0.2864780128002167,
-0.4654337167739868,
-1.2431886196136475,
0.5060114860534668,
-0.3162805140018463,
-0.8203180432319641,
-1.3864201307296753,
0.1051018014550209,
-1.1598397493362427,
-1.68894362449646,
0.23535552620887756,
1.8292949199676514,
2.0808825492858887,
-0.7055372595787048,
1.5710415840148926,
-0.3206973373889923,
0.16948182880878448,
1.2167025804519653,
1.2838573455810547,
3.0636465549468994,
1.9088870286941528,
-1.31972074508667,
0.6958693861961365,
-0.22055281698703766,
-0.5277215242385864,
1.0933841466903687,
-1.2565604448318481,
1.2659929990768433,
-0.185942605137825,
-1.1879950761795044,
-1.247787594795227,
1.0506346225738525,
0.44588059186935425,
0.10463634133338928,
-0.4960084557533264,
1.2524901628494263,
0.13244444131851196,
1.3298587799072266,
0.5473886728286743,
-0.3311786353588104,
0.6362005472183228,
-0.47160813212394714,
-0.5230970978736877,
1.5844664573669434,
0.2247460037469864,
-1.4283736944198608,
-2.1834726333618164,
-0.22355356812477112,
-0.8889651298522949,
0.04975278675556183,
-0.6133911609649658,
-0.9851478338241577,
1.6078927516937256,
0.30456268787384033,
-1.2492225170135498,
-0.28095149993896484,
-0.2821430265903473,
-0.6063839197158813,
2.7026429176330566,
-1.2533295154571533,
-0.2165350615978241,
-0.966120183467865,
-0.7217771410942078,
1.60617995262146,
-1.2164089679718018,
-0.203319251537323,
-1.047782301902771,
-0.5739913582801819,
-1.2328336238861084,
-0.5326585173606873,
0.06478533148765564,
-1.0111260414123535,
0.7966199517250061,
0.14517860114574432,
-1.239870548248291,
-0.3507971465587616,
-0.8373608589172363,
0.8643413782119751,
-0.1752844601869583,
0.16992409527301788,
1.8097858428955078,
0.25777432322502136,
-0.3886108696460724,
0.7390653491020203,
1.1547825336456299,
0.6117309927940369,
-0.6134157776832581,
0.12592798471450806,
-0.6601639986038208,
0.43559902906417847,
-1.1832484006881714,
0.3028322160243988,
-2.9113638401031494,
0.6666910648345947,
-0.009066644124686718,
-0.027195384725928307,
-0.07237232476472855,
-1.3127893209457397,
1.0677698850631714,
2.617873191833496,
-1.193816065788269,
0.5227735638618469,
0.34904944896698,
1.1875535249710083,
-1.5523029565811157,
0.29551947116851807,
-0.5145190954208374,
2.073410749435425,
0.231389582157135,
1.2487096786499023,
-0.5232198238372803,
-2.3780019283294678,
0.6648368835449219,
-1.2322590351104736,
-1.186214804649353,
0.7997191548347473,
-0.9016430974006653,
0.12868642807006836,
-1.367283821105957,
-0.22189435362815857,
-0.8898736238479614,
-1.0546010732650757,
0.593195915222168,
0.16269303858280182,
0.4650554358959198,
-0.5655088424682617,
0.3510720729827881,
-2.227210760116577,
-1.3480920791625977,
-0.2010485976934433,
-0.9388943910598755,
0.4846877455711365,
-0.4013109803199768,
0.6908214092254639,
-0.14149603247642517,
0.022987330332398415,
0.3673703372478485,
1.4883190393447876,
3.3571012020111084,
0.1696651726961136,
0.27460500597953796,
-0.17447802424430847,
-0.9826634526252747,
1.4871689081192017,
0.8500410914421082,
-0.14372138679027557,
-0.6134653091430664,
-1.032896637916565,
1.2387670278549194,
1.9314111471176147,
0.946361243724823,
0.0039066048339009285,
-0.8427832126617432,
-0.7076641917228699,
-0.041313543915748596,
0.11981989443302155,
0.43317970633506775,
0.9620027542114258,
0.052736520767211914,
0.1374301016330719,
1.4414172172546387,
1.1765882968902588,
-0.4770592451095581,
0.2816488444805145,
-0.8391638398170471,
-0.4205400347709656,
0.5101038217544556,
0.3140968978404999,
-0.015889087691903114,
0.33817049860954285,
-1.0087517499923706,
-0.1746395379304886,
-0.33540716767311096,
-0.9230707883834839,
-0.7324702739715576,
-0.3851890563964844,
-0.4195028841495514,
1.6245663166046143,
0.1575794368982315,
-0.48360827565193176,
-0.006195252761244774,
-0.8712987899780273,
-0.14530189335346222,
-1.11351478099823,
0.29250121116638184,
-0.11586995422840118,
-0.11169125884771347,
-0.2232932597398758,
1.7338896989822388,
-0.8549855947494507,
-2.0736629962921143,
0.2286432981491089,
0.19364161789417267,
-0.26156488060951233,
0.24398839473724365,
1.724086046218872,
0.5432058572769165,
1.47164785861969,
1.3415223360061646,
0.9479662179946899,
-0.6057721972465515,
-1.2724567651748657,
0.7558625340461731,
1.0216541290283203,
-1.4469094276428223,
0.8538694977760315,
0.0011999327689409256,
-0.5051481127738953,
0.5760433673858643,
1.2298215627670288,
0.5041474103927612,
-1.9788731336593628,
0.8017280697822571,
-1.062198281288147,
0.837833821773529,
0.7399774789810181,
0.6638272404670715,
0.1777621954679489,
0.9283101558685303,
-1.1787320375442505,
-1.129231572151184,
-0.6952704191207886,
-0.7221962213516235,
2.0402162075042725,
-0.34052637219429016,
0.6000555753707886,
-0.23078103363513947,
-1.2923340797424316,
-0.05440422147512436,
0.7323786616325378,
0.2887422442436218,
-0.4682749807834625,
0.8341727256774902,
-0.6007912755012512,
-1.1640090942382812,
-1.3664273023605347,
-0.4589141309261322,
-1.0938819646835327,
-0.9619726538658142,
1.092771053314209,
0.6673710346221924,
0.3097025156021118,
1.8703594207763672,
0.6378706693649292,
0.28799524903297424,
-2.67391037940979,
0.9208753705024719,
0.22497184574604034,
-0.10432979464530945,
0.9031848907470703,
0.3295463025569916,
0.9933805465698242,
-0.020344166085124016,
0.5472918152809143,
-2.4491753578186035,
2.3124332427978516,
-0.18143010139465332,
0.6509084105491638,
0.043607234954833984,
-0.053619734942913055,
1.0752713680267334,
0.6304299235343933,
0.5492086410522461,
-1.027333378791809,
0.7558079957962036,
-0.556824266910553,
1.2396973371505737,
0.7969792485237122,
-0.8467820286750793,
-0.017831601202487946,
1.380927562713623,
0.36102601885795593,
-0.5517097115516663,
-0.9013553857803345,
-1.0137962102890015,
0.9347022175788879,
1.756234049797058,
-0.11418287456035614,
-0.029757145792245865,
0.7228677868843079,
0.6476909518241882,
-1.3141273260116577,
-0.028376715257763863,
-0.6605828404426575,
-0.6633704304695129,
1.640252709388733,
2.099193572998047,
-0.19364123046398163,
-0.1385960727930069,
-0.6455079317092896,
-1.3796608448028564,
0.8333439826965332,
-0.11536342650651932,
0.16322773694992065,
0.6348504424095154,
-0.5543731451034546,
1.0138835906982422,
0.8247116804122925,
0.9266191720962524,
0.2467925250530243,
0.24065229296684265,
0.42654961347579956,
-0.40654414892196655,
-1.172113299369812,
-0.23910579085350037,
-1.121260643005371,
-2.641775369644165,
0.37926939129829407,
-0.21263855695724487,
-1.384717345237732,
0.0622626468539238,
-0.956251323223114,
0.8754472732543945,
-0.6038138270378113,
-1.0890448093414307,
-1.505875587463379,
0.1590307652950287,
-0.06853193789720535,
0.9396458864212036,
-1.657862901687622,
-0.1371876448392868,
1.167799472808838,
0.8651555776596069,
-0.6627725958824158,
1.0169761180877686,
0.28837576508522034,
1.0435329675674438,
0.8107591867446899,
-0.3713708221912384,
0.6436997056007385,
0.05610280483961105,
-1.3474546670913696,
0.4240359961986542,
1.2426408529281616,
0.13031375408172607,
1.4341683387756348,
-0.4797590672969818,
-0.028830397874116898,
0.35519376397132874,
-0.630993127822876,
-0.41688036918640137,
-0.4238550364971161,
0.6547131538391113,
-0.02212805673480034,
-0.9289879202842712,
-0.07410722970962524,
-0.10468728840351105,
-0.22234350442886353,
0.2057594656944275,
-1.472767949104309,
-0.013550062663853168,
-0.41525179147720337,
-0.5971970558166504,
-1.271494746208191,
-0.07758481055498123,
1.4716938734054565,
-0.7934617400169373,
-0.14689268171787262,
0.4272492825984955,
0.33167245984077454,
0.5328205823898315,
0.691311776638031,
-0.7202304005622864,
-0.289359986782074,
-0.21235686540603638,
-0.3690696954727173,
0.30839788913726807,
1.3788256645202637,
-0.10949403792619705,
-0.9707983136177063,
0.7425656914710999,
-0.3570093512535095,
0.09876202791929245,
1.9103481769561768,
0.09444302320480347,
-0.7725769877433777,
0.2907181680202484,
-0.7407205700874329,
1.9452860355377197,
1.7039320468902588,
1.3213465213775635,
-0.16703122854232788,
-0.8703985214233398,
0.5755564570426941,
-0.39252784848213196,
-0.3660568296909332,
0.8596703410148621,
0.39859822392463684,
-0.28782889246940613,
-1.3853687047958374,
0.7013420462608337,
1.2594280242919922,
-0.8039565682411194,
-0.7958972454071045,
0.16104790568351746,
-0.7266137599945068,
1.1795620918273926,
0.6441356539726257,
0.3872796595096588,
0.24722492694854736,
1.6708649396896362,
0.7721157670021057,
-0.4540707468986511,
0.5222894549369812,
0.5168540477752686,
-0.20009537041187286,
-2.1228859424591064,
-1.1623307466506958,
0.33379656076431274,
-0.6222261786460876,
-1.5649876594543457,
1.3213738203048706,
-1.1414717435836792,
-1.0346050262451172,
0.5466265082359314,
0.04275837540626526,
1.4299228191375732,
0.3675626516342163,
1.577555775642395,
2.0335497856140137,
0.8847019672393799,
0.44985154271125793,
1.2820781469345093,
-0.1757248491048813,
-0.4162347614765167,
1.8618642091751099,
-0.48781338334083557,
0.41453710198402405,
1.1716179847717285,
-0.2783612906932831,
-1.0347654819488525,
-0.832367479801178,
-1.210878610610962,
-0.6953096389770508,
1.1636296510696411,
0.10911611467599869,
-1.129280686378479,
0.24360144138336182,
1.540887475013733,
0.11075086891651154,
-0.2074870467185974,
0.6817765235900879,
0.41294869780540466,
-0.7821129560470581,
-0.031966064125299454,
-0.8696044087409973,
0.5099167227745056,
-0.3189154267311096,
-0.3720456659793854,
0.3541105389595032,
0.43972331285476685,
1.2882113456726074,
-0.11930958926677704,
0.14082589745521545,
1.140350341796875,
-1.4046298265457153,
1.474790334701538,
-0.7252476811408997,
0.2905827462673187,
-2.3391153812408447,
1.3329757452011108,
-0.7423547506332397,
1.9529969692230225,
-2.716838836669922,
0.4458423852920532,
-0.5811272263526917,
-0.5793615579605103,
0.2564449608325958,
-0.3458796441555023,
0.08169148117303848,
-0.1475725919008255,
-1.1581757068634033,
-0.05219924449920654,
-0.6383412480354309,
0.5654183626174927,
1.0725680589675903,
1.3384473323822021,
-1.1806166172027588,
-0.2639133632183075,
-1.760622262954712,
-0.1970485895872116,
-0.7980691194534302,
0.3774188756942749,
-2.0080530643463135,
-0.1568552851676941,
-1.9904587268829346,
-2.3267204761505127,
-1.2434571981430054,
-0.8673630356788635,
1.107085943222046,
0.0949961319565773,
-0.7942710518836975,
1.2837755680084229,
-0.35009169578552246,
-1.8627960681915283,
1.12122642993927,
-2.143306016921997
] |
https://github.com/huggingface/datasets/issues/6060 | Dataset.map() execute twice when in PyTorch DDP mode | If it does the `map` twice then it means the hash of your map function is not some same between your two processes.
Can you make sure your map functions have the same hash in different processes ?
```python
from datasets.fingerprint import Hasher
print(Hasher.hash(lambda x: cut_reorder_keys(x, num_stations_list=args.num_stations_list, is_pad=True, is_train=True)))
print(Hasher.hash(lambda x: random_shift(x, shift_range=(-160, 0), feature_scale=16)))
```
You can also set the fingerprint used to reload the resulting dataset by passing `new_finegrprint=` in `map`, see https://huggingface.co/docs/datasets/v2.13.1/en/about_cache#the-cache. This will force the different processes to use the same fingerprint used to locate the resulting dataset in the cache. | ### Describe the bug
I use `torchrun --standalone --nproc_per_node=2 train.py` to start training. And write the code following the [docs](https://huggingface.co/docs/datasets/process#distributed-usage). The trick about using `torch.distributed.barrier()` to only execute map at the main process doesn't always work. When I am training model, it will map twice. When I am running a test for dataset and dataloader (just print the batches), it can work. Their code about loading dataset are same.
And on another server with 30 CPU cores, I use 2 GPUs and it can't work neither.
I have tried to use `rank` and `local_rank` to check, they all didn't make sense.
### Steps to reproduce the bug
use `torchrun --standalone --nproc_per_node=2 train.py` or `torchrun --standalone train.py` to run
This is my code:
```python
if args.distributed and world_size > 1:
if args.local_rank > 0:
print(f"Rank {args.rank}: Gpu {args.gpu} waiting for main process to perform the mapping", force=True)
torch.distributed.barrier()
print("Mapping dataset")
dataset = dataset.map(lambda x: cut_reorder_keys(x, num_stations_list=args.num_stations_list, is_pad=True, is_train=True), num_proc=8, desc="cut_reorder_keys")
dataset = dataset.map(lambda x: random_shift(x, shift_range=(-160, 0), feature_scale=16), num_proc=8, desc="random_shift")
dataset_test = dataset_test.map(lambda x: cut_reorder_keys(x, num_stations_list=args.num_stations_list, is_pad=True, is_train=False), num_proc=8, desc="cut_reorder_keys")
if args.local_rank == 0:
print("Mapping finished, loading results from main process")
torch.distributed.barrier()
```
### Expected behavior
Only the main process will execute `map`, while the sub process will load cache from disk.
### Environment info
server with 64 CPU cores (AMD Ryzen Threadripper PRO 5995WX 64-Cores) and 2 RTX 4090
- `python==3.9.16`
- `datasets==2.13.1`
- `torch==2.0.1+cu117`
- `22.04.1-Ubuntu`
server with 30 CPU cores (Intel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHz) and 2 RTX 4090
- `python==3.9.0`
- `datasets==2.13.1`
- `torch==2.0.1+cu117`
- `Ubuntu 20.04` | 19 | 95 | Dataset.map() execute twice when in PyTorch DDP mode
### Describe the bug
I use `torchrun --standalone --nproc_per_node=2 train.py` to start training. And write the code following the [docs](https://huggingface.co/docs/datasets/process#distributed-usage). The trick about using `torch.distributed.barrier()` to only execute map at the main process doesn't always work. When I am training model, it will map twice. When I am running a test for dataset and dataloader (just print the batches), it can work. Their code about loading dataset are same.
And on another server with 30 CPU cores, I use 2 GPUs and it can't work neither.
I have tried to use `rank` and `local_rank` to check, they all didn't make sense.
### Steps to reproduce the bug
use `torchrun --standalone --nproc_per_node=2 train.py` or `torchrun --standalone train.py` to run
This is my code:
```python
if args.distributed and world_size > 1:
if args.local_rank > 0:
print(f"Rank {args.rank}: Gpu {args.gpu} waiting for main process to perform the mapping", force=True)
torch.distributed.barrier()
print("Mapping dataset")
dataset = dataset.map(lambda x: cut_reorder_keys(x, num_stations_list=args.num_stations_list, is_pad=True, is_train=True), num_proc=8, desc="cut_reorder_keys")
dataset = dataset.map(lambda x: random_shift(x, shift_range=(-160, 0), feature_scale=16), num_proc=8, desc="random_shift")
dataset_test = dataset_test.map(lambda x: cut_reorder_keys(x, num_stations_list=args.num_stations_list, is_pad=True, is_train=False), num_proc=8, desc="cut_reorder_keys")
if args.local_rank == 0:
print("Mapping finished, loading results from main process")
torch.distributed.barrier()
```
### Expected behavior
Only the main process will execute `map`, while the sub process will load cache from disk.
### Environment info
server with 64 CPU cores (AMD Ryzen Threadripper PRO 5995WX 64-Cores) and 2 RTX 4090
- `python==3.9.16`
- `datasets==2.13.1`
- `torch==2.0.1+cu117`
- `22.04.1-Ubuntu`
server with 30 CPU cores (Intel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHz) and 2 RTX 4090
- `python==3.9.0`
- `datasets==2.13.1`
- `torch==2.0.1+cu117`
- `Ubuntu 20.04`
If it does the `map` twice then it means the hash of your map function is not some same between your two processes.
Can you make sure your map functions have the same hash in different processes ?
```python
from datasets.fingerprint import Hasher
print(Hasher.hash(lambda x: cut_reorder_keys(x, num_stations_list=args.num_stations_list, is_pad=True, is_train=True)))
print(Hasher.hash(lambda x: random_shift(x, shift_range=(-160, 0), feature_scale=16)))
```
You can also set the fingerprint used to reload the resulting dataset by passing `new_finegrprint=` in `map`, see https://huggingface.co/docs/datasets/v2.13.1/en/about_cache#the-cache. This will force the different processes to use the same fingerprint used to locate the resulting dataset in the cache. | [
-1.3185489177703857,
-0.9868546724319458,
-0.5761328935623169,
1.4660086631774902,
-0.17576950788497925,
-1.1413180828094482,
0.1571463942527771,
-1.0458317995071411,
1.5937193632125854,
-0.8820594549179077,
0.28995469212532043,
-1.597267985343933,
0.055676743388175964,
-0.522131085395813,
-0.7138332724571228,
-0.8761380910873413,
-0.4234674870967865,
-0.7217979431152344,
1.141829013824463,
2.4612231254577637,
1.2849757671356201,
-1.398491382598877,
2.67093563079834,
0.7543821334838867,
-0.20498503744602203,
-1.0928007364273071,
0.5248920321464539,
-0.03083524852991104,
-1.2757635116577148,
-0.4112604260444641,
-0.9696189761161804,
-0.10746294260025024,
-0.635527491569519,
-0.4989524483680725,
-0.007602637633681297,
0.4371323585510254,
-0.2862488329410553,
-0.40178611874580383,
-0.5295384526252747,
-0.7151160836219788,
0.5570492148399353,
-0.38045448064804077,
0.8357682228088379,
-0.34930264949798584,
1.7143515348434448,
-0.5441546440124512,
0.5866219997406006,
0.7308601140975952,
1.243807315826416,
0.2239459753036499,
-0.03214837610721588,
0.3170872628688812,
0.44812384247779846,
-0.011264288797974586,
0.5849176049232483,
1.1607863903045654,
0.6380777359008789,
0.5038155317306519,
0.6868812441825867,
-2.2337753772735596,
1.304992914199829,
-0.9791703820228577,
0.29343491792678833,
1.3541194200515747,
-0.9579387903213501,
0.34682074189186096,
-1.7940022945404053,
-0.08815792948007584,
0.5980684161186218,
-2.1361050605773926,
0.25142213702201843,
-1.302985668182373,
-0.5520093441009521,
1.0119881629943848,
0.41355273127555847,
-1.2301959991455078,
0.07757465541362762,
-0.4694061875343323,
1.0448296070098877,
0.4817658066749573,
1.0030397176742554,
-1.6986654996871948,
-0.03533926606178284,
-0.29239848256111145,
0.20219624042510986,
-1.295846939086914,
-1.5640602111816406,
0.5681953430175781,
0.6621199250221252,
0.5541953444480896,
-0.09930382668972015,
1.1010969877243042,
-1.1244772672653198,
0.7611812949180603,
-1.02451753616333,
-1.7237087488174438,
-1.4091860055923462,
-2.305267572402954,
-2.3342113494873047,
0.6796372532844543,
-0.466689795255661,
-0.5691626667976379,
2.097825765609741,
-1.0805041790008545,
-1.6714584827423096,
1.1873505115509033,
0.1926613748073578,
0.020633099600672722,
2.4106926918029785,
0.22189858555793762,
-0.7460521459579468,
0.5121053457260132,
-0.806027352809906,
0.7235427498817444,
-0.3733515739440918,
1.3330072164535522,
0.4038764238357544,
-1.040486216545105,
1.6323401927947998,
-0.29925480484962463,
0.5695567727088928,
-0.5930342078208923,
-0.4916607141494751,
-0.6824690103530884,
0.23993462324142456,
1.941811442375183,
-0.27363619208335876,
1.4326362609863281,
-0.31212571263313293,
-1.4389164447784424,
-1.6227844953536987,
0.9633283615112305,
0.4553346633911133,
-0.7301139831542969,
0.19644999504089355,
-0.4385504722595215,
0.10513020306825638,
-0.015293145552277565,
1.067158818244934,
1.3880984783172607,
0.7153162360191345,
-0.39607349038124084,
-0.873737096786499,
0.16613857448101044,
-0.1586453914642334,
-0.6725117564201355,
-1.8027876615524292,
-0.35693588852882385,
-0.003682376816868782,
0.6947598457336426,
-1.0881465673446655,
1.8119438886642456,
0.914889395236969,
1.8795839548110962,
0.9806324243545532,
-0.36649081110954285,
1.4113882780075073,
0.11870904266834259,
1.8084332942962646,
-0.46743330359458923,
0.6822972297668457,
-0.36971530318260193,
-1.1114965677261353,
0.8890887498855591,
-0.36196380853652954,
-1.9796452522277832,
-0.7160128951072693,
-0.7349088788032532,
-0.18841055035591125,
-0.8068907260894775,
0.9268937110900879,
-0.21654927730560303,
-1.4842095375061035,
0.2380674183368683,
-0.6558262705802917,
0.220973938703537,
-1.1772081851959229,
0.37396180629730225,
0.625952959060669,
-0.666195273399353,
0.1064395159482956,
-0.3157360255718231,
-1.2339547872543335,
-0.5303803086280823,
0.2955318093299866,
1.7946771383285522,
-0.688759446144104,
0.886988639831543,
1.0791221857070923,
-0.6955977082252502,
-0.03827099874615669,
0.33103981614112854,
-0.23652631044387817,
0.7652276754379272,
-1.031660795211792,
-0.45609721541404724,
1.2792311906814575,
-0.2639072835445404,
-0.649196445941925,
1.5271841287612915,
0.7186151146888733,
-0.9755860567092896,
-0.18833619356155396,
-0.13829480111598969,
-0.7650131583213806,
0.09176883846521378,
-1.6013392210006714,
-0.08308371156454086,
0.5309829711914062,
-1.6046762466430664,
-0.4119751751422882,
-0.14134570956230164,
1.3729898929595947,
-0.17124420404434204,
1.4823791980743408,
-0.3851393163204193,
-0.1388094574213028,
-0.31988248229026794,
-0.3260335922241211,
0.15915997326374054,
-0.08836053311824799,
-0.5787795782089233,
0.18589754402637482,
-0.9104270339012146,
0.33793359994888306,
1.435483455657959,
0.30874136090278625,
0.025448491796851158,
0.4583147466182709,
1.0937607288360596,
0.38723036646842957,
-0.09777891635894775,
-0.9103565216064453,
-1.554782748222351,
1.952488899230957,
-1.5000964403152466,
2.071545124053955,
0.7519984841346741,
-0.05720613896846771,
-1.8004939556121826,
-1.7533260583877563,
1.336076021194458,
1.1100893020629883,
2.3652846813201904,
0.5270215272903442,
0.3833594024181366,
-0.8837249279022217,
-0.6555964350700378,
0.350841224193573,
-0.9814335703849792,
-0.7484713196754456,
0.1840018481016159,
2.38594913482666,
1.7939046621322632,
-0.3829582929611206,
-0.11993095278739929,
-0.9890129566192627,
1.4104223251342773,
-0.20923398435115814,
0.318727046251297,
1.966794490814209,
-0.3232051432132721,
-1.0467588901519775,
1.375346302986145,
-2.3920397758483887,
0.1258222758769989,
2.0615410804748535,
0.2759648561477661,
0.0961584821343422,
-1.3380846977233887,
-0.6491498947143555,
-0.2864780128002167,
-0.4654337167739868,
-1.2431886196136475,
0.5060114860534668,
-0.3162805140018463,
-0.8203180432319641,
-1.3864201307296753,
0.1051018014550209,
-1.1598397493362427,
-1.68894362449646,
0.23535552620887756,
1.8292949199676514,
2.0808825492858887,
-0.7055372595787048,
1.5710415840148926,
-0.3206973373889923,
0.16948182880878448,
1.2167025804519653,
1.2838573455810547,
3.0636465549468994,
1.9088870286941528,
-1.31972074508667,
0.6958693861961365,
-0.22055281698703766,
-0.5277215242385864,
1.0933841466903687,
-1.2565604448318481,
1.2659929990768433,
-0.185942605137825,
-1.1879950761795044,
-1.247787594795227,
1.0506346225738525,
0.44588059186935425,
0.10463634133338928,
-0.4960084557533264,
1.2524901628494263,
0.13244444131851196,
1.3298587799072266,
0.5473886728286743,
-0.3311786353588104,
0.6362005472183228,
-0.47160813212394714,
-0.5230970978736877,
1.5844664573669434,
0.2247460037469864,
-1.4283736944198608,
-2.1834726333618164,
-0.22355356812477112,
-0.8889651298522949,
0.04975278675556183,
-0.6133911609649658,
-0.9851478338241577,
1.6078927516937256,
0.30456268787384033,
-1.2492225170135498,
-0.28095149993896484,
-0.2821430265903473,
-0.6063839197158813,
2.7026429176330566,
-1.2533295154571533,
-0.2165350615978241,
-0.966120183467865,
-0.7217771410942078,
1.60617995262146,
-1.2164089679718018,
-0.203319251537323,
-1.047782301902771,
-0.5739913582801819,
-1.2328336238861084,
-0.5326585173606873,
0.06478533148765564,
-1.0111260414123535,
0.7966199517250061,
0.14517860114574432,
-1.239870548248291,
-0.3507971465587616,
-0.8373608589172363,
0.8643413782119751,
-0.1752844601869583,
0.16992409527301788,
1.8097858428955078,
0.25777432322502136,
-0.3886108696460724,
0.7390653491020203,
1.1547825336456299,
0.6117309927940369,
-0.6134157776832581,
0.12592798471450806,
-0.6601639986038208,
0.43559902906417847,
-1.1832484006881714,
0.3028322160243988,
-2.9113638401031494,
0.6666910648345947,
-0.009066644124686718,
-0.027195384725928307,
-0.07237232476472855,
-1.3127893209457397,
1.0677698850631714,
2.617873191833496,
-1.193816065788269,
0.5227735638618469,
0.34904944896698,
1.1875535249710083,
-1.5523029565811157,
0.29551947116851807,
-0.5145190954208374,
2.073410749435425,
0.231389582157135,
1.2487096786499023,
-0.5232198238372803,
-2.3780019283294678,
0.6648368835449219,
-1.2322590351104736,
-1.186214804649353,
0.7997191548347473,
-0.9016430974006653,
0.12868642807006836,
-1.367283821105957,
-0.22189435362815857,
-0.8898736238479614,
-1.0546010732650757,
0.593195915222168,
0.16269303858280182,
0.4650554358959198,
-0.5655088424682617,
0.3510720729827881,
-2.227210760116577,
-1.3480920791625977,
-0.2010485976934433,
-0.9388943910598755,
0.4846877455711365,
-0.4013109803199768,
0.6908214092254639,
-0.14149603247642517,
0.022987330332398415,
0.3673703372478485,
1.4883190393447876,
3.3571012020111084,
0.1696651726961136,
0.27460500597953796,
-0.17447802424430847,
-0.9826634526252747,
1.4871689081192017,
0.8500410914421082,
-0.14372138679027557,
-0.6134653091430664,
-1.032896637916565,
1.2387670278549194,
1.9314111471176147,
0.946361243724823,
0.0039066048339009285,
-0.8427832126617432,
-0.7076641917228699,
-0.041313543915748596,
0.11981989443302155,
0.43317970633506775,
0.9620027542114258,
0.052736520767211914,
0.1374301016330719,
1.4414172172546387,
1.1765882968902588,
-0.4770592451095581,
0.2816488444805145,
-0.8391638398170471,
-0.4205400347709656,
0.5101038217544556,
0.3140968978404999,
-0.015889087691903114,
0.33817049860954285,
-1.0087517499923706,
-0.1746395379304886,
-0.33540716767311096,
-0.9230707883834839,
-0.7324702739715576,
-0.3851890563964844,
-0.4195028841495514,
1.6245663166046143,
0.1575794368982315,
-0.48360827565193176,
-0.006195252761244774,
-0.8712987899780273,
-0.14530189335346222,
-1.11351478099823,
0.29250121116638184,
-0.11586995422840118,
-0.11169125884771347,
-0.2232932597398758,
1.7338896989822388,
-0.8549855947494507,
-2.0736629962921143,
0.2286432981491089,
0.19364161789417267,
-0.26156488060951233,
0.24398839473724365,
1.724086046218872,
0.5432058572769165,
1.47164785861969,
1.3415223360061646,
0.9479662179946899,
-0.6057721972465515,
-1.2724567651748657,
0.7558625340461731,
1.0216541290283203,
-1.4469094276428223,
0.8538694977760315,
0.0011999327689409256,
-0.5051481127738953,
0.5760433673858643,
1.2298215627670288,
0.5041474103927612,
-1.9788731336593628,
0.8017280697822571,
-1.062198281288147,
0.837833821773529,
0.7399774789810181,
0.6638272404670715,
0.1777621954679489,
0.9283101558685303,
-1.1787320375442505,
-1.129231572151184,
-0.6952704191207886,
-0.7221962213516235,
2.0402162075042725,
-0.34052637219429016,
0.6000555753707886,
-0.23078103363513947,
-1.2923340797424316,
-0.05440422147512436,
0.7323786616325378,
0.2887422442436218,
-0.4682749807834625,
0.8341727256774902,
-0.6007912755012512,
-1.1640090942382812,
-1.3664273023605347,
-0.4589141309261322,
-1.0938819646835327,
-0.9619726538658142,
1.092771053314209,
0.6673710346221924,
0.3097025156021118,
1.8703594207763672,
0.6378706693649292,
0.28799524903297424,
-2.67391037940979,
0.9208753705024719,
0.22497184574604034,
-0.10432979464530945,
0.9031848907470703,
0.3295463025569916,
0.9933805465698242,
-0.020344166085124016,
0.5472918152809143,
-2.4491753578186035,
2.3124332427978516,
-0.18143010139465332,
0.6509084105491638,
0.043607234954833984,
-0.053619734942913055,
1.0752713680267334,
0.6304299235343933,
0.5492086410522461,
-1.027333378791809,
0.7558079957962036,
-0.556824266910553,
1.2396973371505737,
0.7969792485237122,
-0.8467820286750793,
-0.017831601202487946,
1.380927562713623,
0.36102601885795593,
-0.5517097115516663,
-0.9013553857803345,
-1.0137962102890015,
0.9347022175788879,
1.756234049797058,
-0.11418287456035614,
-0.029757145792245865,
0.7228677868843079,
0.6476909518241882,
-1.3141273260116577,
-0.028376715257763863,
-0.6605828404426575,
-0.6633704304695129,
1.640252709388733,
2.099193572998047,
-0.19364123046398163,
-0.1385960727930069,
-0.6455079317092896,
-1.3796608448028564,
0.8333439826965332,
-0.11536342650651932,
0.16322773694992065,
0.6348504424095154,
-0.5543731451034546,
1.0138835906982422,
0.8247116804122925,
0.9266191720962524,
0.2467925250530243,
0.24065229296684265,
0.42654961347579956,
-0.40654414892196655,
-1.172113299369812,
-0.23910579085350037,
-1.121260643005371,
-2.641775369644165,
0.37926939129829407,
-0.21263855695724487,
-1.384717345237732,
0.0622626468539238,
-0.956251323223114,
0.8754472732543945,
-0.6038138270378113,
-1.0890448093414307,
-1.505875587463379,
0.1590307652950287,
-0.06853193789720535,
0.9396458864212036,
-1.657862901687622,
-0.1371876448392868,
1.167799472808838,
0.8651555776596069,
-0.6627725958824158,
1.0169761180877686,
0.28837576508522034,
1.0435329675674438,
0.8107591867446899,
-0.3713708221912384,
0.6436997056007385,
0.05610280483961105,
-1.3474546670913696,
0.4240359961986542,
1.2426408529281616,
0.13031375408172607,
1.4341683387756348,
-0.4797590672969818,
-0.028830397874116898,
0.35519376397132874,
-0.630993127822876,
-0.41688036918640137,
-0.4238550364971161,
0.6547131538391113,
-0.02212805673480034,
-0.9289879202842712,
-0.07410722970962524,
-0.10468728840351105,
-0.22234350442886353,
0.2057594656944275,
-1.472767949104309,
-0.013550062663853168,
-0.41525179147720337,
-0.5971970558166504,
-1.271494746208191,
-0.07758481055498123,
1.4716938734054565,
-0.7934617400169373,
-0.14689268171787262,
0.4272492825984955,
0.33167245984077454,
0.5328205823898315,
0.691311776638031,
-0.7202304005622864,
-0.289359986782074,
-0.21235686540603638,
-0.3690696954727173,
0.30839788913726807,
1.3788256645202637,
-0.10949403792619705,
-0.9707983136177063,
0.7425656914710999,
-0.3570093512535095,
0.09876202791929245,
1.9103481769561768,
0.09444302320480347,
-0.7725769877433777,
0.2907181680202484,
-0.7407205700874329,
1.9452860355377197,
1.7039320468902588,
1.3213465213775635,
-0.16703122854232788,
-0.8703985214233398,
0.5755564570426941,
-0.39252784848213196,
-0.3660568296909332,
0.8596703410148621,
0.39859822392463684,
-0.28782889246940613,
-1.3853687047958374,
0.7013420462608337,
1.2594280242919922,
-0.8039565682411194,
-0.7958972454071045,
0.16104790568351746,
-0.7266137599945068,
1.1795620918273926,
0.6441356539726257,
0.3872796595096588,
0.24722492694854736,
1.6708649396896362,
0.7721157670021057,
-0.4540707468986511,
0.5222894549369812,
0.5168540477752686,
-0.20009537041187286,
-2.1228859424591064,
-1.1623307466506958,
0.33379656076431274,
-0.6222261786460876,
-1.5649876594543457,
1.3213738203048706,
-1.1414717435836792,
-1.0346050262451172,
0.5466265082359314,
0.04275837540626526,
1.4299228191375732,
0.3675626516342163,
1.577555775642395,
2.0335497856140137,
0.8847019672393799,
0.44985154271125793,
1.2820781469345093,
-0.1757248491048813,
-0.4162347614765167,
1.8618642091751099,
-0.48781338334083557,
0.41453710198402405,
1.1716179847717285,
-0.2783612906932831,
-1.0347654819488525,
-0.832367479801178,
-1.210878610610962,
-0.6953096389770508,
1.1636296510696411,
0.10911611467599869,
-1.129280686378479,
0.24360144138336182,
1.540887475013733,
0.11075086891651154,
-0.2074870467185974,
0.6817765235900879,
0.41294869780540466,
-0.7821129560470581,
-0.031966064125299454,
-0.8696044087409973,
0.5099167227745056,
-0.3189154267311096,
-0.3720456659793854,
0.3541105389595032,
0.43972331285476685,
1.2882113456726074,
-0.11930958926677704,
0.14082589745521545,
1.140350341796875,
-1.4046298265457153,
1.474790334701538,
-0.7252476811408997,
0.2905827462673187,
-2.3391153812408447,
1.3329757452011108,
-0.7423547506332397,
1.9529969692230225,
-2.716838836669922,
0.4458423852920532,
-0.5811272263526917,
-0.5793615579605103,
0.2564449608325958,
-0.3458796441555023,
0.08169148117303848,
-0.1475725919008255,
-1.1581757068634033,
-0.05219924449920654,
-0.6383412480354309,
0.5654183626174927,
1.0725680589675903,
1.3384473323822021,
-1.1806166172027588,
-0.2639133632183075,
-1.760622262954712,
-0.1970485895872116,
-0.7980691194534302,
0.3774188756942749,
-2.0080530643463135,
-0.1568552851676941,
-1.9904587268829346,
-2.3267204761505127,
-1.2434571981430054,
-0.8673630356788635,
1.107085943222046,
0.0949961319565773,
-0.7942710518836975,
1.2837755680084229,
-0.35009169578552246,
-1.8627960681915283,
1.12122642993927,
-2.143306016921997
] |
https://github.com/huggingface/datasets/issues/6060 | Dataset.map() execute twice when in PyTorch DDP mode | Thanks for help! I find the fingerprint between processes don't have same hash:
```
Rank 0: Gpu 0 cut_reorder_keys fingerprint c7f47f40e9a67657
Rank 0: Gpu 0 random_shift fingerprint 240a0ce79831e7d4
Rank 1: Gpu 1 cut_reorder_keys fingerprint 20edd3d9cf284001
Rank 1: Gpu 1 random_shift fingerprint 819f7c1c18e7733f
```
But my functions only process the example one by one and don't need rank or other arguments. After all it can work in the test for dataset and dataloader.
I'll try to set `new_fingerprint` to see if it works and figure out the reason of different hash. | ### Describe the bug
I use `torchrun --standalone --nproc_per_node=2 train.py` to start training. And write the code following the [docs](https://huggingface.co/docs/datasets/process#distributed-usage). The trick about using `torch.distributed.barrier()` to only execute map at the main process doesn't always work. When I am training model, it will map twice. When I am running a test for dataset and dataloader (just print the batches), it can work. Their code about loading dataset are same.
And on another server with 30 CPU cores, I use 2 GPUs and it can't work neither.
I have tried to use `rank` and `local_rank` to check, they all didn't make sense.
### Steps to reproduce the bug
use `torchrun --standalone --nproc_per_node=2 train.py` or `torchrun --standalone train.py` to run
This is my code:
```python
if args.distributed and world_size > 1:
if args.local_rank > 0:
print(f"Rank {args.rank}: Gpu {args.gpu} waiting for main process to perform the mapping", force=True)
torch.distributed.barrier()
print("Mapping dataset")
dataset = dataset.map(lambda x: cut_reorder_keys(x, num_stations_list=args.num_stations_list, is_pad=True, is_train=True), num_proc=8, desc="cut_reorder_keys")
dataset = dataset.map(lambda x: random_shift(x, shift_range=(-160, 0), feature_scale=16), num_proc=8, desc="random_shift")
dataset_test = dataset_test.map(lambda x: cut_reorder_keys(x, num_stations_list=args.num_stations_list, is_pad=True, is_train=False), num_proc=8, desc="cut_reorder_keys")
if args.local_rank == 0:
print("Mapping finished, loading results from main process")
torch.distributed.barrier()
```
### Expected behavior
Only the main process will execute `map`, while the sub process will load cache from disk.
### Environment info
server with 64 CPU cores (AMD Ryzen Threadripper PRO 5995WX 64-Cores) and 2 RTX 4090
- `python==3.9.16`
- `datasets==2.13.1`
- `torch==2.0.1+cu117`
- `22.04.1-Ubuntu`
server with 30 CPU cores (Intel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHz) and 2 RTX 4090
- `python==3.9.0`
- `datasets==2.13.1`
- `torch==2.0.1+cu117`
- `Ubuntu 20.04` | 19 | 90 | Dataset.map() execute twice when in PyTorch DDP mode
### Describe the bug
I use `torchrun --standalone --nproc_per_node=2 train.py` to start training. And write the code following the [docs](https://huggingface.co/docs/datasets/process#distributed-usage). The trick about using `torch.distributed.barrier()` to only execute map at the main process doesn't always work. When I am training model, it will map twice. When I am running a test for dataset and dataloader (just print the batches), it can work. Their code about loading dataset are same.
And on another server with 30 CPU cores, I use 2 GPUs and it can't work neither.
I have tried to use `rank` and `local_rank` to check, they all didn't make sense.
### Steps to reproduce the bug
use `torchrun --standalone --nproc_per_node=2 train.py` or `torchrun --standalone train.py` to run
This is my code:
```python
if args.distributed and world_size > 1:
if args.local_rank > 0:
print(f"Rank {args.rank}: Gpu {args.gpu} waiting for main process to perform the mapping", force=True)
torch.distributed.barrier()
print("Mapping dataset")
dataset = dataset.map(lambda x: cut_reorder_keys(x, num_stations_list=args.num_stations_list, is_pad=True, is_train=True), num_proc=8, desc="cut_reorder_keys")
dataset = dataset.map(lambda x: random_shift(x, shift_range=(-160, 0), feature_scale=16), num_proc=8, desc="random_shift")
dataset_test = dataset_test.map(lambda x: cut_reorder_keys(x, num_stations_list=args.num_stations_list, is_pad=True, is_train=False), num_proc=8, desc="cut_reorder_keys")
if args.local_rank == 0:
print("Mapping finished, loading results from main process")
torch.distributed.barrier()
```
### Expected behavior
Only the main process will execute `map`, while the sub process will load cache from disk.
### Environment info
server with 64 CPU cores (AMD Ryzen Threadripper PRO 5995WX 64-Cores) and 2 RTX 4090
- `python==3.9.16`
- `datasets==2.13.1`
- `torch==2.0.1+cu117`
- `22.04.1-Ubuntu`
server with 30 CPU cores (Intel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHz) and 2 RTX 4090
- `python==3.9.0`
- `datasets==2.13.1`
- `torch==2.0.1+cu117`
- `Ubuntu 20.04`
Thanks for help! I find the fingerprint between processes don't have same hash:
```
Rank 0: Gpu 0 cut_reorder_keys fingerprint c7f47f40e9a67657
Rank 0: Gpu 0 random_shift fingerprint 240a0ce79831e7d4
Rank 1: Gpu 1 cut_reorder_keys fingerprint 20edd3d9cf284001
Rank 1: Gpu 1 random_shift fingerprint 819f7c1c18e7733f
```
But my functions only process the example one by one and don't need rank or other arguments. After all it can work in the test for dataset and dataloader.
I'll try to set `new_fingerprint` to see if it works and figure out the reason of different hash. | [
-1.3185489177703857,
-0.9868546724319458,
-0.5761328935623169,
1.4660086631774902,
-0.17576950788497925,
-1.1413180828094482,
0.1571463942527771,
-1.0458317995071411,
1.5937193632125854,
-0.8820594549179077,
0.28995469212532043,
-1.597267985343933,
0.055676743388175964,
-0.522131085395813,
-0.7138332724571228,
-0.8761380910873413,
-0.4234674870967865,
-0.7217979431152344,
1.141829013824463,
2.4612231254577637,
1.2849757671356201,
-1.398491382598877,
2.67093563079834,
0.7543821334838867,
-0.20498503744602203,
-1.0928007364273071,
0.5248920321464539,
-0.03083524852991104,
-1.2757635116577148,
-0.4112604260444641,
-0.9696189761161804,
-0.10746294260025024,
-0.635527491569519,
-0.4989524483680725,
-0.007602637633681297,
0.4371323585510254,
-0.2862488329410553,
-0.40178611874580383,
-0.5295384526252747,
-0.7151160836219788,
0.5570492148399353,
-0.38045448064804077,
0.8357682228088379,
-0.34930264949798584,
1.7143515348434448,
-0.5441546440124512,
0.5866219997406006,
0.7308601140975952,
1.243807315826416,
0.2239459753036499,
-0.03214837610721588,
0.3170872628688812,
0.44812384247779846,
-0.011264288797974586,
0.5849176049232483,
1.1607863903045654,
0.6380777359008789,
0.5038155317306519,
0.6868812441825867,
-2.2337753772735596,
1.304992914199829,
-0.9791703820228577,
0.29343491792678833,
1.3541194200515747,
-0.9579387903213501,
0.34682074189186096,
-1.7940022945404053,
-0.08815792948007584,
0.5980684161186218,
-2.1361050605773926,
0.25142213702201843,
-1.302985668182373,
-0.5520093441009521,
1.0119881629943848,
0.41355273127555847,
-1.2301959991455078,
0.07757465541362762,
-0.4694061875343323,
1.0448296070098877,
0.4817658066749573,
1.0030397176742554,
-1.6986654996871948,
-0.03533926606178284,
-0.29239848256111145,
0.20219624042510986,
-1.295846939086914,
-1.5640602111816406,
0.5681953430175781,
0.6621199250221252,
0.5541953444480896,
-0.09930382668972015,
1.1010969877243042,
-1.1244772672653198,
0.7611812949180603,
-1.02451753616333,
-1.7237087488174438,
-1.4091860055923462,
-2.305267572402954,
-2.3342113494873047,
0.6796372532844543,
-0.466689795255661,
-0.5691626667976379,
2.097825765609741,
-1.0805041790008545,
-1.6714584827423096,
1.1873505115509033,
0.1926613748073578,
0.020633099600672722,
2.4106926918029785,
0.22189858555793762,
-0.7460521459579468,
0.5121053457260132,
-0.806027352809906,
0.7235427498817444,
-0.3733515739440918,
1.3330072164535522,
0.4038764238357544,
-1.040486216545105,
1.6323401927947998,
-0.29925480484962463,
0.5695567727088928,
-0.5930342078208923,
-0.4916607141494751,
-0.6824690103530884,
0.23993462324142456,
1.941811442375183,
-0.27363619208335876,
1.4326362609863281,
-0.31212571263313293,
-1.4389164447784424,
-1.6227844953536987,
0.9633283615112305,
0.4553346633911133,
-0.7301139831542969,
0.19644999504089355,
-0.4385504722595215,
0.10513020306825638,
-0.015293145552277565,
1.067158818244934,
1.3880984783172607,
0.7153162360191345,
-0.39607349038124084,
-0.873737096786499,
0.16613857448101044,
-0.1586453914642334,
-0.6725117564201355,
-1.8027876615524292,
-0.35693588852882385,
-0.003682376816868782,
0.6947598457336426,
-1.0881465673446655,
1.8119438886642456,
0.914889395236969,
1.8795839548110962,
0.9806324243545532,
-0.36649081110954285,
1.4113882780075073,
0.11870904266834259,
1.8084332942962646,
-0.46743330359458923,
0.6822972297668457,
-0.36971530318260193,
-1.1114965677261353,
0.8890887498855591,
-0.36196380853652954,
-1.9796452522277832,
-0.7160128951072693,
-0.7349088788032532,
-0.18841055035591125,
-0.8068907260894775,
0.9268937110900879,
-0.21654927730560303,
-1.4842095375061035,
0.2380674183368683,
-0.6558262705802917,
0.220973938703537,
-1.1772081851959229,
0.37396180629730225,
0.625952959060669,
-0.666195273399353,
0.1064395159482956,
-0.3157360255718231,
-1.2339547872543335,
-0.5303803086280823,
0.2955318093299866,
1.7946771383285522,
-0.688759446144104,
0.886988639831543,
1.0791221857070923,
-0.6955977082252502,
-0.03827099874615669,
0.33103981614112854,
-0.23652631044387817,
0.7652276754379272,
-1.031660795211792,
-0.45609721541404724,
1.2792311906814575,
-0.2639072835445404,
-0.649196445941925,
1.5271841287612915,
0.7186151146888733,
-0.9755860567092896,
-0.18833619356155396,
-0.13829480111598969,
-0.7650131583213806,
0.09176883846521378,
-1.6013392210006714,
-0.08308371156454086,
0.5309829711914062,
-1.6046762466430664,
-0.4119751751422882,
-0.14134570956230164,
1.3729898929595947,
-0.17124420404434204,
1.4823791980743408,
-0.3851393163204193,
-0.1388094574213028,
-0.31988248229026794,
-0.3260335922241211,
0.15915997326374054,
-0.08836053311824799,
-0.5787795782089233,
0.18589754402637482,
-0.9104270339012146,
0.33793359994888306,
1.435483455657959,
0.30874136090278625,
0.025448491796851158,
0.4583147466182709,
1.0937607288360596,
0.38723036646842957,
-0.09777891635894775,
-0.9103565216064453,
-1.554782748222351,
1.952488899230957,
-1.5000964403152466,
2.071545124053955,
0.7519984841346741,
-0.05720613896846771,
-1.8004939556121826,
-1.7533260583877563,
1.336076021194458,
1.1100893020629883,
2.3652846813201904,
0.5270215272903442,
0.3833594024181366,
-0.8837249279022217,
-0.6555964350700378,
0.350841224193573,
-0.9814335703849792,
-0.7484713196754456,
0.1840018481016159,
2.38594913482666,
1.7939046621322632,
-0.3829582929611206,
-0.11993095278739929,
-0.9890129566192627,
1.4104223251342773,
-0.20923398435115814,
0.318727046251297,
1.966794490814209,
-0.3232051432132721,
-1.0467588901519775,
1.375346302986145,
-2.3920397758483887,
0.1258222758769989,
2.0615410804748535,
0.2759648561477661,
0.0961584821343422,
-1.3380846977233887,
-0.6491498947143555,
-0.2864780128002167,
-0.4654337167739868,
-1.2431886196136475,
0.5060114860534668,
-0.3162805140018463,
-0.8203180432319641,
-1.3864201307296753,
0.1051018014550209,
-1.1598397493362427,
-1.68894362449646,
0.23535552620887756,
1.8292949199676514,
2.0808825492858887,
-0.7055372595787048,
1.5710415840148926,
-0.3206973373889923,
0.16948182880878448,
1.2167025804519653,
1.2838573455810547,
3.0636465549468994,
1.9088870286941528,
-1.31972074508667,
0.6958693861961365,
-0.22055281698703766,
-0.5277215242385864,
1.0933841466903687,
-1.2565604448318481,
1.2659929990768433,
-0.185942605137825,
-1.1879950761795044,
-1.247787594795227,
1.0506346225738525,
0.44588059186935425,
0.10463634133338928,
-0.4960084557533264,
1.2524901628494263,
0.13244444131851196,
1.3298587799072266,
0.5473886728286743,
-0.3311786353588104,
0.6362005472183228,
-0.47160813212394714,
-0.5230970978736877,
1.5844664573669434,
0.2247460037469864,
-1.4283736944198608,
-2.1834726333618164,
-0.22355356812477112,
-0.8889651298522949,
0.04975278675556183,
-0.6133911609649658,
-0.9851478338241577,
1.6078927516937256,
0.30456268787384033,
-1.2492225170135498,
-0.28095149993896484,
-0.2821430265903473,
-0.6063839197158813,
2.7026429176330566,
-1.2533295154571533,
-0.2165350615978241,
-0.966120183467865,
-0.7217771410942078,
1.60617995262146,
-1.2164089679718018,
-0.203319251537323,
-1.047782301902771,
-0.5739913582801819,
-1.2328336238861084,
-0.5326585173606873,
0.06478533148765564,
-1.0111260414123535,
0.7966199517250061,
0.14517860114574432,
-1.239870548248291,
-0.3507971465587616,
-0.8373608589172363,
0.8643413782119751,
-0.1752844601869583,
0.16992409527301788,
1.8097858428955078,
0.25777432322502136,
-0.3886108696460724,
0.7390653491020203,
1.1547825336456299,
0.6117309927940369,
-0.6134157776832581,
0.12592798471450806,
-0.6601639986038208,
0.43559902906417847,
-1.1832484006881714,
0.3028322160243988,
-2.9113638401031494,
0.6666910648345947,
-0.009066644124686718,
-0.027195384725928307,
-0.07237232476472855,
-1.3127893209457397,
1.0677698850631714,
2.617873191833496,
-1.193816065788269,
0.5227735638618469,
0.34904944896698,
1.1875535249710083,
-1.5523029565811157,
0.29551947116851807,
-0.5145190954208374,
2.073410749435425,
0.231389582157135,
1.2487096786499023,
-0.5232198238372803,
-2.3780019283294678,
0.6648368835449219,
-1.2322590351104736,
-1.186214804649353,
0.7997191548347473,
-0.9016430974006653,
0.12868642807006836,
-1.367283821105957,
-0.22189435362815857,
-0.8898736238479614,
-1.0546010732650757,
0.593195915222168,
0.16269303858280182,
0.4650554358959198,
-0.5655088424682617,
0.3510720729827881,
-2.227210760116577,
-1.3480920791625977,
-0.2010485976934433,
-0.9388943910598755,
0.4846877455711365,
-0.4013109803199768,
0.6908214092254639,
-0.14149603247642517,
0.022987330332398415,
0.3673703372478485,
1.4883190393447876,
3.3571012020111084,
0.1696651726961136,
0.27460500597953796,
-0.17447802424430847,
-0.9826634526252747,
1.4871689081192017,
0.8500410914421082,
-0.14372138679027557,
-0.6134653091430664,
-1.032896637916565,
1.2387670278549194,
1.9314111471176147,
0.946361243724823,
0.0039066048339009285,
-0.8427832126617432,
-0.7076641917228699,
-0.041313543915748596,
0.11981989443302155,
0.43317970633506775,
0.9620027542114258,
0.052736520767211914,
0.1374301016330719,
1.4414172172546387,
1.1765882968902588,
-0.4770592451095581,
0.2816488444805145,
-0.8391638398170471,
-0.4205400347709656,
0.5101038217544556,
0.3140968978404999,
-0.015889087691903114,
0.33817049860954285,
-1.0087517499923706,
-0.1746395379304886,
-0.33540716767311096,
-0.9230707883834839,
-0.7324702739715576,
-0.3851890563964844,
-0.4195028841495514,
1.6245663166046143,
0.1575794368982315,
-0.48360827565193176,
-0.006195252761244774,
-0.8712987899780273,
-0.14530189335346222,
-1.11351478099823,
0.29250121116638184,
-0.11586995422840118,
-0.11169125884771347,
-0.2232932597398758,
1.7338896989822388,
-0.8549855947494507,
-2.0736629962921143,
0.2286432981491089,
0.19364161789417267,
-0.26156488060951233,
0.24398839473724365,
1.724086046218872,
0.5432058572769165,
1.47164785861969,
1.3415223360061646,
0.9479662179946899,
-0.6057721972465515,
-1.2724567651748657,
0.7558625340461731,
1.0216541290283203,
-1.4469094276428223,
0.8538694977760315,
0.0011999327689409256,
-0.5051481127738953,
0.5760433673858643,
1.2298215627670288,
0.5041474103927612,
-1.9788731336593628,
0.8017280697822571,
-1.062198281288147,
0.837833821773529,
0.7399774789810181,
0.6638272404670715,
0.1777621954679489,
0.9283101558685303,
-1.1787320375442505,
-1.129231572151184,
-0.6952704191207886,
-0.7221962213516235,
2.0402162075042725,
-0.34052637219429016,
0.6000555753707886,
-0.23078103363513947,
-1.2923340797424316,
-0.05440422147512436,
0.7323786616325378,
0.2887422442436218,
-0.4682749807834625,
0.8341727256774902,
-0.6007912755012512,
-1.1640090942382812,
-1.3664273023605347,
-0.4589141309261322,
-1.0938819646835327,
-0.9619726538658142,
1.092771053314209,
0.6673710346221924,
0.3097025156021118,
1.8703594207763672,
0.6378706693649292,
0.28799524903297424,
-2.67391037940979,
0.9208753705024719,
0.22497184574604034,
-0.10432979464530945,
0.9031848907470703,
0.3295463025569916,
0.9933805465698242,
-0.020344166085124016,
0.5472918152809143,
-2.4491753578186035,
2.3124332427978516,
-0.18143010139465332,
0.6509084105491638,
0.043607234954833984,
-0.053619734942913055,
1.0752713680267334,
0.6304299235343933,
0.5492086410522461,
-1.027333378791809,
0.7558079957962036,
-0.556824266910553,
1.2396973371505737,
0.7969792485237122,
-0.8467820286750793,
-0.017831601202487946,
1.380927562713623,
0.36102601885795593,
-0.5517097115516663,
-0.9013553857803345,
-1.0137962102890015,
0.9347022175788879,
1.756234049797058,
-0.11418287456035614,
-0.029757145792245865,
0.7228677868843079,
0.6476909518241882,
-1.3141273260116577,
-0.028376715257763863,
-0.6605828404426575,
-0.6633704304695129,
1.640252709388733,
2.099193572998047,
-0.19364123046398163,
-0.1385960727930069,
-0.6455079317092896,
-1.3796608448028564,
0.8333439826965332,
-0.11536342650651932,
0.16322773694992065,
0.6348504424095154,
-0.5543731451034546,
1.0138835906982422,
0.8247116804122925,
0.9266191720962524,
0.2467925250530243,
0.24065229296684265,
0.42654961347579956,
-0.40654414892196655,
-1.172113299369812,
-0.23910579085350037,
-1.121260643005371,
-2.641775369644165,
0.37926939129829407,
-0.21263855695724487,
-1.384717345237732,
0.0622626468539238,
-0.956251323223114,
0.8754472732543945,
-0.6038138270378113,
-1.0890448093414307,
-1.505875587463379,
0.1590307652950287,
-0.06853193789720535,
0.9396458864212036,
-1.657862901687622,
-0.1371876448392868,
1.167799472808838,
0.8651555776596069,
-0.6627725958824158,
1.0169761180877686,
0.28837576508522034,
1.0435329675674438,
0.8107591867446899,
-0.3713708221912384,
0.6436997056007385,
0.05610280483961105,
-1.3474546670913696,
0.4240359961986542,
1.2426408529281616,
0.13031375408172607,
1.4341683387756348,
-0.4797590672969818,
-0.028830397874116898,
0.35519376397132874,
-0.630993127822876,
-0.41688036918640137,
-0.4238550364971161,
0.6547131538391113,
-0.02212805673480034,
-0.9289879202842712,
-0.07410722970962524,
-0.10468728840351105,
-0.22234350442886353,
0.2057594656944275,
-1.472767949104309,
-0.013550062663853168,
-0.41525179147720337,
-0.5971970558166504,
-1.271494746208191,
-0.07758481055498123,
1.4716938734054565,
-0.7934617400169373,
-0.14689268171787262,
0.4272492825984955,
0.33167245984077454,
0.5328205823898315,
0.691311776638031,
-0.7202304005622864,
-0.289359986782074,
-0.21235686540603638,
-0.3690696954727173,
0.30839788913726807,
1.3788256645202637,
-0.10949403792619705,
-0.9707983136177063,
0.7425656914710999,
-0.3570093512535095,
0.09876202791929245,
1.9103481769561768,
0.09444302320480347,
-0.7725769877433777,
0.2907181680202484,
-0.7407205700874329,
1.9452860355377197,
1.7039320468902588,
1.3213465213775635,
-0.16703122854232788,
-0.8703985214233398,
0.5755564570426941,
-0.39252784848213196,
-0.3660568296909332,
0.8596703410148621,
0.39859822392463684,
-0.28782889246940613,
-1.3853687047958374,
0.7013420462608337,
1.2594280242919922,
-0.8039565682411194,
-0.7958972454071045,
0.16104790568351746,
-0.7266137599945068,
1.1795620918273926,
0.6441356539726257,
0.3872796595096588,
0.24722492694854736,
1.6708649396896362,
0.7721157670021057,
-0.4540707468986511,
0.5222894549369812,
0.5168540477752686,
-0.20009537041187286,
-2.1228859424591064,
-1.1623307466506958,
0.33379656076431274,
-0.6222261786460876,
-1.5649876594543457,
1.3213738203048706,
-1.1414717435836792,
-1.0346050262451172,
0.5466265082359314,
0.04275837540626526,
1.4299228191375732,
0.3675626516342163,
1.577555775642395,
2.0335497856140137,
0.8847019672393799,
0.44985154271125793,
1.2820781469345093,
-0.1757248491048813,
-0.4162347614765167,
1.8618642091751099,
-0.48781338334083557,
0.41453710198402405,
1.1716179847717285,
-0.2783612906932831,
-1.0347654819488525,
-0.832367479801178,
-1.210878610610962,
-0.6953096389770508,
1.1636296510696411,
0.10911611467599869,
-1.129280686378479,
0.24360144138336182,
1.540887475013733,
0.11075086891651154,
-0.2074870467185974,
0.6817765235900879,
0.41294869780540466,
-0.7821129560470581,
-0.031966064125299454,
-0.8696044087409973,
0.5099167227745056,
-0.3189154267311096,
-0.3720456659793854,
0.3541105389595032,
0.43972331285476685,
1.2882113456726074,
-0.11930958926677704,
0.14082589745521545,
1.140350341796875,
-1.4046298265457153,
1.474790334701538,
-0.7252476811408997,
0.2905827462673187,
-2.3391153812408447,
1.3329757452011108,
-0.7423547506332397,
1.9529969692230225,
-2.716838836669922,
0.4458423852920532,
-0.5811272263526917,
-0.5793615579605103,
0.2564449608325958,
-0.3458796441555023,
0.08169148117303848,
-0.1475725919008255,
-1.1581757068634033,
-0.05219924449920654,
-0.6383412480354309,
0.5654183626174927,
1.0725680589675903,
1.3384473323822021,
-1.1806166172027588,
-0.2639133632183075,
-1.760622262954712,
-0.1970485895872116,
-0.7980691194534302,
0.3774188756942749,
-2.0080530643463135,
-0.1568552851676941,
-1.9904587268829346,
-2.3267204761505127,
-1.2434571981430054,
-0.8673630356788635,
1.107085943222046,
0.0949961319565773,
-0.7942710518836975,
1.2837755680084229,
-0.35009169578552246,
-1.8627960681915283,
1.12122642993927,
-2.143306016921997
] |
https://github.com/huggingface/datasets/issues/6058 | laion-coco download error | This can also mean one of the files was not downloaded correctly.
We log an erroneous file's name before raising the reader's error, so this is how you can find the problematic file. Then, you should delete it and call `load_dataset` again.
(I checked all the uploaded files, and they seem to be valid Parquet files, so I don't think this is a bug on their side)
| ### Describe the bug
The full trace:
```
/home/bian/anaconda3/envs/sd/lib/python3.10/site-packages/datasets/load.py:1744: FutureWarning: 'ignore_verifications' was de
precated in favor of 'verification_mode' in version 2.9.1 and will be removed in 3.0.0.
You can remove this warning by passing 'verification_mode=no_checks' instead.
warnings.warn(
Downloading and preparing dataset parquet/laion--laion-coco to /home/bian/.cache/huggingface/datasets/laion___parquet/laion--
laion-coco-cb4205d7f1863066/0.0.0/bcacc8bdaa0614a5d73d0344c813275e590940c6ea8bc569da462847103a1afd...
Downloading data: 100%|β| 1.89G/1.89G [04:57<00:00,
Downloading data files: 100%|β| 1/1 [04:59<00:00, 2
Extracting data files: 100%|β| 1/1 [00:00<00:00, 13
Generating train split: 0 examples [00:00, ? examples/s]<_io.BufferedReader
name='/home/bian/.cache/huggingface/datasets/downlo
ads/26d7a016d25bbd9443115cfa3092136e8eb2f1f5bcd4154
0cb9234572927f04c'>
Traceback (most recent call last):
File "/home/bian/data/ZOC/download_laion_coco.py", line 4, in <module>
dataset = load_dataset("laion/laion-coco", ignore_verifications=True)
File "/home/bian/anaconda3/envs/sd/lib/python3.10/site-packages/datasets/load.py", line 1791, in load_dataset
builder_instance.download_and_prepare(
File "/home/bian/anaconda3/envs/sd/lib/python3.10/site-packages/datasets/builder.py", line 891, in download_and_prepare
self._download_and_prepare(
File "/home/bian/anaconda3/envs/sd/lib/python3.10/site-packages/datasets/builder.py", line 986, in _download_and_prepare
self._prepare_split(split_generator, **prepare_split_kwargs)
File "/home/bian/anaconda3/envs/sd/lib/python3.10/site-packages/datasets/builder.py", line 1748, in _prepare_split
for job_id, done, content in self._prepare_split_single(
File "/home/bian/anaconda3/envs/sd/lib/python3.10/site-packages/datasets/builder.py", line 1842, in _prepare_split_single
generator = self._generate_tables(**gen_kwargs)
File "/home/bian/anaconda3/envs/sd/lib/python3.10/site-packages/datasets/packaged_modules/parquet/parquet.py", line 67, in
_generate_tables
parquet_file = pq.ParquetFile(f)
File "/home/bian/anaconda3/envs/sd/lib/python3.10/site-packages/pyarrow/parquet/core.py", line 323, in __init__
self.reader.open(
File "pyarrow/_parquet.pyx", line 1227, in pyarrow._parquet.ParquetReader.open
File "pyarrow/error.pxi", line 100, in pyarrow.lib.check_status
pyarrow.lib.ArrowInvalid: Parquet magic bytes not found in footer. Either the file is corrupted or this is not a parquet file
.
```
I have carefully followed the instructions in #5264 but still get the same error.
Other helpful information:
```
ds = load_dataset("parquet", data_files=
...: "https://huggingface.co/datasets/laion/l
...: aion-coco/resolve/d22869de3ccd39dfec1507
...: f7ded32e4a518dad24/part-00000-2256f782-1
...: 26f-4dc6-b9c6-e6757637749d-c000.snappy.p
...: arquet")
Found cached dataset parquet (/home/bian/.cache/huggingface/datasets/parquet/default-a02eea00aeb08b0e/0.0.0/bb8ccf89d9ee38581ff5e51506d721a9b37f14df8090dc9b2d8fb4a40957833f)
100%|ββββββββββββββ| 1/1 [00:00<00:00, 4.55it/s]
```
### Steps to reproduce the bug
```
from datasets import load_dataset
dataset = load_dataset("laion/laion-coco", ignore_verifications=True/False)
```
### Expected behavior
Properly load Laion-coco dataset
### Environment info
datasets==2.11.0 torch==1.12.1 python 3.10 | 20 | 67 | laion-coco download error
### Describe the bug
The full trace:
```
/home/bian/anaconda3/envs/sd/lib/python3.10/site-packages/datasets/load.py:1744: FutureWarning: 'ignore_verifications' was de
precated in favor of 'verification_mode' in version 2.9.1 and will be removed in 3.0.0.
You can remove this warning by passing 'verification_mode=no_checks' instead.
warnings.warn(
Downloading and preparing dataset parquet/laion--laion-coco to /home/bian/.cache/huggingface/datasets/laion___parquet/laion--
laion-coco-cb4205d7f1863066/0.0.0/bcacc8bdaa0614a5d73d0344c813275e590940c6ea8bc569da462847103a1afd...
Downloading data: 100%|β| 1.89G/1.89G [04:57<00:00,
Downloading data files: 100%|β| 1/1 [04:59<00:00, 2
Extracting data files: 100%|β| 1/1 [00:00<00:00, 13
Generating train split: 0 examples [00:00, ? examples/s]<_io.BufferedReader
name='/home/bian/.cache/huggingface/datasets/downlo
ads/26d7a016d25bbd9443115cfa3092136e8eb2f1f5bcd4154
0cb9234572927f04c'>
Traceback (most recent call last):
File "/home/bian/data/ZOC/download_laion_coco.py", line 4, in <module>
dataset = load_dataset("laion/laion-coco", ignore_verifications=True)
File "/home/bian/anaconda3/envs/sd/lib/python3.10/site-packages/datasets/load.py", line 1791, in load_dataset
builder_instance.download_and_prepare(
File "/home/bian/anaconda3/envs/sd/lib/python3.10/site-packages/datasets/builder.py", line 891, in download_and_prepare
self._download_and_prepare(
File "/home/bian/anaconda3/envs/sd/lib/python3.10/site-packages/datasets/builder.py", line 986, in _download_and_prepare
self._prepare_split(split_generator, **prepare_split_kwargs)
File "/home/bian/anaconda3/envs/sd/lib/python3.10/site-packages/datasets/builder.py", line 1748, in _prepare_split
for job_id, done, content in self._prepare_split_single(
File "/home/bian/anaconda3/envs/sd/lib/python3.10/site-packages/datasets/builder.py", line 1842, in _prepare_split_single
generator = self._generate_tables(**gen_kwargs)
File "/home/bian/anaconda3/envs/sd/lib/python3.10/site-packages/datasets/packaged_modules/parquet/parquet.py", line 67, in
_generate_tables
parquet_file = pq.ParquetFile(f)
File "/home/bian/anaconda3/envs/sd/lib/python3.10/site-packages/pyarrow/parquet/core.py", line 323, in __init__
self.reader.open(
File "pyarrow/_parquet.pyx", line 1227, in pyarrow._parquet.ParquetReader.open
File "pyarrow/error.pxi", line 100, in pyarrow.lib.check_status
pyarrow.lib.ArrowInvalid: Parquet magic bytes not found in footer. Either the file is corrupted or this is not a parquet file
.
```
I have carefully followed the instructions in #5264 but still get the same error.
Other helpful information:
```
ds = load_dataset("parquet", data_files=
...: "https://huggingface.co/datasets/laion/l
...: aion-coco/resolve/d22869de3ccd39dfec1507
...: f7ded32e4a518dad24/part-00000-2256f782-1
...: 26f-4dc6-b9c6-e6757637749d-c000.snappy.p
...: arquet")
Found cached dataset parquet (/home/bian/.cache/huggingface/datasets/parquet/default-a02eea00aeb08b0e/0.0.0/bb8ccf89d9ee38581ff5e51506d721a9b37f14df8090dc9b2d8fb4a40957833f)
100%|ββββββββββββββ| 1/1 [00:00<00:00, 4.55it/s]
```
### Steps to reproduce the bug
```
from datasets import load_dataset
dataset = load_dataset("laion/laion-coco", ignore_verifications=True/False)
```
### Expected behavior
Properly load Laion-coco dataset
### Environment info
datasets==2.11.0 torch==1.12.1 python 3.10
This can also mean one of the files was not downloaded correctly.
We log an erroneous file's name before raising the reader's error, so this is how you can find the problematic file. Then, you should delete it and call `load_dataset` again.
(I checked all the uploaded files, and they seem to be valid Parquet files, so I don't think this is a bug on their side)
| [
-1.228498935699463,
-0.9487924575805664,
-0.7148016691207886,
1.4198180437088013,
-0.07668789476156235,
-1.150172472000122,
0.09865113347768784,
-1.0615023374557495,
1.4952726364135742,
-0.6555337905883789,
0.2628440856933594,
-1.7097371816635132,
-0.08578065782785416,
-0.5050936937332153,
-0.6892457604408264,
-0.8584149479866028,
-0.3745722770690918,
-0.8450447916984558,
0.9768246412277222,
2.555136203765869,
1.314197301864624,
-1.3426812887191772,
2.7618019580841064,
0.7213084101676941,
-0.2418195903301239,
-1.0139371156692505,
0.591608464717865,
0.031193334609270096,
-1.3072401285171509,
-0.390092670917511,
-0.9283614158630371,
0.08938285708427429,
-0.56239914894104,
-0.38049429655075073,
0.03223584219813347,
0.43467479944229126,
-0.24102362990379333,
-0.2956719398498535,
-0.5674000382423401,
-0.7585300207138062,
0.5862157344818115,
-0.38220536708831787,
0.912940502166748,
-0.3528035879135132,
1.7687253952026367,
-0.6201855540275574,
0.42131268978118896,
0.7009080648422241,
1.2704706192016602,
0.1204998642206192,
0.05146379768848419,
0.2836802005767822,
0.3295953869819641,
-0.0020418097265064716,
0.4780920147895813,
1.2764531373977661,
0.546094536781311,
0.4147151708602905,
0.6332439184188843,
-2.244790554046631,
1.2487688064575195,
-0.8665915727615356,
0.2903200387954712,
1.3013724088668823,
-0.8374462723731995,
0.3649899959564209,
-1.851766586303711,
-0.10179277509450912,
0.6290034651756287,
-2.226367950439453,
0.2700003385543823,
-1.3566865921020508,
-0.5200859904289246,
0.8810704946517944,
0.2985893487930298,
-1.2423449754714966,
0.1859138458967209,
-0.5368478298187256,
1.1092218160629272,
0.5065644383430481,
1.1347355842590332,
-1.6713093519210815,
-0.019141139462590218,
-0.24210985004901886,
0.0872749537229538,
-1.3344484567642212,
-1.5633223056793213,
0.5178518295288086,
0.622378945350647,
0.6722461581230164,
0.034294404089450836,
0.997758150100708,
-1.036605954170227,
0.8408883213996887,
-0.9871149063110352,
-1.6269530057907104,
-1.4012669324874878,
-2.422227621078491,
-2.222855806350708,
0.7226151823997498,
-0.4675096869468689,
-0.46350526809692383,
1.9468562602996826,
-1.0262465476989746,
-1.8118715286254883,
1.052470088005066,
0.3580760955810547,
0.05703306943178177,
2.355541944503784,
0.22851932048797607,
-0.7831722497940063,
0.5037704110145569,
-0.7235202789306641,
0.7841796875,
-0.2738734483718872,
1.3358904123306274,
0.4712551236152649,
-0.9637266993522644,
1.5865674018859863,
-0.5172168016433716,
0.533210039138794,
-0.6911758184432983,
-0.5422282218933105,
-0.8121066093444824,
0.1880684196949005,
1.8705618381500244,
-0.37804150581359863,
1.5685884952545166,
-0.35720157623291016,
-1.5800377130508423,
-1.5105090141296387,
0.7699063420295715,
0.5284075140953064,
-0.8522524237632751,
0.018067210912704468,
-0.427138090133667,
0.1262374222278595,
0.02086760848760605,
1.0583747625350952,
1.2073999643325806,
0.7323634624481201,
-0.2750360369682312,
-0.8955976963043213,
0.206366628408432,
-0.12248175591230392,
-0.664344072341919,
-1.8680775165557861,
-0.22778750956058502,
0.2008630335330963,
0.6890774965286255,
-1.2648749351501465,
1.7605663537979126,
0.8823117017745972,
2.0631093978881836,
1.0518971681594849,
-0.3438110947608948,
1.5343384742736816,
0.046365413814783096,
1.8625887632369995,
-0.48916828632354736,
0.5928487181663513,
-0.3578903079032898,
-1.1280615329742432,
0.8522207736968994,
-0.34606605768203735,
-2.0339808464050293,
-0.7580512762069702,
-0.776814341545105,
-0.2119891494512558,
-0.7824917435646057,
0.9328073263168335,
-0.2967168688774109,
-1.4798377752304077,
0.23054169118404388,
-0.6838011741638184,
0.14689496159553528,
-1.2492668628692627,
0.2363162487745285,
0.7579193115234375,
-0.6008316874504089,
-0.008901314809918404,
-0.2810273766517639,
-1.2847459316253662,
-0.45504963397979736,
0.3422703146934509,
1.9507285356521606,
-0.5773174166679382,
0.9412774443626404,
1.044021487236023,
-0.6304748058319092,
0.15779055655002594,
0.2900888919830322,
-0.2943187952041626,
0.7997496724128723,
-1.1253834962844849,
-0.399502694606781,
1.1532789468765259,
-0.20149041712284088,
-0.61143559217453,
1.482243537902832,
0.7877614498138428,
-1.0585548877716064,
-0.2795068621635437,
-0.20247074961662292,
-0.8376999497413635,
-0.02726653777062893,
-1.5615451335906982,
-0.10116168111562729,
0.2772296071052551,
-1.5005290508270264,
-0.36533862352371216,
-0.16204287111759186,
1.2886552810668945,
-0.20099930465221405,
1.44294011592865,
-0.3379572033882141,
-0.09621508419513702,
-0.34441614151000977,
-0.5348367094993591,
0.17892391979694366,
-0.23894155025482178,
-0.5979545712471008,
0.21732977032661438,
-0.8473851084709167,
0.21338407695293427,
1.4815514087677002,
0.42244040966033936,
0.020740298554301262,
0.4671593904495239,
1.096442699432373,
0.4001736640930176,
-0.03350638598203659,
-0.8051170706748962,
-1.5742822885513306,
2.0543830394744873,
-1.4845483303070068,
1.9145641326904297,
0.8167248368263245,
-0.0643586665391922,
-1.8345847129821777,
-1.8537830114364624,
1.2958283424377441,
1.0536876916885376,
2.3779492378234863,
0.5336734652519226,
0.49611490964889526,
-0.7625137567520142,
-0.7844908237457275,
0.38849925994873047,
-0.9797289371490479,
-0.7637457251548767,
0.1441403478384018,
2.4090065956115723,
1.736466646194458,
-0.5256991386413574,
-0.2130642682313919,
-0.8794392943382263,
1.263260841369629,
-0.11526928097009659,
0.18415388464927673,
2.0123019218444824,
-0.24158506095409393,
-1.0636093616485596,
1.2716505527496338,
-2.44150447845459,
0.2961629629135132,
2.0671515464782715,
0.29940688610076904,
0.1656324565410614,
-1.4255679845809937,
-0.6743614673614502,
-0.29989707469940186,
-0.47563236951828003,
-1.2879372835159302,
0.6355262994766235,
-0.3086780905723572,
-0.9346628785133362,
-1.5565613508224487,
0.023103348910808563,
-1.1573121547698975,
-1.7106679677963257,
0.4233664870262146,
1.8822898864746094,
2.1535348892211914,
-0.6982280015945435,
1.446419358253479,
-0.2772231698036194,
0.03938542306423187,
1.2104347944259644,
1.3474000692367554,
3.112942934036255,
1.8433876037597656,
-1.2799818515777588,
0.753895103931427,
-0.1756049394607544,
-0.44563549757003784,
1.181261658668518,
-1.1450239419937134,
1.1125473976135254,
-0.25091353058815,
-1.2742278575897217,
-1.2231110334396362,
1.0880025625228882,
0.45338475704193115,
0.027254894375801086,
-0.5295217633247375,
1.2688971757888794,
0.1857214719057083,
1.3301869630813599,
0.5239172577857971,
-0.35096579790115356,
0.522825300693512,
-0.3390467166900635,
-0.5797827839851379,
1.5490593910217285,
0.15973089635372162,
-1.5250837802886963,
-2.4014358520507812,
-0.24110165238380432,
-0.8863581418991089,
-0.05252066254615784,
-0.6621220707893372,
-1.1263704299926758,
1.6475346088409424,
0.40130019187927246,
-1.2185821533203125,
-0.20888753235340118,
-0.31023740768432617,
-0.5353597402572632,
2.5605757236480713,
-1.3711332082748413,
-0.16373950242996216,
-0.9335827827453613,
-0.5410559177398682,
1.6038745641708374,
-1.2189042568206787,
-0.1452835202217102,
-1.005244493484497,
-0.6586573719978333,
-1.3077722787857056,
-0.48521411418914795,
-0.01928413286805153,
-0.9603381156921387,
0.784338116645813,
0.20415134727954865,
-1.0986992120742798,
-0.26434510946273804,
-1.0150220394134521,
1.0390464067459106,
-0.03599115461111069,
0.2380637228488922,
1.8871524333953857,
0.30078738927841187,
-0.4712381958961487,
0.7000317573547363,
1.194478154182434,
0.5687076449394226,
-0.6436955332756042,
0.02443346008658409,
-0.7011800408363342,
0.38783013820648193,
-1.4351381063461304,
0.24353010952472687,
-2.963026523590088,
0.7703786492347717,
-0.06276474893093109,
-0.10231229662895203,
-0.08564125746488571,
-1.2926511764526367,
1.164710283279419,
2.600958824157715,
-1.2043988704681396,
0.5177287459373474,
0.4266137480735779,
1.167177438735962,
-1.5397329330444336,
0.2725701332092285,
-0.4870532751083374,
2.079735517501831,
0.06350958347320557,
1.2077986001968384,
-0.49720847606658936,
-2.2247843742370605,
0.71275395154953,
-1.21059250831604,
-1.0569257736206055,
0.7754560112953186,
-0.8654086589813232,
0.24649162590503693,
-1.3887403011322021,
-0.24935492873191833,
-1.068612813949585,
-1.238875389099121,
0.6889452338218689,
0.18295560777187347,
0.46240103244781494,
-0.5494383573532104,
0.324502170085907,
-2.2302050590515137,
-1.3730547428131104,
-0.18865966796875,
-0.9902799129486084,
0.48105835914611816,
-0.39272522926330566,
0.6160953044891357,
-0.0714976042509079,
0.03453816846013069,
0.3017970323562622,
1.3036744594573975,
3.388712167739868,
0.18455685675144196,
0.23749808967113495,
-0.1003008633852005,
-1.0630791187286377,
1.3919284343719482,
0.9082516431808472,
-0.173817440867424,
-0.5712094902992249,
-0.9732971787452698,
1.3191699981689453,
2.014946222305298,
1.0649278163909912,
0.11282581835985184,
-0.8873547315597534,
-0.8241215348243713,
0.05427835136651993,
0.1910174936056137,
0.5583785176277161,
0.9664854407310486,
-0.048008643090724945,
0.12408708035945892,
1.4378420114517212,
1.1544017791748047,
-0.3054448962211609,
0.38268548250198364,
-0.9145866632461548,
-0.4242081642150879,
0.4583323001861572,
0.24117238819599152,
0.03472890332341194,
0.475974977016449,
-1.10495924949646,
-0.29468685388565063,
-0.2619773745536804,
-0.9093188047409058,
-0.715080201625824,
-0.40552693605422974,
-0.4025551676750183,
1.5948818922042847,
0.13454602658748627,
-0.44432878494262695,
0.04560843110084534,
-0.760934591293335,
-0.13172928988933563,
-1.1796743869781494,
0.22962886095046997,
-0.16091126203536987,
-0.011848796159029007,
-0.14978033304214478,
1.7215055227279663,
-0.9538109302520752,
-2.145806312561035,
0.19648657739162445,
0.31471699476242065,
-0.38337695598602295,
0.24312637746334076,
1.7168844938278198,
0.5374032855033875,
1.3310556411743164,
1.2989763021469116,
0.9309817552566528,
-0.5824574828147888,
-1.2014706134796143,
0.6604230999946594,
0.9286662340164185,
-1.359337568283081,
0.9573758840560913,
-0.13091593980789185,
-0.48232442140579224,
0.735375702381134,
1.4024341106414795,
0.42705225944519043,
-2.007218360900879,
0.8821060061454773,
-0.8898758292198181,
0.7765955924987793,
0.6671310067176819,
0.7786782383918762,
0.24762557446956635,
0.8716914653778076,
-1.2066073417663574,
-1.066686987876892,
-0.7079212069511414,
-0.6152554154396057,
1.857328176498413,
-0.25853174924850464,
0.4978293180465698,
-0.14459118247032166,
-1.1889792680740356,
-0.07141433656215668,
0.7543741464614868,
0.33745479583740234,
-0.4073566794395447,
0.837603747844696,
-0.6023819446563721,
-1.088660717010498,
-1.220490574836731,
-0.4195065498352051,
-0.9420567154884338,
-0.841575026512146,
0.984359085559845,
0.7219260334968567,
0.42669230699539185,
1.980259895324707,
0.5940423607826233,
0.2854732275009155,
-2.6897168159484863,
0.8815052509307861,
0.3079081177711487,
0.010508626699447632,
0.9607431292533875,
0.21351991593837738,
1.1384979486465454,
-0.009662706404924393,
0.5762503743171692,
-2.315220832824707,
2.2216689586639404,
-0.25354182720184326,
0.7762307524681091,
-0.003823593258857727,
-0.11037106812000275,
1.134499192237854,
0.5860462784767151,
0.5948888659477234,
-1.1017183065414429,
0.7869963049888611,
-0.6497876048088074,
1.1581172943115234,
0.975685179233551,
-0.8895825743675232,
0.06685201823711395,
1.3096942901611328,
0.4304403066635132,
-0.42492181062698364,
-0.9366080164909363,
-0.7769736051559448,
0.9948223829269409,
1.7031137943267822,
-0.04761115834116936,
0.07976400852203369,
0.8857271075248718,
0.6167711019515991,
-1.2665976285934448,
0.06460600346326828,
-0.7097498774528503,
-0.6842336058616638,
1.7391033172607422,
2.0472826957702637,
-0.07991494983434677,
-0.1371760070323944,
-0.7483254075050354,
-1.3347703218460083,
0.8119292259216309,
-0.10294932126998901,
0.10653696954250336,
0.5956153869628906,
-0.7019534111022949,
1.1168973445892334,
0.6284452080726624,
1.0216825008392334,
-0.02797265723347664,
0.37973666191101074,
0.3521241545677185,
-0.3542550206184387,
-1.164475679397583,
-0.36332935094833374,
-1.1351286172866821,
-2.4591290950775146,
0.48880553245544434,
-0.2029695361852646,
-1.4611016511917114,
0.08002002537250519,
-1.0005512237548828,
0.9133970737457275,
-0.6030517816543579,
-1.0956391096115112,
-1.3864295482635498,
0.3052106499671936,
-0.13301271200180054,
0.8963704109191895,
-1.6302051544189453,
-0.13480111956596375,
1.2156046628952026,
0.9607757329940796,
-0.5617979764938354,
1.0183689594268799,
0.307140588760376,
1.010759711265564,
0.807038426399231,
-0.4631974697113037,
0.5672431588172913,
0.10431500524282455,
-1.3208104372024536,
0.4042869210243225,
1.2794713973999023,
0.19585764408111572,
1.4014952182769775,
-0.4639493227005005,
0.026023324579000473,
0.40669602155685425,
-0.6224409937858582,
-0.5515013337135315,
-0.4454893469810486,
0.6694290637969971,
0.06776244193315506,
-1.0240263938903809,
-0.15874972939491272,
-0.11358533054590225,
-0.21383561193943024,
0.19940511882305145,
-1.4979190826416016,
-0.30029767751693726,
-0.3759033679962158,
-0.4775911569595337,
-1.3522738218307495,
0.010379919782280922,
1.3301489353179932,
-0.798587441444397,
-0.19831159710884094,
0.3591928482055664,
0.41273796558380127,
0.5774595141410828,
0.6231883764266968,
-0.6871575117111206,
-0.42833244800567627,
-0.3215211033821106,
-0.26711273193359375,
0.2882682681083679,
1.2281787395477295,
-0.07635685801506042,
-0.9950054287910461,
0.6602081060409546,
-0.46263283491134644,
0.12661607563495636,
1.973872184753418,
-0.002468821592628956,
-0.6825550198554993,
0.3844810128211975,
-0.682885468006134,
1.8087509870529175,
1.6975871324539185,
1.3211239576339722,
-0.2134079486131668,
-0.8223699927330017,
0.5864208936691284,
-0.2867256999015808,
-0.33194899559020996,
0.8715336918830872,
0.4522242546081543,
-0.22354595363140106,
-1.4299206733703613,
0.5535222291946411,
1.1931283473968506,
-0.892138659954071,
-0.6932812333106995,
0.04746429994702339,
-0.8372928500175476,
1.1822935342788696,
0.6409187316894531,
0.3602040410041809,
0.2508174777030945,
1.5545703172683716,
0.6879529356956482,
-0.5644385814666748,
0.4945402145385742,
0.442221462726593,
-0.1957227736711502,
-2.158646821975708,
-1.0209953784942627,
0.34636354446411133,
-0.34611809253692627,
-1.6247386932373047,
1.3466322422027588,
-1.1173862218856812,
-0.9851812124252319,
0.5244323015213013,
0.05662384629249573,
1.2078378200531006,
0.32723987102508545,
1.725295901298523,
2.1054177284240723,
0.9233584403991699,
0.3564804792404175,
1.289912223815918,
-0.07240686565637589,
-0.4371224045753479,
1.8462233543395996,
-0.39873284101486206,
0.6067653894424438,
1.012999176979065,
-0.43174898624420166,
-1.0660163164138794,
-0.7905473709106445,
-1.187294363975525,
-0.6818126440048218,
1.162074089050293,
0.13276325166225433,
-1.0967826843261719,
0.22078803181648254,
1.6068954467773438,
0.09782188385725021,
-0.20227764546871185,
0.6714013814926147,
0.4406238794326782,
-0.7250048518180847,
-0.10060074925422668,
-0.8637056946754456,
0.5095838904380798,
-0.1679452508687973,
-0.3344985246658325,
0.1678951233625412,
0.4666505455970764,
1.303754448890686,
-0.030049994587898254,
0.07983522117137909,
1.259831190109253,
-1.4130539894104004,
1.50863778591156,
-0.6692157983779907,
0.3052656054496765,
-2.458005428314209,
1.3481874465942383,
-0.8018749952316284,
1.8345149755477905,
-2.600437641143799,
0.427287220954895,
-0.5813308358192444,
-0.47337913513183594,
0.2521710991859436,
-0.37970632314682007,
0.11265496909618378,
-0.13991576433181763,
-0.9373952746391296,
-0.018236450850963593,
-0.7166846990585327,
0.5445030331611633,
1.1305803060531616,
1.3782901763916016,
-1.1028605699539185,
-0.24703644216060638,
-1.7535278797149658,
-0.12848591804504395,
-0.7162176370620728,
0.30481064319610596,
-1.9831401109695435,
-0.1957922726869583,
-2.0415589809417725,
-2.384308338165283,
-1.407111406326294,
-0.8750896453857422,
1.0641396045684814,
0.1846003383398056,
-0.9716843962669373,
1.1583081483840942,
-0.40174752473831177,
-1.8019139766693115,
1.106964111328125,
-2.184621810913086
] |
https://github.com/huggingface/datasets/issues/6057 | Why is the speed difference of gen example so big? | Hi!
It's hard to explain this behavior without more information. Can you profile the slower version with the following code
```python
import cProfile, pstats
from datasets import load_dataset
with cProfile.Profile() as profiler:
ds = load_dataset(...)
stats = pstats.Stats(profiler).sort_stats("cumtime")
stats.print_stats()
```
and share the output? | ```python
def _generate_examples(self, metadata_path, images_dir, conditioning_images_dir):
with open(metadata_path, 'r') as file:
metadata = json.load(file)
for idx, item in enumerate(metadata):
image_path = item.get('image_path')
text_content = item.get('text_content')
image_data = open(image_path, "rb").read()
yield idx, {
"text": text_content,
"image": {
"path": image_path,
"bytes": image_data,
},
"conditioning_image": {
"path": image_path,
"bytes": image_data,
},
}
```
Hello,
I use the above function to deal with my local data set, but I am very surprised that the speed at which I generate example is very different. When I start a training task, **sometimes 1000examples/s, sometimes only 10examples/s.**
![image](https://github.com/huggingface/datasets/assets/46072190/cdc17661-8267-4fd8-b30c-b74d505efd9b)
I'm not saying that speed is changing all the time. I mean, the reading speed is different in different training, which will cause me to start training over and over again until the speed of this generation of examples is normal.
| 21 | 44 | Why is the speed difference of gen example so big?
```python
def _generate_examples(self, metadata_path, images_dir, conditioning_images_dir):
with open(metadata_path, 'r') as file:
metadata = json.load(file)
for idx, item in enumerate(metadata):
image_path = item.get('image_path')
text_content = item.get('text_content')
image_data = open(image_path, "rb").read()
yield idx, {
"text": text_content,
"image": {
"path": image_path,
"bytes": image_data,
},
"conditioning_image": {
"path": image_path,
"bytes": image_data,
},
}
```
Hello,
I use the above function to deal with my local data set, but I am very surprised that the speed at which I generate example is very different. When I start a training task, **sometimes 1000examples/s, sometimes only 10examples/s.**
![image](https://github.com/huggingface/datasets/assets/46072190/cdc17661-8267-4fd8-b30c-b74d505efd9b)
I'm not saying that speed is changing all the time. I mean, the reading speed is different in different training, which will cause me to start training over and over again until the speed of this generation of examples is normal.
Hi!
It's hard to explain this behavior without more information. Can you profile the slower version with the following code
```python
import cProfile, pstats
from datasets import load_dataset
with cProfile.Profile() as profiler:
ds = load_dataset(...)
stats = pstats.Stats(profiler).sort_stats("cumtime")
stats.print_stats()
```
and share the output? | [
-1.216934323310852,
-0.9637471437454224,
-0.751177191734314,
1.5022461414337158,
-0.20957061648368835,
-1.2565745115280151,
0.1558200716972351,
-1.0771048069000244,
1.6094040870666504,
-0.8362681269645691,
0.3122471272945404,
-1.6983448266983032,
-0.053490594029426575,
-0.6072121262550354,
-0.7769930958747864,
-0.9163908362388611,
-0.41224589943885803,
-0.8149207234382629,
1.09734046459198,
2.5492799282073975,
1.245376706123352,
-1.3828994035720825,
2.7086687088012695,
0.6530845761299133,
-0.13882777094841003,
-0.9723906517028809,
0.5745235085487366,
-0.046502549201250076,
-1.200953483581543,
-0.5162463784217834,
-0.9431304335594177,
-0.11964836716651917,
-0.6074804067611694,
-0.4699300527572632,
-0.02114814519882202,
0.488050639629364,
-0.29417452216148376,
-0.37931951880455017,
-0.5666587352752686,
-0.8437681794166565,
0.536653995513916,
-0.46105629205703735,
0.955659031867981,
-0.3118918836116791,
1.7483434677124023,
-0.5918545126914978,
0.474875807762146,
0.7374778985977173,
1.3593686819076538,
0.23409757018089294,
-0.011238549835979939,
0.3173207938671112,
0.38173311948776245,
-0.07437087595462799,
0.47496116161346436,
1.168940544128418,
0.6880643963813782,
0.47610780596733093,
0.6776074767112732,
-2.2960779666900635,
1.2665315866470337,
-1.1573166847229004,
0.35120686888694763,
1.3916401863098145,
-0.8963468670845032,
0.37919747829437256,
-1.8457177877426147,
-0.15117447078227997,
0.5400975942611694,
-2.199489116668701,
0.30498841404914856,
-1.2734646797180176,
-0.5128685832023621,
1.0041669607162476,
0.46310290694236755,
-1.3352833986282349,
0.11886250227689743,
-0.40865692496299744,
1.021544337272644,
0.3940100371837616,
1.073049783706665,
-1.718114972114563,
-0.12098783999681473,
-0.28182506561279297,
0.1251845359802246,
-1.2382007837295532,
-1.5566655397415161,
0.5502064228057861,
0.4911429286003113,
0.5354484915733337,
-0.17159442603588104,
1.0377776622772217,
-1.0254701375961304,
0.8149892091751099,
-1.0434931516647339,
-1.6332188844680786,
-1.5595793724060059,
-2.3284833431243896,
-2.228736162185669,
0.7078778147697449,
-0.4568057954311371,
-0.5255005359649658,
2.0507993698120117,
-0.9766611456871033,
-1.6549441814422607,
1.1404653787612915,
0.2656502425670624,
-0.04471474885940552,
2.389646053314209,
0.29052069783210754,
-0.7120004892349243,
0.4496825337409973,
-0.7971571683883667,
0.8142064809799194,
-0.3025203347206116,
1.4463695287704468,
0.462435245513916,
-1.0429657697677612,
1.552085041999817,
-0.3769466280937195,
0.5278354287147522,
-0.6244428753852844,
-0.47757095098495483,
-0.7878803014755249,
0.3614657521247864,
1.791225552558899,
-0.26769116520881653,
1.5123741626739502,
-0.3505963683128357,
-1.5588425397872925,
-1.6101272106170654,
0.9466082453727722,
0.5239459872245789,
-0.7997244596481323,
0.0984991118311882,
-0.46867433190345764,
0.15824683010578156,
-0.028970282524824142,
1.1808602809906006,
1.3028815984725952,
0.8187680840492249,
-0.45707622170448303,
-0.8876189589500427,
0.17532366514205933,
-0.08019596338272095,
-0.7546006441116333,
-1.765468955039978,
-0.3529859781265259,
0.12608833611011505,
0.6574408411979675,
-1.1742455959320068,
1.804736852645874,
0.9488719701766968,
1.9043769836425781,
0.97086101770401,
-0.3957464396953583,
1.4255523681640625,
0.014052540995180607,
1.8452357053756714,
-0.5519430041313171,
0.6725485920906067,
-0.34912949800491333,
-1.1900100708007812,
0.9543017745018005,
-0.235446497797966,
-2.103304624557495,
-0.8518507480621338,
-0.8689342737197876,
-0.2586978077888489,
-0.8216872215270996,
0.9181510210037231,
-0.27465254068374634,
-1.4141559600830078,
0.19384123384952545,
-0.7065879702568054,
0.07353024184703827,
-1.2398806810379028,
0.31061241030693054,
0.6615592241287231,
-0.6511259078979492,
0.08393415063619614,
-0.146683931350708,
-1.2428497076034546,
-0.4482939839363098,
0.21769635379314423,
1.891666054725647,
-0.7483571171760559,
0.9630532264709473,
1.057482361793518,
-0.6726154088973999,
0.08223063498735428,
0.2910272181034088,
-0.35744720697402954,
0.8929024934768677,
-1.0226314067840576,
-0.5091894865036011,
1.2118561267852783,
-0.222666934132576,
-0.5608296394348145,
1.4333099126815796,
0.7025729417800903,
-1.0302958488464355,
-0.22301337122917175,
-0.18449079990386963,
-0.806276798248291,
0.0441046804189682,
-1.5892413854599,
-0.09938362240791321,
0.515005350112915,
-1.527466893196106,
-0.4446544945240021,
-0.18856146931648254,
1.3676832914352417,
-0.19077526032924652,
1.3827095031738281,
-0.36532971262931824,
-0.1877432018518448,
-0.354366660118103,
-0.34552985429763794,
0.18977440893650055,
-0.17622025310993195,
-0.5708389282226562,
0.18984635174274445,
-0.8629563450813293,
0.29111340641975403,
1.4742547273635864,
0.37518274784088135,
-0.03387729078531265,
0.4522343873977661,
1.1018253564834595,
0.37976184487342834,
0.006968350149691105,
-0.872391402721405,
-1.4860467910766602,
2.0683770179748535,
-1.4617959260940552,
1.9652642011642456,
0.7281282544136047,
-0.008387301117181778,
-1.7703149318695068,
-1.8375049829483032,
1.2804157733917236,
1.1620142459869385,
2.34316349029541,
0.5263655185699463,
0.4120207726955414,
-0.8221333026885986,
-0.6920364499092102,
0.39459142088890076,
-1.0828994512557983,
-0.6534784436225891,
0.14554613828659058,
2.4094977378845215,
1.7506295442581177,
-0.4454251527786255,
-0.155517578125,
-1.0082757472991943,
1.380700945854187,
-0.15292888879776,
0.217747762799263,
2.0168440341949463,
-0.25525549054145813,
-1.1336286067962646,
1.2898423671722412,
-2.316448211669922,
0.19030654430389404,
2.0102577209472656,
0.34242451190948486,
0.10349805653095245,
-1.3795124292373657,
-0.615950882434845,
-0.2893010079860687,
-0.41838425397872925,
-1.2401059865951538,
0.5627544522285461,
-0.20907890796661377,
-0.8505750298500061,
-1.4390872716903687,
0.14459823071956635,
-1.1716781854629517,
-1.6821657419204712,
0.32478198409080505,
1.793208122253418,
2.161947011947632,
-0.8092085719108582,
1.5628929138183594,
-0.30092114210128784,
0.15363812446594238,
1.2138662338256836,
1.2734366655349731,
3.0660815238952637,
1.8178532123565674,
-1.332773208618164,
0.5708363056182861,
-0.16564851999282837,
-0.4771782457828522,
1.1470062732696533,
-1.254037618637085,
1.250259518623352,
-0.11739547550678253,
-1.1199109554290771,
-1.174153208732605,
1.0380622148513794,
0.42068737745285034,
-0.02723129466176033,
-0.4943358302116394,
1.1316368579864502,
0.10106472671031952,
1.323494791984558,
0.6231837868690491,
-0.32719239592552185,
0.6239498853683472,
-0.41803961992263794,
-0.47687801718711853,
1.5271998643875122,
0.22894634306430817,
-1.4293179512023926,
-2.2705256938934326,
-0.22981798648834229,
-0.892585039138794,
0.12996496260166168,
-0.5928254723548889,
-0.9865483045578003,
1.6567851305007935,
0.36763325333595276,
-1.2435986995697021,
-0.34799128770828247,
-0.4039337933063507,
-0.5387231707572937,
2.7247543334960938,
-1.3225151300430298,
-0.17847725749015808,
-0.9363937973976135,
-0.6404192447662354,
1.6438761949539185,
-1.2123051881790161,
-0.21962736546993256,
-1.0538585186004639,
-0.5637611746788025,
-1.2742908000946045,
-0.5823673605918884,
-0.01860770955681801,
-0.9440104365348816,
0.7581885457038879,
0.21576279401779175,
-1.1385130882263184,
-0.41667041182518005,
-0.8028188943862915,
0.8809425830841064,
-0.14800044894218445,
0.20809952914714813,
1.8570748567581177,
0.3807787001132965,
-0.3061186969280243,
0.8069878220558167,
1.1905003786087036,
0.6862212419509888,
-0.5423381924629211,
0.14670218527317047,
-0.6497355103492737,
0.2605326175689697,
-1.2446399927139282,
0.27777501940727234,
-2.808924436569214,
0.6155626177787781,
-0.14053478837013245,
-0.12857550382614136,
-0.07717768102884293,
-1.3132963180541992,
1.1144376993179321,
2.540310859680176,
-1.223475456237793,
0.5229458808898926,
0.2830667197704315,
1.0921859741210938,
-1.6558592319488525,
0.27007031440734863,
-0.44060808420181274,
2.141397476196289,
0.19906188547611237,
1.2303106784820557,
-0.5043326616287231,
-2.2538602352142334,
0.6138899922370911,
-1.3114746809005737,
-1.1147377490997314,
0.7018045783042908,
-0.8305339217185974,
0.1776863932609558,
-1.4717872142791748,
-0.26933369040489197,
-0.941997766494751,
-1.2342298030853271,
0.7159574031829834,
0.10205979645252228,
0.3975902199745178,
-0.5724132657051086,
0.32868754863739014,
-2.1962292194366455,
-1.378759741783142,
-0.25573015213012695,
-0.9341325163841248,
0.5133653283119202,
-0.4513842463493347,
0.7414267063140869,
-0.14441241323947906,
0.008694750256836414,
0.428912878036499,
1.5041519403457642,
3.480241298675537,
0.18517722189426422,
0.32471197843551636,
-0.17481698095798492,
-0.9637858271598816,
1.4641592502593994,
0.9391613006591797,
-0.07286127656698227,
-0.5612191557884216,
-1.1084015369415283,
1.2831206321716309,
2.01021409034729,
1.0269954204559326,
0.03209507465362549,
-0.8281400799751282,
-0.6808175444602966,
-0.07539790123701096,
0.19619376957416534,
0.503578782081604,
0.9241909384727478,
0.02988104149699211,
0.08445370942354202,
1.507885456085205,
1.1894105672836304,
-0.4327046573162079,
0.2788918912410736,
-0.854712724685669,
-0.5035659670829773,
0.4569818675518036,
0.22496485710144043,
-0.04864424094557762,
0.42577478289604187,
-1.0288915634155273,
-0.23925051093101501,
-0.3767993450164795,
-0.8531301617622375,
-0.7023192048072815,
-0.43403360247612,
-0.40616631507873535,
1.6096197366714478,
0.1500176191329956,
-0.4755520224571228,
-0.013696257025003433,
-0.7295629978179932,
-0.1648721694946289,
-1.0881563425064087,
0.13597418367862701,
-0.14415331184864044,
-0.15714460611343384,
-0.23218399286270142,
1.7534723281860352,
-0.8532999753952026,
-2.087146759033203,
0.21263593435287476,
0.28404659032821655,
-0.36408984661102295,
0.20758849382400513,
1.6505043506622314,
0.5621452927589417,
1.4374953508377075,
1.2848730087280273,
0.9258859157562256,
-0.6060484051704407,
-1.2426987886428833,
0.6904063820838928,
0.9761770367622375,
-1.3971086740493774,
0.8301537036895752,
-0.06094099581241608,
-0.40621617436408997,
0.6458179950714111,
1.291860818862915,
0.5204951763153076,
-2.019528388977051,
0.852203369140625,
-0.9174354076385498,
0.9058068990707397,
0.7117332816123962,
0.7044247388839722,
0.20182202756404877,
0.7501770853996277,
-1.1959342956542969,
-1.0259056091308594,
-0.71538907289505,
-0.7030901908874512,
2.0007951259613037,
-0.30107396841049194,
0.6618363261222839,
-0.2744344472885132,
-1.246124267578125,
-0.10435359925031662,
0.7282463908195496,
0.2934797704219818,
-0.5091681480407715,
0.777244508266449,
-0.5915536284446716,
-1.0924277305603027,
-1.34956693649292,
-0.4173721373081207,
-1.0943928956985474,
-1.0052675008773804,
1.0494331121444702,
0.7151585221290588,
0.34428054094314575,
1.9037251472473145,
0.6896220445632935,
0.232357919216156,
-2.576251268386841,
0.8775779604911804,
0.3455520570278168,
-0.06035184487700462,
0.8894129395484924,
0.3040429353713989,
1.0626622438430786,
-0.03686874732375145,
0.6097494959831238,
-2.4110107421875,
2.2968478202819824,
-0.16335950791835785,
0.7770819067955017,
-0.051701415330171585,
-0.2513349950313568,
1.1234813928604126,
0.6012284159660339,
0.47362688183784485,
-1.0913722515106201,
0.5934641361236572,
-0.6021558046340942,
1.1824405193328857,
0.8917272090911865,
-0.7387274503707886,
-0.0073491414077579975,
1.4099963903427124,
0.473999947309494,
-0.5056113600730896,
-0.9806418418884277,
-0.9138904809951782,
0.934283435344696,
1.7060366868972778,
-0.14054131507873535,
-0.04043658450245857,
0.8017311692237854,
0.6679850220680237,
-1.2387856245040894,
0.05304402485489845,
-0.7561818361282349,
-0.6828068494796753,
1.6918368339538574,
2.115565776824951,
-0.17962653934955597,
-0.22067205607891083,
-0.6793186664581299,
-1.3018437623977661,
0.8279613852500916,
-0.06916406750679016,
0.1426718533039093,
0.6167895197868347,
-0.6061788201332092,
1.1525055170059204,
0.836959958076477,
0.9305238127708435,
0.18704888224601746,
0.2642520070075989,
0.36768239736557007,
-0.31018364429473877,
-1.0370159149169922,
-0.28414905071258545,
-1.1383432149887085,
-2.609593391418457,
0.48622989654541016,
-0.22905676066875458,
-1.436240553855896,
-0.04384665563702583,
-0.9674939513206482,
0.9470309019088745,
-0.5847738981246948,
-1.066240668296814,
-1.5129002332687378,
0.2217855155467987,
-0.00025786273181438446,
0.9355251789093018,
-1.6425741910934448,
-0.13055191934108734,
1.2681580781936646,
0.8631669878959656,
-0.6457212567329407,
0.945886492729187,
0.20975711941719055,
1.0319513082504272,
0.7449969053268433,
-0.38841676712036133,
0.5632966756820679,
0.0018944013863801956,
-1.286259651184082,
0.4691180884838104,
1.1675113439559937,
0.14936593174934387,
1.5226680040359497,
-0.3893427550792694,
0.06453406810760498,
0.38754090666770935,
-0.5615633726119995,
-0.5456515550613403,
-0.42161038517951965,
0.6744767427444458,
0.04357071593403816,
-0.8633942604064941,
0.020291123539209366,
-0.015298191457986832,
-0.2568173110485077,
0.20563460886478424,
-1.3870978355407715,
-0.18339957296848297,
-0.37311404943466187,
-0.5520909428596497,
-1.2532438039779663,
-0.15734489262104034,
1.3316872119903564,
-0.7179787755012512,
-0.20986224710941315,
0.5465753078460693,
0.3500526547431946,
0.5654042363166809,
0.6741500496864319,
-0.6760182976722717,
-0.36772218346595764,
-0.29948368668556213,
-0.2696693241596222,
0.3348270058631897,
1.24312162399292,
-0.11104389280080795,
-0.9500681757926941,
0.7515242099761963,
-0.2605403959751129,
0.08523928374052048,
1.8313151597976685,
0.00020139478147029877,
-0.788054883480072,
0.35348203778266907,
-0.6335054636001587,
1.9164484739303589,
1.6813000440597534,
1.2779040336608887,
-0.11600814759731293,
-0.9464979767799377,
0.6675404906272888,
-0.35533711314201355,
-0.37629568576812744,
0.7767043709754944,
0.35702940821647644,
-0.1766645312309265,
-1.4663865566253662,
0.7429274320602417,
1.277604103088379,
-0.8597723841667175,
-0.829785943031311,
0.1588001251220703,
-0.7508036494255066,
1.1298134326934814,
0.5879372358322144,
0.4203169345855713,
0.30198022723197937,
1.6812944412231445,
0.794296383857727,
-0.40261027216911316,
0.5403472781181335,
0.6018300652503967,
-0.221987783908844,
-2.091813325881958,
-1.190731406211853,
0.2883550524711609,
-0.5965062975883484,
-1.5593793392181396,
1.4058815240859985,
-1.1179225444793701,
-1.103232979774475,
0.6203775405883789,
0.09642432630062103,
1.4125478267669678,
0.37286293506622314,
1.6093751192092896,
2.0356454849243164,
0.8833154439926147,
0.4710199236869812,
1.252509355545044,
-0.10078807175159454,
-0.44505512714385986,
1.845595121383667,
-0.3903411030769348,
0.5006048679351807,
1.1081572771072388,
-0.2957691550254822,
-1.0690428018569946,
-0.7926371693611145,
-1.1776000261306763,
-0.7749365568161011,
1.2161309719085693,
0.07349555939435959,
-1.0072698593139648,
0.26244959235191345,
1.5956770181655884,
0.1097097173333168,
-0.38386985659599304,
0.5995893478393555,
0.3865424692630768,
-0.7816075086593628,
-0.01209300197660923,
-0.9260096549987793,
0.5104666948318481,
-0.17378030717372894,
-0.38599348068237305,
0.3202413320541382,
0.4523959159851074,
1.3350447416305542,
-0.1254758983850479,
0.14322079718112946,
0.9892311692237854,
-1.474744200706482,
1.544602394104004,
-0.6127983331680298,
0.2725115120410919,
-2.3522114753723145,
1.3059748411178589,
-0.8054678440093994,
1.9724215269088745,
-2.6643409729003906,
0.4151458144187927,
-0.527175784111023,
-0.4692729413509369,
0.3134128749370575,
-0.3621015250682831,
0.1079455316066742,
-0.092584989964962,
-1.105118989944458,
-0.047104258090257645,
-0.6621398329734802,
0.5824953317642212,
1.1572858095169067,
1.3457852602005005,
-1.124616026878357,
-0.32514867186546326,
-1.7089297771453857,
-0.10835269093513489,
-0.6913965940475464,
0.26063063740730286,
-2.0207784175872803,
-0.19330529868602753,
-1.8849340677261353,
-2.2232348918914795,
-1.3246861696243286,
-0.867684006690979,
1.099067211151123,
0.10458523780107498,
-0.8497797846794128,
1.2090086936950684,
-0.35813313722610474,
-1.8612474203109741,
1.0810292959213257,
-2.1806819438934326
] |
https://github.com/huggingface/datasets/issues/6051 | Skipping shard in the remote repo and resume upload | Hi! `_select_contiguous` fetches a (zero-copy) slice of the dataset's Arrow table to build a shard, so I don't think this part is the problem. To me, the issue seems to be the step where we embed external image files' bytes (a lot of file reads). You can use `.map` with multiprocessing to perform this step before `push_to_hub` in a faster manner and cache it to disk:
```python
from datasets.table import embed_table_storage
# load_dataset(...)
format = dataset.format
dataset = dataset.with_format("arrow")
dataset = dataset.map(embed_table_storage, batched=True)
dataset = dataset.with_format(**format)
# push_to_hub(...)
```
(In Datasets 3.0, these external bytes will be written to an Arrow file when generating a dataset to avoid this "embed" step) | ### Describe the bug
For some reason when I try to resume the upload of my dataset, it is very slow to reach the index of the shard from which to resume the uploading.
From my understanding, the problem is in this part of the code:
arrow_dataset.py
```python
for index, shard in logging.tqdm(
enumerate(itertools.chain([first_shard], shards_iter)),
desc="Pushing dataset shards to the dataset hub",
total=num_shards,
disable=not logging.is_progress_bar_enabled(),
):
shard_path_in_repo = path_in_repo(index, shard)
# Upload a shard only if it doesn't already exist in the repository
if shard_path_in_repo not in data_files:
```
In particular, iterating the generator is slow during the call:
```python
self._select_contiguous(start, length, new_fingerprint=new_fingerprint)
```
I wonder if it is possible to avoid calling this function for shards that are already uploaded and just start from the correct shard index.
### Steps to reproduce the bug
1. Start the upload
```python
dataset = load_dataset("imagefolder", data_dir=DATA_DIR, split="train", drop_labels=True)
dataset.push_to_hub("repo/name")
```
2. Stop and restart the upload after hundreds of shards
### Expected behavior
Skip the uploaded shards faster.
### Environment info
- `datasets` version: 2.5.1
- Platform: Linux-4.18.0-193.el8.x86_64-x86_64-with-glibc2.17
- Python version: 3.8.16
- PyArrow version: 12.0.1
- Pandas version: 2.0.2
| 23 | 111 | Skipping shard in the remote repo and resume upload
### Describe the bug
For some reason when I try to resume the upload of my dataset, it is very slow to reach the index of the shard from which to resume the uploading.
From my understanding, the problem is in this part of the code:
arrow_dataset.py
```python
for index, shard in logging.tqdm(
enumerate(itertools.chain([first_shard], shards_iter)),
desc="Pushing dataset shards to the dataset hub",
total=num_shards,
disable=not logging.is_progress_bar_enabled(),
):
shard_path_in_repo = path_in_repo(index, shard)
# Upload a shard only if it doesn't already exist in the repository
if shard_path_in_repo not in data_files:
```
In particular, iterating the generator is slow during the call:
```python
self._select_contiguous(start, length, new_fingerprint=new_fingerprint)
```
I wonder if it is possible to avoid calling this function for shards that are already uploaded and just start from the correct shard index.
### Steps to reproduce the bug
1. Start the upload
```python
dataset = load_dataset("imagefolder", data_dir=DATA_DIR, split="train", drop_labels=True)
dataset.push_to_hub("repo/name")
```
2. Stop and restart the upload after hundreds of shards
### Expected behavior
Skip the uploaded shards faster.
### Environment info
- `datasets` version: 2.5.1
- Platform: Linux-4.18.0-193.el8.x86_64-x86_64-with-glibc2.17
- Python version: 3.8.16
- PyArrow version: 12.0.1
- Pandas version: 2.0.2
Hi! `_select_contiguous` fetches a (zero-copy) slice of the dataset's Arrow table to build a shard, so I don't think this part is the problem. To me, the issue seems to be the step where we embed external image files' bytes (a lot of file reads). You can use `.map` with multiprocessing to perform this step before `push_to_hub` in a faster manner and cache it to disk:
```python
from datasets.table import embed_table_storage
# load_dataset(...)
format = dataset.format
dataset = dataset.with_format("arrow")
dataset = dataset.map(embed_table_storage, batched=True)
dataset = dataset.with_format(**format)
# push_to_hub(...)
```
(In Datasets 3.0, these external bytes will be written to an Arrow file when generating a dataset to avoid this "embed" step) | [
-1.2337567806243896,
-0.90196293592453,
-0.678459882736206,
1.487384557723999,
-0.22792723774909973,
-1.3088724613189697,
0.11573110520839691,
-1.0518202781677246,
1.6316242218017578,
-0.8330173492431641,
0.36152344942092896,
-1.6441075801849365,
0.030849676579236984,
-0.6168583035469055,
-0.7336971163749695,
-0.8600968718528748,
-0.5004979968070984,
-0.7417711615562439,
1.0920333862304688,
2.442368984222412,
1.2779862880706787,
-1.3373117446899414,
2.663069725036621,
0.7389970421791077,
-0.13337045907974243,
-1.008005976676941,
0.5681764483451843,
-0.05696944519877434,
-1.3800630569458008,
-0.49055907130241394,
-0.9164272546768188,
-0.07186185568571091,
-0.5715814232826233,
-0.4574339687824249,
-0.058592747896909714,
0.45068445801734924,
-0.31156983971595764,
-0.4177393913269043,
-0.5743576884269714,
-0.8111051917076111,
0.48351413011550903,
-0.34182289242744446,
1.0015891790390015,
-0.37182119488716125,
1.8272039890289307,
-0.5415825247764587,
0.5739861130714417,
0.7987245321273804,
1.349541425704956,
0.12895791232585907,
-0.07339281588792801,
0.3016209006309509,
0.3990970849990845,
-0.008896199986338615,
0.49192723631858826,
1.1366790533065796,
0.6759856939315796,
0.5126126408576965,
0.6954228281974792,
-2.2642714977264404,
1.353680968284607,
-1.039463758468628,
0.31915467977523804,
1.3722329139709473,
-0.9869458079338074,
0.3252853453159332,
-1.7550792694091797,
-0.058175716549158096,
0.5664023160934448,
-2.1981334686279297,
0.28208088874816895,
-1.3417479991912842,
-0.44480985403060913,
1.013415813446045,
0.4227803349494934,
-1.2477084398269653,
0.09098457545042038,
-0.4054650068283081,
1.0432038307189941,
0.41717857122421265,
1.047292709350586,
-1.6713855266571045,
-0.03900707885622978,
-0.29042088985443115,
0.12725554406642914,
-1.2212977409362793,
-1.553049921989441,
0.5594147443771362,
0.673181414604187,
0.5150609016418457,
-0.1895071119070053,
1.0354520082473755,
-1.0425944328308105,
0.7834643721580505,
-0.9381792545318604,
-1.6824321746826172,
-1.4559377431869507,
-2.340949535369873,
-2.283135175704956,
0.7552310824394226,
-0.4677733778953552,
-0.5569188594818115,
2.1499276161193848,
-1.176769495010376,
-1.6665596961975098,
1.1492308378219604,
0.17132991552352905,
0.059372756630182266,
2.394676923751831,
0.13498452305793762,
-0.7260299921035767,
0.47961190342903137,
-0.7642819881439209,
0.7344311475753784,
-0.4315917491912842,
1.2970620393753052,
0.3782739043235779,
-1.1497187614440918,
1.588239312171936,
-0.32628294825553894,
0.5885304808616638,
-0.6639055609703064,
-0.4823263883590698,
-0.7409040331840515,
0.2865149676799774,
1.840808391571045,
-0.31911948323249817,
1.470992088317871,
-0.2824063301086426,
-1.5089502334594727,
-1.5993562936782837,
0.9435166120529175,
0.4567137360572815,
-0.7191820740699768,
0.09543856233358383,
-0.36312246322631836,
0.14929336309432983,
-0.0446506105363369,
1.1132216453552246,
1.269506812095642,
0.7721238136291504,
-0.3855604827404022,
-0.8607205748558044,
0.17951546609401703,
-0.05530226603150368,
-0.7478744387626648,
-1.709507703781128,
-0.32294797897338867,
0.07837264984846115,
0.6693508625030518,
-1.1027562618255615,
1.8525348901748657,
0.957944929599762,
1.9567567110061646,
0.997471272945404,
-0.3753310441970825,
1.51962411403656,
0.09696115553379059,
1.8581173419952393,
-0.48165056109428406,
0.6287204027175903,
-0.34381410479545593,
-1.1997004747390747,
0.8340712785720825,
-0.26402634382247925,
-2.063399076461792,
-0.7431795597076416,
-0.6845407485961914,
-0.18638189136981964,
-0.7180735468864441,
0.9895925521850586,
-0.29996272921562195,
-1.2942841053009033,
0.2042667418718338,
-0.6687932014465332,
0.15023574233055115,
-1.1884956359863281,
0.3950079679489136,
0.7087992429733276,
-0.5975250601768494,
0.07823894172906876,
-0.2715972661972046,
-1.2314698696136475,
-0.45446252822875977,
0.33750489354133606,
1.827985167503357,
-0.7321612238883972,
0.978770911693573,
1.0678105354309082,
-0.661210298538208,
-0.1158369928598404,
0.3362983465194702,
-0.2824595868587494,
0.8293112516403198,
-0.9925419688224792,
-0.5223758816719055,
1.2453601360321045,
-0.27146974205970764,
-0.6154875755310059,
1.4915587902069092,
0.6893269419670105,
-1.0097055435180664,
-0.262732595205307,
-0.12246263772249222,
-0.8552379012107849,
0.0899268090724945,
-1.6418430805206299,
-0.050854600965976715,
0.5060604214668274,
-1.5585482120513916,
-0.41391685605049133,
-0.13738548755645752,
1.3123596906661987,
-0.13676851987838745,
1.4804519414901733,
-0.29731112718582153,
-0.1608545333147049,
-0.3873220682144165,
-0.3491549789905548,
0.10241173207759857,
-0.10993726551532745,
-0.5633689761161804,
0.21828636527061462,
-0.7332406044006348,
0.3954421579837799,
1.4427874088287354,
0.31749433279037476,
0.017037294805049896,
0.4907570779323578,
1.0944647789001465,
0.3791586756706238,
-0.13381950557231903,
-0.9232704043388367,
-1.546085238456726,
2.030433177947998,
-1.414153814315796,
2.0074234008789062,
0.8281375169754028,
-0.03790296986699104,
-1.7551099061965942,
-1.8667027950286865,
1.3262865543365479,
1.144059658050537,
2.2668569087982178,
0.5308912992477417,
0.41339531540870667,
-0.8677965402603149,
-0.6404852271080017,
0.37399518489837646,
-1.0277353525161743,
-0.7210312485694885,
0.15837128460407257,
2.359985113143921,
1.7972444295883179,
-0.31457674503326416,
-0.17526264488697052,
-1.105748176574707,
1.354956865310669,
-0.1479802131652832,
0.20938830077648163,
1.9835472106933594,
-0.25671085715293884,
-1.086856722831726,
1.234517216682434,
-2.3245649337768555,
0.1497488021850586,
2.047408103942871,
0.2646328806877136,
0.06471793353557587,
-1.4203792810440063,
-0.5465630888938904,
-0.2427622377872467,
-0.4041149914264679,
-1.2693995237350464,
0.6077096462249756,
-0.33866533637046814,
-0.6842174530029297,
-1.348427414894104,
0.20055340230464935,
-1.134090781211853,
-1.6757968664169312,
0.1294519007205963,
1.864619493484497,
2.0497405529022217,
-0.6830126643180847,
1.5622748136520386,
-0.2681933045387268,
0.13469593226909637,
1.2063521146774292,
1.2881721258163452,
3.148425817489624,
1.949645757675171,
-1.3789522647857666,
0.6128236651420593,
-0.19042666256427765,
-0.4722844660282135,
1.1629676818847656,
-1.2368316650390625,
1.3353370428085327,
-0.14665380120277405,
-1.2856532335281372,
-1.195057988166809,
0.9343278408050537,
0.4360649883747101,
0.11221752315759659,
-0.4786183834075928,
1.191691279411316,
0.1318052113056183,
1.360566258430481,
0.5610366463661194,
-0.3690239191055298,
0.6496949791908264,
-0.39443832635879517,
-0.5412927269935608,
1.5553380250930786,
0.22426804900169373,
-1.393402338027954,
-2.290755033493042,
-0.2533697485923767,
-0.8908997774124146,
0.09348299354314804,
-0.6932751536369324,
-0.9280837178230286,
1.618016004562378,
0.3722895383834839,
-1.3056226968765259,
-0.3035373389720917,
-0.31953299045562744,
-0.5707793831825256,
2.732940196990967,
-1.3507685661315918,
-0.22871913015842438,
-1.0462812185287476,
-0.6502271890640259,
1.6150676012039185,
-1.269022822380066,
-0.21696238219738007,
-1.0175433158874512,
-0.5227193236351013,
-1.1877332925796509,
-0.6277198195457458,
0.005058274604380131,
-0.9500988125801086,
0.8573604822158813,
0.18375509977340698,
-1.2750072479248047,
-0.38191547989845276,
-0.8922567367553711,
0.9108405113220215,
-0.1303987056016922,
0.19121673703193665,
1.7812434434890747,
0.3978542685508728,
-0.4086708724498749,
0.8028090000152588,
1.1567962169647217,
0.6818769574165344,
-0.5854315161705017,
0.2466200441122055,
-0.7206945419311523,
0.3587314486503601,
-1.230499505996704,
0.3004726469516754,
-2.8560307025909424,
0.5851266980171204,
-0.06025775149464607,
-0.05165344104170799,
-0.05510515347123146,
-1.3552335500717163,
1.0105946063995361,
2.57735276222229,
-1.2183319330215454,
0.502099335193634,
0.2725886404514313,
1.1751083135604858,
-1.6792534589767456,
0.2922021150588989,
-0.5350991487503052,
2.1385512351989746,
0.19337031245231628,
1.207167625427246,
-0.41381627321243286,
-2.3652184009552,
0.6014919281005859,
-1.330019235610962,
-1.1506848335266113,
0.7954616546630859,
-0.9137471914291382,
0.07106366008520126,
-1.3136755228042603,
-0.2693358063697815,
-0.8069401383399963,
-1.2014745473861694,
0.7003686428070068,
0.14589084684848785,
0.486020565032959,
-0.6145097017288208,
0.27604955434799194,
-2.204354763031006,
-1.2875555753707886,
-0.2963694632053375,
-0.9856960773468018,
0.4617612361907959,
-0.37318432331085205,
0.7074986696243286,
-0.1823211908340454,
-0.04365966096520424,
0.4123278558254242,
1.447935938835144,
3.3985345363616943,
0.195459246635437,
0.3197614252567291,
-0.18392935395240784,
-0.938692569732666,
1.4732571840286255,
0.9049115180969238,
-0.12741681933403015,
-0.6118022799491882,
-1.0041230916976929,
1.274325966835022,
1.9096965789794922,
0.9272371530532837,
0.007966888137161732,
-0.7816242575645447,
-0.7125744819641113,
-0.03954639658331871,
0.16157816350460052,
0.4865676462650299,
0.8726717233657837,
0.06528329104185104,
0.07314923405647278,
1.3811538219451904,
1.1862406730651855,
-0.352421373128891,
0.2833855450153351,
-0.8257800936698914,
-0.4565255045890808,
0.5596519708633423,
0.24358351528644562,
-0.042330484837293625,
0.36624908447265625,
-0.9527102708816528,
-0.20593012869358063,
-0.4184488356113434,
-0.8950109481811523,
-0.7282785177230835,
-0.37364596128463745,
-0.3892807364463806,
1.6669706106185913,
0.0788951888680458,
-0.542248010635376,
0.007905595935881138,
-0.7627795934677124,
-0.14079460501670837,
-1.0717521905899048,
0.2501736581325531,
-0.1407536268234253,
-0.09678574651479721,
-0.15127962827682495,
1.7684893608093262,
-0.9476463794708252,
-2.0795962810516357,
0.2634744346141815,
0.1426902711391449,
-0.21788522601127625,
0.2212018370628357,
1.6563445329666138,
0.4977547228336334,
1.429540753364563,
1.4011359214782715,
0.9955692887306213,
-0.6856331825256348,
-1.3299719095230103,
0.7903128266334534,
0.9949130415916443,
-1.4343352317810059,
0.8227210640907288,
-0.03608926385641098,
-0.5273606181144714,
0.663018524646759,
1.2145793437957764,
0.5351558923721313,
-2.077251434326172,
0.8104270100593567,
-1.0711919069290161,
0.8269333243370056,
0.765339732170105,
0.7047030329704285,
0.1941930204629898,
0.7955692410469055,
-1.160701036453247,
-1.1607857942581177,
-0.6326921582221985,
-0.7590445876121521,
1.9583085775375366,
-0.35090959072113037,
0.6301913857460022,
-0.1556616574525833,
-1.4048386812210083,
-0.12768402695655823,
0.6679036617279053,
0.2948802411556244,
-0.47049233317375183,
0.8317627906799316,
-0.7439082264900208,
-1.1927505731582642,
-1.3664841651916504,
-0.4440276324748993,
-1.084383487701416,
-0.9058203101158142,
1.1159576177597046,
0.7924146056175232,
0.2670268714427948,
1.8079849481582642,
0.6590767502784729,
0.2703622877597809,
-2.6320230960845947,
0.8509394526481628,
0.27071624994277954,
-0.09272062033414841,
0.8038785457611084,
0.36455580592155457,
0.9938639998435974,
0.0015496956184506416,
0.5407965183258057,
-2.5132431983947754,
2.3632912635803223,
-0.2596021294593811,
0.7151375412940979,
0.004197071306407452,
-0.24006880819797516,
1.073674201965332,
0.5426244735717773,
0.5500372052192688,
-1.0633150339126587,
0.7218159437179565,
-0.5476648807525635,
1.2122101783752441,
0.8185598254203796,
-0.8142513632774353,
-0.026592683047056198,
1.360748052597046,
0.5005437135696411,
-0.5871804356575012,
-0.9113787412643433,
-0.9985815286636353,
0.9487605690956116,
1.7840443849563599,
-0.0442657433450222,
0.08227471262216568,
0.8068153262138367,
0.7067267298698425,
-1.194595456123352,
0.08195142447948456,
-0.6857418417930603,
-0.7707301378250122,
1.5716946125030518,
2.0258538722991943,
-0.15652918815612793,
-0.2096499800682068,
-0.7868586778640747,
-1.231432318687439,
0.7900840640068054,
-0.03031308203935623,
0.04938720911741257,
0.5784181952476501,
-0.5745078921318054,
1.0650240182876587,
0.924768328666687,
0.9891169667243958,
0.28517207503318787,
0.21475735306739807,
0.3805500864982605,
-0.41419270634651184,
-1.104225993156433,
-0.14687013626098633,
-1.0291776657104492,
-2.611445188522339,
0.45408591628074646,
-0.2688278257846832,
-1.4459519386291504,
0.009729311801493168,
-1.0292091369628906,
0.8666695952415466,
-0.5230166912078857,
-1.1091209650039673,
-1.5069445371627808,
0.1457825005054474,
-0.03582637012004852,
0.8910927772521973,
-1.671420931816101,
-0.15280066430568695,
1.187508463859558,
0.8654392957687378,
-0.7163599729537964,
1.0232900381088257,
0.2412099987268448,
1.016477108001709,
0.854031503200531,
-0.35248976945877075,
0.4790397882461548,
0.05991574749350548,
-1.4102002382278442,
0.42885181307792664,
1.1695008277893066,
0.06877577304840088,
1.4552544355392456,
-0.5566988587379456,
0.013388876803219318,
0.3812996745109558,
-0.49603545665740967,
-0.5398036241531372,
-0.5241395235061646,
0.7185705304145813,
0.023177050054073334,
-0.8471294641494751,
0.031050924211740494,
-0.1367887705564499,
-0.23966734111309052,
0.11348538100719452,
-1.4788877964019775,
-0.19533951580524445,
-0.3650161921977997,
-0.6026400923728943,
-1.3117738962173462,
-0.1366853564977646,
1.4240243434906006,
-0.715322732925415,
-0.2023852914571762,
0.5118281245231628,
0.3741411566734314,
0.6010702252388,
0.6747812628746033,
-0.6407355666160583,
-0.3277674913406372,
-0.18267107009887695,
-0.3049633204936981,
0.3379477858543396,
1.3638120889663696,
-0.08751450479030609,
-0.8422901034355164,
0.7076956629753113,
-0.2849542200565338,
0.06729922443628311,
1.9548617601394653,
0.1935623437166214,
-0.7523084282875061,
0.2952728569507599,
-0.7399083971977234,
1.8755617141723633,
1.7151470184326172,
1.3504748344421387,
-0.08160117268562317,
-0.9989301562309265,
0.6529162526130676,
-0.3673171401023865,
-0.3732829988002777,
0.8626567721366882,
0.3769260346889496,
-0.2145882099866867,
-1.3582123517990112,
0.7676163911819458,
1.2334342002868652,
-0.8042402863502502,
-0.757841169834137,
0.12439937889575958,
-0.7383881211280823,
1.0720350742340088,
0.615304172039032,
0.37388506531715393,
0.21079808473587036,
1.5953315496444702,
0.8084926605224609,
-0.47875022888183594,
0.58686363697052,
0.5118035674095154,
-0.22067061066627502,
-2.115738868713379,
-1.1762893199920654,
0.3128913938999176,
-0.5099015235900879,
-1.5892385244369507,
1.372091293334961,
-1.161460280418396,
-1.0379739999771118,
0.5223749876022339,
0.03811846300959587,
1.4377191066741943,
0.36276543140411377,
1.5266915559768677,
2.0783708095550537,
0.8480502367019653,
0.4771314859390259,
1.339554786682129,
-0.18926680088043213,
-0.4236353933811188,
1.8070098161697388,
-0.47592681646347046,
0.4263910949230194,
1.1054972410202026,
-0.3578287661075592,
-1.0844471454620361,
-0.7406980395317078,
-1.1826990842819214,
-0.7372338175773621,
1.1885218620300293,
0.03463384881615639,
-0.9829161167144775,
0.31222113966941833,
1.5052239894866943,
0.08488161116838455,
-0.2322094738483429,
0.6185085773468018,
0.35515928268432617,
-0.7842084169387817,
-0.08572963625192642,
-0.9405531287193298,
0.5735734105110168,
-0.27444952726364136,
-0.35207802057266235,
0.37341558933258057,
0.4485834836959839,
1.2953341007232666,
-0.0565042644739151,
0.14852939546108246,
1.0843957662582397,
-1.4618436098098755,
1.4291331768035889,
-0.6996093392372131,
0.2736864686012268,
-2.3257944583892822,
1.3602832555770874,
-0.7575445175170898,
1.9016464948654175,
-2.6301963329315186,
0.3739706575870514,
-0.5695933103561401,
-0.5002127885818481,
0.33819580078125,
-0.2965412437915802,
0.09161651879549026,
-0.22479426860809326,
-1.1100742816925049,
-0.026736214756965637,
-0.6536775827407837,
0.621192455291748,
1.085298776626587,
1.3488065004348755,
-1.0807684659957886,
-0.2877819836139679,
-1.6962494850158691,
-0.13530080020427704,
-0.6934663653373718,
0.31322747468948364,
-1.9541088342666626,
-0.14830568432807922,
-1.9698495864868164,
-2.366447925567627,
-1.1725387573242188,
-0.8388245701789856,
1.1526199579238892,
0.2497282773256302,
-0.845248818397522,
1.232072114944458,
-0.3594874143600464,
-1.878743052482605,
1.0510467290878296,
-2.1976304054260254
] |
https://github.com/huggingface/datasets/issues/6051 | Skipping shard in the remote repo and resume upload | Hi, thanks, this solution saves some time.
But can't we avoid embedding all external image files bytes with each push, skipping the images that have already been pushed into the repo?
Edit: Ok I missed the part of cache it manually on the disk the first time, this solves the problem. Thank you | ### Describe the bug
For some reason when I try to resume the upload of my dataset, it is very slow to reach the index of the shard from which to resume the uploading.
From my understanding, the problem is in this part of the code:
arrow_dataset.py
```python
for index, shard in logging.tqdm(
enumerate(itertools.chain([first_shard], shards_iter)),
desc="Pushing dataset shards to the dataset hub",
total=num_shards,
disable=not logging.is_progress_bar_enabled(),
):
shard_path_in_repo = path_in_repo(index, shard)
# Upload a shard only if it doesn't already exist in the repository
if shard_path_in_repo not in data_files:
```
In particular, iterating the generator is slow during the call:
```python
self._select_contiguous(start, length, new_fingerprint=new_fingerprint)
```
I wonder if it is possible to avoid calling this function for shards that are already uploaded and just start from the correct shard index.
### Steps to reproduce the bug
1. Start the upload
```python
dataset = load_dataset("imagefolder", data_dir=DATA_DIR, split="train", drop_labels=True)
dataset.push_to_hub("repo/name")
```
2. Stop and restart the upload after hundreds of shards
### Expected behavior
Skip the uploaded shards faster.
### Environment info
- `datasets` version: 2.5.1
- Platform: Linux-4.18.0-193.el8.x86_64-x86_64-with-glibc2.17
- Python version: 3.8.16
- PyArrow version: 12.0.1
- Pandas version: 2.0.2
| 23 | 53 | Skipping shard in the remote repo and resume upload
### Describe the bug
For some reason when I try to resume the upload of my dataset, it is very slow to reach the index of the shard from which to resume the uploading.
From my understanding, the problem is in this part of the code:
arrow_dataset.py
```python
for index, shard in logging.tqdm(
enumerate(itertools.chain([first_shard], shards_iter)),
desc="Pushing dataset shards to the dataset hub",
total=num_shards,
disable=not logging.is_progress_bar_enabled(),
):
shard_path_in_repo = path_in_repo(index, shard)
# Upload a shard only if it doesn't already exist in the repository
if shard_path_in_repo not in data_files:
```
In particular, iterating the generator is slow during the call:
```python
self._select_contiguous(start, length, new_fingerprint=new_fingerprint)
```
I wonder if it is possible to avoid calling this function for shards that are already uploaded and just start from the correct shard index.
### Steps to reproduce the bug
1. Start the upload
```python
dataset = load_dataset("imagefolder", data_dir=DATA_DIR, split="train", drop_labels=True)
dataset.push_to_hub("repo/name")
```
2. Stop and restart the upload after hundreds of shards
### Expected behavior
Skip the uploaded shards faster.
### Environment info
- `datasets` version: 2.5.1
- Platform: Linux-4.18.0-193.el8.x86_64-x86_64-with-glibc2.17
- Python version: 3.8.16
- PyArrow version: 12.0.1
- Pandas version: 2.0.2
Hi, thanks, this solution saves some time.
But can't we avoid embedding all external image files bytes with each push, skipping the images that have already been pushed into the repo?
Edit: Ok I missed the part of cache it manually on the disk the first time, this solves the problem. Thank you | [
-1.228704571723938,
-0.9043618440628052,
-0.6839578747749329,
1.5109764337539673,
-0.23591430485248566,
-1.3173547983169556,
0.1201028823852539,
-1.0454732179641724,
1.6178052425384521,
-0.835773766040802,
0.34961482882499695,
-1.637833833694458,
0.06114544719457626,
-0.597659170627594,
-0.7309144139289856,
-0.8682023882865906,
-0.4822472631931305,
-0.7591851353645325,
1.0996440649032593,
2.4432764053344727,
1.2713624238967896,
-1.3261030912399292,
2.6648054122924805,
0.7387117743492126,
-0.15213124454021454,
-1.0129694938659668,
0.5825967788696289,
-0.04606802016496658,
-1.3792647123336792,
-0.47599512338638306,
-0.9170135259628296,
-0.08309967815876007,
-0.5672450661659241,
-0.4467024803161621,
-0.07260693609714508,
0.430767297744751,
-0.29801979660987854,
-0.42205438017845154,
-0.5799188017845154,
-0.7981120347976685,
0.4880681335926056,
-0.33949315547943115,
0.9931639432907104,
-0.3641071915626526,
1.8483794927597046,
-0.5409228205680847,
0.5567080974578857,
0.8044917583465576,
1.3333439826965332,
0.14224177598953247,
-0.07557852566242218,
0.28553444147109985,
0.4145236015319824,
-0.017287999391555786,
0.4972934424877167,
1.1220096349716187,
0.6707319021224976,
0.5149301886558533,
0.6989543437957764,
-2.265629529953003,
1.3520716428756714,
-1.0489099025726318,
0.3171033561229706,
1.3742808103561401,
-0.9650910496711731,
0.32161521911621094,
-1.7562880516052246,
-0.04391030594706535,
0.5513933897018433,
-2.1925365924835205,
0.3012837767601013,
-1.3341368436813354,
-0.4488774538040161,
1.0113328695297241,
0.41127705574035645,
-1.2397688627243042,
0.07803937792778015,
-0.4031028747558594,
1.0434166193008423,
0.4149293601512909,
1.041709542274475,
-1.6683192253112793,
-0.04704334959387779,
-0.28888610005378723,
0.11326772719621658,
-1.244552731513977,
-1.5407202243804932,
0.5420815944671631,
0.6764269471168518,
0.5145896673202515,
-0.1613810807466507,
1.0518311262130737,
-1.0422743558883667,
0.7953903675079346,
-0.9451480507850647,
-1.6588691473007202,
-1.455074429512024,
-2.3577802181243896,
-2.2726504802703857,
0.7421531081199646,
-0.47011980414390564,
-0.5588735938072205,
2.133387804031372,
-1.1700891256332397,
-1.664463758468628,
1.167833924293518,
0.1460105925798416,
0.053397633135318756,
2.3869664669036865,
0.14901019632816315,
-0.7227751612663269,
0.4732585549354553,
-0.7884117364883423,
0.7406023740768433,
-0.41053545475006104,
1.2978558540344238,
0.37093380093574524,
-1.1435527801513672,
1.5783381462097168,
-0.3398882746696472,
0.5918093919754028,
-0.647752046585083,
-0.48756659030914307,
-0.7429701089859009,
0.28429386019706726,
1.8470854759216309,
-0.30738767981529236,
1.4680290222167969,
-0.2780008316040039,
-1.5143991708755493,
-1.5868133306503296,
0.9406290054321289,
0.4637000560760498,
-0.7216934561729431,
0.09128889441490173,
-0.35823145508766174,
0.13439856469631195,
-0.04713689163327217,
1.1132194995880127,
1.2604775428771973,
0.7838214635848999,
-0.42463114857673645,
-0.8597480654716492,
0.18971671164035797,
-0.05599397420883179,
-0.7661831974983215,
-1.7008349895477295,
-0.3261009454727173,
0.07320867478847504,
0.6737215518951416,
-1.1242923736572266,
1.8460534811019897,
0.9694778919219971,
1.9664509296417236,
0.9899462461471558,
-0.38265031576156616,
1.5003949403762817,
0.10096333920955658,
1.8536165952682495,
-0.472467839717865,
0.6261249780654907,
-0.3669796288013458,
-1.2174599170684814,
0.847754180431366,
-0.26838603615760803,
-2.066866397857666,
-0.7565639615058899,
-0.6940391659736633,
-0.18846341967582703,
-0.7363191246986389,
0.9766172170639038,
-0.3098765015602112,
-1.3140308856964111,
0.2054842859506607,
-0.6556103229522705,
0.14853554964065552,
-1.2046319246292114,
0.3993091583251953,
0.7215924263000488,
-0.6150735020637512,
0.08001567423343658,
-0.2574612498283386,
-1.2179303169250488,
-0.4712732136249542,
0.3138259947299957,
1.834788203239441,
-0.7306937575340271,
0.9847047328948975,
1.0803509950637817,
-0.6592857241630554,
-0.10264580696821213,
0.32436850666999817,
-0.2849230170249939,
0.8247910737991333,
-0.9978760480880737,
-0.5035325288772583,
1.2582151889801025,
-0.26244229078292847,
-0.609704315662384,
1.4932047128677368,
0.7274640798568726,
-1.0089200735092163,
-0.2666280269622803,
-0.11189920455217361,
-0.8428474068641663,
0.08438720554113388,
-1.6222280263900757,
-0.031740639358758926,
0.5037580132484436,
-1.554004192352295,
-0.4081672728061676,
-0.15523801743984222,
1.3132820129394531,
-0.124399334192276,
1.4816333055496216,
-0.3110421895980835,
-0.1716161072254181,
-0.3911479413509369,
-0.34530577063560486,
0.12527936697006226,
-0.12243766337633133,
-0.5448832511901855,
0.23015885055065155,
-0.7189149260520935,
0.3800167739391327,
1.4512286186218262,
0.30409446358680725,
0.019052542746067047,
0.46758219599723816,
1.0926305055618286,
0.38666805624961853,
-0.11026934534311295,
-0.9244915843009949,
-1.5312517881393433,
2.011976957321167,
-1.411185622215271,
2.018913507461548,
0.8266667723655701,
-0.04404374957084656,
-1.7581491470336914,
-1.8806408643722534,
1.3255165815353394,
1.1527435779571533,
2.2522575855255127,
0.5236081480979919,
0.4124253988265991,
-0.8852459788322449,
-0.6402797698974609,
0.36940857768058777,
-1.0456252098083496,
-0.7187758088111877,
0.16112445294857025,
2.3561694622039795,
1.7806873321533203,
-0.3196685016155243,
-0.17017494142055511,
-1.1047719717025757,
1.3553032875061035,
-0.12935057282447815,
0.20720811188220978,
1.9812856912612915,
-0.26185181736946106,
-1.0971788167953491,
1.2421444654464722,
-2.33758544921875,
0.1639057844877243,
2.037961721420288,
0.27804821729660034,
0.06931442022323608,
-1.4271236658096313,
-0.559696614742279,
-0.2452780306339264,
-0.41500774025917053,
-1.258641242980957,
0.6146695017814636,
-0.32356807589530945,
-0.6926509141921997,
-1.3507272005081177,
0.20937977731227875,
-1.1365952491760254,
-1.6815723180770874,
0.14669278264045715,
1.8569717407226562,
2.0703492164611816,
-0.7057243585586548,
1.562809705734253,
-0.28304150700569153,
0.1457480937242508,
1.1975783109664917,
1.300986409187317,
3.1579020023345947,
1.9421721696853638,
-1.3680427074432373,
0.6059360504150391,
-0.16923585534095764,
-0.4760698080062866,
1.1437184810638428,
-1.2276408672332764,
1.3308018445968628,
-0.12900789082050323,
-1.2728512287139893,
-1.1790636777877808,
0.9328045845031738,
0.42863959074020386,
0.11957010626792908,
-0.4678685665130615,
1.1789571046829224,
0.15366464853286743,
1.3710359334945679,
0.5670675039291382,
-0.3557983338832855,
0.6476774215698242,
-0.4038623869419098,
-0.5256544947624207,
1.5548425912857056,
0.2170242965221405,
-1.3930764198303223,
-2.300875425338745,
-0.2572968304157257,
-0.881786584854126,
0.07505102455615997,
-0.683070182800293,
-0.9479402899742126,
1.625239372253418,
0.37703660130500793,
-1.3052401542663574,
-0.300563246011734,
-0.3167652189731598,
-0.5636900067329407,
2.7104856967926025,
-1.3567148447036743,
-0.22729624807834625,
-1.0247527360916138,
-0.6582937240600586,
1.612783432006836,
-1.271592378616333,
-0.21260966360569,
-1.0171226263046265,
-0.5198855996131897,
-1.2056125402450562,
-0.6178481578826904,
0.03162412345409393,
-0.9597651958465576,
0.8613771200180054,
0.20068906247615814,
-1.2662734985351562,
-0.38496601581573486,
-0.8938722014427185,
0.9129948616027832,
-0.13183467090129852,
0.20539988577365875,
1.7740364074707031,
0.3991423547267914,
-0.4088329076766968,
0.7967033386230469,
1.1592251062393188,
0.6895012259483337,
-0.6010379791259766,
0.251801460981369,
-0.7123509049415588,
0.33898013830184937,
-1.2289483547210693,
0.309429794549942,
-2.852731466293335,
0.5859745144844055,
-0.06624972820281982,
-0.05783282592892647,
-0.06597563624382019,
-1.3517206907272339,
1.033075213432312,
2.570566177368164,
-1.2037694454193115,
0.49003443121910095,
0.28504323959350586,
1.1857496500015259,
-1.6702464818954468,
0.31009846925735474,
-0.5211763381958008,
2.139895439147949,
0.19774314761161804,
1.227479338645935,
-0.41237178444862366,
-2.38010835647583,
0.6116867661476135,
-1.3468440771102905,
-1.1347756385803223,
0.8142577409744263,
-0.9079391360282898,
0.05981447547674179,
-1.316035509109497,
-0.27948421239852905,
-0.8119747042655945,
-1.2032660245895386,
0.6941831707954407,
0.1552603393793106,
0.48307177424430847,
-0.6175339818000793,
0.2662760019302368,
-2.207716464996338,
-1.2841260433197021,
-0.27472707629203796,
-0.9950864911079407,
0.45826655626296997,
-0.3858832120895386,
0.7148746252059937,
-0.19091428816318512,
-0.041730497032403946,
0.4207777678966522,
1.4697370529174805,
3.422948122024536,
0.19480375945568085,
0.32337328791618347,
-0.16848474740982056,
-0.9459398984909058,
1.4683661460876465,
0.9132167100906372,
-0.109221450984478,
-0.6002305746078491,
-1.009238839149475,
1.2353448867797852,
1.911766529083252,
0.9511762857437134,
-0.006541423499584198,
-0.7861744165420532,
-0.7058963775634766,
-0.056287653744220734,
0.16799286007881165,
0.48621973395347595,
0.8734109401702881,
0.0563146248459816,
0.07591401785612106,
1.3867961168289185,
1.176732063293457,
-0.37994080781936646,
0.2940128743648529,
-0.8200379610061646,
-0.4794737994670868,
0.5596126317977905,
0.24313221871852875,
-0.06046314164996147,
0.3654157221317291,
-0.9687808156013489,
-0.22146710753440857,
-0.41732537746429443,
-0.8975821733474731,
-0.7181075811386108,
-0.38028684258461,
-0.38652974367141724,
1.6497950553894043,
0.08143994212150574,
-0.5329153537750244,
0.023579664528369904,
-0.747759222984314,
-0.1520443558692932,
-1.0676206350326538,
0.23267313838005066,
-0.17066924273967743,
-0.08870898932218552,
-0.1383831799030304,
1.781697392463684,
-0.9425588846206665,
-2.0744056701660156,
0.26922842860221863,
0.1603982299566269,
-0.20296351611614227,
0.21506710350513458,
1.6365454196929932,
0.4862602949142456,
1.4398410320281982,
1.3994226455688477,
0.999700665473938,
-0.692752480506897,
-1.358072280883789,
0.8154308199882507,
1.0086089372634888,
-1.4417774677276611,
0.8125412464141846,
-0.04866030812263489,
-0.5257320404052734,
0.6650962233543396,
1.215242862701416,
0.5189864635467529,
-2.071570634841919,
0.8030419945716858,
-1.0553951263427734,
0.80748051404953,
0.774660587310791,
0.6954814195632935,
0.1812334805727005,
0.7845970392227173,
-1.1791434288024902,
-1.1587088108062744,
-0.6359027028083801,
-0.7487035989761353,
1.934775471687317,
-0.3678581416606903,
0.6263757944107056,
-0.1586126983165741,
-1.3824459314346313,
-0.12621647119522095,
0.6790077090263367,
0.28080540895462036,
-0.4723450541496277,
0.8252383470535278,
-0.7556443214416504,
-1.187980055809021,
-1.3723301887512207,
-0.4306444227695465,
-1.0937221050262451,
-0.8990345001220703,
1.1116268634796143,
0.784834623336792,
0.2622394263744354,
1.8223121166229248,
0.6783742904663086,
0.2656591534614563,
-2.64361572265625,
0.868053138256073,
0.2543427646160126,
-0.08715564757585526,
0.802842378616333,
0.35893163084983826,
0.9932440519332886,
0.03206196799874306,
0.5463810563087463,
-2.5169835090637207,
2.399829626083374,
-0.25694191455841064,
0.7123514413833618,
0.0018110312521457672,
-0.24840383231639862,
1.079972743988037,
0.5703396797180176,
0.5390801429748535,
-1.0646692514419556,
0.6991608738899231,
-0.5596018433570862,
1.2204159498214722,
0.8181807994842529,
-0.8226629495620728,
-0.02655140310525894,
1.3420687913894653,
0.5148924589157104,
-0.5714311003684998,
-0.8928929567337036,
-1.0165866613388062,
0.9443305134773254,
1.761942982673645,
-0.03202011063694954,
0.0668870359659195,
0.7956832051277161,
0.7001951932907104,
-1.1913275718688965,
0.07011698931455612,
-0.7020251750946045,
-0.7867382168769836,
1.5830053091049194,
2.046558380126953,
-0.14760616421699524,
-0.21454066038131714,
-0.7973780035972595,
-1.2246228456497192,
0.809328556060791,
-0.04151821881532669,
0.0651443749666214,
0.5776065587997437,
-0.5713353753089905,
1.0683263540267944,
0.9207415580749512,
0.9684550762176514,
0.31820520758628845,
0.20237286388874054,
0.3827182352542877,
-0.40731480717658997,
-1.0944793224334717,
-0.14248046278953552,
-1.0439671277999878,
-2.6172032356262207,
0.45336589217185974,
-0.25813862681388855,
-1.4403843879699707,
0.005914776585996151,
-1.036720633506775,
0.8786113262176514,
-0.5309873819351196,
-1.0797654390335083,
-1.5102092027664185,
0.13986457884311676,
-0.04038434848189354,
0.9119725227355957,
-1.6671438217163086,
-0.1467561572790146,
1.187636375427246,
0.8678491115570068,
-0.7102791666984558,
1.027347207069397,
0.22427934408187866,
1.0032322406768799,
0.855276882648468,
-0.36094075441360474,
0.47845572233200073,
0.06416253745555878,
-1.4012342691421509,
0.4032413065433502,
1.1730537414550781,
0.06555358320474625,
1.4621787071228027,
-0.5395427346229553,
0.02097216248512268,
0.38095906376838684,
-0.5002768039703369,
-0.5394724011421204,
-0.5372097492218018,
0.7131549119949341,
0.03636547178030014,
-0.8419260382652283,
0.03616313636302948,
-0.13836385309696198,
-0.24983471632003784,
0.12188142538070679,
-1.4772758483886719,
-0.21122406423091888,
-0.37081292271614075,
-0.6062433123588562,
-1.3277208805084229,
-0.1258884221315384,
1.4351381063461304,
-0.7134637832641602,
-0.18166127800941467,
0.506057858467102,
0.35308024287223816,
0.585713803768158,
0.6914894580841064,
-0.6541504859924316,
-0.3383365571498871,
-0.20524439215660095,
-0.2937467694282532,
0.3476657569408417,
1.3705185651779175,
-0.09538822621107101,
-0.8510226011276245,
0.7133631110191345,
-0.27471333742141724,
0.05974440276622772,
1.9487276077270508,
0.19753332436084747,
-0.7694099545478821,
0.2975751757621765,
-0.7305939793586731,
1.898545265197754,
1.696263313293457,
1.340859055519104,
-0.0995272845029831,
-0.9814994931221008,
0.6567543745040894,
-0.36800116300582886,
-0.35671934485435486,
0.8719167709350586,
0.36827531456947327,
-0.21347983181476593,
-1.3836336135864258,
0.7683832049369812,
1.2560762166976929,
-0.8164775967597961,
-0.7548648715019226,
0.15085791051387787,
-0.731731116771698,
1.060798168182373,
0.609004020690918,
0.3846302032470703,
0.22614122927188873,
1.586686611175537,
0.8231459259986877,
-0.4748479425907135,
0.5944653749465942,
0.5161910653114319,
-0.1988295316696167,
-2.1144187450408936,
-1.1679692268371582,
0.3234936594963074,
-0.5265353918075562,
-1.57208251953125,
1.3761097192764282,
-1.1434566974639893,
-1.0447670221328735,
0.541057288646698,
0.02263393998146057,
1.4261339902877808,
0.3667137324810028,
1.5362356901168823,
2.056978940963745,
0.8397693037986755,
0.4570539891719818,
1.3256193399429321,
-0.20201587677001953,
-0.4282276928424835,
1.8037282228469849,
-0.4606095850467682,
0.4189760386943817,
1.1138602495193481,
-0.3555126190185547,
-1.0615371465682983,
-0.7483879327774048,
-1.1862574815750122,
-0.7447010278701782,
1.188305139541626,
0.048487138003110886,
-0.9817389249801636,
0.3048039674758911,
1.505866289138794,
0.07822099328041077,
-0.25425660610198975,
0.6000908613204956,
0.3524427115917206,
-0.7749728560447693,
-0.08418545871973038,
-0.9397168755531311,
0.5724608898162842,
-0.26900461316108704,
-0.36910659074783325,
0.37901633977890015,
0.4537079632282257,
1.3024840354919434,
-0.08943026512861252,
0.14382854104042053,
1.0602905750274658,
-1.4613388776779175,
1.4262266159057617,
-0.7188724875450134,
0.25154808163642883,
-2.325192451477051,
1.3522553443908691,
-0.7539950013160706,
1.8995436429977417,
-2.6247167587280273,
0.3780437409877777,
-0.5675100684165955,
-0.5115915536880493,
0.3569408059120178,
-0.310339093208313,
0.107818603515625,
-0.22964408993721008,
-1.1035053730010986,
-0.046031806617975235,
-0.6747137904167175,
0.6274762749671936,
1.0855480432510376,
1.3483692407608032,
-1.0697335004806519,
-0.2850068509578705,
-1.69120454788208,
-0.13176117837429047,
-0.6823951005935669,
0.3188716173171997,
-1.964604139328003,
-0.16827084124088287,
-1.9746894836425781,
-2.3352129459381104,
-1.1739850044250488,
-0.8417510986328125,
1.1512571573257446,
0.24959062039852142,
-0.8291551470756531,
1.2158429622650146,
-0.35278308391571045,
-1.8700352907180786,
1.0496413707733154,
-2.1970717906951904
] |
https://github.com/huggingface/datasets/issues/6048 | when i use datasets.load_dataset, i encounter the http connect error! | The `audiofolder` loader is not available in version `2.3.2`, hence the error. Please run the `pip install -U datasets` command to update the `datasets` installation to make `load_dataset("audiofolder", ...)` work. | ### Describe the bug
`common_voice_test = load_dataset("audiofolder", data_dir="./dataset/",cache_dir="./cache",split=datasets.Split.TEST)`
when i run the code above, i got the error as below:
--------------------------------------------
ConnectionError: Couldn't reach https://raw.githubusercontent.com/huggingface/datasets/2.3.2/datasets/audiofolder/audiofolder.py (ConnectionError(MaxRetryError("HTTPSConnectionPool(host='raw.githubusercontent.com', port=443): Max retries exceeded with url: /huggingface/datasets/2.3.2/datasets/audiofolder/audiofolder.py (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f299ed082e0>: Failed to establish a new connection: [Errno 101] Network is unreachable'))")))
--------------------------------------------------
My all data is on local machine, why does it need to connect the internet? how can i fix it, because my machine cannot connect the internet.
### Steps to reproduce the bug
1
### Expected behavior
no error when i use the load_dataset func
### Environment info
python=3.8.15 | 24 | 30 | when i use datasets.load_dataset, i encounter the http connect error!
### Describe the bug
`common_voice_test = load_dataset("audiofolder", data_dir="./dataset/",cache_dir="./cache",split=datasets.Split.TEST)`
when i run the code above, i got the error as below:
--------------------------------------------
ConnectionError: Couldn't reach https://raw.githubusercontent.com/huggingface/datasets/2.3.2/datasets/audiofolder/audiofolder.py (ConnectionError(MaxRetryError("HTTPSConnectionPool(host='raw.githubusercontent.com', port=443): Max retries exceeded with url: /huggingface/datasets/2.3.2/datasets/audiofolder/audiofolder.py (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f299ed082e0>: Failed to establish a new connection: [Errno 101] Network is unreachable'))")))
--------------------------------------------------
My all data is on local machine, why does it need to connect the internet? how can i fix it, because my machine cannot connect the internet.
### Steps to reproduce the bug
1
### Expected behavior
no error when i use the load_dataset func
### Environment info
python=3.8.15
The `audiofolder` loader is not available in version `2.3.2`, hence the error. Please run the `pip install -U datasets` command to update the `datasets` installation to make `load_dataset("audiofolder", ...)` work. | [
-1.1496117115020752,
-0.7972938418388367,
-0.5717766880989075,
1.3664467334747314,
-0.026249855756759644,
-1.354591727256775,
0.0974016860127449,
-0.8682535290718079,
1.5897915363311768,
-0.8269336223602295,
0.35338395833969116,
-1.7552576065063477,
0.027949972078204155,
-0.5685946345329285,
-0.6554988026618958,
-0.6858051419258118,
-0.3321291208267212,
-0.6470736265182495,
1.114370346069336,
2.460339307785034,
1.1736494302749634,
-1.323357343673706,
2.8556859493255615,
0.6294866800308228,
-0.18386411666870117,
-0.8316305875778198,
0.4599401354789734,
-0.007841086015105247,
-1.5583491325378418,
-0.2614899277687073,
-1.0210483074188232,
-0.06418023258447647,
-0.6100621819496155,
-0.5219132304191589,
0.13294243812561035,
0.4107189178466797,
-0.1902366429567337,
-0.4721139073371887,
-0.4428354501724243,
-0.7433147430419922,
0.5649077892303467,
-0.31876322627067566,
0.8810073733329773,
-0.30870702862739563,
1.7874512672424316,
-0.582252025604248,
0.5411884784698486,
0.5625228881835938,
1.1637370586395264,
0.2597949802875519,
-0.02474788948893547,
0.47646594047546387,
0.31817176938056946,
0.08917924761772156,
0.541481077671051,
1.19391930103302,
0.6258018016815186,
0.5209311246871948,
0.7209696173667908,
-2.175018548965454,
1.317918062210083,
-0.7270951867103577,
0.17494605481624603,
1.3930109739303589,
-1.1385453939437866,
0.48636531829833984,
-1.9152922630310059,
-0.10831012576818466,
0.3961077034473419,
-2.2505600452423096,
0.06616516411304474,
-1.340348243713379,
-0.5496768951416016,
1.0433326959609985,
0.3307754099369049,
-1.2460261583328247,
-0.021609703078866005,
-0.3998429477214813,
0.9217023253440857,
0.3766312003135681,
1.1769517660140991,
-1.6196306943893433,
-0.004102838225662708,
-0.24128079414367676,
0.29340270161628723,
-1.1716228723526,
-1.602764368057251,
0.6310222148895264,
0.7711183428764343,
0.6405892968177795,
-0.1708027422428131,
0.8558168411254883,
-1.06102454662323,
0.8207327723503113,
-0.9175247550010681,
-1.9297105073928833,
-1.3556180000305176,
-2.434774398803711,
-2.3832147121429443,
0.805029034614563,
-0.3959115743637085,
-0.3517627716064453,
2.167146682739258,
-1.1996891498565674,
-1.7128896713256836,
1.0806522369384766,
0.23600557446479797,
-0.08681731671094894,
2.3693418502807617,
0.21264486014842987,
-0.9266912341117859,
0.6972068548202515,
-0.8606007099151611,
0.6321336030960083,
-0.3292299807071686,
1.2268494367599487,
0.38384416699409485,
-1.0964641571044922,
1.6137410402297974,
-0.44081151485443115,
0.5218912959098816,
-0.7074182629585266,
-0.3568548560142517,
-0.5271580219268799,
0.18706266582012177,
2.019383668899536,
-0.15139785408973694,
1.572386622428894,
-0.1569099873304367,
-1.4697319269180298,
-1.3893287181854248,
0.693518340587616,
0.5129662752151489,
-0.7923777103424072,
0.17197008430957794,
-0.33052873611450195,
0.11949815601110458,
0.17092002928256989,
1.0754481554031372,
1.304404854774475,
0.8085066676139832,
-0.14109286665916443,
-0.9382414817810059,
0.09788668900728226,
-0.041390560567379,
-0.5548637509346008,
-1.7063370943069458,
-0.2885386347770691,
0.12429428845643997,
0.6286389827728271,
-1.212645173072815,
1.8641107082366943,
0.8821069002151489,
2.0183844566345215,
1.0144535303115845,
-0.37059059739112854,
1.545527458190918,
0.1263311207294464,
1.9005262851715088,
-0.275107204914093,
0.6890144348144531,
-0.5352845788002014,
-1.1777148246765137,
0.6167657971382141,
-0.33054235577583313,
-1.9733376502990723,
-0.32785144448280334,
-0.9295326471328735,
-0.07291420549154282,
-0.8729577660560608,
1.0317504405975342,
-0.1498267948627472,
-1.3408795595169067,
0.25179290771484375,
-0.642651379108429,
0.09117726981639862,
-1.47907555103302,
0.2592662572860718,
0.7599743604660034,
-0.7363568544387817,
0.046383388340473175,
-0.45312193036079407,
-1.4097996950149536,
-0.6243100166320801,
0.48496559262275696,
1.7293481826782227,
-0.6664251089096069,
1.04315984249115,
1.0553971529006958,
-0.6166799068450928,
-0.1042952761054039,
0.5087687969207764,
-0.4391618072986603,
0.8551678657531738,
-0.9747480750083923,
-0.4116305112838745,
1.125620722770691,
-0.3443693518638611,
-0.4463321268558502,
1.3027782440185547,
0.7402434945106506,
-1.0278486013412476,
-0.33537402749061584,
-0.10716503858566284,
-0.8148506283760071,
0.040564730763435364,
-1.6604140996932983,
-0.10302472114562988,
0.21973095834255219,
-1.5026768445968628,
-0.5126963257789612,
-0.0709376260638237,
1.3008551597595215,
0.03748432546854019,
1.3619345426559448,
-0.2364329695701599,
-0.132489413022995,
-0.599581778049469,
-0.6065481901168823,
0.08718064427375793,
-0.12228202819824219,
-0.6611356139183044,
0.32609114050865173,
-0.6935513615608215,
0.16440033912658691,
1.473953366279602,
0.2549234628677368,
0.14308685064315796,
0.5588032007217407,
1.1747850179672241,
0.32532837986946106,
-0.21799181401729584,
-0.8580285310745239,
-1.7210109233856201,
2.0068445205688477,
-1.5968512296676636,
1.970452070236206,
0.8156163692474365,
-0.07998869568109512,
-1.7994983196258545,
-1.8563495874404907,
1.5449377298355103,
1.1011366844177246,
2.5079193115234375,
0.542366087436676,
0.4983460307121277,
-0.8192741870880127,
-0.6455765962600708,
0.47037482261657715,
-0.6728885173797607,
-0.9331998229026794,
0.1572834998369217,
2.3370766639709473,
1.6691360473632812,
-0.4001569449901581,
-0.13110363483428955,
-0.9945748448371887,
1.328732967376709,
-0.28595390915870667,
0.24605591595172882,
1.8569345474243164,
-0.4212886393070221,
-1.0289955139160156,
1.24851655960083,
-2.367429733276367,
0.31827518343925476,
1.998326301574707,
0.2888568043708801,
0.03848502039909363,
-1.1830066442489624,
-0.7333730459213257,
-0.15032172203063965,
-0.40612903237342834,
-1.2275917530059814,
0.4000891149044037,
-0.24936997890472412,
-0.8283989429473877,
-1.392041563987732,
-0.022041920572519302,
-1.2168840169906616,
-1.7495331764221191,
0.27289026975631714,
1.7928162813186646,
2.1074929237365723,
-0.7620320320129395,
1.3107670545578003,
-0.25760334730148315,
0.30507221817970276,
1.1898456811904907,
1.2507935762405396,
3.231210708618164,
1.9454090595245361,
-1.2197006940841675,
0.7726446390151978,
-0.14010930061340332,
-0.4853207468986511,
1.1997054815292358,
-0.9894187450408936,
1.2254741191864014,
-0.2510933578014374,
-1.3737738132476807,
-1.1780378818511963,
0.8741240501403809,
0.4559457302093506,
-0.08422178775072098,
-0.42738601565361023,
1.093841791152954,
0.20404043793678284,
1.3437846899032593,
0.6167137026786804,
-0.31175753474235535,
0.5790061950683594,
-0.30315083265304565,
-0.5426087975502014,
1.5489612817764282,
0.053113892674446106,
-1.576826572418213,
-2.3170197010040283,
-0.22633866965770721,
-1.0380481481552124,
-0.03280971944332123,
-0.9039924740791321,
-1.0068333148956299,
1.5052605867385864,
0.5159097909927368,
-0.9148318767547607,
-0.1013697013258934,
-0.48245444893836975,
-0.6199550032615662,
2.5913963317871094,
-1.4246383905410767,
-0.24621471762657166,
-0.9466681480407715,
-0.650689959526062,
1.4949733018875122,
-1.1642634868621826,
-0.24852800369262695,
-1.052000641822815,
-0.537220299243927,
-1.259293556213379,
-0.43713781237602234,
-0.0778297558426857,
-0.7987565398216248,
0.7291257977485657,
-0.05490424484014511,
-1.2363336086273193,
-0.2423946112394333,
-1.118891954421997,
0.8327987194061279,
-0.2676795423030853,
-0.05471917241811752,
1.758301854133606,
0.2836894094944,
-0.4257444441318512,
0.765613317489624,
1.2815662622451782,
0.5848179459571838,
-0.5421578884124756,
0.2777937352657318,
-0.6543374061584473,
0.4885258376598358,
-1.1868704557418823,
0.32558637857437134,
-2.8907833099365234,
0.6567074656486511,
-0.005842064507305622,
-0.03109055757522583,
-0.14239582419395447,
-1.392086148262024,
0.8997663259506226,
2.4153895378112793,
-1.1486936807632446,
0.669167160987854,
0.2494143694639206,
1.238214135169983,
-1.6518114805221558,
0.025855140760540962,
-0.6464523077011108,
2.0212621688842773,
0.03068545274436474,
1.0223300457000732,
-0.5432500839233398,
-2.3063833713531494,
0.5639987587928772,
-1.1860710382461548,
-0.9311071038246155,
0.7719416618347168,
-0.8563648462295532,
0.21700049936771393,
-1.0893864631652832,
-0.0944976955652237,
-0.884541928768158,
-1.1163305044174194,
0.5129727721214294,
0.06217430531978607,
0.6765035390853882,
-0.6058045625686646,
0.26077160239219666,
-2.310572624206543,
-1.4009857177734375,
-0.19606736302375793,
-0.9000125527381897,
0.46366721391677856,
-0.33123084902763367,
0.7377006411552429,
-0.15590313076972961,
0.03222333639860153,
0.289797842502594,
1.4613432884216309,
3.171543836593628,
-0.04088745638728142,
0.35134536027908325,
-0.2421647012233734,
-1.1051349639892578,
1.56687593460083,
0.9227190613746643,
-0.2853491008281708,
-0.6197800636291504,
-0.9847130179405212,
1.369284987449646,
1.8744916915893555,
1.1106747388839722,
0.13565291464328766,
-0.9151912927627563,
-0.7934436202049255,
0.14625224471092224,
0.1207675114274025,
0.48111024498939514,
1.0125433206558228,
0.14113689959049225,
0.2279006391763687,
1.4250479936599731,
1.0309312343597412,
-0.28263694047927856,
0.48625558614730835,
-0.8295280337333679,
-0.4288823902606964,
0.5720808506011963,
0.39327192306518555,
0.018386727198958397,
0.20487263798713684,
-1.0535072088241577,
-0.18962080776691437,
-0.23648251593112946,
-0.8729391694068909,
-0.7159273028373718,
-0.39857208728790283,
-0.3863639533519745,
1.7629311084747314,
-0.09835527092218399,
-0.5309122204780579,
-0.006681689061224461,
-0.8220818042755127,
-0.08803678303956985,
-0.955130934715271,
0.32465094327926636,
-0.15587681531906128,
0.10987681895494461,
-0.11346187442541122,
1.6299362182617188,
-0.9794016480445862,
-2.2653679847717285,
0.1808996945619583,
0.20657682418823242,
-0.3017526865005493,
-0.09741611778736115,
1.7807875871658325,
0.5528081059455872,
1.3686556816101074,
1.6175659894943237,
1.1111479997634888,
-0.6014813780784607,
-1.4116495847702026,
0.7061309814453125,
0.9458845257759094,
-1.3317283391952515,
0.8755969405174255,
-0.20641151070594788,
-0.6069523692131042,
0.5069078803062439,
1.317697525024414,
0.4206511974334717,
-1.9057328701019287,
0.8761683106422424,
-1.098465919494629,
0.930934727191925,
0.8156960010528564,
0.8691990375518799,
0.07746469974517822,
0.8654929399490356,
-1.219688057899475,
-1.0468858480453491,
-0.588864266872406,
-0.679433286190033,
1.8309868574142456,
-0.16421757638454437,
0.2984963357448578,
-0.3335161507129669,
-1.2846490144729614,
0.16520316898822784,
0.603767991065979,
0.30473801493644714,
-0.33495205640792847,
0.723137378692627,
-0.7308019399642944,
-1.158528447151184,
-1.3870036602020264,
-0.454267293214798,
-1.031302809715271,
-0.8326810598373413,
1.0283945798873901,
0.7500924468040466,
0.5156446099281311,
1.930945634841919,
0.6850270628929138,
0.1963409036397934,
-2.6628777980804443,
0.8702978491783142,
0.3385312855243683,
-0.10294961929321289,
0.8322046995162964,
0.24870921671390533,
1.2722707986831665,
-0.2351476550102234,
0.6105657815933228,
-2.281574010848999,
2.2581253051757812,
-0.2988951504230499,
0.7666804790496826,
0.09087938070297241,
0.07409239560365677,
0.9466309547424316,
0.573332667350769,
0.5844878554344177,
-1.1102865934371948,
0.9476518034934998,
-0.5951004028320312,
1.1697216033935547,
0.8354023098945618,
-0.9193970561027527,
0.12704458832740784,
1.1823256015777588,
0.38285812735557556,
-0.5498171448707581,
-0.9905532002449036,
-0.858361005783081,
0.9453873038291931,
1.780330777168274,
0.009229490533471107,
0.12308403104543686,
0.8241925239562988,
0.7505611777305603,
-1.3306010961532593,
-0.0016472572460770607,
-0.5674235820770264,
-0.6577142477035522,
1.7905491590499878,
2.0720462799072266,
0.03145714849233627,
-0.1137871965765953,
-0.7215467691421509,
-1.469542384147644,
0.8277547359466553,
0.16149285435676575,
-0.07799115777015686,
0.883117139339447,
-0.6721137762069702,
1.229618787765503,
0.8259115219116211,
0.8800656199455261,
0.2899481952190399,
-0.008345418609678745,
0.2333691418170929,
-0.22899021208286285,
-1.202262043952942,
-0.33450543880462646,
-0.9209927320480347,
-2.5187325477600098,
0.4135262966156006,
-0.2600574195384979,
-1.4928058385849,
0.11863382905721664,
-0.9526193141937256,
0.7145422101020813,
-0.5460931062698364,
-1.1908316612243652,
-1.3129968643188477,
0.233291894197464,
-0.18333841860294342,
0.7252986431121826,
-1.6499998569488525,
-0.15787774324417114,
1.1683732271194458,
1.0158600807189941,
-0.6408657431602478,
0.9023959636688232,
0.299311101436615,
0.8994495272636414,
0.9423165917396545,
-0.37296879291534424,
0.4495089054107666,
0.2254730612039566,
-1.3329155445098877,
0.3236316442489624,
1.3713393211364746,
0.2192455679178238,
1.3327302932739258,
-0.5067419409751892,
-0.02394185960292816,
0.42392754554748535,
-0.169968381524086,
-0.5257584452629089,
-0.7921698093414307,
0.6024690866470337,
-0.16784752905368805,
-0.9650806188583374,
-0.11760040372610092,
0.012584589421749115,
-0.08019942790269852,
0.33565983176231384,
-1.4615048170089722,
-0.057838134467601776,
-0.37748512625694275,
-0.6232602596282959,
-1.399364709854126,
-0.13400748372077942,
1.3328155279159546,
-0.8982664942741394,
-0.046438559889793396,
0.5738433003425598,
0.16647180914878845,
0.4984816908836365,
0.6455799341201782,
-0.7867518067359924,
-0.19376428425312042,
-0.05813240259885788,
-0.471632719039917,
0.2541804313659668,
1.3008402585983276,
-0.15341047942638397,
-1.0124503374099731,
0.444037526845932,
-0.2641123831272125,
0.2303439825773239,
1.931958794593811,
0.06552401185035706,
-0.9180443286895752,
0.3516140580177307,
-0.7859213352203369,
1.889033317565918,
1.6482316255569458,
1.3808927536010742,
-0.09502905607223511,
-0.9236264228820801,
0.5685643553733826,
-0.3031446635723114,
-0.3568046987056732,
0.9188811779022217,
0.369091272354126,
-0.31504374742507935,
-1.3568216562271118,
0.7899091839790344,
1.2228070497512817,
-0.8168486952781677,
-0.7420438528060913,
0.07538557797670364,
-0.8247998356819153,
1.19963800907135,
0.7404229044914246,
0.3503408432006836,
0.2577311396598816,
1.707341194152832,
0.7183049321174622,
-0.6031409502029419,
0.49301183223724365,
0.4321269094944,
-0.17812514305114746,
-1.955783486366272,
-1.097161054611206,
0.25198620557785034,
-0.4572165310382843,
-1.518727421760559,
1.4344773292541504,
-1.2856535911560059,
-0.98702472448349,
0.5172820687294006,
0.1651023030281067,
1.39370858669281,
0.33743610978126526,
1.7209805250167847,
1.994882583618164,
0.9754965305328369,
0.5204528570175171,
1.146014928817749,
-0.22681598365306854,
-0.1954101324081421,
1.6340669393539429,
-0.4815823435783386,
0.6415764093399048,
1.0193417072296143,
-0.48494231700897217,
-1.1939187049865723,
-0.8858674168586731,
-1.1677896976470947,
-0.7784450650215149,
1.0002448558807373,
0.15551209449768066,
-1.117336392402649,
0.337344229221344,
1.5502912998199463,
-0.004435552284121513,
-0.12671594321727753,
0.7746973037719727,
0.367057740688324,
-0.6533042788505554,
-0.11691590398550034,
-1.0731902122497559,
0.6178777813911438,
-0.378568172454834,
-0.41791775822639465,
0.18747884035110474,
0.5616822242736816,
1.2321420907974243,
0.2214505821466446,
0.1078200414776802,
1.4510499238967896,
-1.3097059726715088,
1.2020809650421143,
-1.033530831336975,
0.3896394371986389,
-2.2399544715881348,
1.5018692016601562,
-0.9744244813919067,
1.9022611379623413,
-2.7083280086517334,
0.49571073055267334,
-0.4859450161457062,
-0.6006907224655151,
0.14618368446826935,
-0.14531546831130981,
0.091877281665802,
-0.058297500014305115,
-1.0896762609481812,
-0.13958077132701874,
-0.8991063833236694,
0.47503355145454407,
1.2298455238342285,
1.3787199258804321,
-0.9281426668167114,
-0.293862909078598,
-1.6715816259384155,
-0.17223961651325226,
-0.45088690519332886,
0.2222994863986969,
-1.748863935470581,
-0.17968280613422394,
-2.064439296722412,
-2.505173921585083,
-1.3803937435150146,
-1.0311229228973389,
1.368121862411499,
0.10907164216041565,
-0.8821243047714233,
1.1502952575683594,
-0.43275463581085205,
-1.770488977432251,
1.1940521001815796,
-2.2300591468811035
] |
https://github.com/huggingface/datasets/issues/6043 | Compression kwargs have no effect when saving datasets as csv | Hello @exs-avianello, I have reproduced the bug successfully and have understood the problem. But I am confused regarding this part of the statement, "`pandas.DataFrame.to_csv` is always called with a buf-like `path_or_buf`".
Can you please elaborate on it?
Thanks! | ### Describe the bug
Attempting to save a dataset as a compressed csv file, the compression kwargs provided to `.to_csv()` that get piped to panda's `pandas.DataFrame.to_csv` do not have any effect - resulting in the dataset not getting compressed.
A warning is raised if explicitly providing a `compression` kwarg, but no warnings are raised if relying on the defaults. This can lead to datasets secretly not getting compressed for users expecting the behaviour to match panda's `.to_csv()`, where the compression format is automatically inferred from the destination path suffix.
### Steps to reproduce the bug
```python
# dataset is not compressed (but at least a warning is emitted)
import datasets
dataset = datasets.load_dataset("rotten_tomatoes", split="train")
dataset.to_csv("uncompressed.csv")
print(os.path.getsize("uncompressed.csv")) # 1008607
dataset.to_csv("compressed.csv.gz", compression={'method': 'gzip', 'compresslevel': 1, 'mtime': 1})
print(os.path.getsize("compressed.csv.gz")) # 1008607
```
```shell
>>>
RuntimeWarning: compression has no effect when passing a non-binary object as input.
csv_str = batch.to_pandas().to_csv(
```
```python
# dataset is not compressed and no warnings are emitted
dataset.to_csv("compressed.csv.gz")
print(os.path.getsize("compressed.csv.gz")) # 1008607
# compare with
dataset.to_pandas().to_csv("pandas.csv.gz")
print(os.path.getsize("pandas.csv.gz")) # 418561
```
---
I think that this is because behind the scenes `pandas.DataFrame.to_csv` is always called with a buf-like `path_or_buf`, but users that are providing a path-like to `datasets.Dataset.to_csv` are likely not to expect / know that - leading to a mismatch in their understanding of the expected behaviour of the `compression` kwarg.
### Expected behavior
The dataset to be saved as a compressed csv file when providing a `compression` kwarg, or when relying on the default `compression='infer'`
### Environment info
`datasets == 2.13.1`
| 25 | 38 | Compression kwargs have no effect when saving datasets as csv
### Describe the bug
Attempting to save a dataset as a compressed csv file, the compression kwargs provided to `.to_csv()` that get piped to panda's `pandas.DataFrame.to_csv` do not have any effect - resulting in the dataset not getting compressed.
A warning is raised if explicitly providing a `compression` kwarg, but no warnings are raised if relying on the defaults. This can lead to datasets secretly not getting compressed for users expecting the behaviour to match panda's `.to_csv()`, where the compression format is automatically inferred from the destination path suffix.
### Steps to reproduce the bug
```python
# dataset is not compressed (but at least a warning is emitted)
import datasets
dataset = datasets.load_dataset("rotten_tomatoes", split="train")
dataset.to_csv("uncompressed.csv")
print(os.path.getsize("uncompressed.csv")) # 1008607
dataset.to_csv("compressed.csv.gz", compression={'method': 'gzip', 'compresslevel': 1, 'mtime': 1})
print(os.path.getsize("compressed.csv.gz")) # 1008607
```
```shell
>>>
RuntimeWarning: compression has no effect when passing a non-binary object as input.
csv_str = batch.to_pandas().to_csv(
```
```python
# dataset is not compressed and no warnings are emitted
dataset.to_csv("compressed.csv.gz")
print(os.path.getsize("compressed.csv.gz")) # 1008607
# compare with
dataset.to_pandas().to_csv("pandas.csv.gz")
print(os.path.getsize("pandas.csv.gz")) # 418561
```
---
I think that this is because behind the scenes `pandas.DataFrame.to_csv` is always called with a buf-like `path_or_buf`, but users that are providing a path-like to `datasets.Dataset.to_csv` are likely not to expect / know that - leading to a mismatch in their understanding of the expected behaviour of the `compression` kwarg.
### Expected behavior
The dataset to be saved as a compressed csv file when providing a `compression` kwarg, or when relying on the default `compression='infer'`
### Environment info
`datasets == 2.13.1`
Hello @exs-avianello, I have reproduced the bug successfully and have understood the problem. But I am confused regarding this part of the statement, "`pandas.DataFrame.to_csv` is always called with a buf-like `path_or_buf`".
Can you please elaborate on it?
Thanks! | [
-1.1168360710144043,
-0.900812566280365,
-0.7744753956794739,
1.420461654663086,
-0.10985736548900604,
-1.2823952436447144,
0.10812487453222275,
-1.1060352325439453,
1.7183713912963867,
-0.8180946111679077,
0.30754318833351135,
-1.7111681699752808,
-0.037234142422676086,
-0.6284632682800293,
-0.7869439721107483,
-0.842337965965271,
-0.3671760559082031,
-0.7356948852539062,
1.0616806745529175,
2.532766819000244,
1.1255848407745361,
-1.3166515827178955,
2.645268440246582,
0.7567117810249329,
-0.09349629282951355,
-0.9773021936416626,
0.6166613101959229,
-0.05566178634762764,
-1.3202784061431885,
-0.3777313828468323,
-0.976398229598999,
-0.09636224806308746,
-0.5742902755737305,
-0.5596725344657898,
0.10166124254465103,
0.35852500796318054,
-0.31098708510398865,
-0.5040317177772522,
-0.7136236429214478,
-0.7985639572143555,
0.446877658367157,
-0.494199275970459,
0.9638375639915466,
-0.31646132469177246,
1.8036441802978516,
-0.6311697363853455,
0.4995254576206207,
0.7608989477157593,
1.3689486980438232,
0.21106350421905518,
0.018131215125322342,
0.4492940902709961,
0.37609395384788513,
0.06759265065193176,
0.5326135754585266,
1.11244797706604,
0.6211467981338501,
0.4901892840862274,
0.8133689165115356,
-2.2875254154205322,
1.3365628719329834,
-1.018896460533142,
0.24848662316799164,
1.3066656589508057,
-0.9322461485862732,
0.3483022153377533,
-1.820330023765564,
-0.007575477939099073,
0.48830586671829224,
-2.266836166381836,
0.28881749510765076,
-1.4255239963531494,
-0.4513356387615204,
1.0744197368621826,
0.47918862104415894,
-1.2201086282730103,
0.15822993218898773,
-0.39245355129241943,
0.904414713382721,
0.47625061869621277,
1.1169764995574951,
-1.7270770072937012,
-0.14570334553718567,
-0.28595131635665894,
0.09915205836296082,
-1.2110257148742676,
-1.506848692893982,
0.6141206622123718,
0.7950940728187561,
0.534454882144928,
-0.2153249830007553,
0.9809665083885193,
-1.024024248123169,
0.7056279182434082,
-0.9511116147041321,
-1.851266622543335,
-1.5006721019744873,
-2.168666362762451,
-2.289398193359375,
0.7580740451812744,
-0.5142483711242676,
-0.480497807264328,
2.0463414192199707,
-1.0565438270568848,
-1.7535772323608398,
1.126138687133789,
0.19421438872814178,
-0.014116848818957806,
2.2924513816833496,
0.2827785313129425,
-0.6294167637825012,
0.46312952041625977,
-0.7297751903533936,
0.7052890062332153,
-0.29096925258636475,
1.300283432006836,
0.4354283809661865,
-1.0290502309799194,
1.6892845630645752,
-0.33662453293800354,
0.5764448046684265,
-0.6458566188812256,
-0.3485567271709442,
-0.721570611000061,
0.3467790484428406,
1.9288711547851562,
-0.26486602425575256,
1.566208839416504,
-0.3556104898452759,
-1.663101315498352,
-1.6912245750427246,
0.8407086133956909,
0.5458827614784241,
-0.7145107388496399,
0.12283540517091751,
-0.4115927517414093,
0.20062409341335297,
0.04442141577601433,
1.2501733303070068,
1.349433422088623,
0.7620142102241516,
-0.36444225907325745,
-0.8268612623214722,
0.16021601855754852,
0.08235783874988556,
-0.7760504484176636,
-1.7979854345321655,
-0.47937700152397156,
0.20667734742164612,
0.6025454998016357,
-1.114196538925171,
1.7836555242538452,
0.9135195016860962,
1.830004334449768,
1.1420972347259521,
-0.31335124373435974,
1.4864271879196167,
0.08891359716653824,
1.9674263000488281,
-0.4325464963912964,
0.5953192710876465,
-0.3854287266731262,
-1.1607589721679688,
0.7500196695327759,
-0.32228463888168335,
-2.0464274883270264,
-0.7968129515647888,
-0.8075549006462097,
-0.18170644342899323,
-0.6517871618270874,
0.9451525211334229,
-0.26643237471580505,
-1.29752516746521,
0.13507485389709473,
-0.8206679821014404,
0.07140497118234634,
-1.1798527240753174,
0.1861151158809662,
0.6935595870018005,
-0.6966843008995056,
0.15944696962833405,
-0.2999487817287445,
-1.3526554107666016,
-0.32391589879989624,
0.23322689533233643,
1.8739148378372192,
-0.8825843334197998,
0.8714936375617981,
1.064733624458313,
-0.7699570059776306,
0.034596022218465805,
0.34973448514938354,
-0.3675767779350281,
0.7749691605567932,
-1.0115822553634644,
-0.38305535912513733,
1.1836892366409302,
-0.09567401558160782,
-0.6227789521217346,
1.408817172050476,
0.6702714562416077,
-1.0563315153121948,
-0.22539694607257843,
-0.17784395813941956,
-0.8063299655914307,
-0.058175601065158844,
-1.6710784435272217,
-0.1469515860080719,
0.3936710059642792,
-1.5561038255691528,
-0.5161765813827515,
-0.2653748691082001,
1.2477893829345703,
-0.03428920358419418,
1.3296773433685303,
-0.32995739579200745,
-0.1332741230726242,
-0.43456852436065674,
-0.41348230838775635,
0.19125543534755707,
-0.2157396674156189,
-0.7187992334365845,
0.2687373757362366,
-0.7667214274406433,
0.33373793959617615,
1.4905917644500732,
0.34842050075531006,
0.05204924941062927,
0.6110513210296631,
1.0453757047653198,
0.3672043979167938,
-0.09485867619514465,
-0.8096666932106018,
-1.758788824081421,
2.0724403858184814,
-1.4711682796478271,
1.9071425199508667,
0.6761040091514587,
0.03390415385365486,
-1.8640395402908325,
-1.8880072832107544,
1.279821515083313,
1.1217892169952393,
2.389890670776367,
0.5811727643013,
0.4804229438304901,
-0.8068696856498718,
-0.6174143552780151,
0.4957487881183624,
-1.04564368724823,
-0.7394556999206543,
0.09938988089561462,
2.3281819820404053,
1.778638482093811,
-0.48802682757377625,
-0.16564753651618958,
-1.0008045434951782,
1.3430627584457397,
-0.2048022300004959,
0.28711241483688354,
2.0497050285339355,
-0.22866904735565186,
-1.0128633975982666,
1.396729588508606,
-2.2777512073516846,
0.1711389422416687,
1.9684020280838013,
0.16737522184848785,
0.09890024363994598,
-1.3984225988388062,
-0.6181963682174683,
-0.2573154866695404,
-0.37722739577293396,
-1.2389984130859375,
0.5218323469161987,
-0.25218257308006287,
-0.7651563286781311,
-1.4202053546905518,
0.14990262687206268,
-1.1484063863754272,
-1.6171650886535645,
0.14455266296863556,
1.8377320766448975,
1.967905879020691,
-0.7513781189918518,
1.5025120973587036,
-0.30739447474479675,
0.12894757091999054,
1.2449928522109985,
1.2191004753112793,
3.1212518215179443,
1.929624319076538,
-1.304192066192627,
0.7167882919311523,
-0.18697954714298248,
-0.42369067668914795,
1.177715539932251,
-1.1448062658309937,
1.2763442993164062,
-0.13625657558441162,
-1.182474970817566,
-1.068400502204895,
0.9211666584014893,
0.48391056060791016,
0.0009282240644097328,
-0.36788737773895264,
1.2570511102676392,
-0.038507141172885895,
1.28501296043396,
0.5323913097381592,
-0.4617323875427246,
0.6797618269920349,
-0.3290531635284424,
-0.5199142098426819,
1.5442482233047485,
0.32342496514320374,
-1.3147752285003662,
-2.2026896476745605,
-0.1490582376718521,
-0.9334180951118469,
0.052528541535139084,
-0.622979998588562,
-0.838523268699646,
1.64137601852417,
0.29920056462287903,
-1.2682809829711914,
-0.20217837393283844,
-0.3712664246559143,
-0.6142124533653259,
2.71854305267334,
-1.4532090425491333,
-0.18033315241336823,
-0.9936212301254272,
-0.6311256289482117,
1.6625289916992188,
-1.258117437362671,
-0.2985090911388397,
-1.0076719522476196,
-0.4274568259716034,
-1.220940113067627,
-0.6088318824768066,
-0.05192135274410248,
-0.9478578567504883,
0.8675135374069214,
0.12345094233751297,
-1.2241551876068115,
-0.3060780465602875,
-0.88885098695755,
0.933856725692749,
-0.14618255198001862,
0.1466057449579239,
2.001352310180664,
0.4044506251811981,
-0.39783817529678345,
0.722306489944458,
1.1244443655014038,
0.6461051106452942,
-0.6114622354507446,
0.25871825218200684,
-0.7199416756629944,
0.2791399359703064,
-1.409805178642273,
0.2696192264556885,
-2.7687017917633057,
0.6320080161094666,
-0.07683800905942917,
-0.06988044083118439,
0.06797594577074051,
-1.297698974609375,
0.9798740744590759,
2.6271212100982666,
-1.263397455215454,
0.4668472111225128,
0.2522924840450287,
1.2313708066940308,
-1.4571534395217896,
0.3198564648628235,
-0.3339794874191284,
2.0197231769561768,
0.2429809421300888,
1.1141937971115112,
-0.3552550673484802,
-2.160320520401001,
0.718073308467865,
-1.2501927614212036,
-1.1299763917922974,
0.8037776947021484,
-0.8973177075386047,
0.061570290476083755,
-1.3330713510513306,
-0.1981625109910965,
-0.7481260895729065,
-1.1612008810043335,
0.7095200419425964,
0.12690241634845734,
0.4294700622558594,
-0.5115002989768982,
0.3266318142414093,
-2.1844966411590576,
-1.2933628559112549,
-0.25756916403770447,
-0.9423646926879883,
0.4938717782497406,
-0.27222955226898193,
0.6765274405479431,
-0.18922238051891327,
0.03519811853766441,
0.4274655878543854,
1.4842743873596191,
3.421665906906128,
0.0789274200797081,
0.32015520334243774,
-0.24945636093616486,
-0.950030505657196,
1.4185600280761719,
0.904325544834137,
-0.21215687692165375,
-0.617883563041687,
-1.2050150632858276,
1.2342921495437622,
1.9606907367706299,
0.9133440852165222,
0.011826115660369396,
-0.8945465683937073,
-0.8844719529151917,
0.031226005405187607,
0.06538525968790054,
0.4929474890232086,
0.921115517616272,
0.19028182327747345,
0.0375988595187664,
1.5231260061264038,
1.1475645303726196,
-0.36243170499801636,
0.36536362767219543,
-0.8752488493919373,
-0.42628151178359985,
0.5323021411895752,
0.3001575469970703,
0.024018600583076477,
0.19426627457141876,
-1.064638376235962,
-0.20445947349071503,
-0.33655786514282227,
-0.8749420046806335,
-0.8020851612091064,
-0.504220724105835,
-0.30137941241264343,
1.6815396547317505,
0.20242692530155182,
-0.5125110149383545,
-0.1316855251789093,
-0.7716248035430908,
-0.050954729318618774,
-0.9916427731513977,
0.2874681055545807,
-0.057919230312108994,
-0.18869614601135254,
-0.08873023092746735,
1.673539400100708,
-0.9641121029853821,
-2.0176985263824463,
0.2586468458175659,
0.10223458707332611,
-0.3718169629573822,
0.16095079481601715,
1.7109569311141968,
0.5955833196640015,
1.3704283237457275,
1.3109004497528076,
0.9080963730812073,
-0.663645327091217,
-1.271849513053894,
0.45734816789627075,
0.919952392578125,
-1.3990533351898193,
0.7817223072052002,
-0.05303115397691727,
-0.4536408483982086,
0.5580140948295593,
1.2809014320373535,
0.4749314785003662,
-2.0102622509002686,
0.7832150459289551,
-0.964293897151947,
0.6752253174781799,
0.68287593126297,
0.7484361529350281,
0.1632176786661148,
0.7684286236763,
-1.2213361263275146,
-1.2379555702209473,
-0.7701852321624756,
-0.7478219270706177,
1.9601500034332275,
-0.20160040259361267,
0.44297149777412415,
-0.14194723963737488,
-1.4377254247665405,
-0.16175201535224915,
0.7084659934043884,
0.32437649369239807,
-0.5439755320549011,
0.7792975902557373,
-0.6709127426147461,
-1.1346887350082397,
-1.4023131132125854,
-0.5349937081336975,
-0.9878829717636108,
-0.8858718276023865,
1.0318039655685425,
0.8895888924598694,
0.23941074311733246,
1.9226700067520142,
0.6057333946228027,
0.3071776032447815,
-2.653193950653076,
0.9515537023544312,
0.252420574426651,
0.059886764734983444,
0.8816747069358826,
0.3458428680896759,
0.9873824715614319,
-0.2075764387845993,
0.5011532306671143,
-2.394563913345337,
2.3293471336364746,
-0.24723678827285767,
0.5960133671760559,
0.036511898040771484,
-0.09551077336072922,
0.9958280920982361,
0.5002396702766418,
0.6725394129753113,
-1.0467017889022827,
0.5530056357383728,
-0.6914710998535156,
1.1693099737167358,
0.8716542720794678,
-0.8221427798271179,
-0.02784329652786255,
1.3482853174209595,
0.43047329783439636,
-0.6722403168678284,
-0.9738211035728455,
-1.1328092813491821,
0.9710649847984314,
1.8631229400634766,
-0.1154145747423172,
-0.06950792670249939,
0.7930203676223755,
0.5401875972747803,
-1.3991403579711914,
0.0001270519569516182,
-0.6719309687614441,
-0.709580659866333,
1.5323450565338135,
2.116025447845459,
-0.17889197170734406,
-0.22693760693073273,
-0.7301150560379028,
-1.2563554048538208,
0.7349393963813782,
0.07140247523784637,
0.11438753455877304,
0.7892283797264099,
-0.6197546720504761,
1.1631698608398438,
0.8658387660980225,
0.9699316024780273,
0.19303441047668457,
0.3496834933757782,
0.40615391731262207,
-0.28277450799942017,
-1.131630301475525,
-0.3580804765224457,
-0.9951796531677246,
-2.507779836654663,
0.5602849721908569,
-0.13964715600013733,
-1.5078333616256714,
0.03564264625310898,
-1.0343315601348877,
0.9481561183929443,
-0.4620232582092285,
-0.9551352262496948,
-1.421741008758545,
0.17359158396720886,
-0.05385514348745346,
0.9177806377410889,
-1.6366918087005615,
-0.15605510771274567,
1.2323017120361328,
1.0513713359832764,
-0.697161853313446,
0.9797095656394958,
0.3250361680984497,
1.0658140182495117,
0.8841721415519714,
-0.34031614661216736,
0.4982447326183319,
0.007812577299773693,
-1.2374234199523926,
0.41365355253219604,
1.1971213817596436,
0.18145032227039337,
1.380018711090088,
-0.5596325993537903,
0.05049649998545647,
0.4302946627140045,
-0.612585186958313,
-0.33003637194633484,
-0.5635422468185425,
0.669134259223938,
0.10096514225006104,
-0.881065845489502,
-0.06349284201860428,
0.003196294419467449,
-0.20894639194011688,
0.1564462035894394,
-1.4710100889205933,
-0.12866806983947754,
-0.24058757722377777,
-0.5890002250671387,
-1.1102944612503052,
-0.17000718414783478,
1.3361616134643555,
-0.8316822052001953,
-0.20798136293888092,
0.6050024628639221,
0.3295622766017914,
0.6127539873123169,
0.5827475786209106,
-0.8025842905044556,
-0.2898080348968506,
-0.1606030911207199,
-0.3512335419654846,
0.2899453043937683,
1.4475431442260742,
-0.03492593392729759,
-1.0040645599365234,
0.7522264122962952,
-0.3574110269546509,
0.07088976353406906,
2.0069408416748047,
0.05992208793759346,
-0.8493474721908569,
0.15875400602817535,
-0.6800208687782288,
1.9210381507873535,
1.7507562637329102,
1.2795586585998535,
-0.034250445663928986,
-0.994504451751709,
0.5878463387489319,
-0.3066956400871277,
-0.2858400046825409,
0.8312714695930481,
0.37434330582618713,
-0.2809799015522003,
-1.2745646238327026,
0.6716364026069641,
1.262791633605957,
-0.8905713558197021,
-0.8101915121078491,
-0.0022310051135718822,
-0.7887418270111084,
1.1592903137207031,
0.8201735019683838,
0.3775714933872223,
0.2364606112241745,
1.5881822109222412,
0.8020243644714355,
-0.4410323202610016,
0.5967516303062439,
0.6222841143608093,
-0.18977384269237518,
-2.0589969158172607,
-1.0437874794006348,
0.38239696621894836,
-0.4099450409412384,
-1.697709321975708,
1.3499943017959595,
-1.2998822927474976,
-0.9038885235786438,
0.5199531316757202,
0.08014196157455444,
1.5421030521392822,
0.42061638832092285,
1.501439094543457,
2.0736196041107178,
0.998849093914032,
0.41844597458839417,
1.2727100849151611,
-0.16535937786102295,
-0.5131171345710754,
1.7496987581253052,
-0.4477277398109436,
0.482941597700119,
1.0049248933792114,
-0.2493288367986679,
-1.0072309970855713,
-0.7622330188751221,
-1.2008686065673828,
-0.8077659606933594,
1.1582506895065308,
0.030483607202768326,
-1.0913405418395996,
0.26777908205986023,
1.5817577838897705,
0.12969931960105896,
-0.31622692942619324,
0.7186712622642517,
0.40256085991859436,
-0.8269557952880859,
-0.10903758555650711,
-0.8827910423278809,
0.4962739050388336,
-0.13411252200603485,
-0.3624551296234131,
0.4031291604042053,
0.26284340023994446,
1.343964695930481,
0.04322217404842377,
0.18205997347831726,
1.2079746723175049,
-1.3993381261825562,
1.619053602218628,
-0.6367594599723816,
0.27456653118133545,
-2.4329864978790283,
1.4371598958969116,
-0.808871865272522,
1.9206682443618774,
-2.5846152305603027,
0.47695717215538025,
-0.5270923972129822,
-0.48380762338638306,
0.20708250999450684,
-0.3390561640262604,
0.05289335176348686,
-0.054824963212013245,
-1.3333884477615356,
-0.037539009004831314,
-0.6566894054412842,
0.5629671216011047,
1.0660784244537354,
1.3415358066558838,
-1.1204503774642944,
-0.26502180099487305,
-1.795602560043335,
-0.15598009526729584,
-0.6707349419593811,
0.32854264974594116,
-1.857424020767212,
-0.18083038926124573,
-1.8596017360687256,
-2.439415693283081,
-1.3755704164505005,
-0.8062856793403625,
1.2052923440933228,
0.11325948685407639,
-0.8339816927909851,
1.1656326055526733,
-0.37950214743614197,
-1.9197404384613037,
1.0664535760879517,
-2.1887288093566895
] |
https://github.com/huggingface/datasets/issues/6043 | Compression kwargs have no effect when saving datasets as csv | Hi @aryanxk02 ! Sure, what I actually meant is that when passing a path-like `path_or_buf` here
https://github.com/huggingface/datasets/blob/14f6edd9222e577dccb962ed5338b79b73502fa5/src/datasets/arrow_dataset.py#L4708-L4714
it gets converted to a file object behind the scenes here
https://github.com/huggingface/datasets/blob/14f6edd9222e577dccb962ed5338b79b73502fa5/src/datasets/io/csv.py#L92-L94
and the eventual pandas `.to_csv()` calls that write to it always get `path_or_buf=None`, making pandas ignore the `compression` kwarg in the `to_csv_kwargs`
https://github.com/huggingface/datasets/blob/14f6edd9222e577dccb962ed5338b79b73502fa5/src/datasets/io/csv.py#L107-L109 | ### Describe the bug
Attempting to save a dataset as a compressed csv file, the compression kwargs provided to `.to_csv()` that get piped to panda's `pandas.DataFrame.to_csv` do not have any effect - resulting in the dataset not getting compressed.
A warning is raised if explicitly providing a `compression` kwarg, but no warnings are raised if relying on the defaults. This can lead to datasets secretly not getting compressed for users expecting the behaviour to match panda's `.to_csv()`, where the compression format is automatically inferred from the destination path suffix.
### Steps to reproduce the bug
```python
# dataset is not compressed (but at least a warning is emitted)
import datasets
dataset = datasets.load_dataset("rotten_tomatoes", split="train")
dataset.to_csv("uncompressed.csv")
print(os.path.getsize("uncompressed.csv")) # 1008607
dataset.to_csv("compressed.csv.gz", compression={'method': 'gzip', 'compresslevel': 1, 'mtime': 1})
print(os.path.getsize("compressed.csv.gz")) # 1008607
```
```shell
>>>
RuntimeWarning: compression has no effect when passing a non-binary object as input.
csv_str = batch.to_pandas().to_csv(
```
```python
# dataset is not compressed and no warnings are emitted
dataset.to_csv("compressed.csv.gz")
print(os.path.getsize("compressed.csv.gz")) # 1008607
# compare with
dataset.to_pandas().to_csv("pandas.csv.gz")
print(os.path.getsize("pandas.csv.gz")) # 418561
```
---
I think that this is because behind the scenes `pandas.DataFrame.to_csv` is always called with a buf-like `path_or_buf`, but users that are providing a path-like to `datasets.Dataset.to_csv` are likely not to expect / know that - leading to a mismatch in their understanding of the expected behaviour of the `compression` kwarg.
### Expected behavior
The dataset to be saved as a compressed csv file when providing a `compression` kwarg, or when relying on the default `compression='infer'`
### Environment info
`datasets == 2.13.1`
| 25 | 52 | Compression kwargs have no effect when saving datasets as csv
### Describe the bug
Attempting to save a dataset as a compressed csv file, the compression kwargs provided to `.to_csv()` that get piped to panda's `pandas.DataFrame.to_csv` do not have any effect - resulting in the dataset not getting compressed.
A warning is raised if explicitly providing a `compression` kwarg, but no warnings are raised if relying on the defaults. This can lead to datasets secretly not getting compressed for users expecting the behaviour to match panda's `.to_csv()`, where the compression format is automatically inferred from the destination path suffix.
### Steps to reproduce the bug
```python
# dataset is not compressed (but at least a warning is emitted)
import datasets
dataset = datasets.load_dataset("rotten_tomatoes", split="train")
dataset.to_csv("uncompressed.csv")
print(os.path.getsize("uncompressed.csv")) # 1008607
dataset.to_csv("compressed.csv.gz", compression={'method': 'gzip', 'compresslevel': 1, 'mtime': 1})
print(os.path.getsize("compressed.csv.gz")) # 1008607
```
```shell
>>>
RuntimeWarning: compression has no effect when passing a non-binary object as input.
csv_str = batch.to_pandas().to_csv(
```
```python
# dataset is not compressed and no warnings are emitted
dataset.to_csv("compressed.csv.gz")
print(os.path.getsize("compressed.csv.gz")) # 1008607
# compare with
dataset.to_pandas().to_csv("pandas.csv.gz")
print(os.path.getsize("pandas.csv.gz")) # 418561
```
---
I think that this is because behind the scenes `pandas.DataFrame.to_csv` is always called with a buf-like `path_or_buf`, but users that are providing a path-like to `datasets.Dataset.to_csv` are likely not to expect / know that - leading to a mismatch in their understanding of the expected behaviour of the `compression` kwarg.
### Expected behavior
The dataset to be saved as a compressed csv file when providing a `compression` kwarg, or when relying on the default `compression='infer'`
### Environment info
`datasets == 2.13.1`
Hi @aryanxk02 ! Sure, what I actually meant is that when passing a path-like `path_or_buf` here
https://github.com/huggingface/datasets/blob/14f6edd9222e577dccb962ed5338b79b73502fa5/src/datasets/arrow_dataset.py#L4708-L4714
it gets converted to a file object behind the scenes here
https://github.com/huggingface/datasets/blob/14f6edd9222e577dccb962ed5338b79b73502fa5/src/datasets/io/csv.py#L92-L94
and the eventual pandas `.to_csv()` calls that write to it always get `path_or_buf=None`, making pandas ignore the `compression` kwarg in the `to_csv_kwargs`
https://github.com/huggingface/datasets/blob/14f6edd9222e577dccb962ed5338b79b73502fa5/src/datasets/io/csv.py#L107-L109 | [
-1.1168360710144043,
-0.900812566280365,
-0.7744753956794739,
1.420461654663086,
-0.10985736548900604,
-1.2823952436447144,
0.10812487453222275,
-1.1060352325439453,
1.7183713912963867,
-0.8180946111679077,
0.30754318833351135,
-1.7111681699752808,
-0.037234142422676086,
-0.6284632682800293,
-0.7869439721107483,
-0.842337965965271,
-0.3671760559082031,
-0.7356948852539062,
1.0616806745529175,
2.532766819000244,
1.1255848407745361,
-1.3166515827178955,
2.645268440246582,
0.7567117810249329,
-0.09349629282951355,
-0.9773021936416626,
0.6166613101959229,
-0.05566178634762764,
-1.3202784061431885,
-0.3777313828468323,
-0.976398229598999,
-0.09636224806308746,
-0.5742902755737305,
-0.5596725344657898,
0.10166124254465103,
0.35852500796318054,
-0.31098708510398865,
-0.5040317177772522,
-0.7136236429214478,
-0.7985639572143555,
0.446877658367157,
-0.494199275970459,
0.9638375639915466,
-0.31646132469177246,
1.8036441802978516,
-0.6311697363853455,
0.4995254576206207,
0.7608989477157593,
1.3689486980438232,
0.21106350421905518,
0.018131215125322342,
0.4492940902709961,
0.37609395384788513,
0.06759265065193176,
0.5326135754585266,
1.11244797706604,
0.6211467981338501,
0.4901892840862274,
0.8133689165115356,
-2.2875254154205322,
1.3365628719329834,
-1.018896460533142,
0.24848662316799164,
1.3066656589508057,
-0.9322461485862732,
0.3483022153377533,
-1.820330023765564,
-0.007575477939099073,
0.48830586671829224,
-2.266836166381836,
0.28881749510765076,
-1.4255239963531494,
-0.4513356387615204,
1.0744197368621826,
0.47918862104415894,
-1.2201086282730103,
0.15822993218898773,
-0.39245355129241943,
0.904414713382721,
0.47625061869621277,
1.1169764995574951,
-1.7270770072937012,
-0.14570334553718567,
-0.28595131635665894,
0.09915205836296082,
-1.2110257148742676,
-1.506848692893982,
0.6141206622123718,
0.7950940728187561,
0.534454882144928,
-0.2153249830007553,
0.9809665083885193,
-1.024024248123169,
0.7056279182434082,
-0.9511116147041321,
-1.851266622543335,
-1.5006721019744873,
-2.168666362762451,
-2.289398193359375,
0.7580740451812744,
-0.5142483711242676,
-0.480497807264328,
2.0463414192199707,
-1.0565438270568848,
-1.7535772323608398,
1.126138687133789,
0.19421438872814178,
-0.014116848818957806,
2.2924513816833496,
0.2827785313129425,
-0.6294167637825012,
0.46312952041625977,
-0.7297751903533936,
0.7052890062332153,
-0.29096925258636475,
1.300283432006836,
0.4354283809661865,
-1.0290502309799194,
1.6892845630645752,
-0.33662453293800354,
0.5764448046684265,
-0.6458566188812256,
-0.3485567271709442,
-0.721570611000061,
0.3467790484428406,
1.9288711547851562,
-0.26486602425575256,
1.566208839416504,
-0.3556104898452759,
-1.663101315498352,
-1.6912245750427246,
0.8407086133956909,
0.5458827614784241,
-0.7145107388496399,
0.12283540517091751,
-0.4115927517414093,
0.20062409341335297,
0.04442141577601433,
1.2501733303070068,
1.349433422088623,
0.7620142102241516,
-0.36444225907325745,
-0.8268612623214722,
0.16021601855754852,
0.08235783874988556,
-0.7760504484176636,
-1.7979854345321655,
-0.47937700152397156,
0.20667734742164612,
0.6025454998016357,
-1.114196538925171,
1.7836555242538452,
0.9135195016860962,
1.830004334449768,
1.1420972347259521,
-0.31335124373435974,
1.4864271879196167,
0.08891359716653824,
1.9674263000488281,
-0.4325464963912964,
0.5953192710876465,
-0.3854287266731262,
-1.1607589721679688,
0.7500196695327759,
-0.32228463888168335,
-2.0464274883270264,
-0.7968129515647888,
-0.8075549006462097,
-0.18170644342899323,
-0.6517871618270874,
0.9451525211334229,
-0.26643237471580505,
-1.29752516746521,
0.13507485389709473,
-0.8206679821014404,
0.07140497118234634,
-1.1798527240753174,
0.1861151158809662,
0.6935595870018005,
-0.6966843008995056,
0.15944696962833405,
-0.2999487817287445,
-1.3526554107666016,
-0.32391589879989624,
0.23322689533233643,
1.8739148378372192,
-0.8825843334197998,
0.8714936375617981,
1.064733624458313,
-0.7699570059776306,
0.034596022218465805,
0.34973448514938354,
-0.3675767779350281,
0.7749691605567932,
-1.0115822553634644,
-0.38305535912513733,
1.1836892366409302,
-0.09567401558160782,
-0.6227789521217346,
1.408817172050476,
0.6702714562416077,
-1.0563315153121948,
-0.22539694607257843,
-0.17784395813941956,
-0.8063299655914307,
-0.058175601065158844,
-1.6710784435272217,
-0.1469515860080719,
0.3936710059642792,
-1.5561038255691528,
-0.5161765813827515,
-0.2653748691082001,
1.2477893829345703,
-0.03428920358419418,
1.3296773433685303,
-0.32995739579200745,
-0.1332741230726242,
-0.43456852436065674,
-0.41348230838775635,
0.19125543534755707,
-0.2157396674156189,
-0.7187992334365845,
0.2687373757362366,
-0.7667214274406433,
0.33373793959617615,
1.4905917644500732,
0.34842050075531006,
0.05204924941062927,
0.6110513210296631,
1.0453757047653198,
0.3672043979167938,
-0.09485867619514465,
-0.8096666932106018,
-1.758788824081421,
2.0724403858184814,
-1.4711682796478271,
1.9071425199508667,
0.6761040091514587,
0.03390415385365486,
-1.8640395402908325,
-1.8880072832107544,
1.279821515083313,
1.1217892169952393,
2.389890670776367,
0.5811727643013,
0.4804229438304901,
-0.8068696856498718,
-0.6174143552780151,
0.4957487881183624,
-1.04564368724823,
-0.7394556999206543,
0.09938988089561462,
2.3281819820404053,
1.778638482093811,
-0.48802682757377625,
-0.16564753651618958,
-1.0008045434951782,
1.3430627584457397,
-0.2048022300004959,
0.28711241483688354,
2.0497050285339355,
-0.22866904735565186,
-1.0128633975982666,
1.396729588508606,
-2.2777512073516846,
0.1711389422416687,
1.9684020280838013,
0.16737522184848785,
0.09890024363994598,
-1.3984225988388062,
-0.6181963682174683,
-0.2573154866695404,
-0.37722739577293396,
-1.2389984130859375,
0.5218323469161987,
-0.25218257308006287,
-0.7651563286781311,
-1.4202053546905518,
0.14990262687206268,
-1.1484063863754272,
-1.6171650886535645,
0.14455266296863556,
1.8377320766448975,
1.967905879020691,
-0.7513781189918518,
1.5025120973587036,
-0.30739447474479675,
0.12894757091999054,
1.2449928522109985,
1.2191004753112793,
3.1212518215179443,
1.929624319076538,
-1.304192066192627,
0.7167882919311523,
-0.18697954714298248,
-0.42369067668914795,
1.177715539932251,
-1.1448062658309937,
1.2763442993164062,
-0.13625657558441162,
-1.182474970817566,
-1.068400502204895,
0.9211666584014893,
0.48391056060791016,
0.0009282240644097328,
-0.36788737773895264,
1.2570511102676392,
-0.038507141172885895,
1.28501296043396,
0.5323913097381592,
-0.4617323875427246,
0.6797618269920349,
-0.3290531635284424,
-0.5199142098426819,
1.5442482233047485,
0.32342496514320374,
-1.3147752285003662,
-2.2026896476745605,
-0.1490582376718521,
-0.9334180951118469,
0.052528541535139084,
-0.622979998588562,
-0.838523268699646,
1.64137601852417,
0.29920056462287903,
-1.2682809829711914,
-0.20217837393283844,
-0.3712664246559143,
-0.6142124533653259,
2.71854305267334,
-1.4532090425491333,
-0.18033315241336823,
-0.9936212301254272,
-0.6311256289482117,
1.6625289916992188,
-1.258117437362671,
-0.2985090911388397,
-1.0076719522476196,
-0.4274568259716034,
-1.220940113067627,
-0.6088318824768066,
-0.05192135274410248,
-0.9478578567504883,
0.8675135374069214,
0.12345094233751297,
-1.2241551876068115,
-0.3060780465602875,
-0.88885098695755,
0.933856725692749,
-0.14618255198001862,
0.1466057449579239,
2.001352310180664,
0.4044506251811981,
-0.39783817529678345,
0.722306489944458,
1.1244443655014038,
0.6461051106452942,
-0.6114622354507446,
0.25871825218200684,
-0.7199416756629944,
0.2791399359703064,
-1.409805178642273,
0.2696192264556885,
-2.7687017917633057,
0.6320080161094666,
-0.07683800905942917,
-0.06988044083118439,
0.06797594577074051,
-1.297698974609375,
0.9798740744590759,
2.6271212100982666,
-1.263397455215454,
0.4668472111225128,
0.2522924840450287,
1.2313708066940308,
-1.4571534395217896,
0.3198564648628235,
-0.3339794874191284,
2.0197231769561768,
0.2429809421300888,
1.1141937971115112,
-0.3552550673484802,
-2.160320520401001,
0.718073308467865,
-1.2501927614212036,
-1.1299763917922974,
0.8037776947021484,
-0.8973177075386047,
0.061570290476083755,
-1.3330713510513306,
-0.1981625109910965,
-0.7481260895729065,
-1.1612008810043335,
0.7095200419425964,
0.12690241634845734,
0.4294700622558594,
-0.5115002989768982,
0.3266318142414093,
-2.1844966411590576,
-1.2933628559112549,
-0.25756916403770447,
-0.9423646926879883,
0.4938717782497406,
-0.27222955226898193,
0.6765274405479431,
-0.18922238051891327,
0.03519811853766441,
0.4274655878543854,
1.4842743873596191,
3.421665906906128,
0.0789274200797081,
0.32015520334243774,
-0.24945636093616486,
-0.950030505657196,
1.4185600280761719,
0.904325544834137,
-0.21215687692165375,
-0.617883563041687,
-1.2050150632858276,
1.2342921495437622,
1.9606907367706299,
0.9133440852165222,
0.011826115660369396,
-0.8945465683937073,
-0.8844719529151917,
0.031226005405187607,
0.06538525968790054,
0.4929474890232086,
0.921115517616272,
0.19028182327747345,
0.0375988595187664,
1.5231260061264038,
1.1475645303726196,
-0.36243170499801636,
0.36536362767219543,
-0.8752488493919373,
-0.42628151178359985,
0.5323021411895752,
0.3001575469970703,
0.024018600583076477,
0.19426627457141876,
-1.064638376235962,
-0.20445947349071503,
-0.33655786514282227,
-0.8749420046806335,
-0.8020851612091064,
-0.504220724105835,
-0.30137941241264343,
1.6815396547317505,
0.20242692530155182,
-0.5125110149383545,
-0.1316855251789093,
-0.7716248035430908,
-0.050954729318618774,
-0.9916427731513977,
0.2874681055545807,
-0.057919230312108994,
-0.18869614601135254,
-0.08873023092746735,
1.673539400100708,
-0.9641121029853821,
-2.0176985263824463,
0.2586468458175659,
0.10223458707332611,
-0.3718169629573822,
0.16095079481601715,
1.7109569311141968,
0.5955833196640015,
1.3704283237457275,
1.3109004497528076,
0.9080963730812073,
-0.663645327091217,
-1.271849513053894,
0.45734816789627075,
0.919952392578125,
-1.3990533351898193,
0.7817223072052002,
-0.05303115397691727,
-0.4536408483982086,
0.5580140948295593,
1.2809014320373535,
0.4749314785003662,
-2.0102622509002686,
0.7832150459289551,
-0.964293897151947,
0.6752253174781799,
0.68287593126297,
0.7484361529350281,
0.1632176786661148,
0.7684286236763,
-1.2213361263275146,
-1.2379555702209473,
-0.7701852321624756,
-0.7478219270706177,
1.9601500034332275,
-0.20160040259361267,
0.44297149777412415,
-0.14194723963737488,
-1.4377254247665405,
-0.16175201535224915,
0.7084659934043884,
0.32437649369239807,
-0.5439755320549011,
0.7792975902557373,
-0.6709127426147461,
-1.1346887350082397,
-1.4023131132125854,
-0.5349937081336975,
-0.9878829717636108,
-0.8858718276023865,
1.0318039655685425,
0.8895888924598694,
0.23941074311733246,
1.9226700067520142,
0.6057333946228027,
0.3071776032447815,
-2.653193950653076,
0.9515537023544312,
0.252420574426651,
0.059886764734983444,
0.8816747069358826,
0.3458428680896759,
0.9873824715614319,
-0.2075764387845993,
0.5011532306671143,
-2.394563913345337,
2.3293471336364746,
-0.24723678827285767,
0.5960133671760559,
0.036511898040771484,
-0.09551077336072922,
0.9958280920982361,
0.5002396702766418,
0.6725394129753113,
-1.0467017889022827,
0.5530056357383728,
-0.6914710998535156,
1.1693099737167358,
0.8716542720794678,
-0.8221427798271179,
-0.02784329652786255,
1.3482853174209595,
0.43047329783439636,
-0.6722403168678284,
-0.9738211035728455,
-1.1328092813491821,
0.9710649847984314,
1.8631229400634766,
-0.1154145747423172,
-0.06950792670249939,
0.7930203676223755,
0.5401875972747803,
-1.3991403579711914,
0.0001270519569516182,
-0.6719309687614441,
-0.709580659866333,
1.5323450565338135,
2.116025447845459,
-0.17889197170734406,
-0.22693760693073273,
-0.7301150560379028,
-1.2563554048538208,
0.7349393963813782,
0.07140247523784637,
0.11438753455877304,
0.7892283797264099,
-0.6197546720504761,
1.1631698608398438,
0.8658387660980225,
0.9699316024780273,
0.19303441047668457,
0.3496834933757782,
0.40615391731262207,
-0.28277450799942017,
-1.131630301475525,
-0.3580804765224457,
-0.9951796531677246,
-2.507779836654663,
0.5602849721908569,
-0.13964715600013733,
-1.5078333616256714,
0.03564264625310898,
-1.0343315601348877,
0.9481561183929443,
-0.4620232582092285,
-0.9551352262496948,
-1.421741008758545,
0.17359158396720886,
-0.05385514348745346,
0.9177806377410889,
-1.6366918087005615,
-0.15605510771274567,
1.2323017120361328,
1.0513713359832764,
-0.697161853313446,
0.9797095656394958,
0.3250361680984497,
1.0658140182495117,
0.8841721415519714,
-0.34031614661216736,
0.4982447326183319,
0.007812577299773693,
-1.2374234199523926,
0.41365355253219604,
1.1971213817596436,
0.18145032227039337,
1.380018711090088,
-0.5596325993537903,
0.05049649998545647,
0.4302946627140045,
-0.612585186958313,
-0.33003637194633484,
-0.5635422468185425,
0.669134259223938,
0.10096514225006104,
-0.881065845489502,
-0.06349284201860428,
0.003196294419467449,
-0.20894639194011688,
0.1564462035894394,
-1.4710100889205933,
-0.12866806983947754,
-0.24058757722377777,
-0.5890002250671387,
-1.1102944612503052,
-0.17000718414783478,
1.3361616134643555,
-0.8316822052001953,
-0.20798136293888092,
0.6050024628639221,
0.3295622766017914,
0.6127539873123169,
0.5827475786209106,
-0.8025842905044556,
-0.2898080348968506,
-0.1606030911207199,
-0.3512335419654846,
0.2899453043937683,
1.4475431442260742,
-0.03492593392729759,
-1.0040645599365234,
0.7522264122962952,
-0.3574110269546509,
0.07088976353406906,
2.0069408416748047,
0.05992208793759346,
-0.8493474721908569,
0.15875400602817535,
-0.6800208687782288,
1.9210381507873535,
1.7507562637329102,
1.2795586585998535,
-0.034250445663928986,
-0.994504451751709,
0.5878463387489319,
-0.3066956400871277,
-0.2858400046825409,
0.8312714695930481,
0.37434330582618713,
-0.2809799015522003,
-1.2745646238327026,
0.6716364026069641,
1.262791633605957,
-0.8905713558197021,
-0.8101915121078491,
-0.0022310051135718822,
-0.7887418270111084,
1.1592903137207031,
0.8201735019683838,
0.3775714933872223,
0.2364606112241745,
1.5881822109222412,
0.8020243644714355,
-0.4410323202610016,
0.5967516303062439,
0.6222841143608093,
-0.18977384269237518,
-2.0589969158172607,
-1.0437874794006348,
0.38239696621894836,
-0.4099450409412384,
-1.697709321975708,
1.3499943017959595,
-1.2998822927474976,
-0.9038885235786438,
0.5199531316757202,
0.08014196157455444,
1.5421030521392822,
0.42061638832092285,
1.501439094543457,
2.0736196041107178,
0.998849093914032,
0.41844597458839417,
1.2727100849151611,
-0.16535937786102295,
-0.5131171345710754,
1.7496987581253052,
-0.4477277398109436,
0.482941597700119,
1.0049248933792114,
-0.2493288367986679,
-1.0072309970855713,
-0.7622330188751221,
-1.2008686065673828,
-0.8077659606933594,
1.1582506895065308,
0.030483607202768326,
-1.0913405418395996,
0.26777908205986023,
1.5817577838897705,
0.12969931960105896,
-0.31622692942619324,
0.7186712622642517,
0.40256085991859436,
-0.8269557952880859,
-0.10903758555650711,
-0.8827910423278809,
0.4962739050388336,
-0.13411252200603485,
-0.3624551296234131,
0.4031291604042053,
0.26284340023994446,
1.343964695930481,
0.04322217404842377,
0.18205997347831726,
1.2079746723175049,
-1.3993381261825562,
1.619053602218628,
-0.6367594599723816,
0.27456653118133545,
-2.4329864978790283,
1.4371598958969116,
-0.808871865272522,
1.9206682443618774,
-2.5846152305603027,
0.47695717215538025,
-0.5270923972129822,
-0.48380762338638306,
0.20708250999450684,
-0.3390561640262604,
0.05289335176348686,
-0.054824963212013245,
-1.3333884477615356,
-0.037539009004831314,
-0.6566894054412842,
0.5629671216011047,
1.0660784244537354,
1.3415358066558838,
-1.1204503774642944,
-0.26502180099487305,
-1.795602560043335,
-0.15598009526729584,
-0.6707349419593811,
0.32854264974594116,
-1.857424020767212,
-0.18083038926124573,
-1.8596017360687256,
-2.439415693283081,
-1.3755704164505005,
-0.8062856793403625,
1.2052923440933228,
0.11325948685407639,
-0.8339816927909851,
1.1656326055526733,
-0.37950214743614197,
-1.9197404384613037,
1.0664535760879517,
-2.1887288093566895
] |
https://github.com/huggingface/datasets/issues/6043 | Compression kwargs have no effect when saving datasets as csv | @exs-avianello When `path_or_buf` is set to None, the `to_csv()` method will return the CSV data as a string instead of saving it to a file. Hence the compression doesn't take place. I think setting `path_or_buf=self.path_or_buf` should work. What you say? | ### Describe the bug
Attempting to save a dataset as a compressed csv file, the compression kwargs provided to `.to_csv()` that get piped to panda's `pandas.DataFrame.to_csv` do not have any effect - resulting in the dataset not getting compressed.
A warning is raised if explicitly providing a `compression` kwarg, but no warnings are raised if relying on the defaults. This can lead to datasets secretly not getting compressed for users expecting the behaviour to match panda's `.to_csv()`, where the compression format is automatically inferred from the destination path suffix.
### Steps to reproduce the bug
```python
# dataset is not compressed (but at least a warning is emitted)
import datasets
dataset = datasets.load_dataset("rotten_tomatoes", split="train")
dataset.to_csv("uncompressed.csv")
print(os.path.getsize("uncompressed.csv")) # 1008607
dataset.to_csv("compressed.csv.gz", compression={'method': 'gzip', 'compresslevel': 1, 'mtime': 1})
print(os.path.getsize("compressed.csv.gz")) # 1008607
```
```shell
>>>
RuntimeWarning: compression has no effect when passing a non-binary object as input.
csv_str = batch.to_pandas().to_csv(
```
```python
# dataset is not compressed and no warnings are emitted
dataset.to_csv("compressed.csv.gz")
print(os.path.getsize("compressed.csv.gz")) # 1008607
# compare with
dataset.to_pandas().to_csv("pandas.csv.gz")
print(os.path.getsize("pandas.csv.gz")) # 418561
```
---
I think that this is because behind the scenes `pandas.DataFrame.to_csv` is always called with a buf-like `path_or_buf`, but users that are providing a path-like to `datasets.Dataset.to_csv` are likely not to expect / know that - leading to a mismatch in their understanding of the expected behaviour of the `compression` kwarg.
### Expected behavior
The dataset to be saved as a compressed csv file when providing a `compression` kwarg, or when relying on the default `compression='infer'`
### Environment info
`datasets == 2.13.1`
| 25 | 40 | Compression kwargs have no effect when saving datasets as csv
### Describe the bug
Attempting to save a dataset as a compressed csv file, the compression kwargs provided to `.to_csv()` that get piped to panda's `pandas.DataFrame.to_csv` do not have any effect - resulting in the dataset not getting compressed.
A warning is raised if explicitly providing a `compression` kwarg, but no warnings are raised if relying on the defaults. This can lead to datasets secretly not getting compressed for users expecting the behaviour to match panda's `.to_csv()`, where the compression format is automatically inferred from the destination path suffix.
### Steps to reproduce the bug
```python
# dataset is not compressed (but at least a warning is emitted)
import datasets
dataset = datasets.load_dataset("rotten_tomatoes", split="train")
dataset.to_csv("uncompressed.csv")
print(os.path.getsize("uncompressed.csv")) # 1008607
dataset.to_csv("compressed.csv.gz", compression={'method': 'gzip', 'compresslevel': 1, 'mtime': 1})
print(os.path.getsize("compressed.csv.gz")) # 1008607
```
```shell
>>>
RuntimeWarning: compression has no effect when passing a non-binary object as input.
csv_str = batch.to_pandas().to_csv(
```
```python
# dataset is not compressed and no warnings are emitted
dataset.to_csv("compressed.csv.gz")
print(os.path.getsize("compressed.csv.gz")) # 1008607
# compare with
dataset.to_pandas().to_csv("pandas.csv.gz")
print(os.path.getsize("pandas.csv.gz")) # 418561
```
---
I think that this is because behind the scenes `pandas.DataFrame.to_csv` is always called with a buf-like `path_or_buf`, but users that are providing a path-like to `datasets.Dataset.to_csv` are likely not to expect / know that - leading to a mismatch in their understanding of the expected behaviour of the `compression` kwarg.
### Expected behavior
The dataset to be saved as a compressed csv file when providing a `compression` kwarg, or when relying on the default `compression='infer'`
### Environment info
`datasets == 2.13.1`
@exs-avianello When `path_or_buf` is set to None, the `to_csv()` method will return the CSV data as a string instead of saving it to a file. Hence the compression doesn't take place. I think setting `path_or_buf=self.path_or_buf` should work. What you say? | [
-1.1168360710144043,
-0.900812566280365,
-0.7744753956794739,
1.420461654663086,
-0.10985736548900604,
-1.2823952436447144,
0.10812487453222275,
-1.1060352325439453,
1.7183713912963867,
-0.8180946111679077,
0.30754318833351135,
-1.7111681699752808,
-0.037234142422676086,
-0.6284632682800293,
-0.7869439721107483,
-0.842337965965271,
-0.3671760559082031,
-0.7356948852539062,
1.0616806745529175,
2.532766819000244,
1.1255848407745361,
-1.3166515827178955,
2.645268440246582,
0.7567117810249329,
-0.09349629282951355,
-0.9773021936416626,
0.6166613101959229,
-0.05566178634762764,
-1.3202784061431885,
-0.3777313828468323,
-0.976398229598999,
-0.09636224806308746,
-0.5742902755737305,
-0.5596725344657898,
0.10166124254465103,
0.35852500796318054,
-0.31098708510398865,
-0.5040317177772522,
-0.7136236429214478,
-0.7985639572143555,
0.446877658367157,
-0.494199275970459,
0.9638375639915466,
-0.31646132469177246,
1.8036441802978516,
-0.6311697363853455,
0.4995254576206207,
0.7608989477157593,
1.3689486980438232,
0.21106350421905518,
0.018131215125322342,
0.4492940902709961,
0.37609395384788513,
0.06759265065193176,
0.5326135754585266,
1.11244797706604,
0.6211467981338501,
0.4901892840862274,
0.8133689165115356,
-2.2875254154205322,
1.3365628719329834,
-1.018896460533142,
0.24848662316799164,
1.3066656589508057,
-0.9322461485862732,
0.3483022153377533,
-1.820330023765564,
-0.007575477939099073,
0.48830586671829224,
-2.266836166381836,
0.28881749510765076,
-1.4255239963531494,
-0.4513356387615204,
1.0744197368621826,
0.47918862104415894,
-1.2201086282730103,
0.15822993218898773,
-0.39245355129241943,
0.904414713382721,
0.47625061869621277,
1.1169764995574951,
-1.7270770072937012,
-0.14570334553718567,
-0.28595131635665894,
0.09915205836296082,
-1.2110257148742676,
-1.506848692893982,
0.6141206622123718,
0.7950940728187561,
0.534454882144928,
-0.2153249830007553,
0.9809665083885193,
-1.024024248123169,
0.7056279182434082,
-0.9511116147041321,
-1.851266622543335,
-1.5006721019744873,
-2.168666362762451,
-2.289398193359375,
0.7580740451812744,
-0.5142483711242676,
-0.480497807264328,
2.0463414192199707,
-1.0565438270568848,
-1.7535772323608398,
1.126138687133789,
0.19421438872814178,
-0.014116848818957806,
2.2924513816833496,
0.2827785313129425,
-0.6294167637825012,
0.46312952041625977,
-0.7297751903533936,
0.7052890062332153,
-0.29096925258636475,
1.300283432006836,
0.4354283809661865,
-1.0290502309799194,
1.6892845630645752,
-0.33662453293800354,
0.5764448046684265,
-0.6458566188812256,
-0.3485567271709442,
-0.721570611000061,
0.3467790484428406,
1.9288711547851562,
-0.26486602425575256,
1.566208839416504,
-0.3556104898452759,
-1.663101315498352,
-1.6912245750427246,
0.8407086133956909,
0.5458827614784241,
-0.7145107388496399,
0.12283540517091751,
-0.4115927517414093,
0.20062409341335297,
0.04442141577601433,
1.2501733303070068,
1.349433422088623,
0.7620142102241516,
-0.36444225907325745,
-0.8268612623214722,
0.16021601855754852,
0.08235783874988556,
-0.7760504484176636,
-1.7979854345321655,
-0.47937700152397156,
0.20667734742164612,
0.6025454998016357,
-1.114196538925171,
1.7836555242538452,
0.9135195016860962,
1.830004334449768,
1.1420972347259521,
-0.31335124373435974,
1.4864271879196167,
0.08891359716653824,
1.9674263000488281,
-0.4325464963912964,
0.5953192710876465,
-0.3854287266731262,
-1.1607589721679688,
0.7500196695327759,
-0.32228463888168335,
-2.0464274883270264,
-0.7968129515647888,
-0.8075549006462097,
-0.18170644342899323,
-0.6517871618270874,
0.9451525211334229,
-0.26643237471580505,
-1.29752516746521,
0.13507485389709473,
-0.8206679821014404,
0.07140497118234634,
-1.1798527240753174,
0.1861151158809662,
0.6935595870018005,
-0.6966843008995056,
0.15944696962833405,
-0.2999487817287445,
-1.3526554107666016,
-0.32391589879989624,
0.23322689533233643,
1.8739148378372192,
-0.8825843334197998,
0.8714936375617981,
1.064733624458313,
-0.7699570059776306,
0.034596022218465805,
0.34973448514938354,
-0.3675767779350281,
0.7749691605567932,
-1.0115822553634644,
-0.38305535912513733,
1.1836892366409302,
-0.09567401558160782,
-0.6227789521217346,
1.408817172050476,
0.6702714562416077,
-1.0563315153121948,
-0.22539694607257843,
-0.17784395813941956,
-0.8063299655914307,
-0.058175601065158844,
-1.6710784435272217,
-0.1469515860080719,
0.3936710059642792,
-1.5561038255691528,
-0.5161765813827515,
-0.2653748691082001,
1.2477893829345703,
-0.03428920358419418,
1.3296773433685303,
-0.32995739579200745,
-0.1332741230726242,
-0.43456852436065674,
-0.41348230838775635,
0.19125543534755707,
-0.2157396674156189,
-0.7187992334365845,
0.2687373757362366,
-0.7667214274406433,
0.33373793959617615,
1.4905917644500732,
0.34842050075531006,
0.05204924941062927,
0.6110513210296631,
1.0453757047653198,
0.3672043979167938,
-0.09485867619514465,
-0.8096666932106018,
-1.758788824081421,
2.0724403858184814,
-1.4711682796478271,
1.9071425199508667,
0.6761040091514587,
0.03390415385365486,
-1.8640395402908325,
-1.8880072832107544,
1.279821515083313,
1.1217892169952393,
2.389890670776367,
0.5811727643013,
0.4804229438304901,
-0.8068696856498718,
-0.6174143552780151,
0.4957487881183624,
-1.04564368724823,
-0.7394556999206543,
0.09938988089561462,
2.3281819820404053,
1.778638482093811,
-0.48802682757377625,
-0.16564753651618958,
-1.0008045434951782,
1.3430627584457397,
-0.2048022300004959,
0.28711241483688354,
2.0497050285339355,
-0.22866904735565186,
-1.0128633975982666,
1.396729588508606,
-2.2777512073516846,
0.1711389422416687,
1.9684020280838013,
0.16737522184848785,
0.09890024363994598,
-1.3984225988388062,
-0.6181963682174683,
-0.2573154866695404,
-0.37722739577293396,
-1.2389984130859375,
0.5218323469161987,
-0.25218257308006287,
-0.7651563286781311,
-1.4202053546905518,
0.14990262687206268,
-1.1484063863754272,
-1.6171650886535645,
0.14455266296863556,
1.8377320766448975,
1.967905879020691,
-0.7513781189918518,
1.5025120973587036,
-0.30739447474479675,
0.12894757091999054,
1.2449928522109985,
1.2191004753112793,
3.1212518215179443,
1.929624319076538,
-1.304192066192627,
0.7167882919311523,
-0.18697954714298248,
-0.42369067668914795,
1.177715539932251,
-1.1448062658309937,
1.2763442993164062,
-0.13625657558441162,
-1.182474970817566,
-1.068400502204895,
0.9211666584014893,
0.48391056060791016,
0.0009282240644097328,
-0.36788737773895264,
1.2570511102676392,
-0.038507141172885895,
1.28501296043396,
0.5323913097381592,
-0.4617323875427246,
0.6797618269920349,
-0.3290531635284424,
-0.5199142098426819,
1.5442482233047485,
0.32342496514320374,
-1.3147752285003662,
-2.2026896476745605,
-0.1490582376718521,
-0.9334180951118469,
0.052528541535139084,
-0.622979998588562,
-0.838523268699646,
1.64137601852417,
0.29920056462287903,
-1.2682809829711914,
-0.20217837393283844,
-0.3712664246559143,
-0.6142124533653259,
2.71854305267334,
-1.4532090425491333,
-0.18033315241336823,
-0.9936212301254272,
-0.6311256289482117,
1.6625289916992188,
-1.258117437362671,
-0.2985090911388397,
-1.0076719522476196,
-0.4274568259716034,
-1.220940113067627,
-0.6088318824768066,
-0.05192135274410248,
-0.9478578567504883,
0.8675135374069214,
0.12345094233751297,
-1.2241551876068115,
-0.3060780465602875,
-0.88885098695755,
0.933856725692749,
-0.14618255198001862,
0.1466057449579239,
2.001352310180664,
0.4044506251811981,
-0.39783817529678345,
0.722306489944458,
1.1244443655014038,
0.6461051106452942,
-0.6114622354507446,
0.25871825218200684,
-0.7199416756629944,
0.2791399359703064,
-1.409805178642273,
0.2696192264556885,
-2.7687017917633057,
0.6320080161094666,
-0.07683800905942917,
-0.06988044083118439,
0.06797594577074051,
-1.297698974609375,
0.9798740744590759,
2.6271212100982666,
-1.263397455215454,
0.4668472111225128,
0.2522924840450287,
1.2313708066940308,
-1.4571534395217896,
0.3198564648628235,
-0.3339794874191284,
2.0197231769561768,
0.2429809421300888,
1.1141937971115112,
-0.3552550673484802,
-2.160320520401001,
0.718073308467865,
-1.2501927614212036,
-1.1299763917922974,
0.8037776947021484,
-0.8973177075386047,
0.061570290476083755,
-1.3330713510513306,
-0.1981625109910965,
-0.7481260895729065,
-1.1612008810043335,
0.7095200419425964,
0.12690241634845734,
0.4294700622558594,
-0.5115002989768982,
0.3266318142414093,
-2.1844966411590576,
-1.2933628559112549,
-0.25756916403770447,
-0.9423646926879883,
0.4938717782497406,
-0.27222955226898193,
0.6765274405479431,
-0.18922238051891327,
0.03519811853766441,
0.4274655878543854,
1.4842743873596191,
3.421665906906128,
0.0789274200797081,
0.32015520334243774,
-0.24945636093616486,
-0.950030505657196,
1.4185600280761719,
0.904325544834137,
-0.21215687692165375,
-0.617883563041687,
-1.2050150632858276,
1.2342921495437622,
1.9606907367706299,
0.9133440852165222,
0.011826115660369396,
-0.8945465683937073,
-0.8844719529151917,
0.031226005405187607,
0.06538525968790054,
0.4929474890232086,
0.921115517616272,
0.19028182327747345,
0.0375988595187664,
1.5231260061264038,
1.1475645303726196,
-0.36243170499801636,
0.36536362767219543,
-0.8752488493919373,
-0.42628151178359985,
0.5323021411895752,
0.3001575469970703,
0.024018600583076477,
0.19426627457141876,
-1.064638376235962,
-0.20445947349071503,
-0.33655786514282227,
-0.8749420046806335,
-0.8020851612091064,
-0.504220724105835,
-0.30137941241264343,
1.6815396547317505,
0.20242692530155182,
-0.5125110149383545,
-0.1316855251789093,
-0.7716248035430908,
-0.050954729318618774,
-0.9916427731513977,
0.2874681055545807,
-0.057919230312108994,
-0.18869614601135254,
-0.08873023092746735,
1.673539400100708,
-0.9641121029853821,
-2.0176985263824463,
0.2586468458175659,
0.10223458707332611,
-0.3718169629573822,
0.16095079481601715,
1.7109569311141968,
0.5955833196640015,
1.3704283237457275,
1.3109004497528076,
0.9080963730812073,
-0.663645327091217,
-1.271849513053894,
0.45734816789627075,
0.919952392578125,
-1.3990533351898193,
0.7817223072052002,
-0.05303115397691727,
-0.4536408483982086,
0.5580140948295593,
1.2809014320373535,
0.4749314785003662,
-2.0102622509002686,
0.7832150459289551,
-0.964293897151947,
0.6752253174781799,
0.68287593126297,
0.7484361529350281,
0.1632176786661148,
0.7684286236763,
-1.2213361263275146,
-1.2379555702209473,
-0.7701852321624756,
-0.7478219270706177,
1.9601500034332275,
-0.20160040259361267,
0.44297149777412415,
-0.14194723963737488,
-1.4377254247665405,
-0.16175201535224915,
0.7084659934043884,
0.32437649369239807,
-0.5439755320549011,
0.7792975902557373,
-0.6709127426147461,
-1.1346887350082397,
-1.4023131132125854,
-0.5349937081336975,
-0.9878829717636108,
-0.8858718276023865,
1.0318039655685425,
0.8895888924598694,
0.23941074311733246,
1.9226700067520142,
0.6057333946228027,
0.3071776032447815,
-2.653193950653076,
0.9515537023544312,
0.252420574426651,
0.059886764734983444,
0.8816747069358826,
0.3458428680896759,
0.9873824715614319,
-0.2075764387845993,
0.5011532306671143,
-2.394563913345337,
2.3293471336364746,
-0.24723678827285767,
0.5960133671760559,
0.036511898040771484,
-0.09551077336072922,
0.9958280920982361,
0.5002396702766418,
0.6725394129753113,
-1.0467017889022827,
0.5530056357383728,
-0.6914710998535156,
1.1693099737167358,
0.8716542720794678,
-0.8221427798271179,
-0.02784329652786255,
1.3482853174209595,
0.43047329783439636,
-0.6722403168678284,
-0.9738211035728455,
-1.1328092813491821,
0.9710649847984314,
1.8631229400634766,
-0.1154145747423172,
-0.06950792670249939,
0.7930203676223755,
0.5401875972747803,
-1.3991403579711914,
0.0001270519569516182,
-0.6719309687614441,
-0.709580659866333,
1.5323450565338135,
2.116025447845459,
-0.17889197170734406,
-0.22693760693073273,
-0.7301150560379028,
-1.2563554048538208,
0.7349393963813782,
0.07140247523784637,
0.11438753455877304,
0.7892283797264099,
-0.6197546720504761,
1.1631698608398438,
0.8658387660980225,
0.9699316024780273,
0.19303441047668457,
0.3496834933757782,
0.40615391731262207,
-0.28277450799942017,
-1.131630301475525,
-0.3580804765224457,
-0.9951796531677246,
-2.507779836654663,
0.5602849721908569,
-0.13964715600013733,
-1.5078333616256714,
0.03564264625310898,
-1.0343315601348877,
0.9481561183929443,
-0.4620232582092285,
-0.9551352262496948,
-1.421741008758545,
0.17359158396720886,
-0.05385514348745346,
0.9177806377410889,
-1.6366918087005615,
-0.15605510771274567,
1.2323017120361328,
1.0513713359832764,
-0.697161853313446,
0.9797095656394958,
0.3250361680984497,
1.0658140182495117,
0.8841721415519714,
-0.34031614661216736,
0.4982447326183319,
0.007812577299773693,
-1.2374234199523926,
0.41365355253219604,
1.1971213817596436,
0.18145032227039337,
1.380018711090088,
-0.5596325993537903,
0.05049649998545647,
0.4302946627140045,
-0.612585186958313,
-0.33003637194633484,
-0.5635422468185425,
0.669134259223938,
0.10096514225006104,
-0.881065845489502,
-0.06349284201860428,
0.003196294419467449,
-0.20894639194011688,
0.1564462035894394,
-1.4710100889205933,
-0.12866806983947754,
-0.24058757722377777,
-0.5890002250671387,
-1.1102944612503052,
-0.17000718414783478,
1.3361616134643555,
-0.8316822052001953,
-0.20798136293888092,
0.6050024628639221,
0.3295622766017914,
0.6127539873123169,
0.5827475786209106,
-0.8025842905044556,
-0.2898080348968506,
-0.1606030911207199,
-0.3512335419654846,
0.2899453043937683,
1.4475431442260742,
-0.03492593392729759,
-1.0040645599365234,
0.7522264122962952,
-0.3574110269546509,
0.07088976353406906,
2.0069408416748047,
0.05992208793759346,
-0.8493474721908569,
0.15875400602817535,
-0.6800208687782288,
1.9210381507873535,
1.7507562637329102,
1.2795586585998535,
-0.034250445663928986,
-0.994504451751709,
0.5878463387489319,
-0.3066956400871277,
-0.2858400046825409,
0.8312714695930481,
0.37434330582618713,
-0.2809799015522003,
-1.2745646238327026,
0.6716364026069641,
1.262791633605957,
-0.8905713558197021,
-0.8101915121078491,
-0.0022310051135718822,
-0.7887418270111084,
1.1592903137207031,
0.8201735019683838,
0.3775714933872223,
0.2364606112241745,
1.5881822109222412,
0.8020243644714355,
-0.4410323202610016,
0.5967516303062439,
0.6222841143608093,
-0.18977384269237518,
-2.0589969158172607,
-1.0437874794006348,
0.38239696621894836,
-0.4099450409412384,
-1.697709321975708,
1.3499943017959595,
-1.2998822927474976,
-0.9038885235786438,
0.5199531316757202,
0.08014196157455444,
1.5421030521392822,
0.42061638832092285,
1.501439094543457,
2.0736196041107178,
0.998849093914032,
0.41844597458839417,
1.2727100849151611,
-0.16535937786102295,
-0.5131171345710754,
1.7496987581253052,
-0.4477277398109436,
0.482941597700119,
1.0049248933792114,
-0.2493288367986679,
-1.0072309970855713,
-0.7622330188751221,
-1.2008686065673828,
-0.8077659606933594,
1.1582506895065308,
0.030483607202768326,
-1.0913405418395996,
0.26777908205986023,
1.5817577838897705,
0.12969931960105896,
-0.31622692942619324,
0.7186712622642517,
0.40256085991859436,
-0.8269557952880859,
-0.10903758555650711,
-0.8827910423278809,
0.4962739050388336,
-0.13411252200603485,
-0.3624551296234131,
0.4031291604042053,
0.26284340023994446,
1.343964695930481,
0.04322217404842377,
0.18205997347831726,
1.2079746723175049,
-1.3993381261825562,
1.619053602218628,
-0.6367594599723816,
0.27456653118133545,
-2.4329864978790283,
1.4371598958969116,
-0.808871865272522,
1.9206682443618774,
-2.5846152305603027,
0.47695717215538025,
-0.5270923972129822,
-0.48380762338638306,
0.20708250999450684,
-0.3390561640262604,
0.05289335176348686,
-0.054824963212013245,
-1.3333884477615356,
-0.037539009004831314,
-0.6566894054412842,
0.5629671216011047,
1.0660784244537354,
1.3415358066558838,
-1.1204503774642944,
-0.26502180099487305,
-1.795602560043335,
-0.15598009526729584,
-0.6707349419593811,
0.32854264974594116,
-1.857424020767212,
-0.18083038926124573,
-1.8596017360687256,
-2.439415693283081,
-1.3755704164505005,
-0.8062856793403625,
1.2052923440933228,
0.11325948685407639,
-0.8339816927909851,
1.1656326055526733,
-0.37950214743614197,
-1.9197404384613037,
1.0664535760879517,
-2.1887288093566895
] |
https://github.com/huggingface/datasets/issues/6038 | File "/home/zhizhou/anaconda3/envs/pytorch/lib/python3.10/site-packages/datasets/builder.py", line 992, in _download_and_prepare if str(split_generator.split_info.name).lower() == "all": AttributeError: 'str' object has no attribute 'split_info'. Did you mean: 'splitlines'? | Instead of writing the loading script, you can use the built-in loader to [load JSON files](https://huggingface.co/docs/datasets/loading#json):
```python
from datasets import load_dataset
ds = load_dataset("json", data_files={"train": os.path.join(data_dir["train"]), "dev": os.path.join(data_dir["dev"])})
``` | Hi, I use the code below to load local file
```
def _split_generators(self, dl_manager):
# TODO: This method is tasked with downloading/extracting the data and defining the splits depending on the configuration
# If several configurations are possible (listed in BUILDER_CONFIGS), the configuration selected by the user is in self.config.name
# dl_manager is a datasets.download.DownloadManager that can be used to download and extract URLS
# It can accept any type or nested list/dict and will give back the same structure with the url replaced with path to local files.
# By default the archives will be extracted and a path to a cached folder where they are extracted is returned instead of the archive
# urls = _URLS[self.config.name]
data_dir = dl_manager.download_and_extract(_URLs)
print(data_dir)
return [
datasets.SplitGenerator(
name=datasets.Split.TRAIN,
# These kwargs will be passed to _generate_examples
gen_kwargs={
"filepath": os.path.join(data_dir["train"]),
"split": "train",
},
),
datasets.SplitGenerator(
name=datasets.Split.VALIDATION,
# These kwargs will be passed to _generate_examples
gen_kwargs={
"filepath": os.path.join(data_dir["dev"]),
"split": "dev",
},
),
]
```
and error occured
```
Traceback (most recent call last):
File "/home/zhizhou/data1/zhanghao/huggingface/FineTuning_Transformer/load_local_dataset.py", line 2, in <module>
dataset = load_dataset("./QA_script.py",data_files='/home/zhizhou/.cache/huggingface/datasets/conversatiom_corps/part_file.json')
File "/home/zhizhou/anaconda3/envs/pytorch/lib/python3.10/site-packages/datasets/load.py", line 1809, in load_dataset
builder_instance.download_and_prepare(
File "/home/zhizhou/anaconda3/envs/pytorch/lib/python3.10/site-packages/datasets/builder.py", line 909, in download_and_prepare
self._download_and_prepare(
File "/home/zhizhou/anaconda3/envs/pytorch/lib/python3.10/site-packages/datasets/builder.py", line 1670, in _download_and_prepare
super()._download_and_prepare(
File "/home/zhizhou/anaconda3/envs/pytorch/lib/python3.10/site-packages/datasets/builder.py", line 992, in _download_and_prepare
if str(split_generator.split_info.name).lower() == "all":
AttributeError: 'str' object has no attribute 'split_info'. Did you mean: 'splitlines'?
```
Could you help me? | 26 | 29 | File "/home/zhizhou/anaconda3/envs/pytorch/lib/python3.10/site-packages/datasets/builder.py", line 992, in _download_and_prepare if str(split_generator.split_info.name).lower() == "all": AttributeError: 'str' object has no attribute 'split_info'. Did you mean: 'splitlines'?
Hi, I use the code below to load local file
```
def _split_generators(self, dl_manager):
# TODO: This method is tasked with downloading/extracting the data and defining the splits depending on the configuration
# If several configurations are possible (listed in BUILDER_CONFIGS), the configuration selected by the user is in self.config.name
# dl_manager is a datasets.download.DownloadManager that can be used to download and extract URLS
# It can accept any type or nested list/dict and will give back the same structure with the url replaced with path to local files.
# By default the archives will be extracted and a path to a cached folder where they are extracted is returned instead of the archive
# urls = _URLS[self.config.name]
data_dir = dl_manager.download_and_extract(_URLs)
print(data_dir)
return [
datasets.SplitGenerator(
name=datasets.Split.TRAIN,
# These kwargs will be passed to _generate_examples
gen_kwargs={
"filepath": os.path.join(data_dir["train"]),
"split": "train",
},
),
datasets.SplitGenerator(
name=datasets.Split.VALIDATION,
# These kwargs will be passed to _generate_examples
gen_kwargs={
"filepath": os.path.join(data_dir["dev"]),
"split": "dev",
},
),
]
```
and error occured
```
Traceback (most recent call last):
File "/home/zhizhou/data1/zhanghao/huggingface/FineTuning_Transformer/load_local_dataset.py", line 2, in <module>
dataset = load_dataset("./QA_script.py",data_files='/home/zhizhou/.cache/huggingface/datasets/conversatiom_corps/part_file.json')
File "/home/zhizhou/anaconda3/envs/pytorch/lib/python3.10/site-packages/datasets/load.py", line 1809, in load_dataset
builder_instance.download_and_prepare(
File "/home/zhizhou/anaconda3/envs/pytorch/lib/python3.10/site-packages/datasets/builder.py", line 909, in download_and_prepare
self._download_and_prepare(
File "/home/zhizhou/anaconda3/envs/pytorch/lib/python3.10/site-packages/datasets/builder.py", line 1670, in _download_and_prepare
super()._download_and_prepare(
File "/home/zhizhou/anaconda3/envs/pytorch/lib/python3.10/site-packages/datasets/builder.py", line 992, in _download_and_prepare
if str(split_generator.split_info.name).lower() == "all":
AttributeError: 'str' object has no attribute 'split_info'. Did you mean: 'splitlines'?
```
Could you help me?
Instead of writing the loading script, you can use the built-in loader to [load JSON files](https://huggingface.co/docs/datasets/loading#json):
```python
from datasets import load_dataset
ds = load_dataset("json", data_files={"train": os.path.join(data_dir["train"]), "dev": os.path.join(data_dir["dev"])})
``` | [
-1.2361313104629517,
-0.9707532525062561,
-0.7087602615356445,
1.4899070262908936,
-0.20801934599876404,
-1.2016712427139282,
0.14858272671699524,
-1.0610185861587524,
1.639115333557129,
-0.8069785833358765,
0.30962151288986206,
-1.6301939487457275,
0.004292638972401619,
-0.5656403303146362,
-0.7168557643890381,
-0.961607038974762,
-0.4047562777996063,
-0.7849110960960388,
1.0389612913131714,
2.5026438236236572,
1.2934478521347046,
-1.4157768487930298,
2.703376054763794,
0.7552603483200073,
-0.20639684796333313,
-1.0368292331695557,
0.5714684128761292,
-0.018146466463804245,
-1.2551121711730957,
-0.4630720317363739,
-0.9902176260948181,
-0.04214571416378021,
-0.5516894459724426,
-0.4607844650745392,
0.027728401124477386,
0.4269070327281952,
-0.31871721148490906,
-0.4128098785877228,
-0.6429016590118408,
-0.8222396969795227,
0.46430957317352295,
-0.399127334356308,
0.9534454345703125,
-0.35352233052253723,
1.8172991275787354,
-0.5565240383148193,
0.42993584275245667,
0.7417346835136414,
1.2842516899108887,
0.23352563381195068,
0.042043834924697876,
0.2862185537815094,
0.38533931970596313,
-0.06569299101829529,
0.5386020541191101,
1.189100980758667,
0.6442052721977234,
0.4925772547721863,
0.6637035012245178,
-2.221102476119995,
1.307544469833374,
-1.0191688537597656,
0.2902560532093048,
1.301385760307312,
-0.8904299139976501,
0.3255777060985565,
-1.802714228630066,
-0.03284993767738342,
0.6671867370605469,
-2.2378978729248047,
0.3039185702800751,
-1.2969056367874146,
-0.5106645822525024,
1.0198822021484375,
0.3686259984970093,
-1.1819353103637695,
0.13251551985740662,
-0.48626014590263367,
1.0580179691314697,
0.4557167589664459,
1.076685905456543,
-1.6646230220794678,
-0.03718437999486923,
-0.2715023159980774,
0.09146763384342194,
-1.2627865076065063,
-1.5764479637145996,
0.597561240196228,
0.6684924364089966,
0.5408741235733032,
-0.05378948897123337,
1.0646750926971436,
-1.0505714416503906,
0.8382611870765686,
-1.0310946702957153,
-1.584236979484558,
-1.4561623334884644,
-2.3848092555999756,
-2.254772424697876,
0.8043491244316101,
-0.48894616961479187,
-0.5480159521102905,
2.1167168617248535,
-1.0765990018844604,
-1.690054178237915,
1.107378602027893,
0.18580234050750732,
0.0661965161561966,
2.407104969024658,
0.1418548822402954,
-0.721686601638794,
0.43234407901763916,
-0.7047389149665833,
0.8181766867637634,
-0.30857521295547485,
1.3001652956008911,
0.42563265562057495,
-1.023518443107605,
1.5897283554077148,
-0.36884212493896484,
0.5832805037498474,
-0.5928476452827454,
-0.5618440508842468,
-0.68996262550354,
0.30828824639320374,
1.8578842878341675,
-0.3159536123275757,
1.5480294227600098,
-0.30891484022140503,
-1.4781129360198975,
-1.6558865308761597,
0.9015934467315674,
0.4942942261695862,
-0.8065803647041321,
0.0650341659784317,
-0.4355755150318146,
0.1255553662776947,
-0.0891311913728714,
1.1461248397827148,
1.3029892444610596,
0.7591384649276733,
-0.35422495007514954,
-0.8561274409294128,
0.15305334329605103,
-0.16031813621520996,
-0.7341011166572571,
-1.7326996326446533,
-0.3508470356464386,
0.10454902797937393,
0.6498605012893677,
-1.2409453392028809,
1.76820969581604,
0.8803805112838745,
1.9711652994155884,
1.0197432041168213,
-0.3558211624622345,
1.5018824338912964,
0.07981143891811371,
1.7970995903015137,
-0.5091488361358643,
0.6089270710945129,
-0.37258368730545044,
-1.163327693939209,
0.8335371613502502,
-0.34541356563568115,
-2.035064935684204,
-0.8249287605285645,
-0.72361820936203,
-0.15547430515289307,
-0.7048505544662476,
0.9143727421760559,
-0.3267033100128174,
-1.4114973545074463,
0.19001540541648865,
-0.7282638549804688,
0.06936703622341156,
-1.2033828496932983,
0.21219071745872498,
0.6873645782470703,
-0.6734187006950378,
0.07328595221042633,
-0.2222556173801422,
-1.1900482177734375,
-0.48437586426734924,
0.3430968225002289,
1.9534595012664795,
-0.675828218460083,
0.8464528918266296,
1.0707948207855225,
-0.706612765789032,
0.07009800523519516,
0.23121494054794312,
-0.30045804381370544,
0.8470484614372253,
-1.0697729587554932,
-0.48925527930259705,
1.2275032997131348,
-0.2771841287612915,
-0.6903067231178284,
1.436646580696106,
0.6545698046684265,
-1.045880675315857,
-0.27717065811157227,
-0.11204440146684647,
-0.8552948832511902,
0.06073947250843048,
-1.5393707752227783,
-0.1720450520515442,
0.4268227815628052,
-1.564723014831543,
-0.4381982982158661,
-0.2152196764945984,
1.3442275524139404,
-0.14571887254714966,
1.4943528175354004,
-0.39441508054733276,
-0.17306265234947205,
-0.19079682230949402,
-0.3747918903827667,
0.170342355966568,
-0.23051536083221436,
-0.5405100584030151,
0.17306429147720337,
-0.849220871925354,
0.2939266562461853,
1.447808027267456,
0.3485696017742157,
0.009227296337485313,
0.517217755317688,
1.1058931350708008,
0.4085230827331543,
-0.041395701467990875,
-0.8378642201423645,
-1.5016202926635742,
1.9586764574050903,
-1.4157663583755493,
1.989501953125,
0.7935287356376648,
-0.08620694279670715,
-1.763917326927185,
-1.8324767351150513,
1.286102294921875,
1.1171895265579224,
2.2486183643341064,
0.5213890075683594,
0.4064769446849823,
-0.8546390533447266,
-0.6943240165710449,
0.41431930661201477,
-1.0327867269515991,
-0.6605767011642456,
0.15027931332588196,
2.395869493484497,
1.7627761363983154,
-0.4253394901752472,
-0.20607692003250122,
-0.9278721809387207,
1.3575602769851685,
-0.2169153094291687,
0.256401002407074,
2.0277180671691895,
-0.22391963005065918,
-1.061044454574585,
1.3153218030929565,
-2.3278374671936035,
0.17196321487426758,
1.9823213815689087,
0.26807689666748047,
0.09152038395404816,
-1.3960142135620117,
-0.633056640625,
-0.36914148926734924,
-0.47190994024276733,
-1.2225933074951172,
0.5471629500389099,
-0.30500853061676025,
-0.816438615322113,
-1.3840148448944092,
0.13886117935180664,
-1.1391992568969727,
-1.7056032419204712,
0.25197651982307434,
1.9560432434082031,
2.0273938179016113,
-0.7759144306182861,
1.589918613433838,
-0.3080909848213196,
0.03282126411795616,
1.2032403945922852,
1.2930415868759155,
3.142282724380493,
1.8623555898666382,
-1.3050590753555298,
0.6295989751815796,
-0.13221623003482819,
-0.4144597053527832,
1.0846165418624878,
-1.2183613777160645,
1.259818196296692,
-0.15952154994010925,
-1.1634886264801025,
-1.1962121725082397,
1.0262868404388428,
0.499575138092041,
0.029029279947280884,
-0.49983957409858704,
1.2445701360702515,
0.08368509262800217,
1.3789572715759277,
0.5898305177688599,
-0.3861579895019531,
0.5621609091758728,
-0.3582610487937927,
-0.5508215427398682,
1.525159478187561,
0.15227347612380981,
-1.4462827444076538,
-2.2417821884155273,
-0.24646058678627014,
-0.8480626344680786,
0.02617696300148964,
-0.6556254625320435,
-0.9919543862342834,
1.741911768913269,
0.34350472688674927,
-1.256361484527588,
-0.343196302652359,
-0.37189018726348877,
-0.5489522814750671,
2.7208452224731445,
-1.251899242401123,
-0.14426583051681519,
-0.9777342677116394,
-0.5871932506561279,
1.6425098180770874,
-1.2665374279022217,
-0.24293962121009827,
-1.0571531057357788,
-0.5695192217826843,
-1.2527562379837036,
-0.5316147208213806,
0.03745609149336815,
-1.016445279121399,
0.781491756439209,
0.20902442932128906,
-1.147491216659546,
-0.3318141996860504,
-0.800406277179718,
0.958240270614624,
-0.07764752209186554,
0.15834593772888184,
1.9119982719421387,
0.3321666717529297,
-0.3801005482673645,
0.7742984294891357,
1.1456239223480225,
0.6554172039031982,
-0.6065738797187805,
0.12273331731557846,
-0.645411491394043,
0.37171581387519836,
-1.3433159589767456,
0.26495856046676636,
-2.911104679107666,
0.6834596395492554,
-0.0956205278635025,
-0.10651510953903198,
-0.031575459986925125,
-1.2697287797927856,
1.0805891752243042,
2.625516653060913,
-1.180474877357483,
0.5331721305847168,
0.3611277639865875,
1.0993627309799194,
-1.6312793493270874,
0.3676031529903412,
-0.41888609528541565,
2.091407299041748,
0.1758541762828827,
1.2497400045394897,
-0.4605761170387268,
-2.235405921936035,
0.7107335329055786,
-1.2137207984924316,
-1.1616215705871582,
0.7732853889465332,
-0.8700333833694458,
0.16603025794029236,
-1.444309115409851,
-0.21637234091758728,
-0.8661328554153442,
-1.2076468467712402,
0.6251165866851807,
0.17209085822105408,
0.3989093601703644,
-0.5933102965354919,
0.32522526383399963,
-2.234982490539551,
-1.4083482027053833,
-0.20374149084091187,
-0.9652397036552429,
0.4974774122238159,
-0.425335556268692,
0.6497347950935364,
-0.1356523633003235,
0.04140884056687355,
0.375657320022583,
1.4684112071990967,
3.4457972049713135,
0.17865434288978577,
0.22717401385307312,
-0.14501264691352844,
-0.9751414060592651,
1.4755603075027466,
0.8124998807907104,
-0.1863986849784851,
-0.5650508403778076,
-1.127404808998108,
1.287604570388794,
2.008697271347046,
1.0095458030700684,
0.05020197853446007,
-0.8176044225692749,
-0.7183942198753357,
-0.09467080980539322,
0.20303893089294434,
0.5221331715583801,
0.8874569535255432,
-0.002904521767050028,
0.09775201976299286,
1.4429584741592407,
1.1964813470840454,
-0.37173783779144287,
0.3072763681411743,
-0.8723706007003784,
-0.48071154952049255,
0.4909660220146179,
0.22661137580871582,
-0.03510243445634842,
0.4317254424095154,
-0.9938921332359314,
-0.2740319073200226,
-0.4085506200790405,
-0.8476358652114868,
-0.6495863795280457,
-0.3923039138317108,
-0.3421585261821747,
1.6216219663619995,
0.14340588450431824,
-0.4931457042694092,
-0.048047564923763275,
-0.6891067624092102,
-0.19469767808914185,
-1.1115204095840454,
0.2256653606891632,
-0.056784916669130325,
-0.16780409216880798,
-0.20278847217559814,
1.6364758014678955,
-0.9194419384002686,
-2.1242058277130127,
0.21518006920814514,
0.2826549708843231,
-0.2634150981903076,
0.23227769136428833,
1.7077676057815552,
0.48507627844810486,
1.4274909496307373,
1.2903591394424438,
0.9032042026519775,
-0.6314463019371033,
-1.2981185913085938,
0.6264002323150635,
0.9998133778572083,
-1.4309208393096924,
0.8257964849472046,
-0.10723428428173065,
-0.500375509262085,
0.6759522557258606,
1.2912918329238892,
0.5130940675735474,
-1.9952080249786377,
0.9313871264457703,
-0.9187434911727905,
0.7546307444572449,
0.6757752895355225,
0.7103037238121033,
0.17006683349609375,
0.8356785178184509,
-1.151655912399292,
-1.1778061389923096,
-0.6687033772468567,
-0.6890496611595154,
1.9658480882644653,
-0.3347087502479553,
0.631388783454895,
-0.2029675543308258,
-1.3123486042022705,
-0.12108258903026581,
0.6930006146430969,
0.3312886953353882,
-0.44302406907081604,
0.8777357339859009,
-0.664391815662384,
-1.0886486768722534,
-1.326673150062561,
-0.3888087570667267,
-1.061586856842041,
-0.9071998000144958,
1.0506463050842285,
0.7663585543632507,
0.32001620531082153,
1.9471759796142578,
0.6397462487220764,
0.3288094699382782,
-2.567171573638916,
0.9134446382522583,
0.3595944941043854,
-0.08026720583438873,
0.8827690482139587,
0.30166521668434143,
1.0486830472946167,
0.00691600888967514,
0.5266318917274475,
-2.415665626525879,
2.2939417362213135,
-0.1886177659034729,
0.7352904081344604,
0.01695999503135681,
-0.19493341445922852,
1.1015807390213013,
0.6141031384468079,
0.5771447420120239,
-1.0506678819656372,
0.6847776174545288,
-0.4801372289657593,
1.1680598258972168,
0.9036667943000793,
-0.7963306903839111,
-0.015196596272289753,
1.4235526323318481,
0.49990105628967285,
-0.5389482378959656,
-0.9433035850524902,
-0.8956436514854431,
0.8786904215812683,
1.7226002216339111,
-0.11273075640201569,
0.05282531678676605,
0.8115516304969788,
0.6222612261772156,
-1.203749179840088,
0.04567873850464821,
-0.6823588013648987,
-0.7796332836151123,
1.65831458568573,
2.0725107192993164,
-0.15931478142738342,
-0.2502818703651428,
-0.6833392977714539,
-1.2999205589294434,
0.8359101414680481,
-0.1887606680393219,
0.1553877592086792,
0.6270719170570374,
-0.6107433438301086,
1.0195190906524658,
0.7898948192596436,
1.0143804550170898,
0.10074160993099213,
0.2371203899383545,
0.4249470829963684,
-0.31838497519493103,
-1.1408424377441406,
-0.2445524036884308,
-1.0965341329574585,
-2.610637903213501,
0.4237569570541382,
-0.23479801416397095,
-1.4036273956298828,
-0.03654371201992035,
-0.9818778038024902,
0.9621233344078064,
-0.6224488615989685,
-1.1079699993133545,
-1.4623675346374512,
0.25965914130210876,
-0.061822112649679184,
0.9022635817527771,
-1.6790934801101685,
-0.24652931094169617,
1.2425521612167358,
0.876239538192749,
-0.6442573070526123,
0.9415903091430664,
0.18370872735977173,
1.0417944192886353,
0.8018112778663635,
-0.34439709782600403,
0.5402706265449524,
0.0014038849622011185,
-1.3454511165618896,
0.46523797512054443,
1.1816136837005615,
0.17181289196014404,
1.5578874349594116,
-0.4983420968055725,
0.021784478798508644,
0.38196685910224915,
-0.6276838183403015,
-0.4456830620765686,
-0.4613981544971466,
0.6851494908332825,
-0.006916401907801628,
-0.9688253402709961,
-0.1203257218003273,
-0.1524600088596344,
-0.32438138127326965,
0.10215896368026733,
-1.425018548965454,
-0.1671215295791626,
-0.4096403121948242,
-0.5020341873168945,
-1.2780054807662964,
-0.08796326071023941,
1.3656901121139526,
-0.7635442614555359,
-0.24107149243354797,
0.43925151228904724,
0.4032604396343231,
0.5533740520477295,
0.6978243589401245,
-0.7744901776313782,
-0.29889941215515137,
-0.2450152039527893,
-0.31388092041015625,
0.3323133885860443,
1.357757806777954,
-0.08299155533313751,
-0.9365158677101135,
0.6636722683906555,
-0.3154057562351227,
0.15684375166893005,
1.9524693489074707,
0.05086597800254822,
-0.7025133371353149,
0.33046287298202515,
-0.7051297426223755,
1.8679275512695312,
1.7334537506103516,
1.2861071825027466,
-0.14724689722061157,
-0.8914405703544617,
0.6346591114997864,
-0.37722504138946533,
-0.3759213089942932,
0.8199011087417603,
0.42935946583747864,
-0.23821720480918884,
-1.4387001991271973,
0.7332803606987,
1.1669329404830933,
-0.8594714999198914,
-0.7572503685951233,
0.12843367457389832,
-0.7751041054725647,
1.1015950441360474,
0.586107075214386,
0.3312571346759796,
0.313831090927124,
1.673905849456787,
0.8406504988670349,
-0.4777045249938965,
0.5301327705383301,
0.5356112718582153,
-0.21591368317604065,
-2.146317481994629,
-1.1085398197174072,
0.3787015676498413,
-0.5093210339546204,
-1.5910348892211914,
1.3686516284942627,
-1.0991886854171753,
-1.0373377799987793,
0.5201656222343445,
0.0010490482673048973,
1.3813081979751587,
0.3759724795818329,
1.5975404977798462,
2.10009765625,
0.8624523282051086,
0.41242650151252747,
1.2848010063171387,
-0.10730508714914322,
-0.4675215482711792,
1.8417754173278809,
-0.46699294447898865,
0.45313435792922974,
1.1075806617736816,
-0.33734482526779175,
-1.0309288501739502,
-0.7732497453689575,
-1.2714698314666748,
-0.7080603241920471,
1.188273310661316,
0.054924994707107544,
-1.0868157148361206,
0.2598225176334381,
1.5888679027557373,
0.13426533341407776,
-0.321897953748703,
0.5865799188613892,
0.4299758970737457,
-0.7733007073402405,
-0.09394014626741409,
-0.846599817276001,
0.49562186002731323,
-0.20079690217971802,
-0.36011165380477905,
0.30224958062171936,
0.45891159772872925,
1.4374529123306274,
-0.1175219938158989,
0.11390566825866699,
1.086269497871399,
-1.4600836038589478,
1.4840202331542969,
-0.6240638494491577,
0.2839885354042053,
-2.375166893005371,
1.3591411113739014,
-0.8041180968284607,
1.9823120832443237,
-2.621116876602173,
0.46823814511299133,
-0.5486845970153809,
-0.5149905681610107,
0.2575761675834656,
-0.37935489416122437,
0.10340537130832672,
-0.12831516563892365,
-1.0682308673858643,
-0.025761067867279053,
-0.6152536273002625,
0.6578165888786316,
1.1541218757629395,
1.370481014251709,
-1.1508182287216187,
-0.2185787856578827,
-1.6665228605270386,
-0.13585978746414185,
-0.7876937985420227,
0.32018205523490906,
-2.014997720718384,
-0.1707889437675476,
-1.9578131437301636,
-2.3624300956726074,
-1.2489360570907593,
-0.8150098323822021,
1.0875639915466309,
0.1270086169242859,
-0.9113729000091553,
1.2253292798995972,
-0.34413155913352966,
-1.8812024593353271,
1.1232595443725586,
-2.189462900161743
] |
https://github.com/huggingface/datasets/issues/6037 | Documentation links to examples are broken | These docs are outdated (version 1.2.1 is over two years old). Please refer to [this](https://huggingface.co/docs/datasets/dataset_script) version instead.
Initially, we hosted datasets in this repo, but now you can find them [on the HF Hub](https://huggingface.co/datasets) (e.g. the [`ag_news`](https://huggingface.co/datasets/ag_news/blob/main/ag_news.py) script) | ### Describe the bug
The links at the bottom of [add_dataset](https://huggingface.co/docs/datasets/v1.2.1/add_dataset.html) to examples of specific datasets are all broken, for example
- text classification: [ag_news](https://github.com/huggingface/datasets/blob/master/datasets/ag_news/ag_news.py) (original data are in csv files)
### Steps to reproduce the bug
Click on links to examples from latest documentation
### Expected behavior
Links should be up to date - it might be more stable to link to https://huggingface.co/datasets/ag_news/blob/main/ag_news.py
### Environment info
dataset v1.2.1 | 27 | 38 | Documentation links to examples are broken
### Describe the bug
The links at the bottom of [add_dataset](https://huggingface.co/docs/datasets/v1.2.1/add_dataset.html) to examples of specific datasets are all broken, for example
- text classification: [ag_news](https://github.com/huggingface/datasets/blob/master/datasets/ag_news/ag_news.py) (original data are in csv files)
### Steps to reproduce the bug
Click on links to examples from latest documentation
### Expected behavior
Links should be up to date - it might be more stable to link to https://huggingface.co/datasets/ag_news/blob/main/ag_news.py
### Environment info
dataset v1.2.1
These docs are outdated (version 1.2.1 is over two years old). Please refer to [this](https://huggingface.co/docs/datasets/dataset_script) version instead.
Initially, we hosted datasets in this repo, but now you can find them [on the HF Hub](https://huggingface.co/datasets) (e.g. the [`ag_news`](https://huggingface.co/datasets/ag_news/blob/main/ag_news.py) script) | [
-1.201838731765747,
-0.8922097682952881,
-0.6922095417976379,
1.4508154392242432,
-0.05030794069170952,
-1.3228124380111694,
0.06119988486170769,
-0.9711858630180359,
1.5745917558670044,
-0.6364167332649231,
0.32652443647384644,
-1.6934266090393066,
-0.08025117218494415,
-0.4993923604488373,
-0.7132911086082458,
-0.9548888802528381,
-0.3697667121887207,
-0.7751343250274658,
0.9559768438339233,
2.556353807449341,
1.2215131521224976,
-1.40086030960083,
2.695465564727783,
0.6684297323226929,
-0.15372323989868164,
-1.1245512962341309,
0.5413325428962708,
0.07263822853565216,
-1.339471459388733,
-0.4253084361553192,
-0.9594334959983826,
-0.0064528342336416245,
-0.5433380007743835,
-0.5290317535400391,
0.12536592781543732,
0.36183053255081177,
-0.1518065482378006,
-0.24240998923778534,
-0.6783203482627869,
-0.7692200541496277,
0.41423365473747253,
-0.3642968237400055,
0.9203229546546936,
-0.40391308069229126,
1.779578447341919,
-0.5650821328163147,
0.46483176946640015,
0.684226393699646,
1.3522214889526367,
0.124139204621315,
0.05208483710885048,
0.3481765389442444,
0.3805478811264038,
0.06971171498298645,
0.5434667468070984,
1.204041600227356,
0.6926079392433167,
0.40223902463912964,
0.5803036689758301,
-2.1965250968933105,
1.2886552810668945,
-0.8190845847129822,
0.24011996388435364,
1.4123222827911377,
-0.9347065687179565,
0.3473028242588043,
-1.6878870725631714,
-0.11233799159526825,
0.6365410685539246,
-2.314096212387085,
0.11186498403549194,
-1.268627643585205,
-0.520723283290863,
1.0640915632247925,
0.3770882189273834,
-1.2317163944244385,
0.16705501079559326,
-0.5309777855873108,
1.0480135679244995,
0.5812475681304932,
1.157358169555664,
-1.6650924682617188,
-0.005052519496530294,
-0.20626482367515564,
0.03613365441560745,
-1.297186017036438,
-1.6312029361724854,
0.49539363384246826,
0.664847195148468,
0.7726572751998901,
-0.10616645216941833,
0.8719334006309509,
-1.0284464359283447,
0.7850810885429382,
-0.8395340442657471,
-1.7357532978057861,
-1.3526142835617065,
-2.424257755279541,
-2.318864583969116,
0.8742903470993042,
-0.47996410727500916,
-0.4426490068435669,
1.966996669769287,
-1.0045409202575684,
-1.83915114402771,
1.0930581092834473,
0.3097299337387085,
0.06530505418777466,
2.418384552001953,
0.2119952142238617,
-0.70866459608078,
0.3562573492527008,
-0.637416422367096,
0.7801921367645264,
-0.29482579231262207,
1.298440933227539,
0.5561485886573792,
-1.040725588798523,
1.5342000722885132,
-0.49727147817611694,
0.5118752121925354,
-0.6954283714294434,
-0.45220234990119934,
-0.750437319278717,
0.24035201966762543,
1.8864086866378784,
-0.4357277452945709,
1.6069645881652832,
-0.26203441619873047,
-1.5228078365325928,
-1.541772723197937,
0.75999915599823,
0.47310373187065125,
-0.7719946503639221,
0.036873187869787216,
-0.4912586808204651,
0.110038623213768,
-0.004683013539761305,
1.123948335647583,
1.139422059059143,
0.5386643409729004,
-0.34634220600128174,
-0.8439865112304688,
0.2934466600418091,
-0.08183906972408295,
-0.6557220816612244,
-1.8605678081512451,
-0.3173023462295532,
0.22945885360240936,
0.6097882986068726,
-1.2688713073730469,
1.7658265829086304,
0.7510378360748291,
1.9772433042526245,
0.9959473013877869,
-0.3426100015640259,
1.4784175157546997,
-0.053271498531103134,
1.9005836248397827,
-0.5410576462745667,
0.6471399068832397,
-0.28104597330093384,
-1.2402650117874146,
0.7680972218513489,
-0.5029246211051941,
-2.0338940620422363,
-0.838258683681488,
-0.7738717794418335,
-0.12211132049560547,
-0.7056498527526855,
0.9994778037071228,
-0.2757892906665802,
-1.3243424892425537,
0.11126688122749329,
-0.7651636600494385,
0.15067626535892487,
-1.3056896924972534,
0.11291931569576263,
0.7997477054595947,
-0.7118293642997742,
-0.10300780832767487,
-0.276156485080719,
-1.3509001731872559,
-0.47067415714263916,
0.35981619358062744,
1.8058536052703857,
-0.7130452990531921,
0.9323463439941406,
0.9872030019760132,
-0.7328980565071106,
0.22307398915290833,
0.2784799039363861,
-0.3016306757926941,
0.8663499355316162,
-1.0751087665557861,
-0.4326803386211395,
1.1804240942001343,
-0.1894150674343109,
-0.8294427990913391,
1.5364168882369995,
0.8489148020744324,
-1.038926601409912,
-0.2275206595659256,
-0.1627589613199234,
-0.7934257984161377,
0.042570196092128754,
-1.642587661743164,
-0.1388421654701233,
0.3560275733470917,
-1.4341856241226196,
-0.36518770456314087,
-0.20837576687335968,
1.4224236011505127,
-0.11595474183559418,
1.4729979038238525,
-0.2993917167186737,
-0.14076851308345795,
-0.40690314769744873,
-0.44895535707473755,
0.1592126339673996,
-0.22279466688632965,
-0.6340380311012268,
0.3239688277244568,
-0.8994148373603821,
0.281583309173584,
1.4329760074615479,
0.4198334813117981,
0.11708050966262817,
0.5944246649742126,
1.0463958978652954,
0.3019328713417053,
-0.21442319452762604,
-0.8657272458076477,
-1.6998814344406128,
2.0648229122161865,
-1.2395946979522705,
1.9951860904693604,
0.850177526473999,
-0.14265160262584686,
-1.7382220029830933,
-1.8853756189346313,
1.333820104598999,
1.1296796798706055,
2.399153470993042,
0.5003154873847961,
0.4134410619735718,
-0.8229634761810303,
-0.7503466010093689,
0.3066767752170563,
-0.9281420111656189,
-0.7338027954101562,
0.11773164570331573,
2.341675281524658,
1.842340350151062,
-0.46632811427116394,
-0.1604757308959961,
-1.0489492416381836,
1.2370967864990234,
-0.3132674992084503,
0.20020583271980286,
2.0618162155151367,
-0.3240734338760376,
-0.9651570320129395,
1.343660831451416,
-2.3263895511627197,
0.29034021496772766,
2.075259208679199,
0.27306678891181946,
0.03271375223994255,
-1.4901748895645142,
-0.6801447868347168,
-0.4032886326313019,
-0.3794384300708771,
-1.155042052268982,
0.5989904999732971,
-0.3545045554637909,
-0.9538988471031189,
-1.394149899482727,
0.030090320855379105,
-1.1143929958343506,
-1.804058313369751,
0.3838021755218506,
1.7485381364822388,
1.9290270805358887,
-0.7860028147697449,
1.400057077407837,
-0.2100609838962555,
0.07243730127811432,
1.3441580533981323,
1.3490269184112549,
3.0589184761047363,
1.9570729732513428,
-1.3004459142684937,
0.8332834243774414,
-0.10293669998645782,
-0.4821675419807434,
1.1327321529388428,
-1.0940250158309937,
1.2158524990081787,
-0.16387183964252472,
-1.4008620977401733,
-1.2432234287261963,
1.1856573820114136,
0.5442628264427185,
0.013824984431266785,
-0.5736703276634216,
1.3515576124191284,
-0.0026501822285354137,
1.3682997226715088,
0.5875594019889832,
-0.3881484568119049,
0.5166775584220886,
-0.3391178846359253,
-0.5965827703475952,
1.5661094188690186,
0.15868660807609558,
-1.585876703262329,
-2.3123669624328613,
-0.2536831498146057,
-0.877327561378479,
-0.22169721126556396,
-0.7363853454589844,
-0.9631848931312561,
1.6090766191482544,
0.45923155546188354,
-1.2420332431793213,
-0.3323693871498108,
-0.31572088599205017,
-0.538689911365509,
2.686915159225464,
-1.3457887172698975,
-0.11847925186157227,
-1.0620571374893188,
-0.423885703086853,
1.5647287368774414,
-1.1560605764389038,
-0.11144226789474487,
-1.1048383712768555,
-0.778100848197937,
-1.2929582595825195,
-0.5313687920570374,
0.09919941425323486,
-0.9485383033752441,
0.6852670311927795,
-0.0241851769387722,
-1.116836428642273,
-0.2910679876804352,
-0.8917907476425171,
1.002748966217041,
-0.11251971125602722,
0.2694610059261322,
1.9033478498458862,
0.452673077583313,
-0.4681653678417206,
0.6239023804664612,
1.1860171556472778,
0.6744275689125061,
-0.7201926112174988,
0.14106130599975586,
-0.7219736576080322,
0.3091782033443451,
-1.4796396493911743,
0.12774896621704102,
-2.914414644241333,
0.7043994665145874,
-0.13400554656982422,
-0.04979580640792847,
-0.02343340963125229,
-1.1979365348815918,
1.0931769609451294,
2.563474416732788,
-1.2840325832366943,
0.44899609684944153,
0.42585399746894836,
1.0594760179519653,
-1.5178784132003784,
0.26557663083076477,
-0.5099879503250122,
2.0300309658050537,
0.08609628677368164,
1.1966068744659424,
-0.5196950435638428,
-1.9505109786987305,
0.7373225688934326,
-1.203059434890747,
-0.9317371845245361,
0.8615409731864929,
-0.8619158267974854,
0.31349343061447144,
-1.440129041671753,
0.021403422579169273,
-0.7929162383079529,
-1.1743733882904053,
0.6670985221862793,
0.004083053208887577,
0.3824254274368286,
-0.5458932518959045,
0.37788188457489014,
-2.0963027477264404,
-1.3549789190292358,
-0.15716706216335297,
-1.0049567222595215,
0.5708091259002686,
-0.27656957507133484,
0.6205372214317322,
-0.08218301832675934,
0.07998910546302795,
0.2700718641281128,
1.3598631620407104,
3.4060215950012207,
0.18623888492584229,
0.21977120637893677,
-0.04387355595827103,
-1.0111666917800903,
1.4507780075073242,
0.9998350739479065,
-0.19965490698814392,
-0.49602413177490234,
-0.8775012493133545,
1.3888092041015625,
1.9940707683563232,
1.2338322401046753,
0.16868235170841217,
-0.9344309568405151,
-0.8647732734680176,
0.06128475442528725,
0.2297516018152237,
0.4482347369194031,
0.9136059284210205,
-0.04091793671250343,
0.11579851806163788,
1.490233063697815,
1.2933794260025024,
-0.37136587500572205,
0.5171858072280884,
-0.9941943883895874,
-0.5124484896659851,
0.44209372997283936,
0.24990828335285187,
0.10707621276378632,
0.5570753812789917,
-1.1425153017044067,
-0.26020699739456177,
-0.31572240591049194,
-0.8779990077018738,
-0.7401243448257446,
-0.4497879147529602,
-0.4942067265510559,
1.5792444944381714,
0.06221133843064308,
-0.43703120946884155,
0.10663387179374695,
-0.7886068224906921,
-0.23316505551338196,
-0.9800342321395874,
0.3210735619068146,
-0.11736354231834412,
-0.007030102424323559,
-0.20686054229736328,
1.6353492736816406,
-1.0170557498931885,
-2.2118093967437744,
0.2761310636997223,
0.23744305968284607,
-0.4092668294906616,
0.13023041188716888,
1.7066069841384888,
0.5254783034324646,
1.4478435516357422,
1.2534154653549194,
0.9289594292640686,
-0.6050798892974854,
-1.2381573915481567,
0.7126032710075378,
1.0679177045822144,
-1.45560622215271,
0.9092438817024231,
-0.18617631494998932,
-0.6011504530906677,
0.6958532333374023,
1.3448867797851562,
0.38625022768974304,
-1.873421311378479,
0.8454983830451965,
-0.8474698066711426,
0.7896316051483154,
0.6346273422241211,
0.8152663111686707,
0.2334980070590973,
0.8217443823814392,
-1.433524250984192,
-1.1684547662734985,
-0.7324152588844299,
-0.5765971541404724,
1.8754737377166748,
-0.19085097312927246,
0.5054677724838257,
-0.26105543971061707,
-1.3121874332427979,
-0.16004660725593567,
0.7523583173751831,
0.35062798857688904,
-0.4497467577457428,
1.0013481378555298,
-0.5457702279090881,
-0.9861127138137817,
-1.3437520265579224,
-0.4327141046524048,
-0.9377052783966064,
-0.821770191192627,
1.0052292346954346,
0.8284099102020264,
0.41915246844291687,
1.802794337272644,
0.5009695887565613,
0.2915888726711273,
-2.663019895553589,
0.9440725445747375,
0.22910131514072418,
-0.06762272119522095,
0.8707771897315979,
0.217510387301445,
1.1366792917251587,
-0.04676061123609543,
0.5643690228462219,
-2.3125128746032715,
2.191155433654785,
-0.1719590127468109,
0.5696147680282593,
0.02770346775650978,
-0.11885955929756165,
1.0836085081100464,
0.5534336566925049,
0.6437062621116638,
-1.174320936203003,
0.7552323937416077,
-0.5799164772033691,
1.1620229482650757,
0.9004403352737427,
-0.9049766659736633,
-0.041246045380830765,
1.4227373600006104,
0.5445523262023926,
-0.3527050316333771,
-0.9162209630012512,
-0.8047084808349609,
0.9814601540565491,
1.6722098588943481,
0.04989571496844292,
0.015516366809606552,
0.9241511821746826,
0.6008322834968567,
-1.3471225500106812,
0.058867115527391434,
-0.7395799160003662,
-0.6179382801055908,
1.7247905731201172,
2.082284927368164,
-0.06556674838066101,
-0.20333018898963928,
-0.7369771599769592,
-1.167855143547058,
0.6898572444915771,
-0.10121910274028778,
0.1010640561580658,
0.8897410035133362,
-0.6331426501274109,
1.1159512996673584,
0.6134024858474731,
0.9484182000160217,
-0.037552155554294586,
0.2079438865184784,
0.2519313097000122,
-0.3364049196243286,
-1.2572170495986938,
-0.36614084243774414,
-1.1480368375778198,
-2.504528522491455,
0.3377574384212494,
-0.30631354451179504,
-1.5212719440460205,
0.04111889749765396,
-1.1697256565093994,
0.9264984726905823,
-0.6390641331672668,
-1.0674219131469727,
-1.4786458015441895,
0.38945266604423523,
-0.17056332528591156,
0.9043055772781372,
-1.6501116752624512,
-0.12421892583370209,
1.250160574913025,
0.8634417057037354,
-0.5024795532226562,
0.9480597972869873,
0.2959502637386322,
1.0201970338821411,
0.7528278827667236,
-0.28166037797927856,
0.4795134365558624,
0.1648494005203247,
-1.42524254322052,
0.47718703746795654,
1.1100385189056396,
0.2647339403629303,
1.3192399740219116,
-0.4491259753704071,
0.18064337968826294,
0.48673295974731445,
-0.575930655002594,
-0.48917824029922485,
-0.4277425706386566,
0.797325849533081,
0.12367329001426697,
-1.0877487659454346,
-0.07169069349765778,
-0.17484639585018158,
-0.223201721906662,
0.1712999939918518,
-1.515884280204773,
-0.20474252104759216,
-0.2750985026359558,
-0.5172988772392273,
-1.2425674200057983,
0.05637713894248009,
1.376444935798645,
-0.9190896153450012,
-0.24798895418643951,
0.5247640013694763,
0.2909539043903351,
0.6158061027526855,
0.7248750329017639,
-0.6511505246162415,
-0.2907014489173889,
-0.3016471266746521,
-0.2587719261646271,
0.23439127206802368,
1.2152179479599,
-0.12128584086894989,
-1.0129106044769287,
0.8802237510681152,
-0.41810348629951477,
0.20111487805843353,
1.9987802505493164,
0.01173771359026432,
-0.8296968936920166,
0.3272014558315277,
-0.6481339335441589,
1.8462737798690796,
1.6962556838989258,
1.306530237197876,
-0.11305585503578186,
-0.8896568417549133,
0.4911647439002991,
-0.1915339082479477,
-0.2952859699726105,
0.8712324500083923,
0.43809884786605835,
-0.1823064386844635,
-1.316583275794983,
0.4889604449272156,
1.2903293371200562,
-0.8743541240692139,
-0.750480592250824,
0.14948859810829163,
-0.9500508308410645,
1.130161166191101,
0.685073971748352,
0.3551722764968872,
0.22078703343868256,
1.5051051378250122,
0.6775992512702942,
-0.44676917791366577,
0.39591264724731445,
0.517887532711029,
-0.2343202829360962,
-2.038675308227539,
-0.9110491871833801,
0.2595069706439972,
-0.47351205348968506,
-1.50349760055542,
1.2089883089065552,
-1.2242952585220337,
-0.8272448778152466,
0.4734109342098236,
0.12706339359283447,
1.4186594486236572,
0.25052300095558167,
1.7245060205459595,
2.0554728507995605,
0.9937064051628113,
0.2338109165430069,
1.334057331085205,
0.05431729927659035,
-0.35709384083747864,
1.7382632493972778,
-0.30944105982780457,
0.5630866885185242,
0.9729757905006409,
-0.44028061628341675,
-1.0727307796478271,
-0.8032838106155396,
-1.1832040548324585,
-0.5303099751472473,
1.1808003187179565,
0.13609014451503754,
-1.1117339134216309,
0.11185845732688904,
1.495400309562683,
0.1495169699192047,
-0.2288365364074707,
0.7097559571266174,
0.40404215455055237,
-0.6425071358680725,
-0.05802421644330025,
-0.8626156449317932,
0.5634108781814575,
-0.15654423832893372,
-0.23505531251430511,
0.3064872622489929,
0.5073802471160889,
1.238552451133728,
-0.06712637841701508,
0.19138601422309875,
1.190024495124817,
-1.3185863494873047,
1.52930748462677,
-0.5929690003395081,
0.25732991099357605,
-2.4979941844940186,
1.416045904159546,
-0.7589908242225647,
1.790522575378418,
-2.5185656547546387,
0.4691285490989685,
-0.6223828196525574,
-0.48772764205932617,
0.26710617542266846,
-0.5241934657096863,
0.09600037336349487,
-0.05347732454538345,
-1.0797927379608154,
-0.174757719039917,
-0.8022356033325195,
0.5652709603309631,
1.2353085279464722,
1.3687565326690674,
-1.0963282585144043,
-0.2824116349220276,
-1.8543137311935425,
-0.20217810571193695,
-0.859107255935669,
0.5276879668235779,
-1.9541765451431274,
-0.12844900786876678,
-1.8946454524993896,
-2.505077600479126,
-1.4376262426376343,
-0.7832603454589844,
1.0315052270889282,
0.23713664710521698,
-0.9037400484085083,
1.0908880233764648,
-0.359527051448822,
-1.8190317153930664,
1.070320963859558,
-2.3448240756988525
] |
https://github.com/huggingface/datasets/issues/6034 | load_dataset hangs on WSL | Even if a dataset is cached, we still make requests to check whether the cache is up-to-date. [This](https://huggingface.co/docs/datasets/v2.13.1/en/loading#offline) section in the docs explains how to avoid them and directly load the cached version. | ### Describe the bug
load_dataset simply hangs. It happens once every ~5 times, and interestingly hangs for a multiple of 5 minutes (hangs for 5/10/15 minutes). Using the profiler in PyCharm shows that it spends the time at <method 'connect' of '_socket.socket' objects>. However, a local cache is available so I am not sure why socket is needed. ([profiler result](https://ibb.co/0Btbbp8))
It only happens on WSL for me. It works for native Windows and my MacBook. (cache quickly recognized and loaded within a second).
### Steps to reproduce the bug
I am using Ubuntu 22.04.2 LTS (GNU/Linux 5.15.90.1-microsoft-standard-WSL2 x86_64)
Python 3.10.10 (main, Mar 21 2023, 18:45:11) [GCC 11.2.0] on linux
>>> import datasets
>>> datasets.load_dataset('ai2_arc', 'ARC-Challenge') # hangs for 5/10/15 minutes
### Expected behavior
cache quickly recognized and loaded within a second
### Environment info
Please let me know if I should provide more environment information. | 28 | 33 | load_dataset hangs on WSL
### Describe the bug
load_dataset simply hangs. It happens once every ~5 times, and interestingly hangs for a multiple of 5 minutes (hangs for 5/10/15 minutes). Using the profiler in PyCharm shows that it spends the time at <method 'connect' of '_socket.socket' objects>. However, a local cache is available so I am not sure why socket is needed. ([profiler result](https://ibb.co/0Btbbp8))
It only happens on WSL for me. It works for native Windows and my MacBook. (cache quickly recognized and loaded within a second).
### Steps to reproduce the bug
I am using Ubuntu 22.04.2 LTS (GNU/Linux 5.15.90.1-microsoft-standard-WSL2 x86_64)
Python 3.10.10 (main, Mar 21 2023, 18:45:11) [GCC 11.2.0] on linux
>>> import datasets
>>> datasets.load_dataset('ai2_arc', 'ARC-Challenge') # hangs for 5/10/15 minutes
### Expected behavior
cache quickly recognized and loaded within a second
### Environment info
Please let me know if I should provide more environment information.
Even if a dataset is cached, we still make requests to check whether the cache is up-to-date. [This](https://huggingface.co/docs/datasets/v2.13.1/en/loading#offline) section in the docs explains how to avoid them and directly load the cached version. | [
-1.2228678464889526,
-0.9821550846099854,
-0.7424820065498352,
1.4652351140975952,
-0.06262974441051483,
-1.1958858966827393,
0.06592405587434769,
-1.0115690231323242,
1.7043321132659912,
-0.717893660068512,
0.24771787226200104,
-1.6565674543380737,
-0.04175431653857231,
-0.5186669230461121,
-0.6928482055664062,
-0.9165083765983582,
-0.38003987073898315,
-0.8692708015441895,
1.0786625146865845,
2.617154836654663,
1.1243420839309692,
-1.4399354457855225,
2.7182741165161133,
0.6912992596626282,
-0.19586247205734253,
-1.045579195022583,
0.5591615438461304,
-0.01309066079556942,
-1.3468350172042847,
-0.4284111261367798,
-0.9979000091552734,
-0.051773540675640106,
-0.5431501865386963,
-0.44979536533355713,
0.07648598402738571,
0.26576584577560425,
-0.14561618864536285,
-0.4491058588027954,
-0.546746015548706,
-0.7259663939476013,
0.3844031095504761,
-0.41654902696609497,
0.9005213379859924,
-0.3017210364341736,
1.8160051107406616,
-0.5673880577087402,
0.4319714307785034,
0.6132807731628418,
1.3566491603851318,
0.23508603870868683,
-0.015506512485444546,
0.4017983675003052,
0.41562753915786743,
0.020967865362763405,
0.5356833338737488,
1.101325511932373,
0.6614630818367004,
0.45306432247161865,
0.6671838164329529,
-2.256737470626831,
1.309556484222412,
-0.9957396984100342,
0.34028804302215576,
1.3123711347579956,
-0.9179227948188782,
0.3584144711494446,
-1.7914336919784546,
-0.06924471259117126,
0.6033593416213989,
-2.2705800533294678,
0.19987161457538605,
-1.2953996658325195,
-0.47556906938552856,
0.9551876187324524,
0.35269761085510254,
-1.3003708124160767,
0.07108406722545624,
-0.551160454750061,
1.0408666133880615,
0.418212890625,
1.152467131614685,
-1.7484793663024902,
-0.07832452654838562,
-0.2963826060295105,
0.14376859366893768,
-1.2959136962890625,
-1.563999056816101,
0.5687878727912903,
0.7051376700401306,
0.5760521292686462,
-0.002478389535099268,
0.8860360980033875,
-1.0064985752105713,
0.7359375953674316,
-0.866218626499176,
-1.7561062574386597,
-1.4466044902801514,
-2.375070095062256,
-2.342775821685791,
0.773668646812439,
-0.43282490968704224,
-0.5056310892105103,
2.0348973274230957,
-1.012551188468933,
-1.801756501197815,
1.1952975988388062,
0.25397664308547974,
-0.0027466220781207085,
2.4529168605804443,
0.13493677973747253,
-0.7246429324150085,
0.43693679571151733,
-0.7032711505889893,
0.7983483076095581,
-0.4229174256324768,
1.3474812507629395,
0.42083197832107544,
-0.9555932879447937,
1.583938717842102,
-0.3983590602874756,
0.5189523696899414,
-0.6512535810470581,
-0.46568071842193604,
-0.8357096910476685,
0.2848445177078247,
1.9658482074737549,
-0.3406389355659485,
1.6187018156051636,
-0.32907795906066895,
-1.5310043096542358,
-1.5710035562515259,
0.819360613822937,
0.4539322257041931,
-0.8196508288383484,
0.09018630534410477,
-0.3722245693206787,
0.12514877319335938,
0.016713524237275124,
1.0816171169281006,
1.217705488204956,
0.6305152177810669,
-0.32713693380355835,
-0.961834192276001,
0.25106745958328247,
-0.15412698686122894,
-0.6660811901092529,
-1.8093186616897583,
-0.35737377405166626,
0.12739510834217072,
0.6484301090240479,
-1.2620600461959839,
1.6468579769134521,
0.8326831459999084,
1.973191738128662,
1.073828935623169,
-0.359855592250824,
1.526942253112793,
0.07139033824205399,
1.8207876682281494,
-0.5330502390861511,
0.6972743272781372,
-0.30751973390579224,
-1.1567069292068481,
0.8082987070083618,
-0.409152090549469,
-1.991692304611206,
-0.733746349811554,
-0.8276575803756714,
-0.18328145146369934,
-0.7626786828041077,
0.8763344287872314,
-0.316356360912323,
-1.3915486335754395,
0.2676433324813843,
-0.8180913329124451,
0.13720135390758514,
-1.257668137550354,
0.29961466789245605,
0.7386059165000916,
-0.5267679691314697,
0.0854928120970726,
-0.29783254861831665,
-1.3459347486495972,
-0.4145474433898926,
0.2695203423500061,
1.8731193542480469,
-0.7375686764717102,
0.8926600217819214,
1.0266427993774414,
-0.7111032009124756,
0.045059043914079666,
0.3781864047050476,
-0.2568305730819702,
0.9465001821517944,
-1.0484479665756226,
-0.35261887311935425,
1.231145977973938,
-0.20807383954524994,
-0.6108014583587646,
1.4395004510879517,
0.7497608661651611,
-0.9999893307685852,
-0.21612732112407684,
-0.14107200503349304,
-0.7931472659111023,
0.0031883707270026207,
-1.691721796989441,
-0.20241838693618774,
0.30827319622039795,
-1.5526151657104492,
-0.4386237859725952,
-0.2441180944442749,
1.3203308582305908,
-0.08596160262823105,
1.4446722269058228,
-0.33398884534835815,
-0.13944649696350098,
-0.3288835287094116,
-0.45170730352401733,
0.15004658699035645,
-0.24998082220554352,
-0.5744591951370239,
0.3314003348350525,
-0.810885488986969,
0.34262174367904663,
1.417216181755066,
0.38221120834350586,
0.11692255735397339,
0.5852938890457153,
0.9360907673835754,
0.39400267601013184,
-0.06776593625545502,
-0.8950141668319702,
-1.7000126838684082,
2.112156867980957,
-1.420556902885437,
1.939886212348938,
0.8503804206848145,
-0.08704671263694763,
-1.784899115562439,
-1.8902748823165894,
1.313240647315979,
1.142114281654358,
2.332646608352661,
0.555194616317749,
0.45016705989837646,
-0.7809211611747742,
-0.6895156502723694,
0.2859150767326355,
-1.0027273893356323,
-0.839974045753479,
0.08370371907949448,
2.372407913208008,
1.7410639524459839,
-0.4041290879249573,
-0.07692758738994598,
-0.9705169200897217,
1.4542994499206543,
-0.16087424755096436,
0.19921475648880005,
1.9707638025283813,
-0.23802749812602997,
-1.026667594909668,
1.283519983291626,
-2.309319019317627,
0.20694182813167572,
2.0086865425109863,
0.26412391662597656,
0.0513148233294487,
-1.5032038688659668,
-0.7227140665054321,
-0.289547860622406,
-0.3592984080314636,
-1.1765786409378052,
0.5692059993743896,
-0.2601664066314697,
-0.826823353767395,
-1.5523611307144165,
0.11667525768280029,
-1.131314754486084,
-1.678747296333313,
0.24163390696048737,
1.8651047945022583,
2.0213382244110107,
-0.7491641044616699,
1.424666166305542,
-0.17897771298885345,
0.11896362900733948,
1.2107059955596924,
1.1812856197357178,
3.1284680366516113,
1.9854844808578491,
-1.2279788255691528,
0.7405967116355896,
-0.15474383533000946,
-0.438737690448761,
1.133676290512085,
-1.2001491785049438,
1.244170904159546,
-0.14410842955112457,
-1.2034605741500854,
-1.1930921077728271,
1.0292266607284546,
0.48545968532562256,
-0.028222888708114624,
-0.4897056818008423,
1.2811007499694824,
0.006428065709769726,
1.2962288856506348,
0.47817671298980713,
-0.34633809328079224,
0.5503528118133545,
-0.4278830289840698,
-0.5643497705459595,
1.5979152917861938,
0.2348487824201584,
-1.424328088760376,
-2.301483154296875,
-0.2001618593931198,
-0.8675973415374756,
-0.03485704958438873,
-0.6188606023788452,
-1.0429078340530396,
1.6178231239318848,
0.3865385055541992,
-1.1780869960784912,
-0.29800260066986084,
-0.28653842210769653,
-0.6277367472648621,
2.7013590335845947,
-1.3986836671829224,
-0.21732382476329803,
-1.048334002494812,
-0.5413917303085327,
1.5787030458450317,
-1.2369513511657715,
-0.17312411963939667,
-0.9573867917060852,
-0.6522430777549744,
-1.230587124824524,
-0.568976104259491,
-0.03616677224636078,
-0.9245370030403137,
0.7972106337547302,
0.19465723633766174,
-1.0918011665344238,
-0.2554326057434082,
-0.8853374719619751,
0.8849772810935974,
0.0029894383624196053,
0.24698583781719208,
1.9007169008255005,
0.37654781341552734,
-0.36546725034713745,
0.6889649629592896,
1.1558648347854614,
0.6089107990264893,
-0.6836404204368591,
0.1302022635936737,
-0.639593243598938,
0.36524301767349243,
-1.3205469846725464,
0.30019521713256836,
-2.886453628540039,
0.6417231559753418,
-0.0620858408510685,
-0.09852161258459091,
-0.03540300577878952,
-1.225721001625061,
1.0617753267288208,
2.6067352294921875,
-1.218205213546753,
0.49293339252471924,
0.3249237537384033,
1.2117794752120972,
-1.5782238245010376,
0.3088366389274597,
-0.45405423641204834,
2.2051050662994385,
0.2394946962594986,
1.172877550125122,
-0.46022266149520874,
-2.2861597537994385,
0.6054104566574097,
-1.2888797521591187,
-1.1015796661376953,
0.6953171491622925,
-0.9454482197761536,
0.1304938942193985,
-1.4106591939926147,
-0.1595037579536438,
-0.789373517036438,
-1.226813554763794,
0.6673726439476013,
0.009831691160798073,
0.4536327123641968,
-0.5008460283279419,
0.3548113703727722,
-2.1393332481384277,
-1.376543641090393,
-0.13921698927879333,
-0.9876662492752075,
0.49142301082611084,
-0.32535552978515625,
0.679017186164856,
-0.16101105511188507,
0.05679551512002945,
0.3540423512458801,
1.3692524433135986,
3.419980525970459,
0.14598120748996735,
0.3431083559989929,
-0.10436981916427612,
-0.9942052364349365,
1.3880058526992798,
0.8926678895950317,
-0.19337961077690125,
-0.5837545990943909,
-1.0442063808441162,
1.445099949836731,
1.9751278162002563,
1.0412434339523315,
0.14694802463054657,
-0.7706827521324158,
-0.7063320875167847,
0.018874144181609154,
0.2568426728248596,
0.4629415273666382,
0.8772146105766296,
0.03896569833159447,
0.12702858448028564,
1.492652177810669,
1.2592352628707886,
-0.42245274782180786,
0.4462064504623413,
-0.8661772012710571,
-0.47341954708099365,
0.4578222632408142,
0.3120114207267761,
0.02438030019402504,
0.42820388078689575,
-1.038119912147522,
-0.22859835624694824,
-0.4017009735107422,
-0.9110060930252075,
-0.7154123783111572,
-0.3466596007347107,
-0.3557692766189575,
1.6534663438796997,
0.16221070289611816,
-0.4738314151763916,
0.015853378921747208,
-0.7283934354782104,
-0.02630542404949665,
-1.0397727489471436,
0.30092567205429077,
-0.07407253235578537,
-0.10645848512649536,
-0.019214464351534843,
1.761522889137268,
-0.9350361227989197,
-2.1341047286987305,
0.22073602676391602,
0.2692289352416992,
-0.325461745262146,
0.1890925019979477,
1.6451938152313232,
0.4712243676185608,
1.421594500541687,
1.3021397590637207,
0.9528213143348694,
-0.7074447870254517,
-1.3353832960128784,
0.6259675025939941,
1.0003528594970703,
-1.3794749975204468,
0.8599427938461304,
-0.0841507762670517,
-0.5910854339599609,
0.61875319480896,
1.3058496713638306,
0.4249764084815979,
-1.9332963228225708,
0.8242232799530029,
-0.9281026124954224,
0.7960056662559509,
0.6230440735816956,
0.7829049229621887,
0.19318246841430664,
0.781467616558075,
-1.3374627828598022,
-1.146870493888855,
-0.8110947608947754,
-0.6540142893791199,
1.9610381126403809,
-0.25051742792129517,
0.5222028493881226,
-0.19039775431156158,
-1.3680657148361206,
-0.08919140696525574,
0.6543573141098022,
0.27423596382141113,
-0.454581618309021,
0.8841119408607483,
-0.6676799058914185,
-1.190643072128296,
-1.4175677299499512,
-0.4670237898826599,
-1.0267438888549805,
-0.9309011101722717,
1.1176279783248901,
0.8389273881912231,
0.310849130153656,
1.8748352527618408,
0.5130285024642944,
0.2742531895637512,
-2.6655380725860596,
0.8668970465660095,
0.2696758508682251,
-0.031180502846837044,
0.8838938474655151,
0.21740037202835083,
1.0213313102722168,
-0.005920602940022945,
0.5776003003120422,
-2.2552695274353027,
2.219590663909912,
-0.19810070097446442,
0.7257446646690369,
-0.010418104939162731,
-0.04686830937862396,
0.9773280620574951,
0.5771185755729675,
0.7034029364585876,
-1.0988115072250366,
0.6791103482246399,
-0.5687990784645081,
1.2425020933151245,
0.9371615052223206,
-0.7890034914016724,
-0.013184178620576859,
1.3441650867462158,
0.4556490182876587,
-0.4844479560852051,
-0.9502320885658264,
-0.9584711790084839,
0.9616252183914185,
1.7585957050323486,
-0.051623642444610596,
-0.04963192343711853,
0.8429273962974548,
0.6163434386253357,
-1.3326622247695923,
0.04896566644310951,
-0.7673805952072144,
-0.6995407938957214,
1.6267495155334473,
2.139246702194214,
-0.09656467288732529,
-0.20431427657604218,
-0.703478991985321,
-1.2880895137786865,
0.7070556879043579,
-0.04733629524707794,
0.05001519247889519,
0.6927716732025146,
-0.614641547203064,
1.116153597831726,
0.8455159068107605,
1.0081192255020142,
0.1441686749458313,
0.2673739194869995,
0.2962617874145508,
-0.28552472591400146,
-1.1990876197814941,
-0.3001617193222046,
-1.105455994606018,
-2.524409294128418,
0.45013898611068726,
-0.2361963391304016,
-1.4933627843856812,
0.09745372831821442,
-1.0511980056762695,
0.8766794204711914,
-0.5271100401878357,
-1.0648834705352783,
-1.3991210460662842,
0.24742425978183746,
-0.12891757488250732,
0.8898994326591492,
-1.6426268815994263,
-0.1087745651602745,
1.2271193265914917,
0.9478427171707153,
-0.5916082262992859,
1.0783973932266235,
0.2927137017250061,
0.9901077151298523,
0.87702476978302,
-0.3971956968307495,
0.5502821207046509,
0.125848188996315,
-1.2644861936569214,
0.4847847819328308,
1.1563910245895386,
0.2720261812210083,
1.4018064737319946,
-0.6093003153800964,
0.023155443370342255,
0.4282016158103943,
-0.49157828092575073,
-0.37542128562927246,
-0.49666327238082886,
0.6928002238273621,
0.016575684770941734,
-0.9333626627922058,
-0.02460744045674801,
-0.10113794356584549,
-0.21301685273647308,
0.20185476541519165,
-1.4919447898864746,
-0.18262822926044464,
-0.4065448045730591,
-0.5223374366760254,
-1.2773103713989258,
-0.08151591569185257,
1.4091362953186035,
-0.9013652801513672,
-0.17943686246871948,
0.48678380250930786,
0.43652939796447754,
0.574331521987915,
0.6535943150520325,
-0.6006263494491577,
-0.38749974966049194,
-0.1806877702474594,
-0.3633129596710205,
0.2946184277534485,
1.262471079826355,
-0.19798049330711365,
-1.0252488851547241,
0.7358132600784302,
-0.3495383858680725,
0.11189669370651245,
1.8928321599960327,
0.1185450404882431,
-0.8316182494163513,
0.25198835134506226,
-0.6903328895568848,
1.9190385341644287,
1.6182875633239746,
1.318878173828125,
-0.10242970287799835,
-0.9352298974990845,
0.6617163419723511,
-0.1593647003173828,
-0.37918752431869507,
0.8270309567451477,
0.46703964471817017,
-0.17440102994441986,
-1.3835645914077759,
0.5622127056121826,
1.1930376291275024,
-0.9089235067367554,
-0.7847756743431091,
0.0731029063463211,
-0.8224453926086426,
1.1383616924285889,
0.721718966960907,
0.3849834203720093,
0.13207212090492249,
1.6636346578598022,
0.7759488821029663,
-0.5635197162628174,
0.4686136841773987,
0.533433198928833,
-0.17878301441669464,
-2.125784158706665,
-0.9681510329246521,
0.26123303174972534,
-0.4707380533218384,
-1.6176713705062866,
1.2814441919326782,
-1.1598397493362427,
-0.8785058259963989,
0.5037060379981995,
0.11552378535270691,
1.4733452796936035,
0.27290576696395874,
1.621548056602478,
2.0539801120758057,
0.9510612487792969,
0.2790488004684448,
1.296937108039856,
-0.0832325890660286,
-0.36097413301467896,
1.7539249658584595,
-0.3741951584815979,
0.564672589302063,
1.0760059356689453,
-0.4795915484428406,
-1.02829110622406,
-0.7082146406173706,
-1.1954950094223022,
-0.6508652567863464,
1.1460965871810913,
0.11512965708971024,
-1.1156532764434814,
0.21866074204444885,
1.5605895519256592,
0.1375807523727417,
-0.2554718554019928,
0.5499585270881653,
0.4486774206161499,
-0.7207962870597839,
-0.08612773567438126,
-0.9893585443496704,
0.47380805015563965,
-0.20518837869167328,
-0.3250964879989624,
0.27011895179748535,
0.3954387903213501,
1.311095952987671,
0.029920663684606552,
0.1337321698665619,
1.244911789894104,
-1.391200304031372,
1.4985778331756592,
-0.587099015712738,
0.23651260137557983,
-2.4250619411468506,
1.4089184999465942,
-0.7829205989837646,
1.8891690969467163,
-2.666250705718994,
0.44388771057128906,
-0.6550742983818054,
-0.43784475326538086,
0.3060208559036255,
-0.34728509187698364,
0.1187313050031662,
-0.1687745451927185,
-1.0782920122146606,
-0.1461797058582306,
-0.6935518383979797,
0.5328364372253418,
1.1510051488876343,
1.3354213237762451,
-1.0739037990570068,
-0.23506276309490204,
-1.7670962810516357,
-0.14144176244735718,
-0.777760922908783,
0.3969438076019287,
-1.934226155281067,
-0.1291772574186325,
-1.909763216972351,
-2.4028098583221436,
-1.3347434997558594,
-0.7786089777946472,
1.073045253753662,
0.11760123074054718,
-0.920390784740448,
1.1389515399932861,
-0.3377615213394165,
-1.8055258989334106,
1.0929632186889648,
-2.192197799682617
] |
https://github.com/huggingface/datasets/issues/6034 | load_dataset hangs on WSL | Thanks - that works! However it doesn't resolve the original issue (but I am not sure if it is a WSL problem) | ### Describe the bug
load_dataset simply hangs. It happens once every ~5 times, and interestingly hangs for a multiple of 5 minutes (hangs for 5/10/15 minutes). Using the profiler in PyCharm shows that it spends the time at <method 'connect' of '_socket.socket' objects>. However, a local cache is available so I am not sure why socket is needed. ([profiler result](https://ibb.co/0Btbbp8))
It only happens on WSL for me. It works for native Windows and my MacBook. (cache quickly recognized and loaded within a second).
### Steps to reproduce the bug
I am using Ubuntu 22.04.2 LTS (GNU/Linux 5.15.90.1-microsoft-standard-WSL2 x86_64)
Python 3.10.10 (main, Mar 21 2023, 18:45:11) [GCC 11.2.0] on linux
>>> import datasets
>>> datasets.load_dataset('ai2_arc', 'ARC-Challenge') # hangs for 5/10/15 minutes
### Expected behavior
cache quickly recognized and loaded within a second
### Environment info
Please let me know if I should provide more environment information. | 28 | 22 | load_dataset hangs on WSL
### Describe the bug
load_dataset simply hangs. It happens once every ~5 times, and interestingly hangs for a multiple of 5 minutes (hangs for 5/10/15 minutes). Using the profiler in PyCharm shows that it spends the time at <method 'connect' of '_socket.socket' objects>. However, a local cache is available so I am not sure why socket is needed. ([profiler result](https://ibb.co/0Btbbp8))
It only happens on WSL for me. It works for native Windows and my MacBook. (cache quickly recognized and loaded within a second).
### Steps to reproduce the bug
I am using Ubuntu 22.04.2 LTS (GNU/Linux 5.15.90.1-microsoft-standard-WSL2 x86_64)
Python 3.10.10 (main, Mar 21 2023, 18:45:11) [GCC 11.2.0] on linux
>>> import datasets
>>> datasets.load_dataset('ai2_arc', 'ARC-Challenge') # hangs for 5/10/15 minutes
### Expected behavior
cache quickly recognized and loaded within a second
### Environment info
Please let me know if I should provide more environment information.
Thanks - that works! However it doesn't resolve the original issue (but I am not sure if it is a WSL problem) | [
-1.2606147527694702,
-1.025841474533081,
-0.7423518300056458,
1.4611889123916626,
-0.08388272672891617,
-1.1834825277328491,
0.060363709926605225,
-1.0104409456253052,
1.7091079950332642,
-0.726340115070343,
0.27476975321769714,
-1.6232661008834839,
0.004051377065479755,
-0.540695071220398,
-0.6806443929672241,
-0.9047511219978333,
-0.37046006321907043,
-0.8734069466590881,
1.1104124784469604,
2.6270503997802734,
1.1184930801391602,
-1.472700595855713,
2.7393648624420166,
0.6847144365310669,
-0.16461676359176636,
-1.0472279787063599,
0.5210445523262024,
-0.04493414983153343,
-1.3384166955947876,
-0.4525541663169861,
-1.007536768913269,
-0.08336730301380157,
-0.5364722609519958,
-0.4543304741382599,
0.06591562181711197,
0.26725059747695923,
-0.16589601337909698,
-0.4519025683403015,
-0.5100255012512207,
-0.7328407764434814,
0.39256295561790466,
-0.43492332100868225,
0.8789607882499695,
-0.31040018796920776,
1.804136872291565,
-0.5555320382118225,
0.4572311341762543,
0.6051779389381409,
1.3494714498519897,
0.2546793818473816,
-0.05336537957191467,
0.42232251167297363,
0.4491228461265564,
0.037346046417951584,
0.5348419547080994,
1.0836191177368164,
0.6779453158378601,
0.44808486104011536,
0.6550828218460083,
-2.2468228340148926,
1.283586025238037,
-1.0183135271072388,
0.29830092191696167,
1.2823480367660522,
-0.9347102046012878,
0.3630664050579071,
-1.7643606662750244,
-0.08725493401288986,
0.6238301396369934,
-2.2917375564575195,
0.18423083424568176,
-1.279822826385498,
-0.4835028052330017,
0.9744069576263428,
0.3590094745159149,
-1.3323758840560913,
0.02178819105029106,
-0.5505824089050293,
1.0348221063613892,
0.4156247079372406,
1.1300231218338013,
-1.7459355592727661,
-0.08121617138385773,
-0.3131331205368042,
0.18419736623764038,
-1.2923475503921509,
-1.5486799478530884,
0.5874165296554565,
0.6690187454223633,
0.5784965753555298,
0.011490211822092533,
0.8754007816314697,
-1.039207935333252,
0.7393209934234619,
-0.9182490110397339,
-1.7265698909759521,
-1.4675288200378418,
-2.3635754585266113,
-2.3381130695343018,
0.7792118787765503,
-0.40442943572998047,
-0.4904118478298187,
1.999996542930603,
-1.034950613975525,
-1.7697789669036865,
1.2246755361557007,
0.21975401043891907,
-0.04626651480793953,
2.49082350730896,
0.11849217861890793,
-0.7552925944328308,
0.5125149488449097,
-0.7110589742660522,
0.7632471919059753,
-0.46698710322380066,
1.3822699785232544,
0.4314816892147064,
-0.931617259979248,
1.5984805822372437,
-0.4015773832798004,
0.5074647665023804,
-0.6069114208221436,
-0.475320428609848,
-0.8441633582115173,
0.32463955879211426,
1.9968093633651733,
-0.3294009268283844,
1.6249608993530273,
-0.3348788917064667,
-1.5373883247375488,
-1.5914939641952515,
0.8344778418540955,
0.43187767267227173,
-0.8440204858779907,
0.13487552106380463,
-0.38460075855255127,
0.15140371024608612,
-0.022856455296278,
1.073705792427063,
1.2231396436691284,
0.6565878391265869,
-0.2899712920188904,
-0.9113642573356628,
0.3077964186668396,
-0.14425772428512573,
-0.6347376704216003,
-1.794091820716858,
-0.390636682510376,
0.06971819698810577,
0.6885097622871399,
-1.228732705116272,
1.6814992427825928,
0.8351050615310669,
1.9619957208633423,
1.0968493223190308,
-0.3452345132827759,
1.520634412765503,
0.09034480154514313,
1.8113536834716797,
-0.5072929263114929,
0.704356849193573,
-0.3022634983062744,
-1.1450856924057007,
0.7875094413757324,
-0.4248187243938446,
-1.9946664571762085,
-0.7206376791000366,
-0.8193790316581726,
-0.1540609896183014,
-0.8027945160865784,
0.9005939364433289,
-0.310532808303833,
-1.4027204513549805,
0.32942190766334534,
-0.8528652191162109,
0.16038796305656433,
-1.2490246295928955,
0.356437087059021,
0.7392547130584717,
-0.5217494368553162,
0.13982175290584564,
-0.28758475184440613,
-1.3098996877670288,
-0.4085041284561157,
0.23656466603279114,
1.8993198871612549,
-0.7649269700050354,
0.8801789879798889,
0.9991081953048706,
-0.6643315553665161,
0.04916461184620857,
0.3931393027305603,
-0.22487474977970123,
0.926969051361084,
-1.0514755249023438,
-0.35219240188598633,
1.2868916988372803,
-0.2603883147239685,
-0.5609995722770691,
1.4316357374191284,
0.7509798407554626,
-0.984242856502533,
-0.19097784161567688,
-0.1467410922050476,
-0.7727409601211548,
0.015802405774593353,
-1.7128784656524658,
-0.17394210398197174,
0.3422503173351288,
-1.5634225606918335,
-0.4208834171295166,
-0.2349732220172882,
1.2982888221740723,
-0.08613291382789612,
1.4390813112258911,
-0.3913024663925171,
-0.1169147938489914,
-0.32190605998039246,
-0.44185590744018555,
0.15872257947921753,
-0.26362454891204834,
-0.5564612746238708,
0.2952065169811249,
-0.7928079962730408,
0.350589394569397,
1.4107102155685425,
0.4141620695590973,
0.12147649377584457,
0.6008155941963196,
0.943777322769165,
0.39767542481422424,
-0.07198839634656906,
-0.8702437877655029,
-1.677688717842102,
2.1360740661621094,
-1.430523157119751,
1.958773136138916,
0.8430178761482239,
-0.12167434394359589,
-1.773707628250122,
-1.891457200050354,
1.278485655784607,
1.1301616430282593,
2.312300205230713,
0.5943877696990967,
0.45069798827171326,
-0.7905581593513489,
-0.6928616762161255,
0.27871331572532654,
-0.9949411153793335,
-0.8769809007644653,
0.07660794258117676,
2.3593592643737793,
1.744789481163025,
-0.38640326261520386,
-0.05907093361020088,
-0.9763850569725037,
1.4605315923690796,
-0.16637274622917175,
0.2576497793197632,
1.940420150756836,
-0.25296348333358765,
-1.0376602411270142,
1.2743656635284424,
-2.2978780269622803,
0.18804927170276642,
2.0097782611846924,
0.26563534140586853,
0.032335035502910614,
-1.5030044317245483,
-0.710902988910675,
-0.2666063904762268,
-0.31722551584243774,
-1.188288688659668,
0.5553023219108582,
-0.2864469289779663,
-0.8577215671539307,
-1.5289863348007202,
0.13149234652519226,
-1.1000208854675293,
-1.6397972106933594,
0.22769027948379517,
1.8526703119277954,
2.0467207431793213,
-0.7369221448898315,
1.428558349609375,
-0.14766007661819458,
0.14011210203170776,
1.2543878555297852,
1.1382414102554321,
3.110507011413574,
1.968115210533142,
-1.2266159057617188,
0.7314503788948059,
-0.16837376356124878,
-0.42138078808784485,
1.1160659790039062,
-1.242981195449829,
1.252338171005249,
-0.14079484343528748,
-1.1969945430755615,
-1.1765506267547607,
0.9919863939285278,
0.47433918714523315,
-0.029816780239343643,
-0.4681442975997925,
1.2978262901306152,
-0.017758574336767197,
1.3098443746566772,
0.45900797843933105,
-0.3100394010543823,
0.5561414957046509,
-0.42995110154151917,
-0.5501891374588013,
1.5821616649627686,
0.2484893798828125,
-1.4422259330749512,
-2.281841993331909,
-0.17356224358081818,
-0.8788379430770874,
-0.026129942387342453,
-0.6132206320762634,
-1.0174058675765991,
1.5958982706069946,
0.3636779189109802,
-1.1679564714431763,
-0.29985177516937256,
-0.27944982051849365,
-0.6043641567230225,
2.7473838329315186,
-1.409461259841919,
-0.2774030864238739,
-1.0538904666900635,
-0.5594315528869629,
1.603019118309021,
-1.2610061168670654,
-0.1663798838853836,
-0.9576706290245056,
-0.6363910436630249,
-1.23328697681427,
-0.5710551142692566,
-0.05962799862027168,
-0.9096697568893433,
0.839233934879303,
0.25591468811035156,
-1.0692732334136963,
-0.28452444076538086,
-0.849776029586792,
0.8320714831352234,
-0.004805309697985649,
0.3029640018939972,
1.889811635017395,
0.3200225830078125,
-0.3898252844810486,
0.6997451782226562,
1.1563944816589355,
0.6040461659431458,
-0.6562016010284424,
0.13904348015785217,
-0.6389604806900024,
0.4292740821838379,
-1.2726507186889648,
0.3003423511981964,
-2.869786500930786,
0.6594029068946838,
-0.08509749174118042,
-0.12032034993171692,
-0.08054256439208984,
-1.2570711374282837,
1.0673795938491821,
2.5873584747314453,
-1.2083055973052979,
0.4999975264072418,
0.2941681146621704,
1.2275758981704712,
-1.5820907354354858,
0.3398378789424896,
-0.4556277096271515,
2.2413270473480225,
0.28953680396080017,
1.1642200946807861,
-0.44153109192848206,
-2.3300304412841797,
0.6465069651603699,
-1.2628029584884644,
-1.1136152744293213,
0.6769062876701355,
-0.9623984694480896,
0.11971358209848404,
-1.405327320098877,
-0.17288075387477875,
-0.7964539527893066,
-1.2022206783294678,
0.6446071863174438,
0.030264608561992645,
0.47824332118034363,
-0.4882899820804596,
0.3494190573692322,
-2.1156058311462402,
-1.3943142890930176,
-0.13987158238887787,
-0.9934505224227905,
0.4887634217739105,
-0.33858728408813477,
0.7104105353355408,
-0.17457415163516998,
0.012337190099060535,
0.38529637455940247,
1.3996303081512451,
3.4434359073638916,
0.15175144374370575,
0.35130447149276733,
-0.11793571710586548,
-0.9658304452896118,
1.3854137659072876,
0.8696907758712769,
-0.20543085038661957,
-0.603207528591156,
-1.0339299440383911,
1.4812017679214478,
1.9670699834823608,
0.9787954688072205,
0.1382906138896942,
-0.7103294134140015,
-0.6630006432533264,
-0.01736009493470192,
0.23164890706539154,
0.4607519805431366,
0.8687512278556824,
0.03681230545043945,
0.1208214983344078,
1.4997928142547607,
1.2804286479949951,
-0.44067707657814026,
0.4390890598297119,
-0.8459396958351135,
-0.4517887830734253,
0.4922870099544525,
0.3109441101551056,
-0.003467161674052477,
0.3885027766227722,
-1.0327270030975342,
-0.19800466299057007,
-0.37817659974098206,
-0.9422633051872253,
-0.7343284487724304,
-0.2996111512184143,
-0.3600623905658722,
1.6656043529510498,
0.16539621353149414,
-0.4972580373287201,
0.015402835793793201,
-0.7824408411979675,
-0.052256278693675995,
-1.026708722114563,
0.28410983085632324,
-0.08118720352649689,
-0.13853628933429718,
-0.021312806755304337,
1.76689612865448,
-0.9043886065483093,
-2.137301445007324,
0.22783617675304413,
0.2669360637664795,
-0.2990259528160095,
0.1978510469198227,
1.6443355083465576,
0.4708312153816223,
1.4327573776245117,
1.3051025867462158,
0.9394453167915344,
-0.7188429236412048,
-1.3206332921981812,
0.647080659866333,
0.9793199300765991,
-1.4010825157165527,
0.8295184969902039,
-0.08155585080385208,
-0.5779674649238586,
0.5967524647712708,
1.279849648475647,
0.47814884781837463,
-1.8883686065673828,
0.8101934790611267,
-0.9554111361503601,
0.8073889017105103,
0.6318244338035583,
0.7606143355369568,
0.2180594950914383,
0.8129522800445557,
-1.3296977281570435,
-1.1315661668777466,
-0.8153237104415894,
-0.6780984997749329,
1.9357227087020874,
-0.2756686508655548,
0.5129532217979431,
-0.14595261216163635,
-1.3489519357681274,
-0.07801700383424759,
0.6406691074371338,
0.25108587741851807,
-0.4079013168811798,
0.86538165807724,
-0.7078337669372559,
-1.2070164680480957,
-1.3955557346343994,
-0.48166635632514954,
-1.0285346508026123,
-0.9786603450775146,
1.1327197551727295,
0.8318670988082886,
0.2795812785625458,
1.8949766159057617,
0.5387954711914062,
0.2628875970840454,
-2.651771306991577,
0.8825199007987976,
0.23601718246936798,
-0.0431235246360302,
0.9049602746963501,
0.19773760437965393,
1.0171716213226318,
0.028836891055107117,
0.5761070251464844,
-2.2852566242218018,
2.234114408493042,
-0.2174941897392273,
0.6972306370735168,
-0.007345565594732761,
-0.023005763068795204,
0.9770915508270264,
0.5822241902351379,
0.6524377465248108,
-1.093183159828186,
0.7009275555610657,
-0.6013332009315491,
1.286609172821045,
0.936443567276001,
-0.8078482151031494,
-0.013579271733760834,
1.2828924655914307,
0.43619605898857117,
-0.5332017540931702,
-0.954555869102478,
-0.9743474721908569,
0.9494889974594116,
1.7679306268692017,
-0.04178563505411148,
-0.07742514461278915,
0.8305220603942871,
0.6135711669921875,
-1.3139857053756714,
0.03922608867287636,
-0.7436479330062866,
-0.7151901125907898,
1.6473479270935059,
2.095792293548584,
-0.0886649638414383,
-0.20006076991558075,
-0.6717795729637146,
-1.3115980625152588,
0.7259802222251892,
-0.003527479711920023,
0.0375656932592392,
0.6804110407829285,
-0.635109543800354,
1.085313081741333,
0.8934081792831421,
1.024437665939331,
0.17531387507915497,
0.24806615710258484,
0.2796548008918762,
-0.2743646204471588,
-1.2103501558303833,
-0.3055737018585205,
-1.1355642080307007,
-2.562276840209961,
0.4460611939430237,
-0.24700933694839478,
-1.479970097541809,
0.10317888855934143,
-1.0307574272155762,
0.8797169327735901,
-0.5065947771072388,
-1.0733026266098022,
-1.4103903770446777,
0.228780135512352,
-0.126438707113266,
0.9017321467399597,
-1.6247225999832153,
-0.13309349119663239,
1.2206259965896606,
0.9828415513038635,
-0.6043009161949158,
1.080650806427002,
0.3063657581806183,
1.0268715620040894,
0.8551589250564575,
-0.4081784188747406,
0.5798001885414124,
0.06919042021036148,
-1.2902060747146606,
0.5359365940093994,
1.181925892829895,
0.2486383616924286,
1.438920021057129,
-0.6178150773048401,
-0.0017225355841219425,
0.41905197501182556,
-0.5391835570335388,
-0.40352100133895874,
-0.507938802242279,
0.6914448738098145,
-0.011988243088126183,
-0.9006430506706238,
-0.03195859119296074,
-0.07789262384176254,
-0.20940491557121277,
0.17969578504562378,
-1.4987200498580933,
-0.13315080106258392,
-0.40386807918548584,
-0.5738950967788696,
-1.2766696214675903,
-0.11318153887987137,
1.4067015647888184,
-0.8882090449333191,
-0.195942685008049,
0.48934200406074524,
0.45075538754463196,
0.5613684058189392,
0.6492906808853149,
-0.6237574815750122,
-0.4292750656604767,
-0.1794285774230957,
-0.3855569660663605,
0.31818267703056335,
1.2635217905044556,
-0.2092653512954712,
-1.0788263082504272,
0.7401309609413147,
-0.3325745165348053,
0.10195010900497437,
1.8466393947601318,
0.13738049566745758,
-0.816051721572876,
0.21230904757976532,
-0.7390120625495911,
1.938002586364746,
1.5886952877044678,
1.2838619947433472,
-0.10639657080173492,
-0.9448162913322449,
0.6865136623382568,
-0.19356364011764526,
-0.37435564398765564,
0.7717989683151245,
0.4516918361186981,
-0.18473917245864868,
-1.3718942403793335,
0.5819311141967773,
1.1163431406021118,
-0.9089915752410889,
-0.7614916563034058,
0.030849050730466843,
-0.7922694087028503,
1.176963448524475,
0.7172410488128662,
0.39053165912628174,
0.16856415569782257,
1.7240439653396606,
0.791225016117096,
-0.5286378264427185,
0.4454144537448883,
0.543817937374115,
-0.17661820352077484,
-2.15751576423645,
-0.9787927865982056,
0.2638433873653412,
-0.49869662523269653,
-1.601086139678955,
1.2599002122879028,
-1.1246538162231445,
-0.8391932845115662,
0.5280080437660217,
0.12558738887310028,
1.4595656394958496,
0.2877483069896698,
1.6174695491790771,
2.026766061782837,
0.9528422951698303,
0.26618629693984985,
1.257834792137146,
-0.13578054308891296,
-0.3414149582386017,
1.7522815465927124,
-0.37146392464637756,
0.5821912884712219,
1.090002417564392,
-0.4957026541233063,
-1.0398708581924438,
-0.6946542859077454,
-1.2075575590133667,
-0.6558173894882202,
1.096052885055542,
0.11497475206851959,
-1.139194369316101,
0.20899970829486847,
1.5421236753463745,
0.10197094082832336,
-0.25424420833587646,
0.47302913665771484,
0.41776013374328613,
-0.718839704990387,
-0.08058962970972061,
-0.9650768637657166,
0.48936188220977783,
-0.21080318093299866,
-0.37041375041007996,
0.2826975882053375,
0.38975539803504944,
1.29688560962677,
0.0036434121429920197,
0.11047516018152237,
1.2883408069610596,
-1.391018271446228,
1.4875202178955078,
-0.6366114616394043,
0.2054855078458786,
-2.3690640926361084,
1.3518370389938354,
-0.8074292540550232,
1.9303120374679565,
-2.6847550868988037,
0.4974640905857086,
-0.6645699143409729,
-0.4363767206668854,
0.3366803526878357,
-0.33228886127471924,
0.12496922165155411,
-0.1784258633852005,
-1.0673034191131592,
-0.14668169617652893,
-0.6790979504585266,
0.5162065029144287,
1.1347707509994507,
1.3360439538955688,
-1.0721244812011719,
-0.19625307619571686,
-1.730464220046997,
-0.11103318631649017,
-0.8022974133491516,
0.3711104393005371,
-1.973193883895874,
-0.11179424822330475,
-1.9456582069396973,
-2.3509740829467773,
-1.3216530084609985,
-0.7517712712287903,
1.1074658632278442,
0.082208551466465,
-0.8942003846168518,
1.1568732261657715,
-0.3271341025829315,
-1.783978819847107,
1.0857518911361694,
-2.2213518619537354
] |
https://github.com/huggingface/datasets/issues/6034 | load_dataset hangs on WSL | We use `requests` to make HTTP requests (and `aiohttp` in the streaming mode), so I don't think we can provide much help regarding the socket issue (it probably has something to do with WSL). | ### Describe the bug
load_dataset simply hangs. It happens once every ~5 times, and interestingly hangs for a multiple of 5 minutes (hangs for 5/10/15 minutes). Using the profiler in PyCharm shows that it spends the time at <method 'connect' of '_socket.socket' objects>. However, a local cache is available so I am not sure why socket is needed. ([profiler result](https://ibb.co/0Btbbp8))
It only happens on WSL for me. It works for native Windows and my MacBook. (cache quickly recognized and loaded within a second).
### Steps to reproduce the bug
I am using Ubuntu 22.04.2 LTS (GNU/Linux 5.15.90.1-microsoft-standard-WSL2 x86_64)
Python 3.10.10 (main, Mar 21 2023, 18:45:11) [GCC 11.2.0] on linux
>>> import datasets
>>> datasets.load_dataset('ai2_arc', 'ARC-Challenge') # hangs for 5/10/15 minutes
### Expected behavior
cache quickly recognized and loaded within a second
### Environment info
Please let me know if I should provide more environment information. | 28 | 34 | load_dataset hangs on WSL
### Describe the bug
load_dataset simply hangs. It happens once every ~5 times, and interestingly hangs for a multiple of 5 minutes (hangs for 5/10/15 minutes). Using the profiler in PyCharm shows that it spends the time at <method 'connect' of '_socket.socket' objects>. However, a local cache is available so I am not sure why socket is needed. ([profiler result](https://ibb.co/0Btbbp8))
It only happens on WSL for me. It works for native Windows and my MacBook. (cache quickly recognized and loaded within a second).
### Steps to reproduce the bug
I am using Ubuntu 22.04.2 LTS (GNU/Linux 5.15.90.1-microsoft-standard-WSL2 x86_64)
Python 3.10.10 (main, Mar 21 2023, 18:45:11) [GCC 11.2.0] on linux
>>> import datasets
>>> datasets.load_dataset('ai2_arc', 'ARC-Challenge') # hangs for 5/10/15 minutes
### Expected behavior
cache quickly recognized and loaded within a second
### Environment info
Please let me know if I should provide more environment information.
We use `requests` to make HTTP requests (and `aiohttp` in the streaming mode), so I don't think we can provide much help regarding the socket issue (it probably has something to do with WSL). | [
-1.2554733753204346,
-1.0141922235488892,
-0.7413086295127869,
1.4800934791564941,
-0.10498398542404175,
-1.1705819368362427,
0.08941688388586044,
-1.0425829887390137,
1.704733967781067,
-0.7188597321510315,
0.2837793231010437,
-1.6243011951446533,
-0.002514083869755268,
-0.5275703072547913,
-0.6943632364273071,
-0.9070106148719788,
-0.4018852710723877,
-0.8636388182640076,
1.078696846961975,
2.627031087875366,
1.1405773162841797,
-1.4617334604263306,
2.7226288318634033,
0.6969813704490662,
-0.16469964385032654,
-1.0524418354034424,
0.5046252608299255,
-0.04769778624176979,
-1.3315237760543823,
-0.45012468099594116,
-0.9884543418884277,
-0.09131927788257599,
-0.5504341721534729,
-0.46862292289733887,
0.0613381490111351,
0.26109778881073,
-0.16663235425949097,
-0.46778643131256104,
-0.49064910411834717,
-0.7439139485359192,
0.4141249656677246,
-0.44213420152664185,
0.899035632610321,
-0.2980833053588867,
1.800614833831787,
-0.5671624541282654,
0.45220011472702026,
0.622208297252655,
1.3568638563156128,
0.2300848662853241,
-0.06293787062168121,
0.4288145899772644,
0.4524235129356384,
0.05856844037771225,
0.527594268321991,
1.0794373750686646,
0.6893928647041321,
0.4412429928779602,
0.6565052270889282,
-2.2430591583251953,
1.2628439664840698,
-1.0507657527923584,
0.32391947507858276,
1.276261806488037,
-0.9130126237869263,
0.346643328666687,
-1.7653428316116333,
-0.10139427334070206,
0.634895384311676,
-2.2819278240203857,
0.20913700759410858,
-1.2978414297103882,
-0.4531397223472595,
0.9710176587104797,
0.3312634825706482,
-1.3297324180603027,
0.04622986540198326,
-0.5302416682243347,
1.045387864112854,
0.427686870098114,
1.1403714418411255,
-1.7809010744094849,
-0.08231489360332489,
-0.3390393853187561,
0.15882554650306702,
-1.2719521522521973,
-1.5189954042434692,
0.5767945051193237,
0.6588115692138672,
0.5549579858779907,
0.006992965936660767,
0.9023617506027222,
-1.0305050611495972,
0.7486806511878967,
-0.9107314944267273,
-1.7235857248306274,
-1.4648427963256836,
-2.3382208347320557,
-2.326411724090576,
0.7628622651100159,
-0.4087890386581421,
-0.4973601698875427,
2.0139482021331787,
-1.03389573097229,
-1.78902268409729,
1.2097755670547485,
0.2228180170059204,
-0.04523592069745064,
2.4554755687713623,
0.10949933528900146,
-0.7506059408187866,
0.4772794246673584,
-0.7076819539070129,
0.7556349039077759,
-0.4624031186103821,
1.3881174325942993,
0.4328805208206177,
-0.9342605471611023,
1.5920215845108032,
-0.3700733780860901,
0.5280665159225464,
-0.6101553440093994,
-0.47883880138397217,
-0.8434493541717529,
0.30521905422210693,
2.0140888690948486,
-0.34894269704818726,
1.6066367626190186,
-0.33973127603530884,
-1.5377951860427856,
-1.557331919670105,
0.8706721067428589,
0.4330350160598755,
-0.8343150615692139,
0.1152045801281929,
-0.3837021589279175,
0.12799932062625885,
-0.019853707402944565,
1.0954111814498901,
1.2331318855285645,
0.6618439555168152,
-0.30660486221313477,
-0.9082691669464111,
0.2977192997932434,
-0.1290871948003769,
-0.6747473478317261,
-1.8008259534835815,
-0.38368165493011475,
0.07844939827919006,
0.6709671020507812,
-1.2312968969345093,
1.6459383964538574,
0.8310233950614929,
1.9538949728012085,
1.0991426706314087,
-0.34179508686065674,
1.511522889137268,
0.08773339539766312,
1.838143229484558,
-0.4802786111831665,
0.6929517388343811,
-0.32419466972351074,
-1.1731220483779907,
0.8203786015510559,
-0.4011051654815674,
-2.002845287322998,
-0.7025315761566162,
-0.8164077997207642,
-0.16819629073143005,
-0.7891750931739807,
0.8961639404296875,
-0.2983053922653198,
-1.4095754623413086,
0.31354784965515137,
-0.8502689003944397,
0.1444883495569229,
-1.2208982706069946,
0.34381598234176636,
0.7121879458427429,
-0.5222075581550598,
0.12867306172847748,
-0.31420111656188965,
-1.3298590183258057,
-0.43843668699264526,
0.23525750637054443,
1.8718364238739014,
-0.7618833184242249,
0.8586580753326416,
1.0211780071258545,
-0.6771692633628845,
0.008581707254052162,
0.39202481508255005,
-0.2506706714630127,
0.9201057553291321,
-1.0540682077407837,
-0.36323481798171997,
1.2635822296142578,
-0.217294842004776,
-0.5830782055854797,
1.4241315126419067,
0.7154209613800049,
-0.9870485067367554,
-0.18307049572467804,
-0.1471927911043167,
-0.7969598174095154,
0.024435028433799744,
-1.7324562072753906,
-0.1808171272277832,
0.358384370803833,
-1.5803143978118896,
-0.4348325729370117,
-0.23271355032920837,
1.3100749254226685,
-0.0633179321885109,
1.4450268745422363,
-0.37603676319122314,
-0.12082573771476746,
-0.334530770778656,
-0.4228052496910095,
0.18537482619285583,
-0.23232918977737427,
-0.5518444776535034,
0.27828824520111084,
-0.8077981472015381,
0.3682391047477722,
1.414734125137329,
0.3818119764328003,
0.0918479710817337,
0.59223872423172,
0.9361515045166016,
0.3921568989753723,
-0.07143287360668182,
-0.8792919516563416,
-1.6738417148590088,
2.136327028274536,
-1.4297833442687988,
1.9514583349227905,
0.8137582540512085,
-0.10583959519863129,
-1.7788633108139038,
-1.908587098121643,
1.3014227151870728,
1.1475005149841309,
2.2875523567199707,
0.5922409296035767,
0.46798259019851685,
-0.7746911644935608,
-0.6653872132301331,
0.2771214246749878,
-1.0320359468460083,
-0.8895061612129211,
0.0863998681306839,
2.3617305755615234,
1.7250241041183472,
-0.42047327756881714,
-0.07080859690904617,
-0.9919891953468323,
1.4517459869384766,
-0.16401755809783936,
0.22608433663845062,
1.9636118412017822,
-0.2241760492324829,
-1.0549976825714111,
1.2946144342422485,
-2.2916274070739746,
0.18710631132125854,
2.014458417892456,
0.2615187168121338,
0.04783913865685463,
-1.4926358461380005,
-0.6920397281646729,
-0.2544654309749603,
-0.33128446340560913,
-1.188277244567871,
0.5663185715675354,
-0.2830665707588196,
-0.8348335027694702,
-1.5218276977539062,
0.13264939188957214,
-1.105911374092102,
-1.6478708982467651,
0.23070606589317322,
1.8624510765075684,
2.0316483974456787,
-0.709782063961029,
1.4685332775115967,
-0.18717241287231445,
0.1427045464515686,
1.2531988620758057,
1.1272118091583252,
3.1309902667999268,
1.9819198846817017,
-1.235569953918457,
0.7251624464988708,
-0.16108673810958862,
-0.4460117816925049,
1.1212407350540161,
-1.2314592599868774,
1.2824338674545288,
-0.17300713062286377,
-1.193071961402893,
-1.1659529209136963,
0.9911724328994751,
0.4741389751434326,
0.010568046942353249,
-0.4635075330734253,
1.25538969039917,
-0.006644297391176224,
1.2909693717956543,
0.45484793186187744,
-0.33743220567703247,
0.5717753767967224,
-0.441067099571228,
-0.5419282913208008,
1.586955189704895,
0.2629162669181824,
-1.4143942594528198,
-2.314831256866455,
-0.18492668867111206,
-0.8852187395095825,
-0.013309139758348465,
-0.598495602607727,
-0.9956976175308228,
1.5819584131240845,
0.37704652547836304,
-1.1708184480667114,
-0.312411904335022,
-0.2975502610206604,
-0.5887834429740906,
2.7384049892425537,
-1.4140424728393555,
-0.26662731170654297,
-1.0496482849121094,
-0.6191869974136353,
1.6080790758132935,
-1.2538684606552124,
-0.17188198864459991,
-0.9486817121505737,
-0.6090213656425476,
-1.2534363269805908,
-0.59442538022995,
-0.03876465559005737,
-0.9398712515830994,
0.8345290422439575,
0.23093146085739136,
-1.1014083623886108,
-0.2515556216239929,
-0.8447039723396301,
0.822502851486206,
-0.009775439277291298,
0.2931833863258362,
1.9128618240356445,
0.33505797386169434,
-0.3731577396392822,
0.7167796492576599,
1.1142895221710205,
0.6082906126976013,
-0.6512976884841919,
0.15299786627292633,
-0.6538112163543701,
0.3700404167175293,
-1.2806516885757446,
0.30009186267852783,
-2.8711204528808594,
0.6581602692604065,
-0.052124787122011185,
-0.06739125400781631,
-0.054250095039606094,
-1.2473185062408447,
1.0276319980621338,
2.5979464054107666,
-1.2185595035552979,
0.4768863916397095,
0.30044275522232056,
1.2007920742034912,
-1.562549114227295,
0.29800909757614136,
-0.44623512029647827,
2.2372703552246094,
0.26869356632232666,
1.1926172971725464,
-0.42463791370391846,
-2.337099075317383,
0.6445751786231995,
-1.2900999784469604,
-1.152389407157898,
0.6665579676628113,
-0.9477179050445557,
0.07481421530246735,
-1.4067721366882324,
-0.16899517178535461,
-0.8209227919578552,
-1.1964935064315796,
0.683101236820221,
0.044850774109363556,
0.4751875400543213,
-0.5042901635169983,
0.36611974239349365,
-2.1266775131225586,
-1.3697564601898193,
-0.12946084141731262,
-0.9805269837379456,
0.47792816162109375,
-0.32601022720336914,
0.6798492670059204,
-0.1919117271900177,
0.008858997374773026,
0.38008445501327515,
1.395660161972046,
3.453932762145996,
0.15416471660137177,
0.34801530838012695,
-0.12646962702274323,
-0.9652050137519836,
1.3904569149017334,
0.8635911345481873,
-0.21444831788539886,
-0.6004414558410645,
-1.0254725217819214,
1.440792202949524,
1.9753047227859497,
0.9409259557723999,
0.14447875320911407,
-0.7297661304473877,
-0.646311342716217,
-0.03754197061061859,
0.2399626076221466,
0.46989309787750244,
0.8813517093658447,
0.05715108662843704,
0.08684206008911133,
1.4648535251617432,
1.2483303546905518,
-0.43897509574890137,
0.42099815607070923,
-0.8189725279808044,
-0.4303986430168152,
0.515663743019104,
0.3209637403488159,
0.0047891996800899506,
0.38045740127563477,
-0.9949651956558228,
-0.19656291604042053,
-0.41330671310424805,
-0.9480745196342468,
-0.7498342394828796,
-0.3101680278778076,
-0.34716296195983887,
1.6495177745819092,
0.1879090964794159,
-0.49884939193725586,
-0.0015999097377061844,
-0.7654724717140198,
-0.03135909512639046,
-1.0226539373397827,
0.29652804136276245,
-0.07643117010593414,
-0.10830485075712204,
-0.028268197551369667,
1.7498805522918701,
-0.9026258587837219,
-2.105073928833008,
0.2402004450559616,
0.26842761039733887,
-0.30100762844085693,
0.20857994258403778,
1.6497353315353394,
0.45211678743362427,
1.4320262670516968,
1.2856624126434326,
0.9580143690109253,
-0.6812162399291992,
-1.319000482559204,
0.6200021505355835,
1.0085687637329102,
-1.4292550086975098,
0.7978761196136475,
-0.022669941186904907,
-0.5682097673416138,
0.6311358213424683,
1.2289897203445435,
0.4692869186401367,
-1.9250590801239014,
0.7989107966423035,
-0.9474948644638062,
0.803326427936554,
0.6157116889953613,
0.7331162095069885,
0.2289612591266632,
0.8099140524864197,
-1.284303069114685,
-1.0978280305862427,
-0.810983419418335,
-0.6644428968429565,
1.9672695398330688,
-0.261921226978302,
0.5202479362487793,
-0.13765904307365417,
-1.3741751909255981,
-0.08689896017313004,
0.6433050036430359,
0.27364933490753174,
-0.4554196000099182,
0.8478842973709106,
-0.7011379599571228,
-1.2094535827636719,
-1.402219295501709,
-0.46527427434921265,
-1.0305252075195312,
-0.964512288570404,
1.1060937643051147,
0.8327715396881104,
0.25554943084716797,
1.8829246759414673,
0.5371046662330627,
0.2623440623283386,
-2.673344373703003,
0.8720792531967163,
0.26054251194000244,
-0.05278469994664192,
0.9303764700889587,
0.20467112958431244,
1.0043278932571411,
0.006463050842285156,
0.5762184858322144,
-2.289069414138794,
2.2292354106903076,
-0.20453116297721863,
0.7042512893676758,
0.023748736828565598,
-0.03993065282702446,
0.954184353351593,
0.5525957345962524,
0.6489121317863464,
-1.0920066833496094,
0.6804869174957275,
-0.6012043952941895,
1.3070262670516968,
0.934427797794342,
-0.8056167364120483,
-0.048390958458185196,
1.3151519298553467,
0.4357556700706482,
-0.510129988193512,
-0.958777129650116,
-0.9958920478820801,
0.9551806449890137,
1.7598274946212769,
-0.058414947241544724,
-0.07846333831548691,
0.8163735270500183,
0.6369072794914246,
-1.3159898519515991,
0.06271114200353622,
-0.7491533160209656,
-0.7288039922714233,
1.624079704284668,
2.1178388595581055,
-0.09367775917053223,
-0.21549004316329956,
-0.7152524590492249,
-1.2938799858093262,
0.7439542412757874,
-0.021328553557395935,
0.04094960168004036,
0.6549577116966248,
-0.6164286732673645,
1.106268286705017,
0.9238232970237732,
1.0237499475479126,
0.210089311003685,
0.2649892568588257,
0.2878381609916687,
-0.2719777822494507,
-1.1899380683898926,
-0.2804067134857178,
-1.1226353645324707,
-2.575056314468384,
0.47689902782440186,
-0.2270040661096573,
-1.48259699344635,
0.10212019085884094,
-1.006377935409546,
0.8893646597862244,
-0.5236973166465759,
-1.0840927362442017,
-1.4186556339263916,
0.2218823879957199,
-0.09015126526355743,
0.930815577507019,
-1.6313884258270264,
-0.0966259092092514,
1.2341856956481934,
0.9709979891777039,
-0.6101819276809692,
1.072660207748413,
0.30402350425720215,
1.0122709274291992,
0.8808083534240723,
-0.4001926779747009,
0.5911601185798645,
0.10376983135938644,
-1.2817375659942627,
0.5412724018096924,
1.1802173852920532,
0.26793450117111206,
1.417011022567749,
-0.6389427185058594,
0.005524092353880405,
0.4267581105232239,
-0.5541378259658813,
-0.4044489860534668,
-0.512347936630249,
0.6966218948364258,
-0.020788036286830902,
-0.8956519365310669,
-0.03201044350862503,
-0.09790589660406113,
-0.2040058821439743,
0.17630594968795776,
-1.518350601196289,
-0.1512727290391922,
-0.3835294246673584,
-0.5671461224555969,
-1.2559508085250854,
-0.1344747692346573,
1.4021830558776855,
-0.8780117034912109,
-0.17408506572246552,
0.51934814453125,
0.4505205750465393,
0.5822123289108276,
0.6237434148788452,
-0.6055240035057068,
-0.4381105899810791,
-0.17615176737308502,
-0.3891018033027649,
0.3136477470397949,
1.3195279836654663,
-0.1988997757434845,
-1.0345429182052612,
0.763949990272522,
-0.3610990047454834,
0.09346899390220642,
1.844801425933838,
0.15539129078388214,
-0.8401439785957336,
0.2003229558467865,
-0.7064585089683533,
1.9517158269882202,
1.5957226753234863,
1.2716801166534424,
-0.12431860715150833,
-0.9523680210113525,
0.6763357520103455,
-0.22823090851306915,
-0.3798813819885254,
0.7725796699523926,
0.45781177282333374,
-0.17991279065608978,
-1.3699634075164795,
0.5858638286590576,
1.1614110469818115,
-0.8728823661804199,
-0.7861306071281433,
0.03792555257678032,
-0.7754819989204407,
1.1372060775756836,
0.7249042391777039,
0.4125804305076599,
0.1403043270111084,
1.6741783618927002,
0.817901611328125,
-0.5476662516593933,
0.4575957655906677,
0.549567461013794,
-0.13754504919052124,
-2.1830837726593018,
-1.0060107707977295,
0.3012115955352783,
-0.4885920286178589,
-1.6223969459533691,
1.2687476873397827,
-1.1425693035125732,
-0.8587362170219421,
0.5216531157493591,
0.10591264814138412,
1.469170331954956,
0.30556344985961914,
1.5921722650527954,
2.0359761714935303,
0.9454764127731323,
0.25429612398147583,
1.3077837228775024,
-0.11872702836990356,
-0.3599504232406616,
1.7512788772583008,
-0.38362938165664673,
0.5571873188018799,
1.1320728063583374,
-0.479977548122406,
-1.017809271812439,
-0.7097491025924683,
-1.243023157119751,
-0.6720681190490723,
1.1155844926834106,
0.12332780659198761,
-1.1273993253707886,
0.21529729664325714,
1.5625696182250977,
0.10027210414409637,
-0.2707514762878418,
0.5221262574195862,
0.3999755382537842,
-0.7387692332267761,
-0.07000115513801575,
-0.9430702924728394,
0.4848790764808655,
-0.18742932379245758,
-0.3552590608596802,
0.30375462770462036,
0.36124134063720703,
1.2796835899353027,
0.014599556103348732,
0.12659412622451782,
1.2362196445465088,
-1.3997869491577148,
1.5097852945327759,
-0.6455341577529907,
0.22543500363826752,
-2.383589029312134,
1.372645616531372,
-0.7881053686141968,
1.9313141107559204,
-2.6861042976379395,
0.46584630012512207,
-0.6538723707199097,
-0.4195353388786316,
0.29107290506362915,
-0.32527071237564087,
0.11432058364152908,
-0.1786089986562729,
-1.0738532543182373,
-0.16146250069141388,
-0.6737780570983887,
0.5646346211433411,
1.1258515119552612,
1.337695837020874,
-1.079654574394226,
-0.2221774160861969,
-1.7376651763916016,
-0.10058420896530151,
-0.754955530166626,
0.3730727434158325,
-1.974000096321106,
-0.10480038821697235,
-1.9379898309707642,
-2.3709795475006104,
-1.2906618118286133,
-0.7566919326782227,
1.1079607009887695,
0.10294079780578613,
-0.8815975785255432,
1.1542350053787231,
-0.30690962076187134,
-1.800648808479309,
1.0936089754104614,
-2.2000832557678223
] |
https://github.com/huggingface/datasets/issues/6032 | DownloadConfig.proxies not work when load_dataset_builder calling HfApi.dataset_info | `HfApi` comes from the `huggingface_hub` package. You can use [this](https://huggingface.co/docs/huggingface_hub/v0.16.3/en/package_reference/utilities#huggingface_hub.configure_http_backend) utility to change the `huggingface_hub`'s `Session` proxies (see the example).
We plan to implement https://github.com/huggingface/datasets/issues/5080 and make this behavior more consistent eventually. | ### Describe the bug
```python
download_config = DownloadConfig(proxies={'https': '<my proxy>'})
builder = load_dataset_builder(..., download_config=download_config)
```
But, when getting the dataset_info from HfApi, the http requests not using the proxies.
### Steps to reproduce the bug
1. Setup proxies in DownloadConfig.
2. Call `load_dataset_build` with download_config.
3. Inspect the call stack in HfApi.dataset_info.
![image](https://github.com/huggingface/datasets/assets/138426806/33e538a8-2e22-4e63-b634-343febe5324b)
### Expected behavior
DownloadConfig.proxies works for getting dataset_info.
### Environment info
https://github.com/huggingface/datasets/commit/406b2212263c0d33f267e35b917f410ff6b3bc00
Python 3.11.4 | 29 | 32 | DownloadConfig.proxies not work when load_dataset_builder calling HfApi.dataset_info
### Describe the bug
```python
download_config = DownloadConfig(proxies={'https': '<my proxy>'})
builder = load_dataset_builder(..., download_config=download_config)
```
But, when getting the dataset_info from HfApi, the http requests not using the proxies.
### Steps to reproduce the bug
1. Setup proxies in DownloadConfig.
2. Call `load_dataset_build` with download_config.
3. Inspect the call stack in HfApi.dataset_info.
![image](https://github.com/huggingface/datasets/assets/138426806/33e538a8-2e22-4e63-b634-343febe5324b)
### Expected behavior
DownloadConfig.proxies works for getting dataset_info.
### Environment info
https://github.com/huggingface/datasets/commit/406b2212263c0d33f267e35b917f410ff6b3bc00
Python 3.11.4
`HfApi` comes from the `huggingface_hub` package. You can use [this](https://huggingface.co/docs/huggingface_hub/v0.16.3/en/package_reference/utilities#huggingface_hub.configure_http_backend) utility to change the `huggingface_hub`'s `Session` proxies (see the example).
We plan to implement https://github.com/huggingface/datasets/issues/5080 and make this behavior more consistent eventually. | [
-1.1104506254196167,
-0.900575578212738,
-0.676376461982727,
1.509926438331604,
-0.10628755390644073,
-1.2705026865005493,
0.15166087448596954,
-1.0402348041534424,
1.57485032081604,
-0.6813511252403259,
0.24466240406036377,
-1.692107081413269,
-0.0123829310759902,
-0.5783460140228271,
-0.7574391961097717,
-0.8580574989318848,
-0.36628347635269165,
-0.6904918551445007,
1.095688819885254,
2.577338933944702,
1.2022228240966797,
-1.3430448770523071,
2.699180841445923,
0.5962550044059753,
-0.19665177166461945,
-1.0601813793182373,
0.5628510117530823,
0.041189733892679214,
-1.328599452972412,
-0.4165651798248291,
-0.9039327502250671,
-0.03228007256984711,
-0.60875403881073,
-0.535675585269928,
-0.02046091854572296,
0.47508659958839417,
-0.27380162477493286,
-0.4081621468067169,
-0.596829891204834,
-0.8036574125289917,
0.4329395592212677,
-0.4128052592277527,
0.9225213527679443,
-0.29648223519325256,
1.7908931970596313,
-0.5474662780761719,
0.4918093681335449,
0.7132156491279602,
1.3026652336120605,
0.16792167723178864,
0.06788921356201172,
0.3552790582180023,
0.4436330497264862,
-0.0725734755396843,
0.4368550181388855,
1.2244088649749756,
0.6461663842201233,
0.4341297745704651,
0.678678572177887,
-2.228120803833008,
1.305802583694458,
-0.88321852684021,
0.20956456661224365,
1.3315443992614746,
-0.9755920767784119,
0.30149298906326294,
-1.7679370641708374,
0.02052128128707409,
0.5488011240959167,
-2.286839723587036,
0.22506412863731384,
-1.3437837362289429,
-0.5066854953765869,
1.006107211112976,
0.34713315963745117,
-1.306723713874817,
0.13191425800323486,
-0.4518280327320099,
1.0986979007720947,
0.4515588581562042,
1.142503261566162,
-1.6751364469528198,
-0.08218446373939514,
-0.24405667185783386,
0.021836917847394943,
-1.2407456636428833,
-1.575995922088623,
0.42326679825782776,
0.649223804473877,
0.6901586651802063,
-0.12710081040859222,
1.0086017847061157,
-0.9885355830192566,
0.7609552145004272,
-0.93067467212677,
-1.7645260095596313,
-1.382432460784912,
-2.4003143310546875,
-2.3488991260528564,
0.7546905279159546,
-0.47516220808029175,
-0.4057999551296234,
2.030994415283203,
-1.038969874382019,
-1.8142956495285034,
1.1295772790908813,
0.3130558431148529,
0.022266458719968796,
2.3042404651641846,
0.223633274435997,
-0.7439404129981995,
0.3906031548976898,
-0.6915361881256104,
0.7444323897361755,
-0.3550393283367157,
1.3575876951217651,
0.5272257328033447,
-1.0721018314361572,
1.538185715675354,
-0.33627960085868835,
0.5982251167297363,
-0.7210452556610107,
-0.4415929615497589,
-0.7794319987297058,
0.23130013048648834,
1.8594266176223755,
-0.4186212122440338,
1.5882319211959839,
-0.34326285123825073,
-1.5787087678909302,
-1.5743600130081177,
0.8637368083000183,
0.4836169183254242,
-0.7991888523101807,
0.07475407421588898,
-0.42807647585868835,
0.055734243243932724,
-0.02685748226940632,
1.1058378219604492,
1.2535598278045654,
0.7014623284339905,
-0.42115071415901184,
-0.8224623799324036,
0.20639584958553314,
-0.14455066621303558,
-0.611973762512207,
-1.8436617851257324,
-0.2667807340621948,
0.1983506679534912,
0.6535174250602722,
-1.2218923568725586,
1.7115440368652344,
0.8278061151504517,
1.9350255727767944,
0.9842560291290283,
-0.3858925402164459,
1.4714568853378296,
0.005415491759777069,
1.9144108295440674,
-0.5294147729873657,
0.6301470994949341,
-0.2849245071411133,
-1.1735538244247437,
0.8531694412231445,
-0.3411025106906891,
-1.9827847480773926,
-0.7748124599456787,
-0.7456656098365784,
-0.16387300193309784,
-0.7769320607185364,
0.9170798063278198,
-0.2668803632259369,
-1.455291509628296,
0.1603352427482605,
-0.6780170202255249,
0.19708068668842316,
-1.2204996347427368,
0.17549774050712585,
0.7711459398269653,
-0.6633509993553162,
0.0003262581303715706,
-0.21091525256633759,
-1.3705083131790161,
-0.4451509118080139,
0.40551871061325073,
1.8167880773544312,
-0.712732195854187,
1.0028834342956543,
1.0932523012161255,
-0.7038068175315857,
0.12928855419158936,
0.3155202865600586,
-0.2809404134750366,
0.905299186706543,
-1.0528125762939453,
-0.3706701993942261,
1.1954586505889893,
-0.2515409290790558,
-0.6771320700645447,
1.4405089616775513,
0.8239383101463318,
-1.0660247802734375,
-0.19052746891975403,
-0.06585107743740082,
-0.8210427165031433,
0.050512246787548065,
-1.6882896423339844,
-0.11614768207073212,
0.37863004207611084,
-1.4917182922363281,
-0.45664840936660767,
-0.2630783021450043,
1.4258201122283936,
-0.1689932495355606,
1.4888763427734375,
-0.21554073691368103,
-0.12197472155094147,
-0.41155391931533813,
-0.42855656147003174,
0.15436379611492157,
-0.2881987988948822,
-0.6391745209693909,
0.2431480884552002,
-0.7977826595306396,
0.33022570610046387,
1.399599313735962,
0.28671562671661377,
0.11409276723861694,
0.5398007035255432,
1.0926789045333862,
0.3668820261955261,
-0.12053313851356506,
-0.8648257255554199,
-1.629359245300293,
2.0034353733062744,
-1.4093984365463257,
2.025486469268799,
0.8225417137145996,
-0.06754973530769348,
-1.774362325668335,
-1.89962637424469,
1.3516241312026978,
1.107871651649475,
2.376584053039551,
0.5273396968841553,
0.37432485818862915,
-0.8004161715507507,
-0.6654309630393982,
0.32232987880706787,
-0.970313549041748,
-0.6845314502716064,
0.12291190028190613,
2.3872902393341064,
1.7940868139266968,
-0.4443439543247223,
-0.29881638288497925,
-1.0322444438934326,
1.3637194633483887,
-0.16370436549186707,
0.2211681306362152,
2.031266212463379,
-0.1991729736328125,
-1.013655662536621,
1.2927072048187256,
-2.2588884830474854,
0.2382107526063919,
2.0152883529663086,
0.21199028193950653,
0.05535600706934929,
-1.493480920791626,
-0.6452730894088745,
-0.35643020272254944,
-0.520674467086792,
-1.230623722076416,
0.549981415271759,
-0.32473161816596985,
-0.8729644417762756,
-1.42784583568573,
0.0713624656200409,
-1.1397325992584229,
-1.7932571172714233,
0.2918204665184021,
1.8869130611419678,
1.9488624334335327,
-0.7767377495765686,
1.542568325996399,
-0.2680276930332184,
0.11991997063159943,
1.2711715698242188,
1.3213027715682983,
3.178255558013916,
1.9134122133255005,
-1.300635814666748,
0.7326114177703857,
-0.11930903792381287,
-0.46935316920280457,
1.1508896350860596,
-1.1284335851669312,
1.301548719406128,
-0.2396194189786911,
-1.230385184288025,
-1.2443428039550781,
1.043971061706543,
0.532069981098175,
0.08511912822723389,
-0.48597416281700134,
1.1990917921066284,
0.09815050661563873,
1.2431241273880005,
0.5797106623649597,
-0.42757081985473633,
0.6580641865730286,
-0.4341757297515869,
-0.6091070175170898,
1.545697808265686,
0.1584693342447281,
-1.4693907499313354,
-2.309870481491089,
-0.27083951234817505,
-0.8653379678726196,
-0.08544647693634033,
-0.6854977011680603,
-0.9847479462623596,
1.5756161212921143,
0.4991028904914856,
-1.3250092267990112,
-0.3245549499988556,
-0.2774961292743683,
-0.5250338315963745,
2.652000904083252,
-1.3184236288070679,
-0.14841623604297638,
-0.997268557548523,
-0.5525486469268799,
1.6473424434661865,
-1.1753937005996704,
-0.2752460241317749,
-1.0792251825332642,
-0.6727097034454346,
-1.308925747871399,
-0.5399994254112244,
0.008983155712485313,
-0.9028916358947754,
0.6863226890563965,
0.12383641302585602,
-1.2247729301452637,
-0.2551611661911011,
-0.8397879004478455,
1.0243127346038818,
-0.10494346916675568,
0.15703995525836945,
1.8872638940811157,
0.46244102716445923,
-0.41567617654800415,
0.7435840368270874,
1.1031173467636108,
0.6267648935317993,
-0.6889869570732117,
0.19403567910194397,
-0.6989346742630005,
0.31811895966529846,
-1.389559030532837,
0.2264556735754013,
-2.9290595054626465,
0.635353684425354,
-0.11505897343158722,
-0.07450148463249207,
0.006298240274190903,
-1.2845402956008911,
1.116457462310791,
2.5502116680145264,
-1.1916154623031616,
0.5274258852005005,
0.3907861113548279,
1.09413743019104,
-1.6173415184020996,
0.3402658700942993,
-0.4192294478416443,
2.059000253677368,
0.16322925686836243,
1.2067759037017822,
-0.4683348536491394,
-2.1562156677246094,
0.6483377814292908,
-1.2708253860473633,
-1.09096360206604,
0.8871893882751465,
-0.8460959196090698,
0.18949492275714874,
-1.3379875421524048,
-0.1759718954563141,
-0.8692435026168823,
-1.242500901222229,
0.7168657779693604,
0.11342667043209076,
0.3983815610408783,
-0.5594236254692078,
0.39061135053634644,
-2.0997118949890137,
-1.3056803941726685,
-0.2596973180770874,
-0.9964914917945862,
0.4820858836174011,
-0.2995300590991974,
0.5811614394187927,
-0.1292431354522705,
0.0966697633266449,
0.33382198214530945,
1.4503339529037476,
3.398569345474243,
0.18015746772289276,
0.24026048183441162,
-0.0403471477329731,
-0.9789121747016907,
1.411399245262146,
0.9639238119125366,
-0.1715283840894699,
-0.6459697484970093,
-1.061428427696228,
1.31447172164917,
1.9701550006866455,
1.0984361171722412,
0.028490271419286728,
-0.8300684690475464,
-0.819693386554718,
0.03280534967780113,
0.12751956284046173,
0.5340533256530762,
0.9314444661140442,
0.046695977449417114,
0.07639974355697632,
1.408305287361145,
1.2404409646987915,
-0.38758671283721924,
0.3904059827327728,
-0.9489261507987976,
-0.43309301137924194,
0.38763582706451416,
0.30541351437568665,
0.03170131891965866,
0.3897475600242615,
-1.110353946685791,
-0.19508807361125946,
-0.41015031933784485,
-0.9078550934791565,
-0.7905780673027039,
-0.39279794692993164,
-0.39544522762298584,
1.5838663578033447,
0.10904772579669952,
-0.43384674191474915,
0.04067584127187729,
-0.7306506037712097,
-0.14276695251464844,
-0.9898078441619873,
0.27919459342956543,
-0.1437651365995407,
-0.03947918489575386,
-0.11779910326004028,
1.6479473114013672,
-1.008719801902771,
-2.1797807216644287,
0.22205208241939545,
0.1505385786294937,
-0.3923719823360443,
0.21525175869464874,
1.7143436670303345,
0.5541250109672546,
1.3747334480285645,
1.3164650201797485,
0.9593373537063599,
-0.6887542605400085,
-1.3319637775421143,
0.6879987716674805,
0.965389609336853,
-1.3602808713912964,
0.8887390494346619,
-0.06066930294036865,
-0.4934891164302826,
0.7616540193557739,
1.3001078367233276,
0.4579680562019348,
-1.9964876174926758,
0.808971107006073,
-0.8486285209655762,
0.8056060075759888,
0.6540830135345459,
0.7735265493392944,
0.20070861279964447,
0.7691859006881714,
-1.298603892326355,
-1.1345932483673096,
-0.6715010404586792,
-0.679571270942688,
1.9636056423187256,
-0.2564260959625244,
0.4970133304595947,
-0.19330492615699768,
-1.2506746053695679,
-0.17531518638134003,
0.8045036196708679,
0.3647267818450928,
-0.5250203013420105,
0.8185453414916992,
-0.6055139303207397,
-1.0545711517333984,
-1.3061720132827759,
-0.4195604920387268,
-0.9647086262702942,
-0.8558672070503235,
0.9600194692611694,
0.7538859844207764,
0.42141982913017273,
1.9241664409637451,
0.5686176419258118,
0.2591942846775055,
-2.6640193462371826,
0.9078684449195862,
0.301035076379776,
-0.016753902658820152,
0.9278759360313416,
0.28418686985969543,
1.1215622425079346,
-0.055356215685606,
0.5584802031517029,
-2.387166976928711,
2.1635360717773438,
-0.2495628446340561,
0.6435447335243225,
-0.01199102122336626,
-0.18279635906219482,
1.1085662841796875,
0.49321049451828003,
0.5488974452018738,
-1.0810540914535522,
0.7784179449081421,
-0.5419455170631409,
1.1335060596466064,
0.8286700248718262,
-0.8662793636322021,
-0.024927649646997452,
1.3682219982147217,
0.47116416692733765,
-0.4619517922401428,
-0.915962278842926,
-0.9658344388008118,
0.9249561429023743,
1.7605665922164917,
-0.04794906824827194,
0.002422482706606388,
0.8263320922851562,
0.6667499542236328,
-1.3132942914962769,
0.15583795309066772,
-0.6878367066383362,
-0.6605168581008911,
1.765930414199829,
2.0837457180023193,
-0.08718268573284149,
-0.2645869553089142,
-0.7969180941581726,
-1.1878108978271484,
0.801214337348938,
-0.025628114119172096,
0.02485368400812149,
0.7196112871170044,
-0.7082555294036865,
1.1117026805877686,
0.7418818473815918,
0.9276309609413147,
0.0731847733259201,
0.2718614935874939,
0.4202505052089691,
-0.26339462399482727,
-1.2561390399932861,
-0.35960039496421814,
-1.1312750577926636,
-2.504185914993286,
0.4240133464336395,
-0.167829230427742,
-1.4600085020065308,
0.04885152727365494,
-1.1132224798202515,
0.8366135954856873,
-0.6053246855735779,
-1.1435577869415283,
-1.5121734142303467,
0.2767999768257141,
-0.17242683470249176,
0.8427345156669617,
-1.583522081375122,
-0.11560167372226715,
1.2850888967514038,
0.8736845850944519,
-0.558977484703064,
0.9645640850067139,
0.18400128185749054,
0.992579996585846,
0.8471308350563049,
-0.3555775284767151,
0.50501549243927,
0.11803720891475677,
-1.345475673675537,
0.44771742820739746,
1.2480593919754028,
0.22911593317985535,
1.4832953214645386,
-0.6061870455741882,
0.0560591034591198,
0.4502590298652649,
-0.5546932220458984,
-0.4905683100223541,
-0.4670950472354889,
0.7188193202018738,
0.08497850596904755,
-0.8974539637565613,
0.06379508972167969,
-0.202626571059227,
-0.24213963747024536,
0.22556574642658234,
-1.4381203651428223,
-0.2003638744354248,
-0.26444900035858154,
-0.5401555299758911,
-1.2402154207229614,
0.007744211703538895,
1.3320045471191406,
-0.7714713215827942,
-0.3059207499027252,
0.5248145461082458,
0.31399041414260864,
0.528569221496582,
0.6233301162719727,
-0.6314515471458435,
-0.2955535054206848,
-0.3662138283252716,
-0.3638804852962494,
0.3588886559009552,
1.2910104990005493,
-0.1386292427778244,
-0.9417473077774048,
0.7435895800590515,
-0.4327552616596222,
0.15231207013130188,
1.9569017887115479,
0.0077581219375133514,
-0.7843679785728455,
0.32048797607421875,
-0.6585538983345032,
1.8923490047454834,
1.7313798666000366,
1.3138991594314575,
-0.13675451278686523,
-1.023309588432312,
0.5546406507492065,
-0.23931659758090973,
-0.32069358229637146,
1.034258246421814,
0.4701540172100067,
-0.21824781596660614,
-1.2511346340179443,
0.5865550637245178,
1.264053225517273,
-0.9415462017059326,
-0.7461144924163818,
0.11625757813453674,
-0.9013423323631287,
1.1302213668823242,
0.6963455080986023,
0.3674607574939728,
0.22964125871658325,
1.5336045026779175,
0.7458339929580688,
-0.3781801164150238,
0.5830110907554626,
0.43789786100387573,
-0.25366953015327454,
-2.064675807952881,
-1.0665562152862549,
0.3366582989692688,
-0.4997096061706543,
-1.603907585144043,
1.2813565731048584,
-1.160434603691101,
-1.0271623134613037,
0.48419636487960815,
0.05043131858110428,
1.4077372550964355,
0.29055702686309814,
1.6464099884033203,
2.1358275413513184,
0.9577997326850891,
0.3539496660232544,
1.2629410028457642,
-0.015857012942433357,
-0.5296200513839722,
1.791399598121643,
-0.4135205149650574,
0.4906895160675049,
1.0297930240631104,
-0.39091190695762634,
-1.045150876045227,
-0.8584311604499817,
-1.2066771984100342,
-0.6446136236190796,
1.1923812627792358,
0.16394750773906708,
-1.1460524797439575,
0.2569243013858795,
1.4817404747009277,
0.20858189463615417,
-0.24446731805801392,
0.7174646258354187,
0.3760841190814972,
-0.7440569996833801,
-0.06922470778226852,
-0.877405047416687,
0.491197407245636,
-0.18785126507282257,
-0.2763091027736664,
0.28599128127098083,
0.43305984139442444,
1.280267357826233,
-0.05548056215047836,
0.1913035660982132,
1.1935367584228516,
-1.4134501218795776,
1.4935460090637207,
-0.6481170058250427,
0.28104400634765625,
-2.435238838195801,
1.4280213117599487,
-0.7795969843864441,
1.8568114042282104,
-2.6437649726867676,
0.4853416383266449,
-0.5846025943756104,
-0.48768502473831177,
0.30250120162963867,
-0.3338490128517151,
0.13732372224330902,
-0.16766954958438873,
-1.1068397760391235,
-0.11897332966327667,
-0.7269430160522461,
0.632849395275116,
1.206366777420044,
1.3370682001113892,
-1.1028724908828735,
-0.23959805071353912,
-1.7293872833251953,
-0.14503061771392822,
-0.6856334209442139,
0.3935035169124603,
-1.9273054599761963,
-0.09984305500984192,
-1.8934024572372437,
-2.4581708908081055,
-1.256500005722046,
-0.7947723269462585,
1.0462788343429565,
0.25205954909324646,
-0.8223464488983154,
1.1512231826782227,
-0.33368703722953796,
-1.8203145265579224,
1.0763421058654785,
-2.218118667602539
] |
https://github.com/huggingface/datasets/issues/6025 | Using a dataset for a use other than it was intended for. | I've opened a PR with a fix. In the meantime, you can avoid the error by deleting `task_templates` with `dataset.info.task_templates = None` before the `interleave_datasets` call.
` | ### Describe the bug
Hi, I want to use the rotten tomatoes dataset but for a task other than classification, but when I interleave the dataset, it throws ```'ValueError: Column label is not present in features.'```. It seems that the label_col must be there in the dataset for some reason?
Here is the full stacktrace
```
File "/home/suryahari/Vornoi/tryage-handoff-other-datasets.py", line 276, in create_dataloaders
dataset = interleave_datasets(dsfold, stopping_strategy="all_exhausted")
File "/home/suryahari/miniconda3/envs/vornoi/lib/python3.10/site-packages/datasets/combine.py", line 134, in interleave_datasets
return _interleave_iterable_datasets(
File "/home/suryahari/miniconda3/envs/vornoi/lib/python3.10/site-packages/datasets/iterable_dataset.py", line 1833, in _interleave_iterable_datasets
info = DatasetInfo.from_merge([d.info for d in datasets])
File "/home/suryahari/miniconda3/envs/vornoi/lib/python3.10/site-packages/datasets/info.py", line 275, in from_merge
dataset_infos = [dset_info.copy() for dset_info in dataset_infos if dset_info is not None]
File "/home/suryahari/miniconda3/envs/vornoi/lib/python3.10/site-packages/datasets/info.py", line 275, in <listcomp>
dataset_infos = [dset_info.copy() for dset_info in dataset_infos if dset_info is not None]
File "/home/suryahari/miniconda3/envs/vornoi/lib/python3.10/site-packages/datasets/info.py", line 378, in copy
return self.__class__(**{k: copy.deepcopy(v) for k, v in self.__dict__.items()})
File "<string>", line 20, in __init__
File "/home/suryahari/miniconda3/envs/vornoi/lib/python3.10/site-packages/datasets/info.py", line 208, in __post_init__
self.task_templates = [
File "/home/suryahari/miniconda3/envs/vornoi/lib/python3.10/site-packages/datasets/info.py", line 209, in <listcomp>
template.align_with_features(self.features) for template in (self.task_templates)
File "/home/suryahari/miniconda3/envs/vornoi/lib/python3.10/site-packages/datasets/tasks/text_classification.py", line 20, in align_with_features
raise ValueError(f"Column {self.label_column} is not present in features.")
ValueError: Column label is not present in features.
```
### Steps to reproduce the bug
Delete the column `labels` from the `rotten_tomatoes` dataset. Try to interleave it with other datasets.
### Expected behavior
Should let me use the dataset with just the `text` field
### Environment info
latest datasets library? I don't think this was an issue in earlier versions. | 31 | 27 | Using a dataset for a use other than it was intended for.
### Describe the bug
Hi, I want to use the rotten tomatoes dataset but for a task other than classification, but when I interleave the dataset, it throws ```'ValueError: Column label is not present in features.'```. It seems that the label_col must be there in the dataset for some reason?
Here is the full stacktrace
```
File "/home/suryahari/Vornoi/tryage-handoff-other-datasets.py", line 276, in create_dataloaders
dataset = interleave_datasets(dsfold, stopping_strategy="all_exhausted")
File "/home/suryahari/miniconda3/envs/vornoi/lib/python3.10/site-packages/datasets/combine.py", line 134, in interleave_datasets
return _interleave_iterable_datasets(
File "/home/suryahari/miniconda3/envs/vornoi/lib/python3.10/site-packages/datasets/iterable_dataset.py", line 1833, in _interleave_iterable_datasets
info = DatasetInfo.from_merge([d.info for d in datasets])
File "/home/suryahari/miniconda3/envs/vornoi/lib/python3.10/site-packages/datasets/info.py", line 275, in from_merge
dataset_infos = [dset_info.copy() for dset_info in dataset_infos if dset_info is not None]
File "/home/suryahari/miniconda3/envs/vornoi/lib/python3.10/site-packages/datasets/info.py", line 275, in <listcomp>
dataset_infos = [dset_info.copy() for dset_info in dataset_infos if dset_info is not None]
File "/home/suryahari/miniconda3/envs/vornoi/lib/python3.10/site-packages/datasets/info.py", line 378, in copy
return self.__class__(**{k: copy.deepcopy(v) for k, v in self.__dict__.items()})
File "<string>", line 20, in __init__
File "/home/suryahari/miniconda3/envs/vornoi/lib/python3.10/site-packages/datasets/info.py", line 208, in __post_init__
self.task_templates = [
File "/home/suryahari/miniconda3/envs/vornoi/lib/python3.10/site-packages/datasets/info.py", line 209, in <listcomp>
template.align_with_features(self.features) for template in (self.task_templates)
File "/home/suryahari/miniconda3/envs/vornoi/lib/python3.10/site-packages/datasets/tasks/text_classification.py", line 20, in align_with_features
raise ValueError(f"Column {self.label_column} is not present in features.")
ValueError: Column label is not present in features.
```
### Steps to reproduce the bug
Delete the column `labels` from the `rotten_tomatoes` dataset. Try to interleave it with other datasets.
### Expected behavior
Should let me use the dataset with just the `text` field
### Environment info
latest datasets library? I don't think this was an issue in earlier versions.
I've opened a PR with a fix. In the meantime, you can avoid the error by deleting `task_templates` with `dataset.info.task_templates = None` before the `interleave_datasets` call.
` | [
-1.1893870830535889,
-0.8744972348213196,
-0.6626822352409363,
1.4390053749084473,
-0.15856659412384033,
-1.3036210536956787,
0.06782419234514236,
-1.0595897436141968,
1.5827667713165283,
-0.763502836227417,
0.24396421015262604,
-1.686629056930542,
-0.07698502391576767,
-0.513750433921814,
-0.7241368293762207,
-0.9104963541030884,
-0.333590030670166,
-0.9068373441696167,
1.028486728668213,
2.5480616092681885,
1.2337501049041748,
-1.3593242168426514,
2.7736783027648926,
0.562408447265625,
-0.24295569956302643,
-1.0384483337402344,
0.543663740158081,
0.0037335073575377464,
-1.1818256378173828,
-0.4670184850692749,
-0.977438747882843,
-0.037165235728025436,
-0.578117311000824,
-0.39683449268341064,
0.09182987362146378,
0.37461575865745544,
-0.29207348823547363,
-0.2593385577201843,
-0.6242038011550903,
-0.6549689173698425,
0.4905564785003662,
-0.2754872143268585,
0.9785796999931335,
-0.37704893946647644,
1.801692008972168,
-0.5629520416259766,
0.3339966833591461,
0.638369619846344,
1.2472813129425049,
0.17918694019317627,
0.020609691739082336,
0.22735969722270966,
0.26994597911834717,
-0.018833301961421967,
0.6008465886116028,
1.1907870769500732,
0.5990839600563049,
0.559347927570343,
0.6752983331680298,
-2.1961755752563477,
1.2984908819198608,
-0.9172113537788391,
0.27894484996795654,
1.3868569135665894,
-0.7574318647384644,
0.35614877939224243,
-1.7720586061477661,
-0.08673539757728577,
0.6376538276672363,
-2.2517311573028564,
0.22629889845848083,
-1.2282918691635132,
-0.49292105436325073,
0.9602181911468506,
0.34336233139038086,
-1.2280067205429077,
0.27073901891708374,
-0.47328686714172363,
1.0628409385681152,
0.530422031879425,
1.2238707542419434,
-1.594411849975586,
0.0429547019302845,
-0.1473049819469452,
0.1466631144285202,
-1.332168698310852,
-1.6531940698623657,
0.6429251432418823,
0.5263065099716187,
0.757008969783783,
-0.12307421863079071,
0.9703125357627869,
-1.0995205640792847,
0.789742112159729,
-0.9263096451759338,
-1.588282585144043,
-1.382873773574829,
-2.39943265914917,
-2.3986403942108154,
0.858527660369873,
-0.5037253499031067,
-0.4347988963127136,
2.028834104537964,
-1.0100923776626587,
-1.7589298486709595,
1.1010292768478394,
0.2883340120315552,
0.09071530401706696,
2.353738307952881,
0.2860388159751892,
-0.810593843460083,
0.5001170039176941,
-0.6381667256355286,
0.814365565776825,
-0.20569419860839844,
1.264512062072754,
0.47604459524154663,
-1.038347840309143,
1.6648739576339722,
-0.4315667450428009,
0.6186067461967468,
-0.593528687953949,
-0.5419360995292664,
-0.8404579162597656,
0.25202468037605286,
1.8426628112792969,
-0.3255394399166107,
1.6632198095321655,
-0.2998514771461487,
-1.562644124031067,
-1.6141773462295532,
0.8119752407073975,
0.4489651322364807,
-0.9345862865447998,
0.08552471548318863,
-0.4641110301017761,
0.14784474670886993,
-0.01873607747256756,
1.1854678392410278,
1.1483186483383179,
0.6640084385871887,
-0.28098341822624207,
-0.8409351706504822,
0.28723564743995667,
-0.11918924748897552,
-0.679766833782196,
-1.8442440032958984,
-0.32207146286964417,
0.22138598561286926,
0.7125968337059021,
-1.1941932439804077,
1.7894726991653442,
0.913168728351593,
1.9952205419540405,
0.9905842542648315,
-0.4091247022151947,
1.4410035610198975,
-0.01587948203086853,
1.8264639377593994,
-0.42285674810409546,
0.5689679980278015,
-0.3350716233253479,
-1.266476035118103,
0.8037241101264954,
-0.35596516728401184,
-1.9836645126342773,
-0.8579992055892944,
-0.8412933945655823,
-0.12460404634475708,
-0.6970422267913818,
0.846856415271759,
-0.31958258152008057,
-1.4968289136886597,
0.10564867407083511,
-0.661194920539856,
0.21175771951675415,
-1.2476750612258911,
0.18820051848888397,
0.7621810436248779,
-0.772163987159729,
-0.13202224671840668,
-0.27387574315071106,
-1.3194729089736938,
-0.5038195848464966,
0.25116977095603943,
1.9768811464309692,
-0.6578606963157654,
0.8904896974563599,
1.0397851467132568,
-0.719054639339447,
0.07682493329048157,
0.2050761878490448,
-0.31430545449256897,
0.8332711458206177,
-1.1105296611785889,
-0.48340967297554016,
1.1641740798950195,
-0.21654896438121796,
-0.7400853633880615,
1.4561644792556763,
0.7846801280975342,
-1.2191526889801025,
-0.25498804450035095,
-0.21340596675872803,
-0.8477485179901123,
-0.028953853994607925,
-1.4969981908798218,
-0.23140543699264526,
0.44512826204299927,
-1.4787545204162598,
-0.33039015531539917,
-0.17216990888118744,
1.3528647422790527,
-0.2255622297525406,
1.4683260917663574,
-0.3601333200931549,
-0.2102852314710617,
-0.31129857897758484,
-0.4802989065647125,
0.25057366490364075,
-0.12998737394809723,
-0.6176050305366516,
0.24563004076480865,
-0.7933650016784668,
0.3070911467075348,
1.414900541305542,
0.30339011549949646,
0.054060135036706924,
0.5053955912590027,
1.1045258045196533,
0.38601765036582947,
0.0050506070256233215,
-0.8497845530509949,
-1.5673028230667114,
1.9178259372711182,
-1.4101719856262207,
1.8504021167755127,
0.7020025849342346,
-0.13081011176109314,
-1.8386809825897217,
-1.8395769596099854,
1.2766073942184448,
1.179831862449646,
2.3285698890686035,
0.5174708962440491,
0.4130423069000244,
-0.7305811643600464,
-0.8305051922798157,
0.31576839089393616,
-0.8648998141288757,
-0.6825198531150818,
0.18598604202270508,
2.3152430057525635,
1.8483006954193115,
-0.5766725540161133,
-0.26879751682281494,
-0.8359520435333252,
1.2617255449295044,
-0.2703877091407776,
0.23460376262664795,
2.107736110687256,
-0.36152181029319763,
-1.1021536588668823,
1.421539306640625,
-2.385988235473633,
0.29311278462409973,
2.0934908390045166,
0.24905316531658173,
0.06864851713180542,
-1.4450498819351196,
-0.601773202419281,
-0.30889832973480225,
-0.4640824794769287,
-1.3202844858169556,
0.5486036539077759,
-0.29248031973838806,
-0.8323423862457275,
-1.4035643339157104,
0.06291790306568146,
-1.1570701599121094,
-1.7565491199493408,
0.3116321563720703,
1.9129263162612915,
2.1146857738494873,
-0.761512041091919,
1.3509242534637451,
-0.2599932551383972,
0.1280907839536667,
1.258929967880249,
1.339234471321106,
3.1068334579467773,
1.8670132160186768,
-1.3073066473007202,
0.796622097492218,
-0.1665503829717636,
-0.4767680764198303,
1.1349663734436035,
-1.1606996059417725,
1.0822066068649292,
-0.18167781829833984,
-1.3067430257797241,
-1.2101507186889648,
1.0480817556381226,
0.4914852976799011,
-0.0215618759393692,
-0.562065601348877,
1.3196765184402466,
0.04908617585897446,
1.3795015811920166,
0.5702036619186401,
-0.4239925146102905,
0.497847318649292,
-0.4156814515590668,
-0.6098982095718384,
1.634723424911499,
0.13168804347515106,
-1.5549356937408447,
-2.3122668266296387,
-0.2682173252105713,
-0.9823127388954163,
-0.05117199569940567,
-0.6389162540435791,
-1.0140374898910522,
1.5449851751327515,
0.43973010778427124,
-1.1615673303604126,
-0.28704383969306946,
-0.3120217025279999,
-0.5217107534408569,
2.688788414001465,
-1.2903977632522583,
-0.12814217805862427,
-1.0299919843673706,
-0.5440471768379211,
1.6428505182266235,
-1.1666847467422485,
-0.22144238650798798,
-0.9914443492889404,
-0.708356499671936,
-1.3804041147232056,
-0.46068012714385986,
0.043519165366888046,
-0.9646852016448975,
0.7944387793540955,
0.12341678142547607,
-1.0196630954742432,
-0.2746274173259735,
-0.8495060205459595,
1.028591275215149,
-0.1075604110956192,
0.19375105202198029,
1.8532370328903198,
0.30799296498298645,
-0.4419127404689789,
0.6504964828491211,
1.2449731826782227,
0.6898334622383118,
-0.6877917647361755,
0.018857091665267944,
-0.7628566026687622,
0.38047948479652405,
-1.434938669204712,
0.20208972692489624,
-2.978189706802368,
0.8109714984893799,
-0.14976978302001953,
-0.12695570290088654,
-0.08391592651605606,
-1.287856101989746,
0.9733098745346069,
2.606112241744995,
-1.1804929971694946,
0.44420763850212097,
0.47211161255836487,
1.0669573545455933,
-1.6127113103866577,
0.19115588068962097,
-0.5336518883705139,
2.016507387161255,
0.09938562661409378,
1.1594690084457397,
-0.45509791374206543,
-2.1524040699005127,
0.6299307942390442,
-1.2820996046066284,
-0.9831259846687317,
0.8550712466239929,
-0.9054377675056458,
0.29297277331352234,
-1.4286494255065918,
-0.0691942572593689,
-0.9420384168624878,
-1.2693661451339722,
0.788449764251709,
0.08473407477140427,
0.43270358443260193,
-0.5390176177024841,
0.3795355558395386,
-2.150324583053589,
-1.4220839738845825,
-0.1452999860048294,
-1.1265077590942383,
0.5638575553894043,
-0.3885619044303894,
0.6470887064933777,
-0.03674059361219406,
0.16927117109298706,
0.32519054412841797,
1.4678192138671875,
3.444727897644043,
0.1321547031402588,
0.18762421607971191,
-0.13376644253730774,
-1.0447971820831299,
1.4126830101013184,
0.9147182703018188,
-0.09052877128124237,
-0.5627944469451904,
-1.0534433126449585,
1.347525715827942,
1.9662166833877563,
1.1570611000061035,
0.1851470172405243,
-0.8806520700454712,
-0.6512149572372437,
0.03312259912490845,
0.29661014676094055,
0.5790323615074158,
0.8936268091201782,
-0.06741674989461899,
0.1305151730775833,
1.3206539154052734,
1.1528816223144531,
-0.24756355583667755,
0.3609978258609772,
-0.9028619527816772,
-0.46278202533721924,
0.47416263818740845,
0.1934269219636917,
0.14881743490695953,
0.5461220741271973,
-1.0378817319869995,
-0.23799076676368713,
-0.2940818965435028,
-0.8985171318054199,
-0.7660701870918274,
-0.38157880306243896,
-0.37467896938323975,
1.5303113460540771,
-0.048185959458351135,
-0.5312338471412659,
0.08550908416509628,
-0.6591504812240601,
-0.15651603043079376,
-1.074044108390808,
0.09149320423603058,
-0.06353559345006943,
-0.15969596803188324,
-0.17501439154148102,
1.5289666652679443,
-0.9201841950416565,
-2.0957908630371094,
0.12221188843250275,
0.35209810733795166,
-0.240303635597229,
0.11529384553432465,
1.6896389722824097,
0.4521061182022095,
1.386250376701355,
1.276077389717102,
0.9538915157318115,
-0.6387069225311279,
-1.2641788721084595,
0.7052298188209534,
0.9824349284172058,
-1.34345543384552,
0.947381854057312,
-0.2847311496734619,
-0.5385894179344177,
0.6702783107757568,
1.379651665687561,
0.42852360010147095,
-1.9794715642929077,
0.9587829113006592,
-1.0205351114273071,
0.7202048301696777,
0.678691565990448,
0.8345026969909668,
0.2314324975013733,
0.8949355483055115,
-1.196433424949646,
-1.1394051313400269,
-0.6718299388885498,
-0.6142860651016235,
1.8623780012130737,
-0.20643621683120728,
0.5756995677947998,
-0.17382274568080902,
-1.1934541463851929,
-0.07659295201301575,
0.8304742574691772,
0.3827156126499176,
-0.3956010341644287,
0.8871088027954102,
-0.7148036360740662,
-0.940241813659668,
-1.2848509550094604,
-0.38479381799697876,
-1.0377496480941772,
-0.8902515769004822,
1.141271710395813,
0.802823543548584,
0.37744390964508057,
1.9118818044662476,
0.5683989524841309,
0.3169171214103699,
-2.586209297180176,
0.8288478851318359,
0.2905315160751343,
-0.06929533183574677,
0.8398928046226501,
0.2510015666484833,
1.1295219659805298,
-0.015196624211966991,
0.6182559132575989,
-2.3526575565338135,
2.233515739440918,
-0.17758780717849731,
0.6277490258216858,
0.046914197504520416,
-0.2118142992258072,
1.092293381690979,
0.6557530760765076,
0.568942666053772,
-1.0809588432312012,
0.7855256199836731,
-0.48740285634994507,
1.1132622957229614,
0.9885170459747314,
-0.9086240530014038,
0.06241248920559883,
1.3944284915924072,
0.5083147883415222,
-0.4204527735710144,
-0.9934670329093933,
-0.8587023019790649,
0.9665196537971497,
1.6899597644805908,
-0.07334873080253601,
-0.0508892685174942,
0.9020689725875854,
0.7140189409255981,
-1.1967569589614868,
0.08677276968955994,
-0.6827165484428406,
-0.7318115830421448,
1.7148576974868774,
2.0038185119628906,
-0.1096784844994545,
-0.17487555742263794,
-0.7661908864974976,
-1.2036277055740356,
0.777826726436615,
-0.12328311800956726,
-0.003365573938935995,
0.7165648937225342,
-0.7317988276481628,
1.0978487730026245,
0.6774446964263916,
0.9227578043937683,
0.024407926946878433,
0.23419013619422913,
0.35499465465545654,
-0.31840190291404724,
-1.1618198156356812,
-0.2840747833251953,
-1.0193448066711426,
-2.625810384750366,
0.32756590843200684,
-0.287475049495697,
-1.4594528675079346,
0.011762858368456364,
-0.9910016655921936,
0.8968880772590637,
-0.5683942437171936,
-1.1104657649993896,
-1.4079091548919678,
0.36045554280281067,
-0.10045456141233444,
0.9673855900764465,
-1.6936352252960205,
-0.2594091594219208,
1.3070884943008423,
0.8372144103050232,
-0.6004194021224976,
0.9056874513626099,
0.24223141372203827,
0.9033476710319519,
0.7649950385093689,
-0.41685131192207336,
0.5716328024864197,
0.01732020452618599,
-1.3525642156600952,
0.4474947452545166,
1.1693851947784424,
0.16348090767860413,
1.3213555812835693,
-0.45710644125938416,
0.07326710969209671,
0.41300666332244873,
-0.6020891666412354,
-0.4572550058364868,
-0.46843868494033813,
0.7158661484718323,
0.024077828973531723,
-0.9825199246406555,
-0.1314731240272522,
-0.15703760087490082,
-0.335091769695282,
0.18180325627326965,
-1.4348464012145996,
-0.267145574092865,
-0.3814661204814911,
-0.4863101840019226,
-1.3189533948898315,
-0.003666226752102375,
1.3009620904922485,
-0.8283920884132385,
-0.24765752255916595,
0.4134231507778168,
0.43561726808547974,
0.5653130412101746,
0.5827257037162781,
-0.7565640211105347,
-0.31055641174316406,
-0.32357490062713623,
-0.2684822380542755,
0.2428090125322342,
1.253335952758789,
-0.08591557294130325,
-1.002056360244751,
0.7222437262535095,
-0.3127100169658661,
0.1441313624382019,
2.026216745376587,
0.11406634002923965,
-0.7166386842727661,
0.37259766459465027,
-0.7536458969116211,
1.7303431034088135,
1.778723955154419,
1.2921931743621826,
-0.11949938535690308,
-0.8159643411636353,
0.6201895475387573,
-0.3182527720928192,
-0.3511117994785309,
0.9990594387054443,
0.4116639196872711,
-0.2432543784379959,
-1.49563729763031,
0.6805077791213989,
1.2446340322494507,
-0.6823343634605408,
-0.7270852327346802,
0.05414971336722374,
-0.910648763179779,
1.1723997592926025,
0.6110594868659973,
0.34130239486694336,
0.2752811908721924,
1.5497958660125732,
0.7786909341812134,
-0.48821166157722473,
0.47064369916915894,
0.5821510553359985,
-0.24632801115512848,
-2.119805097579956,
-1.003017544746399,
0.3149092197418213,
-0.41323432326316833,
-1.6460992097854614,
1.3843413591384888,
-1.1406530141830444,
-0.9957028031349182,
0.5891589522361755,
0.06407222896814346,
1.239454984664917,
0.3412471115589142,
1.786080002784729,
2.086014986038208,
0.8961264491081238,
0.3546796143054962,
1.2703334093093872,
-0.05513843894004822,
-0.39855220913887024,
1.7783844470977783,
-0.4032788872718811,
0.5202489495277405,
1.0438737869262695,
-0.37393540143966675,
-1.0443116426467896,
-0.7985360026359558,
-1.1616253852844238,
-0.6087805032730103,
1.086099624633789,
0.15754592418670654,
-1.0503281354904175,
0.20249637961387634,
1.5751503705978394,
0.17232121527194977,
-0.2111845314502716,
0.6630577445030212,
0.39095205068588257,
-0.7302890419960022,
-0.0917445495724678,
-0.8800901770591736,
0.5151618719100952,
-0.11369440704584122,
-0.22129762172698975,
0.2654707431793213,
0.5686886310577393,
1.408815622329712,
0.001568448729813099,
0.150181844830513,
1.1390252113342285,
-1.3792074918746948,
1.4943821430206299,
-0.6373240351676941,
0.33148160576820374,
-2.515563488006592,
1.3606008291244507,
-0.7396628856658936,
2.0213119983673096,
-2.5151450634002686,
0.4533928632736206,
-0.5637930631637573,
-0.5107551217079163,
0.31701213121414185,
-0.4336085021495819,
0.14190733432769775,
-0.12492553144693375,
-0.960670530796051,
-0.036407992243766785,
-0.7696349620819092,
0.6317809820175171,
1.1931111812591553,
1.3630130290985107,
-1.1611374616622925,
-0.3459845781326294,
-1.6373775005340576,
-0.23814719915390015,
-0.7144688367843628,
0.3192313015460968,
-1.9163659811019897,
-0.2234000861644745,
-2.042569875717163,
-2.4504823684692383,
-1.3939142227172852,
-0.8185921311378479,
1.1614046096801758,
0.20666839182376862,
-1.0211585760116577,
1.1680529117584229,
-0.4146575331687927,
-1.8076328039169312,
1.1488739252090454,
-2.170182228088379
] |
https://github.com/huggingface/datasets/issues/6020 | Inconsistent "The features can't be aligned" error when combining map, multiprocessing, and variable length outputs | This scenario currently requires explicitly passing the target features (to avoid the error):
```python
import datasets
...
features = dataset.features
features["output"] = = [{"test": datasets.Value("int64")}]
test2 = dataset.map(lambda row, idx: test_func(row, idx), with_indices=True, num_proc=32, features=features)
``` | ### Describe the bug
I'm using a dataset with map and multiprocessing to run a function that returned a variable length list of outputs. This output list may be empty. Normally this is handled fine, but there is an edge case that crops up when using multiprocessing. In some cases, an empty list result ends up in a dataset shard consisting of a single item. This results in a `The features can't be aligned` error that is difficult to debug because it depends on the number of processes/shards used.
I've reproduced a minimal example below. My current workaround is to fill empty results with a dummy value that I filter after, but this was a weird error that took a while to track down.
### Steps to reproduce the bug
```python
import datasets
dataset = datasets.Dataset.from_list([{'idx':i} for i in range(60)])
def test_func(row, idx):
if idx==58:
return {'output': []}
else:
return {'output' : [{'test':1}, {'test':2}]}
# this works fine
test1 = dataset.map(lambda row, idx: test_func(row, idx), with_indices=True, num_proc=4)
# this fails
test2 = dataset.map(lambda row, idx: test_func(row, idx), with_indices=True, num_proc=32)
>ValueError: The features can't be aligned because the key output of features {'idx': Value(dtype='int64', id=None), 'output': Sequence(feature=Value(dtype='null', id=None), length=-1, id=None)} has unexpected type - Sequence(feature=Value(dtype='null', id=None), length=-1, id=None) (expected either [{'test': Value(dtype='int64', id=None)}] or Value("null").
```
The error occurs during the check
```python
_check_if_features_can_be_aligned([dset.features for dset in dsets])
```
When the multiprocessing splitting lines up just right with the empty return value, one of the `dset` in `dsets` will have a single item with an empty list value, causing the error.
### Expected behavior
Expected behavior is the result would be the same regardless of the `num_proc` value used.
### Environment info
Datasets version 2.11.0
Python 3.9.16 | 33 | 36 | Inconsistent "The features can't be aligned" error when combining map, multiprocessing, and variable length outputs
### Describe the bug
I'm using a dataset with map and multiprocessing to run a function that returned a variable length list of outputs. This output list may be empty. Normally this is handled fine, but there is an edge case that crops up when using multiprocessing. In some cases, an empty list result ends up in a dataset shard consisting of a single item. This results in a `The features can't be aligned` error that is difficult to debug because it depends on the number of processes/shards used.
I've reproduced a minimal example below. My current workaround is to fill empty results with a dummy value that I filter after, but this was a weird error that took a while to track down.
### Steps to reproduce the bug
```python
import datasets
dataset = datasets.Dataset.from_list([{'idx':i} for i in range(60)])
def test_func(row, idx):
if idx==58:
return {'output': []}
else:
return {'output' : [{'test':1}, {'test':2}]}
# this works fine
test1 = dataset.map(lambda row, idx: test_func(row, idx), with_indices=True, num_proc=4)
# this fails
test2 = dataset.map(lambda row, idx: test_func(row, idx), with_indices=True, num_proc=32)
>ValueError: The features can't be aligned because the key output of features {'idx': Value(dtype='int64', id=None), 'output': Sequence(feature=Value(dtype='null', id=None), length=-1, id=None)} has unexpected type - Sequence(feature=Value(dtype='null', id=None), length=-1, id=None) (expected either [{'test': Value(dtype='int64', id=None)}] or Value("null").
```
The error occurs during the check
```python
_check_if_features_can_be_aligned([dset.features for dset in dsets])
```
When the multiprocessing splitting lines up just right with the empty return value, one of the `dset` in `dsets` will have a single item with an empty list value, causing the error.
### Expected behavior
Expected behavior is the result would be the same regardless of the `num_proc` value used.
### Environment info
Datasets version 2.11.0
Python 3.9.16
This scenario currently requires explicitly passing the target features (to avoid the error):
```python
import datasets
...
features = dataset.features
features["output"] = = [{"test": datasets.Value("int64")}]
test2 = dataset.map(lambda row, idx: test_func(row, idx), with_indices=True, num_proc=32, features=features)
``` | [
-1.2154974937438965,
-1.0155515670776367,
-0.7719004154205322,
1.5813425779342651,
-0.2697145640850067,
-1.105621576309204,
0.07095621526241302,
-1.0311253070831299,
1.575103759765625,
-0.7578650116920471,
0.27627527713775635,
-1.6430742740631104,
0.032659441232681274,
-0.7017241716384888,
-0.7221738696098328,
-0.829932451248169,
-0.3410937190055847,
-0.7434271574020386,
1.1441789865493774,
2.513798952102661,
1.1701115369796753,
-1.5086345672607422,
2.7045845985412598,
0.8395006060600281,
-0.20066268742084503,
-1.0257850885391235,
0.575857937335968,
-0.049216173589229584,
-1.219749093055725,
-0.48988690972328186,
-0.8314977288246155,
-0.13299092650413513,
-0.5103568434715271,
-0.48777350783348083,
-0.14977556467056274,
0.4785570204257965,
-0.23037105798721313,
-0.45333942770957947,
-0.5244424343109131,
-0.7560302019119263,
0.49802055954933167,
-0.4413766860961914,
0.8314049243927002,
-0.2580775022506714,
1.8134530782699585,
-0.445891797542572,
0.3233128488063812,
0.6155476570129395,
1.39305579662323,
0.26910531520843506,
-0.02318612113595009,
0.4553978443145752,
0.3642862141132355,
-0.12849588692188263,
0.5142344236373901,
1.1581043004989624,
0.7642658948898315,
0.40027543902397156,
0.8368394374847412,
-2.2460198402404785,
1.2492138147354126,
-1.1528394222259521,
0.4711780250072479,
1.299846887588501,
-1.0073422193527222,
0.49302515387535095,
-1.710038661956787,
-0.049464523792266846,
0.5917004942893982,
-2.1614227294921875,
0.2982073724269867,
-1.217516541481018,
-0.4773542582988739,
0.9192568063735962,
0.3177221119403839,
-1.2479833364486694,
0.12475746124982834,
-0.40014833211898804,
1.0555599927902222,
0.3493676483631134,
1.0371655225753784,
-1.6723769903182983,
-0.01490790955722332,
-0.3190978169441223,
0.13387688994407654,
-1.3519915342330933,
-1.4989252090454102,
0.5357582569122314,
0.5787345767021179,
0.595046877861023,
-0.16236570477485657,
1.0141112804412842,
-1.0343867540359497,
0.6389740109443665,
-1.0324468612670898,
-1.6781584024429321,
-1.473115086555481,
-2.3359665870666504,
-2.1523680686950684,
0.7195543050765991,
-0.4256698191165924,
-0.6153865456581116,
2.0007035732269287,
-0.9160976409912109,
-1.7507215738296509,
1.2345362901687622,
0.3577023446559906,
-0.007090277969837189,
2.467632532119751,
0.12750506401062012,
-0.8080241084098816,
0.4918260872364044,
-0.826704740524292,
0.7417399883270264,
-0.4669492840766907,
1.4919675588607788,
0.3784925639629364,
-0.891698956489563,
1.6299691200256348,
-0.40578991174697876,
0.49979159235954285,
-0.6646618247032166,
-0.5054160952568054,
-0.7833070158958435,
0.3302669823169708,
1.8874499797821045,
-0.23503746092319489,
1.5140043497085571,
-0.41696998476982117,
-1.5338714122772217,
-1.6091355085372925,
0.9353522658348083,
0.4339887797832489,
-0.8441329002380371,
0.22739587724208832,
-0.4200280010700226,
0.13788841664791107,
-0.05616980046033859,
1.129433512687683,
1.289350152015686,
0.5866362452507019,
-0.24294883012771606,
-0.9021213054656982,
0.18528835475444794,
-0.1758144497871399,
-0.6334028244018555,
-1.7914999723434448,
-0.27954724431037903,
0.07340099662542343,
0.6761338114738464,
-1.2261043787002563,
1.6759512424468994,
0.9405801296234131,
1.8570297956466675,
1.0491963624954224,
-0.39145997166633606,
1.4859391450881958,
0.1236974373459816,
1.787238359451294,
-0.5866425037384033,
0.6916550397872925,
-0.43282681703567505,
-1.1207035779953003,
0.8999853730201721,
-0.26325738430023193,
-2.038550615310669,
-0.6812252402305603,
-0.8014198541641235,
-0.23098011314868927,
-0.8624350428581238,
0.8650243282318115,
-0.33913618326187134,
-1.3990310430526733,
0.34799301624298096,
-0.7998445630073547,
0.2831079661846161,
-1.140027642250061,
0.3928501009941101,
0.7013739943504333,
-0.5058653950691223,
0.10549347847700119,
-0.2566307783126831,
-1.22171151638031,
-0.4972180128097534,
0.39645814895629883,
1.8369778394699097,
-0.8193838596343994,
0.7500740885734558,
1.0955053567886353,
-0.59925776720047,
-0.0007714768871665001,
0.38432905077934265,
-0.2189418524503708,
0.8042309284210205,
-0.9876968860626221,
-0.6123589277267456,
1.143858551979065,
-0.20212343335151672,
-0.5307759642601013,
1.4292564392089844,
0.7998777031898499,
-0.9374944567680359,
-0.18022450804710388,
-0.12793594598770142,
-0.8859283924102783,
-0.008173980750143528,
-1.6373764276504517,
-0.15217642486095428,
0.4717411398887634,
-1.590235710144043,
-0.5228370428085327,
-0.24839212000370026,
1.2581517696380615,
-0.13744209706783295,
1.4005546569824219,
-0.4305286705493927,
-0.14241185784339905,
-0.271373450756073,
-0.3974546492099762,
0.13998951017856598,
-0.26511839032173157,
-0.6105130314826965,
0.165286123752594,
-0.8516908288002014,
0.3951922655105591,
1.4460771083831787,
0.38517096638679504,
0.07594699412584305,
0.578227698802948,
1.1711480617523193,
0.442126601934433,
-0.00037291087210178375,
-0.8085386157035828,
-1.4454292058944702,
2.0049521923065186,
-1.5470716953277588,
2.0773367881774902,
0.775227427482605,
0.06134247034788132,
-1.7278803586959839,
-1.8143056631088257,
1.3936558961868286,
1.2255916595458984,
2.295114040374756,
0.6059349775314331,
0.39605939388275146,
-0.8961455821990967,
-0.6445065140724182,
0.1704285442829132,
-1.0053366422653198,
-0.7981243133544922,
0.12106958776712418,
2.48427677154541,
1.851726770401001,
-0.42019373178482056,
-0.17192161083221436,
-1.0252283811569214,
1.5216450691223145,
-0.20416775345802307,
0.20633959770202637,
2.0280911922454834,
-0.13291631639003754,
-1.112393856048584,
1.2052419185638428,
-2.553988456726074,
0.14426013827323914,
1.9560832977294922,
0.3500673174858093,
0.17624886333942413,
-1.3491026163101196,
-0.6801417469978333,
-0.23673754930496216,
-0.4334673285484314,
-1.2683714628219604,
0.45504865050315857,
-0.2740046977996826,
-0.7392436861991882,
-1.4884356260299683,
0.19730931520462036,
-1.1491377353668213,
-1.605722188949585,
0.26174214482307434,
1.8640567064285278,
2.1457343101501465,
-0.773204505443573,
1.689629077911377,
-0.21885475516319275,
0.23940517008304596,
1.2355682849884033,
1.2449065446853638,
3.041914939880371,
1.9085243940353394,
-1.2728524208068848,
0.48033884167671204,
-0.15269194543361664,
-0.4621991813182831,
1.117430329322815,
-1.210911512374878,
1.1967965364456177,
-0.10988293588161469,
-1.1790791749954224,
-1.201751470565796,
0.8582460284233093,
0.48678088188171387,
0.024602914229035378,
-0.4743339717388153,
1.1186679601669312,
0.014466939494013786,
1.3385405540466309,
0.6465312838554382,
-0.24401049315929413,
0.4709433913230896,
-0.3615633547306061,
-0.5294145345687866,
1.5746268033981323,
0.15590523183345795,
-1.402625560760498,
-2.1924526691436768,
-0.17360055446624756,
-0.7606813907623291,
0.006515588611364365,
-0.6164516806602478,
-1.0253366231918335,
1.5803213119506836,
0.29215097427368164,
-1.167995572090149,
-0.19616705179214478,
-0.3255031406879425,
-0.5727044939994812,
2.6789002418518066,
-1.4132651090621948,
-0.403638631105423,
-0.9986389875411987,
-0.6834922432899475,
1.6533747911453247,
-1.132564663887024,
-0.18086634576320648,
-1.0462241172790527,
-0.5573846101760864,
-1.2764959335327148,
-0.5553333163261414,
-0.1055501401424408,
-0.8416897654533386,
0.8320829272270203,
0.2795937955379486,
-1.1804863214492798,
-0.37121379375457764,
-0.8686654567718506,
0.8811264038085938,
-0.1819329708814621,
0.17541061341762543,
1.8362555503845215,
0.3857760429382324,
-0.3582570552825928,
0.9029276967048645,
1.1508674621582031,
0.6000826358795166,
-0.5967921018600464,
0.2511356472969055,
-0.5560219287872314,
0.37078654766082764,
-1.2962037324905396,
0.29291900992393494,
-2.824470281600952,
0.5912837982177734,
0.060745321214199066,
-0.025094538927078247,
-0.00516195222735405,
-1.366363525390625,
1.1391122341156006,
2.5572657585144043,
-1.168274164199829,
0.5784783959388733,
0.3212747871875763,
1.3346987962722778,
-1.7571734189987183,
0.31798362731933594,
-0.38621243834495544,
2.1848843097686768,
0.22904296219348907,
1.2127808332443237,
-0.4738571345806122,
-2.495424747467041,
0.48196735978126526,
-1.314060091972351,
-1.068548560142517,
0.5928630232810974,
-0.9016053080558777,
0.09176850318908691,
-1.5948290824890137,
-0.24247200787067413,
-0.8815320730209351,
-1.1318563222885132,
0.7400919795036316,
0.20211182534694672,
0.30598512291908264,
-0.5930858850479126,
0.34343773126602173,
-2.2148337364196777,
-1.36850905418396,
-0.21107082068920135,
-0.8925828337669373,
0.4894099533557892,
-0.38478341698646545,
0.7488605380058289,
-0.13766175508499146,
-0.13398176431655884,
0.2843858003616333,
1.448785662651062,
3.3177905082702637,
0.25417929887771606,
0.4701804518699646,
-0.21375419199466705,
-0.8687915205955505,
1.4273971319198608,
0.8135818839073181,
-0.21110430359840393,
-0.49906519055366516,
-1.117302656173706,
1.3816736936569214,
1.8846359252929688,
1.0196629762649536,
-0.008670506998896599,
-0.7393372654914856,
-0.6752050518989563,
-0.09235063940286636,
0.2865569591522217,
0.441261887550354,
0.8999153971672058,
-0.04644419252872467,
0.031229985877871513,
1.4371321201324463,
1.2053940296173096,
-0.5400707721710205,
0.3527609705924988,
-0.8819666504859924,
-0.4868779182434082,
0.42125773429870605,
0.22656826674938202,
-0.0712522342801094,
0.3530084788799286,
-1.0216684341430664,
-0.28477853536605835,
-0.2807556092739105,
-0.8651869297027588,
-0.6642746329307556,
-0.41444242000579834,
-0.3491356372833252,
1.6237890720367432,
0.23791158199310303,
-0.6550576090812683,
-0.10315602272748947,
-0.7497588992118835,
-0.16683954000473022,
-1.1018933057785034,
0.1750173717737198,
-0.08734634518623352,
-0.1383008360862732,
-0.13680507242679596,
1.7573678493499756,
-0.8352052569389343,
-2.1862900257110596,
0.19118143618106842,
0.31004956364631653,
-0.17709067463874817,
0.27926406264305115,
1.6839228868484497,
0.5226816534996033,
1.4060883522033691,
1.371728539466858,
0.9878880977630615,
-0.7023422122001648,
-1.3944532871246338,
0.7444838285446167,
1.0877047777175903,
-1.311096429824829,
0.7703202962875366,
-0.005081656854599714,
-0.525773823261261,
0.5827395915985107,
1.2940092086791992,
0.5408028364181519,
-2.100116014480591,
0.828387439250946,
-1.0690503120422363,
0.8731182217597961,
0.7723141312599182,
0.6070829629898071,
0.2911232113838196,
0.8240723013877869,
-1.3143627643585205,
-1.0596528053283691,
-0.8335441946983337,
-0.7383475303649902,
1.9706181287765503,
-0.27912411093711853,
0.6512379050254822,
-0.15887916088104248,
-1.3785344362258911,
-0.05830211937427521,
0.6564290523529053,
0.23395000398159027,
-0.5453152060508728,
0.7780166864395142,
-0.7155704498291016,
-1.2377206087112427,
-1.3280396461486816,
-0.42672449350357056,
-0.9627851247787476,
-0.9518918991088867,
1.117222785949707,
0.8259527087211609,
0.15488260984420776,
1.8906997442245483,
0.6900195479393005,
0.11586131900548935,
-2.519467830657959,
0.9115036129951477,
0.2931239604949951,
-0.10802515596151352,
0.7388105392456055,
0.39366674423217773,
0.9594780206680298,
0.11109277606010437,
0.6156469583511353,
-2.4718658924102783,
2.3056869506835938,
-0.1662113517522812,
0.8397166728973389,
-0.011290180496871471,
-0.09106865525245667,
1.0762914419174194,
0.5953649878501892,
0.5384557247161865,
-0.9173426628112793,
0.5772526264190674,
-0.5710347890853882,
1.2932897806167603,
0.9602936506271362,
-0.7837281227111816,
-0.013306736014783382,
1.2605441808700562,
0.3236714005470276,
-0.6851929426193237,
-0.9711635708808899,
-0.8676588535308838,
0.8914688229560852,
1.705757737159729,
-0.03193240612745285,
0.03259005397558212,
0.8102703094482422,
0.6429158449172974,
-1.2816452980041504,
0.02288432978093624,
-0.6660029888153076,
-0.6956884860992432,
1.7237836122512817,
2.048226833343506,
-0.3550782799720764,
-0.10859326273202896,
-0.6513990163803101,
-1.3763874769210815,
0.7813025116920471,
-0.0628143921494484,
0.16134871542453766,
0.6876489520072937,
-0.6358206868171692,
1.0008240938186646,
0.9007021188735962,
0.8375520706176758,
0.25730323791503906,
0.22116558253765106,
0.40418416261672974,
-0.37716877460479736,
-1.029770851135254,
-0.21589377522468567,
-1.2234803438186646,
-2.466742992401123,
0.37091025710105896,
-0.10628104954957962,
-1.285032033920288,
0.05872449278831482,
-0.9979928135871887,
1.056885004043579,
-0.6149312853813171,
-1.0757399797439575,
-1.4778146743774414,
0.1971297711133957,
-0.03796008974313736,
0.8610674738883972,
-1.7009303569793701,
-0.09924855828285217,
1.200089693069458,
0.8731177449226379,
-0.6782081127166748,
1.049630045890808,
0.2810162305831909,
1.1521015167236328,
0.828482449054718,
-0.374906986951828,
0.5166182518005371,
-0.019914019852876663,
-1.3357641696929932,
0.4935544431209564,
1.1688507795333862,
0.08310403674840927,
1.4953882694244385,
-0.5371402502059937,
-0.05971524864435196,
0.39764562249183655,
-0.554656982421875,
-0.43083471059799194,
-0.5072972178459167,
0.589591383934021,
0.05583491176366806,
-0.808595597743988,
-0.04732205718755722,
0.03307186812162399,
-0.26641422510147095,
0.13917414844036102,
-1.5034970045089722,
-0.1552771031856537,
-0.42110171914100647,
-0.5808219313621521,
-1.2244915962219238,
-0.20316599309444427,
1.4291305541992188,
-0.6667711734771729,
-0.24716731905937195,
0.5256480574607849,
0.3819170594215393,
0.4976066052913666,
0.6588174104690552,
-0.6578406095504761,
-0.36350804567337036,
-0.08229916542768478,
-0.3196682631969452,
0.3206760883331299,
1.3769783973693848,
-0.15854713320732117,
-0.929919421672821,
0.7006142735481262,
-0.3421122133731842,
0.0690540298819542,
1.8085887432098389,
-0.002156936563551426,
-0.8539590835571289,
0.24694228172302246,
-0.7755637168884277,
2.0113744735717773,
1.6646286249160767,
1.3445439338684082,
-0.27836495637893677,
-0.8721076846122742,
0.6893978714942932,
-0.35679176449775696,
-0.4540494680404663,
0.7595651149749756,
0.4507175385951996,
-0.22530797123908997,
-1.458662748336792,
0.7391330003738403,
1.2802734375,
-0.8349486589431763,
-0.8414064645767212,
0.12226512283086777,
-0.7289257049560547,
1.1568944454193115,
0.6138564944267273,
0.3272150754928589,
0.2728103995323181,
1.7283856868743896,
0.7667842507362366,
-0.5009171366691589,
0.5678573250770569,
0.5448359847068787,
-0.14565664529800415,
-2.130950689315796,
-1.2101565599441528,
0.26729777455329895,
-0.508915364742279,
-1.6420354843139648,
1.2738224267959595,
-1.140212893486023,
-0.88697749376297,
0.6165763735771179,
0.08481164276599884,
1.3739651441574097,
0.34723469614982605,
1.4463746547698975,
1.9987924098968506,
0.7350170612335205,
0.473501980304718,
1.2421749830245972,
-0.22023437917232513,
-0.4610063135623932,
1.76410973072052,
-0.3198254108428955,
0.5018622279167175,
1.0982439517974854,
-0.23801754415035248,
-1.1713945865631104,
-0.7101520299911499,
-1.3421489000320435,
-0.7090741395950317,
1.2168718576431274,
0.13273632526397705,
-1.112846851348877,
0.29932132363319397,
1.5708550214767456,
-0.017203882336616516,
-0.47161003947257996,
0.574307918548584,
0.46141374111175537,
-0.8675869107246399,
-0.067066490650177,
-0.9414269924163818,
0.5135764479637146,
-0.19221551716327667,
-0.3582015931606293,
0.42101240158081055,
0.474575936794281,
1.2982286214828491,
0.058991000056266785,
0.19576777517795563,
1.08315110206604,
-1.4298558235168457,
1.5040534734725952,
-0.7468268871307373,
0.32027608156204224,
-2.30560564994812,
1.4078056812286377,
-0.6993539929389954,
2.092292547225952,
-2.729835033416748,
0.4889214038848877,
-0.7175513505935669,
-0.4288136661052704,
0.3565834164619446,
-0.31693023443222046,
0.09829085320234299,
-0.08890558034181595,
-1.0992412567138672,
0.034883640706539154,
-0.6105283498764038,
0.44755545258522034,
1.1719392538070679,
1.2520158290863037,
-1.073083519935608,
-0.21704928576946259,
-1.7360117435455322,
-0.2234681099653244,
-0.7996494770050049,
0.1885308176279068,
-2.092867851257324,
-0.23790013790130615,
-1.8812947273254395,
-2.222219705581665,
-1.2063987255096436,
-0.8457397818565369,
1.1338087320327759,
0.07708996534347534,
-0.8398756980895996,
1.3477153778076172,
-0.41355153918266296,
-1.7826107740402222,
1.0721315145492554,
-2.0393407344818115
] |
https://github.com/huggingface/datasets/issues/6109 | Problems in downloading Amazon reviews from HF | Thanks for reporting, @610v4nn1.
Indeed, the source data files are no longer available. We have contacted the authors of the dataset and they report that Amazon has decided to stop distributing the multilingual reviews dataset.
We are adding a notification about this issue to the dataset card.
See: https://huggingface.co/datasets/amazon_reviews_multi/discussions/4#64c3898db63057f1fd3ce1a0 | ### Describe the bug
I have a script downloading `amazon_reviews_multi`.
When the download starts, I get
```
Downloading data files: 0%| | 0/1 [00:00<?, ?it/s]
Downloading data: 243B [00:00, 1.43MB/s]
Downloading data files: 100%|ββββββββββ| 1/1 [00:01<00:00, 1.54s/it]
Extracting data files: 100%|ββββββββββ| 1/1 [00:00<00:00, 842.40it/s]
Downloading data files: 0%| | 0/1 [00:00<?, ?it/s]
Downloading data: 243B [00:00, 928kB/s]
Downloading data files: 100%|ββββββββββ| 1/1 [00:01<00:00, 1.42s/it]
Extracting data files: 100%|ββββββββββ| 1/1 [00:00<00:00, 832.70it/s]
Downloading data files: 0%| | 0/1 [00:00<?, ?it/s]
Downloading data: 243B [00:00, 1.81MB/s]
Downloading data files: 100%|ββββββββββ| 1/1 [00:01<00:00, 1.40s/it]
Extracting data files: 100%|ββββββββββ| 1/1 [00:00<00:00, 1294.14it/s]
Generating train split: 0%| | 0/200000 [00:00<?, ? examples/s]
```
the file is clearly too small to contain the requested dataset, in fact it contains en error message:
```
<?xml version="1.0" encoding="UTF-8"?>
<Error><Code>AccessDenied</Code><Message>Access Denied</Message><RequestId>AGJWSY3ZADT2QVWE</RequestId><HostId>Gx1O2KXnxtQFqvzDLxyVSTq3+TTJuTnuVFnJL3SP89Yp8UzvYLPTVwd1PpniE4EvQzT3tCaqEJw=</HostId></Error>
```
obviously the script fails:
```
> raise DatasetGenerationError("An error occurred while generating the dataset") from e
E datasets.builder.DatasetGenerationError: An error occurred while generating the dataset
```
### Steps to reproduce the bug
1. load_dataset("amazon_reviews_multi", name="en", split="train", cache_dir="ADDYOURPATHHERE")
### Expected behavior
I would expect the dataset to be downloaded and processed
### Environment info
* The problem is present with both datasets 2.12.0 and 2.14.2
* python version 3.10.12 | 35 | 49 | Problems in downloading Amazon reviews from HF
### Describe the bug
I have a script downloading `amazon_reviews_multi`.
When the download starts, I get
```
Downloading data files: 0%| | 0/1 [00:00<?, ?it/s]
Downloading data: 243B [00:00, 1.43MB/s]
Downloading data files: 100%|ββββββββββ| 1/1 [00:01<00:00, 1.54s/it]
Extracting data files: 100%|ββββββββββ| 1/1 [00:00<00:00, 842.40it/s]
Downloading data files: 0%| | 0/1 [00:00<?, ?it/s]
Downloading data: 243B [00:00, 928kB/s]
Downloading data files: 100%|ββββββββββ| 1/1 [00:01<00:00, 1.42s/it]
Extracting data files: 100%|ββββββββββ| 1/1 [00:00<00:00, 832.70it/s]
Downloading data files: 0%| | 0/1 [00:00<?, ?it/s]
Downloading data: 243B [00:00, 1.81MB/s]
Downloading data files: 100%|ββββββββββ| 1/1 [00:01<00:00, 1.40s/it]
Extracting data files: 100%|ββββββββββ| 1/1 [00:00<00:00, 1294.14it/s]
Generating train split: 0%| | 0/200000 [00:00<?, ? examples/s]
```
the file is clearly too small to contain the requested dataset, in fact it contains en error message:
```
<?xml version="1.0" encoding="UTF-8"?>
<Error><Code>AccessDenied</Code><Message>Access Denied</Message><RequestId>AGJWSY3ZADT2QVWE</RequestId><HostId>Gx1O2KXnxtQFqvzDLxyVSTq3+TTJuTnuVFnJL3SP89Yp8UzvYLPTVwd1PpniE4EvQzT3tCaqEJw=</HostId></Error>
```
obviously the script fails:
```
> raise DatasetGenerationError("An error occurred while generating the dataset") from e
E datasets.builder.DatasetGenerationError: An error occurred while generating the dataset
```
### Steps to reproduce the bug
1. load_dataset("amazon_reviews_multi", name="en", split="train", cache_dir="ADDYOURPATHHERE")
### Expected behavior
I would expect the dataset to be downloaded and processed
### Environment info
* The problem is present with both datasets 2.12.0 and 2.14.2
* python version 3.10.12
Thanks for reporting, @610v4nn1.
Indeed, the source data files are no longer available. We have contacted the authors of the dataset and they report that Amazon has decided to stop distributing the multilingual reviews dataset.
We are adding a notification about this issue to the dataset card.
See: https://huggingface.co/datasets/amazon_reviews_multi/discussions/4#64c3898db63057f1fd3ce1a0 | [
-1.1749063730239868,
-0.8698778748512268,
-0.8900013566017151,
1.4243459701538086,
-0.13573047518730164,
-1.2226994037628174,
0.15154093503952026,
-1.2511365413665771,
1.432878017425537,
-0.6011939644813538,
0.4040875732898712,
-1.727347731590271,
0.04589912295341492,
-0.4552827477455139,
-0.8431816697120667,
-0.9063414931297302,
-0.48868969082832336,
-0.8219608664512634,
0.97809898853302,
2.5221447944641113,
1.2454487085342407,
-1.4582936763763428,
2.7142021656036377,
0.6927785277366638,
-0.17263635993003845,
-0.89736008644104,
0.6637338399887085,
0.12301131337881088,
-1.3747620582580566,
-0.35270318388938904,
-0.8864206671714783,
-0.2087256908416748,
-0.6776193976402283,
-0.3735634386539459,
0.07718082517385483,
0.36934807896614075,
-0.3336281180381775,
-0.39881977438926697,
-0.5040537118911743,
-0.7731653451919556,
0.4934993088245392,
-0.32639068365097046,
0.9452347755432129,
-0.3145279288291931,
1.7314435243606567,
-0.6894515156745911,
0.33928388357162476,
0.8193453550338745,
1.272710919380188,
0.13429616391658783,
0.06353253871202469,
0.4447978138923645,
0.3506908118724823,
-0.05120202898979187,
0.41016343235969543,
1.257990837097168,
0.5390438437461853,
0.39969515800476074,
0.8323001265525818,
-2.1086618900299072,
1.214141607284546,
-0.9440236687660217,
0.3650023639202118,
1.2934412956237793,
-0.6883390545845032,
0.26393094658851624,
-1.8103132247924805,
-0.11476963013410568,
0.6600466370582581,
-2.1344153881073,
0.3564904034137726,
-1.2919360399246216,
-0.443464457988739,
0.823783278465271,
0.31505170464515686,
-1.0992859601974487,
0.1924101710319519,
-0.6111176609992981,
1.0263460874557495,
0.37969839572906494,
1.2355438470840454,
-1.6439788341522217,
0.034126706421375275,
-0.3567346930503845,
0.15840794146060944,
-1.2842997312545776,
-1.517490267753601,
0.6225483417510986,
0.5877630114555359,
0.5768107175827026,
-0.05366376042366028,
1.0444368124008179,
-0.990924596786499,
0.9438011050224304,
-1.067526936531067,
-1.7909425497055054,
-1.4233341217041016,
-2.2656028270721436,
-2.1752960681915283,
0.675883948802948,
-0.5190905928611755,
-0.5248356461524963,
2.0744285583496094,
-0.8218443989753723,
-1.6847647428512573,
1.0912985801696777,
0.3453565239906311,
-0.025715110823512077,
2.38901424407959,
0.2334384322166443,
-0.8005092144012451,
0.4655986428260803,
-0.7721642851829529,
0.8532306551933289,
-0.17334415018558502,
1.3294612169265747,
0.3952501118183136,
-0.817322313785553,
1.544211983680725,
-0.4773818254470825,
0.5181127190589905,
-0.7069194316864014,
-0.510952889919281,
-0.7492472529411316,
0.1645050048828125,
1.8872120380401611,
-0.39235642552375793,
1.621995449066162,
-0.3711506724357605,
-1.59600830078125,
-1.4015074968338013,
0.8548070192337036,
0.6230926513671875,
-0.9188022017478943,
0.04255623370409012,
-0.312197744846344,
0.18259593844413757,
-0.03362133726477623,
1.1139637231826782,
1.307114839553833,
0.6890169978141785,
-0.32089683413505554,
-0.9190853834152222,
0.09913426637649536,
-0.11919127404689789,
-0.926041305065155,
-1.757145881652832,
-0.23652704060077667,
0.05040449649095535,
0.7428519129753113,
-1.3149826526641846,
1.7849582433700562,
0.8830626010894775,
2.0343971252441406,
0.9405912160873413,
-0.5310664176940918,
1.528465747833252,
-0.02817205712199211,
1.8298226594924927,
-0.5771598815917969,
0.5628949403762817,
-0.5365077257156372,
-1.0460240840911865,
0.9805912971496582,
-0.2174881398677826,
-2.0183277130126953,
-0.8027382493019104,
-0.769136369228363,
-0.19887733459472656,
-0.7266181707382202,
0.955259382724762,
-0.30016273260116577,
-1.4182432889938354,
0.3275747001171112,
-0.802653968334198,
-0.06346053630113602,
-1.2230960130691528,
0.21879997849464417,
0.6387523412704468,
-0.5716357827186584,
0.10249320417642593,
-0.18729642033576965,
-1.2710916996002197,
-0.46968838572502136,
0.24482746422290802,
1.9398324489593506,
-0.7667686939239502,
0.9073495864868164,
1.0570815801620483,
-0.7027702331542969,
0.11184503883123398,
0.32686859369277954,
-0.3282639980316162,
0.7790002822875977,
-1.212141513824463,
-0.45656725764274597,
0.9662719964981079,
0.019504353404045105,
-0.5435457825660706,
1.439026951789856,
0.7922056913375854,
-1.0924997329711914,
-0.255426287651062,
-0.05488476902246475,
-0.8365159630775452,
0.04429824650287628,
-1.6403957605361938,
-0.09435681998729706,
0.36852845549583435,
-1.5204956531524658,
-0.520672082901001,
-0.30619966983795166,
1.1053617000579834,
-0.16894057393074036,
1.449000597000122,
-0.33248600363731384,
-0.12077055126428604,
-0.4024658203125,
-0.4306328296661377,
0.028902584686875343,
-0.3652535378932953,
-0.5527934432029724,
0.21421217918395996,
-0.7657608389854431,
0.30679628252983093,
1.4845154285430908,
0.2737617492675781,
0.05507075786590576,
0.34547150135040283,
1.0786222219467163,
0.4417434334754944,
0.21143725514411926,
-0.8282603621482849,
-1.4216673374176025,
2.001316785812378,
-1.6400216817855835,
1.97896409034729,
0.8372073769569397,
0.10715823620557785,
-1.8509061336517334,
-1.8962409496307373,
1.4369205236434937,
1.1241850852966309,
2.342564582824707,
0.6500725150108337,
0.46998539566993713,
-0.7195444703102112,
-0.6453754901885986,
0.2754843533039093,
-1.0210009813308716,
-0.7155759930610657,
0.2578126788139343,
2.471956729888916,
1.6470394134521484,
-0.5214792490005493,
-0.17199569940567017,
-0.726438045501709,
1.41366708278656,
0.02663044072687626,
0.17419280111789703,
2.0852012634277344,
-0.14341290295124054,
-1.1473554372787476,
1.229561448097229,
-2.429577589035034,
0.11797221750020981,
2.026836633682251,
0.33073946833610535,
0.1609681099653244,
-1.3836150169372559,
-0.6281418800354004,
-0.34391096234321594,
-0.5338645577430725,
-1.253321647644043,
0.6753658652305603,
-0.2650602161884308,
-0.8386390209197998,
-1.5096698999404907,
0.07277022302150726,
-1.1515365839004517,
-1.7260724306106567,
0.3418128192424774,
1.9635727405548096,
2.0626156330108643,
-0.7349366545677185,
1.5515421628952026,
-0.46477410197257996,
0.06370186805725098,
1.160245418548584,
1.2401493787765503,
3.013157606124878,
1.9559723138809204,
-1.2183310985565186,
0.6750320196151733,
-0.17713816463947296,
-0.48272407054901123,
1.0716792345046997,
-1.0915265083312988,
1.1454932689666748,
-0.1399167776107788,
-1.2038884162902832,
-1.1128901243209839,
1.024552822113037,
0.3550156354904175,
0.07617446780204773,
-0.5558145046234131,
1.327270746231079,
0.1391824632883072,
1.2307887077331543,
0.5341731309890747,
-0.1452437937259674,
0.48335760831832886,
-0.28818443417549133,
-0.4738817512989044,
1.7171871662139893,
0.18697428703308105,
-1.403245210647583,
-2.6771697998046875,
-0.2849111557006836,
-0.7995128035545349,
0.1759852021932602,
-0.6112654209136963,
-1.1723847389221191,
1.7169674634933472,
0.37367063760757446,
-1.300646185874939,
-0.28371724486351013,
-0.3797154426574707,
-0.6097359657287598,
2.5670199394226074,
-1.522599220275879,
-0.14569053053855896,
-0.8972037434577942,
-0.5274658203125,
1.6276670694351196,
-1.16399085521698,
-0.24738053977489471,
-1.1193861961364746,
-0.4329818785190582,
-1.2882039546966553,
-0.5998615622520447,
0.04517434537410736,
-0.8486844897270203,
0.8810341954231262,
0.17199794948101044,
-1.1709035634994507,
-0.2558881342411041,
-0.9568411111831665,
0.9307446479797363,
-0.004411451518535614,
0.2978185713291168,
1.9085617065429688,
0.43369096517562866,
-0.38061612844467163,
0.7590588927268982,
1.2261155843734741,
0.6379969120025635,
-0.6504539251327515,
0.048221126198768616,
-0.5984328389167786,
0.29778769612312317,
-1.3792881965637207,
0.2372063398361206,
-2.7560176849365234,
0.7453198432922363,
-0.05306008458137512,
-0.0012062229216098785,
-0.0062557402998209,
-1.3259267807006836,
1.3471084833145142,
2.6281445026397705,
-1.0753347873687744,
0.509250283241272,
0.26455456018447876,
1.213883876800537,
-1.4652806520462036,
0.22578002512454987,
-0.42742154002189636,
2.0522332191467285,
0.0634976252913475,
1.2297056913375854,
-0.49968522787094116,
-2.3146586418151855,
0.6550517678260803,
-1.2991814613342285,
-1.169844388961792,
0.8891038298606873,
-0.8532733917236328,
0.12605108320713043,
-1.6003309488296509,
-0.30556127429008484,
-1.1059569120407104,
-1.1736315488815308,
0.702142596244812,
0.1604469120502472,
0.49357786774635315,
-0.6802213191986084,
0.2678016722202301,
-2.3527588844299316,
-1.5775625705718994,
-0.13285784423351288,
-0.976338267326355,
0.4916875660419464,
-0.31461939215660095,
0.7881571054458618,
-0.05842374265193939,
0.09893082827329636,
0.33207783102989197,
1.313600778579712,
3.3900725841522217,
0.13425490260124207,
0.3289279639720917,
-0.2453550100326538,
-0.9432889819145203,
1.3924176692962646,
0.9624536633491516,
-0.09571674466133118,
-0.5251305103302002,
-0.9654964804649353,
1.0446335077285767,
2.0447933673858643,
0.9815633296966553,
-0.11216336488723755,
-0.9068440198898315,
-0.6823462247848511,
0.013829611241817474,
0.3419812023639679,
0.6237654685974121,
0.9773992896080017,
-0.06411025673151016,
0.07526399195194244,
1.5079127550125122,
1.0406867265701294,
-0.5091202855110168,
0.4486495554447174,
-0.8737609386444092,
-0.46648311614990234,
0.48972436785697937,
0.19705016911029816,
0.031112490221858025,
0.4918842017650604,
-1.0256251096725464,
-0.3616351783275604,
-0.36704379320144653,
-0.8895605802536011,
-0.6549792885780334,
-0.4287479519844055,
-0.3269796073436737,
1.5699057579040527,
0.04413481801748276,
-0.5010541677474976,
0.1614539921283722,
-0.6754230856895447,
-0.10202861577272415,
-1.3057773113250732,
0.20541483163833618,
-0.26072943210601807,
0.0065366774797439575,
-0.0023635383695364,
1.9241080284118652,
-0.9698752760887146,
-1.9168039560317993,
0.2004893571138382,
0.403947651386261,
-0.3661003112792969,
0.3881734311580658,
1.6930071115493774,
0.5842180252075195,
1.2753126621246338,
1.3034780025482178,
0.8723704218864441,
-0.7261286973953247,
-1.2361035346984863,
0.5439016222953796,
1.08719801902771,
-1.2915257215499878,
0.7012451887130737,
-0.0630924329161644,
-0.5183945298194885,
0.6135463714599609,
1.4494212865829468,
0.3749685287475586,
-2.180995225906372,
0.8861059546470642,
-0.7711797952651978,
0.8514716625213623,
0.7089487910270691,
0.6530497074127197,
0.3052757978439331,
0.6766644716262817,
-1.118167519569397,
-1.0680818557739258,
-0.8698973059654236,
-0.6775707602500916,
1.7960538864135742,
-0.27029961347579956,
0.43506860733032227,
-0.11611712723970413,
-1.2624850273132324,
-0.1284356713294983,
0.6547434329986572,
0.4356273114681244,
-0.4624168276786804,
0.7512735724449158,
-0.428268164396286,
-1.1904680728912354,
-1.1483370065689087,
-0.5058434009552002,
-0.9808135628700256,
-0.9432345032691956,
0.9743722677230835,
0.7490095496177673,
0.420931339263916,
1.926198959350586,
0.7165632843971252,
0.14710691571235657,
-2.670243263244629,
0.9915008544921875,
0.28491300344467163,
-0.06686930358409882,
0.9719860553741455,
0.37943747639656067,
1.052603840827942,
-0.034848377108573914,
0.5963867902755737,
-2.400886058807373,
2.3612658977508545,
-0.2599206566810608,
0.6600669622421265,
-0.1086355447769165,
-0.20519514381885529,
1.1235383749008179,
0.5166551470756531,
0.4817787706851959,
-0.9962317943572998,
0.5859125256538391,
-0.7333405613899231,
1.1650338172912598,
0.9196140170097351,
-0.8361541032791138,
0.018627917394042015,
1.2779581546783447,
0.4864630103111267,
-0.4330287575721741,
-0.9519603252410889,
-0.7767674326896667,
1.0227484703063965,
1.683639645576477,
-0.07323424518108368,
0.08754280209541321,
0.8934969902038574,
0.6156206727027893,
-1.3229339122772217,
0.055977821350097656,
-0.7545779943466187,
-0.907872200012207,
1.6536048650741577,
2.0839149951934814,
-0.1205463632941246,
0.021734243258833885,
-0.8252241611480713,
-1.3167014122009277,
0.7425965070724487,
-0.17083707451820374,
0.18411923944950104,
0.45829933881759644,
-0.656634509563446,
1.2142598628997803,
0.5997609496116638,
0.986761748790741,
0.11728135496377945,
0.4458767771720886,
0.24338839948177338,
-0.3179394602775574,
-1.0832067728042603,
-0.3249373137950897,
-1.0838896036148071,
-2.2904796600341797,
0.52424156665802,
-0.21073390543460846,
-1.3744832277297974,
-0.02304096892476082,
-0.9917129278182983,
0.9223828315734863,
-0.48330777883529663,
-0.9368158578872681,
-1.5146100521087646,
0.3025817573070526,
-0.09076005220413208,
1.0534881353378296,
-1.5762221813201904,
-0.03417372703552246,
1.1516927480697632,
0.8605188131332397,
-0.7732939124107361,
1.0082519054412842,
0.3876810371875763,
0.9994192123413086,
0.8226906061172485,
-0.36857882142066956,
0.5117658376693726,
0.06349264830350876,
-1.2483450174331665,
0.46806854009628296,
1.2031885385513306,
0.12669433653354645,
1.5066381692886353,
-0.5424774885177612,
-0.011214332655072212,
0.32395392656326294,
-0.4468333125114441,
-0.4209158718585968,
-0.6392322182655334,
0.49837884306907654,
0.25439348816871643,
-1.112237572669983,
-0.10711278021335602,
-0.17153599858283997,
-0.18383373320102692,
0.170433908700943,
-1.5421189069747925,
-0.18722622096538544,
-0.41582077741622925,
-0.44554540514945984,
-1.2355560064315796,
0.06996677070856094,
1.3724253177642822,
-0.6274109482765198,
-0.1869422346353531,
0.3332890272140503,
0.37544775009155273,
0.5870568156242371,
0.7086239457130432,
-0.5479984283447266,
-0.5137966871261597,
-0.23742985725402832,
-0.30978673696517944,
0.2596223056316376,
1.1794403791427612,
-0.1745225340127945,
-1.105182409286499,
0.702405571937561,
-0.5013771653175354,
0.049570463597774506,
1.8833175897598267,
-0.06828796863555908,
-0.7380130887031555,
0.36028555035591125,
-0.6250954270362854,
1.9332237243652344,
1.8173826932907104,
1.2196736335754395,
-0.2901609241962433,
-0.842371940612793,
0.7425133585929871,
-0.33716896176338196,
-0.2693370282649994,
0.8291410803794861,
0.4381887912750244,
-0.22366578876972198,
-1.4877485036849976,
0.4916926324367523,
1.4167733192443848,
-0.9389976859092712,
-0.870064914226532,
0.1323280930519104,
-0.7855961918830872,
1.0304479598999023,
0.7645847797393799,
0.44430482387542725,
0.3458085358142853,
1.5211031436920166,
0.7765263319015503,
-0.6272578239440918,
0.6429024934768677,
0.45383989810943604,
-0.08577540516853333,
-2.1807284355163574,
-1.1870324611663818,
0.4299168884754181,
-0.24187006056308746,
-1.696832299232483,
1.4447414875030518,
-1.1204994916915894,
-0.9449774026870728,
0.6065897941589355,
-0.06010836362838745,
1.230065107345581,
0.32079073786735535,
1.6275465488433838,
1.9664108753204346,
0.8042439818382263,
0.39815935492515564,
1.2853138446807861,
-0.1474265307188034,
-0.513806164264679,
1.8543224334716797,
-0.47428587079048157,
0.4634801745414734,
1.0229524374008179,
-0.3728414475917816,
-0.9823172688484192,
-0.8187183141708374,
-1.3299754858016968,
-0.7629167437553406,
1.1637600660324097,
0.03620796650648117,
-1.3189409971237183,
0.3655114471912384,
1.6347835063934326,
0.06513488292694092,
-0.3514992594718933,
0.6760244965553284,
0.3992891013622284,
-0.8479978442192078,
-0.1642470508813858,
-0.9876759648323059,
0.537920355796814,
-0.145241379737854,
-0.24066293239593506,
0.2359304279088974,
0.4693142771720886,
1.3625298738479614,
-0.01677818037569523,
0.039165399968624115,
1.216313123703003,
-1.4624488353729248,
1.5417484045028687,
-0.5445027351379395,
0.2758335769176483,
-2.3994669914245605,
1.3979970216751099,
-0.6765440106391907,
1.853250503540039,
-2.619835376739502,
0.32321223616600037,
-0.6381409168243408,
-0.4672563970088959,
0.3043384552001953,
-0.205017551779747,
0.2684471011161804,
-0.19107462465763092,
-1.0291002988815308,
-0.0881328210234642,
-0.7291483879089355,
0.5036725401878357,
1.0193406343460083,
1.3601882457733154,
-0.9946949481964111,
-0.2365916222333908,
-1.6586750745773315,
-0.13133998215198517,
-0.5098843574523926,
0.2868131995201111,
-2.0849008560180664,
-0.16860906779766083,
-2.0005064010620117,
-2.2517220973968506,
-1.481083631515503,
-0.8616116046905518,
1.0225462913513184,
0.22008147835731506,
-1.00897216796875,
1.109222412109375,
-0.41303274035453796,
-1.7098373174667358,
1.1003553867340088,
-2.0465312004089355
] |
https://github.com/huggingface/datasets/issues/6108 | Loading local datasets got strangely stuck | Yesterday I waited for more than 12 hours to make sure it was really **stuck** instead of proceeding too slow. | ### Describe the bug
I try to use `load_dataset()` to load several local `.jsonl` files as a dataset. Every line of these files is a json structure only containing one key `text` (yeah it is a dataset for NLP model). The code snippet is as:
```python
ds = load_dataset("json", data_files=LIST_OF_FILE_PATHS, num_proc=16)['train']
```
However, I found that the loading process can get stuck -- the progress bar `Generating train split` no more proceed. When I was trying to find the cause and solution, I found a really strange behavior. If I load the dataset in this way:
```python
dlist = list()
for _ in LIST_OF_FILE_PATHS:
dlist.append(load_dataset("json", data_files=_)['train'])
ds = concatenate_datasets(dlist)
```
I can actually successfully load all the files despite its slow speed. But if I load them in batch like above, things go wrong. I did try to use Control-C to trace the stuck point but the program cannot be terminated in this way when `num_proc` is set to `None`. The only thing I can do is use Control-Z to hang it up then kill it. If I use more than 2 cpus, a Control-C would simply cause the following error:
```bash
^C
Process ForkPoolWorker-1:
Traceback (most recent call last):
File "/usr/local/lib/python3.10/dist-packages/multiprocess/process.py", line 314, in _bootstrap
self.run()
File "/usr/local/lib/python3.10/dist-packages/multiprocess/process.py", line 108, in run
self._target(*self._args, **self._kwargs)
File "/usr/local/lib/python3.10/dist-packages/multiprocess/pool.py", line 114, in worker
task = get()
File "/usr/local/lib/python3.10/dist-packages/multiprocess/queues.py", line 368, in get
res = self._reader.recv_bytes()
File "/usr/local/lib/python3.10/dist-packages/multiprocess/connection.py", line 224, in recv_bytes
buf = self._recv_bytes(maxlength)
File "/usr/local/lib/python3.10/dist-packages/multiprocess/connection.py", line 422, in _recv_bytes
buf = self._recv(4)
File "/usr/local/lib/python3.10/dist-packages/multiprocess/connection.py", line 387, in _recv
chunk = read(handle, remaining)
KeyboardInterrupt
Generating train split: 92431 examples [01:23, 1104.25 examples/s]
Traceback (most recent call last):
File "/usr/local/lib/python3.10/dist-packages/datasets/utils/py_utils.py", line 1373, in iflatmap_unordered
yield queue.get(timeout=0.05)
File "<string>", line 2, in get
File "/usr/local/lib/python3.10/dist-packages/multiprocess/managers.py", line 818, in _callmethod
kind, result = conn.recv()
File "/usr/local/lib/python3.10/dist-packages/multiprocess/connection.py", line 258, in recv
buf = self._recv_bytes()
File "/usr/local/lib/python3.10/dist-packages/multiprocess/connection.py", line 422, in _recv_bytes
buf = self._recv(4)
File "/usr/local/lib/python3.10/dist-packages/multiprocess/connection.py", line 387, in _recv
chunk = read(handle, remaining)
KeyboardInterrupt
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/mnt/data/liyongyuan/source/batch_load.py", line 11, in <module>
a = load_dataset(
File "/usr/local/lib/python3.10/dist-packages/datasets/load.py", line 2133, in load_dataset
builder_instance.download_and_prepare(
File "/usr/local/lib/python3.10/dist-packages/datasets/builder.py", line 954, in download_and_prepare
self._download_and_prepare(
File "/usr/local/lib/python3.10/dist-packages/datasets/builder.py", line 1049, in _download_and_prepare
self._prepare_split(split_generator, **prepare_split_kwargs)
File "/usr/local/lib/python3.10/dist-packages/datasets/builder.py", line 1842, in _prepare_split
for job_id, done, content in iflatmap_unordered(
File "/usr/local/lib/python3.10/dist-packages/datasets/utils/py_utils.py", line 1387, in iflatmap_unordered
[async_result.get(timeout=0.05) for async_result in async_results]
File "/usr/local/lib/python3.10/dist-packages/datasets/utils/py_utils.py", line 1387, in <listcomp>
[async_result.get(timeout=0.05) for async_result in async_results]
File "/usr/local/lib/python3.10/dist-packages/multiprocess/pool.py", line 770, in get
raise TimeoutError
multiprocess.context.TimeoutError
```
I have validated the basic correctness of these `.jsonl` files. They are correctly formatted (or they cannot be loaded singly by `load_dataset`) though some of the json may contain too long text (more than 1e7 characters). I do not know if this could be the problem. And there should not be any bottleneck in system's resource. The whole dataset is ~300GB, and I am using a cloud server with plenty of storage and 1TB ram.
Thanks for your efforts and patience! Any suggestion or help would be appreciated.
### Steps to reproduce the bug
1. use load_dataset() with `data_files = LIST_OF_FILES`
### Expected behavior
All the files should be smoothly loaded.
### Environment info
- Datasets: A private dataset. ~2500 `.jsonl` files. ~300GB in total. Each json structure only contains one key: `text`. Format checked.
- `datasets` version: 2.14.2
- Platform: Linux-4.19.91-014.kangaroo.alios7.x86_64-x86_64-with-glibc2.35
- Python version: 3.10.6
- Huggingface_hub version: 0.15.1
- PyArrow version: 10.0.1.dev0+ga6eabc2b.d20230609
- Pandas version: 1.5.2 | 36 | 20 | Loading local datasets got strangely stuck
### Describe the bug
I try to use `load_dataset()` to load several local `.jsonl` files as a dataset. Every line of these files is a json structure only containing one key `text` (yeah it is a dataset for NLP model). The code snippet is as:
```python
ds = load_dataset("json", data_files=LIST_OF_FILE_PATHS, num_proc=16)['train']
```
However, I found that the loading process can get stuck -- the progress bar `Generating train split` no more proceed. When I was trying to find the cause and solution, I found a really strange behavior. If I load the dataset in this way:
```python
dlist = list()
for _ in LIST_OF_FILE_PATHS:
dlist.append(load_dataset("json", data_files=_)['train'])
ds = concatenate_datasets(dlist)
```
I can actually successfully load all the files despite its slow speed. But if I load them in batch like above, things go wrong. I did try to use Control-C to trace the stuck point but the program cannot be terminated in this way when `num_proc` is set to `None`. The only thing I can do is use Control-Z to hang it up then kill it. If I use more than 2 cpus, a Control-C would simply cause the following error:
```bash
^C
Process ForkPoolWorker-1:
Traceback (most recent call last):
File "/usr/local/lib/python3.10/dist-packages/multiprocess/process.py", line 314, in _bootstrap
self.run()
File "/usr/local/lib/python3.10/dist-packages/multiprocess/process.py", line 108, in run
self._target(*self._args, **self._kwargs)
File "/usr/local/lib/python3.10/dist-packages/multiprocess/pool.py", line 114, in worker
task = get()
File "/usr/local/lib/python3.10/dist-packages/multiprocess/queues.py", line 368, in get
res = self._reader.recv_bytes()
File "/usr/local/lib/python3.10/dist-packages/multiprocess/connection.py", line 224, in recv_bytes
buf = self._recv_bytes(maxlength)
File "/usr/local/lib/python3.10/dist-packages/multiprocess/connection.py", line 422, in _recv_bytes
buf = self._recv(4)
File "/usr/local/lib/python3.10/dist-packages/multiprocess/connection.py", line 387, in _recv
chunk = read(handle, remaining)
KeyboardInterrupt
Generating train split: 92431 examples [01:23, 1104.25 examples/s]
Traceback (most recent call last):
File "/usr/local/lib/python3.10/dist-packages/datasets/utils/py_utils.py", line 1373, in iflatmap_unordered
yield queue.get(timeout=0.05)
File "<string>", line 2, in get
File "/usr/local/lib/python3.10/dist-packages/multiprocess/managers.py", line 818, in _callmethod
kind, result = conn.recv()
File "/usr/local/lib/python3.10/dist-packages/multiprocess/connection.py", line 258, in recv
buf = self._recv_bytes()
File "/usr/local/lib/python3.10/dist-packages/multiprocess/connection.py", line 422, in _recv_bytes
buf = self._recv(4)
File "/usr/local/lib/python3.10/dist-packages/multiprocess/connection.py", line 387, in _recv
chunk = read(handle, remaining)
KeyboardInterrupt
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/mnt/data/liyongyuan/source/batch_load.py", line 11, in <module>
a = load_dataset(
File "/usr/local/lib/python3.10/dist-packages/datasets/load.py", line 2133, in load_dataset
builder_instance.download_and_prepare(
File "/usr/local/lib/python3.10/dist-packages/datasets/builder.py", line 954, in download_and_prepare
self._download_and_prepare(
File "/usr/local/lib/python3.10/dist-packages/datasets/builder.py", line 1049, in _download_and_prepare
self._prepare_split(split_generator, **prepare_split_kwargs)
File "/usr/local/lib/python3.10/dist-packages/datasets/builder.py", line 1842, in _prepare_split
for job_id, done, content in iflatmap_unordered(
File "/usr/local/lib/python3.10/dist-packages/datasets/utils/py_utils.py", line 1387, in iflatmap_unordered
[async_result.get(timeout=0.05) for async_result in async_results]
File "/usr/local/lib/python3.10/dist-packages/datasets/utils/py_utils.py", line 1387, in <listcomp>
[async_result.get(timeout=0.05) for async_result in async_results]
File "/usr/local/lib/python3.10/dist-packages/multiprocess/pool.py", line 770, in get
raise TimeoutError
multiprocess.context.TimeoutError
```
I have validated the basic correctness of these `.jsonl` files. They are correctly formatted (or they cannot be loaded singly by `load_dataset`) though some of the json may contain too long text (more than 1e7 characters). I do not know if this could be the problem. And there should not be any bottleneck in system's resource. The whole dataset is ~300GB, and I am using a cloud server with plenty of storage and 1TB ram.
Thanks for your efforts and patience! Any suggestion or help would be appreciated.
### Steps to reproduce the bug
1. use load_dataset() with `data_files = LIST_OF_FILES`
### Expected behavior
All the files should be smoothly loaded.
### Environment info
- Datasets: A private dataset. ~2500 `.jsonl` files. ~300GB in total. Each json structure only contains one key: `text`. Format checked.
- `datasets` version: 2.14.2
- Platform: Linux-4.19.91-014.kangaroo.alios7.x86_64-x86_64-with-glibc2.35
- Python version: 3.10.6
- Huggingface_hub version: 0.15.1
- PyArrow version: 10.0.1.dev0+ga6eabc2b.d20230609
- Pandas version: 1.5.2
Yesterday I waited for more than 12 hours to make sure it was really **stuck** instead of proceeding too slow. | [
-1.1857736110687256,
-0.9407454133033752,
-0.7441576719284058,
1.4746325016021729,
-0.11657063663005829,
-1.2399708032608032,
0.11755771934986115,
-1.0479322671890259,
1.7225706577301025,
-0.7684071063995361,
0.38269880414009094,
-1.6014268398284912,
0.03821048140525818,
-0.6209810972213745,
-0.7727939486503601,
-0.8944603800773621,
-0.4088424742221832,
-0.8194125294685364,
1.0283896923065186,
2.462496757507324,
1.2099568843841553,
-1.403232216835022,
2.7265608310699463,
0.6924651861190796,
-0.2164050042629242,
-1.0413557291030884,
0.5166077613830566,
-0.010159664787352085,
-1.1726576089859009,
-0.4255408048629761,
-0.9635022878646851,
-0.10558275878429413,
-0.6585036516189575,
-0.5079758167266846,
0.05268178880214691,
0.4019443094730377,
-0.24002186954021454,
-0.3776376247406006,
-0.57227623462677,
-0.7602928280830383,
0.5162822604179382,
-0.3317278325557709,
0.972929060459137,
-0.28395286202430725,
1.8031069040298462,
-0.6038073301315308,
0.46886107325553894,
0.7760091423988342,
1.354609489440918,
0.2248118817806244,
-0.0016446355730295181,
0.3432528078556061,
0.3676868677139282,
0.04271122068166733,
0.5380293726921082,
1.1995790004730225,
0.6081677675247192,
0.5152134895324707,
0.7276692390441895,
-2.184246063232422,
1.2898826599121094,
-1.0188233852386475,
0.3503153324127197,
1.2698777914047241,
-0.9048412442207336,
0.3893762230873108,
-1.8603965044021606,
-0.04896062612533569,
0.6037646532058716,
-2.244311571121216,
0.2338779866695404,
-1.3310497999191284,
-0.49006420373916626,
0.9795165061950684,
0.3442109227180481,
-1.3024133443832397,
0.18255537748336792,
-0.42121222615242004,
1.051797866821289,
0.4166954457759857,
1.1190639734268188,
-1.6669014692306519,
-0.009774336591362953,
-0.3293585479259491,
0.1635141670703888,
-1.2263544797897339,
-1.5070654153823853,
0.5729089975357056,
0.6171499490737915,
0.5612480640411377,
-0.13687685132026672,
1.0765891075134277,
-1.0261775255203247,
0.8335713744163513,
-0.9632993936538696,
-1.7179174423217773,
-1.4542927742004395,
-2.2724311351776123,
-2.305119037628174,
0.8332210779190063,
-0.48154833912849426,
-0.4861609935760498,
2.066084861755371,
-0.9672607183456421,
-1.760550856590271,
1.1019209623336792,
0.2541908919811249,
0.0005201064050197601,
2.344029188156128,
0.1405647099018097,
-0.7619856595993042,
0.4461615979671478,
-0.719220757484436,
0.8046331405639648,
-0.3599391579627991,
1.3694673776626587,
0.4728565514087677,
-1.0297503471374512,
1.5947773456573486,
-0.4017045795917511,
0.5501520037651062,
-0.6440993547439575,
-0.5337281823158264,
-0.7929158806800842,
0.33021658658981323,
1.9039069414138794,
-0.30433639883995056,
1.5482233762741089,
-0.34435856342315674,
-1.5470677614212036,
-1.564254879951477,
0.888276219367981,
0.48914024233818054,
-0.8056665658950806,
0.10974583774805069,
-0.39614608883857727,
0.15515007078647614,
-0.05539649724960327,
1.18917715549469,
1.2156568765640259,
0.746762752532959,
-0.36024799942970276,
-0.8663837909698486,
0.1407097578048706,
-0.06023271381855011,
-0.7152811884880066,
-1.8659703731536865,
-0.3546149730682373,
0.1788507103919983,
0.6218679547309875,
-1.193255066871643,
1.7748363018035889,
0.92495197057724,
1.9225759506225586,
1.0170502662658691,
-0.3195354640483856,
1.516502857208252,
-0.03558150306344032,
1.8763700723648071,
-0.4583948850631714,
0.5885534286499023,
-0.360810786485672,
-1.196715235710144,
0.8377751708030701,
-0.29318201541900635,
-2.038484573364258,
-0.7103738784790039,
-0.834315299987793,
-0.17930953204631805,
-0.7523581385612488,
0.8580973744392395,
-0.3118514120578766,
-1.4367921352386475,
0.17469334602355957,
-0.6502706408500671,
0.114289291203022,
-1.2390071153640747,
0.29432353377342224,
0.6449299454689026,
-0.7074230909347534,
0.07158519327640533,
-0.3197842836380005,
-1.2106208801269531,
-0.549460768699646,
0.2689276933670044,
1.8636901378631592,
-0.7478760480880737,
0.9734770655632019,
1.032645583152771,
-0.6845254302024841,
-0.028486648574471474,
0.3420042097568512,
-0.29361337423324585,
0.8849694728851318,
-1.0835940837860107,
-0.4671410620212555,
1.1719520092010498,
-0.16941338777542114,
-0.6102598905563354,
1.4208518266677856,
0.7856005430221558,
-1.054190993309021,
-0.24877195060253143,
-0.2335503250360489,
-0.8555761575698853,
0.04584003984928131,
-1.586504340171814,
-0.11513541638851166,
0.4020754098892212,
-1.5483136177062988,
-0.38727813959121704,
-0.20324184000492096,
1.27974271774292,
-0.22253526747226715,
1.4569973945617676,
-0.33041122555732727,
-0.24466556310653687,
-0.32929882407188416,
-0.4515054523944855,
0.16523446142673492,
-0.11603590846061707,
-0.6699464917182922,
0.16696299612522125,
-0.7458930611610413,
0.3739664554595947,
1.4462465047836304,
0.3052820861339569,
0.036311499774456024,
0.5148871541023254,
1.1212682723999023,
0.3424697816371918,
0.044216401875019073,
-0.9726801514625549,
-1.5047413110733032,
2.0229122638702393,
-1.439529299736023,
1.9469588994979858,
0.7661038637161255,
-0.06159823387861252,
-1.8067489862442017,
-1.8054803609848022,
1.3576617240905762,
1.1666648387908936,
2.3743810653686523,
0.5515940189361572,
0.38672754168510437,
-0.8191073536872864,
-0.6778033971786499,
0.3580164611339569,
-1.0762383937835693,
-0.7609761357307434,
0.12679025530815125,
2.3991148471832275,
1.8205279111862183,
-0.502000093460083,
-0.2354866862297058,
-1.0072424411773682,
1.381729006767273,
-0.22363805770874023,
0.2667018473148346,
2.015361785888672,
-0.2953281104564667,
-1.0586005449295044,
1.2469573020935059,
-2.3405649662017822,
0.18798625469207764,
2.040473699569702,
0.2513265609741211,
0.1753658950328827,
-1.4550968408584595,
-0.6100200414657593,
-0.19842049479484558,
-0.4470710754394531,
-1.256653904914856,
0.5058630108833313,
-0.27943867444992065,
-0.7859964966773987,
-1.4496008157730103,
0.15890000760555267,
-1.1547420024871826,
-1.689998745918274,
0.2607925534248352,
1.9289904832839966,
2.0340874195098877,
-0.7462478876113892,
1.5081462860107422,
-0.3079971373081207,
0.18657687306404114,
1.286574363708496,
1.286323070526123,
3.098590850830078,
1.9048638343811035,
-1.2199252843856812,
0.6274429559707642,
-0.21113325655460358,
-0.49390748143196106,
1.138333797454834,
-1.1720070838928223,
1.1568132638931274,
-0.1872391402721405,
-1.1009259223937988,
-1.19161057472229,
1.007169485092163,
0.47824111580848694,
0.02073085308074951,
-0.5081774592399597,
1.2130450010299683,
0.09992562979459763,
1.3254599571228027,
0.5691626071929932,
-0.3873027265071869,
0.6314074993133545,
-0.3668352961540222,
-0.4965443015098572,
1.613722324371338,
0.1891213208436966,
-1.384263277053833,
-2.328956127166748,
-0.18701601028442383,
-0.9365720152854919,
0.045867085456848145,
-0.580862283706665,
-0.958073616027832,
1.6262056827545166,
0.34906628727912903,
-1.2879420518875122,
-0.2250802218914032,
-0.3236059546470642,
-0.6110820174217224,
2.636465072631836,
-1.3133381605148315,
-0.21953465044498444,
-0.9799793362617493,
-0.6194500923156738,
1.666200041770935,
-1.160622477531433,
-0.24824216961860657,
-1.0042481422424316,
-0.5782238841056824,
-1.3139687776565552,
-0.504253089427948,
0.006970008835196495,
-0.9177166819572449,
0.8342537879943848,
0.17317669093608856,
-1.152393102645874,
-0.3344455063343048,
-0.8396942615509033,
0.9102033972740173,
-0.10824748873710632,
0.16855069994926453,
1.856787085533142,
0.35888707637786865,
-0.39788252115249634,
0.7186763882637024,
1.1461787223815918,
0.6140767931938171,
-0.5669205784797668,
0.20943814516067505,
-0.6787242889404297,
0.28269535303115845,
-1.2839521169662476,
0.3277348577976227,
-2.8885583877563477,
0.7232061624526978,
-0.09950622171163559,
-0.08384138345718384,
-0.08552236109972,
-1.3513370752334595,
1.0464576482772827,
2.6293892860412598,
-1.1441740989685059,
0.47064316272735596,
0.32985731959342957,
1.160235047340393,
-1.6788133382797241,
0.2724669575691223,
-0.4323078393936157,
2.1404330730438232,
0.15187376737594604,
1.2186286449432373,
-0.40442413091659546,
-2.308438539505005,
0.5948107242584229,
-1.2602182626724243,
-1.1369141340255737,
0.7923150658607483,
-0.7879585027694702,
0.13558050990104675,
-1.4016728401184082,
-0.21533024311065674,
-0.9284399747848511,
-1.179283618927002,
0.7575048208236694,
0.1545705497264862,
0.4516685903072357,
-0.6421931982040405,
0.32089704275131226,
-2.166081190109253,
-1.3812161684036255,
-0.20191077888011932,
-0.935924232006073,
0.48065775632858276,
-0.3313238322734833,
0.6799854040145874,
-0.1405913531780243,
0.048482559621334076,
0.33047324419021606,
1.4958500862121582,
3.4104464054107666,
0.15938714146614075,
0.31089693307876587,
-0.19146916270256042,
-0.893835186958313,
1.4162228107452393,
0.88791823387146,
-0.14496727287769318,
-0.5868193507194519,
-1.0717086791992188,
1.253820776939392,
2.0058417320251465,
1.0297530889511108,
0.10569362342357635,
-0.7883124351501465,
-0.722813069820404,
-0.060019999742507935,
0.17492865025997162,
0.4602712392807007,
0.8696073889732361,
0.0407901257276535,
0.09817802906036377,
1.3810077905654907,
1.1756192445755005,
-0.41315758228302,
0.3348855674266815,
-0.8387416005134583,
-0.42695140838623047,
0.4968971610069275,
0.2145848572254181,
-0.009452552534639835,
0.3268333077430725,
-1.0249592065811157,
-0.2579589784145355,
-0.3388806879520416,
-0.9548298120498657,
-0.7445858120918274,
-0.4307718276977539,
-0.3861316740512848,
1.6309629678726196,
0.07657036930322647,
-0.5334811210632324,
-0.028085755184292793,
-0.6963358521461487,
-0.08608516305685043,
-1.0765913724899292,
0.16933338344097137,
-0.09807632118463516,
-0.1379164606332779,
-0.142483651638031,
1.7149851322174072,
-0.8927140235900879,
-2.033263921737671,
0.2613278925418854,
0.24954141676425934,
-0.34509292244911194,
0.24373771250247955,
1.6935194730758667,
0.48897215723991394,
1.4522329568862915,
1.3573921918869019,
0.9454881548881531,
-0.6484937071800232,
-1.262046456336975,
0.6607219576835632,
0.980215311050415,
-1.4375168085098267,
0.7953000068664551,
-0.020188678056001663,
-0.45730048418045044,
0.6360543966293335,
1.311997890472412,
0.45368754863739014,
-2.05928635597229,
0.8549001812934875,
-0.941453754901886,
0.7588342428207397,
0.6597298383712769,
0.6531943082809448,
0.20979832112789154,
0.8596407771110535,
-1.1750915050506592,
-1.1869553327560425,
-0.6938489675521851,
-0.6629811525344849,
1.99611496925354,
-0.20582151412963867,
0.6047783493995667,
-0.166952446103096,
-1.2926483154296875,
-0.16168172657489777,
0.7285361886024475,
0.40200361609458923,
-0.44407919049263,
0.7771522402763367,
-0.6781615018844604,
-1.0751254558563232,
-1.4056015014648438,
-0.45740246772766113,
-1.0413670539855957,
-0.8711357712745667,
1.0231027603149414,
0.7878109216690063,
0.3527986705303192,
1.924103021621704,
0.6656416058540344,
0.2717441916465759,
-2.5978899002075195,
0.868948757648468,
0.3302416503429413,
-0.08382503688335419,
0.8692384362220764,
0.29761430621147156,
1.0661942958831787,
-0.0428975373506546,
0.5640226006507874,
-2.350654125213623,
2.2765297889709473,
-0.18213337659835815,
0.6861506700515747,
0.032333776354789734,
-0.2379818707704544,
1.1013121604919434,
0.5840322375297546,
0.576834499835968,
-1.1082333326339722,
0.6316280961036682,
-0.5855826139450073,
1.1901038885116577,
0.8488075733184814,
-0.7871677875518799,
-0.0008683111518621445,
1.3502707481384277,
0.47497960925102234,
-0.5334844589233398,
-0.9547038078308105,
-0.9876457452774048,
0.945563018321991,
1.6805723905563354,
-0.10287394374608994,
-0.003921165131032467,
0.8386645317077637,
0.6805384159088135,
-1.250244379043579,
0.08274426311254501,
-0.7560269832611084,
-0.761878252029419,
1.6453862190246582,
2.032870054244995,
-0.197617307305336,
-0.18333464860916138,
-0.7866719365119934,
-1.277175784111023,
0.7839676141738892,
-0.04455278813838959,
0.05087999999523163,
0.6562317609786987,
-0.6419892311096191,
1.123640775680542,
0.8160219788551331,
0.9518329501152039,
0.20252229273319244,
0.2989584803581238,
0.3617345988750458,
-0.3324471116065979,
-1.1187938451766968,
-0.24678991734981537,
-1.0892280340194702,
-2.576108455657959,
0.4648890495300293,
-0.21890562772750854,
-1.4016669988632202,
0.009480543434619904,
-0.9739300012588501,
0.8982905149459839,
-0.5727550983428955,
-1.1180434226989746,
-1.472895860671997,
0.2954536974430084,
-0.07155786454677582,
0.9305890202522278,
-1.6270309686660767,
-0.07700309157371521,
1.2112900018692017,
0.9251077771186829,
-0.654590904712677,
0.9605237245559692,
0.22694525122642517,
1.0173345804214478,
0.8269578218460083,
-0.3999858796596527,
0.5398796200752258,
-0.016454163938760757,
-1.3011225461959839,
0.4794811010360718,
1.1388471126556396,
0.13864414393901825,
1.4678304195404053,
-0.5136696100234985,
0.02861284278333187,
0.403213769197464,
-0.5807628035545349,
-0.5130099058151245,
-0.5472197532653809,
0.6829068064689636,
-0.017210179939866066,
-0.9211769104003906,
0.025153568014502525,
-0.06269404292106628,
-0.21011319756507874,
0.24059095978736877,
-1.4828931093215942,
-0.1599954515695572,
-0.35624977946281433,
-0.5556564927101135,
-1.276471734046936,
-0.050106480717659,
1.351976752281189,
-0.7318329811096191,
-0.21917471289634705,
0.48565927147865295,
0.4128744602203369,
0.49645423889160156,
0.5929173827171326,
-0.7269665598869324,
-0.36162298917770386,
-0.24627771973609924,
-0.36984002590179443,
0.28233668208122253,
1.316089391708374,
-0.14444801211357117,
-0.9992629885673523,
0.699063777923584,
-0.38259032368659973,
0.0544123649597168,
1.9495508670806885,
0.12797223031520844,
-0.7993029952049255,
0.3344654142856598,
-0.7151427268981934,
1.8554134368896484,
1.807225227355957,
1.2634577751159668,
-0.13580471277236938,
-0.8974276185035706,
0.6457607746124268,
-0.38154345750808716,
-0.3979913592338562,
0.9249047636985779,
0.3525339365005493,
-0.20610910654067993,
-1.426829218864441,
0.7358364462852478,
1.3347903490066528,
-0.8025565147399902,
-0.8295329213142395,
0.09899698197841644,
-0.8371274471282959,
1.0565483570098877,
0.6693841814994812,
0.38482269644737244,
0.24250520765781403,
1.6328611373901367,
0.7659339308738708,
-0.49272406101226807,
0.56073397397995,
0.5103975534439087,
-0.17157547175884247,
-2.113798141479492,
-1.1865376234054565,
0.2917010486125946,
-0.5235059261322021,
-1.6518900394439697,
1.3959109783172607,
-1.0905125141143799,
-0.981827437877655,
0.612024188041687,
0.058938995003700256,
1.4035661220550537,
0.3737771213054657,
1.610931634902954,
2.113927125930786,
0.8295891284942627,
0.3936780095100403,
1.265575647354126,
-0.11900375038385391,
-0.48769399523735046,
1.8852075338363647,
-0.4626515805721283,
0.48724365234375,
1.056398630142212,
-0.34424537420272827,
-1.0873662233352661,
-0.8167374730110168,
-1.1755986213684082,
-0.6811343431472778,
1.1421849727630615,
0.09619375318288803,
-1.0854218006134033,
0.29008960723876953,
1.6480762958526611,
0.10531748086214066,
-0.28998473286628723,
0.6317206621170044,
0.35889267921447754,
-0.771394670009613,
-0.014612091705203056,
-0.959479570388794,
0.5414214134216309,
-0.20882725715637207,
-0.35919004678726196,
0.3234575688838959,
0.46947768330574036,
1.3138418197631836,
-0.032530803233385086,
0.11772935092449188,
1.1937856674194336,
-1.434771180152893,
1.4975249767303467,
-0.6596755385398865,
0.3768799304962158,
-2.4442501068115234,
1.382062554359436,
-0.8422481417655945,
1.948033332824707,
-2.6141459941864014,
0.3736844062805176,
-0.5740783214569092,
-0.4890991151332855,
0.27379336953163147,
-0.33868926763534546,
0.1370794028043747,
-0.1191677451133728,
-1.1200543642044067,
0.018972571939229965,
-0.7024657130241394,
0.5896080136299133,
1.1115639209747314,
1.3885365724563599,
-1.0890425443649292,
-0.2629130780696869,
-1.751060128211975,
-0.1562928855419159,
-0.641274094581604,
0.3397183120250702,
-2.0135340690612793,
-0.18938960134983063,
-1.9122422933578491,
-2.310183048248291,
-1.3322786092758179,
-0.8734745383262634,
1.0172775983810425,
0.14468906819820404,
-0.9001511335372925,
1.1617234945297241,
-0.3717103898525238,
-1.868216633796692,
1.133630633354187,
-2.1540725231170654
] |
https://github.com/huggingface/datasets/issues/6108 | Loading local datasets got strangely stuck | I've had similar weird issues with `load_dataset` as well. Not multiple files, but dataset is quite big, about 50G. | ### Describe the bug
I try to use `load_dataset()` to load several local `.jsonl` files as a dataset. Every line of these files is a json structure only containing one key `text` (yeah it is a dataset for NLP model). The code snippet is as:
```python
ds = load_dataset("json", data_files=LIST_OF_FILE_PATHS, num_proc=16)['train']
```
However, I found that the loading process can get stuck -- the progress bar `Generating train split` no more proceed. When I was trying to find the cause and solution, I found a really strange behavior. If I load the dataset in this way:
```python
dlist = list()
for _ in LIST_OF_FILE_PATHS:
dlist.append(load_dataset("json", data_files=_)['train'])
ds = concatenate_datasets(dlist)
```
I can actually successfully load all the files despite its slow speed. But if I load them in batch like above, things go wrong. I did try to use Control-C to trace the stuck point but the program cannot be terminated in this way when `num_proc` is set to `None`. The only thing I can do is use Control-Z to hang it up then kill it. If I use more than 2 cpus, a Control-C would simply cause the following error:
```bash
^C
Process ForkPoolWorker-1:
Traceback (most recent call last):
File "/usr/local/lib/python3.10/dist-packages/multiprocess/process.py", line 314, in _bootstrap
self.run()
File "/usr/local/lib/python3.10/dist-packages/multiprocess/process.py", line 108, in run
self._target(*self._args, **self._kwargs)
File "/usr/local/lib/python3.10/dist-packages/multiprocess/pool.py", line 114, in worker
task = get()
File "/usr/local/lib/python3.10/dist-packages/multiprocess/queues.py", line 368, in get
res = self._reader.recv_bytes()
File "/usr/local/lib/python3.10/dist-packages/multiprocess/connection.py", line 224, in recv_bytes
buf = self._recv_bytes(maxlength)
File "/usr/local/lib/python3.10/dist-packages/multiprocess/connection.py", line 422, in _recv_bytes
buf = self._recv(4)
File "/usr/local/lib/python3.10/dist-packages/multiprocess/connection.py", line 387, in _recv
chunk = read(handle, remaining)
KeyboardInterrupt
Generating train split: 92431 examples [01:23, 1104.25 examples/s]
Traceback (most recent call last):
File "/usr/local/lib/python3.10/dist-packages/datasets/utils/py_utils.py", line 1373, in iflatmap_unordered
yield queue.get(timeout=0.05)
File "<string>", line 2, in get
File "/usr/local/lib/python3.10/dist-packages/multiprocess/managers.py", line 818, in _callmethod
kind, result = conn.recv()
File "/usr/local/lib/python3.10/dist-packages/multiprocess/connection.py", line 258, in recv
buf = self._recv_bytes()
File "/usr/local/lib/python3.10/dist-packages/multiprocess/connection.py", line 422, in _recv_bytes
buf = self._recv(4)
File "/usr/local/lib/python3.10/dist-packages/multiprocess/connection.py", line 387, in _recv
chunk = read(handle, remaining)
KeyboardInterrupt
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/mnt/data/liyongyuan/source/batch_load.py", line 11, in <module>
a = load_dataset(
File "/usr/local/lib/python3.10/dist-packages/datasets/load.py", line 2133, in load_dataset
builder_instance.download_and_prepare(
File "/usr/local/lib/python3.10/dist-packages/datasets/builder.py", line 954, in download_and_prepare
self._download_and_prepare(
File "/usr/local/lib/python3.10/dist-packages/datasets/builder.py", line 1049, in _download_and_prepare
self._prepare_split(split_generator, **prepare_split_kwargs)
File "/usr/local/lib/python3.10/dist-packages/datasets/builder.py", line 1842, in _prepare_split
for job_id, done, content in iflatmap_unordered(
File "/usr/local/lib/python3.10/dist-packages/datasets/utils/py_utils.py", line 1387, in iflatmap_unordered
[async_result.get(timeout=0.05) for async_result in async_results]
File "/usr/local/lib/python3.10/dist-packages/datasets/utils/py_utils.py", line 1387, in <listcomp>
[async_result.get(timeout=0.05) for async_result in async_results]
File "/usr/local/lib/python3.10/dist-packages/multiprocess/pool.py", line 770, in get
raise TimeoutError
multiprocess.context.TimeoutError
```
I have validated the basic correctness of these `.jsonl` files. They are correctly formatted (or they cannot be loaded singly by `load_dataset`) though some of the json may contain too long text (more than 1e7 characters). I do not know if this could be the problem. And there should not be any bottleneck in system's resource. The whole dataset is ~300GB, and I am using a cloud server with plenty of storage and 1TB ram.
Thanks for your efforts and patience! Any suggestion or help would be appreciated.
### Steps to reproduce the bug
1. use load_dataset() with `data_files = LIST_OF_FILES`
### Expected behavior
All the files should be smoothly loaded.
### Environment info
- Datasets: A private dataset. ~2500 `.jsonl` files. ~300GB in total. Each json structure only contains one key: `text`. Format checked.
- `datasets` version: 2.14.2
- Platform: Linux-4.19.91-014.kangaroo.alios7.x86_64-x86_64-with-glibc2.35
- Python version: 3.10.6
- Huggingface_hub version: 0.15.1
- PyArrow version: 10.0.1.dev0+ga6eabc2b.d20230609
- Pandas version: 1.5.2 | 36 | 19 | Loading local datasets got strangely stuck
### Describe the bug
I try to use `load_dataset()` to load several local `.jsonl` files as a dataset. Every line of these files is a json structure only containing one key `text` (yeah it is a dataset for NLP model). The code snippet is as:
```python
ds = load_dataset("json", data_files=LIST_OF_FILE_PATHS, num_proc=16)['train']
```
However, I found that the loading process can get stuck -- the progress bar `Generating train split` no more proceed. When I was trying to find the cause and solution, I found a really strange behavior. If I load the dataset in this way:
```python
dlist = list()
for _ in LIST_OF_FILE_PATHS:
dlist.append(load_dataset("json", data_files=_)['train'])
ds = concatenate_datasets(dlist)
```
I can actually successfully load all the files despite its slow speed. But if I load them in batch like above, things go wrong. I did try to use Control-C to trace the stuck point but the program cannot be terminated in this way when `num_proc` is set to `None`. The only thing I can do is use Control-Z to hang it up then kill it. If I use more than 2 cpus, a Control-C would simply cause the following error:
```bash
^C
Process ForkPoolWorker-1:
Traceback (most recent call last):
File "/usr/local/lib/python3.10/dist-packages/multiprocess/process.py", line 314, in _bootstrap
self.run()
File "/usr/local/lib/python3.10/dist-packages/multiprocess/process.py", line 108, in run
self._target(*self._args, **self._kwargs)
File "/usr/local/lib/python3.10/dist-packages/multiprocess/pool.py", line 114, in worker
task = get()
File "/usr/local/lib/python3.10/dist-packages/multiprocess/queues.py", line 368, in get
res = self._reader.recv_bytes()
File "/usr/local/lib/python3.10/dist-packages/multiprocess/connection.py", line 224, in recv_bytes
buf = self._recv_bytes(maxlength)
File "/usr/local/lib/python3.10/dist-packages/multiprocess/connection.py", line 422, in _recv_bytes
buf = self._recv(4)
File "/usr/local/lib/python3.10/dist-packages/multiprocess/connection.py", line 387, in _recv
chunk = read(handle, remaining)
KeyboardInterrupt
Generating train split: 92431 examples [01:23, 1104.25 examples/s]
Traceback (most recent call last):
File "/usr/local/lib/python3.10/dist-packages/datasets/utils/py_utils.py", line 1373, in iflatmap_unordered
yield queue.get(timeout=0.05)
File "<string>", line 2, in get
File "/usr/local/lib/python3.10/dist-packages/multiprocess/managers.py", line 818, in _callmethod
kind, result = conn.recv()
File "/usr/local/lib/python3.10/dist-packages/multiprocess/connection.py", line 258, in recv
buf = self._recv_bytes()
File "/usr/local/lib/python3.10/dist-packages/multiprocess/connection.py", line 422, in _recv_bytes
buf = self._recv(4)
File "/usr/local/lib/python3.10/dist-packages/multiprocess/connection.py", line 387, in _recv
chunk = read(handle, remaining)
KeyboardInterrupt
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/mnt/data/liyongyuan/source/batch_load.py", line 11, in <module>
a = load_dataset(
File "/usr/local/lib/python3.10/dist-packages/datasets/load.py", line 2133, in load_dataset
builder_instance.download_and_prepare(
File "/usr/local/lib/python3.10/dist-packages/datasets/builder.py", line 954, in download_and_prepare
self._download_and_prepare(
File "/usr/local/lib/python3.10/dist-packages/datasets/builder.py", line 1049, in _download_and_prepare
self._prepare_split(split_generator, **prepare_split_kwargs)
File "/usr/local/lib/python3.10/dist-packages/datasets/builder.py", line 1842, in _prepare_split
for job_id, done, content in iflatmap_unordered(
File "/usr/local/lib/python3.10/dist-packages/datasets/utils/py_utils.py", line 1387, in iflatmap_unordered
[async_result.get(timeout=0.05) for async_result in async_results]
File "/usr/local/lib/python3.10/dist-packages/datasets/utils/py_utils.py", line 1387, in <listcomp>
[async_result.get(timeout=0.05) for async_result in async_results]
File "/usr/local/lib/python3.10/dist-packages/multiprocess/pool.py", line 770, in get
raise TimeoutError
multiprocess.context.TimeoutError
```
I have validated the basic correctness of these `.jsonl` files. They are correctly formatted (or they cannot be loaded singly by `load_dataset`) though some of the json may contain too long text (more than 1e7 characters). I do not know if this could be the problem. And there should not be any bottleneck in system's resource. The whole dataset is ~300GB, and I am using a cloud server with plenty of storage and 1TB ram.
Thanks for your efforts and patience! Any suggestion or help would be appreciated.
### Steps to reproduce the bug
1. use load_dataset() with `data_files = LIST_OF_FILES`
### Expected behavior
All the files should be smoothly loaded.
### Environment info
- Datasets: A private dataset. ~2500 `.jsonl` files. ~300GB in total. Each json structure only contains one key: `text`. Format checked.
- `datasets` version: 2.14.2
- Platform: Linux-4.19.91-014.kangaroo.alios7.x86_64-x86_64-with-glibc2.35
- Python version: 3.10.6
- Huggingface_hub version: 0.15.1
- PyArrow version: 10.0.1.dev0+ga6eabc2b.d20230609
- Pandas version: 1.5.2
I've had similar weird issues with `load_dataset` as well. Not multiple files, but dataset is quite big, about 50G. | [
-1.1857736110687256,
-0.9407454133033752,
-0.7441576719284058,
1.4746325016021729,
-0.11657063663005829,
-1.2399708032608032,
0.11755771934986115,
-1.0479322671890259,
1.7225706577301025,
-0.7684071063995361,
0.38269880414009094,
-1.6014268398284912,
0.03821048140525818,
-0.6209810972213745,
-0.7727939486503601,
-0.8944603800773621,
-0.4088424742221832,
-0.8194125294685364,
1.0283896923065186,
2.462496757507324,
1.2099568843841553,
-1.403232216835022,
2.7265608310699463,
0.6924651861190796,
-0.2164050042629242,
-1.0413557291030884,
0.5166077613830566,
-0.010159664787352085,
-1.1726576089859009,
-0.4255408048629761,
-0.9635022878646851,
-0.10558275878429413,
-0.6585036516189575,
-0.5079758167266846,
0.05268178880214691,
0.4019443094730377,
-0.24002186954021454,
-0.3776376247406006,
-0.57227623462677,
-0.7602928280830383,
0.5162822604179382,
-0.3317278325557709,
0.972929060459137,
-0.28395286202430725,
1.8031069040298462,
-0.6038073301315308,
0.46886107325553894,
0.7760091423988342,
1.354609489440918,
0.2248118817806244,
-0.0016446355730295181,
0.3432528078556061,
0.3676868677139282,
0.04271122068166733,
0.5380293726921082,
1.1995790004730225,
0.6081677675247192,
0.5152134895324707,
0.7276692390441895,
-2.184246063232422,
1.2898826599121094,
-1.0188233852386475,
0.3503153324127197,
1.2698777914047241,
-0.9048412442207336,
0.3893762230873108,
-1.8603965044021606,
-0.04896062612533569,
0.6037646532058716,
-2.244311571121216,
0.2338779866695404,
-1.3310497999191284,
-0.49006420373916626,
0.9795165061950684,
0.3442109227180481,
-1.3024133443832397,
0.18255537748336792,
-0.42121222615242004,
1.051797866821289,
0.4166954457759857,
1.1190639734268188,
-1.6669014692306519,
-0.009774336591362953,
-0.3293585479259491,
0.1635141670703888,
-1.2263544797897339,
-1.5070654153823853,
0.5729089975357056,
0.6171499490737915,
0.5612480640411377,
-0.13687685132026672,
1.0765891075134277,
-1.0261775255203247,
0.8335713744163513,
-0.9632993936538696,
-1.7179174423217773,
-1.4542927742004395,
-2.2724311351776123,
-2.305119037628174,
0.8332210779190063,
-0.48154833912849426,
-0.4861609935760498,
2.066084861755371,
-0.9672607183456421,
-1.760550856590271,
1.1019209623336792,
0.2541908919811249,
0.0005201064050197601,
2.344029188156128,
0.1405647099018097,
-0.7619856595993042,
0.4461615979671478,
-0.719220757484436,
0.8046331405639648,
-0.3599391579627991,
1.3694673776626587,
0.4728565514087677,
-1.0297503471374512,
1.5947773456573486,
-0.4017045795917511,
0.5501520037651062,
-0.6440993547439575,
-0.5337281823158264,
-0.7929158806800842,
0.33021658658981323,
1.9039069414138794,
-0.30433639883995056,
1.5482233762741089,
-0.34435856342315674,
-1.5470677614212036,
-1.564254879951477,
0.888276219367981,
0.48914024233818054,
-0.8056665658950806,
0.10974583774805069,
-0.39614608883857727,
0.15515007078647614,
-0.05539649724960327,
1.18917715549469,
1.2156568765640259,
0.746762752532959,
-0.36024799942970276,
-0.8663837909698486,
0.1407097578048706,
-0.06023271381855011,
-0.7152811884880066,
-1.8659703731536865,
-0.3546149730682373,
0.1788507103919983,
0.6218679547309875,
-1.193255066871643,
1.7748363018035889,
0.92495197057724,
1.9225759506225586,
1.0170502662658691,
-0.3195354640483856,
1.516502857208252,
-0.03558150306344032,
1.8763700723648071,
-0.4583948850631714,
0.5885534286499023,
-0.360810786485672,
-1.196715235710144,
0.8377751708030701,
-0.29318201541900635,
-2.038484573364258,
-0.7103738784790039,
-0.834315299987793,
-0.17930953204631805,
-0.7523581385612488,
0.8580973744392395,
-0.3118514120578766,
-1.4367921352386475,
0.17469334602355957,
-0.6502706408500671,
0.114289291203022,
-1.2390071153640747,
0.29432353377342224,
0.6449299454689026,
-0.7074230909347534,
0.07158519327640533,
-0.3197842836380005,
-1.2106208801269531,
-0.549460768699646,
0.2689276933670044,
1.8636901378631592,
-0.7478760480880737,
0.9734770655632019,
1.032645583152771,
-0.6845254302024841,
-0.028486648574471474,
0.3420042097568512,
-0.29361337423324585,
0.8849694728851318,
-1.0835940837860107,
-0.4671410620212555,
1.1719520092010498,
-0.16941338777542114,
-0.6102598905563354,
1.4208518266677856,
0.7856005430221558,
-1.054190993309021,
-0.24877195060253143,
-0.2335503250360489,
-0.8555761575698853,
0.04584003984928131,
-1.586504340171814,
-0.11513541638851166,
0.4020754098892212,
-1.5483136177062988,
-0.38727813959121704,
-0.20324184000492096,
1.27974271774292,
-0.22253526747226715,
1.4569973945617676,
-0.33041122555732727,
-0.24466556310653687,
-0.32929882407188416,
-0.4515054523944855,
0.16523446142673492,
-0.11603590846061707,
-0.6699464917182922,
0.16696299612522125,
-0.7458930611610413,
0.3739664554595947,
1.4462465047836304,
0.3052820861339569,
0.036311499774456024,
0.5148871541023254,
1.1212682723999023,
0.3424697816371918,
0.044216401875019073,
-0.9726801514625549,
-1.5047413110733032,
2.0229122638702393,
-1.439529299736023,
1.9469588994979858,
0.7661038637161255,
-0.06159823387861252,
-1.8067489862442017,
-1.8054803609848022,
1.3576617240905762,
1.1666648387908936,
2.3743810653686523,
0.5515940189361572,
0.38672754168510437,
-0.8191073536872864,
-0.6778033971786499,
0.3580164611339569,
-1.0762383937835693,
-0.7609761357307434,
0.12679025530815125,
2.3991148471832275,
1.8205279111862183,
-0.502000093460083,
-0.2354866862297058,
-1.0072424411773682,
1.381729006767273,
-0.22363805770874023,
0.2667018473148346,
2.015361785888672,
-0.2953281104564667,
-1.0586005449295044,
1.2469573020935059,
-2.3405649662017822,
0.18798625469207764,
2.040473699569702,
0.2513265609741211,
0.1753658950328827,
-1.4550968408584595,
-0.6100200414657593,
-0.19842049479484558,
-0.4470710754394531,
-1.256653904914856,
0.5058630108833313,
-0.27943867444992065,
-0.7859964966773987,
-1.4496008157730103,
0.15890000760555267,
-1.1547420024871826,
-1.689998745918274,
0.2607925534248352,
1.9289904832839966,
2.0340874195098877,
-0.7462478876113892,
1.5081462860107422,
-0.3079971373081207,
0.18657687306404114,
1.286574363708496,
1.286323070526123,
3.098590850830078,
1.9048638343811035,
-1.2199252843856812,
0.6274429559707642,
-0.21113325655460358,
-0.49390748143196106,
1.138333797454834,
-1.1720070838928223,
1.1568132638931274,
-0.1872391402721405,
-1.1009259223937988,
-1.19161057472229,
1.007169485092163,
0.47824111580848694,
0.02073085308074951,
-0.5081774592399597,
1.2130450010299683,
0.09992562979459763,
1.3254599571228027,
0.5691626071929932,
-0.3873027265071869,
0.6314074993133545,
-0.3668352961540222,
-0.4965443015098572,
1.613722324371338,
0.1891213208436966,
-1.384263277053833,
-2.328956127166748,
-0.18701601028442383,
-0.9365720152854919,
0.045867085456848145,
-0.580862283706665,
-0.958073616027832,
1.6262056827545166,
0.34906628727912903,
-1.2879420518875122,
-0.2250802218914032,
-0.3236059546470642,
-0.6110820174217224,
2.636465072631836,
-1.3133381605148315,
-0.21953465044498444,
-0.9799793362617493,
-0.6194500923156738,
1.666200041770935,
-1.160622477531433,
-0.24824216961860657,
-1.0042481422424316,
-0.5782238841056824,
-1.3139687776565552,
-0.504253089427948,
0.006970008835196495,
-0.9177166819572449,
0.8342537879943848,
0.17317669093608856,
-1.152393102645874,
-0.3344455063343048,
-0.8396942615509033,
0.9102033972740173,
-0.10824748873710632,
0.16855069994926453,
1.856787085533142,
0.35888707637786865,
-0.39788252115249634,
0.7186763882637024,
1.1461787223815918,
0.6140767931938171,
-0.5669205784797668,
0.20943814516067505,
-0.6787242889404297,
0.28269535303115845,
-1.2839521169662476,
0.3277348577976227,
-2.8885583877563477,
0.7232061624526978,
-0.09950622171163559,
-0.08384138345718384,
-0.08552236109972,
-1.3513370752334595,
1.0464576482772827,
2.6293892860412598,
-1.1441740989685059,
0.47064316272735596,
0.32985731959342957,
1.160235047340393,
-1.6788133382797241,
0.2724669575691223,
-0.4323078393936157,
2.1404330730438232,
0.15187376737594604,
1.2186286449432373,
-0.40442413091659546,
-2.308438539505005,
0.5948107242584229,
-1.2602182626724243,
-1.1369141340255737,
0.7923150658607483,
-0.7879585027694702,
0.13558050990104675,
-1.4016728401184082,
-0.21533024311065674,
-0.9284399747848511,
-1.179283618927002,
0.7575048208236694,
0.1545705497264862,
0.4516685903072357,
-0.6421931982040405,
0.32089704275131226,
-2.166081190109253,
-1.3812161684036255,
-0.20191077888011932,
-0.935924232006073,
0.48065775632858276,
-0.3313238322734833,
0.6799854040145874,
-0.1405913531780243,
0.048482559621334076,
0.33047324419021606,
1.4958500862121582,
3.4104464054107666,
0.15938714146614075,
0.31089693307876587,
-0.19146916270256042,
-0.893835186958313,
1.4162228107452393,
0.88791823387146,
-0.14496727287769318,
-0.5868193507194519,
-1.0717086791992188,
1.253820776939392,
2.0058417320251465,
1.0297530889511108,
0.10569362342357635,
-0.7883124351501465,
-0.722813069820404,
-0.060019999742507935,
0.17492865025997162,
0.4602712392807007,
0.8696073889732361,
0.0407901257276535,
0.09817802906036377,
1.3810077905654907,
1.1756192445755005,
-0.41315758228302,
0.3348855674266815,
-0.8387416005134583,
-0.42695140838623047,
0.4968971610069275,
0.2145848572254181,
-0.009452552534639835,
0.3268333077430725,
-1.0249592065811157,
-0.2579589784145355,
-0.3388806879520416,
-0.9548298120498657,
-0.7445858120918274,
-0.4307718276977539,
-0.3861316740512848,
1.6309629678726196,
0.07657036930322647,
-0.5334811210632324,
-0.028085755184292793,
-0.6963358521461487,
-0.08608516305685043,
-1.0765913724899292,
0.16933338344097137,
-0.09807632118463516,
-0.1379164606332779,
-0.142483651638031,
1.7149851322174072,
-0.8927140235900879,
-2.033263921737671,
0.2613278925418854,
0.24954141676425934,
-0.34509292244911194,
0.24373771250247955,
1.6935194730758667,
0.48897215723991394,
1.4522329568862915,
1.3573921918869019,
0.9454881548881531,
-0.6484937071800232,
-1.262046456336975,
0.6607219576835632,
0.980215311050415,
-1.4375168085098267,
0.7953000068664551,
-0.020188678056001663,
-0.45730048418045044,
0.6360543966293335,
1.311997890472412,
0.45368754863739014,
-2.05928635597229,
0.8549001812934875,
-0.941453754901886,
0.7588342428207397,
0.6597298383712769,
0.6531943082809448,
0.20979832112789154,
0.8596407771110535,
-1.1750915050506592,
-1.1869553327560425,
-0.6938489675521851,
-0.6629811525344849,
1.99611496925354,
-0.20582151412963867,
0.6047783493995667,
-0.166952446103096,
-1.2926483154296875,
-0.16168172657489777,
0.7285361886024475,
0.40200361609458923,
-0.44407919049263,
0.7771522402763367,
-0.6781615018844604,
-1.0751254558563232,
-1.4056015014648438,
-0.45740246772766113,
-1.0413670539855957,
-0.8711357712745667,
1.0231027603149414,
0.7878109216690063,
0.3527986705303192,
1.924103021621704,
0.6656416058540344,
0.2717441916465759,
-2.5978899002075195,
0.868948757648468,
0.3302416503429413,
-0.08382503688335419,
0.8692384362220764,
0.29761430621147156,
1.0661942958831787,
-0.0428975373506546,
0.5640226006507874,
-2.350654125213623,
2.2765297889709473,
-0.18213337659835815,
0.6861506700515747,
0.032333776354789734,
-0.2379818707704544,
1.1013121604919434,
0.5840322375297546,
0.576834499835968,
-1.1082333326339722,
0.6316280961036682,
-0.5855826139450073,
1.1901038885116577,
0.8488075733184814,
-0.7871677875518799,
-0.0008683111518621445,
1.3502707481384277,
0.47497960925102234,
-0.5334844589233398,
-0.9547038078308105,
-0.9876457452774048,
0.945563018321991,
1.6805723905563354,
-0.10287394374608994,
-0.003921165131032467,
0.8386645317077637,
0.6805384159088135,
-1.250244379043579,
0.08274426311254501,
-0.7560269832611084,
-0.761878252029419,
1.6453862190246582,
2.032870054244995,
-0.197617307305336,
-0.18333464860916138,
-0.7866719365119934,
-1.277175784111023,
0.7839676141738892,
-0.04455278813838959,
0.05087999999523163,
0.6562317609786987,
-0.6419892311096191,
1.123640775680542,
0.8160219788551331,
0.9518329501152039,
0.20252229273319244,
0.2989584803581238,
0.3617345988750458,
-0.3324471116065979,
-1.1187938451766968,
-0.24678991734981537,
-1.0892280340194702,
-2.576108455657959,
0.4648890495300293,
-0.21890562772750854,
-1.4016669988632202,
0.009480543434619904,
-0.9739300012588501,
0.8982905149459839,
-0.5727550983428955,
-1.1180434226989746,
-1.472895860671997,
0.2954536974430084,
-0.07155786454677582,
0.9305890202522278,
-1.6270309686660767,
-0.07700309157371521,
1.2112900018692017,
0.9251077771186829,
-0.654590904712677,
0.9605237245559692,
0.22694525122642517,
1.0173345804214478,
0.8269578218460083,
-0.3999858796596527,
0.5398796200752258,
-0.016454163938760757,
-1.3011225461959839,
0.4794811010360718,
1.1388471126556396,
0.13864414393901825,
1.4678304195404053,
-0.5136696100234985,
0.02861284278333187,
0.403213769197464,
-0.5807628035545349,
-0.5130099058151245,
-0.5472197532653809,
0.6829068064689636,
-0.017210179939866066,
-0.9211769104003906,
0.025153568014502525,
-0.06269404292106628,
-0.21011319756507874,
0.24059095978736877,
-1.4828931093215942,
-0.1599954515695572,
-0.35624977946281433,
-0.5556564927101135,
-1.276471734046936,
-0.050106480717659,
1.351976752281189,
-0.7318329811096191,
-0.21917471289634705,
0.48565927147865295,
0.4128744602203369,
0.49645423889160156,
0.5929173827171326,
-0.7269665598869324,
-0.36162298917770386,
-0.24627771973609924,
-0.36984002590179443,
0.28233668208122253,
1.316089391708374,
-0.14444801211357117,
-0.9992629885673523,
0.699063777923584,
-0.38259032368659973,
0.0544123649597168,
1.9495508670806885,
0.12797223031520844,
-0.7993029952049255,
0.3344654142856598,
-0.7151427268981934,
1.8554134368896484,
1.807225227355957,
1.2634577751159668,
-0.13580471277236938,
-0.8974276185035706,
0.6457607746124268,
-0.38154345750808716,
-0.3979913592338562,
0.9249047636985779,
0.3525339365005493,
-0.20610910654067993,
-1.426829218864441,
0.7358364462852478,
1.3347903490066528,
-0.8025565147399902,
-0.8295329213142395,
0.09899698197841644,
-0.8371274471282959,
1.0565483570098877,
0.6693841814994812,
0.38482269644737244,
0.24250520765781403,
1.6328611373901367,
0.7659339308738708,
-0.49272406101226807,
0.56073397397995,
0.5103975534439087,
-0.17157547175884247,
-2.113798141479492,
-1.1865376234054565,
0.2917010486125946,
-0.5235059261322021,
-1.6518900394439697,
1.3959109783172607,
-1.0905125141143799,
-0.981827437877655,
0.612024188041687,
0.058938995003700256,
1.4035661220550537,
0.3737771213054657,
1.610931634902954,
2.113927125930786,
0.8295891284942627,
0.3936780095100403,
1.265575647354126,
-0.11900375038385391,
-0.48769399523735046,
1.8852075338363647,
-0.4626515805721283,
0.48724365234375,
1.056398630142212,
-0.34424537420272827,
-1.0873662233352661,
-0.8167374730110168,
-1.1755986213684082,
-0.6811343431472778,
1.1421849727630615,
0.09619375318288803,
-1.0854218006134033,
0.29008960723876953,
1.6480762958526611,
0.10531748086214066,
-0.28998473286628723,
0.6317206621170044,
0.35889267921447754,
-0.771394670009613,
-0.014612091705203056,
-0.959479570388794,
0.5414214134216309,
-0.20882725715637207,
-0.35919004678726196,
0.3234575688838959,
0.46947768330574036,
1.3138418197631836,
-0.032530803233385086,
0.11772935092449188,
1.1937856674194336,
-1.434771180152893,
1.4975249767303467,
-0.6596755385398865,
0.3768799304962158,
-2.4442501068115234,
1.382062554359436,
-0.8422481417655945,
1.948033332824707,
-2.6141459941864014,
0.3736844062805176,
-0.5740783214569092,
-0.4890991151332855,
0.27379336953163147,
-0.33868926763534546,
0.1370794028043747,
-0.1191677451133728,
-1.1200543642044067,
0.018972571939229965,
-0.7024657130241394,
0.5896080136299133,
1.1115639209747314,
1.3885365724563599,
-1.0890425443649292,
-0.2629130780696869,
-1.751060128211975,
-0.1562928855419159,
-0.641274094581604,
0.3397183120250702,
-2.0135340690612793,
-0.18938960134983063,
-1.9122422933578491,
-2.310183048248291,
-1.3322786092758179,
-0.8734745383262634,
1.0172775983810425,
0.14468906819820404,
-0.9001511335372925,
1.1617234945297241,
-0.3717103898525238,
-1.868216633796692,
1.133630633354187,
-2.1540725231170654
] |
https://github.com/huggingface/datasets/issues/6099 | How do i get "amazon_us_reviews | Seems like the problem isn't with the library, but the dataset itself hosted on AWS S3.
Its [homepage](https://s3.amazonaws.com/amazon-reviews-pds/readme.html) returns an `AccessDenied` XML response, which is the same thing you get if you try to log the `record` that triggers the exception
```python
try:
example = self.info.features.encode_example(record) if self.info.features is not None else record
except Exception as e:
print(record)
```
β¬οΈ
```
{'<?xml version="1.0" encoding="UTF-8"?>': '<Error><Code>AccessDenied</Code><Message>Access Denied</Message><RequestId>N2HFJ82ZV8SZW9BV</RequestId><HostId>Zw2DQ0V2GdRmvH5qWEpumK4uj5+W8YPcilQbN9fLBr3VqQOcKPHOhUZLG3LcM9X5fkOetxp48Os=</HostId></Error>'}
``` | ### Feature request
I have been trying to load 'amazon_us_dataset" but unable to do so.
`amazon_us_reviews = load_dataset('amazon_us_reviews')`
`print(amazon_us_reviews)`
> [ValueError: Config name is missing.
Please pick one among the available configs: ['Wireless_v1_00', 'Watches_v1_00', 'Video_Games_v1_00', 'Video_DVD_v1_00', 'Video_v1_00', 'Toys_v1_00', 'Tools_v1_00', 'Sports_v1_00', 'Software_v1_00', 'Shoes_v1_00', 'Pet_Products_v1_00', 'Personal_Care_Appliances_v1_00', 'PC_v1_00', 'Outdoors_v1_00', 'Office_Products_v1_00', 'Musical_Instruments_v1_00', 'Music_v1_00', 'Mobile_Electronics_v1_00', 'Mobile_Apps_v1_00', 'Major_Appliances_v1_00', 'Luggage_v1_00', 'Lawn_and_Garden_v1_00', 'Kitchen_v1_00', 'Jewelry_v1_00', 'Home_Improvement_v1_00', 'Home_Entertainment_v1_00', 'Home_v1_00', 'Health_Personal_Care_v1_00', 'Grocery_v1_00', 'Gift_Card_v1_00', 'Furniture_v1_00', 'Electronics_v1_00', 'Digital_Video_Games_v1_00', 'Digital_Video_Download_v1_00', 'Digital_Software_v1_00', 'Digital_Music_Purchase_v1_00', 'Digital_Ebook_Purchase_v1_00', 'Camera_v1_00', 'Books_v1_00', 'Beauty_v1_00', 'Baby_v1_00', 'Automotive_v1_00', 'Apparel_v1_00', 'Digital_Ebook_Purchase_v1_01', 'Books_v1_01', 'Books_v1_02']
Example of usage:
`load_dataset('amazon_us_reviews', 'Wireless_v1_00')`]
__________________________________________________________________________
`amazon_us_reviews = load_dataset('amazon_us_reviews', 'Watches_v1_00')
print(amazon_us_reviews)`
**ERROR**
`Generating` train split: 0%
0/960872 [00:00<?, ? examples/s]
---------------------------------------------------------------------------
KeyError Traceback (most recent call last)
/usr/local/lib/python3.10/dist-packages/datasets/builder.py in _prepare_split_single(self, gen_kwargs, fpath, file_format, max_shard_size, split_info, check_duplicate_keys, job_id)
1692 )
-> 1693 example = self.info.features.encode_example(record) if self.info.features is not None else record
1694 writer.write(example, key)
11 frames
KeyError: 'marketplace'
The above exception was the direct cause of the following exception:
DatasetGenerationError Traceback (most recent call last)
/usr/local/lib/python3.10/dist-packages/datasets/builder.py in _prepare_split_single(self, gen_kwargs, fpath, file_format, max_shard_size, split_info, check_duplicate_keys, job_id)
1710 if isinstance(e, SchemaInferenceError) and e.__context__ is not None:
1711 e = e.__context__
-> 1712 raise DatasetGenerationError("An error occurred while generating the dataset") from e
1713
1714 yield job_id, True, (total_num_examples, total_num_bytes, writer._features, num_shards, shard_lengths)
DatasetGenerationError: An error occurred while generating the dataset
### Motivation
The dataset I'm using
https://huggingface.co/datasets/amazon_us_reviews
### Your contribution
What is the best way to load this data | 39 | 67 | How do i get "amazon_us_reviews
### Feature request
I have been trying to load 'amazon_us_dataset" but unable to do so.
`amazon_us_reviews = load_dataset('amazon_us_reviews')`
`print(amazon_us_reviews)`
> [ValueError: Config name is missing.
Please pick one among the available configs: ['Wireless_v1_00', 'Watches_v1_00', 'Video_Games_v1_00', 'Video_DVD_v1_00', 'Video_v1_00', 'Toys_v1_00', 'Tools_v1_00', 'Sports_v1_00', 'Software_v1_00', 'Shoes_v1_00', 'Pet_Products_v1_00', 'Personal_Care_Appliances_v1_00', 'PC_v1_00', 'Outdoors_v1_00', 'Office_Products_v1_00', 'Musical_Instruments_v1_00', 'Music_v1_00', 'Mobile_Electronics_v1_00', 'Mobile_Apps_v1_00', 'Major_Appliances_v1_00', 'Luggage_v1_00', 'Lawn_and_Garden_v1_00', 'Kitchen_v1_00', 'Jewelry_v1_00', 'Home_Improvement_v1_00', 'Home_Entertainment_v1_00', 'Home_v1_00', 'Health_Personal_Care_v1_00', 'Grocery_v1_00', 'Gift_Card_v1_00', 'Furniture_v1_00', 'Electronics_v1_00', 'Digital_Video_Games_v1_00', 'Digital_Video_Download_v1_00', 'Digital_Software_v1_00', 'Digital_Music_Purchase_v1_00', 'Digital_Ebook_Purchase_v1_00', 'Camera_v1_00', 'Books_v1_00', 'Beauty_v1_00', 'Baby_v1_00', 'Automotive_v1_00', 'Apparel_v1_00', 'Digital_Ebook_Purchase_v1_01', 'Books_v1_01', 'Books_v1_02']
Example of usage:
`load_dataset('amazon_us_reviews', 'Wireless_v1_00')`]
__________________________________________________________________________
`amazon_us_reviews = load_dataset('amazon_us_reviews', 'Watches_v1_00')
print(amazon_us_reviews)`
**ERROR**
`Generating` train split: 0%
0/960872 [00:00<?, ? examples/s]
---------------------------------------------------------------------------
KeyError Traceback (most recent call last)
/usr/local/lib/python3.10/dist-packages/datasets/builder.py in _prepare_split_single(self, gen_kwargs, fpath, file_format, max_shard_size, split_info, check_duplicate_keys, job_id)
1692 )
-> 1693 example = self.info.features.encode_example(record) if self.info.features is not None else record
1694 writer.write(example, key)
11 frames
KeyError: 'marketplace'
The above exception was the direct cause of the following exception:
DatasetGenerationError Traceback (most recent call last)
/usr/local/lib/python3.10/dist-packages/datasets/builder.py in _prepare_split_single(self, gen_kwargs, fpath, file_format, max_shard_size, split_info, check_duplicate_keys, job_id)
1710 if isinstance(e, SchemaInferenceError) and e.__context__ is not None:
1711 e = e.__context__
-> 1712 raise DatasetGenerationError("An error occurred while generating the dataset") from e
1713
1714 yield job_id, True, (total_num_examples, total_num_bytes, writer._features, num_shards, shard_lengths)
DatasetGenerationError: An error occurred while generating the dataset
### Motivation
The dataset I'm using
https://huggingface.co/datasets/amazon_us_reviews
### Your contribution
What is the best way to load this data
Seems like the problem isn't with the library, but the dataset itself hosted on AWS S3.
Its [homepage](https://s3.amazonaws.com/amazon-reviews-pds/readme.html) returns an `AccessDenied` XML response, which is the same thing you get if you try to log the `record` that triggers the exception
```python
try:
example = self.info.features.encode_example(record) if self.info.features is not None else record
except Exception as e:
print(record)
```
β¬οΈ
```
{'<?xml version="1.0" encoding="UTF-8"?>': '<Error><Code>AccessDenied</Code><Message>Access Denied</Message><RequestId>N2HFJ82ZV8SZW9BV</RequestId><HostId>Zw2DQ0V2GdRmvH5qWEpumK4uj5+W8YPcilQbN9fLBr3VqQOcKPHOhUZLG3LcM9X5fkOetxp48Os=</HostId></Error>'}
``` | [
-1.210225224494934,
-1.2076855897903442,
-0.5899178385734558,
1.6656270027160645,
0.004276080057024956,
-1.407726764678955,
0.13049446046352386,
-1.0258605480194092,
1.3568669557571411,
-0.8192351460456848,
0.10499061644077301,
-1.3370153903961182,
-0.003387860022485256,
-0.7357089519500732,
-0.5535927414894104,
-0.645135760307312,
-0.1984367072582245,
-0.8439528346061707,
1.4069613218307495,
2.210432291030884,
1.0771844387054443,
-1.2784123420715332,
2.874554395675659,
0.7134087681770325,
-0.0638667643070221,
-1.1538865566253662,
0.4330454468727112,
-0.2653447985649109,
-0.9392576217651367,
-0.5149978995323181,
-0.850578248500824,
-0.09525898844003677,
-0.7634775638580322,
-0.09788039326667786,
-0.15268194675445557,
0.6361565589904785,
-0.4678264856338501,
-0.44046521186828613,
-0.6344451308250427,
-0.7170416116714478,
0.4539276361465454,
-0.33075350522994995,
0.9608746767044067,
-0.23293602466583252,
1.681182622909546,
-0.47491174936294556,
0.2851182818412781,
0.784346878528595,
1.278829574584961,
0.1633814126253128,
0.14690861105918884,
0.38026928901672363,
0.22397121787071228,
-0.03365974500775337,
0.6068795919418335,
1.001813530921936,
0.5345300436019897,
0.23699675500392914,
0.7897163033485413,
-2.433513641357422,
1.290249228477478,
-1.1158027648925781,
0.1610543578863144,
1.3842651844024658,
-0.5954002737998962,
0.3272398114204407,
-1.5675562620162964,
0.04536373168230057,
0.7079699039459229,
-1.9616398811340332,
0.5900647044181824,
-1.1617034673690796,
-0.4066806435585022,
0.5939295887947083,
0.5372082591056824,
-1.1958670616149902,
-0.10249854624271393,
-0.4080660343170166,
1.128000259399414,
0.5118468999862671,
0.4748923182487488,
-1.699906826019287,
0.054819270968437195,
0.033914122730493546,
0.3473580479621887,
-1.2458455562591553,
-1.705798625946045,
0.5336384773254395,
0.42615222930908203,
0.9004007577896118,
-0.06082773581147194,
1.1512850522994995,
-1.3419617414474487,
0.6575153470039368,
-1.2884385585784912,
-1.5539414882659912,
-1.262231469154358,
-2.63409686088562,
-2.2260830402374268,
0.5782156586647034,
-0.4969367980957031,
-0.6304066181182861,
2.0096817016601562,
-0.8032044768333435,
-1.5205976963043213,
1.2951574325561523,
0.16630414128303528,
0.12891386449337006,
2.5492637157440186,
0.14445346593856812,
-0.874646782875061,
0.6491203308105469,
-0.9307577610015869,
0.8942434787750244,
-0.27523595094680786,
1.3601065874099731,
0.5195751190185547,
-0.7659162878990173,
1.4580668210983276,
-0.5078427791595459,
0.624810516834259,
-0.34090447425842285,
-0.5396624207496643,
-0.9580057859420776,
0.24867521226406097,
1.6368212699890137,
0.12380026280879974,
1.3170899152755737,
-0.4155381917953491,
-1.4781368970870972,
-1.5445414781570435,
1.2362614870071411,
0.06426393240690231,
-1.168350338935852,
0.14447782933712006,
-0.6529622673988342,
0.3697661757469177,
-0.29447436332702637,
1.4101039171218872,
1.471571922302246,
0.38914722204208374,
-0.6313988566398621,
-0.7663823366165161,
-0.12903627753257751,
-0.42137467861175537,
-0.7936902046203613,
-1.8142924308776855,
-0.08673470467329025,
0.040670957416296005,
0.6674957871437073,
-0.9456651210784912,
1.8394280672073364,
0.8803703784942627,
2.0485520362854004,
0.845221757888794,
-0.3151698112487793,
1.2785146236419678,
0.00005810242146253586,
1.720511555671692,
-0.727744996547699,
0.3888530731201172,
-0.4364479184150696,
-0.9577677845954895,
0.9937989711761475,
-0.2541348338127136,
-1.790514349937439,
-0.8596090078353882,
-0.6773314476013184,
-0.3794596791267395,
-0.717743456363678,
0.5647395253181458,
-0.4480542540550232,
-1.5472736358642578,
0.2019083946943283,
-0.7155848741531372,
0.4135091304779053,
-1.0086767673492432,
0.2829146385192871,
0.535873532295227,
-0.6549561619758606,
0.13142725825309753,
-0.02421613782644272,
-1.3086822032928467,
-0.589641809463501,
0.88921058177948,
1.8333200216293335,
-0.3410009741783142,
0.427082359790802,
1.0636069774627686,
-0.45642268657684326,
0.06618424504995346,
0.0847572386264801,
-0.15333279967308044,
0.3910595178604126,
-0.9766692519187927,
-0.8112574219703674,
1.399424433708191,
-0.4253351092338562,
-0.8040767908096313,
1.4840502738952637,
0.8294554352760315,
-1.1904504299163818,
-0.08783432841300964,
-0.2914966940879822,
-0.952640950679779,
0.19159404933452606,
-1.6431506872177124,
-0.12051217257976532,
0.8109571933746338,
-1.4818313121795654,
-0.17697036266326904,
-0.28869760036468506,
1.1779723167419434,
0.003311261534690857,
1.2718478441238403,
-0.6217518448829651,
0.041214991360902786,
0.035499658435583115,
-0.6562933921813965,
0.37938326597213745,
-0.21529383957386017,
-0.32851701974868774,
-0.3954307436943054,
-0.8601893782615662,
0.5059376955032349,
1.4699455499649048,
-0.04866672307252884,
0.07238081097602844,
0.21858654916286469,
1.2743110656738281,
0.29731273651123047,
0.30780118703842163,
-0.7257699370384216,
-1.314125657081604,
1.889410138130188,
-1.582964539527893,
2.0784246921539307,
0.4990677833557129,
-0.02205764874815941,
-1.837114691734314,
-1.6086084842681885,
1.201932668685913,
1.0154391527175903,
1.839293122291565,
0.39368391036987305,
0.27081531286239624,
-0.9781020879745483,
-0.8647156357765198,
0.0026127807796001434,
-0.7459132671356201,
-0.4674784541130066,
0.1477011740207672,
2.4664461612701416,
1.845963716506958,
-0.3466310501098633,
-0.1747690588235855,
-0.6480832695960999,
1.657706379890442,
-0.4793803095817566,
0.4831036925315857,
2.1193933486938477,
-0.25760677456855774,
-0.7761260271072388,
1.6101703643798828,
-2.6984970569610596,
0.4672843813896179,
2.372407913208008,
0.2649036645889282,
0.4158872365951538,
-1.1040525436401367,
-0.6779287457466125,
-0.6785708069801331,
-0.1327590048313141,
-1.316164255142212,
0.5729241967201233,
-0.4916074872016907,
-0.7749151587486267,
-1.3347010612487793,
0.4333084225654602,
-1.0847443342208862,
-1.5833227634429932,
0.3183261752128601,
2.103281021118164,
2.4041569232940674,
-0.6306108236312866,
1.5512393712997437,
-0.007784207817167044,
0.20612473785877228,
1.2300636768341064,
1.3499733209609985,
2.845396041870117,
1.7266435623168945,
-1.1758760213851929,
0.4977846145629883,
-0.42966365814208984,
-0.7066797018051147,
1.0213794708251953,
-1.1420575380325317,
1.1663846969604492,
-0.05476696789264679,
-1.2194428443908691,
-1.334078073501587,
1.1617594957351685,
0.5064898133277893,
-0.0215921588242054,
-0.4666362404823303,
1.2061923742294312,
-0.07301675528287888,
1.2218153476715088,
0.7493334412574768,
-0.43469029664993286,
0.2239176481962204,
-0.3820257782936096,
-0.9302724003791809,
1.4656208753585815,
0.24327035248279572,
-1.6889475584030151,
-2.0539350509643555,
-0.38808900117874146,
-0.7484136819839478,
0.11090066283941269,
-0.5279773473739624,
-1.1371877193450928,
1.4302864074707031,
0.1062920093536377,
-1.0905733108520508,
-0.19754262268543243,
-0.175728440284729,
-0.2696554660797119,
2.7831785678863525,
-0.9073716998100281,
-0.2467544674873352,
-0.9142609238624573,
-0.7358637452125549,
1.7873032093048096,
-1.318844199180603,
-0.2890281081199646,
-1.3964159488677979,
-0.35565823316574097,
-1.0720001459121704,
-0.3030719757080078,
0.08364307880401611,
-0.9669814109802246,
1.0273404121398926,
0.48243510723114014,
-1.1686762571334839,
-0.3992760181427002,
-1.1077864170074463,
1.2440744638442993,
-0.2313564419746399,
0.1320086419582367,
1.426996111869812,
-0.09177441149950027,
-0.4927833676338196,
1.0818347930908203,
1.1259385347366333,
0.5235150456428528,
-0.6695930361747742,
-0.1684689223766327,
-0.13044239580631256,
0.5572344660758972,
-1.0423877239227295,
0.459705114364624,
-3.0644073486328125,
0.6658030152320862,
-0.08722704648971558,
-0.34145885705947876,
-0.15602488815784454,
-1.7850298881530762,
1.2232521772384644,
2.292124032974243,
-1.3759785890579224,
0.8795415759086609,
0.28657811880111694,
1.236118197441101,
-1.7205818891525269,
0.4713534712791443,
-0.4212278723716736,
1.97178053855896,
0.010953184217214584,
1.3331756591796875,
-0.5974486470222473,
-2.785918712615967,
0.6235342621803284,
-1.135292887687683,
-0.9101631045341492,
0.6342471241950989,
-1.1590989828109741,
0.5013990998268127,
-1.60431969165802,
-0.5858711004257202,
-1.1055039167404175,
-1.2915143966674805,
0.47223347425460815,
0.32373547554016113,
0.30443984270095825,
-0.44573307037353516,
0.1576235592365265,
-2.4738998413085938,
-1.6853656768798828,
0.028064537793397903,
-0.9745598435401917,
0.9441985487937927,
-0.6840437054634094,
0.3939555287361145,
-0.06484653055667877,
0.16767986118793488,
0.12203171849250793,
1.9222233295440674,
3.461688280105591,
-0.038762226700782776,
0.2616981863975525,
-0.14331555366516113,
-0.8668848276138306,
1.289034366607666,
0.7618101835250854,
-0.1277521699666977,
-0.4414854645729065,
-0.9162626266479492,
1.3535770177841187,
2.1725475788116455,
0.5025514960289001,
-0.20749692618846893,
-0.669009268283844,
-0.37805110216140747,
-0.14053131639957428,
0.34876757860183716,
0.7273016571998596,
0.8370339870452881,
0.1294945627450943,
-0.1535031795501709,
1.1980621814727783,
1.021328091621399,
-0.43237918615341187,
0.33095699548721313,
-0.9550994634628296,
-0.22235724329948425,
0.5584542155265808,
-0.09988810867071152,
-0.31367379426956177,
0.6109278798103333,
-0.8184192776679993,
-0.2740359306335449,
-0.38542044162750244,
-0.5391601324081421,
-0.7834737300872803,
-0.30326974391937256,
-0.5900498032569885,
1.357992172241211,
0.5978986620903015,
-0.7652480602264404,
0.23053386807441711,
-0.36358755826950073,
-0.24375613033771515,
-1.1285080909729004,
-0.04514545947313309,
-0.22764725983142853,
-0.3169388175010681,
-0.43946605920791626,
1.6149792671203613,
-0.9094502925872803,
-1.9904204607009888,
-0.19490422308444977,
0.514474093914032,
0.1926998347043991,
0.3426697254180908,
1.8582179546356201,
0.1355520635843277,
1.5770585536956787,
1.3802621364593506,
0.8927075862884521,
-0.8777205944061279,
-1.273087501525879,
0.6913639307022095,
0.8971491456031799,
-1.3372564315795898,
0.7733129858970642,
-0.22003789246082306,
-0.4611368179321289,
0.7624301910400391,
1.3862580060958862,
0.42917704582214355,
-1.9775104522705078,
1.0535575151443481,
-1.450316309928894,
1.2817925214767456,
0.9948550462722778,
0.47844433784484863,
0.49309593439102173,
0.9611654877662659,
-1.010849952697754,
-1.006635069847107,
-0.8791612982749939,
-1.1208795309066772,
1.973947525024414,
-0.730656623840332,
0.6304389238357544,
0.19190426170825958,
-1.1622687578201294,
0.07389011979103088,
0.7545357942581177,
0.7704148292541504,
-0.32005566358566284,
0.6891259551048279,
-0.8924314975738525,
-1.0763399600982666,
-1.1235287189483643,
-0.4449293613433838,
-1.2491129636764526,
-1.074207067489624,
0.7771356105804443,
0.7565221190452576,
0.411258339881897,
1.779042363166809,
0.7999269366264343,
0.5987473130226135,
-2.3146960735321045,
1.0212346315383911,
0.14241838455200195,
0.0026575513184070587,
0.5834146738052368,
0.5550764799118042,
1.2536181211471558,
0.22779113054275513,
0.5620061159133911,
-2.252286434173584,
2.234640121459961,
-0.16716912388801575,
0.7293847799301147,
-0.3336590528488159,
-0.17689232528209686,
1.0469987392425537,
0.5857565999031067,
0.367010235786438,
-0.9330582618713379,
0.6918842792510986,
-0.344753623008728,
1.2816226482391357,
0.9383744597434998,
-0.8651370406150818,
0.09119991213083267,
1.5379867553710938,
0.13376307487487793,
-1.0344265699386597,
-1.2139235734939575,
-0.871809184551239,
0.6158676743507385,
1.128057837486267,
-0.18427661061286926,
-0.2781570553779602,
0.6295852065086365,
0.6280599236488342,
-1.0339771509170532,
0.10141491889953613,
-0.38715219497680664,
-0.6377065777778625,
1.7574594020843506,
2.0886964797973633,
-0.559212327003479,
0.28490257263183594,
-0.5996301770210266,
-1.3925811052322388,
0.5229480266571045,
-0.13023564219474792,
-0.2075139582157135,
0.17138510942459106,
-0.45400702953338623,
0.7497163414955139,
0.35222554206848145,
0.833016037940979,
-0.016863349825143814,
0.38693875074386597,
0.6733444333076477,
-0.6780864000320435,
-1.0972853899002075,
-0.6176152229309082,
-1.4139716625213623,
-2.480553150177002,
0.18748946487903595,
-0.3185712695121765,
-1.5156983137130737,
0.1472565084695816,
-0.785729169845581,
1.1074588298797607,
-0.6563748717308044,
-1.055670976638794,
-1.1924864053726196,
0.39504653215408325,
0.023491207510232925,
0.8567736148834229,
-1.9032783508300781,
-0.22709371149539948,
1.1499295234680176,
0.6834973692893982,
-0.753402054309845,
1.2836345434188843,
0.3270207643508911,
1.0520933866500854,
0.4434722065925598,
-0.4381895661354065,
0.8627181053161621,
-0.2417100965976715,
-1.3835155963897705,
0.7838159203529358,
1.1783146858215332,
0.05895195156335831,
1.3107820749282837,
0.03911576047539711,
-0.09683475643396378,
0.47304069995880127,
-0.9950792193412781,
-0.346868634223938,
0.0006741201505064964,
0.7155879735946655,
0.027320116758346558,
-0.7075086832046509,
-0.21985284984111786,
0.039648450911045074,
-0.6693775653839111,
0.23051853477954865,
-1.7220393419265747,
-0.3522859215736389,
-0.6524487137794495,
-0.26080596446990967,
-1.5924729108810425,
-0.06879851222038269,
1.3455528020858765,
-0.4729446768760681,
-0.3995169997215271,
0.44383740425109863,
0.5869684815406799,
0.5658378601074219,
0.8592292070388794,
-0.7857706546783447,
0.03455290198326111,
-0.5660000443458557,
-0.0868530124425888,
0.2608341574668884,
1.3288345336914062,
0.021441899240016937,
-1.055073857307434,
0.6635315418243408,
-0.47854989767074585,
0.1002834290266037,
1.6099050045013428,
0.027982216328382492,
-0.8110296130180359,
0.4172441363334656,
-0.9195789098739624,
1.9776335954666138,
1.6497915983200073,
1.0607073307037354,
-0.2595290541648865,
-0.9128652811050415,
0.9755042195320129,
-0.5001735687255859,
-0.12681573629379272,
0.579759418964386,
0.2589576840400696,
-0.388360857963562,
-1.1078588962554932,
1.0721962451934814,
0.9267814755439758,
-0.5810031890869141,
-0.7792497873306274,
0.14326976239681244,
-0.7258784770965576,
1.4030957221984863,
0.4255889654159546,
0.25184357166290283,
0.24630092084407806,
1.8132017850875854,
0.7934964895248413,
-0.512630045413971,
0.6426283121109009,
0.7019808888435364,
-0.45522886514663696,
-2.062368869781494,
-1.1444612741470337,
0.17180216312408447,
-0.5467655062675476,
-1.8001760244369507,
1.4187275171279907,
-0.7825311422348022,
-0.9068099856376648,
0.5307667255401611,
-0.022264765575528145,
0.936246395111084,
0.7461460828781128,
1.3585801124572754,
2.043964147567749,
0.5505794286727905,
0.9709900617599487,
1.2708516120910645,
-0.4369397759437561,
-0.4726090431213379,
1.8671215772628784,
-0.34284472465515137,
0.42558586597442627,
1.3165218830108643,
-0.3364993929862976,
-1.150960922241211,
-0.7881906628608704,
-1.086511492729187,
-0.6455144286155701,
1.1678378582000732,
0.025327980518341064,
-0.9561827778816223,
0.32384294271469116,
1.8534685373306274,
0.09782736748456955,
-0.35398048162460327,
0.7571806907653809,
0.5425701141357422,
-0.7978201508522034,
-0.10394138097763062,
-0.8120983839035034,
0.6300806403160095,
-0.5221537351608276,
-0.2146328091621399,
0.500385582447052,
0.46031898260116577,
1.2767947912216187,
-0.3941080570220947,
0.24107877910137177,
0.7182915210723877,
-1.4341745376586914,
1.2729424238204956,
-0.5982227921485901,
0.25447535514831543,
-2.2237284183502197,
0.9736270308494568,
-0.3546155095100403,
2.233795166015625,
-2.5633704662323,
0.46902984380722046,
-0.7988216876983643,
-0.7058482766151428,
0.3056824803352356,
-0.2925431728363037,
-0.23125946521759033,
0.03898214176297188,
-0.9607555866241455,
0.2775791883468628,
-0.4864264726638794,
0.48410308361053467,
1.1539243459701538,
1.334699034690857,
-0.8269096612930298,
0.039146315306425095,
-1.3482013940811157,
-0.024895060807466507,
-0.9388694763183594,
0.4137986898422241,
-2.0866646766662598,
-0.18059290945529938,
-1.9476525783538818,
-2.095041275024414,
-0.9540354013442993,
-0.8132920861244202,
1.1611050367355347,
0.17695637047290802,
-0.8647010922431946,
1.7262868881225586,
0.017691347748041153,
-1.5221697092056274,
1.1196109056472778,
-1.6851067543029785
] |
https://github.com/huggingface/datasets/issues/6089 | AssertionError: daemonic processes are not allowed to have children | We could add a "threads" parallel backend to `datasets.parallel.parallel_backend` to support downloading with threads but note that `download_and_extract` also decompresses archives, and this is a CPU-intensive task, which is not ideal for (Python) threads (good for IO-intensive tasks). | ### Describe the bug
When I load_dataset with num_proc > 0 in a deamon process, I got an error:
```python
File "/Users/codingl2k1/Work/datasets/src/datasets/download/download_manager.py", line 564, in download_and_extract
return self.extract(self.download(url_or_urls))
^^^^^^^^^^^^^^^^^
File "/Users/codingl2k1/Work/datasets/src/datasets/download/download_manager.py", line 427, in download
downloaded_path_or_paths = map_nested(
^^^^^^^^^^^^^^^^^
File "/Users/codingl2k1/Work/datasets/src/datasets/utils/py_utils.py", line 468, in map_nested
mapped = parallel_map(function, iterable, num_proc, types, disable_tqdm, desc, _single_map_nested)
^^^^^^^^^^^^^^^^^
File "/Users/codingl2k1/Work/datasets/src/datasets/utils/experimental.py", line 40, in _inner_fn
return fn(*args, **kwargs)
^^^^^^^^^^^^^^^^^
File "/Users/codingl2k1/Work/datasets/src/datasets/parallel/parallel.py", line 34, in parallel_map
return _map_with_multiprocessing_pool(
^^^^^^^^^^^^^^^^^
File "/Users/codingl2k1/Work/datasets/src/datasets/parallel/parallel.py", line 64, in _map_with_multiprocessing_pool
with Pool(num_proc, initargs=initargs, initializer=initializer) as pool:
^^^^^^^^^^^^^^^^^
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/multiprocessing/context.py", line 119, in Pool
return Pool(processes, initializer, initargs, maxtasksperchild,
^^^^^^^^^^^^^^^^^
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/multiprocessing/pool.py", line 215, in __init__
self._repopulate_pool()
^^^^^^^^^^^^^^^^^
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/multiprocessing/pool.py", line 306, in _repopulate_pool
return self._repopulate_pool_static(self._ctx, self.Process,
^^^^^^^^^^^^^^^^^
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/multiprocessing/pool.py", line 329, in _repopulate_pool_static
w.start()
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/multiprocessing/process.py", line 118, in start
assert not _current_process._config.get('daemon'), ^^^^^^^^^^^^^^^^^
AssertionError: daemonic processes are not allowed to have children
```
The download is io-intensive computing, may be datasets can replece the multi processing pool by a multi threading pool if in a deamon process.
### Steps to reproduce the bug
1. start a deamon process
2. run load_dataset with num_proc > 0
### Expected behavior
No error.
### Environment info
Python 3.11.4
datasets latest master | 42 | 38 | AssertionError: daemonic processes are not allowed to have children
### Describe the bug
When I load_dataset with num_proc > 0 in a deamon process, I got an error:
```python
File "/Users/codingl2k1/Work/datasets/src/datasets/download/download_manager.py", line 564, in download_and_extract
return self.extract(self.download(url_or_urls))
^^^^^^^^^^^^^^^^^
File "/Users/codingl2k1/Work/datasets/src/datasets/download/download_manager.py", line 427, in download
downloaded_path_or_paths = map_nested(
^^^^^^^^^^^^^^^^^
File "/Users/codingl2k1/Work/datasets/src/datasets/utils/py_utils.py", line 468, in map_nested
mapped = parallel_map(function, iterable, num_proc, types, disable_tqdm, desc, _single_map_nested)
^^^^^^^^^^^^^^^^^
File "/Users/codingl2k1/Work/datasets/src/datasets/utils/experimental.py", line 40, in _inner_fn
return fn(*args, **kwargs)
^^^^^^^^^^^^^^^^^
File "/Users/codingl2k1/Work/datasets/src/datasets/parallel/parallel.py", line 34, in parallel_map
return _map_with_multiprocessing_pool(
^^^^^^^^^^^^^^^^^
File "/Users/codingl2k1/Work/datasets/src/datasets/parallel/parallel.py", line 64, in _map_with_multiprocessing_pool
with Pool(num_proc, initargs=initargs, initializer=initializer) as pool:
^^^^^^^^^^^^^^^^^
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/multiprocessing/context.py", line 119, in Pool
return Pool(processes, initializer, initargs, maxtasksperchild,
^^^^^^^^^^^^^^^^^
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/multiprocessing/pool.py", line 215, in __init__
self._repopulate_pool()
^^^^^^^^^^^^^^^^^
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/multiprocessing/pool.py", line 306, in _repopulate_pool
return self._repopulate_pool_static(self._ctx, self.Process,
^^^^^^^^^^^^^^^^^
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/multiprocessing/pool.py", line 329, in _repopulate_pool_static
w.start()
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/multiprocessing/process.py", line 118, in start
assert not _current_process._config.get('daemon'), ^^^^^^^^^^^^^^^^^
AssertionError: daemonic processes are not allowed to have children
```
The download is io-intensive computing, may be datasets can replece the multi processing pool by a multi threading pool if in a deamon process.
### Steps to reproduce the bug
1. start a deamon process
2. run load_dataset with num_proc > 0
### Expected behavior
No error.
### Environment info
Python 3.11.4
datasets latest master
We could add a "threads" parallel backend to `datasets.parallel.parallel_backend` to support downloading with threads but note that `download_and_extract` also decompresses archives, and this is a CPU-intensive task, which is not ideal for (Python) threads (good for IO-intensive tasks). | [
-1.3304325342178345,
-0.843843400478363,
-0.6240853667259216,
1.2293169498443604,
0.023741507902741432,
-0.9174615740776062,
0.06877093762159348,
-1.0991508960723877,
1.8150602579116821,
-0.6466710567474365,
0.21736067533493042,
-1.551055669784546,
-0.1861899197101593,
-0.48568251729011536,
-0.6399885416030884,
-0.9412006735801697,
-0.28778788447380066,
-0.8252395987510681,
1.0269654989242554,
2.608595609664917,
1.2234467267990112,
-1.412387490272522,
2.707380771636963,
0.8097389936447144,
-0.3603209853172302,
-0.7776699066162109,
0.48141592741012573,
-0.0388236865401268,
-1.0951825380325317,
-0.6576300859451294,
-0.991340160369873,
0.02303980104625225,
-0.6472021341323853,
-0.3529244661331177,
-0.04204221069812775,
0.23380602896213531,
-0.2620423436164856,
-0.1918572634458542,
-0.7916498780250549,
-0.7969321608543396,
0.533761739730835,
-0.3538559079170227,
0.9927069544792175,
-0.4394308030605316,
1.7998770475387573,
-0.5881317853927612,
0.5424193739891052,
0.6860813498497009,
1.152274250984192,
0.05636809021234512,
-0.017423663288354874,
0.511515736579895,
0.3303428590297699,
-0.04301271587610245,
0.7841843962669373,
1.1911066770553589,
0.5725809335708618,
0.4992753565311432,
0.3974270224571228,
-2.302197217941284,
1.3348913192749023,
-1.050580620765686,
0.32438215613365173,
1.479893445968628,
-0.7309799194335938,
0.33590787649154663,
-1.7369120121002197,
0.08000855147838593,
0.7174645066261292,
-2.4402904510498047,
0.25283366441726685,
-1.2671724557876587,
-0.5861356258392334,
1.0325621366500854,
0.4068147540092468,
-1.1362403631210327,
0.08766410499811172,
-0.4590553641319275,
1.1769294738769531,
0.1981641948223114,
1.24491286277771,
-1.5459580421447754,
0.05796533823013306,
-0.14617295563220978,
0.30410197377204895,
-1.2460455894470215,
-1.631604790687561,
0.5121922492980957,
0.48947668075561523,
0.38065025210380554,
-0.1314806193113327,
1.021225929260254,
-0.9869500994682312,
0.56121826171875,
-0.8880736231803894,
-1.5188696384429932,
-1.5767793655395508,
-2.5290467739105225,
-2.3843014240264893,
0.7745110392570496,
-0.6072244644165039,
-0.38829123973846436,
2.145897626876831,
-1.041258692741394,
-1.5384067296981812,
0.9170845746994019,
0.20430254936218262,
0.13918863236904144,
2.285205841064453,
0.14447824656963348,
-0.7653111815452576,
0.44569167494773865,
-0.6788977384567261,
0.8515129685401917,
-0.21523532271385193,
1.4875693321228027,
0.5213677883148193,
-1.0824432373046875,
1.5163935422897339,
-0.567435622215271,
0.5559976696968079,
-0.35646435618400574,
-0.6333647966384888,
-0.8128358721733093,
0.42021554708480835,
1.839524269104004,
-0.2784726321697235,
1.6663795709609985,
-0.5081456303596497,
-1.5520739555358887,
-1.51868736743927,
0.9171946048736572,
0.4682583212852478,
-0.9406428933143616,
0.3041941821575165,
-0.7203582525253296,
0.04868388921022415,
-0.1318347156047821,
1.2593061923980713,
1.3898274898529053,
0.7518086433410645,
-0.28827860951423645,
-0.9010745286941528,
0.22031836211681366,
-0.11386659741401672,
-0.7923910021781921,
-1.8297474384307861,
-0.19696326553821564,
0.13190817832946777,
0.636823296546936,
-1.282250165939331,
1.6906061172485352,
0.9198295474052429,
1.9591645002365112,
0.9109857082366943,
-0.3728978931903839,
1.4761359691619873,
0.10673287510871887,
1.9084452390670776,
-0.5654444098472595,
0.5527309775352478,
-0.19124217331409454,
-1.1289507150650024,
0.7246089577674866,
-0.48534849286079407,
-2.0921213626861572,
-0.7997866868972778,
-0.6997547745704651,
-0.1271107792854309,
-0.8686096668243408,
0.8612416386604309,
-0.13222432136535645,
-1.3321717977523804,
0.11240497976541519,
-0.6415571570396423,
0.5206073522567749,
-1.2524265050888062,
0.13361425697803497,
0.6456899642944336,
-0.5201185345649719,
0.05386587977409363,
-0.29504573345184326,
-1.2281746864318848,
-0.4946044087409973,
0.23472467064857483,
1.8169169425964355,
-0.37691420316696167,
0.7533099055290222,
1.255135178565979,
-0.6906502842903137,
0.004110601730644703,
0.2567013204097748,
-0.35352984070777893,
0.8443289399147034,
-1.137229561805725,
-0.47272056341171265,
1.1565377712249756,
-0.2311088740825653,
-0.5889450907707214,
1.3273029327392578,
0.7584171295166016,
-1.426361322402954,
-0.2743675708770752,
-0.1860629767179489,
-0.7890440821647644,
0.10923869162797928,
-1.546199917793274,
-0.1389160007238388,
0.4691152572631836,
-1.6086301803588867,
-0.4089195728302002,
-0.22541208565235138,
1.3070464134216309,
-0.33431512117385864,
1.4996371269226074,
-0.15307632088661194,
0.03948540240526199,
-0.37946444749832153,
-0.30935782194137573,
0.22002547979354858,
-0.070368692278862,
-0.726814329624176,
0.2931024432182312,
-0.7637889981269836,
0.34078964591026306,
1.2684359550476074,
0.314466267824173,
-0.22319135069847107,
0.34985485672950745,
1.208448052406311,
0.3792874217033386,
-0.19451633095741272,
-0.7860596179962158,
-1.6238878965377808,
1.9106544256210327,
-1.2312949895858765,
1.6735492944717407,
0.882710337638855,
0.07301824539899826,
-1.904015302658081,
-1.8083924055099487,
1.0567853450775146,
1.17347252368927,
2.3897416591644287,
0.3945538103580475,
0.5212079882621765,
-0.7962680459022522,
-0.7153663635253906,
0.32411545515060425,
-0.8808351159095764,
-0.658397376537323,
0.2638431787490845,
2.325768232345581,
1.8435394763946533,
-0.5010067224502563,
-0.09748108685016632,
-0.8561185002326965,
1.0154129266738892,
-0.267787367105484,
0.06630831956863403,
1.896285891532898,
-0.32165318727493286,
-1.1571502685546875,
1.422558069229126,
-2.3560752868652344,
0.37226805090904236,
1.9141747951507568,
0.35776057839393616,
0.17264479398727417,
-1.4220460653305054,
-0.6926590800285339,
-0.30128493905067444,
-0.41479358077049255,
-1.277287483215332,
0.6041663885116577,
-0.1015416830778122,
-1.0456910133361816,
-1.4483577013015747,
0.21438878774642944,
-1.1016639471054077,
-1.6320348978042603,
0.2497943639755249,
1.74262535572052,
1.9436229467391968,
-0.8600535988807678,
1.2765384912490845,
-0.27953019738197327,
-0.036232441663742065,
1.3240114450454712,
1.3741390705108643,
3.176570415496826,
1.9271987676620483,
-1.3641002178192139,
0.7389472723007202,
-0.3500629961490631,
-0.5693926811218262,
1.316216230392456,
-1.3359416723251343,
1.0695539712905884,
-0.12884657084941864,
-1.190621018409729,
-1.1399593353271484,
1.069550633430481,
0.5209141969680786,
0.03289084881544113,
-0.4509654939174652,
1.414374589920044,
0.034260109066963196,
1.399775743484497,
0.5837323069572449,
-0.39594051241874695,
0.4622688591480255,
-0.23633889853954315,
-0.3617784082889557,
1.507798433303833,
0.09773004055023193,
-1.4869892597198486,
-2.131021022796631,
-0.3096770942211151,
-0.9774806499481201,
-0.08939408510923386,
-0.6877508163452148,
-0.9707130193710327,
1.4509782791137695,
0.37954822182655334,
-1.1028389930725098,
-0.48990923166275024,
-0.4333798885345459,
-0.647093653678894,
2.6242964267730713,
-1.3629300594329834,
-0.06571612507104874,
-1.0051853656768799,
-0.48489007353782654,
1.7633041143417358,
-1.2004141807556152,
-0.1305692046880722,
-1.0272409915924072,
-0.6267351508140564,
-1.3827251195907593,
-0.4358065128326416,
-0.07100396603345871,
-0.9514029622077942,
0.8149948716163635,
0.26542848348617554,
-1.1262437105178833,
-0.29019808769226074,
-0.6614691019058228,
0.889967143535614,
-0.10771585255861282,
0.16457884013652802,
1.7490861415863037,
0.263008713722229,
-0.5334863066673279,
0.6476188898086548,
1.3189059495925903,
0.712924063205719,
-0.7111196517944336,
-0.0608978196978569,
-0.8607925772666931,
0.34716734290122986,
-1.6915727853775024,
0.27783477306365967,
-2.791865825653076,
0.7928142547607422,
-0.24503418803215027,
-0.14064954221248627,
-0.1295304298400879,
-1.300614595413208,
1.038190245628357,
2.5224900245666504,
-1.2896816730499268,
0.3768819272518158,
0.4858514964580536,
1.0766099691390991,
-1.492147445678711,
0.18862168490886688,
-0.5654726028442383,
1.960776925086975,
0.2699415683746338,
1.315163016319275,
-0.3439314663410187,
-2.3146910667419434,
0.7290015816688538,
-1.0541572570800781,
-0.8725962042808533,
0.9658891558647156,
-0.9518654346466064,
0.116448312997818,
-1.5816192626953125,
-0.333575963973999,
-0.8868294954299927,
-1.2066816091537476,
0.4930426776409149,
0.15239349007606506,
0.4365537166595459,
-0.7645745873451233,
0.424192875623703,
-2.2163515090942383,
-1.33184814453125,
-0.1836225688457489,
-0.9917702078819275,
0.6547960042953491,
-0.3967544734477997,
0.604312002658844,
0.0047044651582837105,
0.001384655013680458,
0.402719110250473,
1.6410971879959106,
3.5147833824157715,
0.10432422906160355,
0.19333365559577942,
-0.06448661535978317,
-0.9461042881011963,
1.253973364830017,
0.7229137420654297,
-0.04985669255256653,
-0.6167373061180115,
-1.0900797843933105,
1.336202621459961,
1.9673112630844116,
1.0788379907608032,
0.08791892975568771,
-1.06276273727417,
-0.8122178912162781,
0.03616982698440552,
0.2518365979194641,
0.460421085357666,
0.8573691248893738,
0.07617837935686111,
0.13049650192260742,
1.3740532398223877,
1.1302484273910522,
-0.2700002193450928,
0.23110297322273254,
-0.7909466624259949,
-0.3855772912502289,
0.603807806968689,
0.15771855413913727,
0.10632799565792084,
0.657477080821991,
-0.9655768275260925,
-0.27442798018455505,
-0.1681918501853943,
-1.013242244720459,
-0.8219403028488159,
-0.32623812556266785,
-0.3244296908378601,
1.5983244180679321,
0.2024717479944229,
-0.5030938386917114,
0.26116225123405457,
-0.5928218960762024,
-0.22703902423381805,
-1.1583549976348877,
0.12323358654975891,
-0.09077274799346924,
-0.04799662530422211,
-0.18215234577655792,
1.4902077913284302,
-0.8088175654411316,
-1.9813148975372314,
-0.008176576346158981,
0.34217309951782227,
-0.2455287128686905,
0.22169065475463867,
1.8879523277282715,
0.4938393533229828,
1.755243182182312,
1.0864720344543457,
0.9902682900428772,
-0.5133656859397888,
-1.2994192838668823,
0.8026807904243469,
1.0153888463974,
-1.4677257537841797,
0.8137854933738708,
-0.22050611674785614,
-0.6695055961608887,
0.6376296281814575,
1.3059133291244507,
0.3961847424507141,
-1.9002597332000732,
0.9858796000480652,
-0.969140350818634,
0.853757917881012,
0.5451378226280212,
0.8596369624137878,
0.08767935633659363,
0.9139798879623413,
-1.3497358560562134,
-1.078108787536621,
-0.5733649134635925,
-0.6968100070953369,
1.8556544780731201,
-0.2858063578605652,
0.5295326113700867,
-0.2119539976119995,
-1.3135098218917847,
0.018109871074557304,
0.8673224449157715,
0.1274876892566681,
-0.4433935284614563,
1.0319651365280151,
-0.7730141282081604,
-1.123105764389038,
-1.4323285818099976,
-0.3979896605014801,
-1.0148754119873047,
-0.8398872017860413,
1.1456595659255981,
0.7872228026390076,
0.3127463161945343,
1.924622893333435,
0.6254420876502991,
0.2952345907688141,
-2.6125566959381104,
0.8509870767593384,
0.1392730474472046,
0.046217940747737885,
1.0203498601913452,
0.3005492389202118,
1.1170005798339844,
0.0032391175627708435,
0.673811674118042,
-2.2768242359161377,
2.194362163543701,
-0.007100951392203569,
0.6423404216766357,
-0.17794835567474365,
-0.212076336145401,
0.9617400765419006,
0.6102490425109863,
0.613287627696991,
-1.306123971939087,
0.8646275997161865,
-0.4506644010543823,
0.9482406973838806,
0.7787544131278992,
-0.7868632078170776,
-0.008139098063111305,
1.2191545963287354,
0.4937709867954254,
-0.3819431960582733,
-0.9944685101509094,
-0.8158558011054993,
1.1304512023925781,
1.5849108695983887,
-0.09005150943994522,
-0.04430507868528366,
0.6931808590888977,
0.6906065344810486,
-1.1092655658721924,
0.2549070119857788,
-0.5834559202194214,
-0.6531218886375427,
1.4145537614822388,
1.9952160120010376,
-0.0777973085641861,
-0.15996767580509186,
-0.7236011624336243,
-1.2243664264678955,
0.537492573261261,
-0.17085665464401245,
0.3878338038921356,
0.557312548160553,
-0.7564132213592529,
0.9139662384986877,
0.8674067854881287,
0.8068999648094177,
0.10997176915407181,
0.32557913661003113,
0.5992584228515625,
-0.4393632113933563,
-1.0181188583374023,
-0.49378350377082825,
-1.0972319841384888,
-2.8522236347198486,
0.46642035245895386,
-0.3457137644290924,
-1.663859248161316,
0.08124007284641266,
-1.1358860731124878,
0.9074070453643799,
-0.640359103679657,
-1.37736976146698,
-1.4873689413070679,
0.4605240821838379,
0.013774575665593147,
1.148634910583496,
-1.5755233764648438,
-0.14949440956115723,
1.3115029335021973,
0.8610374331474304,
-0.3759710490703583,
0.7837327122688293,
0.31124311685562134,
0.9970458149909973,
1.0012515783309937,
-0.28025946021080017,
0.6434411406517029,
0.25426772236824036,
-1.2782421112060547,
0.407392293214798,
1.2283474206924438,
0.26646697521209717,
1.461991310119629,
-0.335153728723526,
0.1906130611896515,
0.5130802989006042,
-0.656810998916626,
-0.6269012689590454,
-0.20981702208518982,
0.34184199571609497,
0.3345680832862854,
-1.1389877796173096,
-0.1431684046983719,
-0.29904818534851074,
-0.1275937408208847,
-0.03919672593474388,
-1.3286314010620117,
-0.41322559118270874,
-0.4826296865940094,
-0.5927032828330994,
-1.3926994800567627,
-0.021225053817033768,
1.3063527345657349,
-0.7382857799530029,
-0.1095348373055458,
0.4336962103843689,
0.43736159801483154,
0.565293550491333,
0.5686878561973572,
-0.8666343092918396,
-0.3904380202293396,
-0.2581252157688141,
-0.27462780475616455,
0.1479244828224182,
1.0958900451660156,
-0.05296611040830612,
-0.9762871265411377,
0.6078144907951355,
-0.2867714464664459,
0.1783452332019806,
1.8634757995605469,
0.05871466547250748,
-0.8333603143692017,
0.40666627883911133,
-0.6117690801620483,
1.8388617038726807,
1.7326231002807617,
1.3006278276443481,
-0.08563978224992752,
-0.8436257243156433,
0.5076038241386414,
-0.45449769496917725,
-0.12587770819664001,
0.9677723050117493,
0.4980567991733551,
-0.24232034385204315,
-1.422037124633789,
0.6261170506477356,
1.2530957460403442,
-0.9706339836120605,
-0.7701848745346069,
0.2805851399898529,
-0.7059683203697205,
1.2561802864074707,
0.6206027269363403,
0.11443886905908585,
0.24945810437202454,
1.6471143960952759,
0.7506341338157654,
-0.5470148324966431,
0.5543599724769592,
0.6145459413528442,
-0.35863861441612244,
-2.2973062992095947,
-1.2098214626312256,
0.38279369473457336,
-0.4236230254173279,
-1.2823652029037476,
1.3522286415100098,
-1.0345823764801025,
-1.0399971008300781,
0.6887357831001282,
0.04746463894844055,
1.172709345817566,
0.2537335455417633,
1.6408069133758545,
2.162968158721924,
0.7455012202262878,
0.23630434274673462,
1.3254626989364624,
0.039381369948387146,
-0.4057087004184723,
1.9316344261169434,
-0.27190667390823364,
0.40455687046051025,
0.9405522346496582,
-0.46543198823928833,
-1.0855823755264282,
-0.9615910053253174,
-1.1837354898452759,
-0.7762457728385925,
1.2707558870315552,
0.13283506035804749,
-0.9542081952095032,
0.3786190152168274,
1.731632947921753,
0.15428443253040314,
-0.18449193239212036,
0.606900691986084,
0.6123852133750916,
-0.8343814015388489,
-0.012178686447441578,
-1.1688764095306396,
0.6219421625137329,
-0.11869924515485764,
-0.17901313304901123,
0.0623902902007103,
0.7588491439819336,
1.3332550525665283,
0.0418490469455719,
0.033200666308403015,
1.0848162174224854,
-1.4120841026306152,
1.630340576171875,
-0.5874905586242676,
0.4320234954357147,
-2.322429895401001,
1.150725245475769,
-0.6369068622589111,
2.0224199295043945,
-2.491666793823242,
0.5016951560974121,
-0.7353502511978149,
-0.36500805616378784,
0.28895628452301025,
-0.4302225112915039,
0.2601223886013031,
-0.16327767074108124,
-1.0483405590057373,
-0.17867203056812286,
-0.9031030535697937,
0.7377070188522339,
1.1814534664154053,
1.4384634494781494,
-1.1924285888671875,
-0.13877063989639282,
-1.4063576459884644,
-0.15101483464241028,
-0.8681471347808838,
0.24899086356163025,
-1.7142791748046875,
-0.2075604498386383,
-2.1150400638580322,
-2.401919364929199,
-1.3804051876068115,
-0.7051103711128235,
1.126412034034729,
0.1817399561405182,
-0.9492645859718323,
1.1959348917007446,
-0.5891890525817871,
-1.8311340808868408,
1.0280046463012695,
-2.216505765914917
] |
https://github.com/huggingface/datasets/issues/6089 | AssertionError: daemonic processes are not allowed to have children | > We could add a "threads" parallel backend to `datasets.parallel.parallel_backend` to support downloading with threads but note that `download_and_extract` also decompresses archives, and this is a CPU-intensive task, which is not ideal for (Python) threads (good for IO-intensive tasks).
Great! Download takes more time than extract, multiple threads can download in parallel, which can speed up a lot. | ### Describe the bug
When I load_dataset with num_proc > 0 in a deamon process, I got an error:
```python
File "/Users/codingl2k1/Work/datasets/src/datasets/download/download_manager.py", line 564, in download_and_extract
return self.extract(self.download(url_or_urls))
^^^^^^^^^^^^^^^^^
File "/Users/codingl2k1/Work/datasets/src/datasets/download/download_manager.py", line 427, in download
downloaded_path_or_paths = map_nested(
^^^^^^^^^^^^^^^^^
File "/Users/codingl2k1/Work/datasets/src/datasets/utils/py_utils.py", line 468, in map_nested
mapped = parallel_map(function, iterable, num_proc, types, disable_tqdm, desc, _single_map_nested)
^^^^^^^^^^^^^^^^^
File "/Users/codingl2k1/Work/datasets/src/datasets/utils/experimental.py", line 40, in _inner_fn
return fn(*args, **kwargs)
^^^^^^^^^^^^^^^^^
File "/Users/codingl2k1/Work/datasets/src/datasets/parallel/parallel.py", line 34, in parallel_map
return _map_with_multiprocessing_pool(
^^^^^^^^^^^^^^^^^
File "/Users/codingl2k1/Work/datasets/src/datasets/parallel/parallel.py", line 64, in _map_with_multiprocessing_pool
with Pool(num_proc, initargs=initargs, initializer=initializer) as pool:
^^^^^^^^^^^^^^^^^
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/multiprocessing/context.py", line 119, in Pool
return Pool(processes, initializer, initargs, maxtasksperchild,
^^^^^^^^^^^^^^^^^
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/multiprocessing/pool.py", line 215, in __init__
self._repopulate_pool()
^^^^^^^^^^^^^^^^^
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/multiprocessing/pool.py", line 306, in _repopulate_pool
return self._repopulate_pool_static(self._ctx, self.Process,
^^^^^^^^^^^^^^^^^
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/multiprocessing/pool.py", line 329, in _repopulate_pool_static
w.start()
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/multiprocessing/process.py", line 118, in start
assert not _current_process._config.get('daemon'), ^^^^^^^^^^^^^^^^^
AssertionError: daemonic processes are not allowed to have children
```
The download is io-intensive computing, may be datasets can replece the multi processing pool by a multi threading pool if in a deamon process.
### Steps to reproduce the bug
1. start a deamon process
2. run load_dataset with num_proc > 0
### Expected behavior
No error.
### Environment info
Python 3.11.4
datasets latest master | 42 | 58 | AssertionError: daemonic processes are not allowed to have children
### Describe the bug
When I load_dataset with num_proc > 0 in a deamon process, I got an error:
```python
File "/Users/codingl2k1/Work/datasets/src/datasets/download/download_manager.py", line 564, in download_and_extract
return self.extract(self.download(url_or_urls))
^^^^^^^^^^^^^^^^^
File "/Users/codingl2k1/Work/datasets/src/datasets/download/download_manager.py", line 427, in download
downloaded_path_or_paths = map_nested(
^^^^^^^^^^^^^^^^^
File "/Users/codingl2k1/Work/datasets/src/datasets/utils/py_utils.py", line 468, in map_nested
mapped = parallel_map(function, iterable, num_proc, types, disable_tqdm, desc, _single_map_nested)
^^^^^^^^^^^^^^^^^
File "/Users/codingl2k1/Work/datasets/src/datasets/utils/experimental.py", line 40, in _inner_fn
return fn(*args, **kwargs)
^^^^^^^^^^^^^^^^^
File "/Users/codingl2k1/Work/datasets/src/datasets/parallel/parallel.py", line 34, in parallel_map
return _map_with_multiprocessing_pool(
^^^^^^^^^^^^^^^^^
File "/Users/codingl2k1/Work/datasets/src/datasets/parallel/parallel.py", line 64, in _map_with_multiprocessing_pool
with Pool(num_proc, initargs=initargs, initializer=initializer) as pool:
^^^^^^^^^^^^^^^^^
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/multiprocessing/context.py", line 119, in Pool
return Pool(processes, initializer, initargs, maxtasksperchild,
^^^^^^^^^^^^^^^^^
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/multiprocessing/pool.py", line 215, in __init__
self._repopulate_pool()
^^^^^^^^^^^^^^^^^
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/multiprocessing/pool.py", line 306, in _repopulate_pool
return self._repopulate_pool_static(self._ctx, self.Process,
^^^^^^^^^^^^^^^^^
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/multiprocessing/pool.py", line 329, in _repopulate_pool_static
w.start()
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/multiprocessing/process.py", line 118, in start
assert not _current_process._config.get('daemon'), ^^^^^^^^^^^^^^^^^
AssertionError: daemonic processes are not allowed to have children
```
The download is io-intensive computing, may be datasets can replece the multi processing pool by a multi threading pool if in a deamon process.
### Steps to reproduce the bug
1. start a deamon process
2. run load_dataset with num_proc > 0
### Expected behavior
No error.
### Environment info
Python 3.11.4
datasets latest master
> We could add a "threads" parallel backend to `datasets.parallel.parallel_backend` to support downloading with threads but note that `download_and_extract` also decompresses archives, and this is a CPU-intensive task, which is not ideal for (Python) threads (good for IO-intensive tasks).
Great! Download takes more time than extract, multiple threads can download in parallel, which can speed up a lot. | [
-1.3304325342178345,
-0.843843400478363,
-0.6240853667259216,
1.2293169498443604,
0.023741507902741432,
-0.9174615740776062,
0.06877093762159348,
-1.0991508960723877,
1.8150602579116821,
-0.6466710567474365,
0.21736067533493042,
-1.551055669784546,
-0.1861899197101593,
-0.48568251729011536,
-0.6399885416030884,
-0.9412006735801697,
-0.28778788447380066,
-0.8252395987510681,
1.0269654989242554,
2.608595609664917,
1.2234467267990112,
-1.412387490272522,
2.707380771636963,
0.8097389936447144,
-0.3603209853172302,
-0.7776699066162109,
0.48141592741012573,
-0.0388236865401268,
-1.0951825380325317,
-0.6576300859451294,
-0.991340160369873,
0.02303980104625225,
-0.6472021341323853,
-0.3529244661331177,
-0.04204221069812775,
0.23380602896213531,
-0.2620423436164856,
-0.1918572634458542,
-0.7916498780250549,
-0.7969321608543396,
0.533761739730835,
-0.3538559079170227,
0.9927069544792175,
-0.4394308030605316,
1.7998770475387573,
-0.5881317853927612,
0.5424193739891052,
0.6860813498497009,
1.152274250984192,
0.05636809021234512,
-0.017423663288354874,
0.511515736579895,
0.3303428590297699,
-0.04301271587610245,
0.7841843962669373,
1.1911066770553589,
0.5725809335708618,
0.4992753565311432,
0.3974270224571228,
-2.302197217941284,
1.3348913192749023,
-1.050580620765686,
0.32438215613365173,
1.479893445968628,
-0.7309799194335938,
0.33590787649154663,
-1.7369120121002197,
0.08000855147838593,
0.7174645066261292,
-2.4402904510498047,
0.25283366441726685,
-1.2671724557876587,
-0.5861356258392334,
1.0325621366500854,
0.4068147540092468,
-1.1362403631210327,
0.08766410499811172,
-0.4590553641319275,
1.1769294738769531,
0.1981641948223114,
1.24491286277771,
-1.5459580421447754,
0.05796533823013306,
-0.14617295563220978,
0.30410197377204895,
-1.2460455894470215,
-1.631604790687561,
0.5121922492980957,
0.48947668075561523,
0.38065025210380554,
-0.1314806193113327,
1.021225929260254,
-0.9869500994682312,
0.56121826171875,
-0.8880736231803894,
-1.5188696384429932,
-1.5767793655395508,
-2.5290467739105225,
-2.3843014240264893,
0.7745110392570496,
-0.6072244644165039,
-0.38829123973846436,
2.145897626876831,
-1.041258692741394,
-1.5384067296981812,
0.9170845746994019,
0.20430254936218262,
0.13918863236904144,
2.285205841064453,
0.14447824656963348,
-0.7653111815452576,
0.44569167494773865,
-0.6788977384567261,
0.8515129685401917,
-0.21523532271385193,
1.4875693321228027,
0.5213677883148193,
-1.0824432373046875,
1.5163935422897339,
-0.567435622215271,
0.5559976696968079,
-0.35646435618400574,
-0.6333647966384888,
-0.8128358721733093,
0.42021554708480835,
1.839524269104004,
-0.2784726321697235,
1.6663795709609985,
-0.5081456303596497,
-1.5520739555358887,
-1.51868736743927,
0.9171946048736572,
0.4682583212852478,
-0.9406428933143616,
0.3041941821575165,
-0.7203582525253296,
0.04868388921022415,
-0.1318347156047821,
1.2593061923980713,
1.3898274898529053,
0.7518086433410645,
-0.28827860951423645,
-0.9010745286941528,
0.22031836211681366,
-0.11386659741401672,
-0.7923910021781921,
-1.8297474384307861,
-0.19696326553821564,
0.13190817832946777,
0.636823296546936,
-1.282250165939331,
1.6906061172485352,
0.9198295474052429,
1.9591645002365112,
0.9109857082366943,
-0.3728978931903839,
1.4761359691619873,
0.10673287510871887,
1.9084452390670776,
-0.5654444098472595,
0.5527309775352478,
-0.19124217331409454,
-1.1289507150650024,
0.7246089577674866,
-0.48534849286079407,
-2.0921213626861572,
-0.7997866868972778,
-0.6997547745704651,
-0.1271107792854309,
-0.8686096668243408,
0.8612416386604309,
-0.13222432136535645,
-1.3321717977523804,
0.11240497976541519,
-0.6415571570396423,
0.5206073522567749,
-1.2524265050888062,
0.13361425697803497,
0.6456899642944336,
-0.5201185345649719,
0.05386587977409363,
-0.29504573345184326,
-1.2281746864318848,
-0.4946044087409973,
0.23472467064857483,
1.8169169425964355,
-0.37691420316696167,
0.7533099055290222,
1.255135178565979,
-0.6906502842903137,
0.004110601730644703,
0.2567013204097748,
-0.35352984070777893,
0.8443289399147034,
-1.137229561805725,
-0.47272056341171265,
1.1565377712249756,
-0.2311088740825653,
-0.5889450907707214,
1.3273029327392578,
0.7584171295166016,
-1.426361322402954,
-0.2743675708770752,
-0.1860629767179489,
-0.7890440821647644,
0.10923869162797928,
-1.546199917793274,
-0.1389160007238388,
0.4691152572631836,
-1.6086301803588867,
-0.4089195728302002,
-0.22541208565235138,
1.3070464134216309,
-0.33431512117385864,
1.4996371269226074,
-0.15307632088661194,
0.03948540240526199,
-0.37946444749832153,
-0.30935782194137573,
0.22002547979354858,
-0.070368692278862,
-0.726814329624176,
0.2931024432182312,
-0.7637889981269836,
0.34078964591026306,
1.2684359550476074,
0.314466267824173,
-0.22319135069847107,
0.34985485672950745,
1.208448052406311,
0.3792874217033386,
-0.19451633095741272,
-0.7860596179962158,
-1.6238878965377808,
1.9106544256210327,
-1.2312949895858765,
1.6735492944717407,
0.882710337638855,
0.07301824539899826,
-1.904015302658081,
-1.8083924055099487,
1.0567853450775146,
1.17347252368927,
2.3897416591644287,
0.3945538103580475,
0.5212079882621765,
-0.7962680459022522,
-0.7153663635253906,
0.32411545515060425,
-0.8808351159095764,
-0.658397376537323,
0.2638431787490845,
2.325768232345581,
1.8435394763946533,
-0.5010067224502563,
-0.09748108685016632,
-0.8561185002326965,
1.0154129266738892,
-0.267787367105484,
0.06630831956863403,
1.896285891532898,
-0.32165318727493286,
-1.1571502685546875,
1.422558069229126,
-2.3560752868652344,
0.37226805090904236,
1.9141747951507568,
0.35776057839393616,
0.17264479398727417,
-1.4220460653305054,
-0.6926590800285339,
-0.30128493905067444,
-0.41479358077049255,
-1.277287483215332,
0.6041663885116577,
-0.1015416830778122,
-1.0456910133361816,
-1.4483577013015747,
0.21438878774642944,
-1.1016639471054077,
-1.6320348978042603,
0.2497943639755249,
1.74262535572052,
1.9436229467391968,
-0.8600535988807678,
1.2765384912490845,
-0.27953019738197327,
-0.036232441663742065,
1.3240114450454712,
1.3741390705108643,
3.176570415496826,
1.9271987676620483,
-1.3641002178192139,
0.7389472723007202,
-0.3500629961490631,
-0.5693926811218262,
1.316216230392456,
-1.3359416723251343,
1.0695539712905884,
-0.12884657084941864,
-1.190621018409729,
-1.1399593353271484,
1.069550633430481,
0.5209141969680786,
0.03289084881544113,
-0.4509654939174652,
1.414374589920044,
0.034260109066963196,
1.399775743484497,
0.5837323069572449,
-0.39594051241874695,
0.4622688591480255,
-0.23633889853954315,
-0.3617784082889557,
1.507798433303833,
0.09773004055023193,
-1.4869892597198486,
-2.131021022796631,
-0.3096770942211151,
-0.9774806499481201,
-0.08939408510923386,
-0.6877508163452148,
-0.9707130193710327,
1.4509782791137695,
0.37954822182655334,
-1.1028389930725098,
-0.48990923166275024,
-0.4333798885345459,
-0.647093653678894,
2.6242964267730713,
-1.3629300594329834,
-0.06571612507104874,
-1.0051853656768799,
-0.48489007353782654,
1.7633041143417358,
-1.2004141807556152,
-0.1305692046880722,
-1.0272409915924072,
-0.6267351508140564,
-1.3827251195907593,
-0.4358065128326416,
-0.07100396603345871,
-0.9514029622077942,
0.8149948716163635,
0.26542848348617554,
-1.1262437105178833,
-0.29019808769226074,
-0.6614691019058228,
0.889967143535614,
-0.10771585255861282,
0.16457884013652802,
1.7490861415863037,
0.263008713722229,
-0.5334863066673279,
0.6476188898086548,
1.3189059495925903,
0.712924063205719,
-0.7111196517944336,
-0.0608978196978569,
-0.8607925772666931,
0.34716734290122986,
-1.6915727853775024,
0.27783477306365967,
-2.791865825653076,
0.7928142547607422,
-0.24503418803215027,
-0.14064954221248627,
-0.1295304298400879,
-1.300614595413208,
1.038190245628357,
2.5224900245666504,
-1.2896816730499268,
0.3768819272518158,
0.4858514964580536,
1.0766099691390991,
-1.492147445678711,
0.18862168490886688,
-0.5654726028442383,
1.960776925086975,
0.2699415683746338,
1.315163016319275,
-0.3439314663410187,
-2.3146910667419434,
0.7290015816688538,
-1.0541572570800781,
-0.8725962042808533,
0.9658891558647156,
-0.9518654346466064,
0.116448312997818,
-1.5816192626953125,
-0.333575963973999,
-0.8868294954299927,
-1.2066816091537476,
0.4930426776409149,
0.15239349007606506,
0.4365537166595459,
-0.7645745873451233,
0.424192875623703,
-2.2163515090942383,
-1.33184814453125,
-0.1836225688457489,
-0.9917702078819275,
0.6547960042953491,
-0.3967544734477997,
0.604312002658844,
0.0047044651582837105,
0.001384655013680458,
0.402719110250473,
1.6410971879959106,
3.5147833824157715,
0.10432422906160355,
0.19333365559577942,
-0.06448661535978317,
-0.9461042881011963,
1.253973364830017,
0.7229137420654297,
-0.04985669255256653,
-0.6167373061180115,
-1.0900797843933105,
1.336202621459961,
1.9673112630844116,
1.0788379907608032,
0.08791892975568771,
-1.06276273727417,
-0.8122178912162781,
0.03616982698440552,
0.2518365979194641,
0.460421085357666,
0.8573691248893738,
0.07617837935686111,
0.13049650192260742,
1.3740532398223877,
1.1302484273910522,
-0.2700002193450928,
0.23110297322273254,
-0.7909466624259949,
-0.3855772912502289,
0.603807806968689,
0.15771855413913727,
0.10632799565792084,
0.657477080821991,
-0.9655768275260925,
-0.27442798018455505,
-0.1681918501853943,
-1.013242244720459,
-0.8219403028488159,
-0.32623812556266785,
-0.3244296908378601,
1.5983244180679321,
0.2024717479944229,
-0.5030938386917114,
0.26116225123405457,
-0.5928218960762024,
-0.22703902423381805,
-1.1583549976348877,
0.12323358654975891,
-0.09077274799346924,
-0.04799662530422211,
-0.18215234577655792,
1.4902077913284302,
-0.8088175654411316,
-1.9813148975372314,
-0.008176576346158981,
0.34217309951782227,
-0.2455287128686905,
0.22169065475463867,
1.8879523277282715,
0.4938393533229828,
1.755243182182312,
1.0864720344543457,
0.9902682900428772,
-0.5133656859397888,
-1.2994192838668823,
0.8026807904243469,
1.0153888463974,
-1.4677257537841797,
0.8137854933738708,
-0.22050611674785614,
-0.6695055961608887,
0.6376296281814575,
1.3059133291244507,
0.3961847424507141,
-1.9002597332000732,
0.9858796000480652,
-0.969140350818634,
0.853757917881012,
0.5451378226280212,
0.8596369624137878,
0.08767935633659363,
0.9139798879623413,
-1.3497358560562134,
-1.078108787536621,
-0.5733649134635925,
-0.6968100070953369,
1.8556544780731201,
-0.2858063578605652,
0.5295326113700867,
-0.2119539976119995,
-1.3135098218917847,
0.018109871074557304,
0.8673224449157715,
0.1274876892566681,
-0.4433935284614563,
1.0319651365280151,
-0.7730141282081604,
-1.123105764389038,
-1.4323285818099976,
-0.3979896605014801,
-1.0148754119873047,
-0.8398872017860413,
1.1456595659255981,
0.7872228026390076,
0.3127463161945343,
1.924622893333435,
0.6254420876502991,
0.2952345907688141,
-2.6125566959381104,
0.8509870767593384,
0.1392730474472046,
0.046217940747737885,
1.0203498601913452,
0.3005492389202118,
1.1170005798339844,
0.0032391175627708435,
0.673811674118042,
-2.2768242359161377,
2.194362163543701,
-0.007100951392203569,
0.6423404216766357,
-0.17794835567474365,
-0.212076336145401,
0.9617400765419006,
0.6102490425109863,
0.613287627696991,
-1.306123971939087,
0.8646275997161865,
-0.4506644010543823,
0.9482406973838806,
0.7787544131278992,
-0.7868632078170776,
-0.008139098063111305,
1.2191545963287354,
0.4937709867954254,
-0.3819431960582733,
-0.9944685101509094,
-0.8158558011054993,
1.1304512023925781,
1.5849108695983887,
-0.09005150943994522,
-0.04430507868528366,
0.6931808590888977,
0.6906065344810486,
-1.1092655658721924,
0.2549070119857788,
-0.5834559202194214,
-0.6531218886375427,
1.4145537614822388,
1.9952160120010376,
-0.0777973085641861,
-0.15996767580509186,
-0.7236011624336243,
-1.2243664264678955,
0.537492573261261,
-0.17085665464401245,
0.3878338038921356,
0.557312548160553,
-0.7564132213592529,
0.9139662384986877,
0.8674067854881287,
0.8068999648094177,
0.10997176915407181,
0.32557913661003113,
0.5992584228515625,
-0.4393632113933563,
-1.0181188583374023,
-0.49378350377082825,
-1.0972319841384888,
-2.8522236347198486,
0.46642035245895386,
-0.3457137644290924,
-1.663859248161316,
0.08124007284641266,
-1.1358860731124878,
0.9074070453643799,
-0.640359103679657,
-1.37736976146698,
-1.4873689413070679,
0.4605240821838379,
0.013774575665593147,
1.148634910583496,
-1.5755233764648438,
-0.14949440956115723,
1.3115029335021973,
0.8610374331474304,
-0.3759710490703583,
0.7837327122688293,
0.31124311685562134,
0.9970458149909973,
1.0012515783309937,
-0.28025946021080017,
0.6434411406517029,
0.25426772236824036,
-1.2782421112060547,
0.407392293214798,
1.2283474206924438,
0.26646697521209717,
1.461991310119629,
-0.335153728723526,
0.1906130611896515,
0.5130802989006042,
-0.656810998916626,
-0.6269012689590454,
-0.20981702208518982,
0.34184199571609497,
0.3345680832862854,
-1.1389877796173096,
-0.1431684046983719,
-0.29904818534851074,
-0.1275937408208847,
-0.03919672593474388,
-1.3286314010620117,
-0.41322559118270874,
-0.4826296865940094,
-0.5927032828330994,
-1.3926994800567627,
-0.021225053817033768,
1.3063527345657349,
-0.7382857799530029,
-0.1095348373055458,
0.4336962103843689,
0.43736159801483154,
0.565293550491333,
0.5686878561973572,
-0.8666343092918396,
-0.3904380202293396,
-0.2581252157688141,
-0.27462780475616455,
0.1479244828224182,
1.0958900451660156,
-0.05296611040830612,
-0.9762871265411377,
0.6078144907951355,
-0.2867714464664459,
0.1783452332019806,
1.8634757995605469,
0.05871466547250748,
-0.8333603143692017,
0.40666627883911133,
-0.6117690801620483,
1.8388617038726807,
1.7326231002807617,
1.3006278276443481,
-0.08563978224992752,
-0.8436257243156433,
0.5076038241386414,
-0.45449769496917725,
-0.12587770819664001,
0.9677723050117493,
0.4980567991733551,
-0.24232034385204315,
-1.422037124633789,
0.6261170506477356,
1.2530957460403442,
-0.9706339836120605,
-0.7701848745346069,
0.2805851399898529,
-0.7059683203697205,
1.2561802864074707,
0.6206027269363403,
0.11443886905908585,
0.24945810437202454,
1.6471143960952759,
0.7506341338157654,
-0.5470148324966431,
0.5543599724769592,
0.6145459413528442,
-0.35863861441612244,
-2.2973062992095947,
-1.2098214626312256,
0.38279369473457336,
-0.4236230254173279,
-1.2823652029037476,
1.3522286415100098,
-1.0345823764801025,
-1.0399971008300781,
0.6887357831001282,
0.04746463894844055,
1.172709345817566,
0.2537335455417633,
1.6408069133758545,
2.162968158721924,
0.7455012202262878,
0.23630434274673462,
1.3254626989364624,
0.039381369948387146,
-0.4057087004184723,
1.9316344261169434,
-0.27190667390823364,
0.40455687046051025,
0.9405522346496582,
-0.46543198823928833,
-1.0855823755264282,
-0.9615910053253174,
-1.1837354898452759,
-0.7762457728385925,
1.2707558870315552,
0.13283506035804749,
-0.9542081952095032,
0.3786190152168274,
1.731632947921753,
0.15428443253040314,
-0.18449193239212036,
0.606900691986084,
0.6123852133750916,
-0.8343814015388489,
-0.012178686447441578,
-1.1688764095306396,
0.6219421625137329,
-0.11869924515485764,
-0.17901313304901123,
0.0623902902007103,
0.7588491439819336,
1.3332550525665283,
0.0418490469455719,
0.033200666308403015,
1.0848162174224854,
-1.4120841026306152,
1.630340576171875,
-0.5874905586242676,
0.4320234954357147,
-2.322429895401001,
1.150725245475769,
-0.6369068622589111,
2.0224199295043945,
-2.491666793823242,
0.5016951560974121,
-0.7353502511978149,
-0.36500805616378784,
0.28895628452301025,
-0.4302225112915039,
0.2601223886013031,
-0.16327767074108124,
-1.0483405590057373,
-0.17867203056812286,
-0.9031030535697937,
0.7377070188522339,
1.1814534664154053,
1.4384634494781494,
-1.1924285888671875,
-0.13877063989639282,
-1.4063576459884644,
-0.15101483464241028,
-0.8681471347808838,
0.24899086356163025,
-1.7142791748046875,
-0.2075604498386383,
-2.1150400638580322,
-2.401919364929199,
-1.3804051876068115,
-0.7051103711128235,
1.126412034034729,
0.1817399561405182,
-0.9492645859718323,
1.1959348917007446,
-0.5891890525817871,
-1.8311340808868408,
1.0280046463012695,
-2.216505765914917
] |
https://github.com/huggingface/datasets/issues/6086 | Support `fsspec` in `Dataset.to_<format>` methods | I'm assuming this should just cover `to_csv`, `to_parquet`, and `to_json`, right? As `to_list` and `to_dict` just return Python objects, `to_pandas` returns a `pandas.DataFrame` and `to_sql` just inserts into a SQL DB, is that right? | Supporting this should be fairly easy.
Requested on the forum [here](https://discuss.huggingface.co/t/how-can-i-convert-a-loaded-dataset-in-to-a-parquet-file-and-save-it-to-the-s3/48353). | 44 | 34 | Support `fsspec` in `Dataset.to_<format>` methods
Supporting this should be fairly easy.
Requested on the forum [here](https://discuss.huggingface.co/t/how-can-i-convert-a-loaded-dataset-in-to-a-parquet-file-and-save-it-to-the-s3/48353).
I'm assuming this should just cover `to_csv`, `to_parquet`, and `to_json`, right? As `to_list` and `to_dict` just return Python objects, `to_pandas` returns a `pandas.DataFrame` and `to_sql` just inserts into a SQL DB, is that right? | [
-1.0311846733093262,
-0.7468673586845398,
-0.7434991002082825,
1.6008455753326416,
-0.025689486414194107,
-1.4986146688461304,
0.25253990292549133,
-1.046440601348877,
1.7896806001663208,
-0.9305419921875,
0.49904119968414307,
-1.5891073942184448,
0.06446303427219391,
-0.7518453001976013,
-0.7872912883758545,
-0.7511021494865417,
-0.4038705825805664,
-0.7116568684577942,
0.9539511799812317,
2.4297983646392822,
1.0920487642288208,
-1.367638349533081,
2.633028984069824,
0.6873296499252319,
-0.1886100023984909,
-0.9285821914672852,
0.39385753870010376,
0.04693584889173508,
-1.2781950235366821,
-0.30774179100990295,
-0.9090712666511536,
-0.13143087923526764,
-0.6696197986602783,
-0.6520727872848511,
-0.0006529707461595535,
0.5667701959609985,
-0.25414878129959106,
-0.4599475562572479,
-0.3815772235393524,
-0.8414917588233948,
0.5927425026893616,
-0.3488776683807373,
0.9343873858451843,
-0.3979126214981079,
1.8151334524154663,
-0.632334291934967,
0.49572569131851196,
0.6970608830451965,
1.3591004610061646,
0.07623255997896194,
-0.10126954317092896,
0.26150959730148315,
0.2577661871910095,
0.03411267697811127,
0.5024210214614868,
1.1258461475372314,
0.540841817855835,
0.756013810634613,
0.7747696042060852,
-2.2371129989624023,
1.3808374404907227,
-1.0805364847183228,
0.3131685256958008,
1.2217379808425903,
-1.0496230125427246,
0.4055265188217163,
-1.8383861780166626,
-0.0715438649058342,
0.46096011996269226,
-2.2705130577087402,
0.2569184899330139,
-1.2213753461837769,
-0.47138068079948425,
0.9672091603279114,
0.4141950309276581,
-1.2365020513534546,
0.03402671962976456,
-0.2825125753879547,
0.90022873878479,
0.36013808846473694,
1.0146458148956299,
-1.74468195438385,
0.20397284626960754,
-0.37738466262817383,
0.15125156939029694,
-1.309295892715454,
-1.4459741115570068,
0.5735391974449158,
0.7186286449432373,
0.7160276770591736,
-0.08355212956666946,
0.913183331489563,
-0.9650971293449402,
0.7443498373031616,
-0.9610983729362488,
-1.6971232891082764,
-1.1793125867843628,
-2.1830875873565674,
-2.4093616008758545,
0.6942539215087891,
-0.4203471839427948,
-0.4304131269454956,
2.0836985111236572,
-0.9351942539215088,
-1.7907750606536865,
1.0440289974212646,
0.2871205508708954,
-0.06814891844987869,
2.2880306243896484,
0.22876285016536713,
-0.7850550413131714,
0.6122066378593445,
-0.7389885783195496,
0.7494356036186218,
-0.4870719313621521,
1.2817306518554688,
0.4633559286594391,
-1.1748167276382446,
1.6279970407485962,
-0.31174108386039734,
0.6738209128379822,
-0.8112573623657227,
-0.450918585062027,
-0.751257061958313,
0.3534623980522156,
1.8708000183105469,
-0.15815481543540955,
1.4927929639816284,
-0.18753103911876678,
-1.464478850364685,
-1.5552380084991455,
0.9272975325584412,
0.4568360149860382,
-0.7663368582725525,
0.19169074296951294,
-0.41247087717056274,
0.13604377210140228,
0.056000031530857086,
1.285321831703186,
1.2342051267623901,
0.7837735414505005,
-0.13687339425086975,
-0.8175977468490601,
0.15940457582473755,
0.03878430277109146,
-0.6391791701316833,
-1.802850604057312,
-0.3576070964336395,
0.18551674485206604,
0.5082694292068481,
-1.012515664100647,
1.9779413938522339,
0.8559084534645081,
1.9685626029968262,
0.9858341217041016,
-0.18149308860301971,
1.5237483978271484,
-0.13669006526470184,
2.061505079269409,
-0.29504862427711487,
0.6838434934616089,
-0.4581368565559387,
-1.1752760410308838,
0.8723451495170593,
-0.4031623899936676,
-2.028400182723999,
-0.6011122465133667,
-0.9377759099006653,
-0.11116080731153488,
-0.7302972674369812,
1.0616427659988403,
-0.22476699948310852,
-1.349278450012207,
0.16369594633579254,
-0.5901599526405334,
0.11955679953098297,
-1.208953857421875,
0.2851184904575348,
0.7307882308959961,
-0.7838570475578308,
0.07637767493724823,
-0.39684104919433594,
-1.4570338726043701,
-0.5263999700546265,
0.43355289101600647,
1.9122503995895386,
-0.7403901219367981,
0.9439982175827026,
1.0709867477416992,
-0.7082209587097168,
-0.13754220306873322,
0.40074336528778076,
-0.3607213497161865,
0.760130763053894,
-1.0897928476333618,
-0.42891925573349,
1.120383381843567,
-0.2640671730041504,
-0.73497074842453,
1.4524290561676025,
0.7151802182197571,
-0.9426925182342529,
-0.11593740433454514,
-0.30562859773635864,
-0.7195753455162048,
0.08628275990486145,
-1.5923752784729004,
0.048712410032749176,
0.3549637496471405,
-1.4594452381134033,
-0.527899980545044,
-0.10617503523826599,
1.2887884378433228,
-0.10823941975831985,
1.2414312362670898,
-0.1288134753704071,
-0.25678855180740356,
-0.4895918667316437,
-0.621989369392395,
0.12179216742515564,
-0.06383271515369415,
-0.6703035831451416,
0.30251145362854004,
-0.6090611815452576,
0.3489435613155365,
1.4058823585510254,
0.05448513478040695,
0.1501488834619522,
0.6031059622764587,
1.162345051765442,
0.31434500217437744,
-0.07028130441904068,
-0.8880873918533325,
-1.5489224195480347,
2.0352280139923096,
-1.5260392427444458,
1.9590867757797241,
0.6959922909736633,
0.022378990426659584,
-1.7795391082763672,
-1.8551520109176636,
1.562363862991333,
1.2358784675598145,
2.3948469161987305,
0.6509842872619629,
0.3892945349216461,
-0.9516984820365906,
-0.5767883062362671,
0.4632100760936737,
-0.9730199575424194,
-0.7813267111778259,
0.09770939499139786,
2.2969412803649902,
1.7447386980056763,
-0.486691951751709,
-0.2658335864543915,
-0.9953901171684265,
1.3366411924362183,
-0.2808118164539337,
0.24051296710968018,
2.039733409881592,
-0.46958044171333313,
-1.086803674697876,
1.3051514625549316,
-2.435231924057007,
0.14307595789432526,
2.012620449066162,
0.157754048705101,
0.11761443316936493,
-1.3043994903564453,
-0.6110158562660217,
-0.10509585589170456,
-0.41709259152412415,
-1.2983216047286987,
0.5182120203971863,
-0.18492379784584045,
-0.7485464215278625,
-1.3825136423110962,
0.29011380672454834,
-1.1106868982315063,
-1.6156715154647827,
0.38280048966407776,
1.7690130472183228,
2.0650410652160645,
-0.7120133638381958,
1.542420744895935,
-0.25070056319236755,
0.22469066083431244,
1.187914252281189,
1.2224647998809814,
3.185880184173584,
1.9281325340270996,
-1.121960997581482,
0.6213773488998413,
-0.18979117274284363,
-0.6948937177658081,
1.2329185009002686,
-0.9523786306381226,
1.223442554473877,
-0.3182758390903473,
-1.1289342641830444,
-1.4016687870025635,
0.8522231578826904,
0.4911021590232849,
0.10203371196985245,
-0.4258534014225006,
1.2898730039596558,
0.18749134242534637,
1.1810660362243652,
0.5020827054977417,
-0.3392035663127899,
0.535226047039032,
-0.43510541319847107,
-0.560795783996582,
1.6005349159240723,
0.2876759171485901,
-1.321081280708313,
-2.342036008834839,
-0.0888218805193901,
-0.9378473162651062,
-0.03411206603050232,
-0.7310322523117065,
-0.9013141989707947,
1.6955589056015015,
0.41810867190361023,
-1.127138614654541,
-0.061521582305431366,
-0.24637319147586823,
-0.7178144454956055,
2.710242748260498,
-1.3497428894042969,
-0.2669191360473633,
-0.9521215558052063,
-0.6141371130943298,
1.7573330402374268,
-1.2938175201416016,
-0.3093017339706421,
-0.9769707322120667,
-0.43793046474456787,
-1.2696353197097778,
-0.4425352215766907,
-0.07978151738643646,
-0.8822391629219055,
0.8195427656173706,
0.05445154756307602,
-1.357331395149231,
-0.28928330540657043,
-0.9670947790145874,
0.8023878335952759,
-0.18802687525749207,
0.19376662373542786,
1.7587472200393677,
0.33254528045654297,
-0.3512442111968994,
0.8180245757102966,
1.1610350608825684,
0.6268407702445984,
-0.5679292678833008,
0.40178680419921875,
-0.574028491973877,
0.327702134847641,
-1.255971074104309,
0.37335461378097534,
-2.9499762058258057,
0.60151207447052,
-0.02923624962568283,
-0.0005049761384725571,
-0.08287745714187622,
-1.4072265625,
0.9489310383796692,
2.593306541442871,
-1.192398190498352,
0.49450135231018066,
0.21047860383987427,
1.2707006931304932,
-1.4431620836257935,
0.14877250790596008,
-0.49093097448349,
2.1110339164733887,
-0.00189200509339571,
1.0809745788574219,
-0.4505214989185333,
-2.2459561824798584,
0.5577208995819092,
-1.3066859245300293,
-1.2237118482589722,
0.7863438725471497,
-0.8105216026306152,
-0.017146345227956772,
-1.140865445137024,
-0.09000245481729507,
-0.9308052062988281,
-1.2405989170074463,
0.7230727672576904,
0.10711325705051422,
0.58734130859375,
-0.6665359139442444,
0.21079587936401367,
-2.091083526611328,
-1.449954867362976,
-0.2925177812576294,
-0.9279530048370361,
0.3669600784778595,
-0.2455393522977829,
0.6795682311058044,
-0.1718607097864151,
0.13227114081382751,
0.23640219867229462,
1.5448784828186035,
3.2818679809570312,
0.03880062699317932,
0.4497041702270508,
-0.32571133971214294,
-0.927437961101532,
1.4224324226379395,
0.983643651008606,
-0.11725552380084991,
-0.6625562906265259,
-0.9732936024665833,
1.2739626169204712,
2.0449156761169434,
1.0365865230560303,
0.04606379568576813,
-0.9361605048179626,
-0.6823583841323853,
0.0006385073065757751,
0.11483410000801086,
0.4837978780269623,
0.8847295641899109,
0.2611158788204193,
0.0419769287109375,
1.311327338218689,
1.184311032295227,
-0.3496541976928711,
0.4373803436756134,
-0.831731379032135,
-0.2566119432449341,
0.581648588180542,
0.40036043524742126,
0.05102328956127167,
0.16345703601837158,
-0.9163808822631836,
-0.2792079746723175,
-0.2910311222076416,
-0.8557658195495605,
-0.8000630736351013,
-0.5598137974739075,
-0.4488255977630615,
1.792555809020996,
-0.04391390085220337,
-0.606208086013794,
0.04149545729160309,
-0.7449566125869751,
-0.018144745379686356,
-0.8954284191131592,
0.1687370389699936,
-0.18684034049510956,
-0.0776677280664444,
-0.07175939530134201,
1.692878007888794,
-1.0759968757629395,
-2.167210578918457,
0.2658972442150116,
0.180581197142601,
-0.44408759474754333,
0.10268346965312958,
1.6493189334869385,
0.5059884786605835,
1.4429287910461426,
1.4949852228164673,
1.0954363346099854,
-0.7497663497924805,
-1.3672761917114258,
0.5957707166671753,
0.9304563999176025,
-1.4280022382736206,
0.8445965647697449,
0.03916478157043457,
-0.4918813705444336,
0.6301395893096924,
1.130682349205017,
0.48527026176452637,
-2.0588080883026123,
0.6480648517608643,
-1.053032398223877,
0.8814969062805176,
0.7773020267486572,
0.7098017930984497,
0.24982386827468872,
0.8502117991447449,
-1.1150100231170654,
-1.1100555658340454,
-0.6730359792709351,
-0.78318852186203,
1.8263239860534668,
-0.2909870445728302,
0.47882598638534546,
-0.10939743369817734,
-1.39250910282135,
-0.035461507737636566,
0.8382387161254883,
0.48413243889808655,
-0.428843230009079,
0.6966724991798401,
-0.7349783182144165,
-0.9682136178016663,
-1.3383851051330566,
-0.5542756915092468,
-1.0891687870025635,
-0.8658617734909058,
1.0359234809875488,
0.7629672884941101,
0.4022490084171295,
1.9204357862472534,
0.7648157477378845,
0.29282987117767334,
-2.579186201095581,
0.7762705087661743,
0.40048080682754517,
-0.054036930203437805,
0.7443328499794006,
0.41995224356651306,
1.1319808959960938,
-0.21135099232196808,
0.6403719186782837,
-2.3530759811401367,
2.333211660385132,
-0.1370251625776291,
0.4786926805973053,
0.10623596608638763,
-0.19299232959747314,
1.006563425064087,
0.31354406476020813,
0.5860433578491211,
-1.1479134559631348,
0.675491213798523,
-0.6334611773490906,
1.2628521919250488,
0.8484469652175903,
-0.8609784841537476,
-0.030834902077913284,
1.280379056930542,
0.425979346036911,
-0.5791371464729309,
-0.9440838098526001,
-1.0280288457870483,
0.8963196873664856,
1.6936609745025635,
-0.18470250070095062,
-0.04585249722003937,
0.8810791969299316,
0.6071562170982361,
-1.290384292602539,
0.03877352923154831,
-0.7558311223983765,
-0.8272343277931213,
1.7024227380752563,
1.9026880264282227,
-0.1370132565498352,
-0.007200396619737148,
-1.0073857307434082,
-1.2873492240905762,
0.8592326641082764,
0.16058821976184845,
-0.2241358757019043,
0.6322028040885925,
-0.596577525138855,
1.2061694860458374,
0.9510679841041565,
0.8697524666786194,
0.08248762041330338,
0.3136027455329895,
0.47591397166252136,
-0.380668967962265,
-1.2346128225326538,
-0.43774116039276123,
-1.0658912658691406,
-2.6909146308898926,
0.43003198504447937,
-0.33367034792900085,
-1.4243639707565308,
-0.053561821579933167,
-1.0388864278793335,
0.7736572623252869,
-0.49723196029663086,
-1.0866122245788574,
-1.4211639165878296,
0.24019131064414978,
-0.10715183615684509,
0.7993367314338684,
-1.592594027519226,
0.009094279259443283,
1.153560757637024,
0.886236310005188,
-0.909438967704773,
0.8859118819236755,
0.21709772944450378,
0.9724435806274414,
0.9651288986206055,
-0.4744311273097992,
0.5442780256271362,
0.2432233691215515,
-1.351495385169983,
0.45074862241744995,
1.2484279870986938,
0.060148850083351135,
1.22441565990448,
-0.48885753750801086,
-0.03814565762877464,
0.3253905475139618,
-0.3536842465400696,
-0.5116509795188904,
-0.8552283048629761,
0.7172725796699524,
-0.053692832589149475,
-0.8814384937286377,
0.1440623253583908,
0.08625023812055588,
-0.214590385556221,
0.28260523080825806,
-1.610128402709961,
-0.18954475224018097,
-0.3043857216835022,
-0.5751615762710571,
-1.327745795249939,
-0.015219058841466904,
1.2065447568893433,
-0.533894419670105,
-0.13232579827308655,
0.5154678821563721,
0.35872551798820496,
0.49345922470092773,
0.5339822173118591,
-0.7257595062255859,
-0.3129577338695526,
-0.30664825439453125,
-0.4185170829296112,
0.455379456281662,
1.3569276332855225,
-0.10675525665283203,
-0.987647533416748,
0.6964558959007263,
-0.35441216826438904,
0.05879107862710953,
1.9892488718032837,
0.11754383146762848,
-0.9220280051231384,
0.35287028551101685,
-0.7000250220298767,
1.903503179550171,
1.753708004951477,
1.1376174688339233,
-0.06406019628047943,
-0.9378640055656433,
0.6721527576446533,
-0.41316941380500793,
-0.33429622650146484,
0.9179376363754272,
0.3194987177848816,
-0.2957267463207245,
-1.3201228380203247,
0.730625569820404,
1.3855689764022827,
-0.6580642461776733,
-0.9855395555496216,
0.00955580547451973,
-0.8168652653694153,
1.1164212226867676,
0.7476875185966492,
0.48486682772636414,
0.29679280519485474,
1.6505271196365356,
0.7231155633926392,
-0.5049136281013489,
0.5236325263977051,
0.4419235289096832,
-0.11762331426143646,
-1.9457916021347046,
-1.2687222957611084,
0.34080636501312256,
-0.554248034954071,
-1.6311782598495483,
1.451022982597351,
-1.2639130353927612,
-0.9000133872032166,
0.5821887850761414,
0.1202993243932724,
1.5022671222686768,
0.3400416374206543,
1.506836175918579,
1.999670147895813,
0.8631007671356201,
0.4819384217262268,
1.3225620985031128,
-0.29983776807785034,
-0.4721458852291107,
1.8264727592468262,
-0.5362122058868408,
0.47594764828681946,
1.1747989654541016,
-0.3375115692615509,
-1.0446916818618774,
-0.8681375980377197,
-1.1679368019104004,
-0.7377256751060486,
1.114472508430481,
0.16573892533779144,
-1.2651447057724,
0.3853166997432709,
1.655564308166504,
0.08362219482660294,
-0.25970518589019775,
0.6672642827033997,
0.28360119462013245,
-0.8629522323608398,
0.026372158899903297,
-1.0230865478515625,
0.6450616121292114,
-0.30020323395729065,
-0.2972605228424072,
0.408645361661911,
0.447602242231369,
1.078729271888733,
0.03243829309940338,
0.28402963280677795,
1.1318817138671875,
-1.3994684219360352,
1.3689656257629395,
-0.7004972696304321,
0.3862513303756714,
-2.3553307056427,
1.421385645866394,
-0.7425707578659058,
1.9371651411056519,
-2.6623358726501465,
0.2992704212665558,
-0.4795609414577484,
-0.5737990140914917,
0.3507530987262726,
-0.17623332142829895,
0.0650356262922287,
-0.205826997756958,
-1.2052801847457886,
0.009211046621203423,
-0.7550836801528931,
0.49369192123413086,
1.0945736169815063,
1.2969255447387695,
-0.9470831751823425,
-0.3234291672706604,
-1.701683759689331,
-0.11834229528903961,
-0.4523393511772156,
0.22952567040920258,
-1.9894633293151855,
-0.18082097172737122,
-1.9898457527160645,
-2.407313346862793,
-1.3626718521118164,
-0.8761484026908875,
1.2614431381225586,
0.077280692756176,
-0.7900288105010986,
1.1040292978286743,
-0.3218081593513489,
-1.859232783317566,
1.1391003131866455,
-2.0518248081207275
] |
https://github.com/huggingface/datasets/issues/6079 | Iterating over DataLoader based on HF datasets is stuck forever | When the process starts to hang, can you interrupt it with CTRL + C and paste the error stack trace here? | ### Describe the bug
I am using Amazon Sagemaker notebook (Amazon Linux 2) with python 3.10 based Conda environment.
I have a dataset in parquet format locally. When I try to iterate over it, the loader is stuck forever. Note that the same code is working for python 3.6 based conda environment seamlessly. What should be my next steps here?
### Steps to reproduce the bug
```
train_dataset = load_dataset(
"parquet", data_files = {'train': tr_data_path + '*.parquet'},
split = 'train',
collate_fn = streaming_data_collate_fn,
streaming = True
).with_format('torch')
train_dataloader = DataLoader(train_dataset, batch_size = 2, num_workers = 0)
t = time.time()
iter_ = 0
for batch in train_dataloader:
iter_ += 1
if iter_ == 1000:
break
print (time.time() - t)
```
### Expected behavior
The snippet should work normally and load the next batch of data.
### Environment info
datasets: '2.14.0'
pyarrow: '12.0.0'
torch: '2.0.0'
Python: 3.10.10 | packaged by conda-forge | (main, Mar 24 2023, 20:08:06) [GCC 11.3.0]
!uname -r
5.10.178-162.673.amzn2.x86_64 | 45 | 21 | Iterating over DataLoader based on HF datasets is stuck forever
### Describe the bug
I am using Amazon Sagemaker notebook (Amazon Linux 2) with python 3.10 based Conda environment.
I have a dataset in parquet format locally. When I try to iterate over it, the loader is stuck forever. Note that the same code is working for python 3.6 based conda environment seamlessly. What should be my next steps here?
### Steps to reproduce the bug
```
train_dataset = load_dataset(
"parquet", data_files = {'train': tr_data_path + '*.parquet'},
split = 'train',
collate_fn = streaming_data_collate_fn,
streaming = True
).with_format('torch')
train_dataloader = DataLoader(train_dataset, batch_size = 2, num_workers = 0)
t = time.time()
iter_ = 0
for batch in train_dataloader:
iter_ += 1
if iter_ == 1000:
break
print (time.time() - t)
```
### Expected behavior
The snippet should work normally and load the next batch of data.
### Environment info
datasets: '2.14.0'
pyarrow: '12.0.0'
torch: '2.0.0'
Python: 3.10.10 | packaged by conda-forge | (main, Mar 24 2023, 20:08:06) [GCC 11.3.0]
!uname -r
5.10.178-162.673.amzn2.x86_64
When the process starts to hang, can you interrupt it with CTRL + C and paste the error stack trace here? | [
-1.2703862190246582,
-1.0200567245483398,
-0.7282028198242188,
1.5863037109375,
-0.22804024815559387,
-1.1206165552139282,
0.14635612070560455,
-0.9283672571182251,
1.6327399015426636,
-0.8532999157905579,
0.25511327385902405,
-1.5935802459716797,
0.06626027077436447,
-0.5541383624076843,
-0.6710367798805237,
-0.9019896984100342,
-0.39769357442855835,
-0.7906194925308228,
1.2152239084243774,
2.4792754650115967,
1.1767481565475464,
-1.4330624341964722,
2.7466118335723877,
0.6844868659973145,
-0.17716172337532043,
-1.0545680522918701,
0.45236873626708984,
0.011621950194239616,
-1.303383469581604,
-0.47269389033317566,
-0.9854139089584351,
-0.10184447467327118,
-0.5849422812461853,
-0.43242427706718445,
0.031229667365550995,
0.3751274347305298,
-0.3097801208496094,
-0.473556250333786,
-0.5225887894630432,
-0.7543569207191467,
0.4138980507850647,
-0.4091336131095886,
0.9121178388595581,
-0.3322283625602722,
1.8646512031555176,
-0.44648393988609314,
0.4723714292049408,
0.740240216255188,
1.2310529947280884,
0.19101235270500183,
-0.061486128717660904,
0.4019983410835266,
0.40199148654937744,
-0.03395163267850876,
0.5568444132804871,
1.112541675567627,
0.6121524572372437,
0.43153220415115356,
0.6674896478652954,
-2.2594614028930664,
1.3508073091506958,
-1.0539847612380981,
0.3160218894481659,
1.3426822423934937,
-1.0169873237609863,
0.40661099553108215,
-1.7052521705627441,
-0.03219630569219589,
0.6527529954910278,
-2.2229976654052734,
0.31867483258247375,
-1.3309470415115356,
-0.5061382055282593,
1.0579190254211426,
0.37080633640289307,
-1.2101249694824219,
0.08242490887641907,
-0.46905308961868286,
1.0823975801467896,
0.405666708946228,
1.086157202720642,
-1.6750189065933228,
-0.09977629780769348,
-0.2952594459056854,
0.0820297971367836,
-1.360903024673462,
-1.5300941467285156,
0.545491099357605,
0.7014057636260986,
0.5633761882781982,
-0.12729158997535706,
1.126304268836975,
-1.051946997642517,
0.7918419241905212,
-1.054456353187561,
-1.6907122135162354,
-1.4646062850952148,
-2.426743268966675,
-2.34340238571167,
0.7109238505363464,
-0.3870485723018646,
-0.5291550159454346,
2.1213815212249756,
-1.0183073282241821,
-1.7146294116973877,
1.2295945882797241,
0.20865119993686676,
-0.01793459802865982,
2.3642048835754395,
0.20573250949382782,
-0.735796332359314,
0.41250771284103394,
-0.823825478553772,
0.7673927545547485,
-0.3535959720611572,
1.3685827255249023,
0.4158584773540497,
-1.0192694664001465,
1.566381573677063,
-0.27558696269989014,
0.5738387107849121,
-0.5994521975517273,
-0.5265457034111023,
-0.7651427388191223,
0.2725522518157959,
1.9890624284744263,
-0.26922130584716797,
1.4972985982894897,
-0.3141382336616516,
-1.5104280710220337,
-1.614240050315857,
0.9431660175323486,
0.4184652864933014,
-0.7832295894622803,
0.16958367824554443,
-0.29936233162879944,
0.17780359089374542,
-0.09599873423576355,
1.135988473892212,
1.2540297508239746,
0.661910355091095,
-0.4068514108657837,
-0.9580122828483582,
0.2457752823829651,
-0.19125349819660187,
-0.6388253569602966,
-1.7693486213684082,
-0.3928391635417938,
0.003830372355878353,
0.6714229583740234,
-1.2429225444793701,
1.640195369720459,
0.9186469912528992,
1.8952792882919312,
1.0373010635375977,
-0.32901260256767273,
1.4938896894454956,
0.1489226222038269,
1.7987804412841797,
-0.48651060461997986,
0.6303344368934631,
-0.3957127332687378,
-1.1346262693405151,
0.7571297287940979,
-0.30230218172073364,
-1.9857853651046753,
-0.7314308881759644,
-0.8195823431015015,
-0.22460857033729553,
-0.7727138996124268,
0.9088981747627258,
-0.2878906726837158,
-1.460631012916565,
0.32449567317962646,
-0.7310112714767456,
0.1958143562078476,
-1.2123395204544067,
0.395111620426178,
0.6907099485397339,
-0.5267525315284729,
0.11855506896972656,
-0.27504226565361023,
-1.2725237607955933,
-0.45877203345298767,
0.3289075791835785,
1.856755256652832,
-0.7664968371391296,
0.9108681678771973,
1.1084643602371216,
-0.6924868226051331,
0.019573837518692017,
0.26403751969337463,
-0.23922018706798553,
0.8693661093711853,
-0.9898128509521484,
-0.46799516677856445,
1.2221249341964722,
-0.34786251187324524,
-0.6127305030822754,
1.4814071655273438,
0.7415249943733215,
-1.0217437744140625,
-0.25684529542922974,
-0.09715654700994492,
-0.7770324349403381,
0.10685914754867554,
-1.607828140258789,
-0.15883266925811768,
0.4460715055465698,
-1.5786781311035156,
-0.4429323375225067,
-0.22039929032325745,
1.3957363367080688,
-0.09679817408323288,
1.5038902759552002,
-0.3827415406703949,
-0.21682804822921753,
-0.2948243021965027,
-0.39469006657600403,
0.2126920223236084,
-0.18063202500343323,
-0.5854507684707642,
0.183577299118042,
-0.7566635012626648,
0.3451472520828247,
1.418308973312378,
0.3428877890110016,
0.012665154412388802,
0.5042246580123901,
1.0517922639846802,
0.4361526370048523,
-0.01440795511007309,
-0.8900279998779297,
-1.5050073862075806,
1.9882922172546387,
-1.4387753009796143,
2.0444085597991943,
0.751244068145752,
0.006243592128157616,
-1.7774544954299927,
-1.8524779081344604,
1.3661456108093262,
1.0736184120178223,
2.27195143699646,
0.5371049642562866,
0.3737678825855255,
-0.8768037557601929,
-0.6783195734024048,
0.25457867980003357,
-0.9948505163192749,
-0.7738151550292969,
0.1565236747264862,
2.4632973670959473,
1.7346285581588745,
-0.3745049238204956,
-0.10219302028417587,
-0.9748493432998657,
1.4332410097122192,
-0.17354242503643036,
0.26637914776802063,
1.9964344501495361,
-0.2026226967573166,
-1.0046178102493286,
1.2048265933990479,
-2.4078547954559326,
0.15919072926044464,
2.057342767715454,
0.2915995419025421,
0.08237925916910172,
-1.4065937995910645,
-0.6566792130470276,
-0.2889803349971771,
-0.43177077174186707,
-1.2126868963241577,
0.5420443415641785,
-0.3322942852973938,
-0.7989603877067566,
-1.4294886589050293,
0.21874544024467468,
-1.0786625146865845,
-1.6343810558319092,
0.17432256042957306,
1.8816293478012085,
2.0486223697662354,
-0.7394067049026489,
1.573058009147644,
-0.31703507900238037,
0.22263431549072266,
1.243443250656128,
1.2356737852096558,
3.1221001148223877,
1.9922723770141602,
-1.2340881824493408,
0.646368145942688,
-0.11059167981147766,
-0.4361998736858368,
1.1215158700942993,
-1.2102861404418945,
1.3687944412231445,
-0.09323257952928543,
-1.2024167776107788,
-1.1870838403701782,
1.0016605854034424,
0.5748013257980347,
0.009488558396697044,
-0.4487866461277008,
1.2264584302902222,
0.07229287922382355,
1.2745572328567505,
0.46248283982276917,
-0.34409573674201965,
0.6241487860679626,
-0.4325432777404785,
-0.5262516140937805,
1.5442783832550049,
0.179292693734169,
-1.4374271631240845,
-2.2231285572052,
-0.3053877353668213,
-0.8388472199440002,
0.00040428899228572845,
-0.6317750811576843,
-0.9766393899917603,
1.6148477792739868,
0.3497506380081177,
-1.2448102235794067,
-0.23902662098407745,
-0.3667314648628235,
-0.594429612159729,
2.7342543601989746,
-1.300215244293213,
-0.27645888924598694,
-0.9477863311767578,
-0.6512316465377808,
1.6509292125701904,
-1.2321795225143433,
-0.2519448697566986,
-1.01023268699646,
-0.6210387349128723,
-1.2560739517211914,
-0.5465933084487915,
-0.0340912900865078,
-0.9389357566833496,
0.8830350041389465,
0.15667535364627838,
-1.1915464401245117,
-0.31377720832824707,
-0.9291141033172607,
0.8733447790145874,
-0.015085543505847454,
0.20138490200042725,
1.7835066318511963,
0.31587862968444824,
-0.43602800369262695,
0.7711191177368164,
1.109412670135498,
0.6569945216178894,
-0.7114329934120178,
0.21549704670906067,
-0.639967679977417,
0.33332860469818115,
-1.166379690170288,
0.3617279529571533,
-2.940078020095825,
0.6160194873809814,
-0.02417723834514618,
-0.05372264236211777,
-0.05303379148244858,
-1.2435613870620728,
1.1592228412628174,
2.5316905975341797,
-1.1599867343902588,
0.5330909490585327,
0.36675530672073364,
1.1973267793655396,
-1.599210262298584,
0.36012494564056396,
-0.4399902820587158,
2.129509449005127,
0.2263702005147934,
1.2296056747436523,
-0.43472930788993835,
-2.341657876968384,
0.6637955904006958,
-1.2730214595794678,
-1.1811329126358032,
0.7181239128112793,
-0.9457309246063232,
0.10698641091585159,
-1.3595820665359497,
-0.2595587968826294,
-0.8108721971511841,
-1.1869735717773438,
0.6704214215278625,
0.18699075281620026,
0.4101960062980652,
-0.5451969504356384,
0.3398195207118988,
-2.217848062515259,
-1.3330833911895752,
-0.23853689432144165,
-0.9883919358253479,
0.46435925364494324,
-0.3864234387874603,
0.723870038986206,
-0.19503958523273468,
0.05545087903738022,
0.3346658945083618,
1.426460862159729,
3.35093355178833,
0.08663385361433029,
0.32711538672447205,
-0.1662033498287201,
-0.9254851341247559,
1.4863619804382324,
0.9310508370399475,
-0.14118877053260803,
-0.47848594188690186,
-1.1359503269195557,
1.2681918144226074,
1.9578182697296143,
0.964282214641571,
-0.0029162075370550156,
-0.7668343782424927,
-0.6691989302635193,
-0.06934203952550888,
0.14624114334583282,
0.5122901201248169,
0.8726454973220825,
0.06489525735378265,
0.11245114356279373,
1.450420618057251,
1.1771173477172852,
-0.4693325459957123,
0.3176693618297577,
-0.8384205102920532,
-0.47165635228157043,
0.4588860869407654,
0.24981200695037842,
-0.033401016145944595,
0.291052907705307,
-0.9630688428878784,
-0.1935492306947708,
-0.43424469232559204,
-0.949222981929779,
-0.6995052099227905,
-0.41822606325149536,
-0.4140550494194031,
1.6399096250534058,
0.17909683287143707,
-0.5281315445899963,
-0.013116162270307541,
-0.7296276092529297,
-0.042648397386074066,
-1.1368954181671143,
0.2380051612854004,
-0.10869992524385452,
-0.12224888801574707,
-0.1499549001455307,
1.7764824628829956,
-0.9104666113853455,
-2.083815336227417,
0.18810027837753296,
0.21468615531921387,
-0.19710776209831238,
0.2825556993484497,
1.636252760887146,
0.49497872591018677,
1.511309266090393,
1.299277901649475,
0.9824410676956177,
-0.6532245874404907,
-1.3590373992919922,
0.7358136177062988,
1.0105249881744385,
-1.4153169393539429,
0.7653864622116089,
0.0059120506048202515,
-0.4785408079624176,
0.6788317561149597,
1.2529094219207764,
0.5003352165222168,
-2.073185920715332,
0.8337283730506897,
-1.0196824073791504,
0.7778860330581665,
0.687258780002594,
0.6341608166694641,
0.20434285700321198,
0.8310564160346985,
-1.180774211883545,
-1.1132886409759521,
-0.725138783454895,
-0.7020883560180664,
1.9726675748825073,
-0.3179275691509247,
0.5739007592201233,
-0.20499758422374725,
-1.3709590435028076,
0.017508992925286293,
0.6558765172958374,
0.34706389904022217,
-0.4277585744857788,
0.7986032366752625,
-0.762241005897522,
-1.2146183252334595,
-1.410323977470398,
-0.43737202882766724,
-1.07272207736969,
-1.01042902469635,
1.0790698528289795,
0.7350091934204102,
0.2288089394569397,
1.8366214036941528,
0.579835832118988,
0.29235342144966125,
-2.6122186183929443,
0.9967628717422485,
0.22806115448474884,
-0.03857649862766266,
0.8437507152557373,
0.24389702081680298,
1.0736430883407593,
0.00009798351675271988,
0.5092971324920654,
-2.3786094188690186,
2.292348861694336,
-0.23931849002838135,
0.6711820363998413,
0.019374055787920952,
-0.09978099167346954,
1.0775611400604248,
0.6020369529724121,
0.6547490954399109,
-1.0470515489578247,
0.7032753229141235,
-0.5939795970916748,
1.289718747138977,
0.8580099940299988,
-0.785834789276123,
-0.0647682398557663,
1.2956478595733643,
0.45721426606178284,
-0.5334159135818481,
-0.9314931631088257,
-1.0642616748809814,
0.9375760555267334,
1.6632041931152344,
-0.09586623311042786,
-0.04089934378862381,
0.8207515478134155,
0.6526916027069092,
-1.3223484754562378,
0.06194198131561279,
-0.7181742191314697,
-0.7226234674453735,
1.5229676961898804,
2.0825297832489014,
-0.15675637125968933,
-0.21801993250846863,
-0.7181618213653564,
-1.303465485572815,
0.7057399153709412,
-0.08454877138137817,
0.07320751249790192,
0.6206866502761841,
-0.5469963550567627,
0.9519345164299011,
0.8332300782203674,
0.890402615070343,
0.18421414494514465,
0.2312939614057541,
0.3720000684261322,
-0.33420342206954956,
-1.2019357681274414,
-0.24655109643936157,
-0.9993166327476501,
-2.5993082523345947,
0.4401411712169647,
-0.15443389117717743,
-1.3636798858642578,
0.04804083704948425,
-1.0458478927612305,
0.9548082947731018,
-0.5497004985809326,
-1.1285866498947144,
-1.492067575454712,
0.07712852209806442,
-0.08160728216171265,
0.9161662459373474,
-1.5962311029434204,
-0.11612749844789505,
1.2998344898223877,
0.905302107334137,
-0.6949282884597778,
1.1393598318099976,
0.2765551507472992,
1.0223251581192017,
0.8004650473594666,
-0.36835166811943054,
0.6099039912223816,
0.057775259017944336,
-1.3702472448349,
0.5118402242660522,
1.161612868309021,
0.25127407908439636,
1.5377132892608643,
-0.6369185447692871,
-0.07489747554063797,
0.43556877970695496,
-0.6598762273788452,
-0.43065428733825684,
-0.49863868951797485,
0.7044742107391357,
-0.059762317687273026,
-0.8690316081047058,
0.053008392453193665,
-0.08602244406938553,
-0.1944335252046585,
0.1129060760140419,
-1.4900660514831543,
-0.10857226699590683,
-0.3305414021015167,
-0.6443291902542114,
-1.3088690042495728,
-0.022847730666399002,
1.4261952638626099,
-0.8287856578826904,
-0.22520457208156586,
0.39243265986442566,
0.4298798441886902,
0.5205701589584351,
0.6849004030227661,
-0.6297410726547241,
-0.29111358523368835,
-0.18237313628196716,
-0.29901835322380066,
0.35390663146972656,
1.4076448678970337,
-0.12418949604034424,
-0.9984703063964844,
0.7447238564491272,
-0.3212330937385559,
0.07376054674386978,
1.917019248008728,
0.11616790294647217,
-0.8219470381736755,
0.2730754315853119,
-0.7509710788726807,
1.9687995910644531,
1.657674789428711,
1.3370026350021362,
-0.22311443090438843,
-0.9359429478645325,
0.6253951787948608,
-0.39307111501693726,
-0.38142654299736023,
0.8846217393875122,
0.43858301639556885,
-0.2205999195575714,
-1.2919963598251343,
0.7201113104820251,
1.222514271736145,
-0.8710130453109741,
-0.8461534380912781,
0.21387141942977905,
-0.7629655599594116,
1.0719643831253052,
0.6774079203605652,
0.39983507990837097,
0.24147549271583557,
1.606113314628601,
0.8039195537567139,
-0.5606020092964172,
0.5551372170448303,
0.5044341087341309,
-0.25143003463745117,
-2.1217989921569824,
-1.1059330701828003,
0.38332727551460266,
-0.605298638343811,
-1.6160612106323242,
1.3816465139389038,
-1.0602988004684448,
-1.016188621520996,
0.5362488627433777,
0.04867292568087578,
1.4239052534103394,
0.3737947940826416,
1.5541837215423584,
2.035438299179077,
0.8507381081581116,
0.4612227976322174,
1.2828835248947144,
-0.18621918559074402,
-0.5037094354629517,
1.8264073133468628,
-0.45663192868232727,
0.45534732937812805,
1.1414353847503662,
-0.3212839365005493,
-1.03104567527771,
-0.7355055809020996,
-1.1753686666488647,
-0.6607353091239929,
1.1003668308258057,
0.16910292208194733,
-1.0955718755722046,
0.24426904320716858,
1.4897537231445312,
0.12844321131706238,
-0.3664528727531433,
0.6440498232841492,
0.3222862184047699,
-0.7857758402824402,
0.004406985826790333,
-0.9806360602378845,
0.5440222024917603,
-0.2870256006717682,
-0.32590872049331665,
0.32279351353645325,
0.39824730157852173,
1.3347840309143066,
-0.045614153146743774,
0.17215335369110107,
1.1572118997573853,
-1.3649075031280518,
1.4894636869430542,
-0.6449925899505615,
0.2688893973827362,
-2.2688262462615967,
1.2844533920288086,
-0.8029929399490356,
1.9737588167190552,
-2.69169020652771,
0.45761406421661377,
-0.6762818694114685,
-0.45407700538635254,
0.3321778178215027,
-0.35529905557632446,
0.07486776262521744,
-0.14165228605270386,
-1.15927255153656,
-0.0519951730966568,
-0.7132949829101562,
0.5527268052101135,
1.112611174583435,
1.2983803749084473,
-1.1032793521881104,
-0.25698357820510864,
-1.7158437967300415,
-0.16393354535102844,
-0.8286408185958862,
0.4721251428127289,
-2.0392322540283203,
-0.20911775529384613,
-1.8904272317886353,
-2.339359998703003,
-1.1872934103012085,
-0.8320444822311401,
1.1487255096435547,
0.16628381609916687,
-0.8474240303039551,
1.24372136592865,
-0.2978067398071289,
-1.8446353673934937,
1.0334973335266113,
-2.079883337020874
] |
https://github.com/huggingface/datasets/issues/6079 | Iterating over DataLoader based on HF datasets is stuck forever | Thanks @mariosasko for your prompt response, here's the stack trace:
```
KeyboardInterrupt Traceback (most recent call last)
Cell In[12], line 4
2 t = time.time()
3 iter_ = 0
----> 4 for batch in train_dataloader:
5 #batch_proc = streaming_obj.collect_streaming_data_batch(batch)
6 iter_ += 1
8 if iter_ == 1:
File ~/anaconda3/envs/pytorch_p310/lib/python3.10/site-packages/torch/utils/data/dataloader.py:634, in _BaseDataLoaderIter.__next__(self)
631 if self._sampler_iter is None:
632 # TODO(https://github.com/pytorch/pytorch/issues/76750)
633 self._reset() # type: ignore[call-arg]
--> 634 data = self._next_data()
635 self._num_yielded += 1
636 if self._dataset_kind == _DatasetKind.Iterable and \
637 self._IterableDataset_len_called is not None and \
638 self._num_yielded > self._IterableDataset_len_called:
File ~/anaconda3/envs/pytorch_p310/lib/python3.10/site-packages/torch/utils/data/dataloader.py:678, in _SingleProcessDataLoaderIter._next_data(self)
676 def _next_data(self):
677 index = self._next_index() # may raise StopIteration
--> 678 data = self._dataset_fetcher.fetch(index) # may raise StopIteration
679 if self._pin_memory:
680 data = _utils.pin_memory.pin_memory(data, self._pin_memory_device)
File ~/anaconda3/envs/pytorch_p310/lib/python3.10/site-packages/torch/utils/data/_utils/fetch.py:32, in _IterableDatasetFetcher.fetch(self, possibly_batched_index)
30 for _ in possibly_batched_index:
31 try:
---> 32 data.append(next(self.dataset_iter))
33 except StopIteration:
34 self.ended = True
File ~/anaconda3/envs/pytorch_p310/lib/python3.10/site-packages/datasets/iterable_dataset.py:1353, in IterableDataset.__iter__(self)
1350 yield formatter.format_row(pa_table)
1351 return
-> 1353 for key, example in ex_iterable:
1354 if self.features:
1355 # `IterableDataset` automatically fills missing columns with None.
1356 # This is done with `_apply_feature_types_on_example`.
1357 example = _apply_feature_types_on_example(
1358 example, self.features, token_per_repo_id=self._token_per_repo_id
1359 )
File ~/anaconda3/envs/pytorch_p310/lib/python3.10/site-packages/datasets/iterable_dataset.py:956, in BufferShuffledExamplesIterable.__iter__(self)
954 # this is the shuffle buffer that we keep in memory
955 mem_buffer = []
--> 956 for x in self.ex_iterable:
957 if len(mem_buffer) == buffer_size: # if the buffer is full, pick and example from it
958 i = next(indices_iterator)
File ~/anaconda3/envs/pytorch_p310/lib/python3.10/site-packages/datasets/iterable_dataset.py:296, in ShuffledDataSourcesArrowExamplesIterable.__iter__(self)
294 for key, pa_table in self.generate_tables_fn(**kwargs_with_shuffled_shards):
295 for pa_subtable in pa_table.to_reader(max_chunksize=config.ARROW_READER_BATCH_SIZE_IN_DATASET_ITER):
--> 296 formatted_batch = formatter.format_batch(pa_subtable)
297 for example in _batch_to_examples(formatted_batch):
298 yield key, example
File ~/anaconda3/envs/pytorch_p310/lib/python3.10/site-packages/datasets/formatting/formatting.py:448, in PythonFormatter.format_batch(self, pa_table)
446 if self.lazy:
447 return LazyBatch(pa_table, self)
--> 448 batch = self.python_arrow_extractor().extract_batch(pa_table)
449 batch = self.python_features_decoder.decode_batch(batch)
450 return batch
File ~/anaconda3/envs/pytorch_p310/lib/python3.10/site-packages/datasets/formatting/formatting.py:150, in PythonArrowExtractor.extract_batch(self, pa_table)
149 def extract_batch(self, pa_table: pa.Table) -> dict:
--> 150 return pa_table.to_pydict()
KeyboardInterrupt:
```
| ### Describe the bug
I am using Amazon Sagemaker notebook (Amazon Linux 2) with python 3.10 based Conda environment.
I have a dataset in parquet format locally. When I try to iterate over it, the loader is stuck forever. Note that the same code is working for python 3.6 based conda environment seamlessly. What should be my next steps here?
### Steps to reproduce the bug
```
train_dataset = load_dataset(
"parquet", data_files = {'train': tr_data_path + '*.parquet'},
split = 'train',
collate_fn = streaming_data_collate_fn,
streaming = True
).with_format('torch')
train_dataloader = DataLoader(train_dataset, batch_size = 2, num_workers = 0)
t = time.time()
iter_ = 0
for batch in train_dataloader:
iter_ += 1
if iter_ == 1000:
break
print (time.time() - t)
```
### Expected behavior
The snippet should work normally and load the next batch of data.
### Environment info
datasets: '2.14.0'
pyarrow: '12.0.0'
torch: '2.0.0'
Python: 3.10.10 | packaged by conda-forge | (main, Mar 24 2023, 20:08:06) [GCC 11.3.0]
!uname -r
5.10.178-162.673.amzn2.x86_64 | 45 | 308 | Iterating over DataLoader based on HF datasets is stuck forever
### Describe the bug
I am using Amazon Sagemaker notebook (Amazon Linux 2) with python 3.10 based Conda environment.
I have a dataset in parquet format locally. When I try to iterate over it, the loader is stuck forever. Note that the same code is working for python 3.6 based conda environment seamlessly. What should be my next steps here?
### Steps to reproduce the bug
```
train_dataset = load_dataset(
"parquet", data_files = {'train': tr_data_path + '*.parquet'},
split = 'train',
collate_fn = streaming_data_collate_fn,
streaming = True
).with_format('torch')
train_dataloader = DataLoader(train_dataset, batch_size = 2, num_workers = 0)
t = time.time()
iter_ = 0
for batch in train_dataloader:
iter_ += 1
if iter_ == 1000:
break
print (time.time() - t)
```
### Expected behavior
The snippet should work normally and load the next batch of data.
### Environment info
datasets: '2.14.0'
pyarrow: '12.0.0'
torch: '2.0.0'
Python: 3.10.10 | packaged by conda-forge | (main, Mar 24 2023, 20:08:06) [GCC 11.3.0]
!uname -r
5.10.178-162.673.amzn2.x86_64
Thanks @mariosasko for your prompt response, here's the stack trace:
```
KeyboardInterrupt Traceback (most recent call last)
Cell In[12], line 4
2 t = time.time()
3 iter_ = 0
----> 4 for batch in train_dataloader:
5 #batch_proc = streaming_obj.collect_streaming_data_batch(batch)
6 iter_ += 1
8 if iter_ == 1:
File ~/anaconda3/envs/pytorch_p310/lib/python3.10/site-packages/torch/utils/data/dataloader.py:634, in _BaseDataLoaderIter.__next__(self)
631 if self._sampler_iter is None:
632 # TODO(https://github.com/pytorch/pytorch/issues/76750)
633 self._reset() # type: ignore[call-arg]
--> 634 data = self._next_data()
635 self._num_yielded += 1
636 if self._dataset_kind == _DatasetKind.Iterable and \
637 self._IterableDataset_len_called is not None and \
638 self._num_yielded > self._IterableDataset_len_called:
File ~/anaconda3/envs/pytorch_p310/lib/python3.10/site-packages/torch/utils/data/dataloader.py:678, in _SingleProcessDataLoaderIter._next_data(self)
676 def _next_data(self):
677 index = self._next_index() # may raise StopIteration
--> 678 data = self._dataset_fetcher.fetch(index) # may raise StopIteration
679 if self._pin_memory:
680 data = _utils.pin_memory.pin_memory(data, self._pin_memory_device)
File ~/anaconda3/envs/pytorch_p310/lib/python3.10/site-packages/torch/utils/data/_utils/fetch.py:32, in _IterableDatasetFetcher.fetch(self, possibly_batched_index)
30 for _ in possibly_batched_index:
31 try:
---> 32 data.append(next(self.dataset_iter))
33 except StopIteration:
34 self.ended = True
File ~/anaconda3/envs/pytorch_p310/lib/python3.10/site-packages/datasets/iterable_dataset.py:1353, in IterableDataset.__iter__(self)
1350 yield formatter.format_row(pa_table)
1351 return
-> 1353 for key, example in ex_iterable:
1354 if self.features:
1355 # `IterableDataset` automatically fills missing columns with None.
1356 # This is done with `_apply_feature_types_on_example`.
1357 example = _apply_feature_types_on_example(
1358 example, self.features, token_per_repo_id=self._token_per_repo_id
1359 )
File ~/anaconda3/envs/pytorch_p310/lib/python3.10/site-packages/datasets/iterable_dataset.py:956, in BufferShuffledExamplesIterable.__iter__(self)
954 # this is the shuffle buffer that we keep in memory
955 mem_buffer = []
--> 956 for x in self.ex_iterable:
957 if len(mem_buffer) == buffer_size: # if the buffer is full, pick and example from it
958 i = next(indices_iterator)
File ~/anaconda3/envs/pytorch_p310/lib/python3.10/site-packages/datasets/iterable_dataset.py:296, in ShuffledDataSourcesArrowExamplesIterable.__iter__(self)
294 for key, pa_table in self.generate_tables_fn(**kwargs_with_shuffled_shards):
295 for pa_subtable in pa_table.to_reader(max_chunksize=config.ARROW_READER_BATCH_SIZE_IN_DATASET_ITER):
--> 296 formatted_batch = formatter.format_batch(pa_subtable)
297 for example in _batch_to_examples(formatted_batch):
298 yield key, example
File ~/anaconda3/envs/pytorch_p310/lib/python3.10/site-packages/datasets/formatting/formatting.py:448, in PythonFormatter.format_batch(self, pa_table)
446 if self.lazy:
447 return LazyBatch(pa_table, self)
--> 448 batch = self.python_arrow_extractor().extract_batch(pa_table)
449 batch = self.python_features_decoder.decode_batch(batch)
450 return batch
File ~/anaconda3/envs/pytorch_p310/lib/python3.10/site-packages/datasets/formatting/formatting.py:150, in PythonArrowExtractor.extract_batch(self, pa_table)
149 def extract_batch(self, pa_table: pa.Table) -> dict:
--> 150 return pa_table.to_pydict()
KeyboardInterrupt:
```
| [
-1.2974315881729126,
-1.0190706253051758,
-0.664889931678772,
1.5647151470184326,
-0.20822866261005402,
-1.1625877618789673,
0.14594830572605133,
-0.9586323499679565,
1.6330128908157349,
-0.8328601121902466,
0.23161981999874115,
-1.5734355449676514,
0.07717040926218033,
-0.5745692253112793,
-0.6595275402069092,
-0.8466547727584839,
-0.39662471413612366,
-0.7842761278152466,
1.2154903411865234,
2.4511895179748535,
1.237916111946106,
-1.4425482749938965,
2.78933048248291,
0.7293189764022827,
-0.20174670219421387,
-1.0366055965423584,
0.4464857578277588,
-0.0007076840847730637,
-1.3154724836349487,
-0.4695713222026825,
-0.9860295057296753,
-0.08348206430673599,
-0.5744655132293701,
-0.41258174180984497,
0.002774057909846306,
0.3928353488445282,
-0.28975141048431396,
-0.4741595983505249,
-0.5439647436141968,
-0.7093861103057861,
0.43302735686302185,
-0.39043575525283813,
0.9140236377716064,
-0.3093401789665222,
1.8050541877746582,
-0.4824230968952179,
0.4806284010410309,
0.7403391599655151,
1.2507603168487549,
0.19071391224861145,
-0.047029878944158554,
0.37540730834007263,
0.41215452551841736,
-0.02031799592077732,
0.5861753225326538,
1.1431115865707397,
0.6457462310791016,
0.44389820098876953,
0.6579923629760742,
-2.2479546070098877,
1.3083926439285278,
-1.0043361186981201,
0.2921927571296692,
1.3213930130004883,
-1.0259860754013062,
0.4218312203884125,
-1.7281049489974976,
-0.011900633573532104,
0.6921530961990356,
-2.2300031185150146,
0.32679232954978943,
-1.3494404554367065,
-0.5030272006988525,
1.0448921918869019,
0.35023263096809387,
-1.1999526023864746,
0.07853835076093674,
-0.48854026198387146,
1.1119210720062256,
0.3932235538959503,
1.0699409246444702,
-1.6642804145812988,
-0.07834865152835846,
-0.2794768810272217,
0.12058286368846893,
-1.3335446119308472,
-1.5475013256072998,
0.5616384744644165,
0.7034008502960205,
0.5724160671234131,
-0.11761819571256638,
1.1313377618789673,
-1.0776281356811523,
0.7713961601257324,
-1.1007808446884155,
-1.7119488716125488,
-1.4597465991973877,
-2.4179627895355225,
-2.292955160140991,
0.6830970048904419,
-0.39806365966796875,
-0.5272600650787354,
2.1069302558898926,
-1.0400196313858032,
-1.705418348312378,
1.1887396574020386,
0.17578700184822083,
0.022946961224079132,
2.3559136390686035,
0.1920415610074997,
-0.765386700630188,
0.46486955881118774,
-0.8092259168624878,
0.6966451406478882,
-0.3308613896369934,
1.3453669548034668,
0.38290274143218994,
-1.0034589767456055,
1.5773460865020752,
-0.3131062686443329,
0.585328221321106,
-0.6357043981552124,
-0.508878231048584,
-0.7354837656021118,
0.24571484327316284,
1.9951517581939697,
-0.25977861881256104,
1.4806616306304932,
-0.3340049386024475,
-1.5114643573760986,
-1.6016238927841187,
0.931921124458313,
0.43781712651252747,
-0.7742691040039062,
0.15491105616092682,
-0.3656656742095947,
0.17815904319286346,
-0.09961570054292679,
1.1182377338409424,
1.275490403175354,
0.6725599765777588,
-0.39291298389434814,
-0.9345260858535767,
0.22334550321102142,
-0.17127320170402527,
-0.6492434740066528,
-1.7915822267532349,
-0.34437307715415955,
0.03302781656384468,
0.6869486570358276,
-1.214296817779541,
1.6929903030395508,
0.9106225967407227,
1.9142582416534424,
1.0374977588653564,
-0.32771873474121094,
1.5117660760879517,
0.15192483365535736,
1.8245221376419067,
-0.4701645076274872,
0.6367555856704712,
-0.39354103803634644,
-1.1332824230194092,
0.7346843481063843,
-0.33168160915374756,
-1.9986943006515503,
-0.6729686260223389,
-0.7714685201644897,
-0.21216441690921783,
-0.7946441173553467,
0.8935492038726807,
-0.280135840177536,
-1.4753475189208984,
0.29628786444664,
-0.7360696792602539,
0.20007754862308502,
-1.2035003900527954,
0.38214147090911865,
0.6870520114898682,
-0.55238938331604,
0.1074657067656517,
-0.2864062786102295,
-1.257946491241455,
-0.4712546169757843,
0.3664557933807373,
1.8429837226867676,
-0.7364523410797119,
0.8943115472793579,
1.1183193922042847,
-0.6793093681335449,
0.022726833820343018,
0.286374032497406,
-0.23834820091724396,
0.8519396781921387,
-1.0283764600753784,
-0.46608999371528625,
1.2272589206695557,
-0.3373734652996063,
-0.5997359752655029,
1.488410472869873,
0.7421954870223999,
-1.0281431674957275,
-0.2913720905780792,
-0.08610827475786209,
-0.7972085475921631,
0.1255784034729004,
-1.5994362831115723,
-0.1683555394411087,
0.4468134343624115,
-1.5731736421585083,
-0.43235689401626587,
-0.20999504625797272,
1.4142119884490967,
-0.09522038698196411,
1.500401496887207,
-0.3596504032611847,
-0.16738206148147583,
-0.2917817234992981,
-0.39426255226135254,
0.19034990668296814,
-0.18658055365085602,
-0.5768311023712158,
0.13995225727558136,
-0.7734682559967041,
0.3371564447879791,
1.4466079473495483,
0.3223623037338257,
0.02454768866300583,
0.4766293168067932,
1.0540162324905396,
0.43001917004585266,
-0.020220180973410606,
-0.8831686973571777,
-1.5278433561325073,
1.9414390325546265,
-1.46524977684021,
2.065664291381836,
0.7966251373291016,
-0.03148699179291725,
-1.7717210054397583,
-1.8430423736572266,
1.3789745569229126,
1.0823893547058105,
2.3323378562927246,
0.5119791030883789,
0.3722262978553772,
-0.8693242073059082,
-0.6737273931503296,
0.2784413993358612,
-0.9613075256347656,
-0.7678860425949097,
0.18558314442634583,
2.46087384223938,
1.7614370584487915,
-0.35076820850372314,
-0.12249372899532318,
-0.9562599658966064,
1.4128732681274414,
-0.16201330721378326,
0.2993030250072479,
1.9830257892608643,
-0.2261635810136795,
-0.9870784282684326,
1.237268090248108,
-2.425037145614624,
0.1866775006055832,
2.0674188137054443,
0.2805667817592621,
0.12595194578170776,
-1.3875333070755005,
-0.6270977258682251,
-0.3028932809829712,
-0.4568064510822296,
-1.2132331132888794,
0.528445839881897,
-0.3495781421661377,
-0.7751508951187134,
-1.4387212991714478,
0.21036259829998016,
-1.0730477571487427,
-1.6561133861541748,
0.18457263708114624,
1.8898676633834839,
2.0517802238464355,
-0.77681565284729,
1.5526061058044434,
-0.3596724569797516,
0.21321387588977814,
1.244329810142517,
1.239706039428711,
3.1417713165283203,
1.9815956354141235,
-1.2584534883499146,
0.6730904579162598,
-0.15262708067893982,
-0.4433174431324005,
1.0921788215637207,
-1.2360126972198486,
1.3534902334213257,
-0.12275800853967667,
-1.2071703672409058,
-1.1936264038085938,
0.9830225706100464,
0.5702880620956421,
-0.0039474014192819595,
-0.46414196491241455,
1.1965686082839966,
0.0817684680223465,
1.291514277458191,
0.4820803105831146,
-0.3591058850288391,
0.6448630094528198,
-0.4228191077709198,
-0.4979744553565979,
1.542911171913147,
0.16641990840435028,
-1.445759892463684,
-2.2055087089538574,
-0.25104618072509766,
-0.8699507713317871,
0.007389534264802933,
-0.6748964786529541,
-0.9920562505722046,
1.6028532981872559,
0.32562512159347534,
-1.2264509201049805,
-0.2215774804353714,
-0.3327009379863739,
-0.5217937231063843,
2.703495979309082,
-1.2969717979431152,
-0.27301424741744995,
-0.9633967876434326,
-0.6414002180099487,
1.6460157632827759,
-1.2173091173171997,
-0.2823849320411682,
-0.9916144609451294,
-0.6121084690093994,
-1.2310702800750732,
-0.49312272667884827,
-0.013487457297742367,
-0.8998270034790039,
0.8830004930496216,
0.1841505467891693,
-1.2417614459991455,
-0.32991838455200195,
-0.9354161024093628,
0.9293602705001831,
-0.05915849655866623,
0.1919061243534088,
1.7894272804260254,
0.26145729422569275,
-0.4672712981700897,
0.7624393701553345,
1.1166250705718994,
0.6360664367675781,
-0.6843897104263306,
0.20604147017002106,
-0.6426552534103394,
0.37114253640174866,
-1.2035964727401733,
0.34845468401908875,
-2.960057258605957,
0.6312177181243896,
-0.009770376607775688,
-0.041609473526477814,
-0.050903063267469406,
-1.2995798587799072,
1.1160783767700195,
2.549694299697876,
-1.152135968208313,
0.5242035388946533,
0.4052266478538513,
1.2138795852661133,
-1.5841577053070068,
0.3113504946231842,
-0.44616955518722534,
2.10622501373291,
0.21061865985393524,
1.2435986995697021,
-0.4241533577442169,
-2.355393648147583,
0.6719157695770264,
-1.2532589435577393,
-1.1517608165740967,
0.740466833114624,
-0.951149582862854,
0.12970459461212158,
-1.3532981872558594,
-0.27820056676864624,
-0.8494549989700317,
-1.1703068017959595,
0.6605517864227295,
0.19532738626003265,
0.4015110731124878,
-0.5882132053375244,
0.31360840797424316,
-2.198518991470337,
-1.3115651607513428,
-0.20542481541633606,
-0.9809938669204712,
0.45399603247642517,
-0.4049965441226959,
0.6766836643218994,
-0.17170177400112152,
0.027229156345129013,
0.31388023495674133,
1.4174591302871704,
3.3344380855560303,
0.09112998098134995,
0.3093468248844147,
-0.19747653603553772,
-0.9254173040390015,
1.4991672039031982,
0.8865240812301636,
-0.14270009100437164,
-0.4922974109649658,
-1.1263760328292847,
1.2723448276519775,
1.9096494913101196,
0.9586502313613892,
0.02348141372203827,
-0.7994235754013062,
-0.7034412622451782,
-0.07220598310232162,
0.13964134454727173,
0.4972018897533417,
0.9051336050033569,
0.051836639642715454,
0.10717020183801651,
1.4481327533721924,
1.1444321870803833,
-0.45602989196777344,
0.3242008686065674,
-0.8552771806716919,
-0.47204646468162537,
0.462861567735672,
0.2674572169780731,
-0.01140761747956276,
0.2616954743862152,
-0.9798003435134888,
-0.19734638929367065,
-0.4073490500450134,
-0.914859414100647,
-0.6889843940734863,
-0.41088101267814636,
-0.3630508482456207,
1.620431661605835,
0.16484655439853668,
-0.5099267959594727,
-0.021090425550937653,
-0.742570161819458,
-0.08113440871238708,
-1.1182055473327637,
0.26265057921409607,
-0.12230090796947479,
-0.10812405496835709,
-0.16154897212982178,
1.7069978713989258,
-0.9098165035247803,
-2.082085609436035,
0.18326891958713531,
0.19539563357830048,
-0.2030942738056183,
0.2828911244869232,
1.6777479648590088,
0.4934982359409332,
1.474306583404541,
1.3193210363388062,
0.9977390766143799,
-0.6242878437042236,
-1.341513752937317,
0.7503904104232788,
0.9886714220046997,
-1.4026501178741455,
0.8068922758102417,
-0.03409628942608833,
-0.5097527503967285,
0.6658357381820679,
1.281624674797058,
0.49682942032814026,
-2.0842509269714355,
0.8261981010437012,
-1.0345215797424316,
0.775672197341919,
0.7252103090286255,
0.6593869924545288,
0.21586906909942627,
0.8628050088882446,
-1.1530572175979614,
-1.1376219987869263,
-0.6996839046478271,
-0.7225641012191772,
1.9848476648330688,
-0.3296138048171997,
0.5628201961517334,
-0.198027566075325,
-1.3615005016326904,
0.009760832414031029,
0.668104887008667,
0.3455798327922821,
-0.4636423587799072,
0.7962764501571655,
-0.7743848562240601,
-1.1914671659469604,
-1.3486230373382568,
-0.46238648891448975,
-1.0717453956604004,
-0.9823184013366699,
1.0737836360931396,
0.7329951524734497,
0.2999485731124878,
1.8899658918380737,
0.6049156188964844,
0.2987484931945801,
-2.6060850620269775,
0.9720355272293091,
0.21737666428089142,
-0.05081312730908394,
0.8372375965118408,
0.25154948234558105,
1.0437827110290527,
0.024465616792440414,
0.5154883861541748,
-2.3992927074432373,
2.3001954555511475,
-0.2276591658592224,
0.657784104347229,
-0.011395727284252644,
-0.1130533516407013,
1.0781478881835938,
0.6164729595184326,
0.6271088123321533,
-1.0225616693496704,
0.7308287620544434,
-0.5704690217971802,
1.2804566621780396,
0.8171708583831787,
-0.8166124820709229,
-0.06528323888778687,
1.2711116075515747,
0.432098388671875,
-0.5609716176986694,
-0.92247474193573,
-1.0596727132797241,
0.9370721578598022,
1.6832667589187622,
-0.06290261447429657,
-0.030089907348155975,
0.8181744813919067,
0.6693830490112305,
-1.2592216730117798,
0.03864346444606781,
-0.7042809724807739,
-0.7071369886398315,
1.5619490146636963,
2.060899019241333,
-0.1671404242515564,
-0.20244130492210388,
-0.7099497318267822,
-1.3029723167419434,
0.7419188022613525,
-0.08203078806400299,
0.05741816759109497,
0.6271876096725464,
-0.5704121589660645,
0.9741095304489136,
0.7935813665390015,
0.8971580266952515,
0.16694359481334686,
0.2219746708869934,
0.4009399712085724,
-0.3587762117385864,
-1.2118083238601685,
-0.25831007957458496,
-1.0014817714691162,
-2.544210195541382,
0.4239689111709595,
-0.12097016721963882,
-1.3572509288787842,
0.07000209391117096,
-1.0495102405548096,
0.9120780229568481,
-0.5535584688186646,
-1.1449333429336548,
-1.4706090688705444,
0.08204201608896255,
-0.10747477412223816,
0.9028313159942627,
-1.6043668985366821,
-0.0987391248345375,
1.2640069723129272,
0.9058187007904053,
-0.6740248203277588,
1.1002376079559326,
0.2887752652168274,
1.043515682220459,
0.840786337852478,
-0.371063232421875,
0.5943365097045898,
0.05355599522590637,
-1.3454481363296509,
0.5073436498641968,
1.1872164011001587,
0.2508043944835663,
1.5639854669570923,
-0.6105499267578125,
-0.08315184712409973,
0.4376988112926483,
-0.6721184253692627,
-0.45088446140289307,
-0.5130777359008789,
0.7196526527404785,
-0.0630444884300232,
-0.8875824213027954,
-0.011190256103873253,
-0.12696465849876404,
-0.20857401192188263,
0.0945534035563469,
-1.5000231266021729,
-0.07255498319864273,
-0.34967562556266785,
-0.6303430795669556,
-1.3228659629821777,
-0.019764654338359833,
1.4293354749679565,
-0.8177623748779297,
-0.2548235058784485,
0.3891848623752594,
0.40680456161499023,
0.5039209127426147,
0.6839631795883179,
-0.6587836742401123,
-0.29087695479393005,
-0.15814559161663055,
-0.3228982388973236,
0.3624856173992157,
1.4135997295379639,
-0.10769721120595932,
-0.9860594272613525,
0.704243540763855,
-0.3554786443710327,
0.08115480095148087,
1.9146473407745361,
0.10111267864704132,
-0.7790087461471558,
0.27839961647987366,
-0.7783399820327759,
1.950376272201538,
1.6746764183044434,
1.3469010591506958,
-0.22584085166454315,
-0.9031214714050293,
0.628567099571228,
-0.43571481108665466,
-0.38213425874710083,
0.8721033334732056,
0.41456761956214905,
-0.25996625423431396,
-1.329418659210205,
0.7269880771636963,
1.2084258794784546,
-0.8532381057739258,
-0.7835807800292969,
0.18013109266757965,
-0.7536741495132446,
1.1136720180511475,
0.6783825159072876,
0.3761061429977417,
0.26443350315093994,
1.6063339710235596,
0.7943588495254517,
-0.5305664539337158,
0.5592383146286011,
0.48734936118125916,
-0.2412204146385193,
-2.1619086265563965,
-1.1275370121002197,
0.3625762164592743,
-0.569381594657898,
-1.6054171323776245,
1.3758591413497925,
-1.0798474550247192,
-1.0278271436691284,
0.507063627243042,
0.06218058615922928,
1.389482021331787,
0.3866254687309265,
1.5667616128921509,
2.0799031257629395,
0.8709074258804321,
0.48542162775993347,
1.2611982822418213,
-0.21516883373260498,
-0.4960423409938812,
1.8438345193862915,
-0.4678105413913727,
0.4639221131801605,
1.1142040491104126,
-0.312423437833786,
-1.0783714056015015,
-0.7584275007247925,
-1.2116954326629639,
-0.6679356098175049,
1.1171327829360962,
0.12617790699005127,
-1.0921059846878052,
0.2544533610343933,
1.491093397140503,
0.12469863891601562,
-0.3442084789276123,
0.6723824739456177,
0.3098609745502472,
-0.761608362197876,
-0.012444091960787773,
-0.928748607635498,
0.5588490962982178,
-0.31223198771476746,
-0.32909563183784485,
0.3080487549304962,
0.45684143900871277,
1.3419287204742432,
-0.041716400533914566,
0.12988914549350739,
1.1802091598510742,
-1.3884761333465576,
1.4788414239883423,
-0.679023027420044,
0.28262484073638916,
-2.291278839111328,
1.297744870185852,
-0.819218635559082,
1.9794038534164429,
-2.7184412479400635,
0.47755947709083557,
-0.6317075490951538,
-0.48454800248146057,
0.3110902011394501,
-0.3236274719238281,
0.05860303342342377,
-0.14126934111118317,
-1.1567353010177612,
-0.02646554820239544,
-0.6725512742996216,
0.5580421686172485,
1.1093693971633911,
1.309055209159851,
-1.1293411254882812,
-0.219875767827034,
-1.7445155382156372,
-0.1464066058397293,
-0.8403385877609253,
0.43298739194869995,
-2.030527114868164,
-0.2145586460828781,
-1.9183084964752197,
-2.340012788772583,
-1.1703801155090332,
-0.8103485107421875,
1.141724705696106,
0.178611159324646,
-0.8698126077651978,
1.260519027709961,
-0.33546456694602966,
-1.8333860635757446,
1.0353522300720215,
-2.085683584213257
] |
https://github.com/huggingface/datasets/issues/6079 | Iterating over DataLoader based on HF datasets is stuck forever | Update: If i let it run, it eventually fails with:
```
RuntimeError Traceback (most recent call last)
Cell In[16], line 4
2 t = time.time()
3 iter_ = 0
----> 4 for batch in train_dataloader:
5 #batch_proc = streaming_obj.collect_streaming_data_batch(batch)
6 iter_ += 1
8 if iter_ == 1:
File ~/anaconda3/envs/pytorch_p310/lib/python3.10/site-packages/torch/utils/data/dataloader.py:634, in _BaseDataLoaderIter.__next__(self)
631 if self._sampler_iter is None:
632 # TODO(https://github.com/pytorch/pytorch/issues/76750)
633 self._reset() # type: ignore[call-arg]
--> 634 data = self._next_data()
635 self._num_yielded += 1
636 if self._dataset_kind == _DatasetKind.Iterable and \
637 self._IterableDataset_len_called is not None and \
638 self._num_yielded > self._IterableDataset_len_called:
File ~/anaconda3/envs/pytorch_p310/lib/python3.10/site-packages/torch/utils/data/dataloader.py:678, in _SingleProcessDataLoaderIter._next_data(self)
676 def _next_data(self):
677 index = self._next_index() # may raise StopIteration
--> 678 data = self._dataset_fetcher.fetch(index) # may raise StopIteration
679 if self._pin_memory:
680 data = _utils.pin_memory.pin_memory(data, self._pin_memory_device)
File ~/anaconda3/envs/pytorch_p310/lib/python3.10/site-packages/torch/utils/data/_utils/fetch.py:32, in _IterableDatasetFetcher.fetch(self, possibly_batched_index)
30 for _ in possibly_batched_index:
31 try:
---> 32 data.append(next(self.dataset_iter))
33 except StopIteration:
34 self.ended = True
File ~/anaconda3/envs/pytorch_p310/lib/python3.10/site-packages/datasets/iterable_dataset.py:1360, in IterableDataset.__iter__(self)
1354 if self.features:
1355 # `IterableDataset` automatically fills missing columns with None.
1356 # This is done with `_apply_feature_types_on_example`.
1357 example = _apply_feature_types_on_example(
1358 example, self.features, token_per_repo_id=self._token_per_repo_id
1359 )
-> 1360 yield format_dict(example) if format_dict else example
File ~/anaconda3/envs/pytorch_p310/lib/python3.10/site-packages/datasets/formatting/torch_formatter.py:85, in TorchFormatter.recursive_tensorize(self, data_struct)
84 def recursive_tensorize(self, data_struct: dict):
---> 85 return map_nested(self._recursive_tensorize, data_struct, map_list=False)
File ~/anaconda3/envs/pytorch_p310/lib/python3.10/site-packages/datasets/utils/py_utils.py:463, in map_nested(function, data_struct, dict_only, map_list, map_tuple, map_numpy, num_proc, parallel_min_length, types, disable_tqdm, desc)
461 num_proc = 1
462 if num_proc != -1 and num_proc <= 1 or len(iterable) < parallel_min_length:
--> 463 mapped = [
464 _single_map_nested((function, obj, types, None, True, None))
465 for obj in logging.tqdm(iterable, disable=disable_tqdm, desc=desc)
466 ]
467 else:
468 mapped = parallel_map(function, iterable, num_proc, types, disable_tqdm, desc, _single_map_nested)
File ~/anaconda3/envs/pytorch_p310/lib/python3.10/site-packages/datasets/utils/py_utils.py:464, in <listcomp>(.0)
461 num_proc = 1
462 if num_proc != -1 and num_proc <= 1 or len(iterable) < parallel_min_length:
463 mapped = [
--> 464 _single_map_nested((function, obj, types, None, True, None))
465 for obj in logging.tqdm(iterable, disable=disable_tqdm, desc=desc)
466 ]
467 else:
468 mapped = parallel_map(function, iterable, num_proc, types, disable_tqdm, desc, _single_map_nested)
File ~/anaconda3/envs/pytorch_p310/lib/python3.10/site-packages/datasets/utils/py_utils.py:366, in _single_map_nested(args)
364 # Singleton first to spare some computation
365 if not isinstance(data_struct, dict) and not isinstance(data_struct, types):
--> 366 return function(data_struct)
368 # Reduce logging to keep things readable in multiprocessing with tqdm
369 if rank is not None and logging.get_verbosity() < logging.WARNING:
File ~/anaconda3/envs/pytorch_p310/lib/python3.10/site-packages/datasets/formatting/torch_formatter.py:82, in TorchFormatter._recursive_tensorize(self, data_struct)
80 elif isinstance(data_struct, (list, tuple)):
81 return self._consolidate([self.recursive_tensorize(substruct) for substruct in data_struct])
---> 82 return self._tensorize(data_struct)
File ~/anaconda3/envs/pytorch_p310/lib/python3.10/site-packages/datasets/formatting/torch_formatter.py:68, in TorchFormatter._tensorize(self, value)
66 if isinstance(value, PIL.Image.Image):
67 value = np.asarray(value)
---> 68 return torch.tensor(value, **{**default_dtype, **self.torch_tensor_kwargs})
RuntimeError: Could not infer dtype of decimal.Decimal
``` | ### Describe the bug
I am using Amazon Sagemaker notebook (Amazon Linux 2) with python 3.10 based Conda environment.
I have a dataset in parquet format locally. When I try to iterate over it, the loader is stuck forever. Note that the same code is working for python 3.6 based conda environment seamlessly. What should be my next steps here?
### Steps to reproduce the bug
```
train_dataset = load_dataset(
"parquet", data_files = {'train': tr_data_path + '*.parquet'},
split = 'train',
collate_fn = streaming_data_collate_fn,
streaming = True
).with_format('torch')
train_dataloader = DataLoader(train_dataset, batch_size = 2, num_workers = 0)
t = time.time()
iter_ = 0
for batch in train_dataloader:
iter_ += 1
if iter_ == 1000:
break
print (time.time() - t)
```
### Expected behavior
The snippet should work normally and load the next batch of data.
### Environment info
datasets: '2.14.0'
pyarrow: '12.0.0'
torch: '2.0.0'
Python: 3.10.10 | packaged by conda-forge | (main, Mar 24 2023, 20:08:06) [GCC 11.3.0]
!uname -r
5.10.178-162.673.amzn2.x86_64 | 45 | 416 | Iterating over DataLoader based on HF datasets is stuck forever
### Describe the bug
I am using Amazon Sagemaker notebook (Amazon Linux 2) with python 3.10 based Conda environment.
I have a dataset in parquet format locally. When I try to iterate over it, the loader is stuck forever. Note that the same code is working for python 3.6 based conda environment seamlessly. What should be my next steps here?
### Steps to reproduce the bug
```
train_dataset = load_dataset(
"parquet", data_files = {'train': tr_data_path + '*.parquet'},
split = 'train',
collate_fn = streaming_data_collate_fn,
streaming = True
).with_format('torch')
train_dataloader = DataLoader(train_dataset, batch_size = 2, num_workers = 0)
t = time.time()
iter_ = 0
for batch in train_dataloader:
iter_ += 1
if iter_ == 1000:
break
print (time.time() - t)
```
### Expected behavior
The snippet should work normally and load the next batch of data.
### Environment info
datasets: '2.14.0'
pyarrow: '12.0.0'
torch: '2.0.0'
Python: 3.10.10 | packaged by conda-forge | (main, Mar 24 2023, 20:08:06) [GCC 11.3.0]
!uname -r
5.10.178-162.673.amzn2.x86_64
Update: If i let it run, it eventually fails with:
```
RuntimeError Traceback (most recent call last)
Cell In[16], line 4
2 t = time.time()
3 iter_ = 0
----> 4 for batch in train_dataloader:
5 #batch_proc = streaming_obj.collect_streaming_data_batch(batch)
6 iter_ += 1
8 if iter_ == 1:
File ~/anaconda3/envs/pytorch_p310/lib/python3.10/site-packages/torch/utils/data/dataloader.py:634, in _BaseDataLoaderIter.__next__(self)
631 if self._sampler_iter is None:
632 # TODO(https://github.com/pytorch/pytorch/issues/76750)
633 self._reset() # type: ignore[call-arg]
--> 634 data = self._next_data()
635 self._num_yielded += 1
636 if self._dataset_kind == _DatasetKind.Iterable and \
637 self._IterableDataset_len_called is not None and \
638 self._num_yielded > self._IterableDataset_len_called:
File ~/anaconda3/envs/pytorch_p310/lib/python3.10/site-packages/torch/utils/data/dataloader.py:678, in _SingleProcessDataLoaderIter._next_data(self)
676 def _next_data(self):
677 index = self._next_index() # may raise StopIteration
--> 678 data = self._dataset_fetcher.fetch(index) # may raise StopIteration
679 if self._pin_memory:
680 data = _utils.pin_memory.pin_memory(data, self._pin_memory_device)
File ~/anaconda3/envs/pytorch_p310/lib/python3.10/site-packages/torch/utils/data/_utils/fetch.py:32, in _IterableDatasetFetcher.fetch(self, possibly_batched_index)
30 for _ in possibly_batched_index:
31 try:
---> 32 data.append(next(self.dataset_iter))
33 except StopIteration:
34 self.ended = True
File ~/anaconda3/envs/pytorch_p310/lib/python3.10/site-packages/datasets/iterable_dataset.py:1360, in IterableDataset.__iter__(self)
1354 if self.features:
1355 # `IterableDataset` automatically fills missing columns with None.
1356 # This is done with `_apply_feature_types_on_example`.
1357 example = _apply_feature_types_on_example(
1358 example, self.features, token_per_repo_id=self._token_per_repo_id
1359 )
-> 1360 yield format_dict(example) if format_dict else example
File ~/anaconda3/envs/pytorch_p310/lib/python3.10/site-packages/datasets/formatting/torch_formatter.py:85, in TorchFormatter.recursive_tensorize(self, data_struct)
84 def recursive_tensorize(self, data_struct: dict):
---> 85 return map_nested(self._recursive_tensorize, data_struct, map_list=False)
File ~/anaconda3/envs/pytorch_p310/lib/python3.10/site-packages/datasets/utils/py_utils.py:463, in map_nested(function, data_struct, dict_only, map_list, map_tuple, map_numpy, num_proc, parallel_min_length, types, disable_tqdm, desc)
461 num_proc = 1
462 if num_proc != -1 and num_proc <= 1 or len(iterable) < parallel_min_length:
--> 463 mapped = [
464 _single_map_nested((function, obj, types, None, True, None))
465 for obj in logging.tqdm(iterable, disable=disable_tqdm, desc=desc)
466 ]
467 else:
468 mapped = parallel_map(function, iterable, num_proc, types, disable_tqdm, desc, _single_map_nested)
File ~/anaconda3/envs/pytorch_p310/lib/python3.10/site-packages/datasets/utils/py_utils.py:464, in <listcomp>(.0)
461 num_proc = 1
462 if num_proc != -1 and num_proc <= 1 or len(iterable) < parallel_min_length:
463 mapped = [
--> 464 _single_map_nested((function, obj, types, None, True, None))
465 for obj in logging.tqdm(iterable, disable=disable_tqdm, desc=desc)
466 ]
467 else:
468 mapped = parallel_map(function, iterable, num_proc, types, disable_tqdm, desc, _single_map_nested)
File ~/anaconda3/envs/pytorch_p310/lib/python3.10/site-packages/datasets/utils/py_utils.py:366, in _single_map_nested(args)
364 # Singleton first to spare some computation
365 if not isinstance(data_struct, dict) and not isinstance(data_struct, types):
--> 366 return function(data_struct)
368 # Reduce logging to keep things readable in multiprocessing with tqdm
369 if rank is not None and logging.get_verbosity() < logging.WARNING:
File ~/anaconda3/envs/pytorch_p310/lib/python3.10/site-packages/datasets/formatting/torch_formatter.py:82, in TorchFormatter._recursive_tensorize(self, data_struct)
80 elif isinstance(data_struct, (list, tuple)):
81 return self._consolidate([self.recursive_tensorize(substruct) for substruct in data_struct])
---> 82 return self._tensorize(data_struct)
File ~/anaconda3/envs/pytorch_p310/lib/python3.10/site-packages/datasets/formatting/torch_formatter.py:68, in TorchFormatter._tensorize(self, value)
66 if isinstance(value, PIL.Image.Image):
67 value = np.asarray(value)
---> 68 return torch.tensor(value, **{**default_dtype, **self.torch_tensor_kwargs})
RuntimeError: Could not infer dtype of decimal.Decimal
``` | [
-1.270894169807434,
-1.0062732696533203,
-0.6609833240509033,
1.563029408454895,
-0.22833463549613953,
-1.170157790184021,
0.1303490400314331,
-0.9474954009056091,
1.6263947486877441,
-0.8306624889373779,
0.2395327091217041,
-1.5603952407836914,
0.07044895738363266,
-0.571514368057251,
-0.6682233810424805,
-0.8481132984161377,
-0.38888058066368103,
-0.7900111079216003,
1.2113761901855469,
2.447726011276245,
1.2367141246795654,
-1.4530816078186035,
2.7924020290374756,
0.7135749459266663,
-0.20393212139606476,
-1.0507735013961792,
0.4612964987754822,
0.003531821072101593,
-1.3130756616592407,
-0.45410963892936707,
-0.9846562147140503,
-0.08980898559093475,
-0.565320611000061,
-0.40126684308052063,
0.0046327076852321625,
0.384545236825943,
-0.2962914705276489,
-0.4764353334903717,
-0.5384969115257263,
-0.7073339223861694,
0.4402586817741394,
-0.38911867141723633,
0.9184447526931763,
-0.3024829030036926,
1.7972410917282104,
-0.47743141651153564,
0.47781845927238464,
0.745629608631134,
1.2453103065490723,
0.17432767152786255,
-0.049333758652210236,
0.3675185441970825,
0.40944740176200867,
-0.007601087912917137,
0.6044696569442749,
1.1289790868759155,
0.6601251363754272,
0.4477449357509613,
0.6471210718154907,
-2.2443552017211914,
1.3069473505020142,
-1.0050619840621948,
0.290302038192749,
1.2976293563842773,
-1.0123246908187866,
0.4160405397415161,
-1.7251654863357544,
0.00004809163510799408,
0.7029612064361572,
-2.2184715270996094,
0.33911147713661194,
-1.3608454465866089,
-0.4934326708316803,
1.0572134256362915,
0.3500279188156128,
-1.1894656419754028,
0.0842573419213295,
-0.47912076115608215,
1.1190842390060425,
0.3912138342857361,
1.07615065574646,
-1.6805851459503174,
-0.06945937871932983,
-0.27610164880752563,
0.12851503491401672,
-1.318652629852295,
-1.5538134574890137,
0.5647025108337402,
0.7004023790359497,
0.5847771763801575,
-0.12181401252746582,
1.1296182870864868,
-1.0824995040893555,
0.768073558807373,
-1.102979302406311,
-1.69515860080719,
-1.4599180221557617,
-2.418236494064331,
-2.281320333480835,
0.6895415782928467,
-0.4150552749633789,
-0.5149688124656677,
2.1127562522888184,
-1.0301551818847656,
-1.6964021921157837,
1.183211088180542,
0.17434704303741455,
0.027889354154467583,
2.355116367340088,
0.19400650262832642,
-0.7802871465682983,
0.478014200925827,
-0.8134035468101501,
0.7135195732116699,
-0.32809340953826904,
1.3309855461120605,
0.3884616494178772,
-1.0150443315505981,
1.588991641998291,
-0.31828027963638306,
0.5769893527030945,
-0.6200705170631409,
-0.5191239714622498,
-0.7269240617752075,
0.26792454719543457,
1.9941998720169067,
-0.2612859010696411,
1.4838275909423828,
-0.32985517382621765,
-1.5130033493041992,
-1.6050615310668945,
0.9251100420951843,
0.44473063945770264,
-0.7605310082435608,
0.15301114320755005,
-0.3754974603652954,
0.18391475081443787,
-0.10372576117515564,
1.1226850748062134,
1.2597877979278564,
0.6783378720283508,
-0.39477822184562683,
-0.9385807514190674,
0.22632889449596405,
-0.18310023844242096,
-0.6355907917022705,
-1.809810757637024,
-0.3633653223514557,
0.026327496394515038,
0.6923292875289917,
-1.2198795080184937,
1.69111967086792,
0.9162483811378479,
1.903982162475586,
1.0388109683990479,
-0.3243962228298187,
1.5095149278640747,
0.1470445841550827,
1.824945330619812,
-0.47435668110847473,
0.6385324001312256,
-0.39192137122154236,
-1.13716721534729,
0.7187038660049438,
-0.3372196853160858,
-1.9981194734573364,
-0.6887897849082947,
-0.7639445066452026,
-0.20613059401512146,
-0.7932495474815369,
0.8972295522689819,
-0.286155104637146,
-1.4697133302688599,
0.2899286448955536,
-0.7566102147102356,
0.18656764924526215,
-1.2037022113800049,
0.3663537800312042,
0.6884532570838928,
-0.5547046065330505,
0.10183856636285782,
-0.2824554741382599,
-1.236413598060608,
-0.46842893958091736,
0.3536496162414551,
1.8563995361328125,
-0.7293033003807068,
0.9056708216667175,
1.112858533859253,
-0.6751074194908142,
0.00886542722582817,
0.27951523661613464,
-0.2328183650970459,
0.845333993434906,
-1.0388966798782349,
-0.469249963760376,
1.2229046821594238,
-0.33799993991851807,
-0.6053189635276794,
1.4841231107711792,
0.7455310821533203,
-1.0539219379425049,
-0.289532870054245,
-0.08718257397413254,
-0.7891075611114502,
0.1490219235420227,
-1.6053634881973267,
-0.16084933280944824,
0.45094209909439087,
-1.5700863599777222,
-0.42247483134269714,
-0.2140621840953827,
1.4204282760620117,
-0.0978449359536171,
1.5038111209869385,
-0.36796334385871887,
-0.1750011146068573,
-0.29004573822021484,
-0.4050784707069397,
0.19086459279060364,
-0.19149574637413025,
-0.5790479183197021,
0.13548409938812256,
-0.7747557759284973,
0.32987573742866516,
1.435961365699768,
0.31933826208114624,
0.033542558550834656,
0.4824218451976776,
1.0425211191177368,
0.44222986698150635,
-0.016116824001073837,
-0.89936763048172,
-1.5041756629943848,
1.935494065284729,
-1.4650412797927856,
2.06492018699646,
0.8193979859352112,
-0.03665413707494736,
-1.7657263278961182,
-1.8347795009613037,
1.3613286018371582,
1.0841681957244873,
2.3238344192504883,
0.4999658167362213,
0.3629433810710907,
-0.8731787800788879,
-0.67985999584198,
0.280615895986557,
-0.9605448246002197,
-0.7805091142654419,
0.1891888678073883,
2.476578712463379,
1.7557711601257324,
-0.322103351354599,
-0.13071094453334808,
-0.9604265093803406,
1.40438711643219,
-0.14691056311130524,
0.30898401141166687,
2.002153158187866,
-0.22112971544265747,
-0.9941376447677612,
1.2353025674819946,
-2.4277987480163574,
0.19165100157260895,
2.0654807090759277,
0.27055078744888306,
0.1340130716562271,
-1.4090951681137085,
-0.6299431920051575,
-0.29440802335739136,
-0.448049396276474,
-1.2264139652252197,
0.5394156575202942,
-0.34626567363739014,
-0.7866477966308594,
-1.4188717603683472,
0.22466057538986206,
-1.0824586153030396,
-1.675197720527649,
0.19115857779979706,
1.8932909965515137,
2.05416202545166,
-0.7922845482826233,
1.5521248579025269,
-0.36083295941352844,
0.20854990184307098,
1.2484372854232788,
1.2579889297485352,
3.140294313430786,
1.9926289319992065,
-1.26912260055542,
0.6562321186065674,
-0.16041092574596405,
-0.4563203752040863,
1.0899486541748047,
-1.2394053936004639,
1.3336678743362427,
-0.13529902696609497,
-1.2076112031936646,
-1.174291968345642,
0.9907230734825134,
0.5773016810417175,
0.0037780776619911194,
-0.470251202583313,
1.2023485898971558,
0.09207946807146072,
1.314733862876892,
0.48432251811027527,
-0.34909865260124207,
0.6434304118156433,
-0.43249279260635376,
-0.4888746738433838,
1.5366872549057007,
0.15793026983737946,
-1.4479917287826538,
-2.2052114009857178,
-0.26490870118141174,
-0.8883536458015442,
-0.008457927033305168,
-0.6731036901473999,
-0.9928057193756104,
1.5942586660385132,
0.31853461265563965,
-1.227491021156311,
-0.22862210869789124,
-0.32255956530570984,
-0.514264702796936,
2.6932005882263184,
-1.290658950805664,
-0.27765020728111267,
-0.9695496559143066,
-0.646495521068573,
1.6445937156677246,
-1.213698387145996,
-0.2902386784553528,
-1.0014889240264893,
-0.6211761832237244,
-1.2465921640396118,
-0.5047557353973389,
-0.014813993126153946,
-0.913104772567749,
0.8748486042022705,
0.18675178289413452,
-1.24868905544281,
-0.3153795897960663,
-0.9350735545158386,
0.9212428331375122,
-0.044026121497154236,
0.19477996230125427,
1.7761716842651367,
0.23896300792694092,
-0.45711439847946167,
0.7581691145896912,
1.1144293546676636,
0.6522783041000366,
-0.6980969309806824,
0.2172802835702896,
-0.6457921862602234,
0.36730310320854187,
-1.2105940580368042,
0.3456765115261078,
-2.962660551071167,
0.6434297561645508,
0.0016549136489629745,
-0.02593393437564373,
-0.07277154922485352,
-1.2842652797698975,
1.1173659563064575,
2.5451321601867676,
-1.1354405879974365,
0.5254817605018616,
0.42163366079330444,
1.2076352834701538,
-1.597961664199829,
0.31569966673851013,
-0.44860219955444336,
2.104597568511963,
0.21977964043617249,
1.2754498720169067,
-0.42582836747169495,
-2.373715877532959,
0.6739951372146606,
-1.261953592300415,
-1.147359848022461,
0.7453715801239014,
-0.9324014782905579,
0.14106115698814392,
-1.3467626571655273,
-0.2617977559566498,
-0.8363502621650696,
-1.1798980236053467,
0.6530994772911072,
0.18635360896587372,
0.39421969652175903,
-0.5779764652252197,
0.31828561425209045,
-2.1818130016326904,
-1.3327046632766724,
-0.207257479429245,
-0.9944257736206055,
0.46826329827308655,
-0.40472039580345154,
0.6776514649391174,
-0.17187801003456116,
0.02747468091547489,
0.33678001165390015,
1.4232627153396606,
3.3444581031799316,
0.10421094298362732,
0.30304038524627686,
-0.19965849816799164,
-0.9206398129463196,
1.4932854175567627,
0.8964812755584717,
-0.1433396339416504,
-0.4795241057872772,
-1.1316487789154053,
1.2713243961334229,
1.9326814413070679,
0.9703618884086609,
0.02088441513478756,
-0.7870215773582458,
-0.7102424502372742,
-0.06900513917207718,
0.1248612180352211,
0.4937489330768585,
0.8942493200302124,
0.057604819536209106,
0.10577480494976044,
1.4413065910339355,
1.1547070741653442,
-0.4464757740497589,
0.32450348138809204,
-0.8594956398010254,
-0.4618885815143585,
0.48616164922714233,
0.2659998834133148,
-0.009357803501188755,
0.2746897339820862,
-0.9969372153282166,
-0.20868493616580963,
-0.4061471223831177,
-0.892126202583313,
-0.6857156753540039,
-0.4097684621810913,
-0.3535694479942322,
1.6124916076660156,
0.16152824461460114,
-0.4978736639022827,
-0.014707650989294052,
-0.732373833656311,
-0.0743270069360733,
-1.1137354373931885,
0.24079909920692444,
-0.1238875612616539,
-0.12171860784292221,
-0.1788395643234253,
1.7286394834518433,
-0.8910698890686035,
-2.0737969875335693,
0.1764032393693924,
0.2123928666114807,
-0.1916373372077942,
0.2767508625984192,
1.6756103038787842,
0.48910778760910034,
1.4774339199066162,
1.3071788549423218,
1.0007317066192627,
-0.6170224547386169,
-1.3278188705444336,
0.7513521909713745,
1.0019394159317017,
-1.4173911809921265,
0.79366135597229,
-0.05285077542066574,
-0.5136072039604187,
0.6752049922943115,
1.2889961004257202,
0.516312837600708,
-2.0949857234954834,
0.8127655386924744,
-1.0157948732376099,
0.7888049483299255,
0.7188963890075684,
0.6601808667182922,
0.2128511369228363,
0.8456658720970154,
-1.160256028175354,
-1.1228595972061157,
-0.6922293901443481,
-0.7363936901092529,
1.9765113592147827,
-0.3323929011821747,
0.574192225933075,
-0.1988290697336197,
-1.3674176931381226,
-0.012714940123260021,
0.6781772971153259,
0.346954882144928,
-0.47686371207237244,
0.8071022033691406,
-0.776736855506897,
-1.1752746105194092,
-1.3571560382843018,
-0.45490700006484985,
-1.05168616771698,
-0.9909352660179138,
1.0587420463562012,
0.727665364742279,
0.29281458258628845,
1.8867239952087402,
0.6063570380210876,
0.2845653295516968,
-2.6019022464752197,
0.976696789264679,
0.22149820625782013,
-0.044006675481796265,
0.8378030061721802,
0.25655028223991394,
1.051729679107666,
0.029476473107933998,
0.5308452844619751,
-2.4179775714874268,
2.309243679046631,
-0.22571301460266113,
0.6449066996574402,
0.015111135318875313,
-0.13168281316757202,
1.071824550628662,
0.6080565452575684,
0.6229678988456726,
-1.0301852226257324,
0.735278844833374,
-0.5783988237380981,
1.2909770011901855,
0.8103681206703186,
-0.8172921538352966,
-0.06753237545490265,
1.2640478610992432,
0.43061384558677673,
-0.5539657473564148,
-0.9225743412971497,
-1.0745246410369873,
0.9354702830314636,
1.6810131072998047,
-0.05474860966205597,
-0.03961652144789696,
0.8343479037284851,
0.6669244766235352,
-1.2413076162338257,
0.013651538640260696,
-0.7066936492919922,
-0.7084217071533203,
1.5757073163986206,
2.068037509918213,
-0.16806741058826447,
-0.2198592722415924,
-0.7028729319572449,
-1.290052890777588,
0.7375674843788147,
-0.09911787509918213,
0.05183578282594681,
0.6269273161888123,
-0.553286075592041,
0.9795721173286438,
0.7930015325546265,
0.8911049962043762,
0.1707714945077896,
0.20702992379665375,
0.3898225426673889,
-0.3683481514453888,
-1.2248495817184448,
-0.26123660802841187,
-1.0068846940994263,
-2.563929557800293,
0.4079841375350952,
-0.12346173822879791,
-1.3512203693389893,
0.06934618204832077,
-1.0415244102478027,
0.921373188495636,
-0.5494188070297241,
-1.1251375675201416,
-1.4638999700546265,
0.08262013643980026,
-0.11056893318891525,
0.9167917370796204,
-1.6134651899337769,
-0.10754994302988052,
1.2600857019424438,
0.8965988159179688,
-0.6795794367790222,
1.0960254669189453,
0.2776290476322174,
1.048514485359192,
0.8398072123527527,
-0.3679211139678955,
0.5984277725219727,
0.06269589066505432,
-1.3469812870025635,
0.4823053777217865,
1.1844736337661743,
0.24730855226516724,
1.5662294626235962,
-0.6114358901977539,
-0.07734160125255585,
0.45095589756965637,
-0.6858646273612976,
-0.4544745087623596,
-0.512500524520874,
0.725340723991394,
-0.07567884027957916,
-0.8934420943260193,
-0.005812996532768011,
-0.11416210979223251,
-0.19993364810943604,
0.10378285497426987,
-1.4874663352966309,
-0.08211486041545868,
-0.3257371187210083,
-0.6252996325492859,
-1.3249738216400146,
-0.009687556885182858,
1.4255205392837524,
-0.8221729397773743,
-0.23761533200740814,
0.38614872097969055,
0.4048817455768585,
0.49441179633140564,
0.6917943358421326,
-0.6679233908653259,
-0.3184731900691986,
-0.1516755372285843,
-0.316236287355423,
0.37905409932136536,
1.4069538116455078,
-0.07680916041135788,
-0.9991506338119507,
0.7009634971618652,
-0.36629655957221985,
0.10007932782173157,
1.9157859086990356,
0.1043984517455101,
-0.7847328782081604,
0.29208728671073914,
-0.7942682504653931,
1.9345107078552246,
1.6613504886627197,
1.3354215621948242,
-0.23687835037708282,
-0.880400538444519,
0.644775927066803,
-0.4218403100967407,
-0.3829779028892517,
0.8760978579521179,
0.4006626605987549,
-0.24200157821178436,
-1.3211297988891602,
0.7161786556243896,
1.2141401767730713,
-0.8525451421737671,
-0.7907758355140686,
0.19443565607070923,
-0.7434691190719604,
1.1067728996276855,
0.6696789860725403,
0.38152024149894714,
0.25212496519088745,
1.6077673435211182,
0.8000327944755554,
-0.531536877155304,
0.5624864101409912,
0.4732974171638489,
-0.2526099681854248,
-2.171905755996704,
-1.123667597770691,
0.3736517131328583,
-0.5893084406852722,
-1.6125643253326416,
1.3881508111953735,
-1.0743918418884277,
-1.0313217639923096,
0.5154287219047546,
0.03679888695478439,
1.372822642326355,
0.38052240014076233,
1.573861002922058,
2.067125082015991,
0.8657814860343933,
0.4840506613254547,
1.2424730062484741,
-0.2200949639081955,
-0.5044289231300354,
1.8346744775772095,
-0.4649828374385834,
0.47513073682785034,
1.1093411445617676,
-0.3076765537261963,
-1.0737075805664062,
-0.7547973990440369,
-1.2083882093429565,
-0.6733450889587402,
1.1034128665924072,
0.137526735663414,
-1.0980079174041748,
0.26302075386047363,
1.4981766939163208,
0.131122887134552,
-0.3513583242893219,
0.675832211971283,
0.3123714327812195,
-0.7705286145210266,
-0.02791377156972885,
-0.915687084197998,
0.5395777225494385,
-0.3273104429244995,
-0.32638710737228394,
0.29747599363327026,
0.4479236900806427,
1.3350573778152466,
-0.056197792291641235,
0.1373158097267151,
1.1678606271743774,
-1.3916456699371338,
1.4891669750213623,
-0.687503457069397,
0.30726149678230286,
-2.2990076541900635,
1.291118860244751,
-0.8232123255729675,
1.981629490852356,
-2.703916311264038,
0.4751673638820648,
-0.6101461052894592,
-0.48698511719703674,
0.32553258538246155,
-0.3240712881088257,
0.06954636424779892,
-0.13165533542633057,
-1.1482617855072021,
-0.03937014192342758,
-0.6969530582427979,
0.5658732652664185,
1.1070303916931152,
1.3170039653778076,
-1.132583498954773,
-0.20976682007312775,
-1.7403476238250732,
-0.15129977464675903,
-0.851711630821228,
0.40818530321121216,
-2.0244967937469482,
-0.20459166169166565,
-1.9295765161514282,
-2.3254265785217285,
-1.1794416904449463,
-0.8206544518470764,
1.142207384109497,
0.19066548347473145,
-0.8786616921424866,
1.2382049560546875,
-0.31602632999420166,
-1.8231065273284912,
1.042279839515686,
-2.086242198944092
] |
https://github.com/huggingface/datasets/issues/6079 | Iterating over DataLoader based on HF datasets is stuck forever | PyTorch tensors cannot store `Decimal` objects. Casting the column with decimals to `float` should fix the issue. | ### Describe the bug
I am using Amazon Sagemaker notebook (Amazon Linux 2) with python 3.10 based Conda environment.
I have a dataset in parquet format locally. When I try to iterate over it, the loader is stuck forever. Note that the same code is working for python 3.6 based conda environment seamlessly. What should be my next steps here?
### Steps to reproduce the bug
```
train_dataset = load_dataset(
"parquet", data_files = {'train': tr_data_path + '*.parquet'},
split = 'train',
collate_fn = streaming_data_collate_fn,
streaming = True
).with_format('torch')
train_dataloader = DataLoader(train_dataset, batch_size = 2, num_workers = 0)
t = time.time()
iter_ = 0
for batch in train_dataloader:
iter_ += 1
if iter_ == 1000:
break
print (time.time() - t)
```
### Expected behavior
The snippet should work normally and load the next batch of data.
### Environment info
datasets: '2.14.0'
pyarrow: '12.0.0'
torch: '2.0.0'
Python: 3.10.10 | packaged by conda-forge | (main, Mar 24 2023, 20:08:06) [GCC 11.3.0]
!uname -r
5.10.178-162.673.amzn2.x86_64 | 45 | 17 | Iterating over DataLoader based on HF datasets is stuck forever
### Describe the bug
I am using Amazon Sagemaker notebook (Amazon Linux 2) with python 3.10 based Conda environment.
I have a dataset in parquet format locally. When I try to iterate over it, the loader is stuck forever. Note that the same code is working for python 3.6 based conda environment seamlessly. What should be my next steps here?
### Steps to reproduce the bug
```
train_dataset = load_dataset(
"parquet", data_files = {'train': tr_data_path + '*.parquet'},
split = 'train',
collate_fn = streaming_data_collate_fn,
streaming = True
).with_format('torch')
train_dataloader = DataLoader(train_dataset, batch_size = 2, num_workers = 0)
t = time.time()
iter_ = 0
for batch in train_dataloader:
iter_ += 1
if iter_ == 1000:
break
print (time.time() - t)
```
### Expected behavior
The snippet should work normally and load the next batch of data.
### Environment info
datasets: '2.14.0'
pyarrow: '12.0.0'
torch: '2.0.0'
Python: 3.10.10 | packaged by conda-forge | (main, Mar 24 2023, 20:08:06) [GCC 11.3.0]
!uname -r
5.10.178-162.673.amzn2.x86_64
PyTorch tensors cannot store `Decimal` objects. Casting the column with decimals to `float` should fix the issue. | [
-1.2665154933929443,
-1.0163578987121582,
-0.7126186490058899,
1.5815691947937012,
-0.22405150532722473,
-1.126129150390625,
0.14313547313213348,
-0.9426345229148865,
1.658698558807373,
-0.8402796387672424,
0.2593388259410858,
-1.6109161376953125,
0.07901172339916229,
-0.5566502213478088,
-0.6711853742599487,
-0.8891609311103821,
-0.41663792729377747,
-0.7678996324539185,
1.21317458152771,
2.452268123626709,
1.193116307258606,
-1.4144567251205444,
2.738757610321045,
0.7046278119087219,
-0.16879406571388245,
-1.03397798538208,
0.46651896834373474,
0.011510382406413555,
-1.3388084173202515,
-0.4830050468444824,
-0.9689726829528809,
-0.09093113988637924,
-0.5813088417053223,
-0.4530218541622162,
0.023304186761379242,
0.3674195110797882,
-0.3304171562194824,
-0.5091057419776917,
-0.5029694437980652,
-0.7581044435501099,
0.41326063871383667,
-0.39838123321533203,
0.9017629623413086,
-0.34451815485954285,
1.8761265277862549,
-0.45407140254974365,
0.4776243567466736,
0.7587772011756897,
1.2487815618515015,
0.19433467090129852,
-0.06910432875156403,
0.39580437541007996,
0.41724881529808044,
-0.009534357115626335,
0.5657050013542175,
1.1072406768798828,
0.6110185980796814,
0.43892157077789307,
0.6654887795448303,
-2.2544171810150146,
1.3351374864578247,
-1.0477173328399658,
0.2886441946029663,
1.3448930978775024,
-1.011642575263977,
0.38359037041664124,
-1.70269775390625,
-0.011310162022709846,
0.6560035943984985,
-2.214759111404419,
0.3357897996902466,
-1.3485435247421265,
-0.5041565895080566,
1.069886326789856,
0.38653120398521423,
-1.2306609153747559,
0.05729566514492035,
-0.4514666497707367,
1.0816431045532227,
0.415793776512146,
1.1149475574493408,
-1.6716797351837158,
-0.10523770749568939,
-0.3176797926425934,
0.08180972188711166,
-1.346245288848877,
-1.5135804414749146,
0.5559232831001282,
0.6939054131507874,
0.5497555136680603,
-0.11769724637269974,
1.112166166305542,
-1.0517250299453735,
0.7964093089103699,
-1.0665744543075562,
-1.7096123695373535,
-1.4701507091522217,
-2.3903424739837646,
-2.344334363937378,
0.7175324559211731,
-0.37808454036712646,
-0.5269692540168762,
2.1116490364074707,
-1.025730848312378,
-1.7213833332061768,
1.2174253463745117,
0.21236452460289001,
-0.02073873206973076,
2.364199161529541,
0.212211012840271,
-0.7363021373748779,
0.4032915532588959,
-0.8218201398849487,
0.7404487729072571,
-0.36165690422058105,
1.378841757774353,
0.4201945662498474,
-1.0254135131835938,
1.5805479288101196,
-0.2798483669757843,
0.5716120600700378,
-0.6193895936012268,
-0.5122408270835876,
-0.7376856803894043,
0.252835214138031,
1.998952865600586,
-0.2723873555660248,
1.4877996444702148,
-0.3234756886959076,
-1.504496455192566,
-1.6168022155761719,
0.9450416564941406,
0.42872539162635803,
-0.7559083700180054,
0.15929152071475983,
-0.3054995536804199,
0.19160714745521545,
-0.10110925883054733,
1.1298792362213135,
1.262790560722351,
0.6965834498405457,
-0.4080411493778229,
-0.9526225328445435,
0.23405654728412628,
-0.17036935687065125,
-0.646268367767334,
-1.768128514289856,
-0.3823179304599762,
-0.008631161414086819,
0.6722081303596497,
-1.219274640083313,
1.6597687005996704,
0.9169154763221741,
1.8723639249801636,
1.0267524719238281,
-0.32951346039772034,
1.4903032779693604,
0.1563442498445511,
1.8072501420974731,
-0.46952998638153076,
0.6332188248634338,
-0.40016061067581177,
-1.1258876323699951,
0.7607283592224121,
-0.288255900144577,
-2.0005617141723633,
-0.7309930920600891,
-0.8144193291664124,
-0.21676267683506012,
-0.7889464497566223,
0.9223271608352661,
-0.26752033829689026,
-1.4527665376663208,
0.33220598101615906,
-0.7426109910011292,
0.1844612956047058,
-1.225849986076355,
0.40300360321998596,
0.6910614967346191,
-0.5135796666145325,
0.1371220499277115,
-0.28073546290397644,
-1.2816144227981567,
-0.4488655924797058,
0.3362935185432434,
1.8574726581573486,
-0.7859358191490173,
0.9161737561225891,
1.1113728284835815,
-0.6968299746513367,
0.007960288785398006,
0.27749794721603394,
-0.2375195324420929,
0.8604943752288818,
-1.0004429817199707,
-0.4429115355014801,
1.23159921169281,
-0.3321801424026489,
-0.6146910786628723,
1.5008375644683838,
0.7592177987098694,
-1.0241378545761108,
-0.2435925006866455,
-0.10438903421163559,
-0.7682681679725647,
0.11971493065357208,
-1.614971399307251,
-0.13564616441726685,
0.4398578107357025,
-1.5709717273712158,
-0.45650848746299744,
-0.20944689214229584,
1.4027140140533447,
-0.10378824174404144,
1.5054365396499634,
-0.3682989478111267,
-0.22196543216705322,
-0.3070918023586273,
-0.38019227981567383,
0.20601841807365417,
-0.17674098908901215,
-0.5984565019607544,
0.16626210510730743,
-0.7583849430084229,
0.34250250458717346,
1.4039888381958008,
0.3375852704048157,
-0.005259432829916477,
0.5031711459159851,
1.0538991689682007,
0.42066195607185364,
-0.004997848998755217,
-0.8989189863204956,
-1.5171269178390503,
1.9762085676193237,
-1.4544540643692017,
2.03723406791687,
0.7298499345779419,
0.017993170768022537,
-1.7805922031402588,
-1.8680212497711182,
1.3864713907241821,
1.070887804031372,
2.266014814376831,
0.5373873710632324,
0.3917044699192047,
-0.8810553550720215,
-0.667303204536438,
0.27717772126197815,
-1.0015748739242554,
-0.7609319090843201,
0.15892261266708374,
2.456469774246216,
1.7331606149673462,
-0.37647634744644165,
-0.10352890193462372,
-0.9861610531806946,
1.441802740097046,
-0.16424067318439484,
0.24746599793434143,
1.9965813159942627,
-0.21734043955802917,
-0.992488443851471,
1.2072951793670654,
-2.3928186893463135,
0.16987527906894684,
2.03309965133667,
0.258670836687088,
0.08959081768989563,
-1.404106616973877,
-0.6591642498970032,
-0.28616422414779663,
-0.4382839500904083,
-1.199843406677246,
0.5394490957260132,
-0.32586607336997986,
-0.798004686832428,
-1.4143251180648804,
0.2380182445049286,
-1.0798206329345703,
-1.627658724784851,
0.1667918860912323,
1.8965266942977905,
2.0256662368774414,
-0.7560994625091553,
1.5819038152694702,
-0.3276459872722626,
0.1981741040945053,
1.2769999504089355,
1.22199285030365,
3.1205573081970215,
1.979193925857544,
-1.2437995672225952,
0.6594950556755066,
-0.10738164186477661,
-0.4459663927555084,
1.1327317953109741,
-1.215749979019165,
1.366804838180542,
-0.11243390291929245,
-1.1871196031570435,
-1.1906338930130005,
0.9804148077964783,
0.5819227695465088,
0.030600804835557938,
-0.43520087003707886,
1.2071232795715332,
0.06164877861738205,
1.2850100994110107,
0.459764301776886,
-0.3470495641231537,
0.6556670069694519,
-0.4404168426990509,
-0.49846675992012024,
1.5102795362472534,
0.19276268780231476,
-1.410396695137024,
-2.2209455966949463,
-0.28779900074005127,
-0.8387860059738159,
0.01395417284220457,
-0.6161141991615295,
-0.9758028984069824,
1.6218174695968628,
0.36678433418273926,
-1.2464051246643066,
-0.23770321905612946,
-0.3515413701534271,
-0.5826142430305481,
2.736156702041626,
-1.3168694972991943,
-0.28129830956459045,
-0.972428560256958,
-0.6388689279556274,
1.6699143648147583,
-1.2118114233016968,
-0.25702470541000366,
-1.0038659572601318,
-0.6162976622581482,
-1.2766987085342407,
-0.5592951774597168,
-0.0344993993639946,
-0.9312883615493774,
0.8806595802307129,
0.15498650074005127,
-1.2005528211593628,
-0.32315292954444885,
-0.9310685992240906,
0.855065107345581,
-0.018910463899374008,
0.20947253704071045,
1.7940409183502197,
0.3269440829753876,
-0.44621774554252625,
0.7403936386108398,
1.103582739830017,
0.6513206362724304,
-0.6898954510688782,
0.24286046624183655,
-0.6426758766174316,
0.3374771177768707,
-1.1638234853744507,
0.3476593792438507,
-2.9195609092712402,
0.6211771368980408,
-0.022976897656917572,
-0.037176020443439484,
-0.06581497937440872,
-1.2571039199829102,
1.183210849761963,
2.537513017654419,
-1.169463872909546,
0.5242208242416382,
0.3479917645454407,
1.1855708360671997,
-1.5905263423919678,
0.34495389461517334,
-0.4274173676967621,
2.120103359222412,
0.2269093245267868,
1.2321637868881226,
-0.4189278483390808,
-2.334939479827881,
0.6854420304298401,
-1.2674133777618408,
-1.1887494325637817,
0.7470002174377441,
-0.9324772357940674,
0.09536008536815643,
-1.3636939525604248,
-0.2707582116127014,
-0.8094578981399536,
-1.192335844039917,
0.660318911075592,
0.18506085872650146,
0.4159523844718933,
-0.5661275386810303,
0.3404752016067505,
-2.215472459793091,
-1.327735424041748,
-0.23134377598762512,
-0.9943316578865051,
0.4682610034942627,
-0.3661602735519409,
0.702019989490509,
-0.19749587774276733,
0.052637964487075806,
0.3587922155857086,
1.427971601486206,
3.3709447383880615,
0.08471091836690903,
0.3315051794052124,
-0.16155876219272614,
-0.9228637218475342,
1.4808259010314941,
0.9263674020767212,
-0.13601192831993103,
-0.4829833209514618,
-1.142417311668396,
1.2541730403900146,
1.9452595710754395,
0.9584054350852966,
-0.010561566799879074,
-0.7586783766746521,
-0.6798732876777649,
-0.08079290390014648,
0.13124120235443115,
0.5126022100448608,
0.8686554431915283,
0.08405919373035431,
0.1211746335029602,
1.4272037744522095,
1.1702357530593872,
-0.48106810450553894,
0.31874245405197144,
-0.8432776927947998,
-0.4685649573802948,
0.4819718897342682,
0.255923330783844,
-0.0321100689470768,
0.2525607645511627,
-0.9731397032737732,
-0.18293583393096924,
-0.43231716752052307,
-0.9455738067626953,
-0.7130976915359497,
-0.4060038924217224,
-0.4045495092868805,
1.6280330419540405,
0.17091962695121765,
-0.5220518708229065,
-0.03190930560231209,
-0.7493223547935486,
-0.02156206965446472,
-1.1283352375030518,
0.2495177984237671,
-0.12596918642520905,
-0.12062974274158478,
-0.1585218608379364,
1.7642494440078735,
-0.9280194044113159,
-2.057673931121826,
0.19688381254673004,
0.21890099346637726,
-0.2149597406387329,
0.30037054419517517,
1.635040044784546,
0.5100590586662292,
1.4980005025863647,
1.3068435192108154,
0.9843977689743042,
-0.6552549600601196,
-1.3760381937026978,
0.7107420563697815,
1.0095683336257935,
-1.4158965349197388,
0.7506682872772217,
0.038807839155197144,
-0.4738506078720093,
0.6668360233306885,
1.2639752626419067,
0.5214405655860901,
-2.0683326721191406,
0.8163440823554993,
-0.9990065097808838,
0.769373893737793,
0.6816782355308533,
0.6467036008834839,
0.20479777455329895,
0.815567135810852,
-1.1632434129714966,
-1.1259750127792358,
-0.7031359076499939,
-0.7227370142936707,
1.950997233390808,
-0.3121348023414612,
0.5536082983016968,
-0.19279120862483978,
-1.384964108467102,
0.013519798405468464,
0.6658922433853149,
0.34993624687194824,
-0.4455745816230774,
0.7818751931190491,
-0.7351991534233093,
-1.2261719703674316,
-1.4070842266082764,
-0.44494521617889404,
-1.0627598762512207,
-0.9946032166481018,
1.0713731050491333,
0.7577628493309021,
0.24684107303619385,
1.8496536016464233,
0.5931968688964844,
0.2949940860271454,
-2.6103501319885254,
0.9863877892494202,
0.24848362803459167,
-0.039516616612672806,
0.8437551259994507,
0.24406704306602478,
1.0404000282287598,
-0.021647285670042038,
0.5045292377471924,
-2.374232769012451,
2.320509433746338,
-0.2536807954311371,
0.6595773696899414,
0.014141961000859737,
-0.10508005321025848,
1.0867701768875122,
0.6094995737075806,
0.6607446670532227,
-1.0483672618865967,
0.7159472703933716,
-0.6169186234474182,
1.3019721508026123,
0.835611879825592,
-0.7959364652633667,
-0.09026549011468887,
1.2917970418930054,
0.4431680142879486,
-0.5350160598754883,
-0.9237317442893982,
-1.0879335403442383,
0.9339609146118164,
1.672671914100647,
-0.0944562628865242,
-0.050812091678380966,
0.8269956111907959,
0.6479606628417969,
-1.322851300239563,
0.057149410247802734,
-0.7223665714263916,
-0.7153902053833008,
1.540331482887268,
2.0684897899627686,
-0.151530921459198,
-0.24518327414989471,
-0.7507790327072144,
-1.2954832315444946,
0.7251570820808411,
-0.0722959116101265,
0.06087882071733475,
0.6088371276855469,
-0.5551573634147644,
0.9849734902381897,
0.841499924659729,
0.8970031142234802,
0.18355728685855865,
0.25445449352264404,
0.34737715125083923,
-0.3336631953716278,
-1.2253180742263794,
-0.25886645913124084,
-0.9836421608924866,
-2.606123447418213,
0.43529683351516724,
-0.18304337561130524,
-1.3685410022735596,
0.029362741857767105,
-1.074892520904541,
0.9382098913192749,
-0.5287304520606995,
-1.114364504814148,
-1.4826841354370117,
0.07024185359477997,
-0.07194784283638,
0.9307631850242615,
-1.5959594249725342,
-0.08334586769342422,
1.319761872291565,
0.9110318422317505,
-0.6928939819335938,
1.1387569904327393,
0.28522589802742004,
1.0312665700912476,
0.8081250190734863,
-0.3575526177883148,
0.6069363951683044,
0.04350863769650459,
-1.3602122068405151,
0.5178315043449402,
1.177288293838501,
0.25576886534690857,
1.5360761880874634,
-0.6495680212974548,
-0.0702231302857399,
0.43261703848838806,
-0.6681753993034363,
-0.43810874223709106,
-0.5103091597557068,
0.7176939845085144,
-0.05846710503101349,
-0.8746771812438965,
0.058025144040584564,
-0.09915309399366379,
-0.17745842039585114,
0.12363339960575104,
-1.486038088798523,
-0.12475208193063736,
-0.3180084228515625,
-0.6549585461616516,
-1.2915796041488647,
-0.03472231701016426,
1.426408290863037,
-0.8155657052993774,
-0.22659039497375488,
0.40056297183036804,
0.3939891755580902,
0.5202118158340454,
0.678760290145874,
-0.6153991222381592,
-0.30089783668518066,
-0.18412598967552185,
-0.2884615957736969,
0.3416935205459595,
1.4273194074630737,
-0.13051530718803406,
-0.9958993792533875,
0.7465226650238037,
-0.3118319809436798,
0.07225830107927322,
1.9274587631225586,
0.10848090797662735,
-0.834527313709259,
0.2749936282634735,
-0.7557676434516907,
1.9688133001327515,
1.6791224479675293,
1.3394463062286377,
-0.2247193455696106,
-0.9665102958679199,
0.6101062297821045,
-0.41079485416412354,
-0.3747389316558838,
0.8773409128189087,
0.43103334307670593,
-0.23499803245067596,
-1.2767446041107178,
0.707895040512085,
1.2173285484313965,
-0.8735648393630981,
-0.86415034532547,
0.20289738476276398,
-0.7557830810546875,
1.0605355501174927,
0.6952223777770996,
0.3995714783668518,
0.24178901314735413,
1.5906550884246826,
0.7849398255348206,
-0.5487251281738281,
0.5477087497711182,
0.48387855291366577,
-0.2441634237766266,
-2.132612705230713,
-1.100788950920105,
0.38616275787353516,
-0.6208111047744751,
-1.639485239982605,
1.3813477754592896,
-1.0648378133773804,
-1.0110100507736206,
0.5102651715278625,
0.06591065227985382,
1.4320417642593384,
0.3687475621700287,
1.5496758222579956,
2.023242473602295,
0.8631303310394287,
0.45375561714172363,
1.2704050540924072,
-0.19494108855724335,
-0.5105741024017334,
1.8183627128601074,
-0.4829278290271759,
0.45466992259025574,
1.1421164274215698,
-0.29985031485557556,
-1.0370303392410278,
-0.7433935403823853,
-1.1765233278274536,
-0.6715365052223206,
1.119499683380127,
0.14830972254276276,
-1.1116912364959717,
0.23915500938892365,
1.4966421127319336,
0.10703884810209274,
-0.3450920581817627,
0.6534717082977295,
0.3203091323375702,
-0.7922506332397461,
-0.0042849755845963955,
-0.9645588994026184,
0.5593082904815674,
-0.2544003129005432,
-0.3342287242412567,
0.3284141719341278,
0.40134909749031067,
1.365169644355774,
-0.04883212968707085,
0.1607770472764969,
1.16389000415802,
-1.3601547479629517,
1.50651216506958,
-0.6399326324462891,
0.25538963079452515,
-2.263363838195801,
1.2992067337036133,
-0.8121734261512756,
1.9420384168624878,
-2.7129709720611572,
0.4486999809741974,
-0.6443997025489807,
-0.4344804883003235,
0.31926679611206055,
-0.35422420501708984,
0.07361951470375061,
-0.15101709961891174,
-1.1617149114608765,
-0.05673045292496681,
-0.71258944272995,
0.550872802734375,
1.1039001941680908,
1.3295178413391113,
-1.1179193258285522,
-0.2538900375366211,
-1.7174396514892578,
-0.15154539048671722,
-0.8348715901374817,
0.47986918687820435,
-2.028787851333618,
-0.2059311866760254,
-1.9049018621444702,
-2.338073492050171,
-1.1945061683654785,
-0.8120555281639099,
1.1493566036224365,
0.15061356127262115,
-0.828760027885437,
1.2145628929138184,
-0.30227038264274597,
-1.8631116151809692,
1.032098412513733,
-2.0746946334838867
] |
https://github.com/huggingface/datasets/issues/6079 | Iterating over DataLoader based on HF datasets is stuck forever | I already have cast in collate_fn, in which I perform .astype(float) for each numerical field.
On the same instance, I installed a conda env with python 3.6, and this works well.
Sample:
```
def streaming_data_collate_fn(batch):
df = pd.DataFrame.from_dict(batch)
feat_vals = torch.FloatTensor(np.nan_to_num(np.array(df[feats].astype(float))))
``` | ### Describe the bug
I am using Amazon Sagemaker notebook (Amazon Linux 2) with python 3.10 based Conda environment.
I have a dataset in parquet format locally. When I try to iterate over it, the loader is stuck forever. Note that the same code is working for python 3.6 based conda environment seamlessly. What should be my next steps here?
### Steps to reproduce the bug
```
train_dataset = load_dataset(
"parquet", data_files = {'train': tr_data_path + '*.parquet'},
split = 'train',
collate_fn = streaming_data_collate_fn,
streaming = True
).with_format('torch')
train_dataloader = DataLoader(train_dataset, batch_size = 2, num_workers = 0)
t = time.time()
iter_ = 0
for batch in train_dataloader:
iter_ += 1
if iter_ == 1000:
break
print (time.time() - t)
```
### Expected behavior
The snippet should work normally and load the next batch of data.
### Environment info
datasets: '2.14.0'
pyarrow: '12.0.0'
torch: '2.0.0'
Python: 3.10.10 | packaged by conda-forge | (main, Mar 24 2023, 20:08:06) [GCC 11.3.0]
!uname -r
5.10.178-162.673.amzn2.x86_64 | 45 | 42 | Iterating over DataLoader based on HF datasets is stuck forever
### Describe the bug
I am using Amazon Sagemaker notebook (Amazon Linux 2) with python 3.10 based Conda environment.
I have a dataset in parquet format locally. When I try to iterate over it, the loader is stuck forever. Note that the same code is working for python 3.6 based conda environment seamlessly. What should be my next steps here?
### Steps to reproduce the bug
```
train_dataset = load_dataset(
"parquet", data_files = {'train': tr_data_path + '*.parquet'},
split = 'train',
collate_fn = streaming_data_collate_fn,
streaming = True
).with_format('torch')
train_dataloader = DataLoader(train_dataset, batch_size = 2, num_workers = 0)
t = time.time()
iter_ = 0
for batch in train_dataloader:
iter_ += 1
if iter_ == 1000:
break
print (time.time() - t)
```
### Expected behavior
The snippet should work normally and load the next batch of data.
### Environment info
datasets: '2.14.0'
pyarrow: '12.0.0'
torch: '2.0.0'
Python: 3.10.10 | packaged by conda-forge | (main, Mar 24 2023, 20:08:06) [GCC 11.3.0]
!uname -r
5.10.178-162.673.amzn2.x86_64
I already have cast in collate_fn, in which I perform .astype(float) for each numerical field.
On the same instance, I installed a conda env with python 3.6, and this works well.
Sample:
```
def streaming_data_collate_fn(batch):
df = pd.DataFrame.from_dict(batch)
feat_vals = torch.FloatTensor(np.nan_to_num(np.array(df[feats].astype(float))))
``` | [
-1.3096867799758911,
-1.0151026248931885,
-0.654405415058136,
1.5715867280960083,
-0.2311745584011078,
-1.1411608457565308,
0.1739429086446762,
-0.9530844688415527,
1.66796875,
-0.8388645648956299,
0.2485904097557068,
-1.5883809328079224,
0.09396015852689743,
-0.5771110653877258,
-0.6925802230834961,
-0.8570770621299744,
-0.4146874248981476,
-0.7778530120849609,
1.1896148920059204,
2.440484046936035,
1.1997114419937134,
-1.4232124090194702,
2.7564876079559326,
0.7170611023902893,
-0.19052833318710327,
-1.0805776119232178,
0.4426341652870178,
0.022535353899002075,
-1.3379639387130737,
-0.4869075119495392,
-0.9965317845344543,
-0.10414715111255646,
-0.5772668123245239,
-0.4708634614944458,
0.038312382996082306,
0.38878360390663147,
-0.3079364597797394,
-0.48243293166160583,
-0.5072847008705139,
-0.7363354563713074,
0.4595317840576172,
-0.397100031375885,
0.9219574332237244,
-0.31455114483833313,
1.8185019493103027,
-0.5105593204498291,
0.5133712887763977,
0.7263620495796204,
1.2602850198745728,
0.18532878160476685,
-0.09213219583034515,
0.4124717116355896,
0.428472638130188,
0.022085387259721756,
0.5805779695510864,
1.1483293771743774,
0.646795928478241,
0.4280564486980438,
0.685559868812561,
-2.239625930786133,
1.3267836570739746,
-1.049782156944275,
0.3482581377029419,
1.3027223348617554,
-1.0155895948410034,
0.37155404686927795,
-1.7127790451049805,
-0.030043546110391617,
0.6566373109817505,
-2.2135751247406006,
0.31556499004364014,
-1.3559396266937256,
-0.49985072016716003,
1.0694321393966675,
0.39056235551834106,
-1.2015420198440552,
0.10387592017650604,
-0.492864191532135,
1.0623021125793457,
0.394155889749527,
1.0797697305679321,
-1.637520670890808,
-0.09513060003519058,
-0.2755962908267975,
0.1251106709241867,
-1.2785418033599854,
-1.5084528923034668,
0.5647563338279724,
0.6990648508071899,
0.5402552485466003,
-0.15228404104709625,
1.1224725246429443,
-1.0848002433776855,
0.7989893555641174,
-1.0876787900924683,
-1.6750431060791016,
-1.4837896823883057,
-2.355186700820923,
-2.2997138500213623,
0.7110174894332886,
-0.3844025433063507,
-0.5116841793060303,
2.1154913902282715,
-1.0225534439086914,
-1.7204711437225342,
1.2016252279281616,
0.19644875824451447,
-0.001937052235007286,
2.326815128326416,
0.20437940955162048,
-0.7485356330871582,
0.43808165192604065,
-0.8238169550895691,
0.7423199415206909,
-0.34136494994163513,
1.3697233200073242,
0.3971323072910309,
-1.0073949098587036,
1.5982636213302612,
-0.2660088539123535,
0.5704408884048462,
-0.6104174852371216,
-0.5113963484764099,
-0.7093391418457031,
0.29076310992240906,
1.9932290315628052,
-0.26582151651382446,
1.4876220226287842,
-0.3380652964115143,
-1.5479192733764648,
-1.611925482749939,
0.9131816029548645,
0.45100584626197815,
-0.754438042640686,
0.15058633685112,
-0.3907057046890259,
0.1913667470216751,
-0.052844274789094925,
1.1355410814285278,
1.2713807821273804,
0.7208124995231628,
-0.4057602286338806,
-0.9153607487678528,
0.22066420316696167,
-0.14279145002365112,
-0.6559154987335205,
-1.7987339496612549,
-0.3849617540836334,
0.012678864412009716,
0.673972487449646,
-1.189194917678833,
1.6936300992965698,
0.9296067953109741,
1.86659836769104,
1.0454767942428589,
-0.3215910494327545,
1.504955530166626,
0.15690046548843384,
1.7970075607299805,
-0.46737468242645264,
0.6489663124084473,
-0.3799600303173065,
-1.094775676727295,
0.7641201615333557,
-0.3033905327320099,
-2.0379884243011475,
-0.7232341170310974,
-0.7498311996459961,
-0.1771305799484253,
-0.7949440479278564,
0.9277682900428772,
-0.2908604145050049,
-1.4638890027999878,
0.3192678689956665,
-0.7638530731201172,
0.21803656220436096,
-1.1803699731826782,
0.37259209156036377,
0.7193127870559692,
-0.5657587647438049,
0.16446495056152344,
-0.2708050310611725,
-1.2849242687225342,
-0.4387689232826233,
0.32452070713043213,
1.833904504776001,
-0.7913594245910645,
0.880153477191925,
1.1224287748336792,
-0.6764014959335327,
0.019964057952165604,
0.29250437021255493,
-0.24647285044193268,
0.8600201606750488,
-1.012130856513977,
-0.4555339813232422,
1.2309821844100952,
-0.3277507424354553,
-0.5755817294120789,
1.4807119369506836,
0.7400423288345337,
-1.0172529220581055,
-0.24340587854385376,
-0.07394665479660034,
-0.7957198023796082,
0.10506349056959152,
-1.5934679508209229,
-0.13750791549682617,
0.4883807897567749,
-1.5994367599487305,
-0.4130164682865143,
-0.20619472861289978,
1.385690689086914,
-0.08371934294700623,
1.5381540060043335,
-0.3749271631240845,
-0.20268578827381134,
-0.28413069248199463,
-0.344384104013443,
0.22864246368408203,
-0.18812979757785797,
-0.5996495485305786,
0.16784974932670593,
-0.7588263154029846,
0.3458423614501953,
1.4286818504333496,
0.34015530347824097,
-0.006912429351359606,
0.5074713230133057,
1.063926100730896,
0.4078480005264282,
-0.0383758619427681,
-0.8654642105102539,
-1.5201737880706787,
1.982067584991455,
-1.4465255737304688,
2.0149776935577393,
0.7362522482872009,
-0.010867360979318619,
-1.7871742248535156,
-1.8473328351974487,
1.3625379800796509,
1.0692449808120728,
2.343599557876587,
0.5037311315536499,
0.3695605993270874,
-0.8675946593284607,
-0.6586594581604004,
0.3076840341091156,
-1.011961817741394,
-0.7770019173622131,
0.12670233845710754,
2.4588582515716553,
1.7797982692718506,
-0.3705771267414093,
-0.15095429122447968,
-0.9857941269874573,
1.4406046867370605,
-0.1996246576309204,
0.2706913948059082,
1.9543639421463013,
-0.2242717742919922,
-1.0144506692886353,
1.282921314239502,
-2.3994507789611816,
0.18354758620262146,
2.0300509929656982,
0.2668898403644562,
0.09268210828304291,
-1.4265522956848145,
-0.6172072887420654,
-0.28284358978271484,
-0.452655553817749,
-1.2178746461868286,
0.5533179044723511,
-0.32018181681632996,
-0.817857027053833,
-1.4124990701675415,
0.20927688479423523,
-1.1003260612487793,
-1.6508221626281738,
0.1876768320798874,
1.8612916469573975,
2.034036874771118,
-0.724478006362915,
1.5765860080718994,
-0.3619024455547333,
0.24196302890777588,
1.2707411050796509,
1.2552002668380737,
3.1128792762756348,
1.9965015649795532,
-1.257662296295166,
0.6530164480209351,
-0.14869487285614014,
-0.45037901401519775,
1.0771147012710571,
-1.2550362348556519,
1.3548824787139893,
-0.10577500611543655,
-1.2094674110412598,
-1.1633399724960327,
1.0127887725830078,
0.5576831698417664,
0.04121774435043335,
-0.4231439530849457,
1.193319320678711,
0.07245184481143951,
1.2806693315505981,
0.4746658205986023,
-0.3288145959377289,
0.6611692309379578,
-0.42112836241722107,
-0.48642146587371826,
1.4962375164031982,
0.1905747652053833,
-1.4167802333831787,
-2.1796553134918213,
-0.25715282559394836,
-0.8605552315711975,
-0.0014183362945914268,
-0.631344735622406,
-0.9593620300292969,
1.6191457509994507,
0.3269351124763489,
-1.2655833959579468,
-0.21546494960784912,
-0.32636457681655884,
-0.5640943646430969,
2.7183356285095215,
-1.285623550415039,
-0.31190475821495056,
-0.9601651430130005,
-0.6805768013000488,
1.6439801454544067,
-1.17789888381958,
-0.2601545751094818,
-0.9860497713088989,
-0.6032830476760864,
-1.253135085105896,
-0.5685348510742188,
-0.019595738500356674,
-0.9524122476577759,
0.8660804033279419,
0.16058604419231415,
-1.222337007522583,
-0.35466936230659485,
-0.8878694176673889,
0.8984378576278687,
0.001140393316745758,
0.15612027049064636,
1.8024744987487793,
0.27738967537879944,
-0.4492111802101135,
0.7605787515640259,
1.1117537021636963,
0.6635239124298096,
-0.6730391383171082,
0.20531411468982697,
-0.6466558575630188,
0.3375701606273651,
-1.2236459255218506,
0.34499770402908325,
-2.9172942638397217,
0.6511905193328857,
-0.01496883761137724,
-0.05831747129559517,
-0.08490133285522461,
-1.2799948453903198,
1.1377201080322266,
2.5911049842834473,
-1.1442660093307495,
0.5149045586585999,
0.367108553647995,
1.1869468688964844,
-1.542433738708496,
0.3243381977081299,
-0.4398038685321808,
2.117339849472046,
0.25504249334335327,
1.264349102973938,
-0.4188854992389679,
-2.330822229385376,
0.7055357098579407,
-1.2929030656814575,
-1.1787205934524536,
0.7164074182510376,
-0.939228355884552,
0.11067450791597366,
-1.3578699827194214,
-0.2533239424228668,
-0.8075466156005859,
-1.1612147092819214,
0.6187624335289001,
0.20951497554779053,
0.3934454619884491,
-0.5939764976501465,
0.3336564004421234,
-2.1820759773254395,
-1.3125417232513428,
-0.24696284532546997,
-1.0195761919021606,
0.4633339047431946,
-0.3875660300254822,
0.6861302852630615,
-0.18798047304153442,
0.014358260668814182,
0.3599124252796173,
1.457472562789917,
3.3420045375823975,
0.07687303423881531,
0.29351842403411865,
-0.20732466876506805,
-0.9096679091453552,
1.4780648946762085,
0.9162622094154358,
-0.15231195092201233,
-0.5075994729995728,
-1.1052265167236328,
1.2425888776779175,
1.9441629648208618,
0.9471473097801208,
-0.005359059199690819,
-0.7710188627243042,
-0.7122808694839478,
-0.07779648900032043,
0.10523558408021927,
0.5024141073226929,
0.8698173761367798,
0.06695251166820526,
0.08601740747690201,
1.449414849281311,
1.1490426063537598,
-0.46128958463668823,
0.31773611903190613,
-0.8476153016090393,
-0.46765464544296265,
0.48098352551460266,
0.2641230821609497,
-0.04393169283866882,
0.2731150686740875,
-1.0010870695114136,
-0.16519072651863098,
-0.41937825083732605,
-0.9156687259674072,
-0.7279753684997559,
-0.39019787311553955,
-0.4009973704814911,
1.6290467977523804,
0.19073081016540527,
-0.5430238246917725,
-0.042199861258268356,
-0.7369109392166138,
-0.06012648344039917,
-1.0680067539215088,
0.2834434509277344,
-0.10582172870635986,
-0.10375159978866577,
-0.16803190112113953,
1.75171959400177,
-0.8789433836936951,
-2.063408374786377,
0.1920563280582428,
0.1636430025100708,
-0.2001027762889862,
0.28811830282211304,
1.6444525718688965,
0.5482082366943359,
1.4976321458816528,
1.3159505128860474,
0.9818198680877686,
-0.5918576121330261,
-1.3364665508270264,
0.7480161190032959,
0.973825216293335,
-1.4292107820510864,
0.7387123107910156,
0.003395587205886841,
-0.49301260709762573,
0.683383584022522,
1.2522608041763306,
0.5049756169319153,
-2.1029775142669678,
0.8338475227355957,
-1.0294196605682373,
0.7509717345237732,
0.6893869638442993,
0.6327909231185913,
0.2101212590932846,
0.8472387790679932,
-1.186224341392517,
-1.1241847276687622,
-0.7247899174690247,
-0.7082961201667786,
2.003720998764038,
-0.3395092785358429,
0.58784419298172,
-0.20360295474529266,
-1.3976168632507324,
-0.030337896198034286,
0.6815658807754517,
0.32251065969467163,
-0.47225457429885864,
0.8030073046684265,
-0.737337589263916,
-1.2055950164794922,
-1.3559616804122925,
-0.45478349924087524,
-1.0563220977783203,
-0.9783208966255188,
1.0435649156570435,
0.7286571860313416,
0.27796900272369385,
1.8584879636764526,
0.5829505324363708,
0.2913797199726105,
-2.611116647720337,
0.9601711630821228,
0.23863482475280762,
-0.06007896363735199,
0.8224694132804871,
0.23842552304267883,
1.0182355642318726,
-0.010052042081952095,
0.5232247710227966,
-2.407048463821411,
2.304586172103882,
-0.2229871302843094,
0.686651349067688,
0.03153439238667488,
-0.10436869412660599,
1.0988903045654297,
0.6157498359680176,
0.6566645503044128,
-1.0276247262954712,
0.6794995665550232,
-0.6268848180770874,
1.3152247667312622,
0.8154094815254211,
-0.7921879887580872,
-0.06966360658407211,
1.2974141836166382,
0.4265695810317993,
-0.5382262468338013,
-0.9316728115081787,
-1.0935112237930298,
0.9390228390693665,
1.6975547075271606,
-0.12110750377178192,
-0.05578862875699997,
0.8108376264572144,
0.6871424913406372,
-1.2849345207214355,
0.013331149704754353,
-0.7401451468467712,
-0.6849769353866577,
1.5472369194030762,
2.102914810180664,
-0.17657487094402313,
-0.22736011445522308,
-0.7189814448356628,
-1.313171625137329,
0.7133230566978455,
-0.06834103912115097,
0.08395134657621384,
0.6125223636627197,
-0.5500588417053223,
0.9716100096702576,
0.8576180338859558,
0.8913194537162781,
0.20580177009105682,
0.2509276866912842,
0.35626882314682007,
-0.35455888509750366,
-1.2143027782440186,
-0.3007303476333618,
-0.9885495901107788,
-2.597665309906006,
0.41212397813796997,
-0.15179087221622467,
-1.3913853168487549,
0.09208999574184418,
-1.0696914196014404,
0.9247003793716431,
-0.5545245409011841,
-1.1410969495773315,
-1.4941582679748535,
0.10212928056716919,
-0.05592558532953262,
0.9312624931335449,
-1.5826271772384644,
-0.07015778124332428,
1.2646918296813965,
0.9159048795700073,
-0.6864838004112244,
1.1173471212387085,
0.30985555052757263,
1.0410263538360596,
0.8386610150337219,
-0.37140634655952454,
0.6146723628044128,
0.053523000329732895,
-1.338756799697876,
0.4807835519313812,
1.1738396883010864,
0.22977963089942932,
1.522462248802185,
-0.6348821520805359,
-0.06434532254934311,
0.4614335298538208,
-0.7094549536705017,
-0.4510760009288788,
-0.4949019253253937,
0.7012420892715454,
-0.08981536328792572,
-0.8885146379470825,
-0.010145836509764194,
-0.07025176286697388,
-0.23168112337589264,
0.1479697972536087,
-1.481305718421936,
-0.0873471274971962,
-0.29904064536094666,
-0.6370779871940613,
-1.2728240489959717,
-0.030424468219280243,
1.4299489259719849,
-0.8353326320648193,
-0.24110187590122223,
0.3921838402748108,
0.387824684381485,
0.526554524898529,
0.6684823632240295,
-0.6535672545433044,
-0.3022090494632721,
-0.1799289584159851,
-0.33281683921813965,
0.3355211615562439,
1.4499897956848145,
-0.09226493537425995,
-0.9851163029670715,
0.758762776851654,
-0.3689083456993103,
0.05823814496397972,
1.9124078750610352,
0.1111425831913948,
-0.7705786228179932,
0.28006792068481445,
-0.7720562815666199,
1.9508882761001587,
1.681138515472412,
1.314363956451416,
-0.22397807240486145,
-0.9392902851104736,
0.5876840353012085,
-0.41277194023132324,
-0.37751099467277527,
0.8598676919937134,
0.41517069935798645,
-0.22136445343494415,
-1.3208187818527222,
0.7325459718704224,
1.2219070196151733,
-0.8697737455368042,
-0.8247277736663818,
0.21677906811237335,
-0.770778238773346,
1.113586664199829,
0.6826040148735046,
0.3849576711654663,
0.21249637007713318,
1.6055970191955566,
0.808402955532074,
-0.5065656900405884,
0.5554495453834534,
0.5157949328422546,
-0.23454169929027557,
-2.1692581176757812,
-1.1301467418670654,
0.3797445297241211,
-0.6007055640220642,
-1.6338762044906616,
1.34233558177948,
-1.0862547159194946,
-1.014569878578186,
0.5093922019004822,
0.0666215568780899,
1.4245282411575317,
0.39710766077041626,
1.5495400428771973,
2.0332517623901367,
0.8685562610626221,
0.47693830728530884,
1.2493268251419067,
-0.19619905948638916,
-0.5177485346794128,
1.8167401552200317,
-0.4715234637260437,
0.48986583948135376,
1.159519076347351,
-0.30135229229927063,
-1.059878945350647,
-0.7420387864112854,
-1.2042697668075562,
-0.6854161620140076,
1.093219518661499,
0.16645784676074982,
-1.130847454071045,
0.23629845678806305,
1.4901401996612549,
0.12849260866641998,
-0.33130449056625366,
0.633936882019043,
0.31753620505332947,
-0.7479194402694702,
-0.024623017758131027,
-0.9246981739997864,
0.5386685729026794,
-0.33499038219451904,
-0.3572240173816681,
0.3154282569885254,
0.4178428053855896,
1.3162903785705566,
-0.05905412137508392,
0.11860759556293488,
1.1575576066970825,
-1.4089899063110352,
1.5063002109527588,
-0.6702176928520203,
0.2968786060810089,
-2.275449514389038,
1.2960056066513062,
-0.8348955512046814,
1.9679123163223267,
-2.7297844886779785,
0.4542419910430908,
-0.6404876708984375,
-0.47464966773986816,
0.3084568977355957,
-0.33877068758010864,
0.054847780615091324,
-0.14193609356880188,
-1.175463318824768,
-0.034275464713573456,
-0.6749217510223389,
0.5701308250427246,
1.0829651355743408,
1.3376206159591675,
-1.14236319065094,
-0.26074257493019104,
-1.6994091272354126,
-0.17001332342624664,
-0.8395788669586182,
0.447392076253891,
-2.03232479095459,
-0.1845702975988388,
-1.9023187160491943,
-2.325772523880005,
-1.1956110000610352,
-0.8324244022369385,
1.1340781450271606,
0.13611923158168793,
-0.8129894137382507,
1.2636215686798096,
-0.33388423919677734,
-1.8639706373214722,
1.0305594205856323,
-2.152911424636841
] |
https://github.com/huggingface/datasets/issues/6079 | Iterating over DataLoader based on HF datasets is stuck forever | `collate_fn` is applied after the `torch` formatting step, so I think the only option when working with an `IterableDataset` is to remove the `with_format` call and perform the conversion from Python values to PyTorch tensors in `collate_fn`. The standard `Dataset` supports `with_format("numpy")`, which should make this conversion faster. | ### Describe the bug
I am using Amazon Sagemaker notebook (Amazon Linux 2) with python 3.10 based Conda environment.
I have a dataset in parquet format locally. When I try to iterate over it, the loader is stuck forever. Note that the same code is working for python 3.6 based conda environment seamlessly. What should be my next steps here?
### Steps to reproduce the bug
```
train_dataset = load_dataset(
"parquet", data_files = {'train': tr_data_path + '*.parquet'},
split = 'train',
collate_fn = streaming_data_collate_fn,
streaming = True
).with_format('torch')
train_dataloader = DataLoader(train_dataset, batch_size = 2, num_workers = 0)
t = time.time()
iter_ = 0
for batch in train_dataloader:
iter_ += 1
if iter_ == 1000:
break
print (time.time() - t)
```
### Expected behavior
The snippet should work normally and load the next batch of data.
### Environment info
datasets: '2.14.0'
pyarrow: '12.0.0'
torch: '2.0.0'
Python: 3.10.10 | packaged by conda-forge | (main, Mar 24 2023, 20:08:06) [GCC 11.3.0]
!uname -r
5.10.178-162.673.amzn2.x86_64 | 45 | 48 | Iterating over DataLoader based on HF datasets is stuck forever
### Describe the bug
I am using Amazon Sagemaker notebook (Amazon Linux 2) with python 3.10 based Conda environment.
I have a dataset in parquet format locally. When I try to iterate over it, the loader is stuck forever. Note that the same code is working for python 3.6 based conda environment seamlessly. What should be my next steps here?
### Steps to reproduce the bug
```
train_dataset = load_dataset(
"parquet", data_files = {'train': tr_data_path + '*.parquet'},
split = 'train',
collate_fn = streaming_data_collate_fn,
streaming = True
).with_format('torch')
train_dataloader = DataLoader(train_dataset, batch_size = 2, num_workers = 0)
t = time.time()
iter_ = 0
for batch in train_dataloader:
iter_ += 1
if iter_ == 1000:
break
print (time.time() - t)
```
### Expected behavior
The snippet should work normally and load the next batch of data.
### Environment info
datasets: '2.14.0'
pyarrow: '12.0.0'
torch: '2.0.0'
Python: 3.10.10 | packaged by conda-forge | (main, Mar 24 2023, 20:08:06) [GCC 11.3.0]
!uname -r
5.10.178-162.673.amzn2.x86_64
`collate_fn` is applied after the `torch` formatting step, so I think the only option when working with an `IterableDataset` is to remove the `with_format` call and perform the conversion from Python values to PyTorch tensors in `collate_fn`. The standard `Dataset` supports `with_format("numpy")`, which should make this conversion faster. | [
-1.2474640607833862,
-0.9869871735572815,
-0.7190800905227661,
1.585418462753296,
-0.23098866641521454,
-1.1668672561645508,
0.17919516563415527,
-0.9628450274467468,
1.6689121723175049,
-0.8653399348258972,
0.28742289543151855,
-1.6140029430389404,
0.06157983839511871,
-0.5838105082511902,
-0.6935099363327026,
-0.8597397208213806,
-0.39756208658218384,
-0.7837159633636475,
1.1515284776687622,
2.448878765106201,
1.2092665433883667,
-1.4228845834732056,
2.7243475914001465,
0.6874051690101624,
-0.18258148431777954,
-1.0448718070983887,
0.45862776041030884,
-0.00605046795681119,
-1.2891161441802979,
-0.502373456954956,
-0.9571503400802612,
-0.10623360425233841,
-0.5937087535858154,
-0.48667335510253906,
-0.000050358474254608154,
0.40409165620803833,
-0.34179335832595825,
-0.4883759021759033,
-0.5052530169487,
-0.7725861072540283,
0.42227673530578613,
-0.41924816370010376,
0.9328625798225403,
-0.3434752821922302,
1.843133568763733,
-0.48806846141815186,
0.4825756549835205,
0.7664220929145813,
1.2311936616897583,
0.18752826750278473,
-0.07887164503335953,
0.4001147747039795,
0.42024970054626465,
-0.007353747263550758,
0.5687352418899536,
1.1270235776901245,
0.6442726254463196,
0.4735056161880493,
0.686631977558136,
-2.269334316253662,
1.3186662197113037,
-1.0646979808807373,
0.30210864543914795,
1.3015588521957397,
-1.0044528245925903,
0.3702472448348999,
-1.7093485593795776,
-0.04163204878568649,
0.6242326498031616,
-2.232466697692871,
0.31918275356292725,
-1.3571454286575317,
-0.47422200441360474,
1.087108850479126,
0.3754867911338806,
-1.2253470420837402,
0.08011123538017273,
-0.440402090549469,
1.031000018119812,
0.39611995220184326,
1.0839323997497559,
-1.672306776046753,
-0.11116281151771545,
-0.31976014375686646,
0.10405942052602768,
-1.3195194005966187,
-1.5446962118148804,
0.5604054927825928,
0.6881610751152039,
0.5596078634262085,
-0.13842236995697021,
1.133419156074524,
-1.056888222694397,
0.7700156569480896,
-1.0893312692642212,
-1.7182776927947998,
-1.4635107517242432,
-2.3175272941589355,
-2.3029732704162598,
0.7013909220695496,
-0.41217362880706787,
-0.5083773732185364,
2.1249887943267822,
-1.0383613109588623,
-1.7130309343338013,
1.1892776489257812,
0.20772188901901245,
-0.031121348962187767,
2.3431408405303955,
0.18252180516719818,
-0.7316352725028992,
0.41385066509246826,
-0.7991268038749695,
0.756675660610199,
-0.3339640498161316,
1.336255669593811,
0.3994489908218384,
-1.0375908613204956,
1.6060655117034912,
-0.26080232858657837,
0.6029633283615112,
-0.6260465383529663,
-0.5168277621269226,
-0.7472049593925476,
0.2755047082901001,
1.9621009826660156,
-0.29148250818252563,
1.4751123189926147,
-0.3247135281562805,
-1.5244810581207275,
-1.6362156867980957,
0.9500798583030701,
0.42558616399765015,
-0.7813743352890015,
0.13585573434829712,
-0.3303183317184448,
0.19251392781734467,
-0.10896354168653488,
1.1648563146591187,
1.256186604499817,
0.7276239395141602,
-0.4130480885505676,
-0.9260453581809998,
0.21213236451148987,
-0.1307288259267807,
-0.6645070314407349,
-1.7438582181930542,
-0.3959113359451294,
0.011455671861767769,
0.6550705432891846,
-1.2065662145614624,
1.7135652303695679,
0.9360860586166382,
1.8617291450500488,
1.0465317964553833,
-0.33378905057907104,
1.4924180507659912,
0.1411384493112564,
1.822067379951477,
-0.4679350256919861,
0.6080024838447571,
-0.40171098709106445,
-1.11543607711792,
0.7870504856109619,
-0.2753050923347473,
-2.0005414485931396,
-0.7494476437568665,
-0.8042128682136536,
-0.21310918033123016,
-0.7732337117195129,
0.9123914837837219,
-0.26218080520629883,
-1.4518460035324097,
0.2990454435348511,
-0.7073299884796143,
0.17277827858924866,
-1.2019996643066406,
0.4140232801437378,
0.676556408405304,
-0.5771222710609436,
0.1486150175333023,
-0.27468663454055786,
-1.2969670295715332,
-0.4470996856689453,
0.30627328157424927,
1.8486260175704956,
-0.778964102268219,
0.9172187447547913,
1.1091117858886719,
-0.7043505907058716,
0.0047410475090146065,
0.3070604205131531,
-0.25503307580947876,
0.8653206825256348,
-1.009992241859436,
-0.46681469678878784,
1.209969401359558,
-0.30704593658447266,
-0.6236295700073242,
1.4814162254333496,
0.7409685850143433,
-1.0208957195281982,
-0.25185370445251465,
-0.09022965282201767,
-0.8098572492599487,
0.13089001178741455,
-1.6112197637557983,
-0.13188055157661438,
0.4459989666938782,
-1.5665429830551147,
-0.45753055810928345,
-0.2140558809041977,
1.3727222681045532,
-0.0834791362285614,
1.4737285375595093,
-0.3752456307411194,
-0.23666329681873322,
-0.2861192226409912,
-0.3570255637168884,
0.16348588466644287,
-0.17443247139453888,
-0.6301014423370361,
0.16559356451034546,
-0.7400254607200623,
0.34273260831832886,
1.43285071849823,
0.32514840364456177,
-0.04040218144655228,
0.5086140036582947,
1.0846586227416992,
0.41825199127197266,
0.019612926989793777,
-0.8995472192764282,
-1.485770583152771,
1.957190990447998,
-1.4645692110061646,
2.005265712738037,
0.7095295190811157,
0.0058019887655973434,
-1.779424786567688,
-1.8793774843215942,
1.3972433805465698,
1.0648037195205688,
2.2827625274658203,
0.5505614280700684,
0.3714575171470642,
-0.8525716662406921,
-0.6519990563392639,
0.31009113788604736,
-1.0111632347106934,
-0.7576391100883484,
0.16365426778793335,
2.440882444381714,
1.7283456325531006,
-0.3981253504753113,
-0.14158323407173157,
-0.9773507118225098,
1.4131630659103394,
-0.16315078735351562,
0.28899210691452026,
1.9895752668380737,
-0.24499523639678955,
-1.0119943618774414,
1.246759295463562,
-2.386451244354248,
0.16528265178203583,
2.0382583141326904,
0.2451144903898239,
0.10042791813611984,
-1.3904469013214111,
-0.6162855625152588,
-0.2677047848701477,
-0.4595683217048645,
-1.2336454391479492,
0.5121127963066101,
-0.28901833295822144,
-0.787067711353302,
-1.4075711965560913,
0.24703441560268402,
-1.1017626523971558,
-1.6417202949523926,
0.19986389577388763,
1.9120440483093262,
2.0284619331359863,
-0.7415814399719238,
1.613612174987793,
-0.34918415546417236,
0.2268165498971939,
1.266823172569275,
1.2570102214813232,
3.142592191696167,
1.980912685394287,
-1.2665717601776123,
0.664044976234436,
-0.12985628843307495,
-0.4551740884780884,
1.1390538215637207,
-1.2386618852615356,
1.3345985412597656,
-0.14246053993701935,
-1.1987639665603638,
-1.1741249561309814,
0.9618713855743408,
0.5306301116943359,
0.057508885860443115,
-0.43628740310668945,
1.1918925046920776,
0.08295298367738724,
1.253982663154602,
0.48109668493270874,
-0.3460600972175598,
0.6766624450683594,
-0.44203346967697144,
-0.49094927310943604,
1.5145344734191895,
0.18900978565216064,
-1.3790050745010376,
-2.222032308578491,
-0.25441932678222656,
-0.8479142785072327,
0.03955763950943947,
-0.633152186870575,
-0.9440646767616272,
1.6430906057357788,
0.3482569456100464,
-1.2765036821365356,
-0.25403064489364624,
-0.34032124280929565,
-0.5547398328781128,
2.7166967391967773,
-1.3040268421173096,
-0.28787416219711304,
-0.9841190576553345,
-0.6661311388015747,
1.6673153638839722,
-1.20595383644104,
-0.26321613788604736,
-0.9865807890892029,
-0.5770022869110107,
-1.2827107906341553,
-0.5599499940872192,
0.00010267924517393112,
-0.9373336434364319,
0.9051552414894104,
0.184464693069458,
-1.1930451393127441,
-0.3099372982978821,
-0.9144523739814758,
0.8753790855407715,
-0.05381230264902115,
0.20324817299842834,
1.7987408638000488,
0.3181125521659851,
-0.406002402305603,
0.7669413685798645,
1.0938336849212646,
0.6649999618530273,
-0.6544888019561768,
0.24255354702472687,
-0.6626716256141663,
0.3153829574584961,
-1.192891001701355,
0.3407357931137085,
-2.898296594619751,
0.5955909490585327,
-0.03323370963335037,
-0.03464122861623764,
-0.04792758449912071,
-1.290106177330017,
1.1428464651107788,
2.5444588661193848,
-1.1452505588531494,
0.5108366012573242,
0.3318735957145691,
1.2003871202468872,
-1.5834592580795288,
0.3494936227798462,
-0.47042423486709595,
2.13962984085083,
0.22433902323246002,
1.2369681596755981,
-0.4121100902557373,
-2.3395450115203857,
0.6588239669799805,
-1.2750425338745117,
-1.2150546312332153,
0.7660201787948608,
-0.9104652404785156,
0.08577602356672287,
-1.3595638275146484,
-0.26739567518234253,
-0.8107321262359619,
-1.1702600717544556,
0.7123395204544067,
0.19492723047733307,
0.40810245275497437,
-0.5932864546775818,
0.32967281341552734,
-2.177422285079956,
-1.3329343795776367,
-0.2426656037569046,
-0.9773141741752625,
0.479112446308136,
-0.37365156412124634,
0.6992489695549011,
-0.2018287628889084,
0.04234130680561066,
0.3489323854446411,
1.4348852634429932,
3.378411293029785,
0.10135861486196518,
0.31843870878219604,
-0.22256334125995636,
-0.9166905879974365,
1.4896554946899414,
0.91806960105896,
-0.13356703519821167,
-0.49197447299957275,
-1.1497148275375366,
1.2617583274841309,
1.9596476554870605,
0.942861020565033,
-0.0034660869278013706,
-0.7816618084907532,
-0.6723064184188843,
-0.10550449788570404,
0.14543882012367249,
0.5120168924331665,
0.8827692270278931,
0.09282791614532471,
0.10155299305915833,
1.4284805059432983,
1.1626195907592773,
-0.4478418827056885,
0.3239295482635498,
-0.8351842761039734,
-0.4506429433822632,
0.5001628398895264,
0.25410014390945435,
-0.01121532078832388,
0.26259714365005493,
-0.9687768816947937,
-0.21404513716697693,
-0.4445995092391968,
-0.9316389560699463,
-0.7163748145103455,
-0.4066988229751587,
-0.3727467656135559,
1.6377545595169067,
0.13474303483963013,
-0.5558791756629944,
-0.02837587520480156,
-0.7328405976295471,
-0.046536464244127274,
-1.0999183654785156,
0.2579811215400696,
-0.13212937116622925,
-0.1523643434047699,
-0.14756765961647034,
1.725008487701416,
-0.9213540554046631,
-2.0106794834136963,
0.20864319801330566,
0.21491695940494537,
-0.20985452830791473,
0.30889666080474854,
1.628082513809204,
0.5285189151763916,
1.4926725625991821,
1.334924578666687,
0.9860462546348572,
-0.6372338533401489,
-1.3630647659301758,
0.6926770210266113,
0.9693904519081116,
-1.4299736022949219,
0.7484232187271118,
0.02491915598511696,
-0.5052053928375244,
0.6732683181762695,
1.2326700687408447,
0.5055698156356812,
-2.101264476776123,
0.8174012899398804,
-0.9920326471328735,
0.7806317806243896,
0.6879934072494507,
0.6760692000389099,
0.24347077310085297,
0.8029547929763794,
-1.151645541191101,
-1.1486726999282837,
-0.700944721698761,
-0.7075380682945251,
1.9790153503417969,
-0.30790412425994873,
0.599754273891449,
-0.18843422830104828,
-1.3851039409637451,
-0.012661265209317207,
0.692374587059021,
0.36238986253738403,
-0.47309231758117676,
0.7503275871276855,
-0.7281761765480042,
-1.1651562452316284,
-1.397810697555542,
-0.4397784471511841,
-1.103814721107483,
-0.9959898591041565,
1.0571959018707275,
0.7456608414649963,
0.2467239946126938,
1.8652968406677246,
0.6163383722305298,
0.2971993684768677,
-2.622817277908325,
0.9865115880966187,
0.2596198320388794,
-0.07783376425504684,
0.8388906121253967,
0.2894133925437927,
1.0325313806533813,
0.00641903281211853,
0.5513051748275757,
-2.4046051502227783,
2.3271493911743164,
-0.24919679760932922,
0.6612049341201782,
-0.007827511057257652,
-0.15227507054805756,
1.0891757011413574,
0.593078076839447,
0.6316245198249817,
-1.050098180770874,
0.6876004934310913,
-0.6341161131858826,
1.2978752851486206,
0.8167362213134766,
-0.8122537732124329,
-0.08100973814725876,
1.3068323135375977,
0.4511013627052307,
-0.5423576831817627,
-0.9270167350769043,
-1.089239478111267,
0.9332448840141296,
1.6818146705627441,
-0.11492062360048294,
-0.0566791407763958,
0.8441308736801147,
0.676094651222229,
-1.2898386716842651,
0.0831441655755043,
-0.7035263776779175,
-0.7355118989944458,
1.5577585697174072,
2.050224781036377,
-0.15668019652366638,
-0.24252738058567047,
-0.7768045663833618,
-1.26671302318573,
0.7644101977348328,
-0.051354773342609406,
0.03036399558186531,
0.6227371096611023,
-0.5651997327804565,
1.0281656980514526,
0.8689557909965515,
0.9103370308876038,
0.19172537326812744,
0.26818257570266724,
0.3748551607131958,
-0.35788047313690186,
-1.1995192766189575,
-0.25195711851119995,
-0.9927976131439209,
-2.608332395553589,
0.4514732360839844,
-0.16581128537654877,
-1.3770052194595337,
0.03804823383688927,
-1.0637425184249878,
0.9387388825416565,
-0.5612536072731018,
-1.1543484926223755,
-1.51014244556427,
0.07928025722503662,
-0.06172186881303787,
0.9288385510444641,
-1.6154470443725586,
-0.07941736280918121,
1.298117756843567,
0.9275737404823303,
-0.7052536606788635,
1.0884249210357666,
0.2900769114494324,
1.0397149324417114,
0.8440152406692505,
-0.3693259358406067,
0.6060178875923157,
0.011763999238610268,
-1.3398815393447876,
0.5004757642745972,
1.1688802242279053,
0.2467469424009323,
1.5462679862976074,
-0.6296613812446594,
-0.04492015019059181,
0.43522465229034424,
-0.663314163684845,
-0.447476863861084,
-0.5254576206207275,
0.7307261824607849,
-0.06430204212665558,
-0.8690587878227234,
0.05211975425481796,
-0.0848826915025711,
-0.19112657010555267,
0.1083579808473587,
-1.473142385482788,
-0.09721556305885315,
-0.3137611150741577,
-0.6428645849227905,
-1.278188705444336,
-0.04329659789800644,
1.4126473665237427,
-0.8015118837356567,
-0.21342818439006805,
0.43907034397125244,
0.35015541315078735,
0.4794163107872009,
0.6318588256835938,
-0.6323177218437195,
-0.32844310998916626,
-0.20213426649570465,
-0.326815664768219,
0.3641378879547119,
1.4322338104248047,
-0.11443165689706802,
-0.9820363521575928,
0.7609914541244507,
-0.30624955892562866,
0.05313883721828461,
1.8994745016098022,
0.08264786005020142,
-0.7897287607192993,
0.2979999780654907,
-0.7235297560691833,
1.9531108140945435,
1.7033486366271973,
1.3187469244003296,
-0.19227972626686096,
-0.9655264616012573,
0.6222324967384338,
-0.43738478422164917,
-0.39270657300949097,
0.8871968388557434,
0.40565043687820435,
-0.20855630934238434,
-1.3082205057144165,
0.7215048670768738,
1.24862802028656,
-0.8404048681259155,
-0.8335545063018799,
0.18447136878967285,
-0.7508139610290527,
1.0766472816467285,
0.6591916680335999,
0.38862329721450806,
0.2298753261566162,
1.5579570531845093,
0.7886137366294861,
-0.49131864309310913,
0.5678753852844238,
0.49478572607040405,
-0.23211517930030823,
-2.1465141773223877,
-1.154739260673523,
0.3902283310890198,
-0.5941962003707886,
-1.6481152772903442,
1.4025294780731201,
-1.083271861076355,
-1.0146998167037964,
0.5376320481300354,
0.07652923464775085,
1.4428521394729614,
0.3954697847366333,
1.5299197435379028,
2.050313949584961,
0.8556105494499207,
0.4632120728492737,
1.2697869539260864,
-0.1993681788444519,
-0.5161789655685425,
1.8161704540252686,
-0.46405136585235596,
0.4595259428024292,
1.1490648984909058,
-0.2695114016532898,
-1.0388662815093994,
-0.7562112808227539,
-1.2351408004760742,
-0.6989173293113708,
1.1103190183639526,
0.12887026369571686,
-1.1089885234832764,
0.26655256748199463,
1.50289785861969,
0.09726061671972275,
-0.376068651676178,
0.6441118121147156,
0.3363214135169983,
-0.7691918015480042,
-0.0211297869682312,
-0.921855628490448,
0.5615823864936829,
-0.28840523958206177,
-0.32762134075164795,
0.34495317935943604,
0.3996483087539673,
1.3589544296264648,
-0.0614871047437191,
0.1497587114572525,
1.1580886840820312,
-1.4040553569793701,
1.5189646482467651,
-0.6785892248153687,
0.2680680751800537,
-2.269096851348877,
1.30478036403656,
-0.8003623485565186,
1.9696866273880005,
-2.693514585494995,
0.4387246370315552,
-0.6354899406433105,
-0.4327343702316284,
0.32940834760665894,
-0.3170322775840759,
0.08530179411172867,
-0.17494548857212067,
-1.1602388620376587,
-0.05106288194656372,
-0.6816933751106262,
0.5680938363075256,
1.0793139934539795,
1.3365437984466553,
-1.1232725381851196,
-0.2570456862449646,
-1.723242998123169,
-0.14028160274028778,
-0.7815619707107544,
0.4469468593597412,
-2.023447275161743,
-0.1761537790298462,
-1.9294718503952026,
-2.345147132873535,
-1.186707615852356,
-0.8181675672531128,
1.1414233446121216,
0.16728098690509796,
-0.8102849721908569,
1.2488447427749634,
-0.3097918629646301,
-1.8463352918624878,
1.0438182353973389,
-2.1017818450927734
] |
https://github.com/huggingface/datasets/issues/6079 | Iterating over DataLoader based on HF datasets is stuck forever | Thanks!
Python 3.10 conda-env: After replacing with_format("torch") with with_format("numpy"), the error went away. However, it was still taking over 2 minutes to load a very small batch of 64 samples with num_workers set to 32. Once I removed with_format call altogether, it is finishing in 11 seconds.
Python 3.6 based conda-env: When I switch the kernel , neither of the above work, and with_format("torch") is the only thing that works, and executes in 1.6 seconds.
I feel something else is also amiss here. | ### Describe the bug
I am using Amazon Sagemaker notebook (Amazon Linux 2) with python 3.10 based Conda environment.
I have a dataset in parquet format locally. When I try to iterate over it, the loader is stuck forever. Note that the same code is working for python 3.6 based conda environment seamlessly. What should be my next steps here?
### Steps to reproduce the bug
```
train_dataset = load_dataset(
"parquet", data_files = {'train': tr_data_path + '*.parquet'},
split = 'train',
collate_fn = streaming_data_collate_fn,
streaming = True
).with_format('torch')
train_dataloader = DataLoader(train_dataset, batch_size = 2, num_workers = 0)
t = time.time()
iter_ = 0
for batch in train_dataloader:
iter_ += 1
if iter_ == 1000:
break
print (time.time() - t)
```
### Expected behavior
The snippet should work normally and load the next batch of data.
### Environment info
datasets: '2.14.0'
pyarrow: '12.0.0'
torch: '2.0.0'
Python: 3.10.10 | packaged by conda-forge | (main, Mar 24 2023, 20:08:06) [GCC 11.3.0]
!uname -r
5.10.178-162.673.amzn2.x86_64 | 45 | 83 | Iterating over DataLoader based on HF datasets is stuck forever
### Describe the bug
I am using Amazon Sagemaker notebook (Amazon Linux 2) with python 3.10 based Conda environment.
I have a dataset in parquet format locally. When I try to iterate over it, the loader is stuck forever. Note that the same code is working for python 3.6 based conda environment seamlessly. What should be my next steps here?
### Steps to reproduce the bug
```
train_dataset = load_dataset(
"parquet", data_files = {'train': tr_data_path + '*.parquet'},
split = 'train',
collate_fn = streaming_data_collate_fn,
streaming = True
).with_format('torch')
train_dataloader = DataLoader(train_dataset, batch_size = 2, num_workers = 0)
t = time.time()
iter_ = 0
for batch in train_dataloader:
iter_ += 1
if iter_ == 1000:
break
print (time.time() - t)
```
### Expected behavior
The snippet should work normally and load the next batch of data.
### Environment info
datasets: '2.14.0'
pyarrow: '12.0.0'
torch: '2.0.0'
Python: 3.10.10 | packaged by conda-forge | (main, Mar 24 2023, 20:08:06) [GCC 11.3.0]
!uname -r
5.10.178-162.673.amzn2.x86_64
Thanks!
Python 3.10 conda-env: After replacing with_format("torch") with with_format("numpy"), the error went away. However, it was still taking over 2 minutes to load a very small batch of 64 samples with num_workers set to 32. Once I removed with_format call altogether, it is finishing in 11 seconds.
Python 3.6 based conda-env: When I switch the kernel , neither of the above work, and with_format("torch") is the only thing that works, and executes in 1.6 seconds.
I feel something else is also amiss here. | [
-1.2701588869094849,
-0.997541069984436,
-0.6988049149513245,
1.51397705078125,
-0.25449058413505554,
-1.1525267362594604,
0.17723368108272552,
-0.9602234959602356,
1.6439114809036255,
-0.8577772378921509,
0.24207332730293274,
-1.6130080223083496,
0.08785462379455566,
-0.5229309797286987,
-0.6811166405677795,
-0.8537085056304932,
-0.400129497051239,
-0.8010273575782776,
1.1871026754379272,
2.476163864135742,
1.1733671426773071,
-1.4396486282348633,
2.732360601425171,
0.7051440477371216,
-0.17561303079128265,
-1.0406826734542847,
0.49575236439704895,
0.002503238618373871,
-1.3049198389053345,
-0.4783833920955658,
-0.9716491103172302,
-0.07708154618740082,
-0.56305992603302,
-0.43802228569984436,
0.018092865124344826,
0.3574293553829193,
-0.2873089611530304,
-0.4843795597553253,
-0.5461376905441284,
-0.7368584871292114,
0.41958796977996826,
-0.4199245572090149,
0.9315210580825806,
-0.3319796621799469,
1.847409725189209,
-0.46638062596321106,
0.4906671345233917,
0.7715662717819214,
1.253271460533142,
0.18565033376216888,
-0.03796330839395523,
0.35921189188957214,
0.43123728036880493,
0.006302153691649437,
0.5781643390655518,
1.1488054990768433,
0.6594728231430054,
0.43466728925704956,
0.6654775142669678,
-2.2378880977630615,
1.3189213275909424,
-1.0267679691314697,
0.3469168543815613,
1.317851185798645,
-0.9846623539924622,
0.38176023960113525,
-1.7128181457519531,
-0.03979557752609253,
0.653580367565155,
-2.224034070968628,
0.3294602930545807,
-1.3343183994293213,
-0.5041247010231018,
1.0220146179199219,
0.37165719270706177,
-1.1922883987426758,
0.09770189225673676,
-0.4650789499282837,
1.0417280197143555,
0.4054632782936096,
1.0925238132476807,
-1.6195753812789917,
-0.08321529626846313,
-0.275983989238739,
0.12834490835666656,
-1.3108586072921753,
-1.5227161645889282,
0.574711263179779,
0.6916375160217285,
0.5379039645195007,
-0.14215746521949768,
1.1034311056137085,
-1.1029599905014038,
0.8196528553962708,
-1.0427231788635254,
-1.6792923212051392,
-1.4665696620941162,
-2.376901149749756,
-2.2732508182525635,
0.7333661913871765,
-0.39804884791374207,
-0.49667394161224365,
2.1360435485839844,
-1.0553760528564453,
-1.6779736280441284,
1.213833212852478,
0.18864218890666962,
-0.01648104377090931,
2.367807626724243,
0.19370578229427338,
-0.740320086479187,
0.45152002573013306,
-0.8162388205528259,
0.7454320192337036,
-0.3527683913707733,
1.3318248987197876,
0.38049402832984924,
-1.003005862236023,
1.5774284601211548,
-0.3059832453727722,
0.5948058366775513,
-0.5899661779403687,
-0.527621328830719,
-0.7220793962478638,
0.2674453854560852,
1.9524391889572144,
-0.27683958411216736,
1.465733289718628,
-0.32064393162727356,
-1.5348618030548096,
-1.6278679370880127,
0.9373615980148315,
0.463352233171463,
-0.7661367654800415,
0.13881102204322815,
-0.34337809681892395,
0.1774672120809555,
-0.10009114444255829,
1.1231753826141357,
1.2972475290298462,
0.7393402457237244,
-0.3880881071090698,
-0.942970335483551,
0.2182033658027649,
-0.18103322386741638,
-0.6452265381813049,
-1.7721484899520874,
-0.38322171568870544,
-0.004006808623671532,
0.6771760582923889,
-1.2144695520401,
1.716679573059082,
0.9659044146537781,
1.8842787742614746,
1.0310038328170776,
-0.33475255966186523,
1.525872826576233,
0.14535485208034515,
1.8079302310943604,
-0.4700975716114044,
0.6284343004226685,
-0.395235151052475,
-1.1112496852874756,
0.7731799483299255,
-0.30525150895118713,
-1.9916465282440186,
-0.7214903235435486,
-0.8011318445205688,
-0.23762212693691254,
-0.8037933111190796,
0.9121501445770264,
-0.2873883545398712,
-1.4314733743667603,
0.2876891791820526,
-0.7240349650382996,
0.16790291666984558,
-1.185151219367981,
0.4094178080558777,
0.6866364479064941,
-0.5590044856071472,
0.1188606321811676,
-0.24109621345996857,
-1.2746286392211914,
-0.4516345262527466,
0.31067967414855957,
1.8552254438400269,
-0.7664498686790466,
0.8937448859214783,
1.11626398563385,
-0.6781495809555054,
0.0017331279814243317,
0.28495338559150696,
-0.27585262060165405,
0.8451113700866699,
-1.022613763809204,
-0.463473916053772,
1.2111033201217651,
-0.3218679428100586,
-0.584195613861084,
1.4826488494873047,
0.703504204750061,
-1.0147500038146973,
-0.23862643539905548,
-0.06592810153961182,
-0.7831775546073914,
0.1332242339849472,
-1.5895565748214722,
-0.14722754061222076,
0.4538007080554962,
-1.5740971565246582,
-0.45052289962768555,
-0.2127598226070404,
1.3598495721817017,
-0.061550725251436234,
1.5061075687408447,
-0.3865557312965393,
-0.19610269367694855,
-0.29733502864837646,
-0.378986656665802,
0.2033340483903885,
-0.19208388030529022,
-0.6044722199440002,
0.17079564929008484,
-0.7860938906669617,
0.32049694657325745,
1.4522050619125366,
0.3385075628757477,
-0.014925235882401466,
0.5170542001724243,
1.0526115894317627,
0.4553714692592621,
-0.013398164883255959,
-0.907142162322998,
-1.5020304918289185,
1.9925936460494995,
-1.463759422302246,
2.04013991355896,
0.7614389061927795,
-0.01898888312280178,
-1.7802704572677612,
-1.8901606798171997,
1.3464577198028564,
1.0796940326690674,
2.297956943511963,
0.48755207657814026,
0.3718251585960388,
-0.850169837474823,
-0.6473580598831177,
0.2762821912765503,
-1.0193513631820679,
-0.765593945980072,
0.14762891829013824,
2.4665307998657227,
1.7268548011779785,
-0.3922407627105713,
-0.11161129176616669,
-0.9851847887039185,
1.430478811264038,
-0.14847137033939362,
0.28826725482940674,
2.0063414573669434,
-0.2248963564634323,
-1.014085292816162,
1.2307307720184326,
-2.398024082183838,
0.1770232617855072,
2.0561842918395996,
0.2609591484069824,
0.10673551261425018,
-1.3951268196105957,
-0.5940955281257629,
-0.2858896851539612,
-0.470083624124527,
-1.1987589597702026,
0.5823470950126648,
-0.3053801655769348,
-0.8077788949012756,
-1.3958492279052734,
0.20675967633724213,
-1.1191632747650146,
-1.6542097330093384,
0.20028305053710938,
1.873580813407898,
2.090379238128662,
-0.7844973206520081,
1.5643737316131592,
-0.32795408368110657,
0.19403056800365448,
1.2133690118789673,
1.252477765083313,
3.1244661808013916,
1.969364047050476,
-1.2768090963363647,
0.6224083304405212,
-0.15433529019355774,
-0.441391259431839,
1.0869204998016357,
-1.2298392057418823,
1.3371058702468872,
-0.09940895438194275,
-1.1833235025405884,
-1.1315079927444458,
0.9790199995040894,
0.5570042729377747,
0.02749495953321457,
-0.41906237602233887,
1.2068365812301636,
0.07042533159255981,
1.2900521755218506,
0.467149555683136,
-0.3340808153152466,
0.639426589012146,
-0.44310757517814636,
-0.4880206882953644,
1.537368655204773,
0.17308934032917023,
-1.4367198944091797,
-2.2222447395324707,
-0.26654893159866333,
-0.8849257826805115,
0.016620906069874763,
-0.6116673946380615,
-0.9662140011787415,
1.625877022743225,
0.31765690445899963,
-1.2384741306304932,
-0.2577003836631775,
-0.3386326730251312,
-0.5744284391403198,
2.7145142555236816,
-1.3241969347000122,
-0.2918230891227722,
-0.964407205581665,
-0.6582754254341125,
1.649120807647705,
-1.246262788772583,
-0.24607224762439728,
-1.0149670839309692,
-0.5898327827453613,
-1.257222294807434,
-0.5416624546051025,
-0.013714661821722984,
-0.9535548686981201,
0.8954765200614929,
0.19149021804332733,
-1.190814733505249,
-0.3221549093723297,
-0.930261492729187,
0.8934396505355835,
-0.01993665099143982,
0.19407673180103302,
1.771870732307434,
0.288649320602417,
-0.42249295115470886,
0.7592858076095581,
1.122753620147705,
0.6431753039360046,
-0.69842529296875,
0.18848608434200287,
-0.6796755790710449,
0.3571891486644745,
-1.2056869268417358,
0.34484368562698364,
-2.898932456970215,
0.6180151700973511,
-0.03615841642022133,
-0.05562354251742363,
-0.06001171097159386,
-1.2819812297821045,
1.1560578346252441,
2.5419371128082275,
-1.15488862991333,
0.529338002204895,
0.36845487356185913,
1.2264981269836426,
-1.5638412237167358,
0.32753831148147583,
-0.46634334325790405,
2.1161136627197266,
0.24571901559829712,
1.2138577699661255,
-0.4198884665966034,
-2.386744976043701,
0.6719309091567993,
-1.2817288637161255,
-1.1550264358520508,
0.7292847037315369,
-0.9607398509979248,
0.09721380472183228,
-1.3678561449050903,
-0.26493093371391296,
-0.8309328556060791,
-1.1566781997680664,
0.6427813768386841,
0.20667502284049988,
0.41073429584503174,
-0.6036844849586487,
0.30793896317481995,
-2.2074856758117676,
-1.332542896270752,
-0.22885450720787048,
-0.9585644602775574,
0.48808494210243225,
-0.391293466091156,
0.7258768081665039,
-0.192579984664917,
0.03596463426947594,
0.34118327498435974,
1.4308717250823975,
3.34895920753479,
0.0667768120765686,
0.3026490807533264,
-0.2189941555261612,
-0.9393515586853027,
1.488121747970581,
0.9231635332107544,
-0.14700248837471008,
-0.5028260350227356,
-1.1634390354156494,
1.25087571144104,
1.9425779581069946,
0.9486922025680542,
-0.011282362975180149,
-0.790289580821991,
-0.6650676131248474,
-0.0919489711523056,
0.13651733100414276,
0.536473274230957,
0.9091496467590332,
0.022863119840621948,
0.09523709118366241,
1.465559720993042,
1.1924430131912231,
-0.4478757679462433,
0.3257329761981964,
-0.8411945104598999,
-0.4722015857696533,
0.48376044631004333,
0.2636289894580841,
0.0017910413444042206,
0.30885517597198486,
-0.9862009286880493,
-0.2153376042842865,
-0.4039338529109955,
-0.9349409341812134,
-0.7126690149307251,
-0.3929004669189453,
-0.3690302073955536,
1.6336477994918823,
0.2013021856546402,
-0.5318806767463684,
-0.0007514813914895058,
-0.743730366230011,
-0.04516824707388878,
-1.110672950744629,
0.24140551686286926,
-0.13072264194488525,
-0.10589176416397095,
-0.14330101013183594,
1.744181513786316,
-0.9011126756668091,
-2.043588638305664,
0.19388802349567413,
0.20713701844215393,
-0.18075038492679596,
0.2904224991798401,
1.6421003341674805,
0.5198937654495239,
1.50315523147583,
1.31060791015625,
0.9799487590789795,
-0.6150308847427368,
-1.3455204963684082,
0.730927050113678,
0.9919595122337341,
-1.4380972385406494,
0.7607240676879883,
0.004187021404504776,
-0.5007767081260681,
0.6978158950805664,
1.2225512266159058,
0.5030778646469116,
-2.125922918319702,
0.8506892919540405,
-1.060181736946106,
0.8145491480827332,
0.7028776407241821,
0.6676031947135925,
0.22411026060581207,
0.8384104371070862,
-1.179531455039978,
-1.1340285539627075,
-0.7203622460365295,
-0.7368834614753723,
2.0087132453918457,
-0.3232485353946686,
0.6017305254936218,
-0.20299945771694183,
-1.3571909666061401,
-0.03106197714805603,
0.6626098155975342,
0.3293890655040741,
-0.4529348909854889,
0.7838957905769348,
-0.7734266519546509,
-1.215181827545166,
-1.4156426191329956,
-0.4404192864894867,
-1.0748103857040405,
-1.0064456462860107,
1.0857503414154053,
0.7252930998802185,
0.25578200817108154,
1.892201542854309,
0.6086226105690002,
0.293865829706192,
-2.6118874549865723,
0.9458434581756592,
0.24943459033966064,
-0.08795712888240814,
0.8430770635604858,
0.2696574330329895,
1.0548341274261475,
0.009131236001849174,
0.5393955111503601,
-2.4205474853515625,
2.302962303161621,
-0.25213801860809326,
0.6903431415557861,
0.031327541917562485,
-0.1081976592540741,
1.0910946130752563,
0.6337183117866516,
0.6292688250541687,
-1.033584713935852,
0.6829966902732849,
-0.614971399307251,
1.2921192646026611,
0.8378676772117615,
-0.8100093603134155,
-0.03985774144530296,
1.289265513420105,
0.44301894307136536,
-0.5371102690696716,
-0.9209550619125366,
-1.080225944519043,
0.9273495078086853,
1.7155797481536865,
-0.1200663149356842,
-0.016470495611429214,
0.7762956619262695,
0.6931928992271423,
-1.3176597356796265,
0.02343207225203514,
-0.7318390607833862,
-0.6911810040473938,
1.541886568069458,
2.0845835208892822,
-0.1490609347820282,
-0.19841112196445465,
-0.6964938044548035,
-1.3225892782211304,
0.7296470999717712,
-0.11357168853282928,
0.08403365314006805,
0.627517580986023,
-0.5595477223396301,
0.9747501015663147,
0.8592299222946167,
0.9232542514801025,
0.2060817927122116,
0.2203969955444336,
0.37575259804725647,
-0.3459993302822113,
-1.164647102355957,
-0.24759136140346527,
-1.0085211992263794,
-2.620873212814331,
0.4088455140590668,
-0.17523649334907532,
-1.3874887228012085,
0.04433697089552879,
-1.0176173448562622,
0.9339920878410339,
-0.5484925508499146,
-1.099399209022522,
-1.4756193161010742,
0.10371339321136475,
-0.057510923594236374,
0.948765754699707,
-1.601898193359375,
-0.14192542433738708,
1.2785991430282593,
0.94895339012146,
-0.6865915656089783,
1.113865613937378,
0.30897924304008484,
1.034326434135437,
0.801051914691925,
-0.39684557914733887,
0.6022310853004456,
0.03375778719782829,
-1.3655141592025757,
0.48736709356307983,
1.1896202564239502,
0.24454063177108765,
1.4984310865402222,
-0.6304909586906433,
-0.047668177634477615,
0.44213050603866577,
-0.6548638939857483,
-0.45071181654930115,
-0.45142027735710144,
0.7206395864486694,
-0.08988116681575775,
-0.9008637070655823,
-0.008683786727488041,
-0.09296967089176178,
-0.23182687163352966,
0.1310228854417801,
-1.456172227859497,
-0.1316920667886734,
-0.35087838768959045,
-0.623658299446106,
-1.3152827024459839,
-0.02073967084288597,
1.4213351011276245,
-0.8183154463768005,
-0.21125882863998413,
0.39052528142929077,
0.4090016484260559,
0.4866131544113159,
0.6869946718215942,
-0.6659403443336487,
-0.3232826292514801,
-0.16934604942798615,
-0.29624515771865845,
0.3412942886352539,
1.4120323657989502,
-0.14376457035541534,
-0.9874352812767029,
0.7343681454658508,
-0.32073912024497986,
0.07997995615005493,
1.893159031867981,
0.101287841796875,
-0.7885724902153015,
0.3013136386871338,
-0.7826623916625977,
1.925851821899414,
1.6538807153701782,
1.3121453523635864,
-0.20486833155155182,
-0.8981655836105347,
0.6149631142616272,
-0.4193948209285736,
-0.37298521399497986,
0.8558034896850586,
0.42177844047546387,
-0.23558495938777924,
-1.3481262922286987,
0.7215728759765625,
1.2304282188415527,
-0.8653870820999146,
-0.8130067586898804,
0.21427702903747559,
-0.770249605178833,
1.109059453010559,
0.6775920987129211,
0.39914602041244507,
0.23272329568862915,
1.5880968570709229,
0.7911633253097534,
-0.5562694072723389,
0.5574920177459717,
0.5124606490135193,
-0.21768788993358612,
-2.1672778129577637,
-1.122112512588501,
0.3721122145652771,
-0.5731427073478699,
-1.5988121032714844,
1.396072506904602,
-1.0775927305221558,
-1.0298409461975098,
0.5315649509429932,
0.0628364235162735,
1.3640702962875366,
0.41966512799263,
1.5298104286193848,
2.053187131881714,
0.8699852824211121,
0.45985957980155945,
1.2555311918258667,
-0.1913464069366455,
-0.48673662543296814,
1.8368828296661377,
-0.4372262954711914,
0.43597790598869324,
1.1273621320724487,
-0.3029140830039978,
-1.0282363891601562,
-0.7551890015602112,
-1.193136215209961,
-0.6783844828605652,
1.1053550243377686,
0.13174454867839813,
-1.0867184400558472,
0.24139544367790222,
1.4866389036178589,
0.10542373359203339,
-0.36104193329811096,
0.6427332162857056,
0.35319843888282776,
-0.7637277245521545,
-0.04235018417239189,
-0.9192513227462769,
0.5311345458030701,
-0.30180248618125916,
-0.3712029755115509,
0.3471428155899048,
0.43112316727638245,
1.3583877086639404,
-0.09026262164115906,
0.13328129053115845,
1.1725841760635376,
-1.4174890518188477,
1.4953341484069824,
-0.669546902179718,
0.247810959815979,
-2.2625296115875244,
1.2863962650299072,
-0.7946011424064636,
1.9922667741775513,
-2.679826021194458,
0.4733025133609772,
-0.643458902835846,
-0.45683014392852783,
0.3069509267807007,
-0.3196514844894409,
0.06471969187259674,
-0.13366883993148804,
-1.1456785202026367,
-0.03428398072719574,
-0.6826178431510925,
0.5653589963912964,
1.1020526885986328,
1.2961952686309814,
-1.1087595224380493,
-0.25681719183921814,
-1.7000541687011719,
-0.15369229018688202,
-0.8527008295059204,
0.41491225361824036,
-2.0457310676574707,
-0.24195364117622375,
-1.9246095418930054,
-2.3166236877441406,
-1.2268078327178955,
-0.8670639991760254,
1.168347954750061,
0.18244387209415436,
-0.8461188673973083,
1.258316993713379,
-0.3147701025009155,
-1.8611137866973877,
1.0484116077423096,
-2.1141552925109863
] |
https://github.com/huggingface/datasets/issues/6079 | Iterating over DataLoader based on HF datasets is stuck forever | Can you share the `datasets` and `torch` versions installed in these conda envs?
> Once I removed with_format call altogether, it is finishing in 11 seconds.
Hmm, that's surprising. What are your dataset's `.features`? | ### Describe the bug
I am using Amazon Sagemaker notebook (Amazon Linux 2) with python 3.10 based Conda environment.
I have a dataset in parquet format locally. When I try to iterate over it, the loader is stuck forever. Note that the same code is working for python 3.6 based conda environment seamlessly. What should be my next steps here?
### Steps to reproduce the bug
```
train_dataset = load_dataset(
"parquet", data_files = {'train': tr_data_path + '*.parquet'},
split = 'train',
collate_fn = streaming_data_collate_fn,
streaming = True
).with_format('torch')
train_dataloader = DataLoader(train_dataset, batch_size = 2, num_workers = 0)
t = time.time()
iter_ = 0
for batch in train_dataloader:
iter_ += 1
if iter_ == 1000:
break
print (time.time() - t)
```
### Expected behavior
The snippet should work normally and load the next batch of data.
### Environment info
datasets: '2.14.0'
pyarrow: '12.0.0'
torch: '2.0.0'
Python: 3.10.10 | packaged by conda-forge | (main, Mar 24 2023, 20:08:06) [GCC 11.3.0]
!uname -r
5.10.178-162.673.amzn2.x86_64 | 45 | 34 | Iterating over DataLoader based on HF datasets is stuck forever
### Describe the bug
I am using Amazon Sagemaker notebook (Amazon Linux 2) with python 3.10 based Conda environment.
I have a dataset in parquet format locally. When I try to iterate over it, the loader is stuck forever. Note that the same code is working for python 3.6 based conda environment seamlessly. What should be my next steps here?
### Steps to reproduce the bug
```
train_dataset = load_dataset(
"parquet", data_files = {'train': tr_data_path + '*.parquet'},
split = 'train',
collate_fn = streaming_data_collate_fn,
streaming = True
).with_format('torch')
train_dataloader = DataLoader(train_dataset, batch_size = 2, num_workers = 0)
t = time.time()
iter_ = 0
for batch in train_dataloader:
iter_ += 1
if iter_ == 1000:
break
print (time.time() - t)
```
### Expected behavior
The snippet should work normally and load the next batch of data.
### Environment info
datasets: '2.14.0'
pyarrow: '12.0.0'
torch: '2.0.0'
Python: 3.10.10 | packaged by conda-forge | (main, Mar 24 2023, 20:08:06) [GCC 11.3.0]
!uname -r
5.10.178-162.673.amzn2.x86_64
Can you share the `datasets` and `torch` versions installed in these conda envs?
> Once I removed with_format call altogether, it is finishing in 11 seconds.
Hmm, that's surprising. What are your dataset's `.features`? | [
-1.2404839992523193,
-1.0219470262527466,
-0.7118972539901733,
1.579450011253357,
-0.21030646562576294,
-1.133574366569519,
0.14982429146766663,
-0.9466209411621094,
1.682141661643982,
-0.8303287625312805,
0.23833730816841125,
-1.617666482925415,
0.05280683934688568,
-0.5681951642036438,
-0.6765433549880981,
-0.8709424138069153,
-0.40911856293678284,
-0.8142486810684204,
1.1847891807556152,
2.4688432216644287,
1.1770515441894531,
-1.4352710247039795,
2.7073421478271484,
0.6908104419708252,
-0.17808797955513,
-1.0589077472686768,
0.4713391065597534,
-0.002701153978705406,
-1.292872428894043,
-0.4556739926338196,
-0.9839991331100464,
-0.07232900708913803,
-0.5972049832344055,
-0.4617023169994354,
-0.0022998210042715073,
0.38970673084259033,
-0.3227047324180603,
-0.4926636219024658,
-0.5056523680686951,
-0.7612011432647705,
0.4239923655986786,
-0.4176962673664093,
0.9451056122779846,
-0.320350706577301,
1.8215566873550415,
-0.4454863965511322,
0.48263218998908997,
0.7459844350814819,
1.2221221923828125,
0.19631537795066833,
-0.03830590844154358,
0.36948874592781067,
0.4177023470401764,
-0.004733451642096043,
0.5690035820007324,
1.1230777502059937,
0.6363811492919922,
0.43472543358802795,
0.6869372129440308,
-2.2936673164367676,
1.3158998489379883,
-1.0298196077346802,
0.30665701627731323,
1.3135504722595215,
-0.9959898591041565,
0.3873594403266907,
-1.696458339691162,
-0.03455934673547745,
0.6759653091430664,
-2.2043354511260986,
0.3301529586315155,
-1.3694181442260742,
-0.48877209424972534,
1.0233591794967651,
0.3699885904788971,
-1.1977477073669434,
0.09027944505214691,
-0.43661177158355713,
1.0526472330093384,
0.426688551902771,
1.0814026594161987,
-1.6798466444015503,
-0.08257098495960236,
-0.2943214178085327,
0.10318482667207718,
-1.3159016370773315,
-1.5162644386291504,
0.5518167018890381,
0.7052726149559021,
0.5530576109886169,
-0.14719286561012268,
1.1283199787139893,
-1.0753856897354126,
0.7630365490913391,
-1.072466254234314,
-1.7207478284835815,
-1.4290082454681396,
-2.3765780925750732,
-2.3359580039978027,
0.7157936096191406,
-0.3852865397930145,
-0.5099604725837708,
2.148608446121216,
-1.00980806350708,
-1.709897518157959,
1.1957957744598389,
0.20972150564193726,
-0.014168810099363327,
2.3549513816833496,
0.21049293875694275,
-0.7559255361557007,
0.4486068785190582,
-0.8133029341697693,
0.7445334792137146,
-0.33537840843200684,
1.3808915615081787,
0.40033185482025146,
-0.9985578656196594,
1.6050193309783936,
-0.274814635515213,
0.5734860897064209,
-0.619646430015564,
-0.5202553868293762,
-0.7462583184242249,
0.24525466561317444,
1.9639490842819214,
-0.27484339475631714,
1.4852211475372314,
-0.32548296451568604,
-1.5337828397750854,
-1.623948335647583,
0.9353733658790588,
0.40405890345573425,
-0.773701012134552,
0.15280646085739136,
-0.3206230103969574,
0.19103962182998657,
-0.09836743772029877,
1.1598197221755981,
1.2749656438827515,
0.7057585120201111,
-0.42528989911079407,
-0.9605124592781067,
0.23936733603477478,
-0.18523311614990234,
-0.6590787172317505,
-1.7784948348999023,
-0.3832004964351654,
0.021108482033014297,
0.6685187816619873,
-1.2112301588058472,
1.6651746034622192,
0.9175156950950623,
1.8924237489700317,
1.0367672443389893,
-0.3425351679325104,
1.4900834560394287,
0.13206404447555542,
1.8378503322601318,
-0.45651566982269287,
0.6144590377807617,
-0.4006514549255371,
-1.1304668188095093,
0.7876016497612,
-0.2964205741882324,
-1.9621673822402954,
-0.735653817653656,
-0.831057608127594,
-0.21298381686210632,
-0.7927009463310242,
0.8984547853469849,
-0.276347815990448,
-1.45742666721344,
0.3211877942085266,
-0.7481468319892883,
0.19209563732147217,
-1.2043325901031494,
0.40026766061782837,
0.6911644339561462,
-0.5450448393821716,
0.12756651639938354,
-0.2687912583351135,
-1.2905443906784058,
-0.474135160446167,
0.34984850883483887,
1.835105538368225,
-0.7599431276321411,
0.8973667621612549,
1.1204825639724731,
-0.7088857293128967,
0.008125783875584602,
0.2568724453449249,
-0.22410675883293152,
0.8577117323875427,
-1.013865351676941,
-0.45861196517944336,
1.2180886268615723,
-0.34109553694725037,
-0.6332736611366272,
1.4872485399246216,
0.7228327393531799,
-1.013635516166687,
-0.24279636144638062,
-0.07481902837753296,
-0.77083420753479,
0.1203618273139,
-1.5901856422424316,
-0.15866094827651978,
0.47797539830207825,
-1.5835741758346558,
-0.4481205642223358,
-0.2274564504623413,
1.3996813297271729,
-0.0828721821308136,
1.4886990785598755,
-0.36719194054603577,
-0.22481733560562134,
-0.29822561144828796,
-0.3796465992927551,
0.19677236676216125,
-0.20008516311645508,
-0.6071285605430603,
0.1572774052619934,
-0.7743431329727173,
0.3433481752872467,
1.413101315498352,
0.3277679681777954,
-0.027005286887288094,
0.493884801864624,
1.0680540800094604,
0.4335803985595703,
-0.0008302181959152222,
-0.8708881735801697,
-1.491752028465271,
1.9815155267715454,
-1.4404031038284302,
2.0074052810668945,
0.7183507084846497,
-0.0026474539190530777,
-1.7855361700057983,
-1.8801376819610596,
1.3952020406723022,
1.0756515264511108,
2.285630226135254,
0.5258547067642212,
0.39291808009147644,
-0.8702539205551147,
-0.6629776954650879,
0.26976701617240906,
-0.9849939942359924,
-0.771521806716919,
0.16177105903625488,
2.464184522628784,
1.7168062925338745,
-0.38633227348327637,
-0.10762622207403183,
-0.996357262134552,
1.4288580417633057,
-0.14926794171333313,
0.2734389007091522,
2.0040132999420166,
-0.24326607584953308,
-1.016008734703064,
1.2330034971237183,
-2.3909833431243896,
0.15202677249908447,
2.059507131576538,
0.2610805630683899,
0.10768943279981613,
-1.392643690109253,
-0.6431088447570801,
-0.2840668559074402,
-0.4808625876903534,
-1.1848289966583252,
0.5629338026046753,
-0.31729695200920105,
-0.7860865592956543,
-1.4396052360534668,
0.23022907972335815,
-1.0739258527755737,
-1.6620033979415894,
0.16203030943870544,
1.894827961921692,
2.046485185623169,
-0.7547871470451355,
1.6030510663986206,
-0.31952399015426636,
0.2372312843799591,
1.2740730047225952,
1.2404627799987793,
3.1162960529327393,
2.0030465126037598,
-1.2488735914230347,
0.6604598760604858,
-0.0972241535782814,
-0.46157756447792053,
1.1278711557388306,
-1.2333999872207642,
1.326080083847046,
-0.15074190497398376,
-1.2035530805587769,
-1.1791579723358154,
0.9837841391563416,
0.5746381878852844,
0.017730113118886948,
-0.44405102729797363,
1.215837836265564,
0.07921389490365982,
1.2640175819396973,
0.4668547809123993,
-0.3347717821598053,
0.6718351244926453,
-0.4527745842933655,
-0.4864806830883026,
1.533349633216858,
0.18335527181625366,
-1.426499605178833,
-2.2117526531219482,
-0.2858714759349823,
-0.8571293354034424,
-0.009150111116468906,
-0.6174416542053223,
-0.9779652953147888,
1.6073973178863525,
0.33716100454330444,
-1.2604038715362549,
-0.2523183226585388,
-0.3232373893260956,
-0.5766150951385498,
2.7214913368225098,
-1.2914308309555054,
-0.2898692190647125,
-0.959143877029419,
-0.6694746017456055,
1.680742621421814,
-1.2123703956604004,
-0.2492700219154358,
-0.992137610912323,
-0.5979557633399963,
-1.2940212488174438,
-0.5543254613876343,
-0.033768776804208755,
-0.9315159916877747,
0.8702045679092407,
0.17586293816566467,
-1.2017160654067993,
-0.2853221297264099,
-0.9377727508544922,
0.8805773854255676,
-0.047894272953271866,
0.21109792590141296,
1.8058052062988281,
0.3211081922054291,
-0.43115532398223877,
0.7232886552810669,
1.0792460441589355,
0.6591672897338867,
-0.6904904842376709,
0.21171754598617554,
-0.6616030335426331,
0.3484114706516266,
-1.2028181552886963,
0.3354994058609009,
-2.929196834564209,
0.6173917055130005,
-0.02798370085656643,
-0.04853726550936699,
-0.04800921306014061,
-1.2711007595062256,
1.1668882369995117,
2.5011942386627197,
-1.1901333332061768,
0.5426518321037292,
0.3489154279232025,
1.2044718265533447,
-1.5754709243774414,
0.3326685428619385,
-0.437301903963089,
2.1400177478790283,
0.22496908903121948,
1.2413244247436523,
-0.39625033736228943,
-2.3212151527404785,
0.6824098229408264,
-1.2629005908966064,
-1.1823079586029053,
0.7213446497917175,
-0.9611981511116028,
0.11207866668701172,
-1.3516511917114258,
-0.2595834732055664,
-0.8092309236526489,
-1.1778134107589722,
0.692532479763031,
0.19160938262939453,
0.3926199674606323,
-0.5873554944992065,
0.3469609022140503,
-2.1902902126312256,
-1.3305988311767578,
-0.25872087478637695,
-0.9982530474662781,
0.47630441188812256,
-0.3776572346687317,
0.7027084231376648,
-0.20864799618721008,
0.03345201909542084,
0.34211671352386475,
1.4200153350830078,
3.3642797470092773,
0.09444421529769897,
0.3209697902202606,
-0.18153351545333862,
-0.9366363883018494,
1.5048054456710815,
0.9340043663978577,
-0.15295317769050598,
-0.4457966983318329,
-1.1619236469268799,
1.252238392829895,
1.95101797580719,
0.95511794090271,
0.0029531149193644524,
-0.7523399591445923,
-0.6840933561325073,
-0.0714832991361618,
0.14975756406784058,
0.5192348957061768,
0.8560516834259033,
0.07949460297822952,
0.10514038056135178,
1.4244089126586914,
1.150841236114502,
-0.4340521991252899,
0.33633124828338623,
-0.8375714421272278,
-0.48832932114601135,
0.4842342138290405,
0.2563413977622986,
-0.019272875040769577,
0.277149498462677,
-0.9894610643386841,
-0.19296085834503174,
-0.4142071306705475,
-0.9400429129600525,
-0.715405285358429,
-0.41083961725234985,
-0.36991211771965027,
1.6275678873062134,
0.17412069439888,
-0.5455135703086853,
-0.01870451681315899,
-0.7184479236602783,
-0.028691161423921585,
-1.1152369976043701,
0.24856531620025635,
-0.13065898418426514,
-0.12185470759868622,
-0.14043211936950684,
1.744508147239685,
-0.9167934060096741,
-2.054716110229492,
0.19703862071037292,
0.2109781801700592,
-0.21763551235198975,
0.315435528755188,
1.6401898860931396,
0.5128792524337769,
1.5176254510879517,
1.3083553314208984,
1.0140559673309326,
-0.6426788568496704,
-1.3403658866882324,
0.7096289396286011,
0.9870532155036926,
-1.4062169790267944,
0.7771017551422119,
0.02128569409251213,
-0.4967062175273895,
0.6672928929328918,
1.2414957284927368,
0.4936654567718506,
-2.109680414199829,
0.8256683945655823,
-1.0167269706726074,
0.7721311450004578,
0.6797981262207031,
0.6882230639457703,
0.2152937352657318,
0.8122323155403137,
-1.1590535640716553,
-1.1231930255889893,
-0.7155241370201111,
-0.735377848148346,
1.9778215885162354,
-0.3220524489879608,
0.5891772508621216,
-0.1887744963169098,
-1.3736233711242676,
-0.0031722914427518845,
0.6910238862037659,
0.35963091254234314,
-0.4717552363872528,
0.778873085975647,
-0.7418169379234314,
-1.2149654626846313,
-1.4000102281570435,
-0.44912204146385193,
-1.072259545326233,
-1.004077672958374,
1.0555527210235596,
0.7365791201591492,
0.2500673532485962,
1.8667715787887573,
0.5896375179290771,
0.2915869355201721,
-2.5992190837860107,
0.9771204590797424,
0.24141594767570496,
-0.05298352614045143,
0.8379186987876892,
0.2823549211025238,
1.0534844398498535,
-0.0335545539855957,
0.5371406078338623,
-2.379326820373535,
2.2960174083709717,
-0.23523983359336853,
0.6610020399093628,
0.020148009061813354,
-0.09528150409460068,
1.076216459274292,
0.5921005606651306,
0.6445627808570862,
-1.0418808460235596,
0.726813793182373,
-0.6156741976737976,
1.2937901020050049,
0.846942126750946,
-0.7902117967605591,
-0.05760509520769119,
1.309283971786499,
0.44588446617126465,
-0.5443635582923889,
-0.9230704307556152,
-1.0804089307785034,
0.9326514601707458,
1.6774005889892578,
-0.13879558444023132,
-0.04233500733971596,
0.8428437113761902,
0.6650099158287048,
-1.3069959878921509,
0.061006397008895874,
-0.7210120558738708,
-0.687172532081604,
1.5490354299545288,
2.0635058879852295,
-0.17008888721466064,
-0.22416642308235168,
-0.7323115468025208,
-1.296929955482483,
0.7262781858444214,
-0.060560259968042374,
0.029825709760189056,
0.6439225077629089,
-0.5715837478637695,
0.9724148511886597,
0.8499829769134521,
0.8724105954170227,
0.20327258110046387,
0.24677008390426636,
0.3800465166568756,
-0.3242975175380707,
-1.1808698177337646,
-0.22436729073524475,
-0.9896221160888672,
-2.5920541286468506,
0.4338616132736206,
-0.157233327627182,
-1.3767951726913452,
0.026615481823682785,
-1.0512787103652954,
0.9602015614509583,
-0.5414456129074097,
-1.1284855604171753,
-1.5040687322616577,
0.07442585378885269,
-0.06381052732467651,
0.9384097456932068,
-1.5809214115142822,
-0.10119231045246124,
1.3046023845672607,
0.928875207901001,
-0.7292664051055908,
1.1291224956512451,
0.2784682810306549,
1.0330365896224976,
0.8161465525627136,
-0.3768589496612549,
0.6104965209960938,
0.020448993891477585,
-1.3379063606262207,
0.49680477380752563,
1.1876451969146729,
0.23346185684204102,
1.5247317552566528,
-0.6718766689300537,
-0.09301521629095078,
0.43866676092147827,
-0.6335222721099854,
-0.42324140667915344,
-0.503722071647644,
0.7055980563163757,
-0.05505562946200371,
-0.8709168434143066,
0.03895866125822067,
-0.09099972993135452,
-0.17705437541007996,
0.12330632656812668,
-1.4812467098236084,
-0.09876496344804764,
-0.31889599561691284,
-0.6259139776229858,
-1.2773679494857788,
-0.027915671467781067,
1.423396348953247,
-0.8203861713409424,
-0.22438371181488037,
0.40761396288871765,
0.39171314239501953,
0.5214644074440002,
0.6514793038368225,
-0.6359439492225647,
-0.29869598150253296,
-0.18657192587852478,
-0.29532867670059204,
0.3557620942592621,
1.4198960065841675,
-0.10271525382995605,
-1.005256175994873,
0.7744722962379456,
-0.3366924822330475,
0.06565865874290466,
1.907729148864746,
0.08147642761468887,
-0.8183178901672363,
0.25735992193222046,
-0.7625986337661743,
1.9720720052719116,
1.6775494813919067,
1.3314372301101685,
-0.19511845707893372,
-0.9528805613517761,
0.6132036447525024,
-0.40902307629585266,
-0.39232540130615234,
0.8969259262084961,
0.4084073007106781,
-0.23827320337295532,
-1.2951889038085938,
0.7209876179695129,
1.2214566469192505,
-0.8754191994667053,
-0.8338174223899841,
0.2101222574710846,
-0.745800256729126,
1.086289405822754,
0.6778838634490967,
0.42128175497055054,
0.2245256006717682,
1.5951688289642334,
0.8024395108222961,
-0.5227312445640564,
0.569794774055481,
0.514235258102417,
-0.2346559464931488,
-2.1351749897003174,
-1.15257728099823,
0.36254456639289856,
-0.5878848433494568,
-1.6273654699325562,
1.3832311630249023,
-1.0836338996887207,
-0.9975859522819519,
0.5189939737319946,
0.052642688155174255,
1.4265892505645752,
0.38911595940589905,
1.5396714210510254,
2.0580573081970215,
0.8521215915679932,
0.47585925459861755,
1.2754979133605957,
-0.2222718894481659,
-0.5118652582168579,
1.8154047727584839,
-0.48006466031074524,
0.45666930079460144,
1.1370145082473755,
-0.29314497113227844,
-1.0264270305633545,
-0.7381383776664734,
-1.2148683071136475,
-0.6476715803146362,
1.105097770690918,
0.14037960767745972,
-1.115392804145813,
0.26010632514953613,
1.4880973100662231,
0.10874415189027786,
-0.384830117225647,
0.6548544764518738,
0.3087010085582733,
-0.784130871295929,
0.00712084025144577,
-0.9545023441314697,
0.548505425453186,
-0.29704681038856506,
-0.32277578115463257,
0.33625856041908264,
0.38941627740859985,
1.3465266227722168,
-0.04589374363422394,
0.16259080171585083,
1.1685882806777954,
-1.3843308687210083,
1.5167772769927979,
-0.6735242009162903,
0.2533511221408844,
-2.266502857208252,
1.2825214862823486,
-0.8174306750297546,
1.9889562129974365,
-2.711045026779175,
0.43311282992362976,
-0.6254880428314209,
-0.47031348943710327,
0.31813955307006836,
-0.340495228767395,
0.0710403323173523,
-0.14455783367156982,
-1.1796143054962158,
-0.04846638813614845,
-0.6946619749069214,
0.5531837344169617,
1.0988938808441162,
1.3048385381698608,
-1.114607334136963,
-0.25405892729759216,
-1.718196153640747,
-0.153367817401886,
-0.810350239276886,
0.46555233001708984,
-2.025583028793335,
-0.20583340525627136,
-1.898470401763916,
-2.356397867202759,
-1.1655454635620117,
-0.8252571225166321,
1.1304211616516113,
0.12385492771863937,
-0.8548401594161987,
1.2465832233428955,
-0.3081866204738617,
-1.865272045135498,
1.0330631732940674,
-2.0952751636505127
] |
https://github.com/huggingface/datasets/issues/6079 | Iterating over DataLoader based on HF datasets is stuck forever | Python 3.6:
datasets.__version__ 2.4.0
torch.__version__ 1.10.1+cu102
Python 3.10:
datasets.__version__ 2.14.0
torch.__version__ 2.0.0
Anonymized features are of the form (subset shown here):
{
'string_feature_i': Value(dtype='string', id=None),
'numerical_feature_i': Value(dtype='decimal128(38, 0)', id=None),
'numerical_feature_series_i': Sequence(feature=Value(dtype='float64', id=None), length=-1, id=None),
}
There is no output from .features in python 3.6 kernel BTW. | ### Describe the bug
I am using Amazon Sagemaker notebook (Amazon Linux 2) with python 3.10 based Conda environment.
I have a dataset in parquet format locally. When I try to iterate over it, the loader is stuck forever. Note that the same code is working for python 3.6 based conda environment seamlessly. What should be my next steps here?
### Steps to reproduce the bug
```
train_dataset = load_dataset(
"parquet", data_files = {'train': tr_data_path + '*.parquet'},
split = 'train',
collate_fn = streaming_data_collate_fn,
streaming = True
).with_format('torch')
train_dataloader = DataLoader(train_dataset, batch_size = 2, num_workers = 0)
t = time.time()
iter_ = 0
for batch in train_dataloader:
iter_ += 1
if iter_ == 1000:
break
print (time.time() - t)
```
### Expected behavior
The snippet should work normally and load the next batch of data.
### Environment info
datasets: '2.14.0'
pyarrow: '12.0.0'
torch: '2.0.0'
Python: 3.10.10 | packaged by conda-forge | (main, Mar 24 2023, 20:08:06) [GCC 11.3.0]
!uname -r
5.10.178-162.673.amzn2.x86_64 | 45 | 46 | Iterating over DataLoader based on HF datasets is stuck forever
### Describe the bug
I am using Amazon Sagemaker notebook (Amazon Linux 2) with python 3.10 based Conda environment.
I have a dataset in parquet format locally. When I try to iterate over it, the loader is stuck forever. Note that the same code is working for python 3.6 based conda environment seamlessly. What should be my next steps here?
### Steps to reproduce the bug
```
train_dataset = load_dataset(
"parquet", data_files = {'train': tr_data_path + '*.parquet'},
split = 'train',
collate_fn = streaming_data_collate_fn,
streaming = True
).with_format('torch')
train_dataloader = DataLoader(train_dataset, batch_size = 2, num_workers = 0)
t = time.time()
iter_ = 0
for batch in train_dataloader:
iter_ += 1
if iter_ == 1000:
break
print (time.time() - t)
```
### Expected behavior
The snippet should work normally and load the next batch of data.
### Environment info
datasets: '2.14.0'
pyarrow: '12.0.0'
torch: '2.0.0'
Python: 3.10.10 | packaged by conda-forge | (main, Mar 24 2023, 20:08:06) [GCC 11.3.0]
!uname -r
5.10.178-162.673.amzn2.x86_64
Python 3.6:
datasets.__version__ 2.4.0
torch.__version__ 1.10.1+cu102
Python 3.10:
datasets.__version__ 2.14.0
torch.__version__ 2.0.0
Anonymized features are of the form (subset shown here):
{
'string_feature_i': Value(dtype='string', id=None),
'numerical_feature_i': Value(dtype='decimal128(38, 0)', id=None),
'numerical_feature_series_i': Sequence(feature=Value(dtype='float64', id=None), length=-1, id=None),
}
There is no output from .features in python 3.6 kernel BTW. | [
-1.3298096656799316,
-1.0528417825698853,
-0.6605807542800903,
1.6113710403442383,
-0.2553796172142029,
-1.1346224546432495,
0.14628013968467712,
-0.9305062890052795,
1.6034176349639893,
-0.8199122548103333,
0.21513554453849792,
-1.5423533916473389,
0.0535685159265995,
-0.5379592776298523,
-0.6568678021430969,
-0.8877080678939819,
-0.41272836923599243,
-0.7808212041854858,
1.240541696548462,
2.4377236366271973,
1.2058030366897583,
-1.4060343503952026,
2.7201051712036133,
0.7342470288276672,
-0.16559003293514252,
-1.1063780784606934,
0.4977268576622009,
-0.01951708272099495,
-1.3277523517608643,
-0.48728951811790466,
-0.9583196043968201,
-0.0746922567486763,
-0.5892537832260132,
-0.3679662346839905,
-0.0067544542253017426,
0.388237327337265,
-0.31283870339393616,
-0.47349461913108826,
-0.5485016107559204,
-0.7462009787559509,
0.429190456867218,
-0.3966425359249115,
0.8766894936561584,
-0.31062135100364685,
1.7567558288574219,
-0.4459487795829773,
0.5164694786071777,
0.7663624286651611,
1.2304250001907349,
0.1641569286584854,
-0.014109134674072266,
0.3526906371116638,
0.443592369556427,
0.030247971415519714,
0.5706951022148132,
1.1061228513717651,
0.6443842053413391,
0.384914755821228,
0.6305557489395142,
-2.305426597595215,
1.3170167207717896,
-1.0075281858444214,
0.33009761571884155,
1.3224494457244873,
-0.9808305501937866,
0.383125901222229,
-1.6889476776123047,
0.011781119741499424,
0.7156786918640137,
-2.190356969833374,
0.3466074466705322,
-1.3672701120376587,
-0.4797239303588867,
1.0213700532913208,
0.4154771864414215,
-1.17369544506073,
0.0958121046423912,
-0.469936341047287,
1.0867087841033936,
0.41527995467185974,
1.0281050205230713,
-1.6431949138641357,
-0.11028776317834854,
-0.24587754905223846,
0.11941635608673096,
-1.3114062547683716,
-1.5344176292419434,
0.5221985578536987,
0.6808720827102661,
0.5735642313957214,
-0.14031444489955902,
1.1314897537231445,
-1.1123781204223633,
0.7844494581222534,
-1.110348105430603,
-1.7009936571121216,
-1.4750242233276367,
-2.4715611934661865,
-2.2965457439422607,
0.6591904163360596,
-0.37066879868507385,
-0.4831637442111969,
2.1217620372772217,
-1.0498279333114624,
-1.6916004419326782,
1.2090089321136475,
0.201524555683136,
0.06429339945316315,
2.3324131965637207,
0.17948728799819946,
-0.7365530729293823,
0.44389283657073975,
-0.8688836693763733,
0.6971193552017212,
-0.3116282522678375,
1.3276264667510986,
0.3858857750892639,
-0.990355372428894,
1.5281120538711548,
-0.2604154646396637,
0.6138818264007568,
-0.5770568251609802,
-0.4937233030796051,
-0.7603422999382019,
0.2457890510559082,
1.9453270435333252,
-0.23627564311027527,
1.4641101360321045,
-0.3266807198524475,
-1.5220617055892944,
-1.6265939474105835,
0.9376896023750305,
0.4239308536052704,
-0.7763253450393677,
0.12766385078430176,
-0.3682941496372223,
0.2137976884841919,
-0.13541485369205475,
1.1520415544509888,
1.2930686473846436,
0.7195678353309631,
-0.457512766122818,
-0.9251107573509216,
0.20036306977272034,
-0.18151797354221344,
-0.6472330689430237,
-1.8213599920272827,
-0.33327946066856384,
0.01547329593449831,
0.7204570770263672,
-1.1775461435317993,
1.663291096687317,
0.9508802890777588,
1.8812215328216553,
1.040842056274414,
-0.38166651129722595,
1.5006409883499146,
0.1353568732738495,
1.782106637954712,
-0.5345985293388367,
0.6371340155601501,
-0.3916819989681244,
-1.1111185550689697,
0.7930999398231506,
-0.26289770007133484,
-2.0097310543060303,
-0.7296554446220398,
-0.748384952545166,
-0.24465619027614594,
-0.7623983025550842,
0.91902095079422,
-0.30389612913131714,
-1.4598945379257202,
0.2653425931930542,
-0.7887330651283264,
0.23003911972045898,
-1.1290696859359741,
0.38064661622047424,
0.7115272283554077,
-0.5278688669204712,
0.10445426404476166,
-0.24730628728866577,
-1.2637470960617065,
-0.4578188955783844,
0.41908279061317444,
1.784500241279602,
-0.729085385799408,
0.8928185105323792,
1.108392357826233,
-0.657238781452179,
0.04793861508369446,
0.2337539792060852,
-0.21460454165935516,
0.8394777774810791,
-0.9866271615028381,
-0.5029770135879517,
1.2425585985183716,
-0.3867681622505188,
-0.6586636304855347,
1.4975367784500122,
0.7363064289093018,
-1.0253517627716064,
-0.2723301351070404,
-0.06893404573202133,
-0.7865318655967712,
0.15967358648777008,
-1.5960721969604492,
-0.15622034668922424,
0.5437184572219849,
-1.6543500423431396,
-0.4008355736732483,
-0.21027196943759918,
1.4516161680221558,
-0.04770457372069359,
1.493013620376587,
-0.3466118574142456,
-0.1735621988773346,
-0.2699161469936371,
-0.3762969374656677,
0.26039260625839233,
-0.20900453627109528,
-0.549628734588623,
0.14312446117401123,
-0.8172961473464966,
0.35519787669181824,
1.41789972782135,
0.30123233795166016,
0.010617990978062153,
0.47389766573905945,
1.049509048461914,
0.4567943215370178,
-0.012835398316383362,
-0.8815492391586304,
-1.5344336032867432,
1.9951778650283813,
-1.4366347789764404,
2.0467331409454346,
0.7327418327331543,
-0.04415244609117508,
-1.7722376585006714,
-1.8924447298049927,
1.3063515424728394,
1.014277696609497,
2.271087884902954,
0.4778875410556793,
0.3826715648174286,
-0.8967732787132263,
-0.695395827293396,
0.25370892882347107,
-0.9742234945297241,
-0.7443904876708984,
0.11583608388900757,
2.500246524810791,
1.7589675188064575,
-0.3449496030807495,
-0.139967143535614,
-0.9746915102005005,
1.4815713167190552,
-0.1475854218006134,
0.32064956426620483,
2.023254156112671,
-0.16327257454395294,
-0.9519746899604797,
1.2411925792694092,
-2.439650774002075,
0.2246776968240738,
2.0809898376464844,
0.2661683261394501,
0.1167345941066742,
-1.4474728107452393,
-0.6591652631759644,
-0.3080587387084961,
-0.46811431646347046,
-1.2145193815231323,
0.5837011337280273,
-0.33429574966430664,
-0.8078678250312805,
-1.403925895690918,
0.2203434407711029,
-1.0875221490859985,
-1.6999709606170654,
0.1864013671875,
1.896652102470398,
2.060994863510132,
-0.7472561597824097,
1.5853350162506104,
-0.3182758390903473,
0.19023658335208893,
1.2461810111999512,
1.2608230113983154,
3.084324836730957,
1.9837907552719116,
-1.2662056684494019,
0.6411632299423218,
-0.14246581494808197,
-0.40717631578445435,
1.067945122718811,
-1.2551651000976562,
1.3539741039276123,
-0.09997829794883728,
-1.1977049112319946,
-1.158055067062378,
1.0571730136871338,
0.5890811681747437,
0.02030102163553238,
-0.43865302205085754,
1.2072348594665527,
0.04305168241262436,
1.2940404415130615,
0.5118613839149475,
-0.33250346779823303,
0.6354326009750366,
-0.4520094096660614,
-0.5543413758277893,
1.5035521984100342,
0.16978125274181366,
-1.470381259918213,
-2.1955950260162354,
-0.30629679560661316,
-0.8415234088897705,
-0.02840442582964897,
-0.5973462462425232,
-0.9765687584877014,
1.5834574699401855,
0.32287028431892395,
-1.2472670078277588,
-0.2238522469997406,
-0.319909006357193,
-0.5358518958091736,
2.749755859375,
-1.247222900390625,
-0.2794698476791382,
-0.9774842858314514,
-0.657322883605957,
1.6394692659378052,
-1.2139617204666138,
-0.25972437858581543,
-1.0420377254486084,
-0.6102108359336853,
-1.2480415105819702,
-0.49600929021835327,
-0.01873777247965336,
-0.9458726048469543,
0.8809444308280945,
0.18333588540554047,
-1.2144854068756104,
-0.3508009612560272,
-0.9187620878219604,
0.9590059518814087,
0.027036864310503006,
0.1829356849193573,
1.779680848121643,
0.24416980147361755,
-0.40415292978286743,
0.7793243527412415,
1.0686781406402588,
0.6897273063659668,
-0.7000268697738647,
0.16137400269508362,
-0.6016284823417664,
0.3542580306529999,
-1.1922632455825806,
0.34162622690200806,
-2.94655442237854,
0.6389192938804626,
-0.012028021737933159,
-0.07773629575967789,
-0.08784136176109314,
-1.2962933778762817,
1.1712054014205933,
2.53718900680542,
-1.205325961112976,
0.5663360357284546,
0.39433759450912476,
1.1521528959274292,
-1.581709861755371,
0.3822462260723114,
-0.475996196269989,
2.1428327560424805,
0.2546006739139557,
1.2779309749603271,
-0.41683119535446167,
-2.3808391094207764,
0.6964200735092163,
-1.2598828077316284,
-1.149595022201538,
0.7038966417312622,
-0.97724848985672,
0.17917096614837646,
-1.3928098678588867,
-0.27770617604255676,
-0.8433841466903687,
-1.1870858669281006,
0.5930837988853455,
0.21439528465270996,
0.38807544112205505,
-0.5822017788887024,
0.3329574763774872,
-2.2248523235321045,
-1.3111988306045532,
-0.2288307100534439,
-0.9757033586502075,
0.4956132173538208,
-0.444321870803833,
0.6854671239852905,
-0.1373787224292755,
0.025658175349235535,
0.3117533326148987,
1.4553030729293823,
3.377739191055298,
0.05609909072518349,
0.26771751046180725,
-0.20958442986011505,
-0.9354488849639893,
1.489590048789978,
0.9218397736549377,
-0.11817806214094162,
-0.5024507641792297,
-1.1190820932388306,
1.2766056060791016,
1.9700708389282227,
0.9779214859008789,
-0.006018719170242548,
-0.7839645147323608,
-0.6996831297874451,
-0.04501982405781746,
0.1521109938621521,
0.562126636505127,
0.8680147528648376,
0.02625339850783348,
0.0750046893954277,
1.4804762601852417,
1.1548007726669312,
-0.38245269656181335,
0.27491873502731323,
-0.8889657855033875,
-0.4674834907054901,
0.46740469336509705,
0.23994314670562744,
-0.04806872084736824,
0.33986151218414307,
-1.0356454849243164,
-0.13198105990886688,
-0.43660926818847656,
-0.884505033493042,
-0.7055289149284363,
-0.3992696702480316,
-0.4339792728424072,
1.6008182764053345,
0.2286803275346756,
-0.5369414687156677,
-0.04523369297385216,
-0.6874812841415405,
-0.08765802532434464,
-1.095569372177124,
0.24920454621315002,
-0.13089391589164734,
-0.1081015020608902,
-0.2270200401544571,
1.726689338684082,
-0.9093944430351257,
-2.070457935333252,
0.17297445237636566,
0.1746535748243332,
-0.16217851638793945,
0.31912845373153687,
1.667334794998169,
0.5081477165222168,
1.4854249954223633,
1.2762863636016846,
0.9846380949020386,
-0.6066405773162842,
-1.3459291458129883,
0.7464095950126648,
1.0144959688186646,
-1.413762092590332,
0.7661306858062744,
-0.04651912301778793,
-0.49590209126472473,
0.6946755647659302,
1.2804813385009766,
0.49329960346221924,
-2.130812644958496,
0.8597705960273743,
-1.0498616695404053,
0.8195057511329651,
0.7052302956581116,
0.6376156806945801,
0.18726211786270142,
0.8251141309738159,
-1.1773314476013184,
-1.1050623655319214,
-0.6703108549118042,
-0.7703006267547607,
2.0114409923553467,
-0.4018096625804901,
0.6274862289428711,
-0.15150205790996552,
-1.3410056829452515,
-0.01686709001660347,
0.6916643977165222,
0.3210091292858124,
-0.4808834195137024,
0.8273507952690125,
-0.7583788633346558,
-1.2297991514205933,
-1.318325400352478,
-0.44220608472824097,
-1.040150761604309,
-1.033953070640564,
1.068847417831421,
0.722571611404419,
0.29342004656791687,
1.832108736038208,
0.5521697402000427,
0.3180943727493286,
-2.6214590072631836,
0.9472916722297668,
0.22096236050128937,
-0.03972575068473816,
0.8330690860748291,
0.22684383392333984,
1.0640571117401123,
0.015408511273562908,
0.5380109548568726,
-2.401524066925049,
2.302511692047119,
-0.218896746635437,
0.6853947639465332,
-0.023502549156546593,
-0.106397844851017,
1.0968902111053467,
0.6177587509155273,
0.6785020232200623,
-0.995236337184906,
0.7328580617904663,
-0.5633650422096252,
1.3147220611572266,
0.827781081199646,
-0.7947723865509033,
-0.09723310172557831,
1.3051114082336426,
0.4279264211654663,
-0.5532926321029663,
-0.9496206641197205,
-1.077804684638977,
0.895436704158783,
1.6800413131713867,
-0.11191610246896744,
-0.04727436602115631,
0.7646834254264832,
0.6774439215660095,
-1.2735596895217896,
0.028045304119586945,
-0.6938446164131165,
-0.6383458375930786,
1.5461015701293945,
2.0939459800720215,
-0.1997532844543457,
-0.16840456426143646,
-0.6832757592201233,
-1.3029676675796509,
0.6588305830955505,
-0.11733884364366531,
0.025679565966129303,
0.5715230703353882,
-0.4919408857822418,
0.8949763774871826,
0.7784145474433899,
0.9399704933166504,
0.14318230748176575,
0.2307431399822235,
0.37983569502830505,
-0.38713642954826355,
-1.2135926485061646,
-0.32591864466667175,
-1.0139950513839722,
-2.5760345458984375,
0.3753491938114166,
-0.1530846506357193,
-1.3808057308197021,
0.042539723217487335,
-1.0633301734924316,
0.9515658617019653,
-0.5499131083488464,
-1.1272858381271362,
-1.4447945356369019,
0.09626322239637375,
-0.061407238245010376,
0.9110473394393921,
-1.6159337759017944,
-0.09462463855743408,
1.290259599685669,
0.8784069418907166,
-0.6981659531593323,
1.1275748014450073,
0.27560561895370483,
1.0367987155914307,
0.7641754150390625,
-0.36990755796432495,
0.6086001396179199,
0.05145707353949547,
-1.3751965761184692,
0.5069304704666138,
1.1681751012802124,
0.2459210455417633,
1.5328032970428467,
-0.6631156802177429,
-0.07757197320461273,
0.4583008289337158,
-0.7249707579612732,
-0.42906391620635986,
-0.41412296891212463,
0.7390497326850891,
-0.05392669141292572,
-0.8434374928474426,
-0.0014929603785276413,
-0.10401569306850433,
-0.23244206607341766,
0.09262782335281372,
-1.4788100719451904,
-0.10588758438825607,
-0.3663123846054077,
-0.6131609082221985,
-1.322308897972107,
-0.029317818582057953,
1.411328673362732,
-0.7843737006187439,
-0.2524334490299225,
0.38625964522361755,
0.40308257937431335,
0.5273293256759644,
0.7211490273475647,
-0.6448037624359131,
-0.3057556748390198,
-0.18348747491836548,
-0.24542373418807983,
0.37649834156036377,
1.4078906774520874,
-0.0898599922657013,
-1.004345417022705,
0.7536585330963135,
-0.3786509037017822,
0.10270509123802185,
1.926637053489685,
0.07432815432548523,
-0.7624748349189758,
0.3141767382621765,
-0.7854698300361633,
1.9337375164031982,
1.6315186023712158,
1.311328649520874,
-0.24494734406471252,
-0.919948399066925,
0.625117301940918,
-0.4182640016078949,
-0.39850109815597534,
0.8498033285140991,
0.44029754400253296,
-0.2505398392677307,
-1.293412446975708,
0.7662885785102844,
1.1833970546722412,
-0.8930898308753967,
-0.8174716234207153,
0.2652268707752228,
-0.7513734698295593,
1.1552621126174927,
0.6430368423461914,
0.40662282705307007,
0.24875473976135254,
1.6164052486419678,
0.8241543173789978,
-0.5351119637489319,
0.5421974658966064,
0.49979227781295776,
-0.29725363850593567,
-2.1437041759490967,
-1.118283987045288,
0.38689470291137695,
-0.6321932077407837,
-1.63121497631073,
1.3756518363952637,
-1.0964479446411133,
-1.0149626731872559,
0.5233978629112244,
0.04549193009734154,
1.3507739305496216,
0.4390314221382141,
1.552268147468567,
2.0486526489257812,
0.8538669943809509,
0.5361213684082031,
1.282806634902954,
-0.21017926931381226,
-0.5204032063484192,
1.8099875450134277,
-0.44409775733947754,
0.48740315437316895,
1.176558494567871,
-0.3042762577533722,
-1.0417985916137695,
-0.7427499294281006,
-1.1464908123016357,
-0.6160621643066406,
1.1132698059082031,
0.14816398918628693,
-1.0764896869659424,
0.2651669979095459,
1.452521800994873,
0.12091204524040222,
-0.32126253843307495,
0.6833008527755737,
0.27429890632629395,
-0.767406702041626,
-0.05162673443555832,
-0.9318026304244995,
0.5365784764289856,
-0.38220298290252686,
-0.3226526081562042,
0.3251293897628784,
0.38493743538856506,
1.3352081775665283,
-0.09129921346902847,
0.1363583654165268,
1.1377509832382202,
-1.389758586883545,
1.5433236360549927,
-0.6438527703285217,
0.28274649381637573,
-2.262143850326538,
1.2464063167572021,
-0.7810625433921814,
2.004711627960205,
-2.701716899871826,
0.4422456622123718,
-0.6196262240409851,
-0.4831191301345825,
0.31128185987472534,
-0.33001604676246643,
0.024788323789834976,
-0.13977183401584625,
-1.1672171354293823,
0.00797990057617426,
-0.7139195799827576,
0.5417017340660095,
1.129277229309082,
1.2905826568603516,
-1.1274012327194214,
-0.22455546259880066,
-1.6999369859695435,
-0.17903757095336914,
-0.9442474842071533,
0.4567562937736511,
-2.0283055305480957,
-0.22080057859420776,
-1.8840935230255127,
-2.3409671783447266,
-1.117646336555481,
-0.8424140214920044,
1.1422998905181885,
0.1785937249660492,
-0.8024864792823792,
1.2765172719955444,
-0.2819910943508148,
-1.8465632200241089,
1.0148292779922485,
-2.097224235534668
] |
https://github.com/huggingface/datasets/issues/6079 | Iterating over DataLoader based on HF datasets is stuck forever | One more thing, in python 3.10 based kernel, interestingly increasing num_workers seem to be increasing the runtime of iterating I was trying out. In python 3.10 kernel execution, I do not even see multiple CPU cores spiking unlike in 3.6.
512 batch size on 32 workers executes in 2.4 seconds on python 3.6 kernel, while it takes ~118 seconds on 3.10! | ### Describe the bug
I am using Amazon Sagemaker notebook (Amazon Linux 2) with python 3.10 based Conda environment.
I have a dataset in parquet format locally. When I try to iterate over it, the loader is stuck forever. Note that the same code is working for python 3.6 based conda environment seamlessly. What should be my next steps here?
### Steps to reproduce the bug
```
train_dataset = load_dataset(
"parquet", data_files = {'train': tr_data_path + '*.parquet'},
split = 'train',
collate_fn = streaming_data_collate_fn,
streaming = True
).with_format('torch')
train_dataloader = DataLoader(train_dataset, batch_size = 2, num_workers = 0)
t = time.time()
iter_ = 0
for batch in train_dataloader:
iter_ += 1
if iter_ == 1000:
break
print (time.time() - t)
```
### Expected behavior
The snippet should work normally and load the next batch of data.
### Environment info
datasets: '2.14.0'
pyarrow: '12.0.0'
torch: '2.0.0'
Python: 3.10.10 | packaged by conda-forge | (main, Mar 24 2023, 20:08:06) [GCC 11.3.0]
!uname -r
5.10.178-162.673.amzn2.x86_64 | 45 | 61 | Iterating over DataLoader based on HF datasets is stuck forever
### Describe the bug
I am using Amazon Sagemaker notebook (Amazon Linux 2) with python 3.10 based Conda environment.
I have a dataset in parquet format locally. When I try to iterate over it, the loader is stuck forever. Note that the same code is working for python 3.6 based conda environment seamlessly. What should be my next steps here?
### Steps to reproduce the bug
```
train_dataset = load_dataset(
"parquet", data_files = {'train': tr_data_path + '*.parquet'},
split = 'train',
collate_fn = streaming_data_collate_fn,
streaming = True
).with_format('torch')
train_dataloader = DataLoader(train_dataset, batch_size = 2, num_workers = 0)
t = time.time()
iter_ = 0
for batch in train_dataloader:
iter_ += 1
if iter_ == 1000:
break
print (time.time() - t)
```
### Expected behavior
The snippet should work normally and load the next batch of data.
### Environment info
datasets: '2.14.0'
pyarrow: '12.0.0'
torch: '2.0.0'
Python: 3.10.10 | packaged by conda-forge | (main, Mar 24 2023, 20:08:06) [GCC 11.3.0]
!uname -r
5.10.178-162.673.amzn2.x86_64
One more thing, in python 3.10 based kernel, interestingly increasing num_workers seem to be increasing the runtime of iterating I was trying out. In python 3.10 kernel execution, I do not even see multiple CPU cores spiking unlike in 3.6.
512 batch size on 32 workers executes in 2.4 seconds on python 3.6 kernel, while it takes ~118 seconds on 3.10! | [
-1.2805341482162476,
-1.0410552024841309,
-0.6732608079910278,
1.5353178977966309,
-0.254350870847702,
-1.1552599668502808,
0.1737479567527771,
-0.9447788596153259,
1.6417279243469238,
-0.8380560278892517,
0.23958228528499603,
-1.5837104320526123,
0.048319969326257706,
-0.5743476748466492,
-0.664314866065979,
-0.8749992251396179,
-0.41995713114738464,
-0.8276289105415344,
1.1758400201797485,
2.4991390705108643,
1.1417651176452637,
-1.4546122550964355,
2.743734836578369,
0.7094669938087463,
-0.1644556075334549,
-1.0387712717056274,
0.4923863708972931,
0.02493041753768921,
-1.3528867959976196,
-0.45362213253974915,
-0.9714253544807434,
-0.06789121776819229,
-0.5696642994880676,
-0.42071443796157837,
0.04660220444202423,
0.3736344277858734,
-0.2535763084888458,
-0.4705694019794464,
-0.4817972779273987,
-0.7126510143280029,
0.4226340651512146,
-0.41017916798591614,
0.96976637840271,
-0.33517053723335266,
1.7902268171310425,
-0.4383547902107239,
0.4969234764575958,
0.7521657943725586,
1.2435963153839111,
0.21149298548698425,
-0.04546663910150528,
0.35179293155670166,
0.4224698543548584,
-0.012557362206280231,
0.5601574182510376,
1.1182173490524292,
0.6677761673927307,
0.4186140298843384,
0.663558840751648,
-2.247258186340332,
1.3527334928512573,
-1.0599876642227173,
0.3480018079280853,
1.347951889038086,
-0.9849652051925659,
0.4044513702392578,
-1.7185074090957642,
-0.030103210359811783,
0.6921164393424988,
-2.209228038787842,
0.33852484822273254,
-1.321691632270813,
-0.48441359400749207,
1.0565649271011353,
0.3737395107746124,
-1.200653076171875,
0.09883280098438263,
-0.48689785599708557,
1.058122992515564,
0.3753422200679779,
1.1155989170074463,
-1.6678792238235474,
-0.09857533872127533,
-0.293733686208725,
0.0931520164012909,
-1.3108891248703003,
-1.5293574333190918,
0.5658175945281982,
0.671680212020874,
0.5336532592773438,
-0.15386034548282623,
1.07799232006073,
-1.0924696922302246,
0.7965419292449951,
-1.0577360391616821,
-1.702448844909668,
-1.425971508026123,
-2.3804268836975098,
-2.3481016159057617,
0.7123090028762817,
-0.39402347803115845,
-0.4920765161514282,
2.1252317428588867,
-1.0290110111236572,
-1.682169795036316,
1.199485421180725,
0.21305441856384277,
0.006988536566495895,
2.337045907974243,
0.18990622460842133,
-0.7369779944419861,
0.4137668013572693,
-0.8124891519546509,
0.7203657627105713,
-0.39633601903915405,
1.3559463024139404,
0.38393428921699524,
-1.0213611125946045,
1.552427887916565,
-0.27883946895599365,
0.555475115776062,
-0.6124037504196167,
-0.5268741250038147,
-0.755713939666748,
0.28510111570358276,
1.96690034866333,
-0.2680812180042267,
1.470996618270874,
-0.3154226243495941,
-1.5632764101028442,
-1.6280654668807983,
0.9274067878723145,
0.4847026765346527,
-0.7609207630157471,
0.1170988529920578,
-0.3419704735279083,
0.18028078973293304,
-0.12330834567546844,
1.1179338693618774,
1.2829228639602661,
0.7010588049888611,
-0.39426350593566895,
-0.9668821096420288,
0.2415621429681778,
-0.22221477329730988,
-0.6342099905014038,
-1.779576063156128,
-0.38435083627700806,
0.03767911344766617,
0.6975898742675781,
-1.2395583391189575,
1.6743707656860352,
0.9639198780059814,
1.8937433958053589,
1.0078234672546387,
-0.33563387393951416,
1.5184359550476074,
0.17320261895656586,
1.8039374351501465,
-0.5085937976837158,
0.6408292651176453,
-0.4088153839111328,
-1.1196383237838745,
0.7705692648887634,
-0.30699703097343445,
-1.963602900505066,
-0.7143768072128296,
-0.7917117476463318,
-0.2224622368812561,
-0.7972252368927002,
0.920525074005127,
-0.2615356147289276,
-1.4515347480773926,
0.3240491449832916,
-0.7645562887191772,
0.17865635454654694,
-1.1764227151870728,
0.406419038772583,
0.6735956072807312,
-0.5336347222328186,
0.12779055535793304,
-0.24741753935813904,
-1.2896045446395874,
-0.4513084292411804,
0.31529495120048523,
1.8236453533172607,
-0.768692135810852,
0.9050658345222473,
1.1266493797302246,
-0.6884452700614929,
-0.0055798618122935295,
0.29078423976898193,
-0.257819265127182,
0.8777344822883606,
-1.0576517581939697,
-0.43549174070358276,
1.215962290763855,
-0.3141495883464813,
-0.5676507353782654,
1.495126724243164,
0.6974195241928101,
-1.0425317287445068,
-0.26637402176856995,
-0.08683913946151733,
-0.7905617952346802,
0.1347048431634903,
-1.6111581325531006,
-0.15014317631721497,
0.45490002632141113,
-1.6106816530227661,
-0.4169806241989136,
-0.24843987822532654,
1.3992788791656494,
-0.07969385385513306,
1.4929087162017822,
-0.31835415959358215,
-0.20383256673812866,
-0.299049973487854,
-0.38668081164360046,
0.22426095604896545,
-0.19165776669979095,
-0.5808871984481812,
0.19275154173374176,
-0.8014166355133057,
0.35375797748565674,
1.4442381858825684,
0.3145838677883148,
-0.044669605791568756,
0.5142319202423096,
1.0072942972183228,
0.4501971900463104,
-0.02514687180519104,
-0.9010090827941895,
-1.4845572710037231,
1.998814344406128,
-1.4678746461868286,
2.0145552158355713,
0.7650690078735352,
-0.010887471958994865,
-1.7736070156097412,
-1.895063877105713,
1.3374722003936768,
1.0528688430786133,
2.343888759613037,
0.5072139501571655,
0.3896237015724182,
-0.859807550907135,
-0.6625823974609375,
0.2639233469963074,
-1.0119508504867554,
-0.7705976366996765,
0.17646168172359467,
2.4672317504882812,
1.6935834884643555,
-0.39156317710876465,
-0.10136169195175171,
-0.9901569485664368,
1.4373178482055664,
-0.1282867044210434,
0.27921679615974426,
2.0238823890686035,
-0.20625202357769012,
-1.0418709516525269,
1.2179298400878906,
-2.3950867652893066,
0.15945833921432495,
2.037109851837158,
0.24330218136310577,
0.0946892499923706,
-1.4273849725723267,
-0.6381765007972717,
-0.2889968156814575,
-0.4452331066131592,
-1.2094810009002686,
0.5673689246177673,
-0.288874089717865,
-0.8234007358551025,
-1.4379634857177734,
0.18895943462848663,
-1.115624189376831,
-1.6406586170196533,
0.20235827565193176,
1.8703033924102783,
2.07818603515625,
-0.7797585725784302,
1.57099187374115,
-0.29632848501205444,
0.1928466558456421,
1.2285228967666626,
1.2132035493850708,
3.099106550216675,
1.9656428098678589,
-1.2527323961257935,
0.6519720554351807,
-0.14724555611610413,
-0.420077919960022,
1.0773698091506958,
-1.2292453050613403,
1.3256036043167114,
-0.10307386517524719,
-1.1835256814956665,
-1.163016676902771,
0.9914935827255249,
0.5583893060684204,
0.032331034541130066,
-0.42085203528404236,
1.19328773021698,
0.05211517587304115,
1.298064947128296,
0.4656996726989746,
-0.3269982933998108,
0.6726880669593811,
-0.4718559980392456,
-0.4957076907157898,
1.5488836765289307,
0.1835823357105255,
-1.4384753704071045,
-2.230836868286133,
-0.2973712384700775,
-0.8685486316680908,
-0.0026285196654498577,
-0.6199547052383423,
-0.9578381776809692,
1.6060068607330322,
0.3253142535686493,
-1.2684413194656372,
-0.2411399781703949,
-0.3287123441696167,
-0.5704256296157837,
2.7145917415618896,
-1.2835334539413452,
-0.2650720775127411,
-0.9476127624511719,
-0.6467613577842712,
1.6382476091384888,
-1.245035171508789,
-0.2612977921962738,
-0.987959623336792,
-0.6064995527267456,
-1.2638700008392334,
-0.5530682802200317,
-0.041080228984355927,
-0.9263437390327454,
0.869457483291626,
0.18818703293800354,
-1.1714640855789185,
-0.2973751723766327,
-0.9215659499168396,
0.8706616163253784,
0.04108470305800438,
0.2272619903087616,
1.766860842704773,
0.28248077630996704,
-0.38893142342567444,
0.7220298647880554,
1.1022809743881226,
0.6592662334442139,
-0.6776522397994995,
0.17654237151145935,
-0.678175687789917,
0.31313154101371765,
-1.180833339691162,
0.35379931330680847,
-2.9189186096191406,
0.6047517657279968,
-0.04045839607715607,
-0.059869229793548584,
-0.08130383491516113,
-1.2645838260650635,
1.182967185974121,
2.5395185947418213,
-1.1350696086883545,
0.5379703640937805,
0.37608057260513306,
1.1950064897537231,
-1.5633375644683838,
0.3637467622756958,
-0.4512316882610321,
2.1462693214416504,
0.2473965734243393,
1.198941946029663,
-0.41615232825279236,
-2.364956855773926,
0.6514334678649902,
-1.2864947319030762,
-1.1508679389953613,
0.6987887024879456,
-0.9637771844863892,
0.10002681612968445,
-1.378572702407837,
-0.2731183171272278,
-0.7905694246292114,
-1.2221882343292236,
0.6550838947296143,
0.17843464016914368,
0.4058671295642853,
-0.5733575820922852,
0.3448571264743805,
-2.184232711791992,
-1.2776732444763184,
-0.2603231966495514,
-0.9932346343994141,
0.47416952252388,
-0.35899022221565247,
0.7119868993759155,
-0.19509339332580566,
0.02736584097146988,
0.298305481672287,
1.387787103652954,
3.3419063091278076,
0.06939102709293365,
0.3199702799320221,
-0.18380045890808105,
-0.9514392018318176,
1.480014443397522,
0.9686934351921082,
-0.112408846616745,
-0.5243309140205383,
-1.1518185138702393,
1.2924602031707764,
1.981557846069336,
0.9712703824043274,
0.027821063995361328,
-0.7957233190536499,
-0.7073549628257751,
-0.07695294916629791,
0.14527307450771332,
0.5245596170425415,
0.8775869011878967,
0.05207858607172966,
0.07484707236289978,
1.4653822183609009,
1.1820909976959229,
-0.4459840953350067,
0.30339619517326355,
-0.8434131741523743,
-0.4546247124671936,
0.48618802428245544,
0.2643990218639374,
0.0010349154472351074,
0.30223146080970764,
-1.0011446475982666,
-0.2109910249710083,
-0.3793991506099701,
-0.9408141374588013,
-0.710233747959137,
-0.40292784571647644,
-0.368550181388855,
1.6433942317962646,
0.1763099879026413,
-0.5282343626022339,
-0.009778918698430061,
-0.7282640337944031,
-0.03867335617542267,
-1.1405811309814453,
0.25794926285743713,
-0.1396143138408661,
-0.07523711025714874,
-0.15873309969902039,
1.8097234964370728,
-0.8721884489059448,
-2.0624732971191406,
0.14626823365688324,
0.2002931535243988,
-0.21537001430988312,
0.2955687642097473,
1.6435530185699463,
0.5408247709274292,
1.5347341299057007,
1.2903395891189575,
0.9892712235450745,
-0.619868814945221,
-1.3600153923034668,
0.7233812808990479,
0.9975993633270264,
-1.438320517539978,
0.7452347278594971,
-0.014417296275496483,
-0.4823160171508789,
0.6958834528923035,
1.2204508781433105,
0.49883630871772766,
-2.134129524230957,
0.8518427610397339,
-1.0325770378112793,
0.7778832912445068,
0.6844944357872009,
0.6671465635299683,
0.2117677628993988,
0.8034690022468567,
-1.2071242332458496,
-1.0969864130020142,
-0.7185088396072388,
-0.7166057825088501,
1.9982495307922363,
-0.3050529658794403,
0.5855944156646729,
-0.21128849685192108,
-1.3532044887542725,
-0.026206117123365402,
0.6701527833938599,
0.3478614389896393,
-0.4455387592315674,
0.786140501499176,
-0.7845548987388611,
-1.2225247621536255,
-1.412111520767212,
-0.4376596212387085,
-1.057926058769226,
-0.9927344918251038,
1.0854758024215698,
0.725919783115387,
0.2716543674468994,
1.8744735717773438,
0.5755019187927246,
0.31053677201271057,
-2.6149022579193115,
0.9390975832939148,
0.25500044226646423,
-0.07689443230628967,
0.8699174523353577,
0.25561219453811646,
1.0655150413513184,
0.01705814152956009,
0.5349283814430237,
-2.419790744781494,
2.309976816177368,
-0.2329593151807785,
0.7018859386444092,
0.03229066729545593,
-0.09960214793682098,
1.0938266515731812,
0.5996899008750916,
0.6666335463523865,
-1.049027442932129,
0.7028353214263916,
-0.6217909455299377,
1.2954845428466797,
0.8290818929672241,
-0.8124316930770874,
-0.09566695988178253,
1.237954020500183,
0.46135854721069336,
-0.507944643497467,
-0.9247488975524902,
-1.1158182621002197,
0.9101192951202393,
1.6980046033859253,
-0.1494997888803482,
-0.04191873222589493,
0.8073609471321106,
0.682518482208252,
-1.3350090980529785,
-0.0017551816999912262,
-0.7423446178436279,
-0.7137042880058289,
1.5385359525680542,
2.065735101699829,
-0.13605427742004395,
-0.2140643149614334,
-0.7075560092926025,
-1.3195173740386963,
0.6914327144622803,
-0.07208770513534546,
0.06886550784111023,
0.5921539664268494,
-0.5590328574180603,
0.9848684668540955,
0.8665047287940979,
0.8983121514320374,
0.20253583788871765,
0.23911137878894806,
0.35654327273368835,
-0.35066983103752136,
-1.1852765083312988,
-0.24039216339588165,
-0.968574047088623,
-2.625389575958252,
0.44978973269462585,
-0.14364846050739288,
-1.4177775382995605,
0.02561739832162857,
-1.049800157546997,
0.9261113405227661,
-0.5342372059822083,
-1.1203233003616333,
-1.48224675655365,
0.10940474271774292,
-0.10985013842582703,
1.0061875581741333,
-1.5971782207489014,
-0.10243768990039825,
1.2654649019241333,
0.8976554274559021,
-0.6694872379302979,
1.1379423141479492,
0.30610212683677673,
1.0360640287399292,
0.8200559616088867,
-0.3339707851409912,
0.6109384894371033,
0.07288733124732971,
-1.3288713693618774,
0.5043653845787048,
1.1672345399856567,
0.2608582079410553,
1.4829641580581665,
-0.6672011017799377,
-0.043675947934389114,
0.45236310362815857,
-0.6616137027740479,
-0.43403685092926025,
-0.47867637872695923,
0.7257979512214661,
-0.06578461825847626,
-0.8710966110229492,
0.00046223588287830353,
-0.10666446387767792,
-0.19006292521953583,
0.13731540739536285,
-1.4497087001800537,
-0.14176137745380402,
-0.34053677320480347,
-0.6288045644760132,
-1.298919677734375,
-0.012500660493969917,
1.4166312217712402,
-0.8129632472991943,
-0.23913002014160156,
0.4095993638038635,
0.4286178946495056,
0.5159159898757935,
0.6809496283531189,
-0.6474449038505554,
-0.3374772369861603,
-0.1672319620847702,
-0.3225476145744324,
0.3560018539428711,
1.4217305183410645,
-0.103470578789711,
-1.0074663162231445,
0.7744458317756653,
-0.32721754908561707,
0.0498623251914978,
1.9370341300964355,
0.08657053112983704,
-0.8212680816650391,
0.2888016998767853,
-0.7656382322311401,
1.9652715921401978,
1.6691664457321167,
1.334962010383606,
-0.2118672877550125,
-0.9521753191947937,
0.6399604678153992,
-0.41499680280685425,
-0.39676788449287415,
0.8812128305435181,
0.44850993156433105,
-0.21954022347927094,
-1.3412762880325317,
0.6719543933868408,
1.227484107017517,
-0.8618736267089844,
-0.8244968056678772,
0.24644364416599274,
-0.7656531929969788,
1.1099047660827637,
0.699329137802124,
0.4250118136405945,
0.2136191874742508,
1.5990581512451172,
0.8123102784156799,
-0.5362224578857422,
0.5270728468894958,
0.49250301718711853,
-0.24696585536003113,
-2.1313655376434326,
-1.1443136930465698,
0.364197701215744,
-0.5889302492141724,
-1.5992779731750488,
1.4060395956039429,
-1.0464307069778442,
-1.0127558708190918,
0.5151165723800659,
0.03610963374376297,
1.3914368152618408,
0.4219758212566376,
1.5432544946670532,
2.0322976112365723,
0.8784877061843872,
0.4372657537460327,
1.304491400718689,
-0.19219505786895752,
-0.49593645334243774,
1.8346740007400513,
-0.4567447602748871,
0.45779651403427124,
1.1707606315612793,
-0.29412251710891724,
-1.0143283605575562,
-0.7087991237640381,
-1.1708083152770996,
-0.6507752537727356,
1.1081361770629883,
0.15114636719226837,
-1.0695130825042725,
0.2704317271709442,
1.5141260623931885,
0.10772766172885895,
-0.34636253118515015,
0.6372256875038147,
0.3345189392566681,
-0.7576704621315002,
-0.027501976117491722,
-0.9452744126319885,
0.5306039452552795,
-0.30907610058784485,
-0.360095739364624,
0.32251814007759094,
0.4130506217479706,
1.3327155113220215,
-0.07042595744132996,
0.16979123651981354,
1.1482030153274536,
-1.3953684568405151,
1.5072332620620728,
-0.6525607705116272,
0.2797866761684418,
-2.2545933723449707,
1.25023353099823,
-0.7931321859359741,
1.990022897720337,
-2.7192063331604004,
0.43402931094169617,
-0.6184158325195312,
-0.4520805776119232,
0.2929244339466095,
-0.32130542397499084,
0.0644129067659378,
-0.17117972671985626,
-1.1579214334487915,
-0.0766286551952362,
-0.6987094879150391,
0.5947861075401306,
1.0822898149490356,
1.275063157081604,
-1.1045465469360352,
-0.24892348051071167,
-1.6989141702651978,
-0.14874276518821716,
-0.8338255882263184,
0.41215309500694275,
-1.9999570846557617,
-0.20932342112064362,
-1.9136255979537964,
-2.298219680786133,
-1.2375733852386475,
-0.8154141902923584,
1.160719633102417,
0.1556089222431183,
-0.8448294401168823,
1.217685580253601,
-0.3043006360530853,
-1.8474854230880737,
1.0321398973464966,
-2.1195600032806396
] |
https://github.com/huggingface/datasets/issues/6079 | Iterating over DataLoader based on HF datasets is stuck forever | **Update**: It seems the latency part is more of a multiprocessing issue with torch and some host specific issue, and I had to scourge through relevant pytorch issues, when I stumbled across these threads:
1. https://github.com/pytorch/pytorch/issues/102494
2. https://github.com/pytorch/pytorch/issues/102269
3. https://github.com/pytorch/pytorch/issues/99625
Out of the suggested solutions, the one that worked in my case was:
```
os.environ['KMP_AFFINITY'] = "disabled"
```
It is working for now, though I have no clue why, just I hope it does not get stuck when I do actual model training, will update by tomorrow.
| ### Describe the bug
I am using Amazon Sagemaker notebook (Amazon Linux 2) with python 3.10 based Conda environment.
I have a dataset in parquet format locally. When I try to iterate over it, the loader is stuck forever. Note that the same code is working for python 3.6 based conda environment seamlessly. What should be my next steps here?
### Steps to reproduce the bug
```
train_dataset = load_dataset(
"parquet", data_files = {'train': tr_data_path + '*.parquet'},
split = 'train',
collate_fn = streaming_data_collate_fn,
streaming = True
).with_format('torch')
train_dataloader = DataLoader(train_dataset, batch_size = 2, num_workers = 0)
t = time.time()
iter_ = 0
for batch in train_dataloader:
iter_ += 1
if iter_ == 1000:
break
print (time.time() - t)
```
### Expected behavior
The snippet should work normally and load the next batch of data.
### Environment info
datasets: '2.14.0'
pyarrow: '12.0.0'
torch: '2.0.0'
Python: 3.10.10 | packaged by conda-forge | (main, Mar 24 2023, 20:08:06) [GCC 11.3.0]
!uname -r
5.10.178-162.673.amzn2.x86_64 | 45 | 87 | Iterating over DataLoader based on HF datasets is stuck forever
### Describe the bug
I am using Amazon Sagemaker notebook (Amazon Linux 2) with python 3.10 based Conda environment.
I have a dataset in parquet format locally. When I try to iterate over it, the loader is stuck forever. Note that the same code is working for python 3.6 based conda environment seamlessly. What should be my next steps here?
### Steps to reproduce the bug
```
train_dataset = load_dataset(
"parquet", data_files = {'train': tr_data_path + '*.parquet'},
split = 'train',
collate_fn = streaming_data_collate_fn,
streaming = True
).with_format('torch')
train_dataloader = DataLoader(train_dataset, batch_size = 2, num_workers = 0)
t = time.time()
iter_ = 0
for batch in train_dataloader:
iter_ += 1
if iter_ == 1000:
break
print (time.time() - t)
```
### Expected behavior
The snippet should work normally and load the next batch of data.
### Environment info
datasets: '2.14.0'
pyarrow: '12.0.0'
torch: '2.0.0'
Python: 3.10.10 | packaged by conda-forge | (main, Mar 24 2023, 20:08:06) [GCC 11.3.0]
!uname -r
5.10.178-162.673.amzn2.x86_64
**Update**: It seems the latency part is more of a multiprocessing issue with torch and some host specific issue, and I had to scourge through relevant pytorch issues, when I stumbled across these threads:
1. https://github.com/pytorch/pytorch/issues/102494
2. https://github.com/pytorch/pytorch/issues/102269
3. https://github.com/pytorch/pytorch/issues/99625
Out of the suggested solutions, the one that worked in my case was:
```
os.environ['KMP_AFFINITY'] = "disabled"
```
It is working for now, though I have no clue why, just I hope it does not get stuck when I do actual model training, will update by tomorrow.
| [
-1.2661398649215698,
-1.0214083194732666,
-0.7204177379608154,
1.5396506786346436,
-0.22598449885845184,
-1.1263196468353271,
0.09709709882736206,
-0.9557428359985352,
1.616188406944275,
-0.767447292804718,
0.2418806105852127,
-1.6014881134033203,
0.014191004447638988,
-0.5700944066047668,
-0.6887220740318298,
-0.8326528668403625,
-0.4021289646625519,
-0.8193531036376953,
1.1501058340072632,
2.461275815963745,
1.2176599502563477,
-1.4544991254806519,
2.7598564624786377,
0.7620337009429932,
-0.17896640300750732,
-1.0806305408477783,
0.47172263264656067,
0.02960026264190674,
-1.3063308000564575,
-0.48215755820274353,
-0.9501196146011353,
-0.07771357893943787,
-0.5345039367675781,
-0.43878263235092163,
0.030519139021635056,
0.4117480218410492,
-0.2464359700679779,
-0.43205609917640686,
-0.5208451151847839,
-0.7017791271209717,
0.44580066204071045,
-0.40594735741615295,
0.919200599193573,
-0.29969868063926697,
1.7587369680404663,
-0.48269906640052795,
0.4514922797679901,
0.7435368299484253,
1.2727054357528687,
0.2063780575990677,
-0.050388041883707047,
0.3330954909324646,
0.44104963541030884,
-0.03267509490251541,
0.5471842288970947,
1.1406036615371704,
0.6921442151069641,
0.40743979811668396,
0.6572169065475464,
-2.253596067428589,
1.3140475749969482,
-0.9785383343696594,
0.30980929732322693,
1.3586921691894531,
-0.9772142767906189,
0.3749275803565979,
-1.751222848892212,
-0.0002444460988044739,
0.641279399394989,
-2.2270078659057617,
0.3024257719516754,
-1.337628722190857,
-0.5098954439163208,
1.0101642608642578,
0.3457295298576355,
-1.2537873983383179,
0.08956113457679749,
-0.5129416584968567,
1.0572179555892944,
0.41459181904792786,
1.1444520950317383,
-1.6621198654174805,
-0.13273312151432037,
-0.2305729240179062,
0.09944535791873932,
-1.3262279033660889,
-1.548895001411438,
0.5410377383232117,
0.6708890199661255,
0.6119084358215332,
-0.12273968756198883,
1.0471196174621582,
-1.0779770612716675,
0.8181551098823547,
-1.0632208585739136,
-1.6464767456054688,
-1.4807904958724976,
-2.338043689727783,
-2.297668695449829,
0.7542058229446411,
-0.4272737205028534,
-0.5001287460327148,
2.0639560222625732,
-1.0415624380111694,
-1.7445831298828125,
1.148862361907959,
0.2408229559659958,
0.0347595252096653,
2.3597962856292725,
0.2127266824245453,
-0.7624620795249939,
0.44801849126815796,
-0.7654674053192139,
0.7434641122817993,
-0.3473360538482666,
1.3625200986862183,
0.40744927525520325,
-0.9695194363594055,
1.5867751836776733,
-0.3295252025127411,
0.5973964333534241,
-0.6748002767562866,
-0.4954518973827362,
-0.7531324028968811,
0.29111307859420776,
1.9835807085037231,
-0.2933020293712616,
1.5029104948043823,
-0.36904120445251465,
-1.51995050907135,
-1.596002459526062,
0.9262583255767822,
0.4716404378414154,
-0.7930783629417419,
0.11468648910522461,
-0.4113365113735199,
0.164534330368042,
-0.10122281312942505,
1.080365777015686,
1.2676255702972412,
0.726137638092041,
-0.40109044313430786,
-0.9532549381256104,
0.22727924585342407,
-0.19963109493255615,
-0.6679081916809082,
-1.79918372631073,
-0.36918917298316956,
0.07910827547311783,
0.6748710870742798,
-1.2905616760253906,
1.7026636600494385,
0.9137943983078003,
1.9346052408218384,
0.9906944036483765,
-0.4024120569229126,
1.4647021293640137,
0.12985658645629883,
1.8219050168991089,
-0.5270629525184631,
0.6341578960418701,
-0.35132578015327454,
-1.07467782497406,
0.7606831789016724,
-0.30582964420318604,
-2.0138370990753174,
-0.7012991309165955,
-0.8065555095672607,
-0.22179892659187317,
-0.7773258090019226,
0.9179975390434265,
-0.26910996437072754,
-1.4191443920135498,
0.26950857043266296,
-0.7273118495941162,
0.18509940803050995,
-1.2235487699508667,
0.3129851222038269,
0.7112163305282593,
-0.5418875813484192,
0.06646102666854858,
-0.2574272155761719,
-1.3287721872329712,
-0.45669862627983093,
0.3267654776573181,
1.8673691749572754,
-0.767615795135498,
0.9449253082275391,
1.0856345891952515,
-0.6960503458976746,
0.08574414253234863,
0.31653162837028503,
-0.2884092628955841,
0.8626006245613098,
-1.0413872003555298,
-0.42346030473709106,
1.1998469829559326,
-0.30428481101989746,
-0.5910359025001526,
1.517069697380066,
0.8164979219436646,
-1.0180408954620361,
-0.27051517367362976,
-0.0950155034661293,
-0.7669329643249512,
0.0871860533952713,
-1.5938310623168945,
-0.17479871213436127,
0.3674243688583374,
-1.52813720703125,
-0.46827200055122375,
-0.2621018886566162,
1.367405652999878,
-0.14417313039302826,
1.4946717023849487,
-0.3611934185028076,
-0.22236831486225128,
-0.327358603477478,
-0.39369136095046997,
0.15475986897945404,
-0.23005908727645874,
-0.6028856039047241,
0.19584625959396362,
-0.804782509803772,
0.32797566056251526,
1.4466149806976318,
0.3880101144313812,
-0.02658867835998535,
0.5071414113044739,
1.0451021194458008,
0.42278268933296204,
0.0037043150514364243,
-0.929458498954773,
-1.5141606330871582,
1.962631106376648,
-1.4770550727844238,
2.0139119625091553,
0.7803326845169067,
-0.029566690325737,
-1.764171838760376,
-1.87527596950531,
1.3436118364334106,
1.0997380018234253,
2.347928762435913,
0.5476515293121338,
0.40851566195487976,
-0.8564997315406799,
-0.6745644211769104,
0.2942653298377991,
-0.9805647134780884,
-0.75736403465271,
0.14880132675170898,
2.4756603240966797,
1.772615909576416,
-0.44709911942481995,
-0.13581308722496033,
-0.9809200167655945,
1.4000046253204346,
-0.15027876198291779,
0.2696882486343384,
2.033827304840088,
-0.20062431693077087,
-0.9838489890098572,
1.2618408203125,
-2.395210027694702,
0.2570475935935974,
2.0135321617126465,
0.28672000765800476,
0.1106756180524826,
-1.4232991933822632,
-0.6405819654464722,
-0.2870000898838043,
-0.485127717256546,
-1.183034896850586,
0.590377151966095,
-0.3124883472919464,
-0.8670793175697327,
-1.4327902793884277,
0.1856769174337387,
-1.1017847061157227,
-1.6522189378738403,
0.2658170461654663,
1.8899871110916138,
2.060356616973877,
-0.7937384247779846,
1.5366237163543701,
-0.3060949444770813,
0.13869038224220276,
1.2519468069076538,
1.2392323017120361,
3.121965169906616,
1.9692243337631226,
-1.2580784559249878,
0.6857168078422546,
-0.190964475274086,
-0.41012170910835266,
1.092612862586975,
-1.1975197792053223,
1.2659560441970825,
-0.1498182713985443,
-1.2176084518432617,
-1.1480343341827393,
1.0141562223434448,
0.5515347123146057,
0.06601815670728683,
-0.47180482745170593,
1.182490348815918,
0.10948411375284195,
1.296407699584961,
0.5116392970085144,
-0.3279276192188263,
0.6410213708877563,
-0.4272105395793915,
-0.48673728108406067,
1.5224416255950928,
0.16091127693653107,
-1.468116044998169,
-2.2090344429016113,
-0.2888104021549225,
-0.8784373998641968,
-0.027131028473377228,
-0.6430111527442932,
-1.0025790929794312,
1.6162091493606567,
0.3999496400356293,
-1.2759944200515747,
-0.30059030652046204,
-0.32576602697372437,
-0.5405345559120178,
2.6862411499023438,
-1.3464694023132324,
-0.28194111585617065,
-0.9862198829650879,
-0.5646004676818848,
1.6789332628250122,
-1.1844249963760376,
-0.22345200181007385,
-1.035955548286438,
-0.6614478230476379,
-1.2791142463684082,
-0.5166765451431274,
-0.02076844498515129,
-0.8897300958633423,
0.8562694787979126,
0.15939877927303314,
-1.1518532037734985,
-0.29542604088783264,
-0.9151502251625061,
0.8831623196601868,
-0.03713557496666908,
0.18145634233951569,
1.8171186447143555,
0.32503262162208557,
-0.43161648511886597,
0.7531758546829224,
1.1029629707336426,
0.6280664801597595,
-0.6830667853355408,
0.15382377803325653,
-0.6461247205734253,
0.36292022466659546,
-1.2292104959487915,
0.285148948431015,
-2.9276087284088135,
0.6712207794189453,
-0.031906139105558395,
-0.09265252202749252,
-0.08010684698820114,
-1.2679797410964966,
1.2232015132904053,
2.589531421661377,
-1.135190486907959,
0.5180268883705139,
0.3808557987213135,
1.1847373247146606,
-1.5894787311553955,
0.3131718635559082,
-0.4348173141479492,
2.104689598083496,
0.23830625414848328,
1.2629398107528687,
-0.48444390296936035,
-2.312617063522339,
0.6551191806793213,
-1.2216912508010864,
-1.1046980619430542,
0.7274972200393677,
-0.885943591594696,
0.13737349212169647,
-1.4295024871826172,
-0.21836918592453003,
-0.8653061985969543,
-1.2052522897720337,
0.6516966819763184,
0.16518065333366394,
0.3802681267261505,
-0.6147212386131287,
0.3523293137550354,
-2.1883432865142822,
-1.3666623830795288,
-0.21521447598934174,
-0.9527069330215454,
0.4839322566986084,
-0.36871257424354553,
0.7031798362731934,
-0.12699931859970093,
0.02023603394627571,
0.31344345211982727,
1.4074742794036865,
3.3873603343963623,
0.11897844821214676,
0.33217737078666687,
-0.15903258323669434,
-0.9307244420051575,
1.4724829196929932,
0.9726607799530029,
-0.10731540620326996,
-0.5156065225601196,
-1.0618473291397095,
1.2884575128555298,
1.9792377948760986,
1.0295361280441284,
0.014056467451155186,
-0.8108001947402954,
-0.6835631132125854,
-0.06653312593698502,
0.14286597073078156,
0.5023177862167358,
0.9741526246070862,
0.011970029212534428,
0.12008451670408249,
1.4980013370513916,
1.2128030061721802,
-0.4409628212451935,
0.3269074559211731,
-0.8508944511413574,
-0.4231538772583008,
0.43162015080451965,
0.2700020968914032,
0.01159267220646143,
0.3212110698223114,
-1.0313681364059448,
-0.21267470717430115,
-0.3925427794456482,
-0.9595943689346313,
-0.7154979705810547,
-0.40115347504615784,
-0.37979575991630554,
1.6253161430358887,
0.14202414453029633,
-0.5051235556602478,
0.009363248012959957,
-0.7611997723579407,
-0.06269320100545883,
-1.0948280096054077,
0.2866238057613373,
-0.13378235697746277,
-0.10627035051584244,
-0.1654457151889801,
1.7093114852905273,
-0.8985262513160706,
-2.059573173522949,
0.21624144911766052,
0.2556733787059784,
-0.27937620878219604,
0.3092968165874481,
1.6321020126342773,
0.5440384745597839,
1.4658739566802979,
1.2930229902267456,
0.9917691946029663,
-0.6183331608772278,
-1.2935278415679932,
0.6973605155944824,
0.9809533357620239,
-1.4289942979812622,
0.7606905698776245,
-0.04091315343976021,
-0.5333850383758545,
0.7008416056632996,
1.3333759307861328,
0.4630529284477234,
-2.089308023452759,
0.838503897190094,
-0.9486563801765442,
0.7855254411697388,
0.6634352207183838,
0.6684046983718872,
0.21047364175319672,
0.8185998201370239,
-1.2168686389923096,
-1.1142864227294922,
-0.7554638385772705,
-0.676693320274353,
1.9841142892837524,
-0.259631484746933,
0.5769977569580078,
-0.16104912757873535,
-1.3580152988433838,
-0.023416943848133087,
0.7170831561088562,
0.3540169894695282,
-0.43540599942207336,
0.8324915170669556,
-0.6903308629989624,
-1.1759750843048096,
-1.334680438041687,
-0.4416196644306183,
-1.0056755542755127,
-1.0054093599319458,
1.0649951696395874,
0.750251054763794,
0.29931843280792236,
1.8677254915237427,
0.6169666647911072,
0.30167755484580994,
-2.6004209518432617,
1.0001295804977417,
0.2753676772117615,
-0.07716955244541168,
0.9085175395011902,
0.21502676606178284,
1.03960120677948,
-0.00982982199639082,
0.5651879906654358,
-2.3835132122039795,
2.2767868041992188,
-0.23786181211471558,
0.6509610414505005,
-0.01666618511080742,
-0.12688671052455902,
1.1126739978790283,
0.652262806892395,
0.6337741613388062,
-1.1135801076889038,
0.7393299341201782,
-0.5824686884880066,
1.2461540699005127,
0.7982297539710999,
-0.8018156290054321,
-0.03159559145569801,
1.2784119844436646,
0.4190171957015991,
-0.507221519947052,
-0.942267894744873,
-1.0248631238937378,
0.9599552750587463,
1.7106248140335083,
-0.10634688287973404,
-0.022312365472316742,
0.8353573083877563,
0.6532204747200012,
-1.3062814474105835,
0.02959594503045082,
-0.7358414530754089,
-0.6510395407676697,
1.5990378856658936,
2.062061309814453,
-0.12136107683181763,
-0.247141495347023,
-0.6764897108078003,
-1.2955132722854614,
0.716288149356842,
-0.05106967315077782,
0.11543451994657516,
0.6484929919242859,
-0.5857858657836914,
1.04719877243042,
0.7838543057441711,
0.9409589767456055,
0.07269329577684402,
0.2543434798717499,
0.3341750204563141,
-0.3794396221637726,
-1.2213525772094727,
-0.3059470057487488,
-1.0504902601242065,
-2.5394723415374756,
0.42472052574157715,
-0.13898736238479614,
-1.386398196220398,
0.03186981379985809,
-1.0731947422027588,
0.9058120250701904,
-0.5819590091705322,
-1.1523405313491821,
-1.4512728452682495,
0.11988090723752975,
-0.15192750096321106,
0.919806718826294,
-1.600828766822815,
-0.12214198708534241,
1.2940165996551514,
0.8844506144523621,
-0.6290667653083801,
1.0988234281539917,
0.2757415771484375,
1.02842378616333,
0.7853502035140991,
-0.3741871416568756,
0.5665014982223511,
0.038694463670253754,
-1.3572072982788086,
0.49621203541755676,
1.1892671585083008,
0.27794331312179565,
1.4968914985656738,
-0.6359174251556396,
-0.021072618663311005,
0.43945178389549255,
-0.6877829432487488,
-0.4841586649417877,
-0.47574812173843384,
0.742316722869873,
-0.02374415472149849,
-0.9620405435562134,
0.022065971046686172,
-0.13885968923568726,
-0.18265877664089203,
0.12668517231941223,
-1.4752005338668823,
-0.13194136321544647,
-0.3382967412471771,
-0.5781089067459106,
-1.265682578086853,
0.026462890207767487,
1.3834444284439087,
-0.8643494844436646,
-0.23967736959457397,
0.4087892472743988,
0.3895703852176666,
0.5030287504196167,
0.6417034268379211,
-0.6322049498558044,
-0.35914093255996704,
-0.1576000154018402,
-0.31458932161331177,
0.30642059445381165,
1.360521674156189,
-0.08653496950864792,
-1.003784418106079,
0.7569956183433533,
-0.39501824975013733,
0.09992720931768417,
1.8951395750045776,
0.03851785138249397,
-0.7982884645462036,
0.32322442531585693,
-0.7523033022880554,
1.9108481407165527,
1.6485155820846558,
1.3505061864852905,
-0.21292729675769806,
-0.8805689215660095,
0.5898410677909851,
-0.3811679184436798,
-0.36740338802337646,
0.8796919584274292,
0.4080457091331482,
-0.238846555352211,
-1.340729832649231,
0.6456488966941833,
1.2221815586090088,
-0.8994668126106262,
-0.7842153906822205,
0.15658031404018402,
-0.789004385471344,
1.1299183368682861,
0.689980149269104,
0.3660755753517151,
0.22905705869197845,
1.5894780158996582,
0.7380314469337463,
-0.5100706815719604,
0.5016963481903076,
0.49852702021598816,
-0.2575012445449829,
-2.138106107711792,
-1.1053515672683716,
0.3305469751358032,
-0.5359587669372559,
-1.607171893119812,
1.3424549102783203,
-1.0972557067871094,
-1.010508418083191,
0.48702913522720337,
0.10960328578948975,
1.4014983177185059,
0.37331342697143555,
1.5532162189483643,
2.081486463546753,
0.884891927242279,
0.4175777733325958,
1.2451728582382202,
-0.1596774011850357,
-0.5256012082099915,
1.8692233562469482,
-0.46636033058166504,
0.5015011429786682,
1.0980587005615234,
-0.3303076922893524,
-1.0634912252426147,
-0.7630166411399841,
-1.1819168329238892,
-0.626997172832489,
1.2090471982955933,
0.1373305469751358,
-1.1199933290481567,
0.2143787145614624,
1.511945366859436,
0.15905173122882843,
-0.36328086256980896,
0.637513279914856,
0.3537033498287201,
-0.7637263536453247,
0.00040839798748493195,
-0.8867495059967041,
0.5414304137229919,
-0.23278330266475677,
-0.3130379915237427,
0.2860414385795593,
0.4765534996986389,
1.3549937009811401,
-0.05399887263774872,
0.10064586997032166,
1.151572585105896,
-1.3907194137573242,
1.5746294260025024,
-0.6569855809211731,
0.27879342436790466,
-2.304547071456909,
1.3296600580215454,
-0.8249362111091614,
1.9515774250030518,
-2.6879584789276123,
0.41001096367836,
-0.624035120010376,
-0.47311267256736755,
0.2970885932445526,
-0.36611244082450867,
0.06839729100465775,
-0.1355912983417511,
-1.097332239151001,
-0.039959732443094254,
-0.7608487010002136,
0.5432116985321045,
1.1315261125564575,
1.3442859649658203,
-1.166876196861267,
-0.24772107601165771,
-1.7404266595840454,
-0.16017434000968933,
-0.8667598962783813,
0.4788968563079834,
-2.024785041809082,
-0.16268645226955414,
-1.9302982091903687,
-2.254237651824951,
-1.2636827230453491,
-0.8623180985450745,
1.087289810180664,
0.15615884959697723,
-0.8654840588569641,
1.2185522317886353,
-0.34192928671836853,
-1.8179134130477905,
1.0273014307022095,
-2.143564224243164
] |
https://github.com/huggingface/datasets/issues/6078 | resume_download with streaming=True | Currently, it's not possible to efficiently resume streaming after an error. Eventually, we plan to support this for Parquet (see https://github.com/huggingface/datasets/issues/5380). | ### Describe the bug
I used:
```
dataset = load_dataset(
"oscar-corpus/OSCAR-2201",
token=True,
language="fr",
streaming=True,
split="train"
)
```
Unfortunately, the server had a problem during the training process. I saved the step my training stopped at.
But how can I resume download from step 1_000_Β΄000 without re-streaming all the first 1 million docs of the dataset?
`download_config=DownloadConfig(resume_download=True)` seems to not work with streaming=True.
### Steps to reproduce the bug
```
from datasets import load_dataset, DownloadConfig
dataset = load_dataset(
"oscar-corpus/OSCAR-2201",
token=True,
language="fr",
streaming=True, # optional
split="train",
download_config=DownloadConfig(resume_download=True)
)
# interupt the run and try to relaunch it => this restart from scratch
```
### Expected behavior
I would expect a parameter to start streaming from a given index in the dataset.
### Environment info
- `datasets` version: 2.14.0
- Platform: Linux-5.19.0-45-generic-x86_64-with-glibc2.29
- Python version: 3.8.10
- Huggingface_hub version: 0.15.1
- PyArrow version: 12.0.1
- Pandas version: 2.0.0 | 46 | 21 | resume_download with streaming=True
### Describe the bug
I used:
```
dataset = load_dataset(
"oscar-corpus/OSCAR-2201",
token=True,
language="fr",
streaming=True,
split="train"
)
```
Unfortunately, the server had a problem during the training process. I saved the step my training stopped at.
But how can I resume download from step 1_000_Β΄000 without re-streaming all the first 1 million docs of the dataset?
`download_config=DownloadConfig(resume_download=True)` seems to not work with streaming=True.
### Steps to reproduce the bug
```
from datasets import load_dataset, DownloadConfig
dataset = load_dataset(
"oscar-corpus/OSCAR-2201",
token=True,
language="fr",
streaming=True, # optional
split="train",
download_config=DownloadConfig(resume_download=True)
)
# interupt the run and try to relaunch it => this restart from scratch
```
### Expected behavior
I would expect a parameter to start streaming from a given index in the dataset.
### Environment info
- `datasets` version: 2.14.0
- Platform: Linux-5.19.0-45-generic-x86_64-with-glibc2.29
- Python version: 3.8.10
- Huggingface_hub version: 0.15.1
- PyArrow version: 12.0.1
- Pandas version: 2.0.0
Currently, it's not possible to efficiently resume streaming after an error. Eventually, we plan to support this for Parquet (see https://github.com/huggingface/datasets/issues/5380). | [
-1.2152302265167236,
-0.9335026144981384,
-0.6795473694801331,
1.4461760520935059,
-0.1448366641998291,
-1.1738520860671997,
0.18506090342998505,
-1.0231943130493164,
1.5911850929260254,
-0.8055459260940552,
0.3376910090446472,
-1.6882258653640747,
-0.015008553862571716,
-0.5544067621231079,
-0.6764162182807922,
-0.8532108664512634,
-0.4713427424430847,
-0.5966882109642029,
1.0877926349639893,
2.4938271045684814,
1.3066977262496948,
-1.3375062942504883,
2.7422995567321777,
0.7432574033737183,
-0.18866001069545746,
-0.9598947763442993,
0.5551878213882446,
0.07867555320262909,
-1.3557051420211792,
-0.35720792412757874,
-0.9592563509941101,
-0.07734367251396179,
-0.5687628388404846,
-0.5199695825576782,
-0.07902250438928604,
0.4419260621070862,
-0.36033761501312256,
-0.4101621210575104,
-0.528456449508667,
-0.8280544877052307,
0.4416472315788269,
-0.3780672550201416,
0.8595506548881531,
-0.3627651631832123,
1.7919005155563354,
-0.5693904161453247,
0.5638159513473511,
0.7221721410751343,
1.2091435194015503,
0.20429196953773499,
-0.019793439656496048,
0.35101446509361267,
0.433015376329422,
-0.09369628131389618,
0.5654848217964172,
1.1719622611999512,
0.6078616976737976,
0.454606831073761,
0.6841264963150024,
-2.162236213684082,
1.3106409311294556,
-0.953127920627594,
0.25302979350090027,
1.3869777917861938,
-0.9923610687255859,
0.377206951379776,
-1.7350797653198242,
-0.08938468247652054,
0.49600133299827576,
-2.258209228515625,
0.29298311471939087,
-1.2863259315490723,
-0.5818076729774475,
1.0235058069229126,
0.3914727568626404,
-1.2338801622390747,
0.04013660550117493,
-0.41075706481933594,
1.0590635538101196,
0.49247100949287415,
1.114829182624817,
-1.6992371082305908,
-0.046650081872940063,
-0.3145955502986908,
0.15139888226985931,
-1.2747067213058472,
-1.5303367376327515,
0.46012067794799805,
0.6020785570144653,
0.5755804181098938,
-0.1285172998905182,
1.0504354238510132,
-1.054734230041504,
0.7827142477035522,
-1.0037391185760498,
-1.6853892803192139,
-1.4638766050338745,
-2.4283318519592285,
-2.3042001724243164,
0.7224404811859131,
-0.4236210882663727,
-0.5388173460960388,
2.0398926734924316,
-1.0478321313858032,
-1.730431318283081,
1.1580796241760254,
0.22842174768447876,
-0.11994830518960953,
2.423983097076416,
0.23157525062561035,
-0.675762414932251,
0.5167130827903748,
-0.862260639667511,
0.6906998753547668,
-0.3941482901573181,
1.386156439781189,
0.5047014951705933,
-1.1053553819656372,
1.556739091873169,
-0.38618993759155273,
0.5908554196357727,
-0.7261047959327698,
-0.47112736105918884,
-0.6423441171646118,
0.19305086135864258,
1.876969575881958,
-0.31407085061073303,
1.5243463516235352,
-0.30550411343574524,
-1.5056958198547363,
-1.565452218055725,
0.9181663990020752,
0.43211114406585693,
-0.7083709836006165,
0.25211796164512634,
-0.2864833176136017,
0.04308304190635681,
-0.006846821866929531,
1.0507129430770874,
1.310271143913269,
0.7804718017578125,
-0.31781119108200073,
-0.8403688073158264,
0.17215213179588318,
-0.07216153293848038,
-0.6612434387207031,
-1.6783533096313477,
-0.3340854048728943,
0.0033622244372963905,
0.6236568689346313,
-1.2787574529647827,
1.832024097442627,
0.8853970766067505,
1.916749119758606,
0.9779251217842102,
-0.4138173758983612,
1.5175888538360596,
0.10136763751506805,
1.888539433479309,
-0.48837605118751526,
0.6418686509132385,
-0.38206446170806885,
-1.1946923732757568,
0.8367238640785217,
-0.30057835578918457,
-2.050370931625366,
-0.7028405666351318,
-0.8050686717033386,
-0.182336688041687,
-0.8294115662574768,
1.0238276720046997,
-0.21956156194210052,
-1.4199351072311401,
0.2160801738500595,
-0.7005099058151245,
0.12309743463993073,
-1.2839136123657227,
0.3729338049888611,
0.7770066261291504,
-0.6488049626350403,
0.09148965775966644,
-0.29744383692741394,
-1.2349120378494263,
-0.42418745160102844,
0.4374792277812958,
1.8387082815170288,
-0.6922329068183899,
0.9865133166313171,
1.0097006559371948,
-0.7761641144752502,
-0.06195025146007538,
0.403648316860199,
-0.2925274670124054,
0.8706820607185364,
-1.0047743320465088,
-0.52232825756073,
1.1803932189941406,
-0.26057204604148865,
-0.6224153637886047,
1.4836020469665527,
0.7087829113006592,
-1.0296590328216553,
-0.197469100356102,
-0.1394335776567459,
-0.8404703736305237,
0.08052656799554825,
-1.576693058013916,
-0.031925998628139496,
0.3743155002593994,
-1.5318355560302734,
-0.5066518187522888,
-0.16128157079219818,
1.312330722808838,
-0.1573571264743805,
1.4578273296356201,
-0.30365389585494995,
-0.14685745537281036,
-0.45225730538368225,
-0.35402601957321167,
0.15619613230228424,
-0.21242250502109528,
-0.5642135143280029,
0.2449807971715927,
-0.7277427911758423,
0.3310166299343109,
1.4411568641662598,
0.2857378423213959,
0.03681071847677231,
0.5553184151649475,
1.0533413887023926,
0.3821277618408203,
-0.1989714354276657,
-0.8686661720275879,
-1.5513527393341064,
1.965555191040039,
-1.4992032051086426,
1.9865213632583618,
0.7726855874061584,
-0.061497218906879425,
-1.7421406507492065,
-1.8530573844909668,
1.3394582271575928,
1.1679855585098267,
2.3468668460845947,
0.5187192559242249,
0.3967910706996918,
-0.8635135889053345,
-0.723146915435791,
0.24397607147693634,
-1.0291556119918823,
-0.7824226021766663,
0.22567033767700195,
2.375283718109131,
1.7615808248519897,
-0.37500667572021484,
-0.19418133795261383,
-1.120069980621338,
1.4388606548309326,
-0.211673304438591,
0.15452426671981812,
1.9054489135742188,
-0.24300101399421692,
-1.0232532024383545,
1.2525800466537476,
-2.3578097820281982,
0.14099504053592682,
1.9653080701828003,
0.30532053112983704,
0.08138490468263626,
-1.2950373888015747,
-0.7438026666641235,
-0.3297688364982605,
-0.47312676906585693,
-1.2084741592407227,
0.4653668999671936,
-0.2162027806043625,
-0.6918386220932007,
-1.4338619709014893,
0.16054478287696838,
-1.0500643253326416,
-1.7379437685012817,
0.13490578532218933,
1.8025364875793457,
2.015388250350952,
-0.7884443402290344,
1.506548285484314,
-0.2957579493522644,
0.1393580585718155,
1.2280935049057007,
1.2421578168869019,
3.1163454055786133,
1.9810051918029785,
-1.3272329568862915,
0.7171159386634827,
-0.04275035858154297,
-0.4925040304660797,
1.2333329916000366,
-1.1724025011062622,
1.4081696271896362,
-0.16174398362636566,
-1.1865910291671753,
-1.2345467805862427,
0.9529148936271667,
0.4832567870616913,
0.023088594898581505,
-0.5533115863800049,
1.1381181478500366,
0.1744001805782318,
1.373551368713379,
0.5432146787643433,
-0.30075204372406006,
0.6604874134063721,
-0.3410540819168091,
-0.5171825885772705,
1.5663710832595825,
0.22790619730949402,
-1.4601854085922241,
-2.3065671920776367,
-0.21532930433750153,
-0.8855238556861877,
0.06329041719436646,
-0.6837037205696106,
-0.9437782168388367,
1.6569627523422241,
0.5235849022865295,
-1.1427699327468872,
-0.2853957712650299,
-0.3658806085586548,
-0.6114386320114136,
2.7451086044311523,
-1.3821474313735962,
-0.1906457543373108,
-1.0118002891540527,
-0.6680620312690735,
1.5963013172149658,
-1.2098405361175537,
-0.24332483112812042,
-1.0503787994384766,
-0.5597237348556519,
-1.3347715139389038,
-0.6056067943572998,
-0.028251327574253082,
-0.8913255333900452,
0.7518514394760132,
0.12288394570350647,
-1.2823909521102905,
-0.3554604649543762,
-0.8647052049636841,
0.9476937055587769,
-0.12785179913043976,
0.2333310842514038,
1.79412043094635,
0.35986581444740295,
-0.4175155758857727,
0.7270545363426208,
1.1655519008636475,
0.6098622679710388,
-0.5461211204528809,
0.299712598323822,
-0.691704273223877,
0.35012492537498474,
-1.2266067266464233,
0.2315104752779007,
-2.855046272277832,
0.5594903230667114,
-0.047665372490882874,
-0.011979462578892708,
-0.11456239223480225,
-1.2735120058059692,
1.1285794973373413,
2.514244318008423,
-1.1835845708847046,
0.5799510478973389,
0.32331180572509766,
1.1685231924057007,
-1.5894654989242554,
0.27464795112609863,
-0.506837785243988,
2.061248540878296,
0.22779212892055511,
1.1307010650634766,
-0.5289735794067383,
-2.32114577293396,
0.6021445393562317,
-1.2753674983978271,
-1.1291700601577759,
0.815559446811676,
-0.8066407442092896,
0.11687153577804565,
-1.2335373163223267,
-0.2376933991909027,
-0.7891265153884888,
-1.1841456890106201,
0.6700118184089661,
0.06166034936904907,
0.5238075256347656,
-0.6556945443153381,
0.4018084406852722,
-2.257413864135742,
-1.2745277881622314,
-0.2721084952354431,
-0.8754205703735352,
0.40081462264060974,
-0.3751843273639679,
0.6599915027618408,
-0.17777933180332184,
-0.03420703113079071,
0.3128085434436798,
1.4329347610473633,
3.338177442550659,
0.18116465210914612,
0.3606398105621338,
-0.0931011363863945,
-0.9605443477630615,
1.528120756149292,
0.9113075137138367,
-0.15434814989566803,
-0.5743181109428406,
-1.0623633861541748,
1.1986860036849976,
1.823746681213379,
1.1277908086776733,
0.04512573033571243,
-0.8562325835227966,
-0.8179100751876831,
-0.012010086327791214,
0.10682760924100876,
0.41071969270706177,
0.9488883018493652,
0.08067857474088669,
0.09354822337627411,
1.4663938283920288,
1.1581695079803467,
-0.3693964183330536,
0.3556409180164337,
-0.8237767219543457,
-0.4855233132839203,
0.5291132926940918,
0.3107873201370239,
-0.02639114297926426,
0.3579287827014923,
-1.0671637058258057,
-0.24485988914966583,
-0.36165493726730347,
-0.864037811756134,
-0.7178500294685364,
-0.39997369050979614,
-0.38806256651878357,
1.6973234415054321,
0.022445743903517723,
-0.4745410084724426,
0.015440881252288818,
-0.8577554821968079,
-0.07407575100660324,
-1.071800708770752,
0.28187239170074463,
-0.1376981884241104,
-0.04042154178023338,
-0.09818784892559052,
1.7935956716537476,
-0.9425928592681885,
-2.170620918273926,
0.22397802770137787,
0.2432723492383957,
-0.31433016061782837,
0.15838773548603058,
1.6419497728347778,
0.5040155053138733,
1.367754340171814,
1.3101269006729126,
0.9608888030052185,
-0.6161578893661499,
-1.327601432800293,
0.716905415058136,
1.0400457382202148,
-1.3874268531799316,
0.7984371781349182,
0.04011320322751999,
-0.496084988117218,
0.5994125008583069,
1.240555763244629,
0.4713575541973114,
-1.968319296836853,
0.739179253578186,
-0.9133549928665161,
0.8316065073013306,
0.756766676902771,
0.690156102180481,
0.15544137358665466,
0.8197440505027771,
-1.250252366065979,
-1.0575085878372192,
-0.6919196248054504,
-0.6514589786529541,
1.97505784034729,
-0.3400510847568512,
0.5638233423233032,
-0.29003724455833435,
-1.3257312774658203,
0.05606068670749664,
0.636173665523529,
0.28422391414642334,
-0.5369572639465332,
0.7872794270515442,
-0.6003469824790955,
-1.1585335731506348,
-1.3238226175308228,
-0.4602028727531433,
-1.0609277486801147,
-0.9437935948371887,
1.0905256271362305,
0.7342687249183655,
0.2593647241592407,
1.9060503244400024,
0.5982105731964111,
0.20218224823474884,
-2.645624876022339,
0.8851600885391235,
0.24859340488910675,
0.07472506165504456,
0.8156249523162842,
0.3665918707847595,
1.0429344177246094,
-0.06274759024381638,
0.532737672328949,
-2.5300259590148926,
2.3585240840911865,
-0.24261005222797394,
0.6573373079299927,
0.03527519851922989,
-0.13999755680561066,
1.1037564277648926,
0.6760315299034119,
0.4222288727760315,
-1.045186161994934,
0.6462305784225464,
-0.5268282294273376,
1.2884032726287842,
0.8943775296211243,
-0.8640088438987732,
0.002394631505012512,
1.3359862565994263,
0.47202515602111816,
-0.4129452109336853,
-0.9861509203910828,
-0.9883828163146973,
1.0093475580215454,
1.7618577480316162,
0.024923088029026985,
0.08358471095561981,
0.8269375562667847,
0.7280065417289734,
-1.3202109336853027,
0.11657245457172394,
-0.7518434524536133,
-0.7351350784301758,
1.7000536918640137,
2.1430444717407227,
-0.11945410072803497,
-0.2290833294391632,
-0.750403642654419,
-1.2973586320877075,
0.8277097940444946,
0.008054044097661972,
0.18391366302967072,
0.7023034691810608,
-0.6030347943305969,
1.0662516355514526,
0.8582523465156555,
0.8478558659553528,
0.3243965208530426,
0.14563047885894775,
0.3364124596118927,
-0.3254643976688385,
-1.2495590448379517,
-0.18232811987400055,
-1.057618498802185,
-2.6239078044891357,
0.4283095896244049,
-0.2221718579530716,
-1.3980400562286377,
0.04138454794883728,
-1.0823373794555664,
0.8688141703605652,
-0.5551318526268005,
-1.147046446800232,
-1.496049165725708,
0.16760767996311188,
-0.08574362844228745,
0.9128952026367188,
-1.6081352233886719,
-0.11621299386024475,
1.2951852083206177,
0.8642752170562744,
-0.6991583704948425,
1.0267345905303955,
0.1859462857246399,
1.0745776891708374,
0.8270337581634521,
-0.3220572769641876,
0.5803820490837097,
0.08602163195610046,
-1.4245022535324097,
0.3822878301143646,
1.2046293020248413,
0.16048897802829742,
1.5560024976730347,
-0.6085581183433533,
0.012765781953930855,
0.36387836933135986,
-0.5015239715576172,
-0.6270177364349365,
-0.5614607334136963,
0.6439492702484131,
-0.01634574681520462,
-0.9227084517478943,
0.059667617082595825,
-0.07421794533729553,
-0.19960878789424896,
0.18366143107414246,
-1.4385243654251099,
-0.0974927544593811,
-0.3732087016105652,
-0.6499450206756592,
-1.3268990516662598,
-0.08504556119441986,
1.3445314168930054,
-0.7819478511810303,
-0.1495254784822464,
0.4764942228794098,
0.21996138989925385,
0.5576388835906982,
0.6777452826499939,
-0.7188628911972046,
-0.2449461817741394,
-0.18037199974060059,
-0.3575464189052582,
0.44517597556114197,
1.3336044549942017,
-0.13408321142196655,
-0.9335112571716309,
0.5741590857505798,
-0.3169000744819641,
0.18493784964084625,
1.9907430410385132,
0.0416388213634491,
-0.78263258934021,
0.31710198521614075,
-0.6997270584106445,
1.8986737728118896,
1.6918675899505615,
1.3638033866882324,
-0.1596209555864334,
-0.9233207702636719,
0.6485154628753662,
-0.2955987751483917,
-0.46497055888175964,
0.8952386975288391,
0.4143970310688019,
-0.21575963497161865,
-1.3950804471969604,
0.7008740305900574,
1.2859517335891724,
-0.8420936465263367,
-0.885495126247406,
0.1403365135192871,
-0.7658588886260986,
1.0806149244308472,
0.7276718616485596,
0.35227373242378235,
0.30216389894485474,
1.6554561853408813,
0.7934237122535706,
-0.4667719006538391,
0.596416175365448,
0.4684576392173767,
-0.1747775375843048,
-2.0544416904449463,
-1.1277446746826172,
0.3567642867565155,
-0.6356343030929565,
-1.5373082160949707,
1.3921188116073608,
-1.1753582954406738,
-1.0259805917739868,
0.5899139642715454,
0.10220751911401749,
1.411434531211853,
0.31231966614723206,
1.58790922164917,
2.031661033630371,
0.8620810508728027,
0.3892628252506256,
1.218882441520691,
-0.16676153242588043,
-0.4453224539756775,
1.7459038496017456,
-0.41513049602508545,
0.4684638977050781,
1.1277716159820557,
-0.31480878591537476,
-1.0814626216888428,
-0.7824559211730957,
-1.2289707660675049,
-0.7654608488082886,
1.1988794803619385,
0.10859449952840805,
-1.0550651550292969,
0.2635762393474579,
1.4628254175186157,
0.07203550636768341,
-0.29039466381073,
0.6761985421180725,
0.3686957359313965,
-0.7609408497810364,
-0.025927241891622543,
-1.0006458759307861,
0.5500694513320923,
-0.21195241808891296,
-0.4291739761829376,
0.25106361508369446,
0.4353479743003845,
1.3101199865341187,
0.043384552001953125,
0.19582800567150116,
1.1899396181106567,
-1.3893117904663086,
1.472706913948059,
-0.7744202613830566,
0.26952478289604187,
-2.3071365356445312,
1.4284226894378662,
-0.7923533320426941,
1.8372423648834229,
-2.6838741302490234,
0.48084571957588196,
-0.5157762765884399,
-0.43155744671821594,
0.32592493295669556,
-0.44168978929519653,
0.18463295698165894,
-0.1487545222043991,
-1.1672812700271606,
-0.09134617447853088,
-0.6796047687530518,
0.5299858450889587,
1.0839464664459229,
1.3925503492355347,
-1.1302255392074585,
-0.27682071924209595,
-1.727389931678772,
-0.08058236539363861,
-0.6980162262916565,
0.3622454106807709,
-1.9048491716384888,
-0.25896212458610535,
-1.899488925933838,
-2.4035069942474365,
-1.1900361776351929,
-0.815913200378418,
1.183335781097412,
0.15139935910701752,
-0.8207873702049255,
1.1972181797027588,
-0.44696158170700073,
-1.8034833669662476,
1.1631875038146973,
-2.224154472351074
] |
https://github.com/huggingface/datasets/issues/6077 | Mapping gets stuck at 99% | The `MAX_MAP_BATCH_SIZE = 1_000_000_000` hack is bad as it loads the entire dataset into RAM when performing `.map`. Instead, it's best to use `.iter(batch_size)` to iterate over the data batches and compute `mean` for each column. (`stddev` can be computed in another pass).
Also, these arrays are big, so it makes sense to reduce `batch_size`/`writer_batch_size` to avoid RAM issues and slow IO. | ### Describe the bug
Hi !
I'm currently working with a large (~150GB) unnormalized dataset at work.
The dataset is available on a read-only filesystem internally, and I use a [loading script](https://huggingface.co/docs/datasets/dataset_script) to retreive it.
I want to normalize the features of the dataset, meaning I need to compute the mean and standard deviation metric for each feature of the entire dataset. I cannot load the entire dataset to RAM as it is too big, so following [this discussion on the huggingface discourse](https://discuss.huggingface.co/t/copy-columns-in-a-dataset-and-compute-statistics-for-a-column/22157) I am using a [map operation](https://huggingface.co/docs/datasets/v2.14.0/en/package_reference/main_classes#datasets.Dataset.map) to first compute the metrics and a second map operation to apply them on the dataset.
The problem lies in the second mapping, as it gets stuck at ~99%. By checking what the process does (using `htop` and `strace`) it seems to be doing a lot of I/O operations, and I'm not sure why.
Obviously, I could always normalize the dataset externally and then load it using a loading script. However, since the internal dataset is updated fairly frequently, using the library to perform normalization automatically would make it much easier for me.
### Steps to reproduce the bug
I'm able to reproduce the problem using the following scripts:
```python
# random_data.py
import datasets
import torch
_VERSION = "1.0.0"
class RandomDataset(datasets.GeneratorBasedBuilder):
def _info(self):
return datasets.DatasetInfo(
version=_VERSION,
supervised_keys=None,
features=datasets.Features(
{
"positions": datasets.Array2D(
shape=(30000, 3),
dtype="float32",
),
"normals": datasets.Array2D(
shape=(30000, 3),
dtype="float32",
),
"features": datasets.Array2D(
shape=(30000, 6),
dtype="float32",
),
"scalars": datasets.Sequence(
feature=datasets.Value("float32"),
length=20,
),
},
),
)
def _split_generators(self, dl_manager):
return [
datasets.SplitGenerator(
name=datasets.Split.TRAIN, # type: ignore
gen_kwargs={"nb_samples": 1000},
),
datasets.SplitGenerator(
name=datasets.Split.TEST, # type: ignore
gen_kwargs={"nb_samples": 100},
),
]
def _generate_examples(self, nb_samples: int):
for idx in range(nb_samples):
yield idx, {
"positions": torch.randn(30000, 3),
"normals": torch.randn(30000, 3),
"features": torch.randn(30000, 6),
"scalars": torch.randn(20),
}
```
```python
# main.py
import datasets
import torch
def apply_mean_std(
dataset: datasets.Dataset,
means: dict[str, torch.Tensor],
stds: dict[str, torch.Tensor],
) -> dict[str, torch.Tensor]:
"""Normalize the dataset using the mean and standard deviation of each feature.
Args:
dataset (`Dataset`): A huggingface dataset.
mean (`dict[str, Tensor]`): A dictionary containing the mean of each feature.
std (`dict[str, Tensor]`): A dictionary containing the standard deviation of each feature.
Returns:
dict: A dictionary containing the normalized dataset.
"""
result = {}
for key in means.keys():
# extract data from dataset
data: torch.Tensor = dataset[key] # type: ignore
# extract mean and std from dict
mean = means[key] # type: ignore
std = stds[key] # type: ignore
# normalize data
normalized_data = (data - mean) / std
result[key] = normalized_data
return result
# get dataset
ds = datasets.load_dataset(
path="random_data.py",
split="train",
).with_format("torch")
# compute mean (along last axis)
means = {key: torch.zeros(ds[key][0].shape[-1]) for key in ds.column_names}
means_sq = {key: torch.zeros(ds[key][0].shape[-1]) for key in ds.column_names}
for batch in ds.iter(batch_size=8):
for key in ds.column_names:
data = batch[key]
batch_size = data.shape[0]
data = data.reshape(-1, data.shape[-1])
means[key] += data.mean(dim=0) / len(ds) * batch_size
means_sq[key] += (data**2).mean(dim=0) / len(ds) * batch_size
# compute std (along last axis)
stds = {key: torch.sqrt(means_sq[key] - means[key] ** 2) for key in ds.column_names}
# normalize each feature of the dataset
ds_normalized = ds.map(
desc="Applying mean/std", # type: ignore
function=apply_mean_std,
batched=False,
fn_kwargs={
"means": means,
"stds": stds,
},
)
```
### Expected behavior
Using the previous scripts, the `ds_normalized` mapping completes in ~5 minutes, but any subsequent use of `ds_normalized` is really really slow, for example reapplying `apply_mean_std` to `ds_normalized` takes forever. This is very strange, I'm sure I must be missing something, but I would still expect this to be faster.
### Environment info
- `datasets` version: 2.13.1
- Platform: Linux-3.10.0-1160.66.1.el7.x86_64-x86_64-with-glibc2.17
- Python version: 3.10.12
- Huggingface_hub version: 0.15.1
- PyArrow version: 12.0.0
- Pandas version: 2.0.2 | 47 | 62 | Mapping gets stuck at 99%
### Describe the bug
Hi !
I'm currently working with a large (~150GB) unnormalized dataset at work.
The dataset is available on a read-only filesystem internally, and I use a [loading script](https://huggingface.co/docs/datasets/dataset_script) to retreive it.
I want to normalize the features of the dataset, meaning I need to compute the mean and standard deviation metric for each feature of the entire dataset. I cannot load the entire dataset to RAM as it is too big, so following [this discussion on the huggingface discourse](https://discuss.huggingface.co/t/copy-columns-in-a-dataset-and-compute-statistics-for-a-column/22157) I am using a [map operation](https://huggingface.co/docs/datasets/v2.14.0/en/package_reference/main_classes#datasets.Dataset.map) to first compute the metrics and a second map operation to apply them on the dataset.
The problem lies in the second mapping, as it gets stuck at ~99%. By checking what the process does (using `htop` and `strace`) it seems to be doing a lot of I/O operations, and I'm not sure why.
Obviously, I could always normalize the dataset externally and then load it using a loading script. However, since the internal dataset is updated fairly frequently, using the library to perform normalization automatically would make it much easier for me.
### Steps to reproduce the bug
I'm able to reproduce the problem using the following scripts:
```python
# random_data.py
import datasets
import torch
_VERSION = "1.0.0"
class RandomDataset(datasets.GeneratorBasedBuilder):
def _info(self):
return datasets.DatasetInfo(
version=_VERSION,
supervised_keys=None,
features=datasets.Features(
{
"positions": datasets.Array2D(
shape=(30000, 3),
dtype="float32",
),
"normals": datasets.Array2D(
shape=(30000, 3),
dtype="float32",
),
"features": datasets.Array2D(
shape=(30000, 6),
dtype="float32",
),
"scalars": datasets.Sequence(
feature=datasets.Value("float32"),
length=20,
),
},
),
)
def _split_generators(self, dl_manager):
return [
datasets.SplitGenerator(
name=datasets.Split.TRAIN, # type: ignore
gen_kwargs={"nb_samples": 1000},
),
datasets.SplitGenerator(
name=datasets.Split.TEST, # type: ignore
gen_kwargs={"nb_samples": 100},
),
]
def _generate_examples(self, nb_samples: int):
for idx in range(nb_samples):
yield idx, {
"positions": torch.randn(30000, 3),
"normals": torch.randn(30000, 3),
"features": torch.randn(30000, 6),
"scalars": torch.randn(20),
}
```
```python
# main.py
import datasets
import torch
def apply_mean_std(
dataset: datasets.Dataset,
means: dict[str, torch.Tensor],
stds: dict[str, torch.Tensor],
) -> dict[str, torch.Tensor]:
"""Normalize the dataset using the mean and standard deviation of each feature.
Args:
dataset (`Dataset`): A huggingface dataset.
mean (`dict[str, Tensor]`): A dictionary containing the mean of each feature.
std (`dict[str, Tensor]`): A dictionary containing the standard deviation of each feature.
Returns:
dict: A dictionary containing the normalized dataset.
"""
result = {}
for key in means.keys():
# extract data from dataset
data: torch.Tensor = dataset[key] # type: ignore
# extract mean and std from dict
mean = means[key] # type: ignore
std = stds[key] # type: ignore
# normalize data
normalized_data = (data - mean) / std
result[key] = normalized_data
return result
# get dataset
ds = datasets.load_dataset(
path="random_data.py",
split="train",
).with_format("torch")
# compute mean (along last axis)
means = {key: torch.zeros(ds[key][0].shape[-1]) for key in ds.column_names}
means_sq = {key: torch.zeros(ds[key][0].shape[-1]) for key in ds.column_names}
for batch in ds.iter(batch_size=8):
for key in ds.column_names:
data = batch[key]
batch_size = data.shape[0]
data = data.reshape(-1, data.shape[-1])
means[key] += data.mean(dim=0) / len(ds) * batch_size
means_sq[key] += (data**2).mean(dim=0) / len(ds) * batch_size
# compute std (along last axis)
stds = {key: torch.sqrt(means_sq[key] - means[key] ** 2) for key in ds.column_names}
# normalize each feature of the dataset
ds_normalized = ds.map(
desc="Applying mean/std", # type: ignore
function=apply_mean_std,
batched=False,
fn_kwargs={
"means": means,
"stds": stds,
},
)
```
### Expected behavior
Using the previous scripts, the `ds_normalized` mapping completes in ~5 minutes, but any subsequent use of `ds_normalized` is really really slow, for example reapplying `apply_mean_std` to `ds_normalized` takes forever. This is very strange, I'm sure I must be missing something, but I would still expect this to be faster.
### Environment info
- `datasets` version: 2.13.1
- Platform: Linux-3.10.0-1160.66.1.el7.x86_64-x86_64-with-glibc2.17
- Python version: 3.10.12
- Huggingface_hub version: 0.15.1
- PyArrow version: 12.0.0
- Pandas version: 2.0.2
The `MAX_MAP_BATCH_SIZE = 1_000_000_000` hack is bad as it loads the entire dataset into RAM when performing `.map`. Instead, it's best to use `.iter(batch_size)` to iterate over the data batches and compute `mean` for each column. (`stddev` can be computed in another pass).
Also, these arrays are big, so it makes sense to reduce `batch_size`/`writer_batch_size` to avoid RAM issues and slow IO. | [
-1.2467619180679321,
-0.9692441821098328,
-0.7773353457450867,
1.3650438785552979,
-0.10279692709445953,
-1.2577497959136963,
0.0820453092455864,
-1.0771145820617676,
1.6699507236480713,
-0.7752376198768616,
0.2535783052444458,
-1.6741188764572144,
0.0001330627128481865,
-0.5192185044288635,
-0.7196358442306519,
-0.9292827248573303,
-0.42836281657218933,
-0.7693653106689453,
1.0682494640350342,
2.5319032669067383,
1.1663181781768799,
-1.3916829824447632,
2.7380056381225586,
0.6890181303024292,
-0.1308683305978775,
-1.0249642133712769,
0.5794615745544434,
0.014394155703485012,
-1.3597949743270874,
-0.39526140689849854,
-0.9713289737701416,
-0.01855153776705265,
-0.5624193549156189,
-0.4949333965778351,
0.034027427434921265,
0.36742085218429565,
-0.22762511670589447,
-0.4426629841327667,
-0.5897688269615173,
-0.7647039294242859,
0.46197813749313354,
-0.3146698772907257,
0.9942435622215271,
-0.3545180857181549,
1.8296427726745605,
-0.5085375308990479,
0.40375715494155884,
0.6671609878540039,
1.343123435974121,
0.2103288769721985,
0.05046398192644119,
0.32061967253685,
0.4087408781051636,
0.04270897060632706,
0.48136669397354126,
1.1971237659454346,
0.6055260896682739,
0.5078228116035461,
0.7211517691612244,
-2.174020767211914,
1.3422565460205078,
-0.9540314674377441,
0.3771088123321533,
1.3440388441085815,
-0.9014260768890381,
0.36384332180023193,
-1.7529940605163574,
-0.08630987256765366,
0.5511480569839478,
-2.256157875061035,
0.14137482643127441,
-1.2834725379943848,
-0.43197959661483765,
0.9795565009117126,
0.3522584140300751,
-1.2050758600234985,
0.18647566437721252,
-0.47631627321243286,
1.0739091634750366,
0.5062569975852966,
1.2354419231414795,
-1.7089179754257202,
0.033225126564502716,
-0.29483798146247864,
0.17447365820407867,
-1.2803961038589478,
-1.576486349105835,
0.5113226771354675,
0.6043962836265564,
0.6299614310264587,
-0.08441014587879181,
1.0067667961120605,
-1.0267763137817383,
0.7464110255241394,
-0.8652818202972412,
-1.6710386276245117,
-1.3861955404281616,
-2.301039934158325,
-2.3644816875457764,
0.8184136152267456,
-0.5005026459693909,
-0.5061028003692627,
2.0318002700805664,
-1.0828410387039185,
-1.790990948677063,
1.0765491724014282,
0.27483460307121277,
0.02147497981786728,
2.377331256866455,
0.162489116191864,
-0.7233153581619263,
0.49063411355018616,
-0.7345637083053589,
0.7893033027648926,
-0.3272707462310791,
1.3078820705413818,
0.4816489517688751,
-1.0030062198638916,
1.5656243562698364,
-0.40476158261299133,
0.5793794989585876,
-0.6556822061538696,
-0.4828268885612488,
-0.8300641775131226,
0.2967936098575592,
1.8910833597183228,
-0.3305094242095947,
1.6367286443710327,
-0.37281346321105957,
-1.6050193309783936,
-1.6232235431671143,
0.829276442527771,
0.5127225518226624,
-0.7676873207092285,
0.052157413214445114,
-0.3729911148548126,
0.06593628227710724,
0.03608138859272003,
1.1072019338607788,
1.202584981918335,
0.709801971912384,
-0.33022168278694153,
-0.8758439421653748,
0.1816616654396057,
-0.0807175561785698,
-0.6972082853317261,
-1.7582370042800903,
-0.3290409445762634,
0.12490931898355484,
0.620330274105072,
-1.1948826313018799,
1.7064586877822876,
0.8753851652145386,
1.8962076902389526,
1.0360573530197144,
-0.3524904251098633,
1.5238271951675415,
0.08224860578775406,
1.8405604362487793,
-0.49912044405937195,
0.6472380757331848,
-0.32927653193473816,
-1.170258641242981,
0.7816345691680908,
-0.3797627389431,
-2.0614588260650635,
-0.7647451758384705,
-0.8371453285217285,
-0.1527726650238037,
-0.7501168847084045,
0.951413094997406,
-0.34933069348335266,
-1.4247697591781616,
0.1697305142879486,
-0.6908698678016663,
0.10819616168737411,
-1.239892840385437,
0.2963680922985077,
0.7544494271278381,
-0.66166752576828,
-0.005780170671641827,
-0.29043665528297424,
-1.290385365486145,
-0.42731159925460815,
0.3055631220340729,
1.8546395301818848,
-0.7297377586364746,
0.9705548286437988,
1.0357428789138794,
-0.7008418440818787,
0.00022096093744039536,
0.29257071018218994,
-0.27541670203208923,
0.9122263789176941,
-1.0406187772750854,
-0.3938690721988678,
1.141351342201233,
-0.18762926757335663,
-0.6023191213607788,
1.405550479888916,
0.6929025650024414,
-1.041069746017456,
-0.212516650557518,
-0.083040252327919,
-0.8680865168571472,
0.000782831571996212,
-1.5526432991027832,
-0.14706754684448242,
0.30281320214271545,
-1.5828789472579956,
-0.509287416934967,
-0.22816458344459534,
1.2231131792068481,
-0.1552390158176422,
1.4142327308654785,
-0.365632563829422,
-0.19843073189258575,
-0.42432650923728943,
-0.4180070161819458,
0.17111988365650177,
-0.21451576054096222,
-0.6111334562301636,
0.2689812481403351,
-0.8629196882247925,
0.3410608172416687,
1.4479649066925049,
0.4027152955532074,
0.0833694264292717,
0.49972155690193176,
1.0811717510223389,
0.3805101811885834,
-0.08217080682516098,
-0.8663572669029236,
-1.5910987854003906,
2.05835223197937,
-1.4396908283233643,
1.9476808309555054,
0.7663041353225708,
-0.0760643482208252,
-1.8363510370254517,
-1.8936485052108765,
1.3488260507583618,
1.144186019897461,
2.37715744972229,
0.5074591040611267,
0.34930527210235596,
-0.783288836479187,
-0.6814500093460083,
0.34575241804122925,
-0.9749862551689148,
-0.7821716666221619,
0.10059787333011627,
2.326171875,
1.771716594696045,
-0.4542063772678375,
-0.22829017043113708,
-1.0167423486709595,
1.3656398057937622,
-0.201698437333107,
0.18882721662521362,
1.953131079673767,
-0.2971537113189697,
-1.0376105308532715,
1.3382163047790527,
-2.2815980911254883,
0.12969645857810974,
1.9696540832519531,
0.2699890732765198,
0.028413381427526474,
-1.4278004169464111,
-0.734067976474762,
-0.2700731158256531,
-0.46307164430618286,
-1.2981153726577759,
0.5094518661499023,
-0.30918145179748535,
-0.7922512888908386,
-1.4753799438476562,
0.08738581091165543,
-1.1354340314865112,
-1.708796501159668,
0.2509942948818207,
1.8835444450378418,
2.0085153579711914,
-0.7053989768028259,
1.4498223066329956,
-0.2546137869358063,
0.19014158844947815,
1.2200132608413696,
1.2179193496704102,
3.1545634269714355,
1.8570878505706787,
-1.273846983909607,
0.6684048771858215,
-0.1141929179430008,
-0.4647964835166931,
1.1711809635162354,
-1.1206079721450806,
1.273573637008667,
-0.18289639055728912,
-1.2553105354309082,
-1.2094475030899048,
1.0053393840789795,
0.45095232129096985,
0.0753774344921112,
-0.47078564763069153,
1.231424331665039,
-0.00803452730178833,
1.296268343925476,
0.5883960127830505,
-0.416258305311203,
0.6329759359359741,
-0.3883343040943146,
-0.5795652866363525,
1.5594953298568726,
0.13391847908496857,
-1.4948092699050903,
-2.2733843326568604,
-0.2512319087982178,
-0.8362984657287598,
0.061264362186193466,
-0.5851579904556274,
-1.0123529434204102,
1.6775928735733032,
0.4154697358608246,
-1.2488596439361572,
-0.26908570528030396,
-0.3993071913719177,
-0.6375272274017334,
2.6548166275024414,
-1.375285267829895,
-0.22833557426929474,
-0.9726972579956055,
-0.579551637172699,
1.555286169052124,
-1.1725170612335205,
-0.1947334259748459,
-0.9975393414497375,
-0.644557535648346,
-1.3117153644561768,
-0.5524806380271912,
-0.005474680569022894,
-0.9762184023857117,
0.7510079145431519,
0.09415651112794876,
-1.1093993186950684,
-0.21420562267303467,
-0.8925400376319885,
0.9263931512832642,
-0.11680498719215393,
0.23930753767490387,
1.9479926824569702,
0.3844825029373169,
-0.3727227449417114,
0.7020922303199768,
1.192228078842163,
0.6332438588142395,
-0.6933721899986267,
0.17940156161785126,
-0.7332433462142944,
0.2755816876888275,
-1.3079543113708496,
0.2640681564807892,
-2.8605823516845703,
0.6311547160148621,
-0.05276830494403839,
-0.058975230902433395,
0.035076286643743515,
-1.2897974252700806,
1.022388219833374,
2.627579689025879,
-1.2358187437057495,
0.4526868462562561,
0.35500675439834595,
1.1841776371002197,
-1.5929027795791626,
0.2859206199645996,
-0.45876768231391907,
2.0668561458587646,
0.2681424915790558,
1.188961148262024,
-0.4825421869754791,
-2.2171220779418945,
0.6156185865402222,
-1.2931641340255737,
-1.1424412727355957,
0.837589681148529,
-0.9084362387657166,
0.16509266197681427,
-1.4005670547485352,
-0.11599458009004593,
-0.7898463010787964,
-1.1691677570343018,
0.6727437376976013,
0.09872538596391678,
0.4813684821128845,
-0.5571417808532715,
0.3317040205001831,
-2.189272403717041,
-1.3392794132232666,
-0.22758139669895172,
-0.9479457139968872,
0.4868817627429962,
-0.3594978153705597,
0.6272926330566406,
-0.15944111347198486,
-0.00487998453900218,
0.32125017046928406,
1.3401402235031128,
3.422945022583008,
0.23287490010261536,
0.27114418148994446,
-0.09279090911149979,
-1.0096945762634277,
1.4944300651550293,
0.9546167850494385,
-0.16229791939258575,
-0.58292156457901,
-1.010434865951538,
1.332673192024231,
1.925355076789856,
1.103664755821228,
0.07600940763950348,
-0.8146185278892517,
-0.715214192867279,
0.030831746757030487,
0.20698682963848114,
0.4660505950450897,
0.943488359451294,
0.04124996066093445,
0.13615675270557404,
1.4841886758804321,
1.1912275552749634,
-0.3671254813671112,
0.3807029724121094,
-0.8676914572715759,
-0.5236761569976807,
0.501707136631012,
0.2918422520160675,
-0.006752285175025463,
0.44594258069992065,
-1.0455619096755981,
-0.24925671517848969,
-0.4486271142959595,
-0.973075807094574,
-0.6216679811477661,
-0.4124670624732971,
-0.3621116280555725,
1.637519359588623,
0.09520765393972397,
-0.5045101642608643,
-0.031103838235139847,
-0.7441604733467102,
-0.16319754719734192,
-1.0321203470230103,
0.3236604928970337,
-0.10514117777347565,
-0.09052335470914841,
-0.11579757183790207,
1.7546086311340332,
-0.9250495433807373,
-2.144601345062256,
0.2583377957344055,
0.22768360376358032,
-0.33503302931785583,
0.1973697543144226,
1.612885594367981,
0.5320526361465454,
1.4144856929779053,
1.3681854009628296,
0.9136322140693665,
-0.6243329644203186,
-1.2871012687683105,
0.6554571390151978,
1.0068215131759644,
-1.3799216747283936,
0.8822434544563293,
-0.08427087962627411,
-0.6085430979728699,
0.663037121295929,
1.2824103832244873,
0.43640318512916565,
-1.95796537399292,
0.8366286158561707,
-0.8730506300926208,
0.7851585745811462,
0.6522778868675232,
0.7634931206703186,
0.1387971043586731,
0.8068157434463501,
-1.300091028213501,
-1.1802146434783936,
-0.7512952089309692,
-0.633277952671051,
1.9603829383850098,
-0.2229035198688507,
0.6474459171295166,
-0.26533573865890503,
-1.2844253778457642,
-0.10628432780504227,
0.668134868144989,
0.2962866723537445,
-0.4588245749473572,
0.8894175291061401,
-0.6616579294204712,
-1.1329398155212402,
-1.4416307210922241,
-0.3858431279659271,
-1.0280656814575195,
-0.8643195033073425,
1.0733836889266968,
0.7522611021995544,
0.2900993227958679,
1.8616113662719727,
0.5906223058700562,
0.23343966901302338,
-2.6607463359832764,
0.8695493936538696,
0.2809373736381531,
-0.04380936548113823,
0.8599489331245422,
0.24945273995399475,
1.0215091705322266,
-0.005454744677990675,
0.5712770819664001,
-2.357414722442627,
2.238645315170288,
-0.22387544810771942,
0.7148292660713196,
-0.028256762772798538,
-0.18239955604076385,
1.1076127290725708,
0.5988099575042725,
0.6433889865875244,
-1.131514549255371,
0.7183264493942261,
-0.5575469732284546,
1.1952338218688965,
0.9183469414710999,
-0.8061854839324951,
-0.034427180886268616,
1.391994595527649,
0.5169562101364136,
-0.41163790225982666,
-0.9537155032157898,
-0.8884913325309753,
0.9732288122177124,
1.7941237688064575,
-0.017208373174071312,
0.0205356664955616,
0.8445966243743896,
0.7048121690750122,
-1.33951997756958,
0.05590561404824257,
-0.7149564623832703,
-0.6730610132217407,
1.6666510105133057,
2.0555827617645264,
-0.08342210203409195,
-0.16475918889045715,
-0.6779496669769287,
-1.2728368043899536,
0.7260436415672302,
-0.02408532053232193,
0.16788329184055328,
0.6857488751411438,
-0.6352343559265137,
1.1326508522033691,
0.8350221514701843,
0.9098381400108337,
0.16711068153381348,
0.25635331869125366,
0.38047876954078674,
-0.2753162086009979,
-1.1661970615386963,
-0.24308814108371735,
-1.0622906684875488,
-2.490513801574707,
0.39713799953460693,
-0.2678970992565155,
-1.4938024282455444,
0.0615595318377018,
-0.9970216751098633,
0.9434236884117126,
-0.5429925918579102,
-1.0938559770584106,
-1.5237315893173218,
0.2605784237384796,
-0.08075535297393799,
0.8848752379417419,
-1.5840823650360107,
-0.10325048863887787,
1.258912205696106,
0.9220340847969055,
-0.6065003275871277,
1.034543514251709,
0.25848492980003357,
0.9599147439002991,
0.8144968748092651,
-0.427222341299057,
0.4959949553012848,
0.13257567584514618,
-1.4068048000335693,
0.43835729360580444,
1.1329865455627441,
0.21448595821857452,
1.4070404767990112,
-0.5656892657279968,
0.05393088981509209,
0.4348471164703369,
-0.5174618363380432,
-0.4444368779659271,
-0.5237290263175964,
0.6564182043075562,
0.017516884952783585,
-0.9142799377441406,
-0.012896684929728508,
-0.014023944735527039,
-0.2493845522403717,
0.25133979320526123,
-1.4675674438476562,
-0.21480707824230194,
-0.4538046419620514,
-0.6116509437561035,
-1.2738367319107056,
-0.058122944086790085,
1.4391961097717285,
-0.8751161098480225,
-0.20370179414749146,
0.48616519570350647,
0.3364516496658325,
0.5443090200424194,
0.693285346031189,
-0.6777745485305786,
-0.2959807813167572,
-0.2361563742160797,
-0.3430134057998657,
0.2228562980890274,
1.2816890478134155,
-0.19853299856185913,
-0.963226854801178,
0.7401447296142578,
-0.330976665019989,
0.08073585480451584,
1.9571428298950195,
0.09340310841798782,
-0.7795586585998535,
0.28553229570388794,
-0.7227051258087158,
1.886473536491394,
1.7449703216552734,
1.4108755588531494,
-0.13359478116035461,
-0.8632180094718933,
0.5396673083305359,
-0.22204384207725525,
-0.3870353698730469,
0.968782365322113,
0.45092907547950745,
-0.14268913865089417,
-1.4336422681808472,
0.6162696480751038,
1.265200138092041,
-0.9080483317375183,
-0.7721258401870728,
0.0915364995598793,
-0.8525296449661255,
1.1124672889709473,
0.6831794381141663,
0.37242868542671204,
0.21695482730865479,
1.6378859281539917,
0.7516043782234192,
-0.4558798372745514,
0.5118764042854309,
0.5175111889839172,
-0.1697489470243454,
-2.1106138229370117,
-1.0412570238113403,
0.285397469997406,
-0.4316714107990265,
-1.575904130935669,
1.3548997640609741,
-1.1578586101531982,
-0.9238414168357849,
0.5306224226951599,
0.03838927671313286,
1.4312107563018799,
0.35462456941604614,
1.6312850713729858,
2.1382038593292236,
0.9121946096420288,
0.3359551429748535,
1.2678711414337158,
-0.054888613522052765,
-0.3838828206062317,
1.7917003631591797,
-0.38751456141471863,
0.5465928912162781,
1.0551667213439941,
-0.3655823767185211,
-1.0192077159881592,
-0.7280741333961487,
-1.2008825540542603,
-0.6306957006454468,
1.1408659219741821,
0.087174192070961,
-1.1189939975738525,
0.21593990921974182,
1.5484702587127686,
0.16591185331344604,
-0.25275304913520813,
0.6905345916748047,
0.46423640847206116,
-0.7505894303321838,
-0.09318429976701736,
-0.972011387348175,
0.5159144401550293,
-0.23220886290073395,
-0.3800661563873291,
0.3158402144908905,
0.43816208839416504,
1.280009150505066,
0.0043673086911439896,
0.16628558933734894,
1.2539658546447754,
-1.3642265796661377,
1.4609066247940063,
-0.704849123954773,
0.23544204235076904,
-2.4571473598480225,
1.4564132690429688,
-0.7929314970970154,
1.9027079343795776,
-2.627387285232544,
0.45968684554100037,
-0.6051923036575317,
-0.4301159679889679,
0.31800055503845215,
-0.4098037779331207,
0.0812394991517067,
-0.11631014943122864,
-1.098257064819336,
-0.08325605094432831,
-0.7290157675743103,
0.6102077960968018,
1.175999641418457,
1.3195080757141113,
-1.069354772567749,
-0.3195604979991913,
-1.7545759677886963,
-0.16033481061458588,
-0.7242748737335205,
0.3217547833919525,
-1.9534660577774048,
-0.16953818500041962,
-1.9060369729995728,
-2.5040366649627686,
-1.293465256690979,
-0.8021124601364136,
1.1435776948928833,
0.21453706920146942,
-0.9167917370796204,
1.2267842292785645,
-0.3773776888847351,
-1.8507046699523926,
1.1155215501785278,
-2.2504379749298096
] |
https://github.com/huggingface/datasets/issues/6077 | Mapping gets stuck at 99% | Hi @mariosasko !
I agree, it's an ugly hack, but it was convenient since the resulting `mean_std` could be cached by the library. For my large dataset (which doesn't fit in RAM), I'm actually using something similar to what you suggested. I got rid of the first mapping in the above scripts and replaced it with an iterator, but the issue with the second mapping still persists. | ### Describe the bug
Hi !
I'm currently working with a large (~150GB) unnormalized dataset at work.
The dataset is available on a read-only filesystem internally, and I use a [loading script](https://huggingface.co/docs/datasets/dataset_script) to retreive it.
I want to normalize the features of the dataset, meaning I need to compute the mean and standard deviation metric for each feature of the entire dataset. I cannot load the entire dataset to RAM as it is too big, so following [this discussion on the huggingface discourse](https://discuss.huggingface.co/t/copy-columns-in-a-dataset-and-compute-statistics-for-a-column/22157) I am using a [map operation](https://huggingface.co/docs/datasets/v2.14.0/en/package_reference/main_classes#datasets.Dataset.map) to first compute the metrics and a second map operation to apply them on the dataset.
The problem lies in the second mapping, as it gets stuck at ~99%. By checking what the process does (using `htop` and `strace`) it seems to be doing a lot of I/O operations, and I'm not sure why.
Obviously, I could always normalize the dataset externally and then load it using a loading script. However, since the internal dataset is updated fairly frequently, using the library to perform normalization automatically would make it much easier for me.
### Steps to reproduce the bug
I'm able to reproduce the problem using the following scripts:
```python
# random_data.py
import datasets
import torch
_VERSION = "1.0.0"
class RandomDataset(datasets.GeneratorBasedBuilder):
def _info(self):
return datasets.DatasetInfo(
version=_VERSION,
supervised_keys=None,
features=datasets.Features(
{
"positions": datasets.Array2D(
shape=(30000, 3),
dtype="float32",
),
"normals": datasets.Array2D(
shape=(30000, 3),
dtype="float32",
),
"features": datasets.Array2D(
shape=(30000, 6),
dtype="float32",
),
"scalars": datasets.Sequence(
feature=datasets.Value("float32"),
length=20,
),
},
),
)
def _split_generators(self, dl_manager):
return [
datasets.SplitGenerator(
name=datasets.Split.TRAIN, # type: ignore
gen_kwargs={"nb_samples": 1000},
),
datasets.SplitGenerator(
name=datasets.Split.TEST, # type: ignore
gen_kwargs={"nb_samples": 100},
),
]
def _generate_examples(self, nb_samples: int):
for idx in range(nb_samples):
yield idx, {
"positions": torch.randn(30000, 3),
"normals": torch.randn(30000, 3),
"features": torch.randn(30000, 6),
"scalars": torch.randn(20),
}
```
```python
# main.py
import datasets
import torch
def apply_mean_std(
dataset: datasets.Dataset,
means: dict[str, torch.Tensor],
stds: dict[str, torch.Tensor],
) -> dict[str, torch.Tensor]:
"""Normalize the dataset using the mean and standard deviation of each feature.
Args:
dataset (`Dataset`): A huggingface dataset.
mean (`dict[str, Tensor]`): A dictionary containing the mean of each feature.
std (`dict[str, Tensor]`): A dictionary containing the standard deviation of each feature.
Returns:
dict: A dictionary containing the normalized dataset.
"""
result = {}
for key in means.keys():
# extract data from dataset
data: torch.Tensor = dataset[key] # type: ignore
# extract mean and std from dict
mean = means[key] # type: ignore
std = stds[key] # type: ignore
# normalize data
normalized_data = (data - mean) / std
result[key] = normalized_data
return result
# get dataset
ds = datasets.load_dataset(
path="random_data.py",
split="train",
).with_format("torch")
# compute mean (along last axis)
means = {key: torch.zeros(ds[key][0].shape[-1]) for key in ds.column_names}
means_sq = {key: torch.zeros(ds[key][0].shape[-1]) for key in ds.column_names}
for batch in ds.iter(batch_size=8):
for key in ds.column_names:
data = batch[key]
batch_size = data.shape[0]
data = data.reshape(-1, data.shape[-1])
means[key] += data.mean(dim=0) / len(ds) * batch_size
means_sq[key] += (data**2).mean(dim=0) / len(ds) * batch_size
# compute std (along last axis)
stds = {key: torch.sqrt(means_sq[key] - means[key] ** 2) for key in ds.column_names}
# normalize each feature of the dataset
ds_normalized = ds.map(
desc="Applying mean/std", # type: ignore
function=apply_mean_std,
batched=False,
fn_kwargs={
"means": means,
"stds": stds,
},
)
```
### Expected behavior
Using the previous scripts, the `ds_normalized` mapping completes in ~5 minutes, but any subsequent use of `ds_normalized` is really really slow, for example reapplying `apply_mean_std` to `ds_normalized` takes forever. This is very strange, I'm sure I must be missing something, but I would still expect this to be faster.
### Environment info
- `datasets` version: 2.13.1
- Platform: Linux-3.10.0-1160.66.1.el7.x86_64-x86_64-with-glibc2.17
- Python version: 3.10.12
- Huggingface_hub version: 0.15.1
- PyArrow version: 12.0.0
- Pandas version: 2.0.2 | 47 | 67 | Mapping gets stuck at 99%
### Describe the bug
Hi !
I'm currently working with a large (~150GB) unnormalized dataset at work.
The dataset is available on a read-only filesystem internally, and I use a [loading script](https://huggingface.co/docs/datasets/dataset_script) to retreive it.
I want to normalize the features of the dataset, meaning I need to compute the mean and standard deviation metric for each feature of the entire dataset. I cannot load the entire dataset to RAM as it is too big, so following [this discussion on the huggingface discourse](https://discuss.huggingface.co/t/copy-columns-in-a-dataset-and-compute-statistics-for-a-column/22157) I am using a [map operation](https://huggingface.co/docs/datasets/v2.14.0/en/package_reference/main_classes#datasets.Dataset.map) to first compute the metrics and a second map operation to apply them on the dataset.
The problem lies in the second mapping, as it gets stuck at ~99%. By checking what the process does (using `htop` and `strace`) it seems to be doing a lot of I/O operations, and I'm not sure why.
Obviously, I could always normalize the dataset externally and then load it using a loading script. However, since the internal dataset is updated fairly frequently, using the library to perform normalization automatically would make it much easier for me.
### Steps to reproduce the bug
I'm able to reproduce the problem using the following scripts:
```python
# random_data.py
import datasets
import torch
_VERSION = "1.0.0"
class RandomDataset(datasets.GeneratorBasedBuilder):
def _info(self):
return datasets.DatasetInfo(
version=_VERSION,
supervised_keys=None,
features=datasets.Features(
{
"positions": datasets.Array2D(
shape=(30000, 3),
dtype="float32",
),
"normals": datasets.Array2D(
shape=(30000, 3),
dtype="float32",
),
"features": datasets.Array2D(
shape=(30000, 6),
dtype="float32",
),
"scalars": datasets.Sequence(
feature=datasets.Value("float32"),
length=20,
),
},
),
)
def _split_generators(self, dl_manager):
return [
datasets.SplitGenerator(
name=datasets.Split.TRAIN, # type: ignore
gen_kwargs={"nb_samples": 1000},
),
datasets.SplitGenerator(
name=datasets.Split.TEST, # type: ignore
gen_kwargs={"nb_samples": 100},
),
]
def _generate_examples(self, nb_samples: int):
for idx in range(nb_samples):
yield idx, {
"positions": torch.randn(30000, 3),
"normals": torch.randn(30000, 3),
"features": torch.randn(30000, 6),
"scalars": torch.randn(20),
}
```
```python
# main.py
import datasets
import torch
def apply_mean_std(
dataset: datasets.Dataset,
means: dict[str, torch.Tensor],
stds: dict[str, torch.Tensor],
) -> dict[str, torch.Tensor]:
"""Normalize the dataset using the mean and standard deviation of each feature.
Args:
dataset (`Dataset`): A huggingface dataset.
mean (`dict[str, Tensor]`): A dictionary containing the mean of each feature.
std (`dict[str, Tensor]`): A dictionary containing the standard deviation of each feature.
Returns:
dict: A dictionary containing the normalized dataset.
"""
result = {}
for key in means.keys():
# extract data from dataset
data: torch.Tensor = dataset[key] # type: ignore
# extract mean and std from dict
mean = means[key] # type: ignore
std = stds[key] # type: ignore
# normalize data
normalized_data = (data - mean) / std
result[key] = normalized_data
return result
# get dataset
ds = datasets.load_dataset(
path="random_data.py",
split="train",
).with_format("torch")
# compute mean (along last axis)
means = {key: torch.zeros(ds[key][0].shape[-1]) for key in ds.column_names}
means_sq = {key: torch.zeros(ds[key][0].shape[-1]) for key in ds.column_names}
for batch in ds.iter(batch_size=8):
for key in ds.column_names:
data = batch[key]
batch_size = data.shape[0]
data = data.reshape(-1, data.shape[-1])
means[key] += data.mean(dim=0) / len(ds) * batch_size
means_sq[key] += (data**2).mean(dim=0) / len(ds) * batch_size
# compute std (along last axis)
stds = {key: torch.sqrt(means_sq[key] - means[key] ** 2) for key in ds.column_names}
# normalize each feature of the dataset
ds_normalized = ds.map(
desc="Applying mean/std", # type: ignore
function=apply_mean_std,
batched=False,
fn_kwargs={
"means": means,
"stds": stds,
},
)
```
### Expected behavior
Using the previous scripts, the `ds_normalized` mapping completes in ~5 minutes, but any subsequent use of `ds_normalized` is really really slow, for example reapplying `apply_mean_std` to `ds_normalized` takes forever. This is very strange, I'm sure I must be missing something, but I would still expect this to be faster.
### Environment info
- `datasets` version: 2.13.1
- Platform: Linux-3.10.0-1160.66.1.el7.x86_64-x86_64-with-glibc2.17
- Python version: 3.10.12
- Huggingface_hub version: 0.15.1
- PyArrow version: 12.0.0
- Pandas version: 2.0.2
Hi @mariosasko !
I agree, it's an ugly hack, but it was convenient since the resulting `mean_std` could be cached by the library. For my large dataset (which doesn't fit in RAM), I'm actually using something similar to what you suggested. I got rid of the first mapping in the above scripts and replaced it with an iterator, but the issue with the second mapping still persists. | [
-1.2467619180679321,
-0.9692441821098328,
-0.7773353457450867,
1.3650438785552979,
-0.10279692709445953,
-1.2577497959136963,
0.0820453092455864,
-1.0771145820617676,
1.6699507236480713,
-0.7752376198768616,
0.2535783052444458,
-1.6741188764572144,
0.0001330627128481865,
-0.5192185044288635,
-0.7196358442306519,
-0.9292827248573303,
-0.42836281657218933,
-0.7693653106689453,
1.0682494640350342,
2.5319032669067383,
1.1663181781768799,
-1.3916829824447632,
2.7380056381225586,
0.6890181303024292,
-0.1308683305978775,
-1.0249642133712769,
0.5794615745544434,
0.014394155703485012,
-1.3597949743270874,
-0.39526140689849854,
-0.9713289737701416,
-0.01855153776705265,
-0.5624193549156189,
-0.4949333965778351,
0.034027427434921265,
0.36742085218429565,
-0.22762511670589447,
-0.4426629841327667,
-0.5897688269615173,
-0.7647039294242859,
0.46197813749313354,
-0.3146698772907257,
0.9942435622215271,
-0.3545180857181549,
1.8296427726745605,
-0.5085375308990479,
0.40375715494155884,
0.6671609878540039,
1.343123435974121,
0.2103288769721985,
0.05046398192644119,
0.32061967253685,
0.4087408781051636,
0.04270897060632706,
0.48136669397354126,
1.1971237659454346,
0.6055260896682739,
0.5078228116035461,
0.7211517691612244,
-2.174020767211914,
1.3422565460205078,
-0.9540314674377441,
0.3771088123321533,
1.3440388441085815,
-0.9014260768890381,
0.36384332180023193,
-1.7529940605163574,
-0.08630987256765366,
0.5511480569839478,
-2.256157875061035,
0.14137482643127441,
-1.2834725379943848,
-0.43197959661483765,
0.9795565009117126,
0.3522584140300751,
-1.2050758600234985,
0.18647566437721252,
-0.47631627321243286,
1.0739091634750366,
0.5062569975852966,
1.2354419231414795,
-1.7089179754257202,
0.033225126564502716,
-0.29483798146247864,
0.17447365820407867,
-1.2803961038589478,
-1.576486349105835,
0.5113226771354675,
0.6043962836265564,
0.6299614310264587,
-0.08441014587879181,
1.0067667961120605,
-1.0267763137817383,
0.7464110255241394,
-0.8652818202972412,
-1.6710386276245117,
-1.3861955404281616,
-2.301039934158325,
-2.3644816875457764,
0.8184136152267456,
-0.5005026459693909,
-0.5061028003692627,
2.0318002700805664,
-1.0828410387039185,
-1.790990948677063,
1.0765491724014282,
0.27483460307121277,
0.02147497981786728,
2.377331256866455,
0.162489116191864,
-0.7233153581619263,
0.49063411355018616,
-0.7345637083053589,
0.7893033027648926,
-0.3272707462310791,
1.3078820705413818,
0.4816489517688751,
-1.0030062198638916,
1.5656243562698364,
-0.40476158261299133,
0.5793794989585876,
-0.6556822061538696,
-0.4828268885612488,
-0.8300641775131226,
0.2967936098575592,
1.8910833597183228,
-0.3305094242095947,
1.6367286443710327,
-0.37281346321105957,
-1.6050193309783936,
-1.6232235431671143,
0.829276442527771,
0.5127225518226624,
-0.7676873207092285,
0.052157413214445114,
-0.3729911148548126,
0.06593628227710724,
0.03608138859272003,
1.1072019338607788,
1.202584981918335,
0.709801971912384,
-0.33022168278694153,
-0.8758439421653748,
0.1816616654396057,
-0.0807175561785698,
-0.6972082853317261,
-1.7582370042800903,
-0.3290409445762634,
0.12490931898355484,
0.620330274105072,
-1.1948826313018799,
1.7064586877822876,
0.8753851652145386,
1.8962076902389526,
1.0360573530197144,
-0.3524904251098633,
1.5238271951675415,
0.08224860578775406,
1.8405604362487793,
-0.49912044405937195,
0.6472380757331848,
-0.32927653193473816,
-1.170258641242981,
0.7816345691680908,
-0.3797627389431,
-2.0614588260650635,
-0.7647451758384705,
-0.8371453285217285,
-0.1527726650238037,
-0.7501168847084045,
0.951413094997406,
-0.34933069348335266,
-1.4247697591781616,
0.1697305142879486,
-0.6908698678016663,
0.10819616168737411,
-1.239892840385437,
0.2963680922985077,
0.7544494271278381,
-0.66166752576828,
-0.005780170671641827,
-0.29043665528297424,
-1.290385365486145,
-0.42731159925460815,
0.3055631220340729,
1.8546395301818848,
-0.7297377586364746,
0.9705548286437988,
1.0357428789138794,
-0.7008418440818787,
0.00022096093744039536,
0.29257071018218994,
-0.27541670203208923,
0.9122263789176941,
-1.0406187772750854,
-0.3938690721988678,
1.141351342201233,
-0.18762926757335663,
-0.6023191213607788,
1.405550479888916,
0.6929025650024414,
-1.041069746017456,
-0.212516650557518,
-0.083040252327919,
-0.8680865168571472,
0.000782831571996212,
-1.5526432991027832,
-0.14706754684448242,
0.30281320214271545,
-1.5828789472579956,
-0.509287416934967,
-0.22816458344459534,
1.2231131792068481,
-0.1552390158176422,
1.4142327308654785,
-0.365632563829422,
-0.19843073189258575,
-0.42432650923728943,
-0.4180070161819458,
0.17111988365650177,
-0.21451576054096222,
-0.6111334562301636,
0.2689812481403351,
-0.8629196882247925,
0.3410608172416687,
1.4479649066925049,
0.4027152955532074,
0.0833694264292717,
0.49972155690193176,
1.0811717510223389,
0.3805101811885834,
-0.08217080682516098,
-0.8663572669029236,
-1.5910987854003906,
2.05835223197937,
-1.4396908283233643,
1.9476808309555054,
0.7663041353225708,
-0.0760643482208252,
-1.8363510370254517,
-1.8936485052108765,
1.3488260507583618,
1.144186019897461,
2.37715744972229,
0.5074591040611267,
0.34930527210235596,
-0.783288836479187,
-0.6814500093460083,
0.34575241804122925,
-0.9749862551689148,
-0.7821716666221619,
0.10059787333011627,
2.326171875,
1.771716594696045,
-0.4542063772678375,
-0.22829017043113708,
-1.0167423486709595,
1.3656398057937622,
-0.201698437333107,
0.18882721662521362,
1.953131079673767,
-0.2971537113189697,
-1.0376105308532715,
1.3382163047790527,
-2.2815980911254883,
0.12969645857810974,
1.9696540832519531,
0.2699890732765198,
0.028413381427526474,
-1.4278004169464111,
-0.734067976474762,
-0.2700731158256531,
-0.46307164430618286,
-1.2981153726577759,
0.5094518661499023,
-0.30918145179748535,
-0.7922512888908386,
-1.4753799438476562,
0.08738581091165543,
-1.1354340314865112,
-1.708796501159668,
0.2509942948818207,
1.8835444450378418,
2.0085153579711914,
-0.7053989768028259,
1.4498223066329956,
-0.2546137869358063,
0.19014158844947815,
1.2200132608413696,
1.2179193496704102,
3.1545634269714355,
1.8570878505706787,
-1.273846983909607,
0.6684048771858215,
-0.1141929179430008,
-0.4647964835166931,
1.1711809635162354,
-1.1206079721450806,
1.273573637008667,
-0.18289639055728912,
-1.2553105354309082,
-1.2094475030899048,
1.0053393840789795,
0.45095232129096985,
0.0753774344921112,
-0.47078564763069153,
1.231424331665039,
-0.00803452730178833,
1.296268343925476,
0.5883960127830505,
-0.416258305311203,
0.6329759359359741,
-0.3883343040943146,
-0.5795652866363525,
1.5594953298568726,
0.13391847908496857,
-1.4948092699050903,
-2.2733843326568604,
-0.2512319087982178,
-0.8362984657287598,
0.061264362186193466,
-0.5851579904556274,
-1.0123529434204102,
1.6775928735733032,
0.4154697358608246,
-1.2488596439361572,
-0.26908570528030396,
-0.3993071913719177,
-0.6375272274017334,
2.6548166275024414,
-1.375285267829895,
-0.22833557426929474,
-0.9726972579956055,
-0.579551637172699,
1.555286169052124,
-1.1725170612335205,
-0.1947334259748459,
-0.9975393414497375,
-0.644557535648346,
-1.3117153644561768,
-0.5524806380271912,
-0.005474680569022894,
-0.9762184023857117,
0.7510079145431519,
0.09415651112794876,
-1.1093993186950684,
-0.21420562267303467,
-0.8925400376319885,
0.9263931512832642,
-0.11680498719215393,
0.23930753767490387,
1.9479926824569702,
0.3844825029373169,
-0.3727227449417114,
0.7020922303199768,
1.192228078842163,
0.6332438588142395,
-0.6933721899986267,
0.17940156161785126,
-0.7332433462142944,
0.2755816876888275,
-1.3079543113708496,
0.2640681564807892,
-2.8605823516845703,
0.6311547160148621,
-0.05276830494403839,
-0.058975230902433395,
0.035076286643743515,
-1.2897974252700806,
1.022388219833374,
2.627579689025879,
-1.2358187437057495,
0.4526868462562561,
0.35500675439834595,
1.1841776371002197,
-1.5929027795791626,
0.2859206199645996,
-0.45876768231391907,
2.0668561458587646,
0.2681424915790558,
1.188961148262024,
-0.4825421869754791,
-2.2171220779418945,
0.6156185865402222,
-1.2931641340255737,
-1.1424412727355957,
0.837589681148529,
-0.9084362387657166,
0.16509266197681427,
-1.4005670547485352,
-0.11599458009004593,
-0.7898463010787964,
-1.1691677570343018,
0.6727437376976013,
0.09872538596391678,
0.4813684821128845,
-0.5571417808532715,
0.3317040205001831,
-2.189272403717041,
-1.3392794132232666,
-0.22758139669895172,
-0.9479457139968872,
0.4868817627429962,
-0.3594978153705597,
0.6272926330566406,
-0.15944111347198486,
-0.00487998453900218,
0.32125017046928406,
1.3401402235031128,
3.422945022583008,
0.23287490010261536,
0.27114418148994446,
-0.09279090911149979,
-1.0096945762634277,
1.4944300651550293,
0.9546167850494385,
-0.16229791939258575,
-0.58292156457901,
-1.010434865951538,
1.332673192024231,
1.925355076789856,
1.103664755821228,
0.07600940763950348,
-0.8146185278892517,
-0.715214192867279,
0.030831746757030487,
0.20698682963848114,
0.4660505950450897,
0.943488359451294,
0.04124996066093445,
0.13615675270557404,
1.4841886758804321,
1.1912275552749634,
-0.3671254813671112,
0.3807029724121094,
-0.8676914572715759,
-0.5236761569976807,
0.501707136631012,
0.2918422520160675,
-0.006752285175025463,
0.44594258069992065,
-1.0455619096755981,
-0.24925671517848969,
-0.4486271142959595,
-0.973075807094574,
-0.6216679811477661,
-0.4124670624732971,
-0.3621116280555725,
1.637519359588623,
0.09520765393972397,
-0.5045101642608643,
-0.031103838235139847,
-0.7441604733467102,
-0.16319754719734192,
-1.0321203470230103,
0.3236604928970337,
-0.10514117777347565,
-0.09052335470914841,
-0.11579757183790207,
1.7546086311340332,
-0.9250495433807373,
-2.144601345062256,
0.2583377957344055,
0.22768360376358032,
-0.33503302931785583,
0.1973697543144226,
1.612885594367981,
0.5320526361465454,
1.4144856929779053,
1.3681854009628296,
0.9136322140693665,
-0.6243329644203186,
-1.2871012687683105,
0.6554571390151978,
1.0068215131759644,
-1.3799216747283936,
0.8822434544563293,
-0.08427087962627411,
-0.6085430979728699,
0.663037121295929,
1.2824103832244873,
0.43640318512916565,
-1.95796537399292,
0.8366286158561707,
-0.8730506300926208,
0.7851585745811462,
0.6522778868675232,
0.7634931206703186,
0.1387971043586731,
0.8068157434463501,
-1.300091028213501,
-1.1802146434783936,
-0.7512952089309692,
-0.633277952671051,
1.9603829383850098,
-0.2229035198688507,
0.6474459171295166,
-0.26533573865890503,
-1.2844253778457642,
-0.10628432780504227,
0.668134868144989,
0.2962866723537445,
-0.4588245749473572,
0.8894175291061401,
-0.6616579294204712,
-1.1329398155212402,
-1.4416307210922241,
-0.3858431279659271,
-1.0280656814575195,
-0.8643195033073425,
1.0733836889266968,
0.7522611021995544,
0.2900993227958679,
1.8616113662719727,
0.5906223058700562,
0.23343966901302338,
-2.6607463359832764,
0.8695493936538696,
0.2809373736381531,
-0.04380936548113823,
0.8599489331245422,
0.24945273995399475,
1.0215091705322266,
-0.005454744677990675,
0.5712770819664001,
-2.357414722442627,
2.238645315170288,
-0.22387544810771942,
0.7148292660713196,
-0.028256762772798538,
-0.18239955604076385,
1.1076127290725708,
0.5988099575042725,
0.6433889865875244,
-1.131514549255371,
0.7183264493942261,
-0.5575469732284546,
1.1952338218688965,
0.9183469414710999,
-0.8061854839324951,
-0.034427180886268616,
1.391994595527649,
0.5169562101364136,
-0.41163790225982666,
-0.9537155032157898,
-0.8884913325309753,
0.9732288122177124,
1.7941237688064575,
-0.017208373174071312,
0.0205356664955616,
0.8445966243743896,
0.7048121690750122,
-1.33951997756958,
0.05590561404824257,
-0.7149564623832703,
-0.6730610132217407,
1.6666510105133057,
2.0555827617645264,
-0.08342210203409195,
-0.16475918889045715,
-0.6779496669769287,
-1.2728368043899536,
0.7260436415672302,
-0.02408532053232193,
0.16788329184055328,
0.6857488751411438,
-0.6352343559265137,
1.1326508522033691,
0.8350221514701843,
0.9098381400108337,
0.16711068153381348,
0.25635331869125366,
0.38047876954078674,
-0.2753162086009979,
-1.1661970615386963,
-0.24308814108371735,
-1.0622906684875488,
-2.490513801574707,
0.39713799953460693,
-0.2678970992565155,
-1.4938024282455444,
0.0615595318377018,
-0.9970216751098633,
0.9434236884117126,
-0.5429925918579102,
-1.0938559770584106,
-1.5237315893173218,
0.2605784237384796,
-0.08075535297393799,
0.8848752379417419,
-1.5840823650360107,
-0.10325048863887787,
1.258912205696106,
0.9220340847969055,
-0.6065003275871277,
1.034543514251709,
0.25848492980003357,
0.9599147439002991,
0.8144968748092651,
-0.427222341299057,
0.4959949553012848,
0.13257567584514618,
-1.4068048000335693,
0.43835729360580444,
1.1329865455627441,
0.21448595821857452,
1.4070404767990112,
-0.5656892657279968,
0.05393088981509209,
0.4348471164703369,
-0.5174618363380432,
-0.4444368779659271,
-0.5237290263175964,
0.6564182043075562,
0.017516884952783585,
-0.9142799377441406,
-0.012896684929728508,
-0.014023944735527039,
-0.2493845522403717,
0.25133979320526123,
-1.4675674438476562,
-0.21480707824230194,
-0.4538046419620514,
-0.6116509437561035,
-1.2738367319107056,
-0.058122944086790085,
1.4391961097717285,
-0.8751161098480225,
-0.20370179414749146,
0.48616519570350647,
0.3364516496658325,
0.5443090200424194,
0.693285346031189,
-0.6777745485305786,
-0.2959807813167572,
-0.2361563742160797,
-0.3430134057998657,
0.2228562980890274,
1.2816890478134155,
-0.19853299856185913,
-0.963226854801178,
0.7401447296142578,
-0.330976665019989,
0.08073585480451584,
1.9571428298950195,
0.09340310841798782,
-0.7795586585998535,
0.28553229570388794,
-0.7227051258087158,
1.886473536491394,
1.7449703216552734,
1.4108755588531494,
-0.13359478116035461,
-0.8632180094718933,
0.5396673083305359,
-0.22204384207725525,
-0.3870353698730469,
0.968782365322113,
0.45092907547950745,
-0.14268913865089417,
-1.4336422681808472,
0.6162696480751038,
1.265200138092041,
-0.9080483317375183,
-0.7721258401870728,
0.0915364995598793,
-0.8525296449661255,
1.1124672889709473,
0.6831794381141663,
0.37242868542671204,
0.21695482730865479,
1.6378859281539917,
0.7516043782234192,
-0.4558798372745514,
0.5118764042854309,
0.5175111889839172,
-0.1697489470243454,
-2.1106138229370117,
-1.0412570238113403,
0.285397469997406,
-0.4316714107990265,
-1.575904130935669,
1.3548997640609741,
-1.1578586101531982,
-0.9238414168357849,
0.5306224226951599,
0.03838927671313286,
1.4312107563018799,
0.35462456941604614,
1.6312850713729858,
2.1382038593292236,
0.9121946096420288,
0.3359551429748535,
1.2678711414337158,
-0.054888613522052765,
-0.3838828206062317,
1.7917003631591797,
-0.38751456141471863,
0.5465928912162781,
1.0551667213439941,
-0.3655823767185211,
-1.0192077159881592,
-0.7280741333961487,
-1.2008825540542603,
-0.6306957006454468,
1.1408659219741821,
0.087174192070961,
-1.1189939975738525,
0.21593990921974182,
1.5484702587127686,
0.16591185331344604,
-0.25275304913520813,
0.6905345916748047,
0.46423640847206116,
-0.7505894303321838,
-0.09318429976701736,
-0.972011387348175,
0.5159144401550293,
-0.23220886290073395,
-0.3800661563873291,
0.3158402144908905,
0.43816208839416504,
1.280009150505066,
0.0043673086911439896,
0.16628558933734894,
1.2539658546447754,
-1.3642265796661377,
1.4609066247940063,
-0.704849123954773,
0.23544204235076904,
-2.4571473598480225,
1.4564132690429688,
-0.7929314970970154,
1.9027079343795776,
-2.627387285232544,
0.45968684554100037,
-0.6051923036575317,
-0.4301159679889679,
0.31800055503845215,
-0.4098037779331207,
0.0812394991517067,
-0.11631014943122864,
-1.098257064819336,
-0.08325605094432831,
-0.7290157675743103,
0.6102077960968018,
1.175999641418457,
1.3195080757141113,
-1.069354772567749,
-0.3195604979991913,
-1.7545759677886963,
-0.16033481061458588,
-0.7242748737335205,
0.3217547833919525,
-1.9534660577774048,
-0.16953818500041962,
-1.9060369729995728,
-2.5040366649627686,
-1.293465256690979,
-0.8021124601364136,
1.1435776948928833,
0.21453706920146942,
-0.9167917370796204,
1.2267842292785645,
-0.3773776888847351,
-1.8507046699523926,
1.1155215501785278,
-2.2504379749298096
] |
https://github.com/huggingface/datasets/issues/6077 | Mapping gets stuck at 99% | Have you tried to reduce `batch_size`/`writer_batch_size` in the 2nd `.map`? Also, can you interrupt the process when it gets stuck and share the error stack trace? | ### Describe the bug
Hi !
I'm currently working with a large (~150GB) unnormalized dataset at work.
The dataset is available on a read-only filesystem internally, and I use a [loading script](https://huggingface.co/docs/datasets/dataset_script) to retreive it.
I want to normalize the features of the dataset, meaning I need to compute the mean and standard deviation metric for each feature of the entire dataset. I cannot load the entire dataset to RAM as it is too big, so following [this discussion on the huggingface discourse](https://discuss.huggingface.co/t/copy-columns-in-a-dataset-and-compute-statistics-for-a-column/22157) I am using a [map operation](https://huggingface.co/docs/datasets/v2.14.0/en/package_reference/main_classes#datasets.Dataset.map) to first compute the metrics and a second map operation to apply them on the dataset.
The problem lies in the second mapping, as it gets stuck at ~99%. By checking what the process does (using `htop` and `strace`) it seems to be doing a lot of I/O operations, and I'm not sure why.
Obviously, I could always normalize the dataset externally and then load it using a loading script. However, since the internal dataset is updated fairly frequently, using the library to perform normalization automatically would make it much easier for me.
### Steps to reproduce the bug
I'm able to reproduce the problem using the following scripts:
```python
# random_data.py
import datasets
import torch
_VERSION = "1.0.0"
class RandomDataset(datasets.GeneratorBasedBuilder):
def _info(self):
return datasets.DatasetInfo(
version=_VERSION,
supervised_keys=None,
features=datasets.Features(
{
"positions": datasets.Array2D(
shape=(30000, 3),
dtype="float32",
),
"normals": datasets.Array2D(
shape=(30000, 3),
dtype="float32",
),
"features": datasets.Array2D(
shape=(30000, 6),
dtype="float32",
),
"scalars": datasets.Sequence(
feature=datasets.Value("float32"),
length=20,
),
},
),
)
def _split_generators(self, dl_manager):
return [
datasets.SplitGenerator(
name=datasets.Split.TRAIN, # type: ignore
gen_kwargs={"nb_samples": 1000},
),
datasets.SplitGenerator(
name=datasets.Split.TEST, # type: ignore
gen_kwargs={"nb_samples": 100},
),
]
def _generate_examples(self, nb_samples: int):
for idx in range(nb_samples):
yield idx, {
"positions": torch.randn(30000, 3),
"normals": torch.randn(30000, 3),
"features": torch.randn(30000, 6),
"scalars": torch.randn(20),
}
```
```python
# main.py
import datasets
import torch
def apply_mean_std(
dataset: datasets.Dataset,
means: dict[str, torch.Tensor],
stds: dict[str, torch.Tensor],
) -> dict[str, torch.Tensor]:
"""Normalize the dataset using the mean and standard deviation of each feature.
Args:
dataset (`Dataset`): A huggingface dataset.
mean (`dict[str, Tensor]`): A dictionary containing the mean of each feature.
std (`dict[str, Tensor]`): A dictionary containing the standard deviation of each feature.
Returns:
dict: A dictionary containing the normalized dataset.
"""
result = {}
for key in means.keys():
# extract data from dataset
data: torch.Tensor = dataset[key] # type: ignore
# extract mean and std from dict
mean = means[key] # type: ignore
std = stds[key] # type: ignore
# normalize data
normalized_data = (data - mean) / std
result[key] = normalized_data
return result
# get dataset
ds = datasets.load_dataset(
path="random_data.py",
split="train",
).with_format("torch")
# compute mean (along last axis)
means = {key: torch.zeros(ds[key][0].shape[-1]) for key in ds.column_names}
means_sq = {key: torch.zeros(ds[key][0].shape[-1]) for key in ds.column_names}
for batch in ds.iter(batch_size=8):
for key in ds.column_names:
data = batch[key]
batch_size = data.shape[0]
data = data.reshape(-1, data.shape[-1])
means[key] += data.mean(dim=0) / len(ds) * batch_size
means_sq[key] += (data**2).mean(dim=0) / len(ds) * batch_size
# compute std (along last axis)
stds = {key: torch.sqrt(means_sq[key] - means[key] ** 2) for key in ds.column_names}
# normalize each feature of the dataset
ds_normalized = ds.map(
desc="Applying mean/std", # type: ignore
function=apply_mean_std,
batched=False,
fn_kwargs={
"means": means,
"stds": stds,
},
)
```
### Expected behavior
Using the previous scripts, the `ds_normalized` mapping completes in ~5 minutes, but any subsequent use of `ds_normalized` is really really slow, for example reapplying `apply_mean_std` to `ds_normalized` takes forever. This is very strange, I'm sure I must be missing something, but I would still expect this to be faster.
### Environment info
- `datasets` version: 2.13.1
- Platform: Linux-3.10.0-1160.66.1.el7.x86_64-x86_64-with-glibc2.17
- Python version: 3.10.12
- Huggingface_hub version: 0.15.1
- PyArrow version: 12.0.0
- Pandas version: 2.0.2 | 47 | 26 | Mapping gets stuck at 99%
### Describe the bug
Hi !
I'm currently working with a large (~150GB) unnormalized dataset at work.
The dataset is available on a read-only filesystem internally, and I use a [loading script](https://huggingface.co/docs/datasets/dataset_script) to retreive it.
I want to normalize the features of the dataset, meaning I need to compute the mean and standard deviation metric for each feature of the entire dataset. I cannot load the entire dataset to RAM as it is too big, so following [this discussion on the huggingface discourse](https://discuss.huggingface.co/t/copy-columns-in-a-dataset-and-compute-statistics-for-a-column/22157) I am using a [map operation](https://huggingface.co/docs/datasets/v2.14.0/en/package_reference/main_classes#datasets.Dataset.map) to first compute the metrics and a second map operation to apply them on the dataset.
The problem lies in the second mapping, as it gets stuck at ~99%. By checking what the process does (using `htop` and `strace`) it seems to be doing a lot of I/O operations, and I'm not sure why.
Obviously, I could always normalize the dataset externally and then load it using a loading script. However, since the internal dataset is updated fairly frequently, using the library to perform normalization automatically would make it much easier for me.
### Steps to reproduce the bug
I'm able to reproduce the problem using the following scripts:
```python
# random_data.py
import datasets
import torch
_VERSION = "1.0.0"
class RandomDataset(datasets.GeneratorBasedBuilder):
def _info(self):
return datasets.DatasetInfo(
version=_VERSION,
supervised_keys=None,
features=datasets.Features(
{
"positions": datasets.Array2D(
shape=(30000, 3),
dtype="float32",
),
"normals": datasets.Array2D(
shape=(30000, 3),
dtype="float32",
),
"features": datasets.Array2D(
shape=(30000, 6),
dtype="float32",
),
"scalars": datasets.Sequence(
feature=datasets.Value("float32"),
length=20,
),
},
),
)
def _split_generators(self, dl_manager):
return [
datasets.SplitGenerator(
name=datasets.Split.TRAIN, # type: ignore
gen_kwargs={"nb_samples": 1000},
),
datasets.SplitGenerator(
name=datasets.Split.TEST, # type: ignore
gen_kwargs={"nb_samples": 100},
),
]
def _generate_examples(self, nb_samples: int):
for idx in range(nb_samples):
yield idx, {
"positions": torch.randn(30000, 3),
"normals": torch.randn(30000, 3),
"features": torch.randn(30000, 6),
"scalars": torch.randn(20),
}
```
```python
# main.py
import datasets
import torch
def apply_mean_std(
dataset: datasets.Dataset,
means: dict[str, torch.Tensor],
stds: dict[str, torch.Tensor],
) -> dict[str, torch.Tensor]:
"""Normalize the dataset using the mean and standard deviation of each feature.
Args:
dataset (`Dataset`): A huggingface dataset.
mean (`dict[str, Tensor]`): A dictionary containing the mean of each feature.
std (`dict[str, Tensor]`): A dictionary containing the standard deviation of each feature.
Returns:
dict: A dictionary containing the normalized dataset.
"""
result = {}
for key in means.keys():
# extract data from dataset
data: torch.Tensor = dataset[key] # type: ignore
# extract mean and std from dict
mean = means[key] # type: ignore
std = stds[key] # type: ignore
# normalize data
normalized_data = (data - mean) / std
result[key] = normalized_data
return result
# get dataset
ds = datasets.load_dataset(
path="random_data.py",
split="train",
).with_format("torch")
# compute mean (along last axis)
means = {key: torch.zeros(ds[key][0].shape[-1]) for key in ds.column_names}
means_sq = {key: torch.zeros(ds[key][0].shape[-1]) for key in ds.column_names}
for batch in ds.iter(batch_size=8):
for key in ds.column_names:
data = batch[key]
batch_size = data.shape[0]
data = data.reshape(-1, data.shape[-1])
means[key] += data.mean(dim=0) / len(ds) * batch_size
means_sq[key] += (data**2).mean(dim=0) / len(ds) * batch_size
# compute std (along last axis)
stds = {key: torch.sqrt(means_sq[key] - means[key] ** 2) for key in ds.column_names}
# normalize each feature of the dataset
ds_normalized = ds.map(
desc="Applying mean/std", # type: ignore
function=apply_mean_std,
batched=False,
fn_kwargs={
"means": means,
"stds": stds,
},
)
```
### Expected behavior
Using the previous scripts, the `ds_normalized` mapping completes in ~5 minutes, but any subsequent use of `ds_normalized` is really really slow, for example reapplying `apply_mean_std` to `ds_normalized` takes forever. This is very strange, I'm sure I must be missing something, but I would still expect this to be faster.
### Environment info
- `datasets` version: 2.13.1
- Platform: Linux-3.10.0-1160.66.1.el7.x86_64-x86_64-with-glibc2.17
- Python version: 3.10.12
- Huggingface_hub version: 0.15.1
- PyArrow version: 12.0.0
- Pandas version: 2.0.2
Have you tried to reduce `batch_size`/`writer_batch_size` in the 2nd `.map`? Also, can you interrupt the process when it gets stuck and share the error stack trace? | [
-1.2467619180679321,
-0.9692441821098328,
-0.7773353457450867,
1.3650438785552979,
-0.10279692709445953,
-1.2577497959136963,
0.0820453092455864,
-1.0771145820617676,
1.6699507236480713,
-0.7752376198768616,
0.2535783052444458,
-1.6741188764572144,
0.0001330627128481865,
-0.5192185044288635,
-0.7196358442306519,
-0.9292827248573303,
-0.42836281657218933,
-0.7693653106689453,
1.0682494640350342,
2.5319032669067383,
1.1663181781768799,
-1.3916829824447632,
2.7380056381225586,
0.6890181303024292,
-0.1308683305978775,
-1.0249642133712769,
0.5794615745544434,
0.014394155703485012,
-1.3597949743270874,
-0.39526140689849854,
-0.9713289737701416,
-0.01855153776705265,
-0.5624193549156189,
-0.4949333965778351,
0.034027427434921265,
0.36742085218429565,
-0.22762511670589447,
-0.4426629841327667,
-0.5897688269615173,
-0.7647039294242859,
0.46197813749313354,
-0.3146698772907257,
0.9942435622215271,
-0.3545180857181549,
1.8296427726745605,
-0.5085375308990479,
0.40375715494155884,
0.6671609878540039,
1.343123435974121,
0.2103288769721985,
0.05046398192644119,
0.32061967253685,
0.4087408781051636,
0.04270897060632706,
0.48136669397354126,
1.1971237659454346,
0.6055260896682739,
0.5078228116035461,
0.7211517691612244,
-2.174020767211914,
1.3422565460205078,
-0.9540314674377441,
0.3771088123321533,
1.3440388441085815,
-0.9014260768890381,
0.36384332180023193,
-1.7529940605163574,
-0.08630987256765366,
0.5511480569839478,
-2.256157875061035,
0.14137482643127441,
-1.2834725379943848,
-0.43197959661483765,
0.9795565009117126,
0.3522584140300751,
-1.2050758600234985,
0.18647566437721252,
-0.47631627321243286,
1.0739091634750366,
0.5062569975852966,
1.2354419231414795,
-1.7089179754257202,
0.033225126564502716,
-0.29483798146247864,
0.17447365820407867,
-1.2803961038589478,
-1.576486349105835,
0.5113226771354675,
0.6043962836265564,
0.6299614310264587,
-0.08441014587879181,
1.0067667961120605,
-1.0267763137817383,
0.7464110255241394,
-0.8652818202972412,
-1.6710386276245117,
-1.3861955404281616,
-2.301039934158325,
-2.3644816875457764,
0.8184136152267456,
-0.5005026459693909,
-0.5061028003692627,
2.0318002700805664,
-1.0828410387039185,
-1.790990948677063,
1.0765491724014282,
0.27483460307121277,
0.02147497981786728,
2.377331256866455,
0.162489116191864,
-0.7233153581619263,
0.49063411355018616,
-0.7345637083053589,
0.7893033027648926,
-0.3272707462310791,
1.3078820705413818,
0.4816489517688751,
-1.0030062198638916,
1.5656243562698364,
-0.40476158261299133,
0.5793794989585876,
-0.6556822061538696,
-0.4828268885612488,
-0.8300641775131226,
0.2967936098575592,
1.8910833597183228,
-0.3305094242095947,
1.6367286443710327,
-0.37281346321105957,
-1.6050193309783936,
-1.6232235431671143,
0.829276442527771,
0.5127225518226624,
-0.7676873207092285,
0.052157413214445114,
-0.3729911148548126,
0.06593628227710724,
0.03608138859272003,
1.1072019338607788,
1.202584981918335,
0.709801971912384,
-0.33022168278694153,
-0.8758439421653748,
0.1816616654396057,
-0.0807175561785698,
-0.6972082853317261,
-1.7582370042800903,
-0.3290409445762634,
0.12490931898355484,
0.620330274105072,
-1.1948826313018799,
1.7064586877822876,
0.8753851652145386,
1.8962076902389526,
1.0360573530197144,
-0.3524904251098633,
1.5238271951675415,
0.08224860578775406,
1.8405604362487793,
-0.49912044405937195,
0.6472380757331848,
-0.32927653193473816,
-1.170258641242981,
0.7816345691680908,
-0.3797627389431,
-2.0614588260650635,
-0.7647451758384705,
-0.8371453285217285,
-0.1527726650238037,
-0.7501168847084045,
0.951413094997406,
-0.34933069348335266,
-1.4247697591781616,
0.1697305142879486,
-0.6908698678016663,
0.10819616168737411,
-1.239892840385437,
0.2963680922985077,
0.7544494271278381,
-0.66166752576828,
-0.005780170671641827,
-0.29043665528297424,
-1.290385365486145,
-0.42731159925460815,
0.3055631220340729,
1.8546395301818848,
-0.7297377586364746,
0.9705548286437988,
1.0357428789138794,
-0.7008418440818787,
0.00022096093744039536,
0.29257071018218994,
-0.27541670203208923,
0.9122263789176941,
-1.0406187772750854,
-0.3938690721988678,
1.141351342201233,
-0.18762926757335663,
-0.6023191213607788,
1.405550479888916,
0.6929025650024414,
-1.041069746017456,
-0.212516650557518,
-0.083040252327919,
-0.8680865168571472,
0.000782831571996212,
-1.5526432991027832,
-0.14706754684448242,
0.30281320214271545,
-1.5828789472579956,
-0.509287416934967,
-0.22816458344459534,
1.2231131792068481,
-0.1552390158176422,
1.4142327308654785,
-0.365632563829422,
-0.19843073189258575,
-0.42432650923728943,
-0.4180070161819458,
0.17111988365650177,
-0.21451576054096222,
-0.6111334562301636,
0.2689812481403351,
-0.8629196882247925,
0.3410608172416687,
1.4479649066925049,
0.4027152955532074,
0.0833694264292717,
0.49972155690193176,
1.0811717510223389,
0.3805101811885834,
-0.08217080682516098,
-0.8663572669029236,
-1.5910987854003906,
2.05835223197937,
-1.4396908283233643,
1.9476808309555054,
0.7663041353225708,
-0.0760643482208252,
-1.8363510370254517,
-1.8936485052108765,
1.3488260507583618,
1.144186019897461,
2.37715744972229,
0.5074591040611267,
0.34930527210235596,
-0.783288836479187,
-0.6814500093460083,
0.34575241804122925,
-0.9749862551689148,
-0.7821716666221619,
0.10059787333011627,
2.326171875,
1.771716594696045,
-0.4542063772678375,
-0.22829017043113708,
-1.0167423486709595,
1.3656398057937622,
-0.201698437333107,
0.18882721662521362,
1.953131079673767,
-0.2971537113189697,
-1.0376105308532715,
1.3382163047790527,
-2.2815980911254883,
0.12969645857810974,
1.9696540832519531,
0.2699890732765198,
0.028413381427526474,
-1.4278004169464111,
-0.734067976474762,
-0.2700731158256531,
-0.46307164430618286,
-1.2981153726577759,
0.5094518661499023,
-0.30918145179748535,
-0.7922512888908386,
-1.4753799438476562,
0.08738581091165543,
-1.1354340314865112,
-1.708796501159668,
0.2509942948818207,
1.8835444450378418,
2.0085153579711914,
-0.7053989768028259,
1.4498223066329956,
-0.2546137869358063,
0.19014158844947815,
1.2200132608413696,
1.2179193496704102,
3.1545634269714355,
1.8570878505706787,
-1.273846983909607,
0.6684048771858215,
-0.1141929179430008,
-0.4647964835166931,
1.1711809635162354,
-1.1206079721450806,
1.273573637008667,
-0.18289639055728912,
-1.2553105354309082,
-1.2094475030899048,
1.0053393840789795,
0.45095232129096985,
0.0753774344921112,
-0.47078564763069153,
1.231424331665039,
-0.00803452730178833,
1.296268343925476,
0.5883960127830505,
-0.416258305311203,
0.6329759359359741,
-0.3883343040943146,
-0.5795652866363525,
1.5594953298568726,
0.13391847908496857,
-1.4948092699050903,
-2.2733843326568604,
-0.2512319087982178,
-0.8362984657287598,
0.061264362186193466,
-0.5851579904556274,
-1.0123529434204102,
1.6775928735733032,
0.4154697358608246,
-1.2488596439361572,
-0.26908570528030396,
-0.3993071913719177,
-0.6375272274017334,
2.6548166275024414,
-1.375285267829895,
-0.22833557426929474,
-0.9726972579956055,
-0.579551637172699,
1.555286169052124,
-1.1725170612335205,
-0.1947334259748459,
-0.9975393414497375,
-0.644557535648346,
-1.3117153644561768,
-0.5524806380271912,
-0.005474680569022894,
-0.9762184023857117,
0.7510079145431519,
0.09415651112794876,
-1.1093993186950684,
-0.21420562267303467,
-0.8925400376319885,
0.9263931512832642,
-0.11680498719215393,
0.23930753767490387,
1.9479926824569702,
0.3844825029373169,
-0.3727227449417114,
0.7020922303199768,
1.192228078842163,
0.6332438588142395,
-0.6933721899986267,
0.17940156161785126,
-0.7332433462142944,
0.2755816876888275,
-1.3079543113708496,
0.2640681564807892,
-2.8605823516845703,
0.6311547160148621,
-0.05276830494403839,
-0.058975230902433395,
0.035076286643743515,
-1.2897974252700806,
1.022388219833374,
2.627579689025879,
-1.2358187437057495,
0.4526868462562561,
0.35500675439834595,
1.1841776371002197,
-1.5929027795791626,
0.2859206199645996,
-0.45876768231391907,
2.0668561458587646,
0.2681424915790558,
1.188961148262024,
-0.4825421869754791,
-2.2171220779418945,
0.6156185865402222,
-1.2931641340255737,
-1.1424412727355957,
0.837589681148529,
-0.9084362387657166,
0.16509266197681427,
-1.4005670547485352,
-0.11599458009004593,
-0.7898463010787964,
-1.1691677570343018,
0.6727437376976013,
0.09872538596391678,
0.4813684821128845,
-0.5571417808532715,
0.3317040205001831,
-2.189272403717041,
-1.3392794132232666,
-0.22758139669895172,
-0.9479457139968872,
0.4868817627429962,
-0.3594978153705597,
0.6272926330566406,
-0.15944111347198486,
-0.00487998453900218,
0.32125017046928406,
1.3401402235031128,
3.422945022583008,
0.23287490010261536,
0.27114418148994446,
-0.09279090911149979,
-1.0096945762634277,
1.4944300651550293,
0.9546167850494385,
-0.16229791939258575,
-0.58292156457901,
-1.010434865951538,
1.332673192024231,
1.925355076789856,
1.103664755821228,
0.07600940763950348,
-0.8146185278892517,
-0.715214192867279,
0.030831746757030487,
0.20698682963848114,
0.4660505950450897,
0.943488359451294,
0.04124996066093445,
0.13615675270557404,
1.4841886758804321,
1.1912275552749634,
-0.3671254813671112,
0.3807029724121094,
-0.8676914572715759,
-0.5236761569976807,
0.501707136631012,
0.2918422520160675,
-0.006752285175025463,
0.44594258069992065,
-1.0455619096755981,
-0.24925671517848969,
-0.4486271142959595,
-0.973075807094574,
-0.6216679811477661,
-0.4124670624732971,
-0.3621116280555725,
1.637519359588623,
0.09520765393972397,
-0.5045101642608643,
-0.031103838235139847,
-0.7441604733467102,
-0.16319754719734192,
-1.0321203470230103,
0.3236604928970337,
-0.10514117777347565,
-0.09052335470914841,
-0.11579757183790207,
1.7546086311340332,
-0.9250495433807373,
-2.144601345062256,
0.2583377957344055,
0.22768360376358032,
-0.33503302931785583,
0.1973697543144226,
1.612885594367981,
0.5320526361465454,
1.4144856929779053,
1.3681854009628296,
0.9136322140693665,
-0.6243329644203186,
-1.2871012687683105,
0.6554571390151978,
1.0068215131759644,
-1.3799216747283936,
0.8822434544563293,
-0.08427087962627411,
-0.6085430979728699,
0.663037121295929,
1.2824103832244873,
0.43640318512916565,
-1.95796537399292,
0.8366286158561707,
-0.8730506300926208,
0.7851585745811462,
0.6522778868675232,
0.7634931206703186,
0.1387971043586731,
0.8068157434463501,
-1.300091028213501,
-1.1802146434783936,
-0.7512952089309692,
-0.633277952671051,
1.9603829383850098,
-0.2229035198688507,
0.6474459171295166,
-0.26533573865890503,
-1.2844253778457642,
-0.10628432780504227,
0.668134868144989,
0.2962866723537445,
-0.4588245749473572,
0.8894175291061401,
-0.6616579294204712,
-1.1329398155212402,
-1.4416307210922241,
-0.3858431279659271,
-1.0280656814575195,
-0.8643195033073425,
1.0733836889266968,
0.7522611021995544,
0.2900993227958679,
1.8616113662719727,
0.5906223058700562,
0.23343966901302338,
-2.6607463359832764,
0.8695493936538696,
0.2809373736381531,
-0.04380936548113823,
0.8599489331245422,
0.24945273995399475,
1.0215091705322266,
-0.005454744677990675,
0.5712770819664001,
-2.357414722442627,
2.238645315170288,
-0.22387544810771942,
0.7148292660713196,
-0.028256762772798538,
-0.18239955604076385,
1.1076127290725708,
0.5988099575042725,
0.6433889865875244,
-1.131514549255371,
0.7183264493942261,
-0.5575469732284546,
1.1952338218688965,
0.9183469414710999,
-0.8061854839324951,
-0.034427180886268616,
1.391994595527649,
0.5169562101364136,
-0.41163790225982666,
-0.9537155032157898,
-0.8884913325309753,
0.9732288122177124,
1.7941237688064575,
-0.017208373174071312,
0.0205356664955616,
0.8445966243743896,
0.7048121690750122,
-1.33951997756958,
0.05590561404824257,
-0.7149564623832703,
-0.6730610132217407,
1.6666510105133057,
2.0555827617645264,
-0.08342210203409195,
-0.16475918889045715,
-0.6779496669769287,
-1.2728368043899536,
0.7260436415672302,
-0.02408532053232193,
0.16788329184055328,
0.6857488751411438,
-0.6352343559265137,
1.1326508522033691,
0.8350221514701843,
0.9098381400108337,
0.16711068153381348,
0.25635331869125366,
0.38047876954078674,
-0.2753162086009979,
-1.1661970615386963,
-0.24308814108371735,
-1.0622906684875488,
-2.490513801574707,
0.39713799953460693,
-0.2678970992565155,
-1.4938024282455444,
0.0615595318377018,
-0.9970216751098633,
0.9434236884117126,
-0.5429925918579102,
-1.0938559770584106,
-1.5237315893173218,
0.2605784237384796,
-0.08075535297393799,
0.8848752379417419,
-1.5840823650360107,
-0.10325048863887787,
1.258912205696106,
0.9220340847969055,
-0.6065003275871277,
1.034543514251709,
0.25848492980003357,
0.9599147439002991,
0.8144968748092651,
-0.427222341299057,
0.4959949553012848,
0.13257567584514618,
-1.4068048000335693,
0.43835729360580444,
1.1329865455627441,
0.21448595821857452,
1.4070404767990112,
-0.5656892657279968,
0.05393088981509209,
0.4348471164703369,
-0.5174618363380432,
-0.4444368779659271,
-0.5237290263175964,
0.6564182043075562,
0.017516884952783585,
-0.9142799377441406,
-0.012896684929728508,
-0.014023944735527039,
-0.2493845522403717,
0.25133979320526123,
-1.4675674438476562,
-0.21480707824230194,
-0.4538046419620514,
-0.6116509437561035,
-1.2738367319107056,
-0.058122944086790085,
1.4391961097717285,
-0.8751161098480225,
-0.20370179414749146,
0.48616519570350647,
0.3364516496658325,
0.5443090200424194,
0.693285346031189,
-0.6777745485305786,
-0.2959807813167572,
-0.2361563742160797,
-0.3430134057998657,
0.2228562980890274,
1.2816890478134155,
-0.19853299856185913,
-0.963226854801178,
0.7401447296142578,
-0.330976665019989,
0.08073585480451584,
1.9571428298950195,
0.09340310841798782,
-0.7795586585998535,
0.28553229570388794,
-0.7227051258087158,
1.886473536491394,
1.7449703216552734,
1.4108755588531494,
-0.13359478116035461,
-0.8632180094718933,
0.5396673083305359,
-0.22204384207725525,
-0.3870353698730469,
0.968782365322113,
0.45092907547950745,
-0.14268913865089417,
-1.4336422681808472,
0.6162696480751038,
1.265200138092041,
-0.9080483317375183,
-0.7721258401870728,
0.0915364995598793,
-0.8525296449661255,
1.1124672889709473,
0.6831794381141663,
0.37242868542671204,
0.21695482730865479,
1.6378859281539917,
0.7516043782234192,
-0.4558798372745514,
0.5118764042854309,
0.5175111889839172,
-0.1697489470243454,
-2.1106138229370117,
-1.0412570238113403,
0.285397469997406,
-0.4316714107990265,
-1.575904130935669,
1.3548997640609741,
-1.1578586101531982,
-0.9238414168357849,
0.5306224226951599,
0.03838927671313286,
1.4312107563018799,
0.35462456941604614,
1.6312850713729858,
2.1382038593292236,
0.9121946096420288,
0.3359551429748535,
1.2678711414337158,
-0.054888613522052765,
-0.3838828206062317,
1.7917003631591797,
-0.38751456141471863,
0.5465928912162781,
1.0551667213439941,
-0.3655823767185211,
-1.0192077159881592,
-0.7280741333961487,
-1.2008825540542603,
-0.6306957006454468,
1.1408659219741821,
0.087174192070961,
-1.1189939975738525,
0.21593990921974182,
1.5484702587127686,
0.16591185331344604,
-0.25275304913520813,
0.6905345916748047,
0.46423640847206116,
-0.7505894303321838,
-0.09318429976701736,
-0.972011387348175,
0.5159144401550293,
-0.23220886290073395,
-0.3800661563873291,
0.3158402144908905,
0.43816208839416504,
1.280009150505066,
0.0043673086911439896,
0.16628558933734894,
1.2539658546447754,
-1.3642265796661377,
1.4609066247940063,
-0.704849123954773,
0.23544204235076904,
-2.4571473598480225,
1.4564132690429688,
-0.7929314970970154,
1.9027079343795776,
-2.627387285232544,
0.45968684554100037,
-0.6051923036575317,
-0.4301159679889679,
0.31800055503845215,
-0.4098037779331207,
0.0812394991517067,
-0.11631014943122864,
-1.098257064819336,
-0.08325605094432831,
-0.7290157675743103,
0.6102077960968018,
1.175999641418457,
1.3195080757141113,
-1.069354772567749,
-0.3195604979991913,
-1.7545759677886963,
-0.16033481061458588,
-0.7242748737335205,
0.3217547833919525,
-1.9534660577774048,
-0.16953818500041962,
-1.9060369729995728,
-2.5040366649627686,
-1.293465256690979,
-0.8021124601364136,
1.1435776948928833,
0.21453706920146942,
-0.9167917370796204,
1.2267842292785645,
-0.3773776888847351,
-1.8507046699523926,
1.1155215501785278,
-2.2504379749298096
] |
https://github.com/huggingface/datasets/issues/6077 | Mapping gets stuck at 99% | I think `batch_size/writer_batch_size` is already at its lowest in the 2nd `.map` since `batched=False` implies `batch_size=1` and `len(ds) = 1000 = writer_batch_size`.
Here is also a bunch of stack traces when I interrupted the process:
<details>
<summary>stack trace 1</summary>
```python
(pyg)[d623204@rosetta-bigviz01 stage-laurent-f]$ python src/random_scripts/uses_random_data.py
Found cached dataset random_data (/local_scratch/lfainsin/.cache/huggingface/datasets/random_data/default/0.0.0/444e214e1d0e6298cfd3f2368323ec37073dc1439f618e19395b1f421c69b066)
Applying mean/std: 97%|ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | 967/1000 [00:01<00:00, 534.87 examples/s]Traceback (most recent call last):
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_writer.py", line 179, in __arrow_array__
storage = to_pyarrow_listarray(data, pa_type)
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/features/features.py", line 1466, in to_pyarrow_listarray
return pa.array(data, pa_type.storage_dtype)
File "pyarrow/array.pxi", line 320, in pyarrow.lib.array
File "pyarrow/array.pxi", line 39, in pyarrow.lib._sequence_to_array
File "pyarrow/error.pxi", line 144, in pyarrow.lib.pyarrow_internal_check_status
File "pyarrow/error.pxi", line 123, in pyarrow.lib.check_status
pyarrow.lib.ArrowTypeError: Could not convert tensor([[-1.0273, -0.8037, -0.6860],
[-0.5034, -1.2685, -0.0558],
[-1.0908, -1.1820, -0.3178],
...,
[-0.8171, 0.1781, -0.5903],
[ 0.4370, 1.9305, 0.5899],
[-0.1426, 0.9053, -1.7559]]) with type Tensor: was not a sequence or recognized null for conversion to list type
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_dataset.py", line 3449, in _map_single
writer.write(example)
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_writer.py", line 490, in write
self.write_examples_on_file()
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_writer.py", line 448, in write_examples_on_file
self.write_batch(batch_examples=batch_examples)
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_writer.py", line 553, in write_batch
arrays.append(pa.array(typed_sequence))
File "pyarrow/array.pxi", line 236, in pyarrow.lib.array
File "pyarrow/array.pxi", line 110, in pyarrow.lib._handle_arrow_array_protocol
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_writer.py", line 223, in __arrow_array__
return pa.array(cast_to_python_objects(data, only_1d_for_numpy=True))
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/features/features.py", line 446, in cast_to_python_objects
return _cast_to_python_objects(
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/features/features.py", line 407, in _cast_to_python_objects
[
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/features/features.py", line 408, in <listcomp>
_cast_to_python_objects(
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/features/features.py", line 319, in _cast_to_python_objects
[
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/features/features.py", line 320, in <listcomp>
_cast_to_python_objects(
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/features/features.py", line 263, in _cast_to_python_objects
def _cast_to_python_objects(obj: Any, only_1d_for_numpy: bool, optimize_list_casting: bool) -> Tuple[Any, bool]:
KeyboardInterrupt
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_writer.py", line 179, in __arrow_array__
storage = to_pyarrow_listarray(data, pa_type)
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/features/features.py", line 1466, in to_pyarrow_listarray
return pa.array(data, pa_type.storage_dtype)
File "pyarrow/array.pxi", line 320, in pyarrow.lib.array
File "pyarrow/array.pxi", line 39, in pyarrow.lib._sequence_to_array
File "pyarrow/error.pxi", line 144, in pyarrow.lib.pyarrow_internal_check_status
File "pyarrow/error.pxi", line 123, in pyarrow.lib.check_status
pyarrow.lib.ArrowTypeError: Could not convert tensor([[-1.0273, -0.8037, -0.6860],
[-0.5034, -1.2685, -0.0558],
[-1.0908, -1.1820, -0.3178],
...,
[-0.8171, 0.1781, -0.5903],
[ 0.4370, 1.9305, 0.5899],
[-0.1426, 0.9053, -1.7559]]) with type Tensor: was not a sequence or recognized null for conversion to list type
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/gpfs_new/data/users/lfainsin/stage-laurent-f/src/random_scripts/uses_random_data.py", line 62, in <module>
ds_normalized = ds.map(
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_dataset.py", line 580, in wrapper
out: Union["Dataset", "DatasetDict"] = func(self, *args, **kwargs)
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_dataset.py", line 545, in wrapper
out: Union["Dataset", "DatasetDict"] = func(self, *args, **kwargs)
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_dataset.py", line 3087, in map
for rank, done, content in Dataset._map_single(**dataset_kwargs):
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_dataset.py", line 3492, in _map_single
writer.finalize()
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_writer.py", line 584, in finalize
self.write_examples_on_file()
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_writer.py", line 448, in write_examples_on_file
self.write_batch(batch_examples=batch_examples)
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_writer.py", line 553, in write_batch
arrays.append(pa.array(typed_sequence))
File "pyarrow/array.pxi", line 236, in pyarrow.lib.array
File "pyarrow/array.pxi", line 110, in pyarrow.lib._handle_arrow_array_protocol
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_writer.py", line 223, in __arrow_array__
return pa.array(cast_to_python_objects(data, only_1d_for_numpy=True))
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/features/features.py", line 446, in cast_to_python_objects
return _cast_to_python_objects(
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/features/features.py", line 407, in _cast_to_python_objects
[
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/features/features.py", line 408, in <listcomp>
_cast_to_python_objects(
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/features/features.py", line 319, in _cast_to_python_objects
[
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/features/features.py", line 319, in <listcomp>
[
KeyboardInterrupt
```
</details>
<details>
<summary>stack trace 2</summary>
```python
(pyg)[d623204@rosetta-bigviz01 stage-laurent-f]$ python src/random_scripts/uses_random_data.py
Found cached dataset random_data (/local_scratch/lfainsin/.cache/huggingface/datasets/random_data/default/0.0.0/444e214e1d0e6298cfd3f2368323ec37073dc1439f618e19395b1f421c69b066)
Applying mean/std: 99%|ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | 988/1000 [00:20<00:00, 526.19 examples/s]Applying mean/std: 100%|ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ| 999/1000 [00:21<00:00, 9.66 examples/s]Traceback (most recent call last):
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_writer.py", line 179, in __arrow_array__
storage = to_pyarrow_listarray(data, pa_type)
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/features/features.py", line 1466, in to_pyarrow_listarray
return pa.array(data, pa_type.storage_dtype)
File "pyarrow/array.pxi", line 320, in pyarrow.lib.array
File "pyarrow/array.pxi", line 39, in pyarrow.lib._sequence_to_array
File "pyarrow/error.pxi", line 144, in pyarrow.lib.pyarrow_internal_check_status
File "pyarrow/error.pxi", line 123, in pyarrow.lib.check_status
pyarrow.lib.ArrowTypeError: Could not convert tensor([[-1.0273, -0.8037, -0.6860],
[-0.5034, -1.2685, -0.0558],
[-1.0908, -1.1820, -0.3178],
...,
[-0.8171, 0.1781, -0.5903],
[ 0.4370, 1.9305, 0.5899],
[-0.1426, 0.9053, -1.7559]]) with type Tensor: was not a sequence or recognized null for conversion to list type
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_dataset.py", line 3449, in _map_single
writer.write(example)
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_writer.py", line 490, in write
self.write_examples_on_file()
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_writer.py", line 448, in write_examples_on_file
self.write_batch(batch_examples=batch_examples)
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_writer.py", line 553, in write_batch
arrays.append(pa.array(typed_sequence))
File "pyarrow/array.pxi", line 236, in pyarrow.lib.array
File "pyarrow/array.pxi", line 110, in pyarrow.lib._handle_arrow_array_protocol
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_writer.py", line 223, in __arrow_array__
return pa.array(cast_to_python_objects(data, only_1d_for_numpy=True))
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/features/features.py", line 446, in cast_to_python_objects
return _cast_to_python_objects(
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/features/features.py", line 407, in _cast_to_python_objects
[
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/features/features.py", line 408, in <listcomp>
_cast_to_python_objects(
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/features/features.py", line 319, in _cast_to_python_objects
[
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/features/features.py", line 320, in <listcomp>
_cast_to_python_objects(
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/features/features.py", line 263, in _cast_to_python_objects
def _cast_to_python_objects(obj: Any, only_1d_for_numpy: bool, optimize_list_casting: bool) -> Tuple[Any, bool]:
KeyboardInterrupt
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_writer.py", line 179, in __arrow_array__
storage = to_pyarrow_listarray(data, pa_type)
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/features/features.py", line 1466, in to_pyarrow_listarray
return pa.array(data, pa_type.storage_dtype)
File "pyarrow/array.pxi", line 320, in pyarrow.lib.array
File "pyarrow/array.pxi", line 39, in pyarrow.lib._sequence_to_array
File "pyarrow/error.pxi", line 144, in pyarrow.lib.pyarrow_internal_check_status
File "pyarrow/error.pxi", line 123, in pyarrow.lib.check_status
pyarrow.lib.ArrowTypeError: Could not convert tensor([[-1.0273, -0.8037, -0.6860],
[-0.5034, -1.2685, -0.0558],
[-1.0908, -1.1820, -0.3178],
...,
[-0.8171, 0.1781, -0.5903],
[ 0.4370, 1.9305, 0.5899],
[-0.1426, 0.9053, -1.7559]]) with type Tensor: was not a sequence or recognized null for conversion to list type
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/gpfs_new/data/users/lfainsin/stage-laurent-f/src/random_scripts/uses_random_data.py", line 62, in <module>
ds_normalized = ds.map(
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_dataset.py", line 580, in wrapper
out: Union["Dataset", "DatasetDict"] = func(self, *args, **kwargs)
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_dataset.py", line 545, in wrapper
out: Union["Dataset", "DatasetDict"] = func(self, *args, **kwargs)
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_dataset.py", line 3087, in map
for rank, done, content in Dataset._map_single(**dataset_kwargs):
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_dataset.py", line 3492, in _map_single
writer.finalize()
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_writer.py", line 584, in finalize
self.write_examples_on_file()
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_writer.py", line 448, in write_examples_on_file
self.write_batch(batch_examples=batch_examples)
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_writer.py", line 553, in write_batch
arrays.append(pa.array(typed_sequence))
File "pyarrow/array.pxi", line 236, in pyarrow.lib.array
File "pyarrow/array.pxi", line 110, in pyarrow.lib._handle_arrow_array_protocol
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_writer.py", line 223, in __arrow_array__
return pa.array(cast_to_python_objects(data, only_1d_for_numpy=True))
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/features/features.py", line 446, in cast_to_python_objects
return _cast_to_python_objects(
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/features/features.py", line 407, in _cast_to_python_objects
[
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/features/features.py", line 408, in <listcomp>
_cast_to_python_objects(
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/features/features.py", line 319, in _cast_to_python_objects
[
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/features/features.py", line 320, in <listcomp>
_cast_to_python_objects(
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/features/features.py", line 291, in _cast_to_python_objects
if config.JAX_AVAILABLE and "jax" in sys.modules:
KeyboardInterrupt
```
</details>
<details>
<summary>stack trace 3</summary>
```python
(pyg)[d623204@rosetta-bigviz01 stage-laurent-f]$ python src/random_scripts/uses_random_data.py
Found cached dataset random_data (/local_scratch/lfainsin/.cache/huggingface/datasets/random_data/default/0.0.0/444e214e1d0e6298cfd3f2368323ec37073dc1439f618e19395b1f421c69b066)
Applying mean/std: 99%|ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | 989/1000 [00:01<00:00, 504.80 examples/s]Traceback (most recent call last):
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_writer.py", line 179, in __arrow_array__
storage = to_pyarrow_listarray(data, pa_type)
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/features/features.py", line 1466, in to_pyarrow_listarray
return pa.array(data, pa_type.storage_dtype)
File "pyarrow/array.pxi", line 320, in pyarrow.lib.array
File "pyarrow/array.pxi", line 39, in pyarrow.lib._sequence_to_array
File "pyarrow/error.pxi", line 144, in pyarrow.lib.pyarrow_internal_check_status
File "pyarrow/error.pxi", line 123, in pyarrow.lib.check_status
pyarrow.lib.ArrowTypeError: Could not convert tensor([[-1.0273, -0.8037, -0.6860],
[-0.5034, -1.2685, -0.0558],
[-1.0908, -1.1820, -0.3178],
...,
[-0.8171, 0.1781, -0.5903],
[ 0.4370, 1.9305, 0.5899],
[-0.1426, 0.9053, -1.7559]]) with type Tensor: was not a sequence or recognized null for conversion to list type
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_dataset.py", line 3449, in _map_single
writer.write(example)
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_writer.py", line 490, in write
self.write_examples_on_file()
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_writer.py", line 448, in write_examples_on_file
self.write_batch(batch_examples=batch_examples)
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_writer.py", line 553, in write_batch
arrays.append(pa.array(typed_sequence))
File "pyarrow/array.pxi", line 236, in pyarrow.lib.array
File "pyarrow/array.pxi", line 110, in pyarrow.lib._handle_arrow_array_protocol
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_writer.py", line 223, in __arrow_array__
return pa.array(cast_to_python_objects(data, only_1d_for_numpy=True))
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/features/features.py", line 446, in cast_to_python_objects
return _cast_to_python_objects(
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/features/features.py", line 407, in _cast_to_python_objects
[
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/features/features.py", line 408, in <listcomp>
_cast_to_python_objects(
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/features/features.py", line 319, in _cast_to_python_objects
[
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/features/features.py", line 320, in <listcomp>
_cast_to_python_objects(
KeyboardInterrupt
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_writer.py", line 179, in __arrow_array__
storage = to_pyarrow_listarray(data, pa_type)
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/features/features.py", line 1466, in to_pyarrow_listarray
return pa.array(data, pa_type.storage_dtype)
File "pyarrow/array.pxi", line 320, in pyarrow.lib.array
File "pyarrow/array.pxi", line 39, in pyarrow.lib._sequence_to_array
File "pyarrow/error.pxi", line 144, in pyarrow.lib.pyarrow_internal_check_status
File "pyarrow/error.pxi", line 123, in pyarrow.lib.check_status
pyarrow.lib.ArrowTypeError: Could not convert tensor([[-1.0273, -0.8037, -0.6860],
[-0.5034, -1.2685, -0.0558],
[-1.0908, -1.1820, -0.3178],
...,
[-0.8171, 0.1781, -0.5903],
[ 0.4370, 1.9305, 0.5899],
[-0.1426, 0.9053, -1.7559]]) with type Tensor: was not a sequence or recognized null for conversion to list type
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/gpfs_new/data/users/lfainsin/stage-laurent-f/src/random_scripts/uses_random_data.py", line 62, in <module>
ds_normalized = ds.map(
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_dataset.py", line 580, in wrapper
out: Union["Dataset", "DatasetDict"] = func(self, *args, **kwargs)
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_dataset.py", line 545, in wrapper
out: Union["Dataset", "DatasetDict"] = func(self, *args, **kwargs)
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_dataset.py", line 3087, in map
for rank, done, content in Dataset._map_single(**dataset_kwargs):
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_dataset.py", line 3492, in _map_single
writer.finalize()
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_writer.py", line 584, in finalize
self.write_examples_on_file()
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_writer.py", line 448, in write_examples_on_file
self.write_batch(batch_examples=batch_examples)
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_writer.py", line 553, in write_batch
arrays.append(pa.array(typed_sequence))
File "pyarrow/array.pxi", line 236, in pyarrow.lib.array
File "pyarrow/array.pxi", line 110, in pyarrow.lib._handle_arrow_array_protocol
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_writer.py", line 223, in __arrow_array__
return pa.array(cast_to_python_objects(data, only_1d_for_numpy=True))
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/features/features.py", line 446, in cast_to_python_objects
return _cast_to_python_objects(
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/features/features.py", line 407, in _cast_to_python_objects
[
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/features/features.py", line 408, in <listcomp>
_cast_to_python_objects(
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/features/features.py", line 319, in _cast_to_python_objects
[
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/features/features.py", line 320, in <listcomp>
_cast_to_python_objects(
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/features/features.py", line 298, in _cast_to_python_objects
if obj.ndim == 0:
KeyboardInterrupt
```
</details>
| ### Describe the bug
Hi !
I'm currently working with a large (~150GB) unnormalized dataset at work.
The dataset is available on a read-only filesystem internally, and I use a [loading script](https://huggingface.co/docs/datasets/dataset_script) to retreive it.
I want to normalize the features of the dataset, meaning I need to compute the mean and standard deviation metric for each feature of the entire dataset. I cannot load the entire dataset to RAM as it is too big, so following [this discussion on the huggingface discourse](https://discuss.huggingface.co/t/copy-columns-in-a-dataset-and-compute-statistics-for-a-column/22157) I am using a [map operation](https://huggingface.co/docs/datasets/v2.14.0/en/package_reference/main_classes#datasets.Dataset.map) to first compute the metrics and a second map operation to apply them on the dataset.
The problem lies in the second mapping, as it gets stuck at ~99%. By checking what the process does (using `htop` and `strace`) it seems to be doing a lot of I/O operations, and I'm not sure why.
Obviously, I could always normalize the dataset externally and then load it using a loading script. However, since the internal dataset is updated fairly frequently, using the library to perform normalization automatically would make it much easier for me.
### Steps to reproduce the bug
I'm able to reproduce the problem using the following scripts:
```python
# random_data.py
import datasets
import torch
_VERSION = "1.0.0"
class RandomDataset(datasets.GeneratorBasedBuilder):
def _info(self):
return datasets.DatasetInfo(
version=_VERSION,
supervised_keys=None,
features=datasets.Features(
{
"positions": datasets.Array2D(
shape=(30000, 3),
dtype="float32",
),
"normals": datasets.Array2D(
shape=(30000, 3),
dtype="float32",
),
"features": datasets.Array2D(
shape=(30000, 6),
dtype="float32",
),
"scalars": datasets.Sequence(
feature=datasets.Value("float32"),
length=20,
),
},
),
)
def _split_generators(self, dl_manager):
return [
datasets.SplitGenerator(
name=datasets.Split.TRAIN, # type: ignore
gen_kwargs={"nb_samples": 1000},
),
datasets.SplitGenerator(
name=datasets.Split.TEST, # type: ignore
gen_kwargs={"nb_samples": 100},
),
]
def _generate_examples(self, nb_samples: int):
for idx in range(nb_samples):
yield idx, {
"positions": torch.randn(30000, 3),
"normals": torch.randn(30000, 3),
"features": torch.randn(30000, 6),
"scalars": torch.randn(20),
}
```
```python
# main.py
import datasets
import torch
def apply_mean_std(
dataset: datasets.Dataset,
means: dict[str, torch.Tensor],
stds: dict[str, torch.Tensor],
) -> dict[str, torch.Tensor]:
"""Normalize the dataset using the mean and standard deviation of each feature.
Args:
dataset (`Dataset`): A huggingface dataset.
mean (`dict[str, Tensor]`): A dictionary containing the mean of each feature.
std (`dict[str, Tensor]`): A dictionary containing the standard deviation of each feature.
Returns:
dict: A dictionary containing the normalized dataset.
"""
result = {}
for key in means.keys():
# extract data from dataset
data: torch.Tensor = dataset[key] # type: ignore
# extract mean and std from dict
mean = means[key] # type: ignore
std = stds[key] # type: ignore
# normalize data
normalized_data = (data - mean) / std
result[key] = normalized_data
return result
# get dataset
ds = datasets.load_dataset(
path="random_data.py",
split="train",
).with_format("torch")
# compute mean (along last axis)
means = {key: torch.zeros(ds[key][0].shape[-1]) for key in ds.column_names}
means_sq = {key: torch.zeros(ds[key][0].shape[-1]) for key in ds.column_names}
for batch in ds.iter(batch_size=8):
for key in ds.column_names:
data = batch[key]
batch_size = data.shape[0]
data = data.reshape(-1, data.shape[-1])
means[key] += data.mean(dim=0) / len(ds) * batch_size
means_sq[key] += (data**2).mean(dim=0) / len(ds) * batch_size
# compute std (along last axis)
stds = {key: torch.sqrt(means_sq[key] - means[key] ** 2) for key in ds.column_names}
# normalize each feature of the dataset
ds_normalized = ds.map(
desc="Applying mean/std", # type: ignore
function=apply_mean_std,
batched=False,
fn_kwargs={
"means": means,
"stds": stds,
},
)
```
### Expected behavior
Using the previous scripts, the `ds_normalized` mapping completes in ~5 minutes, but any subsequent use of `ds_normalized` is really really slow, for example reapplying `apply_mean_std` to `ds_normalized` takes forever. This is very strange, I'm sure I must be missing something, but I would still expect this to be faster.
### Environment info
- `datasets` version: 2.13.1
- Platform: Linux-3.10.0-1160.66.1.el7.x86_64-x86_64-with-glibc2.17
- Python version: 3.10.12
- Huggingface_hub version: 0.15.1
- PyArrow version: 12.0.0
- Pandas version: 2.0.2 | 47 | 1,454 | Mapping gets stuck at 99%
### Describe the bug
Hi !
I'm currently working with a large (~150GB) unnormalized dataset at work.
The dataset is available on a read-only filesystem internally, and I use a [loading script](https://huggingface.co/docs/datasets/dataset_script) to retreive it.
I want to normalize the features of the dataset, meaning I need to compute the mean and standard deviation metric for each feature of the entire dataset. I cannot load the entire dataset to RAM as it is too big, so following [this discussion on the huggingface discourse](https://discuss.huggingface.co/t/copy-columns-in-a-dataset-and-compute-statistics-for-a-column/22157) I am using a [map operation](https://huggingface.co/docs/datasets/v2.14.0/en/package_reference/main_classes#datasets.Dataset.map) to first compute the metrics and a second map operation to apply them on the dataset.
The problem lies in the second mapping, as it gets stuck at ~99%. By checking what the process does (using `htop` and `strace`) it seems to be doing a lot of I/O operations, and I'm not sure why.
Obviously, I could always normalize the dataset externally and then load it using a loading script. However, since the internal dataset is updated fairly frequently, using the library to perform normalization automatically would make it much easier for me.
### Steps to reproduce the bug
I'm able to reproduce the problem using the following scripts:
```python
# random_data.py
import datasets
import torch
_VERSION = "1.0.0"
class RandomDataset(datasets.GeneratorBasedBuilder):
def _info(self):
return datasets.DatasetInfo(
version=_VERSION,
supervised_keys=None,
features=datasets.Features(
{
"positions": datasets.Array2D(
shape=(30000, 3),
dtype="float32",
),
"normals": datasets.Array2D(
shape=(30000, 3),
dtype="float32",
),
"features": datasets.Array2D(
shape=(30000, 6),
dtype="float32",
),
"scalars": datasets.Sequence(
feature=datasets.Value("float32"),
length=20,
),
},
),
)
def _split_generators(self, dl_manager):
return [
datasets.SplitGenerator(
name=datasets.Split.TRAIN, # type: ignore
gen_kwargs={"nb_samples": 1000},
),
datasets.SplitGenerator(
name=datasets.Split.TEST, # type: ignore
gen_kwargs={"nb_samples": 100},
),
]
def _generate_examples(self, nb_samples: int):
for idx in range(nb_samples):
yield idx, {
"positions": torch.randn(30000, 3),
"normals": torch.randn(30000, 3),
"features": torch.randn(30000, 6),
"scalars": torch.randn(20),
}
```
```python
# main.py
import datasets
import torch
def apply_mean_std(
dataset: datasets.Dataset,
means: dict[str, torch.Tensor],
stds: dict[str, torch.Tensor],
) -> dict[str, torch.Tensor]:
"""Normalize the dataset using the mean and standard deviation of each feature.
Args:
dataset (`Dataset`): A huggingface dataset.
mean (`dict[str, Tensor]`): A dictionary containing the mean of each feature.
std (`dict[str, Tensor]`): A dictionary containing the standard deviation of each feature.
Returns:
dict: A dictionary containing the normalized dataset.
"""
result = {}
for key in means.keys():
# extract data from dataset
data: torch.Tensor = dataset[key] # type: ignore
# extract mean and std from dict
mean = means[key] # type: ignore
std = stds[key] # type: ignore
# normalize data
normalized_data = (data - mean) / std
result[key] = normalized_data
return result
# get dataset
ds = datasets.load_dataset(
path="random_data.py",
split="train",
).with_format("torch")
# compute mean (along last axis)
means = {key: torch.zeros(ds[key][0].shape[-1]) for key in ds.column_names}
means_sq = {key: torch.zeros(ds[key][0].shape[-1]) for key in ds.column_names}
for batch in ds.iter(batch_size=8):
for key in ds.column_names:
data = batch[key]
batch_size = data.shape[0]
data = data.reshape(-1, data.shape[-1])
means[key] += data.mean(dim=0) / len(ds) * batch_size
means_sq[key] += (data**2).mean(dim=0) / len(ds) * batch_size
# compute std (along last axis)
stds = {key: torch.sqrt(means_sq[key] - means[key] ** 2) for key in ds.column_names}
# normalize each feature of the dataset
ds_normalized = ds.map(
desc="Applying mean/std", # type: ignore
function=apply_mean_std,
batched=False,
fn_kwargs={
"means": means,
"stds": stds,
},
)
```
### Expected behavior
Using the previous scripts, the `ds_normalized` mapping completes in ~5 minutes, but any subsequent use of `ds_normalized` is really really slow, for example reapplying `apply_mean_std` to `ds_normalized` takes forever. This is very strange, I'm sure I must be missing something, but I would still expect this to be faster.
### Environment info
- `datasets` version: 2.13.1
- Platform: Linux-3.10.0-1160.66.1.el7.x86_64-x86_64-with-glibc2.17
- Python version: 3.10.12
- Huggingface_hub version: 0.15.1
- PyArrow version: 12.0.0
- Pandas version: 2.0.2
I think `batch_size/writer_batch_size` is already at its lowest in the 2nd `.map` since `batched=False` implies `batch_size=1` and `len(ds) = 1000 = writer_batch_size`.
Here is also a bunch of stack traces when I interrupted the process:
<details>
<summary>stack trace 1</summary>
```python
(pyg)[d623204@rosetta-bigviz01 stage-laurent-f]$ python src/random_scripts/uses_random_data.py
Found cached dataset random_data (/local_scratch/lfainsin/.cache/huggingface/datasets/random_data/default/0.0.0/444e214e1d0e6298cfd3f2368323ec37073dc1439f618e19395b1f421c69b066)
Applying mean/std: 97%|ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | 967/1000 [00:01<00:00, 534.87 examples/s]Traceback (most recent call last):
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_writer.py", line 179, in __arrow_array__
storage = to_pyarrow_listarray(data, pa_type)
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/features/features.py", line 1466, in to_pyarrow_listarray
return pa.array(data, pa_type.storage_dtype)
File "pyarrow/array.pxi", line 320, in pyarrow.lib.array
File "pyarrow/array.pxi", line 39, in pyarrow.lib._sequence_to_array
File "pyarrow/error.pxi", line 144, in pyarrow.lib.pyarrow_internal_check_status
File "pyarrow/error.pxi", line 123, in pyarrow.lib.check_status
pyarrow.lib.ArrowTypeError: Could not convert tensor([[-1.0273, -0.8037, -0.6860],
[-0.5034, -1.2685, -0.0558],
[-1.0908, -1.1820, -0.3178],
...,
[-0.8171, 0.1781, -0.5903],
[ 0.4370, 1.9305, 0.5899],
[-0.1426, 0.9053, -1.7559]]) with type Tensor: was not a sequence or recognized null for conversion to list type
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_dataset.py", line 3449, in _map_single
writer.write(example)
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_writer.py", line 490, in write
self.write_examples_on_file()
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_writer.py", line 448, in write_examples_on_file
self.write_batch(batch_examples=batch_examples)
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_writer.py", line 553, in write_batch
arrays.append(pa.array(typed_sequence))
File "pyarrow/array.pxi", line 236, in pyarrow.lib.array
File "pyarrow/array.pxi", line 110, in pyarrow.lib._handle_arrow_array_protocol
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_writer.py", line 223, in __arrow_array__
return pa.array(cast_to_python_objects(data, only_1d_for_numpy=True))
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/features/features.py", line 446, in cast_to_python_objects
return _cast_to_python_objects(
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/features/features.py", line 407, in _cast_to_python_objects
[
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/features/features.py", line 408, in <listcomp>
_cast_to_python_objects(
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/features/features.py", line 319, in _cast_to_python_objects
[
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/features/features.py", line 320, in <listcomp>
_cast_to_python_objects(
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/features/features.py", line 263, in _cast_to_python_objects
def _cast_to_python_objects(obj: Any, only_1d_for_numpy: bool, optimize_list_casting: bool) -> Tuple[Any, bool]:
KeyboardInterrupt
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_writer.py", line 179, in __arrow_array__
storage = to_pyarrow_listarray(data, pa_type)
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/features/features.py", line 1466, in to_pyarrow_listarray
return pa.array(data, pa_type.storage_dtype)
File "pyarrow/array.pxi", line 320, in pyarrow.lib.array
File "pyarrow/array.pxi", line 39, in pyarrow.lib._sequence_to_array
File "pyarrow/error.pxi", line 144, in pyarrow.lib.pyarrow_internal_check_status
File "pyarrow/error.pxi", line 123, in pyarrow.lib.check_status
pyarrow.lib.ArrowTypeError: Could not convert tensor([[-1.0273, -0.8037, -0.6860],
[-0.5034, -1.2685, -0.0558],
[-1.0908, -1.1820, -0.3178],
...,
[-0.8171, 0.1781, -0.5903],
[ 0.4370, 1.9305, 0.5899],
[-0.1426, 0.9053, -1.7559]]) with type Tensor: was not a sequence or recognized null for conversion to list type
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/gpfs_new/data/users/lfainsin/stage-laurent-f/src/random_scripts/uses_random_data.py", line 62, in <module>
ds_normalized = ds.map(
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_dataset.py", line 580, in wrapper
out: Union["Dataset", "DatasetDict"] = func(self, *args, **kwargs)
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_dataset.py", line 545, in wrapper
out: Union["Dataset", "DatasetDict"] = func(self, *args, **kwargs)
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_dataset.py", line 3087, in map
for rank, done, content in Dataset._map_single(**dataset_kwargs):
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_dataset.py", line 3492, in _map_single
writer.finalize()
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_writer.py", line 584, in finalize
self.write_examples_on_file()
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_writer.py", line 448, in write_examples_on_file
self.write_batch(batch_examples=batch_examples)
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_writer.py", line 553, in write_batch
arrays.append(pa.array(typed_sequence))
File "pyarrow/array.pxi", line 236, in pyarrow.lib.array
File "pyarrow/array.pxi", line 110, in pyarrow.lib._handle_arrow_array_protocol
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_writer.py", line 223, in __arrow_array__
return pa.array(cast_to_python_objects(data, only_1d_for_numpy=True))
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/features/features.py", line 446, in cast_to_python_objects
return _cast_to_python_objects(
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/features/features.py", line 407, in _cast_to_python_objects
[
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/features/features.py", line 408, in <listcomp>
_cast_to_python_objects(
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/features/features.py", line 319, in _cast_to_python_objects
[
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/features/features.py", line 319, in <listcomp>
[
KeyboardInterrupt
```
</details>
<details>
<summary>stack trace 2</summary>
```python
(pyg)[d623204@rosetta-bigviz01 stage-laurent-f]$ python src/random_scripts/uses_random_data.py
Found cached dataset random_data (/local_scratch/lfainsin/.cache/huggingface/datasets/random_data/default/0.0.0/444e214e1d0e6298cfd3f2368323ec37073dc1439f618e19395b1f421c69b066)
Applying mean/std: 99%|ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | 988/1000 [00:20<00:00, 526.19 examples/s]Applying mean/std: 100%|ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ| 999/1000 [00:21<00:00, 9.66 examples/s]Traceback (most recent call last):
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_writer.py", line 179, in __arrow_array__
storage = to_pyarrow_listarray(data, pa_type)
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/features/features.py", line 1466, in to_pyarrow_listarray
return pa.array(data, pa_type.storage_dtype)
File "pyarrow/array.pxi", line 320, in pyarrow.lib.array
File "pyarrow/array.pxi", line 39, in pyarrow.lib._sequence_to_array
File "pyarrow/error.pxi", line 144, in pyarrow.lib.pyarrow_internal_check_status
File "pyarrow/error.pxi", line 123, in pyarrow.lib.check_status
pyarrow.lib.ArrowTypeError: Could not convert tensor([[-1.0273, -0.8037, -0.6860],
[-0.5034, -1.2685, -0.0558],
[-1.0908, -1.1820, -0.3178],
...,
[-0.8171, 0.1781, -0.5903],
[ 0.4370, 1.9305, 0.5899],
[-0.1426, 0.9053, -1.7559]]) with type Tensor: was not a sequence or recognized null for conversion to list type
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_dataset.py", line 3449, in _map_single
writer.write(example)
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_writer.py", line 490, in write
self.write_examples_on_file()
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_writer.py", line 448, in write_examples_on_file
self.write_batch(batch_examples=batch_examples)
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_writer.py", line 553, in write_batch
arrays.append(pa.array(typed_sequence))
File "pyarrow/array.pxi", line 236, in pyarrow.lib.array
File "pyarrow/array.pxi", line 110, in pyarrow.lib._handle_arrow_array_protocol
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_writer.py", line 223, in __arrow_array__
return pa.array(cast_to_python_objects(data, only_1d_for_numpy=True))
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/features/features.py", line 446, in cast_to_python_objects
return _cast_to_python_objects(
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/features/features.py", line 407, in _cast_to_python_objects
[
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/features/features.py", line 408, in <listcomp>
_cast_to_python_objects(
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/features/features.py", line 319, in _cast_to_python_objects
[
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/features/features.py", line 320, in <listcomp>
_cast_to_python_objects(
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/features/features.py", line 263, in _cast_to_python_objects
def _cast_to_python_objects(obj: Any, only_1d_for_numpy: bool, optimize_list_casting: bool) -> Tuple[Any, bool]:
KeyboardInterrupt
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_writer.py", line 179, in __arrow_array__
storage = to_pyarrow_listarray(data, pa_type)
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/features/features.py", line 1466, in to_pyarrow_listarray
return pa.array(data, pa_type.storage_dtype)
File "pyarrow/array.pxi", line 320, in pyarrow.lib.array
File "pyarrow/array.pxi", line 39, in pyarrow.lib._sequence_to_array
File "pyarrow/error.pxi", line 144, in pyarrow.lib.pyarrow_internal_check_status
File "pyarrow/error.pxi", line 123, in pyarrow.lib.check_status
pyarrow.lib.ArrowTypeError: Could not convert tensor([[-1.0273, -0.8037, -0.6860],
[-0.5034, -1.2685, -0.0558],
[-1.0908, -1.1820, -0.3178],
...,
[-0.8171, 0.1781, -0.5903],
[ 0.4370, 1.9305, 0.5899],
[-0.1426, 0.9053, -1.7559]]) with type Tensor: was not a sequence or recognized null for conversion to list type
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/gpfs_new/data/users/lfainsin/stage-laurent-f/src/random_scripts/uses_random_data.py", line 62, in <module>
ds_normalized = ds.map(
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_dataset.py", line 580, in wrapper
out: Union["Dataset", "DatasetDict"] = func(self, *args, **kwargs)
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_dataset.py", line 545, in wrapper
out: Union["Dataset", "DatasetDict"] = func(self, *args, **kwargs)
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_dataset.py", line 3087, in map
for rank, done, content in Dataset._map_single(**dataset_kwargs):
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_dataset.py", line 3492, in _map_single
writer.finalize()
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_writer.py", line 584, in finalize
self.write_examples_on_file()
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_writer.py", line 448, in write_examples_on_file
self.write_batch(batch_examples=batch_examples)
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_writer.py", line 553, in write_batch
arrays.append(pa.array(typed_sequence))
File "pyarrow/array.pxi", line 236, in pyarrow.lib.array
File "pyarrow/array.pxi", line 110, in pyarrow.lib._handle_arrow_array_protocol
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_writer.py", line 223, in __arrow_array__
return pa.array(cast_to_python_objects(data, only_1d_for_numpy=True))
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/features/features.py", line 446, in cast_to_python_objects
return _cast_to_python_objects(
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/features/features.py", line 407, in _cast_to_python_objects
[
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/features/features.py", line 408, in <listcomp>
_cast_to_python_objects(
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/features/features.py", line 319, in _cast_to_python_objects
[
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/features/features.py", line 320, in <listcomp>
_cast_to_python_objects(
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/features/features.py", line 291, in _cast_to_python_objects
if config.JAX_AVAILABLE and "jax" in sys.modules:
KeyboardInterrupt
```
</details>
<details>
<summary>stack trace 3</summary>
```python
(pyg)[d623204@rosetta-bigviz01 stage-laurent-f]$ python src/random_scripts/uses_random_data.py
Found cached dataset random_data (/local_scratch/lfainsin/.cache/huggingface/datasets/random_data/default/0.0.0/444e214e1d0e6298cfd3f2368323ec37073dc1439f618e19395b1f421c69b066)
Applying mean/std: 99%|ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | 989/1000 [00:01<00:00, 504.80 examples/s]Traceback (most recent call last):
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_writer.py", line 179, in __arrow_array__
storage = to_pyarrow_listarray(data, pa_type)
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/features/features.py", line 1466, in to_pyarrow_listarray
return pa.array(data, pa_type.storage_dtype)
File "pyarrow/array.pxi", line 320, in pyarrow.lib.array
File "pyarrow/array.pxi", line 39, in pyarrow.lib._sequence_to_array
File "pyarrow/error.pxi", line 144, in pyarrow.lib.pyarrow_internal_check_status
File "pyarrow/error.pxi", line 123, in pyarrow.lib.check_status
pyarrow.lib.ArrowTypeError: Could not convert tensor([[-1.0273, -0.8037, -0.6860],
[-0.5034, -1.2685, -0.0558],
[-1.0908, -1.1820, -0.3178],
...,
[-0.8171, 0.1781, -0.5903],
[ 0.4370, 1.9305, 0.5899],
[-0.1426, 0.9053, -1.7559]]) with type Tensor: was not a sequence or recognized null for conversion to list type
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_dataset.py", line 3449, in _map_single
writer.write(example)
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_writer.py", line 490, in write
self.write_examples_on_file()
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_writer.py", line 448, in write_examples_on_file
self.write_batch(batch_examples=batch_examples)
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_writer.py", line 553, in write_batch
arrays.append(pa.array(typed_sequence))
File "pyarrow/array.pxi", line 236, in pyarrow.lib.array
File "pyarrow/array.pxi", line 110, in pyarrow.lib._handle_arrow_array_protocol
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_writer.py", line 223, in __arrow_array__
return pa.array(cast_to_python_objects(data, only_1d_for_numpy=True))
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/features/features.py", line 446, in cast_to_python_objects
return _cast_to_python_objects(
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/features/features.py", line 407, in _cast_to_python_objects
[
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/features/features.py", line 408, in <listcomp>
_cast_to_python_objects(
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/features/features.py", line 319, in _cast_to_python_objects
[
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/features/features.py", line 320, in <listcomp>
_cast_to_python_objects(
KeyboardInterrupt
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_writer.py", line 179, in __arrow_array__
storage = to_pyarrow_listarray(data, pa_type)
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/features/features.py", line 1466, in to_pyarrow_listarray
return pa.array(data, pa_type.storage_dtype)
File "pyarrow/array.pxi", line 320, in pyarrow.lib.array
File "pyarrow/array.pxi", line 39, in pyarrow.lib._sequence_to_array
File "pyarrow/error.pxi", line 144, in pyarrow.lib.pyarrow_internal_check_status
File "pyarrow/error.pxi", line 123, in pyarrow.lib.check_status
pyarrow.lib.ArrowTypeError: Could not convert tensor([[-1.0273, -0.8037, -0.6860],
[-0.5034, -1.2685, -0.0558],
[-1.0908, -1.1820, -0.3178],
...,
[-0.8171, 0.1781, -0.5903],
[ 0.4370, 1.9305, 0.5899],
[-0.1426, 0.9053, -1.7559]]) with type Tensor: was not a sequence or recognized null for conversion to list type
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/gpfs_new/data/users/lfainsin/stage-laurent-f/src/random_scripts/uses_random_data.py", line 62, in <module>
ds_normalized = ds.map(
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_dataset.py", line 580, in wrapper
out: Union["Dataset", "DatasetDict"] = func(self, *args, **kwargs)
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_dataset.py", line 545, in wrapper
out: Union["Dataset", "DatasetDict"] = func(self, *args, **kwargs)
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_dataset.py", line 3087, in map
for rank, done, content in Dataset._map_single(**dataset_kwargs):
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_dataset.py", line 3492, in _map_single
writer.finalize()
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_writer.py", line 584, in finalize
self.write_examples_on_file()
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_writer.py", line 448, in write_examples_on_file
self.write_batch(batch_examples=batch_examples)
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_writer.py", line 553, in write_batch
arrays.append(pa.array(typed_sequence))
File "pyarrow/array.pxi", line 236, in pyarrow.lib.array
File "pyarrow/array.pxi", line 110, in pyarrow.lib._handle_arrow_array_protocol
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/arrow_writer.py", line 223, in __arrow_array__
return pa.array(cast_to_python_objects(data, only_1d_for_numpy=True))
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/features/features.py", line 446, in cast_to_python_objects
return _cast_to_python_objects(
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/features/features.py", line 407, in _cast_to_python_objects
[
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/features/features.py", line 408, in <listcomp>
_cast_to_python_objects(
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/features/features.py", line 319, in _cast_to_python_objects
[
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/features/features.py", line 320, in <listcomp>
_cast_to_python_objects(
File "/local_scratch/lfainsin/.conda/envs/pyg/lib/python3.10/site-packages/datasets/features/features.py", line 298, in _cast_to_python_objects
if obj.ndim == 0:
KeyboardInterrupt
```
</details>
| [
-1.2467619180679321,
-0.9692441821098328,
-0.7773353457450867,
1.3650438785552979,
-0.10279692709445953,
-1.2577497959136963,
0.0820453092455864,
-1.0771145820617676,
1.6699507236480713,
-0.7752376198768616,
0.2535783052444458,
-1.6741188764572144,
0.0001330627128481865,
-0.5192185044288635,
-0.7196358442306519,
-0.9292827248573303,
-0.42836281657218933,
-0.7693653106689453,
1.0682494640350342,
2.5319032669067383,
1.1663181781768799,
-1.3916829824447632,
2.7380056381225586,
0.6890181303024292,
-0.1308683305978775,
-1.0249642133712769,
0.5794615745544434,
0.014394155703485012,
-1.3597949743270874,
-0.39526140689849854,
-0.9713289737701416,
-0.01855153776705265,
-0.5624193549156189,
-0.4949333965778351,
0.034027427434921265,
0.36742085218429565,
-0.22762511670589447,
-0.4426629841327667,
-0.5897688269615173,
-0.7647039294242859,
0.46197813749313354,
-0.3146698772907257,
0.9942435622215271,
-0.3545180857181549,
1.8296427726745605,
-0.5085375308990479,
0.40375715494155884,
0.6671609878540039,
1.343123435974121,
0.2103288769721985,
0.05046398192644119,
0.32061967253685,
0.4087408781051636,
0.04270897060632706,
0.48136669397354126,
1.1971237659454346,
0.6055260896682739,
0.5078228116035461,
0.7211517691612244,
-2.174020767211914,
1.3422565460205078,
-0.9540314674377441,
0.3771088123321533,
1.3440388441085815,
-0.9014260768890381,
0.36384332180023193,
-1.7529940605163574,
-0.08630987256765366,
0.5511480569839478,
-2.256157875061035,
0.14137482643127441,
-1.2834725379943848,
-0.43197959661483765,
0.9795565009117126,
0.3522584140300751,
-1.2050758600234985,
0.18647566437721252,
-0.47631627321243286,
1.0739091634750366,
0.5062569975852966,
1.2354419231414795,
-1.7089179754257202,
0.033225126564502716,
-0.29483798146247864,
0.17447365820407867,
-1.2803961038589478,
-1.576486349105835,
0.5113226771354675,
0.6043962836265564,
0.6299614310264587,
-0.08441014587879181,
1.0067667961120605,
-1.0267763137817383,
0.7464110255241394,
-0.8652818202972412,
-1.6710386276245117,
-1.3861955404281616,
-2.301039934158325,
-2.3644816875457764,
0.8184136152267456,
-0.5005026459693909,
-0.5061028003692627,
2.0318002700805664,
-1.0828410387039185,
-1.790990948677063,
1.0765491724014282,
0.27483460307121277,
0.02147497981786728,
2.377331256866455,
0.162489116191864,
-0.7233153581619263,
0.49063411355018616,
-0.7345637083053589,
0.7893033027648926,
-0.3272707462310791,
1.3078820705413818,
0.4816489517688751,
-1.0030062198638916,
1.5656243562698364,
-0.40476158261299133,
0.5793794989585876,
-0.6556822061538696,
-0.4828268885612488,
-0.8300641775131226,
0.2967936098575592,
1.8910833597183228,
-0.3305094242095947,
1.6367286443710327,
-0.37281346321105957,
-1.6050193309783936,
-1.6232235431671143,
0.829276442527771,
0.5127225518226624,
-0.7676873207092285,
0.052157413214445114,
-0.3729911148548126,
0.06593628227710724,
0.03608138859272003,
1.1072019338607788,
1.202584981918335,
0.709801971912384,
-0.33022168278694153,
-0.8758439421653748,
0.1816616654396057,
-0.0807175561785698,
-0.6972082853317261,
-1.7582370042800903,
-0.3290409445762634,
0.12490931898355484,
0.620330274105072,
-1.1948826313018799,
1.7064586877822876,
0.8753851652145386,
1.8962076902389526,
1.0360573530197144,
-0.3524904251098633,
1.5238271951675415,
0.08224860578775406,
1.8405604362487793,
-0.49912044405937195,
0.6472380757331848,
-0.32927653193473816,
-1.170258641242981,
0.7816345691680908,
-0.3797627389431,
-2.0614588260650635,
-0.7647451758384705,
-0.8371453285217285,
-0.1527726650238037,
-0.7501168847084045,
0.951413094997406,
-0.34933069348335266,
-1.4247697591781616,
0.1697305142879486,
-0.6908698678016663,
0.10819616168737411,
-1.239892840385437,
0.2963680922985077,
0.7544494271278381,
-0.66166752576828,
-0.005780170671641827,
-0.29043665528297424,
-1.290385365486145,
-0.42731159925460815,
0.3055631220340729,
1.8546395301818848,
-0.7297377586364746,
0.9705548286437988,
1.0357428789138794,
-0.7008418440818787,
0.00022096093744039536,
0.29257071018218994,
-0.27541670203208923,
0.9122263789176941,
-1.0406187772750854,
-0.3938690721988678,
1.141351342201233,
-0.18762926757335663,
-0.6023191213607788,
1.405550479888916,
0.6929025650024414,
-1.041069746017456,
-0.212516650557518,
-0.083040252327919,
-0.8680865168571472,
0.000782831571996212,
-1.5526432991027832,
-0.14706754684448242,
0.30281320214271545,
-1.5828789472579956,
-0.509287416934967,
-0.22816458344459534,
1.2231131792068481,
-0.1552390158176422,
1.4142327308654785,
-0.365632563829422,
-0.19843073189258575,
-0.42432650923728943,
-0.4180070161819458,
0.17111988365650177,
-0.21451576054096222,
-0.6111334562301636,
0.2689812481403351,
-0.8629196882247925,
0.3410608172416687,
1.4479649066925049,
0.4027152955532074,
0.0833694264292717,
0.49972155690193176,
1.0811717510223389,
0.3805101811885834,
-0.08217080682516098,
-0.8663572669029236,
-1.5910987854003906,
2.05835223197937,
-1.4396908283233643,
1.9476808309555054,
0.7663041353225708,
-0.0760643482208252,
-1.8363510370254517,
-1.8936485052108765,
1.3488260507583618,
1.144186019897461,
2.37715744972229,
0.5074591040611267,
0.34930527210235596,
-0.783288836479187,
-0.6814500093460083,
0.34575241804122925,
-0.9749862551689148,
-0.7821716666221619,
0.10059787333011627,
2.326171875,
1.771716594696045,
-0.4542063772678375,
-0.22829017043113708,
-1.0167423486709595,
1.3656398057937622,
-0.201698437333107,
0.18882721662521362,
1.953131079673767,
-0.2971537113189697,
-1.0376105308532715,
1.3382163047790527,
-2.2815980911254883,
0.12969645857810974,
1.9696540832519531,
0.2699890732765198,
0.028413381427526474,
-1.4278004169464111,
-0.734067976474762,
-0.2700731158256531,
-0.46307164430618286,
-1.2981153726577759,
0.5094518661499023,
-0.30918145179748535,
-0.7922512888908386,
-1.4753799438476562,
0.08738581091165543,
-1.1354340314865112,
-1.708796501159668,
0.2509942948818207,
1.8835444450378418,
2.0085153579711914,
-0.7053989768028259,
1.4498223066329956,
-0.2546137869358063,
0.19014158844947815,
1.2200132608413696,
1.2179193496704102,
3.1545634269714355,
1.8570878505706787,
-1.273846983909607,
0.6684048771858215,
-0.1141929179430008,
-0.4647964835166931,
1.1711809635162354,
-1.1206079721450806,
1.273573637008667,
-0.18289639055728912,
-1.2553105354309082,
-1.2094475030899048,
1.0053393840789795,
0.45095232129096985,
0.0753774344921112,
-0.47078564763069153,
1.231424331665039,
-0.00803452730178833,
1.296268343925476,
0.5883960127830505,
-0.416258305311203,
0.6329759359359741,
-0.3883343040943146,
-0.5795652866363525,
1.5594953298568726,
0.13391847908496857,
-1.4948092699050903,
-2.2733843326568604,
-0.2512319087982178,
-0.8362984657287598,
0.061264362186193466,
-0.5851579904556274,
-1.0123529434204102,
1.6775928735733032,
0.4154697358608246,
-1.2488596439361572,
-0.26908570528030396,
-0.3993071913719177,
-0.6375272274017334,
2.6548166275024414,
-1.375285267829895,
-0.22833557426929474,
-0.9726972579956055,
-0.579551637172699,
1.555286169052124,
-1.1725170612335205,
-0.1947334259748459,
-0.9975393414497375,
-0.644557535648346,
-1.3117153644561768,
-0.5524806380271912,
-0.005474680569022894,
-0.9762184023857117,
0.7510079145431519,
0.09415651112794876,
-1.1093993186950684,
-0.21420562267303467,
-0.8925400376319885,
0.9263931512832642,
-0.11680498719215393,
0.23930753767490387,
1.9479926824569702,
0.3844825029373169,
-0.3727227449417114,
0.7020922303199768,
1.192228078842163,
0.6332438588142395,
-0.6933721899986267,
0.17940156161785126,
-0.7332433462142944,
0.2755816876888275,
-1.3079543113708496,
0.2640681564807892,
-2.8605823516845703,
0.6311547160148621,
-0.05276830494403839,
-0.058975230902433395,
0.035076286643743515,
-1.2897974252700806,
1.022388219833374,
2.627579689025879,
-1.2358187437057495,
0.4526868462562561,
0.35500675439834595,
1.1841776371002197,
-1.5929027795791626,
0.2859206199645996,
-0.45876768231391907,
2.0668561458587646,
0.2681424915790558,
1.188961148262024,
-0.4825421869754791,
-2.2171220779418945,
0.6156185865402222,
-1.2931641340255737,
-1.1424412727355957,
0.837589681148529,
-0.9084362387657166,
0.16509266197681427,
-1.4005670547485352,
-0.11599458009004593,
-0.7898463010787964,
-1.1691677570343018,
0.6727437376976013,
0.09872538596391678,
0.4813684821128845,
-0.5571417808532715,
0.3317040205001831,
-2.189272403717041,
-1.3392794132232666,
-0.22758139669895172,
-0.9479457139968872,
0.4868817627429962,
-0.3594978153705597,
0.6272926330566406,
-0.15944111347198486,
-0.00487998453900218,
0.32125017046928406,
1.3401402235031128,
3.422945022583008,
0.23287490010261536,
0.27114418148994446,
-0.09279090911149979,
-1.0096945762634277,
1.4944300651550293,
0.9546167850494385,
-0.16229791939258575,
-0.58292156457901,
-1.010434865951538,
1.332673192024231,
1.925355076789856,
1.103664755821228,
0.07600940763950348,
-0.8146185278892517,
-0.715214192867279,
0.030831746757030487,
0.20698682963848114,
0.4660505950450897,
0.943488359451294,
0.04124996066093445,
0.13615675270557404,
1.4841886758804321,
1.1912275552749634,
-0.3671254813671112,
0.3807029724121094,
-0.8676914572715759,
-0.5236761569976807,
0.501707136631012,
0.2918422520160675,
-0.006752285175025463,
0.44594258069992065,
-1.0455619096755981,
-0.24925671517848969,
-0.4486271142959595,
-0.973075807094574,
-0.6216679811477661,
-0.4124670624732971,
-0.3621116280555725,
1.637519359588623,
0.09520765393972397,
-0.5045101642608643,
-0.031103838235139847,
-0.7441604733467102,
-0.16319754719734192,
-1.0321203470230103,
0.3236604928970337,
-0.10514117777347565,
-0.09052335470914841,
-0.11579757183790207,
1.7546086311340332,
-0.9250495433807373,
-2.144601345062256,
0.2583377957344055,
0.22768360376358032,
-0.33503302931785583,
0.1973697543144226,
1.612885594367981,
0.5320526361465454,
1.4144856929779053,
1.3681854009628296,
0.9136322140693665,
-0.6243329644203186,
-1.2871012687683105,
0.6554571390151978,
1.0068215131759644,
-1.3799216747283936,
0.8822434544563293,
-0.08427087962627411,
-0.6085430979728699,
0.663037121295929,
1.2824103832244873,
0.43640318512916565,
-1.95796537399292,
0.8366286158561707,
-0.8730506300926208,
0.7851585745811462,
0.6522778868675232,
0.7634931206703186,
0.1387971043586731,
0.8068157434463501,
-1.300091028213501,
-1.1802146434783936,
-0.7512952089309692,
-0.633277952671051,
1.9603829383850098,
-0.2229035198688507,
0.6474459171295166,
-0.26533573865890503,
-1.2844253778457642,
-0.10628432780504227,
0.668134868144989,
0.2962866723537445,
-0.4588245749473572,
0.8894175291061401,
-0.6616579294204712,
-1.1329398155212402,
-1.4416307210922241,
-0.3858431279659271,
-1.0280656814575195,
-0.8643195033073425,
1.0733836889266968,
0.7522611021995544,
0.2900993227958679,
1.8616113662719727,
0.5906223058700562,
0.23343966901302338,
-2.6607463359832764,
0.8695493936538696,
0.2809373736381531,
-0.04380936548113823,
0.8599489331245422,
0.24945273995399475,
1.0215091705322266,
-0.005454744677990675,
0.5712770819664001,
-2.357414722442627,
2.238645315170288,
-0.22387544810771942,
0.7148292660713196,
-0.028256762772798538,
-0.18239955604076385,
1.1076127290725708,
0.5988099575042725,
0.6433889865875244,
-1.131514549255371,
0.7183264493942261,
-0.5575469732284546,
1.1952338218688965,
0.9183469414710999,
-0.8061854839324951,
-0.034427180886268616,
1.391994595527649,
0.5169562101364136,
-0.41163790225982666,
-0.9537155032157898,
-0.8884913325309753,
0.9732288122177124,
1.7941237688064575,
-0.017208373174071312,
0.0205356664955616,
0.8445966243743896,
0.7048121690750122,
-1.33951997756958,
0.05590561404824257,
-0.7149564623832703,
-0.6730610132217407,
1.6666510105133057,
2.0555827617645264,
-0.08342210203409195,
-0.16475918889045715,
-0.6779496669769287,
-1.2728368043899536,
0.7260436415672302,
-0.02408532053232193,
0.16788329184055328,
0.6857488751411438,
-0.6352343559265137,
1.1326508522033691,
0.8350221514701843,
0.9098381400108337,
0.16711068153381348,
0.25635331869125366,
0.38047876954078674,
-0.2753162086009979,
-1.1661970615386963,
-0.24308814108371735,
-1.0622906684875488,
-2.490513801574707,
0.39713799953460693,
-0.2678970992565155,
-1.4938024282455444,
0.0615595318377018,
-0.9970216751098633,
0.9434236884117126,
-0.5429925918579102,
-1.0938559770584106,
-1.5237315893173218,
0.2605784237384796,
-0.08075535297393799,
0.8848752379417419,
-1.5840823650360107,
-0.10325048863887787,
1.258912205696106,
0.9220340847969055,
-0.6065003275871277,
1.034543514251709,
0.25848492980003357,
0.9599147439002991,
0.8144968748092651,
-0.427222341299057,
0.4959949553012848,
0.13257567584514618,
-1.4068048000335693,
0.43835729360580444,
1.1329865455627441,
0.21448595821857452,
1.4070404767990112,
-0.5656892657279968,
0.05393088981509209,
0.4348471164703369,
-0.5174618363380432,
-0.4444368779659271,
-0.5237290263175964,
0.6564182043075562,
0.017516884952783585,
-0.9142799377441406,
-0.012896684929728508,
-0.014023944735527039,
-0.2493845522403717,
0.25133979320526123,
-1.4675674438476562,
-0.21480707824230194,
-0.4538046419620514,
-0.6116509437561035,
-1.2738367319107056,
-0.058122944086790085,
1.4391961097717285,
-0.8751161098480225,
-0.20370179414749146,
0.48616519570350647,
0.3364516496658325,
0.5443090200424194,
0.693285346031189,
-0.6777745485305786,
-0.2959807813167572,
-0.2361563742160797,
-0.3430134057998657,
0.2228562980890274,
1.2816890478134155,
-0.19853299856185913,
-0.963226854801178,
0.7401447296142578,
-0.330976665019989,
0.08073585480451584,
1.9571428298950195,
0.09340310841798782,
-0.7795586585998535,
0.28553229570388794,
-0.7227051258087158,
1.886473536491394,
1.7449703216552734,
1.4108755588531494,
-0.13359478116035461,
-0.8632180094718933,
0.5396673083305359,
-0.22204384207725525,
-0.3870353698730469,
0.968782365322113,
0.45092907547950745,
-0.14268913865089417,
-1.4336422681808472,
0.6162696480751038,
1.265200138092041,
-0.9080483317375183,
-0.7721258401870728,
0.0915364995598793,
-0.8525296449661255,
1.1124672889709473,
0.6831794381141663,
0.37242868542671204,
0.21695482730865479,
1.6378859281539917,
0.7516043782234192,
-0.4558798372745514,
0.5118764042854309,
0.5175111889839172,
-0.1697489470243454,
-2.1106138229370117,
-1.0412570238113403,
0.285397469997406,
-0.4316714107990265,
-1.575904130935669,
1.3548997640609741,
-1.1578586101531982,
-0.9238414168357849,
0.5306224226951599,
0.03838927671313286,
1.4312107563018799,
0.35462456941604614,
1.6312850713729858,
2.1382038593292236,
0.9121946096420288,
0.3359551429748535,
1.2678711414337158,
-0.054888613522052765,
-0.3838828206062317,
1.7917003631591797,
-0.38751456141471863,
0.5465928912162781,
1.0551667213439941,
-0.3655823767185211,
-1.0192077159881592,
-0.7280741333961487,
-1.2008825540542603,
-0.6306957006454468,
1.1408659219741821,
0.087174192070961,
-1.1189939975738525,
0.21593990921974182,
1.5484702587127686,
0.16591185331344604,
-0.25275304913520813,
0.6905345916748047,
0.46423640847206116,
-0.7505894303321838,
-0.09318429976701736,
-0.972011387348175,
0.5159144401550293,
-0.23220886290073395,
-0.3800661563873291,
0.3158402144908905,
0.43816208839416504,
1.280009150505066,
0.0043673086911439896,
0.16628558933734894,
1.2539658546447754,
-1.3642265796661377,
1.4609066247940063,
-0.704849123954773,
0.23544204235076904,
-2.4571473598480225,
1.4564132690429688,
-0.7929314970970154,
1.9027079343795776,
-2.627387285232544,
0.45968684554100037,
-0.6051923036575317,
-0.4301159679889679,
0.31800055503845215,
-0.4098037779331207,
0.0812394991517067,
-0.11631014943122864,
-1.098257064819336,
-0.08325605094432831,
-0.7290157675743103,
0.6102077960968018,
1.175999641418457,
1.3195080757141113,
-1.069354772567749,
-0.3195604979991913,
-1.7545759677886963,
-0.16033481061458588,
-0.7242748737335205,
0.3217547833919525,
-1.9534660577774048,
-0.16953818500041962,
-1.9060369729995728,
-2.5040366649627686,
-1.293465256690979,
-0.8021124601364136,
1.1435776948928833,
0.21453706920146942,
-0.9167917370796204,
1.2267842292785645,
-0.3773776888847351,
-1.8507046699523926,
1.1155215501785278,
-2.2504379749298096
] |
https://github.com/huggingface/datasets/issues/6075 | Error loading music files using `load_dataset` | This code behaves as expected on my local machine or in Colab. Which version of `soundfile` do you have installed? MP3 requires `soundfile>=0.12.1`. | ### Describe the bug
I tried to load a music file using `datasets.load_dataset()` from the repository - https://huggingface.co/datasets/susnato/pop2piano_real_music_test
I got the following error -
```
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/susnato/anaconda3/envs/p2p/lib/python3.9/site-packages/datasets/arrow_dataset.py", line 2803, in __getitem__
return self._getitem(key)
File "/home/susnato/anaconda3/envs/p2p/lib/python3.9/site-packages/datasets/arrow_dataset.py", line 2788, in _getitem
formatted_output = format_table(
File "/home/susnato/anaconda3/envs/p2p/lib/python3.9/site-packages/datasets/formatting/formatting.py", line 629, in format_table
return formatter(pa_table, query_type=query_type)
File "/home/susnato/anaconda3/envs/p2p/lib/python3.9/site-packages/datasets/formatting/formatting.py", line 398, in __call__
return self.format_column(pa_table)
File "/home/susnato/anaconda3/envs/p2p/lib/python3.9/site-packages/datasets/formatting/formatting.py", line 442, in format_column
column = self.python_features_decoder.decode_column(column, pa_table.column_names[0])
File "/home/susnato/anaconda3/envs/p2p/lib/python3.9/site-packages/datasets/formatting/formatting.py", line 218, in decode_column
return self.features.decode_column(column, column_name) if self.features else column
File "/home/susnato/anaconda3/envs/p2p/lib/python3.9/site-packages/datasets/features/features.py", line 1924, in decode_column
[decode_nested_example(self[column_name], value) if value is not None else None for value in column]
File "/home/susnato/anaconda3/envs/p2p/lib/python3.9/site-packages/datasets/features/features.py", line 1924, in <listcomp>
[decode_nested_example(self[column_name], value) if value is not None else None for value in column]
File "/home/susnato/anaconda3/envs/p2p/lib/python3.9/site-packages/datasets/features/features.py", line 1325, in decode_nested_example
return schema.decode_example(obj, token_per_repo_id=token_per_repo_id)
File "/home/susnato/anaconda3/envs/p2p/lib/python3.9/site-packages/datasets/features/audio.py", line 184, in decode_example
array, sampling_rate = sf.read(f)
File "/home/susnato/anaconda3/envs/p2p/lib/python3.9/site-packages/soundfile.py", line 372, in read
with SoundFile(file, 'r', samplerate, channels,
File "/home/susnato/anaconda3/envs/p2p/lib/python3.9/site-packages/soundfile.py", line 740, in __init__
self._file = self._open(file, mode_int, closefd)
File "/home/susnato/anaconda3/envs/p2p/lib/python3.9/site-packages/soundfile.py", line 1264, in _open
_error_check(_snd.sf_error(file_ptr),
File "/home/susnato/anaconda3/envs/p2p/lib/python3.9/site-packages/soundfile.py", line 1455, in _error_check
raise RuntimeError(prefix + _ffi.string(err_str).decode('utf-8', 'replace'))
RuntimeError: Error opening <_io.BufferedReader name='/home/susnato/.cache/huggingface/datasets/downloads/d2b09cb974b967b13f91553297c40c0f02f3c0d4c8356350743598ff48d6f29e'>: Format not recognised.
```
### Steps to reproduce the bug
Code to reproduce the error -
```python
from datasets import load_dataset
ds = load_dataset("susnato/pop2piano_real_music_test", split="test")
print(ds[0])
```
### Expected behavior
I should be able to read the music file without any error.
### Environment info
- `datasets` version: 2.14.0
- Platform: Linux-5.19.0-50-generic-x86_64-with-glibc2.35
- Python version: 3.9.16
- Huggingface_hub version: 0.15.1
- PyArrow version: 11.0.0
- Pandas version: 1.5.3
| 48 | 23 | Error loading music files using `load_dataset`
### Describe the bug
I tried to load a music file using `datasets.load_dataset()` from the repository - https://huggingface.co/datasets/susnato/pop2piano_real_music_test
I got the following error -
```
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/susnato/anaconda3/envs/p2p/lib/python3.9/site-packages/datasets/arrow_dataset.py", line 2803, in __getitem__
return self._getitem(key)
File "/home/susnato/anaconda3/envs/p2p/lib/python3.9/site-packages/datasets/arrow_dataset.py", line 2788, in _getitem
formatted_output = format_table(
File "/home/susnato/anaconda3/envs/p2p/lib/python3.9/site-packages/datasets/formatting/formatting.py", line 629, in format_table
return formatter(pa_table, query_type=query_type)
File "/home/susnato/anaconda3/envs/p2p/lib/python3.9/site-packages/datasets/formatting/formatting.py", line 398, in __call__
return self.format_column(pa_table)
File "/home/susnato/anaconda3/envs/p2p/lib/python3.9/site-packages/datasets/formatting/formatting.py", line 442, in format_column
column = self.python_features_decoder.decode_column(column, pa_table.column_names[0])
File "/home/susnato/anaconda3/envs/p2p/lib/python3.9/site-packages/datasets/formatting/formatting.py", line 218, in decode_column
return self.features.decode_column(column, column_name) if self.features else column
File "/home/susnato/anaconda3/envs/p2p/lib/python3.9/site-packages/datasets/features/features.py", line 1924, in decode_column
[decode_nested_example(self[column_name], value) if value is not None else None for value in column]
File "/home/susnato/anaconda3/envs/p2p/lib/python3.9/site-packages/datasets/features/features.py", line 1924, in <listcomp>
[decode_nested_example(self[column_name], value) if value is not None else None for value in column]
File "/home/susnato/anaconda3/envs/p2p/lib/python3.9/site-packages/datasets/features/features.py", line 1325, in decode_nested_example
return schema.decode_example(obj, token_per_repo_id=token_per_repo_id)
File "/home/susnato/anaconda3/envs/p2p/lib/python3.9/site-packages/datasets/features/audio.py", line 184, in decode_example
array, sampling_rate = sf.read(f)
File "/home/susnato/anaconda3/envs/p2p/lib/python3.9/site-packages/soundfile.py", line 372, in read
with SoundFile(file, 'r', samplerate, channels,
File "/home/susnato/anaconda3/envs/p2p/lib/python3.9/site-packages/soundfile.py", line 740, in __init__
self._file = self._open(file, mode_int, closefd)
File "/home/susnato/anaconda3/envs/p2p/lib/python3.9/site-packages/soundfile.py", line 1264, in _open
_error_check(_snd.sf_error(file_ptr),
File "/home/susnato/anaconda3/envs/p2p/lib/python3.9/site-packages/soundfile.py", line 1455, in _error_check
raise RuntimeError(prefix + _ffi.string(err_str).decode('utf-8', 'replace'))
RuntimeError: Error opening <_io.BufferedReader name='/home/susnato/.cache/huggingface/datasets/downloads/d2b09cb974b967b13f91553297c40c0f02f3c0d4c8356350743598ff48d6f29e'>: Format not recognised.
```
### Steps to reproduce the bug
Code to reproduce the error -
```python
from datasets import load_dataset
ds = load_dataset("susnato/pop2piano_real_music_test", split="test")
print(ds[0])
```
### Expected behavior
I should be able to read the music file without any error.
### Environment info
- `datasets` version: 2.14.0
- Platform: Linux-5.19.0-50-generic-x86_64-with-glibc2.35
- Python version: 3.9.16
- Huggingface_hub version: 0.15.1
- PyArrow version: 11.0.0
- Pandas version: 1.5.3
This code behaves as expected on my local machine or in Colab. Which version of `soundfile` do you have installed? MP3 requires `soundfile>=0.12.1`. | [
-1.2145147323608398,
-0.921959638595581,
-0.7346850633621216,
1.3431165218353271,
-0.05712354928255081,
-1.3600084781646729,
0.1440393477678299,
-1.0172046422958374,
1.5832189321517944,
-0.7139288187026978,
0.3244938552379608,
-1.6303914785385132,
-0.20887859165668488,
-0.43720120191574097,
-0.6327404379844666,
-0.969968855381012,
-0.3424742817878723,
-0.9954277276992798,
1.0009955167770386,
2.490220069885254,
1.4058873653411865,
-1.3310019969940186,
2.8550961017608643,
0.7156549096107483,
-0.3705293536186218,
-0.9465077519416809,
0.5035046935081482,
-0.035874057561159134,
-1.2148834466934204,
-0.5056405663490295,
-0.89205402135849,
0.007805067114531994,
-0.5706169009208679,
-0.3861691355705261,
0.09114023298025131,
0.503330647945404,
-0.3580648601055145,
-0.2530647814273834,
-0.6725223064422607,
-0.6896653771400452,
0.5623816847801208,
-0.27816376090049744,
0.9725621342658997,
-0.3517945110797882,
1.796011209487915,
-0.6089794635772705,
0.3213869035243988,
0.7298578023910522,
1.2293144464492798,
0.09232794493436813,
0.09796445816755295,
0.27282312512397766,
0.2717312276363373,
-0.0029225866310298443,
0.6049818992614746,
1.33393132686615,
0.5586262345314026,
0.5356009006500244,
0.7269602417945862,
-2.1949915885925293,
1.3558303117752075,
-0.8507000207901001,
0.28394144773483276,
1.2862223386764526,
-0.8181114792823792,
0.3374667167663574,
-1.8206592798233032,
-0.105279341340065,
0.627677321434021,
-2.2929837703704834,
0.2638455927371979,
-1.3079279661178589,
-0.546456515789032,
0.870348334312439,
0.3208597004413605,
-1.2204411029815674,
0.20656660199165344,
-0.546284019947052,
1.1120250225067139,
0.5421657562255859,
1.1146620512008667,
-1.6598701477050781,
0.026904065161943436,
-0.17105695605278015,
0.0781191736459732,
-1.23814857006073,
-1.7330660820007324,
0.6389747262001038,
0.44888201355934143,
0.8145563006401062,
-0.05502172186970711,
1.0475430488586426,
-1.0894949436187744,
0.8686932921409607,
-0.9122940897941589,
-1.5084235668182373,
-1.4134981632232666,
-2.4779927730560303,
-2.307069778442383,
0.8327377438545227,
-0.6168121099472046,
-0.4463346600532532,
2.0566213130950928,
-1.0835001468658447,
-1.7059568166732788,
0.977760910987854,
0.36791691184043884,
0.08645197004079819,
2.3095412254333496,
0.26181551814079285,
-0.7966814637184143,
0.44230371713638306,
-0.6685513854026794,
0.855521559715271,
-0.26666784286499023,
1.1755378246307373,
0.5323469042778015,
-0.97586590051651,
1.5979605913162231,
-0.5394272208213806,
0.6207029223442078,
-0.6124140620231628,
-0.5583518147468567,
-0.8629139065742493,
0.18555770814418793,
1.816785216331482,
-0.39821523427963257,
1.5948176383972168,
-0.3190654218196869,
-1.5406016111373901,
-1.5711421966552734,
0.7781834006309509,
0.4721951186656952,
-0.9928323030471802,
0.10346928238868713,
-0.6015675067901611,
0.1748298853635788,
0.024428173899650574,
1.1696735620498657,
1.1825969219207764,
0.695167601108551,
-0.3005025088787079,
-0.8372092843055725,
0.18810896575450897,
-0.1258593499660492,
-0.6460768580436707,
-1.7976635694503784,
-0.34824511408805847,
0.3065263330936432,
0.568640410900116,
-1.2196449041366577,
1.8278239965438843,
0.9120377898216248,
2.0794126987457275,
0.961685299873352,
-0.36785462498664856,
1.5549567937850952,
-0.04436120018362999,
1.8705823421478271,
-0.513343095779419,
0.5350397825241089,
-0.3289232850074768,
-1.1681569814682007,
0.9236301183700562,
-0.3758063018321991,
-2.016339063644409,
-0.8220016360282898,
-0.7086606025695801,
-0.20634058117866516,
-0.6860538125038147,
0.8411805033683777,
-0.3728550672531128,
-1.484786868095398,
0.028148822486400604,
-0.6954106688499451,
0.08651610463857651,
-1.2619905471801758,
0.18506860733032227,
0.7332507371902466,
-0.752224862575531,
-0.07785330712795258,
-0.2975698709487915,
-1.2699979543685913,
-0.43075308203697205,
0.363254189491272,
2.0114359855651855,
-0.5138764977455139,
0.9853573441505432,
0.9975060820579529,
-0.7042824029922485,
0.1973615288734436,
0.1540614515542984,
-0.38105830550193787,
0.7563339471817017,
-1.167134165763855,
-0.3795868754386902,
1.0956906080245972,
-0.21230725944042206,
-0.8060353994369507,
1.3210575580596924,
0.746856153011322,
-1.1430915594100952,
-0.2951295077800751,
-0.227019801735878,
-0.8924160003662109,
0.0008233757689595222,
-1.466294288635254,
-0.15745307505130768,
0.387681782245636,
-1.3974589109420776,
-0.3661961555480957,
-0.12479360401630402,
1.3912317752838135,
-0.20702597498893738,
1.4250317811965942,
-0.3378247320652008,
-0.15179188549518585,
-0.27921342849731445,
-0.488016277551651,
0.20704372227191925,
-0.14632683992385864,
-0.5923090577125549,
0.14371921122074127,
-0.8427867293357849,
0.20427629351615906,
1.5279289484024048,
0.34055715799331665,
0.12319937348365784,
0.4512006938457489,
1.1333658695220947,
0.3767068088054657,
-0.039191894233226776,
-0.8224508762359619,
-1.5562629699707031,
2.054365396499634,
-1.4121479988098145,
1.8833714723587036,
0.8057979345321655,
-0.06577843427658081,
-1.886149287223816,
-1.8592407703399658,
1.171419382095337,
1.1321381330490112,
2.296391725540161,
0.44315168261528015,
0.4265795052051544,
-0.7191435098648071,
-0.7959985733032227,
0.39737871289253235,
-0.9585680365562439,
-0.6052438020706177,
0.1415465772151947,
2.3186113834381104,
1.8386914730072021,
-0.6157079935073853,
-0.3228875994682312,
-0.789150059223175,
1.2763696908950806,
-0.3040889501571655,
0.247960165143013,
2.0189123153686523,
-0.36623460054397583,
-0.9091060757637024,
1.318624496459961,
-2.3961448669433594,
0.29555192589759827,
2.094651699066162,
0.2623575031757355,
0.17572742700576782,
-1.393140435218811,
-0.6698916554450989,
-0.2538515627384186,
-0.5388578176498413,
-1.281889796257019,
0.5163068771362305,
-0.33192938566207886,
-0.8989444375038147,
-1.3582688570022583,
0.006727687083184719,
-1.1926562786102295,
-1.8301830291748047,
0.352275550365448,
1.9469738006591797,
2.092149019241333,
-0.8464356064796448,
1.3579164743423462,
-0.25722673535346985,
-0.04522165283560753,
1.2679201364517212,
1.4183717966079712,
3.0658531188964844,
1.827789068222046,
-1.2817341089248657,
0.7400371432304382,
-0.19758301973342896,
-0.5149325132369995,
1.1330556869506836,
-1.1278998851776123,
1.042427659034729,
-0.17927417159080505,
-1.2801105976104736,
-1.209519386291504,
1.099568247795105,
0.5185332894325256,
-0.004876992199569941,
-0.49824315309524536,
1.4147135019302368,
0.09155670553445816,
1.3265259265899658,
0.6234763264656067,
-0.5440129041671753,
0.513374388217926,
-0.31405723094940186,
-0.6230823397636414,
1.632534384727478,
0.14964251220226288,
-1.5144575834274292,
-2.3314223289489746,
-0.23244808614253998,
-0.9239729642868042,
-0.09940881282091141,
-0.5905365347862244,
-1.0241323709487915,
1.5813696384429932,
0.4291702210903168,
-1.1378804445266724,
-0.2944768965244293,
-0.2895483076572418,
-0.4268748462200165,
2.569439172744751,
-1.2083693742752075,
-0.056473441421985626,
-0.9659532904624939,
-0.42972850799560547,
1.6739466190338135,
-1.2329185009002686,
-0.2567223906517029,
-1.0770390033721924,
-0.6882426738739014,
-1.2884868383407593,
-0.48348671197891235,
0.013915701769292355,
-0.9717223048210144,
0.7014437913894653,
0.14410442113876343,
-1.1260249614715576,
-0.15898700058460236,
-0.917896032333374,
1.1446421146392822,
-0.09643884003162384,
0.24622131884098053,
1.8623422384262085,
0.2778499126434326,
-0.49969586730003357,
0.7773320078849792,
1.2721048593521118,
0.6256400346755981,
-0.6432856917381287,
0.02183520793914795,
-0.6656873226165771,
0.37281185388565063,
-1.4146909713745117,
0.169731006026268,
-3.017423629760742,
0.7965601086616516,
-0.23017296195030212,
-0.13034334778785706,
-0.08347589522600174,
-1.3260815143585205,
1.0270041227340698,
2.56097412109375,
-1.159122109413147,
0.5073560476303101,
0.4671609103679657,
1.0971896648406982,
-1.6581366062164307,
0.285188764333725,
-0.5684064030647278,
2.043454170227051,
0.1870463639497757,
1.2883859872817993,
-0.49752306938171387,
-2.1800594329833984,
0.6065579056739807,
-1.2126643657684326,
-0.9842512607574463,
0.881281852722168,
-0.9974197149276733,
0.33368054032325745,
-1.4707398414611816,
-0.16904807090759277,
-0.9799301624298096,
-1.2612366676330566,
0.7613754272460938,
0.172255739569664,
0.3838741183280945,
-0.5459274649620056,
0.32521888613700867,
-2.1221725940704346,
-1.4122363328933716,
-0.13011246919631958,
-1.0226222276687622,
0.6585782766342163,
-0.38952091336250305,
0.57924884557724,
-0.0019321423023939133,
0.17826884984970093,
0.3261794447898865,
1.4366602897644043,
3.3780057430267334,
0.06893961131572723,
0.10695406049489975,
-0.150472953915596,
-1.0327517986297607,
1.4803853034973145,
0.9067715406417847,
-0.19432246685028076,
-0.6006911396980286,
-1.0360634326934814,
1.3862600326538086,
2.063452959060669,
1.188689112663269,
0.14577026665210724,
-0.911616861820221,
-0.78999263048172,
0.014363766647875309,
0.21523509919643402,
0.5000596046447754,
1.0006670951843262,
0.02290404960513115,
0.0865960568189621,
1.409269094467163,
1.0932550430297852,
-0.24636763334274292,
0.464597225189209,
-0.9900349378585815,
-0.3762480318546295,
0.35191190242767334,
0.16715748608112335,
0.1306619942188263,
0.5633628964424133,
-1.0441200733184814,
-0.3471543788909912,
-0.3069419264793396,
-0.79039067029953,
-0.8010618090629578,
-0.33620405197143555,
-0.44777795672416687,
1.6038113832473755,
0.09160059690475464,
-0.5274823307991028,
0.13847382366657257,
-0.6251826286315918,
-0.1575097143650055,
-1.1204863786697388,
0.15176911652088165,
-0.11321981251239777,
-0.07859660685062408,
-0.1544024795293808,
1.4923347234725952,
-0.9435173869132996,
-2.1884963512420654,
0.13894805312156677,
0.3224537670612335,
-0.2359246462583542,
0.12264849245548248,
1.7131365537643433,
0.5117936730384827,
1.3511584997177124,
1.2372910976409912,
0.9554535746574402,
-0.6400846838951111,
-1.1608519554138184,
0.7497720122337341,
0.9563322067260742,
-1.3203552961349487,
0.9632894992828369,
-0.24493518471717834,
-0.5481536984443665,
0.6954510807991028,
1.2823792695999146,
0.4154978096485138,
-2.0671889781951904,
1.0560280084609985,
-0.9468616247177124,
0.7961621284484863,
0.6636858582496643,
0.8258364200592041,
0.25887331366539,
0.9367914795875549,
-1.2797490358352661,
-1.2068367004394531,
-0.6738147139549255,
-0.6579263210296631,
1.8947110176086426,
-0.24469581246376038,
0.5609796047210693,
-0.16946162283420563,
-1.1537457704544067,
-0.1294492930173874,
0.7867245078086853,
0.32607847452163696,
-0.35668760538101196,
0.9721401333808899,
-0.6675860285758972,
-0.9043540954589844,
-1.3063334226608276,
-0.3409479856491089,
-1.0819281339645386,
-0.8706120848655701,
0.982577383518219,
0.7503696084022522,
0.49736374616622925,
1.9213751554489136,
0.5597691535949707,
0.40324631333351135,
-2.64178204536438,
0.8790004253387451,
0.27909159660339355,
-0.005346215795725584,
0.9282863140106201,
0.24712936580181122,
1.29349684715271,
-0.017239734530448914,
0.6337547302246094,
-2.3051717281341553,
2.1839120388031006,
-0.1458393633365631,
0.6211430430412292,
0.005243908613920212,
-0.27080801129341125,
1.082553744316101,
0.556845486164093,
0.5854734182357788,
-1.1405562162399292,
0.7326475381851196,
-0.5101027488708496,
1.0248007774353027,
0.9648407697677612,
-0.9778624176979065,
0.11924906075000763,
1.483449101448059,
0.47601449489593506,
-0.3987967371940613,
-1.0287504196166992,
-0.8374674320220947,
0.963699460029602,
1.668190360069275,
-0.04368089511990547,
0.007390930317342281,
0.7923048138618469,
0.646637499332428,
-1.1851660013198853,
0.09985589236021042,
-0.6561388373374939,
-0.7081656455993652,
1.7728796005249023,
2.0507943630218506,
-0.14709466695785522,
-0.14611762762069702,
-0.7255953550338745,
-1.2818553447723389,
0.7670121788978577,
-0.1754862368106842,
0.0051169851794838905,
0.6833639144897461,
-0.7384729385375977,
1.1037321090698242,
0.48713070154190063,
1.047559142112732,
-0.059054698795080185,
0.3390491008758545,
0.3545387089252472,
-0.39162832498550415,
-1.136765956878662,
-0.38236674666404724,
-1.0432981252670288,
-2.581385374069214,
0.3449607491493225,
-0.2851550579071045,
-1.4823498725891113,
0.054164640605449677,
-1.0155720710754395,
0.8869288563728333,
-0.6307979226112366,
-1.0960016250610352,
-1.364357829093933,
0.3797685503959656,
-0.13666193187236786,
0.911247968673706,
-1.6522750854492188,
-0.2246333807706833,
1.2877302169799805,
0.8790947198867798,
-0.5747159123420715,
0.9539943933486938,
0.24178530275821686,
0.869515061378479,
0.72572922706604,
-0.3953823149204254,
0.6366352438926697,
-0.006568909622728825,
-1.3780003786087036,
0.3889768719673157,
1.2723472118377686,
0.1439146101474762,
1.4242876768112183,
-0.37244969606399536,
0.1694803386926651,
0.5272530913352966,
-0.6839239597320557,
-0.51121985912323,
-0.30623507499694824,
0.7231888771057129,
0.030565813183784485,
-1.1209200620651245,
-0.2292710393667221,
-0.20175234973430634,
-0.37008801102638245,
0.18604671955108643,
-1.4671508073806763,
-0.3622679114341736,
-0.4235658645629883,
-0.4501519203186035,
-1.4079854488372803,
0.07996895909309387,
1.243454098701477,
-0.7618690133094788,
-0.2196565717458725,
0.4422876834869385,
0.4143645763397217,
0.5663611888885498,
0.5263698697090149,
-0.7854828238487244,
-0.20011074841022491,
-0.42547231912612915,
-0.2578570544719696,
0.24153529107570648,
1.1297470331192017,
-0.0169980525970459,
-1.013205647468567,
0.6535971164703369,
-0.32749518752098083,
0.20751777291297913,
2.0182831287384033,
0.045996177941560745,
-0.6775145530700684,
0.354955792427063,
-0.7072144746780396,
1.640126347541809,
1.7162055969238281,
1.2474720478057861,
-0.08157310634851456,
-0.7732272148132324,
0.530842661857605,
-0.3515503406524658,
-0.2646885812282562,
0.9469072818756104,
0.38173648715019226,
-0.23361657559871674,
-1.4578697681427002,
0.6966748833656311,
1.2724823951721191,
-0.7546454668045044,
-0.717293918132782,
0.04699771851301193,
-0.9446155428886414,
1.235607385635376,
0.5654378533363342,
0.31670302152633667,
0.2561522126197815,
1.4523484706878662,
0.7704967856407166,
-0.47902020812034607,
0.4739415645599365,
0.5403720736503601,
-0.20380540192127228,
-2.103806495666504,
-0.8980244398117065,
0.31977200508117676,
-0.3094438910484314,
-1.5951942205429077,
1.360066533088684,
-1.1258511543273926,
-1.103606939315796,
0.5355380773544312,
0.089043989777565,
1.2029906511306763,
0.3016849160194397,
1.7305959463119507,
2.172203302383423,
0.8262205123901367,
0.3485623002052307,
1.2057874202728271,
-0.04413365200161934,
-0.41267746686935425,
1.777813196182251,
-0.34887364506721497,
0.5389361381530762,
0.9206646084785461,
-0.42998453974723816,
-1.1073893308639526,
-0.8193817734718323,
-1.1687092781066895,
-0.6149203777313232,
1.1501755714416504,
0.08936281502246857,
-1.0044082403182983,
0.1948011815547943,
1.5880377292633057,
0.1453636884689331,
-0.18210431933403015,
0.7142391800880432,
0.45890992879867554,
-0.6761150360107422,
-0.10745076090097427,
-0.8852459788322449,
0.5343282222747803,
-0.09013672173023224,
-0.27749618887901306,
0.27420714497566223,
0.5800495147705078,
1.3117610216140747,
-0.09940171241760254,
0.11605577170848846,
1.1515175104141235,
-1.3301907777786255,
1.5087846517562866,
-0.6150996685028076,
0.3022671341896057,
-2.469545364379883,
1.3968123197555542,
-0.7785011529922485,
1.9963983297348022,
-2.4206418991088867,
0.42703166604042053,
-0.48726990818977356,
-0.475525438785553,
0.3096170127391815,
-0.3779629170894623,
0.07830861210823059,
-0.12785962224006653,
-0.8204134106636047,
0.009931008331477642,
-0.7474716901779175,
0.6366202235221863,
1.191378116607666,
1.381856083869934,
-1.1063071489334106,
-0.21332252025604248,
-1.6504058837890625,
-0.12765508890151978,
-0.829732358455658,
0.31930088996887207,
-2.005704402923584,
-0.15852364897727966,
-2.0713491439819336,
-2.4521450996398926,
-1.3266849517822266,
-0.8478113412857056,
1.100669264793396,
0.21990637481212616,
-0.9384037852287292,
1.2335909605026245,
-0.31964218616485596,
-1.789880394935608,
1.0974891185760498,
-2.162496566772461
] |
https://github.com/huggingface/datasets/issues/6073 | version2.3.2 load_dataset()data_files can't include .xxxx in path | Version 2.3.2 is over one year old, so please use the latest release (2.14.0) to get the expected behavior. Version 2.3.2 does not contain some fixes we made to fix resolving hidden files/directories (starting with a dot). | ### Describe the bug
First, I cd workdir.
Then, I just use load_dataset("json", data_file={"train":"/a/b/c/.d/train/train.json", "test":"/a/b/c/.d/train/test.json"})
that couldn't work and
<FileNotFoundError: Unable to find
'/a/b/c/.d/train/train.jsonl' at
/a/b/c/.d/>
And I debug, it is fine in version2.1.2
So there maybe a bug in path join.
Here is the whole bug report:
/x/datasets/loa β
β d.py:1656 in load_dataset β
β β
β 1653 β ignore_verifications = ignore_verifications or save_infos β
β 1654 β β
β 1655 β # Create a dataset builder β
β β± 1656 β builder_instance = load_dataset_builder( β
β 1657 β β path=path, β
β 1658 β β name=name, β
β 1659 β β data_dir=data_dir, β
β β
β x/datasets/loa β
β d.py:1439 in load_dataset_builder β
β β
β 1436 β if use_auth_token is not None: β
β 1437 β β download_config = download_config.copy() if download_config e β
β 1438 β β download_config.use_auth_token = use_auth_token β
β β± 1439 β dataset_module = dataset_module_factory( β
β 1440 β β path, β
β 1441 β β revision=revision, β
β 1442 β β download_config=download_config, β
β β
β x/datasets/loa β
β d.py:1097 in dataset_module_factory β
β β
β 1094 β β
β 1095 β # Try packaged β
β 1096 β if path in _PACKAGED_DATASETS_MODULES: β
β β± 1097 β β return PackagedDatasetModuleFactory( β
β 1098 β β β path, β
β 1099 β β β data_dir=data_dir, β
β 1100 β β β data_files=data_files, β
β β
βx/datasets/loa β
β d.py:743 in get_module β
β β
β 740 β β β if self.data_dir is not None β
β 741 β β β else get_patterns_locally(str(Path().resolve())) β
β 742 β β ) β
β β± 743 β β data_files = DataFilesDict.from_local_or_remote( β
β 744 β β β patterns, β
β 745 β β β use_auth_token=self.download_config.use_auth_token, β
β 746 β β β base_path=str(Path(self.data_dir).resolve()) if self.data β
β β
β x/datasets/dat β
β a_files.py:590 in from_local_or_remote β
β β
β 587 β β out = cls() β
β 588 β β for key, patterns_for_key in patterns.items(): β
β 589 β β β out[key] = ( β
β β± 590 β β β β DataFilesList.from_local_or_remote( β
β 591 β β β β β patterns_for_key, β
β 592 β β β β β base_path=base_path, β
β 593 β β β β β allowed_extensions=allowed_extensions, β
β β
β /x/datasets/dat β
β a_files.py:558 in from_local_or_remote β
β β
β 555 β β use_auth_token: Optional[Union[bool, str]] = None, β
β 556 β ) -> "DataFilesList": β
β 557 β β base_path = base_path if base_path is not None else str(Path() β
β β± 558 β β data_files = resolve_patterns_locally_or_by_urls(base_path, pa β
β 559 β β origin_metadata = _get_origin_metadata_locally_or_by_urls(data β
β 560 β β return cls(data_files, origin_metadata) β
β 561 β
β β
β /x/datasets/dat β
β a_files.py:195 in resolve_patterns_locally_or_by_urls β
β β
β 192 β β if is_remote_url(pattern): β
β 193 β β β data_files.append(Url(pattern)) β
β 194 β β else: β
β β± 195 β β β for path in _resolve_single_pattern_locally(base_path, pat β
β 196 β β β β data_files.append(path) β
β 197 β β
β 198 β if not data_files: β
β β
β /x/datasets/dat β
β a_files.py:145 in _resolve_single_pattern_locally β
β β
β 142 β β error_msg = f"Unable to find '{pattern}' at {Path(base_path).r β
β 143 β β if allowed_extensions is not None: β
β 144 β β β error_msg += f" with any supported extension {list(allowed β
β β± 145 β β raise FileNotFoundError(error_msg) β
β 146 β return sorted(out) β
β 147
### Steps to reproduce the bug
1. Version=2.3.2
2. In shell, cd workdir.(cd /a/b/c/.d/)
3. load_dataset("json", data_file={"train":"/a/b/c/.d/train/train.json", "test":"/a/b/c/.d/train/test.json"})
### Expected behavior
fix it please~
### Environment info
2.3.2 | 49 | 37 | version2.3.2 load_dataset()data_files can't include .xxxx in path
### Describe the bug
First, I cd workdir.
Then, I just use load_dataset("json", data_file={"train":"/a/b/c/.d/train/train.json", "test":"/a/b/c/.d/train/test.json"})
that couldn't work and
<FileNotFoundError: Unable to find
'/a/b/c/.d/train/train.jsonl' at
/a/b/c/.d/>
And I debug, it is fine in version2.1.2
So there maybe a bug in path join.
Here is the whole bug report:
/x/datasets/loa β
β d.py:1656 in load_dataset β
β β
β 1653 β ignore_verifications = ignore_verifications or save_infos β
β 1654 β β
β 1655 β # Create a dataset builder β
β β± 1656 β builder_instance = load_dataset_builder( β
β 1657 β β path=path, β
β 1658 β β name=name, β
β 1659 β β data_dir=data_dir, β
β β
β x/datasets/loa β
β d.py:1439 in load_dataset_builder β
β β
β 1436 β if use_auth_token is not None: β
β 1437 β β download_config = download_config.copy() if download_config e β
β 1438 β β download_config.use_auth_token = use_auth_token β
β β± 1439 β dataset_module = dataset_module_factory( β
β 1440 β β path, β
β 1441 β β revision=revision, β
β 1442 β β download_config=download_config, β
β β
β x/datasets/loa β
β d.py:1097 in dataset_module_factory β
β β
β 1094 β β
β 1095 β # Try packaged β
β 1096 β if path in _PACKAGED_DATASETS_MODULES: β
β β± 1097 β β return PackagedDatasetModuleFactory( β
β 1098 β β β path, β
β 1099 β β β data_dir=data_dir, β
β 1100 β β β data_files=data_files, β
β β
βx/datasets/loa β
β d.py:743 in get_module β
β β
β 740 β β β if self.data_dir is not None β
β 741 β β β else get_patterns_locally(str(Path().resolve())) β
β 742 β β ) β
β β± 743 β β data_files = DataFilesDict.from_local_or_remote( β
β 744 β β β patterns, β
β 745 β β β use_auth_token=self.download_config.use_auth_token, β
β 746 β β β base_path=str(Path(self.data_dir).resolve()) if self.data β
β β
β x/datasets/dat β
β a_files.py:590 in from_local_or_remote β
β β
β 587 β β out = cls() β
β 588 β β for key, patterns_for_key in patterns.items(): β
β 589 β β β out[key] = ( β
β β± 590 β β β β DataFilesList.from_local_or_remote( β
β 591 β β β β β patterns_for_key, β
β 592 β β β β β base_path=base_path, β
β 593 β β β β β allowed_extensions=allowed_extensions, β
β β
β /x/datasets/dat β
β a_files.py:558 in from_local_or_remote β
β β
β 555 β β use_auth_token: Optional[Union[bool, str]] = None, β
β 556 β ) -> "DataFilesList": β
β 557 β β base_path = base_path if base_path is not None else str(Path() β
β β± 558 β β data_files = resolve_patterns_locally_or_by_urls(base_path, pa β
β 559 β β origin_metadata = _get_origin_metadata_locally_or_by_urls(data β
β 560 β β return cls(data_files, origin_metadata) β
β 561 β
β β
β /x/datasets/dat β
β a_files.py:195 in resolve_patterns_locally_or_by_urls β
β β
β 192 β β if is_remote_url(pattern): β
β 193 β β β data_files.append(Url(pattern)) β
β 194 β β else: β
β β± 195 β β β for path in _resolve_single_pattern_locally(base_path, pat β
β 196 β β β β data_files.append(path) β
β 197 β β
β 198 β if not data_files: β
β β
β /x/datasets/dat β
β a_files.py:145 in _resolve_single_pattern_locally β
β β
β 142 β β error_msg = f"Unable to find '{pattern}' at {Path(base_path).r β
β 143 β β if allowed_extensions is not None: β
β 144 β β β error_msg += f" with any supported extension {list(allowed β
β β± 145 β β raise FileNotFoundError(error_msg) β
β 146 β return sorted(out) β
β 147
### Steps to reproduce the bug
1. Version=2.3.2
2. In shell, cd workdir.(cd /a/b/c/.d/)
3. load_dataset("json", data_file={"train":"/a/b/c/.d/train/train.json", "test":"/a/b/c/.d/train/test.json"})
### Expected behavior
fix it please~
### Environment info
2.3.2
Version 2.3.2 is over one year old, so please use the latest release (2.14.0) to get the expected behavior. Version 2.3.2 does not contain some fixes we made to fix resolving hidden files/directories (starting with a dot). | [
-1.1433175802230835,
-0.7783908247947693,
-0.4615917205810547,
1.541563630104065,
-0.12804095447063446,
-1.145755648612976,
0.23625068366527557,
-1.0691317319869995,
1.5106480121612549,
-0.679083526134491,
0.15528185665607452,
-1.651146411895752,
0.1933295875787735,
-0.5603920221328735,
-0.6208676099777222,
-1.053862452507019,
-0.6205345392227173,
-0.7658807635307312,
1.09348726272583,
2.3890442848205566,
1.2567107677459717,
-1.467777967453003,
2.71407151222229,
0.6630221009254456,
-0.32925212383270264,
-1.16678786277771,
0.48874497413635254,
0.12257836759090424,
-1.3365892171859741,
-0.3825804591178894,
-1.0062938928604126,
-0.17060339450836182,
-0.561908483505249,
-0.5359331369400024,
0.20034271478652954,
0.5296043753623962,
-0.3364591598510742,
-0.2457859069108963,
-0.6277635097503662,
-0.5660560131072998,
0.44951170682907104,
-0.3514642119407654,
0.9074559807777405,
-0.3101887106895447,
1.7080694437026978,
-0.5107011198997498,
0.3869481086730957,
0.7321131229400635,
1.264194130897522,
0.12276864051818848,
0.12371733784675598,
0.3451119065284729,
0.41155892610549927,
-0.13337759673595428,
0.37628263235092163,
1.2875127792358398,
0.8166098594665527,
0.5201098322868347,
0.6258748769760132,
-2.09464693069458,
1.4442496299743652,
-0.8770517706871033,
0.2390117347240448,
1.441699743270874,
-0.9747591018676758,
0.5405576825141907,
-1.5868300199508667,
0.06191135197877884,
0.6430503129959106,
-2.243256092071533,
0.0989067405462265,
-1.0402852296829224,
-0.3809639811515808,
1.026494026184082,
0.3208196759223938,
-1.1738617420196533,
0.25633251667022705,
-0.5135208964347839,
1.148064136505127,
0.45775026082992554,
1.1292036771774292,
-1.6685996055603027,
0.15321996808052063,
-0.09949716180562973,
0.018862223252654076,
-1.3404655456542969,
-1.5197285413742065,
0.5222591757774353,
0.5584102869033813,
0.6786911487579346,
-0.13523881137371063,
1.0434157848358154,
-1.0787614583969116,
0.7184039950370789,
-0.8524059653282166,
-1.5280561447143555,
-1.408761978149414,
-2.573152780532837,
-2.444333076477051,
0.5967075824737549,
-0.4538167715072632,
-0.5093797445297241,
1.85662043094635,
-0.8497728705406189,
-1.582666277885437,
0.8944393992424011,
0.3601294755935669,
0.11999966204166412,
2.399662733078003,
0.16470561921596527,
-0.8668646812438965,
0.27269142866134644,
-0.7423375844955444,
1.0628502368927002,
-0.4055846929550171,
1.3432120084762573,
0.5139399170875549,
-1.036974549293518,
1.3174030780792236,
-0.3352017402648926,
0.6502768993377686,
-0.6385889649391174,
-0.447820782661438,
-0.8703684210777283,
0.28617793321609497,
1.7869175672531128,
-0.24835705757141113,
1.6415170431137085,
-0.2711486220359802,
-1.5334434509277344,
-1.6444710493087769,
0.757538914680481,
0.47700077295303345,
-0.8036672472953796,
0.1939297318458557,
-0.5385656952857971,
0.02171977050602436,
0.05194485932588577,
1.0807136297225952,
1.2665162086486816,
0.6678640842437744,
-0.47129756212234497,
-0.9703578352928162,
0.09687402099370956,
-0.10762342065572739,
-0.6153995990753174,
-2.041548490524292,
-0.20548857748508453,
0.21375907957553864,
0.6382614374160767,
-1.1194829940795898,
1.677879810333252,
0.8961758613586426,
1.956886649131775,
1.078342318534851,
-0.4309709072113037,
1.6418739557266235,
-0.17875035107135773,
1.7693825960159302,
-0.6981474757194519,
0.43685001134872437,
-0.3197881579399109,
-1.3003079891204834,
0.7966429591178894,
-0.3221362829208374,
-2.1456692218780518,
-0.8797736167907715,
-0.8015998005867004,
-0.19291548430919647,
-0.7700440883636475,
0.865770161151886,
-0.28247523307800293,
-1.4933245182037354,
0.21099765598773956,
-0.46280163526535034,
0.3149711489677429,
-1.141182541847229,
0.3011922240257263,
0.747214674949646,
-0.6051100492477417,
0.02123669721186161,
-0.24250848591327667,
-1.348197102546692,
-0.4234796166419983,
0.4167308211326599,
1.5669726133346558,
-0.5984976291656494,
0.8140704035758972,
1.0542635917663574,
-0.6412621140480042,
0.2891744375228882,
-0.009586799889802933,
-0.229042187333107,
0.655518651008606,
-1.2565163373947144,
-0.3415876030921936,
1.1279326677322388,
-0.42416584491729736,
-0.6543446183204651,
1.385514259338379,
0.8304129838943481,
-1.0727909803390503,
-0.1669137179851532,
-0.11744017153978348,
-1.0445148944854736,
0.05204536393284798,
-1.5248857736587524,
-0.0704551488161087,
0.4480825662612915,
-1.5028314590454102,
-0.39667409658432007,
-0.18994371592998505,
1.2432291507720947,
-0.2104581743478775,
1.3503669500350952,
-0.39599692821502686,
-0.06608541309833527,
-0.4536980986595154,
-0.5834594964981079,
0.24576474726200104,
-0.4135704040527344,
-0.538170576095581,
0.1469910740852356,
-0.7313461899757385,
0.3353419899940491,
1.4100580215454102,
0.23609988391399384,
0.014192285016179085,
0.5951408743858337,
1.279596209526062,
0.5568059086799622,
-0.11970280855894089,
-0.7204248309135437,
-1.6473631858825684,
2.0916872024536133,
-1.3208837509155273,
1.8608697652816772,
0.7782649397850037,
0.061005301773548126,
-1.6451871395111084,
-1.6262160539627075,
1.402302861213684,
1.1460083723068237,
2.457900047302246,
0.5335890054702759,
0.23811788856983185,
-0.7806937098503113,
-0.9453248977661133,
0.3429397940635681,
-1.1159275770187378,
-0.5478407144546509,
0.2851123809814453,
2.534719944000244,
1.949310541152954,
-0.3482514023780823,
-0.1749507337808609,
-0.9969763159751892,
1.304979681968689,
-0.11610117554664612,
0.2106684446334839,
2.0151588916778564,
-0.19469109177589417,
-1.0738472938537598,
1.1781742572784424,
-2.3486201763153076,
0.2039131373167038,
2.0948474407196045,
0.3678209185600281,
0.22964417934417725,
-1.548852562904358,
-0.6873149275779724,
-0.3224978446960449,
-0.5947479605674744,
-1.3556485176086426,
0.5705642700195312,
-0.33264869451522827,
-0.6414815187454224,
-1.5382550954818726,
0.25338464975357056,
-1.2595536708831787,
-1.5855156183242798,
0.2817423343658447,
1.828268051147461,
2.137768268585205,
-0.7069783210754395,
1.444445013999939,
-0.305766224861145,
-0.009374294430017471,
1.0961445569992065,
1.204761266708374,
3.106981039047241,
1.9951032400131226,
-1.2493057250976562,
0.7413613200187683,
-0.24124924838542938,
-0.46821391582489014,
0.9499293565750122,
-1.216483235359192,
1.343974232673645,
-0.08784163743257523,
-1.2857609987258911,
-1.2436312437057495,
1.0754581689834595,
0.4395402669906616,
0.12216851115226746,
-0.51067715883255,
1.3436609506607056,
0.07315748929977417,
1.3736789226531982,
0.5596196055412292,
-0.3214079737663269,
0.4705314636230469,
-0.43935251235961914,
-0.5788266658782959,
1.4587537050247192,
0.26396942138671875,
-1.552086591720581,
-2.0852909088134766,
-0.3645908832550049,
-0.7287089824676514,
-0.03821466118097305,
-0.5663536190986633,
-1.0127445459365845,
1.642125129699707,
0.2909631133079529,
-1.1830052137374878,
-0.3144611716270447,
-0.27922916412353516,
-0.55131596326828,
2.666254997253418,
-1.5155528783798218,
-0.0940343514084816,
-0.9684396982192993,
-0.7453456521034241,
1.5491963624954224,
-0.9892292022705078,
-0.21112388372421265,
-1.0353291034698486,
-0.7220402956008911,
-1.3592267036437988,
-0.4221283197402954,
0.07506430149078369,
-0.8842755556106567,
0.7631292939186096,
0.20649296045303345,
-1.0228667259216309,
-0.2439555525779724,
-0.7342276573181152,
1.1464461088180542,
-0.24067047238349915,
0.1884220540523529,
1.8594881296157837,
0.2790706753730774,
-0.3238869309425354,
0.6429929137229919,
1.1539204120635986,
0.7112482786178589,
-0.7643589973449707,
-0.19378265738487244,
-0.676422119140625,
0.3035382032394409,
-1.2354553937911987,
0.0994625985622406,
-2.8706750869750977,
0.48449188470840454,
-0.18730109930038452,
-0.031015506014227867,
-0.006405661813914776,
-1.3231762647628784,
1.0691449642181396,
2.6920998096466064,
-1.1319478750228882,
0.3323975205421448,
0.5640577077865601,
1.170039415359497,
-1.6410157680511475,
0.26347821950912476,
-0.5299068093299866,
1.98677659034729,
0.2022097259759903,
1.2132554054260254,
-0.7660306692123413,
-2.4524316787719727,
0.46815794706344604,
-1.169437289237976,
-0.9104948043823242,
1.0055075883865356,
-0.791338324546814,
0.22265760600566864,
-1.411291241645813,
-0.3020523190498352,
-0.7435042262077332,
-1.3913887739181519,
0.5947372913360596,
0.18734252452850342,
0.3609260320663452,
-0.5765296220779419,
0.3155902624130249,
-2.1944570541381836,
-1.3039857149124146,
-0.2407706379890442,
-1.0286649465560913,
0.6625748872756958,
-0.5734204649925232,
0.7453221082687378,
-0.06429097056388855,
0.1595127433538437,
0.18426838517189026,
1.4734152555465698,
3.337317705154419,
0.14184607565402985,
0.17400166392326355,
0.00406712107360363,
-0.9108477830886841,
1.480411410331726,
0.811981201171875,
-0.030188869684934616,
-0.7291757464408875,
-0.8830650448799133,
1.2122803926467896,
2.179542064666748,
1.1755459308624268,
0.04145233333110809,
-1.1292487382888794,
-0.7506662607192993,
0.040285561233758926,
0.158619686961174,
0.47708970308303833,
0.843035101890564,
-0.10254251956939697,
-0.046476006507873535,
1.4884443283081055,
1.2684714794158936,
-0.2637357711791992,
0.291645884513855,
-0.7928797006607056,
-0.37819457054138184,
0.5322365164756775,
0.14840327203273773,
0.02584013342857361,
0.5071322321891785,
-0.8614099025726318,
0.07937661558389664,
-0.5567247867584229,
-0.9071635007858276,
-0.6944271326065063,
-0.23519757390022278,
-0.40210866928100586,
1.7205151319503784,
0.23399707674980164,
-0.6193760633468628,
0.2038303017616272,
-0.7198207378387451,
-0.39653801918029785,
-1.0320725440979004,
0.30053263902664185,
-0.16639889776706696,
-0.1066301241517067,
-0.23644204437732697,
1.6797276735305786,
-0.9623817801475525,
-2.219578266143799,
0.12659169733524323,
0.2853855490684509,
-0.3657281994819641,
0.23286819458007812,
1.6883805990219116,
0.48475325107574463,
1.4401965141296387,
1.1803058385849,
1.0496323108673096,
-0.8404018878936768,
-1.451182246208191,
0.738864004611969,
1.0320050716400146,
-1.499177098274231,
0.7836403250694275,
-0.24420768022537231,
-0.4882608652114868,
0.751820981502533,
1.2640191316604614,
0.321163535118103,
-2.2479419708251953,
0.9875538945198059,
-1.0874086618423462,
0.6763171553611755,
0.8771947026252747,
0.5962545871734619,
0.17438547313213348,
0.8081785440444946,
-1.2230339050292969,
-1.0760003328323364,
-0.7916103005409241,
-0.712085485458374,
2.0607950687408447,
-0.3183634877204895,
0.7236906290054321,
0.011688191443681717,
-1.3971452713012695,
0.076260507106781,
0.9382582306861877,
0.2435615509748459,
-0.36490803956985474,
0.9919726848602295,
-0.7913916707038879,
-0.8615766763687134,
-1.4219377040863037,
-0.4839915633201599,
-1.1013176441192627,
-1.1023237705230713,
1.3054687976837158,
0.6583678722381592,
0.5047281980514526,
1.9182929992675781,
0.7027357220649719,
0.3500640392303467,
-2.688772678375244,
0.7826105356216431,
0.12922373414039612,
0.06549215316772461,
0.7710931301116943,
0.336930513381958,
0.9676727652549744,
0.043304845690727234,
0.6863774657249451,
-2.4586102962493896,
2.411024808883667,
-0.10211415588855743,
0.75152987241745,
0.10797251015901566,
-0.20523478090763092,
1.0937721729278564,
0.6026236414909363,
0.631499707698822,
-1.2976142168045044,
0.8627831935882568,
-0.5271161198616028,
1.1068365573883057,
0.7251131534576416,
-0.9243126511573792,
-0.007673596031963825,
1.3238543272018433,
0.2807450294494629,
-0.4557957053184509,
-1.0044291019439697,
-0.9761961698532104,
0.8781264424324036,
1.66201651096344,
-0.07950704544782639,
0.0842033177614212,
0.843238115310669,
0.6616807579994202,
-1.0746686458587646,
0.06840887665748596,
-0.6054403781890869,
-0.5618144869804382,
1.6755293607711792,
2.0790188312530518,
-0.27173298597335815,
-0.0984022319316864,
-0.7967514395713806,
-1.1436957120895386,
0.713197648525238,
0.1316647231578827,
0.17560654878616333,
0.3937453627586365,
-0.8254521489143372,
1.0305428504943848,
0.5680270791053772,
0.814473032951355,
0.0760919377207756,
0.35161101818084717,
0.2987024188041687,
-0.1385045200586319,
-1.1656213998794556,
-0.4565853476524353,
-0.9574110507965088,
-2.5601696968078613,
0.15530288219451904,
-0.25485295057296753,
-1.412194013595581,
-0.024730157107114792,
-1.130873203277588,
0.9278895854949951,
-0.48881757259368896,
-1.1232030391693115,
-1.5784828662872314,
0.40402501821517944,
-0.2380954623222351,
0.8886004686355591,
-1.5127922296524048,
-0.045107483863830566,
1.2100940942764282,
0.7965191006660461,
-0.5530121326446533,
1.2314434051513672,
0.11534908413887024,
0.7141327261924744,
0.8961161971092224,
-0.20220282673835754,
0.5418989062309265,
0.22834594547748566,
-1.2939656972885132,
0.4479972720146179,
0.9857848882675171,
0.15683455765247345,
1.3609352111816406,
-0.51955646276474,
-0.09941422194242477,
0.3347753882408142,
-0.5113646984100342,
-0.43224185705184937,
-0.21581444144248962,
0.722432553768158,
0.16299906373023987,
-1.0638598203659058,
0.13292819261550903,
-0.3386511206626892,
-0.2798316478729248,
0.28675687313079834,
-1.300689935684204,
-0.24062731862068176,
-0.38886260986328125,
-0.3162307143211365,
-1.1751854419708252,
0.11144214123487473,
1.4272269010543823,
-0.5828551054000854,
-0.3786841630935669,
0.5020713210105896,
0.47242677211761475,
0.3290221691131592,
0.7905904650688171,
-0.7142037153244019,
-0.23626011610031128,
-0.27061277627944946,
-0.2725849747657776,
0.476848304271698,
1.2040166854858398,
-0.1277143657207489,
-1.0091992616653442,
0.7460378408432007,
-0.43223297595977783,
0.2143513560295105,
1.961700201034546,
0.15757036209106445,
-0.7968944311141968,
0.41459912061691284,
-0.8995100259780884,
1.7652472257614136,
1.7629393339157104,
1.3692182302474976,
-0.3112437129020691,
-1.065306544303894,
0.6313753128051758,
-0.29776531457901,
-0.4190565347671509,
0.9272786378860474,
0.4106123447418213,
-0.25118929147720337,
-1.3965026140213013,
0.6353812217712402,
1.0999560356140137,
-0.7192436456680298,
-0.5218918323516846,
0.17663757503032684,
-0.8542900085449219,
1.2681912183761597,
0.6809509992599487,
0.33513057231903076,
0.13550065457820892,
1.7892346382141113,
0.6981214880943298,
-0.5039399266242981,
0.6054010987281799,
0.5003448128700256,
-0.2676057815551758,
-2.0021235942840576,
-1.152093529701233,
0.2478000968694687,
-0.5713932514190674,
-1.5664281845092773,
1.3606148958206177,
-1.1475647687911987,
-1.0497124195098877,
0.5118897557258606,
-0.012194463051855564,
1.5253021717071533,
0.2504274249076843,
1.5945394039154053,
2.1460132598876953,
0.9340925216674805,
0.3070904016494751,
1.1874146461486816,
-0.13101842999458313,
-0.5576328635215759,
1.7492690086364746,
-0.45812803506851196,
0.2247925102710724,
1.0681493282318115,
-0.5431468486785889,
-1.0343596935272217,
-0.7031842470169067,
-1.008721113204956,
-0.5230446457862854,
1.127942442893982,
0.10865213721990585,
-1.2215286493301392,
0.3369004726409912,
1.5673261880874634,
0.011310841888189316,
-0.3086159825325012,
0.506329357624054,
0.5927850604057312,
-0.6528418064117432,
-0.1270540952682495,
-0.8835152983665466,
0.5534780621528625,
-0.2941610813140869,
-0.3307110667228699,
0.20182429254055023,
0.4331904649734497,
1.1124227046966553,
0.03334036469459534,
0.18816298246383667,
0.9872859120368958,
-1.3866702318191528,
1.515976905822754,
-0.6306281089782715,
0.15975338220596313,
-2.378561496734619,
1.3921093940734863,
-0.5997638702392578,
2.0728824138641357,
-2.4903101921081543,
0.41078436374664307,
-0.6605671644210815,
-0.4749909043312073,
0.48241734504699707,
-0.4731101393699646,
0.19991977512836456,
-0.23205851018428802,
-0.9948724508285522,
-0.1485261619091034,
-0.7073491811752319,
0.78602534532547,
1.037140965461731,
1.422731637954712,
-1.0866812467575073,
-0.37359994649887085,
-1.5690418481826782,
-0.27232837677001953,
-0.785255491733551,
0.36757510900497437,
-1.9513739347457886,
-0.2692149877548218,
-1.9282747507095337,
-2.3926422595977783,
-1.577901840209961,
-0.6960098147392273,
0.8603370785713196,
0.3509608507156372,
-0.8609230518341064,
1.2512965202331543,
-0.22122547030448914,
-1.8396207094192505,
1.198357343673706,
-2.0146214962005615
] |
https://github.com/huggingface/datasets/issues/6071 | storage_options provided to load_dataset not fully piping through since datasets 2.14.0 | Hi ! Thanks for reporting, I opened a PR to fix this
What filesystem are you using ? | ### Describe the bug
Since the latest release of `datasets` (`2.14.0`), custom filesystem `storage_options` passed to `load_dataset()` do not seem to propagate through all the way - leading to problems if loading data files that need those options to be set.
I think this is because of the new `_prepare_path_and_storage_options()` (https://github.com/huggingface/datasets/pull/6028), which returns the right `storage_options` to use given a path and a `DownloadConfig` - but which might not be taking into account the extra `storage_options` explicitly provided e.g. through `load_dataset()`
### Steps to reproduce the bug
```python
import fsspec
import pandas as pd
import datasets
# Generate mock parquet file
data_files = "demo.parquet"
pd.DataFrame({"A": [1, 2, 3], "B": [4, 5, 6]}).to_parquet(data_files)
_storage_options = {"x": 1, "y": 2}
fs = fsspec.filesystem("file", **_storage_options)
dataset = datasets.load_dataset(
"parquet",
data_files=data_files,
storage_options=fs.storage_options
)
```
Looking at the `storage_options` resolved here:
https://github.com/huggingface/datasets/blob/b0177910b32712f28d147879395e511207e39958/src/datasets/data_files.py#L331
they end up being `{}`, instead of propagating through the `storage_options` that were provided to `load_dataset` (`fs.storage_options`). As these then get used for the filesystem operation a few lines below
https://github.com/huggingface/datasets/blob/b0177910b32712f28d147879395e511207e39958/src/datasets/data_files.py#L339
the call will fail if the user-provided `storage_options` were needed.
---
A temporary workaround that seemed to work locally to bypass the problem was to bundle a duplicate of the `storage_options` into the `download_config`, so that they make their way all the way to `_prepare_path_and_storage_options()` and get extracted correctly:
```python
dataset = datasets.load_dataset(
"parquet",
data_files=data_files,
storage_options=fs.storage_options,
download_config=datasets.DownloadConfig(storage_options={fs.protocol: fs.storage_options}),
)
```
### Expected behavior
`storage_options` provided to `load_dataset` take effect in all backend filesystem operations.
### Environment info
datasets==2.14.0 | 50 | 18 | storage_options provided to load_dataset not fully piping through since datasets 2.14.0
### Describe the bug
Since the latest release of `datasets` (`2.14.0`), custom filesystem `storage_options` passed to `load_dataset()` do not seem to propagate through all the way - leading to problems if loading data files that need those options to be set.
I think this is because of the new `_prepare_path_and_storage_options()` (https://github.com/huggingface/datasets/pull/6028), which returns the right `storage_options` to use given a path and a `DownloadConfig` - but which might not be taking into account the extra `storage_options` explicitly provided e.g. through `load_dataset()`
### Steps to reproduce the bug
```python
import fsspec
import pandas as pd
import datasets
# Generate mock parquet file
data_files = "demo.parquet"
pd.DataFrame({"A": [1, 2, 3], "B": [4, 5, 6]}).to_parquet(data_files)
_storage_options = {"x": 1, "y": 2}
fs = fsspec.filesystem("file", **_storage_options)
dataset = datasets.load_dataset(
"parquet",
data_files=data_files,
storage_options=fs.storage_options
)
```
Looking at the `storage_options` resolved here:
https://github.com/huggingface/datasets/blob/b0177910b32712f28d147879395e511207e39958/src/datasets/data_files.py#L331
they end up being `{}`, instead of propagating through the `storage_options` that were provided to `load_dataset` (`fs.storage_options`). As these then get used for the filesystem operation a few lines below
https://github.com/huggingface/datasets/blob/b0177910b32712f28d147879395e511207e39958/src/datasets/data_files.py#L339
the call will fail if the user-provided `storage_options` were needed.
---
A temporary workaround that seemed to work locally to bypass the problem was to bundle a duplicate of the `storage_options` into the `download_config`, so that they make their way all the way to `_prepare_path_and_storage_options()` and get extracted correctly:
```python
dataset = datasets.load_dataset(
"parquet",
data_files=data_files,
storage_options=fs.storage_options,
download_config=datasets.DownloadConfig(storage_options={fs.protocol: fs.storage_options}),
)
```
### Expected behavior
`storage_options` provided to `load_dataset` take effect in all backend filesystem operations.
### Environment info
datasets==2.14.0
Hi ! Thanks for reporting, I opened a PR to fix this
What filesystem are you using ? | [
-1.1659444570541382,
-0.9065359830856323,
-0.6957008242607117,
1.4630454778671265,
-0.13110680878162384,
-1.281360149383545,
0.20910535752773285,
-1.0998634099960327,
1.6670114994049072,
-0.7348120808601379,
0.32562580704689026,
-1.6995145082473755,
0.009933054447174072,
-0.5755549073219299,
-0.7451911568641663,
-0.9200152158737183,
-0.43503010272979736,
-0.7541061043739319,
1.0239232778549194,
2.453195095062256,
1.23199462890625,
-1.3070883750915527,
2.6642022132873535,
0.6743002533912659,
-0.18457183241844177,
-0.9068794250488281,
0.49959325790405273,
0.0038649076595902443,
-1.2505183219909668,
-0.41628387570381165,
-0.8664965033531189,
-0.04657691717147827,
-0.5585222840309143,
-0.5525901317596436,
0.03248471021652222,
0.504227876663208,
-0.35440266132354736,
-0.42747053503990173,
-0.6089617609977722,
-0.8098547458648682,
0.4605863094329834,
-0.33858656883239746,
0.992914617061615,
-0.37326741218566895,
1.8431464433670044,
-0.6006283760070801,
0.46683046221733093,
0.6919424533843994,
1.3278636932373047,
0.1773744523525238,
0.045737698674201965,
0.3241492509841919,
0.34342798590660095,
-0.012814627960324287,
0.5123123526573181,
1.2105752229690552,
0.5993126630783081,
0.5271919369697571,
0.7502551078796387,
-2.240077495574951,
1.2622952461242676,
-1.0845729112625122,
0.2705574631690979,
1.3651924133300781,
-0.910332202911377,
0.3409532308578491,
-1.7276322841644287,
-0.04535721242427826,
0.5455270409584045,
-2.254694700241089,
0.26688018441200256,
-1.2992721796035767,
-0.48834332823753357,
1.0284085273742676,
0.37189337611198425,
-1.174432396888733,
0.2456711083650589,
-0.4405626952648163,
1.0781258344650269,
0.5000813007354736,
1.0946893692016602,
-1.6843466758728027,
-0.029793785884976387,
-0.2525196075439453,
0.09944877028465271,
-1.3129738569259644,
-1.5927908420562744,
0.5589654445648193,
0.6617507934570312,
0.5856059193611145,
-0.17196625471115112,
1.115208625793457,
-0.9909725189208984,
0.8020501136779785,
-1.0491693019866943,
-1.6829742193222046,
-1.4587209224700928,
-2.205605983734131,
-2.3218536376953125,
0.7261097431182861,
-0.5322562456130981,
-0.45678946375846863,
1.9947561025619507,
-0.9500797986984253,
-1.7153191566467285,
1.0625313520431519,
0.30063700675964355,
-0.0328979417681694,
2.289769411087036,
0.2519615888595581,
-0.6645237803459167,
0.45266109704971313,
-0.7515698075294495,
0.7564963102340698,
-0.3518557548522949,
1.3556276559829712,
0.49079805612564087,
-1.132424235343933,
1.5306822061538696,
-0.3789393901824951,
0.6335734128952026,
-0.6971195340156555,
-0.5842567682266235,
-0.7484245300292969,
0.2985270619392395,
1.9265210628509521,
-0.41254404187202454,
1.5414592027664185,
-0.3853899836540222,
-1.5460841655731201,
-1.6298134326934814,
0.9595213532447815,
0.44337210059165955,
-0.7202876806259155,
0.025889446958899498,
-0.394571453332901,
0.13117335736751556,
-0.1374489963054657,
1.2061680555343628,
1.2380439043045044,
0.6730911731719971,
-0.391326367855072,
-0.731009840965271,
0.14833422005176544,
-0.005659333895891905,
-0.6629981398582458,
-1.7539516687393188,
-0.3439052104949951,
0.19783498346805573,
0.5510625839233398,
-1.0953834056854248,
1.8166368007659912,
0.8690539002418518,
1.8995517492294312,
0.994767963886261,
-0.34485822916030884,
1.4661674499511719,
0.03795657306909561,
1.9019769430160522,
-0.5437359809875488,
0.5796456933021545,
-0.32919102907180786,
-1.2047570943832397,
0.9214071035385132,
-0.29899701476097107,
-2.1089189052581787,
-0.7046936750411987,
-0.813073456287384,
-0.21218019723892212,
-0.755550742149353,
0.8620915412902832,
-0.22855456173419952,
-1.4689557552337646,
0.09902960807085037,
-0.6323341727256775,
0.1399742066860199,
-1.1999032497406006,
0.2920125424861908,
0.772793710231781,
-0.7065248489379883,
0.03970305621623993,
-0.1690216362476349,
-1.1956127882003784,
-0.46341216564178467,
0.3694198727607727,
1.8753459453582764,
-0.7057629227638245,
0.9241506457328796,
1.1458568572998047,
-0.7819828987121582,
0.12021348625421524,
0.23232918977737427,
-0.30092868208885193,
0.8015387654304504,
-1.0967674255371094,
-0.38520926237106323,
1.2248108386993408,
-0.24267488718032837,
-0.6285050511360168,
1.4273148775100708,
0.724476158618927,
-1.0684599876403809,
-0.1536722034215927,
-0.15164080262184143,
-0.799889087677002,
0.04558263719081879,
-1.512658953666687,
-0.07650280743837357,
0.4050140678882599,
-1.5151702165603638,
-0.5061731934547424,
-0.25800442695617676,
1.2705963850021362,
-0.23596903681755066,
1.397020697593689,
-0.26413214206695557,
-0.20013462007045746,
-0.37594708800315857,
-0.44043657183647156,
0.14414598047733307,
-0.17091548442840576,
-0.5875096917152405,
0.1945618987083435,
-0.7864773869514465,
0.37010660767555237,
1.4518218040466309,
0.31364038586616516,
0.024714047089219093,
0.4891687333583832,
1.0774530172348022,
0.363523930311203,
-0.08687260746955872,
-0.8739595413208008,
-1.5523496866226196,
2.0007903575897217,
-1.3794522285461426,
1.974825143814087,
0.6670129895210266,
0.025786155834794044,
-1.7979024648666382,
-1.899811863899231,
1.384104609489441,
1.095834493637085,
2.364382266998291,
0.4770861566066742,
0.35969114303588867,
-0.8028115034103394,
-0.6933995485305786,
0.3817480802536011,
-1.0112099647521973,
-0.5707550644874573,
0.1626095175743103,
2.3748512268066406,
1.707842230796814,
-0.5465307831764221,
-0.2677600681781769,
-1.027725338935852,
1.374840259552002,
-0.22947344183921814,
0.2897781729698181,
1.977952241897583,
-0.26696860790252686,
-1.020434021949768,
1.328355073928833,
-2.387859582901001,
0.17654123902320862,
2.032555341720581,
0.2041524350643158,
0.14475350081920624,
-1.4061031341552734,
-0.598484456539154,
-0.33144354820251465,
-0.4287770688533783,
-1.2413862943649292,
0.46713709831237793,
-0.23353911936283112,
-0.7271428108215332,
-1.4437813758850098,
0.18188831210136414,
-1.183809757232666,
-1.7061208486557007,
0.25195109844207764,
1.9295107126235962,
1.9278875589370728,
-0.7214611768722534,
1.5528326034545898,
-0.34706705808639526,
0.0832754597067833,
1.3078075647354126,
1.3343238830566406,
3.1176092624664307,
1.8248577117919922,
-1.2817999124526978,
0.7030459046363831,
-0.21133026480674744,
-0.458996057510376,
1.2748608589172363,
-1.0636005401611328,
1.3398953676223755,
-0.1708829700946808,
-1.2102687358856201,
-1.3065028190612793,
1.008804440498352,
0.5318331718444824,
0.12083750218153,
-0.4757803976535797,
1.1526740789413452,
0.1457667201757431,
1.2701038122177124,
0.5914827585220337,
-0.40570950508117676,
0.6430833339691162,
-0.3056570291519165,
-0.4957660734653473,
1.4759371280670166,
0.2370975911617279,
-1.4398397207260132,
-2.2635772228240967,
-0.22832264006137848,
-0.9071337580680847,
0.001186273992061615,
-0.6397691965103149,
-1.0023554563522339,
1.671995997428894,
0.39584609866142273,
-1.2819496393203735,
-0.1898452490568161,
-0.3151082396507263,
-0.47800183296203613,
2.734839916229248,
-1.3960649967193604,
-0.1712919920682907,
-0.9812588691711426,
-0.6444106698036194,
1.6382824182510376,
-1.1913998126983643,
-0.2510741055011749,
-0.9799677729606628,
-0.5899319052696228,
-1.2991440296173096,
-0.5286481976509094,
0.07262293249368668,
-0.9515824317932129,
0.8154093027114868,
0.11915012449026108,
-1.205686330795288,
-0.3680833876132965,
-0.9034455418586731,
1.025889277458191,
-0.19231121242046356,
0.22252126038074493,
1.9029502868652344,
0.4124053716659546,
-0.38936537504196167,
0.7977638244628906,
1.1564440727233887,
0.6401094794273376,
-0.5912079811096191,
0.24278099834918976,
-0.6878613829612732,
0.23821213841438293,
-1.3615827560424805,
0.2932981848716736,
-2.8583998680114746,
0.5517027974128723,
-0.12527361512184143,
-0.04030260443687439,
0.028177442029118538,
-1.39271879196167,
1.042787790298462,
2.5953269004821777,
-1.2930599451065063,
0.3915897309780121,
0.3905852437019348,
1.1412888765335083,
-1.5681121349334717,
0.2747720181941986,
-0.3796505928039551,
2.030090808868408,
0.20766893029212952,
1.153303861618042,
-0.4855456054210663,
-2.1924357414245605,
0.5027154684066772,
-1.2824504375457764,
-1.2146724462509155,
0.7873144745826721,
-0.8596058487892151,
0.14548464119434357,
-1.4663569927215576,
-0.20848631858825684,
-0.8794965147972107,
-1.253631591796875,
0.7510566115379333,
0.06530851125717163,
0.4243695139884949,
-0.5898420810699463,
0.37910979986190796,
-2.1178629398345947,
-1.3164793252944946,
-0.25526246428489685,
-0.9115816354751587,
0.5455475449562073,
-0.3677777945995331,
0.6892713904380798,
-0.16263198852539062,
-0.0028033237904310226,
0.31784290075302124,
1.5145665407180786,
3.4831032752990723,
0.2098855972290039,
0.2480395883321762,
-0.16798388957977295,
-0.935395359992981,
1.487107276916504,
0.9539108872413635,
-0.1236734390258789,
-0.5559866428375244,
-1.0075582265853882,
1.2813113927841187,
1.9907664060592651,
1.15608811378479,
-0.03986826911568642,
-0.9014610648155212,
-0.817849338054657,
-0.03185732662677765,
0.14874300360679626,
0.4611777067184448,
0.8715522885322571,
0.10374505072832108,
0.05302125960588455,
1.3503665924072266,
1.2176110744476318,
-0.42779740691185,
0.3557065427303314,
-0.899099588394165,
-0.3959008455276489,
0.5744760036468506,
0.25054028630256653,
0.09250535070896149,
0.43459779024124146,
-1.0159388780593872,
-0.2417445182800293,
-0.47418212890625,
-0.9160240888595581,
-0.7224249839782715,
-0.4787653982639313,
-0.42400723695755005,
1.6043486595153809,
0.0728839561343193,
-0.5015122890472412,
-0.06620363146066666,
-0.7358689904212952,
-0.1944359689950943,
-1.0472192764282227,
0.26845693588256836,
-0.1461620330810547,
-0.1460549682378769,
-0.13537980616092682,
1.6183832883834839,
-1.0031733512878418,
-2.0411291122436523,
0.23090262711048126,
0.20048491656780243,
-0.3996144235134125,
0.21970972418785095,
1.6511530876159668,
0.5175144672393799,
1.4042056798934937,
1.3308229446411133,
0.9740248918533325,
-0.667956531047821,
-1.2452298402786255,
0.69199138879776,
0.9468201994895935,
-1.4579946994781494,
0.8173915147781372,
-0.03469642251729965,
-0.446915864944458,
0.6569933295249939,
1.2352854013442993,
0.45166608691215515,
-2.0259389877319336,
0.7815128564834595,
-0.9302851557731628,
0.7979668974876404,
0.7388179898262024,
0.730725109577179,
0.20356160402297974,
0.8728812336921692,
-1.1850067377090454,
-1.1212669610977173,
-0.6855574250221252,
-0.655264139175415,
1.8890734910964966,
-0.22799018025398254,
0.6525946259498596,
-0.19594375789165497,
-1.304029941558838,
-0.15484820306301117,
0.7482708692550659,
0.4177018105983734,
-0.5940617918968201,
0.8103805184364319,
-0.6660152077674866,
-0.9217057824134827,
-1.292639970779419,
-0.5282645225524902,
-1.1177271604537964,
-0.9321832060813904,
1.0173627138137817,
0.7932915091514587,
0.43345242738723755,
1.8398768901824951,
0.5848815441131592,
0.35625994205474854,
-2.7195210456848145,
0.8968212008476257,
0.28531166911125183,
-0.061417579650878906,
0.9064162969589233,
0.3370179831981659,
1.0320343971252441,
-0.05626261234283447,
0.6621289849281311,
-2.4159159660339355,
2.2729015350341797,
-0.15256449580192566,
0.6232372522354126,
-0.028093533590435982,
-0.2285543829202652,
1.1116464138031006,
0.5341112613677979,
0.45356905460357666,
-1.2126977443695068,
0.6719018220901489,
-0.5719404220581055,
1.1215133666992188,
0.8686313629150391,
-0.934180498123169,
0.009725257754325867,
1.3997339010238647,
0.5119024515151978,
-0.4996368885040283,
-0.899520993232727,
-0.9267265796661377,
0.9751957058906555,
1.6305243968963623,
-0.0377398282289505,
-0.06614959239959717,
0.9444680213928223,
0.6707217693328857,
-1.31620454788208,
0.19969692826271057,
-0.6704657673835754,
-0.6219049692153931,
1.6310195922851562,
1.9442778825759888,
-0.14044985175132751,
-0.1457175612449646,
-0.7055753469467163,
-1.1581250429153442,
0.718142032623291,
-0.0008985651656985283,
0.09508417546749115,
0.5417567491531372,
-0.6869722604751587,
1.099092960357666,
0.7936714291572571,
0.8916754722595215,
0.08954229205846786,
0.34973499178886414,
0.437507301568985,
-0.35590097308158875,
-1.145658016204834,
-0.33786681294441223,
-0.9916418790817261,
-2.610077142715454,
0.45289039611816406,
-0.2689560651779175,
-1.398077368736267,
-0.007469642907381058,
-1.0733177661895752,
0.9359637498855591,
-0.5965688824653625,
-1.1644197702407837,
-1.528243899345398,
0.23294098675251007,
0.005835957825183868,
0.9094350337982178,
-1.6343932151794434,
-0.13653336465358734,
1.1883940696716309,
0.8344906568527222,
-0.6359217166900635,
0.9947804808616638,
0.25479233264923096,
1.0168408155441284,
0.8403633832931519,
-0.3272295892238617,
0.5627529621124268,
0.08574262261390686,
-1.3486449718475342,
0.4697081446647644,
1.1918083429336548,
0.1640777438879013,
1.4351757764816284,
-0.5402096509933472,
0.11228649318218231,
0.39763614535331726,
-0.6609447002410889,
-0.5366637110710144,
-0.5396837592124939,
0.6603932976722717,
0.050245434045791626,
-0.9107567667961121,
-0.03789350390434265,
-0.049345336854457855,
-0.2406558096408844,
0.17683643102645874,
-1.5471128225326538,
-0.18781663477420807,
-0.3569713532924652,
-0.6054807901382446,
-1.2222133874893188,
-0.07798094302415848,
1.367732286453247,
-0.7083908319473267,
-0.25631505250930786,
0.5318053960800171,
0.33084192872047424,
0.49062880873680115,
0.594615638256073,
-0.6740756630897522,
-0.269922137260437,
-0.3152434229850769,
-0.36370253562927246,
0.3281751871109009,
1.3093757629394531,
-0.10295296460390091,
-0.9574870467185974,
0.7779077291488647,
-0.41320642828941345,
0.08533038198947906,
1.9537694454193115,
0.07878176122903824,
-0.768172562122345,
0.2830248475074768,
-0.6793204545974731,
1.899658441543579,
1.8147624731063843,
1.3691688776016235,
-0.10532976686954498,
-0.9598008990287781,
0.6253536939620972,
-0.33103129267692566,
-0.39735063910484314,
0.9374682903289795,
0.35365918278694153,
-0.2552782893180847,
-1.4027831554412842,
0.7283390760421753,
1.3477168083190918,
-0.9155437350273132,
-0.7710607051849365,
0.1465439647436142,
-0.8171024918556213,
1.1221683025360107,
0.5668977499008179,
0.2623887062072754,
0.2752506136894226,
1.6065400838851929,
0.7101918458938599,
-0.3682466447353363,
0.5762532949447632,
0.5033949613571167,
-0.11668884754180908,
-2.13289475440979,
-1.1726548671722412,
0.3940025269985199,
-0.5026237964630127,
-1.585331678390503,
1.3990757465362549,
-1.178464651107788,
-0.9792534708976746,
0.5608131885528564,
0.10059190541505814,
1.4739996194839478,
0.34115394949913025,
1.6442025899887085,
2.1229586601257324,
0.8614073991775513,
0.35849449038505554,
1.265771508216858,
-0.05860266089439392,
-0.45911476016044617,
1.8212453126907349,
-0.4481126666069031,
0.4862403869628906,
1.1493501663208008,
-0.34524521231651306,
-1.0472899675369263,
-0.7610039114952087,
-1.2819362878799438,
-0.670264720916748,
1.2022149562835693,
0.05027692764997482,
-1.0654053688049316,
0.2449089139699936,
1.6048229932785034,
0.056260883808135986,
-0.26802605390548706,
0.7347186207771301,
0.4120410978794098,
-0.8554090261459351,
-0.07160887867212296,
-0.8878272771835327,
0.5381397008895874,
-0.23398900032043457,
-0.37377306818962097,
0.30727246403694153,
0.4400062561035156,
1.3004765510559082,
-0.032250382006168365,
0.1393595039844513,
1.1478779315948486,
-1.4798457622528076,
1.5176715850830078,
-0.6818855404853821,
0.3232724666595459,
-2.448801279067993,
1.4098483324050903,
-0.7823773622512817,
1.946903109550476,
-2.535391330718994,
0.4673408567905426,
-0.5887161493301392,
-0.4577425718307495,
0.3067832291126251,
-0.37477609515190125,
0.07786431908607483,
-0.10048908740282059,
-1.138213038444519,
-0.018845658749341965,
-0.738040030002594,
0.6975334882736206,
1.1397093534469604,
1.430039882659912,
-1.1569777727127075,
-0.33779826760292053,
-1.7666417360305786,
-0.08965975046157837,
-0.640928328037262,
0.36095330119132996,
-1.943764567375183,
-0.1309843808412552,
-1.9216758012771606,
-2.4445579051971436,
-1.2921476364135742,
-0.7554457187652588,
1.0445443391799927,
0.06755390018224716,
-0.8661673665046692,
1.249424934387207,
-0.37920618057250977,
-1.8679145574569702,
1.1118818521499634,
-2.196014881134033
] |
https://github.com/huggingface/datasets/issues/6071 | storage_options provided to load_dataset not fully piping through since datasets 2.14.0 | Hi @lhoestq ! Thank you so much π
It's a bit of a custom setup, but in practice I am using a [pyarrow.fs.S3FileSystem](https://arrow.apache.org/docs/python/generated/pyarrow.fs.S3FileSystem.html) (wrapped in a `fsspec.implementations.arrow.ArrowFSWrapper` [to make it](https://arrow.apache.org/docs/python/filesystems.html#using-arrow-filesystems-with-fsspec) `fsspec` compatible). I also register it as an entrypoint with `fsspec` so that it's the one that gets automatically resolved when looking for filesystems for the `s3` protocol
In my case the `storage_option` that seemed not getting piped through was the filesystem's `endpoint_override` that I use in some tests to point at a mock S3 bucket | ### Describe the bug
Since the latest release of `datasets` (`2.14.0`), custom filesystem `storage_options` passed to `load_dataset()` do not seem to propagate through all the way - leading to problems if loading data files that need those options to be set.
I think this is because of the new `_prepare_path_and_storage_options()` (https://github.com/huggingface/datasets/pull/6028), which returns the right `storage_options` to use given a path and a `DownloadConfig` - but which might not be taking into account the extra `storage_options` explicitly provided e.g. through `load_dataset()`
### Steps to reproduce the bug
```python
import fsspec
import pandas as pd
import datasets
# Generate mock parquet file
data_files = "demo.parquet"
pd.DataFrame({"A": [1, 2, 3], "B": [4, 5, 6]}).to_parquet(data_files)
_storage_options = {"x": 1, "y": 2}
fs = fsspec.filesystem("file", **_storage_options)
dataset = datasets.load_dataset(
"parquet",
data_files=data_files,
storage_options=fs.storage_options
)
```
Looking at the `storage_options` resolved here:
https://github.com/huggingface/datasets/blob/b0177910b32712f28d147879395e511207e39958/src/datasets/data_files.py#L331
they end up being `{}`, instead of propagating through the `storage_options` that were provided to `load_dataset` (`fs.storage_options`). As these then get used for the filesystem operation a few lines below
https://github.com/huggingface/datasets/blob/b0177910b32712f28d147879395e511207e39958/src/datasets/data_files.py#L339
the call will fail if the user-provided `storage_options` were needed.
---
A temporary workaround that seemed to work locally to bypass the problem was to bundle a duplicate of the `storage_options` into the `download_config`, so that they make their way all the way to `_prepare_path_and_storage_options()` and get extracted correctly:
```python
dataset = datasets.load_dataset(
"parquet",
data_files=data_files,
storage_options=fs.storage_options,
download_config=datasets.DownloadConfig(storage_options={fs.protocol: fs.storage_options}),
)
```
### Expected behavior
`storage_options` provided to `load_dataset` take effect in all backend filesystem operations.
### Environment info
datasets==2.14.0 | 50 | 86 | storage_options provided to load_dataset not fully piping through since datasets 2.14.0
### Describe the bug
Since the latest release of `datasets` (`2.14.0`), custom filesystem `storage_options` passed to `load_dataset()` do not seem to propagate through all the way - leading to problems if loading data files that need those options to be set.
I think this is because of the new `_prepare_path_and_storage_options()` (https://github.com/huggingface/datasets/pull/6028), which returns the right `storage_options` to use given a path and a `DownloadConfig` - but which might not be taking into account the extra `storage_options` explicitly provided e.g. through `load_dataset()`
### Steps to reproduce the bug
```python
import fsspec
import pandas as pd
import datasets
# Generate mock parquet file
data_files = "demo.parquet"
pd.DataFrame({"A": [1, 2, 3], "B": [4, 5, 6]}).to_parquet(data_files)
_storage_options = {"x": 1, "y": 2}
fs = fsspec.filesystem("file", **_storage_options)
dataset = datasets.load_dataset(
"parquet",
data_files=data_files,
storage_options=fs.storage_options
)
```
Looking at the `storage_options` resolved here:
https://github.com/huggingface/datasets/blob/b0177910b32712f28d147879395e511207e39958/src/datasets/data_files.py#L331
they end up being `{}`, instead of propagating through the `storage_options` that were provided to `load_dataset` (`fs.storage_options`). As these then get used for the filesystem operation a few lines below
https://github.com/huggingface/datasets/blob/b0177910b32712f28d147879395e511207e39958/src/datasets/data_files.py#L339
the call will fail if the user-provided `storage_options` were needed.
---
A temporary workaround that seemed to work locally to bypass the problem was to bundle a duplicate of the `storage_options` into the `download_config`, so that they make their way all the way to `_prepare_path_and_storage_options()` and get extracted correctly:
```python
dataset = datasets.load_dataset(
"parquet",
data_files=data_files,
storage_options=fs.storage_options,
download_config=datasets.DownloadConfig(storage_options={fs.protocol: fs.storage_options}),
)
```
### Expected behavior
`storage_options` provided to `load_dataset` take effect in all backend filesystem operations.
### Environment info
datasets==2.14.0
Hi @lhoestq ! Thank you so much π
It's a bit of a custom setup, but in practice I am using a [pyarrow.fs.S3FileSystem](https://arrow.apache.org/docs/python/generated/pyarrow.fs.S3FileSystem.html) (wrapped in a `fsspec.implementations.arrow.ArrowFSWrapper` [to make it](https://arrow.apache.org/docs/python/filesystems.html#using-arrow-filesystems-with-fsspec) `fsspec` compatible). I also register it as an entrypoint with `fsspec` so that it's the one that gets automatically resolved when looking for filesystems for the `s3` protocol
In my case the `storage_option` that seemed not getting piped through was the filesystem's `endpoint_override` that I use in some tests to point at a mock S3 bucket | [
-1.1659444570541382,
-0.9065359830856323,
-0.6957008242607117,
1.4630454778671265,
-0.13110680878162384,
-1.281360149383545,
0.20910535752773285,
-1.0998634099960327,
1.6670114994049072,
-0.7348120808601379,
0.32562580704689026,
-1.6995145082473755,
0.009933054447174072,
-0.5755549073219299,
-0.7451911568641663,
-0.9200152158737183,
-0.43503010272979736,
-0.7541061043739319,
1.0239232778549194,
2.453195095062256,
1.23199462890625,
-1.3070883750915527,
2.6642022132873535,
0.6743002533912659,
-0.18457183241844177,
-0.9068794250488281,
0.49959325790405273,
0.0038649076595902443,
-1.2505183219909668,
-0.41628387570381165,
-0.8664965033531189,
-0.04657691717147827,
-0.5585222840309143,
-0.5525901317596436,
0.03248471021652222,
0.504227876663208,
-0.35440266132354736,
-0.42747053503990173,
-0.6089617609977722,
-0.8098547458648682,
0.4605863094329834,
-0.33858656883239746,
0.992914617061615,
-0.37326741218566895,
1.8431464433670044,
-0.6006283760070801,
0.46683046221733093,
0.6919424533843994,
1.3278636932373047,
0.1773744523525238,
0.045737698674201965,
0.3241492509841919,
0.34342798590660095,
-0.012814627960324287,
0.5123123526573181,
1.2105752229690552,
0.5993126630783081,
0.5271919369697571,
0.7502551078796387,
-2.240077495574951,
1.2622952461242676,
-1.0845729112625122,
0.2705574631690979,
1.3651924133300781,
-0.910332202911377,
0.3409532308578491,
-1.7276322841644287,
-0.04535721242427826,
0.5455270409584045,
-2.254694700241089,
0.26688018441200256,
-1.2992721796035767,
-0.48834332823753357,
1.0284085273742676,
0.37189337611198425,
-1.174432396888733,
0.2456711083650589,
-0.4405626952648163,
1.0781258344650269,
0.5000813007354736,
1.0946893692016602,
-1.6843466758728027,
-0.029793785884976387,
-0.2525196075439453,
0.09944877028465271,
-1.3129738569259644,
-1.5927908420562744,
0.5589654445648193,
0.6617507934570312,
0.5856059193611145,
-0.17196625471115112,
1.115208625793457,
-0.9909725189208984,
0.8020501136779785,
-1.0491693019866943,
-1.6829742193222046,
-1.4587209224700928,
-2.205605983734131,
-2.3218536376953125,
0.7261097431182861,
-0.5322562456130981,
-0.45678946375846863,
1.9947561025619507,
-0.9500797986984253,
-1.7153191566467285,
1.0625313520431519,
0.30063700675964355,
-0.0328979417681694,
2.289769411087036,
0.2519615888595581,
-0.6645237803459167,
0.45266109704971313,
-0.7515698075294495,
0.7564963102340698,
-0.3518557548522949,
1.3556276559829712,
0.49079805612564087,
-1.132424235343933,
1.5306822061538696,
-0.3789393901824951,
0.6335734128952026,
-0.6971195340156555,
-0.5842567682266235,
-0.7484245300292969,
0.2985270619392395,
1.9265210628509521,
-0.41254404187202454,
1.5414592027664185,
-0.3853899836540222,
-1.5460841655731201,
-1.6298134326934814,
0.9595213532447815,
0.44337210059165955,
-0.7202876806259155,
0.025889446958899498,
-0.394571453332901,
0.13117335736751556,
-0.1374489963054657,
1.2061680555343628,
1.2380439043045044,
0.6730911731719971,
-0.391326367855072,
-0.731009840965271,
0.14833422005176544,
-0.005659333895891905,
-0.6629981398582458,
-1.7539516687393188,
-0.3439052104949951,
0.19783498346805573,
0.5510625839233398,
-1.0953834056854248,
1.8166368007659912,
0.8690539002418518,
1.8995517492294312,
0.994767963886261,
-0.34485822916030884,
1.4661674499511719,
0.03795657306909561,
1.9019769430160522,
-0.5437359809875488,
0.5796456933021545,
-0.32919102907180786,
-1.2047570943832397,
0.9214071035385132,
-0.29899701476097107,
-2.1089189052581787,
-0.7046936750411987,
-0.813073456287384,
-0.21218019723892212,
-0.755550742149353,
0.8620915412902832,
-0.22855456173419952,
-1.4689557552337646,
0.09902960807085037,
-0.6323341727256775,
0.1399742066860199,
-1.1999032497406006,
0.2920125424861908,
0.772793710231781,
-0.7065248489379883,
0.03970305621623993,
-0.1690216362476349,
-1.1956127882003784,
-0.46341216564178467,
0.3694198727607727,
1.8753459453582764,
-0.7057629227638245,
0.9241506457328796,
1.1458568572998047,
-0.7819828987121582,
0.12021348625421524,
0.23232918977737427,
-0.30092868208885193,
0.8015387654304504,
-1.0967674255371094,
-0.38520926237106323,
1.2248108386993408,
-0.24267488718032837,
-0.6285050511360168,
1.4273148775100708,
0.724476158618927,
-1.0684599876403809,
-0.1536722034215927,
-0.15164080262184143,
-0.799889087677002,
0.04558263719081879,
-1.512658953666687,
-0.07650280743837357,
0.4050140678882599,
-1.5151702165603638,
-0.5061731934547424,
-0.25800442695617676,
1.2705963850021362,
-0.23596903681755066,
1.397020697593689,
-0.26413214206695557,
-0.20013462007045746,
-0.37594708800315857,
-0.44043657183647156,
0.14414598047733307,
-0.17091548442840576,
-0.5875096917152405,
0.1945618987083435,
-0.7864773869514465,
0.37010660767555237,
1.4518218040466309,
0.31364038586616516,
0.024714047089219093,
0.4891687333583832,
1.0774530172348022,
0.363523930311203,
-0.08687260746955872,
-0.8739595413208008,
-1.5523496866226196,
2.0007903575897217,
-1.3794522285461426,
1.974825143814087,
0.6670129895210266,
0.025786155834794044,
-1.7979024648666382,
-1.899811863899231,
1.384104609489441,
1.095834493637085,
2.364382266998291,
0.4770861566066742,
0.35969114303588867,
-0.8028115034103394,
-0.6933995485305786,
0.3817480802536011,
-1.0112099647521973,
-0.5707550644874573,
0.1626095175743103,
2.3748512268066406,
1.707842230796814,
-0.5465307831764221,
-0.2677600681781769,
-1.027725338935852,
1.374840259552002,
-0.22947344183921814,
0.2897781729698181,
1.977952241897583,
-0.26696860790252686,
-1.020434021949768,
1.328355073928833,
-2.387859582901001,
0.17654123902320862,
2.032555341720581,
0.2041524350643158,
0.14475350081920624,
-1.4061031341552734,
-0.598484456539154,
-0.33144354820251465,
-0.4287770688533783,
-1.2413862943649292,
0.46713709831237793,
-0.23353911936283112,
-0.7271428108215332,
-1.4437813758850098,
0.18188831210136414,
-1.183809757232666,
-1.7061208486557007,
0.25195109844207764,
1.9295107126235962,
1.9278875589370728,
-0.7214611768722534,
1.5528326034545898,
-0.34706705808639526,
0.0832754597067833,
1.3078075647354126,
1.3343238830566406,
3.1176092624664307,
1.8248577117919922,
-1.2817999124526978,
0.7030459046363831,
-0.21133026480674744,
-0.458996057510376,
1.2748608589172363,
-1.0636005401611328,
1.3398953676223755,
-0.1708829700946808,
-1.2102687358856201,
-1.3065028190612793,
1.008804440498352,
0.5318331718444824,
0.12083750218153,
-0.4757803976535797,
1.1526740789413452,
0.1457667201757431,
1.2701038122177124,
0.5914827585220337,
-0.40570950508117676,
0.6430833339691162,
-0.3056570291519165,
-0.4957660734653473,
1.4759371280670166,
0.2370975911617279,
-1.4398397207260132,
-2.2635772228240967,
-0.22832264006137848,
-0.9071337580680847,
0.001186273992061615,
-0.6397691965103149,
-1.0023554563522339,
1.671995997428894,
0.39584609866142273,
-1.2819496393203735,
-0.1898452490568161,
-0.3151082396507263,
-0.47800183296203613,
2.734839916229248,
-1.3960649967193604,
-0.1712919920682907,
-0.9812588691711426,
-0.6444106698036194,
1.6382824182510376,
-1.1913998126983643,
-0.2510741055011749,
-0.9799677729606628,
-0.5899319052696228,
-1.2991440296173096,
-0.5286481976509094,
0.07262293249368668,
-0.9515824317932129,
0.8154093027114868,
0.11915012449026108,
-1.205686330795288,
-0.3680833876132965,
-0.9034455418586731,
1.025889277458191,
-0.19231121242046356,
0.22252126038074493,
1.9029502868652344,
0.4124053716659546,
-0.38936537504196167,
0.7977638244628906,
1.1564440727233887,
0.6401094794273376,
-0.5912079811096191,
0.24278099834918976,
-0.6878613829612732,
0.23821213841438293,
-1.3615827560424805,
0.2932981848716736,
-2.8583998680114746,
0.5517027974128723,
-0.12527361512184143,
-0.04030260443687439,
0.028177442029118538,
-1.39271879196167,
1.042787790298462,
2.5953269004821777,
-1.2930599451065063,
0.3915897309780121,
0.3905852437019348,
1.1412888765335083,
-1.5681121349334717,
0.2747720181941986,
-0.3796505928039551,
2.030090808868408,
0.20766893029212952,
1.153303861618042,
-0.4855456054210663,
-2.1924357414245605,
0.5027154684066772,
-1.2824504375457764,
-1.2146724462509155,
0.7873144745826721,
-0.8596058487892151,
0.14548464119434357,
-1.4663569927215576,
-0.20848631858825684,
-0.8794965147972107,
-1.253631591796875,
0.7510566115379333,
0.06530851125717163,
0.4243695139884949,
-0.5898420810699463,
0.37910979986190796,
-2.1178629398345947,
-1.3164793252944946,
-0.25526246428489685,
-0.9115816354751587,
0.5455475449562073,
-0.3677777945995331,
0.6892713904380798,
-0.16263198852539062,
-0.0028033237904310226,
0.31784290075302124,
1.5145665407180786,
3.4831032752990723,
0.2098855972290039,
0.2480395883321762,
-0.16798388957977295,
-0.935395359992981,
1.487107276916504,
0.9539108872413635,
-0.1236734390258789,
-0.5559866428375244,
-1.0075582265853882,
1.2813113927841187,
1.9907664060592651,
1.15608811378479,
-0.03986826911568642,
-0.9014610648155212,
-0.817849338054657,
-0.03185732662677765,
0.14874300360679626,
0.4611777067184448,
0.8715522885322571,
0.10374505072832108,
0.05302125960588455,
1.3503665924072266,
1.2176110744476318,
-0.42779740691185,
0.3557065427303314,
-0.899099588394165,
-0.3959008455276489,
0.5744760036468506,
0.25054028630256653,
0.09250535070896149,
0.43459779024124146,
-1.0159388780593872,
-0.2417445182800293,
-0.47418212890625,
-0.9160240888595581,
-0.7224249839782715,
-0.4787653982639313,
-0.42400723695755005,
1.6043486595153809,
0.0728839561343193,
-0.5015122890472412,
-0.06620363146066666,
-0.7358689904212952,
-0.1944359689950943,
-1.0472192764282227,
0.26845693588256836,
-0.1461620330810547,
-0.1460549682378769,
-0.13537980616092682,
1.6183832883834839,
-1.0031733512878418,
-2.0411291122436523,
0.23090262711048126,
0.20048491656780243,
-0.3996144235134125,
0.21970972418785095,
1.6511530876159668,
0.5175144672393799,
1.4042056798934937,
1.3308229446411133,
0.9740248918533325,
-0.667956531047821,
-1.2452298402786255,
0.69199138879776,
0.9468201994895935,
-1.4579946994781494,
0.8173915147781372,
-0.03469642251729965,
-0.446915864944458,
0.6569933295249939,
1.2352854013442993,
0.45166608691215515,
-2.0259389877319336,
0.7815128564834595,
-0.9302851557731628,
0.7979668974876404,
0.7388179898262024,
0.730725109577179,
0.20356160402297974,
0.8728812336921692,
-1.1850067377090454,
-1.1212669610977173,
-0.6855574250221252,
-0.655264139175415,
1.8890734910964966,
-0.22799018025398254,
0.6525946259498596,
-0.19594375789165497,
-1.304029941558838,
-0.15484820306301117,
0.7482708692550659,
0.4177018105983734,
-0.5940617918968201,
0.8103805184364319,
-0.6660152077674866,
-0.9217057824134827,
-1.292639970779419,
-0.5282645225524902,
-1.1177271604537964,
-0.9321832060813904,
1.0173627138137817,
0.7932915091514587,
0.43345242738723755,
1.8398768901824951,
0.5848815441131592,
0.35625994205474854,
-2.7195210456848145,
0.8968212008476257,
0.28531166911125183,
-0.061417579650878906,
0.9064162969589233,
0.3370179831981659,
1.0320343971252441,
-0.05626261234283447,
0.6621289849281311,
-2.4159159660339355,
2.2729015350341797,
-0.15256449580192566,
0.6232372522354126,
-0.028093533590435982,
-0.2285543829202652,
1.1116464138031006,
0.5341112613677979,
0.45356905460357666,
-1.2126977443695068,
0.6719018220901489,
-0.5719404220581055,
1.1215133666992188,
0.8686313629150391,
-0.934180498123169,
0.009725257754325867,
1.3997339010238647,
0.5119024515151978,
-0.4996368885040283,
-0.899520993232727,
-0.9267265796661377,
0.9751957058906555,
1.6305243968963623,
-0.0377398282289505,
-0.06614959239959717,
0.9444680213928223,
0.6707217693328857,
-1.31620454788208,
0.19969692826271057,
-0.6704657673835754,
-0.6219049692153931,
1.6310195922851562,
1.9442778825759888,
-0.14044985175132751,
-0.1457175612449646,
-0.7055753469467163,
-1.1581250429153442,
0.718142032623291,
-0.0008985651656985283,
0.09508417546749115,
0.5417567491531372,
-0.6869722604751587,
1.099092960357666,
0.7936714291572571,
0.8916754722595215,
0.08954229205846786,
0.34973499178886414,
0.437507301568985,
-0.35590097308158875,
-1.145658016204834,
-0.33786681294441223,
-0.9916418790817261,
-2.610077142715454,
0.45289039611816406,
-0.2689560651779175,
-1.398077368736267,
-0.007469642907381058,
-1.0733177661895752,
0.9359637498855591,
-0.5965688824653625,
-1.1644197702407837,
-1.528243899345398,
0.23294098675251007,
0.005835957825183868,
0.9094350337982178,
-1.6343932151794434,
-0.13653336465358734,
1.1883940696716309,
0.8344906568527222,
-0.6359217166900635,
0.9947804808616638,
0.25479233264923096,
1.0168408155441284,
0.8403633832931519,
-0.3272295892238617,
0.5627529621124268,
0.08574262261390686,
-1.3486449718475342,
0.4697081446647644,
1.1918083429336548,
0.1640777438879013,
1.4351757764816284,
-0.5402096509933472,
0.11228649318218231,
0.39763614535331726,
-0.6609447002410889,
-0.5366637110710144,
-0.5396837592124939,
0.6603932976722717,
0.050245434045791626,
-0.9107567667961121,
-0.03789350390434265,
-0.049345336854457855,
-0.2406558096408844,
0.17683643102645874,
-1.5471128225326538,
-0.18781663477420807,
-0.3569713532924652,
-0.6054807901382446,
-1.2222133874893188,
-0.07798094302415848,
1.367732286453247,
-0.7083908319473267,
-0.25631505250930786,
0.5318053960800171,
0.33084192872047424,
0.49062880873680115,
0.594615638256073,
-0.6740756630897522,
-0.269922137260437,
-0.3152434229850769,
-0.36370253562927246,
0.3281751871109009,
1.3093757629394531,
-0.10295296460390091,
-0.9574870467185974,
0.7779077291488647,
-0.41320642828941345,
0.08533038198947906,
1.9537694454193115,
0.07878176122903824,
-0.768172562122345,
0.2830248475074768,
-0.6793204545974731,
1.899658441543579,
1.8147624731063843,
1.3691688776016235,
-0.10532976686954498,
-0.9598008990287781,
0.6253536939620972,
-0.33103129267692566,
-0.39735063910484314,
0.9374682903289795,
0.35365918278694153,
-0.2552782893180847,
-1.4027831554412842,
0.7283390760421753,
1.3477168083190918,
-0.9155437350273132,
-0.7710607051849365,
0.1465439647436142,
-0.8171024918556213,
1.1221683025360107,
0.5668977499008179,
0.2623887062072754,
0.2752506136894226,
1.6065400838851929,
0.7101918458938599,
-0.3682466447353363,
0.5762532949447632,
0.5033949613571167,
-0.11668884754180908,
-2.13289475440979,
-1.1726548671722412,
0.3940025269985199,
-0.5026237964630127,
-1.585331678390503,
1.3990757465362549,
-1.178464651107788,
-0.9792534708976746,
0.5608131885528564,
0.10059190541505814,
1.4739996194839478,
0.34115394949913025,
1.6442025899887085,
2.1229586601257324,
0.8614073991775513,
0.35849449038505554,
1.265771508216858,
-0.05860266089439392,
-0.45911476016044617,
1.8212453126907349,
-0.4481126666069031,
0.4862403869628906,
1.1493501663208008,
-0.34524521231651306,
-1.0472899675369263,
-0.7610039114952087,
-1.2819362878799438,
-0.670264720916748,
1.2022149562835693,
0.05027692764997482,
-1.0654053688049316,
0.2449089139699936,
1.6048229932785034,
0.056260883808135986,
-0.26802605390548706,
0.7347186207771301,
0.4120410978794098,
-0.8554090261459351,
-0.07160887867212296,
-0.8878272771835327,
0.5381397008895874,
-0.23398900032043457,
-0.37377306818962097,
0.30727246403694153,
0.4400062561035156,
1.3004765510559082,
-0.032250382006168365,
0.1393595039844513,
1.1478779315948486,
-1.4798457622528076,
1.5176715850830078,
-0.6818855404853821,
0.3232724666595459,
-2.448801279067993,
1.4098483324050903,
-0.7823773622512817,
1.946903109550476,
-2.535391330718994,
0.4673408567905426,
-0.5887161493301392,
-0.4577425718307495,
0.3067832291126251,
-0.37477609515190125,
0.07786431908607483,
-0.10048908740282059,
-1.138213038444519,
-0.018845658749341965,
-0.738040030002594,
0.6975334882736206,
1.1397093534469604,
1.430039882659912,
-1.1569777727127075,
-0.33779826760292053,
-1.7666417360305786,
-0.08965975046157837,
-0.640928328037262,
0.36095330119132996,
-1.943764567375183,
-0.1309843808412552,
-1.9216758012771606,
-2.4445579051971436,
-1.2921476364135742,
-0.7554457187652588,
1.0445443391799927,
0.06755390018224716,
-0.8661673665046692,
1.249424934387207,
-0.37920618057250977,
-1.8679145574569702,
1.1118818521499634,
-2.196014881134033
] |
https://github.com/huggingface/datasets/issues/6069 | KeyError: dataset has no key "image" | You can list the dataset's columns with `ds.column_names` before `.map` to check whether the dataset has an `image` column. If it doesn't, then this is a bug. Otherwise, please paste the line with the `.map` call.
| ### Describe the bug
I've loaded a local image dataset with:
`ds = laod_dataset("imagefolder", data_dir=path-to-data)`
And defined a transform to process the data, following the Datasets docs.
However, I get a keyError error, indicating there's no "image" key in my dataset. When I printed out the example_batch sent to the transformation function, it shows only the labels are being sent to the function.
For some reason, the images are not in the example batches.
### Steps to reproduce the bug
I'm using the latest stable version of datasets
### Expected behavior
I expect the example_batches to contain both images and labels
### Environment info
I'm using the latest stable version of datasets | 51 | 36 | KeyError: dataset has no key "image"
### Describe the bug
I've loaded a local image dataset with:
`ds = laod_dataset("imagefolder", data_dir=path-to-data)`
And defined a transform to process the data, following the Datasets docs.
However, I get a keyError error, indicating there's no "image" key in my dataset. When I printed out the example_batch sent to the transformation function, it shows only the labels are being sent to the function.
For some reason, the images are not in the example batches.
### Steps to reproduce the bug
I'm using the latest stable version of datasets
### Expected behavior
I expect the example_batches to contain both images and labels
### Environment info
I'm using the latest stable version of datasets
You can list the dataset's columns with `ds.column_names` before `.map` to check whether the dataset has an `image` column. If it doesn't, then this is a bug. Otherwise, please paste the line with the `.map` call.
| [
-1.17133367061615,
-0.9671884775161743,
-0.9597904086112976,
1.3718503713607788,
-0.1919693946838379,
-1.2990189790725708,
0.16572007536888123,
-1.1901322603225708,
1.7549738883972168,
-0.969964325428009,
0.27610474824905396,
-1.708359956741333,
0.08246801793575287,
-0.5398345589637756,
-0.706153929233551,
-0.9495611190795898,
-0.3414621949195862,
-0.7510542869567871,
1.001107096672058,
2.576221227645874,
1.1336803436279297,
-1.3365492820739746,
2.7054831981658936,
0.7257957458496094,
-0.10540841519832611,
-0.9627012610435486,
0.6217358708381653,
-0.10793594270944595,
-1.192529559135437,
-0.4351949691772461,
-0.9266275763511658,
-0.008450464345514774,
-0.5384441018104553,
-0.545267641544342,
-0.0457821860909462,
0.36693358421325684,
-0.3295103907585144,
-0.48003849387168884,
-0.5268958806991577,
-0.8868971467018127,
0.4290182292461395,
-0.4118172228336334,
1.0164655447006226,
-0.41145068407058716,
1.9148855209350586,
-0.4094085395336151,
0.4092038869857788,
0.781620979309082,
1.3408983945846558,
0.14164766669273376,
-0.006329881027340889,
0.2230878323316574,
0.4162255525588989,
0.022504668682813644,
0.32090404629707336,
0.9785491228103638,
0.556075394153595,
0.5840178728103638,
0.7297382950782776,
-2.270826578140259,
1.2525219917297363,
-1.0482686758041382,
0.287079393863678,
1.4030479192733765,
-0.9451649188995361,
0.33972206711769104,
-1.7361218929290771,
-0.07239121943712234,
0.5876610279083252,
-2.2171285152435303,
0.2355852723121643,
-1.2339085340499878,
-0.4683908224105835,
0.972304105758667,
0.34569481015205383,
-1.1831294298171997,
0.0946139395236969,
-0.38289421796798706,
1.0978361368179321,
0.5568019151687622,
1.1787055730819702,
-1.7322392463684082,
-0.058271728456020355,
-0.33473289012908936,
0.08691789209842682,
-1.4216212034225464,
-1.523978590965271,
0.5101463198661804,
0.6727948188781738,
0.5914025902748108,
-0.055051177740097046,
0.975202202796936,
-0.8888302445411682,
0.66400146484375,
-0.8825551867485046,
-1.7237253189086914,
-1.2578037977218628,
-2.2696352005004883,
-2.372797966003418,
0.726646900177002,
-0.4520286023616791,
-0.5588398575782776,
2.0297739505767822,
-1.0810538530349731,
-1.7526588439941406,
1.1943109035491943,
0.1938200443983078,
-0.03818012401461601,
2.4108335971832275,
0.23456068336963654,
-0.6626744866371155,
0.45644569396972656,
-0.7219120264053345,
0.8192589282989502,
-0.43989256024360657,
1.2695376873016357,
0.4991764724254608,
-1.0482532978057861,
1.6078590154647827,
-0.5252044200897217,
0.572536826133728,
-0.6588248610496521,
-0.40975111722946167,
-0.9293946623802185,
0.3258340656757355,
1.7891124486923218,
-0.319368839263916,
1.6065610647201538,
-0.36993083357810974,
-1.556734561920166,
-1.6441144943237305,
0.9025869369506836,
0.45144855976104736,
-0.782646656036377,
0.1870800405740738,
-0.24795083701610565,
0.11475329846143723,
-0.07663507014513016,
1.1343879699707031,
1.2209954261779785,
0.6660292148590088,
-0.32731860876083374,
-0.884376049041748,
0.2835472822189331,
-0.12155784666538239,
-0.7748939394950867,
-1.7618049383163452,
-0.3139440417289734,
0.08379096537828445,
0.7146629095077515,
-1.1877317428588867,
1.7057950496673584,
0.8288958668708801,
1.884993314743042,
1.0368295907974243,
-0.34485623240470886,
1.4667998552322388,
0.035225607454776764,
1.9328126907348633,
-0.4897834062576294,
0.7148158550262451,
-0.2987295091152191,
-1.1227903366088867,
0.8615630865097046,
-0.3352924585342407,
-2.0037171840667725,
-0.8839505910873413,
-0.8737770915031433,
-0.22190263867378235,
-0.7249599099159241,
0.9305211305618286,
-0.4264613687992096,
-1.3284180164337158,
0.35292673110961914,
-0.62557053565979,
0.06364596635103226,
-1.283942699432373,
0.34298574924468994,
0.6907849311828613,
-0.5947149395942688,
-0.028535492718219757,
-0.2696800231933594,
-1.3001106977462769,
-0.4583246111869812,
0.23872774839401245,
1.8882694244384766,
-0.755626380443573,
0.9850927591323853,
0.9734673500061035,
-0.7384496927261353,
-0.13407813012599945,
0.2636301517486572,
-0.30354928970336914,
0.8793269395828247,
-1.1112083196640015,
-0.5344064235687256,
1.188075304031372,
-0.27826133370399475,
-0.6537535190582275,
1.485206127166748,
0.6537100672721863,
-1.0805034637451172,
-0.13600018620491028,
-0.18161223828792572,
-0.9245836734771729,
0.08252653479576111,
-1.6576569080352783,
-0.15602466464042664,
0.32789602875709534,
-1.5159832239151,
-0.564611554145813,
-0.17399471998214722,
1.2586758136749268,
-0.14389550685882568,
1.3956109285354614,
-0.4413895010948181,
-0.29274019598960876,
-0.3899507224559784,
-0.3665097653865814,
0.19132350385189056,
-0.14079517126083374,
-0.6792939901351929,
0.13734641671180725,
-0.795643150806427,
0.3032822608947754,
1.3266433477401733,
0.35685399174690247,
0.10872698575258255,
0.5877314209938049,
1.0358467102050781,
0.3822730779647827,
-0.02056765742599964,
-0.9088057279586792,
-1.5322647094726562,
2.0133213996887207,
-1.4009464979171753,
1.8919025659561157,
0.7034560441970825,
-0.08028875291347504,
-1.8267987966537476,
-1.8058067560195923,
1.3953213691711426,
1.219870686531067,
2.150857925415039,
0.61896812915802,
0.45626315474510193,
-0.7663816809654236,
-0.680022120475769,
0.2929891049861908,
-1.037154197692871,
-0.7541900277137756,
0.13274186849594116,
2.325916051864624,
1.7377994060516357,
-0.42684227228164673,
-0.1600402146577835,
-1.0568101406097412,
1.2808136940002441,
-0.08404014259576797,
0.2126447707414627,
1.9803999662399292,
-0.3695097267627716,
-1.0920612812042236,
1.2063828706741333,
-2.252815008163452,
0.08534359931945801,
1.9821174144744873,
0.1831570714712143,
0.01504779327660799,
-1.3861750364303589,
-0.7295379042625427,
-0.20191392302513123,
-0.4134059548377991,
-1.2810460329055786,
0.529000997543335,
-0.3363432288169861,
-0.6569960117340088,
-1.4594923257827759,
0.24829956889152527,
-1.0787897109985352,
-1.6461302042007446,
0.1803857833147049,
1.9052610397338867,
2.066762685775757,
-0.714625895023346,
1.5556060075759888,
-0.2324947565793991,
0.25397488474845886,
1.2536629438400269,
1.1495157480239868,
3.087261915206909,
1.9381113052368164,
-1.3351112604141235,
0.7003053426742554,
0.00424398947507143,
-0.5068328976631165,
1.226087212562561,
-1.0991647243499756,
1.3332606554031372,
-0.14982366561889648,
-1.2008339166641235,
-1.2887266874313354,
0.8491401076316833,
0.4500053822994232,
0.08060502260923386,
-0.4262520968914032,
1.3451563119888306,
-0.09052371233701706,
1.301812767982483,
0.5798892378807068,
-0.43796059489250183,
0.6202942132949829,
-0.47839799523353577,
-0.5437460541725159,
1.5820244550704956,
0.23161041736602783,
-1.3738813400268555,
-2.347836494445801,
-0.3135007917881012,
-0.7705928087234497,
0.0550125390291214,
-0.5760089755058289,
-0.9452297687530518,
1.6678707599639893,
0.4174719750881195,
-1.1306816339492798,
-0.3722854256629944,
-0.40546345710754395,
-0.7032206654548645,
2.6576082706451416,
-1.4657316207885742,
-0.24333059787750244,
-0.9753686189651489,
-0.6680848598480225,
1.5764057636260986,
-1.2856800556182861,
-0.2150939553976059,
-1.0355144739151,
-0.5610566139221191,
-1.4012773036956787,
-0.5074103474617004,
-0.006886810529977083,
-0.9793336987495422,
0.9619913101196289,
0.20202697813510895,
-1.0628060102462769,
-0.1570199728012085,
-0.9124230146408081,
0.7804288268089294,
-0.18466393649578094,
0.31943458318710327,
1.9061118364334106,
0.5055373311042786,
-0.41235920786857605,
0.6782684326171875,
1.1453505754470825,
0.6671269536018372,
-0.6853367686271667,
0.1885152906179428,
-0.817145049571991,
0.2405506670475006,
-1.1577345132827759,
0.2549036145210266,
-2.818092107772827,
0.5783221125602722,
-0.06591635942459106,
-0.0571071021258831,
0.045582856982946396,
-1.2830078601837158,
0.9535842537879944,
2.5975141525268555,
-1.2787903547286987,
0.4730784296989441,
0.25083205103874207,
1.316194772720337,
-1.633347988128662,
0.3668023347854614,
-0.3519243896007538,
2.106874465942383,
0.22120536863803864,
1.1395879983901978,
-0.4334176480770111,
-2.2302234172821045,
0.6780554056167603,
-1.256903886795044,
-1.3096007108688354,
0.8433524966239929,
-0.7936291098594666,
0.029393229633569717,
-1.472247838973999,
-0.24877119064331055,
-0.7812214493751526,
-1.3178595304489136,
0.761279284954071,
0.15150794386863708,
0.5285516381263733,
-0.5627361536026001,
0.27937594056129456,
-2.216520309448242,
-1.4096564054489136,
-0.22294475138187408,
-0.9193025827407837,
0.39124271273612976,
-0.3399850130081177,
0.7645223140716553,
-0.24978725612163544,
0.15432317554950714,
0.3597269058227539,
1.40789794921875,
3.612074136734009,
0.34403976798057556,
0.3762441873550415,
-0.11604844778776169,
-0.9168594479560852,
1.461918830871582,
0.941592276096344,
-0.13713346421718597,
-0.49638810753822327,
-1.017823576927185,
1.2078300714492798,
1.990455985069275,
0.9662162661552429,
0.13270099461078644,
-0.7370306849479675,
-0.5139939785003662,
-0.04364318028092384,
0.17876483500003815,
0.46921443939208984,
0.8654741048812866,
0.06609200686216354,
0.08920315653085709,
1.5098997354507446,
1.1404796838760376,
-0.3575077950954437,
0.4204089939594269,
-0.7401086688041687,
-0.4674737751483917,
0.6620923280715942,
0.33532050251960754,
0.018261749297380447,
0.3396034836769104,
-0.9482625722885132,
-0.24741990864276886,
-0.5020020604133606,
-0.9920036196708679,
-0.6330535411834717,
-0.4502793848514557,
-0.3122738003730774,
1.5773206949234009,
0.14115770161151886,
-0.5475481152534485,
-0.13945777714252472,
-0.7558923363685608,
-0.12533226609230042,
-1.0757368803024292,
0.12919241189956665,
-0.22030875086784363,
-0.21209315955638885,
-0.036336030811071396,
1.7561231851577759,
-0.9758755564689636,
-2.070350408554077,
0.231466606259346,
0.28475460410118103,
-0.27357447147369385,
0.2748149335384369,
1.618691086769104,
0.47932231426239014,
1.4461396932601929,
1.3654193878173828,
0.9216713905334473,
-0.7873765826225281,
-1.3101556301116943,
0.6187462210655212,
0.9508850574493408,
-1.3936642408370972,
0.7419352531433105,
0.06454925984144211,
-0.6138707399368286,
0.7252562642097473,
1.2562193870544434,
0.4607906937599182,
-1.938795566558838,
0.8022234439849854,
-0.9247692823410034,
0.7881272435188293,
0.6916199922561646,
0.7232520580291748,
0.16858743131160736,
0.8403242230415344,
-1.19921875,
-1.1223188638687134,
-0.7610493898391724,
-0.6374256610870361,
1.9868067502975464,
-0.2467067688703537,
0.6076938509941101,
-0.17728692293167114,
-1.2792620658874512,
-0.04742148891091347,
0.6964204907417297,
0.33837053179740906,
-0.32775378227233887,
0.6989043354988098,
-0.720722496509552,
-1.039717435836792,
-1.5140812397003174,
-0.3946808874607086,
-1.0544458627700806,
-0.9003653526306152,
1.1216044425964355,
0.8435494303703308,
0.2010824978351593,
1.823788046836853,
0.6981688737869263,
0.16385819017887115,
-2.5519392490386963,
0.8501743078231812,
0.29626333713531494,
0.008023957721889019,
0.850845456123352,
0.31115829944610596,
1.0663034915924072,
-0.05002940073609352,
0.48289263248443604,
-2.3069229125976562,
2.2305703163146973,
-0.3558896780014038,
0.6164165735244751,
-0.03514175862073898,
-0.21896474063396454,
1.1391186714172363,
0.4896602928638458,
0.5911567807197571,
-1.0365803241729736,
0.6974726319313049,
-0.6060482859611511,
1.1753836870193481,
1.0084501504898071,
-0.8667058944702148,
-0.0707731693983078,
1.3840084075927734,
0.5679836273193359,
-0.5120699405670166,
-0.877886950969696,
-0.9669672846794128,
0.9345646500587463,
1.7893849611282349,
-0.05962976813316345,
-0.0054334006272256374,
0.8010329008102417,
0.6158174276351929,
-1.3175535202026367,
0.14031121134757996,
-0.7919760346412659,
-0.7814602851867676,
1.6745656728744507,
2.0290913581848145,
-0.13290788233280182,
-0.1680530607700348,
-0.7990145683288574,
-1.2454339265823364,
0.8407266139984131,
0.05473688989877701,
0.11524102836847305,
0.702813446521759,
-0.6647385954856873,
1.0327054262161255,
0.9307737350463867,
0.9567893743515015,
0.252050518989563,
0.289801687002182,
0.41865429282188416,
-0.2811817526817322,
-1.0211514234542847,
-0.19421152770519257,
-1.0634584426879883,
-2.4667365550994873,
0.5212450623512268,
-0.32708078622817993,
-1.473809838294983,
-0.035622064024209976,
-0.9211487174034119,
1.0345098972320557,
-0.5011645555496216,
-1.0606160163879395,
-1.5652422904968262,
0.29847145080566406,
-0.07636603713035583,
0.8994706273078918,
-1.5733921527862549,
-0.08538354188203812,
1.3568339347839355,
0.9741918444633484,
-0.7229355573654175,
1.0551377534866333,
0.16881319880485535,
1.035220980644226,
0.7429008483886719,
-0.43873751163482666,
0.4390879273414612,
-0.008306966163218021,
-1.3719416856765747,
0.4940955340862274,
1.037419080734253,
0.20190595090389252,
1.478476881980896,
-0.5298686623573303,
0.032458700239658356,
0.339417427778244,
-0.381973534822464,
-0.5605394840240479,
-0.5806567072868347,
0.716644823551178,
0.06801049411296844,
-0.7615117430686951,
0.1512778401374817,
-0.04343150556087494,
-0.3119453191757202,
0.20588496327400208,
-1.419695496559143,
-0.19367723166942596,
-0.4213763475418091,
-0.6560876965522766,
-1.247096300125122,
-0.07848764210939407,
1.4206509590148926,
-0.7063394784927368,
-0.19794538617134094,
0.5573899745941162,
0.5164132714271545,
0.4647786319255829,
0.6047331690788269,
-0.6338474154472351,
-0.2905898690223694,
-0.33766618371009827,
-0.3015965223312378,
0.31284189224243164,
1.3410429954528809,
-0.22704602777957916,
-1.022943139076233,
0.7486234903335571,
-0.2994247078895569,
0.05891842395067215,
1.870989441871643,
0.14761081337928772,
-0.7849798202514648,
0.22445467114448547,
-0.7432578206062317,
1.9345357418060303,
1.7376091480255127,
1.4198827743530273,
-0.04398123919963837,
-0.9811376333236694,
0.5864952206611633,
-0.24642057716846466,
-0.36430031061172485,
1.0280207395553589,
0.4784970283508301,
-0.08958189189434052,
-1.3553850650787354,
0.7228286266326904,
1.2123346328735352,
-0.8996391296386719,
-0.85012286901474,
0.039177361875772476,
-0.7637192010879517,
1.0942484140396118,
0.6960570216178894,
0.5191282629966736,
0.28660833835601807,
1.64413583278656,
0.6709526181221008,
-0.5940446853637695,
0.5223284363746643,
0.5062876343727112,
-0.13867658376693726,
-2.0567219257354736,
-1.1550531387329102,
0.384120374917984,
-0.5084260702133179,
-1.617220401763916,
1.4291592836380005,
-1.1328235864639282,
-0.8963597416877747,
0.5439198613166809,
0.14773528277873993,
1.4199267625808716,
0.3246177136898041,
1.5657082796096802,
2.0476231575012207,
0.8645638227462769,
0.32398056983947754,
1.3589870929718018,
-0.1969512701034546,
-0.3815149664878845,
1.833980917930603,
-0.36193448305130005,
0.4108961224555969,
1.1004047393798828,
-0.3890051543712616,
-0.9916788339614868,
-0.7165113091468811,
-1.1300872564315796,
-0.5980016589164734,
1.1152597665786743,
0.09415019303560257,
-1.0534688234329224,
0.17295442521572113,
1.5312004089355469,
0.1235540360212326,
-0.36193370819091797,
0.6853290796279907,
0.5080857276916504,
-0.8112942576408386,
-0.025126762688159943,
-0.9523976445198059,
0.5481646656990051,
-0.21260012686252594,
-0.3312751352787018,
0.4268477261066437,
0.434566468000412,
1.3545963764190674,
-0.08464022725820541,
0.19404397904872894,
1.2773849964141846,
-1.3227989673614502,
1.4525316953659058,
-0.6440067887306213,
0.17171688377857208,
-2.4059507846832275,
1.3230468034744263,
-0.7164851427078247,
1.8936794996261597,
-2.652022123336792,
0.35881859064102173,
-0.6739225387573242,
-0.2768138349056244,
0.3450492322444916,
-0.37305083870887756,
0.08948960155248642,
-0.19246608018875122,
-1.1297471523284912,
-0.03623548895120621,
-0.7302300930023193,
0.6114293932914734,
1.2020008563995361,
1.3743356466293335,
-1.1073318719863892,
-0.2309754490852356,
-1.76022469997406,
-0.1818356066942215,
-0.6980052590370178,
0.38392385840415955,
-1.994249939918518,
-0.23898853361606598,
-1.919569730758667,
-2.5223217010498047,
-1.3706244230270386,
-0.7556517124176025,
1.1488269567489624,
0.1629444807767868,
-0.9674549102783203,
1.1483103036880493,
-0.3953922986984253,
-1.9117090702056885,
1.1431899070739746,
-2.1586859226226807
] |
https://github.com/huggingface/datasets/issues/6069 | KeyError: dataset has no key "image" | This is the piece of code I am running:
```
data_transforms = utils.get_data_augmentation(args)
image_dataset = utils.load_image_dataset(args.dataset)
def resize(examples):
examples["pixel_values"] = [image.convert("RGB").resize((300, 300)) for image in examples["image"]]
return examples
def preprocess_train(example_batch):
print(f"Example batch: \n{example_batch}")
example_batch["pixel_values"] = [
data_transforms["train"](image.convert("RGB")) for image in example_batch["pixel_values"]
]
return example_batch
def preprocess_val(example_batch):
example_batch["pixel_values"] = [
data_transforms["val"](image.convert("RGB")) for image in example_batch["pixel_values"]
]
return example_batch
image_dataset = image_dataset.map(resize, remove_columns=["image"], batched=True)
image_dataset["train"].set_transform(preprocess_train)
image_dataset["validation"].set_transform(preprocess_val)
```
When I print ds.column_names I get the following
`{'train': ['image', 'label'], 'validation': ['image', 'label'], 'test': ['image', 'label']}`
The `print(f"Example batch: \n{example_batch}")` in the `preprocess_train` function outputs only labels without images:
```
Example batch:
{'label': [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3]}
```
The weird part of it all is that a sample code runs in a jupyter lab notebook without any bugs, but when I run my scripts from the terminal I get the bug. The same code. | ### Describe the bug
I've loaded a local image dataset with:
`ds = laod_dataset("imagefolder", data_dir=path-to-data)`
And defined a transform to process the data, following the Datasets docs.
However, I get a keyError error, indicating there's no "image" key in my dataset. When I printed out the example_batch sent to the transformation function, it shows only the labels are being sent to the function.
For some reason, the images are not in the example batches.
### Steps to reproduce the bug
I'm using the latest stable version of datasets
### Expected behavior
I expect the example_batches to contain both images and labels
### Environment info
I'm using the latest stable version of datasets | 51 | 1,035 | KeyError: dataset has no key "image"
### Describe the bug
I've loaded a local image dataset with:
`ds = laod_dataset("imagefolder", data_dir=path-to-data)`
And defined a transform to process the data, following the Datasets docs.
However, I get a keyError error, indicating there's no "image" key in my dataset. When I printed out the example_batch sent to the transformation function, it shows only the labels are being sent to the function.
For some reason, the images are not in the example batches.
### Steps to reproduce the bug
I'm using the latest stable version of datasets
### Expected behavior
I expect the example_batches to contain both images and labels
### Environment info
I'm using the latest stable version of datasets
This is the piece of code I am running:
```
data_transforms = utils.get_data_augmentation(args)
image_dataset = utils.load_image_dataset(args.dataset)
def resize(examples):
examples["pixel_values"] = [image.convert("RGB").resize((300, 300)) for image in examples["image"]]
return examples
def preprocess_train(example_batch):
print(f"Example batch: \n{example_batch}")
example_batch["pixel_values"] = [
data_transforms["train"](image.convert("RGB")) for image in example_batch["pixel_values"]
]
return example_batch
def preprocess_val(example_batch):
example_batch["pixel_values"] = [
data_transforms["val"](image.convert("RGB")) for image in example_batch["pixel_values"]
]
return example_batch
image_dataset = image_dataset.map(resize, remove_columns=["image"], batched=True)
image_dataset["train"].set_transform(preprocess_train)
image_dataset["validation"].set_transform(preprocess_val)
```
When I print ds.column_names I get the following
`{'train': ['image', 'label'], 'validation': ['image', 'label'], 'test': ['image', 'label']}`
The `print(f"Example batch: \n{example_batch}")` in the `preprocess_train` function outputs only labels without images:
```
Example batch:
{'label': [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3]}
```
The weird part of it all is that a sample code runs in a jupyter lab notebook without any bugs, but when I run my scripts from the terminal I get the bug. The same code. | [
-1.32200288772583,
-0.9935063719749451,
-0.7597574591636658,
1.4973571300506592,
-0.1484074741601944,
-1.2504184246063232,
0.17417672276496887,
-1.1684865951538086,
1.676836371421814,
-0.8942831754684448,
0.34366580843925476,
-1.6277977228164673,
0.02760835736989975,
-0.595337450504303,
-0.7549809217453003,
-0.9617453813552856,
-0.3615272045135498,
-0.7153549790382385,
1.1563044786453247,
2.4337575435638428,
1.2245985269546509,
-1.3397986888885498,
2.8036139011383057,
0.7477515935897827,
-0.14225569367408752,
-0.9857285618782043,
0.5699177384376526,
-0.005357904359698296,
-1.2369924783706665,
-0.48542413115501404,
-0.9487560987472534,
-0.02115122228860855,
-0.5049024820327759,
-0.41575896739959717,
-0.07255478948354721,
0.4051506519317627,
-0.30828288197517395,
-0.5573874115943909,
-0.6815981268882751,
-0.7656100988388062,
0.39006319642066956,
-0.3894035518169403,
0.9668353199958801,
-0.37822425365448,
1.8766236305236816,
-0.6142939329147339,
0.4652569890022278,
0.7767666578292847,
1.3072071075439453,
0.21946240961551666,
0.071721151471138,
0.3346967101097107,
0.4105490446090698,
-0.08301603049039841,
0.48971304297447205,
1.166818380355835,
0.6094017624855042,
0.5053261518478394,
0.7924914360046387,
-2.228973388671875,
1.2275104522705078,
-1.0700277090072632,
0.28812652826309204,
1.3492703437805176,
-0.8822406530380249,
0.34583061933517456,
-1.6776338815689087,
-0.06382092088460922,
0.7137361764907837,
-2.1965765953063965,
0.33238595724105835,
-1.3158537149429321,
-0.5655530691146851,
0.9878942370414734,
0.43395182490348816,
-1.1174209117889404,
0.11503869295120239,
-0.49134254455566406,
1.0824319124221802,
0.3890218734741211,
1.0949537754058838,
-1.6421301364898682,
-0.04493258520960808,
-0.26204782724380493,
0.07850703597068787,
-1.2949467897415161,
-1.5817155838012695,
0.5819595456123352,
0.5997764468193054,
0.5904183387756348,
-0.1352350413799286,
1.108616590499878,
-1.0874474048614502,
0.786742091178894,
-1.011566400527954,
-1.711814284324646,
-1.4476191997528076,
-2.293522596359253,
-2.2221763134002686,
0.6891267895698547,
-0.48497870564460754,
-0.5715678334236145,
2.0749905109405518,
-0.9872743487358093,
-1.6707831621170044,
1.193830132484436,
0.2476622611284256,
0.0433267317712307,
2.4274258613586426,
0.24659641087055206,
-0.6980528831481934,
0.5381906628608704,
-0.7470848560333252,
0.819193959236145,
-0.30229195952415466,
1.2528008222579956,
0.3406025767326355,
-0.982877254486084,
1.540136456489563,
-0.3714441955089569,
0.6485644578933716,
-0.585490345954895,
-0.430418461561203,
-0.8268729448318481,
0.3209628760814667,
1.7741520404815674,
-0.24566785991191864,
1.5780576467514038,
-0.3567369878292084,
-1.607645869255066,
-1.744858980178833,
0.871891975402832,
0.4708828628063202,
-0.7232771515846252,
0.08772154152393341,
-0.40038877725601196,
0.15803003311157227,
-0.1018662303686142,
1.3004320859909058,
1.3108611106872559,
0.7414987087249756,
-0.4829462468624115,
-0.8000015020370483,
0.11928469687700272,
-0.04732164740562439,
-0.8466143608093262,
-1.6812225580215454,
-0.3711104989051819,
0.2032640278339386,
0.6242696642875671,
-1.2303292751312256,
1.7676258087158203,
0.9254854321479797,
1.8572568893432617,
1.0719172954559326,
-0.3732896149158478,
1.4528051614761353,
0.08782456070184708,
1.800287127494812,
-0.5349398851394653,
0.6339080929756165,
-0.2511897385120392,
-1.1352505683898926,
0.800294041633606,
-0.31544533371925354,
-2.0440590381622314,
-1.0041877031326294,
-0.6863632798194885,
-0.18555350601673126,
-0.7171522378921509,
0.8641453981399536,
-0.43640902638435364,
-1.3962205648422241,
0.21459853649139404,
-0.7294276356697083,
0.04916359484195709,
-1.1622159481048584,
0.22735494375228882,
0.6219590306282043,
-0.6524142026901245,
0.06907819956541061,
-0.11416874080896378,
-1.3041579723358154,
-0.35909149050712585,
0.20267727971076965,
1.9477835893630981,
-0.7166976928710938,
0.9356309175491333,
1.0931283235549927,
-0.7087998390197754,
-0.008559166453778744,
0.18546998500823975,
-0.34274426102638245,
0.878774881362915,
-1.066840410232544,
-0.5789669752120972,
1.2487056255340576,
-0.21187636256217957,
-0.6271354556083679,
1.590315580368042,
0.6619406342506409,
-1.0424145460128784,
-0.2675149142742157,
-0.06811825931072235,
-0.8609877228736877,
0.020522672683000565,
-1.5437299013137817,
-0.15586622059345245,
0.4849940240383148,
-1.5419193506240845,
-0.5065261721611023,
-0.18010810017585754,
1.2770097255706787,
-0.2058097869157791,
1.4243125915527344,
-0.4407418370246887,
-0.17276011407375336,
-0.2962481677532196,
-0.40002232789993286,
0.18986696004867554,
-0.17491698265075684,
-0.6939389109611511,
0.07850921899080276,
-0.8197840452194214,
0.3523601293563843,
1.4506049156188965,
0.41354283690452576,
0.11261171102523804,
0.4532703161239624,
1.1068024635314941,
0.3872695565223694,
-0.02006254531443119,
-0.8632779121398926,
-1.5252965688705444,
1.9621115922927856,
-1.4357327222824097,
1.9932007789611816,
0.7963418364524841,
-0.12672226130962372,
-1.847668170928955,
-1.8493024110794067,
1.3132261037826538,
1.1931750774383545,
2.269911527633667,
0.41323035955429077,
0.39749497175216675,
-0.8276918530464172,
-0.7324581146240234,
0.28784891963005066,
-1.01736319065094,
-0.6199508309364319,
0.2340030074119568,
2.334286689758301,
1.8533951044082642,
-0.3973951041698456,
-0.11928273737430573,
-0.9847295880317688,
1.3597941398620605,
-0.23111839592456818,
0.27830907702445984,
1.941483974456787,
-0.2778418958187103,
-1.0433180332183838,
1.347650170326233,
-2.2593255043029785,
0.12838056683540344,
1.994091272354126,
0.2779148519039154,
0.03300091624259949,
-1.2742865085601807,
-0.5684598088264465,
-0.4652937054634094,
-0.3763725757598877,
-1.2265644073486328,
0.5499334335327148,
-0.24397103488445282,
-0.7991776466369629,
-1.3272793292999268,
0.13581207394599915,
-1.1072776317596436,
-1.6540974378585815,
0.2617245316505432,
1.8702468872070312,
2.1030893325805664,
-0.8194082975387573,
1.5861358642578125,
-0.3388324975967407,
0.11435811966657639,
1.090417742729187,
1.2374390363693237,
3.0489375591278076,
1.8031773567199707,
-1.32355535030365,
0.5584592819213867,
-0.15885032713413239,
-0.49709007143974304,
1.131735920906067,
-1.2127045392990112,
1.4224436283111572,
-0.08349694311618805,
-1.1885265111923218,
-1.2433491945266724,
1.043783187866211,
0.47869178652763367,
0.024477627128362656,
-0.5007179975509644,
1.1810518503189087,
0.01438406202942133,
1.3808577060699463,
0.6243520379066467,
-0.3633972108364105,
0.6067363619804382,
-0.4360937476158142,
-0.5635203123092651,
1.4921519756317139,
0.12057942897081375,
-1.5240932703018188,
-2.1897425651550293,
-0.2300342321395874,
-0.8337308764457703,
0.11804793030023575,
-0.6258479952812195,
-1.0588483810424805,
1.6973117589950562,
0.2722190320491791,
-1.2690812349319458,
-0.36856749653816223,
-0.41387656331062317,
-0.6450517773628235,
2.7750284671783447,
-1.243848204612732,
-0.198668971657753,
-0.9317384958267212,
-0.7020172476768494,
1.604265570640564,
-1.1802620887756348,
-0.20567479729652405,
-1.0188838243484497,
-0.5566931962966919,
-1.327011227607727,
-0.5037631988525391,
0.10599858313798904,
-1.0085663795471191,
0.911078691482544,
0.1507561355829239,
-1.0619181394577026,
-0.3329883813858032,
-0.86076420545578,
0.9622551798820496,
-0.24973002076148987,
0.15694604814052582,
1.8897004127502441,
0.3750573694705963,
-0.33073124289512634,
0.8372148275375366,
1.2440056800842285,
0.70142662525177,
-0.6602407097816467,
0.05075791850686073,
-0.7166978120803833,
0.3119843602180481,
-1.2119649648666382,
0.22744345664978027,
-2.8197011947631836,
0.6266904473304749,
-0.024430204182863235,
-0.08740794658660889,
0.07478801906108856,
-1.2750324010849,
1.0339354276657104,
2.624598503112793,
-1.2672183513641357,
0.4924260675907135,
0.3443443477153778,
1.1639374494552612,
-1.610426664352417,
0.3017783761024475,
-0.4522251784801483,
2.0371251106262207,
0.20949015021324158,
1.2392107248306274,
-0.5087475776672363,
-2.1185717582702637,
0.7810633182525635,
-1.2881619930267334,
-1.2262095212936401,
0.7900058627128601,
-1.0134423971176147,
0.35552242398262024,
-1.4748457670211792,
-0.36739209294319153,
-0.8506283760070801,
-1.1367764472961426,
0.5533140301704407,
0.11681833118200302,
0.3424437344074249,
-0.4885921776294708,
0.26887407898902893,
-2.274141550064087,
-1.4451887607574463,
-0.21441952884197235,
-1.0035077333450317,
0.5808043479919434,
-0.4850071668624878,
0.7461572289466858,
-0.1682639718055725,
0.06628239899873734,
0.36722832918167114,
1.4607939720153809,
3.472224473953247,
0.32368287444114685,
0.24698792397975922,
-0.18701812624931335,
-0.9263452291488647,
1.4263187646865845,
0.8701736927032471,
-0.12609416246414185,
-0.48623546957969666,
-1.0899720191955566,
1.2937783002853394,
1.9420064687728882,
0.9699433445930481,
0.002857200801372528,
-0.8500108122825623,
-0.6676489114761353,
-0.09364053606987,
0.14892198145389557,
0.4257274270057678,
0.8287645578384399,
0.03313809260725975,
0.15237407386302948,
1.5843870639801025,
1.1282711029052734,
-0.42115697264671326,
0.3171271085739136,
-0.8498275279998779,
-0.5456227660179138,
0.5615816116333008,
0.2314000129699707,
-0.0002833930775523186,
0.4136633574962616,
-1.0032079219818115,
-0.25458377599716187,
-0.5107152462005615,
-0.7839317321777344,
-0.594618022441864,
-0.35710954666137695,
-0.3434517979621887,
1.5474693775177002,
0.10890162736177444,
-0.5500428676605225,
-0.0622408390045166,
-0.7287602424621582,
-0.17180462181568146,
-1.0654939413070679,
0.188008651137352,
-0.08512619137763977,
-0.16727717220783234,
-0.22702986001968384,
1.7462040185928345,
-0.9318197965621948,
-1.9904533624649048,
0.15096671879291534,
0.2789503335952759,
-0.1922946572303772,
0.21156246960163116,
1.6731399297714233,
0.5327841639518738,
1.4688841104507446,
1.2671360969543457,
0.8237615823745728,
-0.7449976801872253,
-1.242655634880066,
0.6059844493865967,
0.9414424896240234,
-1.2546252012252808,
0.79154372215271,
-0.15112529695034027,
-0.575880229473114,
0.6558213829994202,
1.2883009910583496,
0.4900745451450348,
-1.9245781898498535,
0.8831894397735596,
-1.0249300003051758,
0.8855055570602417,
0.6784952282905579,
0.6185740232467651,
0.13824555277824402,
0.923484742641449,
-1.1201692819595337,
-1.131229281425476,
-0.7426800727844238,
-0.7217855453491211,
2.023094654083252,
-0.32882219552993774,
0.6156739592552185,
-0.30621615052223206,
-1.242126703262329,
-0.054970499128103256,
0.6082505583763123,
0.3537147343158722,
-0.40836063027381897,
0.7783010005950928,
-0.673926830291748,
-0.9879872798919678,
-1.4049174785614014,
-0.283754825592041,
-1.070666790008545,
-0.96391761302948,
1.117658257484436,
0.7430063486099243,
0.2821856439113617,
1.8598709106445312,
0.713411808013916,
0.2802862226963043,
-2.5201103687286377,
0.8920331597328186,
0.23121176660060883,
-0.08247619867324829,
0.831182062625885,
0.39086830615997314,
1.0233089923858643,
0.009864416904747486,
0.362583726644516,
-2.373856782913208,
2.2509264945983887,
-0.2748953104019165,
0.6826545000076294,
-0.11131322383880615,
-0.17539680004119873,
1.2057989835739136,
0.5999176502227783,
0.5357890725135803,
-0.9680323004722595,
0.582922101020813,
-0.393513947725296,
1.196418046951294,
0.912212610244751,
-0.7695685625076294,
-0.040202781558036804,
1.4430832862854004,
0.5088538527488708,
-0.5550251007080078,
-1.0030338764190674,
-0.875206470489502,
0.9971492886543274,
1.6871023178100586,
-0.005920453928411007,
-0.03021293133497238,
0.758058488368988,
0.6012905240058899,
-1.255530595779419,
0.03569922596216202,
-0.7745970487594604,
-0.7446670532226562,
1.68252432346344,
2.1875369548797607,
-0.22186221182346344,
-0.20437879860401154,
-0.6301231980323792,
-1.3051272630691528,
0.829322874546051,
-0.20956747233867645,
0.21379536390304565,
0.6465954780578613,
-0.6772953271865845,
1.0198891162872314,
0.8529029488563538,
0.9209989309310913,
0.20386570692062378,
0.18133556842803955,
0.42219048738479614,
-0.2778196334838867,
-1.170204758644104,
-0.21104612946510315,
-1.0021222829818726,
-2.4353737831115723,
0.3148350715637207,
-0.20732364058494568,
-1.449038028717041,
-0.03742394968867302,
-0.9503377079963684,
1.0817326307296753,
-0.5145012140274048,
-0.9842121601104736,
-1.5672636032104492,
0.25288906693458557,
0.03639257326722145,
1.0065398216247559,
-1.5422455072402954,
-0.2873195707798004,
1.1874786615371704,
0.8975549936294556,
-0.7143856883049011,
0.9846531748771667,
0.184390589594841,
1.0280166864395142,
0.7371724247932434,
-0.4366697371006012,
0.46674174070358276,
-0.07432708144187927,
-1.3595097064971924,
0.4459612965583801,
1.1207400560379028,
0.20625071227550507,
1.5465304851531982,
-0.3920820355415344,
0.04851550981402397,
0.38329389691352844,
-0.5641327500343323,
-0.5125707983970642,
-0.4105992913246155,
0.6058165431022644,
-0.005783365108072758,
-0.8546363115310669,
-0.08826673030853271,
-0.06917667388916016,
-0.37801533937454224,
0.2373560518026352,
-1.4335355758666992,
-0.06899501383304596,
-0.4673228859901428,
-0.6932662129402161,
-1.1857608556747437,
-0.048532575368881226,
1.4212045669555664,
-0.8271508812904358,
-0.24014930427074432,
0.49852821230888367,
0.36093923449516296,
0.5796162486076355,
0.6934453248977661,
-0.7197914719581604,
-0.20456774532794952,
-0.27690595388412476,
-0.27719393372535706,
0.34380272030830383,
1.400185465812683,
-0.14172181487083435,
-0.934913158416748,
0.6563848257064819,
-0.30365267395973206,
0.07000687718391418,
1.9458726644515991,
0.1438014656305313,
-0.6581496000289917,
0.3047959506511688,
-0.8313530087471008,
1.8944820165634155,
1.6920772790908813,
1.3882756233215332,
-0.10480097681283951,
-0.9324712753295898,
0.5794863700866699,
-0.3030206859111786,
-0.4183385670185089,
0.854278028011322,
0.3493356704711914,
-0.18950912356376648,
-1.4693045616149902,
0.8588505387306213,
1.19511878490448,
-0.8938280344009399,
-0.7233487963676453,
0.15334223210811615,
-0.7832848429679871,
1.151631474494934,
0.5689712762832642,
0.48300057649612427,
0.37074318528175354,
1.6566667556762695,
0.8321512341499329,
-0.5064520835876465,
0.41780582070350647,
0.6389927268028259,
-0.1586458683013916,
-2.1070189476013184,
-1.19504714012146,
0.30703306198120117,
-0.6022427678108215,
-1.6353816986083984,
1.4138532876968384,
-1.1296104192733765,
-1.0561846494674683,
0.6295404434204102,
0.052597109228372574,
1.3394966125488281,
0.4096202552318573,
1.5460959672927856,
2.077540874481201,
0.8413578867912292,
0.4382825791835785,
1.2407031059265137,
-0.1672302633523941,
-0.4507628381252289,
1.8762707710266113,
-0.4086918532848358,
0.3788471519947052,
1.0335593223571777,
-0.3387744724750519,
-1.1053096055984497,
-0.6804349422454834,
-1.2582627534866333,
-0.7917503118515015,
1.1359636783599854,
0.025601554661989212,
-1.0323470830917358,
0.18220141530036926,
1.5786184072494507,
0.14128056168556213,
-0.40031594038009644,
0.6805248260498047,
0.4453445076942444,
-0.785821259021759,
-0.03192952647805214,
-0.897585928440094,
0.5724384188652039,
-0.16347414255142212,
-0.33507537841796875,
0.2834409177303314,
0.41548478603363037,
1.4911885261535645,
-0.14421814680099487,
0.12869198620319366,
1.0938870906829834,
-1.4035450220108032,
1.4553931951522827,
-0.6259013414382935,
0.25575971603393555,
-2.40372896194458,
1.3743635416030884,
-0.7357022166252136,
1.9512313604354858,
-2.711371421813965,
0.567987859249115,
-0.6633942723274231,
-0.42388826608657837,
0.2676268517971039,
-0.3463505208492279,
0.11703584343194962,
-0.1178051009774208,
-1.1796951293945312,
-0.0017234641127288342,
-0.5941561460494995,
0.6800044178962708,
1.196908950805664,
1.396846055984497,
-1.1266460418701172,
-0.27288785576820374,
-1.6831011772155762,
-0.09546733647584915,
-0.8158230781555176,
0.300730437040329,
-2.0007548332214355,
-0.2627889811992645,
-1.8298598527908325,
-2.4343156814575195,
-1.3187445402145386,
-0.7276159524917603,
1.1616086959838867,
0.19402669370174408,
-0.9959649443626404,
1.3206099271774292,
-0.470553994178772,
-1.938821792602539,
1.1791480779647827,
-2.1777396202087402
] |
https://github.com/huggingface/datasets/issues/6069 | KeyError: dataset has no key "image" | The `remove_columns=["image"]` argument in the `.map` call removes the `image` column from the output, so drop this argument to preserve it. | ### Describe the bug
I've loaded a local image dataset with:
`ds = laod_dataset("imagefolder", data_dir=path-to-data)`
And defined a transform to process the data, following the Datasets docs.
However, I get a keyError error, indicating there's no "image" key in my dataset. When I printed out the example_batch sent to the transformation function, it shows only the labels are being sent to the function.
For some reason, the images are not in the example batches.
### Steps to reproduce the bug
I'm using the latest stable version of datasets
### Expected behavior
I expect the example_batches to contain both images and labels
### Environment info
I'm using the latest stable version of datasets | 51 | 21 | KeyError: dataset has no key "image"
### Describe the bug
I've loaded a local image dataset with:
`ds = laod_dataset("imagefolder", data_dir=path-to-data)`
And defined a transform to process the data, following the Datasets docs.
However, I get a keyError error, indicating there's no "image" key in my dataset. When I printed out the example_batch sent to the transformation function, it shows only the labels are being sent to the function.
For some reason, the images are not in the example batches.
### Steps to reproduce the bug
I'm using the latest stable version of datasets
### Expected behavior
I expect the example_batches to contain both images and labels
### Environment info
I'm using the latest stable version of datasets
The `remove_columns=["image"]` argument in the `.map` call removes the `image` column from the output, so drop this argument to preserve it. | [
-1.1705082654953003,
-0.9761772155761719,
-0.9978625178337097,
1.4372361898422241,
-0.19130155444145203,
-1.3484487533569336,
0.14734625816345215,
-1.2010046243667603,
1.7176117897033691,
-0.9727316498756409,
0.27451565861701965,
-1.7099891901016235,
0.08859211206436157,
-0.5738220810890198,
-0.701682448387146,
-0.9426342844963074,
-0.3480087220668793,
-0.7283479571342468,
1.0102790594100952,
2.5096540451049805,
1.1884801387786865,
-1.2896901369094849,
2.735440969467163,
0.7648870348930359,
-0.12253248691558838,
-0.972828209400177,
0.6166423559188843,
-0.05271654203534126,
-1.2153894901275635,
-0.4956766366958618,
-0.901776909828186,
-0.02583441324532032,
-0.46844515204429626,
-0.5089779496192932,
-0.062335990369319916,
0.4035801291465759,
-0.2880679965019226,
-0.47218671441078186,
-0.5870861411094666,
-0.8694013357162476,
0.40008267760276794,
-0.42125120759010315,
1.0326396226882935,
-0.46545401215553284,
1.9068611860275269,
-0.4457106590270996,
0.38227593898773193,
0.8100413680076599,
1.340503215789795,
0.1467057168483734,
-0.0019809268414974213,
0.223072811961174,
0.42152443528175354,
-0.012930412776768208,
0.3156391382217407,
0.968376100063324,
0.5220723152160645,
0.6037536263465881,
0.7614989876747131,
-2.218498468399048,
1.2292721271514893,
-1.0382357835769653,
0.27516767382621765,
1.4283818006515503,
-0.9896321296691895,
0.36060065031051636,
-1.7625101804733276,
-0.0798163115978241,
0.597579300403595,
-2.21449613571167,
0.2480962872505188,
-1.1979435682296753,
-0.5069314241409302,
0.9361940026283264,
0.32265719771385193,
-1.2062605619430542,
0.0847308337688446,
-0.44203245639801025,
1.055422067642212,
0.5638985633850098,
1.1386054754257202,
-1.7214744091033936,
-0.01072498969733715,
-0.3592568635940552,
0.017409799620509148,
-1.4486445188522339,
-1.5033835172653198,
0.4903813898563385,
0.6178022623062134,
0.614479660987854,
-0.09905444085597992,
0.997032105922699,
-0.8759922981262207,
0.6750573515892029,
-0.8592489361763,
-1.7414357662200928,
-1.2522915601730347,
-2.2891695499420166,
-2.297525405883789,
0.7406355142593384,
-0.4904175400733948,
-0.6020832657814026,
2.049990653991699,
-1.0687342882156372,
-1.718032956123352,
1.1845083236694336,
0.18265509605407715,
-0.007833173498511314,
2.4510490894317627,
0.23595577478408813,
-0.6148956418037415,
0.44217726588249207,
-0.7087555527687073,
0.8326401710510254,
-0.5010907649993896,
1.2696952819824219,
0.48492032289505005,
-1.0635285377502441,
1.613479495048523,
-0.48658764362335205,
0.5955509543418884,
-0.6748907566070557,
-0.40135708451271057,
-0.9660249352455139,
0.3655020594596863,
1.7648485898971558,
-0.28155338764190674,
1.6157660484313965,
-0.37078940868377686,
-1.567745327949524,
-1.7018095254898071,
0.9019357562065125,
0.41745495796203613,
-0.762988269329071,
0.25321388244628906,
-0.2533853352069855,
0.08913855254650116,
-0.0664089098572731,
1.1538641452789307,
1.240824580192566,
0.661885678768158,
-0.34224778413772583,
-0.832756519317627,
0.28105953335762024,
-0.08502659201622009,
-0.7670466899871826,
-1.6949812173843384,
-0.3273668885231018,
0.10459260642528534,
0.6716192960739136,
-1.1512352228164673,
1.7350438833236694,
0.8737611174583435,
1.8730612993240356,
1.0388325452804565,
-0.33474957942962646,
1.4368184804916382,
0.070842444896698,
1.9210559129714966,
-0.5237415432929993,
0.6996630430221558,
-0.2570311725139618,
-1.1089295148849487,
0.8612933158874512,
-0.36577296257019043,
-1.9729115962982178,
-0.9277735352516174,
-0.8546754121780396,
-0.21123935282230377,
-0.7006086111068726,
0.9328662157058716,
-0.45296797156333923,
-1.2781741619110107,
0.3409702479839325,
-0.6374394297599792,
0.04363393783569336,
-1.3013813495635986,
0.37581172585487366,
0.6871725916862488,
-0.6095049381256104,
-0.021427009254693985,
-0.24534524977207184,
-1.294745922088623,
-0.44308504462242126,
0.26606112718582153,
1.9232819080352783,
-0.7302612662315369,
0.9963327050209045,
0.9729776978492737,
-0.7801976799964905,
-0.09960216283798218,
0.27998480200767517,
-0.3187064528465271,
0.8710705041885376,
-1.1317943334579468,
-0.5443132519721985,
1.1903897523880005,
-0.28157585859298706,
-0.6578485369682312,
1.5158369541168213,
0.6749571561813354,
-1.072453498840332,
-0.17856639623641968,
-0.14893408119678497,
-0.964664876461029,
0.08887410163879395,
-1.62071692943573,
-0.12432923913002014,
0.3264448344707489,
-1.5000900030136108,
-0.5601488947868347,
-0.17115037143230438,
1.2591485977172852,
-0.1244010180234909,
1.3709664344787598,
-0.440032422542572,
-0.32884570956230164,
-0.3930351436138153,
-0.43271514773368835,
0.1963803917169571,
-0.1850689798593521,
-0.7043097615242004,
0.14352694153785706,
-0.7437850832939148,
0.2967838943004608,
1.3483028411865234,
0.35793039202690125,
0.10518397390842438,
0.5872412323951721,
1.046851634979248,
0.33111104369163513,
-0.05864718183875084,
-0.9154723882675171,
-1.5188168287277222,
1.9770324230194092,
-1.4112863540649414,
1.890008807182312,
0.7484974265098572,
-0.07869699597358704,
-1.8171871900558472,
-1.8388149738311768,
1.4196510314941406,
1.2342652082443237,
2.125288486480713,
0.6173048615455627,
0.4368601143360138,
-0.7990807294845581,
-0.7362107038497925,
0.2566588521003723,
-1.0598118305206299,
-0.7214241027832031,
0.12789978086948395,
2.304811954498291,
1.7533683776855469,
-0.4387902319431305,
-0.16567374765872955,
-1.0892890691757202,
1.2409331798553467,
-0.09038366377353668,
0.18308697640895844,
1.9695231914520264,
-0.349239706993103,
-1.0783023834228516,
1.195200800895691,
-2.2624645233154297,
0.07176028192043304,
1.9686098098754883,
0.23779675364494324,
0.008207127451896667,
-1.3651632070541382,
-0.7245022654533386,
-0.27150365710258484,
-0.3812881410121918,
-1.2873038053512573,
0.568556010723114,
-0.35143405199050903,
-0.6351412534713745,
-1.4610011577606201,
0.20630396902561188,
-1.0743247270584106,
-1.5967878103256226,
0.2089938521385193,
1.8806838989257812,
2.082812786102295,
-0.7011967301368713,
1.5874786376953125,
-0.21098117530345917,
0.20827031135559082,
1.2490465641021729,
1.1931047439575195,
3.0836284160614014,
1.9135773181915283,
-1.3212627172470093,
0.6520308256149292,
0.018188875168561935,
-0.5296123027801514,
1.2279552221298218,
-1.0602855682373047,
1.3780193328857422,
-0.14426390826702118,
-1.19296133518219,
-1.3125383853912354,
0.8189199566841125,
0.44542956352233887,
0.08680227398872375,
-0.4559703469276428,
1.308801531791687,
-0.0533449724316597,
1.3180478811264038,
0.5940808653831482,
-0.42597827315330505,
0.6170838475227356,
-0.4492008090019226,
-0.5263661742210388,
1.588178277015686,
0.21351070702075958,
-1.4137883186340332,
-2.335120439529419,
-0.3067270815372467,
-0.7650061845779419,
0.10217706859111786,
-0.6221940517425537,
-0.9676453471183777,
1.696204423904419,
0.4128897786140442,
-1.1407315731048584,
-0.3842754364013672,
-0.42282816767692566,
-0.7337626218795776,
2.6916966438293457,
-1.4722503423690796,
-0.2520412802696228,
-0.9670037031173706,
-0.6238924264907837,
1.5642714500427246,
-1.3023964166641235,
-0.19994717836380005,
-1.0760420560836792,
-0.5383725166320801,
-1.3647165298461914,
-0.5065896511077881,
0.006159747019410133,
-0.9758632183074951,
0.9847206473350525,
0.1794527918100357,
-1.0505377054214478,
-0.158784419298172,
-0.883508026599884,
0.8043684363365173,
-0.21860510110855103,
0.3341350555419922,
1.8861334323883057,
0.5566165447235107,
-0.3938756287097931,
0.7276028394699097,
1.164171576499939,
0.6784828305244446,
-0.665742039680481,
0.17781110107898712,
-0.7980358600616455,
0.22752529382705688,
-1.1558209657669067,
0.2416069507598877,
-2.827988624572754,
0.5542987585067749,
-0.0728817731142044,
-0.07789777219295502,
0.03161635622382164,
-1.277510166168213,
0.9923855662345886,
2.5909922122955322,
-1.2773001194000244,
0.4345278739929199,
0.23182906210422516,
1.3187892436981201,
-1.637089490890503,
0.37693315744400024,
-0.3701610565185547,
2.0728821754455566,
0.18147313594818115,
1.114761471748352,
-0.47164690494537354,
-2.2022531032562256,
0.6926950812339783,
-1.264341115951538,
-1.2735695838928223,
0.812906801700592,
-0.7924019694328308,
0.06191791221499443,
-1.4644962549209595,
-0.2822890281677246,
-0.7641288042068481,
-1.2868010997772217,
0.7715675830841064,
0.14850656688213348,
0.5001230239868164,
-0.5278065204620361,
0.23430757224559784,
-2.2045578956604004,
-1.4017558097839355,
-0.26915010809898376,
-0.9246041178703308,
0.4117926359176636,
-0.37678757309913635,
0.7688598036766052,
-0.24091845750808716,
0.15351340174674988,
0.3347909450531006,
1.4294991493225098,
3.599234104156494,
0.3199510872364044,
0.3992924988269806,
-0.11897246539592743,
-0.9178907871246338,
1.5052152872085571,
0.9396361708641052,
-0.08114765584468842,
-0.5199062824249268,
-1.0122331380844116,
1.2164322137832642,
1.9503644704818726,
0.9775022864341736,
0.12042993307113647,
-0.7596070766448975,
-0.5434255599975586,
-0.12452596426010132,
0.18656684458255768,
0.4425508379936218,
0.8617138266563416,
0.04712020233273506,
0.04765542969107628,
1.5453710556030273,
1.1679104566574097,
-0.4013272523880005,
0.39331886172294617,
-0.7628528475761414,
-0.43786096572875977,
0.6606765389442444,
0.32887494564056396,
0.008786620572209358,
0.32501399517059326,
-0.9571444392204285,
-0.28083181381225586,
-0.4662344753742218,
-0.9543901681900024,
-0.6061185598373413,
-0.42291733622550964,
-0.3345082104206085,
1.607456922531128,
0.1361560821533203,
-0.5581021308898926,
-0.1325514316558838,
-0.7759140133857727,
-0.14212332665920258,
-1.1188881397247314,
0.14690297842025757,
-0.1978309154510498,
-0.19651931524276733,
-0.040100276470184326,
1.8174667358398438,
-1.0266931056976318,
-2.127666473388672,
0.2356473058462143,
0.289201021194458,
-0.24299980700016022,
0.25779610872268677,
1.5886863470077515,
0.4501771628856659,
1.4608378410339355,
1.3296986818313599,
0.9371941685676575,
-0.8114861845970154,
-1.3355472087860107,
0.6195598244667053,
0.9318901300430298,
-1.3679955005645752,
0.7665260434150696,
0.03253249451518059,
-0.6252303719520569,
0.7349536418914795,
1.2459408044815063,
0.44621479511260986,
-1.9198298454284668,
0.8167243003845215,
-0.8968430757522583,
0.8547625541687012,
0.7283759117126465,
0.7436956167221069,
0.17874617874622345,
0.8433784246444702,
-1.221687912940979,
-1.184369444847107,
-0.7593655586242676,
-0.6226550340652466,
1.9590853452682495,
-0.24893081188201904,
0.6304569840431213,
-0.2082625776529312,
-1.279212236404419,
-0.04072079434990883,
0.6705963611602783,
0.36349478363990784,
-0.2922344505786896,
0.7335960865020752,
-0.7343847155570984,
-1.058453917503357,
-1.5155279636383057,
-0.37107962369918823,
-1.0318539142608643,
-0.9390556812286377,
1.1440980434417725,
0.8425918817520142,
0.20254729688167572,
1.8378713130950928,
0.7041981816291809,
0.20286139845848083,
-2.534226655960083,
0.834185779094696,
0.26558974385261536,
0.04041717201471329,
0.8439230918884277,
0.36484113335609436,
1.0884817838668823,
-0.005575312301516533,
0.41132962703704834,
-2.319424867630005,
2.2698826789855957,
-0.37302327156066895,
0.641380786895752,
-0.07624408602714539,
-0.23973968625068665,
1.1868740320205688,
0.491548091173172,
0.5470455288887024,
-1.0287396907806396,
0.6983935832977295,
-0.5640369653701782,
1.2035235166549683,
0.9936371445655823,
-0.8522992730140686,
-0.012517660856246948,
1.407240867614746,
0.6045035719871521,
-0.5376172065734863,
-0.9000958204269409,
-0.9231177568435669,
0.9480453729629517,
1.771024465560913,
0.022246241569519043,
0.03326825797557831,
0.78270423412323,
0.6110000610351562,
-1.2766658067703247,
0.13361847400665283,
-0.7923537492752075,
-0.7786345481872559,
1.6797292232513428,
2.0285983085632324,
-0.12098880112171173,
-0.19417189061641693,
-0.7899569869041443,
-1.2361373901367188,
0.8247267603874207,
0.018428685143589973,
0.1381901204586029,
0.6986647844314575,
-0.6547231674194336,
0.9950330853462219,
0.9418469667434692,
0.9642174243927002,
0.2866087257862091,
0.31468814611434937,
0.48364436626434326,
-0.30383405089378357,
-1.0464987754821777,
-0.1558365374803543,
-1.0856859683990479,
-2.476217031478882,
0.4954546391963959,
-0.3398151397705078,
-1.4755818843841553,
-0.049577221274375916,
-0.9526911973953247,
1.0641249418258667,
-0.4983651638031006,
-1.1081022024154663,
-1.6069812774658203,
0.22411814332008362,
-0.12448957562446594,
0.8992865085601807,
-1.5013505220413208,
-0.1557844877243042,
1.327258825302124,
0.95100998878479,
-0.7187322378158569,
0.9888707399368286,
0.1469048261642456,
1.0748770236968994,
0.7226306796073914,
-0.4280480146408081,
0.3866855800151825,
-0.05767137184739113,
-1.3985579013824463,
0.4869650602340698,
1.0220749378204346,
0.18669655919075012,
1.485787272453308,
-0.4811406135559082,
0.061787109822034836,
0.3451564311981201,
-0.32752111554145813,
-0.5717146396636963,
-0.5881040096282959,
0.673163890838623,
0.0433746762573719,
-0.7661015391349792,
0.12331549823284149,
-0.04586765915155411,
-0.315067857503891,
0.20111507177352905,
-1.4146075248718262,
-0.16685163974761963,
-0.45445626974105835,
-0.6699537634849548,
-1.268799901008606,
-0.03174858167767525,
1.3829995393753052,
-0.6347284317016602,
-0.18202584981918335,
0.5276080369949341,
0.4759299159049988,
0.4665720462799072,
0.590105414390564,
-0.6523979902267456,
-0.23633116483688354,
-0.3158259391784668,
-0.3007981479167938,
0.3201552927494049,
1.297043800354004,
-0.21654798090457916,
-1.010669231414795,
0.7073075771331787,
-0.26556718349456787,
0.07937109470367432,
1.9481630325317383,
0.16850832104682922,
-0.784997820854187,
0.23110555112361908,
-0.76534104347229,
1.9263452291488647,
1.69426429271698,
1.4042418003082275,
-0.07042547315359116,
-0.9783445000648499,
0.5739683508872986,
-0.2345236986875534,
-0.3406393826007843,
0.997247040271759,
0.45269355177879333,
-0.08835731446743011,
-1.4159823656082153,
0.7292499542236328,
1.2342488765716553,
-0.8777531385421753,
-0.8138231039047241,
0.04024091362953186,
-0.7774261236190796,
1.0351403951644897,
0.7057740092277527,
0.5328938364982605,
0.34137657284736633,
1.656704306602478,
0.6941885352134705,
-0.5755652785301208,
0.523308277130127,
0.5433382391929626,
-0.10649923980236053,
-2.0304791927337646,
-1.1831998825073242,
0.3727706968784332,
-0.5414822101593018,
-1.605389952659607,
1.4394627809524536,
-1.1502739191055298,
-0.9141669869422913,
0.5540972948074341,
0.17782090604305267,
1.452567219734192,
0.3103277087211609,
1.5210548639297485,
2.0245819091796875,
0.8184267282485962,
0.34163522720336914,
1.3266700506210327,
-0.17835138738155365,
-0.386951208114624,
1.8793381452560425,
-0.3675859570503235,
0.3893938660621643,
1.099941611289978,
-0.3659646213054657,
-1.1023231744766235,
-0.6908797025680542,
-1.0985158681869507,
-0.634545087814331,
1.1627445220947266,
0.07033832371234894,
-1.0262643098831177,
0.19005079567432404,
1.5141582489013672,
0.14298522472381592,
-0.3725152313709259,
0.6714550256729126,
0.5169754028320312,
-0.8252065777778625,
-0.03500943258404732,
-0.947273850440979,
0.5553775429725647,
-0.16341935098171234,
-0.35778385400772095,
0.43770262598991394,
0.4574190080165863,
1.3605854511260986,
-0.11335210502147675,
0.1969478875398636,
1.2635565996170044,
-1.31378972530365,
1.4609217643737793,
-0.6418728232383728,
0.14922551810741425,
-2.340402841567993,
1.3984633684158325,
-0.7222198843955994,
1.8778116703033447,
-2.6120545864105225,
0.3377191424369812,
-0.6653237342834473,
-0.2942347526550293,
0.3549126088619232,
-0.4160540997982025,
0.08104148507118225,
-0.20194822549819946,
-1.0983319282531738,
-0.04029808193445206,
-0.7149404883384705,
0.627565324306488,
1.2523558139801025,
1.3514187335968018,
-1.0552735328674316,
-0.2101101279258728,
-1.7310677766799927,
-0.1814642697572708,
-0.7329192161560059,
0.3761586546897888,
-2.012868642807007,
-0.26824599504470825,
-1.923254132270813,
-2.507117748260498,
-1.3562933206558228,
-0.7554112672805786,
1.1956253051757812,
0.21153700351715088,
-0.9967884421348572,
1.2003862857818604,
-0.41881468892097473,
-1.879589557647705,
1.104267954826355,
-2.183274984359741
] |
https://github.com/huggingface/datasets/issues/6069 | KeyError: dataset has no key "image" | The problem is not with the removal of the image key. The bug is why only the labels are sent to be process, instead of all the featues or dictionary keys.
P.S. I just dropped the removal argument as you've suggested, but that didn't solve the problem, because only the labels are being sent to be processed | ### Describe the bug
I've loaded a local image dataset with:
`ds = laod_dataset("imagefolder", data_dir=path-to-data)`
And defined a transform to process the data, following the Datasets docs.
However, I get a keyError error, indicating there's no "image" key in my dataset. When I printed out the example_batch sent to the transformation function, it shows only the labels are being sent to the function.
For some reason, the images are not in the example batches.
### Steps to reproduce the bug
I'm using the latest stable version of datasets
### Expected behavior
I expect the example_batches to contain both images and labels
### Environment info
I'm using the latest stable version of datasets | 51 | 57 | KeyError: dataset has no key "image"
### Describe the bug
I've loaded a local image dataset with:
`ds = laod_dataset("imagefolder", data_dir=path-to-data)`
And defined a transform to process the data, following the Datasets docs.
However, I get a keyError error, indicating there's no "image" key in my dataset. When I printed out the example_batch sent to the transformation function, it shows only the labels are being sent to the function.
For some reason, the images are not in the example batches.
### Steps to reproduce the bug
I'm using the latest stable version of datasets
### Expected behavior
I expect the example_batches to contain both images and labels
### Environment info
I'm using the latest stable version of datasets
The problem is not with the removal of the image key. The bug is why only the labels are sent to be process, instead of all the featues or dictionary keys.
P.S. I just dropped the removal argument as you've suggested, but that didn't solve the problem, because only the labels are being sent to be processed | [
-1.1786153316497803,
-0.9939639568328857,
-0.9947094917297363,
1.3766529560089111,
-0.24062664806842804,
-1.2966949939727783,
0.09172168374061584,
-1.222991704940796,
1.6651229858398438,
-0.9775608777999878,
0.26388615369796753,
-1.6799390316009521,
0.0680551677942276,
-0.5430256724357605,
-0.7078108787536621,
-0.9635455012321472,
-0.37877240777015686,
-0.772977888584137,
0.9955487847328186,
2.580137252807617,
1.1385366916656494,
-1.3377724885940552,
2.715064525604248,
0.7699050307273865,
-0.09476617723703384,
-0.9719046354293823,
0.6622390747070312,
-0.12758371233940125,
-1.2412405014038086,
-0.5399913191795349,
-0.908200740814209,
-0.009430673904716969,
-0.48693355917930603,
-0.4908277094364166,
-0.011925104074180126,
0.36250296235084534,
-0.24275441467761993,
-0.4119980037212372,
-0.6206687092781067,
-0.8999953269958496,
0.4864178001880646,
-0.4342956840991974,
1.0406655073165894,
-0.4150436818599701,
1.9079777002334595,
-0.38191482424736023,
0.33459267020225525,
0.8254538774490356,
1.3616048097610474,
0.1528584361076355,
-0.02587435394525528,
0.2347651571035385,
0.4585006535053253,
-0.015069065615534782,
0.2929585874080658,
0.9720757007598877,
0.5528084635734558,
0.5400999188423157,
0.7548627853393555,
-2.2076988220214844,
1.2713695764541626,
-1.0669687986373901,
0.28079885244369507,
1.4561636447906494,
-0.9801076650619507,
0.41094276309013367,
-1.7470269203186035,
-0.09330615401268005,
0.5820640325546265,
-2.2555699348449707,
0.2109738141298294,
-1.169692039489746,
-0.5001030564308167,
0.9371587038040161,
0.3105665445327759,
-1.2157247066497803,
0.1265726536512375,
-0.46824735403060913,
1.091543197631836,
0.5701645612716675,
1.1309702396392822,
-1.7267301082611084,
-0.06610516458749771,
-0.2968742847442627,
0.0752812996506691,
-1.4569653272628784,
-1.508529782295227,
0.4698978662490845,
0.669291615486145,
0.5197762250900269,
-0.06667246669530869,
0.9767686724662781,
-0.8807365894317627,
0.7198178768157959,
-0.8504170775413513,
-1.6939936876296997,
-1.3073217868804932,
-2.278803825378418,
-2.2894773483276367,
0.7599841952323914,
-0.4828008711338043,
-0.6431673765182495,
2.058567523956299,
-1.127137541770935,
-1.7123616933822632,
1.2444490194320679,
0.13697388768196106,
0.036746617406606674,
2.4925971031188965,
0.19734789431095123,
-0.6344534754753113,
0.4445922076702118,
-0.6871989369392395,
0.8527303338050842,
-0.4977346360683441,
1.2543938159942627,
0.47485747933387756,
-1.0083048343658447,
1.647918701171875,
-0.5233420133590698,
0.5917549729347229,
-0.6488480567932129,
-0.4566792845726013,
-0.9528099894523621,
0.40573185682296753,
1.7669026851654053,
-0.3091212809085846,
1.5829899311065674,
-0.3693346083164215,
-1.5769678354263306,
-1.7183963060379028,
0.9317945241928101,
0.3886391520500183,
-0.8378315567970276,
0.22746364772319794,
-0.2516211271286011,
0.06976459920406342,
-0.026647858321666718,
1.1154073476791382,
1.2626982927322388,
0.6364004611968994,
-0.3167131543159485,
-0.8619822859764099,
0.2954103350639343,
-0.1315915733575821,
-0.7191848754882812,
-1.729332685470581,
-0.36108773946762085,
0.08935559540987015,
0.7031299471855164,
-1.202925682067871,
1.723617434501648,
0.8919488191604614,
1.8496161699295044,
1.0428780317306519,
-0.38172447681427,
1.4401237964630127,
0.04528709501028061,
1.8825337886810303,
-0.5501512289047241,
0.7044243812561035,
-0.3118422031402588,
-1.1077556610107422,
0.8492299914360046,
-0.324165403842926,
-1.978535771369934,
-0.8879222273826599,
-0.8632210493087769,
-0.27114206552505493,
-0.6992775201797485,
0.9627887010574341,
-0.469234824180603,
-1.2325406074523926,
0.3672250807285309,
-0.6241467595100403,
0.07555384188890457,
-1.2702786922454834,
0.4122470021247864,
0.7205937504768372,
-0.5838174819946289,
-0.008739237673580647,
-0.22574441134929657,
-1.3117579221725464,
-0.435129851102829,
0.27343714237213135,
1.9116088151931763,
-0.7453129291534424,
0.9470475912094116,
0.9413137435913086,
-0.7138969898223877,
-0.10688821971416473,
0.28575241565704346,
-0.31404292583465576,
0.8436080813407898,
-1.0867934226989746,
-0.5360297560691833,
1.1755247116088867,
-0.2969208061695099,
-0.6241940259933472,
1.4681451320648193,
0.688169538974762,
-1.092209815979004,
-0.21171462535858154,
-0.18311335146427155,
-0.9760746359825134,
0.08275754749774933,
-1.6502512693405151,
-0.13650836050510406,
0.27585726976394653,
-1.575870394706726,
-0.5314016342163086,
-0.16475634276866913,
1.2503889799118042,
-0.13440760970115662,
1.4231832027435303,
-0.5160874724388123,
-0.2885797917842865,
-0.40410315990448,
-0.4172157347202301,
0.22469423711299896,
-0.18059159815311432,
-0.7086727619171143,
0.15752671658992767,
-0.8264632225036621,
0.28079378604888916,
1.375213861465454,
0.4412772059440613,
0.11144299060106277,
0.5872074365615845,
1.0331141948699951,
0.3400173485279083,
-0.061584196984767914,
-0.9248684644699097,
-1.4865803718566895,
2.0408742427825928,
-1.441138505935669,
1.876797080039978,
0.7470148801803589,
-0.05681395158171654,
-1.8019719123840332,
-1.8189761638641357,
1.3699129819869995,
1.2262537479400635,
2.0727040767669678,
0.5999653935432434,
0.42610231041908264,
-0.8302817344665527,
-0.7065634727478027,
0.2987404465675354,
-1.0993504524230957,
-0.7489031553268433,
0.07803598791360855,
2.3286728858947754,
1.7763087749481201,
-0.4444754719734192,
-0.17248982191085815,
-1.052702784538269,
1.293994665145874,
-0.10246244817972183,
0.17861999571323395,
1.9780480861663818,
-0.33018019795417786,
-1.0511597394943237,
1.176711082458496,
-2.2915074825286865,
0.10618568956851959,
1.9489526748657227,
0.24001166224479675,
0.04092010110616684,
-1.3766310214996338,
-0.7139657735824585,
-0.2430446296930313,
-0.3742400109767914,
-1.2780232429504395,
0.5859585404396057,
-0.35698238015174866,
-0.7005186080932617,
-1.4358561038970947,
0.17985749244689941,
-1.1228123903274536,
-1.6122382879257202,
0.19599159061908722,
1.8402886390686035,
2.1071133613586426,
-0.6725550293922424,
1.6085160970687866,
-0.202705979347229,
0.23078720271587372,
1.234189748764038,
1.2022064924240112,
3.1120378971099854,
1.9632354974746704,
-1.3202389478683472,
0.6168633699417114,
-0.003312331158667803,
-0.491858571767807,
1.1709728240966797,
-1.0651015043258667,
1.3777393102645874,
-0.1804419308900833,
-1.254289150238037,
-1.2208744287490845,
0.8979174494743347,
0.46504753828048706,
0.08649802207946777,
-0.46126168966293335,
1.3400182723999023,
-0.08550254255533218,
1.3151774406433105,
0.5818681120872498,
-0.433914452791214,
0.6207984089851379,
-0.4943556487560272,
-0.5791488289833069,
1.565693736076355,
0.21241483092308044,
-1.4111987352371216,
-2.3172781467437744,
-0.3399994969367981,
-0.7488008737564087,
0.053903646767139435,
-0.5868765115737915,
-0.9412263035774231,
1.6755573749542236,
0.37089335918426514,
-1.1712850332260132,
-0.4595002830028534,
-0.4772090017795563,
-0.7217670679092407,
2.6615450382232666,
-1.5736982822418213,
-0.27170705795288086,
-0.9192596673965454,
-0.58699631690979,
1.52888822555542,
-1.3511799573898315,
-0.16509297490119934,
-1.091884732246399,
-0.5894736647605896,
-1.3607510328292847,
-0.5332844257354736,
-0.0914231687784195,
-0.9974116683006287,
0.9333106875419617,
0.1965438574552536,
-1.0203875303268433,
-0.15536907315254211,
-0.8898130059242249,
0.7738508582115173,
-0.16081593930721283,
0.3159898519515991,
1.882050633430481,
0.4973008632659912,
-0.41640737652778625,
0.7063028216362,
1.1868194341659546,
0.6983816623687744,
-0.6790205836296082,
0.11114051192998886,
-0.7996887564659119,
0.25127974152565,
-1.168829083442688,
0.26687586307525635,
-2.8129093647003174,
0.5923309326171875,
-0.08173612505197525,
-0.05958562716841698,
0.02972067892551422,
-1.227514624595642,
0.9745692610740662,
2.5750906467437744,
-1.2627619504928589,
0.44524505734443665,
0.19639696180820465,
1.3124680519104004,
-1.688246726989746,
0.38082095980644226,
-0.37990421056747437,
2.1083757877349854,
0.1980835497379303,
1.1156924962997437,
-0.4568875730037689,
-2.2026379108428955,
0.6695073843002319,
-1.21979558467865,
-1.2712141275405884,
0.8260022401809692,
-0.784651517868042,
0.03122880682349205,
-1.47818922996521,
-0.22928468883037567,
-0.7857283353805542,
-1.2615936994552612,
0.8002748489379883,
0.14722250401973724,
0.5046339631080627,
-0.5302310585975647,
0.21755805611610413,
-2.1805803775787354,
-1.3923120498657227,
-0.2872432768344879,
-0.8868769407272339,
0.42152899503707886,
-0.37956878542900085,
0.763129472732544,
-0.23209044337272644,
0.12110204249620438,
0.3711299002170563,
1.391652226448059,
3.593618869781494,
0.32500970363616943,
0.41153308749198914,
-0.1454521119594574,
-0.9024775624275208,
1.473901629447937,
0.9638633131980896,
-0.1408379077911377,
-0.47913026809692383,
-0.932759165763855,
1.2550452947616577,
1.9294357299804688,
0.9474406838417053,
0.11095261573791504,
-0.7247631549835205,
-0.5076263546943665,
-0.08461043238639832,
0.19941073656082153,
0.48110151290893555,
0.8617774844169617,
-0.00147185567766428,
0.06493359804153442,
1.548879623413086,
1.1975758075714111,
-0.37283700704574585,
0.3939603269100189,
-0.7296088337898254,
-0.4543844163417816,
0.646168053150177,
0.3425792455673218,
-0.028358623385429382,
0.35471174120903015,
-0.9132561683654785,
-0.25300613045692444,
-0.4494606554508209,
-1.0173932313919067,
-0.5887869000434875,
-0.40215760469436646,
-0.3104798495769501,
1.6049741506576538,
0.2045028954744339,
-0.5577015280723572,
-0.10190047323703766,
-0.770176887512207,
-0.17515654861927032,
-1.1159154176712036,
0.1505981683731079,
-0.18468274176120758,
-0.20862528681755066,
-0.09472765773534775,
1.7869404554367065,
-0.9723242521286011,
-2.1236531734466553,
0.22571143507957458,
0.2771329879760742,
-0.26112228631973267,
0.25907737016677856,
1.5675517320632935,
0.40821993350982666,
1.4877057075500488,
1.3531471490859985,
0.8910672664642334,
-0.792549192905426,
-1.2695499658584595,
0.602306604385376,
0.919489860534668,
-1.438661813735962,
0.7957078814506531,
0.01512907724827528,
-0.6215924024581909,
0.7577768564224243,
1.258553147315979,
0.40226805210113525,
-1.940020203590393,
0.8639476895332336,
-0.8969338536262512,
0.8283388614654541,
0.6933006644248962,
0.7460220456123352,
0.21552518010139465,
0.8424738049507141,
-1.2306592464447021,
-1.211668610572815,
-0.7874065637588501,
-0.5897834300994873,
2.0118539333343506,
-0.252871036529541,
0.6259364485740662,
-0.15665091574192047,
-1.2966973781585693,
-0.055184006690979004,
0.6756835579872131,
0.34290120005607605,
-0.26606225967407227,
0.7782056331634521,
-0.7204170227050781,
-1.1250828504562378,
-1.485033392906189,
-0.3497945964336395,
-1.017996907234192,
-0.9194231033325195,
1.1688646078109741,
0.8562129735946655,
0.14903400838375092,
1.8482054471969604,
0.6367053985595703,
0.1755467802286148,
-2.533519983291626,
0.8385719656944275,
0.2958708703517914,
0.02870301529765129,
0.8807543516159058,
0.2825593948364258,
1.0665457248687744,
0.009763299487531185,
0.4164733290672302,
-2.298839569091797,
2.2405779361724854,
-0.37021955847740173,
0.6996712684631348,
-0.07130640745162964,
-0.22329406440258026,
1.1502137184143066,
0.5254483222961426,
0.6134944558143616,
-1.035888910293579,
0.6990929841995239,
-0.6161413192749023,
1.1686580181121826,
1.0111042261123657,
-0.8270638585090637,
0.017031904309988022,
1.3737432956695557,
0.5821468234062195,
-0.5709722638130188,
-0.939004123210907,
-0.867266058921814,
0.9406470060348511,
1.8102612495422363,
-0.006519756279885769,
-0.006615506950765848,
0.7462783455848694,
0.6414218544960022,
-1.3021738529205322,
0.1898028552532196,
-0.7995542287826538,
-0.7994721531867981,
1.6121456623077393,
2.0301547050476074,
-0.14109069108963013,
-0.14328695833683014,
-0.7528708577156067,
-1.2508050203323364,
0.8180590271949768,
0.005497689358890057,
0.1994456648826599,
0.672758162021637,
-0.679837703704834,
1.0293394327163696,
0.920981228351593,
0.9501258134841919,
0.24731509387493134,
0.312779039144516,
0.4302563965320587,
-0.29291579127311707,
-1.0145357847213745,
-0.19354791939258575,
-1.079854130744934,
-2.4771013259887695,
0.5067405104637146,
-0.3483405113220215,
-1.4833687543869019,
-0.004084257408976555,
-0.9244435429573059,
1.0687615871429443,
-0.5147899389266968,
-1.0943284034729004,
-1.619478702545166,
0.25974076986312866,
-0.07978505641222,
0.8989534378051758,
-1.536217451095581,
-0.10559576749801636,
1.3371381759643555,
0.956059992313385,
-0.6531107425689697,
1.0317221879959106,
0.20036306977272034,
1.102043628692627,
0.7087883949279785,
-0.41684743762016296,
0.3729041516780853,
-0.02599553018808365,
-1.373935580253601,
0.4792294204235077,
1.0365025997161865,
0.21232090890407562,
1.4346717596054077,
-0.5248634815216064,
0.05930487811565399,
0.3482908308506012,
-0.3985603451728821,
-0.5403459072113037,
-0.5437778234481812,
0.7115463614463806,
0.057468481361866,
-0.725251317024231,
0.11870358139276505,
-0.11701266467571259,
-0.3219607472419739,
0.21889160573482513,
-1.3924094438552856,
-0.22952231764793396,
-0.4725213646888733,
-0.5947048664093018,
-1.297735333442688,
-0.06190938502550125,
1.411278486251831,
-0.64382004737854,
-0.17261788249015808,
0.5556009411811829,
0.533512532711029,
0.46544939279556274,
0.6206798553466797,
-0.6386094689369202,
-0.24873889982700348,
-0.28268370032310486,
-0.2818761169910431,
0.2965807318687439,
1.2866240739822388,
-0.22227542102336884,
-0.971031129360199,
0.7461649179458618,
-0.29443642497062683,
0.06077723205089569,
1.9313743114471436,
0.17546966671943665,
-0.7566700577735901,
0.25924208760261536,
-0.7582448720932007,
1.906366229057312,
1.7209653854370117,
1.3964335918426514,
-0.07756607234477997,
-0.9852796196937561,
0.5903064012527466,
-0.22638443112373352,
-0.33264440298080444,
1.0070850849151611,
0.4937717914581299,
-0.11014172434806824,
-1.385662317276001,
0.7249521017074585,
1.1645314693450928,
-0.8727999329566956,
-0.7840605974197388,
0.03461071103811264,
-0.7657725214958191,
1.0522719621658325,
0.6789928674697876,
0.5588052868843079,
0.245435431599617,
1.6795212030410767,
0.6948917508125305,
-0.6199702620506287,
0.52037513256073,
0.5655012130737305,
-0.15977932512760162,
-2.036674737930298,
-1.1584289073944092,
0.3715924024581909,
-0.4531523585319519,
-1.621317744255066,
1.3965222835540771,
-1.1466152667999268,
-0.9068245887756348,
0.5233815908432007,
0.1652321070432663,
1.3986738920211792,
0.295550137758255,
1.5428701639175415,
2.067657709121704,
0.8340109586715698,
0.346464604139328,
1.3692141771316528,
-0.16575978696346283,
-0.32158371806144714,
1.8636107444763184,
-0.37219327688217163,
0.4017012119293213,
1.1193394660949707,
-0.40260645747184753,
-1.0386396646499634,
-0.6793844103813171,
-1.0733238458633423,
-0.5887347459793091,
1.1617982387542725,
0.06934874504804611,
-1.003699779510498,
0.1974998414516449,
1.518312692642212,
0.11135990917682648,
-0.3864098787307739,
0.6277115345001221,
0.5502204895019531,
-0.773430347442627,
-0.024107281118631363,
-0.9712260365486145,
0.5468153953552246,
-0.2050677388906479,
-0.35033151507377625,
0.49547648429870605,
0.41814538836479187,
1.296157956123352,
-0.08723928779363632,
0.21427874267101288,
1.2573195695877075,
-1.3355225324630737,
1.4403659105300903,
-0.6605411171913147,
0.14918826520442963,
-2.329361915588379,
1.3981255292892456,
-0.7077589631080627,
1.9132969379425049,
-2.5898680686950684,
0.34127387404441833,
-0.737879753112793,
-0.33160480856895447,
0.38174137473106384,
-0.37664029002189636,
0.049786277115345,
-0.184667706489563,
-1.0637023448944092,
0.014937830157577991,
-0.6716722846031189,
0.6183544993400574,
1.2461587190628052,
1.3726550340652466,
-1.0629264116287231,
-0.20181229710578918,
-1.7602471113204956,
-0.19819574058055878,
-0.7584353089332581,
0.3977851867675781,
-2.023073673248291,
-0.22973760962486267,
-1.9581714868545532,
-2.475163698196411,
-1.4261966943740845,
-0.7473171949386597,
1.1642255783081055,
0.22691087424755096,
-0.9697116017341614,
1.202702522277832,
-0.45203685760498047,
-1.8525460958480835,
1.1083743572235107,
-2.189915657043457
] |
https://github.com/huggingface/datasets/issues/6069 | KeyError: dataset has no key "image" | All the `image_dataset.column_names` after the `map` call should also be present in `preprocess_train `/`preprocess_val` unless (input) `columns` in `set_transform` are specified.
If that's not the case, we need a full reproducer (not snippets) with the environment info. | ### Describe the bug
I've loaded a local image dataset with:
`ds = laod_dataset("imagefolder", data_dir=path-to-data)`
And defined a transform to process the data, following the Datasets docs.
However, I get a keyError error, indicating there's no "image" key in my dataset. When I printed out the example_batch sent to the transformation function, it shows only the labels are being sent to the function.
For some reason, the images are not in the example batches.
### Steps to reproduce the bug
I'm using the latest stable version of datasets
### Expected behavior
I expect the example_batches to contain both images and labels
### Environment info
I'm using the latest stable version of datasets | 51 | 37 | KeyError: dataset has no key "image"
### Describe the bug
I've loaded a local image dataset with:
`ds = laod_dataset("imagefolder", data_dir=path-to-data)`
And defined a transform to process the data, following the Datasets docs.
However, I get a keyError error, indicating there's no "image" key in my dataset. When I printed out the example_batch sent to the transformation function, it shows only the labels are being sent to the function.
For some reason, the images are not in the example batches.
### Steps to reproduce the bug
I'm using the latest stable version of datasets
### Expected behavior
I expect the example_batches to contain both images and labels
### Environment info
I'm using the latest stable version of datasets
All the `image_dataset.column_names` after the `map` call should also be present in `preprocess_train `/`preprocess_val` unless (input) `columns` in `set_transform` are specified.
If that's not the case, we need a full reproducer (not snippets) with the environment info. | [
-1.1579222679138184,
-0.939723789691925,
-0.9462810754776001,
1.4220147132873535,
-0.1891966313123703,
-1.2969825267791748,
0.16110125184059143,
-1.1809947490692139,
1.7300562858581543,
-1.0112223625183105,
0.29581353068351746,
-1.6760975122451782,
0.04168058559298515,
-0.615085780620575,
-0.7548807859420776,
-0.9561278820037842,
-0.3603673279285431,
-0.7472550272941589,
0.9984289407730103,
2.5039374828338623,
1.166009545326233,
-1.3192211389541626,
2.7076985836029053,
0.7415801286697388,
-0.1552356332540512,
-0.9843882322311401,
0.5801583528518677,
-0.14514108002185822,
-1.1804418563842773,
-0.49666157364845276,
-0.9065219759941101,
-0.022723564878106117,
-0.5435464978218079,
-0.5403812527656555,
-0.006974207237362862,
0.4191204309463501,
-0.32311269640922546,
-0.44608911871910095,
-0.5443940758705139,
-0.8821299076080322,
0.44844675064086914,
-0.42024925351142883,
1.0280355215072632,
-0.436563640832901,
1.9023804664611816,
-0.4656156003475189,
0.397553414106369,
0.7657536864280701,
1.3631402254104614,
0.1853141188621521,
-0.03171234950423241,
0.27504026889801025,
0.41482141613960266,
0.008490712381899357,
0.36857083439826965,
1.0441436767578125,
0.5071980357170105,
0.5611781477928162,
0.761684775352478,
-2.244374990463257,
1.242404580116272,
-1.0252504348754883,
0.26855748891830444,
1.3586490154266357,
-0.9421122670173645,
0.31421172618865967,
-1.733701229095459,
-0.05790406093001366,
0.6234806776046753,
-2.275953531265259,
0.2538365423679352,
-1.2632665634155273,
-0.4837833642959595,
1.0177967548370361,
0.38350844383239746,
-1.1712291240692139,
0.0995410680770874,
-0.38712453842163086,
1.087441086769104,
0.5673169493675232,
1.1561686992645264,
-1.6841909885406494,
-0.07494553178548813,
-0.2921016812324524,
0.05745373293757439,
-1.3856488466262817,
-1.4971749782562256,
0.47775766253471375,
0.6590061187744141,
0.5559875965118408,
-0.09801433235406876,
1.0438611507415771,
-0.891497015953064,
0.6872172951698303,
-0.9328980445861816,
-1.7341889142990112,
-1.2891727685928345,
-2.255685806274414,
-2.315509080886841,
0.7511945962905884,
-0.4667462706565857,
-0.583820104598999,
2.057013750076294,
-1.05256986618042,
-1.7822331190109253,
1.1756125688552856,
0.23624183237552643,
0.011326047591865063,
2.3762547969818115,
0.2625819146633148,
-0.6558173894882202,
0.4761888086795807,
-0.7019979357719421,
0.8347474932670593,
-0.477193146944046,
1.2897995710372925,
0.4715219736099243,
-1.0476078987121582,
1.592929720878601,
-0.556690514087677,
0.6176192164421082,
-0.6564374566078186,
-0.40599483251571655,
-0.9127641916275024,
0.396007239818573,
1.8011236190795898,
-0.30289119482040405,
1.5921741724014282,
-0.3607349395751953,
-1.5719408988952637,
-1.713562250137329,
0.8945847153663635,
0.4183688461780548,
-0.7938517928123474,
0.19709843397140503,
-0.3199766278266907,
0.1192847341299057,
-0.08173811435699463,
1.195407509803772,
1.231260895729065,
0.6953005790710449,
-0.3085687756538391,
-0.8433327078819275,
0.2671564221382141,
-0.07070342451334,
-0.7626532912254333,
-1.7535531520843506,
-0.36776071786880493,
0.15268133580684662,
0.6569579243659973,
-1.1290470361709595,
1.7160494327545166,
0.8492037653923035,
1.8934519290924072,
1.0214438438415527,
-0.3192874789237976,
1.4865686893463135,
0.02695910632610321,
1.9514952898025513,
-0.46373504400253296,
0.6640326380729675,
-0.2958199679851532,
-1.1312328577041626,
0.8278923034667969,
-0.36937984824180603,
-1.986890435218811,
-0.8900443315505981,
-0.8767604231834412,
-0.18511533737182617,
-0.7035633325576782,
0.9392288327217102,
-0.3978147506713867,
-1.302668809890747,
0.2945570945739746,
-0.7154088616371155,
0.08829355239868164,
-1.274849772453308,
0.3608064651489258,
0.7259184718132019,
-0.6514776349067688,
-0.0013308655470609665,
-0.2631593346595764,
-1.2904999256134033,
-0.4585234224796295,
0.2900611162185669,
1.9452760219573975,
-0.8092789649963379,
0.9795234799385071,
0.9625864028930664,
-0.727833092212677,
-0.08867442607879639,
0.25413036346435547,
-0.332533061504364,
0.8542625904083252,
-1.0984148979187012,
-0.470959335565567,
1.2107683420181274,
-0.26476073265075684,
-0.6748222708702087,
1.4811344146728516,
0.7363343238830566,
-1.1135315895080566,
-0.1456567496061325,
-0.21389582753181458,
-0.9014398455619812,
0.07132639735937119,
-1.6301476955413818,
-0.13260313868522644,
0.3688042163848877,
-1.5180364847183228,
-0.5588350892066956,
-0.1742498129606247,
1.2921825647354126,
-0.14803893864154816,
1.438597321510315,
-0.4637240469455719,
-0.22295595705509186,
-0.38170698285102844,
-0.4208274185657501,
0.21304413676261902,
-0.17689228057861328,
-0.7046688795089722,
0.10188271105289459,
-0.7350177764892578,
0.28766560554504395,
1.3602044582366943,
0.35742369294166565,
0.11195801198482513,
0.5551339983940125,
1.1017789840698242,
0.34520936012268066,
-0.002563584130257368,
-0.8888566493988037,
-1.5102189779281616,
2.0445094108581543,
-1.3951404094696045,
1.8836991786956787,
0.7012295722961426,
-0.09036170691251755,
-1.7869791984558105,
-1.874458909034729,
1.4145749807357788,
1.2006816864013672,
2.1551034450531006,
0.5985462069511414,
0.4485856294631958,
-0.8321638107299805,
-0.701816976070404,
0.3589212894439697,
-1.014883041381836,
-0.6994816064834595,
0.06424813717603683,
2.3261711597442627,
1.7926719188690186,
-0.4580919146537781,
-0.19745171070098877,
-1.0310629606246948,
1.3534713983535767,
-0.1791328340768814,
0.2109711915254593,
1.9713293313980103,
-0.3101048171520233,
-1.074963092803955,
1.2077922821044922,
-2.266418218612671,
0.09782443940639496,
2.00020694732666,
0.17671369016170502,
0.04288258031010628,
-1.385101079940796,
-0.6655957698822021,
-0.26763537526130676,
-0.34236621856689453,
-1.2643588781356812,
0.5355009436607361,
-0.2993023097515106,
-0.687774121761322,
-1.4151079654693604,
0.25477689504623413,
-1.0824023485183716,
-1.6232483386993408,
0.19398704171180725,
1.9066243171691895,
2.046124219894409,
-0.711859405040741,
1.5963855981826782,
-0.26297327876091003,
0.21060243248939514,
1.282644510269165,
1.2340630292892456,
3.1568048000335693,
1.8858692646026611,
-1.3447444438934326,
0.6260452270507812,
-0.02562858536839485,
-0.5427815914154053,
1.2391564846038818,
-1.1200271844863892,
1.3321040868759155,
-0.1765507161617279,
-1.203653335571289,
-1.3036808967590332,
0.8291240930557251,
0.507409393787384,
0.10000109672546387,
-0.46160805225372314,
1.3204083442687988,
-0.068485789000988,
1.317395567893982,
0.5907034277915955,
-0.4536491930484772,
0.6330532431602478,
-0.4566185176372528,
-0.5321748852729797,
1.5365113019943237,
0.2205904871225357,
-1.3928453922271729,
-2.2854278087615967,
-0.2766377925872803,
-0.8201526999473572,
0.06472785025835037,
-0.5986937284469604,
-0.9587311148643494,
1.6438313722610474,
0.35342177748680115,
-1.177971363067627,
-0.41583552956581116,
-0.40634849667549133,
-0.6691599488258362,
2.6915981769561768,
-1.4355311393737793,
-0.2518649697303772,
-0.9508408904075623,
-0.5883263945579529,
1.6029165983200073,
-1.2702525854110718,
-0.22184695303440094,
-1.0821807384490967,
-0.5394463539123535,
-1.3667768239974976,
-0.5276006460189819,
-0.048700083047151566,
-0.9469488263130188,
0.9620413780212402,
0.16961313784122467,
-1.1253079175949097,
-0.1978801041841507,
-0.8871910572052002,
0.848408043384552,
-0.19804799556732178,
0.27753934264183044,
1.8642195463180542,
0.508313000202179,
-0.4274449348449707,
0.7239788770675659,
1.18951416015625,
0.6615968942642212,
-0.6233466267585754,
0.19130884110927582,
-0.7716833353042603,
0.25604894757270813,
-1.2192970514297485,
0.24448445439338684,
-2.8744406700134277,
0.6143032312393188,
-0.08814731985330582,
-0.09033741801977158,
-0.022101450711488724,
-1.3129479885101318,
0.9861660599708557,
2.5893590450286865,
-1.2755277156829834,
0.4438859224319458,
0.24451971054077148,
1.2709810733795166,
-1.6637177467346191,
0.28073909878730774,
-0.3899683356285095,
2.128789186477661,
0.18259485065937042,
1.1755733489990234,
-0.41946691274642944,
-2.1894938945770264,
0.6950893402099609,
-1.2788194417953491,
-1.22956120967865,
0.8586932420730591,
-0.7750988006591797,
0.03395725414156914,
-1.4439641237258911,
-0.25206926465034485,
-0.7944368124008179,
-1.2579939365386963,
0.7807381749153137,
0.14574779570102692,
0.5112326741218567,
-0.5127867460250854,
0.27414438128471375,
-2.189652919769287,
-1.4284676313400269,
-0.2577343285083771,
-0.9425926804542542,
0.4117395877838135,
-0.38996535539627075,
0.7368360757827759,
-0.23537003993988037,
0.11055126786231995,
0.41869843006134033,
1.4211472272872925,
3.567368268966675,
0.3250664472579956,
0.3854750096797943,
-0.16548289358615875,
-0.884354829788208,
1.4522358179092407,
0.9062225222587585,
-0.18496005237102509,
-0.4418138265609741,
-0.9413161277770996,
1.230043649673462,
1.9654139280319214,
0.9824213981628418,
0.07991227507591248,
-0.7746278643608093,
-0.5904375910758972,
-0.13792899250984192,
0.12174336612224579,
0.4654461443424225,
0.8285478353500366,
0.0666903480887413,
0.06352098286151886,
1.4592983722686768,
1.1109117269515991,
-0.39512667059898376,
0.4188351333141327,
-0.7326623201370239,
-0.46258750557899475,
0.6352854371070862,
0.3094048500061035,
-0.003399995155632496,
0.3079386353492737,
-0.9236982464790344,
-0.2358182966709137,
-0.4671453833580017,
-0.8907353281974792,
-0.6631167531013489,
-0.4533092975616455,
-0.31735959649086,
1.582017421722412,
0.1152200847864151,
-0.5289713740348816,
-0.10708974301815033,
-0.7434712648391724,
-0.11271804571151733,
-1.0861622095108032,
0.15667475759983063,
-0.17647945880889893,
-0.22445932030677795,
-0.07229520380496979,
1.6596041917800903,
-1.000964641571045,
-2.0582120418548584,
0.22265702486038208,
0.2837314307689667,
-0.3133985698223114,
0.2276877611875534,
1.6596648693084717,
0.4774886667728424,
1.4658986330032349,
1.3653957843780518,
0.9307402968406677,
-0.7957717180252075,
-1.2549558877944946,
0.6391400694847107,
0.8914352059364319,
-1.4304262399673462,
0.7451016306877136,
0.05082470178604126,
-0.5913861989974976,
0.7259969711303711,
1.219023585319519,
0.4784056842327118,
-1.926387071609497,
0.840973436832428,
-0.9374285340309143,
0.7916452884674072,
0.6883025765419006,
0.7148500084877014,
0.21353428065776825,
0.8626329302787781,
-1.1492022275924683,
-1.204079270362854,
-0.7375704646110535,
-0.6654089689254761,
2.0044918060302734,
-0.23704083263874054,
0.5240200161933899,
-0.17090445756912231,
-1.2984460592269897,
-0.0997447744011879,
0.7267362475395203,
0.38213911652565,
-0.33043599128723145,
0.7147636413574219,
-0.7205907106399536,
-1.0033490657806396,
-1.4740188121795654,
-0.375367134809494,
-1.0681740045547485,
-0.9295042157173157,
1.0977553129196167,
0.8691357970237732,
0.23757275938987732,
1.855943202972412,
0.6972596645355225,
0.21938766539096832,
-2.497241973876953,
0.8593754768371582,
0.31435495615005493,
-0.061117786914110184,
0.841785192489624,
0.3368167281150818,
1.1304265260696411,
-0.03633854165673256,
0.4805786907672882,
-2.3199684619903564,
2.227609634399414,
-0.34872716665267944,
0.5961340665817261,
-0.07905028015375137,
-0.22607089579105377,
1.1758396625518799,
0.5057035684585571,
0.5404290556907654,
-1.0398361682891846,
0.7060295343399048,
-0.6170051097869873,
1.1543062925338745,
0.9355515241622925,
-0.8790075182914734,
-0.0021051610819995403,
1.4168450832366943,
0.5034867525100708,
-0.568882942199707,
-0.9295795559883118,
-0.9270278811454773,
0.9500146508216858,
1.6936413049697876,
-0.053975000977516174,
-0.03462166711688042,
0.801869809627533,
0.6426419615745544,
-1.2960083484649658,
0.19637565314769745,
-0.774634599685669,
-0.7986549139022827,
1.6570029258728027,
2.0085220336914062,
-0.16655273735523224,
-0.14310118556022644,
-0.8211778402328491,
-1.2437571287155151,
0.8228884339332581,
0.016608674079179764,
0.053722504526376724,
0.6543383002281189,
-0.675507128238678,
1.0865548849105835,
0.9510995745658875,
0.9156238436698914,
0.21994708478450775,
0.260001003742218,
0.4391992390155792,
-0.2800717353820801,
-1.0383731126785278,
-0.22199611365795135,
-1.0844484567642212,
-2.4809834957122803,
0.5137905478477478,
-0.3217936158180237,
-1.4394844770431519,
-0.013523890636861324,
-0.940747857093811,
1.0570183992385864,
-0.536442220211029,
-1.0527676343917847,
-1.5745880603790283,
0.2662408947944641,
-0.0765610933303833,
0.9045674800872803,
-1.5260673761367798,
-0.09752421826124191,
1.3403704166412354,
0.8997676372528076,
-0.740914523601532,
0.9716996550559998,
0.21482212841510773,
1.0670818090438843,
0.8273911476135254,
-0.40435004234313965,
0.4423710107803345,
-0.04158761352300644,
-1.3958724737167358,
0.5054669976234436,
1.0807181596755981,
0.17710232734680176,
1.4664169549942017,
-0.4880911707878113,
0.03683110326528549,
0.30517324805259705,
-0.42721712589263916,
-0.571427583694458,
-0.5645586848258972,
0.7029199004173279,
0.04834672436118126,
-0.7867423892021179,
0.14262638986110687,
-0.07821165025234222,
-0.32586172223091125,
0.20472975075244904,
-1.4697060585021973,
-0.1739858090877533,
-0.38053372502326965,
-0.6367030739784241,
-1.248329520225525,
-0.08553300052881241,
1.3906092643737793,
-0.6630610227584839,
-0.20867837965488434,
0.5813072323799133,
0.47119516134262085,
0.49156585335731506,
0.5933088660240173,
-0.6533443331718445,
-0.25936615467071533,
-0.3216044008731842,
-0.3112534284591675,
0.31875893473625183,
1.3374066352844238,
-0.15104396641254425,
-0.9797596335411072,
0.6985476016998291,
-0.32270485162734985,
0.03821475803852081,
1.9253119230270386,
0.14026163518428802,
-0.7826740741729736,
0.2734649181365967,
-0.7601828575134277,
1.914287805557251,
1.808862328529358,
1.3774425983428955,
-0.005918308161199093,
-1.0089318752288818,
0.5943945050239563,
-0.31337863206863403,
-0.31629687547683716,
1.032529592514038,
0.43295010924339294,
-0.13937361538410187,
-1.388035774230957,
0.7300928831100464,
1.2061901092529297,
-0.8552747368812561,
-0.8541293740272522,
0.029031168669462204,
-0.7730677127838135,
1.0545777082443237,
0.7358187437057495,
0.5355992913246155,
0.29088327288627625,
1.6365160942077637,
0.7255638241767883,
-0.5470096468925476,
0.4973829686641693,
0.5143508911132812,
-0.14152264595031738,
-2.0711734294891357,
-1.1543991565704346,
0.41534239053726196,
-0.4578284025192261,
-1.6326788663864136,
1.4048279523849487,
-1.1331820487976074,
-0.8967914581298828,
0.5364903807640076,
0.11091849952936172,
1.4189743995666504,
0.34612488746643066,
1.5512081384658813,
2.055316209793091,
0.8500124216079712,
0.3388088643550873,
1.3322447538375854,
-0.19722029566764832,
-0.3640466332435608,
1.8351346254348755,
-0.3871481716632843,
0.39486172795295715,
1.1097698211669922,
-0.4139101207256317,
-1.0635221004486084,
-0.736712634563446,
-1.1675595045089722,
-0.6384149193763733,
1.1504770517349243,
0.07817525416612625,
-1.0525802373886108,
0.2009885311126709,
1.579911708831787,
0.11595886945724487,
-0.3307439684867859,
0.6975467801094055,
0.48401790857315063,
-0.8613426089286804,
-0.003132980316877365,
-0.9777883887290955,
0.5512012839317322,
-0.15284119546413422,
-0.3389139473438263,
0.47286707162857056,
0.44950902462005615,
1.3607358932495117,
-0.07791655510663986,
0.1781442016363144,
1.210376501083374,
-1.317767858505249,
1.4461719989776611,
-0.6707832217216492,
0.21075710654258728,
-2.3596479892730713,
1.38157320022583,
-0.7525700330734253,
1.920424222946167,
-2.6076600551605225,
0.38498231768608093,
-0.6876747012138367,
-0.3572406470775604,
0.3935302495956421,
-0.3800891041755676,
0.114536814391613,
-0.17439870536327362,
-1.175289273262024,
-0.04297524318099022,
-0.7064731121063232,
0.652252733707428,
1.2380011081695557,
1.3749254941940308,
-1.1098246574401855,
-0.24232710897922516,
-1.7338329553604126,
-0.1637505292892456,
-0.6957638263702393,
0.37135326862335205,
-1.9710302352905273,
-0.21699513494968414,
-1.9438759088516235,
-2.431042194366455,
-1.3623794317245483,
-0.7274217009544373,
1.1519914865493774,
0.16506339609622955,
-0.9568078517913818,
1.2061998844146729,
-0.41803714632987976,
-1.8818333148956299,
1.0783077478408813,
-2.167205572128296
] |
https://github.com/huggingface/datasets/issues/6069 | KeyError: dataset has no key "image" | I have resolved the error after including a collate function as indicated in the Quick Start session of the Datasets docs.:
Here is what I did:
```
data_transforms = utils.get_data_augmentation(args)
image_dataset = utils.load_image_dataset(args.dataset)
def preprocess_train(example_batch):
example_batch["pixel_values"] = [
data_transforms["train"](image.convert("RGB")) for image in example_batch["image"]
]
return example_batch
def preprocess_val(example_batch):
example_batch["pixel_values"] = [
data_transforms["val"](image.convert("RGB")) for image in example_batch["image"]
]
return example_batch
def collate_fn(examples):
images = []
labels = []
for example in examples:
images.append((example["pixel_values"]))
labels.append(example["label"])
pixel_values = torch.stack(images)
labels = torch.tensor(labels)
return {"pixel_values": pixel_values, "label": labels}
train_dataset = image_dataset["train"].with_transform(preprocess_train)
val_dataset = image_dataset["validation"].with_transform(preprocess_val)
image_datasets = {
"train": train_dataset,
"val": val_dataset
}
samplers = {
"train": data.RandomSampler(train_dataset),
"val": data.SequentialSampler(val_dataset),
}
dataloaders = {
x: data.DataLoader(
image_datasets[x],
collate_fn=collate_fn,
batch_size=batch_size,
sampler=samplers[x],
num_workers=args.num_workers,
worker_init_fn=utils.set_seed_for_worker,
generator=g,
pin_memory=True,
)
for x in ["train", "val"]
}
train_loader, val_loader = dataloaders["train"], dataloaders["val"]
```
Everything runs fine without any bug now. | ### Describe the bug
I've loaded a local image dataset with:
`ds = laod_dataset("imagefolder", data_dir=path-to-data)`
And defined a transform to process the data, following the Datasets docs.
However, I get a keyError error, indicating there's no "image" key in my dataset. When I printed out the example_batch sent to the transformation function, it shows only the labels are being sent to the function.
For some reason, the images are not in the example batches.
### Steps to reproduce the bug
I'm using the latest stable version of datasets
### Expected behavior
I expect the example_batches to contain both images and labels
### Environment info
I'm using the latest stable version of datasets | 51 | 139 | KeyError: dataset has no key "image"
### Describe the bug
I've loaded a local image dataset with:
`ds = laod_dataset("imagefolder", data_dir=path-to-data)`
And defined a transform to process the data, following the Datasets docs.
However, I get a keyError error, indicating there's no "image" key in my dataset. When I printed out the example_batch sent to the transformation function, it shows only the labels are being sent to the function.
For some reason, the images are not in the example batches.
### Steps to reproduce the bug
I'm using the latest stable version of datasets
### Expected behavior
I expect the example_batches to contain both images and labels
### Environment info
I'm using the latest stable version of datasets
I have resolved the error after including a collate function as indicated in the Quick Start session of the Datasets docs.:
Here is what I did:
```
data_transforms = utils.get_data_augmentation(args)
image_dataset = utils.load_image_dataset(args.dataset)
def preprocess_train(example_batch):
example_batch["pixel_values"] = [
data_transforms["train"](image.convert("RGB")) for image in example_batch["image"]
]
return example_batch
def preprocess_val(example_batch):
example_batch["pixel_values"] = [
data_transforms["val"](image.convert("RGB")) for image in example_batch["image"]
]
return example_batch
def collate_fn(examples):
images = []
labels = []
for example in examples:
images.append((example["pixel_values"]))
labels.append(example["label"])
pixel_values = torch.stack(images)
labels = torch.tensor(labels)
return {"pixel_values": pixel_values, "label": labels}
train_dataset = image_dataset["train"].with_transform(preprocess_train)
val_dataset = image_dataset["validation"].with_transform(preprocess_val)
image_datasets = {
"train": train_dataset,
"val": val_dataset
}
samplers = {
"train": data.RandomSampler(train_dataset),
"val": data.SequentialSampler(val_dataset),
}
dataloaders = {
x: data.DataLoader(
image_datasets[x],
collate_fn=collate_fn,
batch_size=batch_size,
sampler=samplers[x],
num_workers=args.num_workers,
worker_init_fn=utils.set_seed_for_worker,
generator=g,
pin_memory=True,
)
for x in ["train", "val"]
}
train_loader, val_loader = dataloaders["train"], dataloaders["val"]
```
Everything runs fine without any bug now. | [
-1.339882731437683,
-0.9851165413856506,
-0.8010908961296082,
1.4915612936019897,
-0.19218501448631287,
-1.2128950357437134,
0.16310033202171326,
-1.1704480648040771,
1.6644611358642578,
-0.8980790972709656,
0.3183603584766388,
-1.6021389961242676,
0.006425078026950359,
-0.5804527997970581,
-0.7326551675796509,
-0.9579440355300903,
-0.3941601514816284,
-0.7174669504165649,
1.1095390319824219,
2.445794105529785,
1.2203056812286377,
-1.357608675956726,
2.782254695892334,
0.7622158527374268,
-0.16911150515079498,
-1.0011374950408936,
0.588487446308136,
-0.01786199025809765,
-1.2430508136749268,
-0.4882839322090149,
-0.9656474590301514,
-0.033090658485889435,
-0.4968354403972626,
-0.45368674397468567,
-0.05188123509287834,
0.38845425844192505,
-0.2851496636867523,
-0.5295100808143616,
-0.6669496893882751,
-0.7634566426277161,
0.40862616896629333,
-0.39763960242271423,
0.9706383347511292,
-0.39776572585105896,
1.8667635917663574,
-0.5811114311218262,
0.43803220987319946,
0.750489354133606,
1.3160110712051392,
0.218834787607193,
0.09588087350130081,
0.3213057518005371,
0.40978601574897766,
-0.08450525254011154,
0.47164711356163025,
1.1966910362243652,
0.5704813003540039,
0.482410192489624,
0.8046389818191528,
-2.2168524265289307,
1.2158509492874146,
-1.0558922290802002,
0.33622410893440247,
1.3618555068969727,
-0.914006769657135,
0.35471540689468384,
-1.6917752027511597,
-0.09727451205253601,
0.7270475625991821,
-2.222193717956543,
0.2905119061470032,
-1.2952160835266113,
-0.5827206969261169,
0.9574295878410339,
0.3932974338531494,
-1.1189647912979126,
0.11376161873340607,
-0.5420905947685242,
1.1084368228912354,
0.4129538834095001,
1.1002076864242554,
-1.6112817525863647,
-0.03292519226670265,
-0.22041445970535278,
0.08457571268081665,
-1.3119480609893799,
-1.542250394821167,
0.550337553024292,
0.6439231038093567,
0.5780363082885742,
-0.11221086978912354,
1.1216859817504883,
-1.0609691143035889,
0.7792256474494934,
-1.0072382688522339,
-1.6915165185928345,
-1.4589414596557617,
-2.310943841934204,
-2.196451187133789,
0.7022415995597839,
-0.4728085994720459,
-0.6061159372329712,
2.107631206512451,
-0.9732820391654968,
-1.685207486152649,
1.1575291156768799,
0.2242918461561203,
0.07954467833042145,
2.4312472343444824,
0.23531055450439453,
-0.7057897448539734,
0.5103488564491272,
-0.7215124368667603,
0.8126251697540283,
-0.3026975989341736,
1.2432773113250732,
0.35596325993537903,
-0.9642438888549805,
1.5695286989212036,
-0.38361093401908875,
0.6667235493659973,
-0.5774950981140137,
-0.4245903491973877,
-0.862114429473877,
0.2816278338432312,
1.7940855026245117,
-0.27126091718673706,
1.5768083333969116,
-0.3386167585849762,
-1.6509463787078857,
-1.7091516256332397,
0.8499985933303833,
0.4632777273654938,
-0.7487635612487793,
0.10730268806219101,
-0.38649892807006836,
0.14099036157131195,
-0.09031723439693451,
1.2695235013961792,
1.2838146686553955,
0.737355649471283,
-0.43437620997428894,
-0.806550920009613,
0.15003398060798645,
-0.06596565991640091,
-0.8426682353019714,
-1.662841558456421,
-0.37772616744041443,
0.20830786228179932,
0.6288784146308899,
-1.2342016696929932,
1.7601410150527954,
0.9123415946960449,
1.8340309858322144,
1.0448203086853027,
-0.38015857338905334,
1.4699413776397705,
0.05375020205974579,
1.7830748558044434,
-0.5237634181976318,
0.6147114634513855,
-0.26302671432495117,
-1.165055751800537,
0.8168497085571289,
-0.30556607246398926,
-2.049145460128784,
-0.9746851921081543,
-0.7043235301971436,
-0.17149372398853302,
-0.7312149405479431,
0.8666244149208069,
-0.4416959285736084,
-1.410341739654541,
0.24257636070251465,
-0.7343251705169678,
0.07698706537485123,
-1.1487709283828735,
0.2771196663379669,
0.6405414342880249,
-0.6398087739944458,
0.060322269797325134,
-0.11388996988534927,
-1.2861806154251099,
-0.35244300961494446,
0.21315111219882965,
1.9554888010025024,
-0.7364625930786133,
0.9124468564987183,
1.077802300453186,
-0.6917241215705872,
0.012976967729628086,
0.17554032802581787,
-0.3256385326385498,
0.910746693611145,
-1.0953826904296875,
-0.5431824326515198,
1.2372405529022217,
-0.20422302186489105,
-0.6570428013801575,
1.573737382888794,
0.6835266947746277,
-1.0090389251708984,
-0.2988661527633667,
-0.08052809536457062,
-0.9099317789077759,
-0.002292354591190815,
-1.5348609685897827,
-0.16952265799045563,
0.4878161549568176,
-1.5547244548797607,
-0.49897608160972595,
-0.19905517995357513,
1.2848894596099854,
-0.20686902105808258,
1.4659639596939087,
-0.4518047273159027,
-0.21060073375701904,
-0.2997229993343353,
-0.4067562222480774,
0.20923347771167755,
-0.19137543439865112,
-0.6870158314704895,
0.05877520143985748,
-0.847629964351654,
0.30410274863243103,
1.4403146505355835,
0.42874643206596375,
0.12530966103076935,
0.46833479404449463,
1.1226648092269897,
0.39757394790649414,
-0.043577056378126144,
-0.882617712020874,
-1.5084788799285889,
1.9952441453933716,
-1.3986860513687134,
1.9808850288391113,
0.7889285683631897,
-0.09904971718788147,
-1.8444277048110962,
-1.8724353313446045,
1.307070255279541,
1.2231603860855103,
2.2614634037017822,
0.40761473774909973,
0.4416099786758423,
-0.8378061652183533,
-0.7114445567131042,
0.2707500457763672,
-1.065819501876831,
-0.6325848698616028,
0.19989056885242462,
2.3469135761260986,
1.8406357765197754,
-0.40782031416893005,
-0.14948616921901703,
-0.9664715528488159,
1.373763918876648,
-0.22699293494224548,
0.2542109787464142,
1.936686635017395,
-0.27728286385536194,
-1.0209161043167114,
1.32530677318573,
-2.276602029800415,
0.12389062345027924,
1.99014413356781,
0.2701627314090729,
0.05415477603673935,
-1.291900396347046,
-0.5772359371185303,
-0.4353730380535126,
-0.36558571457862854,
-1.225306749343872,
0.5651018023490906,
-0.26765260100364685,
-0.7852728366851807,
-1.351009726524353,
0.13176880776882172,
-1.1203272342681885,
-1.647838830947876,
0.2603267431259155,
1.8580528497695923,
2.1169850826263428,
-0.8238587975502014,
1.5954532623291016,
-0.32845574617385864,
0.14138862490653992,
1.101224660873413,
1.2590672969818115,
3.0601677894592285,
1.809695839881897,
-1.3219830989837646,
0.5341842770576477,
-0.10617274791002274,
-0.4729171097278595,
1.11488938331604,
-1.22856867313385,
1.3869165182113647,
-0.06282749772071838,
-1.1973097324371338,
-1.2377591133117676,
1.0606704950332642,
0.5047446489334106,
0.007291550748050213,
-0.5095381140708923,
1.200055480003357,
-0.003554699942469597,
1.3882492780685425,
0.5916377902030945,
-0.3862011432647705,
0.6183197498321533,
-0.4258315861225128,
-0.5692064166069031,
1.5074471235275269,
0.11113739758729935,
-1.4819567203521729,
-2.2240145206451416,
-0.25052013993263245,
-0.8231179118156433,
0.10378523170948029,
-0.6092734932899475,
-1.0573720932006836,
1.7472199201583862,
0.29494044184684753,
-1.2761762142181396,
-0.40510129928588867,
-0.385959267616272,
-0.6661920547485352,
2.759385108947754,
-1.2512131929397583,
-0.17926254868507385,
-0.907444953918457,
-0.6795576214790344,
1.6441730260849,
-1.188053011894226,
-0.22562360763549805,
-1.0410740375518799,
-0.5677971839904785,
-1.3364160060882568,
-0.5663127899169922,
0.08118389546871185,
-1.0334656238555908,
0.9015758037567139,
0.15396226942539215,
-1.0654240846633911,
-0.27420279383659363,
-0.8574381470680237,
0.9557306170463562,
-0.24233034253120422,
0.13297955691814423,
1.8807017803192139,
0.35717397928237915,
-0.3621227741241455,
0.8001425862312317,
1.237531304359436,
0.7070631384849548,
-0.6582959890365601,
0.03607048839330673,
-0.738350510597229,
0.3016880750656128,
-1.2433847188949585,
0.2275150567293167,
-2.8345823287963867,
0.6510412096977234,
-0.045403506606817245,
-0.08493142575025558,
0.08132916688919067,
-1.2363232374191284,
1.059426188468933,
2.6316378116607666,
-1.275650143623352,
0.46677514910697937,
0.31183385848999023,
1.1597336530685425,
-1.6360645294189453,
0.3410140872001648,
-0.4242401123046875,
2.037489414215088,
0.20886121690273285,
1.2562814950942993,
-0.47461745142936707,
-2.1422171592712402,
0.7640224099159241,
-1.292949914932251,
-1.22945237159729,
0.8060464859008789,
-0.9980722069740295,
0.3149844706058502,
-1.5025454759597778,
-0.35397103428840637,
-0.8557652831077576,
-1.1457809209823608,
0.5269352197647095,
0.15589909255504608,
0.35819438099861145,
-0.5165072083473206,
0.23694318532943726,
-2.2373406887054443,
-1.397388219833374,
-0.21246843039989471,
-1.0200355052947998,
0.5644869804382324,
-0.4847754240036011,
0.7308440208435059,
-0.16314274072647095,
0.0848526731133461,
0.35196778178215027,
1.4533584117889404,
3.4871230125427246,
0.3501950204372406,
0.23231551051139832,
-0.16174568235874176,
-0.9163650870323181,
1.4485405683517456,
0.8820909261703491,
-0.14163245260715485,
-0.4612169563770294,
-1.0630098581314087,
1.274145245552063,
1.925453543663025,
0.9740909337997437,
0.008530714549124241,
-0.8385993838310242,
-0.6547790765762329,
-0.10863492637872696,
0.18460406363010406,
0.43555667996406555,
0.8504407405853271,
0.024335265159606934,
0.11323582381010056,
1.6079505681991577,
1.1191754341125488,
-0.42114582657814026,
0.29346299171447754,
-0.8823316097259521,
-0.5573506355285645,
0.5331344604492188,
0.2501004934310913,
-0.04473372548818588,
0.4201774597167969,
-1.0200068950653076,
-0.24003547430038452,
-0.5008541941642761,
-0.8109504580497742,
-0.5801876783370972,
-0.34428152441978455,
-0.3354974091053009,
1.5382336378097534,
0.13407258689403534,
-0.535563588142395,
-0.05029802769422531,
-0.7184199690818787,
-0.15208032727241516,
-1.0841058492660522,
0.20047958195209503,
-0.08993510156869888,
-0.18755897879600525,
-0.2207867056131363,
1.7313013076782227,
-0.9045934677124023,
-2.0203936100006104,
0.16349686682224274,
0.24441421031951904,
-0.22277233004570007,
0.218205988407135,
1.670060157775879,
0.5392380356788635,
1.494390606880188,
1.300112247467041,
0.8296870589256287,
-0.7660064101219177,
-1.2328438758850098,
0.6298481822013855,
0.9549115896224976,
-1.2755624055862427,
0.8138819336891174,
-0.14065292477607727,
-0.588032066822052,
0.6462461948394775,
1.2756270170211792,
0.4858047664165497,
-1.9531500339508057,
0.8824676871299744,
-0.987151563167572,
0.8461098670959473,
0.7077224850654602,
0.6150422692298889,
0.13212716579437256,
0.9137816429138184,
-1.1336076259613037,
-1.1497489213943481,
-0.7383182644844055,
-0.6841639280319214,
2.029232978820801,
-0.3736821711063385,
0.6170023679733276,
-0.305267333984375,
-1.2236652374267578,
-0.07149877399206161,
0.6297922730445862,
0.35564011335372925,
-0.3844760060310364,
0.8192082643508911,
-0.6782965064048767,
-1.0067262649536133,
-1.3720638751983643,
-0.3132324516773224,
-1.0455069541931152,
-0.9588102698326111,
1.126876711845398,
0.7484819293022156,
0.27933093905448914,
1.873724102973938,
0.7179471850395203,
0.25808006525039673,
-2.523658037185669,
0.865135133266449,
0.24471011757850647,
-0.06647054851055145,
0.8396255373954773,
0.32536593079566956,
1.0245518684387207,
-0.0029771486297249794,
0.3589571416378021,
-2.3444271087646484,
2.238647699356079,
-0.23929260671138763,
0.7099829316139221,
-0.12720708549022675,
-0.2041039764881134,
1.1990563869476318,
0.5897359251976013,
0.5795250535011292,
-0.9684501886367798,
0.5881766676902771,
-0.45790570974349976,
1.1716800928115845,
0.9075704216957092,
-0.7590293884277344,
-0.021304506808519363,
1.4559191465377808,
0.5283222198486328,
-0.5869848728179932,
-1.012044072151184,
-0.8688833713531494,
0.9706271290779114,
1.6971489191055298,
0.013180105946958065,
-0.04263179749250412,
0.7476930618286133,
0.6251948475837708,
-1.2578420639038086,
0.06366746872663498,
-0.7837948799133301,
-0.743187665939331,
1.650525450706482,
2.1593101024627686,
-0.1920158565044403,
-0.1858271062374115,
-0.5954837203025818,
-1.3251240253448486,
0.8201265335083008,
-0.18841370940208435,
0.21908697485923767,
0.6579183340072632,
-0.6319159865379333,
1.0431808233261108,
0.8548022508621216,
0.9431045651435852,
0.18937088549137115,
0.22996044158935547,
0.42389950156211853,
-0.2698693871498108,
-1.1744086742401123,
-0.197729229927063,
-0.9924429655075073,
-2.430462121963501,
0.3464811146259308,
-0.18361136317253113,
-1.4520012140274048,
-0.007179897278547287,
-0.9416091442108154,
1.0813363790512085,
-0.5287900567054749,
-1.0082286596298218,
-1.6026647090911865,
0.22825774550437927,
0.026386946439743042,
0.9838540554046631,
-1.489453673362732,
-0.2564069628715515,
1.2190446853637695,
0.9252273440361023,
-0.7178826332092285,
0.9919376373291016,
0.17244131863117218,
1.037796974182129,
0.7403044104576111,
-0.4199720025062561,
0.48396962881088257,
-0.035866089165210724,
-1.3821606636047363,
0.43293091654777527,
1.103021502494812,
0.18771657347679138,
1.5564321279525757,
-0.41388726234436035,
0.052384670823812485,
0.38256216049194336,
-0.5746726989746094,
-0.5428091287612915,
-0.41241180896759033,
0.6150419116020203,
-0.01723260059952736,
-0.8379602432250977,
-0.06728027760982513,
-0.10352642089128494,
-0.4077965021133423,
0.2435477077960968,
-1.4291775226593018,
-0.07519030570983887,
-0.4554952085018158,
-0.6712021827697754,
-1.1629090309143066,
0.007816231809556484,
1.392857313156128,
-0.8085682988166809,
-0.25095483660697937,
0.47172585129737854,
0.3985007107257843,
0.5679200291633606,
0.6659947037696838,
-0.7324791550636292,
-0.19443729519844055,
-0.29704463481903076,
-0.22565403580665588,
0.3378969132900238,
1.3400896787643433,
-0.1702178418636322,
-0.930981457233429,
0.6592016220092773,
-0.32588785886764526,
0.05622527748346329,
1.9597617387771606,
0.14237681031227112,
-0.6844158172607422,
0.3078647255897522,
-0.8231201171875,
1.8990585803985596,
1.6708900928497314,
1.390154480934143,
-0.12119341641664505,
-0.9230054020881653,
0.6045201420783997,
-0.3311660587787628,
-0.4165627658367157,
0.8517376184463501,
0.35990574955940247,
-0.1610601544380188,
-1.4503284692764282,
0.8456893563270569,
1.1876111030578613,
-0.9227926731109619,
-0.7225275635719299,
0.17091932892799377,
-0.8049538135528564,
1.1081762313842773,
0.5765491127967834,
0.4501226246356964,
0.36290815472602844,
1.6599587202072144,
0.834705650806427,
-0.5125017166137695,
0.41426587104797363,
0.659954845905304,
-0.13583262264728546,
-2.057957172393799,
-1.187387466430664,
0.3137979507446289,
-0.5749719738960266,
-1.6279228925704956,
1.4177607297897339,
-1.134568452835083,
-1.0377085208892822,
0.6076139211654663,
0.049868300557136536,
1.317331075668335,
0.39378345012664795,
1.5482600927352905,
2.0531957149505615,
0.8406184315681458,
0.40018054842948914,
1.2433961629867554,
-0.1432974487543106,
-0.3985901474952698,
1.889258861541748,
-0.4045635163784027,
0.4332362115383148,
1.0669045448303223,
-0.332061767578125,
-1.1106126308441162,
-0.6742843985557556,
-1.2444744110107422,
-0.750117838382721,
1.127044677734375,
0.04141845554113388,
-1.040052056312561,
0.1904064267873764,
1.5578595399856567,
0.1309056282043457,
-0.3922520875930786,
0.6692607402801514,
0.4190164804458618,
-0.7614217400550842,
-0.004536524415016174,
-0.9071465730667114,
0.5500465631484985,
-0.150699645280838,
-0.35957688093185425,
0.2972530126571655,
0.41423073410987854,
1.479291558265686,
-0.10432679951190948,
0.15623675286769867,
1.1179693937301636,
-1.410143256187439,
1.4670337438583374,
-0.6514564752578735,
0.24800556898117065,
-2.429887294769287,
1.379260778427124,
-0.7427778244018555,
1.9628854990005493,
-2.70932674407959,
0.5115440487861633,
-0.6389323472976685,
-0.40592947602272034,
0.28467604517936707,
-0.36299681663513184,
0.12426966428756714,
-0.07199089229106903,
-1.1991679668426514,
0.007193167693912983,
-0.5953764319419861,
0.6838774681091309,
1.1983853578567505,
1.3780796527862549,
-1.148268699645996,
-0.2652129828929901,
-1.6803311109542847,
-0.10762277245521545,
-0.8302258253097534,
0.3208133280277252,
-2.021413803100586,
-0.24789632856845856,
-1.8240808248519897,
-2.4717650413513184,
-1.2848080396652222,
-0.7293521165847778,
1.1449618339538574,
0.20339424908161163,
-0.9671533703804016,
1.3120347261428833,
-0.4533609449863434,
-1.906899333000183,
1.1683073043823242,
-2.1942851543426514
] |
https://github.com/huggingface/datasets/issues/6066 | AttributeError: '_tqdm_cls' object has no attribute '_lock' | Hi ! I opened https://github.com/huggingface/datasets/pull/6067 to add the missing `_lock`
We'll do a patch release soon, but feel free to install `datasets` from source in the meantime | ### Describe the bug
```python
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/site-packages/datasets/load.py", line 1034, in get_module
data_files = DataFilesDict.from_patterns(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/site-packages/datasets/data_files.py", line 671, in from_patterns
DataFilesList.from_patterns(
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/site-packages/datasets/data_files.py", line 586, in from_patterns
origin_metadata = _get_origin_metadata(data_files, download_config=download_config)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/site-packages/datasets/data_files.py", line 502, in _get_origin_metadata
return thread_map(
^^^^^^^^^^^
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/site-packages/tqdm/contrib/concurrent.py", line 70, in thread_map
return _executor_map(ThreadPoolExecutor, fn, *iterables, **tqdm_kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/site-packages/tqdm/contrib/concurrent.py", line 48, in _executor_map
with ensure_lock(tqdm_class, lock_name=lock_name) as lk:
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/contextlib.py", line 144, in __exit__
next(self.gen)
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/site-packages/tqdm/contrib/concurrent.py", line 25, in ensure_lock
del tqdm_class._lock
^^^^^^^^^^^^^^^^
AttributeError: '_tqdm_cls' object has no attribute '_lock'
```
### Steps to reproduce the bug
Happens ocasionally.
### Expected behavior
I added a print in tqdm `ensure_lock()`, got a `ensure_lock <datasets.utils.logging._tqdm_cls object at 0x16dddead0> ` print.
According to the code in https://github.com/tqdm/tqdm/blob/master/tqdm/contrib/concurrent.py#L24
```python
@contextmanager
def ensure_lock(tqdm_class, lock_name=""):
"""get (create if necessary) and then restore `tqdm_class`'s lock"""
print("ensure_lock", tqdm_class, lock_name)
old_lock = getattr(tqdm_class, '_lock', None) # don't create a new lock
lock = old_lock or tqdm_class.get_lock() # maybe create a new lock
lock = getattr(lock, lock_name, lock) # maybe subtype
tqdm_class.set_lock(lock)
yield lock
if old_lock is None:
del tqdm_class._lock # <-- It tries to del the `_lock` attribute from tqdm_class.
else:
tqdm_class.set_lock(old_lock)
```
But, huggingface datasets `datasets.utils.logging._tqdm_cls` does not have the field `_lock`: https://github.com/huggingface/datasets/blob/main/src/datasets/utils/logging.py#L205
```python
class _tqdm_cls:
def __call__(self, *args, disable=False, **kwargs):
if _tqdm_active and not disable:
return tqdm_lib.tqdm(*args, **kwargs)
else:
return EmptyTqdm(*args, **kwargs)
def set_lock(self, *args, **kwargs):
self._lock = None
if _tqdm_active:
return tqdm_lib.tqdm.set_lock(*args, **kwargs)
def get_lock(self):
if _tqdm_active:
return tqdm_lib.tqdm.get_lock()
```
### Environment info
Python 3.11.4
tqdm '4.65.0'
datasets master | 52 | 27 | AttributeError: '_tqdm_cls' object has no attribute '_lock'
### Describe the bug
```python
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/site-packages/datasets/load.py", line 1034, in get_module
data_files = DataFilesDict.from_patterns(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/site-packages/datasets/data_files.py", line 671, in from_patterns
DataFilesList.from_patterns(
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/site-packages/datasets/data_files.py", line 586, in from_patterns
origin_metadata = _get_origin_metadata(data_files, download_config=download_config)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/site-packages/datasets/data_files.py", line 502, in _get_origin_metadata
return thread_map(
^^^^^^^^^^^
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/site-packages/tqdm/contrib/concurrent.py", line 70, in thread_map
return _executor_map(ThreadPoolExecutor, fn, *iterables, **tqdm_kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/site-packages/tqdm/contrib/concurrent.py", line 48, in _executor_map
with ensure_lock(tqdm_class, lock_name=lock_name) as lk:
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/contextlib.py", line 144, in __exit__
next(self.gen)
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/site-packages/tqdm/contrib/concurrent.py", line 25, in ensure_lock
del tqdm_class._lock
^^^^^^^^^^^^^^^^
AttributeError: '_tqdm_cls' object has no attribute '_lock'
```
### Steps to reproduce the bug
Happens ocasionally.
### Expected behavior
I added a print in tqdm `ensure_lock()`, got a `ensure_lock <datasets.utils.logging._tqdm_cls object at 0x16dddead0> ` print.
According to the code in https://github.com/tqdm/tqdm/blob/master/tqdm/contrib/concurrent.py#L24
```python
@contextmanager
def ensure_lock(tqdm_class, lock_name=""):
"""get (create if necessary) and then restore `tqdm_class`'s lock"""
print("ensure_lock", tqdm_class, lock_name)
old_lock = getattr(tqdm_class, '_lock', None) # don't create a new lock
lock = old_lock or tqdm_class.get_lock() # maybe create a new lock
lock = getattr(lock, lock_name, lock) # maybe subtype
tqdm_class.set_lock(lock)
yield lock
if old_lock is None:
del tqdm_class._lock # <-- It tries to del the `_lock` attribute from tqdm_class.
else:
tqdm_class.set_lock(old_lock)
```
But, huggingface datasets `datasets.utils.logging._tqdm_cls` does not have the field `_lock`: https://github.com/huggingface/datasets/blob/main/src/datasets/utils/logging.py#L205
```python
class _tqdm_cls:
def __call__(self, *args, disable=False, **kwargs):
if _tqdm_active and not disable:
return tqdm_lib.tqdm(*args, **kwargs)
else:
return EmptyTqdm(*args, **kwargs)
def set_lock(self, *args, **kwargs):
self._lock = None
if _tqdm_active:
return tqdm_lib.tqdm.set_lock(*args, **kwargs)
def get_lock(self):
if _tqdm_active:
return tqdm_lib.tqdm.get_lock()
```
### Environment info
Python 3.11.4
tqdm '4.65.0'
datasets master
Hi ! I opened https://github.com/huggingface/datasets/pull/6067 to add the missing `_lock`
We'll do a patch release soon, but feel free to install `datasets` from source in the meantime | [
-1.3521512746810913,
-0.8465626835823059,
-0.5868315100669861,
1.283677339553833,
0.03677382320165634,
-0.8991362452507019,
0.05178180709481239,
-1.024348497390747,
1.9279330968856812,
-0.5640751123428345,
0.19435115158557892,
-1.4659757614135742,
-0.12366081774234772,
-0.3550596237182617,
-0.6583359837532043,
-1.0089880228042603,
-0.22304120659828186,
-0.8023163080215454,
1.1088749170303345,
2.6884775161743164,
1.156903862953186,
-1.3759241104125977,
2.642866849899292,
0.7988353967666626,
-0.24207842350006104,
-0.7284358143806458,
0.5179723501205444,
-0.011512529104948044,
-1.1826525926589966,
-0.6495604515075684,
-1.0175813436508179,
0.022053562104701996,
-0.6313120722770691,
-0.3401859402656555,
-0.02158968523144722,
0.13139449059963226,
-0.20061808824539185,
-0.2873065769672394,
-0.9021544456481934,
-0.6910043358802795,
0.548274040222168,
-0.2852327525615692,
0.962647020816803,
-0.3649974763393402,
1.8277539014816284,
-0.6605496406555176,
0.6081895232200623,
0.7097229957580566,
1.1302821636199951,
0.03843861073255539,
-0.02079499140381813,
0.534895122051239,
0.3973972499370575,
-0.030856993049383163,
0.7792328596115112,
1.1679213047027588,
0.6481515765190125,
0.5231693983078003,
0.3747190535068512,
-2.402606964111328,
1.3480474948883057,
-1.1254764795303345,
0.2611131966114044,
1.3818163871765137,
-0.7771731615066528,
0.33440378308296204,
-1.6795424222946167,
0.18649689853191376,
0.7953941226005554,
-2.4113516807556152,
0.21887235343456268,
-1.3777607679367065,
-0.6116394400596619,
1.02347731590271,
0.4455806314945221,
-1.1382908821105957,
0.04288424551486969,
-0.4744756817817688,
1.1887880563735962,
0.16459180414676666,
1.323036789894104,
-1.5153446197509766,
0.07853391021490097,
-0.16390080749988556,
0.40112704038619995,
-1.1884578466415405,
-1.63075590133667,
0.47040989995002747,
0.5899773836135864,
0.26367324590682983,
-0.20505091547966003,
1.0199583768844604,
-0.9974428415298462,
0.5892379283905029,
-0.879410445690155,
-1.5193231105804443,
-1.6370117664337158,
-2.5339717864990234,
-2.419931411743164,
0.7907775044441223,
-0.6993247866630554,
-0.3508959710597992,
2.1170456409454346,
-1.1112667322158813,
-1.5155402421951294,
0.9031490683555603,
0.1301542967557907,
0.18626834452152252,
2.1760153770446777,
0.0870685800909996,
-0.6804654598236084,
0.37824180722236633,
-0.726199746131897,
0.7385104894638062,
-0.30165982246398926,
1.4342628717422485,
0.5134738087654114,
-1.1090902090072632,
1.4783711433410645,
-0.5905486345291138,
0.5421697497367859,
-0.35697025060653687,
-0.5581348538398743,
-0.7811577320098877,
0.4774627089500427,
1.9544063806533813,
-0.3682940602302551,
1.717416763305664,
-0.5249424576759338,
-1.5466097593307495,
-1.4526327848434448,
0.8967746496200562,
0.4380446970462799,
-0.9256751537322998,
0.3436538577079773,
-0.6989375352859497,
0.06934519857168198,
-0.1274934858083725,
1.2606428861618042,
1.4358786344528198,
0.8622769117355347,
-0.28867924213409424,
-0.9380638599395752,
0.21729804575443268,
-0.180426687002182,
-0.8059960007667542,
-1.8390917778015137,
-0.16765767335891724,
0.10799171775579453,
0.6952167749404907,
-1.334524154663086,
1.5881760120391846,
0.8184784650802612,
1.9953057765960693,
0.8810362219810486,
-0.3565824329853058,
1.5788503885269165,
0.10273914039134979,
1.9695619344711304,
-0.7274723052978516,
0.6091565489768982,
-0.25802770256996155,
-1.13075590133667,
0.602349579334259,
-0.5166391730308533,
-2.019538164138794,
-0.7058054208755493,
-0.7484105825424194,
-0.07471983879804611,
-0.8735766410827637,
0.8328580856323242,
-0.07892382144927979,
-1.3269766569137573,
0.037220317870378494,
-0.6979303359985352,
0.525588870048523,
-1.268679141998291,
0.19269853830337524,
0.7282240986824036,
-0.40709948539733887,
0.19289961457252502,
-0.30141860246658325,
-1.2765871286392212,
-0.44538742303848267,
0.2148360311985016,
1.7092931270599365,
-0.3832385241985321,
0.6793234348297119,
1.2920857667922974,
-0.7202000617980957,
-0.05136673152446747,
0.24222339689731598,
-0.31593912839889526,
0.8499449491500854,
-1.213307499885559,
-0.4020674526691437,
1.103127121925354,
-0.12177959829568863,
-0.538506269454956,
1.2828400135040283,
0.7414155006408691,
-1.4261047840118408,
-0.3345857858657837,
-0.1103140339255333,
-0.800789475440979,
0.229596808552742,
-1.599118947982788,
-0.13479000329971313,
0.3764839768409729,
-1.6156822443008423,
-0.42269524931907654,
-0.2238057255744934,
1.2895721197128296,
-0.4028053879737854,
1.5293537378311157,
-0.02884598821401596,
0.03283382207155228,
-0.41834840178489685,
-0.23257780075073242,
0.32171517610549927,
-0.152330681681633,
-0.7775755524635315,
0.37977704405784607,
-0.6720184087753296,
0.2616594433784485,
1.236938238143921,
0.21759240329265594,
-0.2889638841152191,
0.292082816362381,
1.2093192338943481,
0.35908243060112,
-0.23396429419517517,
-0.8236218690872192,
-1.7396965026855469,
1.9075483083724976,
-1.2333664894104004,
1.735875129699707,
0.8410902619361877,
0.06864677369594574,
-1.9759607315063477,
-1.9344966411590576,
0.9765974283218384,
1.1564213037490845,
2.433076858520508,
0.29628849029541016,
0.5317174792289734,
-0.816351056098938,
-0.6313667893409729,
0.2908959686756134,
-0.8242727518081665,
-0.6654465198516846,
0.28600338101387024,
2.3161346912384033,
1.744185447692871,
-0.5277401804924011,
-0.16757617890834808,
-0.9070008993148804,
0.9472280740737915,
-0.1560613512992859,
0.1032833382487297,
1.8340047597885132,
-0.21770057082176208,
-1.109144926071167,
1.2990546226501465,
-2.280304193496704,
0.3642001152038574,
1.896501064300537,
0.3428557813167572,
0.14780259132385254,
-1.515293002128601,
-0.7185305953025818,
-0.2297145128250122,
-0.47209396958351135,
-1.2793437242507935,
0.5771636366844177,
-0.04452018067240715,
-1.1568613052368164,
-1.4738106727600098,
0.17234741151332855,
-1.0940903425216675,
-1.6372356414794922,
0.09702835232019424,
1.6472487449645996,
1.7815272808074951,
-0.9347864389419556,
1.2636431455612183,
-0.2786821722984314,
-0.058101311326026917,
1.3028626441955566,
1.2421928644180298,
3.1923696994781494,
2.0930440425872803,
-1.3588863611221313,
0.7501751184463501,
-0.45425325632095337,
-0.48371684551239014,
1.3359118700027466,
-1.3969383239746094,
1.0847744941711426,
-0.08317103981971741,
-1.2431195974349976,
-1.1207540035247803,
1.196039080619812,
0.49201297760009766,
-0.017637604847550392,
-0.39043474197387695,
1.4444079399108887,
0.08816592395305634,
1.329132080078125,
0.5904709696769714,
-0.3448835015296936,
0.5995341539382935,
-0.2379176914691925,
-0.3511018753051758,
1.4434895515441895,
0.16469095647335052,
-1.3172589540481567,
-2.0604515075683594,
-0.30608969926834106,
-1.092736840248108,
-0.18789948523044586,
-0.6453109383583069,
-0.8920084238052368,
1.4902311563491821,
0.4073588252067566,
-1.0816891193389893,
-0.48647788166999817,
-0.4077385365962982,
-0.694445013999939,
2.6950268745422363,
-1.438475251197815,
-0.12085571885108948,
-1.0280990600585938,
-0.37704789638519287,
1.7620261907577515,
-1.2021361589431763,
-0.1440926343202591,
-1.0291293859481812,
-0.5072453618049622,
-1.343376636505127,
-0.40150928497314453,
-0.15733928978443146,
-0.8161590695381165,
0.8386436104774475,
0.29525089263916016,
-1.2216306924819946,
-0.307094007730484,
-0.6104503870010376,
0.8233334422111511,
-0.00845920480787754,
0.21250730752944946,
1.8285976648330688,
0.20871397852897644,
-0.5204732418060303,
0.6522339582443237,
1.2864199876785278,
0.8206965327262878,
-0.7473633885383606,
0.01238060649484396,
-0.877595067024231,
0.2103065550327301,
-1.8275014162063599,
0.2577137053012848,
-2.6765716075897217,
0.745964527130127,
-0.21918867528438568,
-0.16634029150009155,
-0.1883762925863266,
-1.3646878004074097,
0.9899558424949646,
2.4431285858154297,
-1.222352147102356,
0.34013426303863525,
0.558910608291626,
1.129453420639038,
-1.52141535282135,
0.27728357911109924,
-0.5472350716590881,
1.9673813581466675,
0.3606279194355011,
1.29331374168396,
-0.26412132382392883,
-2.2942326068878174,
0.7008957862854004,
-0.9900544285774231,
-0.7993454337120056,
0.9848408699035645,
-1.036194920539856,
0.10173735022544861,
-1.6293010711669922,
-0.4484351575374603,
-0.7917584776878357,
-1.3042129278182983,
0.4027526080608368,
0.10850761830806732,
0.4813213050365448,
-0.8338385820388794,
0.4156211018562317,
-2.1256425380706787,
-1.280670166015625,
-0.14467526972293854,
-0.9829208850860596,
0.6360070705413818,
-0.3579353094100952,
0.5913558006286621,
0.045186858624219894,
0.1168600469827652,
0.3235798180103302,
1.642377257347107,
3.5620157718658447,
0.1342773586511612,
0.2802782654762268,
-0.03751535341143608,
-0.9832461476325989,
1.1756844520568848,
0.699571967124939,
-0.07713732123374939,
-0.6242050528526306,
-1.064204216003418,
1.3947227001190186,
1.9391998052597046,
1.1102224588394165,
0.11502466350793839,
-0.9782136082649231,
-0.9323775768280029,
0.11117929965257645,
0.19524629414081573,
0.45118585228919983,
0.8819080591201782,
0.14739590883255005,
0.13738112151622772,
1.4058096408843994,
1.1642804145812988,
-0.3376760482788086,
0.2272675782442093,
-0.8579511642456055,
-0.3494069278240204,
0.6956281661987305,
0.24563147127628326,
0.15718181431293488,
0.6150067448616028,
-1.0578062534332275,
-0.3040401339530945,
-0.1187351644039154,
-1.033526062965393,
-0.8469188213348389,
-0.3645491302013397,
-0.2851758599281311,
1.6337007284164429,
0.2335965484380722,
-0.48823320865631104,
0.18423989415168762,
-0.4957510828971863,
-0.13290081918239594,
-1.1375561952590942,
0.07648321986198425,
-0.10401888191699982,
0.01050268393009901,
-0.14036229252815247,
1.5430327653884888,
-0.7817375063896179,
-1.9662758111953735,
0.02723463624715805,
0.2289348542690277,
-0.28549960255622864,
0.2778286933898926,
1.876517415046692,
0.5024697780609131,
1.791791558265686,
1.02422297000885,
1.1390247344970703,
-0.47523459792137146,
-1.336104154586792,
0.7638934254646301,
1.0105618238449097,
-1.4831258058547974,
0.7561991214752197,
-0.2655555307865143,
-0.6414832472801208,
0.6192159056663513,
1.3197944164276123,
0.3682551980018616,
-1.8802424669265747,
1.0183417797088623,
-0.8876082301139832,
0.7711708545684814,
0.5310311317443848,
0.9148852229118347,
-0.02934601902961731,
0.8280729055404663,
-1.341902494430542,
-1.0763003826141357,
-0.5112506151199341,
-0.7666745781898499,
1.7777831554412842,
-0.33654695749282837,
0.47715476155281067,
-0.18093575537204742,
-1.3464833498001099,
0.04348471015691757,
0.9014179706573486,
0.09589551389217377,
-0.5071082711219788,
1.235575795173645,
-0.7955337762832642,
-1.2208199501037598,
-1.3365451097488403,
-0.4627600908279419,
-0.8945221304893494,
-0.8102182745933533,
1.1722508668899536,
0.8489481806755066,
0.3076280951499939,
1.931687593460083,
0.5728175640106201,
0.2557595372200012,
-2.676346778869629,
0.7806742787361145,
0.07530584931373596,
0.1754676252603531,
0.9270681738853455,
0.2305983155965805,
1.0851138830184937,
-0.13302747905254364,
0.6602859497070312,
-2.2139697074890137,
2.190561532974243,
-0.06898049265146255,
0.6678903698921204,
-0.27786168456077576,
-0.24984021484851837,
0.8927656412124634,
0.48498299717903137,
0.743829071521759,
-1.4213987588882446,
0.8266007900238037,
-0.4907926023006439,
0.9112980365753174,
0.6877413988113403,
-0.7418578267097473,
-0.10262042284011841,
1.0204861164093018,
0.5001095533370972,
-0.38696756958961487,
-0.9797511696815491,
-0.9291428327560425,
1.1279083490371704,
1.6088098287582397,
-0.04091116413474083,
-0.0063375914469361305,
0.7068549394607544,
0.6967776417732239,
-1.119896650314331,
0.3266255855560303,
-0.7109658718109131,
-0.6586567759513855,
1.3143470287322998,
2.0225086212158203,
-0.10523401200771332,
-0.19205746054649353,
-0.6288843154907227,
-1.1921111345291138,
0.4705393612384796,
-0.14703509211540222,
0.45896822214126587,
0.6097984910011292,
-0.6311136484146118,
0.7907437682151794,
0.853172242641449,
0.9281733632087708,
0.11423075199127197,
0.3773452043533325,
0.5226050615310669,
-0.4893872141838074,
-0.9468663334846497,
-0.5079358220100403,
-0.9944900274276733,
-2.772594928741455,
0.4865324795246124,
-0.31221452355384827,
-1.7003687620162964,
0.13714314997196198,
-1.1598178148269653,
0.9037516713142395,
-0.6062751412391663,
-1.4831300973892212,
-1.3606762886047363,
0.3976737856864929,
-0.018978750333189964,
1.126449704170227,
-1.5416712760925293,
-0.10684391856193542,
1.3499733209609985,
0.9306431412696838,
-0.20869342982769012,
0.7041609883308411,
0.3663647174835205,
1.0119878053665161,
1.1269590854644775,
-0.1746334284543991,
0.5356847643852234,
0.31965020298957825,
-1.226167917251587,
0.44694799184799194,
1.1744554042816162,
0.3333441913127899,
1.4427132606506348,
-0.35785728693008423,
0.17492975294589996,
0.5848684310913086,
-0.7010063529014587,
-0.5601987242698669,
-0.2631869614124298,
0.35074901580810547,
0.3718017339706421,
-1.1137945652008057,
-0.14256711304187775,
-0.3362291157245636,
0.004177388735115528,
-0.11863942444324493,
-1.3614659309387207,
-0.3265659213066101,
-0.3982192873954773,
-0.686803936958313,
-1.4375382661819458,
0.07430471479892731,
1.2458163499832153,
-0.7400732040405273,
-0.09871954470872879,
0.38881802558898926,
0.46149173378944397,
0.5702497959136963,
0.509876012802124,
-0.7289793491363525,
-0.45075181126594543,
-0.1696815937757492,
-0.25022801756858826,
0.1599012315273285,
1.0350897312164307,
-0.12144225835800171,
-1.0334320068359375,
0.6304041147232056,
-0.278475284576416,
0.19349141418933868,
1.8877155780792236,
0.12918412685394287,
-0.8450613021850586,
0.42738577723503113,
-0.5980470776557922,
1.7481648921966553,
1.7766462564468384,
1.4082164764404297,
-0.08475938439369202,
-0.8481414318084717,
0.4641878008842468,
-0.5516619682312012,
-0.12393351644277573,
0.9465259313583374,
0.6039053797721863,
-0.22551381587982178,
-1.3075534105300903,
0.5837433934211731,
1.3028631210327148,
-1.0849767923355103,
-0.7287118434906006,
0.353732168674469,
-0.6826037764549255,
1.322310447692871,
0.624575138092041,
0.07813600450754166,
0.2458200603723526,
1.6093138456344604,
0.7779735326766968,
-0.535224437713623,
0.5232193470001221,
0.7197362780570984,
-0.4259026348590851,
-2.314595937728882,
-1.2201613187789917,
0.3978528082370758,
-0.38476404547691345,
-1.3012583255767822,
1.393068790435791,
-1.1441254615783691,
-1.0403860807418823,
0.6296542286872864,
0.05764849856495857,
1.1507059335708618,
0.19841574132442474,
1.7154958248138428,
2.253068685531616,
0.757347583770752,
0.257707804441452,
1.313523530960083,
0.1278500258922577,
-0.47213754057884216,
1.9872981309890747,
-0.26319774985313416,
0.4560069441795349,
0.8710852265357971,
-0.5018423795700073,
-1.1134164333343506,
-1.0161212682724,
-1.1849862337112427,
-0.6824880242347717,
1.3156335353851318,
0.11360086500644684,
-0.9215918183326721,
0.4901082217693329,
1.7598676681518555,
0.16926084458827972,
-0.24960167706012726,
0.6341556310653687,
0.5583701729774475,
-0.7889825105667114,
-0.020468756556510925,
-1.2578049898147583,
0.6289879679679871,
-0.1664561629295349,
-0.09694315493106842,
0.08676231652498245,
0.7347716093063354,
1.2358806133270264,
0.09766668826341629,
-0.12577080726623535,
1.1313918828964233,
-1.4748961925506592,
1.6798367500305176,
-0.5699650049209595,
0.45263174176216125,
-2.3144304752349854,
1.1421259641647339,
-0.6715932488441467,
1.9252856969833374,
-2.450446367263794,
0.5139152407646179,
-0.7128379344940186,
-0.4163958430290222,
0.28455430269241333,
-0.4057167172431946,
0.14052660763263702,
-0.18454530835151672,
-1.046558141708374,
-0.14424367249011993,
-1.0758476257324219,
0.7310072779655457,
1.146992802619934,
1.4003256559371948,
-1.2156238555908203,
-0.0036764685064554214,
-1.3482110500335693,
-0.08654996007680893,
-0.8571937084197998,
0.23416702449321747,
-1.6697404384613037,
-0.28050923347473145,
-2.1111562252044678,
-2.304094076156616,
-1.326977252960205,
-0.7295746803283691,
1.0908632278442383,
0.22760042548179626,
-0.8652193546295166,
1.0831001996994019,
-0.6321773529052734,
-1.8993183374404907,
0.9742449522018433,
-2.2420873641967773
] |
https://github.com/huggingface/datasets/issues/6066 | AttributeError: '_tqdm_cls' object has no attribute '_lock' | I have tested the latest main, it does not work.
I add more logs to reproduce this issue, it looks like a multi threading bug:
```python
@contextmanager
def ensure_lock(tqdm_class, lock_name=""):
"""get (create if necessary) and then restore `tqdm_class`'s lock"""
import os
import threading
print(os.getpid(), threading.get_ident(), "ensure_lock", tqdm_class, lock_name)
old_lock = getattr(tqdm_class, '_lock', None) # don't create a new lock
lock = old_lock or tqdm_class.get_lock() # maybe create a new lock
lock = getattr(lock, lock_name, lock) # maybe subtype
tqdm_class.set_lock(lock)
print(os.getpid(), threading.get_ident(), "set_lock")
yield lock
if old_lock is None:
print(os.getpid(), threading.get_ident(), "del tqdm_class")
del tqdm_class._lock
else:
tqdm_class.set_lock(old_lock)
```
output
```
64943 8424758784 ensure_lock <datasets.utils.logging._tqdm_cls object at 0x2aa7fb250>
64943 8424758784 set_lock
64943 8424758784 del tqdm_class
64943 8424758784 ensure_lock <datasets.utils.logging._tqdm_cls object at 0x2aa7fb250>
64943 8424758784 set_lock
64943 8424758784 del tqdm_class
64943 11638370304 ensure_lock <datasets.utils.logging._tqdm_cls object at 0x2aa7fb250>
64943 11638370304 set_lock
64943 11568967680 ensure_lock <datasets.utils.logging._tqdm_cls object at 0x2aa7fb250>
64943 11568967680 set_lock
64943 11638370304 del tqdm_class
64943 11638370304 ensure_lock <datasets.utils.logging._tqdm_cls object at 0x2aa7fb250>
64943 11638370304 set_lock
64943 11638370304 del tqdm_class
64943 11568967680 del tqdm_class
```
Thread `11638370304` del the _lock from tqdm_class first, then thread `11568967680` del _lock failed. | ### Describe the bug
```python
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/site-packages/datasets/load.py", line 1034, in get_module
data_files = DataFilesDict.from_patterns(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/site-packages/datasets/data_files.py", line 671, in from_patterns
DataFilesList.from_patterns(
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/site-packages/datasets/data_files.py", line 586, in from_patterns
origin_metadata = _get_origin_metadata(data_files, download_config=download_config)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/site-packages/datasets/data_files.py", line 502, in _get_origin_metadata
return thread_map(
^^^^^^^^^^^
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/site-packages/tqdm/contrib/concurrent.py", line 70, in thread_map
return _executor_map(ThreadPoolExecutor, fn, *iterables, **tqdm_kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/site-packages/tqdm/contrib/concurrent.py", line 48, in _executor_map
with ensure_lock(tqdm_class, lock_name=lock_name) as lk:
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/contextlib.py", line 144, in __exit__
next(self.gen)
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/site-packages/tqdm/contrib/concurrent.py", line 25, in ensure_lock
del tqdm_class._lock
^^^^^^^^^^^^^^^^
AttributeError: '_tqdm_cls' object has no attribute '_lock'
```
### Steps to reproduce the bug
Happens ocasionally.
### Expected behavior
I added a print in tqdm `ensure_lock()`, got a `ensure_lock <datasets.utils.logging._tqdm_cls object at 0x16dddead0> ` print.
According to the code in https://github.com/tqdm/tqdm/blob/master/tqdm/contrib/concurrent.py#L24
```python
@contextmanager
def ensure_lock(tqdm_class, lock_name=""):
"""get (create if necessary) and then restore `tqdm_class`'s lock"""
print("ensure_lock", tqdm_class, lock_name)
old_lock = getattr(tqdm_class, '_lock', None) # don't create a new lock
lock = old_lock or tqdm_class.get_lock() # maybe create a new lock
lock = getattr(lock, lock_name, lock) # maybe subtype
tqdm_class.set_lock(lock)
yield lock
if old_lock is None:
del tqdm_class._lock # <-- It tries to del the `_lock` attribute from tqdm_class.
else:
tqdm_class.set_lock(old_lock)
```
But, huggingface datasets `datasets.utils.logging._tqdm_cls` does not have the field `_lock`: https://github.com/huggingface/datasets/blob/main/src/datasets/utils/logging.py#L205
```python
class _tqdm_cls:
def __call__(self, *args, disable=False, **kwargs):
if _tqdm_active and not disable:
return tqdm_lib.tqdm(*args, **kwargs)
else:
return EmptyTqdm(*args, **kwargs)
def set_lock(self, *args, **kwargs):
self._lock = None
if _tqdm_active:
return tqdm_lib.tqdm.set_lock(*args, **kwargs)
def get_lock(self):
if _tqdm_active:
return tqdm_lib.tqdm.get_lock()
```
### Environment info
Python 3.11.4
tqdm '4.65.0'
datasets master | 52 | 184 | AttributeError: '_tqdm_cls' object has no attribute '_lock'
### Describe the bug
```python
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/site-packages/datasets/load.py", line 1034, in get_module
data_files = DataFilesDict.from_patterns(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/site-packages/datasets/data_files.py", line 671, in from_patterns
DataFilesList.from_patterns(
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/site-packages/datasets/data_files.py", line 586, in from_patterns
origin_metadata = _get_origin_metadata(data_files, download_config=download_config)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/site-packages/datasets/data_files.py", line 502, in _get_origin_metadata
return thread_map(
^^^^^^^^^^^
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/site-packages/tqdm/contrib/concurrent.py", line 70, in thread_map
return _executor_map(ThreadPoolExecutor, fn, *iterables, **tqdm_kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/site-packages/tqdm/contrib/concurrent.py", line 48, in _executor_map
with ensure_lock(tqdm_class, lock_name=lock_name) as lk:
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/contextlib.py", line 144, in __exit__
next(self.gen)
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/site-packages/tqdm/contrib/concurrent.py", line 25, in ensure_lock
del tqdm_class._lock
^^^^^^^^^^^^^^^^
AttributeError: '_tqdm_cls' object has no attribute '_lock'
```
### Steps to reproduce the bug
Happens ocasionally.
### Expected behavior
I added a print in tqdm `ensure_lock()`, got a `ensure_lock <datasets.utils.logging._tqdm_cls object at 0x16dddead0> ` print.
According to the code in https://github.com/tqdm/tqdm/blob/master/tqdm/contrib/concurrent.py#L24
```python
@contextmanager
def ensure_lock(tqdm_class, lock_name=""):
"""get (create if necessary) and then restore `tqdm_class`'s lock"""
print("ensure_lock", tqdm_class, lock_name)
old_lock = getattr(tqdm_class, '_lock', None) # don't create a new lock
lock = old_lock or tqdm_class.get_lock() # maybe create a new lock
lock = getattr(lock, lock_name, lock) # maybe subtype
tqdm_class.set_lock(lock)
yield lock
if old_lock is None:
del tqdm_class._lock # <-- It tries to del the `_lock` attribute from tqdm_class.
else:
tqdm_class.set_lock(old_lock)
```
But, huggingface datasets `datasets.utils.logging._tqdm_cls` does not have the field `_lock`: https://github.com/huggingface/datasets/blob/main/src/datasets/utils/logging.py#L205
```python
class _tqdm_cls:
def __call__(self, *args, disable=False, **kwargs):
if _tqdm_active and not disable:
return tqdm_lib.tqdm(*args, **kwargs)
else:
return EmptyTqdm(*args, **kwargs)
def set_lock(self, *args, **kwargs):
self._lock = None
if _tqdm_active:
return tqdm_lib.tqdm.set_lock(*args, **kwargs)
def get_lock(self):
if _tqdm_active:
return tqdm_lib.tqdm.get_lock()
```
### Environment info
Python 3.11.4
tqdm '4.65.0'
datasets master
I have tested the latest main, it does not work.
I add more logs to reproduce this issue, it looks like a multi threading bug:
```python
@contextmanager
def ensure_lock(tqdm_class, lock_name=""):
"""get (create if necessary) and then restore `tqdm_class`'s lock"""
import os
import threading
print(os.getpid(), threading.get_ident(), "ensure_lock", tqdm_class, lock_name)
old_lock = getattr(tqdm_class, '_lock', None) # don't create a new lock
lock = old_lock or tqdm_class.get_lock() # maybe create a new lock
lock = getattr(lock, lock_name, lock) # maybe subtype
tqdm_class.set_lock(lock)
print(os.getpid(), threading.get_ident(), "set_lock")
yield lock
if old_lock is None:
print(os.getpid(), threading.get_ident(), "del tqdm_class")
del tqdm_class._lock
else:
tqdm_class.set_lock(old_lock)
```
output
```
64943 8424758784 ensure_lock <datasets.utils.logging._tqdm_cls object at 0x2aa7fb250>
64943 8424758784 set_lock
64943 8424758784 del tqdm_class
64943 8424758784 ensure_lock <datasets.utils.logging._tqdm_cls object at 0x2aa7fb250>
64943 8424758784 set_lock
64943 8424758784 del tqdm_class
64943 11638370304 ensure_lock <datasets.utils.logging._tqdm_cls object at 0x2aa7fb250>
64943 11638370304 set_lock
64943 11568967680 ensure_lock <datasets.utils.logging._tqdm_cls object at 0x2aa7fb250>
64943 11568967680 set_lock
64943 11638370304 del tqdm_class
64943 11638370304 ensure_lock <datasets.utils.logging._tqdm_cls object at 0x2aa7fb250>
64943 11638370304 set_lock
64943 11638370304 del tqdm_class
64943 11568967680 del tqdm_class
```
Thread `11638370304` del the _lock from tqdm_class first, then thread `11568967680` del _lock failed. | [
-1.3521512746810913,
-0.8465626835823059,
-0.5868315100669861,
1.283677339553833,
0.03677382320165634,
-0.8991362452507019,
0.05178180709481239,
-1.024348497390747,
1.9279330968856812,
-0.5640751123428345,
0.19435115158557892,
-1.4659757614135742,
-0.12366081774234772,
-0.3550596237182617,
-0.6583359837532043,
-1.0089880228042603,
-0.22304120659828186,
-0.8023163080215454,
1.1088749170303345,
2.6884775161743164,
1.156903862953186,
-1.3759241104125977,
2.642866849899292,
0.7988353967666626,
-0.24207842350006104,
-0.7284358143806458,
0.5179723501205444,
-0.011512529104948044,
-1.1826525926589966,
-0.6495604515075684,
-1.0175813436508179,
0.022053562104701996,
-0.6313120722770691,
-0.3401859402656555,
-0.02158968523144722,
0.13139449059963226,
-0.20061808824539185,
-0.2873065769672394,
-0.9021544456481934,
-0.6910043358802795,
0.548274040222168,
-0.2852327525615692,
0.962647020816803,
-0.3649974763393402,
1.8277539014816284,
-0.6605496406555176,
0.6081895232200623,
0.7097229957580566,
1.1302821636199951,
0.03843861073255539,
-0.02079499140381813,
0.534895122051239,
0.3973972499370575,
-0.030856993049383163,
0.7792328596115112,
1.1679213047027588,
0.6481515765190125,
0.5231693983078003,
0.3747190535068512,
-2.402606964111328,
1.3480474948883057,
-1.1254764795303345,
0.2611131966114044,
1.3818163871765137,
-0.7771731615066528,
0.33440378308296204,
-1.6795424222946167,
0.18649689853191376,
0.7953941226005554,
-2.4113516807556152,
0.21887235343456268,
-1.3777607679367065,
-0.6116394400596619,
1.02347731590271,
0.4455806314945221,
-1.1382908821105957,
0.04288424551486969,
-0.4744756817817688,
1.1887880563735962,
0.16459180414676666,
1.323036789894104,
-1.5153446197509766,
0.07853391021490097,
-0.16390080749988556,
0.40112704038619995,
-1.1884578466415405,
-1.63075590133667,
0.47040989995002747,
0.5899773836135864,
0.26367324590682983,
-0.20505091547966003,
1.0199583768844604,
-0.9974428415298462,
0.5892379283905029,
-0.879410445690155,
-1.5193231105804443,
-1.6370117664337158,
-2.5339717864990234,
-2.419931411743164,
0.7907775044441223,
-0.6993247866630554,
-0.3508959710597992,
2.1170456409454346,
-1.1112667322158813,
-1.5155402421951294,
0.9031490683555603,
0.1301542967557907,
0.18626834452152252,
2.1760153770446777,
0.0870685800909996,
-0.6804654598236084,
0.37824180722236633,
-0.726199746131897,
0.7385104894638062,
-0.30165982246398926,
1.4342628717422485,
0.5134738087654114,
-1.1090902090072632,
1.4783711433410645,
-0.5905486345291138,
0.5421697497367859,
-0.35697025060653687,
-0.5581348538398743,
-0.7811577320098877,
0.4774627089500427,
1.9544063806533813,
-0.3682940602302551,
1.717416763305664,
-0.5249424576759338,
-1.5466097593307495,
-1.4526327848434448,
0.8967746496200562,
0.4380446970462799,
-0.9256751537322998,
0.3436538577079773,
-0.6989375352859497,
0.06934519857168198,
-0.1274934858083725,
1.2606428861618042,
1.4358786344528198,
0.8622769117355347,
-0.28867924213409424,
-0.9380638599395752,
0.21729804575443268,
-0.180426687002182,
-0.8059960007667542,
-1.8390917778015137,
-0.16765767335891724,
0.10799171775579453,
0.6952167749404907,
-1.334524154663086,
1.5881760120391846,
0.8184784650802612,
1.9953057765960693,
0.8810362219810486,
-0.3565824329853058,
1.5788503885269165,
0.10273914039134979,
1.9695619344711304,
-0.7274723052978516,
0.6091565489768982,
-0.25802770256996155,
-1.13075590133667,
0.602349579334259,
-0.5166391730308533,
-2.019538164138794,
-0.7058054208755493,
-0.7484105825424194,
-0.07471983879804611,
-0.8735766410827637,
0.8328580856323242,
-0.07892382144927979,
-1.3269766569137573,
0.037220317870378494,
-0.6979303359985352,
0.525588870048523,
-1.268679141998291,
0.19269853830337524,
0.7282240986824036,
-0.40709948539733887,
0.19289961457252502,
-0.30141860246658325,
-1.2765871286392212,
-0.44538742303848267,
0.2148360311985016,
1.7092931270599365,
-0.3832385241985321,
0.6793234348297119,
1.2920857667922974,
-0.7202000617980957,
-0.05136673152446747,
0.24222339689731598,
-0.31593912839889526,
0.8499449491500854,
-1.213307499885559,
-0.4020674526691437,
1.103127121925354,
-0.12177959829568863,
-0.538506269454956,
1.2828400135040283,
0.7414155006408691,
-1.4261047840118408,
-0.3345857858657837,
-0.1103140339255333,
-0.800789475440979,
0.229596808552742,
-1.599118947982788,
-0.13479000329971313,
0.3764839768409729,
-1.6156822443008423,
-0.42269524931907654,
-0.2238057255744934,
1.2895721197128296,
-0.4028053879737854,
1.5293537378311157,
-0.02884598821401596,
0.03283382207155228,
-0.41834840178489685,
-0.23257780075073242,
0.32171517610549927,
-0.152330681681633,
-0.7775755524635315,
0.37977704405784607,
-0.6720184087753296,
0.2616594433784485,
1.236938238143921,
0.21759240329265594,
-0.2889638841152191,
0.292082816362381,
1.2093192338943481,
0.35908243060112,
-0.23396429419517517,
-0.8236218690872192,
-1.7396965026855469,
1.9075483083724976,
-1.2333664894104004,
1.735875129699707,
0.8410902619361877,
0.06864677369594574,
-1.9759607315063477,
-1.9344966411590576,
0.9765974283218384,
1.1564213037490845,
2.433076858520508,
0.29628849029541016,
0.5317174792289734,
-0.816351056098938,
-0.6313667893409729,
0.2908959686756134,
-0.8242727518081665,
-0.6654465198516846,
0.28600338101387024,
2.3161346912384033,
1.744185447692871,
-0.5277401804924011,
-0.16757617890834808,
-0.9070008993148804,
0.9472280740737915,
-0.1560613512992859,
0.1032833382487297,
1.8340047597885132,
-0.21770057082176208,
-1.109144926071167,
1.2990546226501465,
-2.280304193496704,
0.3642001152038574,
1.896501064300537,
0.3428557813167572,
0.14780259132385254,
-1.515293002128601,
-0.7185305953025818,
-0.2297145128250122,
-0.47209396958351135,
-1.2793437242507935,
0.5771636366844177,
-0.04452018067240715,
-1.1568613052368164,
-1.4738106727600098,
0.17234741151332855,
-1.0940903425216675,
-1.6372356414794922,
0.09702835232019424,
1.6472487449645996,
1.7815272808074951,
-0.9347864389419556,
1.2636431455612183,
-0.2786821722984314,
-0.058101311326026917,
1.3028626441955566,
1.2421928644180298,
3.1923696994781494,
2.0930440425872803,
-1.3588863611221313,
0.7501751184463501,
-0.45425325632095337,
-0.48371684551239014,
1.3359118700027466,
-1.3969383239746094,
1.0847744941711426,
-0.08317103981971741,
-1.2431195974349976,
-1.1207540035247803,
1.196039080619812,
0.49201297760009766,
-0.017637604847550392,
-0.39043474197387695,
1.4444079399108887,
0.08816592395305634,
1.329132080078125,
0.5904709696769714,
-0.3448835015296936,
0.5995341539382935,
-0.2379176914691925,
-0.3511018753051758,
1.4434895515441895,
0.16469095647335052,
-1.3172589540481567,
-2.0604515075683594,
-0.30608969926834106,
-1.092736840248108,
-0.18789948523044586,
-0.6453109383583069,
-0.8920084238052368,
1.4902311563491821,
0.4073588252067566,
-1.0816891193389893,
-0.48647788166999817,
-0.4077385365962982,
-0.694445013999939,
2.6950268745422363,
-1.438475251197815,
-0.12085571885108948,
-1.0280990600585938,
-0.37704789638519287,
1.7620261907577515,
-1.2021361589431763,
-0.1440926343202591,
-1.0291293859481812,
-0.5072453618049622,
-1.343376636505127,
-0.40150928497314453,
-0.15733928978443146,
-0.8161590695381165,
0.8386436104774475,
0.29525089263916016,
-1.2216306924819946,
-0.307094007730484,
-0.6104503870010376,
0.8233334422111511,
-0.00845920480787754,
0.21250730752944946,
1.8285976648330688,
0.20871397852897644,
-0.5204732418060303,
0.6522339582443237,
1.2864199876785278,
0.8206965327262878,
-0.7473633885383606,
0.01238060649484396,
-0.877595067024231,
0.2103065550327301,
-1.8275014162063599,
0.2577137053012848,
-2.6765716075897217,
0.745964527130127,
-0.21918867528438568,
-0.16634029150009155,
-0.1883762925863266,
-1.3646878004074097,
0.9899558424949646,
2.4431285858154297,
-1.222352147102356,
0.34013426303863525,
0.558910608291626,
1.129453420639038,
-1.52141535282135,
0.27728357911109924,
-0.5472350716590881,
1.9673813581466675,
0.3606279194355011,
1.29331374168396,
-0.26412132382392883,
-2.2942326068878174,
0.7008957862854004,
-0.9900544285774231,
-0.7993454337120056,
0.9848408699035645,
-1.036194920539856,
0.10173735022544861,
-1.6293010711669922,
-0.4484351575374603,
-0.7917584776878357,
-1.3042129278182983,
0.4027526080608368,
0.10850761830806732,
0.4813213050365448,
-0.8338385820388794,
0.4156211018562317,
-2.1256425380706787,
-1.280670166015625,
-0.14467526972293854,
-0.9829208850860596,
0.6360070705413818,
-0.3579353094100952,
0.5913558006286621,
0.045186858624219894,
0.1168600469827652,
0.3235798180103302,
1.642377257347107,
3.5620157718658447,
0.1342773586511612,
0.2802782654762268,
-0.03751535341143608,
-0.9832461476325989,
1.1756844520568848,
0.699571967124939,
-0.07713732123374939,
-0.6242050528526306,
-1.064204216003418,
1.3947227001190186,
1.9391998052597046,
1.1102224588394165,
0.11502466350793839,
-0.9782136082649231,
-0.9323775768280029,
0.11117929965257645,
0.19524629414081573,
0.45118585228919983,
0.8819080591201782,
0.14739590883255005,
0.13738112151622772,
1.4058096408843994,
1.1642804145812988,
-0.3376760482788086,
0.2272675782442093,
-0.8579511642456055,
-0.3494069278240204,
0.6956281661987305,
0.24563147127628326,
0.15718181431293488,
0.6150067448616028,
-1.0578062534332275,
-0.3040401339530945,
-0.1187351644039154,
-1.033526062965393,
-0.8469188213348389,
-0.3645491302013397,
-0.2851758599281311,
1.6337007284164429,
0.2335965484380722,
-0.48823320865631104,
0.18423989415168762,
-0.4957510828971863,
-0.13290081918239594,
-1.1375561952590942,
0.07648321986198425,
-0.10401888191699982,
0.01050268393009901,
-0.14036229252815247,
1.5430327653884888,
-0.7817375063896179,
-1.9662758111953735,
0.02723463624715805,
0.2289348542690277,
-0.28549960255622864,
0.2778286933898926,
1.876517415046692,
0.5024697780609131,
1.791791558265686,
1.02422297000885,
1.1390247344970703,
-0.47523459792137146,
-1.336104154586792,
0.7638934254646301,
1.0105618238449097,
-1.4831258058547974,
0.7561991214752197,
-0.2655555307865143,
-0.6414832472801208,
0.6192159056663513,
1.3197944164276123,
0.3682551980018616,
-1.8802424669265747,
1.0183417797088623,
-0.8876082301139832,
0.7711708545684814,
0.5310311317443848,
0.9148852229118347,
-0.02934601902961731,
0.8280729055404663,
-1.341902494430542,
-1.0763003826141357,
-0.5112506151199341,
-0.7666745781898499,
1.7777831554412842,
-0.33654695749282837,
0.47715476155281067,
-0.18093575537204742,
-1.3464833498001099,
0.04348471015691757,
0.9014179706573486,
0.09589551389217377,
-0.5071082711219788,
1.235575795173645,
-0.7955337762832642,
-1.2208199501037598,
-1.3365451097488403,
-0.4627600908279419,
-0.8945221304893494,
-0.8102182745933533,
1.1722508668899536,
0.8489481806755066,
0.3076280951499939,
1.931687593460083,
0.5728175640106201,
0.2557595372200012,
-2.676346778869629,
0.7806742787361145,
0.07530584931373596,
0.1754676252603531,
0.9270681738853455,
0.2305983155965805,
1.0851138830184937,
-0.13302747905254364,
0.6602859497070312,
-2.2139697074890137,
2.190561532974243,
-0.06898049265146255,
0.6678903698921204,
-0.27786168456077576,
-0.24984021484851837,
0.8927656412124634,
0.48498299717903137,
0.743829071521759,
-1.4213987588882446,
0.8266007900238037,
-0.4907926023006439,
0.9112980365753174,
0.6877413988113403,
-0.7418578267097473,
-0.10262042284011841,
1.0204861164093018,
0.5001095533370972,
-0.38696756958961487,
-0.9797511696815491,
-0.9291428327560425,
1.1279083490371704,
1.6088098287582397,
-0.04091116413474083,
-0.0063375914469361305,
0.7068549394607544,
0.6967776417732239,
-1.119896650314331,
0.3266255855560303,
-0.7109658718109131,
-0.6586567759513855,
1.3143470287322998,
2.0225086212158203,
-0.10523401200771332,
-0.19205746054649353,
-0.6288843154907227,
-1.1921111345291138,
0.4705393612384796,
-0.14703509211540222,
0.45896822214126587,
0.6097984910011292,
-0.6311136484146118,
0.7907437682151794,
0.853172242641449,
0.9281733632087708,
0.11423075199127197,
0.3773452043533325,
0.5226050615310669,
-0.4893872141838074,
-0.9468663334846497,
-0.5079358220100403,
-0.9944900274276733,
-2.772594928741455,
0.4865324795246124,
-0.31221452355384827,
-1.7003687620162964,
0.13714314997196198,
-1.1598178148269653,
0.9037516713142395,
-0.6062751412391663,
-1.4831300973892212,
-1.3606762886047363,
0.3976737856864929,
-0.018978750333189964,
1.126449704170227,
-1.5416712760925293,
-0.10684391856193542,
1.3499733209609985,
0.9306431412696838,
-0.20869342982769012,
0.7041609883308411,
0.3663647174835205,
1.0119878053665161,
1.1269590854644775,
-0.1746334284543991,
0.5356847643852234,
0.31965020298957825,
-1.226167917251587,
0.44694799184799194,
1.1744554042816162,
0.3333441913127899,
1.4427132606506348,
-0.35785728693008423,
0.17492975294589996,
0.5848684310913086,
-0.7010063529014587,
-0.5601987242698669,
-0.2631869614124298,
0.35074901580810547,
0.3718017339706421,
-1.1137945652008057,
-0.14256711304187775,
-0.3362291157245636,
0.004177388735115528,
-0.11863942444324493,
-1.3614659309387207,
-0.3265659213066101,
-0.3982192873954773,
-0.686803936958313,
-1.4375382661819458,
0.07430471479892731,
1.2458163499832153,
-0.7400732040405273,
-0.09871954470872879,
0.38881802558898926,
0.46149173378944397,
0.5702497959136963,
0.509876012802124,
-0.7289793491363525,
-0.45075181126594543,
-0.1696815937757492,
-0.25022801756858826,
0.1599012315273285,
1.0350897312164307,
-0.12144225835800171,
-1.0334320068359375,
0.6304041147232056,
-0.278475284576416,
0.19349141418933868,
1.8877155780792236,
0.12918412685394287,
-0.8450613021850586,
0.42738577723503113,
-0.5980470776557922,
1.7481648921966553,
1.7766462564468384,
1.4082164764404297,
-0.08475938439369202,
-0.8481414318084717,
0.4641878008842468,
-0.5516619682312012,
-0.12393351644277573,
0.9465259313583374,
0.6039053797721863,
-0.22551381587982178,
-1.3075534105300903,
0.5837433934211731,
1.3028631210327148,
-1.0849767923355103,
-0.7287118434906006,
0.353732168674469,
-0.6826037764549255,
1.322310447692871,
0.624575138092041,
0.07813600450754166,
0.2458200603723526,
1.6093138456344604,
0.7779735326766968,
-0.535224437713623,
0.5232193470001221,
0.7197362780570984,
-0.4259026348590851,
-2.314595937728882,
-1.2201613187789917,
0.3978528082370758,
-0.38476404547691345,
-1.3012583255767822,
1.393068790435791,
-1.1441254615783691,
-1.0403860807418823,
0.6296542286872864,
0.05764849856495857,
1.1507059335708618,
0.19841574132442474,
1.7154958248138428,
2.253068685531616,
0.757347583770752,
0.257707804441452,
1.313523530960083,
0.1278500258922577,
-0.47213754057884216,
1.9872981309890747,
-0.26319774985313416,
0.4560069441795349,
0.8710852265357971,
-0.5018423795700073,
-1.1134164333343506,
-1.0161212682724,
-1.1849862337112427,
-0.6824880242347717,
1.3156335353851318,
0.11360086500644684,
-0.9215918183326721,
0.4901082217693329,
1.7598676681518555,
0.16926084458827972,
-0.24960167706012726,
0.6341556310653687,
0.5583701729774475,
-0.7889825105667114,
-0.020468756556510925,
-1.2578049898147583,
0.6289879679679871,
-0.1664561629295349,
-0.09694315493106842,
0.08676231652498245,
0.7347716093063354,
1.2358806133270264,
0.09766668826341629,
-0.12577080726623535,
1.1313918828964233,
-1.4748961925506592,
1.6798367500305176,
-0.5699650049209595,
0.45263174176216125,
-2.3144304752349854,
1.1421259641647339,
-0.6715932488441467,
1.9252856969833374,
-2.450446367263794,
0.5139152407646179,
-0.7128379344940186,
-0.4163958430290222,
0.28455430269241333,
-0.4057167172431946,
0.14052660763263702,
-0.18454530835151672,
-1.046558141708374,
-0.14424367249011993,
-1.0758476257324219,
0.7310072779655457,
1.146992802619934,
1.4003256559371948,
-1.2156238555908203,
-0.0036764685064554214,
-1.3482110500335693,
-0.08654996007680893,
-0.8571937084197998,
0.23416702449321747,
-1.6697404384613037,
-0.28050923347473145,
-2.1111562252044678,
-2.304094076156616,
-1.326977252960205,
-0.7295746803283691,
1.0908632278442383,
0.22760042548179626,
-0.8652193546295166,
1.0831001996994019,
-0.6321773529052734,
-1.8993183374404907,
0.9742449522018433,
-2.2420873641967773
] |
https://github.com/huggingface/datasets/issues/6066 | AttributeError: '_tqdm_cls' object has no attribute '_lock' | Maybe it is a bug of tqdm? I think simply use `try ... except AttributeError ...` wraps `del tqdm_class._lock` should work. | ### Describe the bug
```python
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/site-packages/datasets/load.py", line 1034, in get_module
data_files = DataFilesDict.from_patterns(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/site-packages/datasets/data_files.py", line 671, in from_patterns
DataFilesList.from_patterns(
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/site-packages/datasets/data_files.py", line 586, in from_patterns
origin_metadata = _get_origin_metadata(data_files, download_config=download_config)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/site-packages/datasets/data_files.py", line 502, in _get_origin_metadata
return thread_map(
^^^^^^^^^^^
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/site-packages/tqdm/contrib/concurrent.py", line 70, in thread_map
return _executor_map(ThreadPoolExecutor, fn, *iterables, **tqdm_kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/site-packages/tqdm/contrib/concurrent.py", line 48, in _executor_map
with ensure_lock(tqdm_class, lock_name=lock_name) as lk:
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/contextlib.py", line 144, in __exit__
next(self.gen)
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/site-packages/tqdm/contrib/concurrent.py", line 25, in ensure_lock
del tqdm_class._lock
^^^^^^^^^^^^^^^^
AttributeError: '_tqdm_cls' object has no attribute '_lock'
```
### Steps to reproduce the bug
Happens ocasionally.
### Expected behavior
I added a print in tqdm `ensure_lock()`, got a `ensure_lock <datasets.utils.logging._tqdm_cls object at 0x16dddead0> ` print.
According to the code in https://github.com/tqdm/tqdm/blob/master/tqdm/contrib/concurrent.py#L24
```python
@contextmanager
def ensure_lock(tqdm_class, lock_name=""):
"""get (create if necessary) and then restore `tqdm_class`'s lock"""
print("ensure_lock", tqdm_class, lock_name)
old_lock = getattr(tqdm_class, '_lock', None) # don't create a new lock
lock = old_lock or tqdm_class.get_lock() # maybe create a new lock
lock = getattr(lock, lock_name, lock) # maybe subtype
tqdm_class.set_lock(lock)
yield lock
if old_lock is None:
del tqdm_class._lock # <-- It tries to del the `_lock` attribute from tqdm_class.
else:
tqdm_class.set_lock(old_lock)
```
But, huggingface datasets `datasets.utils.logging._tqdm_cls` does not have the field `_lock`: https://github.com/huggingface/datasets/blob/main/src/datasets/utils/logging.py#L205
```python
class _tqdm_cls:
def __call__(self, *args, disable=False, **kwargs):
if _tqdm_active and not disable:
return tqdm_lib.tqdm(*args, **kwargs)
else:
return EmptyTqdm(*args, **kwargs)
def set_lock(self, *args, **kwargs):
self._lock = None
if _tqdm_active:
return tqdm_lib.tqdm.set_lock(*args, **kwargs)
def get_lock(self):
if _tqdm_active:
return tqdm_lib.tqdm.get_lock()
```
### Environment info
Python 3.11.4
tqdm '4.65.0'
datasets master | 52 | 21 | AttributeError: '_tqdm_cls' object has no attribute '_lock'
### Describe the bug
```python
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/site-packages/datasets/load.py", line 1034, in get_module
data_files = DataFilesDict.from_patterns(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/site-packages/datasets/data_files.py", line 671, in from_patterns
DataFilesList.from_patterns(
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/site-packages/datasets/data_files.py", line 586, in from_patterns
origin_metadata = _get_origin_metadata(data_files, download_config=download_config)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/site-packages/datasets/data_files.py", line 502, in _get_origin_metadata
return thread_map(
^^^^^^^^^^^
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/site-packages/tqdm/contrib/concurrent.py", line 70, in thread_map
return _executor_map(ThreadPoolExecutor, fn, *iterables, **tqdm_kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/site-packages/tqdm/contrib/concurrent.py", line 48, in _executor_map
with ensure_lock(tqdm_class, lock_name=lock_name) as lk:
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/contextlib.py", line 144, in __exit__
next(self.gen)
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/site-packages/tqdm/contrib/concurrent.py", line 25, in ensure_lock
del tqdm_class._lock
^^^^^^^^^^^^^^^^
AttributeError: '_tqdm_cls' object has no attribute '_lock'
```
### Steps to reproduce the bug
Happens ocasionally.
### Expected behavior
I added a print in tqdm `ensure_lock()`, got a `ensure_lock <datasets.utils.logging._tqdm_cls object at 0x16dddead0> ` print.
According to the code in https://github.com/tqdm/tqdm/blob/master/tqdm/contrib/concurrent.py#L24
```python
@contextmanager
def ensure_lock(tqdm_class, lock_name=""):
"""get (create if necessary) and then restore `tqdm_class`'s lock"""
print("ensure_lock", tqdm_class, lock_name)
old_lock = getattr(tqdm_class, '_lock', None) # don't create a new lock
lock = old_lock or tqdm_class.get_lock() # maybe create a new lock
lock = getattr(lock, lock_name, lock) # maybe subtype
tqdm_class.set_lock(lock)
yield lock
if old_lock is None:
del tqdm_class._lock # <-- It tries to del the `_lock` attribute from tqdm_class.
else:
tqdm_class.set_lock(old_lock)
```
But, huggingface datasets `datasets.utils.logging._tqdm_cls` does not have the field `_lock`: https://github.com/huggingface/datasets/blob/main/src/datasets/utils/logging.py#L205
```python
class _tqdm_cls:
def __call__(self, *args, disable=False, **kwargs):
if _tqdm_active and not disable:
return tqdm_lib.tqdm(*args, **kwargs)
else:
return EmptyTqdm(*args, **kwargs)
def set_lock(self, *args, **kwargs):
self._lock = None
if _tqdm_active:
return tqdm_lib.tqdm.set_lock(*args, **kwargs)
def get_lock(self):
if _tqdm_active:
return tqdm_lib.tqdm.get_lock()
```
### Environment info
Python 3.11.4
tqdm '4.65.0'
datasets master
Maybe it is a bug of tqdm? I think simply use `try ... except AttributeError ...` wraps `del tqdm_class._lock` should work. | [
-1.3521512746810913,
-0.8465626835823059,
-0.5868315100669861,
1.283677339553833,
0.03677382320165634,
-0.8991362452507019,
0.05178180709481239,
-1.024348497390747,
1.9279330968856812,
-0.5640751123428345,
0.19435115158557892,
-1.4659757614135742,
-0.12366081774234772,
-0.3550596237182617,
-0.6583359837532043,
-1.0089880228042603,
-0.22304120659828186,
-0.8023163080215454,
1.1088749170303345,
2.6884775161743164,
1.156903862953186,
-1.3759241104125977,
2.642866849899292,
0.7988353967666626,
-0.24207842350006104,
-0.7284358143806458,
0.5179723501205444,
-0.011512529104948044,
-1.1826525926589966,
-0.6495604515075684,
-1.0175813436508179,
0.022053562104701996,
-0.6313120722770691,
-0.3401859402656555,
-0.02158968523144722,
0.13139449059963226,
-0.20061808824539185,
-0.2873065769672394,
-0.9021544456481934,
-0.6910043358802795,
0.548274040222168,
-0.2852327525615692,
0.962647020816803,
-0.3649974763393402,
1.8277539014816284,
-0.6605496406555176,
0.6081895232200623,
0.7097229957580566,
1.1302821636199951,
0.03843861073255539,
-0.02079499140381813,
0.534895122051239,
0.3973972499370575,
-0.030856993049383163,
0.7792328596115112,
1.1679213047027588,
0.6481515765190125,
0.5231693983078003,
0.3747190535068512,
-2.402606964111328,
1.3480474948883057,
-1.1254764795303345,
0.2611131966114044,
1.3818163871765137,
-0.7771731615066528,
0.33440378308296204,
-1.6795424222946167,
0.18649689853191376,
0.7953941226005554,
-2.4113516807556152,
0.21887235343456268,
-1.3777607679367065,
-0.6116394400596619,
1.02347731590271,
0.4455806314945221,
-1.1382908821105957,
0.04288424551486969,
-0.4744756817817688,
1.1887880563735962,
0.16459180414676666,
1.323036789894104,
-1.5153446197509766,
0.07853391021490097,
-0.16390080749988556,
0.40112704038619995,
-1.1884578466415405,
-1.63075590133667,
0.47040989995002747,
0.5899773836135864,
0.26367324590682983,
-0.20505091547966003,
1.0199583768844604,
-0.9974428415298462,
0.5892379283905029,
-0.879410445690155,
-1.5193231105804443,
-1.6370117664337158,
-2.5339717864990234,
-2.419931411743164,
0.7907775044441223,
-0.6993247866630554,
-0.3508959710597992,
2.1170456409454346,
-1.1112667322158813,
-1.5155402421951294,
0.9031490683555603,
0.1301542967557907,
0.18626834452152252,
2.1760153770446777,
0.0870685800909996,
-0.6804654598236084,
0.37824180722236633,
-0.726199746131897,
0.7385104894638062,
-0.30165982246398926,
1.4342628717422485,
0.5134738087654114,
-1.1090902090072632,
1.4783711433410645,
-0.5905486345291138,
0.5421697497367859,
-0.35697025060653687,
-0.5581348538398743,
-0.7811577320098877,
0.4774627089500427,
1.9544063806533813,
-0.3682940602302551,
1.717416763305664,
-0.5249424576759338,
-1.5466097593307495,
-1.4526327848434448,
0.8967746496200562,
0.4380446970462799,
-0.9256751537322998,
0.3436538577079773,
-0.6989375352859497,
0.06934519857168198,
-0.1274934858083725,
1.2606428861618042,
1.4358786344528198,
0.8622769117355347,
-0.28867924213409424,
-0.9380638599395752,
0.21729804575443268,
-0.180426687002182,
-0.8059960007667542,
-1.8390917778015137,
-0.16765767335891724,
0.10799171775579453,
0.6952167749404907,
-1.334524154663086,
1.5881760120391846,
0.8184784650802612,
1.9953057765960693,
0.8810362219810486,
-0.3565824329853058,
1.5788503885269165,
0.10273914039134979,
1.9695619344711304,
-0.7274723052978516,
0.6091565489768982,
-0.25802770256996155,
-1.13075590133667,
0.602349579334259,
-0.5166391730308533,
-2.019538164138794,
-0.7058054208755493,
-0.7484105825424194,
-0.07471983879804611,
-0.8735766410827637,
0.8328580856323242,
-0.07892382144927979,
-1.3269766569137573,
0.037220317870378494,
-0.6979303359985352,
0.525588870048523,
-1.268679141998291,
0.19269853830337524,
0.7282240986824036,
-0.40709948539733887,
0.19289961457252502,
-0.30141860246658325,
-1.2765871286392212,
-0.44538742303848267,
0.2148360311985016,
1.7092931270599365,
-0.3832385241985321,
0.6793234348297119,
1.2920857667922974,
-0.7202000617980957,
-0.05136673152446747,
0.24222339689731598,
-0.31593912839889526,
0.8499449491500854,
-1.213307499885559,
-0.4020674526691437,
1.103127121925354,
-0.12177959829568863,
-0.538506269454956,
1.2828400135040283,
0.7414155006408691,
-1.4261047840118408,
-0.3345857858657837,
-0.1103140339255333,
-0.800789475440979,
0.229596808552742,
-1.599118947982788,
-0.13479000329971313,
0.3764839768409729,
-1.6156822443008423,
-0.42269524931907654,
-0.2238057255744934,
1.2895721197128296,
-0.4028053879737854,
1.5293537378311157,
-0.02884598821401596,
0.03283382207155228,
-0.41834840178489685,
-0.23257780075073242,
0.32171517610549927,
-0.152330681681633,
-0.7775755524635315,
0.37977704405784607,
-0.6720184087753296,
0.2616594433784485,
1.236938238143921,
0.21759240329265594,
-0.2889638841152191,
0.292082816362381,
1.2093192338943481,
0.35908243060112,
-0.23396429419517517,
-0.8236218690872192,
-1.7396965026855469,
1.9075483083724976,
-1.2333664894104004,
1.735875129699707,
0.8410902619361877,
0.06864677369594574,
-1.9759607315063477,
-1.9344966411590576,
0.9765974283218384,
1.1564213037490845,
2.433076858520508,
0.29628849029541016,
0.5317174792289734,
-0.816351056098938,
-0.6313667893409729,
0.2908959686756134,
-0.8242727518081665,
-0.6654465198516846,
0.28600338101387024,
2.3161346912384033,
1.744185447692871,
-0.5277401804924011,
-0.16757617890834808,
-0.9070008993148804,
0.9472280740737915,
-0.1560613512992859,
0.1032833382487297,
1.8340047597885132,
-0.21770057082176208,
-1.109144926071167,
1.2990546226501465,
-2.280304193496704,
0.3642001152038574,
1.896501064300537,
0.3428557813167572,
0.14780259132385254,
-1.515293002128601,
-0.7185305953025818,
-0.2297145128250122,
-0.47209396958351135,
-1.2793437242507935,
0.5771636366844177,
-0.04452018067240715,
-1.1568613052368164,
-1.4738106727600098,
0.17234741151332855,
-1.0940903425216675,
-1.6372356414794922,
0.09702835232019424,
1.6472487449645996,
1.7815272808074951,
-0.9347864389419556,
1.2636431455612183,
-0.2786821722984314,
-0.058101311326026917,
1.3028626441955566,
1.2421928644180298,
3.1923696994781494,
2.0930440425872803,
-1.3588863611221313,
0.7501751184463501,
-0.45425325632095337,
-0.48371684551239014,
1.3359118700027466,
-1.3969383239746094,
1.0847744941711426,
-0.08317103981971741,
-1.2431195974349976,
-1.1207540035247803,
1.196039080619812,
0.49201297760009766,
-0.017637604847550392,
-0.39043474197387695,
1.4444079399108887,
0.08816592395305634,
1.329132080078125,
0.5904709696769714,
-0.3448835015296936,
0.5995341539382935,
-0.2379176914691925,
-0.3511018753051758,
1.4434895515441895,
0.16469095647335052,
-1.3172589540481567,
-2.0604515075683594,
-0.30608969926834106,
-1.092736840248108,
-0.18789948523044586,
-0.6453109383583069,
-0.8920084238052368,
1.4902311563491821,
0.4073588252067566,
-1.0816891193389893,
-0.48647788166999817,
-0.4077385365962982,
-0.694445013999939,
2.6950268745422363,
-1.438475251197815,
-0.12085571885108948,
-1.0280990600585938,
-0.37704789638519287,
1.7620261907577515,
-1.2021361589431763,
-0.1440926343202591,
-1.0291293859481812,
-0.5072453618049622,
-1.343376636505127,
-0.40150928497314453,
-0.15733928978443146,
-0.8161590695381165,
0.8386436104774475,
0.29525089263916016,
-1.2216306924819946,
-0.307094007730484,
-0.6104503870010376,
0.8233334422111511,
-0.00845920480787754,
0.21250730752944946,
1.8285976648330688,
0.20871397852897644,
-0.5204732418060303,
0.6522339582443237,
1.2864199876785278,
0.8206965327262878,
-0.7473633885383606,
0.01238060649484396,
-0.877595067024231,
0.2103065550327301,
-1.8275014162063599,
0.2577137053012848,
-2.6765716075897217,
0.745964527130127,
-0.21918867528438568,
-0.16634029150009155,
-0.1883762925863266,
-1.3646878004074097,
0.9899558424949646,
2.4431285858154297,
-1.222352147102356,
0.34013426303863525,
0.558910608291626,
1.129453420639038,
-1.52141535282135,
0.27728357911109924,
-0.5472350716590881,
1.9673813581466675,
0.3606279194355011,
1.29331374168396,
-0.26412132382392883,
-2.2942326068878174,
0.7008957862854004,
-0.9900544285774231,
-0.7993454337120056,
0.9848408699035645,
-1.036194920539856,
0.10173735022544861,
-1.6293010711669922,
-0.4484351575374603,
-0.7917584776878357,
-1.3042129278182983,
0.4027526080608368,
0.10850761830806732,
0.4813213050365448,
-0.8338385820388794,
0.4156211018562317,
-2.1256425380706787,
-1.280670166015625,
-0.14467526972293854,
-0.9829208850860596,
0.6360070705413818,
-0.3579353094100952,
0.5913558006286621,
0.045186858624219894,
0.1168600469827652,
0.3235798180103302,
1.642377257347107,
3.5620157718658447,
0.1342773586511612,
0.2802782654762268,
-0.03751535341143608,
-0.9832461476325989,
1.1756844520568848,
0.699571967124939,
-0.07713732123374939,
-0.6242050528526306,
-1.064204216003418,
1.3947227001190186,
1.9391998052597046,
1.1102224588394165,
0.11502466350793839,
-0.9782136082649231,
-0.9323775768280029,
0.11117929965257645,
0.19524629414081573,
0.45118585228919983,
0.8819080591201782,
0.14739590883255005,
0.13738112151622772,
1.4058096408843994,
1.1642804145812988,
-0.3376760482788086,
0.2272675782442093,
-0.8579511642456055,
-0.3494069278240204,
0.6956281661987305,
0.24563147127628326,
0.15718181431293488,
0.6150067448616028,
-1.0578062534332275,
-0.3040401339530945,
-0.1187351644039154,
-1.033526062965393,
-0.8469188213348389,
-0.3645491302013397,
-0.2851758599281311,
1.6337007284164429,
0.2335965484380722,
-0.48823320865631104,
0.18423989415168762,
-0.4957510828971863,
-0.13290081918239594,
-1.1375561952590942,
0.07648321986198425,
-0.10401888191699982,
0.01050268393009901,
-0.14036229252815247,
1.5430327653884888,
-0.7817375063896179,
-1.9662758111953735,
0.02723463624715805,
0.2289348542690277,
-0.28549960255622864,
0.2778286933898926,
1.876517415046692,
0.5024697780609131,
1.791791558265686,
1.02422297000885,
1.1390247344970703,
-0.47523459792137146,
-1.336104154586792,
0.7638934254646301,
1.0105618238449097,
-1.4831258058547974,
0.7561991214752197,
-0.2655555307865143,
-0.6414832472801208,
0.6192159056663513,
1.3197944164276123,
0.3682551980018616,
-1.8802424669265747,
1.0183417797088623,
-0.8876082301139832,
0.7711708545684814,
0.5310311317443848,
0.9148852229118347,
-0.02934601902961731,
0.8280729055404663,
-1.341902494430542,
-1.0763003826141357,
-0.5112506151199341,
-0.7666745781898499,
1.7777831554412842,
-0.33654695749282837,
0.47715476155281067,
-0.18093575537204742,
-1.3464833498001099,
0.04348471015691757,
0.9014179706573486,
0.09589551389217377,
-0.5071082711219788,
1.235575795173645,
-0.7955337762832642,
-1.2208199501037598,
-1.3365451097488403,
-0.4627600908279419,
-0.8945221304893494,
-0.8102182745933533,
1.1722508668899536,
0.8489481806755066,
0.3076280951499939,
1.931687593460083,
0.5728175640106201,
0.2557595372200012,
-2.676346778869629,
0.7806742787361145,
0.07530584931373596,
0.1754676252603531,
0.9270681738853455,
0.2305983155965805,
1.0851138830184937,
-0.13302747905254364,
0.6602859497070312,
-2.2139697074890137,
2.190561532974243,
-0.06898049265146255,
0.6678903698921204,
-0.27786168456077576,
-0.24984021484851837,
0.8927656412124634,
0.48498299717903137,
0.743829071521759,
-1.4213987588882446,
0.8266007900238037,
-0.4907926023006439,
0.9112980365753174,
0.6877413988113403,
-0.7418578267097473,
-0.10262042284011841,
1.0204861164093018,
0.5001095533370972,
-0.38696756958961487,
-0.9797511696815491,
-0.9291428327560425,
1.1279083490371704,
1.6088098287582397,
-0.04091116413474083,
-0.0063375914469361305,
0.7068549394607544,
0.6967776417732239,
-1.119896650314331,
0.3266255855560303,
-0.7109658718109131,
-0.6586567759513855,
1.3143470287322998,
2.0225086212158203,
-0.10523401200771332,
-0.19205746054649353,
-0.6288843154907227,
-1.1921111345291138,
0.4705393612384796,
-0.14703509211540222,
0.45896822214126587,
0.6097984910011292,
-0.6311136484146118,
0.7907437682151794,
0.853172242641449,
0.9281733632087708,
0.11423075199127197,
0.3773452043533325,
0.5226050615310669,
-0.4893872141838074,
-0.9468663334846497,
-0.5079358220100403,
-0.9944900274276733,
-2.772594928741455,
0.4865324795246124,
-0.31221452355384827,
-1.7003687620162964,
0.13714314997196198,
-1.1598178148269653,
0.9037516713142395,
-0.6062751412391663,
-1.4831300973892212,
-1.3606762886047363,
0.3976737856864929,
-0.018978750333189964,
1.126449704170227,
-1.5416712760925293,
-0.10684391856193542,
1.3499733209609985,
0.9306431412696838,
-0.20869342982769012,
0.7041609883308411,
0.3663647174835205,
1.0119878053665161,
1.1269590854644775,
-0.1746334284543991,
0.5356847643852234,
0.31965020298957825,
-1.226167917251587,
0.44694799184799194,
1.1744554042816162,
0.3333441913127899,
1.4427132606506348,
-0.35785728693008423,
0.17492975294589996,
0.5848684310913086,
-0.7010063529014587,
-0.5601987242698669,
-0.2631869614124298,
0.35074901580810547,
0.3718017339706421,
-1.1137945652008057,
-0.14256711304187775,
-0.3362291157245636,
0.004177388735115528,
-0.11863942444324493,
-1.3614659309387207,
-0.3265659213066101,
-0.3982192873954773,
-0.686803936958313,
-1.4375382661819458,
0.07430471479892731,
1.2458163499832153,
-0.7400732040405273,
-0.09871954470872879,
0.38881802558898926,
0.46149173378944397,
0.5702497959136963,
0.509876012802124,
-0.7289793491363525,
-0.45075181126594543,
-0.1696815937757492,
-0.25022801756858826,
0.1599012315273285,
1.0350897312164307,
-0.12144225835800171,
-1.0334320068359375,
0.6304041147232056,
-0.278475284576416,
0.19349141418933868,
1.8877155780792236,
0.12918412685394287,
-0.8450613021850586,
0.42738577723503113,
-0.5980470776557922,
1.7481648921966553,
1.7766462564468384,
1.4082164764404297,
-0.08475938439369202,
-0.8481414318084717,
0.4641878008842468,
-0.5516619682312012,
-0.12393351644277573,
0.9465259313583374,
0.6039053797721863,
-0.22551381587982178,
-1.3075534105300903,
0.5837433934211731,
1.3028631210327148,
-1.0849767923355103,
-0.7287118434906006,
0.353732168674469,
-0.6826037764549255,
1.322310447692871,
0.624575138092041,
0.07813600450754166,
0.2458200603723526,
1.6093138456344604,
0.7779735326766968,
-0.535224437713623,
0.5232193470001221,
0.7197362780570984,
-0.4259026348590851,
-2.314595937728882,
-1.2201613187789917,
0.3978528082370758,
-0.38476404547691345,
-1.3012583255767822,
1.393068790435791,
-1.1441254615783691,
-1.0403860807418823,
0.6296542286872864,
0.05764849856495857,
1.1507059335708618,
0.19841574132442474,
1.7154958248138428,
2.253068685531616,
0.757347583770752,
0.257707804441452,
1.313523530960083,
0.1278500258922577,
-0.47213754057884216,
1.9872981309890747,
-0.26319774985313416,
0.4560069441795349,
0.8710852265357971,
-0.5018423795700073,
-1.1134164333343506,
-1.0161212682724,
-1.1849862337112427,
-0.6824880242347717,
1.3156335353851318,
0.11360086500644684,
-0.9215918183326721,
0.4901082217693329,
1.7598676681518555,
0.16926084458827972,
-0.24960167706012726,
0.6341556310653687,
0.5583701729774475,
-0.7889825105667114,
-0.020468756556510925,
-1.2578049898147583,
0.6289879679679871,
-0.1664561629295349,
-0.09694315493106842,
0.08676231652498245,
0.7347716093063354,
1.2358806133270264,
0.09766668826341629,
-0.12577080726623535,
1.1313918828964233,
-1.4748961925506592,
1.6798367500305176,
-0.5699650049209595,
0.45263174176216125,
-2.3144304752349854,
1.1421259641647339,
-0.6715932488441467,
1.9252856969833374,
-2.450446367263794,
0.5139152407646179,
-0.7128379344940186,
-0.4163958430290222,
0.28455430269241333,
-0.4057167172431946,
0.14052660763263702,
-0.18454530835151672,
-1.046558141708374,
-0.14424367249011993,
-1.0758476257324219,
0.7310072779655457,
1.146992802619934,
1.4003256559371948,
-1.2156238555908203,
-0.0036764685064554214,
-1.3482110500335693,
-0.08654996007680893,
-0.8571937084197998,
0.23416702449321747,
-1.6697404384613037,
-0.28050923347473145,
-2.1111562252044678,
-2.304094076156616,
-1.326977252960205,
-0.7295746803283691,
1.0908632278442383,
0.22760042548179626,
-0.8652193546295166,
1.0831001996994019,
-0.6321773529052734,
-1.8993183374404907,
0.9742449522018433,
-2.2420873641967773
] |
https://github.com/huggingface/datasets/issues/6066 | AttributeError: '_tqdm_cls' object has no attribute '_lock' | Yes it looks like a bug on their end indeed, do you want to open a PR on tqdm ?
Let me see if I can find a workaround in the meantime | ### Describe the bug
```python
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/site-packages/datasets/load.py", line 1034, in get_module
data_files = DataFilesDict.from_patterns(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/site-packages/datasets/data_files.py", line 671, in from_patterns
DataFilesList.from_patterns(
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/site-packages/datasets/data_files.py", line 586, in from_patterns
origin_metadata = _get_origin_metadata(data_files, download_config=download_config)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/site-packages/datasets/data_files.py", line 502, in _get_origin_metadata
return thread_map(
^^^^^^^^^^^
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/site-packages/tqdm/contrib/concurrent.py", line 70, in thread_map
return _executor_map(ThreadPoolExecutor, fn, *iterables, **tqdm_kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/site-packages/tqdm/contrib/concurrent.py", line 48, in _executor_map
with ensure_lock(tqdm_class, lock_name=lock_name) as lk:
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/contextlib.py", line 144, in __exit__
next(self.gen)
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/site-packages/tqdm/contrib/concurrent.py", line 25, in ensure_lock
del tqdm_class._lock
^^^^^^^^^^^^^^^^
AttributeError: '_tqdm_cls' object has no attribute '_lock'
```
### Steps to reproduce the bug
Happens ocasionally.
### Expected behavior
I added a print in tqdm `ensure_lock()`, got a `ensure_lock <datasets.utils.logging._tqdm_cls object at 0x16dddead0> ` print.
According to the code in https://github.com/tqdm/tqdm/blob/master/tqdm/contrib/concurrent.py#L24
```python
@contextmanager
def ensure_lock(tqdm_class, lock_name=""):
"""get (create if necessary) and then restore `tqdm_class`'s lock"""
print("ensure_lock", tqdm_class, lock_name)
old_lock = getattr(tqdm_class, '_lock', None) # don't create a new lock
lock = old_lock or tqdm_class.get_lock() # maybe create a new lock
lock = getattr(lock, lock_name, lock) # maybe subtype
tqdm_class.set_lock(lock)
yield lock
if old_lock is None:
del tqdm_class._lock # <-- It tries to del the `_lock` attribute from tqdm_class.
else:
tqdm_class.set_lock(old_lock)
```
But, huggingface datasets `datasets.utils.logging._tqdm_cls` does not have the field `_lock`: https://github.com/huggingface/datasets/blob/main/src/datasets/utils/logging.py#L205
```python
class _tqdm_cls:
def __call__(self, *args, disable=False, **kwargs):
if _tqdm_active and not disable:
return tqdm_lib.tqdm(*args, **kwargs)
else:
return EmptyTqdm(*args, **kwargs)
def set_lock(self, *args, **kwargs):
self._lock = None
if _tqdm_active:
return tqdm_lib.tqdm.set_lock(*args, **kwargs)
def get_lock(self):
if _tqdm_active:
return tqdm_lib.tqdm.get_lock()
```
### Environment info
Python 3.11.4
tqdm '4.65.0'
datasets master | 52 | 32 | AttributeError: '_tqdm_cls' object has no attribute '_lock'
### Describe the bug
```python
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/site-packages/datasets/load.py", line 1034, in get_module
data_files = DataFilesDict.from_patterns(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/site-packages/datasets/data_files.py", line 671, in from_patterns
DataFilesList.from_patterns(
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/site-packages/datasets/data_files.py", line 586, in from_patterns
origin_metadata = _get_origin_metadata(data_files, download_config=download_config)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/site-packages/datasets/data_files.py", line 502, in _get_origin_metadata
return thread_map(
^^^^^^^^^^^
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/site-packages/tqdm/contrib/concurrent.py", line 70, in thread_map
return _executor_map(ThreadPoolExecutor, fn, *iterables, **tqdm_kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/site-packages/tqdm/contrib/concurrent.py", line 48, in _executor_map
with ensure_lock(tqdm_class, lock_name=lock_name) as lk:
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/contextlib.py", line 144, in __exit__
next(self.gen)
File "/Users/codingl2k1/.pyenv/versions/3.11.4/lib/python3.11/site-packages/tqdm/contrib/concurrent.py", line 25, in ensure_lock
del tqdm_class._lock
^^^^^^^^^^^^^^^^
AttributeError: '_tqdm_cls' object has no attribute '_lock'
```
### Steps to reproduce the bug
Happens ocasionally.
### Expected behavior
I added a print in tqdm `ensure_lock()`, got a `ensure_lock <datasets.utils.logging._tqdm_cls object at 0x16dddead0> ` print.
According to the code in https://github.com/tqdm/tqdm/blob/master/tqdm/contrib/concurrent.py#L24
```python
@contextmanager
def ensure_lock(tqdm_class, lock_name=""):
"""get (create if necessary) and then restore `tqdm_class`'s lock"""
print("ensure_lock", tqdm_class, lock_name)
old_lock = getattr(tqdm_class, '_lock', None) # don't create a new lock
lock = old_lock or tqdm_class.get_lock() # maybe create a new lock
lock = getattr(lock, lock_name, lock) # maybe subtype
tqdm_class.set_lock(lock)
yield lock
if old_lock is None:
del tqdm_class._lock # <-- It tries to del the `_lock` attribute from tqdm_class.
else:
tqdm_class.set_lock(old_lock)
```
But, huggingface datasets `datasets.utils.logging._tqdm_cls` does not have the field `_lock`: https://github.com/huggingface/datasets/blob/main/src/datasets/utils/logging.py#L205
```python
class _tqdm_cls:
def __call__(self, *args, disable=False, **kwargs):
if _tqdm_active and not disable:
return tqdm_lib.tqdm(*args, **kwargs)
else:
return EmptyTqdm(*args, **kwargs)
def set_lock(self, *args, **kwargs):
self._lock = None
if _tqdm_active:
return tqdm_lib.tqdm.set_lock(*args, **kwargs)
def get_lock(self):
if _tqdm_active:
return tqdm_lib.tqdm.get_lock()
```
### Environment info
Python 3.11.4
tqdm '4.65.0'
datasets master
Yes it looks like a bug on their end indeed, do you want to open a PR on tqdm ?
Let me see if I can find a workaround in the meantime | [
-1.3521512746810913,
-0.8465626835823059,
-0.5868315100669861,
1.283677339553833,
0.03677382320165634,
-0.8991362452507019,
0.05178180709481239,
-1.024348497390747,
1.9279330968856812,
-0.5640751123428345,
0.19435115158557892,
-1.4659757614135742,
-0.12366081774234772,
-0.3550596237182617,
-0.6583359837532043,
-1.0089880228042603,
-0.22304120659828186,
-0.8023163080215454,
1.1088749170303345,
2.6884775161743164,
1.156903862953186,
-1.3759241104125977,
2.642866849899292,
0.7988353967666626,
-0.24207842350006104,
-0.7284358143806458,
0.5179723501205444,
-0.011512529104948044,
-1.1826525926589966,
-0.6495604515075684,
-1.0175813436508179,
0.022053562104701996,
-0.6313120722770691,
-0.3401859402656555,
-0.02158968523144722,
0.13139449059963226,
-0.20061808824539185,
-0.2873065769672394,
-0.9021544456481934,
-0.6910043358802795,
0.548274040222168,
-0.2852327525615692,
0.962647020816803,
-0.3649974763393402,
1.8277539014816284,
-0.6605496406555176,
0.6081895232200623,
0.7097229957580566,
1.1302821636199951,
0.03843861073255539,
-0.02079499140381813,
0.534895122051239,
0.3973972499370575,
-0.030856993049383163,
0.7792328596115112,
1.1679213047027588,
0.6481515765190125,
0.5231693983078003,
0.3747190535068512,
-2.402606964111328,
1.3480474948883057,
-1.1254764795303345,
0.2611131966114044,
1.3818163871765137,
-0.7771731615066528,
0.33440378308296204,
-1.6795424222946167,
0.18649689853191376,
0.7953941226005554,
-2.4113516807556152,
0.21887235343456268,
-1.3777607679367065,
-0.6116394400596619,
1.02347731590271,
0.4455806314945221,
-1.1382908821105957,
0.04288424551486969,
-0.4744756817817688,
1.1887880563735962,
0.16459180414676666,
1.323036789894104,
-1.5153446197509766,
0.07853391021490097,
-0.16390080749988556,
0.40112704038619995,
-1.1884578466415405,
-1.63075590133667,
0.47040989995002747,
0.5899773836135864,
0.26367324590682983,
-0.20505091547966003,
1.0199583768844604,
-0.9974428415298462,
0.5892379283905029,
-0.879410445690155,
-1.5193231105804443,
-1.6370117664337158,
-2.5339717864990234,
-2.419931411743164,
0.7907775044441223,
-0.6993247866630554,
-0.3508959710597992,
2.1170456409454346,
-1.1112667322158813,
-1.5155402421951294,
0.9031490683555603,
0.1301542967557907,
0.18626834452152252,
2.1760153770446777,
0.0870685800909996,
-0.6804654598236084,
0.37824180722236633,
-0.726199746131897,
0.7385104894638062,
-0.30165982246398926,
1.4342628717422485,
0.5134738087654114,
-1.1090902090072632,
1.4783711433410645,
-0.5905486345291138,
0.5421697497367859,
-0.35697025060653687,
-0.5581348538398743,
-0.7811577320098877,
0.4774627089500427,
1.9544063806533813,
-0.3682940602302551,
1.717416763305664,
-0.5249424576759338,
-1.5466097593307495,
-1.4526327848434448,
0.8967746496200562,
0.4380446970462799,
-0.9256751537322998,
0.3436538577079773,
-0.6989375352859497,
0.06934519857168198,
-0.1274934858083725,
1.2606428861618042,
1.4358786344528198,
0.8622769117355347,
-0.28867924213409424,
-0.9380638599395752,
0.21729804575443268,
-0.180426687002182,
-0.8059960007667542,
-1.8390917778015137,
-0.16765767335891724,
0.10799171775579453,
0.6952167749404907,
-1.334524154663086,
1.5881760120391846,
0.8184784650802612,
1.9953057765960693,
0.8810362219810486,
-0.3565824329853058,
1.5788503885269165,
0.10273914039134979,
1.9695619344711304,
-0.7274723052978516,
0.6091565489768982,
-0.25802770256996155,
-1.13075590133667,
0.602349579334259,
-0.5166391730308533,
-2.019538164138794,
-0.7058054208755493,
-0.7484105825424194,
-0.07471983879804611,
-0.8735766410827637,
0.8328580856323242,
-0.07892382144927979,
-1.3269766569137573,
0.037220317870378494,
-0.6979303359985352,
0.525588870048523,
-1.268679141998291,
0.19269853830337524,
0.7282240986824036,
-0.40709948539733887,
0.19289961457252502,
-0.30141860246658325,
-1.2765871286392212,
-0.44538742303848267,
0.2148360311985016,
1.7092931270599365,
-0.3832385241985321,
0.6793234348297119,
1.2920857667922974,
-0.7202000617980957,
-0.05136673152446747,
0.24222339689731598,
-0.31593912839889526,
0.8499449491500854,
-1.213307499885559,
-0.4020674526691437,
1.103127121925354,
-0.12177959829568863,
-0.538506269454956,
1.2828400135040283,
0.7414155006408691,
-1.4261047840118408,
-0.3345857858657837,
-0.1103140339255333,
-0.800789475440979,
0.229596808552742,
-1.599118947982788,
-0.13479000329971313,
0.3764839768409729,
-1.6156822443008423,
-0.42269524931907654,
-0.2238057255744934,
1.2895721197128296,
-0.4028053879737854,
1.5293537378311157,
-0.02884598821401596,
0.03283382207155228,
-0.41834840178489685,
-0.23257780075073242,
0.32171517610549927,
-0.152330681681633,
-0.7775755524635315,
0.37977704405784607,
-0.6720184087753296,
0.2616594433784485,
1.236938238143921,
0.21759240329265594,
-0.2889638841152191,
0.292082816362381,
1.2093192338943481,
0.35908243060112,
-0.23396429419517517,
-0.8236218690872192,
-1.7396965026855469,
1.9075483083724976,
-1.2333664894104004,
1.735875129699707,
0.8410902619361877,
0.06864677369594574,
-1.9759607315063477,
-1.9344966411590576,
0.9765974283218384,
1.1564213037490845,
2.433076858520508,
0.29628849029541016,
0.5317174792289734,
-0.816351056098938,
-0.6313667893409729,
0.2908959686756134,
-0.8242727518081665,
-0.6654465198516846,
0.28600338101387024,
2.3161346912384033,
1.744185447692871,
-0.5277401804924011,
-0.16757617890834808,
-0.9070008993148804,
0.9472280740737915,
-0.1560613512992859,
0.1032833382487297,
1.8340047597885132,
-0.21770057082176208,
-1.109144926071167,
1.2990546226501465,
-2.280304193496704,
0.3642001152038574,
1.896501064300537,
0.3428557813167572,
0.14780259132385254,
-1.515293002128601,
-0.7185305953025818,
-0.2297145128250122,
-0.47209396958351135,
-1.2793437242507935,
0.5771636366844177,
-0.04452018067240715,
-1.1568613052368164,
-1.4738106727600098,
0.17234741151332855,
-1.0940903425216675,
-1.6372356414794922,
0.09702835232019424,
1.6472487449645996,
1.7815272808074951,
-0.9347864389419556,
1.2636431455612183,
-0.2786821722984314,
-0.058101311326026917,
1.3028626441955566,
1.2421928644180298,
3.1923696994781494,
2.0930440425872803,
-1.3588863611221313,
0.7501751184463501,
-0.45425325632095337,
-0.48371684551239014,
1.3359118700027466,
-1.3969383239746094,
1.0847744941711426,
-0.08317103981971741,
-1.2431195974349976,
-1.1207540035247803,
1.196039080619812,
0.49201297760009766,
-0.017637604847550392,
-0.39043474197387695,
1.4444079399108887,
0.08816592395305634,
1.329132080078125,
0.5904709696769714,
-0.3448835015296936,
0.5995341539382935,
-0.2379176914691925,
-0.3511018753051758,
1.4434895515441895,
0.16469095647335052,
-1.3172589540481567,
-2.0604515075683594,
-0.30608969926834106,
-1.092736840248108,
-0.18789948523044586,
-0.6453109383583069,
-0.8920084238052368,
1.4902311563491821,
0.4073588252067566,
-1.0816891193389893,
-0.48647788166999817,
-0.4077385365962982,
-0.694445013999939,
2.6950268745422363,
-1.438475251197815,
-0.12085571885108948,
-1.0280990600585938,
-0.37704789638519287,
1.7620261907577515,
-1.2021361589431763,
-0.1440926343202591,
-1.0291293859481812,
-0.5072453618049622,
-1.343376636505127,
-0.40150928497314453,
-0.15733928978443146,
-0.8161590695381165,
0.8386436104774475,
0.29525089263916016,
-1.2216306924819946,
-0.307094007730484,
-0.6104503870010376,
0.8233334422111511,
-0.00845920480787754,
0.21250730752944946,
1.8285976648330688,
0.20871397852897644,
-0.5204732418060303,
0.6522339582443237,
1.2864199876785278,
0.8206965327262878,
-0.7473633885383606,
0.01238060649484396,
-0.877595067024231,
0.2103065550327301,
-1.8275014162063599,
0.2577137053012848,
-2.6765716075897217,
0.745964527130127,
-0.21918867528438568,
-0.16634029150009155,
-0.1883762925863266,
-1.3646878004074097,
0.9899558424949646,
2.4431285858154297,
-1.222352147102356,
0.34013426303863525,
0.558910608291626,
1.129453420639038,
-1.52141535282135,
0.27728357911109924,
-0.5472350716590881,
1.9673813581466675,
0.3606279194355011,
1.29331374168396,
-0.26412132382392883,
-2.2942326068878174,
0.7008957862854004,
-0.9900544285774231,
-0.7993454337120056,
0.9848408699035645,
-1.036194920539856,
0.10173735022544861,
-1.6293010711669922,
-0.4484351575374603,
-0.7917584776878357,
-1.3042129278182983,
0.4027526080608368,
0.10850761830806732,
0.4813213050365448,
-0.8338385820388794,
0.4156211018562317,
-2.1256425380706787,
-1.280670166015625,
-0.14467526972293854,
-0.9829208850860596,
0.6360070705413818,
-0.3579353094100952,
0.5913558006286621,
0.045186858624219894,
0.1168600469827652,
0.3235798180103302,
1.642377257347107,
3.5620157718658447,
0.1342773586511612,
0.2802782654762268,
-0.03751535341143608,
-0.9832461476325989,
1.1756844520568848,
0.699571967124939,
-0.07713732123374939,
-0.6242050528526306,
-1.064204216003418,
1.3947227001190186,
1.9391998052597046,
1.1102224588394165,
0.11502466350793839,
-0.9782136082649231,
-0.9323775768280029,
0.11117929965257645,
0.19524629414081573,
0.45118585228919983,
0.8819080591201782,
0.14739590883255005,
0.13738112151622772,
1.4058096408843994,
1.1642804145812988,
-0.3376760482788086,
0.2272675782442093,
-0.8579511642456055,
-0.3494069278240204,
0.6956281661987305,
0.24563147127628326,
0.15718181431293488,
0.6150067448616028,
-1.0578062534332275,
-0.3040401339530945,
-0.1187351644039154,
-1.033526062965393,
-0.8469188213348389,
-0.3645491302013397,
-0.2851758599281311,
1.6337007284164429,
0.2335965484380722,
-0.48823320865631104,
0.18423989415168762,
-0.4957510828971863,
-0.13290081918239594,
-1.1375561952590942,
0.07648321986198425,
-0.10401888191699982,
0.01050268393009901,
-0.14036229252815247,
1.5430327653884888,
-0.7817375063896179,
-1.9662758111953735,
0.02723463624715805,
0.2289348542690277,
-0.28549960255622864,
0.2778286933898926,
1.876517415046692,
0.5024697780609131,
1.791791558265686,
1.02422297000885,
1.1390247344970703,
-0.47523459792137146,
-1.336104154586792,
0.7638934254646301,
1.0105618238449097,
-1.4831258058547974,
0.7561991214752197,
-0.2655555307865143,
-0.6414832472801208,
0.6192159056663513,
1.3197944164276123,
0.3682551980018616,
-1.8802424669265747,
1.0183417797088623,
-0.8876082301139832,
0.7711708545684814,
0.5310311317443848,
0.9148852229118347,
-0.02934601902961731,
0.8280729055404663,
-1.341902494430542,
-1.0763003826141357,
-0.5112506151199341,
-0.7666745781898499,
1.7777831554412842,
-0.33654695749282837,
0.47715476155281067,
-0.18093575537204742,
-1.3464833498001099,
0.04348471015691757,
0.9014179706573486,
0.09589551389217377,
-0.5071082711219788,
1.235575795173645,
-0.7955337762832642,
-1.2208199501037598,
-1.3365451097488403,
-0.4627600908279419,
-0.8945221304893494,
-0.8102182745933533,
1.1722508668899536,
0.8489481806755066,
0.3076280951499939,
1.931687593460083,
0.5728175640106201,
0.2557595372200012,
-2.676346778869629,
0.7806742787361145,
0.07530584931373596,
0.1754676252603531,
0.9270681738853455,
0.2305983155965805,
1.0851138830184937,
-0.13302747905254364,
0.6602859497070312,
-2.2139697074890137,
2.190561532974243,
-0.06898049265146255,
0.6678903698921204,
-0.27786168456077576,
-0.24984021484851837,
0.8927656412124634,
0.48498299717903137,
0.743829071521759,
-1.4213987588882446,
0.8266007900238037,
-0.4907926023006439,
0.9112980365753174,
0.6877413988113403,
-0.7418578267097473,
-0.10262042284011841,
1.0204861164093018,
0.5001095533370972,
-0.38696756958961487,
-0.9797511696815491,
-0.9291428327560425,
1.1279083490371704,
1.6088098287582397,
-0.04091116413474083,
-0.0063375914469361305,
0.7068549394607544,
0.6967776417732239,
-1.119896650314331,
0.3266255855560303,
-0.7109658718109131,
-0.6586567759513855,
1.3143470287322998,
2.0225086212158203,
-0.10523401200771332,
-0.19205746054649353,
-0.6288843154907227,
-1.1921111345291138,
0.4705393612384796,
-0.14703509211540222,
0.45896822214126587,
0.6097984910011292,
-0.6311136484146118,
0.7907437682151794,
0.853172242641449,
0.9281733632087708,
0.11423075199127197,
0.3773452043533325,
0.5226050615310669,
-0.4893872141838074,
-0.9468663334846497,
-0.5079358220100403,
-0.9944900274276733,
-2.772594928741455,
0.4865324795246124,
-0.31221452355384827,
-1.7003687620162964,
0.13714314997196198,
-1.1598178148269653,
0.9037516713142395,
-0.6062751412391663,
-1.4831300973892212,
-1.3606762886047363,
0.3976737856864929,
-0.018978750333189964,
1.126449704170227,
-1.5416712760925293,
-0.10684391856193542,
1.3499733209609985,
0.9306431412696838,
-0.20869342982769012,
0.7041609883308411,
0.3663647174835205,
1.0119878053665161,
1.1269590854644775,
-0.1746334284543991,
0.5356847643852234,
0.31965020298957825,
-1.226167917251587,
0.44694799184799194,
1.1744554042816162,
0.3333441913127899,
1.4427132606506348,
-0.35785728693008423,
0.17492975294589996,
0.5848684310913086,
-0.7010063529014587,
-0.5601987242698669,
-0.2631869614124298,
0.35074901580810547,
0.3718017339706421,
-1.1137945652008057,
-0.14256711304187775,
-0.3362291157245636,
0.004177388735115528,
-0.11863942444324493,
-1.3614659309387207,
-0.3265659213066101,
-0.3982192873954773,
-0.686803936958313,
-1.4375382661819458,
0.07430471479892731,
1.2458163499832153,
-0.7400732040405273,
-0.09871954470872879,
0.38881802558898926,
0.46149173378944397,
0.5702497959136963,
0.509876012802124,
-0.7289793491363525,
-0.45075181126594543,
-0.1696815937757492,
-0.25022801756858826,
0.1599012315273285,
1.0350897312164307,
-0.12144225835800171,
-1.0334320068359375,
0.6304041147232056,
-0.278475284576416,
0.19349141418933868,
1.8877155780792236,
0.12918412685394287,
-0.8450613021850586,
0.42738577723503113,
-0.5980470776557922,
1.7481648921966553,
1.7766462564468384,
1.4082164764404297,
-0.08475938439369202,
-0.8481414318084717,
0.4641878008842468,
-0.5516619682312012,
-0.12393351644277573,
0.9465259313583374,
0.6039053797721863,
-0.22551381587982178,
-1.3075534105300903,
0.5837433934211731,
1.3028631210327148,
-1.0849767923355103,
-0.7287118434906006,
0.353732168674469,
-0.6826037764549255,
1.322310447692871,
0.624575138092041,
0.07813600450754166,
0.2458200603723526,
1.6093138456344604,
0.7779735326766968,
-0.535224437713623,
0.5232193470001221,
0.7197362780570984,
-0.4259026348590851,
-2.314595937728882,
-1.2201613187789917,
0.3978528082370758,
-0.38476404547691345,
-1.3012583255767822,
1.393068790435791,
-1.1441254615783691,
-1.0403860807418823,
0.6296542286872864,
0.05764849856495857,
1.1507059335708618,
0.19841574132442474,
1.7154958248138428,
2.253068685531616,
0.757347583770752,
0.257707804441452,
1.313523530960083,
0.1278500258922577,
-0.47213754057884216,
1.9872981309890747,
-0.26319774985313416,
0.4560069441795349,
0.8710852265357971,
-0.5018423795700073,
-1.1134164333343506,
-1.0161212682724,
-1.1849862337112427,
-0.6824880242347717,
1.3156335353851318,
0.11360086500644684,
-0.9215918183326721,
0.4901082217693329,
1.7598676681518555,
0.16926084458827972,
-0.24960167706012726,
0.6341556310653687,
0.5583701729774475,
-0.7889825105667114,
-0.020468756556510925,
-1.2578049898147583,
0.6289879679679871,
-0.1664561629295349,
-0.09694315493106842,
0.08676231652498245,
0.7347716093063354,
1.2358806133270264,
0.09766668826341629,
-0.12577080726623535,
1.1313918828964233,
-1.4748961925506592,
1.6798367500305176,
-0.5699650049209595,
0.45263174176216125,
-2.3144304752349854,
1.1421259641647339,
-0.6715932488441467,
1.9252856969833374,
-2.450446367263794,
0.5139152407646179,
-0.7128379344940186,
-0.4163958430290222,
0.28455430269241333,
-0.4057167172431946,
0.14052660763263702,
-0.18454530835151672,
-1.046558141708374,
-0.14424367249011993,
-1.0758476257324219,
0.7310072779655457,
1.146992802619934,
1.4003256559371948,
-1.2156238555908203,
-0.0036764685064554214,
-1.3482110500335693,
-0.08654996007680893,
-0.8571937084197998,
0.23416702449321747,
-1.6697404384613037,
-0.28050923347473145,
-2.1111562252044678,
-2.304094076156616,
-1.326977252960205,
-0.7295746803283691,
1.0908632278442383,
0.22760042548179626,
-0.8652193546295166,
1.0831001996994019,
-0.6321773529052734,
-1.8993183374404907,
0.9742449522018433,
-2.2420873641967773
] |
https://github.com/huggingface/datasets/issues/6060 | Dataset.map() execute twice when in PyTorch DDP mode | Sorry for asking a duplicate question about `num_proc`, I searched the forum and find the solution.
But I still can't make the trick with `torch.distributed.barrier()` to only map at the main process work. The [post on forum]( https://discuss.huggingface.co/t/slow-processing-with-map-when-using-deepspeed-or-fairscale/7229/7) didn't help. | ### Describe the bug
I use `torchrun --standalone --nproc_per_node=2 train.py` to start training. And write the code following the [docs](https://huggingface.co/docs/datasets/process#distributed-usage). The trick about using `torch.distributed.barrier()` to only execute map at the main process doesn't always work. When I am training model, it will map twice. When I am running a test for dataset and dataloader (just print the batches), it can work. Their code about loading dataset are same.
And on another server with 30 CPU cores, I use 2 GPUs and it can't work neither.
I have tried to use `rank` and `local_rank` to check, they all didn't make sense.
### Steps to reproduce the bug
use `torchrun --standalone --nproc_per_node=2 train.py` or `torchrun --standalone train.py` to run
This is my code:
```python
if args.distributed and world_size > 1:
if args.local_rank > 0:
print(f"Rank {args.rank}: Gpu {args.gpu} waiting for main process to perform the mapping", force=True)
torch.distributed.barrier()
print("Mapping dataset")
dataset = dataset.map(lambda x: cut_reorder_keys(x, num_stations_list=args.num_stations_list, is_pad=True, is_train=True), num_proc=8, desc="cut_reorder_keys")
dataset = dataset.map(lambda x: random_shift(x, shift_range=(-160, 0), feature_scale=16), num_proc=8, desc="random_shift")
dataset_test = dataset_test.map(lambda x: cut_reorder_keys(x, num_stations_list=args.num_stations_list, is_pad=True, is_train=False), num_proc=8, desc="cut_reorder_keys")
if args.local_rank == 0:
print("Mapping finished, loading results from main process")
torch.distributed.barrier()
```
### Expected behavior
Only the main process will execute `map`, while the sub process will load cache from disk.
### Environment info
server with 64 CPU cores (AMD Ryzen Threadripper PRO 5995WX 64-Cores) and 2 RTX 4090
- `python==3.9.16`
- `datasets==2.13.1`
- `torch==2.0.1+cu117`
- `22.04.1-Ubuntu`
server with 30 CPU cores (Intel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHz) and 2 RTX 4090
- `python==3.9.0`
- `datasets==2.13.1`
- `torch==2.0.1+cu117`
- `Ubuntu 20.04` | 53 | 40 | Dataset.map() execute twice when in PyTorch DDP mode
### Describe the bug
I use `torchrun --standalone --nproc_per_node=2 train.py` to start training. And write the code following the [docs](https://huggingface.co/docs/datasets/process#distributed-usage). The trick about using `torch.distributed.barrier()` to only execute map at the main process doesn't always work. When I am training model, it will map twice. When I am running a test for dataset and dataloader (just print the batches), it can work. Their code about loading dataset are same.
And on another server with 30 CPU cores, I use 2 GPUs and it can't work neither.
I have tried to use `rank` and `local_rank` to check, they all didn't make sense.
### Steps to reproduce the bug
use `torchrun --standalone --nproc_per_node=2 train.py` or `torchrun --standalone train.py` to run
This is my code:
```python
if args.distributed and world_size > 1:
if args.local_rank > 0:
print(f"Rank {args.rank}: Gpu {args.gpu} waiting for main process to perform the mapping", force=True)
torch.distributed.barrier()
print("Mapping dataset")
dataset = dataset.map(lambda x: cut_reorder_keys(x, num_stations_list=args.num_stations_list, is_pad=True, is_train=True), num_proc=8, desc="cut_reorder_keys")
dataset = dataset.map(lambda x: random_shift(x, shift_range=(-160, 0), feature_scale=16), num_proc=8, desc="random_shift")
dataset_test = dataset_test.map(lambda x: cut_reorder_keys(x, num_stations_list=args.num_stations_list, is_pad=True, is_train=False), num_proc=8, desc="cut_reorder_keys")
if args.local_rank == 0:
print("Mapping finished, loading results from main process")
torch.distributed.barrier()
```
### Expected behavior
Only the main process will execute `map`, while the sub process will load cache from disk.
### Environment info
server with 64 CPU cores (AMD Ryzen Threadripper PRO 5995WX 64-Cores) and 2 RTX 4090
- `python==3.9.16`
- `datasets==2.13.1`
- `torch==2.0.1+cu117`
- `22.04.1-Ubuntu`
server with 30 CPU cores (Intel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHz) and 2 RTX 4090
- `python==3.9.0`
- `datasets==2.13.1`
- `torch==2.0.1+cu117`
- `Ubuntu 20.04`
Sorry for asking a duplicate question about `num_proc`, I searched the forum and find the solution.
But I still can't make the trick with `torch.distributed.barrier()` to only map at the main process work. The [post on forum]( https://discuss.huggingface.co/t/slow-processing-with-map-when-using-deepspeed-or-fairscale/7229/7) didn't help. | [
-1.3185489177703857,
-0.9868546724319458,
-0.5761328935623169,
1.4660086631774902,
-0.17576950788497925,
-1.1413180828094482,
0.1571463942527771,
-1.0458317995071411,
1.5937193632125854,
-0.8820594549179077,
0.28995469212532043,
-1.597267985343933,
0.055676743388175964,
-0.522131085395813,
-0.7138332724571228,
-0.8761380910873413,
-0.4234674870967865,
-0.7217979431152344,
1.141829013824463,
2.4612231254577637,
1.2849757671356201,
-1.398491382598877,
2.67093563079834,
0.7543821334838867,
-0.20498503744602203,
-1.0928007364273071,
0.5248920321464539,
-0.03083524852991104,
-1.2757635116577148,
-0.4112604260444641,
-0.9696189761161804,
-0.10746294260025024,
-0.635527491569519,
-0.4989524483680725,
-0.007602637633681297,
0.4371323585510254,
-0.2862488329410553,
-0.40178611874580383,
-0.5295384526252747,
-0.7151160836219788,
0.5570492148399353,
-0.38045448064804077,
0.8357682228088379,
-0.34930264949798584,
1.7143515348434448,
-0.5441546440124512,
0.5866219997406006,
0.7308601140975952,
1.243807315826416,
0.2239459753036499,
-0.03214837610721588,
0.3170872628688812,
0.44812384247779846,
-0.011264288797974586,
0.5849176049232483,
1.1607863903045654,
0.6380777359008789,
0.5038155317306519,
0.6868812441825867,
-2.2337753772735596,
1.304992914199829,
-0.9791703820228577,
0.29343491792678833,
1.3541194200515747,
-0.9579387903213501,
0.34682074189186096,
-1.7940022945404053,
-0.08815792948007584,
0.5980684161186218,
-2.1361050605773926,
0.25142213702201843,
-1.302985668182373,
-0.5520093441009521,
1.0119881629943848,
0.41355273127555847,
-1.2301959991455078,
0.07757465541362762,
-0.4694061875343323,
1.0448296070098877,
0.4817658066749573,
1.0030397176742554,
-1.6986654996871948,
-0.03533926606178284,
-0.29239848256111145,
0.20219624042510986,
-1.295846939086914,
-1.5640602111816406,
0.5681953430175781,
0.6621199250221252,
0.5541953444480896,
-0.09930382668972015,
1.1010969877243042,
-1.1244772672653198,
0.7611812949180603,
-1.02451753616333,
-1.7237087488174438,
-1.4091860055923462,
-2.305267572402954,
-2.3342113494873047,
0.6796372532844543,
-0.466689795255661,
-0.5691626667976379,
2.097825765609741,
-1.0805041790008545,
-1.6714584827423096,
1.1873505115509033,
0.1926613748073578,
0.020633099600672722,
2.4106926918029785,
0.22189858555793762,
-0.7460521459579468,
0.5121053457260132,
-0.806027352809906,
0.7235427498817444,
-0.3733515739440918,
1.3330072164535522,
0.4038764238357544,
-1.040486216545105,
1.6323401927947998,
-0.29925480484962463,
0.5695567727088928,
-0.5930342078208923,
-0.4916607141494751,
-0.6824690103530884,
0.23993462324142456,
1.941811442375183,
-0.27363619208335876,
1.4326362609863281,
-0.31212571263313293,
-1.4389164447784424,
-1.6227844953536987,
0.9633283615112305,
0.4553346633911133,
-0.7301139831542969,
0.19644999504089355,
-0.4385504722595215,
0.10513020306825638,
-0.015293145552277565,
1.067158818244934,
1.3880984783172607,
0.7153162360191345,
-0.39607349038124084,
-0.873737096786499,
0.16613857448101044,
-0.1586453914642334,
-0.6725117564201355,
-1.8027876615524292,
-0.35693588852882385,
-0.003682376816868782,
0.6947598457336426,
-1.0881465673446655,
1.8119438886642456,
0.914889395236969,
1.8795839548110962,
0.9806324243545532,
-0.36649081110954285,
1.4113882780075073,
0.11870904266834259,
1.8084332942962646,
-0.46743330359458923,
0.6822972297668457,
-0.36971530318260193,
-1.1114965677261353,
0.8890887498855591,
-0.36196380853652954,
-1.9796452522277832,
-0.7160128951072693,
-0.7349088788032532,
-0.18841055035591125,
-0.8068907260894775,
0.9268937110900879,
-0.21654927730560303,
-1.4842095375061035,
0.2380674183368683,
-0.6558262705802917,
0.220973938703537,
-1.1772081851959229,
0.37396180629730225,
0.625952959060669,
-0.666195273399353,
0.1064395159482956,
-0.3157360255718231,
-1.2339547872543335,
-0.5303803086280823,
0.2955318093299866,
1.7946771383285522,
-0.688759446144104,
0.886988639831543,
1.0791221857070923,
-0.6955977082252502,
-0.03827099874615669,
0.33103981614112854,
-0.23652631044387817,
0.7652276754379272,
-1.031660795211792,
-0.45609721541404724,
1.2792311906814575,
-0.2639072835445404,
-0.649196445941925,
1.5271841287612915,
0.7186151146888733,
-0.9755860567092896,
-0.18833619356155396,
-0.13829480111598969,
-0.7650131583213806,
0.09176883846521378,
-1.6013392210006714,
-0.08308371156454086,
0.5309829711914062,
-1.6046762466430664,
-0.4119751751422882,
-0.14134570956230164,
1.3729898929595947,
-0.17124420404434204,
1.4823791980743408,
-0.3851393163204193,
-0.1388094574213028,
-0.31988248229026794,
-0.3260335922241211,
0.15915997326374054,
-0.08836053311824799,
-0.5787795782089233,
0.18589754402637482,
-0.9104270339012146,
0.33793359994888306,
1.435483455657959,
0.30874136090278625,
0.025448491796851158,
0.4583147466182709,
1.0937607288360596,
0.38723036646842957,
-0.09777891635894775,
-0.9103565216064453,
-1.554782748222351,
1.952488899230957,
-1.5000964403152466,
2.071545124053955,
0.7519984841346741,
-0.05720613896846771,
-1.8004939556121826,
-1.7533260583877563,
1.336076021194458,
1.1100893020629883,
2.3652846813201904,
0.5270215272903442,
0.3833594024181366,
-0.8837249279022217,
-0.6555964350700378,
0.350841224193573,
-0.9814335703849792,
-0.7484713196754456,
0.1840018481016159,
2.38594913482666,
1.7939046621322632,
-0.3829582929611206,
-0.11993095278739929,
-0.9890129566192627,
1.4104223251342773,
-0.20923398435115814,
0.318727046251297,
1.966794490814209,
-0.3232051432132721,
-1.0467588901519775,
1.375346302986145,
-2.3920397758483887,
0.1258222758769989,
2.0615410804748535,
0.2759648561477661,
0.0961584821343422,
-1.3380846977233887,
-0.6491498947143555,
-0.2864780128002167,
-0.4654337167739868,
-1.2431886196136475,
0.5060114860534668,
-0.3162805140018463,
-0.8203180432319641,
-1.3864201307296753,
0.1051018014550209,
-1.1598397493362427,
-1.68894362449646,
0.23535552620887756,
1.8292949199676514,
2.0808825492858887,
-0.7055372595787048,
1.5710415840148926,
-0.3206973373889923,
0.16948182880878448,
1.2167025804519653,
1.2838573455810547,
3.0636465549468994,
1.9088870286941528,
-1.31972074508667,
0.6958693861961365,
-0.22055281698703766,
-0.5277215242385864,
1.0933841466903687,
-1.2565604448318481,
1.2659929990768433,
-0.185942605137825,
-1.1879950761795044,
-1.247787594795227,
1.0506346225738525,
0.44588059186935425,
0.10463634133338928,
-0.4960084557533264,
1.2524901628494263,
0.13244444131851196,
1.3298587799072266,
0.5473886728286743,
-0.3311786353588104,
0.6362005472183228,
-0.47160813212394714,
-0.5230970978736877,
1.5844664573669434,
0.2247460037469864,
-1.4283736944198608,
-2.1834726333618164,
-0.22355356812477112,
-0.8889651298522949,
0.04975278675556183,
-0.6133911609649658,
-0.9851478338241577,
1.6078927516937256,
0.30456268787384033,
-1.2492225170135498,
-0.28095149993896484,
-0.2821430265903473,
-0.6063839197158813,
2.7026429176330566,
-1.2533295154571533,
-0.2165350615978241,
-0.966120183467865,
-0.7217771410942078,
1.60617995262146,
-1.2164089679718018,
-0.203319251537323,
-1.047782301902771,
-0.5739913582801819,
-1.2328336238861084,
-0.5326585173606873,
0.06478533148765564,
-1.0111260414123535,
0.7966199517250061,
0.14517860114574432,
-1.239870548248291,
-0.3507971465587616,
-0.8373608589172363,
0.8643413782119751,
-0.1752844601869583,
0.16992409527301788,
1.8097858428955078,
0.25777432322502136,
-0.3886108696460724,
0.7390653491020203,
1.1547825336456299,
0.6117309927940369,
-0.6134157776832581,
0.12592798471450806,
-0.6601639986038208,
0.43559902906417847,
-1.1832484006881714,
0.3028322160243988,
-2.9113638401031494,
0.6666910648345947,
-0.009066644124686718,
-0.027195384725928307,
-0.07237232476472855,
-1.3127893209457397,
1.0677698850631714,
2.617873191833496,
-1.193816065788269,
0.5227735638618469,
0.34904944896698,
1.1875535249710083,
-1.5523029565811157,
0.29551947116851807,
-0.5145190954208374,
2.073410749435425,
0.231389582157135,
1.2487096786499023,
-0.5232198238372803,
-2.3780019283294678,
0.6648368835449219,
-1.2322590351104736,
-1.186214804649353,
0.7997191548347473,
-0.9016430974006653,
0.12868642807006836,
-1.367283821105957,
-0.22189435362815857,
-0.8898736238479614,
-1.0546010732650757,
0.593195915222168,
0.16269303858280182,
0.4650554358959198,
-0.5655088424682617,
0.3510720729827881,
-2.227210760116577,
-1.3480920791625977,
-0.2010485976934433,
-0.9388943910598755,
0.4846877455711365,
-0.4013109803199768,
0.6908214092254639,
-0.14149603247642517,
0.022987330332398415,
0.3673703372478485,
1.4883190393447876,
3.3571012020111084,
0.1696651726961136,
0.27460500597953796,
-0.17447802424430847,
-0.9826634526252747,
1.4871689081192017,
0.8500410914421082,
-0.14372138679027557,
-0.6134653091430664,
-1.032896637916565,
1.2387670278549194,
1.9314111471176147,
0.946361243724823,
0.0039066048339009285,
-0.8427832126617432,
-0.7076641917228699,
-0.041313543915748596,
0.11981989443302155,
0.43317970633506775,
0.9620027542114258,
0.052736520767211914,
0.1374301016330719,
1.4414172172546387,
1.1765882968902588,
-0.4770592451095581,
0.2816488444805145,
-0.8391638398170471,
-0.4205400347709656,
0.5101038217544556,
0.3140968978404999,
-0.015889087691903114,
0.33817049860954285,
-1.0087517499923706,
-0.1746395379304886,
-0.33540716767311096,
-0.9230707883834839,
-0.7324702739715576,
-0.3851890563964844,
-0.4195028841495514,
1.6245663166046143,
0.1575794368982315,
-0.48360827565193176,
-0.006195252761244774,
-0.8712987899780273,
-0.14530189335346222,
-1.11351478099823,
0.29250121116638184,
-0.11586995422840118,
-0.11169125884771347,
-0.2232932597398758,
1.7338896989822388,
-0.8549855947494507,
-2.0736629962921143,
0.2286432981491089,
0.19364161789417267,
-0.26156488060951233,
0.24398839473724365,
1.724086046218872,
0.5432058572769165,
1.47164785861969,
1.3415223360061646,
0.9479662179946899,
-0.6057721972465515,
-1.2724567651748657,
0.7558625340461731,
1.0216541290283203,
-1.4469094276428223,
0.8538694977760315,
0.0011999327689409256,
-0.5051481127738953,
0.5760433673858643,
1.2298215627670288,
0.5041474103927612,
-1.9788731336593628,
0.8017280697822571,
-1.062198281288147,
0.837833821773529,
0.7399774789810181,
0.6638272404670715,
0.1777621954679489,
0.9283101558685303,
-1.1787320375442505,
-1.129231572151184,
-0.6952704191207886,
-0.7221962213516235,
2.0402162075042725,
-0.34052637219429016,
0.6000555753707886,
-0.23078103363513947,
-1.2923340797424316,
-0.05440422147512436,
0.7323786616325378,
0.2887422442436218,
-0.4682749807834625,
0.8341727256774902,
-0.6007912755012512,
-1.1640090942382812,
-1.3664273023605347,
-0.4589141309261322,
-1.0938819646835327,
-0.9619726538658142,
1.092771053314209,
0.6673710346221924,
0.3097025156021118,
1.8703594207763672,
0.6378706693649292,
0.28799524903297424,
-2.67391037940979,
0.9208753705024719,
0.22497184574604034,
-0.10432979464530945,
0.9031848907470703,
0.3295463025569916,
0.9933805465698242,
-0.020344166085124016,
0.5472918152809143,
-2.4491753578186035,
2.3124332427978516,
-0.18143010139465332,
0.6509084105491638,
0.043607234954833984,
-0.053619734942913055,
1.0752713680267334,
0.6304299235343933,
0.5492086410522461,
-1.027333378791809,
0.7558079957962036,
-0.556824266910553,
1.2396973371505737,
0.7969792485237122,
-0.8467820286750793,
-0.017831601202487946,
1.380927562713623,
0.36102601885795593,
-0.5517097115516663,
-0.9013553857803345,
-1.0137962102890015,
0.9347022175788879,
1.756234049797058,
-0.11418287456035614,
-0.029757145792245865,
0.7228677868843079,
0.6476909518241882,
-1.3141273260116577,
-0.028376715257763863,
-0.6605828404426575,
-0.6633704304695129,
1.640252709388733,
2.099193572998047,
-0.19364123046398163,
-0.1385960727930069,
-0.6455079317092896,
-1.3796608448028564,
0.8333439826965332,
-0.11536342650651932,
0.16322773694992065,
0.6348504424095154,
-0.5543731451034546,
1.0138835906982422,
0.8247116804122925,
0.9266191720962524,
0.2467925250530243,
0.24065229296684265,
0.42654961347579956,
-0.40654414892196655,
-1.172113299369812,
-0.23910579085350037,
-1.121260643005371,
-2.641775369644165,
0.37926939129829407,
-0.21263855695724487,
-1.384717345237732,
0.0622626468539238,
-0.956251323223114,
0.8754472732543945,
-0.6038138270378113,
-1.0890448093414307,
-1.505875587463379,
0.1590307652950287,
-0.06853193789720535,
0.9396458864212036,
-1.657862901687622,
-0.1371876448392868,
1.167799472808838,
0.8651555776596069,
-0.6627725958824158,
1.0169761180877686,
0.28837576508522034,
1.0435329675674438,
0.8107591867446899,
-0.3713708221912384,
0.6436997056007385,
0.05610280483961105,
-1.3474546670913696,
0.4240359961986542,
1.2426408529281616,
0.13031375408172607,
1.4341683387756348,
-0.4797590672969818,
-0.028830397874116898,
0.35519376397132874,
-0.630993127822876,
-0.41688036918640137,
-0.4238550364971161,
0.6547131538391113,
-0.02212805673480034,
-0.9289879202842712,
-0.07410722970962524,
-0.10468728840351105,
-0.22234350442886353,
0.2057594656944275,
-1.472767949104309,
-0.013550062663853168,
-0.41525179147720337,
-0.5971970558166504,
-1.271494746208191,
-0.07758481055498123,
1.4716938734054565,
-0.7934617400169373,
-0.14689268171787262,
0.4272492825984955,
0.33167245984077454,
0.5328205823898315,
0.691311776638031,
-0.7202304005622864,
-0.289359986782074,
-0.21235686540603638,
-0.3690696954727173,
0.30839788913726807,
1.3788256645202637,
-0.10949403792619705,
-0.9707983136177063,
0.7425656914710999,
-0.3570093512535095,
0.09876202791929245,
1.9103481769561768,
0.09444302320480347,
-0.7725769877433777,
0.2907181680202484,
-0.7407205700874329,
1.9452860355377197,
1.7039320468902588,
1.3213465213775635,
-0.16703122854232788,
-0.8703985214233398,
0.5755564570426941,
-0.39252784848213196,
-0.3660568296909332,
0.8596703410148621,
0.39859822392463684,
-0.28782889246940613,
-1.3853687047958374,
0.7013420462608337,
1.2594280242919922,
-0.8039565682411194,
-0.7958972454071045,
0.16104790568351746,
-0.7266137599945068,
1.1795620918273926,
0.6441356539726257,
0.3872796595096588,
0.24722492694854736,
1.6708649396896362,
0.7721157670021057,
-0.4540707468986511,
0.5222894549369812,
0.5168540477752686,
-0.20009537041187286,
-2.1228859424591064,
-1.1623307466506958,
0.33379656076431274,
-0.6222261786460876,
-1.5649876594543457,
1.3213738203048706,
-1.1414717435836792,
-1.0346050262451172,
0.5466265082359314,
0.04275837540626526,
1.4299228191375732,
0.3675626516342163,
1.577555775642395,
2.0335497856140137,
0.8847019672393799,
0.44985154271125793,
1.2820781469345093,
-0.1757248491048813,
-0.4162347614765167,
1.8618642091751099,
-0.48781338334083557,
0.41453710198402405,
1.1716179847717285,
-0.2783612906932831,
-1.0347654819488525,
-0.832367479801178,
-1.210878610610962,
-0.6953096389770508,
1.1636296510696411,
0.10911611467599869,
-1.129280686378479,
0.24360144138336182,
1.540887475013733,
0.11075086891651154,
-0.2074870467185974,
0.6817765235900879,
0.41294869780540466,
-0.7821129560470581,
-0.031966064125299454,
-0.8696044087409973,
0.5099167227745056,
-0.3189154267311096,
-0.3720456659793854,
0.3541105389595032,
0.43972331285476685,
1.2882113456726074,
-0.11930958926677704,
0.14082589745521545,
1.140350341796875,
-1.4046298265457153,
1.474790334701538,
-0.7252476811408997,
0.2905827462673187,
-2.3391153812408447,
1.3329757452011108,
-0.7423547506332397,
1.9529969692230225,
-2.716838836669922,
0.4458423852920532,
-0.5811272263526917,
-0.5793615579605103,
0.2564449608325958,
-0.3458796441555023,
0.08169148117303848,
-0.1475725919008255,
-1.1581757068634033,
-0.05219924449920654,
-0.6383412480354309,
0.5654183626174927,
1.0725680589675903,
1.3384473323822021,
-1.1806166172027588,
-0.2639133632183075,
-1.760622262954712,
-0.1970485895872116,
-0.7980691194534302,
0.3774188756942749,
-2.0080530643463135,
-0.1568552851676941,
-1.9904587268829346,
-2.3267204761505127,
-1.2434571981430054,
-0.8673630356788635,
1.107085943222046,
0.0949961319565773,
-0.7942710518836975,
1.2837755680084229,
-0.35009169578552246,
-1.8627960681915283,
1.12122642993927,
-2.143306016921997
] |
https://github.com/huggingface/datasets/issues/6060 | Dataset.map() execute twice when in PyTorch DDP mode | If it does the `map` twice then it means the hash of your map function is not some same between your two processes.
Can you make sure your map functions have the same hash in different processes ?
```python
from datasets.fingerprint import Hasher
print(Hasher.hash(lambda x: cut_reorder_keys(x, num_stations_list=args.num_stations_list, is_pad=True, is_train=True)))
print(Hasher.hash(lambda x: random_shift(x, shift_range=(-160, 0), feature_scale=16)))
```
You can also set the fingerprint used to reload the resulting dataset by passing `new_finegrprint=` in `map`, see https://huggingface.co/docs/datasets/v2.13.1/en/about_cache#the-cache. This will force the different processes to use the same fingerprint used to locate the resulting dataset in the cache. | ### Describe the bug
I use `torchrun --standalone --nproc_per_node=2 train.py` to start training. And write the code following the [docs](https://huggingface.co/docs/datasets/process#distributed-usage). The trick about using `torch.distributed.barrier()` to only execute map at the main process doesn't always work. When I am training model, it will map twice. When I am running a test for dataset and dataloader (just print the batches), it can work. Their code about loading dataset are same.
And on another server with 30 CPU cores, I use 2 GPUs and it can't work neither.
I have tried to use `rank` and `local_rank` to check, they all didn't make sense.
### Steps to reproduce the bug
use `torchrun --standalone --nproc_per_node=2 train.py` or `torchrun --standalone train.py` to run
This is my code:
```python
if args.distributed and world_size > 1:
if args.local_rank > 0:
print(f"Rank {args.rank}: Gpu {args.gpu} waiting for main process to perform the mapping", force=True)
torch.distributed.barrier()
print("Mapping dataset")
dataset = dataset.map(lambda x: cut_reorder_keys(x, num_stations_list=args.num_stations_list, is_pad=True, is_train=True), num_proc=8, desc="cut_reorder_keys")
dataset = dataset.map(lambda x: random_shift(x, shift_range=(-160, 0), feature_scale=16), num_proc=8, desc="random_shift")
dataset_test = dataset_test.map(lambda x: cut_reorder_keys(x, num_stations_list=args.num_stations_list, is_pad=True, is_train=False), num_proc=8, desc="cut_reorder_keys")
if args.local_rank == 0:
print("Mapping finished, loading results from main process")
torch.distributed.barrier()
```
### Expected behavior
Only the main process will execute `map`, while the sub process will load cache from disk.
### Environment info
server with 64 CPU cores (AMD Ryzen Threadripper PRO 5995WX 64-Cores) and 2 RTX 4090
- `python==3.9.16`
- `datasets==2.13.1`
- `torch==2.0.1+cu117`
- `22.04.1-Ubuntu`
server with 30 CPU cores (Intel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHz) and 2 RTX 4090
- `python==3.9.0`
- `datasets==2.13.1`
- `torch==2.0.1+cu117`
- `Ubuntu 20.04` | 53 | 95 | Dataset.map() execute twice when in PyTorch DDP mode
### Describe the bug
I use `torchrun --standalone --nproc_per_node=2 train.py` to start training. And write the code following the [docs](https://huggingface.co/docs/datasets/process#distributed-usage). The trick about using `torch.distributed.barrier()` to only execute map at the main process doesn't always work. When I am training model, it will map twice. When I am running a test for dataset and dataloader (just print the batches), it can work. Their code about loading dataset are same.
And on another server with 30 CPU cores, I use 2 GPUs and it can't work neither.
I have tried to use `rank` and `local_rank` to check, they all didn't make sense.
### Steps to reproduce the bug
use `torchrun --standalone --nproc_per_node=2 train.py` or `torchrun --standalone train.py` to run
This is my code:
```python
if args.distributed and world_size > 1:
if args.local_rank > 0:
print(f"Rank {args.rank}: Gpu {args.gpu} waiting for main process to perform the mapping", force=True)
torch.distributed.barrier()
print("Mapping dataset")
dataset = dataset.map(lambda x: cut_reorder_keys(x, num_stations_list=args.num_stations_list, is_pad=True, is_train=True), num_proc=8, desc="cut_reorder_keys")
dataset = dataset.map(lambda x: random_shift(x, shift_range=(-160, 0), feature_scale=16), num_proc=8, desc="random_shift")
dataset_test = dataset_test.map(lambda x: cut_reorder_keys(x, num_stations_list=args.num_stations_list, is_pad=True, is_train=False), num_proc=8, desc="cut_reorder_keys")
if args.local_rank == 0:
print("Mapping finished, loading results from main process")
torch.distributed.barrier()
```
### Expected behavior
Only the main process will execute `map`, while the sub process will load cache from disk.
### Environment info
server with 64 CPU cores (AMD Ryzen Threadripper PRO 5995WX 64-Cores) and 2 RTX 4090
- `python==3.9.16`
- `datasets==2.13.1`
- `torch==2.0.1+cu117`
- `22.04.1-Ubuntu`
server with 30 CPU cores (Intel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHz) and 2 RTX 4090
- `python==3.9.0`
- `datasets==2.13.1`
- `torch==2.0.1+cu117`
- `Ubuntu 20.04`
If it does the `map` twice then it means the hash of your map function is not some same between your two processes.
Can you make sure your map functions have the same hash in different processes ?
```python
from datasets.fingerprint import Hasher
print(Hasher.hash(lambda x: cut_reorder_keys(x, num_stations_list=args.num_stations_list, is_pad=True, is_train=True)))
print(Hasher.hash(lambda x: random_shift(x, shift_range=(-160, 0), feature_scale=16)))
```
You can also set the fingerprint used to reload the resulting dataset by passing `new_finegrprint=` in `map`, see https://huggingface.co/docs/datasets/v2.13.1/en/about_cache#the-cache. This will force the different processes to use the same fingerprint used to locate the resulting dataset in the cache. | [
-1.3185489177703857,
-0.9868546724319458,
-0.5761328935623169,
1.4660086631774902,
-0.17576950788497925,
-1.1413180828094482,
0.1571463942527771,
-1.0458317995071411,
1.5937193632125854,
-0.8820594549179077,
0.28995469212532043,
-1.597267985343933,
0.055676743388175964,
-0.522131085395813,
-0.7138332724571228,
-0.8761380910873413,
-0.4234674870967865,
-0.7217979431152344,
1.141829013824463,
2.4612231254577637,
1.2849757671356201,
-1.398491382598877,
2.67093563079834,
0.7543821334838867,
-0.20498503744602203,
-1.0928007364273071,
0.5248920321464539,
-0.03083524852991104,
-1.2757635116577148,
-0.4112604260444641,
-0.9696189761161804,
-0.10746294260025024,
-0.635527491569519,
-0.4989524483680725,
-0.007602637633681297,
0.4371323585510254,
-0.2862488329410553,
-0.40178611874580383,
-0.5295384526252747,
-0.7151160836219788,
0.5570492148399353,
-0.38045448064804077,
0.8357682228088379,
-0.34930264949798584,
1.7143515348434448,
-0.5441546440124512,
0.5866219997406006,
0.7308601140975952,
1.243807315826416,
0.2239459753036499,
-0.03214837610721588,
0.3170872628688812,
0.44812384247779846,
-0.011264288797974586,
0.5849176049232483,
1.1607863903045654,
0.6380777359008789,
0.5038155317306519,
0.6868812441825867,
-2.2337753772735596,
1.304992914199829,
-0.9791703820228577,
0.29343491792678833,
1.3541194200515747,
-0.9579387903213501,
0.34682074189186096,
-1.7940022945404053,
-0.08815792948007584,
0.5980684161186218,
-2.1361050605773926,
0.25142213702201843,
-1.302985668182373,
-0.5520093441009521,
1.0119881629943848,
0.41355273127555847,
-1.2301959991455078,
0.07757465541362762,
-0.4694061875343323,
1.0448296070098877,
0.4817658066749573,
1.0030397176742554,
-1.6986654996871948,
-0.03533926606178284,
-0.29239848256111145,
0.20219624042510986,
-1.295846939086914,
-1.5640602111816406,
0.5681953430175781,
0.6621199250221252,
0.5541953444480896,
-0.09930382668972015,
1.1010969877243042,
-1.1244772672653198,
0.7611812949180603,
-1.02451753616333,
-1.7237087488174438,
-1.4091860055923462,
-2.305267572402954,
-2.3342113494873047,
0.6796372532844543,
-0.466689795255661,
-0.5691626667976379,
2.097825765609741,
-1.0805041790008545,
-1.6714584827423096,
1.1873505115509033,
0.1926613748073578,
0.020633099600672722,
2.4106926918029785,
0.22189858555793762,
-0.7460521459579468,
0.5121053457260132,
-0.806027352809906,
0.7235427498817444,
-0.3733515739440918,
1.3330072164535522,
0.4038764238357544,
-1.040486216545105,
1.6323401927947998,
-0.29925480484962463,
0.5695567727088928,
-0.5930342078208923,
-0.4916607141494751,
-0.6824690103530884,
0.23993462324142456,
1.941811442375183,
-0.27363619208335876,
1.4326362609863281,
-0.31212571263313293,
-1.4389164447784424,
-1.6227844953536987,
0.9633283615112305,
0.4553346633911133,
-0.7301139831542969,
0.19644999504089355,
-0.4385504722595215,
0.10513020306825638,
-0.015293145552277565,
1.067158818244934,
1.3880984783172607,
0.7153162360191345,
-0.39607349038124084,
-0.873737096786499,
0.16613857448101044,
-0.1586453914642334,
-0.6725117564201355,
-1.8027876615524292,
-0.35693588852882385,
-0.003682376816868782,
0.6947598457336426,
-1.0881465673446655,
1.8119438886642456,
0.914889395236969,
1.8795839548110962,
0.9806324243545532,
-0.36649081110954285,
1.4113882780075073,
0.11870904266834259,
1.8084332942962646,
-0.46743330359458923,
0.6822972297668457,
-0.36971530318260193,
-1.1114965677261353,
0.8890887498855591,
-0.36196380853652954,
-1.9796452522277832,
-0.7160128951072693,
-0.7349088788032532,
-0.18841055035591125,
-0.8068907260894775,
0.9268937110900879,
-0.21654927730560303,
-1.4842095375061035,
0.2380674183368683,
-0.6558262705802917,
0.220973938703537,
-1.1772081851959229,
0.37396180629730225,
0.625952959060669,
-0.666195273399353,
0.1064395159482956,
-0.3157360255718231,
-1.2339547872543335,
-0.5303803086280823,
0.2955318093299866,
1.7946771383285522,
-0.688759446144104,
0.886988639831543,
1.0791221857070923,
-0.6955977082252502,
-0.03827099874615669,
0.33103981614112854,
-0.23652631044387817,
0.7652276754379272,
-1.031660795211792,
-0.45609721541404724,
1.2792311906814575,
-0.2639072835445404,
-0.649196445941925,
1.5271841287612915,
0.7186151146888733,
-0.9755860567092896,
-0.18833619356155396,
-0.13829480111598969,
-0.7650131583213806,
0.09176883846521378,
-1.6013392210006714,
-0.08308371156454086,
0.5309829711914062,
-1.6046762466430664,
-0.4119751751422882,
-0.14134570956230164,
1.3729898929595947,
-0.17124420404434204,
1.4823791980743408,
-0.3851393163204193,
-0.1388094574213028,
-0.31988248229026794,
-0.3260335922241211,
0.15915997326374054,
-0.08836053311824799,
-0.5787795782089233,
0.18589754402637482,
-0.9104270339012146,
0.33793359994888306,
1.435483455657959,
0.30874136090278625,
0.025448491796851158,
0.4583147466182709,
1.0937607288360596,
0.38723036646842957,
-0.09777891635894775,
-0.9103565216064453,
-1.554782748222351,
1.952488899230957,
-1.5000964403152466,
2.071545124053955,
0.7519984841346741,
-0.05720613896846771,
-1.8004939556121826,
-1.7533260583877563,
1.336076021194458,
1.1100893020629883,
2.3652846813201904,
0.5270215272903442,
0.3833594024181366,
-0.8837249279022217,
-0.6555964350700378,
0.350841224193573,
-0.9814335703849792,
-0.7484713196754456,
0.1840018481016159,
2.38594913482666,
1.7939046621322632,
-0.3829582929611206,
-0.11993095278739929,
-0.9890129566192627,
1.4104223251342773,
-0.20923398435115814,
0.318727046251297,
1.966794490814209,
-0.3232051432132721,
-1.0467588901519775,
1.375346302986145,
-2.3920397758483887,
0.1258222758769989,
2.0615410804748535,
0.2759648561477661,
0.0961584821343422,
-1.3380846977233887,
-0.6491498947143555,
-0.2864780128002167,
-0.4654337167739868,
-1.2431886196136475,
0.5060114860534668,
-0.3162805140018463,
-0.8203180432319641,
-1.3864201307296753,
0.1051018014550209,
-1.1598397493362427,
-1.68894362449646,
0.23535552620887756,
1.8292949199676514,
2.0808825492858887,
-0.7055372595787048,
1.5710415840148926,
-0.3206973373889923,
0.16948182880878448,
1.2167025804519653,
1.2838573455810547,
3.0636465549468994,
1.9088870286941528,
-1.31972074508667,
0.6958693861961365,
-0.22055281698703766,
-0.5277215242385864,
1.0933841466903687,
-1.2565604448318481,
1.2659929990768433,
-0.185942605137825,
-1.1879950761795044,
-1.247787594795227,
1.0506346225738525,
0.44588059186935425,
0.10463634133338928,
-0.4960084557533264,
1.2524901628494263,
0.13244444131851196,
1.3298587799072266,
0.5473886728286743,
-0.3311786353588104,
0.6362005472183228,
-0.47160813212394714,
-0.5230970978736877,
1.5844664573669434,
0.2247460037469864,
-1.4283736944198608,
-2.1834726333618164,
-0.22355356812477112,
-0.8889651298522949,
0.04975278675556183,
-0.6133911609649658,
-0.9851478338241577,
1.6078927516937256,
0.30456268787384033,
-1.2492225170135498,
-0.28095149993896484,
-0.2821430265903473,
-0.6063839197158813,
2.7026429176330566,
-1.2533295154571533,
-0.2165350615978241,
-0.966120183467865,
-0.7217771410942078,
1.60617995262146,
-1.2164089679718018,
-0.203319251537323,
-1.047782301902771,
-0.5739913582801819,
-1.2328336238861084,
-0.5326585173606873,
0.06478533148765564,
-1.0111260414123535,
0.7966199517250061,
0.14517860114574432,
-1.239870548248291,
-0.3507971465587616,
-0.8373608589172363,
0.8643413782119751,
-0.1752844601869583,
0.16992409527301788,
1.8097858428955078,
0.25777432322502136,
-0.3886108696460724,
0.7390653491020203,
1.1547825336456299,
0.6117309927940369,
-0.6134157776832581,
0.12592798471450806,
-0.6601639986038208,
0.43559902906417847,
-1.1832484006881714,
0.3028322160243988,
-2.9113638401031494,
0.6666910648345947,
-0.009066644124686718,
-0.027195384725928307,
-0.07237232476472855,
-1.3127893209457397,
1.0677698850631714,
2.617873191833496,
-1.193816065788269,
0.5227735638618469,
0.34904944896698,
1.1875535249710083,
-1.5523029565811157,
0.29551947116851807,
-0.5145190954208374,
2.073410749435425,
0.231389582157135,
1.2487096786499023,
-0.5232198238372803,
-2.3780019283294678,
0.6648368835449219,
-1.2322590351104736,
-1.186214804649353,
0.7997191548347473,
-0.9016430974006653,
0.12868642807006836,
-1.367283821105957,
-0.22189435362815857,
-0.8898736238479614,
-1.0546010732650757,
0.593195915222168,
0.16269303858280182,
0.4650554358959198,
-0.5655088424682617,
0.3510720729827881,
-2.227210760116577,
-1.3480920791625977,
-0.2010485976934433,
-0.9388943910598755,
0.4846877455711365,
-0.4013109803199768,
0.6908214092254639,
-0.14149603247642517,
0.022987330332398415,
0.3673703372478485,
1.4883190393447876,
3.3571012020111084,
0.1696651726961136,
0.27460500597953796,
-0.17447802424430847,
-0.9826634526252747,
1.4871689081192017,
0.8500410914421082,
-0.14372138679027557,
-0.6134653091430664,
-1.032896637916565,
1.2387670278549194,
1.9314111471176147,
0.946361243724823,
0.0039066048339009285,
-0.8427832126617432,
-0.7076641917228699,
-0.041313543915748596,
0.11981989443302155,
0.43317970633506775,
0.9620027542114258,
0.052736520767211914,
0.1374301016330719,
1.4414172172546387,
1.1765882968902588,
-0.4770592451095581,
0.2816488444805145,
-0.8391638398170471,
-0.4205400347709656,
0.5101038217544556,
0.3140968978404999,
-0.015889087691903114,
0.33817049860954285,
-1.0087517499923706,
-0.1746395379304886,
-0.33540716767311096,
-0.9230707883834839,
-0.7324702739715576,
-0.3851890563964844,
-0.4195028841495514,
1.6245663166046143,
0.1575794368982315,
-0.48360827565193176,
-0.006195252761244774,
-0.8712987899780273,
-0.14530189335346222,
-1.11351478099823,
0.29250121116638184,
-0.11586995422840118,
-0.11169125884771347,
-0.2232932597398758,
1.7338896989822388,
-0.8549855947494507,
-2.0736629962921143,
0.2286432981491089,
0.19364161789417267,
-0.26156488060951233,
0.24398839473724365,
1.724086046218872,
0.5432058572769165,
1.47164785861969,
1.3415223360061646,
0.9479662179946899,
-0.6057721972465515,
-1.2724567651748657,
0.7558625340461731,
1.0216541290283203,
-1.4469094276428223,
0.8538694977760315,
0.0011999327689409256,
-0.5051481127738953,
0.5760433673858643,
1.2298215627670288,
0.5041474103927612,
-1.9788731336593628,
0.8017280697822571,
-1.062198281288147,
0.837833821773529,
0.7399774789810181,
0.6638272404670715,
0.1777621954679489,
0.9283101558685303,
-1.1787320375442505,
-1.129231572151184,
-0.6952704191207886,
-0.7221962213516235,
2.0402162075042725,
-0.34052637219429016,
0.6000555753707886,
-0.23078103363513947,
-1.2923340797424316,
-0.05440422147512436,
0.7323786616325378,
0.2887422442436218,
-0.4682749807834625,
0.8341727256774902,
-0.6007912755012512,
-1.1640090942382812,
-1.3664273023605347,
-0.4589141309261322,
-1.0938819646835327,
-0.9619726538658142,
1.092771053314209,
0.6673710346221924,
0.3097025156021118,
1.8703594207763672,
0.6378706693649292,
0.28799524903297424,
-2.67391037940979,
0.9208753705024719,
0.22497184574604034,
-0.10432979464530945,
0.9031848907470703,
0.3295463025569916,
0.9933805465698242,
-0.020344166085124016,
0.5472918152809143,
-2.4491753578186035,
2.3124332427978516,
-0.18143010139465332,
0.6509084105491638,
0.043607234954833984,
-0.053619734942913055,
1.0752713680267334,
0.6304299235343933,
0.5492086410522461,
-1.027333378791809,
0.7558079957962036,
-0.556824266910553,
1.2396973371505737,
0.7969792485237122,
-0.8467820286750793,
-0.017831601202487946,
1.380927562713623,
0.36102601885795593,
-0.5517097115516663,
-0.9013553857803345,
-1.0137962102890015,
0.9347022175788879,
1.756234049797058,
-0.11418287456035614,
-0.029757145792245865,
0.7228677868843079,
0.6476909518241882,
-1.3141273260116577,
-0.028376715257763863,
-0.6605828404426575,
-0.6633704304695129,
1.640252709388733,
2.099193572998047,
-0.19364123046398163,
-0.1385960727930069,
-0.6455079317092896,
-1.3796608448028564,
0.8333439826965332,
-0.11536342650651932,
0.16322773694992065,
0.6348504424095154,
-0.5543731451034546,
1.0138835906982422,
0.8247116804122925,
0.9266191720962524,
0.2467925250530243,
0.24065229296684265,
0.42654961347579956,
-0.40654414892196655,
-1.172113299369812,
-0.23910579085350037,
-1.121260643005371,
-2.641775369644165,
0.37926939129829407,
-0.21263855695724487,
-1.384717345237732,
0.0622626468539238,
-0.956251323223114,
0.8754472732543945,
-0.6038138270378113,
-1.0890448093414307,
-1.505875587463379,
0.1590307652950287,
-0.06853193789720535,
0.9396458864212036,
-1.657862901687622,
-0.1371876448392868,
1.167799472808838,
0.8651555776596069,
-0.6627725958824158,
1.0169761180877686,
0.28837576508522034,
1.0435329675674438,
0.8107591867446899,
-0.3713708221912384,
0.6436997056007385,
0.05610280483961105,
-1.3474546670913696,
0.4240359961986542,
1.2426408529281616,
0.13031375408172607,
1.4341683387756348,
-0.4797590672969818,
-0.028830397874116898,
0.35519376397132874,
-0.630993127822876,
-0.41688036918640137,
-0.4238550364971161,
0.6547131538391113,
-0.02212805673480034,
-0.9289879202842712,
-0.07410722970962524,
-0.10468728840351105,
-0.22234350442886353,
0.2057594656944275,
-1.472767949104309,
-0.013550062663853168,
-0.41525179147720337,
-0.5971970558166504,
-1.271494746208191,
-0.07758481055498123,
1.4716938734054565,
-0.7934617400169373,
-0.14689268171787262,
0.4272492825984955,
0.33167245984077454,
0.5328205823898315,
0.691311776638031,
-0.7202304005622864,
-0.289359986782074,
-0.21235686540603638,
-0.3690696954727173,
0.30839788913726807,
1.3788256645202637,
-0.10949403792619705,
-0.9707983136177063,
0.7425656914710999,
-0.3570093512535095,
0.09876202791929245,
1.9103481769561768,
0.09444302320480347,
-0.7725769877433777,
0.2907181680202484,
-0.7407205700874329,
1.9452860355377197,
1.7039320468902588,
1.3213465213775635,
-0.16703122854232788,
-0.8703985214233398,
0.5755564570426941,
-0.39252784848213196,
-0.3660568296909332,
0.8596703410148621,
0.39859822392463684,
-0.28782889246940613,
-1.3853687047958374,
0.7013420462608337,
1.2594280242919922,
-0.8039565682411194,
-0.7958972454071045,
0.16104790568351746,
-0.7266137599945068,
1.1795620918273926,
0.6441356539726257,
0.3872796595096588,
0.24722492694854736,
1.6708649396896362,
0.7721157670021057,
-0.4540707468986511,
0.5222894549369812,
0.5168540477752686,
-0.20009537041187286,
-2.1228859424591064,
-1.1623307466506958,
0.33379656076431274,
-0.6222261786460876,
-1.5649876594543457,
1.3213738203048706,
-1.1414717435836792,
-1.0346050262451172,
0.5466265082359314,
0.04275837540626526,
1.4299228191375732,
0.3675626516342163,
1.577555775642395,
2.0335497856140137,
0.8847019672393799,
0.44985154271125793,
1.2820781469345093,
-0.1757248491048813,
-0.4162347614765167,
1.8618642091751099,
-0.48781338334083557,
0.41453710198402405,
1.1716179847717285,
-0.2783612906932831,
-1.0347654819488525,
-0.832367479801178,
-1.210878610610962,
-0.6953096389770508,
1.1636296510696411,
0.10911611467599869,
-1.129280686378479,
0.24360144138336182,
1.540887475013733,
0.11075086891651154,
-0.2074870467185974,
0.6817765235900879,
0.41294869780540466,
-0.7821129560470581,
-0.031966064125299454,
-0.8696044087409973,
0.5099167227745056,
-0.3189154267311096,
-0.3720456659793854,
0.3541105389595032,
0.43972331285476685,
1.2882113456726074,
-0.11930958926677704,
0.14082589745521545,
1.140350341796875,
-1.4046298265457153,
1.474790334701538,
-0.7252476811408997,
0.2905827462673187,
-2.3391153812408447,
1.3329757452011108,
-0.7423547506332397,
1.9529969692230225,
-2.716838836669922,
0.4458423852920532,
-0.5811272263526917,
-0.5793615579605103,
0.2564449608325958,
-0.3458796441555023,
0.08169148117303848,
-0.1475725919008255,
-1.1581757068634033,
-0.05219924449920654,
-0.6383412480354309,
0.5654183626174927,
1.0725680589675903,
1.3384473323822021,
-1.1806166172027588,
-0.2639133632183075,
-1.760622262954712,
-0.1970485895872116,
-0.7980691194534302,
0.3774188756942749,
-2.0080530643463135,
-0.1568552851676941,
-1.9904587268829346,
-2.3267204761505127,
-1.2434571981430054,
-0.8673630356788635,
1.107085943222046,
0.0949961319565773,
-0.7942710518836975,
1.2837755680084229,
-0.35009169578552246,
-1.8627960681915283,
1.12122642993927,
-2.143306016921997
] |
https://github.com/huggingface/datasets/issues/6060 | Dataset.map() execute twice when in PyTorch DDP mode | Thanks for help! I find the fingerprint between processes don't have same hash:
```
Rank 0: Gpu 0 cut_reorder_keys fingerprint c7f47f40e9a67657
Rank 0: Gpu 0 random_shift fingerprint 240a0ce79831e7d4
Rank 1: Gpu 1 cut_reorder_keys fingerprint 20edd3d9cf284001
Rank 1: Gpu 1 random_shift fingerprint 819f7c1c18e7733f
```
But my functions only process the example one by one and don't need rank or other arguments. After all it can work in the test for dataset and dataloader.
I'll try to set `new_fingerprint` to see if it works and figure out the reason of different hash. | ### Describe the bug
I use `torchrun --standalone --nproc_per_node=2 train.py` to start training. And write the code following the [docs](https://huggingface.co/docs/datasets/process#distributed-usage). The trick about using `torch.distributed.barrier()` to only execute map at the main process doesn't always work. When I am training model, it will map twice. When I am running a test for dataset and dataloader (just print the batches), it can work. Their code about loading dataset are same.
And on another server with 30 CPU cores, I use 2 GPUs and it can't work neither.
I have tried to use `rank` and `local_rank` to check, they all didn't make sense.
### Steps to reproduce the bug
use `torchrun --standalone --nproc_per_node=2 train.py` or `torchrun --standalone train.py` to run
This is my code:
```python
if args.distributed and world_size > 1:
if args.local_rank > 0:
print(f"Rank {args.rank}: Gpu {args.gpu} waiting for main process to perform the mapping", force=True)
torch.distributed.barrier()
print("Mapping dataset")
dataset = dataset.map(lambda x: cut_reorder_keys(x, num_stations_list=args.num_stations_list, is_pad=True, is_train=True), num_proc=8, desc="cut_reorder_keys")
dataset = dataset.map(lambda x: random_shift(x, shift_range=(-160, 0), feature_scale=16), num_proc=8, desc="random_shift")
dataset_test = dataset_test.map(lambda x: cut_reorder_keys(x, num_stations_list=args.num_stations_list, is_pad=True, is_train=False), num_proc=8, desc="cut_reorder_keys")
if args.local_rank == 0:
print("Mapping finished, loading results from main process")
torch.distributed.barrier()
```
### Expected behavior
Only the main process will execute `map`, while the sub process will load cache from disk.
### Environment info
server with 64 CPU cores (AMD Ryzen Threadripper PRO 5995WX 64-Cores) and 2 RTX 4090
- `python==3.9.16`
- `datasets==2.13.1`
- `torch==2.0.1+cu117`
- `22.04.1-Ubuntu`
server with 30 CPU cores (Intel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHz) and 2 RTX 4090
- `python==3.9.0`
- `datasets==2.13.1`
- `torch==2.0.1+cu117`
- `Ubuntu 20.04` | 53 | 90 | Dataset.map() execute twice when in PyTorch DDP mode
### Describe the bug
I use `torchrun --standalone --nproc_per_node=2 train.py` to start training. And write the code following the [docs](https://huggingface.co/docs/datasets/process#distributed-usage). The trick about using `torch.distributed.barrier()` to only execute map at the main process doesn't always work. When I am training model, it will map twice. When I am running a test for dataset and dataloader (just print the batches), it can work. Their code about loading dataset are same.
And on another server with 30 CPU cores, I use 2 GPUs and it can't work neither.
I have tried to use `rank` and `local_rank` to check, they all didn't make sense.
### Steps to reproduce the bug
use `torchrun --standalone --nproc_per_node=2 train.py` or `torchrun --standalone train.py` to run
This is my code:
```python
if args.distributed and world_size > 1:
if args.local_rank > 0:
print(f"Rank {args.rank}: Gpu {args.gpu} waiting for main process to perform the mapping", force=True)
torch.distributed.barrier()
print("Mapping dataset")
dataset = dataset.map(lambda x: cut_reorder_keys(x, num_stations_list=args.num_stations_list, is_pad=True, is_train=True), num_proc=8, desc="cut_reorder_keys")
dataset = dataset.map(lambda x: random_shift(x, shift_range=(-160, 0), feature_scale=16), num_proc=8, desc="random_shift")
dataset_test = dataset_test.map(lambda x: cut_reorder_keys(x, num_stations_list=args.num_stations_list, is_pad=True, is_train=False), num_proc=8, desc="cut_reorder_keys")
if args.local_rank == 0:
print("Mapping finished, loading results from main process")
torch.distributed.barrier()
```
### Expected behavior
Only the main process will execute `map`, while the sub process will load cache from disk.
### Environment info
server with 64 CPU cores (AMD Ryzen Threadripper PRO 5995WX 64-Cores) and 2 RTX 4090
- `python==3.9.16`
- `datasets==2.13.1`
- `torch==2.0.1+cu117`
- `22.04.1-Ubuntu`
server with 30 CPU cores (Intel(R) Xeon(R) Platinum 8375C CPU @ 2.90GHz) and 2 RTX 4090
- `python==3.9.0`
- `datasets==2.13.1`
- `torch==2.0.1+cu117`
- `Ubuntu 20.04`
Thanks for help! I find the fingerprint between processes don't have same hash:
```
Rank 0: Gpu 0 cut_reorder_keys fingerprint c7f47f40e9a67657
Rank 0: Gpu 0 random_shift fingerprint 240a0ce79831e7d4
Rank 1: Gpu 1 cut_reorder_keys fingerprint 20edd3d9cf284001
Rank 1: Gpu 1 random_shift fingerprint 819f7c1c18e7733f
```
But my functions only process the example one by one and don't need rank or other arguments. After all it can work in the test for dataset and dataloader.
I'll try to set `new_fingerprint` to see if it works and figure out the reason of different hash. | [
-1.3185489177703857,
-0.9868546724319458,
-0.5761328935623169,
1.4660086631774902,
-0.17576950788497925,
-1.1413180828094482,
0.1571463942527771,
-1.0458317995071411,
1.5937193632125854,
-0.8820594549179077,
0.28995469212532043,
-1.597267985343933,
0.055676743388175964,
-0.522131085395813,
-0.7138332724571228,
-0.8761380910873413,
-0.4234674870967865,
-0.7217979431152344,
1.141829013824463,
2.4612231254577637,
1.2849757671356201,
-1.398491382598877,
2.67093563079834,
0.7543821334838867,
-0.20498503744602203,
-1.0928007364273071,
0.5248920321464539,
-0.03083524852991104,
-1.2757635116577148,
-0.4112604260444641,
-0.9696189761161804,
-0.10746294260025024,
-0.635527491569519,
-0.4989524483680725,
-0.007602637633681297,
0.4371323585510254,
-0.2862488329410553,
-0.40178611874580383,
-0.5295384526252747,
-0.7151160836219788,
0.5570492148399353,
-0.38045448064804077,
0.8357682228088379,
-0.34930264949798584,
1.7143515348434448,
-0.5441546440124512,
0.5866219997406006,
0.7308601140975952,
1.243807315826416,
0.2239459753036499,
-0.03214837610721588,
0.3170872628688812,
0.44812384247779846,
-0.011264288797974586,
0.5849176049232483,
1.1607863903045654,
0.6380777359008789,
0.5038155317306519,
0.6868812441825867,
-2.2337753772735596,
1.304992914199829,
-0.9791703820228577,
0.29343491792678833,
1.3541194200515747,
-0.9579387903213501,
0.34682074189186096,
-1.7940022945404053,
-0.08815792948007584,
0.5980684161186218,
-2.1361050605773926,
0.25142213702201843,
-1.302985668182373,
-0.5520093441009521,
1.0119881629943848,
0.41355273127555847,
-1.2301959991455078,
0.07757465541362762,
-0.4694061875343323,
1.0448296070098877,
0.4817658066749573,
1.0030397176742554,
-1.6986654996871948,
-0.03533926606178284,
-0.29239848256111145,
0.20219624042510986,
-1.295846939086914,
-1.5640602111816406,
0.5681953430175781,
0.6621199250221252,
0.5541953444480896,
-0.09930382668972015,
1.1010969877243042,
-1.1244772672653198,
0.7611812949180603,
-1.02451753616333,
-1.7237087488174438,
-1.4091860055923462,
-2.305267572402954,
-2.3342113494873047,
0.6796372532844543,
-0.466689795255661,
-0.5691626667976379,
2.097825765609741,
-1.0805041790008545,
-1.6714584827423096,
1.1873505115509033,
0.1926613748073578,
0.020633099600672722,
2.4106926918029785,
0.22189858555793762,
-0.7460521459579468,
0.5121053457260132,
-0.806027352809906,
0.7235427498817444,
-0.3733515739440918,
1.3330072164535522,
0.4038764238357544,
-1.040486216545105,
1.6323401927947998,
-0.29925480484962463,
0.5695567727088928,
-0.5930342078208923,
-0.4916607141494751,
-0.6824690103530884,
0.23993462324142456,
1.941811442375183,
-0.27363619208335876,
1.4326362609863281,
-0.31212571263313293,
-1.4389164447784424,
-1.6227844953536987,
0.9633283615112305,
0.4553346633911133,
-0.7301139831542969,
0.19644999504089355,
-0.4385504722595215,
0.10513020306825638,
-0.015293145552277565,
1.067158818244934,
1.3880984783172607,
0.7153162360191345,
-0.39607349038124084,
-0.873737096786499,
0.16613857448101044,
-0.1586453914642334,
-0.6725117564201355,
-1.8027876615524292,
-0.35693588852882385,
-0.003682376816868782,
0.6947598457336426,
-1.0881465673446655,
1.8119438886642456,
0.914889395236969,
1.8795839548110962,
0.9806324243545532,
-0.36649081110954285,
1.4113882780075073,
0.11870904266834259,
1.8084332942962646,
-0.46743330359458923,
0.6822972297668457,
-0.36971530318260193,
-1.1114965677261353,
0.8890887498855591,
-0.36196380853652954,
-1.9796452522277832,
-0.7160128951072693,
-0.7349088788032532,
-0.18841055035591125,
-0.8068907260894775,
0.9268937110900879,
-0.21654927730560303,
-1.4842095375061035,
0.2380674183368683,
-0.6558262705802917,
0.220973938703537,
-1.1772081851959229,
0.37396180629730225,
0.625952959060669,
-0.666195273399353,
0.1064395159482956,
-0.3157360255718231,
-1.2339547872543335,
-0.5303803086280823,
0.2955318093299866,
1.7946771383285522,
-0.688759446144104,
0.886988639831543,
1.0791221857070923,
-0.6955977082252502,
-0.03827099874615669,
0.33103981614112854,
-0.23652631044387817,
0.7652276754379272,
-1.031660795211792,
-0.45609721541404724,
1.2792311906814575,
-0.2639072835445404,
-0.649196445941925,
1.5271841287612915,
0.7186151146888733,
-0.9755860567092896,
-0.18833619356155396,
-0.13829480111598969,
-0.7650131583213806,
0.09176883846521378,
-1.6013392210006714,
-0.08308371156454086,
0.5309829711914062,
-1.6046762466430664,
-0.4119751751422882,
-0.14134570956230164,
1.3729898929595947,
-0.17124420404434204,
1.4823791980743408,
-0.3851393163204193,
-0.1388094574213028,
-0.31988248229026794,
-0.3260335922241211,
0.15915997326374054,
-0.08836053311824799,
-0.5787795782089233,
0.18589754402637482,
-0.9104270339012146,
0.33793359994888306,
1.435483455657959,
0.30874136090278625,
0.025448491796851158,
0.4583147466182709,
1.0937607288360596,
0.38723036646842957,
-0.09777891635894775,
-0.9103565216064453,
-1.554782748222351,
1.952488899230957,
-1.5000964403152466,
2.071545124053955,
0.7519984841346741,
-0.05720613896846771,
-1.8004939556121826,
-1.7533260583877563,
1.336076021194458,
1.1100893020629883,
2.3652846813201904,
0.5270215272903442,
0.3833594024181366,
-0.8837249279022217,
-0.6555964350700378,
0.350841224193573,
-0.9814335703849792,
-0.7484713196754456,
0.1840018481016159,
2.38594913482666,
1.7939046621322632,
-0.3829582929611206,
-0.11993095278739929,
-0.9890129566192627,
1.4104223251342773,
-0.20923398435115814,
0.318727046251297,
1.966794490814209,
-0.3232051432132721,
-1.0467588901519775,
1.375346302986145,
-2.3920397758483887,
0.1258222758769989,
2.0615410804748535,
0.2759648561477661,
0.0961584821343422,
-1.3380846977233887,
-0.6491498947143555,
-0.2864780128002167,
-0.4654337167739868,
-1.2431886196136475,
0.5060114860534668,
-0.3162805140018463,
-0.8203180432319641,
-1.3864201307296753,
0.1051018014550209,
-1.1598397493362427,
-1.68894362449646,
0.23535552620887756,
1.8292949199676514,
2.0808825492858887,
-0.7055372595787048,
1.5710415840148926,
-0.3206973373889923,
0.16948182880878448,
1.2167025804519653,
1.2838573455810547,
3.0636465549468994,
1.9088870286941528,
-1.31972074508667,
0.6958693861961365,
-0.22055281698703766,
-0.5277215242385864,
1.0933841466903687,
-1.2565604448318481,
1.2659929990768433,
-0.185942605137825,
-1.1879950761795044,
-1.247787594795227,
1.0506346225738525,
0.44588059186935425,
0.10463634133338928,
-0.4960084557533264,
1.2524901628494263,
0.13244444131851196,
1.3298587799072266,
0.5473886728286743,
-0.3311786353588104,
0.6362005472183228,
-0.47160813212394714,
-0.5230970978736877,
1.5844664573669434,
0.2247460037469864,
-1.4283736944198608,
-2.1834726333618164,
-0.22355356812477112,
-0.8889651298522949,
0.04975278675556183,
-0.6133911609649658,
-0.9851478338241577,
1.6078927516937256,
0.30456268787384033,
-1.2492225170135498,
-0.28095149993896484,
-0.2821430265903473,
-0.6063839197158813,
2.7026429176330566,
-1.2533295154571533,
-0.2165350615978241,
-0.966120183467865,
-0.7217771410942078,
1.60617995262146,
-1.2164089679718018,
-0.203319251537323,
-1.047782301902771,
-0.5739913582801819,
-1.2328336238861084,
-0.5326585173606873,
0.06478533148765564,
-1.0111260414123535,
0.7966199517250061,
0.14517860114574432,
-1.239870548248291,
-0.3507971465587616,
-0.8373608589172363,
0.8643413782119751,
-0.1752844601869583,
0.16992409527301788,
1.8097858428955078,
0.25777432322502136,
-0.3886108696460724,
0.7390653491020203,
1.1547825336456299,
0.6117309927940369,
-0.6134157776832581,
0.12592798471450806,
-0.6601639986038208,
0.43559902906417847,
-1.1832484006881714,
0.3028322160243988,
-2.9113638401031494,
0.6666910648345947,
-0.009066644124686718,
-0.027195384725928307,
-0.07237232476472855,
-1.3127893209457397,
1.0677698850631714,
2.617873191833496,
-1.193816065788269,
0.5227735638618469,
0.34904944896698,
1.1875535249710083,
-1.5523029565811157,
0.29551947116851807,
-0.5145190954208374,
2.073410749435425,
0.231389582157135,
1.2487096786499023,
-0.5232198238372803,
-2.3780019283294678,
0.6648368835449219,
-1.2322590351104736,
-1.186214804649353,
0.7997191548347473,
-0.9016430974006653,
0.12868642807006836,
-1.367283821105957,
-0.22189435362815857,
-0.8898736238479614,
-1.0546010732650757,
0.593195915222168,
0.16269303858280182,
0.4650554358959198,
-0.5655088424682617,
0.3510720729827881,
-2.227210760116577,
-1.3480920791625977,
-0.2010485976934433,
-0.9388943910598755,
0.4846877455711365,
-0.4013109803199768,
0.6908214092254639,
-0.14149603247642517,
0.022987330332398415,
0.3673703372478485,
1.4883190393447876,
3.3571012020111084,
0.1696651726961136,
0.27460500597953796,
-0.17447802424430847,
-0.9826634526252747,
1.4871689081192017,
0.8500410914421082,
-0.14372138679027557,
-0.6134653091430664,
-1.032896637916565,
1.2387670278549194,
1.9314111471176147,
0.946361243724823,
0.0039066048339009285,
-0.8427832126617432,
-0.7076641917228699,
-0.041313543915748596,
0.11981989443302155,
0.43317970633506775,
0.9620027542114258,
0.052736520767211914,
0.1374301016330719,
1.4414172172546387,
1.1765882968902588,
-0.4770592451095581,
0.2816488444805145,
-0.8391638398170471,
-0.4205400347709656,
0.5101038217544556,
0.3140968978404999,
-0.015889087691903114,
0.33817049860954285,
-1.0087517499923706,
-0.1746395379304886,
-0.33540716767311096,
-0.9230707883834839,
-0.7324702739715576,
-0.3851890563964844,
-0.4195028841495514,
1.6245663166046143,
0.1575794368982315,
-0.48360827565193176,
-0.006195252761244774,
-0.8712987899780273,
-0.14530189335346222,
-1.11351478099823,
0.29250121116638184,
-0.11586995422840118,
-0.11169125884771347,
-0.2232932597398758,
1.7338896989822388,
-0.8549855947494507,
-2.0736629962921143,
0.2286432981491089,
0.19364161789417267,
-0.26156488060951233,
0.24398839473724365,
1.724086046218872,
0.5432058572769165,
1.47164785861969,
1.3415223360061646,
0.9479662179946899,
-0.6057721972465515,
-1.2724567651748657,
0.7558625340461731,
1.0216541290283203,
-1.4469094276428223,
0.8538694977760315,
0.0011999327689409256,
-0.5051481127738953,
0.5760433673858643,
1.2298215627670288,
0.5041474103927612,
-1.9788731336593628,
0.8017280697822571,
-1.062198281288147,
0.837833821773529,
0.7399774789810181,
0.6638272404670715,
0.1777621954679489,
0.9283101558685303,
-1.1787320375442505,
-1.129231572151184,
-0.6952704191207886,
-0.7221962213516235,
2.0402162075042725,
-0.34052637219429016,
0.6000555753707886,
-0.23078103363513947,
-1.2923340797424316,
-0.05440422147512436,
0.7323786616325378,
0.2887422442436218,
-0.4682749807834625,
0.8341727256774902,
-0.6007912755012512,
-1.1640090942382812,
-1.3664273023605347,
-0.4589141309261322,
-1.0938819646835327,
-0.9619726538658142,
1.092771053314209,
0.6673710346221924,
0.3097025156021118,
1.8703594207763672,
0.6378706693649292,
0.28799524903297424,
-2.67391037940979,
0.9208753705024719,
0.22497184574604034,
-0.10432979464530945,
0.9031848907470703,
0.3295463025569916,
0.9933805465698242,
-0.020344166085124016,
0.5472918152809143,
-2.4491753578186035,
2.3124332427978516,
-0.18143010139465332,
0.6509084105491638,
0.043607234954833984,
-0.053619734942913055,
1.0752713680267334,
0.6304299235343933,
0.5492086410522461,
-1.027333378791809,
0.7558079957962036,
-0.556824266910553,
1.2396973371505737,
0.7969792485237122,
-0.8467820286750793,
-0.017831601202487946,
1.380927562713623,
0.36102601885795593,
-0.5517097115516663,
-0.9013553857803345,
-1.0137962102890015,
0.9347022175788879,
1.756234049797058,
-0.11418287456035614,
-0.029757145792245865,
0.7228677868843079,
0.6476909518241882,
-1.3141273260116577,
-0.028376715257763863,
-0.6605828404426575,
-0.6633704304695129,
1.640252709388733,
2.099193572998047,
-0.19364123046398163,
-0.1385960727930069,
-0.6455079317092896,
-1.3796608448028564,
0.8333439826965332,
-0.11536342650651932,
0.16322773694992065,
0.6348504424095154,
-0.5543731451034546,
1.0138835906982422,
0.8247116804122925,
0.9266191720962524,
0.2467925250530243,
0.24065229296684265,
0.42654961347579956,
-0.40654414892196655,
-1.172113299369812,
-0.23910579085350037,
-1.121260643005371,
-2.641775369644165,
0.37926939129829407,
-0.21263855695724487,
-1.384717345237732,
0.0622626468539238,
-0.956251323223114,
0.8754472732543945,
-0.6038138270378113,
-1.0890448093414307,
-1.505875587463379,
0.1590307652950287,
-0.06853193789720535,
0.9396458864212036,
-1.657862901687622,
-0.1371876448392868,
1.167799472808838,
0.8651555776596069,
-0.6627725958824158,
1.0169761180877686,
0.28837576508522034,
1.0435329675674438,
0.8107591867446899,
-0.3713708221912384,
0.6436997056007385,
0.05610280483961105,
-1.3474546670913696,
0.4240359961986542,
1.2426408529281616,
0.13031375408172607,
1.4341683387756348,
-0.4797590672969818,
-0.028830397874116898,
0.35519376397132874,
-0.630993127822876,
-0.41688036918640137,
-0.4238550364971161,
0.6547131538391113,
-0.02212805673480034,
-0.9289879202842712,
-0.07410722970962524,
-0.10468728840351105,
-0.22234350442886353,
0.2057594656944275,
-1.472767949104309,
-0.013550062663853168,
-0.41525179147720337,
-0.5971970558166504,
-1.271494746208191,
-0.07758481055498123,
1.4716938734054565,
-0.7934617400169373,
-0.14689268171787262,
0.4272492825984955,
0.33167245984077454,
0.5328205823898315,
0.691311776638031,
-0.7202304005622864,
-0.289359986782074,
-0.21235686540603638,
-0.3690696954727173,
0.30839788913726807,
1.3788256645202637,
-0.10949403792619705,
-0.9707983136177063,
0.7425656914710999,
-0.3570093512535095,
0.09876202791929245,
1.9103481769561768,
0.09444302320480347,
-0.7725769877433777,
0.2907181680202484,
-0.7407205700874329,
1.9452860355377197,
1.7039320468902588,
1.3213465213775635,
-0.16703122854232788,
-0.8703985214233398,
0.5755564570426941,
-0.39252784848213196,
-0.3660568296909332,
0.8596703410148621,
0.39859822392463684,
-0.28782889246940613,
-1.3853687047958374,
0.7013420462608337,
1.2594280242919922,
-0.8039565682411194,
-0.7958972454071045,
0.16104790568351746,
-0.7266137599945068,
1.1795620918273926,
0.6441356539726257,
0.3872796595096588,
0.24722492694854736,
1.6708649396896362,
0.7721157670021057,
-0.4540707468986511,
0.5222894549369812,
0.5168540477752686,
-0.20009537041187286,
-2.1228859424591064,
-1.1623307466506958,
0.33379656076431274,
-0.6222261786460876,
-1.5649876594543457,
1.3213738203048706,
-1.1414717435836792,
-1.0346050262451172,
0.5466265082359314,
0.04275837540626526,
1.4299228191375732,
0.3675626516342163,
1.577555775642395,
2.0335497856140137,
0.8847019672393799,
0.44985154271125793,
1.2820781469345093,
-0.1757248491048813,
-0.4162347614765167,
1.8618642091751099,
-0.48781338334083557,
0.41453710198402405,
1.1716179847717285,
-0.2783612906932831,
-1.0347654819488525,
-0.832367479801178,
-1.210878610610962,
-0.6953096389770508,
1.1636296510696411,
0.10911611467599869,
-1.129280686378479,
0.24360144138336182,
1.540887475013733,
0.11075086891651154,
-0.2074870467185974,
0.6817765235900879,
0.41294869780540466,
-0.7821129560470581,
-0.031966064125299454,
-0.8696044087409973,
0.5099167227745056,
-0.3189154267311096,
-0.3720456659793854,
0.3541105389595032,
0.43972331285476685,
1.2882113456726074,
-0.11930958926677704,
0.14082589745521545,
1.140350341796875,
-1.4046298265457153,
1.474790334701538,
-0.7252476811408997,
0.2905827462673187,
-2.3391153812408447,
1.3329757452011108,
-0.7423547506332397,
1.9529969692230225,
-2.716838836669922,
0.4458423852920532,
-0.5811272263526917,
-0.5793615579605103,
0.2564449608325958,
-0.3458796441555023,
0.08169148117303848,
-0.1475725919008255,
-1.1581757068634033,
-0.05219924449920654,
-0.6383412480354309,
0.5654183626174927,
1.0725680589675903,
1.3384473323822021,
-1.1806166172027588,
-0.2639133632183075,
-1.760622262954712,
-0.1970485895872116,
-0.7980691194534302,
0.3774188756942749,
-2.0080530643463135,
-0.1568552851676941,
-1.9904587268829346,
-2.3267204761505127,
-1.2434571981430054,
-0.8673630356788635,
1.107085943222046,
0.0949961319565773,
-0.7942710518836975,
1.2837755680084229,
-0.35009169578552246,
-1.8627960681915283,
1.12122642993927,
-2.143306016921997
] |
https://github.com/huggingface/datasets/issues/6058 | laion-coco download error | This can also mean one of the files was not downloaded correctly.
We log an erroneous file's name before raising the reader's error, so this is how you can find the problematic file. Then, you should delete it and call `load_dataset` again.
(I checked all the uploaded files, and they seem to be valid Parquet files, so I don't think this is a bug on their side)
| ### Describe the bug
The full trace:
```
/home/bian/anaconda3/envs/sd/lib/python3.10/site-packages/datasets/load.py:1744: FutureWarning: 'ignore_verifications' was de
precated in favor of 'verification_mode' in version 2.9.1 and will be removed in 3.0.0.
You can remove this warning by passing 'verification_mode=no_checks' instead.
warnings.warn(
Downloading and preparing dataset parquet/laion--laion-coco to /home/bian/.cache/huggingface/datasets/laion___parquet/laion--
laion-coco-cb4205d7f1863066/0.0.0/bcacc8bdaa0614a5d73d0344c813275e590940c6ea8bc569da462847103a1afd...
Downloading data: 100%|β| 1.89G/1.89G [04:57<00:00,
Downloading data files: 100%|β| 1/1 [04:59<00:00, 2
Extracting data files: 100%|β| 1/1 [00:00<00:00, 13
Generating train split: 0 examples [00:00, ? examples/s]<_io.BufferedReader
name='/home/bian/.cache/huggingface/datasets/downlo
ads/26d7a016d25bbd9443115cfa3092136e8eb2f1f5bcd4154
0cb9234572927f04c'>
Traceback (most recent call last):
File "/home/bian/data/ZOC/download_laion_coco.py", line 4, in <module>
dataset = load_dataset("laion/laion-coco", ignore_verifications=True)
File "/home/bian/anaconda3/envs/sd/lib/python3.10/site-packages/datasets/load.py", line 1791, in load_dataset
builder_instance.download_and_prepare(
File "/home/bian/anaconda3/envs/sd/lib/python3.10/site-packages/datasets/builder.py", line 891, in download_and_prepare
self._download_and_prepare(
File "/home/bian/anaconda3/envs/sd/lib/python3.10/site-packages/datasets/builder.py", line 986, in _download_and_prepare
self._prepare_split(split_generator, **prepare_split_kwargs)
File "/home/bian/anaconda3/envs/sd/lib/python3.10/site-packages/datasets/builder.py", line 1748, in _prepare_split
for job_id, done, content in self._prepare_split_single(
File "/home/bian/anaconda3/envs/sd/lib/python3.10/site-packages/datasets/builder.py", line 1842, in _prepare_split_single
generator = self._generate_tables(**gen_kwargs)
File "/home/bian/anaconda3/envs/sd/lib/python3.10/site-packages/datasets/packaged_modules/parquet/parquet.py", line 67, in
_generate_tables
parquet_file = pq.ParquetFile(f)
File "/home/bian/anaconda3/envs/sd/lib/python3.10/site-packages/pyarrow/parquet/core.py", line 323, in __init__
self.reader.open(
File "pyarrow/_parquet.pyx", line 1227, in pyarrow._parquet.ParquetReader.open
File "pyarrow/error.pxi", line 100, in pyarrow.lib.check_status
pyarrow.lib.ArrowInvalid: Parquet magic bytes not found in footer. Either the file is corrupted or this is not a parquet file
.
```
I have carefully followed the instructions in #5264 but still get the same error.
Other helpful information:
```
ds = load_dataset("parquet", data_files=
...: "https://huggingface.co/datasets/laion/l
...: aion-coco/resolve/d22869de3ccd39dfec1507
...: f7ded32e4a518dad24/part-00000-2256f782-1
...: 26f-4dc6-b9c6-e6757637749d-c000.snappy.p
...: arquet")
Found cached dataset parquet (/home/bian/.cache/huggingface/datasets/parquet/default-a02eea00aeb08b0e/0.0.0/bb8ccf89d9ee38581ff5e51506d721a9b37f14df8090dc9b2d8fb4a40957833f)
100%|ββββββββββββββ| 1/1 [00:00<00:00, 4.55it/s]
```
### Steps to reproduce the bug
```
from datasets import load_dataset
dataset = load_dataset("laion/laion-coco", ignore_verifications=True/False)
```
### Expected behavior
Properly load Laion-coco dataset
### Environment info
datasets==2.11.0 torch==1.12.1 python 3.10 | 54 | 67 | laion-coco download error
### Describe the bug
The full trace:
```
/home/bian/anaconda3/envs/sd/lib/python3.10/site-packages/datasets/load.py:1744: FutureWarning: 'ignore_verifications' was de
precated in favor of 'verification_mode' in version 2.9.1 and will be removed in 3.0.0.
You can remove this warning by passing 'verification_mode=no_checks' instead.
warnings.warn(
Downloading and preparing dataset parquet/laion--laion-coco to /home/bian/.cache/huggingface/datasets/laion___parquet/laion--
laion-coco-cb4205d7f1863066/0.0.0/bcacc8bdaa0614a5d73d0344c813275e590940c6ea8bc569da462847103a1afd...
Downloading data: 100%|β| 1.89G/1.89G [04:57<00:00,
Downloading data files: 100%|β| 1/1 [04:59<00:00, 2
Extracting data files: 100%|β| 1/1 [00:00<00:00, 13
Generating train split: 0 examples [00:00, ? examples/s]<_io.BufferedReader
name='/home/bian/.cache/huggingface/datasets/downlo
ads/26d7a016d25bbd9443115cfa3092136e8eb2f1f5bcd4154
0cb9234572927f04c'>
Traceback (most recent call last):
File "/home/bian/data/ZOC/download_laion_coco.py", line 4, in <module>
dataset = load_dataset("laion/laion-coco", ignore_verifications=True)
File "/home/bian/anaconda3/envs/sd/lib/python3.10/site-packages/datasets/load.py", line 1791, in load_dataset
builder_instance.download_and_prepare(
File "/home/bian/anaconda3/envs/sd/lib/python3.10/site-packages/datasets/builder.py", line 891, in download_and_prepare
self._download_and_prepare(
File "/home/bian/anaconda3/envs/sd/lib/python3.10/site-packages/datasets/builder.py", line 986, in _download_and_prepare
self._prepare_split(split_generator, **prepare_split_kwargs)
File "/home/bian/anaconda3/envs/sd/lib/python3.10/site-packages/datasets/builder.py", line 1748, in _prepare_split
for job_id, done, content in self._prepare_split_single(
File "/home/bian/anaconda3/envs/sd/lib/python3.10/site-packages/datasets/builder.py", line 1842, in _prepare_split_single
generator = self._generate_tables(**gen_kwargs)
File "/home/bian/anaconda3/envs/sd/lib/python3.10/site-packages/datasets/packaged_modules/parquet/parquet.py", line 67, in
_generate_tables
parquet_file = pq.ParquetFile(f)
File "/home/bian/anaconda3/envs/sd/lib/python3.10/site-packages/pyarrow/parquet/core.py", line 323, in __init__
self.reader.open(
File "pyarrow/_parquet.pyx", line 1227, in pyarrow._parquet.ParquetReader.open
File "pyarrow/error.pxi", line 100, in pyarrow.lib.check_status
pyarrow.lib.ArrowInvalid: Parquet magic bytes not found in footer. Either the file is corrupted or this is not a parquet file
.
```
I have carefully followed the instructions in #5264 but still get the same error.
Other helpful information:
```
ds = load_dataset("parquet", data_files=
...: "https://huggingface.co/datasets/laion/l
...: aion-coco/resolve/d22869de3ccd39dfec1507
...: f7ded32e4a518dad24/part-00000-2256f782-1
...: 26f-4dc6-b9c6-e6757637749d-c000.snappy.p
...: arquet")
Found cached dataset parquet (/home/bian/.cache/huggingface/datasets/parquet/default-a02eea00aeb08b0e/0.0.0/bb8ccf89d9ee38581ff5e51506d721a9b37f14df8090dc9b2d8fb4a40957833f)
100%|ββββββββββββββ| 1/1 [00:00<00:00, 4.55it/s]
```
### Steps to reproduce the bug
```
from datasets import load_dataset
dataset = load_dataset("laion/laion-coco", ignore_verifications=True/False)
```
### Expected behavior
Properly load Laion-coco dataset
### Environment info
datasets==2.11.0 torch==1.12.1 python 3.10
This can also mean one of the files was not downloaded correctly.
We log an erroneous file's name before raising the reader's error, so this is how you can find the problematic file. Then, you should delete it and call `load_dataset` again.
(I checked all the uploaded files, and they seem to be valid Parquet files, so I don't think this is a bug on their side)
| [
-1.228498935699463,
-0.9487924575805664,
-0.7148016691207886,
1.4198180437088013,
-0.07668789476156235,
-1.150172472000122,
0.09865113347768784,
-1.0615023374557495,
1.4952726364135742,
-0.6555337905883789,
0.2628440856933594,
-1.7097371816635132,
-0.08578065782785416,
-0.5050936937332153,
-0.6892457604408264,
-0.8584149479866028,
-0.3745722770690918,
-0.8450447916984558,
0.9768246412277222,
2.555136203765869,
1.314197301864624,
-1.3426812887191772,
2.7618019580841064,
0.7213084101676941,
-0.2418195903301239,
-1.0139371156692505,
0.591608464717865,
0.031193334609270096,
-1.3072401285171509,
-0.390092670917511,
-0.9283614158630371,
0.08938285708427429,
-0.56239914894104,
-0.38049429655075073,
0.03223584219813347,
0.43467479944229126,
-0.24102362990379333,
-0.2956719398498535,
-0.5674000382423401,
-0.7585300207138062,
0.5862157344818115,
-0.38220536708831787,
0.912940502166748,
-0.3528035879135132,
1.7687253952026367,
-0.6201855540275574,
0.42131268978118896,
0.7009080648422241,
1.2704706192016602,
0.1204998642206192,
0.05146379768848419,
0.2836802005767822,
0.3295953869819641,
-0.0020418097265064716,
0.4780920147895813,
1.2764531373977661,
0.546094536781311,
0.4147151708602905,
0.6332439184188843,
-2.244790554046631,
1.2487688064575195,
-0.8665915727615356,
0.2903200387954712,
1.3013724088668823,
-0.8374462723731995,
0.3649899959564209,
-1.851766586303711,
-0.10179277509450912,
0.6290034651756287,
-2.226367950439453,
0.2700003385543823,
-1.3566865921020508,
-0.5200859904289246,
0.8810704946517944,
0.2985893487930298,
-1.2423449754714966,
0.1859138458967209,
-0.5368478298187256,
1.1092218160629272,
0.5065644383430481,
1.1347355842590332,
-1.6713093519210815,
-0.019141139462590218,
-0.24210985004901886,
0.0872749537229538,
-1.3344484567642212,
-1.5633223056793213,
0.5178518295288086,
0.622378945350647,
0.6722461581230164,
0.034294404089450836,
0.997758150100708,
-1.036605954170227,
0.8408883213996887,
-0.9871149063110352,
-1.6269530057907104,
-1.4012669324874878,
-2.422227621078491,
-2.222855806350708,
0.7226151823997498,
-0.4675096869468689,
-0.46350526809692383,
1.9468562602996826,
-1.0262465476989746,
-1.8118715286254883,
1.052470088005066,
0.3580760955810547,
0.05703306943178177,
2.355541944503784,
0.22851932048797607,
-0.7831722497940063,
0.5037704110145569,
-0.7235202789306641,
0.7841796875,
-0.2738734483718872,
1.3358904123306274,
0.4712551236152649,
-0.9637266993522644,
1.5865674018859863,
-0.5172168016433716,
0.533210039138794,
-0.6911758184432983,
-0.5422282218933105,
-0.8121066093444824,
0.1880684196949005,
1.8705618381500244,
-0.37804150581359863,
1.5685884952545166,
-0.35720157623291016,
-1.5800377130508423,
-1.5105090141296387,
0.7699063420295715,
0.5284075140953064,
-0.8522524237632751,
0.018067210912704468,
-0.427138090133667,
0.1262374222278595,
0.02086760848760605,
1.0583747625350952,
1.2073999643325806,
0.7323634624481201,
-0.2750360369682312,
-0.8955976963043213,
0.206366628408432,
-0.12248175591230392,
-0.664344072341919,
-1.8680775165557861,
-0.22778750956058502,
0.2008630335330963,
0.6890774965286255,
-1.2648749351501465,
1.7605663537979126,
0.8823117017745972,
2.0631093978881836,
1.0518971681594849,
-0.3438110947608948,
1.5343384742736816,
0.046365413814783096,
1.8625887632369995,
-0.48916828632354736,
0.5928487181663513,
-0.3578903079032898,
-1.1280615329742432,
0.8522207736968994,
-0.34606605768203735,
-2.0339808464050293,
-0.7580512762069702,
-0.776814341545105,
-0.2119891494512558,
-0.7824917435646057,
0.9328073263168335,
-0.2967168688774109,
-1.4798377752304077,
0.23054169118404388,
-0.6838011741638184,
0.14689496159553528,
-1.2492668628692627,
0.2363162487745285,
0.7579193115234375,
-0.6008316874504089,
-0.008901314809918404,
-0.2810273766517639,
-1.2847459316253662,
-0.45504963397979736,
0.3422703146934509,
1.9507285356521606,
-0.5773174166679382,
0.9412774443626404,
1.044021487236023,
-0.6304748058319092,
0.15779055655002594,
0.2900888919830322,
-0.2943187952041626,
0.7997496724128723,
-1.1253834962844849,
-0.399502694606781,
1.1532789468765259,
-0.20149041712284088,
-0.61143559217453,
1.482243537902832,
0.7877614498138428,
-1.0585548877716064,
-0.2795068621635437,
-0.20247074961662292,
-0.8376999497413635,
-0.02726653777062893,
-1.5615451335906982,
-0.10116168111562729,
0.2772296071052551,
-1.5005290508270264,
-0.36533862352371216,
-0.16204287111759186,
1.2886552810668945,
-0.20099930465221405,
1.44294011592865,
-0.3379572033882141,
-0.09621508419513702,
-0.34441614151000977,
-0.5348367094993591,
0.17892391979694366,
-0.23894155025482178,
-0.5979545712471008,
0.21732977032661438,
-0.8473851084709167,
0.21338407695293427,
1.4815514087677002,
0.42244040966033936,
0.020740298554301262,
0.4671593904495239,
1.096442699432373,
0.4001736640930176,
-0.03350638598203659,
-0.8051170706748962,
-1.5742822885513306,
2.0543830394744873,
-1.4845483303070068,
1.9145641326904297,
0.8167248368263245,
-0.0643586665391922,
-1.8345847129821777,
-1.8537830114364624,
1.2958283424377441,
1.0536876916885376,
2.3779492378234863,
0.5336734652519226,
0.49611490964889526,
-0.7625137567520142,
-0.7844908237457275,
0.38849925994873047,
-0.9797289371490479,
-0.7637457251548767,
0.1441403478384018,
2.4090065956115723,
1.736466646194458,
-0.5256991386413574,
-0.2130642682313919,
-0.8794392943382263,
1.263260841369629,
-0.11526928097009659,
0.18415388464927673,
2.0123019218444824,
-0.24158506095409393,
-1.0636093616485596,
1.2716505527496338,
-2.44150447845459,
0.2961629629135132,
2.0671515464782715,
0.29940688610076904,
0.1656324565410614,
-1.4255679845809937,
-0.6743614673614502,
-0.29989707469940186,
-0.47563236951828003,
-1.2879372835159302,
0.6355262994766235,
-0.3086780905723572,
-0.9346628785133362,
-1.5565613508224487,
0.023103348910808563,
-1.1573121547698975,
-1.7106679677963257,
0.4233664870262146,
1.8822898864746094,
2.1535348892211914,
-0.6982280015945435,
1.446419358253479,
-0.2772231698036194,
0.03938542306423187,
1.2104347944259644,
1.3474000692367554,
3.112942934036255,
1.8433876037597656,
-1.2799818515777588,
0.753895103931427,
-0.1756049394607544,
-0.44563549757003784,
1.181261658668518,
-1.1450239419937134,
1.1125473976135254,
-0.25091353058815,
-1.2742278575897217,
-1.2231110334396362,
1.0880025625228882,
0.45338475704193115,
0.027254894375801086,
-0.5295217633247375,
1.2688971757888794,
0.1857214719057083,
1.3301869630813599,
0.5239172577857971,
-0.35096579790115356,
0.522825300693512,
-0.3390467166900635,
-0.5797827839851379,
1.5490593910217285,
0.15973089635372162,
-1.5250837802886963,
-2.4014358520507812,
-0.24110165238380432,
-0.8863581418991089,
-0.05252066254615784,
-0.6621220707893372,
-1.1263704299926758,
1.6475346088409424,
0.40130019187927246,
-1.2185821533203125,
-0.20888753235340118,
-0.31023740768432617,
-0.5353597402572632,
2.5605757236480713,
-1.3711332082748413,
-0.16373950242996216,
-0.9335827827453613,
-0.5410559177398682,
1.6038745641708374,
-1.2189042568206787,
-0.1452835202217102,
-1.005244493484497,
-0.6586573719978333,
-1.3077722787857056,
-0.48521411418914795,
-0.01928413286805153,
-0.9603381156921387,
0.784338116645813,
0.20415134727954865,
-1.0986992120742798,
-0.26434510946273804,
-1.0150220394134521,
1.0390464067459106,
-0.03599115461111069,
0.2380637228488922,
1.8871524333953857,
0.30078738927841187,
-0.4712381958961487,
0.7000317573547363,
1.194478154182434,
0.5687076449394226,
-0.6436955332756042,
0.02443346008658409,
-0.7011800408363342,
0.38783013820648193,
-1.4351381063461304,
0.24353010952472687,
-2.963026523590088,
0.7703786492347717,
-0.06276474893093109,
-0.10231229662895203,
-0.08564125746488571,
-1.2926511764526367,
1.164710283279419,
2.600958824157715,
-1.2043988704681396,
0.5177287459373474,
0.4266137480735779,
1.167177438735962,
-1.5397329330444336,
0.2725701332092285,
-0.4870532751083374,
2.079735517501831,
0.06350958347320557,
1.2077986001968384,
-0.49720847606658936,
-2.2247843742370605,
0.71275395154953,
-1.21059250831604,
-1.0569257736206055,
0.7754560112953186,
-0.8654086589813232,
0.24649162590503693,
-1.3887403011322021,
-0.24935492873191833,
-1.068612813949585,
-1.238875389099121,
0.6889452338218689,
0.18295560777187347,
0.46240103244781494,
-0.5494383573532104,
0.324502170085907,
-2.2302050590515137,
-1.3730547428131104,
-0.18865966796875,
-0.9902799129486084,
0.48105835914611816,
-0.39272522926330566,
0.6160953044891357,
-0.0714976042509079,
0.03453816846013069,
0.3017970323562622,
1.3036744594573975,
3.388712167739868,
0.18455685675144196,
0.23749808967113495,
-0.1003008633852005,
-1.0630791187286377,
1.3919284343719482,
0.9082516431808472,
-0.173817440867424,
-0.5712094902992249,
-0.9732971787452698,
1.3191699981689453,
2.014946222305298,
1.0649278163909912,
0.11282581835985184,
-0.8873547315597534,
-0.8241215348243713,
0.05427835136651993,
0.1910174936056137,
0.5583785176277161,
0.9664854407310486,
-0.048008643090724945,
0.12408708035945892,
1.4378420114517212,
1.1544017791748047,
-0.3054448962211609,
0.38268548250198364,
-0.9145866632461548,
-0.4242081642150879,
0.4583323001861572,
0.24117238819599152,
0.03472890332341194,
0.475974977016449,
-1.10495924949646,
-0.29468685388565063,
-0.2619773745536804,
-0.9093188047409058,
-0.715080201625824,
-0.40552693605422974,
-0.4025551676750183,
1.5948818922042847,
0.13454602658748627,
-0.44432878494262695,
0.04560843110084534,
-0.760934591293335,
-0.13172928988933563,
-1.1796743869781494,
0.22962886095046997,
-0.16091126203536987,
-0.011848796159029007,
-0.14978033304214478,
1.7215055227279663,
-0.9538109302520752,
-2.145806312561035,
0.19648657739162445,
0.31471699476242065,
-0.38337695598602295,
0.24312637746334076,
1.7168844938278198,
0.5374032855033875,
1.3310556411743164,
1.2989763021469116,
0.9309817552566528,
-0.5824574828147888,
-1.2014706134796143,
0.6604230999946594,
0.9286662340164185,
-1.359337568283081,
0.9573758840560913,
-0.13091593980789185,
-0.48232442140579224,
0.735375702381134,
1.4024341106414795,
0.42705225944519043,
-2.007218360900879,
0.8821060061454773,
-0.8898758292198181,
0.7765955924987793,
0.6671310067176819,
0.7786782383918762,
0.24762557446956635,
0.8716914653778076,
-1.2066073417663574,
-1.066686987876892,
-0.7079212069511414,
-0.6152554154396057,
1.857328176498413,
-0.25853174924850464,
0.4978293180465698,
-0.14459118247032166,
-1.1889792680740356,
-0.07141433656215668,
0.7543741464614868,
0.33745479583740234,
-0.4073566794395447,
0.837603747844696,
-0.6023819446563721,
-1.088660717010498,
-1.220490574836731,
-0.4195065498352051,
-0.9420567154884338,
-0.841575026512146,
0.984359085559845,
0.7219260334968567,
0.42669230699539185,
1.980259895324707,
0.5940423607826233,
0.2854732275009155,
-2.6897168159484863,
0.8815052509307861,
0.3079081177711487,
0.010508626699447632,
0.9607431292533875,
0.21351991593837738,
1.1384979486465454,
-0.009662706404924393,
0.5762503743171692,
-2.315220832824707,
2.2216689586639404,
-0.25354182720184326,
0.7762307524681091,
-0.003823593258857727,
-0.11037106812000275,
1.134499192237854,
0.5860462784767151,
0.5948888659477234,
-1.1017183065414429,
0.7869963049888611,
-0.6497876048088074,
1.1581172943115234,
0.975685179233551,
-0.8895825743675232,
0.06685201823711395,
1.3096942901611328,
0.4304403066635132,
-0.42492181062698364,
-0.9366080164909363,
-0.7769736051559448,
0.9948223829269409,
1.7031137943267822,
-0.04761115834116936,
0.07976400852203369,
0.8857271075248718,
0.6167711019515991,
-1.2665976285934448,
0.06460600346326828,
-0.7097498774528503,
-0.6842336058616638,
1.7391033172607422,
2.0472826957702637,
-0.07991494983434677,
-0.1371760070323944,
-0.7483254075050354,
-1.3347703218460083,
0.8119292259216309,
-0.10294932126998901,
0.10653696954250336,
0.5956153869628906,
-0.7019534111022949,
1.1168973445892334,
0.6284452080726624,
1.0216825008392334,
-0.02797265723347664,
0.37973666191101074,
0.3521241545677185,
-0.3542550206184387,
-1.164475679397583,
-0.36332935094833374,
-1.1351286172866821,
-2.4591290950775146,
0.48880553245544434,
-0.2029695361852646,
-1.4611016511917114,
0.08002002537250519,
-1.0005512237548828,
0.9133970737457275,
-0.6030517816543579,
-1.0956391096115112,
-1.3864295482635498,
0.3052106499671936,
-0.13301271200180054,
0.8963704109191895,
-1.6302051544189453,
-0.13480111956596375,
1.2156046628952026,
0.9607757329940796,
-0.5617979764938354,
1.0183689594268799,
0.307140588760376,
1.010759711265564,
0.807038426399231,
-0.4631974697113037,
0.5672431588172913,
0.10431500524282455,
-1.3208104372024536,
0.4042869210243225,
1.2794713973999023,
0.19585764408111572,
1.4014952182769775,
-0.4639493227005005,
0.026023324579000473,
0.40669602155685425,
-0.6224409937858582,
-0.5515013337135315,
-0.4454893469810486,
0.6694290637969971,
0.06776244193315506,
-1.0240263938903809,
-0.15874972939491272,
-0.11358533054590225,
-0.21383561193943024,
0.19940511882305145,
-1.4979190826416016,
-0.30029767751693726,
-0.3759033679962158,
-0.4775911569595337,
-1.3522738218307495,
0.010379919782280922,
1.3301489353179932,
-0.798587441444397,
-0.19831159710884094,
0.3591928482055664,
0.41273796558380127,
0.5774595141410828,
0.6231883764266968,
-0.6871575117111206,
-0.42833244800567627,
-0.3215211033821106,
-0.26711273193359375,
0.2882682681083679,
1.2281787395477295,
-0.07635685801506042,
-0.9950054287910461,
0.6602081060409546,
-0.46263283491134644,
0.12661607563495636,
1.973872184753418,
-0.002468821592628956,
-0.6825550198554993,
0.3844810128211975,
-0.682885468006134,
1.8087509870529175,
1.6975871324539185,
1.3211239576339722,
-0.2134079486131668,
-0.8223699927330017,
0.5864208936691284,
-0.2867256999015808,
-0.33194899559020996,
0.8715336918830872,
0.4522242546081543,
-0.22354595363140106,
-1.4299206733703613,
0.5535222291946411,
1.1931283473968506,
-0.892138659954071,
-0.6932812333106995,
0.04746429994702339,
-0.8372928500175476,
1.1822935342788696,
0.6409187316894531,
0.3602040410041809,
0.2508174777030945,
1.5545703172683716,
0.6879529356956482,
-0.5644385814666748,
0.4945402145385742,
0.442221462726593,
-0.1957227736711502,
-2.158646821975708,
-1.0209953784942627,
0.34636354446411133,
-0.34611809253692627,
-1.6247386932373047,
1.3466322422027588,
-1.1173862218856812,
-0.9851812124252319,
0.5244323015213013,
0.05662384629249573,
1.2078378200531006,
0.32723987102508545,
1.725295901298523,
2.1054177284240723,
0.9233584403991699,
0.3564804792404175,
1.289912223815918,
-0.07240686565637589,
-0.4371224045753479,
1.8462233543395996,
-0.39873284101486206,
0.6067653894424438,
1.012999176979065,
-0.43174898624420166,
-1.0660163164138794,
-0.7905473709106445,
-1.187294363975525,
-0.6818126440048218,
1.162074089050293,
0.13276325166225433,
-1.0967826843261719,
0.22078803181648254,
1.6068954467773438,
0.09782188385725021,
-0.20227764546871185,
0.6714013814926147,
0.4406238794326782,
-0.7250048518180847,
-0.10060074925422668,
-0.8637056946754456,
0.5095838904380798,
-0.1679452508687973,
-0.3344985246658325,
0.1678951233625412,
0.4666505455970764,
1.303754448890686,
-0.030049994587898254,
0.07983522117137909,
1.259831190109253,
-1.4130539894104004,
1.50863778591156,
-0.6692157983779907,
0.3052656054496765,
-2.458005428314209,
1.3481874465942383,
-0.8018749952316284,
1.8345149755477905,
-2.600437641143799,
0.427287220954895,
-0.5813308358192444,
-0.47337913513183594,
0.2521710991859436,
-0.37970632314682007,
0.11265496909618378,
-0.13991576433181763,
-0.9373952746391296,
-0.018236450850963593,
-0.7166846990585327,
0.5445030331611633,
1.1305803060531616,
1.3782901763916016,
-1.1028605699539185,
-0.24703644216060638,
-1.7535278797149658,
-0.12848591804504395,
-0.7162176370620728,
0.30481064319610596,
-1.9831401109695435,
-0.1957922726869583,
-2.0415589809417725,
-2.384308338165283,
-1.407111406326294,
-0.8750896453857422,
1.0641396045684814,
0.1846003383398056,
-0.9716843962669373,
1.1583081483840942,
-0.40174752473831177,
-1.8019139766693115,
1.106964111328125,
-2.184621810913086
] |
https://github.com/huggingface/datasets/issues/6057 | Why is the speed difference of gen example so big? | Hi!
It's hard to explain this behavior without more information. Can you profile the slower version with the following code
```python
import cProfile, pstats
from datasets import load_dataset
with cProfile.Profile() as profiler:
ds = load_dataset(...)
stats = pstats.Stats(profiler).sort_stats("cumtime")
stats.print_stats()
```
and share the output? | ```python
def _generate_examples(self, metadata_path, images_dir, conditioning_images_dir):
with open(metadata_path, 'r') as file:
metadata = json.load(file)
for idx, item in enumerate(metadata):
image_path = item.get('image_path')
text_content = item.get('text_content')
image_data = open(image_path, "rb").read()
yield idx, {
"text": text_content,
"image": {
"path": image_path,
"bytes": image_data,
},
"conditioning_image": {
"path": image_path,
"bytes": image_data,
},
}
```
Hello,
I use the above function to deal with my local data set, but I am very surprised that the speed at which I generate example is very different. When I start a training task, **sometimes 1000examples/s, sometimes only 10examples/s.**
![image](https://github.com/huggingface/datasets/assets/46072190/cdc17661-8267-4fd8-b30c-b74d505efd9b)
I'm not saying that speed is changing all the time. I mean, the reading speed is different in different training, which will cause me to start training over and over again until the speed of this generation of examples is normal.
| 55 | 44 | Why is the speed difference of gen example so big?
```python
def _generate_examples(self, metadata_path, images_dir, conditioning_images_dir):
with open(metadata_path, 'r') as file:
metadata = json.load(file)
for idx, item in enumerate(metadata):
image_path = item.get('image_path')
text_content = item.get('text_content')
image_data = open(image_path, "rb").read()
yield idx, {
"text": text_content,
"image": {
"path": image_path,
"bytes": image_data,
},
"conditioning_image": {
"path": image_path,
"bytes": image_data,
},
}
```
Hello,
I use the above function to deal with my local data set, but I am very surprised that the speed at which I generate example is very different. When I start a training task, **sometimes 1000examples/s, sometimes only 10examples/s.**
![image](https://github.com/huggingface/datasets/assets/46072190/cdc17661-8267-4fd8-b30c-b74d505efd9b)
I'm not saying that speed is changing all the time. I mean, the reading speed is different in different training, which will cause me to start training over and over again until the speed of this generation of examples is normal.
Hi!
It's hard to explain this behavior without more information. Can you profile the slower version with the following code
```python
import cProfile, pstats
from datasets import load_dataset
with cProfile.Profile() as profiler:
ds = load_dataset(...)
stats = pstats.Stats(profiler).sort_stats("cumtime")
stats.print_stats()
```
and share the output? | [
-1.216934323310852,
-0.9637471437454224,
-0.751177191734314,
1.5022461414337158,
-0.20957061648368835,
-1.2565745115280151,
0.1558200716972351,
-1.0771048069000244,
1.6094040870666504,
-0.8362681269645691,
0.3122471272945404,
-1.6983448266983032,
-0.053490594029426575,
-0.6072121262550354,
-0.7769930958747864,
-0.9163908362388611,
-0.41224589943885803,
-0.8149207234382629,
1.09734046459198,
2.5492799282073975,
1.245376706123352,
-1.3828994035720825,
2.7086687088012695,
0.6530845761299133,
-0.13882777094841003,
-0.9723906517028809,
0.5745235085487366,
-0.046502549201250076,
-1.200953483581543,
-0.5162463784217834,
-0.9431304335594177,
-0.11964836716651917,
-0.6074804067611694,
-0.4699300527572632,
-0.02114814519882202,
0.488050639629364,
-0.29417452216148376,
-0.37931951880455017,
-0.5666587352752686,
-0.8437681794166565,
0.536653995513916,
-0.46105629205703735,
0.955659031867981,
-0.3118918836116791,
1.7483434677124023,
-0.5918545126914978,
0.474875807762146,
0.7374778985977173,
1.3593686819076538,
0.23409757018089294,
-0.011238549835979939,
0.3173207938671112,
0.38173311948776245,
-0.07437087595462799,
0.47496116161346436,
1.168940544128418,
0.6880643963813782,
0.47610780596733093,
0.6776074767112732,
-2.2960779666900635,
1.2665315866470337,
-1.1573166847229004,
0.35120686888694763,
1.3916401863098145,
-0.8963468670845032,
0.37919747829437256,
-1.8457177877426147,
-0.15117447078227997,
0.5400975942611694,
-2.199489116668701,
0.30498841404914856,
-1.2734646797180176,
-0.5128685832023621,
1.0041669607162476,
0.46310290694236755,
-1.3352833986282349,
0.11886250227689743,
-0.40865692496299744,
1.021544337272644,
0.3940100371837616,
1.073049783706665,
-1.718114972114563,
-0.12098783999681473,
-0.28182506561279297,
0.1251845359802246,
-1.2382007837295532,
-1.5566655397415161,
0.5502064228057861,
0.4911429286003113,
0.5354484915733337,
-0.17159442603588104,
1.0377776622772217,
-1.0254701375961304,
0.8149892091751099,
-1.0434931516647339,
-1.6332188844680786,
-1.5595793724060059,
-2.3284833431243896,
-2.228736162185669,
0.7078778147697449,
-0.4568057954311371,
-0.5255005359649658,
2.0507993698120117,
-0.9766611456871033,
-1.6549441814422607,
1.1404653787612915,
0.2656502425670624,
-0.04471474885940552,
2.389646053314209,
0.29052069783210754,
-0.7120004892349243,
0.4496825337409973,
-0.7971571683883667,
0.8142064809799194,
-0.3025203347206116,
1.4463695287704468,
0.462435245513916,
-1.0429657697677612,
1.552085041999817,
-0.3769466280937195,
0.5278354287147522,
-0.6244428753852844,
-0.47757095098495483,
-0.7878803014755249,
0.3614657521247864,
1.791225552558899,
-0.26769116520881653,
1.5123741626739502,
-0.3505963683128357,
-1.5588425397872925,
-1.6101272106170654,
0.9466082453727722,
0.5239459872245789,
-0.7997244596481323,
0.0984991118311882,
-0.46867433190345764,
0.15824683010578156,
-0.028970282524824142,
1.1808602809906006,
1.3028815984725952,
0.8187680840492249,
-0.45707622170448303,
-0.8876189589500427,
0.17532366514205933,
-0.08019596338272095,
-0.7546006441116333,
-1.765468955039978,
-0.3529859781265259,
0.12608833611011505,
0.6574408411979675,
-1.1742455959320068,
1.804736852645874,
0.9488719701766968,
1.9043769836425781,
0.97086101770401,
-0.3957464396953583,
1.4255523681640625,
0.014052540995180607,
1.8452357053756714,
-0.5519430041313171,
0.6725485920906067,
-0.34912949800491333,
-1.1900100708007812,
0.9543017745018005,
-0.235446497797966,
-2.103304624557495,
-0.8518507480621338,
-0.8689342737197876,
-0.2586978077888489,
-0.8216872215270996,
0.9181510210037231,
-0.27465254068374634,
-1.4141559600830078,
0.19384123384952545,
-0.7065879702568054,
0.07353024184703827,
-1.2398806810379028,
0.31061241030693054,
0.6615592241287231,
-0.6511259078979492,
0.08393415063619614,
-0.146683931350708,
-1.2428497076034546,
-0.4482939839363098,
0.21769635379314423,
1.891666054725647,
-0.7483571171760559,
0.9630532264709473,
1.057482361793518,
-0.6726154088973999,
0.08223063498735428,
0.2910272181034088,
-0.35744720697402954,
0.8929024934768677,
-1.0226314067840576,
-0.5091894865036011,
1.2118561267852783,
-0.222666934132576,
-0.5608296394348145,
1.4333099126815796,
0.7025729417800903,
-1.0302958488464355,
-0.22301337122917175,
-0.18449079990386963,
-0.806276798248291,
0.0441046804189682,
-1.5892413854599,
-0.09938362240791321,
0.515005350112915,
-1.527466893196106,
-0.4446544945240021,
-0.18856146931648254,
1.3676832914352417,
-0.19077526032924652,
1.3827095031738281,
-0.36532971262931824,
-0.1877432018518448,
-0.354366660118103,
-0.34552985429763794,
0.18977440893650055,
-0.17622025310993195,
-0.5708389282226562,
0.18984635174274445,
-0.8629563450813293,
0.29111340641975403,
1.4742547273635864,
0.37518274784088135,
-0.03387729078531265,
0.4522343873977661,
1.1018253564834595,
0.37976184487342834,
0.006968350149691105,
-0.872391402721405,
-1.4860467910766602,
2.0683770179748535,
-1.4617959260940552,
1.9652642011642456,
0.7281282544136047,
-0.008387301117181778,
-1.7703149318695068,
-1.8375049829483032,
1.2804157733917236,
1.1620142459869385,
2.34316349029541,
0.5263655185699463,
0.4120207726955414,
-0.8221333026885986,
-0.6920364499092102,
0.39459142088890076,
-1.0828994512557983,
-0.6534784436225891,
0.14554613828659058,
2.4094977378845215,
1.7506295442581177,
-0.4454251527786255,
-0.155517578125,
-1.0082757472991943,
1.380700945854187,
-0.15292888879776,
0.217747762799263,
2.0168440341949463,
-0.25525549054145813,
-1.1336286067962646,
1.2898423671722412,
-2.316448211669922,
0.19030654430389404,
2.0102577209472656,
0.34242451190948486,
0.10349805653095245,
-1.3795124292373657,
-0.615950882434845,
-0.2893010079860687,
-0.41838425397872925,
-1.2401059865951538,
0.5627544522285461,
-0.20907890796661377,
-0.8505750298500061,
-1.4390872716903687,
0.14459823071956635,
-1.1716781854629517,
-1.6821657419204712,
0.32478198409080505,
1.793208122253418,
2.161947011947632,
-0.8092085719108582,
1.5628929138183594,
-0.30092114210128784,
0.15363812446594238,
1.2138662338256836,
1.2734366655349731,
3.0660815238952637,
1.8178532123565674,
-1.332773208618164,
0.5708363056182861,
-0.16564851999282837,
-0.4771782457828522,
1.1470062732696533,
-1.254037618637085,
1.250259518623352,
-0.11739547550678253,
-1.1199109554290771,
-1.174153208732605,
1.0380622148513794,
0.42068737745285034,
-0.02723129466176033,
-0.4943358302116394,
1.1316368579864502,
0.10106472671031952,
1.323494791984558,
0.6231837868690491,
-0.32719239592552185,
0.6239498853683472,
-0.41803961992263794,
-0.47687801718711853,
1.5271998643875122,
0.22894634306430817,
-1.4293179512023926,
-2.2705256938934326,
-0.22981798648834229,
-0.892585039138794,
0.12996496260166168,
-0.5928254723548889,
-0.9865483045578003,
1.6567851305007935,
0.36763325333595276,
-1.2435986995697021,
-0.34799128770828247,
-0.4039337933063507,
-0.5387231707572937,
2.7247543334960938,
-1.3225151300430298,
-0.17847725749015808,
-0.9363937973976135,
-0.6404192447662354,
1.6438761949539185,
-1.2123051881790161,
-0.21962736546993256,
-1.0538585186004639,
-0.5637611746788025,
-1.2742908000946045,
-0.5823673605918884,
-0.01860770955681801,
-0.9440104365348816,
0.7581885457038879,
0.21576279401779175,
-1.1385130882263184,
-0.41667041182518005,
-0.8028188943862915,
0.8809425830841064,
-0.14800044894218445,
0.20809952914714813,
1.8570748567581177,
0.3807787001132965,
-0.3061186969280243,
0.8069878220558167,
1.1905003786087036,
0.6862212419509888,
-0.5423381924629211,
0.14670218527317047,
-0.6497355103492737,
0.2605326175689697,
-1.2446399927139282,
0.27777501940727234,
-2.808924436569214,
0.6155626177787781,
-0.14053478837013245,
-0.12857550382614136,
-0.07717768102884293,
-1.3132963180541992,
1.1144376993179321,
2.540310859680176,
-1.223475456237793,
0.5229458808898926,
0.2830667197704315,
1.0921859741210938,
-1.6558592319488525,
0.27007031440734863,
-0.44060808420181274,
2.141397476196289,
0.19906188547611237,
1.2303106784820557,
-0.5043326616287231,
-2.2538602352142334,
0.6138899922370911,
-1.3114746809005737,
-1.1147377490997314,
0.7018045783042908,
-0.8305339217185974,
0.1776863932609558,
-1.4717872142791748,
-0.26933369040489197,
-0.941997766494751,
-1.2342298030853271,
0.7159574031829834,
0.10205979645252228,
0.3975902199745178,
-0.5724132657051086,
0.32868754863739014,
-2.1962292194366455,
-1.378759741783142,
-0.25573015213012695,
-0.9341325163841248,
0.5133653283119202,
-0.4513842463493347,
0.7414267063140869,
-0.14441241323947906,
0.008694750256836414,
0.428912878036499,
1.5041519403457642,
3.480241298675537,
0.18517722189426422,
0.32471197843551636,
-0.17481698095798492,
-0.9637858271598816,
1.4641592502593994,
0.9391613006591797,
-0.07286127656698227,
-0.5612191557884216,
-1.1084015369415283,
1.2831206321716309,
2.01021409034729,
1.0269954204559326,
0.03209507465362549,
-0.8281400799751282,
-0.6808175444602966,
-0.07539790123701096,
0.19619376957416534,
0.503578782081604,
0.9241909384727478,
0.02988104149699211,
0.08445370942354202,
1.507885456085205,
1.1894105672836304,
-0.4327046573162079,
0.2788918912410736,
-0.854712724685669,
-0.5035659670829773,
0.4569818675518036,
0.22496485710144043,
-0.04864424094557762,
0.42577478289604187,
-1.0288915634155273,
-0.23925051093101501,
-0.3767993450164795,
-0.8531301617622375,
-0.7023192048072815,
-0.43403360247612,
-0.40616631507873535,
1.6096197366714478,
0.1500176191329956,
-0.4755520224571228,
-0.013696257025003433,
-0.7295629978179932,
-0.1648721694946289,
-1.0881563425064087,
0.13597418367862701,
-0.14415331184864044,
-0.15714460611343384,
-0.23218399286270142,
1.7534723281860352,
-0.8532999753952026,
-2.087146759033203,
0.21263593435287476,
0.28404659032821655,
-0.36408984661102295,
0.20758849382400513,
1.6505043506622314,
0.5621452927589417,
1.4374953508377075,
1.2848730087280273,
0.9258859157562256,
-0.6060484051704407,
-1.2426987886428833,
0.6904063820838928,
0.9761770367622375,
-1.3971086740493774,
0.8301537036895752,
-0.06094099581241608,
-0.40621617436408997,
0.6458179950714111,
1.291860818862915,
0.5204951763153076,
-2.019528388977051,
0.852203369140625,
-0.9174354076385498,
0.9058068990707397,
0.7117332816123962,
0.7044247388839722,
0.20182202756404877,
0.7501770853996277,
-1.1959342956542969,
-1.0259056091308594,
-0.71538907289505,
-0.7030901908874512,
2.0007951259613037,
-0.30107396841049194,
0.6618363261222839,
-0.2744344472885132,
-1.246124267578125,
-0.10435359925031662,
0.7282463908195496,
0.2934797704219818,
-0.5091681480407715,
0.777244508266449,
-0.5915536284446716,
-1.0924277305603027,
-1.34956693649292,
-0.4173721373081207,
-1.0943928956985474,
-1.0052675008773804,
1.0494331121444702,
0.7151585221290588,
0.34428054094314575,
1.9037251472473145,
0.6896220445632935,
0.232357919216156,
-2.576251268386841,
0.8775779604911804,
0.3455520570278168,
-0.06035184487700462,
0.8894129395484924,
0.3040429353713989,
1.0626622438430786,
-0.03686874732375145,
0.6097494959831238,
-2.4110107421875,
2.2968478202819824,
-0.16335950791835785,
0.7770819067955017,
-0.051701415330171585,
-0.2513349950313568,
1.1234813928604126,
0.6012284159660339,
0.47362688183784485,
-1.0913722515106201,
0.5934641361236572,
-0.6021558046340942,
1.1824405193328857,
0.8917272090911865,
-0.7387274503707886,
-0.0073491414077579975,
1.4099963903427124,
0.473999947309494,
-0.5056113600730896,
-0.9806418418884277,
-0.9138904809951782,
0.934283435344696,
1.7060366868972778,
-0.14054131507873535,
-0.04043658450245857,
0.8017311692237854,
0.6679850220680237,
-1.2387856245040894,
0.05304402485489845,
-0.7561818361282349,
-0.6828068494796753,
1.6918368339538574,
2.115565776824951,
-0.17962653934955597,
-0.22067205607891083,
-0.6793186664581299,
-1.3018437623977661,
0.8279613852500916,
-0.06916406750679016,
0.1426718533039093,
0.6167895197868347,
-0.6061788201332092,
1.1525055170059204,
0.836959958076477,
0.9305238127708435,
0.18704888224601746,
0.2642520070075989,
0.36768239736557007,
-0.31018364429473877,
-1.0370159149169922,
-0.28414905071258545,
-1.1383432149887085,
-2.609593391418457,
0.48622989654541016,
-0.22905676066875458,
-1.436240553855896,
-0.04384665563702583,
-0.9674939513206482,
0.9470309019088745,
-0.5847738981246948,
-1.066240668296814,
-1.5129002332687378,
0.2217855155467987,
-0.00025786273181438446,
0.9355251789093018,
-1.6425741910934448,
-0.13055191934108734,
1.2681580781936646,
0.8631669878959656,
-0.6457212567329407,
0.945886492729187,
0.20975711941719055,
1.0319513082504272,
0.7449969053268433,
-0.38841676712036133,
0.5632966756820679,
0.0018944013863801956,
-1.286259651184082,
0.4691180884838104,
1.1675113439559937,
0.14936593174934387,
1.5226680040359497,
-0.3893427550792694,
0.06453406810760498,
0.38754090666770935,
-0.5615633726119995,
-0.5456515550613403,
-0.42161038517951965,
0.6744767427444458,
0.04357071593403816,
-0.8633942604064941,
0.020291123539209366,
-0.015298191457986832,
-0.2568173110485077,
0.20563460886478424,
-1.3870978355407715,
-0.18339957296848297,
-0.37311404943466187,
-0.5520909428596497,
-1.2532438039779663,
-0.15734489262104034,
1.3316872119903564,
-0.7179787755012512,
-0.20986224710941315,
0.5465753078460693,
0.3500526547431946,
0.5654042363166809,
0.6741500496864319,
-0.6760182976722717,
-0.36772218346595764,
-0.29948368668556213,
-0.2696693241596222,
0.3348270058631897,
1.24312162399292,
-0.11104389280080795,
-0.9500681757926941,
0.7515242099761963,
-0.2605403959751129,
0.08523928374052048,
1.8313151597976685,
0.00020139478147029877,
-0.788054883480072,
0.35348203778266907,
-0.6335054636001587,
1.9164484739303589,
1.6813000440597534,
1.2779040336608887,
-0.11600814759731293,
-0.9464979767799377,
0.6675404906272888,
-0.35533711314201355,
-0.37629568576812744,
0.7767043709754944,
0.35702940821647644,
-0.1766645312309265,
-1.4663865566253662,
0.7429274320602417,
1.277604103088379,
-0.8597723841667175,
-0.829785943031311,
0.1588001251220703,
-0.7508036494255066,
1.1298134326934814,
0.5879372358322144,
0.4203169345855713,
0.30198022723197937,
1.6812944412231445,
0.794296383857727,
-0.40261027216911316,
0.5403472781181335,
0.6018300652503967,
-0.221987783908844,
-2.091813325881958,
-1.190731406211853,
0.2883550524711609,
-0.5965062975883484,
-1.5593793392181396,
1.4058815240859985,
-1.1179225444793701,
-1.103232979774475,
0.6203775405883789,
0.09642432630062103,
1.4125478267669678,
0.37286293506622314,
1.6093751192092896,
2.0356454849243164,
0.8833154439926147,
0.4710199236869812,
1.252509355545044,
-0.10078807175159454,
-0.44505512714385986,
1.845595121383667,
-0.3903411030769348,
0.5006048679351807,
1.1081572771072388,
-0.2957691550254822,
-1.0690428018569946,
-0.7926371693611145,
-1.1776000261306763,
-0.7749365568161011,
1.2161309719085693,
0.07349555939435959,
-1.0072698593139648,
0.26244959235191345,
1.5956770181655884,
0.1097097173333168,
-0.38386985659599304,
0.5995893478393555,
0.3865424692630768,
-0.7816075086593628,
-0.01209300197660923,
-0.9260096549987793,
0.5104666948318481,
-0.17378030717372894,
-0.38599348068237305,
0.3202413320541382,
0.4523959159851074,
1.3350447416305542,
-0.1254758983850479,
0.14322079718112946,
0.9892311692237854,
-1.474744200706482,
1.544602394104004,
-0.6127983331680298,
0.2725115120410919,
-2.3522114753723145,
1.3059748411178589,
-0.8054678440093994,
1.9724215269088745,
-2.6643409729003906,
0.4151458144187927,
-0.527175784111023,
-0.4692729413509369,
0.3134128749370575,
-0.3621015250682831,
0.1079455316066742,
-0.092584989964962,
-1.105118989944458,
-0.047104258090257645,
-0.6621398329734802,
0.5824953317642212,
1.1572858095169067,
1.3457852602005005,
-1.124616026878357,
-0.32514867186546326,
-1.7089297771453857,
-0.10835269093513489,
-0.6913965940475464,
0.26063063740730286,
-2.0207784175872803,
-0.19330529868602753,
-1.8849340677261353,
-2.2232348918914795,
-1.3246861696243286,
-0.867684006690979,
1.099067211151123,
0.10458523780107498,
-0.8497797846794128,
1.2090086936950684,
-0.35813313722610474,
-1.8612474203109741,
1.0810292959213257,
-2.1806819438934326
] |
https://github.com/huggingface/datasets/issues/6051 | Skipping shard in the remote repo and resume upload | Hi! `_select_contiguous` fetches a (zero-copy) slice of the dataset's Arrow table to build a shard, so I don't think this part is the problem. To me, the issue seems to be the step where we embed external image files' bytes (a lot of file reads). You can use `.map` with multiprocessing to perform this step before `push_to_hub` in a faster manner and cache it to disk:
```python
from datasets.table import embed_table_storage
# load_dataset(...)
format = dataset.format
dataset = dataset.with_format("arrow")
dataset = dataset.map(embed_table_storage, batched=True)
dataset = dataset.with_format(**format)
# push_to_hub(...)
```
(In Datasets 3.0, these external bytes will be written to an Arrow file when generating a dataset to avoid this "embed" step) | ### Describe the bug
For some reason when I try to resume the upload of my dataset, it is very slow to reach the index of the shard from which to resume the uploading.
From my understanding, the problem is in this part of the code:
arrow_dataset.py
```python
for index, shard in logging.tqdm(
enumerate(itertools.chain([first_shard], shards_iter)),
desc="Pushing dataset shards to the dataset hub",
total=num_shards,
disable=not logging.is_progress_bar_enabled(),
):
shard_path_in_repo = path_in_repo(index, shard)
# Upload a shard only if it doesn't already exist in the repository
if shard_path_in_repo not in data_files:
```
In particular, iterating the generator is slow during the call:
```python
self._select_contiguous(start, length, new_fingerprint=new_fingerprint)
```
I wonder if it is possible to avoid calling this function for shards that are already uploaded and just start from the correct shard index.
### Steps to reproduce the bug
1. Start the upload
```python
dataset = load_dataset("imagefolder", data_dir=DATA_DIR, split="train", drop_labels=True)
dataset.push_to_hub("repo/name")
```
2. Stop and restart the upload after hundreds of shards
### Expected behavior
Skip the uploaded shards faster.
### Environment info
- `datasets` version: 2.5.1
- Platform: Linux-4.18.0-193.el8.x86_64-x86_64-with-glibc2.17
- Python version: 3.8.16
- PyArrow version: 12.0.1
- Pandas version: 2.0.2
| 57 | 111 | Skipping shard in the remote repo and resume upload
### Describe the bug
For some reason when I try to resume the upload of my dataset, it is very slow to reach the index of the shard from which to resume the uploading.
From my understanding, the problem is in this part of the code:
arrow_dataset.py
```python
for index, shard in logging.tqdm(
enumerate(itertools.chain([first_shard], shards_iter)),
desc="Pushing dataset shards to the dataset hub",
total=num_shards,
disable=not logging.is_progress_bar_enabled(),
):
shard_path_in_repo = path_in_repo(index, shard)
# Upload a shard only if it doesn't already exist in the repository
if shard_path_in_repo not in data_files:
```
In particular, iterating the generator is slow during the call:
```python
self._select_contiguous(start, length, new_fingerprint=new_fingerprint)
```
I wonder if it is possible to avoid calling this function for shards that are already uploaded and just start from the correct shard index.
### Steps to reproduce the bug
1. Start the upload
```python
dataset = load_dataset("imagefolder", data_dir=DATA_DIR, split="train", drop_labels=True)
dataset.push_to_hub("repo/name")
```
2. Stop and restart the upload after hundreds of shards
### Expected behavior
Skip the uploaded shards faster.
### Environment info
- `datasets` version: 2.5.1
- Platform: Linux-4.18.0-193.el8.x86_64-x86_64-with-glibc2.17
- Python version: 3.8.16
- PyArrow version: 12.0.1
- Pandas version: 2.0.2
Hi! `_select_contiguous` fetches a (zero-copy) slice of the dataset's Arrow table to build a shard, so I don't think this part is the problem. To me, the issue seems to be the step where we embed external image files' bytes (a lot of file reads). You can use `.map` with multiprocessing to perform this step before `push_to_hub` in a faster manner and cache it to disk:
```python
from datasets.table import embed_table_storage
# load_dataset(...)
format = dataset.format
dataset = dataset.with_format("arrow")
dataset = dataset.map(embed_table_storage, batched=True)
dataset = dataset.with_format(**format)
# push_to_hub(...)
```
(In Datasets 3.0, these external bytes will be written to an Arrow file when generating a dataset to avoid this "embed" step) | [
-1.2337567806243896,
-0.90196293592453,
-0.678459882736206,
1.487384557723999,
-0.22792723774909973,
-1.3088724613189697,
0.11573110520839691,
-1.0518202781677246,
1.6316242218017578,
-0.8330173492431641,
0.36152344942092896,
-1.6441075801849365,
0.030849676579236984,
-0.6168583035469055,
-0.7336971163749695,
-0.8600968718528748,
-0.5004979968070984,
-0.7417711615562439,
1.0920333862304688,
2.442368984222412,
1.2779862880706787,
-1.3373117446899414,
2.663069725036621,
0.7389970421791077,
-0.13337045907974243,
-1.008005976676941,
0.5681764483451843,
-0.05696944519877434,
-1.3800630569458008,
-0.49055907130241394,
-0.9164272546768188,
-0.07186185568571091,
-0.5715814232826233,
-0.4574339687824249,
-0.058592747896909714,
0.45068445801734924,
-0.31156983971595764,
-0.4177393913269043,
-0.5743576884269714,
-0.8111051917076111,
0.48351413011550903,
-0.34182289242744446,
1.0015891790390015,
-0.37182119488716125,
1.8272039890289307,
-0.5415825247764587,
0.5739861130714417,
0.7987245321273804,
1.349541425704956,
0.12895791232585907,
-0.07339281588792801,
0.3016209006309509,
0.3990970849990845,
-0.008896199986338615,
0.49192723631858826,
1.1366790533065796,
0.6759856939315796,
0.5126126408576965,
0.6954228281974792,
-2.2642714977264404,
1.353680968284607,
-1.039463758468628,
0.31915467977523804,
1.3722329139709473,
-0.9869458079338074,
0.3252853453159332,
-1.7550792694091797,
-0.058175716549158096,
0.5664023160934448,
-2.1981334686279297,
0.28208088874816895,
-1.3417479991912842,
-0.44480985403060913,
1.013415813446045,
0.4227803349494934,
-1.2477084398269653,
0.09098457545042038,
-0.4054650068283081,
1.0432038307189941,
0.41717857122421265,
1.047292709350586,
-1.6713855266571045,
-0.03900707885622978,
-0.29042088985443115,
0.12725554406642914,
-1.2212977409362793,
-1.553049921989441,
0.5594147443771362,
0.673181414604187,
0.5150609016418457,
-0.1895071119070053,
1.0354520082473755,
-1.0425944328308105,
0.7834643721580505,
-0.9381792545318604,
-1.6824321746826172,
-1.4559377431869507,
-2.340949535369873,
-2.283135175704956,
0.7552310824394226,
-0.4677733778953552,
-0.5569188594818115,
2.1499276161193848,
-1.176769495010376,
-1.6665596961975098,
1.1492308378219604,
0.17132991552352905,
0.059372756630182266,
2.394676923751831,
0.13498452305793762,
-0.7260299921035767,
0.47961190342903137,
-0.7642819881439209,
0.7344311475753784,
-0.4315917491912842,
1.2970620393753052,
0.3782739043235779,
-1.1497187614440918,
1.588239312171936,
-0.32628294825553894,
0.5885304808616638,
-0.6639055609703064,
-0.4823263883590698,
-0.7409040331840515,
0.2865149676799774,
1.840808391571045,
-0.31911948323249817,
1.470992088317871,
-0.2824063301086426,
-1.5089502334594727,
-1.5993562936782837,
0.9435166120529175,
0.4567137360572815,
-0.7191820740699768,
0.09543856233358383,
-0.36312246322631836,
0.14929336309432983,
-0.0446506105363369,
1.1132216453552246,
1.269506812095642,
0.7721238136291504,
-0.3855604827404022,
-0.8607205748558044,
0.17951546609401703,
-0.05530226603150368,
-0.7478744387626648,
-1.709507703781128,
-0.32294797897338867,
0.07837264984846115,
0.6693508625030518,
-1.1027562618255615,
1.8525348901748657,
0.957944929599762,
1.9567567110061646,
0.997471272945404,
-0.3753310441970825,
1.51962411403656,
0.09696115553379059,
1.8581173419952393,
-0.48165056109428406,
0.6287204027175903,
-0.34381410479545593,
-1.1997004747390747,
0.8340712785720825,
-0.26402634382247925,
-2.063399076461792,
-0.7431795597076416,
-0.6845407485961914,
-0.18638189136981964,
-0.7180735468864441,
0.9895925521850586,
-0.29996272921562195,
-1.2942841053009033,
0.2042667418718338,
-0.6687932014465332,
0.15023574233055115,
-1.1884956359863281,
0.3950079679489136,
0.7087992429733276,
-0.5975250601768494,
0.07823894172906876,
-0.2715972661972046,
-1.2314698696136475,
-0.45446252822875977,
0.33750489354133606,
1.827985167503357,
-0.7321612238883972,
0.978770911693573,
1.0678105354309082,
-0.661210298538208,
-0.1158369928598404,
0.3362983465194702,
-0.2824595868587494,
0.8293112516403198,
-0.9925419688224792,
-0.5223758816719055,
1.2453601360321045,
-0.27146974205970764,
-0.6154875755310059,
1.4915587902069092,
0.6893269419670105,
-1.0097055435180664,
-0.262732595205307,
-0.12246263772249222,
-0.8552379012107849,
0.0899268090724945,
-1.6418430805206299,
-0.050854600965976715,
0.5060604214668274,
-1.5585482120513916,
-0.41391685605049133,
-0.13738548755645752,
1.3123596906661987,
-0.13676851987838745,
1.4804519414901733,
-0.29731112718582153,
-0.1608545333147049,
-0.3873220682144165,
-0.3491549789905548,
0.10241173207759857,
-0.10993726551532745,
-0.5633689761161804,
0.21828636527061462,
-0.7332406044006348,
0.3954421579837799,
1.4427874088287354,
0.31749433279037476,
0.017037294805049896,
0.4907570779323578,
1.0944647789001465,
0.3791586756706238,
-0.13381950557231903,
-0.9232704043388367,
-1.546085238456726,
2.030433177947998,
-1.414153814315796,
2.0074234008789062,
0.8281375169754028,
-0.03790296986699104,
-1.7551099061965942,
-1.8667027950286865,
1.3262865543365479,
1.144059658050537,
2.2668569087982178,
0.5308912992477417,
0.41339531540870667,
-0.8677965402603149,
-0.6404852271080017,
0.37399518489837646,
-1.0277353525161743,
-0.7210312485694885,
0.15837128460407257,
2.359985113143921,
1.7972444295883179,
-0.31457674503326416,
-0.17526264488697052,
-1.105748176574707,
1.354956865310669,
-0.1479802131652832,
0.20938830077648163,
1.9835472106933594,
-0.25671085715293884,
-1.086856722831726,
1.234517216682434,
-2.3245649337768555,
0.1497488021850586,
2.047408103942871,
0.2646328806877136,
0.06471793353557587,
-1.4203792810440063,
-0.5465630888938904,
-0.2427622377872467,
-0.4041149914264679,
-1.2693995237350464,
0.6077096462249756,
-0.33866533637046814,
-0.6842174530029297,
-1.348427414894104,
0.20055340230464935,
-1.134090781211853,
-1.6757968664169312,
0.1294519007205963,
1.864619493484497,
2.0497405529022217,
-0.6830126643180847,
1.5622748136520386,
-0.2681933045387268,
0.13469593226909637,
1.2063521146774292,
1.2881721258163452,
3.148425817489624,
1.949645757675171,
-1.3789522647857666,
0.6128236651420593,
-0.19042666256427765,
-0.4722844660282135,
1.1629676818847656,
-1.2368316650390625,
1.3353370428085327,
-0.14665380120277405,
-1.2856532335281372,
-1.195057988166809,
0.9343278408050537,
0.4360649883747101,
0.11221752315759659,
-0.4786183834075928,
1.191691279411316,
0.1318052113056183,
1.360566258430481,
0.5610366463661194,
-0.3690239191055298,
0.6496949791908264,
-0.39443832635879517,
-0.5412927269935608,
1.5553380250930786,
0.22426804900169373,
-1.393402338027954,
-2.290755033493042,
-0.2533697485923767,
-0.8908997774124146,
0.09348299354314804,
-0.6932751536369324,
-0.9280837178230286,
1.618016004562378,
0.3722895383834839,
-1.3056226968765259,
-0.3035373389720917,
-0.31953299045562744,
-0.5707793831825256,
2.732940196990967,
-1.3507685661315918,
-0.22871913015842438,
-1.0462812185287476,
-0.6502271890640259,
1.6150676012039185,
-1.269022822380066,
-0.21696238219738007,
-1.0175433158874512,
-0.5227193236351013,
-1.1877332925796509,
-0.6277198195457458,
0.005058274604380131,
-0.9500988125801086,
0.8573604822158813,
0.18375509977340698,
-1.2750072479248047,
-0.38191547989845276,
-0.8922567367553711,
0.9108405113220215,
-0.1303987056016922,
0.19121673703193665,
1.7812434434890747,
0.3978542685508728,
-0.4086708724498749,
0.8028090000152588,
1.1567962169647217,
0.6818769574165344,
-0.5854315161705017,
0.2466200441122055,
-0.7206945419311523,
0.3587314486503601,
-1.230499505996704,
0.3004726469516754,
-2.8560307025909424,
0.5851266980171204,
-0.06025775149464607,
-0.05165344104170799,
-0.05510515347123146,
-1.3552335500717163,
1.0105946063995361,
2.57735276222229,
-1.2183319330215454,
0.502099335193634,
0.2725886404514313,
1.1751083135604858,
-1.6792534589767456,
0.2922021150588989,
-0.5350991487503052,
2.1385512351989746,
0.19337031245231628,
1.207167625427246,
-0.41381627321243286,
-2.3652184009552,
0.6014919281005859,
-1.330019235610962,
-1.1506848335266113,
0.7954616546630859,
-0.9137471914291382,
0.07106366008520126,
-1.3136755228042603,
-0.2693358063697815,
-0.8069401383399963,
-1.2014745473861694,
0.7003686428070068,
0.14589084684848785,
0.486020565032959,
-0.6145097017288208,
0.27604955434799194,
-2.204354763031006,
-1.2875555753707886,
-0.2963694632053375,
-0.9856960773468018,
0.4617612361907959,
-0.37318432331085205,
0.7074986696243286,
-0.1823211908340454,
-0.04365966096520424,
0.4123278558254242,
1.447935938835144,
3.3985345363616943,
0.195459246635437,
0.3197614252567291,
-0.18392935395240784,
-0.938692569732666,
1.4732571840286255,
0.9049115180969238,
-0.12741681933403015,
-0.6118022799491882,
-1.0041230916976929,
1.274325966835022,
1.9096965789794922,
0.9272371530532837,
0.007966888137161732,
-0.7816242575645447,
-0.7125744819641113,
-0.03954639658331871,
0.16157816350460052,
0.4865676462650299,
0.8726717233657837,
0.06528329104185104,
0.07314923405647278,
1.3811538219451904,
1.1862406730651855,
-0.352421373128891,
0.2833855450153351,
-0.8257800936698914,
-0.4565255045890808,
0.5596519708633423,
0.24358351528644562,
-0.042330484837293625,
0.36624908447265625,
-0.9527102708816528,
-0.20593012869358063,
-0.4184488356113434,
-0.8950109481811523,
-0.7282785177230835,
-0.37364596128463745,
-0.3892807364463806,
1.6669706106185913,
0.0788951888680458,
-0.542248010635376,
0.007905595935881138,
-0.7627795934677124,
-0.14079460501670837,
-1.0717521905899048,
0.2501736581325531,
-0.1407536268234253,
-0.09678574651479721,
-0.15127962827682495,
1.7684893608093262,
-0.9476463794708252,
-2.0795962810516357,
0.2634744346141815,
0.1426902711391449,
-0.21788522601127625,
0.2212018370628357,
1.6563445329666138,
0.4977547228336334,
1.429540753364563,
1.4011359214782715,
0.9955692887306213,
-0.6856331825256348,
-1.3299719095230103,
0.7903128266334534,
0.9949130415916443,
-1.4343352317810059,
0.8227210640907288,
-0.03608926385641098,
-0.5273606181144714,
0.663018524646759,
1.2145793437957764,
0.5351558923721313,
-2.077251434326172,
0.8104270100593567,
-1.0711919069290161,
0.8269333243370056,
0.765339732170105,
0.7047030329704285,
0.1941930204629898,
0.7955692410469055,
-1.160701036453247,
-1.1607857942581177,
-0.6326921582221985,
-0.7590445876121521,
1.9583085775375366,
-0.35090959072113037,
0.6301913857460022,
-0.1556616574525833,
-1.4048386812210083,
-0.12768402695655823,
0.6679036617279053,
0.2948802411556244,
-0.47049233317375183,
0.8317627906799316,
-0.7439082264900208,
-1.1927505731582642,
-1.3664841651916504,
-0.4440276324748993,
-1.084383487701416,
-0.9058203101158142,
1.1159576177597046,
0.7924146056175232,
0.2670268714427948,
1.8079849481582642,
0.6590767502784729,
0.2703622877597809,
-2.6320230960845947,
0.8509394526481628,
0.27071624994277954,
-0.09272062033414841,
0.8038785457611084,
0.36455580592155457,
0.9938639998435974,
0.0015496956184506416,
0.5407965183258057,
-2.5132431983947754,
2.3632912635803223,
-0.2596021294593811,
0.7151375412940979,
0.004197071306407452,
-0.24006880819797516,
1.073674201965332,
0.5426244735717773,
0.5500372052192688,
-1.0633150339126587,
0.7218159437179565,
-0.5476648807525635,
1.2122101783752441,
0.8185598254203796,
-0.8142513632774353,
-0.026592683047056198,
1.360748052597046,
0.5005437135696411,
-0.5871804356575012,
-0.9113787412643433,
-0.9985815286636353,
0.9487605690956116,
1.7840443849563599,
-0.0442657433450222,
0.08227471262216568,
0.8068153262138367,
0.7067267298698425,
-1.194595456123352,
0.08195142447948456,
-0.6857418417930603,
-0.7707301378250122,
1.5716946125030518,
2.0258538722991943,
-0.15652918815612793,
-0.2096499800682068,
-0.7868586778640747,
-1.231432318687439,
0.7900840640068054,
-0.03031308203935623,
0.04938720911741257,
0.5784181952476501,
-0.5745078921318054,
1.0650240182876587,
0.924768328666687,
0.9891169667243958,
0.28517207503318787,
0.21475735306739807,
0.3805500864982605,
-0.41419270634651184,
-1.104225993156433,
-0.14687013626098633,
-1.0291776657104492,
-2.611445188522339,
0.45408591628074646,
-0.2688278257846832,
-1.4459519386291504,
0.009729311801493168,
-1.0292091369628906,
0.8666695952415466,
-0.5230166912078857,
-1.1091209650039673,
-1.5069445371627808,
0.1457825005054474,
-0.03582637012004852,
0.8910927772521973,
-1.671420931816101,
-0.15280066430568695,
1.187508463859558,
0.8654392957687378,
-0.7163599729537964,
1.0232900381088257,
0.2412099987268448,
1.016477108001709,
0.854031503200531,
-0.35248976945877075,
0.4790397882461548,
0.05991574749350548,
-1.4102002382278442,
0.42885181307792664,
1.1695008277893066,
0.06877577304840088,
1.4552544355392456,
-0.5566988587379456,
0.013388876803219318,
0.3812996745109558,
-0.49603545665740967,
-0.5398036241531372,
-0.5241395235061646,
0.7185705304145813,
0.023177050054073334,
-0.8471294641494751,
0.031050924211740494,
-0.1367887705564499,
-0.23966734111309052,
0.11348538100719452,
-1.4788877964019775,
-0.19533951580524445,
-0.3650161921977997,
-0.6026400923728943,
-1.3117738962173462,
-0.1366853564977646,
1.4240243434906006,
-0.715322732925415,
-0.2023852914571762,
0.5118281245231628,
0.3741411566734314,
0.6010702252388,
0.6747812628746033,
-0.6407355666160583,
-0.3277674913406372,
-0.18267107009887695,
-0.3049633204936981,
0.3379477858543396,
1.3638120889663696,
-0.08751450479030609,
-0.8422901034355164,
0.7076956629753113,
-0.2849542200565338,
0.06729922443628311,
1.9548617601394653,
0.1935623437166214,
-0.7523084282875061,
0.2952728569507599,
-0.7399083971977234,
1.8755617141723633,
1.7151470184326172,
1.3504748344421387,
-0.08160117268562317,
-0.9989301562309265,
0.6529162526130676,
-0.3673171401023865,
-0.3732829988002777,
0.8626567721366882,
0.3769260346889496,
-0.2145882099866867,
-1.3582123517990112,
0.7676163911819458,
1.2334342002868652,
-0.8042402863502502,
-0.757841169834137,
0.12439937889575958,
-0.7383881211280823,
1.0720350742340088,
0.615304172039032,
0.37388506531715393,
0.21079808473587036,
1.5953315496444702,
0.8084926605224609,
-0.47875022888183594,
0.58686363697052,
0.5118035674095154,
-0.22067061066627502,
-2.115738868713379,
-1.1762893199920654,
0.3128913938999176,
-0.5099015235900879,
-1.5892385244369507,
1.372091293334961,
-1.161460280418396,
-1.0379739999771118,
0.5223749876022339,
0.03811846300959587,
1.4377191066741943,
0.36276543140411377,
1.5266915559768677,
2.0783708095550537,
0.8480502367019653,
0.4771314859390259,
1.339554786682129,
-0.18926680088043213,
-0.4236353933811188,
1.8070098161697388,
-0.47592681646347046,
0.4263910949230194,
1.1054972410202026,
-0.3578287661075592,
-1.0844471454620361,
-0.7406980395317078,
-1.1826990842819214,
-0.7372338175773621,
1.1885218620300293,
0.03463384881615639,
-0.9829161167144775,
0.31222113966941833,
1.5052239894866943,
0.08488161116838455,
-0.2322094738483429,
0.6185085773468018,
0.35515928268432617,
-0.7842084169387817,
-0.08572963625192642,
-0.9405531287193298,
0.5735734105110168,
-0.27444952726364136,
-0.35207802057266235,
0.37341558933258057,
0.4485834836959839,
1.2953341007232666,
-0.0565042644739151,
0.14852939546108246,
1.0843957662582397,
-1.4618436098098755,
1.4291331768035889,
-0.6996093392372131,
0.2736864686012268,
-2.3257944583892822,
1.3602832555770874,
-0.7575445175170898,
1.9016464948654175,
-2.6301963329315186,
0.3739706575870514,
-0.5695933103561401,
-0.5002127885818481,
0.33819580078125,
-0.2965412437915802,
0.09161651879549026,
-0.22479426860809326,
-1.1100742816925049,
-0.026736214756965637,
-0.6536775827407837,
0.621192455291748,
1.085298776626587,
1.3488065004348755,
-1.0807684659957886,
-0.2877819836139679,
-1.6962494850158691,
-0.13530080020427704,
-0.6934663653373718,
0.31322747468948364,
-1.9541088342666626,
-0.14830568432807922,
-1.9698495864868164,
-2.366447925567627,
-1.1725387573242188,
-0.8388245701789856,
1.1526199579238892,
0.2497282773256302,
-0.845248818397522,
1.232072114944458,
-0.3594874143600464,
-1.878743052482605,
1.0510467290878296,
-2.1976304054260254
] |
https://github.com/huggingface/datasets/issues/6051 | Skipping shard in the remote repo and resume upload | Hi, thanks, this solution saves some time.
But can't we avoid embedding all external image files bytes with each push, skipping the images that have already been pushed into the repo?
Edit: Ok I missed the part of cache it manually on the disk the first time, this solves the problem. Thank you | ### Describe the bug
For some reason when I try to resume the upload of my dataset, it is very slow to reach the index of the shard from which to resume the uploading.
From my understanding, the problem is in this part of the code:
arrow_dataset.py
```python
for index, shard in logging.tqdm(
enumerate(itertools.chain([first_shard], shards_iter)),
desc="Pushing dataset shards to the dataset hub",
total=num_shards,
disable=not logging.is_progress_bar_enabled(),
):
shard_path_in_repo = path_in_repo(index, shard)
# Upload a shard only if it doesn't already exist in the repository
if shard_path_in_repo not in data_files:
```
In particular, iterating the generator is slow during the call:
```python
self._select_contiguous(start, length, new_fingerprint=new_fingerprint)
```
I wonder if it is possible to avoid calling this function for shards that are already uploaded and just start from the correct shard index.
### Steps to reproduce the bug
1. Start the upload
```python
dataset = load_dataset("imagefolder", data_dir=DATA_DIR, split="train", drop_labels=True)
dataset.push_to_hub("repo/name")
```
2. Stop and restart the upload after hundreds of shards
### Expected behavior
Skip the uploaded shards faster.
### Environment info
- `datasets` version: 2.5.1
- Platform: Linux-4.18.0-193.el8.x86_64-x86_64-with-glibc2.17
- Python version: 3.8.16
- PyArrow version: 12.0.1
- Pandas version: 2.0.2
| 57 | 53 | Skipping shard in the remote repo and resume upload
### Describe the bug
For some reason when I try to resume the upload of my dataset, it is very slow to reach the index of the shard from which to resume the uploading.
From my understanding, the problem is in this part of the code:
arrow_dataset.py
```python
for index, shard in logging.tqdm(
enumerate(itertools.chain([first_shard], shards_iter)),
desc="Pushing dataset shards to the dataset hub",
total=num_shards,
disable=not logging.is_progress_bar_enabled(),
):
shard_path_in_repo = path_in_repo(index, shard)
# Upload a shard only if it doesn't already exist in the repository
if shard_path_in_repo not in data_files:
```
In particular, iterating the generator is slow during the call:
```python
self._select_contiguous(start, length, new_fingerprint=new_fingerprint)
```
I wonder if it is possible to avoid calling this function for shards that are already uploaded and just start from the correct shard index.
### Steps to reproduce the bug
1. Start the upload
```python
dataset = load_dataset("imagefolder", data_dir=DATA_DIR, split="train", drop_labels=True)
dataset.push_to_hub("repo/name")
```
2. Stop and restart the upload after hundreds of shards
### Expected behavior
Skip the uploaded shards faster.
### Environment info
- `datasets` version: 2.5.1
- Platform: Linux-4.18.0-193.el8.x86_64-x86_64-with-glibc2.17
- Python version: 3.8.16
- PyArrow version: 12.0.1
- Pandas version: 2.0.2
Hi, thanks, this solution saves some time.
But can't we avoid embedding all external image files bytes with each push, skipping the images that have already been pushed into the repo?
Edit: Ok I missed the part of cache it manually on the disk the first time, this solves the problem. Thank you | [
-1.228704571723938,
-0.9043618440628052,
-0.6839578747749329,
1.5109764337539673,
-0.23591430485248566,
-1.3173547983169556,
0.1201028823852539,
-1.0454732179641724,
1.6178052425384521,
-0.835773766040802,
0.34961482882499695,
-1.637833833694458,
0.06114544719457626,
-0.597659170627594,
-0.7309144139289856,
-0.8682023882865906,
-0.4822472631931305,
-0.7591851353645325,
1.0996440649032593,
2.4432764053344727,
1.2713624238967896,
-1.3261030912399292,
2.6648054122924805,
0.7387117743492126,
-0.15213124454021454,
-1.0129694938659668,
0.5825967788696289,
-0.04606802016496658,
-1.3792647123336792,
-0.47599512338638306,
-0.9170135259628296,
-0.08309967815876007,
-0.5672450661659241,
-0.4467024803161621,
-0.07260693609714508,
0.430767297744751,
-0.29801979660987854,
-0.42205438017845154,
-0.5799188017845154,
-0.7981120347976685,
0.4880681335926056,
-0.33949315547943115,
0.9931639432907104,
-0.3641071915626526,
1.8483794927597046,
-0.5409228205680847,
0.5567080974578857,
0.8044917583465576,
1.3333439826965332,
0.14224177598953247,
-0.07557852566242218,
0.28553444147109985,
0.4145236015319824,
-0.017287999391555786,
0.4972934424877167,
1.1220096349716187,
0.6707319021224976,
0.5149301886558533,
0.6989543437957764,
-2.265629529953003,
1.3520716428756714,
-1.0489099025726318,
0.3171033561229706,
1.3742808103561401,
-0.9650910496711731,
0.32161521911621094,
-1.7562880516052246,
-0.04391030594706535,
0.5513933897018433,
-2.1925365924835205,
0.3012837767601013,
-1.3341368436813354,
-0.4488774538040161,
1.0113328695297241,
0.41127705574035645,
-1.2397688627243042,
0.07803937792778015,
-0.4031028747558594,
1.0434166193008423,
0.4149293601512909,
1.041709542274475,
-1.6683192253112793,
-0.04704334959387779,
-0.28888610005378723,
0.11326772719621658,
-1.244552731513977,
-1.5407202243804932,
0.5420815944671631,
0.6764269471168518,
0.5145896673202515,
-0.1613810807466507,
1.0518311262130737,
-1.0422743558883667,
0.7953903675079346,
-0.9451480507850647,
-1.6588691473007202,
-1.455074429512024,
-2.3577802181243896,
-2.2726504802703857,
0.7421531081199646,
-0.47011980414390564,
-0.5588735938072205,
2.133387804031372,
-1.1700891256332397,
-1.664463758468628,
1.167833924293518,
0.1460105925798416,
0.053397633135318756,
2.3869664669036865,
0.14901019632816315,
-0.7227751612663269,
0.4732585549354553,
-0.7884117364883423,
0.7406023740768433,
-0.41053545475006104,
1.2978558540344238,
0.37093380093574524,
-1.1435527801513672,
1.5783381462097168,
-0.3398882746696472,
0.5918093919754028,
-0.647752046585083,
-0.48756659030914307,
-0.7429701089859009,
0.28429386019706726,
1.8470854759216309,
-0.30738767981529236,
1.4680290222167969,
-0.2780008316040039,
-1.5143991708755493,
-1.5868133306503296,
0.9406290054321289,
0.4637000560760498,
-0.7216934561729431,
0.09128889441490173,
-0.35823145508766174,
0.13439856469631195,
-0.04713689163327217,
1.1132194995880127,
1.2604775428771973,
0.7838214635848999,
-0.42463114857673645,
-0.8597480654716492,
0.18971671164035797,
-0.05599397420883179,
-0.7661831974983215,
-1.7008349895477295,
-0.3261009454727173,
0.07320867478847504,
0.6737215518951416,
-1.1242923736572266,
1.8460534811019897,
0.9694778919219971,
1.9664509296417236,
0.9899462461471558,
-0.38265031576156616,
1.5003949403762817,
0.10096333920955658,
1.8536165952682495,
-0.472467839717865,
0.6261249780654907,
-0.3669796288013458,
-1.2174599170684814,
0.847754180431366,
-0.26838603615760803,
-2.066866397857666,
-0.7565639615058899,
-0.6940391659736633,
-0.18846341967582703,
-0.7363191246986389,
0.9766172170639038,
-0.3098765015602112,
-1.3140308856964111,
0.2054842859506607,
-0.6556103229522705,
0.14853554964065552,
-1.2046319246292114,
0.3993091583251953,
0.7215924263000488,
-0.6150735020637512,
0.08001567423343658,
-0.2574612498283386,
-1.2179303169250488,
-0.4712732136249542,
0.3138259947299957,
1.834788203239441,
-0.7306937575340271,
0.9847047328948975,
1.0803509950637817,
-0.6592857241630554,
-0.10264580696821213,
0.32436850666999817,
-0.2849230170249939,
0.8247910737991333,
-0.9978760480880737,
-0.5035325288772583,
1.2582151889801025,
-0.26244229078292847,
-0.609704315662384,
1.4932047128677368,
0.7274640798568726,
-1.0089200735092163,
-0.2666280269622803,
-0.11189920455217361,
-0.8428474068641663,
0.08438720554113388,
-1.6222280263900757,
-0.031740639358758926,
0.5037580132484436,
-1.554004192352295,
-0.4081672728061676,
-0.15523801743984222,
1.3132820129394531,
-0.124399334192276,
1.4816333055496216,
-0.3110421895980835,
-0.1716161072254181,
-0.3911479413509369,
-0.34530577063560486,
0.12527936697006226,
-0.12243766337633133,
-0.5448832511901855,
0.23015885055065155,
-0.7189149260520935,
0.3800167739391327,
1.4512286186218262,
0.30409446358680725,
0.019052542746067047,
0.46758219599723816,
1.0926305055618286,
0.38666805624961853,
-0.11026934534311295,
-0.9244915843009949,
-1.5312517881393433,
2.011976957321167,
-1.411185622215271,
2.018913507461548,
0.8266667723655701,
-0.04404374957084656,
-1.7581491470336914,
-1.8806408643722534,
1.3255165815353394,
1.1527435779571533,
2.2522575855255127,
0.5236081480979919,
0.4124253988265991,
-0.8852459788322449,
-0.6402797698974609,
0.36940857768058777,
-1.0456252098083496,
-0.7187758088111877,
0.16112445294857025,
2.3561694622039795,
1.7806873321533203,
-0.3196685016155243,
-0.17017494142055511,
-1.1047719717025757,
1.3553032875061035,
-0.12935057282447815,
0.20720811188220978,
1.9812856912612915,
-0.26185181736946106,
-1.0971788167953491,
1.2421444654464722,
-2.33758544921875,
0.1639057844877243,
2.037961721420288,
0.27804821729660034,
0.06931442022323608,
-1.4271236658096313,
-0.559696614742279,
-0.2452780306339264,
-0.41500774025917053,
-1.258641242980957,
0.6146695017814636,
-0.32356807589530945,
-0.6926509141921997,
-1.3507272005081177,
0.20937977731227875,
-1.1365952491760254,
-1.6815723180770874,
0.14669278264045715,
1.8569717407226562,
2.0703492164611816,
-0.7057243585586548,
1.562809705734253,
-0.28304150700569153,
0.1457480937242508,
1.1975783109664917,
1.300986409187317,
3.1579020023345947,
1.9421721696853638,
-1.3680427074432373,
0.6059360504150391,
-0.16923585534095764,
-0.4760698080062866,
1.1437184810638428,
-1.2276408672332764,
1.3308018445968628,
-0.12900789082050323,
-1.2728512287139893,
-1.1790636777877808,
0.9328045845031738,
0.42863959074020386,
0.11957010626792908,
-0.4678685665130615,
1.1789571046829224,
0.15366464853286743,
1.3710359334945679,
0.5670675039291382,
-0.3557983338832855,
0.6476774215698242,
-0.4038623869419098,
-0.5256544947624207,
1.5548425912857056,
0.2170242965221405,
-1.3930764198303223,
-2.300875425338745,
-0.2572968304157257,
-0.881786584854126,
0.07505102455615997,
-0.683070182800293,
-0.9479402899742126,
1.625239372253418,
0.37703660130500793,
-1.3052401542663574,
-0.300563246011734,
-0.3167652189731598,
-0.5636900067329407,
2.7104856967926025,
-1.3567148447036743,
-0.22729624807834625,
-1.0247527360916138,
-0.6582937240600586,
1.612783432006836,
-1.271592378616333,
-0.21260966360569,
-1.0171226263046265,
-0.5198855996131897,
-1.2056125402450562,
-0.6178481578826904,
0.03162412345409393,
-0.9597651958465576,
0.8613771200180054,
0.20068906247615814,
-1.2662734985351562,
-0.38496601581573486,
-0.8938722014427185,
0.9129948616027832,
-0.13183467090129852,
0.20539988577365875,
1.7740364074707031,
0.3991423547267914,
-0.4088329076766968,
0.7967033386230469,
1.1592251062393188,
0.6895012259483337,
-0.6010379791259766,
0.251801460981369,
-0.7123509049415588,
0.33898013830184937,
-1.2289483547210693,
0.309429794549942,
-2.852731466293335,
0.5859745144844055,
-0.06624972820281982,
-0.05783282592892647,
-0.06597563624382019,
-1.3517206907272339,
1.033075213432312,
2.570566177368164,
-1.2037694454193115,
0.49003443121910095,
0.28504323959350586,
1.1857496500015259,
-1.6702464818954468,
0.31009846925735474,
-0.5211763381958008,
2.139895439147949,
0.19774314761161804,
1.227479338645935,
-0.41237178444862366,
-2.38010835647583,
0.6116867661476135,
-1.3468440771102905,
-1.1347756385803223,
0.8142577409744263,
-0.9079391360282898,
0.05981447547674179,
-1.316035509109497,
-0.27948421239852905,
-0.8119747042655945,
-1.2032660245895386,
0.6941831707954407,
0.1552603393793106,
0.48307177424430847,
-0.6175339818000793,
0.2662760019302368,
-2.207716464996338,
-1.2841260433197021,
-0.27472707629203796,
-0.9950864911079407,
0.45826655626296997,
-0.3858832120895386,
0.7148746252059937,
-0.19091428816318512,
-0.041730497032403946,
0.4207777678966522,
1.4697370529174805,
3.422948122024536,
0.19480375945568085,
0.32337328791618347,
-0.16848474740982056,
-0.9459398984909058,
1.4683661460876465,
0.9132167100906372,
-0.109221450984478,
-0.6002305746078491,
-1.009238839149475,
1.2353448867797852,
1.911766529083252,
0.9511762857437134,
-0.006541423499584198,
-0.7861744165420532,
-0.7058963775634766,
-0.056287653744220734,
0.16799286007881165,
0.48621973395347595,
0.8734109401702881,
0.0563146248459816,
0.07591401785612106,
1.3867961168289185,
1.176732063293457,
-0.37994080781936646,
0.2940128743648529,
-0.8200379610061646,
-0.4794737994670868,
0.5596126317977905,
0.24313221871852875,
-0.06046314164996147,
0.3654157221317291,
-0.9687808156013489,
-0.22146710753440857,
-0.41732537746429443,
-0.8975821733474731,
-0.7181075811386108,
-0.38028684258461,
-0.38652974367141724,
1.6497950553894043,
0.08143994212150574,
-0.5329153537750244,
0.023579664528369904,
-0.747759222984314,
-0.1520443558692932,
-1.0676206350326538,
0.23267313838005066,
-0.17066924273967743,
-0.08870898932218552,
-0.1383831799030304,
1.781697392463684,
-0.9425588846206665,
-2.0744056701660156,
0.26922842860221863,
0.1603982299566269,
-0.20296351611614227,
0.21506710350513458,
1.6365454196929932,
0.4862602949142456,
1.4398410320281982,
1.3994226455688477,
0.999700665473938,
-0.692752480506897,
-1.358072280883789,
0.8154308199882507,
1.0086089372634888,
-1.4417774677276611,
0.8125412464141846,
-0.04866030812263489,
-0.5257320404052734,
0.6650962233543396,
1.215242862701416,
0.5189864635467529,
-2.071570634841919,
0.8030419945716858,
-1.0553951263427734,
0.80748051404953,
0.774660587310791,
0.6954814195632935,
0.1812334805727005,
0.7845970392227173,
-1.1791434288024902,
-1.1587088108062744,
-0.6359027028083801,
-0.7487035989761353,
1.934775471687317,
-0.3678581416606903,
0.6263757944107056,
-0.1586126983165741,
-1.3824459314346313,
-0.12621647119522095,
0.6790077090263367,
0.28080540895462036,
-0.4723450541496277,
0.8252383470535278,
-0.7556443214416504,
-1.187980055809021,
-1.3723301887512207,
-0.4306444227695465,
-1.0937221050262451,
-0.8990345001220703,
1.1116268634796143,
0.784834623336792,
0.2622394263744354,
1.8223121166229248,
0.6783742904663086,
0.2656591534614563,
-2.64361572265625,
0.868053138256073,
0.2543427646160126,
-0.08715564757585526,
0.802842378616333,
0.35893163084983826,
0.9932440519332886,
0.03206196799874306,
0.5463810563087463,
-2.5169835090637207,
2.399829626083374,
-0.25694191455841064,
0.7123514413833618,
0.0018110312521457672,
-0.24840383231639862,
1.079972743988037,
0.5703396797180176,
0.5390801429748535,
-1.0646692514419556,
0.6991608738899231,
-0.5596018433570862,
1.2204159498214722,
0.8181807994842529,
-0.8226629495620728,
-0.02655140310525894,
1.3420687913894653,
0.5148924589157104,
-0.5714311003684998,
-0.8928929567337036,
-1.0165866613388062,
0.9443305134773254,
1.761942982673645,
-0.03202011063694954,
0.0668870359659195,
0.7956832051277161,
0.7001951932907104,
-1.1913275718688965,
0.07011698931455612,
-0.7020251750946045,
-0.7867382168769836,
1.5830053091049194,
2.046558380126953,
-0.14760616421699524,
-0.21454066038131714,
-0.7973780035972595,
-1.2246228456497192,
0.809328556060791,
-0.04151821881532669,
0.0651443749666214,
0.5776065587997437,
-0.5713353753089905,
1.0683263540267944,
0.9207415580749512,
0.9684550762176514,
0.31820520758628845,
0.20237286388874054,
0.3827182352542877,
-0.40731480717658997,
-1.0944793224334717,
-0.14248046278953552,
-1.0439671277999878,
-2.6172032356262207,
0.45336589217185974,
-0.25813862681388855,
-1.4403843879699707,
0.005914776585996151,
-1.036720633506775,
0.8786113262176514,
-0.5309873819351196,
-1.0797654390335083,
-1.5102092027664185,
0.13986457884311676,
-0.04038434848189354,
0.9119725227355957,
-1.6671438217163086,
-0.1467561572790146,
1.187636375427246,
0.8678491115570068,
-0.7102791666984558,
1.027347207069397,
0.22427934408187866,
1.0032322406768799,
0.855276882648468,
-0.36094075441360474,
0.47845572233200073,
0.06416253745555878,
-1.4012342691421509,
0.4032413065433502,
1.1730537414550781,
0.06555358320474625,
1.4621787071228027,
-0.5395427346229553,
0.02097216248512268,
0.38095906376838684,
-0.5002768039703369,
-0.5394724011421204,
-0.5372097492218018,
0.7131549119949341,
0.03636547178030014,
-0.8419260382652283,
0.03616313636302948,
-0.13836385309696198,
-0.24983471632003784,
0.12188142538070679,
-1.4772758483886719,
-0.21122406423091888,
-0.37081292271614075,
-0.6062433123588562,
-1.3277208805084229,
-0.1258884221315384,
1.4351381063461304,
-0.7134637832641602,
-0.18166127800941467,
0.506057858467102,
0.35308024287223816,
0.585713803768158,
0.6914894580841064,
-0.6541504859924316,
-0.3383365571498871,
-0.20524439215660095,
-0.2937467694282532,
0.3476657569408417,
1.3705185651779175,
-0.09538822621107101,
-0.8510226011276245,
0.7133631110191345,
-0.27471333742141724,
0.05974440276622772,
1.9487276077270508,
0.19753332436084747,
-0.7694099545478821,
0.2975751757621765,
-0.7305939793586731,
1.898545265197754,
1.696263313293457,
1.340859055519104,
-0.0995272845029831,
-0.9814994931221008,
0.6567543745040894,
-0.36800116300582886,
-0.35671934485435486,
0.8719167709350586,
0.36827531456947327,
-0.21347983181476593,
-1.3836336135864258,
0.7683832049369812,
1.2560762166976929,
-0.8164775967597961,
-0.7548648715019226,
0.15085791051387787,
-0.731731116771698,
1.060798168182373,
0.609004020690918,
0.3846302032470703,
0.22614122927188873,
1.586686611175537,
0.8231459259986877,
-0.4748479425907135,
0.5944653749465942,
0.5161910653114319,
-0.1988295316696167,
-2.1144187450408936,
-1.1679692268371582,
0.3234936594963074,
-0.5265353918075562,
-1.57208251953125,
1.3761097192764282,
-1.1434566974639893,
-1.0447670221328735,
0.541057288646698,
0.02263393998146057,
1.4261339902877808,
0.3667137324810028,
1.5362356901168823,
2.056978940963745,
0.8397693037986755,
0.4570539891719818,
1.3256193399429321,
-0.20201587677001953,
-0.4282276928424835,
1.8037282228469849,
-0.4606095850467682,
0.4189760386943817,
1.1138602495193481,
-0.3555126190185547,
-1.0615371465682983,
-0.7483879327774048,
-1.1862574815750122,
-0.7447010278701782,
1.188305139541626,
0.048487138003110886,
-0.9817389249801636,
0.3048039674758911,
1.505866289138794,
0.07822099328041077,
-0.25425660610198975,
0.6000908613204956,
0.3524427115917206,
-0.7749728560447693,
-0.08418545871973038,
-0.9397168755531311,
0.5724608898162842,
-0.26900461316108704,
-0.36910659074783325,
0.37901633977890015,
0.4537079632282257,
1.3024840354919434,
-0.08943026512861252,
0.14382854104042053,
1.0602905750274658,
-1.4613388776779175,
1.4262266159057617,
-0.7188724875450134,
0.25154808163642883,
-2.325192451477051,
1.3522553443908691,
-0.7539950013160706,
1.8995436429977417,
-2.6247167587280273,
0.3780437409877777,
-0.5675100684165955,
-0.5115915536880493,
0.3569408059120178,
-0.310339093208313,
0.107818603515625,
-0.22964408993721008,
-1.1035053730010986,
-0.046031806617975235,
-0.6747137904167175,
0.6274762749671936,
1.0855480432510376,
1.3483692407608032,
-1.0697335004806519,
-0.2850068509578705,
-1.69120454788208,
-0.13176117837429047,
-0.6823951005935669,
0.3188716173171997,
-1.964604139328003,
-0.16827084124088287,
-1.9746894836425781,
-2.3352129459381104,
-1.1739850044250488,
-0.8417510986328125,
1.1512571573257446,
0.24959062039852142,
-0.8291551470756531,
1.2158429622650146,
-0.35278308391571045,
-1.8700352907180786,
1.0496413707733154,
-2.1970717906951904
] |