html_url
stringlengths
48
51
title
stringlengths
5
280
comments
stringlengths
63
51.8k
body
stringlengths
0
36.2k
comment_length
int64
16
1.52k
text
stringlengths
159
54.1k
embeddings
listlengths
768
768
https://github.com/huggingface/datasets/issues/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
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.
[ -0.5046077370643616, -0.41358450055122375, -0.15014885365962982, 0.4784199595451355, 0.1318594366312027, -0.006352901458740234, 0.22309695184230804, -0.05357160046696663, -0.0247789453715086, 0.07532718032598495, 0.13872188329696655, 0.24004310369491577, -0.2916395962238312, -0.12241759151220322, -0.3018485903739929, -0.07861778140068054, -0.020911596715450287, -0.11754271388053894, -0.22647976875305176, -0.019411422312259674, -0.48551756143569946, 0.25808578729629517, -0.10476352274417877, -0.031453341245651245, -0.040395338088274, -0.4484356939792633, -0.09809011965990067, 0.8303667306900024, -0.3918516933917999, -0.5647463798522949, 0.000574873760342598, 0.09858754277229309, 0.031415753066539764, 0.900989294052124, -0.0001153585035353899, -0.0391036719083786, 0.47987276315689087, 0.07222267985343933, -0.2291751205921173, 0.04047428071498871, -0.19416949152946472, -0.053676947951316833, 0.1568792313337326, -0.11828126013278961, 0.3793048858642578, -0.045122139155864716, -0.09616199135780334, -0.4131332337856293, 0.32035210728645325, 0.26049187779426575, 0.17469456791877747, 0.23649105429649353, 0.06836241483688354, -0.21454286575317383, -0.4456839859485626, 0.08172377943992615, -0.05255298316478729, 0.7022655606269836, 0.09630310535430908, 0.04329891502857208, 0.2792907953262329, -0.23577414453029633, -0.26140767335891724, 0.06488330662250519, 0.0208359993994236, -0.3101223409175873, 0.40012162923812866, -0.5286166667938232, -0.010670658200979233, 0.23620247840881348, 0.2483225166797638, -0.20530152320861816, -0.28006303310394287, 0.13336390256881714, -0.2758300006389618, -0.42603302001953125, 0.08083559572696686, 0.26321500539779663, -0.18832075595855713, 0.23991216719150543, 0.209743469953537, 0.03643442317843437, -0.049149639904499054, -0.18234996497631073, 0.017551325261592865, 0.3273860216140747, 0.1925852745771408, 0.011543340981006622, 0.09737423062324524, 0.29632771015167236, 0.03266017138957977, 0.26047682762145996, -0.09144161641597748, -0.002039186656475067, -0.08354851603507996, 0.11602349579334259, -0.0820358619093895, -0.43092069029808044, 0.1459634006023407, 0.13704447448253632, -0.19572767615318298, -0.14321041107177734, -0.051798976957798004, 0.2612828016281128, 0.04089422523975372, -0.13480830192565918, 0.056649237871170044, 0.40281403064727783, 0.11848490685224533, 0.11236350238323212, -0.017272528260946274, -0.024507563561201096, -0.17178435623645782, 0.005762244574725628, -0.025698157027363777, 0.15374886989593506, 0.3790775537490845, 0.0016457252204418182, -0.19631977379322052, 0.14626382291316986, 0.2067624032497406, 0.1836918294429779, 0.18499045073986053, 0.3633743226528168, 0.1953449845314026, 0.43399080634117126, 0.07049784064292908, 0.0997941717505455, -0.165062814950943, 0.267775297164917, -0.2406432032585144, 0.1383131891489029, 0.030297856777906418, 0.2922637164592743, -0.1626410335302353, 0.2357293665409088, 0.35963886976242065, 0.057611361145973206, -0.21390150487422943, -0.0309776458889246, 0.3621942102909088, -0.3815597593784332, -0.14284977316856384, 0.46911516785621643, -0.19004201889038086, -0.09720856696367264, 0.24188074469566345, 0.16415131092071533, 0.12774184346199036, 0.2130621075630188, -0.07844626158475876, -0.28703415393829346, -0.3929480016231537, 0.2064146101474762, -0.15389001369476318, 0.2551942467689514, -0.3124268054962158, 0.06644022464752197, 0.4429943561553955, -0.2519279420375824, 0.22149181365966797, -0.09740191698074341, -0.7441145777702332, -0.23855911195278168, 0.0002990681678056717, 0.5459442734718323, -0.2587133049964905, -0.0035391487181186676, -0.2477894127368927, -0.24505946040153503, 0.36456358432769775, 0.2787029445171356, 0.11514626443386078, 0.26048561930656433, -0.3108530342578888, 0.21564356982707977, -0.03128352016210556, -0.3737500011920929, -0.10036153346300125, 0.17350155115127563, -0.18870809674263, 0.06130523234605789, 0.33679327368736267, -0.152590811252594, 0.17825764417648315, -0.09383033215999603, 0.18643403053283691, 0.018806904554367065, 0.20923908054828644, 0.03316640853881836, -0.5459012389183044, -0.20610639452934265, 0.30215197801589966, -0.005090903490781784, 0.2789570093154907, 0.5058116912841797, 0.13193731009960175, -0.11432033777236938, 0.20918011665344238, 0.05613967403769493, -0.1384204924106598, 0.17357029020786285, 0.27736106514930725, 0.03060879558324814, 0.027710970491170883, -0.352469801902771, -0.09472181648015976, 0.2475343644618988, -0.28759437799453735, 0.3053940534591675, -0.026895195245742798, -0.07469817996025085, -0.10680034011602402, 0.16504918038845062, 0.015182297676801682, -0.08993278443813324, 0.17108455300331116, 0.06735330075025558, -0.18130026757717133, -0.06160110980272293, -0.15381813049316406, 0.43233558535575867, -0.2006920576095581, 0.1417226493358612, -0.10372424125671387, 0.008659405633807182, -0.1883886158466339, -0.2395588904619217, -0.10550197958946228, 0.0010149553418159485, 0.15922129154205322, 0.11520620435476303, -0.04580126702785492, 0.34247657656669617, 0.2969813942909241, 0.04851685091853142, 0.15696510672569275, -0.20893914997577667, 0.24551960825920105, 0.09076303243637085, -0.07971915602684021, 0.1319352090358734, 0.21814033389091492, -0.1587190330028534, 0.5451523065567017, -0.1150340586900711, 0.028577756136655807, 0.18136495351791382, 0.17182821035385132, -0.07661774009466171, 0.21720223128795624, -0.0030084513127803802, 0.19035133719444275, 0.012612149119377136, 0.2620103657245636, 0.33066362142562866, 0.21381430327892303, -0.11851830780506134, -0.11966263502836227, -0.09230297058820724, -0.1592223048210144, 0.09078332781791687, 0.1206865906715393, -0.1548769176006317, 0.11037740856409073, 0.12904614210128784, 0.31212517619132996, 0.06366629898548126, 0.7765316367149353, 0.20191286504268646, -0.043975237756967545, 0.24416986107826233, 0.03788161277770996, -0.10712621361017227, 0.21881067752838135, 0.4057523012161255, 0.372566282749176, 0.2808108627796173, 0.1358053982257843, -0.0014334795996546745, -0.40746524930000305, -0.4201221168041229, 0.07864868640899658, 0.5111544132232666, -0.41004475951194763, 0.021265791729092598, -0.06408201903104782, 0.43577730655670166, 0.21124567091464996, -0.004586269147694111, -0.03433743491768837, -0.14124444127082825, -0.19698995351791382, 0.6102404594421387, 0.033252615481615067, -0.0695345550775528, -0.39263153076171875, 0.09783560782670975, -0.06034260243177414, 0.2484496682882309, -0.45717838406562805, -0.109857939183712, 0.06693306565284729, 0.006944090127944946, 0.46021178364753723, 0.1708892285823822, 0.4271616041660309, 0.10693471878767014, -0.4408295750617981, 0.2159026563167572, -0.11113840341567993, -0.037374354898929596, -0.052600741386413574, 0.27779778838157654, 0.18656256794929504, 0.48896247148513794, 0.02871222048997879, -0.48347097635269165, 0.12297351658344269, 0.011786168441176414, -0.25833001732826233, -0.23171836137771606, -0.014569015242159367, -0.18908803164958954, -0.34960708022117615, -0.26440003514289856, -0.5475119352340698, -0.5366696715354919, 0.34930193424224854, 0.08405531942844391, 0.2894158959388733, 0.13980281352996826, 0.05716631934046745, 0.037527818232774734, 0.27891844511032104, 0.17643560469150543, -0.1806933879852295, 0.10977834463119507, -0.1512003242969513, -0.21197400987148285, -0.10648010671138763, -0.03761844336986542, -0.10564500838518143, 0.1807231605052948, -0.1677868664264679, -0.2548457086086273, -0.42185476422309875, -0.21028923988342285, -0.033207688480615616, -0.3066951036453247, -0.3556431233882904, 0.3814227879047394, 0.17507025599479675, -0.16488182544708252, -0.0015325509011745453, -0.0233384370803833, 0.15151485800743103, -0.12046719342470169, 0.03562196344137192, 0.01359282061457634, 0.49012768268585205, 0.10606573522090912, 0.20449399948120117, 0.15775887668132782, -0.0825798511505127, 0.1246979758143425, -0.32692480087280273, 0.0739186555147171, 0.026980139315128326, -0.3783930242061615, 0.06559878587722778, 0.06712117791175842, -0.3000867962837219, 0.06255680322647095, -0.30102139711380005, 0.11524596065282822, -0.05586577206850052, 0.011505458503961563, -0.271042138338089, 0.07983365654945374, -0.24933244287967682, -0.06772742420434952, 0.00579833984375, -0.15247400104999542, -0.014013871550559998, 0.1145627349615097, 0.27717241644859314, -0.07195891439914703, 0.25380486249923706, -0.005684569478034973, -0.12298593670129776, -0.0982135757803917, 0.3143468201160431, -0.3831932842731476, 0.24003712832927704, 0.20762264728546143, 0.4220287501811981, -0.17593833804130554, 0.039809033274650574, -0.10282757878303528, -0.23141145706176758, 0.7300938963890076, -0.17631922662258148, 0.018303951248526573, 0.24201852083206177, -0.17649997770786285, -0.477647602558136, -0.06741194427013397, -0.15229836106300354, 0.18443544209003448, 0.21277116239070892, 0.31468039751052856, -0.29019007086753845, 0.11926931142807007, 0.12951385974884033, -0.26962268352508545, 0.013116735965013504, -0.39981338381767273, -0.43894657492637634, -0.5271481871604919, -0.4468167722225189, 0.19017824530601501, -0.03916092962026596, 0.06976501643657684, -0.3610367774963379, -0.15369635820388794, -0.04128675162792206, -0.03346315026283264, 0.11834593862295151, -0.08606301248073578, 0.16827327013015747, -0.1704890877008438, 0.1613008975982666, -0.009798411279916763, 0.04548981413245201, 0.4208812117576599, 0.11789549142122269, 0.242380753159523, -0.2318161427974701, -0.07538873702287674, 0.0922076627612114, -0.035412050783634186, 0.11723942309617996, 0.032780133187770844, 0.06001535803079605, 0.36652666330337524, 0.0953293889760971, 0.054859988391399384, 0.2330472767353058, 0.1156785637140274, -0.13205157220363617, -0.03778921812772751, -0.15420344471931458, 0.16202232241630554, 0.295206755399704, 0.07546283304691315, 0.3343902826309204, -0.6096521615982056, -0.30530303716659546, -0.003894267836585641, 0.13954859972000122, 0.9121222496032715, -0.020982936024665833, -0.19106826186180115, 0.4774819314479828, -0.1061575710773468, 0.032284822314977646, 0.17351116240024567, -0.21475118398666382, -0.30205872654914856, -0.0795074850320816, -0.06532448530197144, -0.10421773791313171, 0.22956117987632751, -0.17316533625125885, -0.3751775026321411, 0.051639094948768616, -0.18785330653190613, -0.11324605345726013, 0.13298480212688446, 0.290146142244339, 0.03630411624908447, -0.09171754121780396, -0.030650220811367035, 0.09111393988132477, -0.05010376125574112, -0.28252163529396057, -0.3405650854110718, -0.1739998310804367, -0.06981884688138962, -0.21127943694591522, -0.25193914771080017, 0.0478380024433136, -0.599179208278656, 0.33663904666900635, -0.30564549565315247, 0.022358335554599762, -0.1391681581735611, 0.04669712483882904, 0.08427216112613678, -0.012474697083234787, -0.08286873251199722, 0.02909277379512787, -0.10939057916402817, -0.013139767572283745, 0.16954854130744934, -0.05478071793913841, 0.17753013968467712, -0.2238318920135498, -0.3296949863433838, -0.1924213469028473, -0.30935704708099365, -0.14472314715385437, -0.1636698991060257, 0.2634749710559845, 0.19098447263240814, 0.15993908047676086, -0.018897540867328644, 0.10473648458719254, -0.38701167702674866, -0.19963368773460388, 0.14380067586898804, 0.055626869201660156, -0.30960309505462646, 0.1935443878173828, -0.18755558133125305, -0.37473317980766296, -0.09504063427448273, 0.6572676301002502, 0.14735788106918335, -0.025582756847143173, 0.2981140911579132, 0.04362558200955391, -0.121665820479393, -0.27386870980262756, -0.2264394462108612, -0.30123773217201233, 0.13889408111572266, 0.3230878710746765, 0.28772398829460144, -0.22028174996376038, -0.07395357638597488, -0.016885768622159958, 0.06795453280210495, 0.14387616515159607, -0.22241994738578796, -0.46247127652168274, -0.488525390625, 0.19827145338058472, -0.5827509164810181, 0.14425964653491974, 0.12463254481554031, 0.014933070167899132, -0.19607789814472198, -0.050321586430072784, -0.28446537256240845, -0.11097177118062973, -0.23528385162353516, -0.13296115398406982, 0.2222048044204712, -0.1628653109073639, -0.08300314098596573, -0.06494034826755524, 0.17748473584651947, 0.365378201007843, -0.17029497027397156, -0.22258499264717102, -0.011241268366575241, 0.11669445782899857, 0.0915130004286766, -0.058891937136650085, -0.0750468522310257, -0.1528329998254776, -0.2658279538154602, 0.11000027507543564, -0.15295805037021637, 0.29421737790107727, -0.1946774572134018, -0.050154101103544235, 0.1720838099718094, 0.48293405771255493, -0.22067546844482422, 0.42271339893341064, 0.07712644338607788, -0.1435152292251587, -0.05835855007171631, 0.32814887166023254, 0.0620279498398304, -0.03966378793120384, 0.2570473253726959, -0.05858825892210007, 0.23123912513256073, 0.10392829030752182, 0.24077782034873962, -0.27090132236480713, -0.10844554007053375, -0.06904333084821701, 0.1926746368408203, 0.2859032154083252, 0.009549276903271675, 0.0561419278383255, -0.1514468789100647, 0.20079727470874786, -0.137716144323349, -0.033608533442020416, 0.37454384565353394, -0.16782690584659576, -0.015616312623023987, 0.2525109052658081, -0.034074585884809494, -0.4416932463645935, -0.22312720119953156, 0.22115537524223328, 0.31728336215019226, -0.3844778537750244, 0.036309823393821716, -0.1710072159767151, -0.43782103061676025, 0.11139994859695435, 0.07792870700359344, 0.15880529582500458, 0.32343631982803345, 0.5661433935165405, 0.30246537923812866, 0.21563008427619934, -0.05731247365474701, -0.05705610290169716, 0.03887991979718208, -0.16407880187034607, -0.16627047955989838, 0.13669699430465698, 0.02805706113576889, 0.09609171748161316, 0.020925290882587433, 0.2842053771018982, -0.05119587108492851, -0.20819619297981262, -0.037214748561382294, -0.04812240228056908, -0.25675562024116516, 0.1510598212480545, -0.5365152359008789, 0.15028953552246094, 0.14637446403503418, -0.357791006565094, 0.358404278755188, -0.1478288769721985, 0.23698005080223083, 0.07208390533924103, -0.2791222929954529, -0.07801056653261185, -0.3996746242046356, 0.6140224933624268, -0.15897881984710693, -0.3779069185256958, 0.14274972677230835, 0.6060832142829895, -0.08773937821388245, -0.03927646204829216, 0.3408096730709076, 0.6808923482894897, 0.5342673659324646, -0.1027805507183075, -0.11870523542165756, -0.03358568996191025, 0.035248853266239166, -0.1724555790424347, 0.28420841693878174, 0.025276701897382736, 0.43888822197914124, 0.09820431470870972, 0.1549234539270401, -0.16608302295207977, 0.0028641223907470703, 0.36129480600357056, 0.26943886280059814, -0.12067387998104095, 0.35562944412231445, -0.13597065210342407, -0.411370187997818, 0.2570267915725708, 0.13614532351493835, -0.4632718563079834, 0.15202827751636505, 0.42092570662498474, -0.12471514195203781, 0.20774587988853455, 0.16776971518993378, 0.05487756431102753, -0.2723173201084137, 0.31484365463256836, 0.30561205744743347, -0.005052357912063599, -0.1046130359172821, 0.17520077526569366, -0.34483811259269714, 0.2518084645271301, 0.16260789334774017, -0.06968144327402115, -0.1265081912279129, 0.012587148696184158, 0.15599635243415833, 0.1442175954580307, -0.007144734263420105, -0.10354985296726227, 0.08746597170829773, 0.3139454424381256, -0.2600236237049103, 0.15626707673072815, -0.06606733798980713, -0.125923752784729, 0.1657819300889969, -0.4529016613960266, 0.25093239545822144, -0.374847948551178, 0.053018078207969666, 0.2591269016265869, -0.005518883466720581, -0.11725999414920807, -0.06938314437866211, 0.3428278863430023, 0.23688162863254547, 0.6181566715240479, -0.28203049302101135, 0.05851191282272339, -0.30735766887664795, -0.15317606925964355, -0.1764945089817047, 0.23821058869361877, 0.17469768226146698, 0.238973468542099, -0.16804689168930054, 0.053598444908857346, -0.1129126325249672, 0.4548916220664978, -0.0424710176885128, -0.0817769467830658, -0.3013153672218323, 0.1323358416557312, 0.0907919779419899, -0.03874143213033676, -0.2210901528596878, 0.07731010019779205, 0.14428630471229553, 0.05794944614171982, -0.27123498916625977, -0.37067070603370667, 0.5982506275177002, -0.13302081823349, -0.2942005395889282, -0.1965690404176712, 0.4296398460865021, 0.05458617955446243, 0.026379741728305817, 0.004602961242198944, -0.0905647948384285, 0.18862293660640717, -0.12179901450872421, -0.38428032398223877, 0.21194913983345032, -0.18975013494491577, -0.02005428448319435, -0.010050149634480476, -0.035258710384368896, -0.2235375940799713, -0.16856083273887634, 0.27102792263031006, 0.045643992722034454 ]
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).
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?
[ -0.22816504538059235, -0.20701062679290771, -0.07345107197761536, 0.013687685132026672, 0.3130878806114197, -0.09484143555164337, -0.029510851949453354, 0.19544264674186707, -0.05052902549505234, -0.05537717044353485, -0.12054097652435303, 0.4630905091762543, 0.01380886696279049, 0.9158241748809814, 0.013948752544820309, 0.0983375608921051, 0.4865874946117401, 0.23047080636024475, -0.19432246685028076, 0.16499467194080353, -0.1984943002462387, 0.20148716866970062, 0.013253122568130493, -0.11980004608631134, 0.029308175668120384, 0.013075338676571846, -0.31987395882606506, 0.19463607668876648, -0.25918668508529663, -0.5768376588821411, 0.21066854894161224, 0.11546705663204193, 0.2224450260400772, 0.18429487943649292, -0.00011345016537234187, -0.2761806845664978, -0.02823718637228012, -0.13916674256324768, -0.29564449191093445, 0.0066025108098983765, -0.3404630422592163, -0.3424828350543976, 0.37125834822654724, -0.14566422998905182, -0.4055563807487488, -0.16824866831302643, -0.06229964643716812, -0.1835269182920456, 0.4810768961906433, 0.5020652413368225, 0.15333062410354614, 0.061372749507427216, 0.09251154959201813, -0.11789331585168839, 0.3139198422431946, 0.2741343677043915, -0.147799551486969, -0.18612675368785858, 0.2202596366405487, -0.01003600750118494, 0.32263869047164917, -0.08733145892620087, -0.012801313772797585, -0.07783718407154083, 0.2363702654838562, -0.11434047669172287, -0.21813419461250305, -0.37211382389068604, -0.1913873255252838, 0.04882919043302536, 0.5509035587310791, -0.3496217727661133, -0.613540530204773, -0.1215939074754715, -0.1853056401014328, -0.40243959426879883, -0.22580251097679138, -0.05455338954925537, 0.17347045242786407, 0.09084297716617584, 0.03571612760424614, -0.35871654748916626, -0.22867333889007568, -0.03181838244199753, -0.3366864025592804, -0.03823539614677429, -0.4009285271167755, -0.18275627493858337, 0.07881894707679749, -0.28265833854675293, -0.02899164706468582, -0.11423516273498535, 0.06708145141601562, -0.043507713824510574, -0.3338676691055298, -0.5811092853546143, -0.05750759690999985, 0.00713425874710083, -0.1302272081375122, 0.4432709217071533, -0.2069096714258194, 0.18535161018371582, 0.12167990207672119, 0.12613940238952637, 0.237054705619812, -0.37999168038368225, 0.005591437220573425, 0.09261128306388855, 0.15535180270671844, -0.07859643548727036, 0.1267935335636139, -0.18305492401123047, 0.05243256688117981, -0.03628240525722504, -0.34625354409217834, -0.041145604103803635, 0.22112984955310822, -0.40476518869400024, -0.22407236695289612, 0.06596378982067108, 0.46403807401657104, 0.14134863018989563, -0.3501628637313843, 0.2933056950569153, -0.0648217424750328, 0.43005216121673584, 0.02700541913509369, 0.25180375576019287, -0.016907647252082825, -0.1550256758928299, -0.02272382192313671, 0.22509734332561493, -0.07864093035459518, -0.07704086601734161, -0.030207838863134384, -0.08496080338954926, -0.10031817853450775, 0.05925280600786209, 0.01210738718509674, 0.2268059253692627, -0.10778266936540604, 0.014588065445423126, 0.29577791690826416, 0.21587657928466797, -0.11908331513404846, -0.023711014539003372, 0.04577527195215225, -0.04370642080903053, -0.43390390276908875, -0.196677565574646, -0.1571323275566101, -0.06230371817946434, -0.30002719163894653, 0.09213125705718994, 0.041807353496551514, -0.2757473289966583, -0.521973729133606, 0.435833603143692, -0.22484350204467773, -0.21888673305511475, -0.12432665377855301, -0.13480113446712494, -0.09034202992916107, -0.13685713708400726, -0.034674957394599915, 0.213382750749588, -0.4076615571975708, 0.13452211022377014, 0.2314087599515915, -0.14251452684402466, 0.24637436866760254, 0.20122253894805908, 0.18945986032485962, -0.24247592687606812, -0.04185543209314346, 0.21204720437526703, 0.4220491349697113, -0.11149941384792328, 0.08590488880872726, 0.30236729979515076, 0.29229629039764404, -0.02295389398932457, 0.22661298513412476, -0.14125950634479523, 0.5118386745452881, -0.22478154301643372, -0.09058175981044769, 0.3739795684814453, -0.20164933800697327, 0.13976363837718964, -0.08362475037574768, -0.04616248607635498, 0.30161017179489136, 0.07630321383476257, -0.1519172489643097, 0.24292930960655212, 0.2602217495441437, -0.047532081604003906, 0.021629665046930313, -0.42378875613212585, 0.030473945662379265, 0.07964780926704407, 0.4252883791923523, 0.3141801655292511, -0.18242302536964417, -0.27451956272125244, -0.3113805055618286, -0.021515531465411186, 0.12321525812149048, -0.02728581428527832, 0.033737003803253174, -0.2533731460571289, -0.05507973954081535, 0.07327207177877426, 0.10711000859737396, 0.0024189800024032593, 0.06831743568181992, 0.008460655808448792, 0.11778536438941956, -0.061407409608364105, -0.35368794202804565, 0.0018873056396842003, 0.05045291781425476, 0.22027362883090973, -0.16196279227733612, 0.19764477014541626, 0.12483518570661545, -0.20932099223136902, 0.4439294636249542, 0.25697609782218933, 0.16077089309692383, -0.23639146983623505, 0.22159743309020996, 0.20102474093437195, 0.6202336549758911, 0.058789029717445374, 0.12919560074806213, 0.46779435873031616, 0.12292617559432983, 0.04434461519122124, -0.010006463155150414, -0.001701299101114273, 0.13876624405384064, 0.017317935824394226, -0.5469350814819336, 0.5195266008377075, 0.11494755744934082, 0.23331773281097412, 0.18646495044231415, -0.027729835361242294, 0.4472689628601074, 0.19819292426109314, -0.16923417150974274, 0.1554122269153595, -0.24184371531009674, 0.2280079424381256, -0.18785081803798676, -0.0037014279514551163, -0.5660123825073242, 0.15326924622058868, 0.4009760022163391, -0.1746423840522766, 0.04137659817934036, 0.293410062789917, 0.1636974811553955, -0.39106735587120056, 0.3103448450565338, 0.08402884006500244, 0.11340180784463882, 0.35487237572669983, 0.15198524296283722, 0.0032852664589881897, -0.019065149128437042, 0.08892861753702164, 0.29412931203842163, -0.04039496183395386, 0.1670617312192917, -0.00785045325756073, 0.19404268264770508, 0.11115827411413193, -0.303261935710907, -0.08496854454278946, -0.2620431184768677, 0.013899505138397217, -0.4262928068637848, 0.2509081959724426, -0.20050494372844696, -0.11768893897533417, 0.12636075913906097, 0.2374723255634308, -0.015146519988775253, -0.26017525792121887, -0.16007615625858307, 0.1615774929523468, -0.012132681906223297, -0.1577666848897934, -0.09982693195343018, 0.5549927949905396, 0.01531144417822361, -0.021802706643939018, -0.32580330967903137, -0.14668968319892883, -0.02848229557275772, 0.11063989996910095, 0.2653580904006958, 0.08537765592336655, 0.3725843131542206, 0.02105007879436016, 0.1857512891292572, -0.38911202549934387, -0.2799952030181885, 0.14804989099502563, -0.2483706921339035, 0.22245927155017853, 0.25209856033325195, 0.2307060807943344, 0.14080648124217987, 0.05351712554693222, -0.0291498601436615, -0.017578713595867157, -0.16398394107818604, 0.1331462264060974, -0.21507585048675537, -0.13777878880500793, 0.08212359249591827, -0.1634952425956726, -0.28352999687194824, -0.3227238357067108, 0.4052760601043701, 0.023587245494127274, 0.048203106969594955, -0.29829931259155273, 0.059968117624521255, -0.08700597286224365, -0.0768912062048912, 0.28036531805992126, -0.16014234721660614, -0.25645020604133606, 0.32906848192214966, -0.14147168397903442, -0.355137437582016, 0.18230605125427246, 0.170517697930336, 0.01033451035618782, 0.017544621601700783, -0.07349051535129547, -0.19295109808444977, -0.21649451553821564, -0.14253242313861847, 0.10669571161270142, 0.21190088987350464, 0.4389555752277374, 0.02253744751214981, -0.13784751296043396, 0.018691688776016235, -0.203798308968544, -0.1663174033164978, 0.37114226818084717, -0.10868673771619797, 0.019488215446472168, 0.46865469217300415, 0.06683771312236786, 0.34464937448501587, 0.1768224686384201, -0.12502285838127136, 0.4290609061717987, -0.1188298836350441, 0.3437013626098633, -0.11599621921777725, 0.07372676581144333, 0.023578954860568047, -0.5015177726745605, 0.0381522998213768, 0.12221937626600266, -0.06925627589225769, -0.00862867571413517, -0.1010497435927391, 0.26218095421791077, -0.4214879870414734, -0.08383408188819885, -0.05490919202566147, -0.19067732989788055, 0.16535383462905884, -0.15677179396152496, -0.10332240164279938, 0.2045261114835739, 0.24198386073112488, 0.18590207397937775, 0.21234190464019775, 0.34890875220298767, -0.11494026333093643, -0.44092628359794617, -0.19128674268722534, -0.5421645045280457, 0.28788119554519653, -0.07361577451229095, 0.221191868185997, -0.10935510694980621, -0.12380550056695938, -0.03968434035778046, -0.32925423979759216, 0.6952459812164307, -0.1950732320547104, -0.33974653482437134, 0.23231881856918335, -0.3577592670917511, -0.40839430689811707, 0.13667328655719757, -0.3854878842830658, -0.04594258964061737, -0.0737573653459549, 0.4325343072414398, -0.46387115120887756, -0.318467915058136, -0.020380113273859024, -0.0928376242518425, -0.010349482297897339, 0.41187986731529236, -0.010068293660879135, -0.07515623420476913, -0.37517455220222473, 0.21898341178894043, 0.10427487641572952, -0.008483451791107655, -0.1352144181728363, -0.08096450567245483, -0.3853597342967987, 0.003937356173992157, 0.23656727373600006, 0.0863211452960968, 0.16135436296463013, 0.06493686884641647, -0.06560774892568588, -0.10471759736537933, 0.29373055696487427, 0.2707142233848572, 0.3751354515552521, -0.20017991960048676, -0.5464004278182983, 0.14741873741149902, 0.29155927896499634, 0.6233009696006775, 0.13870908319950104, 0.10539150983095169, 0.10185660421848297, -0.37649768590927124, 0.05117585510015488, -0.46859902143478394, 0.08035240322351456, 0.3016199469566345, 0.0839887410402298, -0.2133314311504364, -0.33461064100265503, 0.277357816696167, -0.02387113869190216, 0.036846354603767395, -0.27162492275238037, 0.4853367209434509, -0.09034916758537292, 0.5561609268188477, 0.24828428030014038, 0.8483763933181763, -0.25380563735961914, 0.50877445936203, 0.24230530858039856, -0.4728057384490967, 0.54759281873703, -0.39919471740722656, -0.18754789233207703, -0.1902172714471817, 0.10511506348848343, -0.13557763397693634, 0.0098135806620121, 0.24494099617004395, 0.18849052488803864, -0.21454663574695587, 0.413161039352417, 0.07801541686058044, -0.20083093643188477, 0.008181747980415821, 0.2882804274559021, 0.109392911195755, -0.3175959885120392, -0.7827303409576416, 0.21612896025180817, 0.027900898829102516, -0.42818689346313477, -0.07572421431541443, -0.22423292696475983, 0.07637819647789001, 0.18903541564941406, -0.08622469753026962, 0.21950265765190125, 0.12529298663139343, -0.09316959977149963, -0.03768080845475197, -0.18327048420906067, 0.2428571581840515, 0.20026350021362305, 0.13749374449253082, 0.10919564962387085, -0.16414815187454224, -0.2502998113632202, -0.06303413957357407, 0.21662314236164093, -0.05880868062376976, -0.14522145688533783, 0.3445754647254944, -0.0544024296104908, 0.3225471079349518, 0.14058274030685425, -0.01606326550245285, -0.2352616786956787, 0.37759971618652344, -0.13639552891254425, 0.28271979093551636, -0.3775918185710907, -0.35662487149238586, 0.049933094531297684, -0.03890768066048622, -0.2231723666191101, 0.13086557388305664, 0.0945187509059906, -0.11471759527921677, 0.27491286396980286, -0.07679390907287598, 0.026750408113002777, -0.12595337629318237, 0.17046165466308594, -0.39019230008125305, 0.001321539282798767, 0.11117491126060486, 0.197938472032547, -0.47731858491897583, -0.22611457109451294, 0.09799432009458542, 0.18577474355697632, 0.17631053924560547, 0.22769860923290253, -0.019760465249419212, -0.18857821822166443, 0.07405576854944229, 0.3084245026111603, 0.10044030845165253, -0.36765652894973755, 0.028194788843393326, -0.19613243639469147, -0.03523721173405647, 0.016896646469831467, 0.1078537255525589, 0.4217455983161926, 0.3043908476829529, -0.10230284929275513, -0.32875150442123413, -0.20373724400997162, -0.29379570484161377, 0.09433934837579727, -0.04529360681772232, 0.2943786084651947, 0.4339098632335663, -0.0022071674466133118, -0.050143543630838394, -0.14773958921432495, 0.06894008815288544, 0.05776839703321457, -0.06959512084722519, -0.25957101583480835, -0.03364266827702522, 0.1441367268562317, 0.2910544276237488, -0.07392790913581848, 0.03753161430358887, 0.14509202539920807, -0.40281033515930176, -0.3182457685470581, -0.04177713766694069, 0.20368346571922302, -0.24189864099025726, 0.21551798284053802, 0.26852115988731384, -0.1512657105922699, 0.10364136099815369, 0.014619473367929459, 0.20404407382011414, 0.17833606898784637, -0.05852320417761803, 0.2764415144920349, -0.27477172017097473, -0.16907650232315063, 0.3016064167022705, 0.6260992884635925, 0.490328848361969, -0.0969822034239769, 0.3716447949409485, -0.11221407353878021, -0.26786670088768005, 0.24433816969394684, 0.47547343373298645, 0.3384166955947876, -0.015317318961024284, 0.2737289369106293, 0.27634721994400024, 0.1843957006931305, -0.11761564016342163, -0.1791476160287857, 0.06581932306289673, -0.06527747213840485, -0.015137549489736557, 0.05397479981184006, 0.17036636173725128, 0.08138416707515717, 0.039684731513261795, -0.003764711320400238, -0.06551990658044815, 0.12820333242416382, 0.07735989987850189, -0.0379202626645565, 0.06741325557231903, 0.07909630984067917, 0.3462887704372406, 0.1328727751970291, 0.06650945544242859, 0.3468474745750427, 0.3301717936992645, 0.33023661375045776, 0.10569266229867935, 0.28209221363067627, 0.1175532191991806, -0.3199126422405243, 0.36349180340766907, -0.17716413736343384, 0.27971142530441284, 0.1930566132068634, 0.19686219096183777, -0.0008890479803085327, 0.12648722529411316, -0.422981858253479, -0.04042818397283554, 0.4468495845794678, -0.08327213674783707, -0.28606292605400085, 0.3515061140060425, -0.049851104617118835, 0.16347168385982513, 0.1724100559949875, -0.33948323130607605, -0.34292107820510864, -0.014671973884105682, 0.07574813812971115, 0.5078288316726685, -0.13592474162578583, 0.042566895484924316, -0.17100822925567627, 0.20889613032341003, -0.051736172288656235, 0.20362216234207153, -0.13123951852321625, -0.18437343835830688, -0.007495369762182236, 0.026462608948349953, 0.4360387623310089, 0.061503998935222626, -0.23173540830612183, 0.06912317872047424, -0.1254810094833374, -0.20559801161289215, 0.2650255560874939, 0.06598740816116333, -0.3109823763370514, 0.22575199604034424, 0.25270870327949524, 0.1618594527244568, -0.014686590060591698, -0.322103887796402, -0.15514805912971497, -0.1818612962961197, -0.32060521841049194, 0.05110694840550423, 0.4174517095088959, -0.08446021378040314, -0.056564658880233765, 0.1910829097032547, -0.4602658748626709, -0.36110880970954895, 0.31881406903266907, -0.09475116431713104, 0.2308385968208313, 0.1692219376564026, 0.10108145326375961, 0.3210349678993225, 0.2021665871143341, -0.028078090399503708, 0.1599033623933792, -0.18838457763195038, -0.1164771020412445, -0.095633864402771, -0.22827887535095215, 0.2887220084667206, -0.07902632653713226, 0.0829031839966774, 0.3512427508831024, 0.2631889581680298, 0.20275291800498962, -0.21625925600528717, 0.3635861277580261, -0.13818995654582977, 0.41348904371261597, 0.11136655509471893, 0.08990990370512009, -0.14950302243232727, 0.07956027239561081, -0.042759332805871964, -0.16353288292884827, 0.19091372191905975, 0.09206997603178024, 0.010913599282503128, -0.13163703680038452, 0.12855283915996552, -0.09517180919647217, -0.2852775752544403, 0.1212899312376976, 0.16899770498275757, 0.2692030072212219, -0.26253247261047363, -0.11077254265546799, 0.19812190532684326, -0.09046749770641327, -0.10106175392866135, 0.3674095869064331, -0.37309080362319946, 0.05232454836368561, -0.09719831496477127, 0.025578856468200684, -0.15190954506397247, -0.02992769330739975, 0.019759811460971832, -0.22732889652252197, -0.2592993676662445, 0.2765722870826721, -0.23483163118362427, -0.03373811021447182, -0.06456585973501205, 0.16219131648540497, 0.0042395032942295074, 0.013316089287400246, -0.07020743191242218, 0.007103636860847473, 0.03787057101726532, -0.43149706721305847, -0.26467910408973694, -0.23194439709186554, 0.12760931253433228, -0.020653650164604187, 0.08167463541030884, -0.10357701778411865, 0.015965305268764496, 0.07784813642501831, -0.1955978274345398, -0.1455906629562378, 0.45824292302131653, -0.17097418010234833, -0.16100475192070007, -0.4069039225578308, 0.319009006023407, 0.18605700135231018, 0.11381055414676666, -0.3065604269504547, -0.6174044609069824 ]
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
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?
[ -0.12034155428409576, -0.06106922775506973, -0.05394645035266876, 0.29939770698547363, -0.0075555890798568726, 0.13879653811454773, 0.3968620002269745, 0.22607295215129852, -0.03234626352787018, 0.2422584593296051, 0.014716611243784428, 0.3595842123031616, -0.005157136358320713, 0.1901366263628006, -0.19140878319740295, 0.01733224093914032, 0.11034365743398666, 0.19251525402069092, 0.05634697526693344, -0.13046899437904358, 0.007158983498811722, 0.05956301838159561, -0.26146042346954346, -0.24115557968616486, -0.17238584160804749, -0.1049707755446434, 0.07371770590543747, -0.04959437996149063, 0.016465559601783752, -0.37040984630584717, 0.58366459608078, 0.14477229118347168, 0.3255670368671417, 0.7392752170562744, -0.0001286432525375858, 0.10254867374897003, 0.2484430968761444, 0.04332318902015686, -0.5669699907302856, -0.2875477075576782, 0.07709792256355286, 0.02845594473183155, 0.16678202152252197, -0.148709237575531, 0.06501806527376175, -0.16938968002796173, -0.11232630908489227, -0.3137887120246887, 0.06704851239919662, -0.0175027959048748, -0.007366877049207687, 0.03892349824309349, -0.14582069218158722, 0.02273114211857319, 0.18154829740524292, 0.15672336518764496, 0.0025434400886297226, 0.21113228797912598, 0.323451429605484, -0.24620750546455383, -0.19147315621376038, 0.03814099356532097, 0.059255532920360565, 0.03677885979413986, 0.24797788262367249, -0.2199011892080307, 0.15155163407325745, -0.1516037881374359, 0.17197567224502563, 0.05214386060833931, 0.6349730491638184, -0.2051560878753662, -0.31167301535606384, -0.1874931901693344, 0.05711349844932556, -0.2066849172115326, 0.22093775868415833, 0.23907002806663513, -0.36529669165611267, -0.06721791625022888, 0.1302320510149002, -0.017412669956684113, -0.2558680474758148, 0.06314022839069366, -0.32610222697257996, 0.4725860357284546, -0.028254274278879166, 0.21908441185951233, 0.20119960606098175, -0.05168982595205307, 0.20117083191871643, 0.1509179174900055, 0.09443944692611694, -0.00911173690110445, -0.8740888833999634, 0.16843107342720032, 0.03486434370279312, -0.0966726616024971, -0.10910190641880035, 0.09376178681850433, -0.005183466710150242, 0.06792795658111572, 0.3463151454925537, 0.1993158459663391, 0.46078774333000183, -0.2793406844139099, 0.13229280710220337, 0.02966015785932541, 0.167966827750206, 0.15225107967853546, -0.08464543521404266, 0.00478300079703331, -0.284297913312912, -0.2816356420516968, 0.27368617057800293, -0.26657676696777344, 0.12990505993366241, -0.4193747937679291, -0.04090825840830803, 0.2169112116098404, -0.17517495155334473, -0.11186601221561432, 0.17135463654994965, 0.5569676756858826, -0.24068212509155273, 0.19960260391235352, -0.02035960927605629, 0.17093931138515472, -0.03623565286397934, 0.07730219513177872, 0.11739923804998398, -0.13908885419368744, -0.17958413064479828, -0.05887072533369064, 0.09668077528476715, -0.4493831396102905, 0.03337828814983368, 0.13280782103538513, 0.23295888304710388, -0.14270062744617462, 0.09616415947675705, -0.2332106977701187, 0.11734391003847122, 0.2087404578924179, 0.012928120791912079, 0.11991798132658005, 0.07579822093248367, -0.1300608366727829, -0.24528682231903076, -0.006963029503822327, -0.16953307390213013, -0.021312016993761063, -0.23514790832996368, 0.00923585332930088, 0.13334397971630096, -0.1736951768398285, -0.21858179569244385, -0.5035790801048279, 0.16486135125160217, 0.02700456604361534, 0.0838286429643631, -0.16777198016643524, 0.02577628567814827, 0.047048069536685944, 0.08268596231937408, 0.32359087467193604, -0.6584928631782532, 0.3557184636592865, 0.10101424157619476, 0.13943740725517273, 0.1610989272594452, 0.08393514156341553, -0.3149610757827759, 0.39346134662628174, -0.326668381690979, -0.4337341785430908, 0.44984763860702515, -0.3066416084766388, -0.09339069575071335, 0.5220127701759338, 0.055653512477874756, 0.2298082858324051, 0.27921411395072937, -0.26905015110969543, 0.06662784516811371, -0.09709804505109787, 0.23712031543254852, 0.11836839467287064, -0.02522260509431362, -0.010444052517414093, -0.15131862461566925, 0.11702708899974823, 0.0866670161485672, 0.3975197374820709, 0.1423652321100235, 0.18696832656860352, -0.18376371264457703, -0.21247899532318115, 0.40750011801719666, -0.11452008783817291, -0.02553304098546505, 0.5652461051940918, 0.343671977519989, 0.4750639796257019, 0.25390470027923584, -0.03004257008433342, -0.3697569668292999, 0.28945156931877136, 0.08763965964317322, -0.026697836816310883, -0.1038520485162735, 0.14545099437236786, -0.11274980008602142, 0.3891129791736603, -0.3410992920398712, -0.03433937206864357, -0.11348940432071686, 0.3032042980194092, 0.05994739010930061, -0.1584000438451767, -0.3077721893787384, 0.605199933052063, -0.05788422375917435, 0.046945612877607346, -0.3146789073944092, 0.209865003824234, 0.16851364076137543, -0.09245413541793823, -0.013506924733519554, -0.11716111749410629, 0.10137627273797989, -0.27514538168907166, -0.10926911979913712, 0.0202452652156353, 0.12762762606143951, 0.015506841242313385, -0.10508496314287186, -0.19679580628871918, -0.0058330874890089035, 0.2401445209980011, 0.08615684509277344, -0.20454619824886322, 0.10715397447347641, -0.1568717658519745, 0.20699059963226318, 0.05904043838381767, 0.013610264286398888, 0.8269125819206238, -0.08546270430088043, -0.049995601177215576, 0.22375652194023132, 0.09098586440086365, 0.003619654104113579, 0.27124303579330444, 0.36902207136154175, -0.046148914843797684, 0.8012937307357788, -0.04375002533197403, -0.3187139630317688, 0.12877361476421356, 0.12530258297920227, 0.08137036859989166, -0.3563346564769745, 0.306765615940094, 0.06225544959306717, 0.2061372697353363, 0.17597004771232605, 0.05113528296351433, 0.13064631819725037, 0.028734300285577774, 0.03638060390949249, -0.11230476945638657, -0.0872165709733963, 0.010778611525893211, -0.1384192407131195, 0.3581894040107727, 0.5623959302902222, 0.2582297921180725, 0.017739620059728622, -0.07933589816093445, -0.059122197329998016, -0.5250728130340576, -0.04220939800143242, 0.3343014419078827, -0.08200377225875854, 0.5696793794631958, -0.3426891565322876, 0.24768802523612976, -0.16052751243114471, -0.05167403817176819, -0.2887345850467682, -0.2719355523586273, -0.40860509872436523, 0.6014846563339233, 0.048340704292058945, 0.04622121900320053, 0.03763924911618233, 0.14569157361984253, 0.23470266163349152, -0.38421839475631714, -0.47259756922721863, -0.2938691973686218, -0.33157774806022644, -0.221663698554039, 0.4596204459667206, -0.2112596333026886, 0.14619408547878265, -0.08082982152700424, -0.19700025022029877, -0.25750336050987244, -0.20808187127113342, 0.21392209827899933, -0.1000322550535202, 0.31484517455101013, 0.1823989748954773, 0.32633453607559204, -0.029765848070383072, -0.1834876984357834, 0.013211708515882492, 0.05672430992126465, 0.06809587776660919, 0.29521799087524414, 0.020864486694335938, 0.12024173140525818, 0.2648945152759552, 0.013918653130531311, -0.09302110970020294, -0.3483176827430725, 0.2924504280090332, -0.03395257517695427, 0.027126744389533997, -0.1469140350818634, 0.15289773046970367, 0.19091244041919708, -0.06400492042303085, 0.1950751394033432, 0.050075892359018326, -0.7142707109451294, 0.2778991758823395, -0.1319386512041092, -0.18297691643238068, 0.010370228439569473, -0.009189827367663383, 0.29042163491249084, 0.2471437156200409, -0.719473123550415, 0.27001330256462097, -0.16969642043113708, -0.09022228419780731, -0.384392648935318, -0.04389091581106186, 0.10993781685829163, 0.0023983868304640055, 0.09334957599639893, -0.00960763543844223, -0.09471212327480316, 0.2698820233345032, -0.027497436851263046, 0.13529059290885925, 0.13615764677524567, 0.533331036567688, -0.03682433068752289, 0.3945220112800598, 0.22211335599422455, -0.029855895787477493, 0.5339847803115845, 0.2289533019065857, 0.1436123549938202, -0.021263137459754944, -0.29347455501556396, -0.15117628872394562, -0.09197095036506653, -0.31045764684677124, 0.0625469982624054, -0.22162297368049622, -0.4197785556316376, -0.2214502990245819, -0.16646873950958252, 0.01878579705953598, -0.3225864768028259, 0.26373299956321716, -0.268373966217041, 0.17963847517967224, -0.06883260607719421, 0.13470110297203064, -0.20850875973701477, 0.12043433636426926, 0.08343684673309326, 0.09479232132434845, 0.13439908623695374, -0.0304122231900692, -0.015958942472934723, 0.03956010192632675, -0.2541281282901764, 0.0796656385064125, -0.0005656578578054905, 0.591728150844574, 0.0596177913248539, -0.21527713537216187, 0.16404050588607788, -0.4550539553165436, 1.1258093118667603, -0.082077756524086, 0.08999982476234436, 0.15774406492710114, -0.37458738684654236, -0.2748861014842987, -0.1909971833229065, 0.028270717710256577, 0.12183064967393875, 0.13253428041934967, 0.6072776317596436, -0.274065226316452, -0.5121183395385742, 0.13615384697914124, 0.07660120725631714, -0.20567694306373596, -0.41742438077926636, -0.3720260262489319, 0.09090805798768997, -0.3091866075992584, 0.13706760108470917, -0.24465996026992798, 0.19434836506843567, 0.10077991336584091, -0.061881981790065765, -0.298157274723053, 0.05786778777837753, -0.05033223330974579, 0.09700140357017517, 0.07742519676685333, -0.1963854879140854, 0.5088981986045837, 0.09684503078460693, 0.33157432079315186, 0.41019102931022644, 0.391500324010849, 0.1806132197380066, -0.5782785415649414, 0.3797402083873749, 0.026959452778100967, 0.5014553070068359, 0.40764057636260986, -0.010872093960642815, -0.04060054570436478, -0.19405725598335266, 0.3997500538825989, -0.29865214228630066, 0.07488473504781723, 0.2792312204837799, 0.1545085310935974, -0.5815045833587646, -0.23671527206897736, 0.27665531635284424, -0.022884206846356392, 0.16622070968151093, 0.37096327543258667, -0.0020156651735305786, 0.07901836931705475, 0.444485604763031, 0.0013892129063606262, 0.8731947541236877, -0.1627861112356186, 0.15144768357276917, 0.12780342996120453, -0.3167559504508972, 0.010410575196146965, -0.7195463180541992, -0.043808501213788986, -0.37848544120788574, -0.17139394581317902, -0.0054327622056007385, -0.39563989639282227, 0.27059707045555115, 0.0768415555357933, 0.2435128390789032, 0.289644330739975, -0.2047872692346573, -0.0922565907239914, 0.09164126217365265, 0.21977263689041138, -0.2187054455280304, -0.2903853952884674, -0.23824551701545715, -0.028101377189159393, -0.0510919988155365, 0.08153516054153442, -0.1831797957420349, -0.15133154392242432, 0.09454107284545898, 0.07842821627855301, -0.12124103307723999, 0.26836273074150085, 0.25823816657066345, -0.15523791313171387, 0.17574568092823029, -0.6000228524208069, 0.15930525958538055, 0.020072445273399353, -0.0023554638028144836, 0.09627913683652878, -0.08349418640136719, 0.15460576117038727, -0.0682465210556984, -0.10481997579336166, 0.08946067094802856, -0.1389746069908142, 0.449680894613266, 0.03492586314678192, -0.16668470203876495, 0.03873047977685928, -0.21873141825199127, -0.2736295163631439, 0.2130691111087799, 0.20977261662483215, 0.20484843850135803, -0.10161857306957245, 0.10912522673606873, 0.18492257595062256, -0.07658174633979797, -0.23194769024848938, -0.004559045657515526, -0.05815117061138153, -0.2877082824707031, 0.15020430088043213, -0.2447846382856369, -0.36300599575042725, -0.1480739414691925, 0.5220639109611511, -0.06524350494146347, 0.03812282532453537, 0.7059681415557861, 0.3768424689769745, -0.3177737593650818, -0.19154062867164612, -0.23352009057998657, 0.13625910878181458, -0.4205075204372406, 0.06062334030866623, -0.12048245221376419, 0.16320563852787018, 0.14718890190124512, -0.0731055736541748, -0.04659198969602585, -0.5454514026641846, -0.15253502130508423, -0.42693960666656494, -0.11685144901275635, -0.1525029093027115, -0.06778714060783386, 0.07129497826099396, 0.10949700325727463, 0.023965582251548767, -0.11394576728343964, 0.1505383998155594, -0.11834950745105743, -0.08120639622211456, -0.2745699882507324, 0.04845292866230011, -0.10888588428497314, -0.20559316873550415, 0.06673062592744827, 0.010266901925206184, 0.01273479126393795, 0.2248583436012268, 0.1496301293373108, -0.09064701199531555, -0.2661873400211334, 0.17253221571445465, 0.0312964990735054, 0.17291459441184998, 0.12295102328062057, -0.28446024656295776, -0.14269119501113892, -0.10017028450965881, 0.17534810304641724, -0.26797494292259216, 0.03774872049689293, -0.06560993939638138, 0.36727476119995117, 0.18614542484283447, -0.16246697306632996, 0.040722962468862534, 0.3598944842815399, -0.23546229302883148, 0.14419689774513245, 0.2526533603668213, -0.2356421947479248, 0.06655910611152649, -0.1665869951248169, 0.1050410196185112, 0.18456551432609558, 0.05644042789936066, 0.46145328879356384, -0.4978675842285156, 0.0896902084350586, -0.06681044399738312, 0.38982197642326355, 0.7883561849594116, 0.10677706450223923, -0.280800998210907, 0.6195487380027771, -0.01495949737727642, -0.20318269729614258, -0.1499386727809906, -0.10081024467945099, 0.05276631936430931, -0.02503122016787529, 0.21115651726722717, -0.16187119483947754, -0.15043377876281738, 0.2702637314796448, 0.16402852535247803, 0.15861296653747559, -0.08816501498222351, -0.07467658817768097, 0.13951435685157776, -0.06085112318396568, 0.0003319568932056427, 0.4081156849861145, 0.5040665864944458, 0.04427037760615349, 0.31111979484558105, 0.12803120911121368, 0.08732721954584122, -0.13816669583320618, 0.14193075895309448, -0.146957129240036, -0.5513461828231812, 0.11849373579025269, 0.20306937396526337, 0.3576228618621826, 0.013086676597595215, -0.01871681958436966, 0.2967531085014343, 0.1923357993364334, -0.3570903241634369, -0.37753912806510925, 0.21752873063087463, -0.105284683406353, 0.15053853392601013, 0.1373993158340454, -0.17486074566841125, -0.054977141320705414, 0.15254059433937073, 0.05549922585487366, -0.21180422604084015, 0.15200801193714142, 0.17851081490516663, 0.23425854742527008, -0.4782266318798065, -0.22846195101737976, -0.07099449634552002, 0.17394213378429413, -0.09709613025188446, 0.12891969084739685, -0.035185158252716064, -0.1908218264579773, -0.32790321111679077, -0.13369566202163696, 0.2679755389690399, 0.40518033504486084, -0.09313501417636871, 0.03518327325582504, -0.08544959127902985, 0.01664486713707447, -0.016931714490056038, 0.10955439507961273, -0.27324342727661133, 0.24662993848323822, 0.4421943128108978, -0.07109857350587845, 0.01732170581817627, -0.04164950177073479, 0.03980039805173874, 0.26414191722869873, -0.2831558585166931, 0.14098072052001953, 0.3457299470901489, 0.03439510613679886, 0.01066233403980732, -0.10183236747980118, -0.5850303173065186, -0.029669828712940216, 0.2981836795806885, -0.10737349092960358, 0.012188063934445381, 0.031353045254945755, 0.009797703474760056, -0.09419344365596771, 0.6142704486846924, 0.2568384110927582, 0.2784876227378845, -0.22813467681407928, -0.17703166604042053, -0.3556425869464874, -0.009600207209587097, -0.33493611216545105, -0.06779656559228897, 0.3497079014778137, 0.31605568528175354, 0.3502807319164276, 0.057571135461330414, 0.20956715941429138, -0.1104535385966301, -0.29660874605178833, 0.6280043125152588, -0.42457515001296997, -0.23322848975658417, 0.09758955240249634, 0.12226833403110504, -0.16719602048397064, -0.3827924430370331, 0.1538422405719757, -0.024739371612668037, -0.0502893328666687, -0.04151461273431778, -0.29342371225357056, 0.23640677332878113, -0.5849096775054932, 0.3832554221153259, -0.27024415135383606, 0.07349395751953125, 0.16191765666007996, -0.1825958490371704, -0.2629907727241516, -0.12617382407188416, 0.0500016026198864, -0.0051616281270980835, -0.09311749041080475, 0.08104290813207626, -0.20207780599594116, 0.005453769117593765, -0.4061242938041687, -0.048810478299856186, -0.07444261014461517, -0.07288379967212677, -0.0316733717918396, 0.14413882791996002, 0.13890638947486877, 0.30200374126434326, 0.10253769159317017, 0.2118193507194519, 0.2551742494106293, 0.18122996389865875, -0.4533480405807495, -0.009677636437118053, 0.42406225204467773, -0.32979175448417664, -0.5895323753356934, 0.21973758935928345, 0.09519873559474945, 0.13435973227024078, -0.08594740182161331, -0.3225000202655792, 0.20558294653892517, 0.11137331277132034, -0.04372801631689072, 0.026521816849708557, 0.20534232258796692, 0.1469155102968216, 0.1101515144109726, -0.3406696915626526, 0.18107281625270844, -0.02983393892645836, -0.10084168612957001, -0.049124669283628464, -0.10315623879432678 ]
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
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: ```
[ -0.11611801385879517, -0.08128397166728973, -0.03265773132443428, 0.27752193808555603, 0.005241136997938156, 0.10193123668432236, 0.4178648889064789, 0.2360876053571701, -0.0588974691927433, 0.2419949173927307, 0.033153973519802094, 0.31277570128440857, -0.008137241937220097, 0.1814092993736267, -0.16851776838302612, 0.007712662220001221, 0.08212435245513916, 0.27330538630485535, 0.023139890283346176, -0.13803204894065857, 0.028176017105579376, 0.05369184911251068, -0.2516207695007324, -0.2548896074295044, -0.15095753967761993, -0.08349782228469849, 0.06863514333963394, -0.08840636163949966, 0.017149077728390694, -0.3563288152217865, 0.5631604194641113, 0.12643322348594666, 0.34400475025177, 0.7400312423706055, -0.00012986865476705134, 0.09923461079597473, 0.2584875226020813, -0.0049940962344408035, -0.5916667580604553, -0.29735469818115234, 0.11025535315275192, 0.02331470139324665, 0.15417559444904327, -0.18132880330085754, 0.017393700778484344, -0.17648014426231384, -0.09208417683839798, -0.3477407693862915, 0.06372450292110443, 0.0086999936029315, -0.00788264349102974, 0.07851359248161316, -0.1667158603668213, 0.08499067276716232, 0.15931658446788788, 0.1585724651813507, -0.031056629493832588, 0.1990460902452469, 0.3632676601409912, -0.24817189574241638, -0.17436417937278748, 0.0750274807214737, 0.03605307638645172, 0.03626887500286102, 0.2503214180469513, -0.19048164784908295, 0.16200821101665497, -0.16349707543849945, 0.17282706499099731, 0.03215809166431427, 0.5763807892799377, -0.18930894136428833, -0.30561044812202454, -0.2624896168708801, 0.015724031254649162, -0.24970081448554993, 0.17371779680252075, 0.25530532002449036, -0.36777693033218384, -0.05550137534737587, 0.12283004820346832, 0.03239402920007706, -0.26055610179901123, 0.09229414165019989, -0.29859310388565063, 0.4839078485965729, -0.02749168500304222, 0.22203469276428223, 0.22202274203300476, -0.035336464643478394, 0.22887662053108215, 0.12461686134338379, 0.10886070132255554, 0.0024433229118585587, -0.8359068036079407, 0.18220028281211853, 0.06493482738733292, -0.11116514354944229, -0.13939914107322693, 0.14440716803073883, 0.04706769064068794, 0.07682862877845764, 0.3921278417110443, 0.165935218334198, 0.45649394392967224, -0.2350519746541977, 0.16655179858207703, 0.029484421014785767, 0.1410205066204071, 0.19156642258167267, -0.09261270612478256, 0.00002450123429298401, -0.26111748814582825, -0.25822725892066956, 0.3417457044124603, -0.2565308213233948, 0.17422212660312653, -0.3624249994754791, -0.032077014446258545, 0.19670726358890533, -0.19775176048278809, -0.120358407497406, 0.18159611523151398, 0.5512442588806152, -0.20047569274902344, 0.22847062349319458, -0.054829392582178116, 0.20638354122638702, -0.06314459443092346, 0.06379644572734833, 0.12243067473173141, -0.18819484114646912, -0.197829931974411, -0.0011631855741143227, 0.1385180503129959, -0.505329430103302, 0.06378255784511566, 0.12190311402082443, 0.18799516558647156, -0.11718988418579102, 0.08797036856412888, -0.22342859208583832, 0.15916088223457336, 0.18646065890789032, 0.014326084405183792, 0.15594805777072906, 0.1024506688117981, -0.1503959596157074, -0.23053735494613647, 0.025021232664585114, -0.13999122381210327, -0.034626446664333344, -0.18607236444950104, 0.013337806798517704, 0.11702567338943481, -0.19845405220985413, -0.20555156469345093, -0.45567309856414795, 0.18413783609867096, 0.0030877217650413513, 0.11632056534290314, -0.18503394722938538, -0.0013242550194263458, 0.06870707869529724, 0.07231802493333817, 0.3284991979598999, -0.644097089767456, 0.34119927883148193, 0.15162262320518494, 0.18214592337608337, 0.2247742861509323, 0.04669218137860298, -0.3353321850299835, 0.3183351159095764, -0.32032355666160583, -0.38863128423690796, 0.45053961873054504, -0.3164604604244232, -0.14021170139312744, 0.500228226184845, 0.02079632133245468, 0.24737732112407684, 0.3008955419063568, -0.22503340244293213, 0.11888593435287476, -0.07225805521011353, 0.2366926670074463, 0.1428714096546173, -0.013143738731741905, 0.013965914025902748, -0.16741745173931122, 0.13751527667045593, 0.08023107796907425, 0.33617788553237915, 0.16345588862895966, 0.2508026659488678, -0.14139270782470703, -0.2300223559141159, 0.397513210773468, -0.13548460602760315, -0.001951129175722599, 0.5439562201499939, 0.40119668841362, 0.4964095950126648, 0.2572878897190094, -0.00901726447045803, -0.37251773476600647, 0.3025875985622406, 0.11992737650871277, -0.06045132875442505, -0.08988334238529205, 0.16914623975753784, -0.09850069135427475, 0.3813113272190094, -0.35957083106040955, -0.08326849341392517, -0.12331327050924301, 0.35729944705963135, 0.06043309345841408, -0.20421013236045837, -0.3242596685886383, 0.6252360343933105, -0.057886652648448944, 0.02993943728506565, -0.3437522351741791, 0.2549979090690613, 0.16000404953956604, -0.1510675996541977, -0.04123290255665779, -0.12545472383499146, 0.16623210906982422, -0.2568734288215637, -0.10198897123336792, 0.010120060294866562, 0.15219920873641968, -0.02060551941394806, -0.15628549456596375, -0.18549184501171112, 0.024648362770676613, 0.21122285723686218, 0.07596911489963531, -0.14555245637893677, 0.1119103953242302, -0.1507382094860077, 0.23549184203147888, 0.1101640835404396, 0.03834475204348564, 0.8456958532333374, -0.08274249732494354, -0.05304498225450516, 0.21539735794067383, 0.08303023874759674, -0.05268920212984085, 0.258216917514801, 0.35642457008361816, -0.08667482435703278, 0.7751632928848267, -0.017566079273819923, -0.3490389287471771, 0.17309504747390747, 0.14109551906585693, 0.09935948252677917, -0.37064552307128906, 0.29524001479148865, 0.005819357931613922, 0.171561598777771, 0.16172051429748535, 0.1315823644399643, 0.15555806457996368, 0.03357963263988495, 0.03387374430894852, -0.1186802014708519, -0.04761623591184616, -0.005555126816034317, -0.09676700085401535, 0.3507728576660156, 0.5436466336250305, 0.2728008031845093, 0.04424606263637543, -0.07813243567943573, -0.10181640088558197, -0.49952584505081177, -0.03985290974378586, 0.3091140389442444, -0.07729379087686539, 0.6018987894058228, -0.3594927191734314, 0.22961565852165222, -0.21450801193714142, -0.08855348825454712, -0.2315034568309784, -0.26849910616874695, -0.41917115449905396, 0.6434588432312012, 0.07582862675189972, 0.06124691665172577, 0.03424105793237686, 0.1334621012210846, 0.2028740644454956, -0.41133829951286316, -0.45229044556617737, -0.29077067971229553, -0.3865867853164673, -0.23573815822601318, 0.3728359639644623, -0.2323467880487442, 0.17782212793827057, -0.07226531207561493, -0.20073820650577545, -0.3121667206287384, -0.23243191838264465, 0.1733754277229309, -0.09315179288387299, 0.31271129846572876, 0.11270573735237122, 0.33850720524787903, 0.007348258048295975, -0.22051316499710083, 0.026512322947382927, 0.006029309704899788, 0.06992437690496445, 0.3343455493450165, 0.017774125561118126, 0.1383030116558075, 0.24540534615516663, 0.024168401956558228, -0.07268697768449783, -0.31826186180114746, 0.2656917870044708, -0.02883540466427803, 0.04210667312145233, -0.06703212112188339, 0.14608991146087646, 0.18788036704063416, -0.0613892637193203, 0.17629842460155487, 0.04461683705449104, -0.6645939350128174, 0.3199596107006073, -0.10345643013715744, -0.18862701952457428, -0.0045556724071502686, -0.036514103412628174, 0.2759552299976349, 0.2868327498435974, -0.6897560954093933, 0.22469709813594818, -0.1701498031616211, -0.07751338183879852, -0.32958605885505676, -0.03315619379281998, 0.12094113230705261, -0.0036166911013424397, 0.0879843458533287, -0.021655699238181114, -0.12609194219112396, 0.25113582611083984, 0.009152412414550781, 0.15201523900032043, 0.11106827110052109, 0.5458341240882874, -0.04537062719464302, 0.4528135657310486, 0.22398002445697784, -0.07795673608779907, 0.5503472685813904, 0.17947696149349213, 0.1375959813594818, -0.04597828537225723, -0.3479270935058594, -0.15194420516490936, -0.13672858476638794, -0.2870786786079407, 0.047870296984910965, -0.24949175119400024, -0.43425655364990234, -0.23570246994495392, -0.11293219029903412, -0.01959964632987976, -0.31395554542541504, 0.29470139741897583, -0.28586599230766296, 0.18071813881397247, -0.06506039202213287, 0.18602004647254944, -0.23237858712673187, 0.08958352357149124, -0.0001744646579027176, 0.0753486156463623, 0.06669497489929199, 0.014872437343001366, 0.009289022535085678, 0.021713532507419586, -0.3285018801689148, 0.0824585035443306, -0.002151284134015441, 0.6354800462722778, 0.07290169596672058, -0.24228113889694214, 0.17558898031711578, -0.4146018922328949, 1.0636951923370361, -0.05593598634004593, 0.1302025318145752, 0.1471232771873474, -0.37896305322647095, -0.28573545813560486, -0.23252740502357483, 0.014072515070438385, 0.08376304805278778, 0.11829450726509094, 0.6062549352645874, -0.27685216069221497, -0.48538514971733093, 0.10394865274429321, 0.04086798429489136, -0.1937398761510849, -0.3818453252315521, -0.39984720945358276, 0.0782703310251236, -0.2786448299884796, 0.1147424727678299, -0.21767014265060425, 0.21828731894493103, 0.0985359475016594, -0.06760457158088684, -0.2609041929244995, 0.0394924134016037, -0.009163782000541687, 0.0838065892457962, 0.07839972525835037, -0.1076735109090805, 0.5010775923728943, 0.09247691929340363, 0.35275861620903015, 0.3838486671447754, 0.3932900130748749, 0.18881146609783173, -0.5857113599777222, 0.4113864302635193, 0.027784015983343124, 0.49766018986701965, 0.43984878063201904, -0.01194037776440382, -0.03936692327260971, -0.15380947291851044, 0.3901957869529724, -0.2833351194858551, 0.07466225326061249, 0.2703549563884735, 0.13070058822631836, -0.5404490232467651, -0.3015317916870117, 0.26533815264701843, -0.055195100605487823, 0.18746481835842133, 0.40245071053504944, -0.03542988747358322, 0.07024150341749191, 0.4303293824195862, -0.003363505005836487, 0.8676902055740356, -0.16171002388000488, 0.15492390096187592, 0.17881715297698975, -0.3315954804420471, 0.014945441856980324, -0.6646163463592529, -0.010619767010211945, -0.3750586211681366, -0.14385460317134857, -0.016991782933473587, -0.38481706380844116, 0.22107988595962524, 0.039463650435209274, 0.21901825070381165, 0.31376880407333374, -0.19077695906162262, -0.040650125592947006, 0.12111617624759674, 0.1678299903869629, -0.24763759970664978, -0.2836263179779053, -0.25343605875968933, -0.04103300720453262, -0.08592332899570465, 0.126925989985466, -0.16750362515449524, -0.17866191267967224, 0.09302259981632233, 0.043090224266052246, -0.13120688498020172, 0.2892144024372101, 0.1978711038827896, -0.16101591289043427, 0.13622447848320007, -0.6383601427078247, 0.09807471930980682, 0.03093322552740574, -0.02413005381822586, 0.02005837671458721, -0.0849001556634903, 0.1119956523180008, -0.013211913406848907, -0.0789620578289032, 0.06953822821378708, -0.18433043360710144, 0.4778669774532318, 0.050597965717315674, -0.1828325390815735, 0.044773705303668976, -0.19545288383960724, -0.2773663401603699, 0.21696782112121582, 0.2310691922903061, 0.23193012177944183, -0.05973265320062637, 0.12796363234519958, 0.18555262684822083, -0.06303322315216064, -0.25219789147377014, -0.018560487776994705, -0.10398589074611664, -0.29239875078201294, 0.11957891285419464, -0.26246151328086853, -0.3692139685153961, -0.11766093969345093, 0.5325026512145996, -0.048920147120952606, 0.04233171045780182, 0.746902346611023, 0.3545561730861664, -0.30508989095687866, -0.18412178754806519, -0.221127450466156, 0.12365559488534927, -0.43735793232917786, 0.05382738634943962, -0.11087828129529953, 0.16700293123722076, 0.1457313746213913, -0.08022402226924896, -0.06149790436029434, -0.5722085237503052, -0.19312161207199097, -0.40966829657554626, -0.0910620465874672, -0.177632674574852, -0.09761691093444824, 0.04361288249492645, 0.10546988993883133, 0.04151742532849312, -0.07363104075193405, 0.1746353656053543, -0.11581210792064667, -0.08930742740631104, -0.22561654448509216, 0.08073155581951141, -0.1067308634519577, -0.23494404554367065, 0.05104462429881096, 0.021539749577641487, -0.0020354539155960083, 0.20672303438186646, 0.13396504521369934, -0.09447697550058365, -0.29795894026756287, 0.17041675746440887, 0.042651355266571045, 0.1873152256011963, 0.07875048369169235, -0.30068737268447876, -0.1563280075788498, -0.1344585120677948, 0.1787586659193039, -0.21756422519683838, 0.05188696086406708, -0.051688309758901596, 0.4111877679824829, 0.19724810123443604, -0.15326517820358276, -0.002327796071767807, 0.30584174394607544, -0.22311778366565704, 0.15954075753688812, 0.26085758209228516, -0.21537542343139648, 0.08080165088176727, -0.22883383929729462, 0.08769325166940689, 0.17376708984375, 0.06938855350017548, 0.4398258626461029, -0.5329623818397522, 0.08658888936042786, -0.11690768599510193, 0.3607500195503235, 0.778200626373291, 0.10353173315525055, -0.31415367126464844, 0.5704089403152466, -0.017239371314644814, -0.20264548063278198, -0.12793835997581482, -0.11951039731502533, 0.10839386284351349, -0.0019687525928020477, 0.22591984272003174, -0.13612161576747894, -0.18646296858787537, 0.26412367820739746, 0.10470505803823471, 0.15875008702278137, -0.07762023061513901, -0.03652011975646019, 0.164838045835495, -0.016330525279045105, 0.016735583543777466, 0.4049842059612274, 0.5309313535690308, 0.02206435054540634, 0.27106669545173645, 0.10340149700641632, 0.11851709336042404, -0.167613685131073, 0.11030976474285126, -0.21706509590148926, -0.551532506942749, 0.0853864774107933, 0.1407293677330017, 0.3273548483848572, 0.024320732802152634, 0.004334151744842529, 0.3405883014202118, 0.1455831229686737, -0.31868213415145874, -0.3623031973838806, 0.1744249016046524, -0.0748019590973854, 0.1268967092037201, 0.1039232611656189, -0.15685731172561646, -0.06110111624002457, 0.15681856870651245, 0.08461759239435196, -0.17040877044200897, 0.14097675681114197, 0.18165485560894012, 0.20517700910568237, -0.5014461278915405, -0.2626481354236603, -0.011072438210248947, 0.17036762833595276, -0.09766310453414917, 0.19367732107639313, -0.054098039865493774, -0.14553073048591614, -0.3209345042705536, -0.1495937705039978, 0.26194673776626587, 0.4146535396575928, -0.06961999833583832, 0.07908076047897339, -0.07894058525562286, 0.005509776994585991, -0.010849615558981895, 0.09199807047843933, -0.24038276076316833, 0.21356825530529022, 0.42831122875213623, -0.0744575709104538, 0.012594311498105526, -0.016514644026756287, 0.04728806018829346, 0.2458517849445343, -0.2801886200904846, 0.1537569761276245, 0.3377339243888855, 0.05411481112241745, -0.02292511984705925, -0.08564390987157822, -0.5657636523246765, 0.031193062663078308, 0.33927440643310547, -0.10616791993379593, 0.037961121648550034, 0.030610710382461548, 0.0021298155188560486, -0.07016755640506744, 0.5910798907279968, 0.23755532503128052, 0.2290952503681183, -0.23523074388504028, -0.16470429301261902, -0.39351364970207214, 0.007911182940006256, -0.3446938991546631, -0.03882327303290367, 0.350693017244339, 0.3487614393234253, 0.379147469997406, 0.04567886143922806, 0.23020149767398834, -0.08045120537281036, -0.32985401153564453, 0.6018739938735962, -0.4390297532081604, -0.2646653652191162, 0.08354818820953369, 0.1716478168964386, -0.16082841157913208, -0.3627817928791046, 0.1329394280910492, -0.036612845957279205, -0.05520990490913391, -0.026815835386514664, -0.2768934965133667, 0.21202857792377472, -0.5866454839706421, 0.37569671869277954, -0.25990554690361023, 0.0752357468008995, 0.1634698212146759, -0.13836981356143951, -0.26760241389274597, -0.11214424669742584, 0.027034107595682144, -0.07709059864282608, -0.1060837060213089, 0.08444932848215103, -0.17160680890083313, -0.03552784398198128, -0.43609747290611267, -0.003316554706543684, -0.019084084779024124, -0.13119003176689148, -0.011808186769485474, 0.1714836210012436, 0.13071569800376892, 0.3608753979206085, 0.07363925129175186, 0.21532270312309265, 0.22915105521678925, 0.2073839008808136, -0.4607524871826172, -0.04240447282791138, 0.44350165128707886, -0.3774226903915405, -0.5973464250564575, 0.21783965826034546, 0.10967636108398438, 0.16941609978675842, -0.03234255313873291, -0.3182682693004608, 0.21857568621635437, 0.11330469697713852, -0.07502496987581253, 0.0027431920170783997, 0.21433912217617035, 0.11566823720932007, 0.1423729807138443, -0.3448391854763031, 0.16903910040855408, 0.03564390167593956, -0.09665512293577194, -0.06352727860212326, -0.12159619480371475 ]
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
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 ```
[ -0.1563848853111267, -0.04011803865432739, -0.026112090796232224, 0.27627280354499817, 0.0020155515521764755, 0.09724234789609909, 0.4256720244884491, 0.24761535227298737, -0.07167793065309525, 0.2194664478302002, 0.021227069199085236, 0.33242067694664, -0.02397504448890686, 0.18956062197685242, -0.18950708210468292, -0.002742968499660492, 0.08053469657897949, 0.26331114768981934, 0.014589611440896988, -0.10969813913106918, 0.026919417083263397, 0.05575166642665863, -0.2450975626707077, -0.25248467922210693, -0.13999177515506744, -0.11033659428358078, 0.05797905474901199, -0.07466932386159897, 0.021731369197368622, -0.36813458800315857, 0.5503676533699036, 0.10591632127761841, 0.3780273199081421, 0.7747953534126282, -0.00012928817886859179, 0.1094386875629425, 0.24179264903068542, -0.015691746026277542, -0.5798144936561584, -0.2899017333984375, 0.1198696568608284, 0.011586761102080345, 0.13718077540397644, -0.16414561867713928, 0.025373980402946472, -0.17333543300628662, -0.0947616696357727, -0.3518211245536804, 0.05980975553393364, 0.020923804491758347, -0.0042894817888736725, 0.10893934965133667, -0.16864237189292908, 0.07944075763225555, 0.1715572029352188, 0.14901340007781982, -0.04024071991443634, 0.21059931814670563, 0.3471111059188843, -0.25862839818000793, -0.1763363778591156, 0.06609286367893219, 0.03532618284225464, 0.042928121984004974, 0.251507967710495, -0.18485446274280548, 0.15207788348197937, -0.15815891325473785, 0.12835249304771423, 0.040876924991607666, 0.5616927742958069, -0.19915106892585754, -0.3406810760498047, -0.2657358646392822, 0.0012109603267163038, -0.2750522494316101, 0.17689621448516846, 0.24701237678527832, -0.3503008484840393, -0.07710374891757965, 0.12648694217205048, 0.0673040971159935, -0.26174598932266235, 0.06924252957105637, -0.29755693674087524, 0.490560382604599, -0.023911908268928528, 0.21808159351348877, 0.2404642254114151, -0.027928460389375687, 0.22616150975227356, 0.12786510586738586, 0.09579601883888245, -0.002126876264810562, -0.8375096917152405, 0.1597389131784439, 0.03688468039035797, -0.10997600108385086, -0.1293419599533081, 0.14203277230262756, 0.07999841868877411, 0.06386856734752655, 0.3861542344093323, 0.17944274842739105, 0.4551112651824951, -0.22528260946273804, 0.1688060164451599, 0.00776731688529253, 0.13158732652664185, 0.19983616471290588, -0.07749485224485397, -0.011555284261703491, -0.2691590189933777, -0.2589019238948822, 0.32036399841308594, -0.2378038465976715, 0.15775421261787415, -0.34062421321868896, -0.0631120577454567, 0.19090236723423004, -0.17865902185440063, -0.13816030323505402, 0.19015006721019745, 0.5388684272766113, -0.21734291315078735, 0.20963293313980103, -0.04668314382433891, 0.21337175369262695, -0.06198178976774216, 0.05728287622332573, 0.11814101040363312, -0.16491703689098358, -0.19177812337875366, -0.014701901003718376, 0.12698476016521454, -0.5281556248664856, 0.08005490154027939, 0.1004105880856514, 0.18198974430561066, -0.09568130970001221, 0.07742372900247574, -0.23301568627357483, 0.12830062210559845, 0.19302910566329956, 0.013658680021762848, 0.13574828207492828, 0.11434583365917206, -0.13695871829986572, -0.2203807532787323, 0.010406523942947388, -0.13412201404571533, -0.03644847869873047, -0.1736646145582199, 0.015702249482274055, 0.09798983484506607, -0.18783661723136902, -0.1964436173439026, -0.4570772647857666, 0.2120637148618698, -0.007769182324409485, 0.10611632466316223, -0.19359587132930756, -0.014218378812074661, 0.05869016796350479, 0.0722997784614563, 0.3304532766342163, -0.6316624283790588, 0.34840744733810425, 0.15416015684604645, 0.19274088740348816, 0.21652263402938843, 0.030619783326983452, -0.3289879858493805, 0.3430008590221405, -0.32179880142211914, -0.3962016701698303, 0.47335734963417053, -0.33055904507637024, -0.10506759583950043, 0.49468493461608887, 0.02523038536310196, 0.2512849271297455, 0.2978608012199402, -0.2346315234899521, 0.1245807558298111, -0.09592381119728088, 0.2513723075389862, 0.15157923102378845, -0.018473954871296883, -0.004299221560359001, -0.15449322760105133, 0.1308274269104004, 0.09203442931175232, 0.3304192125797272, 0.16523951292037964, 0.25544965267181396, -0.14793646335601807, -0.23179243505001068, 0.3742850124835968, -0.12424178421497345, -0.016995202749967575, 0.5115296244621277, 0.38255736231803894, 0.47130298614501953, 0.25318190455436707, -0.0033579040318727493, -0.3512418866157532, 0.3146001100540161, 0.11692894995212555, -0.05768965929746628, -0.07513430714607239, 0.1696724146604538, -0.08202812075614929, 0.39277803897857666, -0.35019955039024353, -0.09316800534725189, -0.10995963215827942, 0.3672935664653778, 0.061214838176965714, -0.20008619129657745, -0.33355268836021423, 0.6228125691413879, -0.0785759836435318, 0.03920230641961098, -0.3477340638637543, 0.2516927421092987, 0.1607895940542221, -0.16602857410907745, -0.0173396747559309, -0.13433226943016052, 0.15602192282676697, -0.2520063519477844, -0.0989338606595993, 0.024651262909173965, 0.1357887089252472, -0.01313009113073349, -0.19901680946350098, -0.19753099977970123, 0.02930227294564247, 0.2383023202419281, 0.06595266610383987, -0.13938945531845093, 0.10896199196577072, -0.14504793286323547, 0.2418455183506012, 0.11129982769489288, 0.0189121775329113, 0.833318829536438, -0.07076998800039291, -0.05450255423784256, 0.213018998503685, 0.08599148690700531, -0.05452435463666916, 0.25631630420684814, 0.33366408944129944, -0.078193798661232, 0.7856041789054871, -0.051897309720516205, -0.333943247795105, 0.16721004247665405, 0.12984830141067505, 0.11136811971664429, -0.3609234094619751, 0.2877376973628998, 0.02255195379257202, 0.1802290380001068, 0.19141186773777008, 0.13022463023662567, 0.18937845528125763, 0.022270113229751587, 0.046496663242578506, -0.11738922446966171, -0.06920085102319717, 0.0038419626653194427, -0.08673294633626938, 0.3571845293045044, 0.5635448098182678, 0.2872074544429779, 0.03735597804188728, -0.06437645852565765, -0.12479618191719055, -0.536243736743927, -0.04554256796836853, 0.3289056718349457, -0.08295945823192596, 0.6204965114593506, -0.3499540388584137, 0.23124876618385315, -0.2118319272994995, -0.08455025404691696, -0.212824746966362, -0.2667785584926605, -0.4159841537475586, 0.665763258934021, 0.05189934000372887, 0.06587035208940506, 0.029334470629692078, 0.13623729348182678, 0.21088959276676178, -0.39849111437797546, -0.42757824063301086, -0.2785571813583374, -0.3824079930782318, -0.22312475740909576, 0.37019139528274536, -0.2446325719356537, 0.18858492374420166, -0.09432432800531387, -0.19124525785446167, -0.30112916231155396, -0.22253358364105225, 0.191608265042305, -0.09659846127033234, 0.3199852406978607, 0.1251363605260849, 0.32497936487197876, 0.019186489284038544, -0.2349599003791809, 0.03531026095151901, -0.000009045004844665527, 0.08143671602010727, 0.32486799359321594, 0.0311948973685503, 0.15249228477478027, 0.24637269973754883, 0.030758004635572433, -0.06503274291753769, -0.34378039836883545, 0.25198447704315186, -0.028060482814908028, 0.059082191437482834, -0.06262258440256119, 0.16593509912490845, 0.19196824729442596, -0.04640302062034607, 0.17584258317947388, 0.05143230780959129, -0.6687545776367188, 0.3127296566963196, -0.10804077982902527, -0.18634973466396332, 0.002189885824918747, -0.030055858194828033, 0.2877163290977478, 0.3097463846206665, -0.681655764579773, 0.19677916169166565, -0.1330011934041977, -0.09908417612314224, -0.3197813332080841, -0.023676736280322075, 0.12371215224266052, -0.010484108701348305, 0.08580052107572556, -0.021910812705755234, -0.10723051428794861, 0.24321553111076355, 0.00813082605600357, 0.16769230365753174, 0.1499146819114685, 0.5722647309303284, -0.03723534941673279, 0.4385005831718445, 0.24866631627082825, -0.09896548092365265, 0.5681047439575195, 0.19291172921657562, 0.16507136821746826, -0.02327374368906021, -0.3377804756164551, -0.15999452769756317, -0.13610556721687317, -0.2899037003517151, 0.060617897659540176, -0.2627701759338379, -0.414432168006897, -0.2468431144952774, -0.14154601097106934, 0.01650885120034218, -0.30249208211898804, 0.2993979752063751, -0.2916894257068634, 0.18983161449432373, -0.09848436713218689, 0.20031267404556274, -0.21866779029369354, 0.1095072478055954, -0.005854703485965729, 0.07865889370441437, 0.08872457593679428, 0.029342805966734886, 0.005853783339262009, 0.013906953856348991, -0.3458132743835449, 0.07956104725599289, 0.0017173073720186949, 0.6713675856590271, 0.07430024445056915, -0.25115498900413513, 0.14020420610904694, -0.4157087206840515, 1.0515447854995728, -0.08014901727437973, 0.12506288290023804, 0.15679703652858734, -0.36799877882003784, -0.2895094156265259, -0.2419394701719284, 0.009823467582464218, 0.0901600569486618, 0.12060175836086273, 0.5927040576934814, -0.2743128538131714, -0.4638434648513794, 0.08882322907447815, 0.03505140170454979, -0.17756421864032745, -0.37226757407188416, -0.3918216824531555, 0.05375459045171738, -0.2950182855129242, 0.13067221641540527, -0.20273719727993011, 0.2190982699394226, 0.1026754155755043, -0.06332743912935257, -0.26322734355926514, 0.03231353685259819, -0.0029021352529525757, 0.09090347588062286, 0.07567489147186279, -0.11544595658779144, 0.4991406798362732, 0.08330155909061432, 0.32202038168907166, 0.3776441514492035, 0.41237759590148926, 0.16833370923995972, -0.5872926712036133, 0.41656816005706787, 0.052568595856428146, 0.4953371584415436, 0.4315464198589325, -0.015494078397750854, -0.050202541053295135, -0.16390608251094818, 0.3775522708892822, -0.27481386065483093, 0.07944425940513611, 0.2733711302280426, 0.11134793609380722, -0.53751540184021, -0.2988037168979645, 0.26579782366752625, -0.0507320761680603, 0.20120500028133392, 0.4190137982368469, -0.07207757234573364, 0.0622636154294014, 0.44522690773010254, 0.023839272558689117, 0.8491901159286499, -0.12820692360401154, 0.15117128193378448, 0.20829224586486816, -0.3168538212776184, 0.02941921167075634, -0.6461663246154785, -0.0011827163398265839, -0.3765909969806671, -0.1343025267124176, -0.024632299318909645, -0.37968412041664124, 0.23121866583824158, 0.04116148129105568, 0.22518280148506165, 0.3298240005970001, -0.18330876529216766, -0.02310800924897194, 0.12256500869989395, 0.17707595229148865, -0.25249236822128296, -0.2973932921886444, -0.2576662302017212, -0.03725853189826012, -0.08522139489650726, 0.11247456073760986, -0.17918312549591064, -0.17745879292488098, 0.116817906498909, 0.04589758813381195, -0.13334205746650696, 0.28499212861061096, 0.19020432233810425, -0.17274782061576843, 0.12252378463745117, -0.6697735786437988, 0.0955437421798706, 0.0249821525067091, 0.0018898099660873413, 0.007694147527217865, -0.0775943472981453, 0.09767569601535797, -0.02930907905101776, -0.07983273267745972, 0.06813882291316986, -0.18374623358249664, 0.48421818017959595, 0.032750241458415985, -0.1592290997505188, 0.05273209884762764, -0.1988147646188736, -0.2908795475959778, 0.23680922389030457, 0.2371569275856018, 0.21977978944778442, -0.07451297342777252, 0.13429374992847443, 0.17335110902786255, -0.05639510601758957, -0.26051977276802063, -0.012442585080862045, -0.09927001595497131, -0.2895989418029785, 0.13873852789402008, -0.26935043931007385, -0.36641961336135864, -0.12485162913799286, 0.5290641188621521, -0.04167490452528, 0.06357076019048691, 0.7208547592163086, 0.36427873373031616, -0.3038625717163086, -0.17624375224113464, -0.23184800148010254, 0.11436296999454498, -0.43514278531074524, 0.04552420228719711, -0.11295635253190994, 0.15942330658435822, 0.1457863450050354, -0.0725243091583252, -0.07078992575407028, -0.5371657609939575, -0.17087455093860626, -0.4253939688205719, -0.07923229783773422, -0.15479768812656403, -0.10354600846767426, 0.052201442420482635, 0.11440736800432205, 0.036343105137348175, -0.09547693282365799, 0.17360909283161163, -0.12075874209403992, -0.10911663621664047, -0.21092167496681213, 0.06279146671295166, -0.11129111051559448, -0.21665993332862854, 0.04955413565039635, 0.041485998779535294, -0.008259565569460392, 0.22793853282928467, 0.11979658156633377, -0.09221304953098297, -0.2860737144947052, 0.1737079620361328, 0.04536886513233185, 0.16028974950313568, 0.09055665880441666, -0.30683743953704834, -0.17445172369480133, -0.1455705314874649, 0.16423283517360687, -0.2228742241859436, 0.036439843475818634, -0.054628994315862656, 0.3866022527217865, 0.21357306838035583, -0.15294142067432404, -0.00610530748963356, 0.3093423843383789, -0.21778099238872528, 0.1645451784133911, 0.2582581639289856, -0.22996611893177032, 0.06693187355995178, -0.2268085479736328, 0.07607941329479218, 0.1720229685306549, 0.06461939215660095, 0.4501070976257324, -0.5281917452812195, 0.08159884810447693, -0.15055899322032928, 0.3589479327201843, 0.761890709400177, 0.09427977353334427, -0.308001309633255, 0.5624474287033081, -0.024828435853123665, -0.2070024311542511, -0.15589512884616852, -0.138835608959198, 0.10363387316465378, -0.006739780306816101, 0.24660173058509827, -0.11340311169624329, -0.19193404912948608, 0.249354287981987, 0.11307884007692337, 0.19114936888217926, -0.058439143002033234, -0.04420940950512886, 0.15365424752235413, -0.04284045100212097, 0.033752359449863434, 0.4024216830730438, 0.5165188312530518, 0.04578295722603798, 0.24595972895622253, 0.09368391335010529, 0.12783671915531158, -0.16756078600883484, 0.0778590589761734, -0.2305813729763031, -0.586551308631897, 0.0768497958779335, 0.1292143315076828, 0.3396815061569214, 0.03605746477842331, -0.014671310782432556, 0.3283168077468872, 0.11513660848140717, -0.30549171566963196, -0.36410582065582275, 0.1602632999420166, -0.06836020201444626, 0.13345663249492645, 0.082993283867836, -0.1671072244644165, -0.04540739580988884, 0.14215978980064392, 0.09104566276073456, -0.1897411197423935, 0.132522851228714, 0.16173459589481354, 0.1928158700466156, -0.47695815563201904, -0.26095861196517944, -0.004303932189941406, 0.15631958842277527, -0.10133471339941025, 0.21371571719646454, -0.03558500111103058, -0.14136815071105957, -0.31763169169425964, -0.138342022895813, 0.2885831296443939, 0.4014030992984772, -0.048318374902009964, 0.08125697076320648, -0.09187503159046173, 0.022045349702239037, -0.008020307868719101, 0.08902101963758469, -0.2604356110095978, 0.197916641831398, 0.44064176082611084, -0.06846699118614197, 0.010527926497161388, -0.017179876565933228, 0.03980288282036781, 0.221445232629776, -0.2713771462440491, 0.16053670644760132, 0.34795743227005005, 0.06549514085054398, -0.0013744719326496124, -0.09476753324270248, -0.5493530035018921, 0.03536438196897507, 0.3542463183403015, -0.10336384922266006, 0.03492533043026924, 0.031495142728090286, 0.0009170621633529663, -0.07720184326171875, 0.5896949172019958, 0.22778667509555817, 0.21872925758361816, -0.22811122238636017, -0.15391305088996887, -0.3945877254009247, 0.01838352531194687, -0.36578062176704407, -0.024228591471910477, 0.3637907803058624, 0.330814391374588, 0.37537169456481934, 0.04764022305607796, 0.23882648348808289, -0.08520045131444931, -0.34145739674568176, 0.5784502029418945, -0.4412108063697815, -0.2872992753982544, 0.06261284649372101, 0.17969171702861786, -0.1480761468410492, -0.36583951115608215, 0.14010944962501526, -0.04404275864362717, -0.04990376532077789, -0.024064667522907257, -0.293165922164917, 0.22149336338043213, -0.6123090982437134, 0.39421525597572327, -0.26914694905281067, 0.060837648808956146, 0.15851089358329773, -0.13072499632835388, -0.27992793917655945, -0.10572678595781326, 0.017792493104934692, -0.07102394849061966, -0.10901010036468506, 0.11015760898590088, -0.1739521324634552, -0.03454015776515007, -0.4482210874557495, 0.02500644512474537, -0.027674000710248947, -0.1265295147895813, -0.002362079918384552, 0.1910540759563446, 0.11644589155912399, 0.3575860261917114, 0.09061535447835922, 0.2155137062072754, 0.21844708919525146, 0.20828908681869507, -0.47583431005477905, -0.053136810660362244, 0.44956642389297485, -0.3914570212364197, -0.5857256650924683, 0.20876866579055786, 0.08348189294338226, 0.18429917097091675, 0.001633496955037117, -0.3315640985965729, 0.21360740065574646, 0.10976359993219376, -0.07591370493173599, -0.009374860674142838, 0.1859257072210312, 0.10889820754528046, 0.13235291838645935, -0.32642480731010437, 0.1627417504787445, 0.003826068714261055, -0.11379434913396835, -0.043873097747564316, -0.11753127723932266 ]
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
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.
[ -0.09444297850131989, -0.06475373357534409, -0.029098303988575935, 0.3447765111923218, 0.04791253060102463, 0.09503508359193802, 0.45834895968437195, 0.2557198405265808, -0.0722559243440628, 0.2827421724796295, -0.019446847960352898, 0.35102713108062744, -0.0015756366774439812, 0.12524208426475525, -0.20255732536315918, -0.0027668848633766174, 0.04653529077768326, 0.28917670249938965, 0.016636982560157776, -0.1865251660346985, 0.02065505087375641, 0.023115618154406548, -0.2336353212594986, -0.26012033224105835, -0.2048167586326599, -0.07497768104076385, 0.10491354763507843, -0.11993623524904251, -0.02714245207607746, -0.35620325803756714, 0.597611665725708, 0.05594635754823685, 0.35612475872039795, 0.7832602858543396, -0.00013099714124109596, 0.14119143784046173, 0.20855163037776947, 0.01589585654437542, -0.6036479473114014, -0.24625106155872345, 0.14538007974624634, -0.04518233984708786, 0.20801615715026855, -0.2291511595249176, -0.003806851804256439, -0.13199597597122192, -0.1231793761253357, -0.3129329979419708, 0.08795347809791565, 0.012765522114932537, -0.03591306880116463, 0.09469881653785706, -0.16642911732196808, 0.08354628086090088, 0.19239385426044464, 0.09663908928632736, -0.04712709039449692, 0.22772441804409027, 0.27563637495040894, -0.1855323761701584, -0.16516172885894775, 0.08074933290481567, 0.04874107241630554, 0.039329566061496735, 0.24187016487121582, -0.1707860678434372, 0.18328982591629028, -0.1515171378850937, 0.13219019770622253, 0.06936484575271606, 0.546576976776123, -0.2147083580493927, -0.3018623888492584, -0.23058444261550903, -0.005733683705329895, -0.2945674657821655, 0.2087470293045044, 0.2721429169178009, -0.3267935812473297, -0.05193723365664482, 0.1636718064546585, -0.02517683058977127, -0.2979673147201538, 0.152333602309227, -0.42102673649787903, 0.4710610508918762, -0.04708104953169823, 0.21945106983184814, 0.18699946999549866, -0.05264364928007126, 0.17416581511497498, 0.16825997829437256, 0.1894049346446991, -0.0005686944350600243, -0.8054006099700928, 0.12935735285282135, 0.0163738951086998, -0.20540106296539307, -0.13202202320098877, 0.014132969081401825, 0.05706692487001419, 0.16003406047821045, 0.29203516244888306, 0.21162199974060059, 0.4291311204433441, -0.22672925889492035, 0.12952245771884918, 0.12917619943618774, 0.22329775989055634, 0.1328807771205902, -0.0581035390496254, 0.01609286107122898, -0.27060773968696594, -0.2669253349304199, 0.3138108253479004, -0.27339592576026917, 0.1386759877204895, -0.33880552649497986, -0.013446569442749023, 0.27134793996810913, -0.16453295946121216, -0.09476704150438309, 0.1757204234600067, 0.5118537545204163, -0.2741755545139313, 0.31092536449432373, 0.003407079726457596, 0.18743616342544556, -0.08968117833137512, 0.12402414530515671, 0.123961441218853, -0.09884095191955566, -0.187533900141716, -0.05282428115606308, 0.1296132653951645, -0.43533164262771606, 0.026502778753638268, 0.16289687156677246, 0.2478272020816803, -0.1274578869342804, 0.1265377700328827, -0.23703767359256744, 0.15503743290901184, 0.23251332342624664, -0.013675246387720108, 0.12008931487798691, 0.047515835613012314, -0.15358969569206238, -0.24384072422981262, 0.034184202551841736, -0.24452844262123108, -0.013634596019983292, -0.19751521944999695, -0.01606414094567299, 0.1530609279870987, -0.20745849609375, -0.19334664940834045, -0.46582531929016113, 0.2551034986972809, 0.048858288675546646, 0.1112990453839302, -0.23139722645282745, -0.07435563951730728, 0.02970191277563572, 0.10819072276353836, 0.2124217301607132, -0.6541258096694946, 0.3262147009372711, 0.1843351274728775, 0.2127426266670227, 0.1808018535375595, 0.12826238572597504, -0.32392099499702454, 0.2757982313632965, -0.29426249861717224, -0.41689592599868774, 0.5239505171775818, -0.3610864281654358, -0.134297713637352, 0.43496939539909363, 0.08998332917690277, 0.1333053708076477, 0.21877005696296692, -0.23057907819747925, 0.15585118532180786, -0.031035784631967545, 0.27255523204803467, 0.07100024819374084, -0.003794020041823387, -0.0009320694953203201, -0.1811418980360031, 0.10055029392242432, 0.12353600561618805, 0.3826617896556854, 0.2231854796409607, 0.18767724931240082, -0.18135178089141846, -0.1492355763912201, 0.3550998270511627, -0.11133246123790741, 0.006458813324570656, 0.5498011112213135, 0.3589990437030792, 0.4369656443595886, 0.29558897018432617, -0.09110979735851288, -0.3508274257183075, 0.2892219126224518, 0.04808943718671799, 0.03275470435619354, -0.0913456380367279, 0.21586276590824127, -0.09843529760837555, 0.3668159544467926, -0.2965180575847626, -0.002973254770040512, -0.14089104533195496, 0.2786087989807129, 0.059399787336587906, -0.13292238116264343, -0.340656578540802, 0.5239566564559937, -0.010961243882775307, 0.04553138092160225, -0.33779653906822205, 0.2803291082382202, 0.18488898873329163, -0.15051883459091187, -0.11116483807563782, -0.07180368155241013, 0.1426999717950821, -0.2533855736255646, -0.08471699059009552, 0.015921663492918015, 0.1515241265296936, -0.0718851238489151, -0.17149361968040466, -0.07085524499416351, 0.1605950891971588, 0.23221951723098755, 0.10281739383935928, -0.19239218533039093, 0.056854940950870514, -0.1259915679693222, 0.22465285658836365, 0.16572785377502441, 0.0826142281293869, 0.745435357093811, -0.08224732428789139, -0.06181871145963669, 0.23651763796806335, 0.06885512173175812, -0.05403221398591995, 0.20867007970809937, 0.32899922132492065, -0.08681967854499817, 0.7539048790931702, 0.00831490010023117, -0.3628234565258026, 0.117349773645401, 0.1684948056936264, 0.08597704768180847, -0.2683011591434479, 0.3061078190803528, -0.010116279125213623, 0.22514694929122925, 0.11133935302495956, 0.021141264587640762, 0.09944675117731094, 0.0029961527325212955, 0.06961236149072647, -0.11210893839597702, -0.14607788622379303, 0.006965024396777153, -0.1598776876926422, 0.3536962866783142, 0.5309144854545593, 0.2821601629257202, 0.10774385184049606, -0.03575412929058075, -0.13598477840423584, -0.38047555088996887, -0.004051581956446171, 0.29713693261146545, -0.09373404085636139, 0.5861688256263733, -0.3622545003890991, 0.36548224091529846, -0.25318387150764465, -0.06090276315808296, -0.252217561006546, -0.25344550609588623, -0.35451698303222656, 0.5996354222297668, 0.0787951797246933, 0.0691494420170784, 0.06890806555747986, 0.17031657695770264, 0.2467445582151413, -0.3781009316444397, -0.4766996204853058, -0.2670239508152008, -0.38719645142555237, -0.2509089410305023, 0.3128006160259247, -0.24634748697280884, 0.18424104154109955, -0.09558046609163284, -0.2856215834617615, -0.21844090521335602, -0.3250318765640259, 0.21533545851707458, -0.021461334079504013, 0.29358506202697754, 0.12228590995073318, 0.32427430152893066, -0.08011692017316818, -0.1448892056941986, 0.08587035536766052, 0.04179149866104126, 0.09325092285871506, 0.3781803548336029, 0.004924256354570389, 0.13732312619686127, 0.2241697609424591, -0.04122783988714218, -0.07744995504617691, -0.30891159176826477, 0.2315913587808609, -0.029136180877685547, 0.0599617101252079, -0.1564270257949829, 0.17615123093128204, 0.21141771972179413, -0.07899799942970276, 0.20682355761528015, 0.03223806992173195, -0.6613253355026245, 0.3999421000480652, -0.13659466803073883, -0.21718119084835052, -0.007845733314752579, -0.03606315702199936, 0.22447586059570312, 0.3025379776954651, -0.7120556831359863, 0.1864074170589447, -0.1781478077173233, -0.10707245767116547, -0.32868653535842896, 0.02096562460064888, 0.16099810600280762, -0.02295590750873089, 0.09830918908119202, -0.019755732268095016, -0.10857786238193512, 0.2737985849380493, 0.06105653941631317, 0.14665399491786957, 0.11363877356052399, 0.5104572176933289, 0.020274613052606583, 0.4627113938331604, 0.18362689018249512, -0.15276244282722473, 0.48145678639411926, 0.1318259984254837, 0.1465798020362854, -0.014451168477535248, -0.34517568349838257, -0.16727890074253082, -0.11172693967819214, -0.3083806037902832, 0.057115908712148666, -0.223539799451828, -0.3831707537174225, -0.23751074075698853, -0.1427364945411682, 0.0449962392449379, -0.3421524167060852, 0.28672370314598083, -0.33386436104774475, 0.19999590516090393, -0.060100071132183075, 0.19445985555648804, -0.24633380770683289, 0.08520856499671936, 0.038162462413311005, 0.05564368516206741, 0.012964494526386261, -0.0007277231197804213, -0.02589920349419117, 0.0036369541194289923, -0.328494668006897, 0.06745021045207977, -0.01106929685920477, 0.6763708591461182, 0.10848557949066162, -0.18988412618637085, 0.21194638311862946, -0.3891840875148773, 1.0847491025924683, -0.022042037919163704, 0.1044558435678482, 0.100520059466362, -0.4544261395931244, -0.36577093601226807, -0.20312005281448364, -0.006559651345014572, 0.05406644940376282, 0.13036969304084778, 0.7068526148796082, -0.32613706588745117, -0.4961113929748535, 0.11745567619800568, 0.049637436866760254, -0.2288602590560913, -0.3233075737953186, -0.4298202097415924, 0.061212629079818726, -0.28651973605155945, 0.09640912711620331, -0.2124205380678177, 0.1986137330532074, 0.16088458895683289, -0.09696356952190399, -0.28251001238822937, 0.031459059566259384, -0.0033167973160743713, 0.06530913710594177, 0.07499156892299652, -0.10967160761356354, 0.46435338258743286, 0.0898071676492691, 0.38301679491996765, 0.43828991055488586, 0.4155948758125305, 0.15856629610061646, -0.6203396320343018, 0.39832764863967896, 0.032461121678352356, 0.45895177125930786, 0.41774505376815796, -0.024218376725912094, -0.12039116770029068, -0.1480422466993332, 0.3748062252998352, -0.327115535736084, 0.12512727081775665, 0.24423570930957794, 0.15510384738445282, -0.5452674031257629, -0.2184232920408249, 0.30272337794303894, -0.04433627426624298, 0.20092757046222687, 0.3337373733520508, -0.09163059294223785, 0.07921452075242996, 0.45695585012435913, 0.10316923260688782, 0.8714702725410461, -0.26535600423812866, 0.19258703291416168, 0.2129877507686615, -0.2980148196220398, 0.11714070290327072, -0.7707149386405945, 0.004565125331282616, -0.40216386318206787, -0.10614743828773499, -0.044722780585289, -0.399029403924942, 0.19262167811393738, 0.04756098613142967, 0.21542304754257202, 0.2540760040283203, -0.14872047305107117, -0.07393033802509308, 0.06105650216341019, 0.2047785520553589, -0.17676496505737305, -0.29124686121940613, -0.19291169941425323, -0.04898844286799431, -0.12066437304019928, 0.10435865819454193, -0.17317315936088562, -0.17293396592140198, 0.04120710864663124, 0.021245505660772324, -0.09841883182525635, 0.26533254981040955, 0.16687273979187012, -0.06316566467285156, 0.21779459714889526, -0.6088393926620483, 0.04854680970311165, 0.04167766124010086, 0.07724586129188538, 0.02450595609843731, -0.07860859483480453, 0.10230658948421478, -0.09897752851247787, -0.14531844854354858, 0.17207075655460358, -0.14043383300304413, 0.5264853835105896, 0.056368663907051086, -0.1890760064125061, 0.009899728000164032, -0.17254188656806946, -0.2599666714668274, 0.19734156131744385, 0.27486521005630493, 0.21818691492080688, -0.10787133127450943, 0.1494615226984024, 0.11417090892791748, -0.057900868356227875, -0.22560711205005646, -0.016783446073532104, -0.04541506618261337, -0.2753736972808838, 0.18615582585334778, -0.21017427742481232, -0.3769669830799103, -0.09959515929222107, 0.5609695911407471, -0.013888627290725708, 0.0014515668153762817, 0.7198057174682617, 0.37438786029815674, -0.3043808341026306, -0.1701171100139618, -0.23392996191978455, 0.12458807229995728, -0.4108733534812927, 0.11369302868843079, -0.14099138975143433, 0.09434223175048828, 0.0842767059803009, -0.04413962736725807, -0.04032887518405914, -0.577652096748352, -0.16575069725513458, -0.4094719886779785, -0.11728730797767639, -0.16430488228797913, -0.01602686569094658, 0.06961929798126221, 0.18159565329551697, 0.07063640654087067, -0.12793610990047455, 0.1330900341272354, -0.09871230274438858, -0.013331690803170204, -0.26792293787002563, 0.11212887614965439, -0.11617021262645721, -0.2172834277153015, 0.019996635615825653, 0.030829504132270813, -0.025599868968129158, 0.2146136462688446, 0.11162884533405304, -0.06896744668483734, -0.30609452724456787, 0.17114581167697906, 0.04865836352109909, 0.1539180427789688, 0.055035609751939774, -0.35352033376693726, -0.18225474655628204, -0.14645719528198242, 0.13476064801216125, -0.1764146089553833, 0.007829025387763977, 0.07047394663095474, 0.3295477032661438, 0.22653380036354065, -0.08789276331663132, 0.010007472708821297, 0.3391307294368744, -0.1906643956899643, 0.15533186495304108, 0.26302725076675415, -0.20497077703475952, 0.0787871927022934, -0.271606981754303, 0.07351849973201752, 0.14339840412139893, -0.014837317168712616, 0.4424123167991638, -0.5359243154525757, 0.1153562068939209, -0.026252321898937225, 0.3623233437538147, 0.7729361057281494, 0.0361892394721508, -0.2775806784629822, 0.5638841390609741, -0.032813660800457, -0.19340655207633972, -0.15589523315429688, -0.013876914978027344, 0.10127099603414536, -0.03630032762885094, 0.22828544676303864, -0.10332359373569489, -0.1103701964020729, 0.2599654793739319, 0.13097041845321655, 0.11609320342540741, -0.2048795223236084, -0.02035178430378437, 0.14502468705177307, -0.10544966906309128, -0.014025811105966568, 0.39918994903564453, 0.5295016169548035, 0.02541670948266983, 0.37904244661331177, 0.14821429550647736, 0.08344931900501251, -0.18334639072418213, 0.07721550762653351, -0.22704535722732544, -0.478842169046402, 0.0919414684176445, 0.1892598569393158, 0.3407990336418152, -0.011684194207191467, -0.0002900809049606323, 0.3180655837059021, 0.17670737206935883, -0.2884869873523712, -0.37323689460754395, 0.18441109359264374, -0.12846440076828003, 0.11573168635368347, 0.10043065249919891, -0.16790804266929626, -0.017178181558847427, 0.12897425889968872, 0.07541713863611221, -0.12699384987354279, 0.23284345865249634, 0.25394344329833984, 0.19318178296089172, -0.46483930945396423, -0.22758278250694275, 0.008659575134515762, 0.17736242711544037, -0.10658486187458038, 0.17008118331432343, -0.05581843852996826, -0.19864565134048462, -0.3560180366039276, -0.17537610232830048, 0.2550017833709717, 0.46738454699516296, -0.11123865842819214, 0.07557065039873123, -0.07774721086025238, 0.02897859551012516, -0.03953443840146065, 0.08901581913232803, -0.2400093376636505, 0.25381654500961304, 0.40793687105178833, -0.09085152298212051, 0.015707019716501236, -0.026266124099493027, -0.002107638865709305, 0.2600843608379364, -0.3089159429073334, 0.16416674852371216, 0.35943514108657837, 0.032255806028842926, -0.01244429498910904, -0.13555839657783508, -0.5513191223144531, 0.021341685205698013, 0.32903236150741577, -0.07981500029563904, 0.07349028438329697, -0.0009667515987530351, -0.00940826814621687, -0.08988398313522339, 0.5833278298377991, 0.2758692502975464, 0.18172097206115723, -0.20734263956546783, -0.07838702201843262, -0.3495037853717804, 0.03941292315721512, -0.320485383272171, -0.05369613319635391, 0.3817809224128723, 0.39652085304260254, 0.38495197892189026, 0.0380936823785305, 0.19707299768924713, -0.2106018364429474, -0.26490017771720886, 0.5181781053543091, -0.4095965325832367, -0.24231310188770294, 0.01248953491449356, 0.17021411657333374, -0.1064704954624176, -0.3948115408420563, 0.16370603442192078, -0.020331989973783493, -0.08789156377315521, -0.05628437548875809, -0.24769000709056854, 0.1516657918691635, -0.5446382761001587, 0.4218221604824066, -0.2365921437740326, 0.09660946577787399, 0.15069490671157837, -0.1265638768672943, -0.20675241947174072, -0.07696246355772018, -0.006628741975873709, -0.010949917137622833, -0.12476561963558197, 0.09555957466363907, -0.26800423860549927, -0.06822051107883453, -0.4570605456829071, -0.07247666269540787, -0.057333290576934814, -0.18723474442958832, 0.024541465565562248, 0.21841023862361908, 0.1726575791835785, 0.3321307599544525, 0.10387258231639862, 0.24021819233894348, 0.28113192319869995, 0.22052183747291565, -0.4396591782569885, -0.06875688582658768, 0.4039904475212097, -0.33131128549575806, -0.6204609870910645, 0.17002300918102264, 0.10082793235778809, 0.17963522672653198, -0.038108207285404205, -0.454497367143631, 0.17924925684928894, 0.10753313452005386, -0.0555395632982254, -0.06117509305477142, 0.18437151610851288, 0.18606214225292206, 0.10838218033313751, -0.347337007522583, 0.2590453326702118, 0.011267876252532005, -0.06518390774726868, -0.09828867018222809, -0.12423361837863922 ]
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
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)))) ```
[ -0.06654274463653564, -0.02089744806289673, -0.018205003812909126, 0.259533554315567, 0.08013083785772324, 0.0900522992014885, 0.473732590675354, 0.23492825031280518, -0.06655088067054749, 0.2405540645122528, -0.01982230320572853, 0.3410205841064453, 0.03522254899144173, 0.13594551384449005, -0.22777073085308075, 0.021456433460116386, 0.0927208811044693, 0.2636975347995758, 0.014105692505836487, -0.20109541714191437, 0.00975191593170166, -0.011791156604886055, -0.24572023749351501, -0.2761128544807434, -0.08044649660587311, -0.08472970128059387, 0.08444387465715408, -0.12441236525774002, -0.024463040754199028, -0.3122103810310364, 0.5938937067985535, 0.1372862160205841, 0.3924270272254944, 0.7136006951332092, -0.00012859424168709666, 0.10374189913272858, 0.2674587368965149, -0.015013190917670727, -0.59006667137146, -0.27604955434799194, 0.1850811243057251, -0.030546529218554497, 0.21627219021320343, -0.19792816042900085, -0.02724922075867653, -0.22507596015930176, -0.12698189914226532, -0.33901140093803406, 0.04844526946544647, -0.009555739350616932, 0.00008316338062286377, 0.06168370693922043, -0.1521347165107727, 0.08234062045812607, 0.09359365701675415, 0.11129984259605408, -0.05623012036085129, 0.22527442872524261, 0.2640102803707123, -0.19433455169200897, -0.26421481370925903, 0.04746156558394432, 0.042937271296978, 0.027274824678897858, 0.23128372430801392, -0.2106042355298996, 0.14007586240768433, -0.13898493349552155, 0.18896105885505676, 0.08321491628885269, 0.44090694189071655, -0.16500753164291382, -0.32640206813812256, -0.2252083122730255, 0.04292754456400871, -0.23213639855384827, 0.1949043869972229, 0.24207794666290283, -0.31203505396842957, -0.05517848953604698, 0.11374111473560333, 0.09220557659864426, -0.18330438435077667, 0.152080237865448, -0.35291483998298645, 0.4188792109489441, -0.06979496777057648, 0.23363956809043884, 0.2580268383026123, -0.062534399330616, 0.2844350039958954, 0.13708505034446716, 0.1620623916387558, 0.008652808144688606, -0.8546208143234253, 0.21153438091278076, 0.11138755083084106, -0.1535315215587616, -0.16971039772033691, -0.00965544581413269, 0.05329018086194992, 0.1394605189561844, 0.32232755422592163, 0.18436703085899353, 0.47776898741722107, -0.20042912662029266, 0.14686161279678345, 0.02950911596417427, 0.19027939438819885, 0.20728740096092224, -0.04692908748984337, 0.02528417855501175, -0.26998573541641235, -0.21674159169197083, 0.2534731328487396, -0.30246680974960327, 0.09451751410961151, -0.38329261541366577, -0.03337438777089119, 0.22384510934352875, -0.13321053981781006, -0.08649709075689316, 0.16773264110088348, 0.5376348495483398, -0.1663048416376114, 0.3127739131450653, -0.03889308124780655, 0.22562851011753082, -0.012106472626328468, 0.09975919127464294, 0.10768039524555206, -0.16675084829330444, -0.2054489552974701, -0.07964534312486649, 0.12629921734333038, -0.5250718593597412, 0.03480852395296097, 0.16097261011600494, 0.15697410702705383, -0.0762024074792862, 0.04418405145406723, -0.22190767526626587, 0.19219496846199036, 0.18837657570838928, 0.0027678534388542175, 0.129811093211174, 0.19864748418331146, -0.2096969485282898, -0.23528721928596497, -0.06757592409849167, -0.09287262707948685, 0.022822987288236618, -0.22781486809253693, 0.00301639037206769, 0.18788032233715057, -0.15278615057468414, -0.18228530883789062, -0.3975495994091034, 0.14918941259384155, 0.0029239915311336517, 0.1126471608877182, -0.2652828097343445, -0.03443828970193863, 0.024860773235559464, 0.09042823314666748, 0.28571027517318726, -0.6211115121841431, 0.3227314352989197, 0.11709161102771759, 0.23534263670444489, 0.21869614720344543, 0.12169584631919861, -0.34499067068099976, 0.22553566098213196, -0.34610602259635925, -0.450497567653656, 0.5026891231536865, -0.28879600763320923, -0.08841677755117416, 0.4711695909500122, 0.06991779804229736, 0.24793972074985504, 0.2451869547367096, -0.24807971715927124, 0.15927772223949432, -0.06640210002660751, 0.3121720254421234, 0.1761564016342163, -0.029119757935404778, -0.0058393049985170364, -0.15675818920135498, 0.12527760863304138, 0.11689931154251099, 0.32065486907958984, 0.09944887459278107, 0.2791697084903717, -0.10069546848535538, -0.2660853862762451, 0.29474738240242004, -0.14775608479976654, -0.01902843825519085, 0.5215672850608826, 0.3193866014480591, 0.392067015171051, 0.22971677780151367, 0.0808088555932045, -0.40747562050819397, 0.30530649423599243, 0.17952747642993927, -0.027738958597183228, -0.12119239568710327, 0.1767812818288803, -0.06732761859893799, 0.2857675552368164, -0.3115842938423157, -0.07634000480175018, -0.10993140935897827, 0.36523205041885376, 0.08949728310108185, -0.1562419980764389, -0.29795771837234497, 0.5527724623680115, -0.1171870231628418, -0.006454279646277428, -0.3481179475784302, 0.20790395140647888, 0.1726399064064026, -0.1631278246641159, -0.04243597760796547, -0.09860353916883469, 0.18333177268505096, -0.23536618053913116, -0.11050847172737122, 0.029483433812856674, 0.10314874351024628, -0.042842552065849304, -0.16649100184440613, -0.14197851717472076, 0.07447657734155655, 0.25758472084999084, 0.08282306045293808, -0.18260693550109863, 0.06748486310243607, -0.16866064071655273, 0.2428356409072876, 0.18832635879516602, 0.06913628429174423, 0.8325302600860596, -0.05118255689740181, -0.0026225801557302475, 0.26841476559638977, 0.13715121150016785, -0.02587626501917839, 0.21357041597366333, 0.31183093786239624, -0.09726180136203766, 0.7539966702461243, 0.0027737002819776535, -0.37386414408683777, 0.16418024897575378, 0.11090356111526489, 0.0936322808265686, -0.33068564534187317, 0.3224716782569885, 0.0069994330406188965, 0.15326577425003052, 0.18133477866649628, 0.1383654773235321, 0.13542573153972626, 0.02179211750626564, 0.056876007467508316, -0.1158875897526741, -0.10670556873083115, 0.041407473385334015, -0.1423112452030182, 0.30887338519096375, 0.4941817820072174, 0.29207843542099, 0.08773339539766312, -0.01847914233803749, -0.14856839179992676, -0.4351504147052765, -0.07018515467643738, 0.29428669810295105, -0.08080238103866577, 0.6000446677207947, -0.3874644339084625, 0.2760811746120453, -0.2349933236837387, -0.051272306591272354, -0.19208082556724548, -0.28295302391052246, -0.43879109621047974, 0.5873831510543823, 0.02574947103857994, 0.1105106845498085, -0.019076086580753326, 0.08607606589794159, 0.24644367396831512, -0.42209818959236145, -0.4788956344127655, -0.22753028571605682, -0.3916204869747162, -0.2403302788734436, 0.35676732659339905, -0.23735280334949493, 0.16249039769172668, -0.04473844915628433, -0.2402433604001999, -0.322060763835907, -0.3193672299385071, 0.2158997803926468, -0.10055695474147797, 0.34055718779563904, 0.1587984263896942, 0.3343041241168976, -0.08166433870792389, -0.2360335737466812, 0.060475967824459076, -0.02290596440434456, 0.07188017666339874, 0.37047258019447327, 0.039123162627220154, 0.16206911206245422, 0.21729904413223267, -0.0223202183842659, -0.06267458945512772, -0.36993783712387085, 0.22948849201202393, -0.08360092341899872, -0.02254197746515274, -0.13679403066635132, 0.144784078001976, 0.2109658122062683, 0.007981818169355392, 0.23532839119434357, 0.030978677794337273, -0.5510843396186829, 0.3564746677875519, -0.05897507444024086, -0.20427671074867249, -0.07987001538276672, -0.09038306027650833, 0.2189512550830841, 0.32879483699798584, -0.7069646716117859, 0.1778695285320282, -0.1567886471748352, -0.07135230302810669, -0.3246045410633087, -0.01044616661965847, 0.1319361925125122, 0.0011900682002305984, 0.08412937819957733, -0.012237463146448135, -0.11581876873970032, 0.23517462611198425, 0.06148234382271767, 0.14530973136425018, 0.11011934280395508, 0.6345436573028564, -0.06940452009439468, 0.4122023582458496, 0.1312810480594635, -0.20544768869876862, 0.5629236698150635, 0.20100907981395721, 0.23397579789161682, -0.05016889423131943, -0.3395189046859741, -0.13704797625541687, -0.12271198630332947, -0.30136001110076904, 0.051634613424539566, -0.2737973928451538, -0.47761091589927673, -0.22792929410934448, -0.10160605609416962, 0.02962575852870941, -0.3180999159812927, 0.32751861214637756, -0.2420836091041565, 0.19155336916446686, -0.09333035349845886, 0.19595718383789062, -0.11787642538547516, 0.07085277885198593, -0.013088664039969444, 0.04969164729118347, 0.03998787701129913, 0.028258617967367172, 0.08285306394100189, 0.017896464094519615, -0.3223251700401306, 0.10304699093103409, 0.01170123927295208, 0.6980000138282776, 0.12916484475135803, -0.2807061970233917, 0.16129331290721893, -0.3634226322174072, 1.0772463083267212, -0.06730838119983673, 0.06997551769018173, 0.16298547387123108, -0.3610789179801941, -0.33852818608283997, -0.24015027284622192, 0.00035121291875839233, 0.0323331281542778, 0.1758795827627182, 0.6726390719413757, -0.2817722260951996, -0.48492056131362915, 0.1208217442035675, 0.05886990949511528, -0.1579030603170395, -0.33217912912368774, -0.41069453954696655, 0.023831799626350403, -0.2791280448436737, 0.15059956908226013, -0.20410986244678497, 0.20998515188694, 0.07244838774204254, -0.058676578104496, -0.31548160314559937, 0.03480985760688782, -0.01637490838766098, 0.0745307058095932, 0.10491661727428436, -0.08557532727718353, 0.5007957220077515, 0.0957387238740921, 0.4065662622451782, 0.36349403858184814, 0.4176529347896576, 0.1606011986732483, -0.5319434404373169, 0.461606502532959, 0.07472831010818481, 0.4526493549346924, 0.44345006346702576, 0.008461377583444118, -0.04371582716703415, -0.18625114858150482, 0.35230064392089844, -0.2473403513431549, 0.06282298266887665, 0.26937222480773926, 0.07310646027326584, -0.5514349341392517, -0.25109508633613586, 0.3205491006374359, -0.0885775238275528, 0.2141217440366745, 0.3246324360370636, -0.029905162751674652, 0.07086730003356934, 0.47606348991394043, 0.03417152166366577, 0.8705956339836121, -0.24267636239528656, 0.17353449761867523, 0.1430223435163498, -0.33778613805770874, 0.09399859607219696, -0.7046588659286499, -0.03679322823882103, -0.3951180875301361, -0.17244188487529755, -0.025769749656319618, -0.3663425147533417, 0.18476657569408417, 0.03494708985090256, 0.19304858148097992, 0.3650992512702942, -0.23521485924720764, -0.028946738690137863, 0.08999484032392502, 0.1673351526260376, -0.18935689330101013, -0.3333316445350647, -0.27424919605255127, -0.0371716283261776, -0.07643556594848633, 0.06806884706020355, -0.09715583175420761, -0.1416196972131729, 0.11582516133785248, 0.020699936896562576, -0.0826062560081482, 0.28931868076324463, 0.208724707365036, -0.08805965632200241, 0.18426744639873505, -0.6233507990837097, 0.08469074964523315, 0.05396312475204468, 0.00043077021837234497, -0.005256276577711105, -0.04961066693067551, 0.11137929558753967, 0.07084988802671432, -0.044832803308963776, 0.14977607131004333, -0.21336106956005096, 0.5097319483757019, 0.12861105799674988, -0.13438251614570618, 0.010589085519313812, -0.2190619707107544, -0.2553573548793793, 0.18809223175048828, 0.27484840154647827, 0.2096197009086609, -0.11131876707077026, 0.10542047023773193, 0.13644357025623322, -0.034732215106487274, -0.26375141739845276, -0.008869603276252747, -0.099127858877182, -0.2652830183506012, 0.0743376836180687, -0.20421959459781647, -0.38435131311416626, -0.13205114006996155, 0.5401942729949951, -0.05423712730407715, 0.0325082391500473, 0.6898304224014282, 0.34207865595817566, -0.3044710159301758, -0.16131381690502167, -0.2729508578777313, 0.09093084186315536, -0.369856059551239, 0.09075994044542313, -0.16474923491477966, 0.0785192996263504, 0.07916349917650223, -0.10130785405635834, -0.0666477307677269, -0.5634880065917969, -0.22421090304851532, -0.39455559849739075, -0.10308708250522614, -0.17764608561992645, -0.06821218132972717, 0.06825423985719681, 0.13129925727844238, -0.009022293612360954, -0.1322258561849594, 0.120346799492836, -0.11498073488473892, -0.11254962533712387, -0.24857980012893677, 0.09562601894140244, -0.11686092615127563, -0.2051248550415039, 0.09828053414821625, 0.0466882698237896, 0.021571511402726173, 0.2067071944475174, 0.12592509388923645, -0.08399118483066559, -0.30289754271507263, 0.1691737174987793, 0.0414678230881691, 0.21970553696155548, 0.07504650205373764, -0.32761240005493164, -0.2062525451183319, -0.19634832441806793, 0.14621107280254364, -0.2543773055076599, 0.042057834565639496, -0.07283416390419006, 0.3077680170536041, 0.18680515885353088, -0.04202909767627716, -0.013909641653299332, 0.2907184362411499, -0.20924566686153412, 0.13657891750335693, 0.2664371430873871, -0.22106215357780457, 0.10524687170982361, -0.2036665827035904, 0.05983489751815796, 0.13045303523540497, 0.03582645207643509, 0.3946574032306671, -0.44282108545303345, 0.0494203083217144, -0.13278727233409882, 0.39944010972976685, 0.7907026410102844, 0.016487153246998787, -0.3324843645095825, 0.5864158272743225, -0.027220705524086952, -0.16866573691368103, -0.08069274574518204, -0.08362312614917755, 0.09484776109457016, 0.018370579928159714, 0.24077895283699036, -0.11257989704608917, -0.19620159268379211, 0.27595484256744385, 0.0912504568696022, 0.14440567791461945, -0.16032811999320984, -0.022328170016407967, 0.12721316516399384, -0.0515577532351017, 0.0047423988580703735, 0.4210626482963562, 0.4528670907020569, 0.037927791476249695, 0.27228957414627075, 0.10225345939397812, -0.01604890637099743, -0.17937228083610535, 0.12962046265602112, -0.21178722381591797, -0.546454906463623, 0.23666289448738098, 0.21036206185817719, 0.3011680841445923, 0.05045101419091225, 0.006807863712310791, 0.3378969132900238, 0.09982050210237503, -0.31202954053878784, -0.3815056383609772, 0.20768316090106964, -0.12425065785646439, 0.08381602168083191, 0.20595359802246094, -0.13481928408145905, -0.11137717962265015, 0.1980741024017334, 0.08423618972301483, -0.13443058729171753, 0.08534648269414902, 0.24498997628688812, 0.2157089114189148, -0.48864543437957764, -0.2342376708984375, -0.05376008152961731, 0.20472517609596252, -0.07698345184326172, 0.2255142331123352, -0.03618535399436951, -0.12160345911979675, -0.294206827878952, -0.19248904287815094, 0.272984117269516, 0.4757356643676758, -0.086391881108284, 0.024238478392362595, -0.03170289844274521, 0.0035046152770519257, -0.018887678161263466, 0.13051077723503113, -0.2498915195465088, 0.25967082381248474, 0.430350661277771, -0.06363139301538467, -0.021906329318881035, -0.07188871502876282, -0.016741331666707993, 0.2937265634536743, -0.2567001283168793, 0.19878707826137543, 0.3534186780452728, 0.13321056962013245, -0.03314638137817383, -0.09757804125547409, -0.5591741800308228, 0.05101611092686653, 0.3328946530818939, -0.11406063288450241, 0.08348047733306885, 0.048440732061862946, 0.011391710489988327, -0.028699342161417007, 0.5511323809623718, 0.27572962641716003, 0.1766919493675232, -0.2007555216550827, -0.15340667963027954, -0.38948124647140503, -0.0023450180888175964, -0.27714309096336365, -0.09119052439928055, 0.3612026572227478, 0.39702388644218445, 0.4005507230758667, 0.03570542857050896, 0.17090953886508942, -0.1649131178855896, -0.2883461117744446, 0.5332807898521423, -0.35848209261894226, -0.3011513948440552, -0.028348736464977264, 0.12227465957403183, -0.16467460989952087, -0.40878722071647644, 0.09640748798847198, 0.03182811662554741, -0.03945596143603325, 0.0070912204682827, -0.2551419138908386, 0.1360226571559906, -0.6487051248550415, 0.39415454864501953, -0.24098140001296997, 0.09119213372468948, 0.16849741339683533, -0.14768467843532562, -0.2598000466823578, -0.14837630093097687, -0.010180938057601452, -0.057821162045001984, -0.14925985038280487, 0.13917507231235504, -0.16721642017364502, -0.0858110785484314, -0.4756370186805725, 0.041163429617881775, -0.014370497316122055, -0.1510438323020935, -0.01605149358510971, 0.22040864825248718, 0.12435727566480637, 0.33257976174354553, 0.034434448927640915, 0.21407026052474976, 0.2747594118118286, 0.28296056389808655, -0.39572465419769287, -0.09159690141677856, 0.4332873821258545, -0.4096333384513855, -0.5856463313102722, 0.2753838002681732, 0.06776393949985504, 0.15426111221313477, 0.0028769243508577347, -0.4142307937145233, 0.217746764421463, 0.09099695831537247, -0.09660074859857559, -0.013558873906731606, 0.21282389760017395, 0.07428242266178131, 0.12169584631919861, -0.3674546480178833, 0.11429294943809509, 0.0536392480134964, -0.08719494938850403, -0.055672526359558105, -0.09899647533893585 ]
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
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.
[ -0.09866772592067719, -0.05150693655014038, -0.0060966890305280685, 0.25379228591918945, 0.03468255698680878, 0.12388598173856735, 0.5064866542816162, 0.27355942130088806, -0.14257481694221497, 0.21018089354038239, -0.024298863485455513, 0.3711855411529541, 0.0008322000503540039, 0.136659637093544, -0.19797545671463013, 0.025907427072525024, 0.06171966716647148, 0.24372489750385284, 0.041448067873716354, -0.1403292715549469, -0.020195668563246727, 0.05664074420928955, -0.2577371597290039, -0.28897684812545776, -0.20135998725891113, -0.12482433766126633, 0.0640057623386383, -0.059562861919403076, 0.04773829132318497, -0.3754054307937622, 0.6273662447929382, 0.1659674048423767, 0.2872539162635803, 0.7220770716667175, -0.00013000910985283554, 0.11339595913887024, 0.20158784091472626, -0.016969511285424232, -0.5561368465423584, -0.22837771475315094, 0.1487550437450409, -0.02835243195295334, 0.13656574487686157, -0.2263716757297516, -0.03119855932891369, -0.2532840371131897, -0.14449453353881836, -0.34597599506378174, 0.09319397062063217, 0.036373987793922424, -0.024023372679948807, 0.07979996502399445, -0.1484609991312027, 0.09127402305603027, 0.10743861645460129, 0.14451467990875244, -0.057326607406139374, 0.20969389379024506, 0.32450389862060547, -0.1905466765165329, -0.1802992820739746, 0.08628442883491516, 0.03125779330730438, 0.04009059816598892, 0.25563403964042664, -0.1820027232170105, 0.06414490193128586, -0.095348060131073, 0.13927164673805237, 0.06389398127794266, 0.513033926486969, -0.22444328665733337, -0.310875803232193, -0.3355446457862854, 0.0031217322684824467, -0.2911781668663025, 0.24076932668685913, 0.21541529893875122, -0.3218623995780945, -0.05702510103583336, 0.07721637934446335, 0.010979605838656425, -0.28088563680648804, 0.12795975804328918, -0.3354937434196472, 0.4021764099597931, -0.057515405118465424, 0.21048405766487122, 0.26209405064582825, -0.026880651712417603, 0.28931576013565063, 0.150803804397583, 0.138168066740036, 0.038076043128967285, -0.8043261170387268, 0.12122832238674164, 0.04584641754627228, -0.2185354232788086, -0.10324475169181824, 0.06341039389371872, -0.007936329580843449, 0.12900444865226746, 0.25059330463409424, 0.20049548149108887, 0.4932253360748291, -0.21018683910369873, 0.07505018264055252, 0.05121110752224922, 0.20987147092819214, 0.12225509434938431, 0.003034442663192749, 0.05995694547891617, -0.25951117277145386, -0.27582287788391113, 0.32175177335739136, -0.2653084397315979, 0.1571614146232605, -0.38458842039108276, -0.04372088983654976, 0.21171605587005615, -0.231930673122406, -0.09703337401151657, 0.11169333755970001, 0.4763825237751007, -0.20763951539993286, 0.20119571685791016, -0.0038237720727920532, 0.20535871386528015, -0.049886636435985565, 0.13561908900737762, 0.13666006922721863, -0.15605151653289795, -0.14570170640945435, -0.05390063673257828, 0.15671174228191376, -0.5025505423545837, 0.022038711234927177, 0.12160850316286087, 0.2056189477443695, -0.12982816994190216, 0.1149822324514389, -0.2105219066143036, 0.2633194923400879, 0.19303585588932037, -0.021990206092596054, 0.12915581464767456, 0.12191629409790039, -0.2014233022928238, -0.26243579387664795, 0.028958305716514587, -0.21740129590034485, -0.0469960942864418, -0.2071889489889145, -0.0076389675959944725, 0.07724747061729431, -0.18721064925193787, -0.15304365754127502, -0.3964342474937439, 0.21027469635009766, 0.035668741911649704, 0.08639273792505264, -0.25429123640060425, -0.055534668266773224, 0.061199940741062164, 0.10357470065355301, 0.24536043405532837, -0.6491330862045288, 0.2790546715259552, 0.19600673019886017, 0.20419999957084656, 0.19090954959392548, 0.13038310408592224, -0.3386554419994354, 0.33191588521003723, -0.31611084938049316, -0.4061042070388794, 0.49081680178642273, -0.22809447348117828, -0.16203635931015015, 0.44457146525382996, 0.09259310364723206, 0.31809329986572266, 0.20553608238697052, -0.21597114205360413, 0.12343289703130722, -0.09481318295001984, 0.3008336126804352, 0.12916377186775208, -0.04196452349424362, -0.014012942090630531, -0.1865134984254837, 0.12112440168857574, 0.11609000712633133, 0.3383251130580902, 0.15198086202144623, 0.20379844307899475, -0.19803789258003235, -0.1706884652376175, 0.36651498079299927, -0.1482418179512024, -0.008386530913412571, 0.5470357537269592, 0.3419116735458374, 0.4173925518989563, 0.31429463624954224, -0.016125567257404327, -0.40624305605888367, 0.2835884690284729, 0.08763256669044495, 0.004692498594522476, -0.1530366688966751, 0.10904672741889954, -0.08354569971561432, 0.31931307911872864, -0.37373781204223633, -0.07413244247436523, -0.1282472312450409, 0.30821800231933594, 0.06188054755330086, -0.19580794870853424, -0.37534353137016296, 0.5987242460250854, -0.07216722518205643, -0.01358048152178526, -0.36149370670318604, 0.21686413884162903, 0.20518264174461365, -0.1648906171321869, -0.020742880180478096, -0.008548460900783539, 0.14468172192573547, -0.3190103769302368, -0.1080981194972992, 0.0256205964833498, 0.13101725280284882, -0.04660135507583618, -0.24211597442626953, -0.07350711524486542, 0.11964906007051468, 0.2766721546649933, 0.028268558904528618, -0.1607893705368042, 0.04240802675485611, -0.1427524983882904, 0.169311061501503, 0.19170162081718445, -0.01395183801651001, 0.8178407549858093, -0.07761923968791962, -0.03643222898244858, 0.2766304910182953, 0.08060461282730103, -0.05988895148038864, 0.21035891771316528, 0.28254255652427673, -0.09602828323841095, 0.6597723364830017, 0.001912551000714302, -0.3548356294631958, 0.18189439177513123, 0.21890297532081604, 0.08957025408744812, -0.32744041085243225, 0.28298112750053406, -0.004767514765262604, 0.15771624445915222, 0.1503845751285553, 0.06533637642860413, 0.11448172479867935, 0.01230000238865614, 0.03918908163905144, -0.044244520366191864, -0.13890312612056732, 0.020901571959257126, -0.1160009428858757, 0.3801930546760559, 0.5351851582527161, 0.26908278465270996, 0.06530969589948654, -0.047443125396966934, -0.14423665404319763, -0.458822101354599, -0.041411466896533966, 0.3201219439506531, -0.1121499091386795, 0.614643931388855, -0.4058811366558075, 0.25540855526924133, -0.2512194514274597, -0.06177282705903053, -0.21642549335956573, -0.29740944504737854, -0.3567236661911011, 0.6690154671669006, 0.0740630179643631, 0.08866188675165176, 0.06536836922168732, 0.2154313176870346, 0.22551532089710236, -0.43655797839164734, -0.45902079343795776, -0.3077545166015625, -0.38524946570396423, -0.23252429068088531, 0.3593824803829193, -0.36180761456489563, 0.1947270929813385, -0.07763877511024475, -0.2099233716726303, -0.2833886742591858, -0.2655334770679474, 0.24039079248905182, -0.10012805461883545, 0.26518943905830383, 0.11871764063835144, 0.3255002498626709, -0.028783703222870827, -0.19245630502700806, 0.037322044372558594, 0.1264728307723999, 0.10987135767936707, 0.35287439823150635, -0.019811337813735008, 0.13789185881614685, 0.25528931617736816, -0.07837796956300735, -0.03403031826019287, -0.2788696885108948, 0.2559700012207031, -0.06432262063026428, 0.08879102766513824, -0.06327616423368454, 0.11700305342674255, 0.1958877444267273, -0.05104032903909683, 0.18273088335990906, 0.03336109220981598, -0.5982890129089355, 0.3892023265361786, -0.08125484734773636, -0.21322019398212433, -0.03130839765071869, -0.05667460337281227, 0.24934835731983185, 0.35479938983917236, -0.6761937737464905, 0.18092148005962372, -0.1343735307455063, -0.0683000311255455, -0.35602623224258423, -0.04129941016435623, 0.16498571634292603, 0.060896169394254684, 0.09121817350387573, -0.01398322731256485, -0.09746772050857544, 0.28701749444007874, 0.06574800610542297, 0.14784058928489685, 0.13439343869686127, 0.5564122200012207, 0.03460915759205818, 0.44170957803726196, 0.24461564421653748, -0.15070469677448273, 0.5232698917388916, 0.19897988438606262, 0.17561443150043488, -0.050809405744075775, -0.3498581349849701, -0.13301080465316772, -0.17130225896835327, -0.24746163189411163, 0.06465553492307663, -0.24494272470474243, -0.4635224938392639, -0.19256478548049927, -0.059519149363040924, 0.02566830813884735, -0.35324931144714355, 0.33233368396759033, -0.21918871998786926, 0.252355694770813, -0.06263269484043121, 0.20407918095588684, -0.1914365440607071, 0.06265995651483536, 0.09613184630870819, 0.026535436511039734, 0.11191919445991516, 0.01671813614666462, 0.010327707976102829, -0.042731210589408875, -0.3005979061126709, 0.07078497111797333, 0.016879256814718246, 0.6481266617774963, 0.08373937010765076, -0.24559134244918823, 0.18974611163139343, -0.40175506472587585, 1.1557397842407227, -0.032774172723293304, 0.05083867907524109, 0.20233537256717682, -0.35018908977508545, -0.32778581976890564, -0.21432824432849884, -0.009530831128358841, 0.13201472163200378, 0.15744635462760925, 0.777108371257782, -0.2706896662712097, -0.5141991376876831, 0.16553041338920593, 0.08317632228136063, -0.22443971037864685, -0.2903709411621094, -0.39756321907043457, -0.0034563057124614716, -0.3121944069862366, 0.15313926339149475, -0.17571339011192322, 0.23636756837368011, 0.13392837345600128, -0.104606032371521, -0.31271734833717346, -0.008094973862171173, -0.026976287364959717, 0.12751519680023193, 0.08991392701864243, -0.05121263489127159, 0.4915119409561157, 0.1600431203842163, 0.42009592056274414, 0.3643803298473358, 0.39645370841026306, 0.17882952094078064, -0.5513402819633484, 0.3764182925224304, 0.008044104091823101, 0.48831266164779663, 0.436394602060318, -0.02545112743973732, -0.059215985238552094, -0.17492325603961945, 0.33039551973342896, -0.3322660028934479, 0.10408487170934677, 0.287864089012146, 0.14979277551174164, -0.5691829919815063, -0.30821841955184937, 0.27717018127441406, -0.055847786366939545, 0.19093434512615204, 0.390388548374176, 0.013901658356189728, 0.0874444767832756, 0.4777531623840332, 0.03466704860329628, 0.8743609189987183, -0.21631191670894623, 0.13932913541793823, 0.165118008852005, -0.34762346744537354, 0.04511227086186409, -0.7497524619102478, 0.034550003707408905, -0.35373520851135254, -0.19685526192188263, -0.024828270077705383, -0.3784911036491394, 0.20003068447113037, 0.09509317576885223, 0.2325015664100647, 0.323631227016449, -0.14793655276298523, -0.1160362958908081, 0.0851227343082428, 0.17022141814231873, -0.15632103383541107, -0.3134036362171173, -0.27480024099349976, -0.04030513018369675, -0.12001089751720428, 0.11850272119045258, -0.12079283595085144, -0.15211516618728638, 0.1468711942434311, 0.10514259338378906, -0.1146392673254013, 0.27227574586868286, 0.16404925286769867, -0.13172534108161926, 0.17782717943191528, -0.6451170444488525, 0.10407988727092743, 0.01691833883523941, 0.112406887114048, 0.022789448499679565, -0.09394916146993637, 0.09709746390581131, -0.018100276589393616, -0.08817023783922195, 0.15403935313224792, -0.1796196550130844, 0.5126615762710571, 0.0416434183716774, -0.12511800229549408, 0.013746827840805054, -0.17830291390419006, -0.33715343475341797, 0.21621015667915344, 0.19033634662628174, 0.24225866794586182, -0.11232233047485352, 0.08647552132606506, 0.2052464783191681, -0.01654592901468277, -0.25022152066230774, -0.017101958394050598, -0.07147638499736786, -0.24899516999721527, 0.20256823301315308, -0.28681832551956177, -0.38270294666290283, -0.1001187264919281, 0.5489773154258728, -0.017006076872348785, 0.01743820309638977, 0.7191879749298096, 0.3452690839767456, -0.3230138421058655, -0.14287032186985016, -0.2807793617248535, 0.1640145182609558, -0.4289986491203308, 0.08193442225456238, -0.1393054723739624, 0.15778173506259918, -0.023541320115327835, -0.038755904883146286, -0.08092150092124939, -0.5331928730010986, -0.21374747157096863, -0.3955557644367218, -0.1084492951631546, -0.17549662292003632, 0.004432473331689835, 0.09497196972370148, 0.20054465532302856, 0.02116844244301319, -0.17279285192489624, 0.12280640006065369, -0.10765520483255386, -0.09850695729255676, -0.21218040585517883, 0.09517303854227066, -0.144846111536026, -0.2114974558353424, 0.10692226886749268, -0.01591242104768753, -0.02103002369403839, 0.20546692609786987, 0.149617537856102, -0.0927903801202774, -0.32318034768104553, 0.16849717497825623, 0.013826420530676842, 0.12438204884529114, 0.06481290608644485, -0.32633495330810547, -0.2134333997964859, -0.17961600422859192, 0.24114510416984558, -0.21049633622169495, 0.05035731568932533, -0.010657168924808502, 0.293639212846756, 0.13345953822135925, -0.1013178750872612, -0.08114027231931686, 0.3285840153694153, -0.23910798132419586, 0.14183804392814636, 0.23092356324195862, -0.25153836607933044, 0.051810771226882935, -0.2070530205965042, 0.12699326872825623, 0.17985332012176514, 0.001350555568933487, 0.4258630871772766, -0.5233975648880005, 0.056003015488386154, -0.06762756407260895, 0.3739950656890869, 0.7506058216094971, 0.056810420006513596, -0.30454790592193604, 0.5548611283302307, -0.04105238616466522, -0.22284576296806335, -0.19872012734413147, -0.11844402551651001, 0.0631842315196991, -0.005046885460615158, 0.2235504686832428, -0.10269084572792053, -0.10066386312246323, 0.28576749563217163, 0.10166807472705841, 0.16686174273490906, -0.1943739950656891, -0.04291185736656189, 0.10656481981277466, -0.0502653643488884, 0.001686982810497284, 0.38868987560272217, 0.45699355006217957, 0.05197333171963692, 0.23566606640815735, 0.1514723002910614, 0.11755790561437607, -0.03558265417814255, 0.06468657404184341, -0.14392584562301636, -0.5210019946098328, 0.06933802366256714, 0.10324740409851074, 0.37056052684783936, 0.06951874494552612, 0.024659503251314163, 0.2947445809841156, 0.1301306188106537, -0.3456600308418274, -0.3387882709503174, 0.15272867679595947, -0.09841348975896835, 0.11503350734710693, 0.16163533926010132, -0.16983067989349365, -0.0806085616350174, 0.15496498346328735, 0.03460889682173729, -0.2100524753332138, 0.11297120153903961, 0.18752093613147736, 0.19074895977973938, -0.4814240634441376, -0.1956040859222412, -0.060157306492328644, 0.250548779964447, -0.078643798828125, 0.19868335127830505, -0.0683024674654007, -0.1716320812702179, -0.3182618319988251, -0.15104196965694427, 0.23843710124492645, 0.40782949328422546, -0.11488012969493866, 0.051480092108249664, -0.11858835816383362, 0.005522517487406731, 0.018236730247735977, 0.1270730048418045, -0.3181716501712799, 0.14667664468288422, 0.40688806772232056, -0.08604215085506439, 0.021466854959726334, -0.05862012878060341, 0.01349126547574997, 0.2451750934123993, -0.26796361804008484, 0.1875772327184677, 0.3388454020023346, 0.012006476521492004, 0.005520997568964958, -0.1364327371120453, -0.44589319825172424, -0.06710408627986908, 0.4134936034679413, -0.06614875793457031, 0.07553128153085709, 0.050906453281641006, 0.008114062249660492, -0.0433771051466465, 0.586534857749939, 0.2368285059928894, 0.18187233805656433, -0.1938968002796173, -0.10167236626148224, -0.36229509115219116, 0.024690210819244385, -0.28607064485549927, -0.03061279095709324, 0.4102804362773895, 0.3564322292804718, 0.3778136074542999, 0.0789763405919075, 0.221543088555336, -0.14166097342967987, -0.2059670388698578, 0.5600918531417847, -0.3980073034763336, -0.2937209904193878, 0.06053878366947174, 0.14055699110031128, -0.1587100774049759, -0.41354799270629883, 0.15916430950164795, -0.02978072687983513, -0.07338438928127289, -0.002692088484764099, -0.29779380559921265, 0.16722160577774048, -0.5536541938781738, 0.3697056472301483, -0.22048889100551605, 0.0681629553437233, 0.19151431322097778, -0.11528456211090088, -0.2285410761833191, -0.05168735235929489, 0.012936203740537167, 0.009492490440607071, -0.14722073078155518, 0.09052498638629913, -0.15508967638015747, -0.038677241653203964, -0.43930405378341675, 0.01733379252254963, 0.011057805269956589, -0.15410183370113373, -0.017609283328056335, 0.2404155433177948, 0.11096098273992538, 0.3588048219680786, 0.08783482015132904, 0.2368186116218567, 0.25922638177871704, 0.25867992639541626, -0.43222576379776, -0.0379948690533638, 0.45347464084625244, -0.38742250204086304, -0.6058681011199951, 0.2514971196651459, 0.09288051724433899, 0.203049898147583, -0.03394003212451935, -0.3631102740764618, 0.1279662549495697, 0.13334767520427704, -0.09242245554924011, -0.036353807896375656, 0.2133595049381256, 0.11953815817832947, 0.11644579470157623, -0.35177138447761536, 0.2749592065811157, 0.04023168236017227, -0.10179772228002548, -0.08941075205802917, -0.11239122599363327 ]
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
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.
[ -0.087595134973526, -0.05146826058626175, -0.008220763877034187, 0.2627723813056946, 0.07494160532951355, 0.032871171832084656, 0.5292813777923584, 0.29862651228904724, -0.16207551956176758, 0.18641173839569092, -0.0485047921538353, 0.42074963450431824, -0.007070318795740604, 0.08174891769886017, -0.21155664324760437, 0.09538578242063522, 0.13751672208309174, 0.18894989788532257, 0.009223602712154388, -0.09641355276107788, -0.012771271169185638, 0.036670126020908356, -0.23501648008823395, -0.2509411573410034, -0.2860860824584961, -0.0141752939671278, 0.11479625105857849, -0.036718517541885376, 0.0027928082272410393, -0.4637413024902344, 0.6261834502220154, 0.08818592876195908, 0.3093971610069275, 0.7832284569740295, -0.0001300823496421799, 0.13682936131954193, 0.2875930964946747, -0.001528685912489891, -0.5465436577796936, -0.22208859026432037, 0.10308044403791428, -0.08552711457014084, 0.19408799707889557, -0.15631058812141418, 0.0013775378465652466, -0.12070543318986893, -0.1143793910741806, -0.34396469593048096, 0.03782787173986435, 0.05493522807955742, -0.027402151376008987, 0.05966874957084656, -0.16564860939979553, 0.03089386783540249, 0.12047465890645981, 0.23448781669139862, -0.019706103950738907, 0.30722856521606445, 0.38823843002319336, -0.1976224035024643, -0.23063376545906067, 0.1427796632051468, -0.015151123516261578, 0.050114184617996216, 0.19603794813156128, -0.21031850576400757, 0.10491902381181717, -0.10740083456039429, 0.16991287469863892, 0.119692362844944, 0.5104138255119324, -0.091084323823452, -0.3229161500930786, -0.23589330911636353, -0.09694357216358185, -0.2139974683523178, 0.2525999844074249, 0.21765413880348206, -0.36215710639953613, -0.06045973673462868, 0.03951478749513626, 0.10895354300737381, -0.1790730357170105, 0.04062020778656006, -0.31824615597724915, 0.5012407302856445, 0.011232760734856129, 0.19958505034446716, 0.26868736743927, 0.02244846522808075, 0.3280929923057556, 0.1410524547100067, 0.16293804347515106, 0.030253425240516663, -0.794945240020752, 0.21059390902519226, 0.05816427245736122, -0.11980342119932175, -0.15799227356910706, -0.011075839400291443, -0.03229004889726639, 0.11429067701101303, 0.2685355842113495, 0.12041322141885757, 0.37797728180885315, -0.27337029576301575, 0.1737564504146576, 0.042764194309711456, 0.11315709352493286, 0.15943273901939392, -0.015385780483484268, 0.059880826622247696, -0.2422260046005249, -0.35960647463798523, 0.2426721602678299, -0.17984503507614136, 0.12577053904533386, -0.3473673462867737, -0.08497478812932968, 0.14190542697906494, -0.14490942656993866, -0.1806287169456482, 0.13016076385974884, 0.48195162415504456, -0.18292613327503204, 0.2846578061580658, -0.003383718430995941, 0.17730697989463806, -0.11973550170660019, 0.1296926587820053, 0.162861168384552, -0.11198201775550842, -0.28217414021492004, -0.0698762908577919, 0.14434553682804108, -0.5911117196083069, 0.10331617295742035, 0.1457158327102661, 0.22031740844249725, -0.036393869668245316, 0.01236780546605587, -0.24325862526893616, 0.13783374428749084, 0.13298042118549347, -0.1483980417251587, 0.23780356347560883, 0.15363305807113647, -0.08347645401954651, -0.2574750483036041, -0.028630279004573822, -0.14748767018318176, -0.08578093349933624, -0.19677218794822693, -0.011799891479313374, 0.1416746973991394, -0.06736084073781967, -0.04577035456895828, -0.522328794002533, 0.18566861748695374, -0.051756639033555984, 0.09895053505897522, -0.22910065948963165, -0.08098303526639938, 0.035436779260635376, 0.07524798065423965, 0.3761204779148102, -0.6683439612388611, 0.3167181611061096, 0.29812052845954895, 0.2238563746213913, 0.22548386454582214, 0.09131647646427155, -0.3375900387763977, 0.2842545509338379, -0.3561455309391022, -0.46478986740112305, 0.45171597599983215, -0.3167095184326172, -0.18016771972179413, 0.4776419401168823, 0.057836130261421204, 0.22773708403110504, 0.26199597120285034, -0.22243446111679077, 0.06580550968647003, -0.13975922763347626, 0.3189489245414734, 0.12142381817102432, 0.02342120185494423, -0.022547492757439613, -0.2488248497247696, 0.02732952870428562, 0.05221369117498398, 0.3559509515762329, 0.08440560102462769, 0.1686391830444336, -0.20088782906532288, -0.27558571100234985, 0.3825701177120209, -0.10783523321151733, -0.02686479315161705, 0.49433469772338867, 0.24002744257450104, 0.40744853019714355, 0.2359100580215454, 0.07869542390108109, -0.36645427346229553, 0.3453904986381531, 0.11601348221302032, 0.023597894236445427, -0.06796196103096008, 0.16203728318214417, -0.1103399395942688, 0.33261287212371826, -0.35237759351730347, -0.1732379049062729, -0.16029943525791168, 0.33270108699798584, 0.05423123016953468, -0.14381487667560577, -0.341246098279953, 0.5778266191482544, 0.00584234856069088, 0.0330226831138134, -0.2885887920856476, 0.12144799530506134, 0.12544280290603638, -0.14746955037117004, -0.027821213006973267, -0.11095865815877914, 0.12089695036411285, -0.24868866801261902, -0.13878175616264343, -0.0030882656574249268, 0.20137645304203033, -0.0326230525970459, -0.27497589588165283, -0.25059646368026733, 0.06444960832595825, 0.417653352022171, 0.0805295780301094, -0.17703953385353088, 0.10390342026948929, -0.10166066139936447, 0.13585743308067322, 0.11919880658388138, 0.0014192797243595123, 0.7810067534446716, -0.16211402416229248, -0.021608686074614525, 0.2772027254104614, 0.09001541137695312, 0.01089441031217575, 0.17996184527873993, 0.4067271947860718, -0.029355604201555252, 0.741080105304718, 0.014151245355606079, -0.2841423749923706, 0.18688473105430603, 0.1523437350988388, 0.07053229212760925, -0.37152087688446045, 0.3029453754425049, 0.03513827919960022, 0.12159065157175064, 0.17700500786304474, 0.04999161139130592, 0.23449638485908508, 0.0064233741723001, 0.062426548451185226, -0.1439991444349289, -0.04969129338860512, -0.033890463411808014, -0.08253996819257736, 0.30115649104118347, 0.5943384170532227, 0.21108537912368774, -0.010473012924194336, -0.04497375339269638, -0.04125635698437691, -0.5201136469841003, -0.06372817605733871, 0.24663549661636353, -0.11424677073955536, 0.5818238854408264, -0.3328721225261688, 0.3628098666667938, -0.22942638397216797, -0.21168720722198486, -0.16085682809352875, -0.27675870060920715, -0.41207683086395264, 0.521504819393158, 0.06334994733333588, 0.1394014209508896, 0.07293690741062164, 0.10148647427558899, 0.23567430675029755, -0.3859484791755676, -0.37585094571113586, -0.28078988194465637, -0.3597957193851471, -0.2557547390460968, 0.3889552354812622, -0.2749790549278259, 0.11891669780015945, -0.12581272423267365, -0.2009410709142685, -0.2125125229358673, -0.22735023498535156, 0.24278013408184052, -0.041214145720005035, 0.2884366512298584, 0.15389104187488556, 0.33320802450180054, 0.04310242086648941, -0.18342025578022003, 0.0942477434873581, 0.04348887503147125, 0.08160317689180374, 0.32250094413757324, -0.019417451694607735, 0.18650195002555847, 0.23341119289398193, -0.034014225006103516, -0.10299518704414368, -0.3722124695777893, 0.1872188150882721, -0.09352946281433105, 0.034298595041036606, -0.09844513237476349, 0.24511584639549255, 0.24885502457618713, -0.0682326927781105, 0.20377852022647858, 0.023167874664068222, -0.6360751390457153, 0.36484494805336, -0.07409484684467316, -0.18942075967788696, -0.08986572921276093, -0.0049460045993328094, 0.2718510031700134, 0.38459503650665283, -0.6500184535980225, 0.08188655227422714, -0.19171930849552155, -0.1441877782344818, -0.3296028673648834, 0.023540019989013672, 0.21768170595169067, 0.1069319024682045, 0.0647212564945221, 0.030248284339904785, -0.09513440728187561, 0.22468680143356323, -0.09149426221847534, 0.09183679521083832, 0.11927177757024765, 0.6572452187538147, 0.002226348966360092, 0.4138944149017334, 0.2724233865737915, -0.1302621066570282, 0.4403579831123352, 0.285417377948761, 0.19316691160202026, -0.09715843945741653, -0.32519569993019104, -0.07580329477787018, -0.13363909721374512, -0.23928864300251007, 0.03760981559753418, -0.28177013993263245, -0.4064779281616211, -0.16910555958747864, -0.11514212191104889, -0.04169163480401039, -0.31641703844070435, 0.3946223556995392, -0.27565592527389526, 0.23265141248703003, -0.05473661422729492, 0.30081841349601746, -0.21935641765594482, 0.054694995284080505, -0.009683234617114067, 0.038220297545194626, 0.11455420404672623, -0.04301774874329567, -0.03770490363240242, 0.11039650440216064, -0.31717753410339355, 0.19048240780830383, 0.05274989828467369, 0.6484024524688721, 0.1207621842622757, -0.27904731035232544, 0.14420397579669952, -0.3573397696018219, 1.0860754251480103, 0.010568547993898392, 0.12097125500440598, 0.17671708762645721, -0.4172093868255615, -0.41474607586860657, -0.2671857476234436, 0.1003837138414383, 0.11787696927785873, 0.22775188088417053, 0.6591969132423401, -0.24818962812423706, -0.5271131992340088, 0.12165441364049911, 0.05416489392518997, -0.12686434388160706, -0.3630826473236084, -0.38512110710144043, 0.05273795872926712, -0.31068944931030273, 0.15274471044540405, -0.21810488402843475, 0.22894398868083954, 0.10438214242458344, -0.03234262764453888, -0.32321473956108093, 0.04403027892112732, 0.01017472892999649, 0.053244445472955704, 0.08224231749773026, -0.1383746862411499, 0.4903185963630676, 0.15416944026947021, 0.3560880720615387, 0.34610438346862793, 0.36100438237190247, 0.055300273001194, -0.48727577924728394, 0.3794512152671814, -0.025396980345249176, 0.35213276743888855, 0.5750604271888733, 0.07627373188734055, -0.10045213252305984, -0.21379680931568146, 0.3643686771392822, -0.29977259039878845, 0.10863445699214935, 0.27712148427963257, 0.13455675542354584, -0.6556291580200195, -0.3523310422897339, 0.27746105194091797, -0.02383955754339695, 0.1399606317281723, 0.4057517647743225, -0.05502285063266754, 0.06502120941877365, 0.4797861576080322, 0.08763712644577026, 0.8756579756736755, -0.1315200924873352, 0.22372029721736908, 0.12371965497732162, -0.3423302173614502, 0.08246149122714996, -0.6077616214752197, 0.04164622724056244, -0.36748945713043213, -0.19437043368816376, -0.009202983230352402, -0.4358610510826111, 0.18006712198257446, 0.12976524233818054, 0.2616112232208252, 0.28247904777526855, -0.24555283784866333, -0.039556439965963364, 0.03710389509797096, 0.1083439439535141, -0.18616652488708496, -0.30823108553886414, -0.2584695518016815, -0.05690775811672211, -0.07380779087543488, 0.11631935834884644, -0.11265116184949875, -0.12543846666812897, -0.04536539316177368, 0.06513563543558121, -0.057820554822683334, 0.25217023491859436, 0.17007026076316833, -0.030854452401399612, 0.18438540399074554, -0.7273196578025818, 0.1780552715063095, 0.04901469126343727, 0.08948977291584015, 0.022888174280524254, -0.024293305352330208, 0.0869186520576477, -0.009310901165008545, -0.06251780688762665, 0.17698872089385986, -0.2408616542816162, 0.4733954668045044, 0.08552269637584686, -0.10921164602041245, -0.0028010383248329163, -0.255672812461853, -0.27780160307884216, 0.18176138401031494, 0.3362377882003784, 0.2063298374414444, -0.14909762144088745, -0.044823888689279556, 0.17773720622062683, 0.03923263028264046, -0.19802412390708923, -0.030494671314954758, 0.01581784337759018, -0.21772249042987823, 0.2316519320011139, -0.24850748479366302, -0.3927721083164215, -0.07575289905071259, 0.5250782370567322, -0.0669013112783432, -0.035455044358968735, 0.7066106796264648, 0.35503360629081726, -0.3581264615058899, -0.11135991662740707, -0.17773626744747162, 0.16471770405769348, -0.5515404343605042, 0.06946849822998047, -0.11087667942047119, 0.08454598486423492, 0.07079232484102249, -0.09680162370204926, -0.11440534889698029, -0.4529839754104614, -0.12937583029270172, -0.44656962156295776, -0.1162688136100769, -0.15213651955127716, -0.16798964142799377, 0.06808941811323166, 0.09834866970777512, 0.03520088642835617, -0.11173765361309052, 0.166218563914299, -0.10564341396093369, -0.012310931459069252, -0.22190320491790771, 0.10409608483314514, -0.08935950696468353, -0.250702440738678, 0.1051977202296257, -0.007805246394127607, -0.03767354413866997, 0.23975691199302673, 0.09148407727479935, -0.06709705293178558, -0.3345666825771332, 0.17313018441200256, -0.016330450773239136, 0.11547837406396866, 0.19844388961791992, -0.31908518075942993, -0.14748865365982056, -0.1581668108701706, 0.11174339056015015, -0.16563332080841064, 0.053719617426395416, -0.1315365582704544, 0.25512877106666565, 0.288648784160614, -0.07301771640777588, 0.05426650121808052, 0.23773017525672913, -0.17124824225902557, 0.20290140807628632, 0.2267717868089676, -0.19822631776332855, 0.12493249773979187, -0.15356731414794922, 0.14642247557640076, 0.16636128723621368, 0.06286149471998215, 0.3604033291339874, -0.5100668668746948, 0.15197330713272095, -0.04255184903740883, 0.3440569341182709, 0.7364616394042969, 0.01914127543568611, -0.34856975078582764, 0.574995219707489, -0.050338707864284515, -0.17656004428863525, -0.23306044936180115, -0.08558192849159241, 0.06234996020793915, -0.015185527503490448, 0.23793372511863708, -0.11666916310787201, -0.1450677216053009, 0.26647478342056274, 0.20172065496444702, 0.08831838518381119, -0.15983954071998596, -0.04453026503324509, 0.1354207843542099, -0.0033076927065849304, 0.024721648544073105, 0.4934181272983551, 0.413142591714859, 0.054693520069122314, 0.2660040855407715, 0.16696049273014069, 0.20481178164482117, -0.12000275403261185, 0.1303674876689911, -0.1905793845653534, -0.6018977761268616, 0.05526217073202133, 0.16780494153499603, 0.2587789297103882, -0.022101707756519318, -0.026960179209709167, 0.2926769554615021, -0.022196948528289795, -0.2872158885002136, -0.3057655990123749, 0.12184514105319977, -0.08517169207334518, 0.10460010170936584, 0.19641749560832977, -0.16838347911834717, -0.041928935796022415, 0.1926211565732956, -0.026163313537836075, -0.09862853586673737, 0.20740661025047302, 0.2128787487745285, 0.16476115584373474, -0.33638596534729004, -0.20771518349647522, -0.045048654079437256, 0.15400654077529907, -0.10140912234783173, 0.10325747728347778, -0.062208160758018494, -0.15922221541404724, -0.2817672789096832, -0.043399326503276825, 0.32739025354385376, 0.46259254217147827, -0.10555781424045563, 0.012892636470496655, -0.11840133368968964, 0.07956612855195999, -0.0025663673877716064, 0.11610622704029083, -0.20089983940124512, 0.18795324862003326, 0.38665881752967834, -0.0876498892903328, -0.02183636464178562, -0.10779750347137451, 0.03628368675708771, 0.20102444291114807, -0.20809273421764374, 0.15017178654670715, 0.34492483735084534, 0.022546038031578064, -0.020023223012685776, -0.06293360143899918, -0.5503424406051636, 0.004609094001352787, 0.29063040018081665, -0.013704679906368256, 0.07054335623979568, 0.06097671762108803, 0.00311896950006485, -0.010443225502967834, 0.5134193301200867, 0.18543729186058044, 0.1791686862707138, -0.21117867529392242, -0.20531925559043884, -0.3587142825126648, -0.06963776797056198, -0.3410103917121887, 0.01367158629000187, 0.31902191042900085, 0.3074009120464325, 0.40359798073768616, 0.03698771446943283, 0.2111942172050476, -0.02087324857711792, -0.28363826870918274, 0.5718328952789307, -0.41291093826293945, -0.22876323759555817, 0.06663092970848083, 0.07539721578359604, -0.1573716402053833, -0.45673874020576477, 0.12409631907939911, -0.1190636157989502, -0.03959784656763077, -0.06507327407598495, -0.2827877998352051, 0.23494082689285278, -0.45890048146247864, 0.41487595438957214, -0.20669585466384888, 0.06981528550386429, 0.24763339757919312, -0.3129408359527588, -0.3073346018791199, -0.023650674149394035, 0.09906639903783798, -0.012815989553928375, -0.052114930003881454, 0.13647188246250153, -0.21641623973846436, -0.12438113987445831, -0.44745707511901855, 0.171354278922081, -0.1524181216955185, 0.009135054424405098, 0.009955434128642082, 0.19409658014774323, 0.08618325740098953, 0.3130069375038147, 0.1314355731010437, 0.2766099274158478, 0.2576335370540619, 0.25412672758102417, -0.49291008710861206, -0.07312413305044174, 0.3676564693450928, -0.39377400279045105, -0.5985384583473206, 0.2090596854686737, 0.03681114315986633, 0.13250473141670227, 0.06443320959806442, -0.3650526702404022, 0.16788068413734436, 0.045003607869148254, -0.0677468478679657, -0.0495913028717041, 0.16057124733924866, 0.1221081018447876, 0.07058775424957275, -0.37350761890411377, 0.24266821146011353, 0.11226467043161392, -0.1295510232448578, -0.12735840678215027, -0.08985261619091034 ]
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
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`?
[ -0.09469516575336456, -0.07855184376239777, -0.025267140939831734, 0.2823977470397949, -0.0035468265414237976, 0.10885124653577805, 0.43466904759407043, 0.26948973536491394, -0.0667296051979065, 0.20157024264335632, -0.0014982549473643303, 0.3665716052055359, -0.0019920850172638893, 0.1998566836118698, -0.23154579102993011, 0.013911671936511993, 0.1322956681251526, 0.21849751472473145, 0.0505608506500721, -0.1465407758951187, 0.02220815420150757, -0.0030891112983226776, -0.22783568501472473, -0.23767171800136566, -0.164164200425148, -0.07146799564361572, 0.06464948505163193, -0.09328926354646683, -0.009176583960652351, -0.37360879778862, 0.612325131893158, 0.14226344227790833, 0.31743553280830383, 0.7592602968215942, -0.0001299281429965049, 0.08811348676681519, 0.2638353407382965, 0.023614903911948204, -0.5803160071372986, -0.2428266555070877, 0.07830405980348587, -0.028177667409181595, 0.18095265328884125, -0.17419779300689697, 0.017569810152053833, -0.15936380624771118, -0.10620877146720886, -0.32011502981185913, 0.03807903081178665, -0.018306178972125053, -0.006694171577692032, 0.05075652897357941, -0.1452217847108841, 0.03160647302865982, 0.19689413905143738, 0.2194869965314865, -0.03068920597434044, 0.20648430287837982, 0.3758125305175781, -0.2402101308107376, -0.21686384081840515, 0.09319344162940979, 0.03567449748516083, 0.017227770760655403, 0.26431146264076233, -0.22482050955295563, 0.12011836469173431, -0.1044018417596817, 0.18161115050315857, 0.07877147197723389, 0.6449962854385376, -0.1732596755027771, -0.3529864549636841, -0.2300432026386261, -0.03097061812877655, -0.191163569688797, 0.2239549458026886, 0.22906550765037537, -0.3360896408557892, -0.07826051115989685, 0.08804011344909668, 0.008363629691302776, -0.21589820086956024, 0.03965511918067932, -0.30958765745162964, 0.46624594926834106, -0.017827481031417847, 0.21230390667915344, 0.19529467821121216, -0.03594356030225754, 0.22195862233638763, 0.1246686652302742, 0.12221270799636841, 0.010381550528109074, -0.8447631597518921, 0.17359718680381775, 0.06099206209182739, -0.08242129534482956, -0.1122516393661499, 0.16426503658294678, -0.044100530445575714, 0.0735597014427185, 0.3126838207244873, 0.16571485996246338, 0.461620032787323, -0.2458038032054901, 0.1623634397983551, 0.04667159169912338, 0.13961325585842133, 0.13958829641342163, -0.05537448078393936, 0.025390688329935074, -0.26141512393951416, -0.27033260464668274, 0.2740601897239685, -0.25842949748039246, 0.1435808688402176, -0.4106310307979584, -0.04079180583357811, 0.21344971656799316, -0.1573983132839203, -0.1544492095708847, 0.12001606822013855, 0.5102853178977966, -0.22737275063991547, 0.22273686528205872, -0.03700675815343857, 0.17200544476509094, -0.07018979638814926, 0.10970106720924377, 0.13684172928333282, -0.15963584184646606, -0.22627346217632294, -0.08587481826543808, 0.09716908633708954, -0.5080939531326294, 0.028793083503842354, 0.14903050661087036, 0.18326187133789062, -0.08208723366260529, 0.042596086859703064, -0.2306954711675644, 0.13348984718322754, 0.1521739363670349, -0.03931831568479538, 0.1931873857975006, 0.0918302983045578, -0.13848266005516052, -0.2815191149711609, -0.029376477003097534, -0.19741487503051758, -0.0485866516828537, -0.2511184513568878, 0.007248172536492348, 0.13119615614414215, -0.1424751877784729, -0.14292442798614502, -0.4999810457229614, 0.16129839420318604, 0.01637425646185875, 0.10145252197980881, -0.184111550450325, -0.013008687645196915, 0.07219862192869186, 0.06302107125520706, 0.3459634780883789, -0.6821317672729492, 0.34830722212791443, 0.22430038452148438, 0.1905292123556137, 0.18730470538139343, 0.08407476544380188, -0.32749322056770325, 0.35814589262008667, -0.3469139039516449, -0.48918062448501587, 0.4630836546421051, -0.31409135460853577, -0.11854667961597443, 0.5044463872909546, 0.03949235379695892, 0.2629888355731964, 0.2879517078399658, -0.26150596141815186, 0.07031390815973282, -0.11919141560792923, 0.2121521383523941, 0.12322814762592316, -0.00620194710791111, -0.03365582227706909, -0.1880461573600769, 0.08652312308549881, 0.1352912038564682, 0.3356684148311615, 0.09945812076330185, 0.19206510484218597, -0.18908032774925232, -0.22731970250606537, 0.38093557953834534, -0.09070374071598053, -0.029121076688170433, 0.5439870357513428, 0.33001744747161865, 0.48571282625198364, 0.26603391766548157, 0.038895413279533386, -0.35357463359832764, 0.31138867139816284, 0.13025833666324615, -0.05573107302188873, -0.0647004246711731, 0.12681467831134796, -0.0869680792093277, 0.36976227164268494, -0.3768116533756256, -0.1018526554107666, -0.13612356781959534, 0.33407625555992126, 0.04962623491883278, -0.1954471617937088, -0.3234912157058716, 0.5844672322273254, -0.03849836066365242, 0.024742547422647476, -0.34025120735168457, 0.17588742077350616, 0.15853329002857208, -0.08209140598773956, -0.010823685675859451, -0.1030607596039772, 0.13523158431053162, -0.2674403488636017, -0.11922150105237961, 0.013412520289421082, 0.1469014585018158, -0.005766764283180237, -0.10080825537443161, -0.18651576340198517, 0.03443428874015808, 0.27894335985183716, 0.07182573527097702, -0.18668773770332336, 0.092618428170681, -0.14318254590034485, 0.11688689887523651, 0.07404118776321411, 0.0325586199760437, 0.864857017993927, -0.09570856392383575, -0.060084275901317596, 0.22180068492889404, 0.08416654169559479, 0.006712725386023521, 0.25683343410491943, 0.36992067098617554, -0.06785127520561218, 0.7652665972709656, 0.0034424029290676117, -0.3114135265350342, 0.16982606053352356, 0.15219266712665558, 0.08860242366790771, -0.3803868889808655, 0.32990601658821106, 0.03224150836467743, 0.16226670145988464, 0.15488404035568237, 0.013745654374361038, 0.08738277852535248, 0.046551045030355453, 0.048756662756204605, -0.1407242715358734, -0.08426147699356079, 0.01405024528503418, -0.11058693379163742, 0.359310507774353, 0.44808048009872437, 0.24810948967933655, 0.03333574905991554, -0.06529562175273895, -0.062213219702243805, -0.5113165974617004, -0.07086263597011566, 0.2895010709762573, -0.08293650299310684, 0.605972409248352, -0.3454795777797699, 0.26434463262557983, -0.20057059824466705, -0.10042796283960342, -0.24871665239334106, -0.27064812183380127, -0.3717429041862488, 0.5561202764511108, 0.05768163129687309, 0.0700906440615654, 0.038893166929483414, 0.15499018132686615, 0.2343280166387558, -0.4124912917613983, -0.4129360616207123, -0.27240440249443054, -0.40753182768821716, -0.2290041297674179, 0.39282336831092834, -0.2502205967903137, 0.18311399221420288, -0.09698764979839325, -0.13366231322288513, -0.28635138273239136, -0.24420395493507385, 0.2026732861995697, -0.08566231280565262, 0.3056893050670624, 0.16361993551254272, 0.32352566719055176, -0.00791504979133606, -0.19484026730060577, 0.045905452221632004, 0.0605279803276062, 0.07644864171743393, 0.30930349230766296, -0.005128847435116768, 0.14877896010875702, 0.2730914354324341, -0.003964334726333618, -0.027039362117648125, -0.30969753861427307, 0.26658251881599426, -0.03288949280977249, 0.046935196965932846, -0.1183416023850441, 0.1373746395111084, 0.1907787024974823, -0.09055446088314056, 0.20191369950771332, 0.03447658196091652, -0.7116603255271912, 0.34086844325065613, -0.053014107048511505, -0.1721830666065216, -0.01457647979259491, -0.0009859781712293625, 0.23149272799491882, 0.29594355821609497, -0.6845418214797974, 0.21231046319007874, -0.17009678483009338, -0.09899163991212845, -0.34747233986854553, 0.029398184269666672, 0.1180635318160057, 0.035386472940444946, 0.0884593278169632, 0.00720585510134697, -0.1162954568862915, 0.27968931198120117, -0.04259529709815979, 0.13890810310840607, 0.09716363251209259, 0.5652405619621277, -0.018932577222585678, 0.40179526805877686, 0.2238387018442154, -0.0709037184715271, 0.49783945083618164, 0.25001099705696106, 0.17818747460842133, -0.0790376290678978, -0.33019864559173584, -0.10757871717214584, -0.12691354751586914, -0.2748565375804901, 0.06340906023979187, -0.2146529257297516, -0.4213728904724121, -0.20214001834392548, -0.12067683041095734, 0.028114333748817444, -0.29746460914611816, 0.3027038276195526, -0.28433194756507874, 0.17256401479244232, -0.062324728816747665, 0.21124982833862305, -0.2289039045572281, 0.06533631682395935, 0.07927274703979492, 0.04689643532037735, 0.12354215979576111, 0.010519500821828842, -0.03558199107646942, 0.032424718141555786, -0.24975892901420593, 0.08582118153572083, 0.013520779088139534, 0.5973133444786072, 0.09360474348068237, -0.2549768388271332, 0.16776350140571594, -0.3976784348487854, 1.1136302947998047, -0.03923690319061279, 0.11983239650726318, 0.15487433969974518, -0.39485281705856323, -0.2682528495788574, -0.24862512946128845, 0.06300738453865051, 0.12267046421766281, 0.1215066909790039, 0.6672095060348511, -0.27057936787605286, -0.5114895701408386, 0.12199868261814117, 0.09222777187824249, -0.192146435379982, -0.3873383700847626, -0.3778993785381317, 0.11578481644392014, -0.2805940508842468, 0.16522985696792603, -0.24378935992717743, 0.17085406184196472, 0.10741670429706573, -0.06915652751922607, -0.31518635153770447, 0.04131000488996506, -0.00801829993724823, 0.04574032500386238, 0.10060559213161469, -0.15345819294452667, 0.49378257989883423, 0.12082458287477493, 0.3923315703868866, 0.3706419765949249, 0.42713722586631775, 0.1370861977338791, -0.5193401575088501, 0.4006195068359375, -0.033323317766189575, 0.4549610912799835, 0.488199383020401, 0.038701027631759644, -0.044503502547740936, -0.23593822121620178, 0.3891787528991699, -0.33314311504364014, 0.07132106274366379, 0.2777744233608246, 0.09803894907236099, -0.6348785758018494, -0.29040905833244324, 0.2770496606826782, -0.04724957048892975, 0.17446903884410858, 0.3537592589855194, -0.002294406294822693, 0.0813608318567276, 0.4501494765281677, 0.0025770962238311768, 0.9178200960159302, -0.17956899106502533, 0.15310905873775482, 0.08575837314128876, -0.35984480381011963, 0.0536162406206131, -0.7519596815109253, -0.0860171765089035, -0.3635197877883911, -0.19464975595474243, -0.026242723688483238, -0.3857276737689972, 0.2283785045146942, 0.08138363063335419, 0.2760010361671448, 0.33774420619010925, -0.23135671019554138, 0.006489168852567673, 0.09056808054447174, 0.18891732394695282, -0.18369150161743164, -0.27231884002685547, -0.23098748922348022, -0.04722905904054642, -0.05271647125482559, 0.09681770205497742, -0.12666726112365723, -0.16007490456104279, 0.07103963196277618, 0.053109556436538696, -0.09932498633861542, 0.26802584528923035, 0.24621547758579254, -0.14145717024803162, 0.15660862624645233, -0.676305890083313, 0.1497809737920761, -0.0027372315526008606, -0.013718776404857635, 0.08454728126525879, -0.07545358687639236, 0.12575742602348328, 0.01677035167813301, -0.05653267726302147, 0.10045675188302994, -0.18543477356433868, 0.45677903294563293, 0.06689714640378952, -0.11146079003810883, 0.03656362369656563, -0.23311766982078552, -0.2749590277671814, 0.16004398465156555, 0.23380808532238007, 0.24689243733882904, -0.09823163598775864, 0.05888015404343605, 0.16543808579444885, -0.0015179887413978577, -0.22352628409862518, -0.022770315408706665, -0.03888292610645294, -0.23117057979106903, 0.14632901549339294, -0.22805865108966827, -0.3642248809337616, -0.13610337674617767, 0.5222020745277405, -0.0318475067615509, 0.007262419909238815, 0.7095339298248291, 0.3520357310771942, -0.3531090021133423, -0.15587526559829712, -0.22107791900634766, 0.2151782065629959, -0.48364442586898804, 0.01671535149216652, -0.14388883113861084, 0.15435762703418732, 0.0980670154094696, -0.0773632675409317, -0.06649228930473328, -0.5792352557182312, -0.15071801841259003, -0.42794740200042725, -0.05499578267335892, -0.16701851785182953, -0.08835896849632263, 0.06375312060117722, 0.10697435587644577, 0.020030954852700233, -0.09533505141735077, 0.16902785003185272, -0.10882017761468887, -0.08594270795583725, -0.21648651361465454, 0.08920188993215561, -0.13801142573356628, -0.18571162223815918, 0.06890127062797546, -0.010301213711500168, -0.007132783532142639, 0.1901869922876358, 0.12897318601608276, -0.08650028705596924, -0.303352415561676, 0.1779327541589737, 0.02384270168840885, 0.17952466011047363, 0.11877746134996414, -0.2911335229873657, -0.14891484379768372, -0.141017884016037, 0.13051849603652954, -0.22707122564315796, 0.0541384220123291, -0.10458437353372574, 0.3416638672351837, 0.18912282586097717, -0.14300663769245148, -0.013040482997894287, 0.34031566977500916, -0.22053755819797516, 0.16185738146305084, 0.21310053765773773, -0.23775269091129303, 0.0836944729089737, -0.19737304747104645, 0.12814433872699738, 0.1608067750930786, 0.07759959995746613, 0.41561082005500793, -0.5125516653060913, 0.09692330658435822, -0.05121643841266632, 0.38024818897247314, 0.803419291973114, 0.08316865563392639, -0.33368757367134094, 0.5878556370735168, -0.02923128940165043, -0.2030860334634781, -0.21160361170768738, -0.10292325913906097, 0.0771801620721817, -0.03087020106613636, 0.2085396647453308, -0.11758917570114136, -0.13661617040634155, 0.25687944889068604, 0.1396559476852417, 0.12852469086647034, -0.11166898906230927, -0.038578733801841736, 0.18184411525726318, -0.012563124299049377, 0.01355607807636261, 0.4040393531322479, 0.5061875581741333, 0.022737689316272736, 0.2917291224002838, 0.17620332539081573, 0.13233785331249237, -0.0566055029630661, 0.1474863439798355, -0.19033211469650269, -0.5881166458129883, 0.07767995446920395, 0.15409168601036072, 0.39421722292900085, 0.013759296387434006, -0.004971049726009369, 0.30911046266555786, 0.15516166388988495, -0.3453531265258789, -0.36985689401626587, 0.13639426231384277, -0.0629650130867958, 0.12346687912940979, 0.2093168944120407, -0.1811296045780182, -0.0702180340886116, 0.18544523417949677, 0.017205137759447098, -0.15799064934253693, 0.15579655766487122, 0.1503482609987259, 0.24738164246082306, -0.46996545791625977, -0.19603517651557922, -0.07011661678552628, 0.19947683811187744, -0.1155722439289093, 0.15716597437858582, -0.06659822165966034, -0.17281422019004822, -0.3042902648448944, -0.15913189947605133, 0.24315614998340607, 0.42744180560112, -0.09676823019981384, 0.013335647992789745, -0.12198802828788757, 0.02391023375093937, 0.006759572774171829, 0.1325523853302002, -0.3106946051120758, 0.17143096029758453, 0.4364686608314514, -0.08237866312265396, 0.004566905088722706, -0.024675119668245316, 0.0026102736592292786, 0.24153895676136017, -0.30867090821266174, 0.13557064533233643, 0.3657282590866089, 0.04911070317029953, -0.002977471798658371, -0.09072091430425644, -0.5475208759307861, -0.046154070645570755, 0.29792022705078125, -0.0026344575453549623, 0.022562291473150253, 0.02083304524421692, 0.0061920080333948135, -0.060375820845365524, 0.5719751715660095, 0.2737313210964203, 0.2297399640083313, -0.20518265664577484, -0.1591545045375824, -0.34657806158065796, -0.01751299947500229, -0.3458820581436157, -0.02658667601644993, 0.3794410228729248, 0.33923569321632385, 0.38354241847991943, 0.06233853101730347, 0.24323877692222595, -0.08602606505155563, -0.2817433476448059, 0.5948896408081055, -0.4153680205345154, -0.24462608993053436, 0.056352291256189346, 0.1360059678554535, -0.18135054409503937, -0.3932434320449829, 0.15308219194412231, -0.03234313800930977, -0.05816350504755974, -0.026030659675598145, -0.3087948262691498, 0.2642805874347687, -0.5324217081069946, 0.383373886346817, -0.2663758099079132, 0.07334969937801361, 0.20551303029060364, -0.1870591640472412, -0.26493167877197266, -0.06114104762673378, 0.06006377562880516, -0.03402391076087952, -0.10815834999084473, 0.09633291512727737, -0.19412608444690704, -0.019911330193281174, -0.41115105152130127, 0.028702251613140106, -0.0764494389295578, -0.034881237894296646, -0.0344092920422554, 0.1628326177597046, 0.12552589178085327, 0.31240755319595337, 0.10392234474420547, 0.20721718668937683, 0.26633381843566895, 0.21636547148227692, -0.4365045428276062, -0.03838762640953064, 0.4101351201534271, -0.3422778844833374, -0.6099590063095093, 0.23231545090675354, 0.08997774124145508, 0.210679829120636, -0.00882636196911335, -0.3627772629261017, 0.1839894950389862, 0.10283315181732178, -0.03808525204658508, 0.0369383879005909, 0.20982155203819275, 0.11699894070625305, 0.1374279409646988, -0.3574867844581604, 0.23167791962623596, 0.005084449425339699, -0.08665763586759567, -0.060396961867809296, -0.09021031856536865 ]
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
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.
[ -0.10414494574069977, -0.06336086988449097, -0.03020908497273922, 0.2883920669555664, 0.0075524915009737015, 0.10713665932416916, 0.44242048263549805, 0.2390352338552475, -0.07540088146924973, 0.23192623257637024, 0.004603263456374407, 0.38680028915405273, 0.022636644542217255, 0.16401991248130798, -0.19678527116775513, 0.044330645352602005, 0.0699826031923294, 0.2382112294435501, 0.036159902811050415, -0.15268895030021667, 0.038027502596378326, 0.03409484773874283, -0.23754841089248657, -0.22605429589748383, -0.18138514459133148, -0.09860167652368546, 0.09232998639345169, -0.05092860758304596, 0.019966987892985344, -0.35423025488853455, 0.553274929523468, 0.11725372076034546, 0.3517654240131378, 0.7071784138679504, -0.00012922809401061386, 0.10497814416885376, 0.2590925693511963, -0.00560394674539566, -0.6045846343040466, -0.2840598225593567, 0.09072171896696091, 0.004779571667313576, 0.17519527673721313, -0.18622750043869019, -0.0017328113317489624, -0.1600751429796219, -0.14000830054283142, -0.3471583127975464, 0.04988491162657738, -0.0012596594169735909, -0.005964215844869614, 0.07209526002407074, -0.13452395796775818, 0.0729982927441597, 0.20000235736370087, 0.1965366005897522, -0.046685174107551575, 0.17506244778633118, 0.3140815496444702, -0.23755447566509247, -0.19133758544921875, 0.06887257099151611, 0.06699829548597336, 0.03559327870607376, 0.2698177695274353, -0.19910597801208496, 0.16083917021751404, -0.10931332409381866, 0.17835280299186707, 0.06678351014852524, 0.5646636486053467, -0.1811445951461792, -0.3387902081012726, -0.2353667914867401, -0.00009220954962074757, -0.23285526037216187, 0.20601144433021545, 0.26192334294319153, -0.32813751697540283, -0.04811399057507515, 0.12118659913539886, 0.013435715809464455, -0.20263727009296417, 0.06875123083591461, -0.3253173828125, 0.4617824852466583, -0.030609890818595886, 0.21785131096839905, 0.19638535380363464, -0.06895192712545395, 0.1950899213552475, 0.14250141382217407, 0.10292032361030579, 0.01756308227777481, -0.852195143699646, 0.17315450310707092, 0.06567241251468658, -0.1067567840218544, -0.11697915196418762, 0.13737866282463074, 0.04715022072196007, 0.10555396229028702, 0.3266277015209198, 0.16482055187225342, 0.4343135952949524, -0.2545827031135559, 0.1848083734512329, 0.042331762611866, 0.15822455286979675, 0.16069313883781433, -0.0813315212726593, 0.007358763366937637, -0.2682194113731384, -0.24515536427497864, 0.32560887932777405, -0.255710244178772, 0.1545047014951706, -0.3889695405960083, -0.06101790815591812, 0.22803018987178802, -0.15092210471630096, -0.14974403381347656, 0.1501772701740265, 0.5342459082603455, -0.18983210623264313, 0.20550814270973206, -0.05492658540606499, 0.18959033489227295, -0.05550133436918259, 0.07400377094745636, 0.11466921865940094, -0.1474180370569229, -0.21530695259571075, -0.051047876477241516, 0.10849016904830933, -0.5102603435516357, 0.06233102083206177, 0.12507040798664093, 0.15935949981212616, -0.12063494324684143, 0.08978357911109924, -0.20067563652992249, 0.1307031363248825, 0.16696448624134064, -0.014724554494023323, 0.1413048952817917, 0.1239466518163681, -0.15403959155082703, -0.23662817478179932, -0.01918654888868332, -0.2001645863056183, -0.012452103197574615, -0.21208219230175018, 0.016119658946990967, 0.13823562860488892, -0.16392996907234192, -0.20103904604911804, -0.4687892198562622, 0.16536813974380493, 0.05444345995783806, 0.12059194594621658, -0.1651093065738678, -0.030022332444787025, 0.05581211298704147, 0.07236052304506302, 0.3309292495250702, -0.649671196937561, 0.34610962867736816, 0.17628103494644165, 0.20351165533065796, 0.1799319088459015, 0.040553539991378784, -0.3619513213634491, 0.3060761094093323, -0.34508568048477173, -0.39955174922943115, 0.48815518617630005, -0.3303787112236023, -0.0884082019329071, 0.5122234225273132, 0.03231190890073776, 0.23113329708576202, 0.26907387375831604, -0.2747712731361389, 0.0792841911315918, -0.07643721997737885, 0.23803801834583282, 0.1350443959236145, 0.001879783347249031, -0.01345079392194748, -0.17801420390605927, 0.13086028397083282, 0.12279438227415085, 0.3274959921836853, 0.14757047593593597, 0.23559284210205078, -0.11120859533548355, -0.21834444999694824, 0.39263448119163513, -0.11495748162269592, -0.014033496379852295, 0.5614026188850403, 0.3339633047580719, 0.4886213541030884, 0.26666200160980225, 0.029683917760849, -0.35536789894104004, 0.3125109076499939, 0.09073757380247116, -0.06078308820724487, -0.08939360082149506, 0.15826725959777832, -0.11638758331537247, 0.3683001399040222, -0.3526814877986908, -0.09151752293109894, -0.1160956546664238, 0.3727048933506012, 0.04143109545111656, -0.19741180539131165, -0.3174581229686737, 0.6142505407333374, -0.049281418323516846, 0.040013011544942856, -0.3473866879940033, 0.24976341426372528, 0.1832493245601654, -0.12327833473682404, -0.034855104982852936, -0.11987046152353287, 0.17109692096710205, -0.2698494493961334, -0.11806695908308029, 0.021707726642489433, 0.16700436174869537, -0.013508565723896027, -0.11149599403142929, -0.1980646699666977, 0.0439780056476593, 0.24156033992767334, 0.08553354442119598, -0.17870865762233734, 0.10212316364049911, -0.1477561891078949, 0.20557481050491333, 0.12282688170671463, 0.05805147439241409, 0.822456955909729, -0.1018054187297821, -0.04874729365110397, 0.2089405655860901, 0.054943423718214035, -0.02488887310028076, 0.2521146833896637, 0.3254147171974182, -0.03365711495280266, 0.7720398902893066, 0.00654187984764576, -0.341703861951828, 0.17546531558036804, 0.12453246116638184, 0.09518934786319733, -0.3532053828239441, 0.2884151339530945, 0.03179866820573807, 0.1840079426765442, 0.17030662298202515, 0.06459641456604004, 0.11818183213472366, 0.03291979432106018, 0.04542136937379837, -0.11947924643754959, -0.07341895997524261, 0.029774554073810577, -0.13112357258796692, 0.3349039554595947, 0.5323923230171204, 0.2756899297237396, 0.060444172471761703, -0.07811591774225235, -0.1191323921084404, -0.5008125305175781, -0.030421007424592972, 0.3027920424938202, -0.07872193306684494, 0.5910440683364868, -0.38929277658462524, 0.3304331600666046, -0.2026255875825882, -0.07961872965097427, -0.24445921182632446, -0.27058425545692444, -0.4014090299606323, 0.6186456680297852, 0.05657238885760307, 0.0744662880897522, 0.015066545456647873, 0.11088377982378006, 0.22880469262599945, -0.39699018001556396, -0.45319631695747375, -0.2809920907020569, -0.4017317295074463, -0.2329251766204834, 0.35315924882888794, -0.2241588681936264, 0.14078649878501892, -0.09654566645622253, -0.20754769444465637, -0.33802151679992676, -0.2398228943347931, 0.2097337245941162, -0.10133348405361176, 0.3299561142921448, 0.13096590340137482, 0.2773262560367584, -0.017758462578058243, -0.2129276841878891, 0.04267890378832817, 0.05281086266040802, 0.05148717761039734, 0.3284716308116913, 0.045978132635354996, 0.12921325862407684, 0.25719544291496277, 0.00037651509046554565, -0.04124912619590759, -0.3381343483924866, 0.25395089387893677, -0.02346424013376236, 0.04488099366426468, -0.11025996506214142, 0.1257483810186386, 0.15412037074565887, -0.05057936906814575, 0.21436594426631927, 0.03392971307039261, -0.6997016072273254, 0.33966612815856934, -0.09818705171346664, -0.18852056562900543, -0.008709210902452469, -0.04252532124519348, 0.27375736832618713, 0.3188548684120178, -0.6844132542610168, 0.22370631992816925, -0.15088355541229248, -0.08893392980098724, -0.352619469165802, -0.0071021560579538345, 0.13113655149936676, 0.00039789266884326935, 0.08062069118022919, -0.004100535064935684, -0.13189224898815155, 0.28099948167800903, -0.005019742995500565, 0.16138491034507751, 0.12087468057870865, 0.5475835800170898, -0.05728757381439209, 0.42256367206573486, 0.2026216983795166, -0.08127079904079437, 0.5674796104431152, 0.19293378293514252, 0.1463695466518402, -0.03606679290533066, -0.33834347128868103, -0.16235296428203583, -0.09938451647758484, -0.2715945243835449, 0.0699382871389389, -0.24409523606300354, -0.4101426601409912, -0.2269953489303589, -0.17575466632843018, 0.021099351346492767, -0.3248406648635864, 0.26848939061164856, -0.3088764250278473, 0.1988920271396637, -0.08728782832622528, 0.21215400099754333, -0.2342393547296524, 0.12461797147989273, 0.060771409422159195, 0.060972120612859726, 0.08176463097333908, -0.00024092986132018268, -0.02763945423066616, 0.10325178503990173, -0.277150958776474, 0.07196441292762756, -0.01499206479638815, 0.6285838484764099, 0.08436611294746399, -0.2716767191886902, 0.1580882966518402, -0.3961183726787567, 1.0789251327514648, -0.0478699654340744, 0.17346055805683136, 0.16518612205982208, -0.40845873951911926, -0.2918013632297516, -0.2561492323875427, 0.05043330416083336, 0.07321986556053162, 0.12087929248809814, 0.6670328378677368, -0.2852564752101898, -0.5099256038665771, 0.09748049825429916, 0.03511133790016174, -0.21206869184970856, -0.3564249575138092, -0.38183677196502686, 0.11158742755651474, -0.3029068112373352, 0.12696965038776398, -0.22963294386863708, 0.22042518854141235, 0.1308736801147461, -0.08431729674339294, -0.320298433303833, 0.015916667878627777, 0.002801649272441864, 0.08637060225009918, 0.08799407631158829, -0.12973544001579285, 0.5127692818641663, 0.06045190989971161, 0.3915456235408783, 0.35535678267478943, 0.45000046491622925, 0.21171486377716064, -0.6037524342536926, 0.3891361951828003, -0.00876286718994379, 0.48061060905456543, 0.4142990708351135, -0.0007994279731065035, -0.03772618621587753, -0.22279959917068481, 0.36738061904907227, -0.32730355858802795, 0.10161179304122925, 0.2503025233745575, 0.11171559989452362, -0.5557599663734436, -0.23339606821537018, 0.28745508193969727, -0.08287970721721649, 0.18539123237133026, 0.3438290059566498, -0.028597652912139893, 0.07068170607089996, 0.44804447889328003, 0.037131380289793015, 0.8597015142440796, -0.161686971783638, 0.11523118615150452, 0.09629984945058823, -0.31940823793411255, 0.0047989655286073685, -0.7176753282546997, -0.052917882800102234, -0.3675898611545563, -0.1523386687040329, -0.02420072630047798, -0.37901803851127625, 0.22405537962913513, 0.07281674444675446, 0.28260764479637146, 0.3260902166366577, -0.19424432516098022, -0.07757328450679779, 0.08861929178237915, 0.18793143332004547, -0.20047099888324738, -0.26805776357650757, -0.20579341053962708, -0.03898942098021507, -0.07978494465351105, 0.13854801654815674, -0.131902813911438, -0.1991385966539383, 0.07652775943279266, 0.025648877024650574, -0.07895500212907791, 0.30335456132888794, 0.2214132398366928, -0.12991727888584137, 0.1919967234134674, -0.6729623079299927, 0.11377465724945068, 0.0036624595522880554, 0.005891025066375732, 0.042946696281433105, -0.060941606760025024, 0.09198130667209625, -0.01909652352333069, -0.08263560384511948, 0.05387375131249428, -0.16614650189876556, 0.4861561059951782, 0.0658540278673172, -0.1657112091779709, 0.04080839455127716, -0.21129852533340454, -0.2651417851448059, 0.20014330744743347, 0.23575381934642792, 0.260652631521225, -0.09279024600982666, 0.15426304936408997, 0.17252615094184875, -0.040958333760499954, -0.24868902564048767, -0.013988923281431198, -0.06042729318141937, -0.27971357107162476, 0.08954577147960663, -0.22208957374095917, -0.3749311566352844, -0.11952841281890869, 0.5382049083709717, -0.0569877102971077, 0.05260448902845383, 0.7065873146057129, 0.3373820185661316, -0.2984148859977722, -0.17582252621650696, -0.2550644278526306, 0.16959449648857117, -0.40774789452552795, 0.05335243046283722, -0.12874551117420197, 0.13641054928302765, 0.11537990719079971, -0.03627537563443184, -0.05306192487478256, -0.5535841584205627, -0.15897226333618164, -0.4212827682495117, -0.09898437559604645, -0.1789071410894394, -0.12834230065345764, 0.06178059056401253, 0.13542485237121582, 0.02412860095500946, -0.10295377671718597, 0.1690114438533783, -0.11755969375371933, -0.06978108733892441, -0.24573737382888794, 0.09214466065168381, -0.10945641994476318, -0.22541683912277222, 0.007864467799663544, 0.043716732412576675, 0.015745015814900398, 0.17924080789089203, 0.12155305594205856, -0.09169214963912964, -0.30187615752220154, 0.1747594177722931, 0.024799151346087456, 0.1953219771385193, 0.08225885778665543, -0.30235403776168823, -0.15181943774223328, -0.15782366693019867, 0.18077684938907623, -0.22523951530456543, 0.043647974729537964, -0.016201920807361603, 0.34268975257873535, 0.1704186648130417, -0.14561966061592102, -0.024312220513820648, 0.32735881209373474, -0.2543022632598877, 0.1438671499490738, 0.23130600154399872, -0.240036278963089, 0.07425527274608612, -0.2412072718143463, 0.08749471604824066, 0.1453397274017334, 0.06423629820346832, 0.42568400502204895, -0.4933386445045471, 0.07271461188793182, -0.09185878187417984, 0.34550532698631287, 0.7632796168327332, 0.09968452900648117, -0.3029301166534424, 0.5737638473510742, -0.008276524022221565, -0.2352711409330368, -0.17077481746673584, -0.1041608452796936, 0.10457872599363327, 0.011628519743680954, 0.21401844918727875, -0.09698197990655899, -0.19133694469928741, 0.2622510492801666, 0.09565301239490509, 0.14053751528263092, -0.11760586500167847, -0.053541652858257294, 0.15686510503292084, -0.05346573144197464, 0.005644541233778, 0.4474356174468994, 0.5113442540168762, 0.03798234462738037, 0.3106497526168823, 0.12404535710811615, 0.134770005941391, -0.15374228358268738, 0.12130260467529297, -0.1972440779209137, -0.5850446820259094, 0.12631815671920776, 0.13999630510807037, 0.37324681878089905, 0.01317598670721054, 0.008124135434627533, 0.30586063861846924, 0.20031413435935974, -0.3176111876964569, -0.3598589301109314, 0.17160527408123016, -0.10602856427431107, 0.10672284662723541, 0.14771471917629242, -0.1909925937652588, -0.0790436863899231, 0.17269755899906158, 0.07944869250059128, -0.16940458118915558, 0.1703120470046997, 0.1709115207195282, 0.22902487218379974, -0.4827498495578766, -0.21963179111480713, -0.03825290501117706, 0.1795615255832672, -0.11929289996623993, 0.17719854414463043, -0.080691397190094, -0.17506803572177887, -0.29297173023223877, -0.17424742877483368, 0.23634593188762665, 0.4132019877433777, -0.05229625478386879, 0.0325285941362381, -0.07530425488948822, 0.020870888605713844, -0.005918828770518303, 0.09386491030454636, -0.32256197929382324, 0.2349678874015808, 0.4505426585674286, -0.07157029956579208, 0.00755689200013876, -0.03373393788933754, 0.009956508874893188, 0.205070361495018, -0.2958267331123352, 0.15329647064208984, 0.3838807940483093, 0.06542316824197769, -0.015752028673887253, -0.08244752138853073, -0.5125157237052917, -0.013934311456978321, 0.3334968388080597, -0.05671226233243942, 0.05364156514406204, 0.01814676821231842, 0.006332613527774811, -0.09521526098251343, 0.5368879437446594, 0.259061336517334, 0.18668407201766968, -0.2271352857351303, -0.13658423721790314, -0.36674222350120544, 0.04841643571853638, -0.31859496235847473, -0.07087234407663345, 0.3980044424533844, 0.35715869069099426, 0.3951273262500763, 0.03372850641608238, 0.2283964455127716, -0.11803891509771347, -0.30858123302459717, 0.5864704847335815, -0.4417838156223297, -0.2529868483543396, 0.07794726639986038, 0.1458485722541809, -0.1472880095243454, -0.3679955303668976, 0.14865942299365997, 0.00769761111587286, -0.04918348789215088, -0.0313742533326149, -0.30662333965301514, 0.2060975730419159, -0.6096029281616211, 0.4157732129096985, -0.2763840854167938, 0.06407277286052704, 0.1659567952156067, -0.10930771380662918, -0.28216493129730225, -0.07910741865634918, 0.05120324343442917, -0.054929181933403015, -0.10002881288528442, 0.08418942242860794, -0.17046375572681427, 0.007897008210420609, -0.45034486055374146, 0.00554890651255846, -0.03987737372517586, -0.09869052469730377, -0.01137838140130043, 0.20413364470005035, 0.1196223720908165, 0.3203916847705841, 0.09072462469339371, 0.21263033151626587, 0.2617015838623047, 0.2190447449684143, -0.4278770089149475, -0.06649409979581833, 0.4350932240486145, -0.332309752702713, -0.6071891784667969, 0.21533814072608948, 0.10175210982561111, 0.21429365873336792, -0.034674450755119324, -0.358551561832428, 0.1918109953403473, 0.1233946681022644, -0.068707674741745, 0.013431686908006668, 0.18977905809879303, 0.1238669902086258, 0.13014362752437592, -0.33946165442466736, 0.18631070852279663, 0.00482558086514473, -0.05177641659975052, -0.0738161951303482, -0.11383923143148422 ]
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
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!
[ -0.1618717759847641, -0.11623475700616837, -0.05073045194149017, 0.24418897926807404, -0.047889284789562225, 0.04484961926937103, 0.5003330111503601, 0.24632807075977325, -0.09249958395957947, 0.25677400827407837, 0.011409665457904339, 0.4652772545814514, -0.047021735459566116, 0.14862160384655, -0.1819804608821869, 0.14048142731189728, 0.12657375633716583, 0.2034156769514084, 0.021680660545825958, -0.12567003071308136, -0.04159185662865639, 0.05701664090156555, -0.20565223693847656, -0.3150607943534851, -0.18829064071178436, -0.10061059147119522, 0.07566788047552109, -0.014600478112697601, 0.08693032711744308, -0.42743200063705444, 0.5890479683876038, 0.11758723855018616, 0.38393402099609375, 0.7320483326911926, -0.00012890355719719082, 0.07450035214424133, 0.25272136926651, 0.07799258828163147, -0.5209656953811646, -0.19218023121356964, 0.05941835045814514, -0.07102549821138382, 0.1538349688053131, -0.16601264476776123, 0.07990546524524689, -0.017835263162851334, -0.13168202340602875, -0.2738543748855591, 0.009935006499290466, -0.02675233781337738, -0.010273713618516922, 0.13689571619033813, -0.23116885125637054, 0.12070821225643158, 0.19633960723876953, 0.13378530740737915, -0.021442387253046036, 0.2797911465167999, 0.42006149888038635, -0.26396873593330383, -0.1811717450618744, 0.10535822808742523, 0.0901573970913887, 0.06574784219264984, 0.26909318566322327, -0.17851825058460236, 0.16275988519191742, -0.20868434011936188, 0.15985310077667236, 0.14006680250167847, 0.44695016741752625, -0.14405104517936707, -0.33052563667297363, -0.26898419857025146, -0.06382625550031662, -0.2859436273574829, 0.26640456914901733, 0.18569010496139526, -0.36763113737106323, -0.12309044599533081, 0.15527085959911346, 0.08731511980295181, -0.19591043889522552, 0.04304974153637886, -0.2831266522407532, 0.5560547709465027, 0.0007084794342517853, 0.1561792492866516, 0.3108657896518707, -0.03421621024608612, 0.25135356187820435, 0.2052249312400818, 0.17461085319519043, -0.006654593162238598, -0.8474757075309753, 0.09959734976291656, 0.09272660315036774, -0.08796640485525131, -0.17570459842681885, 0.06186818331480026, 0.0008196588605642319, 0.1264657974243164, 0.36051201820373535, 0.14018982648849487, 0.4055003225803375, -0.3020510971546173, 0.11495113372802734, 0.010549350641667843, 0.15496256947517395, 0.18032293021678925, -0.0693429484963417, 0.04751505330204964, -0.2383836805820465, -0.30722153186798096, 0.3735230267047882, -0.23584851622581482, 0.11422371864318848, -0.29121410846710205, -0.02674626000225544, 0.11912699788808823, -0.13941004872322083, -0.16382764279842377, 0.14556217193603516, 0.517113208770752, -0.2471623569726944, 0.2682490050792694, -0.10589451342821121, 0.1604364812374115, -0.1568981558084488, 0.06175132468342781, 0.1380760818719864, -0.12856554985046387, -0.17392753064632416, -0.04500795900821686, 0.1416030079126358, -0.5804479122161865, 0.0963749960064888, 0.15351830422878265, 0.20274008810520172, -0.06961986422538757, 0.09074316173791885, -0.22018738090991974, 0.1042238101363182, 0.12683016061782837, -0.026997238397598267, 0.16074536740779877, 0.07880325615406036, -0.13994665443897247, -0.25211024284362793, 0.020777296274900436, -0.14639067649841309, -0.03116939216852188, -0.15448147058486938, 0.0046104253269732, 0.1208716481924057, -0.20704543590545654, -0.17177808284759521, -0.4776546359062195, 0.2262427806854248, 0.06430412828922272, 0.08579720556735992, -0.22302274405956268, -0.05531983822584152, 0.02654225565493107, 0.058671317994594574, 0.3087264895439148, -0.5949589014053345, 0.36674636602401733, 0.13484054803848267, 0.27727365493774414, 0.2309473752975464, 0.06378762423992157, -0.2541722059249878, 0.3389745354652405, -0.31729641556739807, -0.4109482765197754, 0.39635026454925537, -0.36046481132507324, -0.17053037881851196, 0.521217942237854, 0.05964556336402893, 0.21894821524620056, 0.28789231181144714, -0.21931740641593933, 0.0989251583814621, -0.10593290627002716, 0.31528985500335693, 0.1019085943698883, 0.03645757585763931, 0.025411667302250862, -0.24083136022090912, 0.06279201060533524, -0.003995496779680252, 0.3539317846298218, 0.15292231738567352, 0.17403605580329895, -0.17734017968177795, -0.2842835485935211, 0.4416238069534302, -0.168803870677948, -0.015452010557055473, 0.5505431890487671, 0.35689017176628113, 0.4330821633338928, 0.25467613339424133, -0.03597525879740715, -0.2896023988723755, 0.328493595123291, -0.0015162918716669083, 0.018811818212270737, 0.031585268676280975, 0.18076984584331512, -0.06696821004152298, 0.3503136932849884, -0.3407116234302521, -0.08159810304641724, -0.12096559256315231, 0.2856157422065735, 0.04889750853180885, -0.18075360357761383, -0.3265315294265747, 0.5754957795143127, -0.016963640227913857, 0.02187112346291542, -0.3798040747642517, 0.19590981304645538, 0.1736573427915573, -0.13678838312625885, -0.04693093150854111, -0.10578883439302444, 0.1218319833278656, -0.23799605667591095, -0.08350225538015366, -0.05735473334789276, 0.2381732314825058, -0.001926124095916748, -0.18992581963539124, -0.14777497947216034, 0.03357800468802452, 0.3683522343635559, 0.08901580423116684, -0.17194198071956635, 0.1066216379404068, -0.08534299582242966, 0.2460031807422638, 0.10913161188364029, -0.04585910215973854, 0.7491178512573242, -0.06474639475345612, -0.09689345955848694, 0.16300053894519806, 0.06254187226295471, -0.006509844213724136, 0.25236251950263977, 0.37092137336730957, -0.01891108974814415, 0.7655933499336243, -0.019349927082657814, -0.2833729684352875, 0.21070608496665955, 0.19056572020053864, 0.10872490704059601, -0.3213735818862915, 0.28895583748817444, 0.009497866034507751, 0.12173714488744736, 0.1916353702545166, 0.13818106055259705, 0.1474224328994751, 0.021607037633657455, 0.10468284785747528, -0.10021849721670151, -0.051945604383945465, 0.0044179875403642654, -0.06749909371137619, 0.3539299964904785, 0.6203135848045349, 0.20175665616989136, -0.006730515975505114, -0.0628209337592125, -0.08517296612262726, -0.5933938026428223, -0.10296128690242767, 0.32715898752212524, -0.13596519827842712, 0.5944817662239075, -0.3258870244026184, 0.34952831268310547, -0.16416853666305542, -0.07598548382520676, -0.24949249625205994, -0.3061201274394989, -0.44304728507995605, 0.6229490637779236, 0.06705237925052643, 0.024724306538701057, 0.06196068599820137, 0.08922398090362549, 0.17846894264221191, -0.29967200756073, -0.413357675075531, -0.2468969076871872, -0.34546908736228943, -0.21901951730251312, 0.3692224621772766, -0.2729381322860718, 0.13452641665935516, -0.1231461763381958, -0.25171226263046265, -0.19079162180423737, -0.21333998441696167, 0.17405161261558533, -0.08564922958612442, 0.26395899057388306, 0.14671730995178223, 0.3184050917625427, -0.04665849357843399, -0.14697010815143585, 0.0010882383212447166, -0.011109826155006886, 0.058611467480659485, 0.2860027849674225, 0.017287956550717354, 0.19298066198825836, 0.3070037066936493, 0.012153133749961853, -0.07059193402528763, -0.33456286787986755, 0.30281341075897217, -0.0032712817192077637, 0.05959741771221161, -0.002544715069234371, 0.17274516820907593, 0.18876996636390686, -0.006442726124078035, 0.1677730828523636, 0.027517667040228844, -0.6874179840087891, 0.33370307087898254, -0.07905442267656326, -0.21468262374401093, -0.0448724739253521, -0.07571232318878174, 0.30484598875045776, 0.22914791107177734, -0.6630093455314636, 0.1271916776895523, -0.22673644125461578, -0.0609474740922451, -0.37745895981788635, 0.09583180397748947, 0.13230572640895844, 0.04703577235341072, 0.05589134991168976, -0.0009861700236797333, -0.0678459107875824, 0.2197921872138977, 0.01807740144431591, 0.08399858325719833, 0.18384087085723877, 0.5773604512214661, -0.022151518613100052, 0.43745118379592896, 0.31756600737571716, -0.057284917682409286, 0.5106604695320129, 0.19643501937389374, 0.12847279012203217, -0.019274257123470306, -0.34502601623535156, -0.1853765994310379, -0.1091495156288147, -0.2632078528404236, 0.07373590767383575, -0.26809635758399963, -0.3795751631259918, -0.1452943980693817, -0.14946229755878448, 0.055202193558216095, -0.29070669412612915, 0.32489413022994995, -0.30319204926490784, 0.17906853556632996, -0.019777510315179825, 0.23985964059829712, -0.2825683057308197, 0.05883104354143143, -0.03183837980031967, -0.012790702283382416, 0.07076355069875717, -0.05595023185014725, 0.04010992869734764, 0.024943504482507706, -0.4432387351989746, 0.08660340309143066, 0.06612289696931839, 0.6217999458312988, 0.1702432483434677, -0.2582995593547821, 0.20006063580513, -0.4139428734779358, 1.1118345260620117, -0.14672422409057617, 0.16594529151916504, 0.1712159514427185, -0.48480796813964844, -0.4029228389263153, -0.19895045459270477, -0.007490333169698715, 0.0214874017983675, 0.19442668557167053, 0.601401686668396, -0.19529908895492554, -0.4894254207611084, 0.08492954820394516, -0.0462348498404026, -0.17966359853744507, -0.3766308128833771, -0.44798630475997925, -0.007916871458292007, -0.246144101023674, 0.15198500454425812, -0.19921952486038208, 0.22650127112865448, 0.1201210543513298, -0.04815661534667015, -0.26236939430236816, 0.03491924703121185, 0.04809720441699028, 0.14466902613639832, 0.019158102571964264, -0.10961659252643585, 0.5277038812637329, 0.0466921404004097, 0.3180530071258545, 0.3649452328681946, 0.40531817078590393, 0.06398100405931473, -0.5422202944755554, 0.3553917407989502, -0.00046058185398578644, 0.45980870723724365, 0.4860193431377411, 0.0334465391933918, -0.03059077262878418, -0.13647018373012543, 0.4176003336906433, -0.33368590474128723, 0.003977414686232805, 0.28018903732299805, 0.18908654153347015, -0.5694273114204407, -0.27116841077804565, 0.27229973673820496, -0.012130392715334892, 0.19884617626667023, 0.3241387903690338, -0.13366083800792694, 0.08147040754556656, 0.4057278037071228, 0.08713056147098541, 0.8224061131477356, -0.13858528435230255, 0.18526646494865417, 0.1570398211479187, -0.27961432933807373, 0.09731344133615494, -0.6480470895767212, 0.046045370399951935, -0.4223750829696655, -0.22698532044887543, 0.04435112327337265, -0.3854244649410248, 0.1890208125114441, 0.11483539640903473, 0.23991036415100098, 0.261820524930954, -0.1373589038848877, -0.09755203127861023, 0.061743929982185364, 0.22183126211166382, -0.2702697813510895, -0.28238537907600403, -0.24945083260536194, -0.03369560092687607, -0.019140489399433136, 0.09644161909818649, -0.167342871427536, -0.16353173553943634, -0.01650043949484825, 0.0627061203122139, -0.08945945650339127, 0.24939706921577454, 0.23892842233181, -0.08509143441915512, 0.21727369725704193, -0.6226943135261536, 0.1607774794101715, 0.024724237620830536, 0.0977027490735054, -0.010388296097517014, -0.05777858942747116, 0.040192149579524994, -0.08871672302484512, -0.0608082041144371, 0.18181322515010834, -0.17049147188663483, 0.4650689363479614, -0.019919343292713165, -0.21237722039222717, -0.06110473722219467, -0.163398876786232, -0.30556201934814453, 0.2122858166694641, 0.3353084325790405, 0.12196529656648636, -0.11467277258634567, 0.15136802196502686, 0.24375495314598083, -0.04616096615791321, -0.24544338881969452, -0.011926542967557907, -0.024277381598949432, -0.2698582112789154, 0.30047890543937683, -0.24332471191883087, -0.3650548458099365, -0.1160636842250824, 0.5141152143478394, -0.03519213944673538, 0.11594021320343018, 0.7194281816482544, 0.37381258606910706, -0.35704392194747925, -0.15467417240142822, -0.143389493227005, 0.12859749794006348, -0.46406155824661255, 0.10341457277536392, -0.11599286645650864, 0.1528291553258896, 0.11444615572690964, -0.05500461533665657, -0.08451665937900543, -0.4986620545387268, -0.19313167035579681, -0.3543300926685333, -0.07974889129400253, -0.15479247272014618, -0.0864843875169754, 0.021772414445877075, 0.04694637656211853, -0.019563425332307816, -0.12970125675201416, 0.1572335660457611, -0.12988735735416412, -0.07786348462104797, -0.22517380118370056, 0.01845357194542885, -0.1539534330368042, -0.3218877911567688, 0.11399397253990173, 0.06408664584159851, -0.01198931597173214, 0.21137887239456177, 0.08986395597457886, -0.10803476721048355, -0.3007969260215759, 0.15365786850452423, -0.02816876396536827, 0.06752948462963104, 0.1293502002954483, -0.2105785310268402, -0.2033606320619583, -0.1689872443675995, 0.12015102803707123, -0.23104923963546753, 0.07077013701200485, -0.024396874010562897, 0.31702056527137756, 0.24425065517425537, -0.11094962805509567, 0.060108430683612823, 0.28601276874542236, -0.19940917193889618, 0.14735697209835052, 0.2983514368534088, -0.12136921286582947, 0.08831444382667542, -0.14248180389404297, 0.12998464703559875, 0.18554124236106873, -0.02578829601407051, 0.4013173282146454, -0.5497322082519531, 0.08975157141685486, -0.07775695621967316, 0.3413941264152527, 0.7738457918167114, 0.09691636264324188, -0.33215177059173584, 0.5302598476409912, -0.02027188055217266, -0.18308207392692566, -0.1692199558019638, -0.06775568425655365, 0.08864089101552963, -0.007148992270231247, 0.30267253518104553, -0.10090982913970947, -0.14598815143108368, 0.2704682946205139, 0.10622932761907578, 0.16512946784496307, -0.1421566903591156, -0.0831415206193924, 0.04115653783082962, -0.05343449115753174, 0.016805846244096756, 0.4790060222148895, 0.5187140703201294, 0.05570050701498985, 0.2717570662498474, 0.195267915725708, 0.17554599046707153, -0.1752563714981079, 0.11154618859291077, -0.18380925059318542, -0.6079599857330322, 0.11702488362789154, 0.18584981560707092, 0.24396979808807373, -0.029085494577884674, 0.006658673286437988, 0.2745668888092041, 0.07634080201387405, -0.2480994313955307, -0.3711574673652649, 0.1489403396844864, -0.14007538557052612, 0.07181937992572784, 0.11067762970924377, -0.12843798100948334, -0.0048164501786231995, 0.1558694988489151, 0.058511849492788315, -0.18294672667980194, 0.146345317363739, 0.21144148707389832, 0.1965000033378601, -0.3764147162437439, -0.26253432035446167, -0.09077679365873337, 0.24105632305145264, -0.08509981632232666, 0.04797189682722092, -0.08851167559623718, -0.12567827105522156, -0.4011215567588806, -0.09522929042577744, 0.3539483845233917, 0.3889979124069214, -0.07238513231277466, 0.03157402202486992, -0.0669553279876709, 0.0589950829744339, -0.07680422067642212, 0.0942714586853981, -0.24914732575416565, 0.27971580624580383, 0.38953906297683716, -0.09842811524868011, 0.002898319624364376, -0.12114737927913666, 0.029200689867138863, 0.21386507153511047, -0.24679292738437653, 0.1451549381017685, 0.3297257423400879, 0.04171264171600342, 0.008409321308135986, -0.06608327478170395, -0.5343636870384216, 0.02093656361103058, 0.33972883224487305, -0.13586264848709106, 0.045292820781469345, -0.011835560202598572, 0.00962924212217331, -0.11864455044269562, 0.5528885126113892, 0.2859301269054413, 0.1974068284034729, -0.15978601574897766, -0.11258916556835175, -0.2801162004470825, -0.0263771191239357, -0.4013300836086273, -0.06849770247936249, 0.36839932203292847, 0.3652293384075165, 0.3162933588027954, 0.02795705758035183, 0.29926973581314087, -0.08533079922199249, -0.3506658673286438, 0.6434943675994873, -0.4277184307575226, -0.22030068933963776, 0.07652722299098969, 0.08983280509710312, -0.12094318121671677, -0.42479151487350464, 0.16088519990444183, -0.14644160866737366, -0.052263010293245316, -0.10835729539394379, -0.25580012798309326, 0.2148813009262085, -0.586998462677002, 0.4256051182746887, -0.24148991703987122, 0.0914463996887207, 0.18530720472335815, -0.28844213485717773, -0.25829246640205383, -0.06420174986124039, 0.030386298894882202, 0.020887069404125214, -0.12919539213180542, 0.0877259373664856, -0.18061240017414093, -0.07252712547779083, -0.392337441444397, 0.11880255490541458, -0.09137202799320221, -0.008677617646753788, 0.057026371359825134, 0.16280528903007507, 0.15791526436805725, 0.35631969571113586, 0.12130837142467499, 0.22881001234054565, 0.20771566033363342, 0.18921342492103577, -0.49273377656936646, -0.06910309940576553, 0.3066863417625427, -0.39840298891067505, -0.5961796641349792, 0.07368908077478409, 0.09664420783519745, 0.03825492039322853, 0.0027204882353544235, -0.2595641613006592, 0.1719805896282196, 0.0774000734090805, -0.06371114403009415, -0.050465382635593414, 0.24098367989063263, 0.08676318824291229, 0.1155848503112793, -0.3341931700706482, 0.16164591908454895, -0.002904098480939865, -0.09493011981248856, -0.07486716657876968, -0.12614932656288147 ]
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
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.
[ -0.1282348930835724, -0.16303855180740356, -0.03323454409837723, 0.22006115317344666, -0.08479119837284088, 0.044966258108615875, 0.4441736340522766, 0.2328474521636963, -0.08224599063396454, 0.19713321328163147, 0.04701299965381622, 0.3833540081977844, 0.020228806883096695, -0.003366183489561081, -0.188598170876503, -0.033799245953559875, 0.06023280322551727, 0.19576144218444824, -0.017361290752887726, -0.12104857712984085, 0.1253301203250885, 0.0037335511296987534, -0.2132294625043869, -0.2208343893289566, -0.28959494829177856, -0.09955807775259018, 0.004785580560564995, -0.08074095100164413, 0.11567386239767075, -0.3850102722644806, 0.5517266392707825, 0.14592744410037994, 0.2125541716814041, 0.7858381271362305, -0.00012740892998408526, 0.06073002517223358, 0.2737290859222412, 0.0773068219423294, -0.5201413035392761, -0.19899658858776093, 0.3156583905220032, -0.026708384975790977, 0.21663998067378998, -0.171725794672966, -0.05352667719125748, -0.17657789587974548, -0.09129202365875244, -0.4018271863460541, 0.0005606338381767273, 0.009669140912592411, 0.002419702708721161, 0.24164140224456787, -0.23948973417282104, 0.07476445287466049, 0.12983563542366028, 0.17444723844528198, -0.010116249322891235, 0.16711413860321045, 0.4735138714313507, -0.2247215360403061, -0.34858980774879456, 0.1061868667602539, 0.04298584163188934, 0.12596917152404785, 0.33433622121810913, -0.22182324528694153, -0.014465764164924622, -0.08843915164470673, 0.041135650128126144, 0.0858437791466713, 0.4793258607387543, -0.1476411521434784, -0.33275964856147766, -0.26822489500045776, -0.06434692442417145, -0.22489933669567108, 0.25235894322395325, 0.15041899681091309, -0.3533093333244324, -0.0973462164402008, 0.0472174808382988, 0.04071030020713806, -0.23455722630023956, 0.07779940217733383, -0.28329622745513916, 0.44501039385795593, 0.03228836506605148, 0.20183157920837402, 0.13903197646141052, -0.008285265415906906, 0.2497146874666214, 0.07591517269611359, 0.2579061686992645, 0.019696500152349472, -0.8287281394004822, 0.20608016848564148, 0.11865988373756409, -0.246267169713974, -0.20483121275901794, 0.1106189638376236, 0.04565637186169624, 0.16164720058441162, 0.3271091878414154, 0.158899188041687, 0.41164276003837585, -0.19735491275787354, 0.03512762859463692, 0.04848453402519226, 0.20777300000190735, 0.04415576905012131, -0.05405283719301224, 0.08104564249515533, -0.20055370032787323, -0.31742966175079346, 0.27833521366119385, -0.1855318248271942, 0.10573452711105347, -0.30457863211631775, -0.046679623425006866, 0.19204546511173248, -0.09650123119354248, -0.10240727663040161, 0.1841643750667572, 0.5119490027427673, -0.28244978189468384, 0.28566014766693115, 0.04447440803050995, 0.11646436899900436, -0.1351642608642578, 0.10792168229818344, 0.11812559515237808, -0.14263580739498138, -0.1985185295343399, -0.07583768665790558, 0.14570000767707825, -0.46500271558761597, 0.0612812414765358, 0.14106658101081848, 0.37256699800491333, -0.07190871238708496, 0.06310007721185684, -0.24118651449680328, 0.13647502660751343, 0.15168128907680511, -0.113507479429245, 0.15532894432544708, 0.076210618019104, 0.09051884710788727, -0.2706785202026367, -0.013373814523220062, -0.17004582285881042, -0.11367790400981903, -0.2109466940164566, 0.018139081075787544, 0.13437916338443756, -0.10786545276641846, -0.11974699050188065, -0.5369675755500793, 0.1944219172000885, 0.022418249398469925, 0.023219585418701172, -0.260459303855896, -0.08370738476514816, 0.09937694668769836, 0.08837597072124481, 0.29600653052330017, -0.5126630663871765, 0.2683594822883606, 0.18587663769721985, 0.2616991400718689, 0.15383216738700867, 0.13527877628803253, -0.3134447932243347, 0.30432960391044617, -0.3094261884689331, -0.38461899757385254, 0.4345477819442749, -0.3389453887939453, -0.053929924964904785, 0.5047903060913086, -0.035507578402757645, 0.23734520375728607, 0.2731824815273285, -0.12549424171447754, 0.10399772971868515, -0.06701596081256866, 0.3289487659931183, 0.1983271837234497, 0.03415708616375923, 0.07299543917179108, -0.19867774844169617, 0.11941853165626526, 0.09350143373012543, 0.4231121242046356, 0.11738093197345734, 0.0876118540763855, -0.20054417848587036, -0.27756839990615845, 0.4117310345172882, -0.1435924470424652, -0.0498005747795105, 0.6226991415023804, 0.18968980014324188, 0.452248752117157, 0.33909285068511963, 0.010151688009500504, -0.30218273401260376, 0.3201761841773987, 0.15101875364780426, 0.023170828819274902, -0.13190872967243195, 0.1824251115322113, 0.012947237119078636, 0.3651636838912964, -0.3801310658454895, -0.0404374785721302, -0.12552568316459656, 0.3213680386543274, 0.05428807809948921, -0.2153390496969223, -0.29624491930007935, 0.6006156206130981, -0.018037013709545135, -0.028303293511271477, -0.33982089161872864, 0.1587217003107071, 0.09854084253311157, -0.13364927470684052, 0.0477132722735405, -0.11855118721723557, 0.10106182843446732, -0.28067031502723694, -0.12449853867292404, 0.042810723185539246, 0.15840084850788116, 0.034330181777477264, -0.14000636339187622, -0.19398407638072968, 0.07422201335430145, 0.2574537992477417, 0.1561458557844162, -0.018499743193387985, 0.023957498371601105, -0.20852679014205933, 0.17128898203372955, 0.1846705675125122, 0.051497358828783035, 0.8057292699813843, -0.10135488212108612, -0.13761816918849945, 0.1472356617450714, 0.15652576088905334, -0.041742436587810516, 0.31719690561294556, 0.4886823892593384, -0.04876113310456276, 0.791573166847229, -0.007833154872059822, -0.384647399187088, 0.17780332267284393, 0.08786633610725403, 0.062319543212652206, -0.37325137853622437, 0.2674618065357208, 0.055807553231716156, 0.1219244971871376, 0.17607542872428894, -0.09710817039012909, 0.16152828931808472, 0.0318550243973732, 0.043512262403964996, -0.1696946620941162, -0.12918803095817566, -0.0030402662232518196, -0.12917298078536987, 0.3306781053543091, 0.48323002457618713, 0.2352067232131958, 0.07307843118906021, -0.028801314532756805, -0.09751815348863602, -0.5260420441627502, -0.05839293450117111, 0.1409294754266739, -0.08026988804340363, 0.669424295425415, -0.34796157479286194, 0.3091539442539215, -0.21922507882118225, -0.09348645061254501, -0.3079586327075958, -0.26563405990600586, -0.29572778940200806, 0.5695269107818604, 0.014539595693349838, 0.08793770521879196, 0.05071628466248512, 0.04659004509449005, 0.2999553978443146, -0.5311840176582336, -0.4011194109916687, -0.3319467008113861, -0.3443777859210968, -0.21654051542282104, 0.3255549967288971, -0.22306415438652039, 0.20545168220996857, -0.10328935086727142, -0.1840190440416336, -0.2373601496219635, -0.19735535979270935, 0.15280359983444214, -0.07937728613615036, 0.2109168916940689, 0.09484566003084183, 0.22597864270210266, 0.07381787151098251, -0.22418639063835144, 0.1130198985338211, -0.08221500366926193, 0.06175720691680908, 0.31213104724884033, -0.017372582107782364, 0.10677776485681534, 0.2597455680370331, -0.02653280645608902, -0.044076837599277496, -0.2843978703022003, 0.19586004316806793, -0.04701545462012291, 0.04951895400881767, -0.15056245028972626, 0.17924310266971588, 0.1268565058708191, -0.047165822237730026, 0.3113795518875122, 0.10144703835248947, -0.6588580012321472, 0.3922480642795563, -0.10958274453878403, -0.28002116084098816, -0.14981496334075928, -0.005287650972604752, 0.24412597715854645, 0.3251311779022217, -0.6613543629646301, 0.13210082054138184, -0.2203036993741989, -0.009581752121448517, -0.3635203540325165, -0.07084544748067856, 0.20217296481132507, 0.032331351190805435, 0.032015688717365265, -0.017990434542298317, -0.12578672170639038, 0.18858644366264343, -0.014635350555181503, 0.12744730710983276, 0.0874602198600769, 0.4644906222820282, -0.004696119576692581, 0.5634547472000122, 0.13471291959285736, -0.18136878311634064, 0.5286002159118652, 0.18629634380340576, 0.12853944301605225, -0.0771961435675621, -0.33924221992492676, -0.11106528341770172, -0.2515265643596649, -0.2384285032749176, 0.041137948632240295, -0.25309643149375916, -0.44094011187553406, -0.23097428679466248, -0.13216494023799896, 0.11993274837732315, -0.2988502085208893, 0.3276843726634979, -0.3295155465602875, 0.2237447202205658, -0.07160153985023499, 0.2675788998603821, -0.2772146463394165, 0.11326278746128082, 0.09486258029937744, -0.028800204396247864, 0.12316223978996277, -0.05866424739360809, 0.07145239412784576, 0.06018684431910515, -0.31667953729629517, 0.09198562800884247, 0.05341208353638649, 0.5590816140174866, 0.15632207691669464, -0.27515774965286255, 0.221279576420784, -0.4462674558162689, 0.9339809417724609, 0.14962825179100037, 0.17429254949092865, 0.18395347893238068, -0.4252992570400238, -0.3698015809059143, -0.16727381944656372, 0.07634307444095612, 0.17498403787612915, 0.24018803238868713, 0.5403403639793396, -0.2801347076892853, -0.5825622081756592, 0.07475245743989944, 0.1485978215932846, -0.20711492002010345, -0.3710312247276306, -0.45170482993125916, 0.10398400574922562, -0.247565358877182, 0.1471279114484787, -0.18264181911945343, 0.26042184233665466, 0.1350546032190323, -0.041056133806705475, -0.2462194710969925, 0.09158115088939667, -0.0903896689414978, 0.02351684868335724, 0.0781116709113121, -0.2792324721813202, 0.5323889851570129, 0.1154889464378357, 0.46552813053131104, 0.3305024206638336, 0.37573978304862976, 0.13342073559761047, -0.4777715802192688, 0.4246264696121216, 0.07304390519857407, 0.413727343082428, 0.505028247833252, 0.08717998117208481, -0.0779634490609169, -0.2221153974533081, 0.4203703999519348, -0.3333033323287964, 0.1132410317659378, 0.32552215456962585, 0.10901764780282974, -0.5049720406532288, -0.25073057413101196, 0.22488224506378174, -0.03097054734826088, 0.18174470961093903, 0.4017893075942993, -0.12793751060962677, 0.18313299119472504, 0.4081379175186157, 0.08932488411664963, 0.9135490655899048, -0.1691722422838211, 0.2489926666021347, 0.08775492012500763, -0.3394377827644348, -0.053342778235673904, -0.7310382723808289, 0.03102867677807808, -0.36461782455444336, -0.13349413871765137, 0.04407992213964462, -0.4001394212245941, 0.16260339319705963, 0.07291268557310104, 0.27763631939888, 0.3105155825614929, -0.09678757190704346, -0.06429009139537811, 0.05504225194454193, 0.2844177782535553, -0.18352331221103668, -0.2949768900871277, -0.16601362824440002, -0.027231978252530098, -0.09808856248855591, 0.1943085491657257, -0.1256827712059021, -0.1672457903623581, 0.0696474015712738, -0.012091169133782387, -0.08541848510503769, 0.25057870149612427, 0.20084118843078613, -0.0796908438205719, 0.08929552882909775, -0.7588247060775757, 0.05179005488753319, 0.018508102744817734, -0.10262900590896606, -0.0440690778195858, -0.035580381751060486, 0.12186218798160553, -0.03879848122596741, -0.015759581699967384, 0.08888543397188187, -0.31209057569503784, 0.3677685856819153, 0.012521874159574509, -0.08178500831127167, -0.02438555657863617, -0.24686114490032196, -0.3097466230392456, 0.2671707570552826, 0.30706560611724854, 0.17978233098983765, -0.007733945734798908, 0.20527344942092896, 0.1798645555973053, -0.002559039741754532, -0.22793886065483093, -0.004565345123410225, 0.0005203038454055786, -0.2519557476043701, 0.15937739610671997, -0.2823556661605835, -0.3242552578449249, -0.12120871245861053, 0.5422455668449402, 0.0047502946108579636, -0.0021674074232578278, 0.6889649629592896, 0.46349960565567017, -0.36391574144363403, -0.1303986757993698, -0.2012675404548645, 0.16748110949993134, -0.4937412738800049, 0.048403140157461166, -0.18122205138206482, 0.09677031636238098, 0.0665452629327774, -0.057101476937532425, -0.1151934564113617, -0.5163530111312866, -0.18111826479434967, -0.295047402381897, -0.15290161967277527, -0.18394304811954498, -0.07970945537090302, 0.05439087003469467, 0.13324099779129028, 0.013354603201150894, -0.05576670914888382, 0.21725955605506897, -0.11903136223554611, -0.10261353850364685, -0.18701882660388947, 0.13146305084228516, -0.10881766676902771, -0.2420189380645752, 0.1036686971783638, 0.024306386709213257, -0.015010864473879337, 0.11516794562339783, 0.1816498041152954, -0.08820414543151855, -0.25176844000816345, 0.16121628880500793, -0.04820401966571808, 0.1498398780822754, 0.0654335469007492, -0.29085564613342285, -0.10626783967018127, -0.18137414753437042, 0.16971446573734283, -0.1582813560962677, -0.0025801286101341248, -0.09596594423055649, 0.33470746874809265, 0.10987593978643417, -0.07123584300279617, -0.030091866850852966, 0.31502020359039307, -0.16270317137241364, 0.13979172706604004, 0.23899976909160614, -0.11980348825454712, 0.041666507720947266, -0.075358547270298, 0.054626237601041794, 0.11332754045724869, -0.0182858407497406, 0.3875104486942291, -0.4736880660057068, 0.05890708044171333, -0.16433684527873993, 0.4484860599040985, 0.7816051840782166, 0.07098328322172165, -0.3125961422920227, 0.4629760980606079, -0.012631034478545189, -0.2104247659444809, -0.2653948962688446, -0.10882772505283356, 0.01092458050698042, 0.029694143682718277, 0.12479047477245331, -0.10640417784452438, -0.018836133182048798, 0.3480474352836609, 0.15106254816055298, 0.13062450289726257, -0.15104712545871735, -0.0882808119058609, 0.11568286269903183, 0.07196804881095886, -0.049716439098119736, 0.450324147939682, 0.44728437066078186, 0.03432759642601013, 0.2670273780822754, 0.13654446601867676, 0.23828516900539398, -0.012079939246177673, 0.1295175701379776, -0.14881232380867004, -0.4394438564777374, 0.029851967468857765, 0.042753130197525024, 0.3748290240764618, -0.05621384084224701, -0.018133610486984253, 0.3604482114315033, 0.04373510181903839, -0.35902535915374756, -0.3672621548175812, 0.20466771721839905, -0.10211662203073502, 0.12915414571762085, 0.19114606082439423, -0.13423216342926025, -0.026950817555189133, 0.16599918901920319, 0.07117944210767746, -0.04966212064027786, 0.1651117205619812, 0.20492516458034515, 0.22805903851985931, -0.4560891091823578, -0.26538971066474915, -0.11785558611154556, 0.21030068397521973, -0.04204174876213074, 0.1561514437198639, 0.012228287756443024, -0.1502668261528015, -0.3066157400608063, -0.10890989750623703, 0.36715224385261536, 0.3530412018299103, -0.19021481275558472, 0.09056095778942108, -0.1289258450269699, 0.007364260032773018, 0.008657535538077354, 0.15116432309150696, -0.30303922295570374, 0.13681834936141968, 0.4797583520412445, -0.07934025675058365, -0.012677754275500774, -0.03578795865178108, -0.04410683736205101, 0.17682160437107086, -0.24469442665576935, 0.2963915169239044, 0.2329997569322586, -0.05570593103766441, -0.06992647051811218, -0.053892187774181366, -0.5279349088668823, 0.026131298393011093, 0.3707154095172882, -0.08643753826618195, -0.003555011935532093, -0.03203434497117996, 0.007402490824460983, -0.11151295900344849, 0.6506914496421814, 0.2361329346895218, 0.3291269540786743, -0.23498855531215668, -0.16660751402378082, -0.34138166904449463, 0.0679653137922287, -0.4469633400440216, -0.033684298396110535, 0.31759583950042725, 0.28906017541885376, 0.3796786367893219, 0.06738868355751038, 0.22457870841026306, -0.08936905860900879, -0.2498662918806076, 0.593071699142456, -0.455914169549942, -0.15584427118301392, 0.003430798649787903, 0.14966963231563568, -0.14986121654510498, -0.36872369050979614, 0.10753485560417175, 0.003061003051698208, -0.036077454686164856, -0.04622922092676163, -0.27975937724113464, 0.24444982409477234, -0.434032142162323, 0.358290433883667, -0.2303336262702942, 0.13699251413345337, 0.1990574300289154, -0.2388925552368164, -0.24692243337631226, -0.05913938209414482, 0.06257303804159164, -0.0416327640414238, -0.05223436281085014, 0.024004563689231873, -0.1491146683692932, -0.11041031777858734, -0.45985862612724304, 0.13143059611320496, -0.07287696748971939, -0.14558330178260803, 0.03709929436445236, 0.15123188495635986, 0.042723871767520905, 0.42197516560554504, 0.07614132016897202, 0.2449711561203003, 0.23035801947116852, 0.18016700446605682, -0.48245489597320557, -0.08907762169837952, 0.40522539615631104, -0.34172165393829346, -0.5525678992271423, 0.09836054593324661, 0.1087348535656929, 0.18227508664131165, 0.061264291405677795, -0.33912214636802673, 0.18267607688903809, 0.05231277272105217, 0.02081448957324028, 0.005141701549291611, 0.18522629141807556, 0.166143998503685, 0.07856310904026031, -0.3599410057067871, 0.24524125456809998, -0.026387013494968414, -0.10724973678588867, -0.17912724614143372, -0.1352599710226059 ]
https://github.com/huggingface/datasets/issues/6079
Iterating over DataLoader based on HF datasets is stuck forever
I'm facing a similar situation in the local VS Code. Datasets version 2.14.4 Torch 2.0.1+cu118 Same code runs without issues in Colab ``` from datasets import load_dataset dataset = load_dataset("Supermaxman/esa-hubble", streaming=True) sample = next(iter(dataset["train"])) ``` is stuck for minutes. If I interrupt, I get ``` --------------------------------------------------------------------------- KeyboardInterrupt Traceback (most recent call last) Cell In[5], line 5 1 from datasets import load_dataset 3 dataset = load_dataset("Supermaxman/esa-hubble", streaming=True) ----> 5 sample = next(iter(dataset["train"])) 6 print(sample["text"]) 7 sample["image"] File [~/miniconda3/envs/book/lib/python3.10/site-packages/datasets/iterable_dataset.py:1353](https://file+.vscode-resource.vscode-cdn.net/home/osanseviero/Desktop/workspace/genai/nbs/~/miniconda3/envs/book/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 [~/miniconda3/envs/book/lib/python3.10/site-packages/datasets/iterable_dataset.py:255](https://file+.vscode-resource.vscode-cdn.net/home/osanseviero/Desktop/workspace/genai/nbs/~/miniconda3/envs/book/lib/python3.10/site-packages/datasets/iterable_dataset.py:255), in ArrowExamplesIterable.__iter__(self) 253 def __iter__(self): 254 formatter = PythonFormatter() --> 255 for key, pa_table in self.generate_tables_fn(**self.kwargs): 256 for pa_subtable in pa_table.to_reader(max_chunksize=config.ARROW_READER_BATCH_SIZE_IN_DATASET_ITER): ... -> 1130 return self._sslobj.read(len, buffer) 1131 else: 1132 return self._sslobj.read(len) ```
### 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
155
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'm facing a similar situation in the local VS Code. Datasets version 2.14.4 Torch 2.0.1+cu118 Same code runs without issues in Colab ``` from datasets import load_dataset dataset = load_dataset("Supermaxman/esa-hubble", streaming=True) sample = next(iter(dataset["train"])) ``` is stuck for minutes. If I interrupt, I get ``` --------------------------------------------------------------------------- KeyboardInterrupt Traceback (most recent call last) Cell In[5], line 5 1 from datasets import load_dataset 3 dataset = load_dataset("Supermaxman/esa-hubble", streaming=True) ----> 5 sample = next(iter(dataset["train"])) 6 print(sample["text"]) 7 sample["image"] File [~/miniconda3/envs/book/lib/python3.10/site-packages/datasets/iterable_dataset.py:1353](https://file+.vscode-resource.vscode-cdn.net/home/osanseviero/Desktop/workspace/genai/nbs/~/miniconda3/envs/book/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 [~/miniconda3/envs/book/lib/python3.10/site-packages/datasets/iterable_dataset.py:255](https://file+.vscode-resource.vscode-cdn.net/home/osanseviero/Desktop/workspace/genai/nbs/~/miniconda3/envs/book/lib/python3.10/site-packages/datasets/iterable_dataset.py:255), in ArrowExamplesIterable.__iter__(self) 253 def __iter__(self): 254 formatter = PythonFormatter() --> 255 for key, pa_table in self.generate_tables_fn(**self.kwargs): 256 for pa_subtable in pa_table.to_reader(max_chunksize=config.ARROW_READER_BATCH_SIZE_IN_DATASET_ITER): ... -> 1130 return self._sslobj.read(len, buffer) 1131 else: 1132 return self._sslobj.read(len) ```
[ -0.15123406052589417, -0.03259515017271042, -0.02845512516796589, 0.23572959005832672, -0.027844958007335663, 0.07383473962545395, 0.3774380385875702, 0.20796845853328705, -0.021897586062550545, 0.385067880153656, -0.012811973690986633, 0.3522011339664459, -0.008928348310291767, 0.16393548250198364, -0.17049254477024078, 0.0670933872461319, 0.049390438944101334, 0.22274312376976013, 0.10169398784637451, -0.130355566740036, 0.02948765456676483, 0.029950778931379318, -0.3097453713417053, -0.26594454050064087, -0.18462315201759338, -0.03683578968048096, 0.12878631055355072, -0.05628608912229538, 0.0259518101811409, -0.3814319670200348, 0.62481689453125, 0.16229815781116486, 0.37533581256866455, 0.7256145477294922, -0.0001313472748734057, 0.142774298787117, 0.3356812000274658, 0.048867352306842804, -0.6637637615203857, -0.3589891195297241, 0.0435652956366539, 0.06522509455680847, 0.26196950674057007, -0.15577951073646545, -0.05944162607192993, -0.06394404172897339, -0.07916826754808426, -0.3699111342430115, 0.05046670883893967, -0.019641589373350143, -0.033483486622571945, 0.08880497515201569, -0.28518348932266235, 0.044522326439619064, 0.22081932425498962, 0.22438284754753113, -0.11967513710260391, 0.19854629039764404, 0.38984814286231995, -0.1517939418554306, -0.19205603003501892, 0.07849550247192383, 0.08150558918714523, 0.10371550917625427, 0.28534582257270813, -0.1949390023946762, -0.012792900204658508, -0.08776344358921051, 0.19933104515075684, -0.006608821451663971, 0.5435318350791931, -0.19053015112876892, -0.28082603216171265, -0.1588321477174759, 0.009332738816738129, -0.2936658263206482, 0.2816721498966217, 0.2376810759305954, -0.36647048592567444, -0.013070560991764069, 0.044045060873031616, 0.0472281388938427, -0.23692406713962555, 0.08813665807247162, -0.3727712631225586, 0.3604058027267456, -0.08875536918640137, 0.2470746636390686, 0.23569193482398987, -0.00028419867157936096, 0.41206175088882446, 0.06204819306731224, 0.16325758397579193, 0.04009727016091347, -0.8684039115905762, 0.22935903072357178, 0.059457212686538696, 0.062263019382953644, -0.2154698371887207, 0.06333906948566437, 0.09233134239912033, 0.06884685158729553, 0.28327855467796326, 0.18865671753883362, 0.3755180239677429, -0.18589209020137787, 0.18544265627861023, 0.11111923307180405, 0.2405146062374115, 0.19580726325511932, -0.1834554672241211, 0.020044919103384018, -0.25425851345062256, -0.2745972275733948, 0.1482871025800705, -0.17778730392456055, 0.15119771659374237, -0.44642916321754456, -0.055938154458999634, 0.2692316770553589, -0.2518477737903595, -0.10010534524917603, 0.20177805423736572, 0.4657802879810333, -0.17026197910308838, 0.17156392335891724, -0.05493248999118805, 0.03519761562347412, -0.059961527585983276, 0.07592548429965973, 0.11021985113620758, -0.1491984874010086, -0.2401869148015976, 0.025191862136125565, 0.15736496448516846, -0.473896324634552, 0.016375629231333733, 0.03656032308936119, 0.22008031606674194, -0.040186259895563126, 0.03933727741241455, -0.2740861773490906, 0.24444183707237244, 0.2233804315328598, -0.0007129162549972534, 0.1987021118402481, 0.0503951720893383, -0.1870151311159134, -0.27030977606773376, 0.022870510816574097, -0.11108409613370895, -0.05100509524345398, -0.18232731521129608, -0.033140406012535095, 0.044595688581466675, -0.08854402601718903, -0.2075405716896057, -0.44742831587791443, 0.11794903874397278, 0.005197007209062576, 0.11940602958202362, -0.20231866836547852, -0.10491959750652313, 0.10703127831220627, 0.10973062366247177, 0.43811100721359253, -0.7472406029701233, 0.3302385210990906, 0.1328272819519043, 0.2631215751171112, 0.1952347308397293, 0.11407771706581116, -0.4000150263309479, 0.33650654554367065, -0.34857508540153503, -0.425578236579895, 0.38636600971221924, -0.36282745003700256, -0.1725119650363922, 0.5592951774597168, 0.06826773285865784, 0.261261910200119, 0.21544983983039856, -0.22731944918632507, 0.09231723099946976, -0.10013709962368011, 0.2865482568740845, 0.1608920395374298, -0.05289130657911301, 0.0023761745542287827, -0.20182223618030548, 0.07363554835319519, 0.06555429100990295, 0.3734332025051117, 0.15602682530879974, 0.16692247986793518, -0.08668827265501022, -0.1548842191696167, 0.3598410487174988, -0.1159164160490036, 0.0033922356087714434, 0.5571637153625488, 0.3055690824985504, 0.371165931224823, 0.22362439334392548, -0.002470925450325012, -0.39639249444007874, 0.3028389513492584, 0.1711764931678772, 0.018208585679531097, -0.1241270899772644, 0.10915188491344452, -0.14426806569099426, 0.3750935196876526, -0.378852903842926, -0.11003467440605164, -0.15896210074424744, 0.3783946931362152, 0.08572280406951904, -0.1674986630678177, -0.2627023458480835, 0.6112453937530518, -0.06349746137857437, 0.0012820804258808494, -0.3321755528450012, 0.2894882261753082, 0.14667917788028717, -0.1721167117357254, -0.07828903198242188, -0.11506941169500351, 0.10457542538642883, -0.39439326524734497, -0.18799138069152832, 0.025626730173826218, 0.14014901220798492, 0.05428200587630272, -0.04603911191225052, -0.1357361227273941, 0.13612550497055054, 0.20193153619766235, 0.05883120000362396, -0.1444232016801834, 0.13007111847400665, -0.11742722988128662, 0.1042165532708168, 0.07379612326622009, -0.018665440380573273, 0.8758018016815186, -0.14854729175567627, -0.12917901575565338, 0.19037088751792908, 0.053489092737436295, -0.08837726712226868, 0.2786230742931366, 0.35817551612854004, 0.026824988424777985, 0.8443766832351685, 0.034854188561439514, -0.3246515691280365, 0.18487757444381714, 0.14936818182468414, 0.09916622936725616, -0.4599725008010864, 0.3138221502304077, 0.04337234050035477, 0.17808222770690918, 0.2643295228481293, 0.06474219262599945, 0.14374932646751404, 0.007676021195948124, 0.05795720964670181, -0.1191210076212883, -0.09302311390638351, -0.03350713104009628, -0.12510845065116882, 0.31874048709869385, 0.49455562233924866, 0.2563630938529968, 0.052206169813871384, -0.054021041840314865, -0.13513123989105225, -0.4862891435623169, -0.07065559923648834, 0.3025238513946533, -0.022607140243053436, 0.6263390779495239, -0.4066511392593384, 0.17327526211738586, -0.2577996551990509, -0.05829903110861778, -0.17126764357089996, -0.2719879746437073, -0.4631521701812744, 0.6159791350364685, 0.048069294542074203, 0.1192270815372467, 0.07565313577651978, 0.13765522837638855, 0.24107719957828522, -0.40924984216690063, -0.44191914796829224, -0.2837447226047516, -0.35938361287117004, -0.24078398942947388, 0.4463018476963043, -0.24213995039463043, 0.12279413640499115, -0.10628164559602737, -0.1816709041595459, -0.25198274850845337, -0.26231849193573, 0.30063295364379883, -0.08927033841609955, 0.44878315925598145, 0.10069293528795242, 0.20940101146697998, -0.11383276432752609, -0.18434599041938782, 0.05694001540541649, 0.017432408407330513, 0.10124295949935913, 0.18550732731819153, -0.05335644260048866, 0.04007871076464653, 0.225763201713562, -0.05037876218557358, -0.14298422634601593, -0.35043424367904663, 0.2323617935180664, -0.09541760385036469, 0.0028854310512542725, -0.13541282713413239, 0.17770501971244812, 0.172896146774292, 0.0922672376036644, 0.04751233011484146, 0.06597770750522614, -0.7267881035804749, 0.2927631735801697, -0.19318868219852448, -0.1926259547472, -0.07886019349098206, -0.03091413527727127, 0.2606043219566345, 0.29134541749954224, -0.6580789685249329, 0.2737690806388855, -0.2846597135066986, -0.02954423800110817, -0.28522372245788574, -0.01783529855310917, 0.12543967366218567, -0.024950506165623665, 0.0990639328956604, 0.013341061770915985, -0.2206803262233734, 0.24593940377235413, 0.10751094669103622, 0.105828657746315, 0.19586464762687683, 0.4334084093570709, 0.016244418919086456, 0.47473829984664917, 0.17976593971252441, -0.15817943215370178, 0.5086106061935425, 0.22324776649475098, 0.17517389357089996, -0.11427905410528183, -0.36171841621398926, -0.001397009938955307, -0.08598434925079346, -0.4221619963645935, 0.09497123956680298, -0.22322094440460205, -0.44023677706718445, -0.21041177213191986, -0.20595289766788483, -0.023927737027406693, -0.39648616313934326, 0.27025100588798523, -0.2249692976474762, 0.2074773609638214, -0.05204733461141586, 0.101174496114254, -0.1863316148519516, 0.0473782941699028, 0.06301726400852203, 0.12393871694803238, 0.08410213887691498, 0.02168339490890503, -0.0022838227450847626, 0.06519396603107452, -0.29788777232170105, 0.08223523199558258, 0.07879680395126343, 0.540623128414154, 0.09952794015407562, -0.24798086285591125, 0.1758446991443634, -0.4568672478199005, 1.0127156972885132, -0.04976281523704529, 0.14386050403118134, 0.16680125892162323, -0.36138027906417847, -0.21239495277404785, -0.25535574555397034, 0.0665363073348999, 0.2133665829896927, 0.08802492171525955, 0.6111730933189392, -0.15136940777301788, -0.5169568657875061, 0.14848601818084717, 0.11051268130540848, -0.17534545063972473, -0.3720002770423889, -0.2777377963066101, 0.08670742064714432, -0.31187430024147034, 0.15852689743041992, -0.2427966594696045, 0.1620827615261078, 0.06356602907180786, -0.16135163605213165, -0.2611118257045746, 0.0519869402050972, 0.03287907689809799, 0.14173465967178345, 0.025793489068746567, -0.10763737559318542, 0.5221010446548462, 0.09015469253063202, 0.36017319560050964, 0.399768590927124, 0.41280874609947205, 0.1616908311843872, -0.4578492045402527, 0.439525306224823, -0.023093603551387787, 0.4330642521381378, 0.5286036729812622, -0.028989966958761215, -0.088787741959095, -0.2077268809080124, 0.3347064256668091, -0.3261547386646271, 0.20650078356266022, 0.16217777132987976, 0.13573822379112244, -0.4720141291618347, -0.2338058054447174, 0.2248339056968689, 0.005921952426433563, 0.08066190779209137, 0.3046746850013733, 0.029280103743076324, 0.07188060879707336, 0.4109206795692444, 0.06197233125567436, 0.87070232629776, -0.20658276975154877, 0.11220584809780121, 0.026849033311009407, -0.28130680322647095, -0.006200365722179413, -0.6525917649269104, -0.0068959686905145645, -0.3707272410392761, -0.20511238276958466, -0.038248851895332336, -0.37030425667762756, 0.21436676383018494, -0.00829426571726799, 0.23864039778709412, 0.3160583972930908, -0.08456547558307648, 0.04143596440553665, 0.05147074908018112, 0.13873983919620514, -0.1330643743276596, -0.31315135955810547, -0.14466173946857452, -0.04883706569671631, -0.07769440114498138, 0.17065586149692535, -0.16231492161750793, -0.1226264089345932, 0.0275375135242939, 0.06644534319639206, -0.09615273773670197, 0.2986200749874115, 0.12679697573184967, -0.1976204216480255, 0.13406814634799957, -0.6676058769226074, 0.11041942238807678, -0.014965903013944626, 0.048774510622024536, 0.0861482322216034, -0.10146136581897736, 0.1353253573179245, -0.028981655836105347, -0.05863851308822632, 0.027879275381565094, -0.20946714282035828, 0.42961275577545166, 0.06882940977811813, -0.12351293861865997, -0.01158684492111206, -0.20792575180530548, -0.29346179962158203, 0.2418874204158783, 0.30309563875198364, 0.3062557578086853, -0.012618204578757286, 0.1329490691423416, 0.1590041220188141, -0.035006772726774216, -0.21828404068946838, -0.034218866378068924, -0.17418387532234192, -0.19341203570365906, 0.17766155302524567, -0.22668330371379852, -0.3782576620578766, -0.09905602037906647, 0.5633699893951416, -0.0011189058423042297, -0.037387505173683167, 0.6309739351272583, 0.3187783360481262, -0.3108631372451782, -0.1653359979391098, -0.21060729026794434, 0.10191360116004944, -0.40543144941329956, 0.09445333480834961, -0.18531982600688934, 0.09956714510917664, 0.19417843222618103, 0.08931130170822144, -0.04464820772409439, -0.561121940612793, -0.22358550131320953, -0.3301195204257965, -0.09816908836364746, -0.19092296063899994, -0.09864240884780884, 0.10946650803089142, 0.12877815961837769, 0.12826143205165863, -0.0931396484375, 0.1307346373796463, -0.1028384119272232, -0.03781644254922867, -0.27902260422706604, 0.13929510116577148, -0.11162936687469482, -0.22875413298606873, 0.10168639570474625, 0.004802870564162731, -0.035785794258117676, 0.21978087723255157, 0.10351379960775375, -0.06954604387283325, -0.3115991950035095, 0.17598900198936462, 0.04150232672691345, 0.17278563976287842, 0.036066241562366486, -0.2857825756072998, -0.017481543123722076, -0.203335240483284, 0.27270209789276123, -0.19297289848327637, 0.04972951114177704, -0.04586132615804672, 0.29807427525520325, 0.23641246557235718, -0.07638978958129883, 0.14026567339897156, 0.35658830404281616, -0.08849485218524933, 0.15185531973838806, 0.2731274962425232, -0.17937923967838287, 0.09521836042404175, -0.08337929099798203, 0.06931596994400024, 0.16079120337963104, 0.15850664675235748, 0.37238579988479614, -0.46180611848831177, 0.0360407792031765, -0.03142512962222099, 0.34466782212257385, 0.7160384058952332, 0.13960140943527222, -0.39531657099723816, 0.5027800798416138, -0.05292487144470215, -0.13641369342803955, -0.17206767201423645, -0.08535744249820709, 0.04983431100845337, 0.03441184386610985, 0.26789698004722595, 0.00970308855175972, -0.182876318693161, 0.33497804403305054, 0.09870413690805435, 0.2454618662595749, -0.04895252734422684, -0.07882864773273468, 0.17387205362319946, -0.001256704330444336, 0.018088344484567642, 0.3134438097476959, 0.4034619927406311, 0.08241626620292664, 0.4002537131309509, 0.0606229268014431, 0.035968564450740814, -0.10968229919672012, 0.22778818011283875, -0.08693549782037735, -0.5486076474189758, 0.18579310178756714, 0.12255751341581345, 0.3683985471725464, -0.009463176131248474, 0.057556137442588806, 0.3216949999332428, 0.13428178429603577, -0.34297311305999756, -0.3478587865829468, 0.1652427613735199, -0.05116423964500427, 0.0765855461359024, 0.12934748828411102, -0.18135115504264832, -0.13683968782424927, 0.2016756385564804, 0.05733969062566757, -0.07376863062381744, 0.26524049043655396, 0.16833233833312988, 0.2138422131538391, -0.3248090147972107, -0.23369619250297546, -0.06297051161527634, 0.17788156867027283, -0.07728511095046997, 0.23328611254692078, -0.11165466904640198, -0.1763857752084732, -0.35531798005104065, -0.1604921668767929, 0.20293278992176056, 0.4594152569770813, -0.16643927991390228, 0.0077592660672962666, -0.03792470321059227, 0.03249465674161911, -0.032726556062698364, 0.05295272544026375, -0.3919298052787781, 0.21446864306926727, 0.4708270728588104, -0.09104932099580765, 0.023887764662504196, -0.0006143860518932343, -0.056053366512060165, 0.22024814784526825, -0.2620556652545929, 0.05699944868683815, 0.36318811774253845, 0.13484564423561096, 0.029149409383535385, -0.07037294656038284, -0.5633891820907593, 0.04917847365140915, 0.2738857865333557, -0.22649183869361877, 0.08469539880752563, 0.04151894897222519, -0.007500212639570236, -0.14775051176548004, 0.6253964900970459, 0.2969072163105011, 0.2460373044013977, -0.2677758038043976, -0.24052152037620544, -0.3392983376979828, 0.024670206010341644, -0.2798806428909302, 0.03187788277864456, 0.2752021253108978, 0.36877819895744324, 0.3186778724193573, 0.07796719670295715, 0.06422168016433716, -0.15962329506874084, -0.2880384624004364, 0.5284178853034973, -0.407242089509964, -0.24543015658855438, 0.10934577882289886, -0.010331520810723305, -0.16765271127223969, -0.4535609185695648, 0.10535740852355957, -0.05116358771920204, -0.08913480490446091, -0.06499942392110825, -0.3586423695087433, 0.2144262045621872, -0.5870652198791504, 0.4642634391784668, -0.2248721569776535, 0.025307640433311462, 0.13669240474700928, -0.1393136978149414, -0.27838149666786194, -0.08795642107725143, 0.04203856736421585, -0.07392687350511551, -0.08227141201496124, 0.14532525837421417, -0.1804618388414383, 0.04871390014886856, -0.4520685076713562, -0.006469998508691788, 0.016570482403039932, 0.016380835324525833, 0.07479389011859894, 0.13310499489307404, -0.052226029336452484, 0.3655138313770294, 0.018138539046049118, 0.2572774291038513, 0.27092868089675903, 0.269273579120636, -0.4215817451477051, -0.08541377633810043, 0.4767114818096161, -0.27496206760406494, -0.536098301410675, 0.18475747108459473, 0.016005799174308777, 0.24023783206939697, -0.06401737779378891, -0.3366162180900574, 0.16032123565673828, 0.08581759035587311, -0.14463379979133606, 0.014769863337278366, 0.2508144676685333, 0.19256405532360077, 0.16574230790138245, -0.40163394808769226, 0.1664239466190338, 0.09028998017311096, -0.06800710409879684, -0.13362301886081696, -0.1242777481675148 ]
https://github.com/huggingface/datasets/issues/6079
Iterating over DataLoader based on HF datasets is stuck forever
@osanseviero I assume the `self._sslobj.read(len, buffer)` line comes from the built-in `ssl` module, so this probably has something to do with your network. Please open a new issue with the full stack trace in case you haven't resolved this yet.
### 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
40
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 @osanseviero I assume the `self._sslobj.read(len, buffer)` line comes from the built-in `ssl` module, so this probably has something to do with your network. Please open a new issue with the full stack trace in case you haven't resolved this yet.
[ -0.08103130757808685, -0.013380534946918488, -0.036693647503852844, 0.2710031270980835, -0.03732561320066452, 0.0885935053229332, 0.45809710025787354, 0.20576384663581848, -0.0007539670914411545, 0.2618664801120758, 0.0385136678814888, 0.29885172843933105, 0.03217671066522598, 0.21014860272407532, -0.18459269404411316, 0.08294191211462021, 0.07246355712413788, 0.2210017442703247, 0.015250366181135178, -0.1543101668357849, 0.026104822754859924, 0.01042463444173336, -0.23452748358249664, -0.25117433071136475, -0.12205033749341965, -0.10736789554357529, 0.05474863201379776, -0.0770876482129097, -0.03042692504823208, -0.3631841838359833, 0.613317608833313, 0.11146049201488495, 0.36007189750671387, 0.6758054494857788, -0.00012982926273252815, 0.1584313064813614, 0.2526197135448456, 0.012313047423958778, -0.5766765475273132, -0.29393815994262695, 0.02576524019241333, -0.034759219735860825, 0.17682687938213348, -0.20119410753250122, 0.04090207815170288, -0.19740194082260132, -0.09514497220516205, -0.2940819263458252, 0.14029870927333832, 0.026142705231904984, -0.017121542245149612, 0.022607143968343735, -0.14905467629432678, 0.1134188324213028, 0.14579373598098755, 0.15493614971637726, -0.05467204004526138, 0.21674565970897675, 0.318601131439209, -0.2535943388938904, -0.20672070980072021, 0.0745462030172348, 0.04100147634744644, 0.02782171592116356, 0.3470097482204437, -0.2114826887845993, 0.17165988683700562, -0.12751269340515137, 0.1964118480682373, 0.07873902469873428, 0.5810105800628662, -0.16031202673912048, -0.3020067512989044, -0.22202399373054504, 0.027412638068199158, -0.15219217538833618, 0.2793724536895752, 0.30442357063293457, -0.3469519317150116, -0.037113528698682785, 0.12002592533826828, 0.004594458267092705, -0.2519618570804596, 0.14881747961044312, -0.32682088017463684, 0.5327348709106445, -0.026789098978042603, 0.2572386860847473, 0.25177818536758423, -0.06401564925909042, 0.2552153170108795, 0.09958662837743759, 0.12674754858016968, -0.016480866819620132, -0.7961495518684387, 0.2163475751876831, 0.04584420472383499, -0.06959240883588791, -0.14543509483337402, 0.11359475553035736, 0.0389181487262249, 0.06938706338405609, 0.33497801423072815, 0.18729326128959656, 0.4557687044143677, -0.25323185324668884, 0.1636771857738495, 0.07857759296894073, 0.16652697324752808, 0.17893189191818237, -0.09016314148902893, 0.025780461728572845, -0.24687252938747406, -0.282230943441391, 0.25917014479637146, -0.24799755215644836, 0.12251633405685425, -0.3399665951728821, 0.010661279782652855, 0.2669844925403595, -0.1880260407924652, -0.14687496423721313, 0.1288098841905594, 0.5210103988647461, -0.20069174468517303, 0.19335809350013733, -0.06702876836061478, 0.15080730617046356, -0.02652852050960064, 0.10268017649650574, 0.12323854118585587, -0.18068887293338776, -0.2003411501646042, -0.035435259342193604, 0.1061195582151413, -0.46931394934654236, -0.005622945725917816, 0.10118776559829712, 0.15750139951705933, -0.1380312293767929, 0.04694661498069763, -0.21935981512069702, 0.21303938329219818, 0.17891736328601837, -0.028868623077869415, 0.13167749345302582, 0.09637463092803955, -0.19808515906333923, -0.25569015741348267, 0.02944742888212204, -0.22230428457260132, -0.024682477116584778, -0.16628612577915192, -0.025667257606983185, 0.10877053439617157, -0.16157624125480652, -0.12423961609601974, -0.47798144817352295, 0.09249063581228256, 0.028431590646505356, 0.1224554032087326, -0.19410105049610138, -0.026277493685483932, 0.08718457072973251, 0.0762489065527916, 0.3411092460155487, -0.7038230895996094, 0.3094952702522278, 0.13865020871162415, 0.18676339089870453, 0.18238422274589539, 0.060167305171489716, -0.32732686400413513, 0.34257933497428894, -0.3274590075016022, -0.3932361602783203, 0.48951900005340576, -0.2894083261489868, -0.20375265181064606, 0.5882298946380615, 0.025086261332035065, 0.18949049711227417, 0.26725614070892334, -0.17540417611598969, 0.07188284397125244, -0.02889292500913143, 0.23331522941589355, 0.13146132230758667, 0.01596543937921524, -0.007055221125483513, -0.142822727560997, 0.0748010203242302, 0.07622618973255157, 0.32961127161979675, 0.1140032708644867, 0.24624288082122803, -0.14594724774360657, -0.24463753402233124, 0.37292373180389404, -0.09916543960571289, -0.01475100964307785, 0.6046374440193176, 0.3249031603336334, 0.5105574131011963, 0.25378653407096863, 0.11326495558023453, -0.41511473059654236, 0.29191893339157104, 0.08819729834794998, -0.07793685793876648, -0.15910859405994415, 0.19440649449825287, -0.10058861970901489, 0.3639101982116699, -0.3647582530975342, -0.021234188228845596, -0.14159773290157318, 0.33159756660461426, 0.08023272454738617, -0.1596718728542328, -0.2715168297290802, 0.536452054977417, -0.028171367943286896, 0.029752224683761597, -0.3465367555618286, 0.2650429606437683, 0.1505987048149109, -0.10070683062076569, -0.02279157191514969, -0.1470935344696045, 0.17115899920463562, -0.2639705240726471, -0.11418716609477997, -0.018050260841846466, 0.08015990257263184, 0.029514767229557037, -0.06744524836540222, -0.1227545291185379, 0.03526617959141731, 0.19899094104766846, 0.12239883095026016, -0.16765642166137695, 0.07251851260662079, -0.1622939556837082, 0.16817083954811096, 0.11343393474817276, -0.039634909480810165, 0.8775908946990967, -0.1311732530593872, -0.05091945454478264, 0.17380619049072266, 0.048184920102357864, -0.07827353477478027, 0.2813850939273834, 0.3458267152309418, -0.12519700825214386, 0.7747626304626465, 0.025200255215168, -0.30993083119392395, 0.13262692093849182, 0.12630386650562286, 0.09747780859470367, -0.2921719551086426, 0.32185009121894836, 0.058613404631614685, 0.17652475833892822, 0.1321479231119156, 0.13077671825885773, 0.08865271508693695, -0.006389699876308441, 0.06276780366897583, -0.07038357853889465, -0.03447367623448372, -0.021298818290233612, -0.14709195494651794, 0.31168490648269653, 0.4699583947658539, 0.2491512894630432, 0.051177557557821274, -0.08373748511075974, -0.10910365730524063, -0.4738951623439789, -0.056464649736881256, 0.3388054668903351, -0.0440852977335453, 0.6561020612716675, -0.3820868134498596, 0.2095106542110443, -0.18373972177505493, -0.03295326232910156, -0.2777330279350281, -0.28938111662864685, -0.41031181812286377, 0.5533869862556458, 0.00040504708886146545, 0.03965331241488457, -0.012281076982617378, 0.19124801456928253, 0.28197038173675537, -0.43060925602912903, -0.435265451669693, -0.29738545417785645, -0.39064863324165344, -0.2566373348236084, 0.40720847249031067, -0.25733160972595215, 0.1288398653268814, -0.06359448283910751, -0.2558680772781372, -0.28165316581726074, -0.2092278003692627, 0.20640034973621368, -0.07203695923089981, 0.2671210765838623, 0.12424856424331665, 0.3843330144882202, -0.07539398223161697, -0.21214008331298828, 0.08164022117853165, 0.026084942743182182, 0.08893541246652603, 0.31377825140953064, 0.01607472449541092, 0.17278066277503967, 0.24930933117866516, -0.023240908980369568, -0.0727497860789299, -0.30440741777420044, 0.3375653624534607, -0.04795459657907486, 0.06917698681354523, -0.1822807639837265, 0.16151079535484314, 0.1267806887626648, -0.1072441041469574, 0.1393367052078247, 0.04713915288448334, -0.7890844345092773, 0.38083699345588684, -0.045783642679452896, -0.21891669929027557, -0.009365927428007126, 0.005404016003012657, 0.24740414321422577, 0.22401131689548492, -0.8357343077659607, 0.16739287972450256, -0.17681096494197845, -0.05858048051595688, -0.37322622537612915, -0.008712397888302803, 0.085866779088974, -0.020336365327239037, 0.09104049950838089, -0.006463799625635147, -0.10880602896213531, 0.3100602328777313, -0.035719841718673706, 0.13405565917491913, 0.11251045763492584, 0.5574479699134827, 0.012665387243032455, 0.38118910789489746, 0.18902982771396637, -0.08587214350700378, 0.5455591082572937, 0.18575365841388702, 0.13781289756298065, -0.023776113986968994, -0.3240281939506531, -0.09616217017173767, -0.09394748508930206, -0.3192827105522156, 0.07517154514789581, -0.23020851612091064, -0.3960190713405609, -0.2437613308429718, -0.1085139811038971, -0.016082406044006348, -0.36908602714538574, 0.33894410729408264, -0.25674566626548767, 0.18054015934467316, -0.05449327826499939, 0.17445755004882812, -0.23293223977088928, 0.04928762465715408, 0.05907334014773369, 0.03968114033341408, 0.10079064965248108, 0.035921502858400345, -0.017443258315324783, 0.027178321033716202, -0.295338898897171, 0.10162565112113953, -0.027861054986715317, 0.636846661567688, 0.02619190141558647, -0.2278396189212799, 0.18106147646903992, -0.42091551423072815, 1.0862926244735718, 0.004371866583824158, 0.1719062179327011, 0.10328096151351929, -0.32259172201156616, -0.3248791992664337, -0.24186626076698303, 0.04154500737786293, 0.10085976123809814, 0.14561456441879272, 0.6285646557807922, -0.26173722743988037, -0.43751096725463867, 0.09498465061187744, 0.04606756195425987, -0.23940838873386383, -0.3835599422454834, -0.424883097410202, 0.0696670189499855, -0.27412888407707214, 0.16032707691192627, -0.25382402539253235, 0.16143080592155457, 0.13703541457653046, -0.08189935237169266, -0.1851031482219696, 0.03679373115301132, -0.06708259880542755, 0.05820188298821449, 0.035678938031196594, -0.1429051160812378, 0.45670199394226074, 0.139665424823761, 0.3864392042160034, 0.38423725962638855, 0.506157398223877, 0.20189233124256134, -0.5282922983169556, 0.40660130977630615, -0.006384578999131918, 0.41719481348991394, 0.4924132823944092, 0.03136696293950081, -0.06020926684141159, -0.11693863570690155, 0.4121388792991638, -0.3650921881198883, 0.07557279616594315, 0.2685494124889374, 0.09452102333307266, -0.5400147438049316, -0.22966107726097107, 0.27940720319747925, -0.09213536977767944, 0.17321349680423737, 0.31317660212516785, 0.009723678231239319, 0.09898018091917038, 0.4421870708465576, -0.050073690712451935, 0.935173749923706, -0.1835363209247589, 0.14636965095996857, 0.08176428079605103, -0.2514205873012543, 0.08203329145908356, -0.8075323104858398, -0.06717988848686218, -0.33569690585136414, -0.1234114021062851, -0.05069515481591225, -0.4150262773036957, 0.23227781057357788, 0.11060139536857605, 0.2574407458305359, 0.30287012457847595, -0.18523411452770233, -0.08551663160324097, 0.09146500378847122, 0.18418578803539276, -0.26441216468811035, -0.2280728965997696, -0.20178569853305817, -0.038866251707077026, -0.08612610399723053, 0.15736719965934753, -0.1343296468257904, -0.18398040533065796, 0.09216038882732391, 0.024095527827739716, -0.08240478485822678, 0.32219067215919495, 0.23627744615077972, -0.12929406762123108, 0.19038543105125427, -0.5672103762626648, 0.06911391019821167, 0.0507449209690094, 0.01628044992685318, 0.06156275421380997, -0.09395384788513184, 0.13844378292560577, -0.0761261060833931, -0.05964656546711922, 0.028627561405301094, -0.16809193789958954, 0.3660545349121094, 0.05356190353631973, -0.18489030003547668, -0.005199626088142395, -0.19425901770591736, -0.31605207920074463, 0.2146887481212616, 0.24857765436172485, 0.24230366945266724, -0.07175976783037186, 0.1527656763792038, 0.15029990673065186, -0.05277639627456665, -0.21824826300144196, -0.03131072595715523, -0.004055477678775787, -0.29269808530807495, 0.14289572834968567, -0.22503666579723358, -0.3655187785625458, -0.09177517890930176, 0.5890074968338013, -0.0782252848148346, 0.0857091024518013, 0.7374351024627686, 0.3529418706893921, -0.3006129264831543, -0.17746809124946594, -0.17881247401237488, 0.11029048264026642, -0.3835024833679199, 0.024294953793287277, -0.19683738052845, 0.1580142229795456, 0.08171860873699188, -0.04965592548251152, -0.04681592434644699, -0.5141850709915161, -0.16947273910045624, -0.4469693899154663, -0.061293669044971466, -0.1643376648426056, -0.04567636176943779, 0.04061480611562729, 0.15350466966629028, 0.06286840885877609, -0.08693753182888031, 0.17622381448745728, -0.10023913532495499, -0.05223297327756882, -0.3210149109363556, 0.1017879843711853, -0.1365111768245697, -0.23009362816810608, 0.10774290561676025, -0.012172447517514229, -0.024696780368685722, 0.18973730504512787, 0.1466980129480362, -0.08286784589290619, -0.29025354981422424, 0.18606425821781158, 0.055195122957229614, 0.1754981428384781, 0.020624548196792603, -0.36359208822250366, -0.10969366133213043, -0.12017150223255157, 0.15694232285022736, -0.22462743520736694, 0.03613027185201645, -0.038571156561374664, 0.3147308826446533, 0.18963786959648132, -0.13768357038497925, -0.009014174342155457, 0.2988402545452118, -0.1603797823190689, 0.17876990139484406, 0.2681654095649719, -0.2211635857820511, 0.098613440990448, -0.22397078573703766, 0.12046936899423599, 0.16499446332454681, 0.08603416383266449, 0.4622305929660797, -0.49508136510849, 0.09410575032234192, -0.14756454527378082, 0.37399283051490784, 0.7864668369293213, 0.06588855385780334, -0.33580514788627625, 0.5836144089698792, -0.03529953211545944, -0.168882817029953, -0.19515439867973328, -0.07339638471603394, 0.13009555637836456, -0.011951383203268051, 0.17674589157104492, -0.12386739253997803, -0.16146454215049744, 0.19172893464565277, 0.0898088663816452, 0.13289031386375427, -0.084456667304039, -0.057759713381528854, 0.1779603213071823, -0.06720024347305298, 0.01835121214389801, 0.389832079410553, 0.42068296670913696, 0.005094505846500397, 0.32186561822891235, 0.11815928667783737, 0.09284976124763489, -0.08312566578388214, 0.15179471671581268, -0.16327369213104248, -0.6148578524589539, 0.1321561634540558, 0.1263495683670044, 0.3603866994380951, -0.00044533610343933105, -0.019246086478233337, 0.30510345101356506, 0.1343076080083847, -0.3172089159488678, -0.405364990234375, 0.17195609211921692, -0.062678262591362, 0.07422681152820587, 0.10096631944179535, -0.19820597767829895, -0.047849684953689575, 0.21522024273872375, 0.10066291689872742, -0.19660170376300812, 0.14386460185050964, 0.22365042567253113, 0.21807779371738434, -0.45473796129226685, -0.27994677424430847, -0.0436563715338707, 0.16981151700019836, -0.09803754091262817, 0.20470699667930603, -0.015545465052127838, -0.1786016821861267, -0.3075368404388428, -0.16561482846736908, 0.23402664065361023, 0.3938826024532318, -0.026342235505580902, 0.07647562772035599, -0.0926760733127594, -0.015520473010838032, -0.07306741178035736, 0.09134484827518463, -0.2586299180984497, 0.19070668518543243, 0.4440248906612396, -0.08700123429298401, 0.024701178073883057, 0.047144755721092224, -0.012207861989736557, 0.30199316143989563, -0.22368746995925903, 0.1155598983168602, 0.31926921010017395, 0.07534243911504745, -0.05181259661912918, -0.09503563493490219, -0.5553687810897827, -0.023526426404714584, 0.31460607051849365, -0.1145188957452774, 0.08592760562896729, -0.011792373843491077, -0.012143515050411224, -0.10128135979175568, 0.6486117243766785, 0.2916537821292877, 0.24189671874046326, -0.21200408041477203, -0.1555396169424057, -0.3421448767185211, 0.025039590895175934, -0.3704160451889038, -0.05790746584534645, 0.34151506423950195, 0.37909382581710815, 0.36230430006980896, 0.061518725007772446, 0.2058936357498169, -0.11149277538061142, -0.34106096625328064, 0.5995348691940308, -0.4080103933811188, -0.21765489876270294, 0.10039553046226501, 0.23404692113399506, -0.18516430258750916, -0.36695772409439087, 0.21580688655376434, -0.032185737043619156, -0.07665694504976273, 0.053242508322000504, -0.3467545211315155, 0.1349935531616211, -0.5269970893859863, 0.43979015946388245, -0.2106800079345703, 0.07918327301740646, 0.1573905050754547, -0.14923176169395447, -0.28724879026412964, -0.1047111302614212, 0.08500134944915771, -0.05581674724817276, -0.11860345304012299, 0.09633374214172363, -0.24310791492462158, 0.025701602920889854, -0.45509156584739685, -0.026887569576501846, -0.09626832604408264, -0.07936519384384155, -0.028004201129078865, 0.11404315382242203, 0.12630853056907654, 0.3631235659122467, 0.06034613028168678, 0.18304923176765442, 0.2961964011192322, 0.1544719785451889, -0.4213526248931885, 0.00707666389644146, 0.42681145668029785, -0.35018685460090637, -0.5633065700531006, 0.22735610604286194, 0.08539340645074844, 0.200492262840271, -0.0003367029130458832, -0.34338313341140747, 0.22041958570480347, 0.09319987893104553, -0.049670226871967316, 0.015464570373296738, 0.16075903177261353, 0.10356391966342926, 0.16035611927509308, -0.3498295247554779, 0.14805477857589722, 0.026097934693098068, -0.12798021733760834, -0.07283230125904083, -0.12167907506227493 ]
https://github.com/huggingface/datasets/issues/6079
Iterating over DataLoader based on HF datasets is stuck forever
Ran into same issue after upgrading to pytorch-2.0. Disabling KMP_AFFINITY as mentioned above worked for me. Thanks!
### 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
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 Ran into same issue after upgrading to pytorch-2.0. Disabling KMP_AFFINITY as mentioned above worked for me. Thanks!
[ -0.05018563196063042, -0.09019803255796432, -0.02637721598148346, 0.24758650362491608, -0.0008604787290096283, 0.02632962167263031, 0.3614424467086792, 0.22580324113368988, -0.08515036106109619, 0.23723386228084564, 0.032829396426677704, 0.40315142273902893, -0.04841122776269913, 0.12932707369327545, -0.18982002139091492, -0.04447874426841736, 0.06475226581096649, 0.2716362476348877, 0.010752514004707336, -0.11593189090490341, 0.0344916433095932, 0.04041433706879616, -0.2212079018354416, -0.25523489713668823, -0.24463458359241486, -0.08390887081623077, 0.05881138890981674, -0.0821404829621315, 0.0039870720356702805, -0.43121275305747986, 0.558163046836853, 0.10534727573394775, 0.31400686502456665, 0.7093729972839355, -0.00013053732982371002, 0.0721195638179779, 0.26016226410865784, 0.047493524849414825, -0.5610939860343933, -0.29815220832824707, 0.2704184353351593, -0.036349475383758545, 0.21595315635204315, -0.2356872856616974, 0.029556572437286377, -0.16257700324058533, -0.11288698017597198, -0.2892393469810486, 0.07293349504470825, 0.005080520175397396, -0.01873220130801201, 0.12889468669891357, -0.15460652112960815, 0.08575974404811859, 0.22103789448738098, 0.13477659225463867, -0.043162450194358826, 0.22660626471042633, 0.3729434311389923, -0.2789306342601776, -0.2401740849018097, 0.09499812126159668, 0.025807270780205727, 0.06288821250200272, 0.37087008357048035, -0.2255767583847046, 0.1513008028268814, -0.17338401079177856, 0.14648643136024475, 0.032843124121427536, 0.5271239876747131, -0.17534556984901428, -0.2571656405925751, -0.24173539876937866, 0.0451737642288208, -0.19141334295272827, 0.24692103266716003, 0.21876923739910126, -0.3548191785812378, -0.11483429372310638, 0.07297252863645554, 0.0027882058639079332, -0.29909461736679077, 0.13121271133422852, -0.3754734694957733, 0.5054036378860474, 0.0020756865851581097, 0.22540277242660522, 0.2699386179447174, -0.03253456950187683, 0.1882086843252182, 0.1584618240594864, 0.10137699544429779, 0.006064362823963165, -0.8004945516586304, 0.17651879787445068, 0.0776178389787674, -0.16926121711730957, -0.148677796125412, 0.11966051161289215, 0.01978660747408867, 0.08197183907032013, 0.3862745761871338, 0.19257476925849915, 0.4693494737148285, -0.2144867479801178, 0.17206375300884247, 0.062496304512023926, 0.19283895194530487, 0.10869437456130981, -0.08646221458911896, 0.048090435564517975, -0.2349575161933899, -0.32522377371788025, 0.37486183643341064, -0.27390265464782715, 0.14318129420280457, -0.32790082693099976, 0.004248546436429024, 0.23048432171344757, -0.2077927589416504, -0.09474120289087296, 0.1503065824508667, 0.48938629031181335, -0.24270638823509216, 0.21764490008354187, -0.040270183235406876, 0.19531099498271942, -0.054561883211135864, 0.17185428738594055, 0.14483493566513062, -0.12574248015880585, -0.21730928122997284, -0.0804411917924881, 0.19857430458068848, -0.5071807503700256, 0.08450964093208313, 0.1222098097205162, 0.26081615686416626, -0.11667609214782715, 0.08444036543369293, -0.19931375980377197, 0.18706250190734863, 0.22745439410209656, -0.01837865076959133, 0.14161476492881775, 0.04783838987350464, -0.0604344941675663, -0.25535210967063904, 0.026311270892620087, -0.22231873869895935, -0.04655637964606285, -0.19516396522521973, 0.002091602422297001, 0.1041942834854126, -0.2120334506034851, -0.16375452280044556, -0.4927346110343933, 0.15517964959144592, -0.0249599851667881, 0.12003952264785767, -0.22091330587863922, -0.013365421444177628, 0.03679152578115463, 0.06050155311822891, 0.26156851649284363, -0.5960499048233032, 0.3039226531982422, 0.2015962451696396, 0.219153493642807, 0.19895492494106293, 0.06787373870611191, -0.33042287826538086, 0.2663116455078125, -0.3429304361343384, -0.41005784273147583, 0.45462918281555176, -0.2866975963115692, -0.1383485198020935, 0.4741227626800537, -0.013258639723062515, 0.2144211083650589, 0.27484187483787537, -0.22654162347316742, 0.07388070225715637, -0.008472819812595844, 0.23540443181991577, 0.09528283029794693, 0.02357996255159378, 0.0309599619358778, -0.1947445124387741, 0.1559707373380661, 0.18641340732574463, 0.32657018303871155, 0.20392432808876038, 0.19177564978599548, -0.14783361554145813, -0.25418010354042053, 0.37260934710502625, -0.12062865495681763, 0.010826276615262032, 0.5808864831924438, 0.3971347510814667, 0.44223910570144653, 0.30534276366233826, -0.06879881769418716, -0.35136330127716064, 0.3204324543476105, -0.009186485782265663, -0.0045616887509822845, -0.13464602828025818, 0.17901849746704102, -0.10348670929670334, 0.34755706787109375, -0.36968114972114563, -0.0956973135471344, -0.12366103380918503, 0.24119673669338226, 0.09247015416622162, -0.1564822942018509, -0.2927934527397156, 0.5370947122573853, 0.022071177139878273, 0.016205061227083206, -0.2754948139190674, 0.3060705065727234, 0.15933862328529358, -0.13289684057235718, -0.04041837528347969, -0.042709946632385254, 0.19760632514953613, -0.2739408612251282, -0.09472404420375824, -0.0012994930148124695, 0.15145021677017212, -0.033144816756248474, -0.14952972531318665, -0.21308870613574982, 0.08937951177358627, 0.19558048248291016, 0.055056385695934296, -0.17129850387573242, 0.04443414509296417, -0.1647375226020813, 0.2401508390903473, 0.15494264662265778, 0.07803831249475479, 0.8190388083457947, -0.11319185793399811, -0.05971050262451172, 0.13965439796447754, 0.057626474648714066, -0.0438542515039444, 0.28069114685058594, 0.3910074830055237, -0.06456369161605835, 0.7627143263816833, 0.028732098639011383, -0.28788936138153076, 0.13672930002212524, 0.12417218089103699, 0.07075104117393494, -0.36402878165245056, 0.3018712103366852, -0.020978860557079315, 0.14932334423065186, 0.1506253331899643, 0.07383209466934204, 0.09344232082366943, 0.027740124613046646, 0.03708016127347946, -0.09984346479177475, -0.12451782077550888, 0.016296330839395523, -0.10745470970869064, 0.33621853590011597, 0.5900933742523193, 0.30234235525131226, 0.13270117342472076, -0.0275154747068882, -0.11595107614994049, -0.4342357814311981, -0.0035317009314894676, 0.30951154232025146, -0.04677632451057434, 0.5663212537765503, -0.3929517865180969, 0.28232723474502563, -0.17761088907718658, 0.021121079102158546, -0.35680750012397766, -0.28899091482162476, -0.36686861515045166, 0.6363877058029175, 0.06101473048329353, 0.06575498729944229, -0.008719056844711304, 0.11797992885112762, 0.22871361672878265, -0.46068400144577026, -0.4215461015701294, -0.34354186058044434, -0.3610694706439972, -0.24151593446731567, 0.3329576253890991, -0.2174297273159027, 0.19161950051784515, -0.036735862493515015, -0.1889638751745224, -0.2954094707965851, -0.2790343165397644, 0.17106759548187256, -0.07486437261104584, 0.1892881691455841, 0.13307076692581177, 0.29110950231552124, -0.025630135089159012, -0.22908562421798706, 0.06777764856815338, -0.06100912392139435, 0.03563980758190155, 0.3986307978630066, -0.00689446646720171, 0.12295348197221756, 0.24430608749389648, 0.016133233904838562, -0.08034555613994598, -0.29076558351516724, 0.27689266204833984, -0.06886114180088043, 0.060009319335222244, -0.13009478151798248, 0.1623988002538681, 0.17017440497875214, -0.1467639058828354, 0.15980830788612366, 0.084968201816082, -0.6204430460929871, 0.3671543300151825, -0.11567657440900803, -0.20872968435287476, 0.027623962610960007, -0.057056836783885956, 0.2504752576351166, 0.27330929040908813, -0.7132082581520081, 0.13250741362571716, -0.1659269481897354, 0.0156937837600708, -0.3339729607105255, 0.010570278391242027, 0.160209059715271, 0.02719304710626602, 0.08202558755874634, -0.012327507138252258, -0.11649025976657867, 0.31361523270606995, 0.06548423320055008, 0.12366390973329544, 0.100725457072258, 0.4548012614250183, 0.012083586305379868, 0.5304560661315918, 0.14964915812015533, -0.0470888577401638, 0.5127542018890381, 0.13887310028076172, 0.11370394378900528, -0.047013409435749054, -0.3807966411113739, -0.11521963775157928, -0.19992342591285706, -0.2523955702781677, 0.0017056465148925781, -0.24246874451637268, -0.4437240660190582, -0.2550700008869171, -0.11287850141525269, 0.07600469887256622, -0.3038855493068695, 0.2837306261062622, -0.28016942739486694, 0.22937855124473572, -0.0552147775888443, 0.15970715880393982, -0.2662288546562195, 0.09588140994310379, 0.07996159791946411, 0.02863743156194687, 0.04865805432200432, 0.039444852620363235, -0.12927007675170898, -0.019635947421193123, -0.3280268609523773, 0.07289132475852966, 0.04342737793922424, 0.5857351422309875, 0.09829635918140411, -0.23049333691596985, 0.21431034803390503, -0.43711474537849426, 1.0577597618103027, 0.02225477620959282, 0.15949180722236633, 0.1373620480298996, -0.42504680156707764, -0.2960256338119507, -0.21764008700847626, 0.06225213780999184, 0.14225256443023682, 0.18452425301074982, 0.61957186460495, -0.2804814577102661, -0.5175232291221619, 0.09703764319419861, 0.036714062094688416, -0.19975456595420837, -0.3938634991645813, -0.4292282462120056, 0.09225780516862869, -0.2391403168439865, 0.1346946656703949, -0.2028445154428482, 0.2405346781015396, 0.045998714864254, -0.048567187041044235, -0.2528292238712311, 0.04457554966211319, -0.06349539756774902, 0.09918569028377533, 0.08912431448698044, -0.15357747673988342, 0.47073787450790405, 0.16939511895179749, 0.44973692297935486, 0.42723891139030457, 0.41648510098457336, 0.13148202002048492, -0.5777495503425598, 0.4198518693447113, 0.007345658726990223, 0.5249024629592896, 0.4343286454677582, 0.006075557321310043, -0.026689276099205017, -0.1574607938528061, 0.3447871208190918, -0.31414681673049927, 0.054464150220155716, 0.2883012890815735, 0.10288262367248535, -0.49677905440330505, -0.23666900396347046, 0.24916991591453552, -0.07495985925197601, 0.2050306648015976, 0.2754918336868286, -0.024670951068401337, 0.11381660401821136, 0.3829675316810608, 0.023161955177783966, 0.8659840822219849, -0.1432725191116333, 0.22609931230545044, 0.17706140875816345, -0.32564932107925415, 0.047599148005247116, -0.6980340480804443, 0.018750451505184174, -0.43128231167793274, -0.07727371156215668, -0.03572520241141319, -0.39100518822669983, 0.23884958028793335, 0.028596924617886543, 0.2614953815937042, 0.26498550176620483, -0.12666058540344238, -0.10442572832107544, 0.07924824208021164, 0.23435258865356445, -0.22791266441345215, -0.26780420541763306, -0.20727883279323578, -0.05077093467116356, -0.10359953343868256, 0.18807069957256317, -0.12437164038419724, -0.19826357066631317, 0.09333567321300507, 0.023945949971675873, -0.1185196116566658, 0.27230212092399597, 0.11811764538288116, -0.15819017589092255, 0.23523369431495667, -0.6713336110115051, 0.1321890503168106, 0.00811951607465744, -0.04237581044435501, 0.028089461848139763, -0.07437902688980103, 0.09997411072254181, 0.017024550586938858, -0.08937039971351624, 0.12457109242677689, -0.15474241971969604, 0.41259467601776123, 0.01904284954071045, -0.1714710295200348, 0.06462067365646362, -0.24711957573890686, -0.29175347089767456, 0.2483389675617218, 0.30185115337371826, 0.17361977696418762, -0.0647168904542923, 0.12576739490032196, 0.16052627563476562, -0.034329116344451904, -0.2546219229698181, -0.028916802257299423, -0.026075325906276703, -0.28486427664756775, 0.0777054876089096, -0.22292347252368927, -0.3787369728088379, -0.09014008939266205, 0.5678785443305969, -0.08018168807029724, -0.01421722024679184, 0.7632148265838623, 0.3176998496055603, -0.3004831075668335, -0.1664913296699524, -0.17891374230384827, 0.14958283305168152, -0.4306669533252716, 0.049541134387254715, -0.03801703453063965, 0.12792356312274933, 0.12592749297618866, -0.03383248671889305, -0.07887756824493408, -0.5599431395530701, -0.16549618542194366, -0.35994458198547363, -0.12496219575405121, -0.17900852859020233, -0.0225251205265522, 0.06849616765975952, 0.15409666299819946, 0.05043773725628853, -0.10476256906986237, 0.1972525268793106, -0.10470835864543915, -0.03321308642625809, -0.1822410374879837, 0.06345000863075256, -0.15678681433200836, -0.29706382751464844, -0.002632742514833808, 0.006040902808308601, -0.028658710420131683, 0.18735858798027039, 0.15213891863822937, -0.07906176149845123, -0.35249170660972595, 0.17557653784751892, 0.03836645558476448, 0.18013045191764832, 0.06664974987506866, -0.3396715521812439, -0.12738598883152008, -0.09493779391050339, 0.199116051197052, -0.17978164553642273, 0.01863996684551239, 0.015363776125013828, 0.3600359261035919, 0.14051660895347595, -0.09760591387748718, 0.03258577734231949, 0.2718419134616852, -0.22188524901866913, 0.17251898348331451, 0.2355382889509201, -0.2067081183195114, 0.09882226586341858, -0.16023245453834534, 0.056188374757766724, 0.09481877833604813, 0.027464134618639946, 0.4059765636920929, -0.5528821349143982, 0.053526680916547775, -0.1437578797340393, 0.3926716148853302, 0.792816698551178, 0.08277122676372528, -0.3039734959602356, 0.6076344847679138, -0.013474097475409508, -0.25539302825927734, -0.20657707750797272, -0.04489094391465187, 0.10939019918441772, 0.0040394701063632965, 0.17071039974689484, -0.08670356869697571, -0.11458289623260498, 0.30090606212615967, 0.1327621340751648, 0.10906539112329483, -0.10891501605510712, -0.06784690916538239, 0.09730647504329681, -0.009555511176586151, -0.02991800382733345, 0.47035902738571167, 0.5473185181617737, 0.014681175351142883, 0.23929058015346527, 0.1603219360113144, 0.153021901845932, -0.07381702959537506, 0.11264985799789429, -0.15123698115348816, -0.5275594592094421, 0.024934248998761177, 0.06510627269744873, 0.317129909992218, 0.01582028716802597, -0.011418357491493225, 0.4142269790172577, 0.08827756345272064, -0.39392369985580444, -0.3696289360523224, 0.19007903337478638, -0.11042245477437973, 0.10172198712825775, 0.11788646876811981, -0.21472850441932678, -0.037803784012794495, 0.18662720918655396, 0.07956483215093613, -0.17327502369880676, 0.1989833116531372, 0.20275983214378357, 0.19177192449569702, -0.5297488570213318, -0.22447916865348816, -0.04595993459224701, 0.2516617774963379, -0.07842253148555756, 0.16633953154087067, -0.06544239819049835, -0.19731280207633972, -0.3035593032836914, -0.16471783816814423, 0.2830420732498169, 0.42596232891082764, -0.17364990711212158, 0.00664030946791172, -0.12203705310821533, 0.019712330773472786, -0.029534846544265747, 0.1077362596988678, -0.19976148009300232, 0.14061304926872253, 0.4205295741558075, -0.09864375740289688, 0.009829833172261715, 0.012551512569189072, 0.0478685200214386, 0.249289870262146, -0.26446977257728577, 0.19043894112110138, 0.3375045359134674, 0.003514125943183899, -0.00585218146443367, -0.0691118910908699, -0.5514134764671326, -0.060436949133872986, 0.31418630480766296, -0.044825129210948944, 0.027922172099351883, -0.057876985520124435, -0.0027642957866191864, -0.06387796998023987, 0.6380953192710876, 0.3057286739349365, 0.23378613591194153, -0.2609542906284332, -0.1160145252943039, -0.37234222888946533, 0.028147108852863312, -0.397411048412323, -0.06866198033094406, 0.36806970834732056, 0.29297035932540894, 0.3450125753879547, 0.04511028900742531, 0.2201499044895172, -0.034738678485155106, -0.2782273590564728, 0.5789487361907959, -0.45772475004196167, -0.17568355798721313, 0.09821867197751999, 0.1755857914686203, -0.15764516592025757, -0.3590703010559082, 0.16853658854961395, -0.05175267159938812, -0.06038312986493111, -0.0017892122268676758, -0.2798349857330322, 0.22910666465759277, -0.5254651308059692, 0.36859330534935, -0.25227636098861694, 0.1418735831975937, 0.21697577834129333, -0.12650969624519348, -0.222293883562088, -0.09937389940023422, 0.06043972447514534, -0.11448965221643448, -0.057960476726293564, 0.13179658353328705, -0.16632696986198425, -0.06908895075321198, -0.40454044938087463, 0.04268133267760277, -0.043210819363594055, -0.1625543087720871, 0.01426943764090538, 0.17042668163776398, 0.166277676820755, 0.35540881752967834, 0.08716730773448944, 0.24307367205619812, 0.24414756894111633, 0.16296172142028809, -0.4718756675720215, -0.04665801301598549, 0.4144490361213684, -0.40869173407554626, -0.6151532530784607, 0.21520167589187622, 0.08000117540359497, 0.21484926342964172, -0.03330157697200775, -0.2916701138019562, 0.12704172730445862, 0.08590883761644363, -0.06827078759670258, 0.015236791223287582, 0.16654041409492493, 0.03723154962062836, 0.0969635546207428, -0.35575586557388306, 0.22330588102340698, 0.026825763285160065, -0.0782473087310791, -0.1459551751613617, -0.12383389472961426 ]
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
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).
[ -0.4960499703884125, -0.22135543823242188, 0.09422238171100616, 0.04180407524108887, 0.2625921964645386, -0.0770002007484436, -0.12203124165534973, -0.01835404708981514, 0.010030895471572876, 0.11760860681533813, 0.050583191215991974, 0.10911090672016144, 0.029635418206453323, 0.39785924553871155, 0.13156424462795258, -0.2412327229976654, -0.24040067195892334, 0.1370294839143753, 0.04153168573975563, -0.007516983896493912, 0.07286472618579865, -0.07075856626033783, -0.07919389009475708, -0.18932144343852997, 0.07768789678812027, -0.011765053495764732, 0.10519897937774658, 0.26650160551071167, -0.0874755010008812, -0.3389490246772766, 0.473742812871933, 0.017693806439638138, 0.34804052114486694, 0.12353502213954926, -0.0001206640517921187, -0.04715903103351593, 0.4625619649887085, -0.21917572617530823, -0.49746471643447876, -0.3830420970916748, -0.01050722599029541, 0.06914488226175308, 0.2593608498573303, 0.022229671478271484, 0.057535119354724884, 0.14388777315616608, 0.11631157249212265, -0.03895898163318634, 0.5077918171882629, 0.25298529863357544, 0.1029224544763565, 0.07047012448310852, -0.03602110594511032, -0.036473799496889114, 0.052022598683834076, -0.026722542941570282, 0.22487270832061768, 0.25739696621894836, 0.1660226732492447, 0.12274318933486938, 0.025414951145648956, 0.12297986447811127, -0.2822922170162201, 0.10989493131637573, -0.03543351590633392, -0.14698202908039093, -0.11262313276529312, -0.33108383417129517, -0.003947678953409195, 0.21634483337402344, 0.4584338366985321, -0.16932889819145203, -0.27362391352653503, -0.44614341855049133, 0.3890098035335541, -0.7690572142601013, -0.1457153856754303, 0.21899829804897308, -0.19107258319854736, 0.10966417193412781, -0.21039144694805145, -0.34298866987228394, -0.07098213583230972, 0.17176926136016846, -0.28152763843536377, 0.15584902465343475, -0.053307149559259415, 0.1311826854944229, -0.005597639828920364, 0.43749499320983887, -0.0016903635114431381, 0.033447086811065674, 0.24048703908920288, 0.08765462040901184, -0.18875880539417267, 0.07692624628543854, 0.14653697609901428, 0.1699630320072174, 0.36399778723716736, 0.2783271074295044, 0.03386318311095238, -0.019675981253385544, 0.07410023361444473, 0.11044099926948547, 0.28141412138938904, -0.019463693723082542, -0.03267684578895569, -0.09713439643383026, 0.2745921313762665, 0.574747622013092, -0.06498748809099197, -0.2465122938156128, 0.17943459749221802, 0.16709741950035095, -0.03317873552441597, 0.07235020399093628, 0.26478850841522217, -0.11124111711978912, -0.31329262256622314, 0.25422951579093933, -0.3003476560115814, 0.0237816721200943, 0.10220877826213837, 0.2574314773082733, -0.21946318447589874, 0.17212355136871338, 0.03368894010782242, -0.03502603620290756, -0.20997627079486847, -0.30755847692489624, -0.19666291773319244, -0.1751481145620346, -0.14405834674835205, 0.14648425579071045, 0.20375294983386993, -0.5759515166282654, 0.3026050627231598, 0.20673051476478577, 0.0780106633901596, -0.03838438540697098, 0.1842949241399765, 0.04704808071255684, -0.028241969645023346, 0.3275788724422455, -0.05307640880346298, 0.2862926423549652, 0.2269974648952484, 0.0439227819442749, -0.09160272032022476, 0.123358815908432, -0.3452514410018921, -0.35706549882888794, 0.1574157029390335, 0.08562859892845154, -0.09276648610830307, -0.04924424737691879, -0.48474910855293274, 0.11252462863922119, -0.19101929664611816, -0.058834344148635864, 0.2709328532218933, -0.05276379734277725, -0.2734428346157074, -0.09174501150846481, 0.5161376595497131, 0.4292783737182617, -0.10409343242645264, -0.44852182269096375, 0.02904602512717247, -0.07720908522605896, 0.38772448897361755, 0.23987600207328796, -0.2860030233860016, 0.12049676477909088, -0.2155054807662964, 0.18057049810886383, 0.5103741884231567, -0.17987355589866638, -0.46150335669517517, 0.15485645830631256, -0.1824720799922943, 0.3241695463657379, -0.03008349984884262, -0.23251596093177795, 0.631091833114624, -0.004541745875030756, 0.08909890055656433, 0.3505120873451233, -0.12022380530834198, 0.07366999238729477, -0.16681979596614838, -0.3126964867115021, -0.0693785771727562, 0.12979720532894135, 0.058352213352918625, 0.10109434276819229, 0.15523333847522736, 0.1523299515247345, 0.49067747592926025, 0.12686575949192047, 0.12387790530920029, 0.18874037265777588, 0.04049966484308243, 0.2930481433868408, -0.25952762365341187, -0.2887009382247925, -0.29430457949638367, 0.2203662097454071, 0.31553560495376587, -0.32283711433410645, -0.07439151406288147, -0.16836291551589966, -0.31989362835884094, -0.24876755475997925, -0.04301555082201958, -0.386393666267395, 0.045656487345695496, 0.17774906754493713, 0.01562565565109253, 0.2892366945743561, -0.30953434109687805, 0.482435941696167, -0.32669711112976074, 0.28858575224876404, -0.32346150279045105, 0.3812010586261749, 0.375076025724411, -0.24587729573249817, -0.02094268426299095, -0.21024611592292786, 0.32912614941596985, -0.0739327147603035, 0.01737968996167183, 0.5150038003921509, -0.24758149683475494, 0.5027754902839661, -0.1078610047698021, -0.2535524368286133, 0.12150704860687256, 0.046657126396894455, -0.298789918422699, -0.06943553686141968, -0.01814986765384674, 0.08784040063619614, -0.06774991005659103, 0.1543254852294922, 0.05658557638525963, 0.14332924783229828, 0.2708427906036377, 0.08015608042478561, 0.23842459917068481, -0.12183964252471924, -0.4467485249042511, 0.16696201264858246, 0.47326114773750305, -0.2499474138021469, -0.13334889709949493, -0.22474028170108795, -0.7261183857917786, 0.01610410213470459, 0.37211161851882935, -0.1860179305076599, -0.12523946166038513, 0.2515079379081726, -0.10639611631631851, 0.11319830268621445, 0.136652871966362, 0.11369185149669647, 0.3642542064189911, 0.22276708483695984, 0.4113481640815735, 0.12823006510734558, -0.16703735291957855, -0.05488927289843559, 0.1941799819469452, 0.07993882149457932, -0.06650371849536896, 0.24242156744003296, 0.22000694274902344, -0.0959966853260994, -0.4585025906562805, 0.022399231791496277, 0.031115608289837837, 0.11921742558479309, -0.09784631431102753, 0.06392548233270645, -0.28555378317832947, -0.18234267830848694, -0.28303393721580505, -0.1403689980506897, -0.059856023639440536, -0.08643123507499695, -0.20787887275218964, 0.7054842114448547, 0.08724148571491241, 0.28322669863700867, -0.3363700807094574, -0.025025412440299988, -0.11783509701490402, -0.22062534093856812, -0.15693260729312897, -0.11156760156154633, 0.011078765615820885, -0.040656208992004395, 0.00420376006513834, -0.010323833674192429, 0.33508965373039246, -0.023923994973301888, -0.33067888021469116, -0.3467504680156708, -0.09906693547964096, 0.23026028275489807, 0.06834957003593445, 0.049752771854400635, 0.1773175597190857, 0.3930305242538452, -0.10338875651359558, -0.1496656835079193, -0.006976136472076178, -0.16482946276664734, 0.0325724259018898, -0.04258882999420166, 0.05836411938071251, 0.5262755751609802, -0.07400426268577576, -0.2615194022655487, -0.07052265852689743, -0.32602593302726746, 0.3362833857536316, 0.09759001433849335, -0.1840829849243164, -0.075213223695755, -0.22260507941246033, -0.04973015934228897, -0.16250120103359222, 0.16024291515350342, -0.32442814111709595, -0.5468454360961914, 0.1139603704214096, -0.09659995138645172, -0.11680792272090912, 0.0841589868068695, -0.11566874384880066, 0.07277174293994904, 0.39218252897262573, -0.6348939538002014, 0.04235917329788208, -0.13632197678089142, -0.05602540820837021, -0.500946581363678, 0.17304284870624542, 0.4517567753791809, -0.31472620368003845, 0.015110014006495476, 0.0015014074742794037, 0.09644143283367157, -0.13747912645339966, 0.3488180935382843, 0.29074838757514954, -0.24491041898727417, 0.629873514175415, 0.110060915350914, 0.7490262389183044, 0.17666727304458618, 0.08042526245117188, 0.37416189908981323, 0.07000260800123215, 0.2933974862098694, -0.2573901414871216, -0.08489258587360382, -0.03318660333752632, -0.22461622953414917, -0.08831174671649933, 0.0630774050951004, -0.038625046610832214, -0.11149867624044418, -0.33706367015838623, -0.25898659229278564, -0.08923394978046417, -0.49243584275245667, -0.13228027522563934, -0.031147807836532593, 0.22949263453483582, 0.15140491724014282, 0.19722658395767212, 0.0389927439391613, 0.024602308869361877, -0.005602394696325064, 0.2688579559326172, 0.5406609773635864, 0.1508825421333313, 0.15990705788135529, 0.2073894441127777, -0.6008418798446655, -0.09730786085128784, 0.011050761677324772, 0.1662493646144867, 0.12496441602706909, 0.036926835775375366, 0.0971498042345047, 0.02407247945666313, 0.7052348256111145, -0.10116428136825562, 0.07364734262228012, -0.11432181298732758, -0.02381271682679653, -0.3614354729652405, -0.08210687339305878, -0.05679193511605263, 0.02185976505279541, 0.3505934774875641, 0.5292736291885376, -0.4735485911369324, 0.22554796934127808, 0.30805739760398865, 0.20288534462451935, 0.0239676795899868, -0.007913507521152496, -0.295373797416687, -0.33033549785614014, -0.39086708426475525, 0.36101871728897095, 0.19804270565509796, -0.08393232524394989, -0.131178081035614, -0.028219223022460938, -0.20313222706317902, -0.1076134592294693, -0.2572082281112671, -0.1279887855052948, 0.0987296998500824, 0.21780841052532196, 0.20227544009685516, 0.2422633320093155, 0.005048200488090515, 0.2539673149585724, 0.6088821887969971, 0.06343051791191101, -0.32283321022987366, -0.07595067471265793, 0.24492037296295166, 0.07367707043886185, 0.42852598428726196, -0.16381965577602386, 0.28237223625183105, 0.0886538103222847, 0.21729427576065063, -0.22239673137664795, 0.28981253504753113, 0.167122021317482, -0.012463917955756187, -0.2405308037996292, -0.5118789076805115, 0.42746078968048096, -0.11537632346153259, -0.02285704016685486, 0.3378589451313019, 0.05679309368133545, -0.1646747589111328, -0.1541208028793335, -0.11489807814359665, 0.9310005307197571, 0.11383059620857239, 0.1497887372970581, 0.03693215548992157, -0.4117735028266907, 0.7049878239631653, -0.1813504844903946, 0.21976029872894287, -0.02530372142791748, -0.5245158076286316, -0.14573881030082703, -0.1313055157661438, 0.07888507097959518, -0.22945810854434967, -0.24937672913074493, 0.49410393834114075, 0.037874735891819, 0.2087538242340088, 0.06973732262849808, 0.05517113208770752, -0.3201298117637634, -0.21613407135009766, -0.44393351674079895, 0.006179749965667725, 0.015713199973106384, 0.1489851176738739, -0.1612308919429779, 0.031239580363035202, 0.3387354910373688, -0.03873823583126068, -0.2761150002479553, 0.050474368035793304, -0.5247802138328552, -0.19667746126651764, -0.3065589964389801, -0.38453012704849243, -0.1087784469127655, 0.13815392553806305, 0.1048632562160492, -0.04486839845776558, -0.20245128870010376, 0.2718440294265747, -0.07809256762266159, -0.030750902369618416, -0.13799971342086792, -0.07338013499975204, 0.35740187764167786, 0.05473368614912033, -0.18984639644622803, 0.1972988247871399, -0.14522837102413177, -0.03163032978773117, 0.0985262393951416, -0.047632910311222076, 0.30315762758255005, 0.009604774415493011, -0.12499883770942688, 0.08102735131978989, 0.19769607484340668, -0.37430378794670105, 0.014917686581611633, -0.03789794445037842, -0.04866014048457146, -0.005211889743804932, -0.11719825863838196, -0.0761430487036705, -0.3564627766609192, 0.7775909304618835, -0.20320254564285278, 0.1684039980173111, 0.2900913655757904, 0.0889502614736557, -0.2962075471878052, -0.015225410461425781, -0.21313512325286865, -0.09395840018987656, -0.3412081301212311, 0.20435869693756104, -0.029205476865172386, 0.3600412607192993, -0.11491771042346954, 0.052993424236774445, -0.19304190576076508, -0.23706212639808655, -0.14636288583278656, -0.2181922197341919, -0.30556073784828186, 0.014522217214107513, 0.1368342936038971, 0.045496463775634766, 0.293403297662735, 0.30511409044265747, 0.040502794086933136, -0.16017615795135498, -0.2216801643371582, 0.2562173902988434, -0.039404794573783875, 0.24564354121685028, 0.25802746415138245, 0.146707221865654, 0.20108647644519806, -0.13266821205615997, 0.029928939417004585, 0.5029234290122986, 0.04556804895401001, -0.14200922846794128, -0.2659105956554413, 0.17659133672714233, 0.09295660257339478, 0.1819486916065216, 0.18263091146945953, -0.07387492805719376, -0.04896179214119911, -0.13249993324279785, 0.3237382173538208, 0.20629024505615234, 0.19079819321632385, -0.07233726978302002, 0.5120839476585388, 0.2124863564968109, -0.28010958433151245, 0.003216322511434555, -0.3717196583747864, 0.12806975841522217, -0.17180301249027252, 0.2528771460056305, -0.21319206058979034, -0.08794223517179489, -0.27687570452690125, -0.1866503357887268, 0.2492472380399704, 0.2083805799484253, 0.42946764826774597, -0.15197604894638062, -0.36921703815460205, -0.0953407809138298, 0.47006577253341675, 0.41814711689949036, -0.032502319663763046, -0.23872454464435577, 0.3886013627052307, 0.13115063309669495, -0.28403016924858093, -0.01435374841094017, 0.03274207189679146, 0.0007744003087282181, 0.1654018610715866, 0.15395480394363403, -0.14098355174064636, -0.3093675374984741, -0.3805087208747864, 0.08718264102935791, 0.33276546001434326, 0.06343083083629608, 0.223582923412323, 0.47179919481277466, 0.05890100821852684, -0.07276299595832825, -0.05702438950538635, 0.34899234771728516, 0.30383363366127014, 0.14357301592826843, 0.06737058609724045, 0.2127629965543747, 0.027113355696201324, 0.041226357221603394, -0.2362329661846161, -0.5356764793395996, -0.09863036870956421, 0.14520984888076782, -0.15535959601402283, 0.28006356954574585, -0.021472543478012085, 0.23495054244995117, 0.25977396965026855, -0.1507624387741089, -0.05614987015724182, 0.32884353399276733, 0.07892091572284698, -0.14304429292678833, 0.11424030363559723, -0.17430418729782104, 0.1127808541059494, 0.30029696226119995, 0.05692507326602936, 0.08016976714134216, 0.1772022247314453, 0.12258477509021759, 0.10536950081586838, -0.4330352544784546, -0.303025484085083, -0.05811222642660141, 0.26111260056495667, -0.23821097612380981, 0.0313783697783947, 0.15520206093788147, -0.17257335782051086, -0.14264965057373047, 0.023614713922142982, 0.15719203650951385, -0.1829417496919632, 0.09521779417991638, 0.2580932378768921, 0.453215628862381, 0.13830240070819855, -0.057812921702861786, -0.055862605571746826, 0.3195781409740448, 0.1767779439687729, 0.22428369522094727, 0.10936591029167175, -0.15626250207424164, 0.23095275461673737, -0.05695943161845207, -0.11663573980331421, -0.6016769409179688, 0.10457225143909454, 0.14760974049568176, 0.08305668085813522, -0.26049646735191345, 0.042016979306936264, -0.32072320580482483, 0.20274236798286438, 0.011167885735630989, -0.169253408908844, 0.11445822566747665, 0.09186402708292007, 0.059058718383312225, -0.13148385286331177, 0.1203983724117279, 0.16377922892570496, -0.11589998751878738, -0.15346311032772064, -0.1619798094034195, -0.6316264867782593, -0.05440717190504074, -0.07809892296791077, -0.0342165008187294, 0.2036728709936142, 0.1559664011001587, -0.04478666931390762, 0.10213188827037811, -0.03915424644947052, 0.0036222231574356556, 0.03251121565699577, 0.31361615657806396, 0.0845126211643219, -0.7207062840461731, -0.2565910816192627, -0.1387842893600464, -0.09252705425024033, -0.13402658700942993, 0.26790758967399597, -0.22129711508750916, 0.04042278975248337, 0.168013334274292, -0.1035534143447876, -0.07620640099048615, -0.16688823699951172, 0.32844144105911255, 0.08565733581781387, 0.03619566559791565, -0.310970276594162, -0.12327398359775543, -0.017081480473279953, 0.030219009146094322, -0.3318606913089752, -0.030222974717617035, -0.2692417502403259, 0.3080975115299225, -0.1472788155078888, -0.18825767934322357, -0.5347957015037537, 0.2558259963989258, 0.4532446265220642, -0.024480093270540237, -0.3436891436576843, -0.01997579261660576, 0.0749158188700676, 0.08001279085874557, -0.04963245615363121, 0.48402056097984314, -0.23889896273612976, 0.2038392722606659, -0.13653850555419922, -0.4332262873649597, 0.7176175117492676, -0.42861101031303406, -0.11945608258247375, -0.23451809585094452, 0.31300315260887146, 0.44247061014175415, 0.02252008579671383, -0.5316165685653687, 0.3694486916065216, 0.3237767219543457, -0.15485969185829163, -0.44911715388298035, 0.296863853931427, -0.03529445081949234, 0.09723679721355438, -0.06139666214585304, 0.17922304570674896, 0.4066919982433319, -0.20712028443813324, 0.3108878433704376, -0.23482005298137665 ]
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
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.
[ -0.2388804703950882, -0.42039424180984497, 0.11454983055591583, 0.013677917420864105, 0.3820091485977173, -0.026951275765895844, -0.09978540241718292, 0.2806102931499481, 0.2809220254421234, 0.42724764347076416, -0.14177918434143066, 0.3004532754421234, 0.17234168946743011, -0.09254340827465057, -0.20135712623596191, 0.1648067981004715, 0.012814372777938843, 0.027215875685214996, -0.46503302454948425, -0.023259803652763367, -0.30321362614631653, -0.019845841452479362, -0.08741754293441772, -0.22614990174770355, 0.029805229976773262, 0.05566719174385071, 0.23480743169784546, 0.048041969537734985, -0.13257582485675812, -0.03899882733821869, 0.025727158412337303, 0.33187803626060486, -0.2694393992424011, 0.7168409824371338, -0.0001257616822840646, -0.24600796401500702, 0.3856589198112488, 0.12560468912124634, 0.07028405368328094, -0.14490459859371185, 0.4119062125682831, -0.23816551268100739, 0.07440546900033951, -0.2535730004310608, 0.21299558877944946, 0.0970379114151001, 0.17317521572113037, -0.2661341726779938, 0.26940834522247314, -0.2111963927745819, 0.0643077865242958, 0.1619422733783722, -0.1921636164188385, -0.02156246267259121, 0.046288128942251205, 0.3041096329689026, 0.005572399124503136, 0.5163283348083496, 0.1856713443994522, -0.2736380994319916, -0.22961297631263733, 0.35308316349983215, -0.23241208493709564, -0.24688448011875153, 0.44899415969848633, -0.023223359137773514, 0.2293471097946167, -0.14012391865253448, 0.450479656457901, 0.24075055122375488, -0.05068720132112503, -0.05832003802061081, -0.20002377033233643, -0.2391187846660614, -0.08658820390701294, -0.20893920958042145, 0.158798485994339, 0.076323963701725, -0.2498103529214859, -0.13516537845134735, -0.589224100112915, -0.20159725844860077, 0.1903139054775238, 0.011416729539632797, -0.4154917001724243, -0.11164240539073944, -0.11775729060173035, 0.2734394967556, 0.4124734401702881, -0.20074571669101715, -0.43840664625167847, -0.0484187975525856, 0.29575470089912415, 0.16494159400463104, -0.2238069623708725, 0.1342388540506363, 0.24506279826164246, -0.20668789744377136, 0.19873002171516418, 0.029519882053136826, -0.3274613320827484, 0.20284652709960938, -0.1723250448703766, 0.11157113313674927, 0.2877354323863983, 0.2299201786518097, -0.07176683098077774, 0.16607190668582916, 0.4792513847351074, 0.24024450778961182, -0.12510834634304047, 0.07817891240119934, 0.34749460220336914, -0.2629399299621582, 0.20621512830257416, -0.19157558679580688, 0.08132008463144302, -0.3271124064922333, -0.08810865134000778, 0.2338065356016159, -0.02311709336936474, 0.1665746122598648, 0.0541432723402977, 0.26647984981536865, 0.28801655769348145, 0.03394828364253044, 0.05194912105798721, 0.11398106813430786, -0.30280810594558716, 0.2608893811702728, 0.023673804476857185, -0.1403404027223587, -0.3892468512058258, 0.21316266059875488, 0.007915191352367401, -0.11985050141811371, 0.04438326507806778, 0.15219847857952118, 0.07513782382011414, -0.17251800000667572, -0.007029242813587189, -0.15144793689250946, 0.28983935713768005, 0.31175920367240906, -0.2254585176706314, 0.40087464451789856, -0.02229120209813118, -0.031029824167490005, -0.2700267732143402, 0.08179167658090591, 0.022208355367183685, -0.02402842789888382, 0.20523898303508759, 0.015945443883538246, -0.13217301666736603, 0.2970324754714966, -0.059470243752002716, 0.18673139810562134, 0.3860650956630707, -0.24491482973098755, 0.03056919574737549, -0.15452414751052856, -0.3442258834838867, -0.12373950332403183, 0.2280447781085968, 0.5708963871002197, -0.07920300960540771, 0.06152220070362091, 0.03908877074718475, 0.10825614631175995, 0.2775461673736572, 0.32453787326812744, 0.0911373570561409, 0.1843341886997223, -0.2951490581035614, 0.029287241399288177, -0.30308666825294495, -0.16072231531143188, -0.4697611331939697, 0.4938769042491913, -0.5575812458992004, 0.203892782330513, 0.02161066234111786, 0.06717279553413391, -0.02055305801331997, -0.06775475293397903, 0.42178577184677124, 0.11313401162624359, -0.04053343087434769, 0.06422069668769836, -0.115497887134552, -0.15403740108013153, 0.137740820646286, 0.21668770909309387, 0.24219581484794617, -0.030807964503765106, 0.23239031434059143, -0.3148108124732971, 0.0743972584605217, -0.09870047867298126, 0.11744342744350433, 0.22700992226600647, 0.017411790788173676, 0.1518639326095581, 0.013074265792965889, -0.5110952258110046, -0.4240115284919739, 0.12463059276342392, 0.05850869417190552, 0.020973820239305496, -0.3666144609451294, -0.2333809733390808, -0.318918913602829, -0.06761816143989563, -0.03722725436091423, 0.27504587173461914, -0.12419392168521881, 0.02847849577665329, -0.1573118269443512, 0.12788619101047516, -0.03772396594285965, -0.18904858827590942, -0.06251081079244614, 0.23099084198474884, -0.6582083106040955, 0.152180016040802, 0.23641648888587952, -0.2917603552341461, -0.031077001243829727, 0.23493489623069763, 0.17350973188877106, -0.3071972131729126, -0.08042354881763458, 0.303044855594635, -0.16496101021766663, 0.2505462169647217, -0.05314791202545166, 0.41233396530151367, 0.09876055270433426, 0.1920226514339447, -0.04778430610895157, 0.21650639176368713, 0.10364970564842224, -0.37129756808280945, -0.16018351912498474, 0.31123095750808716, -0.23095862567424774, 0.4938899278640747, -0.1795552670955658, -0.018198711797595024, 0.057181984186172485, -0.03867245465517044, -0.33655115962028503, -0.1715606451034546, 0.4729599952697754, 0.2662582993507385, -0.02222106233239174, 0.052158523350954056, 0.1236138641834259, -0.040628619492053986, 0.45399346947669983, -0.35915595293045044, -0.05735056847333908, 0.15214717388153076, -0.037039414048194885, 0.13274547457695007, 0.07663054764270782, -0.22056810557842255, 0.328664094209671, 0.0495850034058094, 0.0890142023563385, 0.25696948170661926, 0.06748668104410172, -0.041223153471946716, 0.03859096020460129, 0.15688329935073853, 0.0524555929005146, 0.15206317603588104, 0.06971358507871628, 0.07846195250749588, -0.2890482544898987, -0.2303764671087265, -0.09772747755050659, 0.26063987612724304, -0.2403760403394699, -0.10018187016248703, -0.2927587628364563, 0.3055817782878876, -0.10294516384601593, 0.22796191275119781, -0.36109933257102966, -0.47942960262298584, -0.3381495475769043, 0.3350684344768524, -0.2742214500904083, 0.20275017619132996, 0.20204828679561615, 0.008992314338684082, -0.010444644838571548, -0.11006764322519302, -0.14648383855819702, -0.08160876482725143, -0.0197611041367054, -0.3132166862487793, 0.4684447646141052, -0.32853826880455017, 0.30248501896858215, -0.006483949720859528, -0.14062291383743286, -0.04586349427700043, -0.38114115595817566, -0.018194951117038727, 0.007683422416448593, 0.15184970200061798, 0.13487578928470612, 0.19577786326408386, -0.17469263076782227, 0.02922739088535309, 0.22800767421722412, -0.18603846430778503, -0.07460442185401917, 0.08755339682102203, 0.05278673395514488, 0.06101684644818306, -0.2449713796377182, -0.028351642191410065, 0.16690614819526672, -0.3009679913520813, 0.6349738836288452, -0.5413115620613098, 0.19146476686000824, 0.10177956521511078, -0.18995659053325653, -0.06051838397979736, -0.35687318444252014, -0.0874604806303978, -0.11918392777442932, -0.09153549373149872, 0.24307221174240112, 0.018023265525698662, -0.09907510876655579, -0.07739739865064621, 0.11826808750629425, -0.33912336826324463, 0.4203845262527466, -0.3586285710334778, 0.0036464473232626915, -0.6129180788993835, 0.4145774841308594, -0.36235424876213074, 0.5213751196861267, 0.24066758155822754, 0.052110008895397186, -0.06067921966314316, 0.11904842406511307, -0.22991396486759186, 0.11621695011854172, 0.018999025225639343, -0.3164730668067932, 0.07239852845668793, 0.3815532326698303, 0.2155793011188507, 0.3912976384162903, 0.23783725500106812, 0.017702165991067886, 0.06952623277902603, 0.03549274429678917, 0.2525549829006195, -0.4628985822200775, -0.4772782623767853, -0.02210560441017151, -0.07348829507827759, -0.16659045219421387, 0.11811284720897675, 0.07371124625205994, 0.035981737077236176, 0.06487447023391724, -0.16818158328533173, -0.21392780542373657, -0.459059476852417, 0.15326954424381256, -0.020726673305034637, 0.010972298681735992, 0.1157359629869461, 0.3245413303375244, -0.20322851836681366, -0.1725568175315857, 0.22188571095466614, 0.2305416315793991, 0.09045781940221786, -0.1450119912624359, -0.6466354727745056, -0.11341898143291473, -0.5839853882789612, 0.3120260536670685, -0.09698426723480225, 0.03854341059923172, -0.1606910675764084, 0.11498764902353287, 0.17899444699287415, -0.16795040667057037, 0.7110092043876648, -0.05402546375989914, 0.25112754106521606, -0.08594174683094025, -0.3230152428150177, -0.43349647521972656, 0.169632688164711, 0.043355051428079605, 0.651696503162384, 0.3352051079273224, 0.9209738969802856, -0.5595276951789856, 0.09841692447662354, 0.23311308026313782, 0.1075611263513565, -0.05370836332440376, -0.48272863030433655, -0.16164885461330414, -0.340710312128067, 0.017573541030287743, 0.03870431333780289, 0.07834134250879288, 0.1757803112268448, 0.03529413044452667, -0.26659682393074036, 0.08844098448753357, -0.004208652302622795, 0.32376110553741455, -0.1250266134738922, 0.032294005155563354, 0.3541364073753357, 0.2597753405570984, 0.19551415741443634, 0.12716512382030487, 0.028859039768576622, 0.3350772559642792, 0.3258299231529236, 0.0645514726638794, 0.02420136332511902, -0.008666373789310455, 0.4252777397632599, 0.5220961570739746, 0.26267099380493164, 0.09232426434755325, 0.0022421106696128845, 0.3612261414527893, -0.4305432140827179, -0.01932058483362198, 0.08422897011041641, 0.25744399428367615, 0.005420882720500231, -0.12321852147579193, 0.45183753967285156, 0.1161847859621048, -0.1984427124261856, 0.5560110807418823, 0.05901723355054855, -0.24077939987182617, 0.1654711216688156, -0.022777020931243896, 1.0856157541275024, -0.32582640647888184, 0.01687362790107727, 0.1473166048526764, -0.20329861342906952, 0.29720500111579895, -0.15487335622310638, -0.11433082818984985, -0.24449476599693298, -0.22063329815864563, 0.23241598904132843, -0.004680652171373367, 0.23912128806114197, -0.1434376984834671, 0.05808253958821297, 0.2643987238407135, -0.07180646806955338, 0.16438698768615723, 0.05966673791408539, 0.12828129529953003, -0.18527597188949585, -0.5459385514259338, -0.1653936803340912, -0.10275962203741074, -0.0464465394616127, 0.15883874893188477, 0.026181135326623917, 0.061127420514822006, -0.07266847789287567, 0.08410362899303436, 0.01373688131570816, -0.03083033487200737, -0.05427723005414009, -0.06448326259851456, -0.216745525598526, 0.08868405222892761, -0.010880742222070694, 0.003827366977930069, -0.13319291174411774, 0.49164921045303345, -0.07399116456508636, 0.03424714505672455, 0.02643212303519249, 0.15796875953674316, 0.1594584882259369, -0.11559496074914932, -0.024185853078961372, 0.06242532283067703, -0.20603711903095245, -0.32834067940711975, 0.02239152416586876, 0.1384766846895218, -0.1543620079755783, -0.13176055252552032, -0.04287233203649521, -0.22770656645298004, -0.127167746424675, -0.02435094118118286, 0.1837126612663269, -0.11008132994174957, -0.058499645441770554, 0.18449360132217407, -0.24122537672519684, 0.3735998570919037, -0.08822797238826752, -0.3953043520450592, -0.10393127799034119, 0.6344955563545227, 0.010421240702271461, -0.23700828850269318, 0.7087689638137817, -0.07702738046646118, -0.05710790306329727, -0.16444744169712067, 0.3385883867740631, 0.5586374402046204, -0.24462753534317017, 0.2147832214832306, -0.25088414549827576, 0.011680588126182556, -0.10829354077577591, 0.08876349776983261, 0.1030031368136406, -0.5223098993301392, -0.10934846103191376, -0.5039831399917603, -0.43715840578079224, 0.05081131309270859, 0.3166467547416687, 0.15294015407562256, -0.21891170740127563, -0.08608657121658325, -0.23076042532920837, 0.18432340025901794, -0.13626918196678162, 0.0054397243075072765, -0.03928036615252495, 0.2209508866071701, 0.19502782821655273, -0.1933629810810089, -0.03922705724835396, -0.20526933670043945, 0.03739862143993378, 0.27980536222457886, -0.25010886788368225, -0.03600415214896202, -0.0393863283097744, 0.21950197219848633, -0.25278082489967346, -0.17280606925487518, 0.3825647234916687, -0.2839566469192505, -0.14871740341186523, -0.4645366668701172, 0.21011117100715637, 0.2932010293006897, -0.07075804471969604, -0.11504863202571869, -0.014532539993524551, 0.32089659571647644, 0.16738778352737427, 0.24592076241970062, -0.06628371775150299, 0.04054572805762291, -0.14622949063777924, 0.10256931930780411, -0.05880509316921234, -0.11613259464502335, -0.3286270201206207, 0.019978322088718414, 0.31452351808547974, 0.06399017572402954, 0.3035332262516022, -0.18932116031646729, -0.2217317819595337, 0.37511879205703735, 0.5794053077697754, 0.3862801790237427, -0.27660295367240906, -0.24566514790058136, 0.161533385515213, 0.03528733551502228, -0.06660771369934082, 0.23094059526920319, 0.5689195394515991, 0.07470627129077911, 0.035043854266405106, 0.17986083030700684, 0.021952573210000992, -0.14437070488929749, -0.2576485872268677, -0.19037574529647827, 0.14818549156188965, 0.07130442559719086, 0.0472169928252697, 0.21345387399196625, 0.16395694017410278, 0.06114104390144348, 0.33889833092689514, 0.28907209634780884, 0.08657233417034149, 0.46671026945114136, 0.36833521723747253, 0.3922783136367798, -0.17793506383895874, 0.45053398609161377, -0.1657322645187378, -0.6048744916915894, 0.05006133019924164, 0.5202895402908325, 0.0029046088457107544, 0.21429744362831116, 0.1338866949081421, 0.38823968172073364, -0.3346572518348694, -0.4425603449344635, -0.21835723519325256, 0.2409757524728775, -0.3484090268611908, -0.2405196577310562, -0.12771075963974, -0.16644859313964844, -0.19621485471725464, 0.20828908681869507, 0.028466826304793358, -0.01391419768333435, 0.583320140838623, -0.05597786605358124, 0.07471874356269836, -0.16509927809238434, -0.13108599185943604, -0.15083172917366028, 0.5593532919883728, -0.4249300956726074, -0.05827359855175018, 0.0850893035531044, 0.2014937549829483, 0.005659814924001694, 0.09891659021377563, 0.22191683948040009, 0.5954396724700928, -0.34415534138679504, 0.1737135797739029, 0.007833249866962433, 0.0002800002694129944, -0.07336442917585373, 0.3781742453575134, -0.023917175829410553, 0.4306616187095642, 0.35236334800720215, -0.0769110918045044, -0.19672951102256775, -0.1365981101989746, 0.1685664802789688, 0.16232620179653168, -0.17076309025287628, 0.0013052970170974731, -0.10554970800876617, -0.28268885612487793, 0.043627724051475525, -0.23438486456871033, -0.15561677515506744, -0.26679372787475586, 0.015271233394742012, -0.20121757686138153, 0.04535309970378876, -0.33287063241004944, 0.0407525971531868, -0.1899546980857849, 0.3805100917816162, 0.36594313383102417, -0.004106886684894562, -0.4409253001213074, -0.18570628762245178, -0.6614765524864197, 0.21573372185230255, -0.13150636851787567, -0.1283676028251648, 0.21142706274986267, 0.20397856831550598, 0.06626047194004059, -0.037849061191082, -0.030719071626663208, -0.1803531050682068, 0.25373339653015137, 0.37092190980911255, 0.06299549341201782, -0.049475591629743576, -0.24363352358341217, -0.3167143762111664, 0.06748935580253601, -0.430189847946167, 0.338339239358902, -0.39672091603279114, -0.06871280074119568, 0.09887946397066116, 0.23482993245124817, -0.3199445605278015, 0.23999114334583282, 0.6963932514190674, 0.38060513138771057, 0.17886658012866974, -0.08828824758529663, -0.2170494943857193, -0.2739618122577667, 0.16009551286697388, -0.18827418982982635, 0.22882702946662903, -0.11228372156620026, 0.4331352710723877, -0.14778760075569153, 0.11189886927604675, -0.22905497252941132, 0.18503588438034058, -0.04645029455423355, -0.056735821068286896, -0.0674976110458374, -0.04833732545375824, -0.004544232040643692, 0.0744660347700119, 0.0734248235821724, 0.4428519308567047, 0.11574968695640564, 0.41858235001564026, -0.19462652504444122, -0.3257076144218445, 0.45590972900390625, -0.2594570815563202, -0.6162012815475464, 0.15928514301776886, 0.29199790954589844, 0.23965629935264587, -0.25190213322639465, -0.29562681913375854, -0.012355774641036987, 0.15429794788360596, -0.04089241474866867, -0.1076558381319046, 0.22024458646774292, -0.4544614255428314, -0.4066638648509979, -0.08461301028728485, 0.32723742723464966, 0.1267111450433731, -0.3212854862213135, 0.18627022206783295, -0.12177833169698715 ]
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
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.
[ -0.2388804703950882, -0.42039424180984497, 0.11454983055591583, 0.013677917420864105, 0.3820091485977173, -0.026951275765895844, -0.09978540241718292, 0.2806102931499481, 0.2809220254421234, 0.42724764347076416, -0.14177918434143066, 0.3004532754421234, 0.17234168946743011, -0.09254340827465057, -0.20135712623596191, 0.1648067981004715, 0.012814372777938843, 0.027215875685214996, -0.46503302454948425, -0.023259803652763367, -0.30321362614631653, -0.019845841452479362, -0.08741754293441772, -0.22614990174770355, 0.029805229976773262, 0.05566719174385071, 0.23480743169784546, 0.048041969537734985, -0.13257582485675812, -0.03899882733821869, 0.025727158412337303, 0.33187803626060486, -0.2694393992424011, 0.7168409824371338, -0.0001257616822840646, -0.24600796401500702, 0.3856589198112488, 0.12560468912124634, 0.07028405368328094, -0.14490459859371185, 0.4119062125682831, -0.23816551268100739, 0.07440546900033951, -0.2535730004310608, 0.21299558877944946, 0.0970379114151001, 0.17317521572113037, -0.2661341726779938, 0.26940834522247314, -0.2111963927745819, 0.0643077865242958, 0.1619422733783722, -0.1921636164188385, -0.02156246267259121, 0.046288128942251205, 0.3041096329689026, 0.005572399124503136, 0.5163283348083496, 0.1856713443994522, -0.2736380994319916, -0.22961297631263733, 0.35308316349983215, -0.23241208493709564, -0.24688448011875153, 0.44899415969848633, -0.023223359137773514, 0.2293471097946167, -0.14012391865253448, 0.450479656457901, 0.24075055122375488, -0.05068720132112503, -0.05832003802061081, -0.20002377033233643, -0.2391187846660614, -0.08658820390701294, -0.20893920958042145, 0.158798485994339, 0.076323963701725, -0.2498103529214859, -0.13516537845134735, -0.589224100112915, -0.20159725844860077, 0.1903139054775238, 0.011416729539632797, -0.4154917001724243, -0.11164240539073944, -0.11775729060173035, 0.2734394967556, 0.4124734401702881, -0.20074571669101715, -0.43840664625167847, -0.0484187975525856, 0.29575470089912415, 0.16494159400463104, -0.2238069623708725, 0.1342388540506363, 0.24506279826164246, -0.20668789744377136, 0.19873002171516418, 0.029519882053136826, -0.3274613320827484, 0.20284652709960938, -0.1723250448703766, 0.11157113313674927, 0.2877354323863983, 0.2299201786518097, -0.07176683098077774, 0.16607190668582916, 0.4792513847351074, 0.24024450778961182, -0.12510834634304047, 0.07817891240119934, 0.34749460220336914, -0.2629399299621582, 0.20621512830257416, -0.19157558679580688, 0.08132008463144302, -0.3271124064922333, -0.08810865134000778, 0.2338065356016159, -0.02311709336936474, 0.1665746122598648, 0.0541432723402977, 0.26647984981536865, 0.28801655769348145, 0.03394828364253044, 0.05194912105798721, 0.11398106813430786, -0.30280810594558716, 0.2608893811702728, 0.023673804476857185, -0.1403404027223587, -0.3892468512058258, 0.21316266059875488, 0.007915191352367401, -0.11985050141811371, 0.04438326507806778, 0.15219847857952118, 0.07513782382011414, -0.17251800000667572, -0.007029242813587189, -0.15144793689250946, 0.28983935713768005, 0.31175920367240906, -0.2254585176706314, 0.40087464451789856, -0.02229120209813118, -0.031029824167490005, -0.2700267732143402, 0.08179167658090591, 0.022208355367183685, -0.02402842789888382, 0.20523898303508759, 0.015945443883538246, -0.13217301666736603, 0.2970324754714966, -0.059470243752002716, 0.18673139810562134, 0.3860650956630707, -0.24491482973098755, 0.03056919574737549, -0.15452414751052856, -0.3442258834838867, -0.12373950332403183, 0.2280447781085968, 0.5708963871002197, -0.07920300960540771, 0.06152220070362091, 0.03908877074718475, 0.10825614631175995, 0.2775461673736572, 0.32453787326812744, 0.0911373570561409, 0.1843341886997223, -0.2951490581035614, 0.029287241399288177, -0.30308666825294495, -0.16072231531143188, -0.4697611331939697, 0.4938769042491913, -0.5575812458992004, 0.203892782330513, 0.02161066234111786, 0.06717279553413391, -0.02055305801331997, -0.06775475293397903, 0.42178577184677124, 0.11313401162624359, -0.04053343087434769, 0.06422069668769836, -0.115497887134552, -0.15403740108013153, 0.137740820646286, 0.21668770909309387, 0.24219581484794617, -0.030807964503765106, 0.23239031434059143, -0.3148108124732971, 0.0743972584605217, -0.09870047867298126, 0.11744342744350433, 0.22700992226600647, 0.017411790788173676, 0.1518639326095581, 0.013074265792965889, -0.5110952258110046, -0.4240115284919739, 0.12463059276342392, 0.05850869417190552, 0.020973820239305496, -0.3666144609451294, -0.2333809733390808, -0.318918913602829, -0.06761816143989563, -0.03722725436091423, 0.27504587173461914, -0.12419392168521881, 0.02847849577665329, -0.1573118269443512, 0.12788619101047516, -0.03772396594285965, -0.18904858827590942, -0.06251081079244614, 0.23099084198474884, -0.6582083106040955, 0.152180016040802, 0.23641648888587952, -0.2917603552341461, -0.031077001243829727, 0.23493489623069763, 0.17350973188877106, -0.3071972131729126, -0.08042354881763458, 0.303044855594635, -0.16496101021766663, 0.2505462169647217, -0.05314791202545166, 0.41233396530151367, 0.09876055270433426, 0.1920226514339447, -0.04778430610895157, 0.21650639176368713, 0.10364970564842224, -0.37129756808280945, -0.16018351912498474, 0.31123095750808716, -0.23095862567424774, 0.4938899278640747, -0.1795552670955658, -0.018198711797595024, 0.057181984186172485, -0.03867245465517044, -0.33655115962028503, -0.1715606451034546, 0.4729599952697754, 0.2662582993507385, -0.02222106233239174, 0.052158523350954056, 0.1236138641834259, -0.040628619492053986, 0.45399346947669983, -0.35915595293045044, -0.05735056847333908, 0.15214717388153076, -0.037039414048194885, 0.13274547457695007, 0.07663054764270782, -0.22056810557842255, 0.328664094209671, 0.0495850034058094, 0.0890142023563385, 0.25696948170661926, 0.06748668104410172, -0.041223153471946716, 0.03859096020460129, 0.15688329935073853, 0.0524555929005146, 0.15206317603588104, 0.06971358507871628, 0.07846195250749588, -0.2890482544898987, -0.2303764671087265, -0.09772747755050659, 0.26063987612724304, -0.2403760403394699, -0.10018187016248703, -0.2927587628364563, 0.3055817782878876, -0.10294516384601593, 0.22796191275119781, -0.36109933257102966, -0.47942960262298584, -0.3381495475769043, 0.3350684344768524, -0.2742214500904083, 0.20275017619132996, 0.20204828679561615, 0.008992314338684082, -0.010444644838571548, -0.11006764322519302, -0.14648383855819702, -0.08160876482725143, -0.0197611041367054, -0.3132166862487793, 0.4684447646141052, -0.32853826880455017, 0.30248501896858215, -0.006483949720859528, -0.14062291383743286, -0.04586349427700043, -0.38114115595817566, -0.018194951117038727, 0.007683422416448593, 0.15184970200061798, 0.13487578928470612, 0.19577786326408386, -0.17469263076782227, 0.02922739088535309, 0.22800767421722412, -0.18603846430778503, -0.07460442185401917, 0.08755339682102203, 0.05278673395514488, 0.06101684644818306, -0.2449713796377182, -0.028351642191410065, 0.16690614819526672, -0.3009679913520813, 0.6349738836288452, -0.5413115620613098, 0.19146476686000824, 0.10177956521511078, -0.18995659053325653, -0.06051838397979736, -0.35687318444252014, -0.0874604806303978, -0.11918392777442932, -0.09153549373149872, 0.24307221174240112, 0.018023265525698662, -0.09907510876655579, -0.07739739865064621, 0.11826808750629425, -0.33912336826324463, 0.4203845262527466, -0.3586285710334778, 0.0036464473232626915, -0.6129180788993835, 0.4145774841308594, -0.36235424876213074, 0.5213751196861267, 0.24066758155822754, 0.052110008895397186, -0.06067921966314316, 0.11904842406511307, -0.22991396486759186, 0.11621695011854172, 0.018999025225639343, -0.3164730668067932, 0.07239852845668793, 0.3815532326698303, 0.2155793011188507, 0.3912976384162903, 0.23783725500106812, 0.017702165991067886, 0.06952623277902603, 0.03549274429678917, 0.2525549829006195, -0.4628985822200775, -0.4772782623767853, -0.02210560441017151, -0.07348829507827759, -0.16659045219421387, 0.11811284720897675, 0.07371124625205994, 0.035981737077236176, 0.06487447023391724, -0.16818158328533173, -0.21392780542373657, -0.459059476852417, 0.15326954424381256, -0.020726673305034637, 0.010972298681735992, 0.1157359629869461, 0.3245413303375244, -0.20322851836681366, -0.1725568175315857, 0.22188571095466614, 0.2305416315793991, 0.09045781940221786, -0.1450119912624359, -0.6466354727745056, -0.11341898143291473, -0.5839853882789612, 0.3120260536670685, -0.09698426723480225, 0.03854341059923172, -0.1606910675764084, 0.11498764902353287, 0.17899444699287415, -0.16795040667057037, 0.7110092043876648, -0.05402546375989914, 0.25112754106521606, -0.08594174683094025, -0.3230152428150177, -0.43349647521972656, 0.169632688164711, 0.043355051428079605, 0.651696503162384, 0.3352051079273224, 0.9209738969802856, -0.5595276951789856, 0.09841692447662354, 0.23311308026313782, 0.1075611263513565, -0.05370836332440376, -0.48272863030433655, -0.16164885461330414, -0.340710312128067, 0.017573541030287743, 0.03870431333780289, 0.07834134250879288, 0.1757803112268448, 0.03529413044452667, -0.26659682393074036, 0.08844098448753357, -0.004208652302622795, 0.32376110553741455, -0.1250266134738922, 0.032294005155563354, 0.3541364073753357, 0.2597753405570984, 0.19551415741443634, 0.12716512382030487, 0.028859039768576622, 0.3350772559642792, 0.3258299231529236, 0.0645514726638794, 0.02420136332511902, -0.008666373789310455, 0.4252777397632599, 0.5220961570739746, 0.26267099380493164, 0.09232426434755325, 0.0022421106696128845, 0.3612261414527893, -0.4305432140827179, -0.01932058483362198, 0.08422897011041641, 0.25744399428367615, 0.005420882720500231, -0.12321852147579193, 0.45183753967285156, 0.1161847859621048, -0.1984427124261856, 0.5560110807418823, 0.05901723355054855, -0.24077939987182617, 0.1654711216688156, -0.022777020931243896, 1.0856157541275024, -0.32582640647888184, 0.01687362790107727, 0.1473166048526764, -0.20329861342906952, 0.29720500111579895, -0.15487335622310638, -0.11433082818984985, -0.24449476599693298, -0.22063329815864563, 0.23241598904132843, -0.004680652171373367, 0.23912128806114197, -0.1434376984834671, 0.05808253958821297, 0.2643987238407135, -0.07180646806955338, 0.16438698768615723, 0.05966673791408539, 0.12828129529953003, -0.18527597188949585, -0.5459385514259338, -0.1653936803340912, -0.10275962203741074, -0.0464465394616127, 0.15883874893188477, 0.026181135326623917, 0.061127420514822006, -0.07266847789287567, 0.08410362899303436, 0.01373688131570816, -0.03083033487200737, -0.05427723005414009, -0.06448326259851456, -0.216745525598526, 0.08868405222892761, -0.010880742222070694, 0.003827366977930069, -0.13319291174411774, 0.49164921045303345, -0.07399116456508636, 0.03424714505672455, 0.02643212303519249, 0.15796875953674316, 0.1594584882259369, -0.11559496074914932, -0.024185853078961372, 0.06242532283067703, -0.20603711903095245, -0.32834067940711975, 0.02239152416586876, 0.1384766846895218, -0.1543620079755783, -0.13176055252552032, -0.04287233203649521, -0.22770656645298004, -0.127167746424675, -0.02435094118118286, 0.1837126612663269, -0.11008132994174957, -0.058499645441770554, 0.18449360132217407, -0.24122537672519684, 0.3735998570919037, -0.08822797238826752, -0.3953043520450592, -0.10393127799034119, 0.6344955563545227, 0.010421240702271461, -0.23700828850269318, 0.7087689638137817, -0.07702738046646118, -0.05710790306329727, -0.16444744169712067, 0.3385883867740631, 0.5586374402046204, -0.24462753534317017, 0.2147832214832306, -0.25088414549827576, 0.011680588126182556, -0.10829354077577591, 0.08876349776983261, 0.1030031368136406, -0.5223098993301392, -0.10934846103191376, -0.5039831399917603, -0.43715840578079224, 0.05081131309270859, 0.3166467547416687, 0.15294015407562256, -0.21891170740127563, -0.08608657121658325, -0.23076042532920837, 0.18432340025901794, -0.13626918196678162, 0.0054397243075072765, -0.03928036615252495, 0.2209508866071701, 0.19502782821655273, -0.1933629810810089, -0.03922705724835396, -0.20526933670043945, 0.03739862143993378, 0.27980536222457886, -0.25010886788368225, -0.03600415214896202, -0.0393863283097744, 0.21950197219848633, -0.25278082489967346, -0.17280606925487518, 0.3825647234916687, -0.2839566469192505, -0.14871740341186523, -0.4645366668701172, 0.21011117100715637, 0.2932010293006897, -0.07075804471969604, -0.11504863202571869, -0.014532539993524551, 0.32089659571647644, 0.16738778352737427, 0.24592076241970062, -0.06628371775150299, 0.04054572805762291, -0.14622949063777924, 0.10256931930780411, -0.05880509316921234, -0.11613259464502335, -0.3286270201206207, 0.019978322088718414, 0.31452351808547974, 0.06399017572402954, 0.3035332262516022, -0.18932116031646729, -0.2217317819595337, 0.37511879205703735, 0.5794053077697754, 0.3862801790237427, -0.27660295367240906, -0.24566514790058136, 0.161533385515213, 0.03528733551502228, -0.06660771369934082, 0.23094059526920319, 0.5689195394515991, 0.07470627129077911, 0.035043854266405106, 0.17986083030700684, 0.021952573210000992, -0.14437070488929749, -0.2576485872268677, -0.19037574529647827, 0.14818549156188965, 0.07130442559719086, 0.0472169928252697, 0.21345387399196625, 0.16395694017410278, 0.06114104390144348, 0.33889833092689514, 0.28907209634780884, 0.08657233417034149, 0.46671026945114136, 0.36833521723747253, 0.3922783136367798, -0.17793506383895874, 0.45053398609161377, -0.1657322645187378, -0.6048744916915894, 0.05006133019924164, 0.5202895402908325, 0.0029046088457107544, 0.21429744362831116, 0.1338866949081421, 0.38823968172073364, -0.3346572518348694, -0.4425603449344635, -0.21835723519325256, 0.2409757524728775, -0.3484090268611908, -0.2405196577310562, -0.12771075963974, -0.16644859313964844, -0.19621485471725464, 0.20828908681869507, 0.028466826304793358, -0.01391419768333435, 0.583320140838623, -0.05597786605358124, 0.07471874356269836, -0.16509927809238434, -0.13108599185943604, -0.15083172917366028, 0.5593532919883728, -0.4249300956726074, -0.05827359855175018, 0.0850893035531044, 0.2014937549829483, 0.005659814924001694, 0.09891659021377563, 0.22191683948040009, 0.5954396724700928, -0.34415534138679504, 0.1737135797739029, 0.007833249866962433, 0.0002800002694129944, -0.07336442917585373, 0.3781742453575134, -0.023917175829410553, 0.4306616187095642, 0.35236334800720215, -0.0769110918045044, -0.19672951102256775, -0.1365981101989746, 0.1685664802789688, 0.16232620179653168, -0.17076309025287628, 0.0013052970170974731, -0.10554970800876617, -0.28268885612487793, 0.043627724051475525, -0.23438486456871033, -0.15561677515506744, -0.26679372787475586, 0.015271233394742012, -0.20121757686138153, 0.04535309970378876, -0.33287063241004944, 0.0407525971531868, -0.1899546980857849, 0.3805100917816162, 0.36594313383102417, -0.004106886684894562, -0.4409253001213074, -0.18570628762245178, -0.6614765524864197, 0.21573372185230255, -0.13150636851787567, -0.1283676028251648, 0.21142706274986267, 0.20397856831550598, 0.06626047194004059, -0.037849061191082, -0.030719071626663208, -0.1803531050682068, 0.25373339653015137, 0.37092190980911255, 0.06299549341201782, -0.049475591629743576, -0.24363352358341217, -0.3167143762111664, 0.06748935580253601, -0.430189847946167, 0.338339239358902, -0.39672091603279114, -0.06871280074119568, 0.09887946397066116, 0.23482993245124817, -0.3199445605278015, 0.23999114334583282, 0.6963932514190674, 0.38060513138771057, 0.17886658012866974, -0.08828824758529663, -0.2170494943857193, -0.2739618122577667, 0.16009551286697388, -0.18827418982982635, 0.22882702946662903, -0.11228372156620026, 0.4331352710723877, -0.14778760075569153, 0.11189886927604675, -0.22905497252941132, 0.18503588438034058, -0.04645029455423355, -0.056735821068286896, -0.0674976110458374, -0.04833732545375824, -0.004544232040643692, 0.0744660347700119, 0.0734248235821724, 0.4428519308567047, 0.11574968695640564, 0.41858235001564026, -0.19462652504444122, -0.3257076144218445, 0.45590972900390625, -0.2594570815563202, -0.6162012815475464, 0.15928514301776886, 0.29199790954589844, 0.23965629935264587, -0.25190213322639465, -0.29562681913375854, -0.012355774641036987, 0.15429794788360596, -0.04089241474866867, -0.1076558381319046, 0.22024458646774292, -0.4544614255428314, -0.4066638648509979, -0.08461301028728485, 0.32723742723464966, 0.1267111450433731, -0.3212854862213135, 0.18627022206783295, -0.12177833169698715 ]
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
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?
[ -0.2388804703950882, -0.42039424180984497, 0.11454983055591583, 0.013677917420864105, 0.3820091485977173, -0.026951275765895844, -0.09978540241718292, 0.2806102931499481, 0.2809220254421234, 0.42724764347076416, -0.14177918434143066, 0.3004532754421234, 0.17234168946743011, -0.09254340827465057, -0.20135712623596191, 0.1648067981004715, 0.012814372777938843, 0.027215875685214996, -0.46503302454948425, -0.023259803652763367, -0.30321362614631653, -0.019845841452479362, -0.08741754293441772, -0.22614990174770355, 0.029805229976773262, 0.05566719174385071, 0.23480743169784546, 0.048041969537734985, -0.13257582485675812, -0.03899882733821869, 0.025727158412337303, 0.33187803626060486, -0.2694393992424011, 0.7168409824371338, -0.0001257616822840646, -0.24600796401500702, 0.3856589198112488, 0.12560468912124634, 0.07028405368328094, -0.14490459859371185, 0.4119062125682831, -0.23816551268100739, 0.07440546900033951, -0.2535730004310608, 0.21299558877944946, 0.0970379114151001, 0.17317521572113037, -0.2661341726779938, 0.26940834522247314, -0.2111963927745819, 0.0643077865242958, 0.1619422733783722, -0.1921636164188385, -0.02156246267259121, 0.046288128942251205, 0.3041096329689026, 0.005572399124503136, 0.5163283348083496, 0.1856713443994522, -0.2736380994319916, -0.22961297631263733, 0.35308316349983215, -0.23241208493709564, -0.24688448011875153, 0.44899415969848633, -0.023223359137773514, 0.2293471097946167, -0.14012391865253448, 0.450479656457901, 0.24075055122375488, -0.05068720132112503, -0.05832003802061081, -0.20002377033233643, -0.2391187846660614, -0.08658820390701294, -0.20893920958042145, 0.158798485994339, 0.076323963701725, -0.2498103529214859, -0.13516537845134735, -0.589224100112915, -0.20159725844860077, 0.1903139054775238, 0.011416729539632797, -0.4154917001724243, -0.11164240539073944, -0.11775729060173035, 0.2734394967556, 0.4124734401702881, -0.20074571669101715, -0.43840664625167847, -0.0484187975525856, 0.29575470089912415, 0.16494159400463104, -0.2238069623708725, 0.1342388540506363, 0.24506279826164246, -0.20668789744377136, 0.19873002171516418, 0.029519882053136826, -0.3274613320827484, 0.20284652709960938, -0.1723250448703766, 0.11157113313674927, 0.2877354323863983, 0.2299201786518097, -0.07176683098077774, 0.16607190668582916, 0.4792513847351074, 0.24024450778961182, -0.12510834634304047, 0.07817891240119934, 0.34749460220336914, -0.2629399299621582, 0.20621512830257416, -0.19157558679580688, 0.08132008463144302, -0.3271124064922333, -0.08810865134000778, 0.2338065356016159, -0.02311709336936474, 0.1665746122598648, 0.0541432723402977, 0.26647984981536865, 0.28801655769348145, 0.03394828364253044, 0.05194912105798721, 0.11398106813430786, -0.30280810594558716, 0.2608893811702728, 0.023673804476857185, -0.1403404027223587, -0.3892468512058258, 0.21316266059875488, 0.007915191352367401, -0.11985050141811371, 0.04438326507806778, 0.15219847857952118, 0.07513782382011414, -0.17251800000667572, -0.007029242813587189, -0.15144793689250946, 0.28983935713768005, 0.31175920367240906, -0.2254585176706314, 0.40087464451789856, -0.02229120209813118, -0.031029824167490005, -0.2700267732143402, 0.08179167658090591, 0.022208355367183685, -0.02402842789888382, 0.20523898303508759, 0.015945443883538246, -0.13217301666736603, 0.2970324754714966, -0.059470243752002716, 0.18673139810562134, 0.3860650956630707, -0.24491482973098755, 0.03056919574737549, -0.15452414751052856, -0.3442258834838867, -0.12373950332403183, 0.2280447781085968, 0.5708963871002197, -0.07920300960540771, 0.06152220070362091, 0.03908877074718475, 0.10825614631175995, 0.2775461673736572, 0.32453787326812744, 0.0911373570561409, 0.1843341886997223, -0.2951490581035614, 0.029287241399288177, -0.30308666825294495, -0.16072231531143188, -0.4697611331939697, 0.4938769042491913, -0.5575812458992004, 0.203892782330513, 0.02161066234111786, 0.06717279553413391, -0.02055305801331997, -0.06775475293397903, 0.42178577184677124, 0.11313401162624359, -0.04053343087434769, 0.06422069668769836, -0.115497887134552, -0.15403740108013153, 0.137740820646286, 0.21668770909309387, 0.24219581484794617, -0.030807964503765106, 0.23239031434059143, -0.3148108124732971, 0.0743972584605217, -0.09870047867298126, 0.11744342744350433, 0.22700992226600647, 0.017411790788173676, 0.1518639326095581, 0.013074265792965889, -0.5110952258110046, -0.4240115284919739, 0.12463059276342392, 0.05850869417190552, 0.020973820239305496, -0.3666144609451294, -0.2333809733390808, -0.318918913602829, -0.06761816143989563, -0.03722725436091423, 0.27504587173461914, -0.12419392168521881, 0.02847849577665329, -0.1573118269443512, 0.12788619101047516, -0.03772396594285965, -0.18904858827590942, -0.06251081079244614, 0.23099084198474884, -0.6582083106040955, 0.152180016040802, 0.23641648888587952, -0.2917603552341461, -0.031077001243829727, 0.23493489623069763, 0.17350973188877106, -0.3071972131729126, -0.08042354881763458, 0.303044855594635, -0.16496101021766663, 0.2505462169647217, -0.05314791202545166, 0.41233396530151367, 0.09876055270433426, 0.1920226514339447, -0.04778430610895157, 0.21650639176368713, 0.10364970564842224, -0.37129756808280945, -0.16018351912498474, 0.31123095750808716, -0.23095862567424774, 0.4938899278640747, -0.1795552670955658, -0.018198711797595024, 0.057181984186172485, -0.03867245465517044, -0.33655115962028503, -0.1715606451034546, 0.4729599952697754, 0.2662582993507385, -0.02222106233239174, 0.052158523350954056, 0.1236138641834259, -0.040628619492053986, 0.45399346947669983, -0.35915595293045044, -0.05735056847333908, 0.15214717388153076, -0.037039414048194885, 0.13274547457695007, 0.07663054764270782, -0.22056810557842255, 0.328664094209671, 0.0495850034058094, 0.0890142023563385, 0.25696948170661926, 0.06748668104410172, -0.041223153471946716, 0.03859096020460129, 0.15688329935073853, 0.0524555929005146, 0.15206317603588104, 0.06971358507871628, 0.07846195250749588, -0.2890482544898987, -0.2303764671087265, -0.09772747755050659, 0.26063987612724304, -0.2403760403394699, -0.10018187016248703, -0.2927587628364563, 0.3055817782878876, -0.10294516384601593, 0.22796191275119781, -0.36109933257102966, -0.47942960262298584, -0.3381495475769043, 0.3350684344768524, -0.2742214500904083, 0.20275017619132996, 0.20204828679561615, 0.008992314338684082, -0.010444644838571548, -0.11006764322519302, -0.14648383855819702, -0.08160876482725143, -0.0197611041367054, -0.3132166862487793, 0.4684447646141052, -0.32853826880455017, 0.30248501896858215, -0.006483949720859528, -0.14062291383743286, -0.04586349427700043, -0.38114115595817566, -0.018194951117038727, 0.007683422416448593, 0.15184970200061798, 0.13487578928470612, 0.19577786326408386, -0.17469263076782227, 0.02922739088535309, 0.22800767421722412, -0.18603846430778503, -0.07460442185401917, 0.08755339682102203, 0.05278673395514488, 0.06101684644818306, -0.2449713796377182, -0.028351642191410065, 0.16690614819526672, -0.3009679913520813, 0.6349738836288452, -0.5413115620613098, 0.19146476686000824, 0.10177956521511078, -0.18995659053325653, -0.06051838397979736, -0.35687318444252014, -0.0874604806303978, -0.11918392777442932, -0.09153549373149872, 0.24307221174240112, 0.018023265525698662, -0.09907510876655579, -0.07739739865064621, 0.11826808750629425, -0.33912336826324463, 0.4203845262527466, -0.3586285710334778, 0.0036464473232626915, -0.6129180788993835, 0.4145774841308594, -0.36235424876213074, 0.5213751196861267, 0.24066758155822754, 0.052110008895397186, -0.06067921966314316, 0.11904842406511307, -0.22991396486759186, 0.11621695011854172, 0.018999025225639343, -0.3164730668067932, 0.07239852845668793, 0.3815532326698303, 0.2155793011188507, 0.3912976384162903, 0.23783725500106812, 0.017702165991067886, 0.06952623277902603, 0.03549274429678917, 0.2525549829006195, -0.4628985822200775, -0.4772782623767853, -0.02210560441017151, -0.07348829507827759, -0.16659045219421387, 0.11811284720897675, 0.07371124625205994, 0.035981737077236176, 0.06487447023391724, -0.16818158328533173, -0.21392780542373657, -0.459059476852417, 0.15326954424381256, -0.020726673305034637, 0.010972298681735992, 0.1157359629869461, 0.3245413303375244, -0.20322851836681366, -0.1725568175315857, 0.22188571095466614, 0.2305416315793991, 0.09045781940221786, -0.1450119912624359, -0.6466354727745056, -0.11341898143291473, -0.5839853882789612, 0.3120260536670685, -0.09698426723480225, 0.03854341059923172, -0.1606910675764084, 0.11498764902353287, 0.17899444699287415, -0.16795040667057037, 0.7110092043876648, -0.05402546375989914, 0.25112754106521606, -0.08594174683094025, -0.3230152428150177, -0.43349647521972656, 0.169632688164711, 0.043355051428079605, 0.651696503162384, 0.3352051079273224, 0.9209738969802856, -0.5595276951789856, 0.09841692447662354, 0.23311308026313782, 0.1075611263513565, -0.05370836332440376, -0.48272863030433655, -0.16164885461330414, -0.340710312128067, 0.017573541030287743, 0.03870431333780289, 0.07834134250879288, 0.1757803112268448, 0.03529413044452667, -0.26659682393074036, 0.08844098448753357, -0.004208652302622795, 0.32376110553741455, -0.1250266134738922, 0.032294005155563354, 0.3541364073753357, 0.2597753405570984, 0.19551415741443634, 0.12716512382030487, 0.028859039768576622, 0.3350772559642792, 0.3258299231529236, 0.0645514726638794, 0.02420136332511902, -0.008666373789310455, 0.4252777397632599, 0.5220961570739746, 0.26267099380493164, 0.09232426434755325, 0.0022421106696128845, 0.3612261414527893, -0.4305432140827179, -0.01932058483362198, 0.08422897011041641, 0.25744399428367615, 0.005420882720500231, -0.12321852147579193, 0.45183753967285156, 0.1161847859621048, -0.1984427124261856, 0.5560110807418823, 0.05901723355054855, -0.24077939987182617, 0.1654711216688156, -0.022777020931243896, 1.0856157541275024, -0.32582640647888184, 0.01687362790107727, 0.1473166048526764, -0.20329861342906952, 0.29720500111579895, -0.15487335622310638, -0.11433082818984985, -0.24449476599693298, -0.22063329815864563, 0.23241598904132843, -0.004680652171373367, 0.23912128806114197, -0.1434376984834671, 0.05808253958821297, 0.2643987238407135, -0.07180646806955338, 0.16438698768615723, 0.05966673791408539, 0.12828129529953003, -0.18527597188949585, -0.5459385514259338, -0.1653936803340912, -0.10275962203741074, -0.0464465394616127, 0.15883874893188477, 0.026181135326623917, 0.061127420514822006, -0.07266847789287567, 0.08410362899303436, 0.01373688131570816, -0.03083033487200737, -0.05427723005414009, -0.06448326259851456, -0.216745525598526, 0.08868405222892761, -0.010880742222070694, 0.003827366977930069, -0.13319291174411774, 0.49164921045303345, -0.07399116456508636, 0.03424714505672455, 0.02643212303519249, 0.15796875953674316, 0.1594584882259369, -0.11559496074914932, -0.024185853078961372, 0.06242532283067703, -0.20603711903095245, -0.32834067940711975, 0.02239152416586876, 0.1384766846895218, -0.1543620079755783, -0.13176055252552032, -0.04287233203649521, -0.22770656645298004, -0.127167746424675, -0.02435094118118286, 0.1837126612663269, -0.11008132994174957, -0.058499645441770554, 0.18449360132217407, -0.24122537672519684, 0.3735998570919037, -0.08822797238826752, -0.3953043520450592, -0.10393127799034119, 0.6344955563545227, 0.010421240702271461, -0.23700828850269318, 0.7087689638137817, -0.07702738046646118, -0.05710790306329727, -0.16444744169712067, 0.3385883867740631, 0.5586374402046204, -0.24462753534317017, 0.2147832214832306, -0.25088414549827576, 0.011680588126182556, -0.10829354077577591, 0.08876349776983261, 0.1030031368136406, -0.5223098993301392, -0.10934846103191376, -0.5039831399917603, -0.43715840578079224, 0.05081131309270859, 0.3166467547416687, 0.15294015407562256, -0.21891170740127563, -0.08608657121658325, -0.23076042532920837, 0.18432340025901794, -0.13626918196678162, 0.0054397243075072765, -0.03928036615252495, 0.2209508866071701, 0.19502782821655273, -0.1933629810810089, -0.03922705724835396, -0.20526933670043945, 0.03739862143993378, 0.27980536222457886, -0.25010886788368225, -0.03600415214896202, -0.0393863283097744, 0.21950197219848633, -0.25278082489967346, -0.17280606925487518, 0.3825647234916687, -0.2839566469192505, -0.14871740341186523, -0.4645366668701172, 0.21011117100715637, 0.2932010293006897, -0.07075804471969604, -0.11504863202571869, -0.014532539993524551, 0.32089659571647644, 0.16738778352737427, 0.24592076241970062, -0.06628371775150299, 0.04054572805762291, -0.14622949063777924, 0.10256931930780411, -0.05880509316921234, -0.11613259464502335, -0.3286270201206207, 0.019978322088718414, 0.31452351808547974, 0.06399017572402954, 0.3035332262516022, -0.18932116031646729, -0.2217317819595337, 0.37511879205703735, 0.5794053077697754, 0.3862801790237427, -0.27660295367240906, -0.24566514790058136, 0.161533385515213, 0.03528733551502228, -0.06660771369934082, 0.23094059526920319, 0.5689195394515991, 0.07470627129077911, 0.035043854266405106, 0.17986083030700684, 0.021952573210000992, -0.14437070488929749, -0.2576485872268677, -0.19037574529647827, 0.14818549156188965, 0.07130442559719086, 0.0472169928252697, 0.21345387399196625, 0.16395694017410278, 0.06114104390144348, 0.33889833092689514, 0.28907209634780884, 0.08657233417034149, 0.46671026945114136, 0.36833521723747253, 0.3922783136367798, -0.17793506383895874, 0.45053398609161377, -0.1657322645187378, -0.6048744916915894, 0.05006133019924164, 0.5202895402908325, 0.0029046088457107544, 0.21429744362831116, 0.1338866949081421, 0.38823968172073364, -0.3346572518348694, -0.4425603449344635, -0.21835723519325256, 0.2409757524728775, -0.3484090268611908, -0.2405196577310562, -0.12771075963974, -0.16644859313964844, -0.19621485471725464, 0.20828908681869507, 0.028466826304793358, -0.01391419768333435, 0.583320140838623, -0.05597786605358124, 0.07471874356269836, -0.16509927809238434, -0.13108599185943604, -0.15083172917366028, 0.5593532919883728, -0.4249300956726074, -0.05827359855175018, 0.0850893035531044, 0.2014937549829483, 0.005659814924001694, 0.09891659021377563, 0.22191683948040009, 0.5954396724700928, -0.34415534138679504, 0.1737135797739029, 0.007833249866962433, 0.0002800002694129944, -0.07336442917585373, 0.3781742453575134, -0.023917175829410553, 0.4306616187095642, 0.35236334800720215, -0.0769110918045044, -0.19672951102256775, -0.1365981101989746, 0.1685664802789688, 0.16232620179653168, -0.17076309025287628, 0.0013052970170974731, -0.10554970800876617, -0.28268885612487793, 0.043627724051475525, -0.23438486456871033, -0.15561677515506744, -0.26679372787475586, 0.015271233394742012, -0.20121757686138153, 0.04535309970378876, -0.33287063241004944, 0.0407525971531868, -0.1899546980857849, 0.3805100917816162, 0.36594313383102417, -0.004106886684894562, -0.4409253001213074, -0.18570628762245178, -0.6614765524864197, 0.21573372185230255, -0.13150636851787567, -0.1283676028251648, 0.21142706274986267, 0.20397856831550598, 0.06626047194004059, -0.037849061191082, -0.030719071626663208, -0.1803531050682068, 0.25373339653015137, 0.37092190980911255, 0.06299549341201782, -0.049475591629743576, -0.24363352358341217, -0.3167143762111664, 0.06748935580253601, -0.430189847946167, 0.338339239358902, -0.39672091603279114, -0.06871280074119568, 0.09887946397066116, 0.23482993245124817, -0.3199445605278015, 0.23999114334583282, 0.6963932514190674, 0.38060513138771057, 0.17886658012866974, -0.08828824758529663, -0.2170494943857193, -0.2739618122577667, 0.16009551286697388, -0.18827418982982635, 0.22882702946662903, -0.11228372156620026, 0.4331352710723877, -0.14778760075569153, 0.11189886927604675, -0.22905497252941132, 0.18503588438034058, -0.04645029455423355, -0.056735821068286896, -0.0674976110458374, -0.04833732545375824, -0.004544232040643692, 0.0744660347700119, 0.0734248235821724, 0.4428519308567047, 0.11574968695640564, 0.41858235001564026, -0.19462652504444122, -0.3257076144218445, 0.45590972900390625, -0.2594570815563202, -0.6162012815475464, 0.15928514301776886, 0.29199790954589844, 0.23965629935264587, -0.25190213322639465, -0.29562681913375854, -0.012355774641036987, 0.15429794788360596, -0.04089241474866867, -0.1076558381319046, 0.22024458646774292, -0.4544614255428314, -0.4066638648509979, -0.08461301028728485, 0.32723742723464966, 0.1267111450433731, -0.3212854862213135, 0.18627022206783295, -0.12177833169698715 ]
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
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>
[ -0.2388804703950882, -0.42039424180984497, 0.11454983055591583, 0.013677917420864105, 0.3820091485977173, -0.026951275765895844, -0.09978540241718292, 0.2806102931499481, 0.2809220254421234, 0.42724764347076416, -0.14177918434143066, 0.3004532754421234, 0.17234168946743011, -0.09254340827465057, -0.20135712623596191, 0.1648067981004715, 0.012814372777938843, 0.027215875685214996, -0.46503302454948425, -0.023259803652763367, -0.30321362614631653, -0.019845841452479362, -0.08741754293441772, -0.22614990174770355, 0.029805229976773262, 0.05566719174385071, 0.23480743169784546, 0.048041969537734985, -0.13257582485675812, -0.03899882733821869, 0.025727158412337303, 0.33187803626060486, -0.2694393992424011, 0.7168409824371338, -0.0001257616822840646, -0.24600796401500702, 0.3856589198112488, 0.12560468912124634, 0.07028405368328094, -0.14490459859371185, 0.4119062125682831, -0.23816551268100739, 0.07440546900033951, -0.2535730004310608, 0.21299558877944946, 0.0970379114151001, 0.17317521572113037, -0.2661341726779938, 0.26940834522247314, -0.2111963927745819, 0.0643077865242958, 0.1619422733783722, -0.1921636164188385, -0.02156246267259121, 0.046288128942251205, 0.3041096329689026, 0.005572399124503136, 0.5163283348083496, 0.1856713443994522, -0.2736380994319916, -0.22961297631263733, 0.35308316349983215, -0.23241208493709564, -0.24688448011875153, 0.44899415969848633, -0.023223359137773514, 0.2293471097946167, -0.14012391865253448, 0.450479656457901, 0.24075055122375488, -0.05068720132112503, -0.05832003802061081, -0.20002377033233643, -0.2391187846660614, -0.08658820390701294, -0.20893920958042145, 0.158798485994339, 0.076323963701725, -0.2498103529214859, -0.13516537845134735, -0.589224100112915, -0.20159725844860077, 0.1903139054775238, 0.011416729539632797, -0.4154917001724243, -0.11164240539073944, -0.11775729060173035, 0.2734394967556, 0.4124734401702881, -0.20074571669101715, -0.43840664625167847, -0.0484187975525856, 0.29575470089912415, 0.16494159400463104, -0.2238069623708725, 0.1342388540506363, 0.24506279826164246, -0.20668789744377136, 0.19873002171516418, 0.029519882053136826, -0.3274613320827484, 0.20284652709960938, -0.1723250448703766, 0.11157113313674927, 0.2877354323863983, 0.2299201786518097, -0.07176683098077774, 0.16607190668582916, 0.4792513847351074, 0.24024450778961182, -0.12510834634304047, 0.07817891240119934, 0.34749460220336914, -0.2629399299621582, 0.20621512830257416, -0.19157558679580688, 0.08132008463144302, -0.3271124064922333, -0.08810865134000778, 0.2338065356016159, -0.02311709336936474, 0.1665746122598648, 0.0541432723402977, 0.26647984981536865, 0.28801655769348145, 0.03394828364253044, 0.05194912105798721, 0.11398106813430786, -0.30280810594558716, 0.2608893811702728, 0.023673804476857185, -0.1403404027223587, -0.3892468512058258, 0.21316266059875488, 0.007915191352367401, -0.11985050141811371, 0.04438326507806778, 0.15219847857952118, 0.07513782382011414, -0.17251800000667572, -0.007029242813587189, -0.15144793689250946, 0.28983935713768005, 0.31175920367240906, -0.2254585176706314, 0.40087464451789856, -0.02229120209813118, -0.031029824167490005, -0.2700267732143402, 0.08179167658090591, 0.022208355367183685, -0.02402842789888382, 0.20523898303508759, 0.015945443883538246, -0.13217301666736603, 0.2970324754714966, -0.059470243752002716, 0.18673139810562134, 0.3860650956630707, -0.24491482973098755, 0.03056919574737549, -0.15452414751052856, -0.3442258834838867, -0.12373950332403183, 0.2280447781085968, 0.5708963871002197, -0.07920300960540771, 0.06152220070362091, 0.03908877074718475, 0.10825614631175995, 0.2775461673736572, 0.32453787326812744, 0.0911373570561409, 0.1843341886997223, -0.2951490581035614, 0.029287241399288177, -0.30308666825294495, -0.16072231531143188, -0.4697611331939697, 0.4938769042491913, -0.5575812458992004, 0.203892782330513, 0.02161066234111786, 0.06717279553413391, -0.02055305801331997, -0.06775475293397903, 0.42178577184677124, 0.11313401162624359, -0.04053343087434769, 0.06422069668769836, -0.115497887134552, -0.15403740108013153, 0.137740820646286, 0.21668770909309387, 0.24219581484794617, -0.030807964503765106, 0.23239031434059143, -0.3148108124732971, 0.0743972584605217, -0.09870047867298126, 0.11744342744350433, 0.22700992226600647, 0.017411790788173676, 0.1518639326095581, 0.013074265792965889, -0.5110952258110046, -0.4240115284919739, 0.12463059276342392, 0.05850869417190552, 0.020973820239305496, -0.3666144609451294, -0.2333809733390808, -0.318918913602829, -0.06761816143989563, -0.03722725436091423, 0.27504587173461914, -0.12419392168521881, 0.02847849577665329, -0.1573118269443512, 0.12788619101047516, -0.03772396594285965, -0.18904858827590942, -0.06251081079244614, 0.23099084198474884, -0.6582083106040955, 0.152180016040802, 0.23641648888587952, -0.2917603552341461, -0.031077001243829727, 0.23493489623069763, 0.17350973188877106, -0.3071972131729126, -0.08042354881763458, 0.303044855594635, -0.16496101021766663, 0.2505462169647217, -0.05314791202545166, 0.41233396530151367, 0.09876055270433426, 0.1920226514339447, -0.04778430610895157, 0.21650639176368713, 0.10364970564842224, -0.37129756808280945, -0.16018351912498474, 0.31123095750808716, -0.23095862567424774, 0.4938899278640747, -0.1795552670955658, -0.018198711797595024, 0.057181984186172485, -0.03867245465517044, -0.33655115962028503, -0.1715606451034546, 0.4729599952697754, 0.2662582993507385, -0.02222106233239174, 0.052158523350954056, 0.1236138641834259, -0.040628619492053986, 0.45399346947669983, -0.35915595293045044, -0.05735056847333908, 0.15214717388153076, -0.037039414048194885, 0.13274547457695007, 0.07663054764270782, -0.22056810557842255, 0.328664094209671, 0.0495850034058094, 0.0890142023563385, 0.25696948170661926, 0.06748668104410172, -0.041223153471946716, 0.03859096020460129, 0.15688329935073853, 0.0524555929005146, 0.15206317603588104, 0.06971358507871628, 0.07846195250749588, -0.2890482544898987, -0.2303764671087265, -0.09772747755050659, 0.26063987612724304, -0.2403760403394699, -0.10018187016248703, -0.2927587628364563, 0.3055817782878876, -0.10294516384601593, 0.22796191275119781, -0.36109933257102966, -0.47942960262298584, -0.3381495475769043, 0.3350684344768524, -0.2742214500904083, 0.20275017619132996, 0.20204828679561615, 0.008992314338684082, -0.010444644838571548, -0.11006764322519302, -0.14648383855819702, -0.08160876482725143, -0.0197611041367054, -0.3132166862487793, 0.4684447646141052, -0.32853826880455017, 0.30248501896858215, -0.006483949720859528, -0.14062291383743286, -0.04586349427700043, -0.38114115595817566, -0.018194951117038727, 0.007683422416448593, 0.15184970200061798, 0.13487578928470612, 0.19577786326408386, -0.17469263076782227, 0.02922739088535309, 0.22800767421722412, -0.18603846430778503, -0.07460442185401917, 0.08755339682102203, 0.05278673395514488, 0.06101684644818306, -0.2449713796377182, -0.028351642191410065, 0.16690614819526672, -0.3009679913520813, 0.6349738836288452, -0.5413115620613098, 0.19146476686000824, 0.10177956521511078, -0.18995659053325653, -0.06051838397979736, -0.35687318444252014, -0.0874604806303978, -0.11918392777442932, -0.09153549373149872, 0.24307221174240112, 0.018023265525698662, -0.09907510876655579, -0.07739739865064621, 0.11826808750629425, -0.33912336826324463, 0.4203845262527466, -0.3586285710334778, 0.0036464473232626915, -0.6129180788993835, 0.4145774841308594, -0.36235424876213074, 0.5213751196861267, 0.24066758155822754, 0.052110008895397186, -0.06067921966314316, 0.11904842406511307, -0.22991396486759186, 0.11621695011854172, 0.018999025225639343, -0.3164730668067932, 0.07239852845668793, 0.3815532326698303, 0.2155793011188507, 0.3912976384162903, 0.23783725500106812, 0.017702165991067886, 0.06952623277902603, 0.03549274429678917, 0.2525549829006195, -0.4628985822200775, -0.4772782623767853, -0.02210560441017151, -0.07348829507827759, -0.16659045219421387, 0.11811284720897675, 0.07371124625205994, 0.035981737077236176, 0.06487447023391724, -0.16818158328533173, -0.21392780542373657, -0.459059476852417, 0.15326954424381256, -0.020726673305034637, 0.010972298681735992, 0.1157359629869461, 0.3245413303375244, -0.20322851836681366, -0.1725568175315857, 0.22188571095466614, 0.2305416315793991, 0.09045781940221786, -0.1450119912624359, -0.6466354727745056, -0.11341898143291473, -0.5839853882789612, 0.3120260536670685, -0.09698426723480225, 0.03854341059923172, -0.1606910675764084, 0.11498764902353287, 0.17899444699287415, -0.16795040667057037, 0.7110092043876648, -0.05402546375989914, 0.25112754106521606, -0.08594174683094025, -0.3230152428150177, -0.43349647521972656, 0.169632688164711, 0.043355051428079605, 0.651696503162384, 0.3352051079273224, 0.9209738969802856, -0.5595276951789856, 0.09841692447662354, 0.23311308026313782, 0.1075611263513565, -0.05370836332440376, -0.48272863030433655, -0.16164885461330414, -0.340710312128067, 0.017573541030287743, 0.03870431333780289, 0.07834134250879288, 0.1757803112268448, 0.03529413044452667, -0.26659682393074036, 0.08844098448753357, -0.004208652302622795, 0.32376110553741455, -0.1250266134738922, 0.032294005155563354, 0.3541364073753357, 0.2597753405570984, 0.19551415741443634, 0.12716512382030487, 0.028859039768576622, 0.3350772559642792, 0.3258299231529236, 0.0645514726638794, 0.02420136332511902, -0.008666373789310455, 0.4252777397632599, 0.5220961570739746, 0.26267099380493164, 0.09232426434755325, 0.0022421106696128845, 0.3612261414527893, -0.4305432140827179, -0.01932058483362198, 0.08422897011041641, 0.25744399428367615, 0.005420882720500231, -0.12321852147579193, 0.45183753967285156, 0.1161847859621048, -0.1984427124261856, 0.5560110807418823, 0.05901723355054855, -0.24077939987182617, 0.1654711216688156, -0.022777020931243896, 1.0856157541275024, -0.32582640647888184, 0.01687362790107727, 0.1473166048526764, -0.20329861342906952, 0.29720500111579895, -0.15487335622310638, -0.11433082818984985, -0.24449476599693298, -0.22063329815864563, 0.23241598904132843, -0.004680652171373367, 0.23912128806114197, -0.1434376984834671, 0.05808253958821297, 0.2643987238407135, -0.07180646806955338, 0.16438698768615723, 0.05966673791408539, 0.12828129529953003, -0.18527597188949585, -0.5459385514259338, -0.1653936803340912, -0.10275962203741074, -0.0464465394616127, 0.15883874893188477, 0.026181135326623917, 0.061127420514822006, -0.07266847789287567, 0.08410362899303436, 0.01373688131570816, -0.03083033487200737, -0.05427723005414009, -0.06448326259851456, -0.216745525598526, 0.08868405222892761, -0.010880742222070694, 0.003827366977930069, -0.13319291174411774, 0.49164921045303345, -0.07399116456508636, 0.03424714505672455, 0.02643212303519249, 0.15796875953674316, 0.1594584882259369, -0.11559496074914932, -0.024185853078961372, 0.06242532283067703, -0.20603711903095245, -0.32834067940711975, 0.02239152416586876, 0.1384766846895218, -0.1543620079755783, -0.13176055252552032, -0.04287233203649521, -0.22770656645298004, -0.127167746424675, -0.02435094118118286, 0.1837126612663269, -0.11008132994174957, -0.058499645441770554, 0.18449360132217407, -0.24122537672519684, 0.3735998570919037, -0.08822797238826752, -0.3953043520450592, -0.10393127799034119, 0.6344955563545227, 0.010421240702271461, -0.23700828850269318, 0.7087689638137817, -0.07702738046646118, -0.05710790306329727, -0.16444744169712067, 0.3385883867740631, 0.5586374402046204, -0.24462753534317017, 0.2147832214832306, -0.25088414549827576, 0.011680588126182556, -0.10829354077577591, 0.08876349776983261, 0.1030031368136406, -0.5223098993301392, -0.10934846103191376, -0.5039831399917603, -0.43715840578079224, 0.05081131309270859, 0.3166467547416687, 0.15294015407562256, -0.21891170740127563, -0.08608657121658325, -0.23076042532920837, 0.18432340025901794, -0.13626918196678162, 0.0054397243075072765, -0.03928036615252495, 0.2209508866071701, 0.19502782821655273, -0.1933629810810089, -0.03922705724835396, -0.20526933670043945, 0.03739862143993378, 0.27980536222457886, -0.25010886788368225, -0.03600415214896202, -0.0393863283097744, 0.21950197219848633, -0.25278082489967346, -0.17280606925487518, 0.3825647234916687, -0.2839566469192505, -0.14871740341186523, -0.4645366668701172, 0.21011117100715637, 0.2932010293006897, -0.07075804471969604, -0.11504863202571869, -0.014532539993524551, 0.32089659571647644, 0.16738778352737427, 0.24592076241970062, -0.06628371775150299, 0.04054572805762291, -0.14622949063777924, 0.10256931930780411, -0.05880509316921234, -0.11613259464502335, -0.3286270201206207, 0.019978322088718414, 0.31452351808547974, 0.06399017572402954, 0.3035332262516022, -0.18932116031646729, -0.2217317819595337, 0.37511879205703735, 0.5794053077697754, 0.3862801790237427, -0.27660295367240906, -0.24566514790058136, 0.161533385515213, 0.03528733551502228, -0.06660771369934082, 0.23094059526920319, 0.5689195394515991, 0.07470627129077911, 0.035043854266405106, 0.17986083030700684, 0.021952573210000992, -0.14437070488929749, -0.2576485872268677, -0.19037574529647827, 0.14818549156188965, 0.07130442559719086, 0.0472169928252697, 0.21345387399196625, 0.16395694017410278, 0.06114104390144348, 0.33889833092689514, 0.28907209634780884, 0.08657233417034149, 0.46671026945114136, 0.36833521723747253, 0.3922783136367798, -0.17793506383895874, 0.45053398609161377, -0.1657322645187378, -0.6048744916915894, 0.05006133019924164, 0.5202895402908325, 0.0029046088457107544, 0.21429744362831116, 0.1338866949081421, 0.38823968172073364, -0.3346572518348694, -0.4425603449344635, -0.21835723519325256, 0.2409757524728775, -0.3484090268611908, -0.2405196577310562, -0.12771075963974, -0.16644859313964844, -0.19621485471725464, 0.20828908681869507, 0.028466826304793358, -0.01391419768333435, 0.583320140838623, -0.05597786605358124, 0.07471874356269836, -0.16509927809238434, -0.13108599185943604, -0.15083172917366028, 0.5593532919883728, -0.4249300956726074, -0.05827359855175018, 0.0850893035531044, 0.2014937549829483, 0.005659814924001694, 0.09891659021377563, 0.22191683948040009, 0.5954396724700928, -0.34415534138679504, 0.1737135797739029, 0.007833249866962433, 0.0002800002694129944, -0.07336442917585373, 0.3781742453575134, -0.023917175829410553, 0.4306616187095642, 0.35236334800720215, -0.0769110918045044, -0.19672951102256775, -0.1365981101989746, 0.1685664802789688, 0.16232620179653168, -0.17076309025287628, 0.0013052970170974731, -0.10554970800876617, -0.28268885612487793, 0.043627724051475525, -0.23438486456871033, -0.15561677515506744, -0.26679372787475586, 0.015271233394742012, -0.20121757686138153, 0.04535309970378876, -0.33287063241004944, 0.0407525971531868, -0.1899546980857849, 0.3805100917816162, 0.36594313383102417, -0.004106886684894562, -0.4409253001213074, -0.18570628762245178, -0.6614765524864197, 0.21573372185230255, -0.13150636851787567, -0.1283676028251648, 0.21142706274986267, 0.20397856831550598, 0.06626047194004059, -0.037849061191082, -0.030719071626663208, -0.1803531050682068, 0.25373339653015137, 0.37092190980911255, 0.06299549341201782, -0.049475591629743576, -0.24363352358341217, -0.3167143762111664, 0.06748935580253601, -0.430189847946167, 0.338339239358902, -0.39672091603279114, -0.06871280074119568, 0.09887946397066116, 0.23482993245124817, -0.3199445605278015, 0.23999114334583282, 0.6963932514190674, 0.38060513138771057, 0.17886658012866974, -0.08828824758529663, -0.2170494943857193, -0.2739618122577667, 0.16009551286697388, -0.18827418982982635, 0.22882702946662903, -0.11228372156620026, 0.4331352710723877, -0.14778760075569153, 0.11189886927604675, -0.22905497252941132, 0.18503588438034058, -0.04645029455423355, -0.056735821068286896, -0.0674976110458374, -0.04833732545375824, -0.004544232040643692, 0.0744660347700119, 0.0734248235821724, 0.4428519308567047, 0.11574968695640564, 0.41858235001564026, -0.19462652504444122, -0.3257076144218445, 0.45590972900390625, -0.2594570815563202, -0.6162012815475464, 0.15928514301776886, 0.29199790954589844, 0.23965629935264587, -0.25190213322639465, -0.29562681913375854, -0.012355774641036987, 0.15429794788360596, -0.04089241474866867, -0.1076558381319046, 0.22024458646774292, -0.4544614255428314, -0.4066638648509979, -0.08461301028728485, 0.32723742723464966, 0.1267111450433731, -0.3212854862213135, 0.18627022206783295, -0.12177833169698715 ]
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
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`.
[ -0.23908647894859314, 0.018336161971092224, -0.09103678166866302, 0.46061939001083374, 0.4076109528541565, -0.08961306512355804, 0.20931801199913025, 0.24716612696647644, -0.10778580605983734, 0.07141643762588501, -0.3074873387813568, 0.444944828748703, -0.031737372279167175, -0.10553357750177383, 0.08245260268449783, -0.16889412701129913, 0.012422151863574982, 0.10818745940923691, 0.10719926655292511, 0.2047395557165146, -0.41087812185287476, 0.3405347466468811, -0.3375338912010193, 0.14304116368293762, -0.27381083369255066, -0.013408301398158073, 0.04840143769979477, 0.3472684919834137, -0.39484283328056335, -0.43051013350486755, 0.13972745835781097, 0.04713490977883339, 0.14381057024002075, 0.6482419967651367, -0.00010467147512827069, 0.1015232652425766, 0.3086015582084656, -0.11870793998241425, -0.3150549530982971, -0.33766651153564453, -0.4682979881763458, -0.07509230077266693, 0.07213491201400757, 0.021704889833927155, -0.03742546960711479, -0.35644569993019104, -0.32888874411582947, -0.39606979489326477, 0.4451805353164673, 0.4218822419643402, 0.3180524706840515, 0.005983108654618263, 0.0871640294790268, -0.20945411920547485, 0.27995508909225464, 0.10818701982498169, 0.078966423869133, 0.43559134006500244, 0.3161969780921936, -0.019603777676820755, 0.08895082026720047, 0.2199416309595108, -0.18228040635585785, 0.0996411144733429, 0.2705102264881134, -0.06575943529605865, -0.006434544920921326, -0.10531973838806152, 0.26442810893058777, 0.10778398811817169, 0.7009297609329224, -0.23771506547927856, -0.3620319068431854, -0.13650816679000854, 0.19188956916332245, -0.15531723201274872, 0.10021160542964935, 0.10296878218650818, -0.1614106446504593, 0.1593542993068695, -0.024992454797029495, -0.15759395062923431, -0.022637981921434402, 0.15278351306915283, 0.12488137185573578, -0.05604077875614166, -0.1585044115781784, -0.006355516612529755, 0.28608089685440063, -0.22656024992465973, -0.005088282749056816, 0.028080876916646957, -0.21090084314346313, 0.28104904294013977, -0.3969959318637848, 0.26095718145370483, -0.11122163385152817, -0.05755063146352768, 0.16622012853622437, 0.13252821564674377, 0.29928645491600037, 0.11031221598386765, -0.005434890277683735, 0.19590914249420166, 0.328250914812088, 0.02943718060851097, -0.03840171545743942, 0.05460456758737564, 0.2994062900543213, 0.18826967477798462, 0.03505052998661995, -0.11894143372774124, -0.3040357232093811, -0.3190101981163025, 0.023129917681217194, -0.022986970841884613, 0.45090198516845703, -0.2980594038963318, -0.3592699468135834, -0.011655122973024845, -0.07863666117191315, 0.00007271533831954002, 0.12120187282562256, 0.3965093791484833, 0.12178725004196167, 0.28586533665657043, 0.15632674098014832, 0.3789721727371216, -0.04728670045733452, 0.045345768332481384, -0.1930527240037918, -0.06428411602973938, -0.14035741984844208, -0.04131179302930832, 0.3622893691062927, -0.47906678915023804, 0.3036399185657501, 0.22420546412467957, 0.08447879552841187, -0.3746757209300995, 0.04036819934844971, -0.12645632028579712, -0.15209966897964478, 0.28758734464645386, -0.06751890480518341, 0.07290302217006683, 0.09305264055728912, -0.16221365332603455, 0.020006656646728516, 0.19150057435035706, -0.42052051424980164, -0.32257893681526184, -0.18253792822360992, 0.3548935055732727, -0.14702960848808289, 0.25274354219436646, -0.5352616310119629, -0.048227179795503616, 0.10432032495737076, -0.36851754784584045, -0.11072926968336105, -0.06903426349163055, -0.15861940383911133, -0.13462117314338684, 0.3581816256046295, 0.4056004285812378, -0.25592681765556335, -0.015859607607126236, -0.003922442905604839, -0.12621192634105682, 0.03165368735790253, 0.22537067532539368, -0.2639251947402954, 0.10733719915151596, -0.37277907133102417, -0.03664613887667656, 0.4244031012058258, -0.24477632343769073, -0.4256885349750519, 0.08922229707241058, -0.1383988857269287, 0.13270817697048187, -0.037528567016124725, -0.21597561240196228, 0.060789816081523895, -0.02765629068017006, 0.3771817088127136, 0.224394291639328, 0.1463887244462967, 0.268353670835495, -0.1662885546684265, -0.034462008625268936, 0.0004219524562358856, 0.3315260112285614, -0.17586994171142578, 0.05823438614606857, 0.12055276334285736, 0.11119767278432846, 0.15415039658546448, 0.0384071059525013, -0.10710631310939789, 0.11770837008953094, 0.005151461809873581, 0.019170306622982025, 0.0989798828959465, -0.16250354051589966, -0.18615832924842834, 0.08177042007446289, -0.040168099105358124, 0.042743980884552, -0.4282330274581909, -0.17601703107357025, -0.48320797085762024, 0.1549779176712036, -0.44244834780693054, -0.05318586155772209, 0.22108641266822815, 0.17999975383281708, -0.11801989376544952, 0.1764911413192749, -0.11709190905094147, 0.25277408957481384, 0.09956714510917664, -0.012792705558240414, -0.3096618950366974, 0.06558844447135925, -0.0929180234670639, 0.026525352150201797, 0.26722484827041626, 0.28454792499542236, 0.369063138961792, -0.07268931716680527, -0.2688261866569519, 0.5382429957389832, 0.2407965064048767, 0.0734364464879036, -0.14502039551734924, -0.1417890042066574, 0.09339193999767303, -0.26159825921058655, 0.00978936068713665, 0.12999165058135986, 0.30001509189605713, -0.09758630394935608, -0.08111193031072617, 0.28974649310112, -0.22234557569026947, 0.06165528669953346, -0.012172799557447433, -0.14692160487174988, 0.3755322992801666, 0.23296397924423218, -0.039453618228435516, -0.006870385259389877, 0.16447800397872925, 0.1692223846912384, 0.21935810148715973, 0.12614384293556213, -0.02816300094127655, -0.24172136187553406, 0.14220571517944336, -0.11120137572288513, 0.0343303382396698, 0.05627613887190819, -0.17792391777038574, -0.21490007638931274, 0.019543804228305817, 0.1960124522447586, 0.46652454137802124, 0.15615707635879517, -0.15264059603214264, -0.025598710402846336, 0.1490904986858368, -0.2366381138563156, 0.29029956459999084, 0.09267235547304153, 0.17193971574306488, 0.4953905940055847, 0.1385003924369812, -0.04276673495769501, -0.2816161513328552, -0.20489783585071564, 0.13640567660331726, 0.39687278866767883, -0.48600518703460693, -0.0942981168627739, -0.3528728783130646, -0.21411743760108948, 0.04389846324920654, -0.20193302631378174, -0.11580356955528259, -0.18880495429039001, 0.023768160492181778, 0.1707744300365448, -0.024802040308713913, 0.10398206114768982, -0.09917078912258148, 0.29977869987487793, 0.11199831962585449, -0.059528008103370667, -0.1014847680926323, -0.045574773102998734, -0.030992895364761353, 0.15188956260681152, 0.49080973863601685, 0.1919812709093094, 0.28280264139175415, -0.24197599291801453, 0.062100850045681, -0.016196878626942635, 0.2267620861530304, 0.030379096046090126, 0.15414410829544067, 0.12345147132873535, 0.06429070979356766, 0.13544416427612305, 0.17493578791618347, -0.17314279079437256, 0.3491283357143402, -0.10245034843683243, -0.10336007177829742, 0.352623850107193, 0.049488384276628494, 0.08198881894350052, -0.2181486040353775, -0.24743002653121948, -0.2785751223564148, -0.5099345445632935, 0.014945253729820251, -0.17626473307609558, -0.05612390488386154, 0.39536499977111816, 0.06910457462072372, 0.2962968647480011, 0.16406063735485077, 0.22700944542884827, -0.30080461502075195, -0.2620135247707367, 0.2285790741443634, -0.15878498554229736, -0.2919732928276062, 0.08248232305049896, 0.1571653038263321, 0.02500319294631481, 0.1081923097372055, -0.2291809469461441, -0.15976759791374207, 0.17915362119674683, 0.09485277533531189, -0.3554459512233734, -0.07324129343032837, 0.06547592580318451, 0.04879005625844002, -0.0917135551571846, -0.20928046107292175, -0.17336460947990417, -0.11927469819784164, -0.2539456784725189, -0.013907432556152344, -0.03872282803058624, 0.4252610206604004, -0.22074979543685913, 0.3719058036804199, 0.006241209805011749, 0.04873936250805855, 0.3738410770893097, -0.09966550022363663, 0.4176066517829895, -0.17730331420898438, -0.2647523581981659, -0.06743113696575165, 0.00975055992603302, -0.008440667763352394, 0.15795668959617615, 0.05890693515539169, 0.03043352998793125, -0.29107779264450073, 0.20024874806404114, -0.20126676559448242, -0.034236840903759, 0.026207124814391136, -0.14101581275463104, 0.16331873834133148, -0.013137590140104294, 0.23609250783920288, 0.1443350613117218, -0.04498075321316719, -0.02847452647984028, 0.3068295121192932, 0.12137950211763382, -0.03807154297828674, -0.26569226384162903, 0.04530337080359459, -0.22088494896888733, 0.3005824685096741, 0.12201951444149017, 0.5353319644927979, -0.14008943736553192, 0.008395705372095108, 0.009703800082206726, -0.12180470675230026, 0.5289769172668457, -0.05339308828115463, 0.16079837083816528, 0.2568376660346985, 0.07392121106386185, -0.3398491144180298, -0.03938573598861694, -0.15823234617710114, 0.2956884503364563, -0.16600465774536133, 0.48953017592430115, -0.19891655445098877, -0.2532890737056732, 0.010928094387054443, 0.1839495450258255, 0.053101006895303726, -0.23366022109985352, -0.33858996629714966, -0.3754463195800781, -0.36634933948516846, -0.09998751431703568, 0.13424985110759735, 0.37062934041023254, -0.2422022521495819, 0.01770668849349022, 0.06470147520303726, 0.26799750328063965, 0.09320928901433945, 0.12767107784748077, 0.5023236274719238, 0.2619607448577881, 0.10281288623809814, 0.3777109384536743, -0.0010111704468727112, 0.3845021426677704, 0.5984041094779968, -0.0202227383852005, -0.2223508656024933, 0.05123468488454819, -0.08030393719673157, -0.11985493451356888, 0.11966317147016525, -0.15941931307315826, -0.013089776039123535, -0.09897048026323318, -0.12039925158023834, -0.13235992193222046, 0.06874346733093262, 0.3295809030532837, -0.06342515349388123, -0.3702996075153351, -0.6057955622673035, 0.24080109596252441, -0.11831091344356537, -0.09192332625389099, 0.20165765285491943, -0.07512833178043365, -0.17650072276592255, 0.24788133800029755, -0.2844577431678772, 0.6320368647575378, -0.04948028177022934, 0.14042319357395172, 0.3282920718193054, -0.21432924270629883, 0.18690286576747894, -0.058918070048093796, -0.06177516281604767, -0.14846564829349518, -0.27995333075523376, 0.06482291966676712, -0.11580121517181396, -0.04016672819852829, 0.0326366126537323, -0.11802393198013306, -0.004670135676860809, 0.015181824564933777, 0.06603135913610458, 0.026647042483091354, 0.25962692499160767, -0.08261407166719437, -0.204321026802063, -0.4769595265388489, 0.27254948019981384, -0.36430823802948, -0.00009958446025848389, -0.1268448382616043, 0.02318750135600567, -0.06362898647785187, -0.20162123441696167, -0.19786754250526428, 0.19515180587768555, -0.31768181920051575, 0.3065720200538635, -0.18934552371501923, -0.4162077307701111, 0.2084418088197708, 0.2294044941663742, -0.2542088031768799, 0.17383572459220886, -0.23187977075576782, 0.12189409136772156, -0.10893649607896805, 0.13688357174396515, -0.13249333202838898, 0.16281619668006897, 0.060241106897592545, -0.01241937093436718, -0.13867107033729553, -0.005428306758403778, -0.1008429229259491, -0.2124934047460556, 0.03516368567943573, 0.08254073560237885, 0.1502542942762375, -0.19416482746601105, -0.4365381598472595, -0.39215055108070374, 0.14093144237995148, -0.2110290229320526, 0.2089644819498062, 0.2674510180950165, -0.18583431839942932, -0.1375158131122589, 0.14175496995449066, -0.25198400020599365, 0.08373747020959854, 0.5094395279884338, -0.26682713627815247, -0.1335306018590927, 0.4956057369709015, 0.09487934410572052, -0.10318765789270401, -0.27992933988571167, 0.3255852162837982, 0.007084932178258896, -0.6049146056175232, 0.1552284210920334, 0.17593207955360413, 0.025987908244132996, -0.024225762113928795, 0.21813727915287018, 0.07657646387815475, -0.15012747049331665, 0.1873067319393158, -0.7153547406196594, -0.2921963632106781, 0.1316712200641632, 0.06122869253158569, 0.17622710764408112, 0.1254795789718628, -0.18918049335479736, 0.0081751998513937, -0.24468672275543213, -0.3715771436691284, 0.26643502712249756, -0.07075861096382141, 0.023067297413945198, 0.05870760977268219, -0.07099921256303787, 0.06103844940662384, -0.18042446672916412, 0.2266876995563507, 0.06493717432022095, -0.20764590799808502, -0.2914344370365143, -0.06474128365516663, 0.08980780094861984, -0.007870137691497803, -0.2539291977882385, -0.12932853400707245, -0.15745964646339417, -0.13143213093280792, -0.08680287003517151, 0.1341465264558792, 0.2161657214164734, -0.003463663160800934, -0.09496933966875076, 0.02594536542892456, 0.06404200941324234, -0.057818446308374405, 0.2776142656803131, -0.009889595210552216, -0.050793230533599854, 0.06899166107177734, 0.06460483372211456, -0.17418722808361053, -0.0203978531062603, -0.21339808404445648, 0.17951005697250366, 0.09185267984867096, 0.09067630767822266, 0.3392993211746216, -0.4668276906013489, 0.2011575847864151, 0.2075110673904419, 0.3983937203884125, 0.4140361249446869, -0.37900400161743164, 0.09429112821817398, 0.10266599804162979, 0.27248793840408325, -0.26378142833709717, -0.12296854704618454, 0.12995049357414246, -0.13501806557178497, -0.11309666931629181, -0.028653167188167572, 0.010874878615140915, -0.17767620086669922, -0.1945585161447525, 0.02446923404932022, 0.517450749874115, 0.19534803926944733, 0.08508406579494476, 0.37498190999031067, -0.06895825266838074, 0.16606435179710388, 0.018234090879559517, -0.025887534022331238, 0.037061579525470734, 0.2744227945804596, -0.33492526412010193, 0.29509392380714417, 0.0964268296957016, 0.0665769875049591, -0.037826791405677795, -0.5749418139457703, -0.0136256143450737, 0.3236892819404602, -0.09369982779026031, 0.15383541584014893, 0.05042656883597374, 0.3930076062679291, -0.3554714620113373, -0.06081255152821541, 0.008264200761914253, -0.11396436393260956, -0.20409095287322998, 0.049602508544921875, -0.17466606199741364, -0.31102076172828674, -0.16502752900123596, 0.1026649922132492, -0.20189186930656433, 0.1370508223772049, -0.08340023458003998, 0.02270791307091713, -0.009883761405944824, -0.29465529322624207, 0.03146842494606972, 0.37832486629486084, -0.007583066821098328, -0.3549835681915283, 0.2014068365097046, 0.23824602365493774, 0.11429604142904282, 0.4330644905567169, 0.20924262702465057, 0.5430936217308044, 0.3356221318244934, -0.037091199308633804, 0.029751267284154892, 0.01685626246035099, 0.009519951418042183, 0.006819313392043114, 0.1845715492963791, 0.3015229105949402, 0.12401138246059418, 0.3453787565231323, 0.2651609182357788, -0.14842866361141205, -0.005534041672945023, 0.35274121165275574, 0.07580142468214035, -0.1243751049041748, -0.017965897917747498, -0.35962435603141785, -0.19874802231788635, -0.12793885171413422, 0.07554404437541962, -0.17933854460716248, -0.033472940325737, 0.17785146832466125, 0.28837770223617554, 0.06463178247213364, -0.1241401806473732, 0.13439349830150604, -0.03988268971443176, 0.4534018039703369, 0.3058522343635559, 0.19527947902679443, -0.11567843705415726, -0.32341277599334717, -0.9951183199882507, 0.17122511565685272, 0.16150398552417755, -0.043064214289188385, 0.17642439901828766, -0.15976382791996002, 0.21938422322273254, 0.19114893674850464, 0.06667350232601166, 0.1358170360326767, 0.14357851445674896, 0.0691954717040062, -0.34282365441322327, -0.3311595022678375, 0.04845128580927849, 0.09558070451021194, -0.09728298336267471, -0.4530349373817444, 0.08220842480659485, -0.11230407655239105, 0.1444709599018097, -0.15078319609165192, -0.052883099764585495, -0.40827664732933044, 0.03617141395807266, 0.33162742853164673, -0.0009887143969535828, 0.3948369026184082, -0.2235533595085144, -0.0227973610162735, -0.16476687788963318, -0.3320009112358093, 0.09061576426029205, 0.33928126096725464, 0.1307038813829422, 0.40948331356048584, 0.111143097281456, -0.07165984809398651, -0.24544821679592133, 0.27561596035957336, -0.14888668060302734, 0.04202541336417198, -0.6106957793235779, 0.09095687419176102, 0.07950543612241745, -0.06044292077422142, -0.07873597741127014, -0.10501591116189957, -0.19704341888427734, 0.0527954176068306, -0.086979940533638, -0.23399220407009125, 0.6291710138320923, -0.268974632024765, -0.2798370122909546, 0.16368038952350616, 0.3373439311981201, -0.07417147606611252, -0.1206086054444313, -0.48834580183029175, 0.32769572734832764, 0.3594091236591339, -0.03601423650979996, -0.3108645975589752, 0.16098031401634216, -0.3389066755771637, 0.017652500420808792, -0.11123216152191162, 0.23967790603637695, 0.06408880650997162, -0.2867429554462433, 0.21122512221336365, -0.33312296867370605 ]
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
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).
[ -0.07166016101837158, 0.4233100414276123, -0.05782254785299301, 0.46117913722991943, 0.17863178253173828, 0.13693565130233765, 0.2276168018579483, 0.3537435531616211, 0.06425751745700836, -0.15938116610050201, 0.18695907294750214, 0.5130404233932495, -0.0992254987359047, 0.10764140635728836, -0.18250375986099243, -0.05177594721317291, 0.1726326197385788, 0.19705402851104736, -0.3572787642478943, 0.13083037734031677, -0.2849862575531006, 0.5683481097221375, -0.161579892039299, 0.008546113967895508, -0.27082452178001404, 0.32366257905960083, -0.15645135939121246, 0.5793684720993042, 0.09783624112606049, -0.23640306293964386, 0.3887108266353607, -0.1627918779850006, 0.40842515230178833, 0.6299086213111877, -0.00011586614709813148, 0.1843457669019699, 0.39381420612335205, -0.0046327486634254456, -0.5326491594314575, -0.7496438026428223, -0.49041807651519775, -0.08178292214870453, 0.10338512063026428, -0.07899045199155807, 0.11047185212373734, 0.07026233524084091, -0.055515676736831665, -0.11248709261417389, 0.3147287964820862, 0.2008712887763977, 0.18514643609523773, 0.2963864207267761, 0.3206372559070587, -0.17133432626724243, 0.3651161789894104, 0.30591702461242676, -0.010106712579727173, 0.24268260598182678, 0.019909925758838654, 0.061060696840286255, 0.23632264137268066, 0.14020442962646484, 0.07367955893278122, -0.10122758150100708, 0.4101997911930084, 0.005013877991586924, 0.14917197823524475, -0.1417725682258606, -0.0625479444861412, 0.22235402464866638, 0.6393240094184875, -0.08249007910490036, -0.43175944685935974, -0.35920408368110657, -0.16818585991859436, 0.07697249203920364, 0.409594863653183, -0.1398058831691742, 0.01738419011235237, 0.15253159403800964, 0.09962078183889389, -0.020225495100021362, -0.03985656052827835, 0.12981389462947845, 0.20992732048034668, 0.25906744599342346, 0.02987568825483322, 0.1487860381603241, 0.12799686193466187, -0.03027670830488205, 0.19002673029899597, -0.1489313393831253, -0.23689725995063782, -0.015421065501868725, -0.12110593914985657, -0.0029929019510746002, 0.04561157897114754, -0.09426385909318924, 0.16608476638793945, 0.13092869520187378, -0.08755145967006683, -0.2797410488128662, -0.18444953858852386, 0.22040271759033203, 0.3529023826122284, -0.09011143445968628, 0.008225373923778534, 0.14441826939582825, 0.30063652992248535, 0.24906396865844727, -0.020213719457387924, 0.001241736114025116, -0.3214774429798126, -0.46832334995269775, -0.2543794810771942, 0.04444319009780884, 0.2256983369588852, -0.054721444845199585, -0.385056734085083, -0.33327534794807434, 0.008867431432008743, -0.2540445029735565, 0.10625318437814713, 0.3617958724498749, 0.11721961945295334, 0.16452372074127197, 0.03919461369514465, 0.21486863493919373, 0.2159087359905243, 0.03940994292497635, -0.2133486419916153, 0.07562164962291718, 0.060469042509794235, -0.08744142949581146, -0.019956566393375397, 0.05056454986333847, 0.5139122009277344, -0.2172343134880066, 0.13556146621704102, 0.04176001250743866, -0.05310443043708801, -0.12069863080978394, -0.0063272565603256226, 0.3141529858112335, -0.017817053943872452, 0.12623895704746246, -0.14793705940246582, -0.1266220510005951, -0.22302162647247314, 0.15455536544322968, -0.6133898496627808, -0.41892218589782715, -0.26790669560432434, 0.12928973138332367, -0.41615569591522217, -0.13249234855175018, -0.23996278643608093, -0.14327546954154968, 0.08270144462585449, -0.4118538796901703, -0.015123657882213593, -0.07187443971633911, -0.2065431922674179, -0.2820952832698822, 0.3870309889316559, 0.3431621789932251, -0.013115417212247849, -0.010952550917863846, -0.013623934239149094, -0.0671703964471817, 0.06728486716747284, 0.045664407312870026, -0.2760359048843384, 0.1576629877090454, -0.5451198220252991, 0.12710152566432953, 0.5557777881622314, -0.5641891956329346, -0.11350426077842712, 0.4859561324119568, -0.1179560124874115, -0.07295268028974533, 0.36226141452789307, -0.17701490223407745, -0.2989148795604706, -0.36853402853012085, 0.19035494327545166, 0.4719107747077942, 0.23874060809612274, -0.12622889876365662, -0.1662958264350891, -0.34327977895736694, 0.18473470211029053, 0.04889031872153282, -0.1635439544916153, -0.08386928588151932, 0.10080193728208542, -0.155645951628685, 0.4314189553260803, -0.19147434830665588, 0.05270099639892578, 0.5052000284194946, 0.32366710901260376, -0.0932760089635849, 0.2649618983268738, -0.03636215999722481, -0.48699963092803955, 0.18004772067070007, -0.06398363411426544, -0.5076833367347717, -0.038289874792099, 0.013434741646051407, -0.2136256992816925, -0.127360001206398, -0.41229987144470215, -0.23561760783195496, 0.053040795028209686, 0.16202904284000397, 0.13619163632392883, -0.0853489339351654, -0.23589974641799927, 0.026986639946699142, 0.03884141892194748, 0.0056412313133478165, -0.21812507510185242, 0.4173922836780548, -0.024314334616065025, -0.1587792932987213, 0.04376649856567383, 0.48996371030807495, 0.13353702425956726, -0.1707555055618286, -0.06494376808404922, 0.34472352266311646, 0.056974802166223526, 0.43458056449890137, 0.1707106977701187, 0.08862664550542831, -0.16503961384296417, 0.021123800426721573, -0.21361792087554932, 0.12886150181293488, 0.12071561813354492, 0.02063780277967453, -0.13798943161964417, 0.06585822254419327, -0.2941223978996277, 0.37590888142585754, 0.21752820909023285, -0.15010873973369598, 0.33597496151924133, -0.15696506202220917, -0.09666761755943298, -0.020674660801887512, 0.031189585104584694, 0.1377377212047577, 0.34102657437324524, 0.26297834515571594, -0.2004832625389099, -0.007896758615970612, 0.45631206035614014, 0.042707789689302444, -0.029071398079395294, 0.09256041049957275, -0.29268544912338257, -0.09919161349534988, -0.18736493587493896, 0.5712782740592957, 0.6106808185577393, 0.1874045729637146, 0.22141151130199432, -0.004475697875022888, 0.07902606576681137, -0.27626582980155945, 0.27619943022727966, -0.027653127908706665, 0.3879289925098419, 0.42242690920829773, 0.2899951934814453, 0.1942475438117981, -0.07468459755182266, -0.25798845291137695, -0.004274650476872921, 0.05890699476003647, -0.42322099208831787, 0.0652494877576828, -0.27658963203430176, -0.2917947769165039, -0.2089691162109375, -0.10842818766832352, -0.05500460043549538, -0.21339216828346252, -0.18580439686775208, 0.26103338599205017, -0.15350954234600067, 0.09515631198883057, -0.08697301149368286, -0.10973431169986725, -0.054955050349235535, -0.5429365634918213, -0.14255264401435852, 0.13944938778877258, -0.25987082719802856, -0.0019459910690784454, 0.3358934819698334, -0.10906387865543365, -0.05411618947982788, -0.37506169080734253, -0.0050295265391469, -0.18959584832191467, -0.2553642988204956, -0.01647087186574936, 0.0922558456659317, 0.21243257820606232, 0.47888121008872986, -0.030544787645339966, 0.23223941028118134, -0.2500702142715454, 0.16760703921318054, 0.1295764446258545, -0.12865673005580902, 0.12477034330368042, -0.18468613922595978, 0.07643914222717285, -0.22882603108882904, -0.41700634360313416, -0.05607780069112778, -0.4589703679084778, 0.2529417872428894, 0.06759046018123627, 0.04571711644530296, 0.25484636425971985, 0.18569093942642212, 0.3176504671573639, -0.15854819118976593, 0.09637781977653503, 0.033341702073812485, -0.5272009968757629, 0.5637418627738953, -0.09236416965723038, -0.235589399933815, 0.23646283149719238, -0.24456052482128143, 0.32091566920280457, -0.2312009632587433, -0.3780796527862549, -0.22538314759731293, -0.09419231116771698, 0.29104912281036377, -0.07539674639701843, 0.06345658004283905, 0.17089134454727173, -0.053839076310396194, -0.03157886117696762, -0.29346391558647156, -0.18197989463806152, 0.2146526277065277, 0.30569925904273987, 0.3900769352912903, 0.06318165361881256, 0.29594236612319946, -0.032499730587005615, 0.440254807472229, 0.21825596690177917, 0.08043405413627625, 0.3610047698020935, -0.1891251802444458, 0.44588831067085266, -0.18452653288841248, -0.031838320195674896, 0.004183805547654629, 0.09472714364528656, 0.034508660435676575, -0.07551455497741699, 0.2290358543395996, 0.0891144871711731, -0.22595563530921936, -0.24367696046829224, -0.17283308506011963, 0.022202450782060623, 0.07209134846925735, -0.2765551507472992, 0.14093247056007385, 0.004397597163915634, -0.120867520570755, 0.1039358377456665, -0.06414514780044556, 0.13319194316864014, 0.39902329444885254, 0.3512890934944153, 0.11269247531890869, -0.21379414200782776, -0.22677718102931976, -0.09643977135419846, -0.0032976865768432617, -0.06155252456665039, 0.4006943106651306, -0.12468457221984863, -0.15610277652740479, -0.18496151268482208, -0.1496388018131256, 0.6990509629249573, -0.20303355157375336, 0.14097844064235687, 0.11583888530731201, 0.10975639522075653, -0.37589073181152344, -0.1470094919204712, 0.1839398741722107, 0.14995600283145905, 0.2182978093624115, 0.7471991777420044, -0.13157367706298828, -0.2201434075832367, 0.2226838320493698, 0.3697747588157654, 0.04301418736577034, -0.2832377254962921, -0.42906853556632996, -0.15225443243980408, -0.29230886697769165, -0.3876062333583832, 0.06503545492887497, 0.2845795154571533, -0.02870693989098072, -0.2164629101753235, 0.1477937400341034, -0.2994268536567688, -0.1307665854692459, -0.08300013840198517, 0.4332217574119568, -0.03861301392316818, 0.21619373559951782, 0.30991238355636597, 0.1531296968460083, 0.28055089712142944, 0.5915568470954895, -0.11217035353183746, -0.40296778082847595, -0.013032149523496628, -0.33191242814064026, 0.3987741768360138, 0.09043970704078674, -0.4451468884944916, 0.10191534459590912, -0.1904146373271942, -0.16474753618240356, -0.08082008361816406, -0.12332800775766373, 0.4558667540550232, -0.10753326863050461, -0.11438380181789398, -0.4297221302986145, 0.17820049822330475, 0.19282270967960358, 0.062343254685401917, 0.14153450727462769, -0.3788335919380188, -0.4047401249408722, 0.08387011289596558, -0.3653925359249115, 0.5086005330085754, 0.4198867678642273, 0.08733981102705002, 0.45942437648773193, -0.4138631224632263, 0.3546372652053833, 0.11200235784053802, 0.02651963010430336, -0.2777983546257019, 0.0864349976181984, 0.008044889196753502, -0.2994372248649597, 0.019487064331769943, 0.005362372845411301, -0.00853348895907402, 0.3056119978427887, -0.14168785512447357, 0.3304324746131897, -0.01910441927611828, 0.22520801424980164, 0.008565873838961124, 0.012722518295049667, -0.1216835230588913, -0.022715134546160698, 0.20721003413200378, -0.005758136510848999, 0.02512001246213913, -0.3891599178314209, -0.11340296268463135, -0.4567447304725647, -0.07171425968408585, 0.15757369995117188, -0.21048977971076965, 0.08957577496767044, 0.43852299451828003, -0.4620351195335388, 0.14612312614917755, 0.503097414970398, 0.09085337072610855, -0.23682163655757904, -0.3071427047252655, 0.17933756113052368, -0.2725568413734436, 0.30825743079185486, -0.03652593120932579, -0.10577185451984406, 0.05131201446056366, -0.13242805004119873, 0.010417483747005463, -0.03708335757255554, -0.4618838429450989, -0.38867032527923584, -0.006957933306694031, 0.09044773876667023, -0.04420164227485657, 0.018307892605662346, -0.35051825642585754, 0.0332229882478714, 0.1129896491765976, -0.353586882352829, 0.11585989594459534, 0.1477406620979309, -0.2027478963136673, -0.056212492287158966, -0.08335673809051514, -0.3307764232158661, 0.01624409854412079, 0.28769466280937195, -0.32955682277679443, 0.22707673907279968, 0.6590533256530762, 0.038496728986501694, 0.019811470061540604, -0.11453007906675339, 0.4269591271877289, 0.25983160734176636, -0.23236852884292603, -0.03801114857196808, 0.1265234649181366, 0.10255958139896393, -0.024148717522621155, 0.1045634001493454, 0.04831860587000847, -0.03872077167034149, -0.016679704189300537, -0.6765839457511902, -0.149325892329216, 0.20279212296009064, -0.052472073584795, -0.08164045214653015, -0.10060200095176697, -0.09960582852363586, 0.09250977635383606, -0.2424619197845459, -0.21872541308403015, 0.21640460193157196, -0.03636348620057106, -0.04157605767250061, -0.11127947270870209, 0.27724114060401917, 0.291134774684906, -0.0006002141162753105, 0.06198027729988098, -0.25785398483276367, -0.04633127897977829, -0.0965847447514534, -0.22210857272148132, 0.12517611682415009, -0.017726995050907135, 0.20910672843456268, -0.05285309627652168, -0.3490634560585022, -0.2158888876438141, -0.06437847018241882, -0.09078192710876465, -0.1282086968421936, -0.10170075297355652, 0.15325748920440674, -0.12882104516029358, -0.0197041854262352, -0.0239233560860157, 0.07173626124858856, -0.2935449182987213, 0.1659913957118988, 0.15790517628192902, 0.36705780029296875, -0.10373668372631073, 0.050598591566085815, 0.0655723363161087, -0.2539750635623932, -0.5065341591835022, 0.2513410747051239, 0.2297966182231903, -0.3746277689933777, 0.12163206934928894, 0.011710366234183311, 0.21242298185825348, 0.3804813623428345, -0.37661415338516235, 0.2685858905315399, 0.10562671720981598, 0.12607285380363464, -0.2097633183002472, -0.1728615015745163, 0.12144680321216583, 0.15917403995990753, 0.0035615749657154083, -0.015213094651699066, 0.2119346261024475, -0.244233638048172, -0.12734325230121613, 0.24527600407600403, 0.39862579107284546, 0.14372213184833527, 0.32427141070365906, 0.5455829501152039, -0.008725088089704514, 0.27941781282424927, -0.09198611229658127, 0.1639554351568222, 0.16895468533039093, 0.5386072397232056, 0.04339383542537689, 0.2609054744243622, 0.2376042604446411, 0.07543806731700897, -0.01652560383081436, -0.40959158539772034, 0.17301905155181885, 0.06604950875043869, 0.20280951261520386, -0.2600768506526947, -0.04993920028209686, 0.31549203395843506, -0.25971975922584534, 0.23784363269805908, 0.10369076579809189, -0.12720705568790436, -0.10556616634130478, -0.2698213458061218, -0.029397450387477875, -0.35796475410461426, 0.020960338413715363, 0.009597044438123703, -0.008923429995775223, -0.060065217316150665, -0.08960936963558197, -0.10676130652427673, -0.04432784020900726, -0.3732776343822479, 0.3618195354938507, 0.17284739017486572, -0.12152764946222305, -0.3939566910266876, 0.35569924116134644, 0.09304996579885483, -0.04757280647754669, 0.22351711988449097, 0.02814577706158161, 0.5923491716384888, 0.3908628523349762, 0.11283667385578156, -0.26357969641685486, -0.2291930615901947, -0.06812191754579544, -0.1585690975189209, 0.25546541810035706, -0.10604821145534515, 0.03143690526485443, 0.3855407238006592, 0.1383715569972992, -0.03940460830926895, 0.20080086588859558, 0.13796879351139069, 0.19632841646671295, -0.4275871515274048, 0.45355814695358276, -0.4129598140716553, -0.13797390460968018, 0.1766762137413025, 0.16711078584194183, -0.30342230200767517, -0.14142721891403198, 0.4055459201335907, 0.24491693079471588, 0.1746276319026947, 0.08111683279275894, 0.07202405482530594, 0.0732189267873764, 0.30455464124679565, 0.2822575867176056, 0.049666084349155426, -0.17177581787109375, -0.1999151110649109, -0.48491528630256653, 0.07569152116775513, -0.08552069962024689, 0.09903523325920105, -0.01965874619781971, 0.004764430224895477, -0.09029997140169144, -0.1603802740573883, 0.3992871046066284, 0.3472423553466797, 0.16830585896968842, -0.014426760375499725, -0.19311097264289856, -0.37538430094718933, -0.14851276576519012, 0.17656166851520538, 0.0025194957852363586, -0.2643373906612396, 0.04459773376584053, 0.19753636419773102, 0.009132638573646545, -0.12355780601501465, -0.21048587560653687, 0.06979049742221832, 0.0955730751156807, 0.22498835623264313, 0.05082012712955475, 0.21452301740646362, -0.19534048438072205, -0.043169353157281876, -0.22888073325157166, -0.35759878158569336, 0.02569563314318657, 0.1826404482126236, -0.14123764634132385, 0.053248852491378784, -0.5081580281257629, 0.18504782021045685, -0.47177234292030334, -0.11449021846055984, -0.26545071601867676, -0.08323287963867188, -0.16249412298202515, 0.18950821459293365, -0.06494081020355225, 0.196329727768898, 0.03111332282423973, -0.06849866360425949, -0.24465635418891907, -0.2369127720594406, -0.10828889161348343, -0.20690380036830902, 0.400234580039978, -0.2964705526828766, -0.29702138900756836, 0.038173891603946686, 0.18369966745376587, 0.045249827206134796, 0.16478833556175232, -0.1509532332420349, 0.1165582463145256, 0.5190088152885437, 0.2603137195110321, -0.18547196686267853, -0.0030807405710220337, 0.05098745971918106, 0.3085193932056427, 0.144648015499115, 0.06676432490348816, 0.13186115026474, -0.26897430419921875, 0.11019809544086456, -0.17912818491458893 ]
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
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 ?
[ -0.15290424227714539, -0.011342160403728485, -0.0035984087735414505, 0.1689012348651886, 0.1570984125137329, -0.12320028245449066, 0.09978185594081879, 0.07052542269229889, -0.2103186547756195, -0.010081857442855835, -0.05347342789173126, 0.3284134864807129, -0.01689298450946808, 0.2652380168437958, -0.016930408775806427, 0.16082441806793213, 0.19298557937145233, -0.16062253713607788, -0.01488589495420456, 0.0638224259018898, -0.49945661425590515, 0.2975035607814789, -0.2505773901939392, -0.24892790615558624, 0.01138219516724348, 0.1712588220834732, -0.44314947724342346, 0.2632845640182495, -0.1389782577753067, -0.4832424223423004, 0.4568485617637634, 0.23431096971035004, 0.09546399861574173, 0.08152329176664352, -0.00011923632700927556, 0.04260049760341644, 0.2941548228263855, -0.2264106720685959, -0.5904031991958618, -0.16284413635730743, 0.04189315438270569, -0.4702175557613373, 0.18840354681015015, 0.02327679842710495, -0.054310597479343414, -0.4134978950023651, 0.09615353494882584, -0.4954592287540436, 0.057776011526584625, 0.22762228548526764, 0.17907673120498657, 0.022636324167251587, -0.04818841069936752, -0.22856763005256653, 0.34154659509658813, 0.37351375818252563, -0.13747304677963257, -0.005512526258826256, 0.27292919158935547, -0.05431651324033737, -0.11526507884263992, -0.07878178358078003, -0.013104111887514591, 0.11376100778579712, 0.1877591907978058, 0.2261113077402115, 0.16567228734493256, 0.037686437368392944, -0.03665711730718613, 0.14276282489299774, 0.4508594274520874, -0.15998798608779907, -0.5891254544258118, -0.6514387130737305, -0.211553156375885, -0.2048557698726654, 0.3938172161579132, 0.16065099835395813, 0.035622332245111465, 0.08709341287612915, -0.05306701734662056, -0.03636141121387482, -0.07393522560596466, 0.20547042787075043, -0.16761182248592377, 0.029170341789722443, -0.25093039870262146, -0.1011008694767952, 0.12311504781246185, -0.28304189443588257, -0.05589153245091438, -0.27148154377937317, -0.15696333348751068, 0.13555772602558136, -0.16906842589378357, 0.13198064267635345, 0.2142414152622223, 0.25722330808639526, 0.19660955667495728, 0.2981754541397095, -0.3301208019256592, 0.036151446402072906, 0.0764579325914383, -0.026516124606132507, 0.21963295340538025, -0.06262281537055969, -0.16235029697418213, 0.13285548985004425, -0.00017327815294265747, 0.26622626185417175, 0.21109777688980103, -0.2464478313922882, 0.2345045804977417, -0.19164901971817017, -0.5081840753555298, -0.4092119634151459, 0.20068447291851044, -0.13595998287200928, -0.21971257030963898, 0.17672765254974365, -0.05386742949485779, 0.19782543182373047, 0.16621491312980652, 0.1591424196958542, 0.0214405357837677, 0.3581978976726532, 0.16085459291934967, 0.1467951536178589, -0.23806025087833405, 0.09610698372125626, -0.22771964967250824, -0.2566016614437103, -0.14446784555912018, 0.044938042759895325, 0.2296506017446518, 0.18334726989269257, 0.29223552346229553, 0.20271086692810059, 0.18317508697509766, 0.18125750124454498, -0.21307793259620667, -0.18323871493339539, 0.1165444552898407, 0.3083992898464203, -0.3350987136363983, 0.1947498470544815, 0.0007112957537174225, -0.14418870210647583, -0.07946239411830902, 0.02200939506292343, -0.21357658505439758, -0.35193610191345215, -0.04961849004030228, 0.1211685761809349, -0.24995525181293488, 0.02577904611825943, -0.7889910340309143, 0.16945834457874298, -0.006591044366359711, -0.16825342178344727, -0.11781946569681168, -0.1170002818107605, -0.37368088960647583, -0.16855771839618683, 0.33202287554740906, 0.5698569416999817, -0.3904547393321991, -0.06351510435342789, -0.2289341241121292, 0.05014749616384506, 0.34793490171432495, 0.13085909187793732, -0.19349132478237152, 0.05038780719041824, -0.4610527455806732, 0.23006118834018707, 0.15123185515403748, -0.19591309130191803, -0.25347253680229187, 0.31087514758110046, 0.048546046018600464, 0.45849084854125977, 0.2725849151611328, -0.3200863301753998, 0.3843834698200226, 0.013518637046217918, 0.030625905841588974, 0.1538095921278, -0.02284969948232174, 0.06721186637878418, -0.35851043462753296, -0.25355368852615356, 0.13803555071353912, 0.06980419158935547, 0.011509232223033905, 0.10124499350786209, 0.060614340007305145, 0.1818772256374359, 0.49126505851745605, 0.001003894954919815, 0.0935426652431488, 0.13175946474075317, 0.5366714000701904, 0.319650262594223, -0.06025856360793114, -0.04064006730914116, -0.7242836952209473, 0.3130885064601898, 0.10148529708385468, -0.2256554663181305, -0.23923920094966888, 0.017458267509937286, -0.07169228792190552, -0.09543386846780777, -0.08140744268894196, -0.3532520830631256, 0.06297634541988373, 0.4205883741378784, -0.14905589818954468, 0.0001750253140926361, -0.08268081396818161, 0.5375640392303467, -0.33025574684143066, 0.04615355655550957, -0.13080041110515594, 0.5203421711921692, 0.21004684269428253, -0.3021397590637207, -0.12886834144592285, 0.006178438663482666, 0.2287745177745819, -0.15721841156482697, -0.07246754318475723, 0.6432702541351318, 0.3776761293411255, 0.40617281198501587, -0.15891507267951965, 0.2597979009151459, 0.2974884510040283, 0.19236290454864502, 0.13827894628047943, -0.09338259696960449, 0.009467332623898983, 0.07103510946035385, -0.2755429744720459, 0.24551993608474731, -0.03242063894867897, 0.1961899697780609, 0.13141943514347076, -0.06471535563468933, 0.2558842599391937, 0.21920621395111084, -0.030453186482191086, -0.23492811620235443, 0.08746858686208725, 0.1757896989583969, 0.4955284595489502, 0.07128551602363586, -0.2696816623210907, 0.20622241497039795, 0.3187848627567291, 0.05773720517754555, -0.31942975521087646, 0.09319835156202316, 0.1505410075187683, -0.27686581015586853, 0.4058873951435089, 0.23447881639003754, 0.5855885148048401, 0.2741241753101349, 0.07759144902229309, 0.0019691847264766693, -0.1116814985871315, -0.20621725916862488, 0.28509005904197693, 0.010216981172561646, -0.2254098504781723, 0.16915643215179443, 0.15855681896209717, 0.025876574218273163, -0.22696319222450256, 0.14274194836616516, 0.10646829754114151, 0.06672928482294083, -0.4064982235431671, -0.05336783081293106, -0.5170156359672546, 0.09911761432886124, -0.16356362402439117, 0.1275874227285385, -0.049960020929574966, -0.4888416528701782, 0.009089499711990356, 0.412934273481369, -0.24429671466350555, -0.01209760271012783, -0.27051541209220886, 0.34578052163124084, -0.143220454454422, -0.2948177754878998, -0.1718575656414032, 0.2781964838504791, -0.2819983661174774, -0.005464337766170502, 0.15313933789730072, 0.09305249899625778, 0.12775376439094543, 0.11910871416330338, -0.0884857177734375, -0.4881536364555359, -0.2079179584980011, 0.0363074466586113, 0.0016322508454322815, 0.49122169613838196, 0.1165584921836853, 0.01330818235874176, 0.12897183001041412, 0.05875548720359802, 0.2447650283575058, 0.056944213807582855, -0.11708027869462967, 0.0670875608921051, 0.25455737113952637, 0.04504420608282089, -0.24820885062217712, -0.3474721908569336, -0.2745063006877899, -0.29499197006225586, 0.33749639987945557, 0.12403856217861176, -0.05476765334606171, 0.09293432533740997, 0.05072520673274994, 0.06367658078670502, -0.09462139010429382, 0.004473392851650715, -0.18537500500679016, -0.5136890411376953, 0.29583632946014404, -0.2919151186943054, -0.0532352589070797, -0.17694491147994995, 0.14653882384300232, -0.2228001058101654, 0.24026364088058472, -0.4741741418838501, -0.23481446504592896, -0.3717804551124573, 0.23204952478408813, -0.1199643611907959, -0.12423567473888397, 0.5179239511489868, 0.01617181859910488, 0.062446944415569305, -0.3381514847278595, -0.241556316614151, 0.23680680990219116, 0.2685370147228241, 0.14805060625076294, 0.036517735570669174, 0.27571219205856323, 0.14536668360233307, 0.4057121276855469, 0.2844719886779785, 0.1385524719953537, 0.5614776611328125, -0.19775506854057312, 0.4847760796546936, -0.3017762303352356, -0.2716272175312042, 0.03275417163968086, -0.013768568634986877, -0.08310267329216003, 0.3195730447769165, 0.23150518536567688, 0.16663618385791779, 0.12193682789802551, 0.129253089427948, 0.0439247190952301, -0.2695171535015106, -0.08007140457630157, 0.052662111818790436, 0.26498186588287354, -0.0863453596830368, 0.0702248141169548, -0.12028037011623383, -0.21644121408462524, -0.20239780843257904, 0.2864115834236145, 0.34584683179855347, 0.04387428238987923, 0.02525394782423973, 0.33515694737434387, -0.20601233839988708, 0.16647301614284515, -0.053641751408576965, 0.29293784499168396, -0.0835435539484024, -0.12660616636276245, 0.031132586300373077, 0.039487771689891815, 0.5939799547195435, 0.014708380214869976, -0.004010017961263657, 0.06334604322910309, -0.15936610102653503, -0.34375283122062683, -0.34902334213256836, -0.06845694035291672, 0.011130817234516144, 0.09455627202987671, 0.7519521713256836, -0.22000384330749512, -0.43698936700820923, -0.12328441441059113, 0.09896746277809143, -0.08736207336187363, 0.06713524460792542, -0.05844428017735481, 0.06510739773511887, -0.05940742790699005, -0.016716592013835907, 0.15318027138710022, 0.329955130815506, -0.2575661242008209, -0.11358258128166199, -0.10946376621723175, -0.03070318140089512, 0.030479654669761658, -0.11693720519542694, 0.42792192101478577, -0.1692485809326172, 0.31139084696769714, 0.1726798564195633, 0.12448383867740631, 0.7364998459815979, 0.5298048853874207, -0.13362251222133636, 0.03791321814060211, 0.23305469751358032, -0.11072598397731781, 0.15690919756889343, 0.417942076921463, -0.37438541650772095, 0.004163868725299835, -0.37201979756355286, 0.16513168811798096, -0.6378698945045471, 0.07944944500923157, 0.3956424295902252, -0.262362539768219, 0.3268465995788574, -0.298621267080307, 0.44278833270072937, 0.03963395208120346, -0.1498662680387497, -0.05277880281209946, 0.7544151544570923, -0.552287220954895, 0.12094108760356903, 0.05384411662817001, 0.49732500314712524, 0.18918657302856445, 0.128903329372406, 0.2719491720199585, -0.19324098527431488, 0.09770873188972473, -0.28750574588775635, -0.1247107982635498, -0.01358974352478981, -0.10173415392637253, 0.02547646127641201, -0.11347095668315887, 0.5026901364326477, 0.24782755970954895, 0.0015166662633419037, 0.314678817987442, 0.11939291656017303, 0.262554407119751, -0.02216394431889057, 0.12049591541290283, -0.18243499100208282, -0.32473209500312805, -0.45672789216041565, 0.17926838994026184, 0.15260231494903564, -0.15040400624275208, 0.07162276655435562, 0.03727954998612404, -0.012757558375597, 0.04833973944187164, -0.2444121539592743, -0.03593467175960541, -0.24547523260116577, 0.08235970139503479, 0.19629262387752533, -0.03182379901409149, 0.14594915509223938, 0.3657950460910797, 0.013159632682800293, 0.19133718311786652, -0.2323783040046692, -0.07654011249542236, -0.17003631591796875, 0.24022044241428375, -0.04281799867749214, 0.020872347056865692, 0.18233156204223633, 0.12357296794652939, -0.061264410614967346, -0.36271268129348755, -0.30344030261039734, -0.30353593826293945, -0.07885963469743729, -0.16233325004577637, 0.11492985486984253, -0.32912659645080566, -0.11804185807704926, -0.257489413022995, 0.23642677068710327, -0.26744163036346436, 0.10332964360713959, 0.15140166878700256, -0.12074077874422073, 0.3519631028175354, -0.29440566897392273, -0.1382530778646469, -0.18746373057365417, 0.506901204586029, -0.5611608028411865, 0.1593180149793625, 0.5466101169586182, -0.20139145851135254, -0.2151273787021637, -0.07713228464126587, 0.31759336590766907, -0.05515650659799576, -0.1149219274520874, 0.22679297626018524, -0.1298273503780365, -0.04232281446456909, -0.1026899516582489, 0.33176541328430176, 0.2852447032928467, -0.0844830647110939, 0.04242650046944618, -0.24066874384880066, -0.1665029078722, 0.2396526336669922, -0.09847593307495117, 0.23830312490463257, -0.03140857070684433, -0.14988790452480316, 0.03660009056329727, -0.3156364858150482, -0.28087836503982544, 0.2577804923057556, 0.00048485398292541504, 0.09125940501689911, 0.1340789794921875, 0.0768207535147667, 0.2611934244632721, -0.1634121537208557, 0.09144166111946106, 0.04009725898504257, -0.15131182968616486, -0.09077292680740356, -0.24058593809604645, 0.124588742852211, 0.1574038565158844, -0.07511281222105026, -0.01931394264101982, -0.23914743959903717, -0.21172133088111877, -0.3025650680065155, 0.21973678469657898, 0.23495161533355713, 0.04271933436393738, 0.02229064702987671, 0.4115617871284485, 0.1586911976337433, 0.014029163867235184, 0.17317616939544678, 0.00486263632774353, -0.06714767217636108, -0.09979137033224106, 0.14213153719902039, -0.2958024740219116, -0.059521544724702835, 0.11275389045476913, 0.17669260501861572, 0.006020650267601013, 0.2907574772834778, 0.21639743447303772, -0.059881798923015594, -0.07287944853305817, 0.27708739042282104, 0.3654014468193054, 0.4282286763191223, 0.06663557142019272, -0.19082124531269073, 0.40411144495010376, 0.1315973699092865, -0.08751916885375977, -0.09171401709318161, 0.43136027455329895, 0.25225964188575745, 0.10794204473495483, 0.20839740335941315, 0.4449895918369293, -0.18336689472198486, -0.004106059670448303, 0.117024265229702, 0.08271951973438263, -0.025638382881879807, 0.3114818036556244, 0.22926266491413116, -0.14188767969608307, 0.18926399946212769, 0.1363227665424347, -0.09574948251247406, 0.13738882541656494, 0.456365704536438, -0.08465071767568588, 0.07290779799222946, 0.09640216827392578, -0.0694195032119751, 0.13577306270599365, -0.5972060561180115, -0.025477025657892227, 0.07513759285211563, -0.03759312629699707, 0.13427677750587463, -0.19390740990638733, 0.2433883547782898, -0.20162731409072876, -0.09061979502439499, -0.2465209662914276, 0.029672028496861458, -0.24248072504997253, -0.5893636345863342, 0.31450486183166504, -0.31231188774108887, -0.3696463704109192, -0.011610366404056549, -0.1576976478099823, -0.3150911331176758, 0.23409616947174072, -0.1572294384241104, 0.03623855486512184, -0.3480789363384247, 0.06305928528308868, -0.04020724445581436, 0.2554672062397003, -0.2554168105125427, 0.3295391798019409, -0.03982889652252197, -0.1565714329481125, 0.1783534437417984, 0.17572417855262756, 0.126033216714859, 0.30689603090286255, 0.08420182764530182, -0.25769466161727905, 0.2731996178627014, 0.030734026804566383, -0.011701196432113647, 0.22580040991306305, -0.3136540651321411, 0.019090550020337105, 0.25495249032974243, 0.1604820042848587, -0.11653989553451538, 0.008762933313846588, 0.16191355884075165, 0.1987234205007553, -0.5982889533042908, 0.567609429359436, 0.09436580538749695, 0.009067289531230927, 0.20330704748630524, -0.043381594121456146, -0.231105774641037, -0.26944679021835327, 0.25069621205329895, 0.0681898295879364, 0.32258135080337524, 0.2928840219974518, 0.07244779914617538, 0.19605737924575806, 0.10754573345184326, 0.16998523473739624, -0.46211525797843933, -0.1769011914730072, -0.2001478672027588, -0.5422199964523315, -0.3018328845500946, -0.006983842700719833, -0.0666288435459137, 0.008102765306830406, 0.41325730085372925, 0.018917053937911987, -0.27490103244781494, -0.13044358789920807, -0.42639216780662537, 0.14178483188152313, 0.23483680188655853, -0.2650422751903534, -0.14033125340938568, -0.015245862305164337, -0.013888528570532799, 0.04503754526376724, -0.278156578540802, -0.06045129522681236, 0.08501147478818893, 0.005498453974723816, 0.16368833184242249, 0.2233726978302002, -0.07996326684951782, -0.2438492774963379, 0.13904067873954773, -0.010519726201891899, -0.13960763812065125, 0.03317221254110336, -0.13869741559028625, -0.5629135966300964, -0.13902294635772705, -0.00802287645637989, 0.11374307423830032, -0.44197511672973633, 0.712494969367981, -0.38094234466552734, -0.051849398761987686, -0.29649004340171814, -0.16994521021842957, 0.14813372492790222, -0.2212366908788681, -0.30649808049201965, 0.30505654215812683, -0.0842101126909256, -0.03510187193751335, -0.12977786362171173, 0.21901118755340576, -0.26130497455596924, 0.31973761320114136, -0.05488461256027222, -0.3310236930847168, 0.3758852481842041, -0.32556021213531494, -0.05243094637989998, -0.04782284423708916, 0.256783127784729, 0.23418423533439636, 0.04209244251251221, -0.5339727997779846, -0.005652733147144318, 0.4839298129081726, -0.12284275144338608, 0.06812518835067749, 0.15094298124313354, 0.06802333891391754, -0.11244283616542816, -0.10292055457830429, 0.28953924775123596, 0.13933302462100983, 0.02619216777384281, 0.25964125990867615, -0.29263705015182495 ]
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
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
[ -0.15290424227714539, -0.011342160403728485, -0.0035984087735414505, 0.1689012348651886, 0.1570984125137329, -0.12320028245449066, 0.09978185594081879, 0.07052542269229889, -0.2103186547756195, -0.010081857442855835, -0.05347342789173126, 0.3284134864807129, -0.01689298450946808, 0.2652380168437958, -0.016930408775806427, 0.16082441806793213, 0.19298557937145233, -0.16062253713607788, -0.01488589495420456, 0.0638224259018898, -0.49945661425590515, 0.2975035607814789, -0.2505773901939392, -0.24892790615558624, 0.01138219516724348, 0.1712588220834732, -0.44314947724342346, 0.2632845640182495, -0.1389782577753067, -0.4832424223423004, 0.4568485617637634, 0.23431096971035004, 0.09546399861574173, 0.08152329176664352, -0.00011923632700927556, 0.04260049760341644, 0.2941548228263855, -0.2264106720685959, -0.5904031991958618, -0.16284413635730743, 0.04189315438270569, -0.4702175557613373, 0.18840354681015015, 0.02327679842710495, -0.054310597479343414, -0.4134978950023651, 0.09615353494882584, -0.4954592287540436, 0.057776011526584625, 0.22762228548526764, 0.17907673120498657, 0.022636324167251587, -0.04818841069936752, -0.22856763005256653, 0.34154659509658813, 0.37351375818252563, -0.13747304677963257, -0.005512526258826256, 0.27292919158935547, -0.05431651324033737, -0.11526507884263992, -0.07878178358078003, -0.013104111887514591, 0.11376100778579712, 0.1877591907978058, 0.2261113077402115, 0.16567228734493256, 0.037686437368392944, -0.03665711730718613, 0.14276282489299774, 0.4508594274520874, -0.15998798608779907, -0.5891254544258118, -0.6514387130737305, -0.211553156375885, -0.2048557698726654, 0.3938172161579132, 0.16065099835395813, 0.035622332245111465, 0.08709341287612915, -0.05306701734662056, -0.03636141121387482, -0.07393522560596466, 0.20547042787075043, -0.16761182248592377, 0.029170341789722443, -0.25093039870262146, -0.1011008694767952, 0.12311504781246185, -0.28304189443588257, -0.05589153245091438, -0.27148154377937317, -0.15696333348751068, 0.13555772602558136, -0.16906842589378357, 0.13198064267635345, 0.2142414152622223, 0.25722330808639526, 0.19660955667495728, 0.2981754541397095, -0.3301208019256592, 0.036151446402072906, 0.0764579325914383, -0.026516124606132507, 0.21963295340538025, -0.06262281537055969, -0.16235029697418213, 0.13285548985004425, -0.00017327815294265747, 0.26622626185417175, 0.21109777688980103, -0.2464478313922882, 0.2345045804977417, -0.19164901971817017, -0.5081840753555298, -0.4092119634151459, 0.20068447291851044, -0.13595998287200928, -0.21971257030963898, 0.17672765254974365, -0.05386742949485779, 0.19782543182373047, 0.16621491312980652, 0.1591424196958542, 0.0214405357837677, 0.3581978976726532, 0.16085459291934967, 0.1467951536178589, -0.23806025087833405, 0.09610698372125626, -0.22771964967250824, -0.2566016614437103, -0.14446784555912018, 0.044938042759895325, 0.2296506017446518, 0.18334726989269257, 0.29223552346229553, 0.20271086692810059, 0.18317508697509766, 0.18125750124454498, -0.21307793259620667, -0.18323871493339539, 0.1165444552898407, 0.3083992898464203, -0.3350987136363983, 0.1947498470544815, 0.0007112957537174225, -0.14418870210647583, -0.07946239411830902, 0.02200939506292343, -0.21357658505439758, -0.35193610191345215, -0.04961849004030228, 0.1211685761809349, -0.24995525181293488, 0.02577904611825943, -0.7889910340309143, 0.16945834457874298, -0.006591044366359711, -0.16825342178344727, -0.11781946569681168, -0.1170002818107605, -0.37368088960647583, -0.16855771839618683, 0.33202287554740906, 0.5698569416999817, -0.3904547393321991, -0.06351510435342789, -0.2289341241121292, 0.05014749616384506, 0.34793490171432495, 0.13085909187793732, -0.19349132478237152, 0.05038780719041824, -0.4610527455806732, 0.23006118834018707, 0.15123185515403748, -0.19591309130191803, -0.25347253680229187, 0.31087514758110046, 0.048546046018600464, 0.45849084854125977, 0.2725849151611328, -0.3200863301753998, 0.3843834698200226, 0.013518637046217918, 0.030625905841588974, 0.1538095921278, -0.02284969948232174, 0.06721186637878418, -0.35851043462753296, -0.25355368852615356, 0.13803555071353912, 0.06980419158935547, 0.011509232223033905, 0.10124499350786209, 0.060614340007305145, 0.1818772256374359, 0.49126505851745605, 0.001003894954919815, 0.0935426652431488, 0.13175946474075317, 0.5366714000701904, 0.319650262594223, -0.06025856360793114, -0.04064006730914116, -0.7242836952209473, 0.3130885064601898, 0.10148529708385468, -0.2256554663181305, -0.23923920094966888, 0.017458267509937286, -0.07169228792190552, -0.09543386846780777, -0.08140744268894196, -0.3532520830631256, 0.06297634541988373, 0.4205883741378784, -0.14905589818954468, 0.0001750253140926361, -0.08268081396818161, 0.5375640392303467, -0.33025574684143066, 0.04615355655550957, -0.13080041110515594, 0.5203421711921692, 0.21004684269428253, -0.3021397590637207, -0.12886834144592285, 0.006178438663482666, 0.2287745177745819, -0.15721841156482697, -0.07246754318475723, 0.6432702541351318, 0.3776761293411255, 0.40617281198501587, -0.15891507267951965, 0.2597979009151459, 0.2974884510040283, 0.19236290454864502, 0.13827894628047943, -0.09338259696960449, 0.009467332623898983, 0.07103510946035385, -0.2755429744720459, 0.24551993608474731, -0.03242063894867897, 0.1961899697780609, 0.13141943514347076, -0.06471535563468933, 0.2558842599391937, 0.21920621395111084, -0.030453186482191086, -0.23492811620235443, 0.08746858686208725, 0.1757896989583969, 0.4955284595489502, 0.07128551602363586, -0.2696816623210907, 0.20622241497039795, 0.3187848627567291, 0.05773720517754555, -0.31942975521087646, 0.09319835156202316, 0.1505410075187683, -0.27686581015586853, 0.4058873951435089, 0.23447881639003754, 0.5855885148048401, 0.2741241753101349, 0.07759144902229309, 0.0019691847264766693, -0.1116814985871315, -0.20621725916862488, 0.28509005904197693, 0.010216981172561646, -0.2254098504781723, 0.16915643215179443, 0.15855681896209717, 0.025876574218273163, -0.22696319222450256, 0.14274194836616516, 0.10646829754114151, 0.06672928482294083, -0.4064982235431671, -0.05336783081293106, -0.5170156359672546, 0.09911761432886124, -0.16356362402439117, 0.1275874227285385, -0.049960020929574966, -0.4888416528701782, 0.009089499711990356, 0.412934273481369, -0.24429671466350555, -0.01209760271012783, -0.27051541209220886, 0.34578052163124084, -0.143220454454422, -0.2948177754878998, -0.1718575656414032, 0.2781964838504791, -0.2819983661174774, -0.005464337766170502, 0.15313933789730072, 0.09305249899625778, 0.12775376439094543, 0.11910871416330338, -0.0884857177734375, -0.4881536364555359, -0.2079179584980011, 0.0363074466586113, 0.0016322508454322815, 0.49122169613838196, 0.1165584921836853, 0.01330818235874176, 0.12897183001041412, 0.05875548720359802, 0.2447650283575058, 0.056944213807582855, -0.11708027869462967, 0.0670875608921051, 0.25455737113952637, 0.04504420608282089, -0.24820885062217712, -0.3474721908569336, -0.2745063006877899, -0.29499197006225586, 0.33749639987945557, 0.12403856217861176, -0.05476765334606171, 0.09293432533740997, 0.05072520673274994, 0.06367658078670502, -0.09462139010429382, 0.004473392851650715, -0.18537500500679016, -0.5136890411376953, 0.29583632946014404, -0.2919151186943054, -0.0532352589070797, -0.17694491147994995, 0.14653882384300232, -0.2228001058101654, 0.24026364088058472, -0.4741741418838501, -0.23481446504592896, -0.3717804551124573, 0.23204952478408813, -0.1199643611907959, -0.12423567473888397, 0.5179239511489868, 0.01617181859910488, 0.062446944415569305, -0.3381514847278595, -0.241556316614151, 0.23680680990219116, 0.2685370147228241, 0.14805060625076294, 0.036517735570669174, 0.27571219205856323, 0.14536668360233307, 0.4057121276855469, 0.2844719886779785, 0.1385524719953537, 0.5614776611328125, -0.19775506854057312, 0.4847760796546936, -0.3017762303352356, -0.2716272175312042, 0.03275417163968086, -0.013768568634986877, -0.08310267329216003, 0.3195730447769165, 0.23150518536567688, 0.16663618385791779, 0.12193682789802551, 0.129253089427948, 0.0439247190952301, -0.2695171535015106, -0.08007140457630157, 0.052662111818790436, 0.26498186588287354, -0.0863453596830368, 0.0702248141169548, -0.12028037011623383, -0.21644121408462524, -0.20239780843257904, 0.2864115834236145, 0.34584683179855347, 0.04387428238987923, 0.02525394782423973, 0.33515694737434387, -0.20601233839988708, 0.16647301614284515, -0.053641751408576965, 0.29293784499168396, -0.0835435539484024, -0.12660616636276245, 0.031132586300373077, 0.039487771689891815, 0.5939799547195435, 0.014708380214869976, -0.004010017961263657, 0.06334604322910309, -0.15936610102653503, -0.34375283122062683, -0.34902334213256836, -0.06845694035291672, 0.011130817234516144, 0.09455627202987671, 0.7519521713256836, -0.22000384330749512, -0.43698936700820923, -0.12328441441059113, 0.09896746277809143, -0.08736207336187363, 0.06713524460792542, -0.05844428017735481, 0.06510739773511887, -0.05940742790699005, -0.016716592013835907, 0.15318027138710022, 0.329955130815506, -0.2575661242008209, -0.11358258128166199, -0.10946376621723175, -0.03070318140089512, 0.030479654669761658, -0.11693720519542694, 0.42792192101478577, -0.1692485809326172, 0.31139084696769714, 0.1726798564195633, 0.12448383867740631, 0.7364998459815979, 0.5298048853874207, -0.13362251222133636, 0.03791321814060211, 0.23305469751358032, -0.11072598397731781, 0.15690919756889343, 0.417942076921463, -0.37438541650772095, 0.004163868725299835, -0.37201979756355286, 0.16513168811798096, -0.6378698945045471, 0.07944944500923157, 0.3956424295902252, -0.262362539768219, 0.3268465995788574, -0.298621267080307, 0.44278833270072937, 0.03963395208120346, -0.1498662680387497, -0.05277880281209946, 0.7544151544570923, -0.552287220954895, 0.12094108760356903, 0.05384411662817001, 0.49732500314712524, 0.18918657302856445, 0.128903329372406, 0.2719491720199585, -0.19324098527431488, 0.09770873188972473, -0.28750574588775635, -0.1247107982635498, -0.01358974352478981, -0.10173415392637253, 0.02547646127641201, -0.11347095668315887, 0.5026901364326477, 0.24782755970954895, 0.0015166662633419037, 0.314678817987442, 0.11939291656017303, 0.262554407119751, -0.02216394431889057, 0.12049591541290283, -0.18243499100208282, -0.32473209500312805, -0.45672789216041565, 0.17926838994026184, 0.15260231494903564, -0.15040400624275208, 0.07162276655435562, 0.03727954998612404, -0.012757558375597, 0.04833973944187164, -0.2444121539592743, -0.03593467175960541, -0.24547523260116577, 0.08235970139503479, 0.19629262387752533, -0.03182379901409149, 0.14594915509223938, 0.3657950460910797, 0.013159632682800293, 0.19133718311786652, -0.2323783040046692, -0.07654011249542236, -0.17003631591796875, 0.24022044241428375, -0.04281799867749214, 0.020872347056865692, 0.18233156204223633, 0.12357296794652939, -0.061264410614967346, -0.36271268129348755, -0.30344030261039734, -0.30353593826293945, -0.07885963469743729, -0.16233325004577637, 0.11492985486984253, -0.32912659645080566, -0.11804185807704926, -0.257489413022995, 0.23642677068710327, -0.26744163036346436, 0.10332964360713959, 0.15140166878700256, -0.12074077874422073, 0.3519631028175354, -0.29440566897392273, -0.1382530778646469, -0.18746373057365417, 0.506901204586029, -0.5611608028411865, 0.1593180149793625, 0.5466101169586182, -0.20139145851135254, -0.2151273787021637, -0.07713228464126587, 0.31759336590766907, -0.05515650659799576, -0.1149219274520874, 0.22679297626018524, -0.1298273503780365, -0.04232281446456909, -0.1026899516582489, 0.33176541328430176, 0.2852447032928467, -0.0844830647110939, 0.04242650046944618, -0.24066874384880066, -0.1665029078722, 0.2396526336669922, -0.09847593307495117, 0.23830312490463257, -0.03140857070684433, -0.14988790452480316, 0.03660009056329727, -0.3156364858150482, -0.28087836503982544, 0.2577804923057556, 0.00048485398292541504, 0.09125940501689911, 0.1340789794921875, 0.0768207535147667, 0.2611934244632721, -0.1634121537208557, 0.09144166111946106, 0.04009725898504257, -0.15131182968616486, -0.09077292680740356, -0.24058593809604645, 0.124588742852211, 0.1574038565158844, -0.07511281222105026, -0.01931394264101982, -0.23914743959903717, -0.21172133088111877, -0.3025650680065155, 0.21973678469657898, 0.23495161533355713, 0.04271933436393738, 0.02229064702987671, 0.4115617871284485, 0.1586911976337433, 0.014029163867235184, 0.17317616939544678, 0.00486263632774353, -0.06714767217636108, -0.09979137033224106, 0.14213153719902039, -0.2958024740219116, -0.059521544724702835, 0.11275389045476913, 0.17669260501861572, 0.006020650267601013, 0.2907574772834778, 0.21639743447303772, -0.059881798923015594, -0.07287944853305817, 0.27708739042282104, 0.3654014468193054, 0.4282286763191223, 0.06663557142019272, -0.19082124531269073, 0.40411144495010376, 0.1315973699092865, -0.08751916885375977, -0.09171401709318161, 0.43136027455329895, 0.25225964188575745, 0.10794204473495483, 0.20839740335941315, 0.4449895918369293, -0.18336689472198486, -0.004106059670448303, 0.117024265229702, 0.08271951973438263, -0.025638382881879807, 0.3114818036556244, 0.22926266491413116, -0.14188767969608307, 0.18926399946212769, 0.1363227665424347, -0.09574948251247406, 0.13738882541656494, 0.456365704536438, -0.08465071767568588, 0.07290779799222946, 0.09640216827392578, -0.0694195032119751, 0.13577306270599365, -0.5972060561180115, -0.025477025657892227, 0.07513759285211563, -0.03759312629699707, 0.13427677750587463, -0.19390740990638733, 0.2433883547782898, -0.20162731409072876, -0.09061979502439499, -0.2465209662914276, 0.029672028496861458, -0.24248072504997253, -0.5893636345863342, 0.31450486183166504, -0.31231188774108887, -0.3696463704109192, -0.011610366404056549, -0.1576976478099823, -0.3150911331176758, 0.23409616947174072, -0.1572294384241104, 0.03623855486512184, -0.3480789363384247, 0.06305928528308868, -0.04020724445581436, 0.2554672062397003, -0.2554168105125427, 0.3295391798019409, -0.03982889652252197, -0.1565714329481125, 0.1783534437417984, 0.17572417855262756, 0.126033216714859, 0.30689603090286255, 0.08420182764530182, -0.25769466161727905, 0.2731996178627014, 0.030734026804566383, -0.011701196432113647, 0.22580040991306305, -0.3136540651321411, 0.019090550020337105, 0.25495249032974243, 0.1604820042848587, -0.11653989553451538, 0.008762933313846588, 0.16191355884075165, 0.1987234205007553, -0.5982889533042908, 0.567609429359436, 0.09436580538749695, 0.009067289531230927, 0.20330704748630524, -0.043381594121456146, -0.231105774641037, -0.26944679021835327, 0.25069621205329895, 0.0681898295879364, 0.32258135080337524, 0.2928840219974518, 0.07244779914617538, 0.19605737924575806, 0.10754573345184326, 0.16998523473739624, -0.46211525797843933, -0.1769011914730072, -0.2001478672027588, -0.5422199964523315, -0.3018328845500946, -0.006983842700719833, -0.0666288435459137, 0.008102765306830406, 0.41325730085372925, 0.018917053937911987, -0.27490103244781494, -0.13044358789920807, -0.42639216780662537, 0.14178483188152313, 0.23483680188655853, -0.2650422751903534, -0.14033125340938568, -0.015245862305164337, -0.013888528570532799, 0.04503754526376724, -0.278156578540802, -0.06045129522681236, 0.08501147478818893, 0.005498453974723816, 0.16368833184242249, 0.2233726978302002, -0.07996326684951782, -0.2438492774963379, 0.13904067873954773, -0.010519726201891899, -0.13960763812065125, 0.03317221254110336, -0.13869741559028625, -0.5629135966300964, -0.13902294635772705, -0.00802287645637989, 0.11374307423830032, -0.44197511672973633, 0.712494969367981, -0.38094234466552734, -0.051849398761987686, -0.29649004340171814, -0.16994521021842957, 0.14813372492790222, -0.2212366908788681, -0.30649808049201965, 0.30505654215812683, -0.0842101126909256, -0.03510187193751335, -0.12977786362171173, 0.21901118755340576, -0.26130497455596924, 0.31973761320114136, -0.05488461256027222, -0.3310236930847168, 0.3758852481842041, -0.32556021213531494, -0.05243094637989998, -0.04782284423708916, 0.256783127784729, 0.23418423533439636, 0.04209244251251221, -0.5339727997779846, -0.005652733147144318, 0.4839298129081726, -0.12284275144338608, 0.06812518835067749, 0.15094298124313354, 0.06802333891391754, -0.11244283616542816, -0.10292055457830429, 0.28953924775123596, 0.13933302462100983, 0.02619216777384281, 0.25964125990867615, -0.29263705015182495 ]
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
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.
[ -0.32401198148727417, -0.15878283977508545, -0.011707793921232224, 0.12749545276165009, 0.21714608371257782, 0.11436022073030472, 0.4323761761188507, 0.18996253609657288, 0.20589525997638702, 0.12764689326286316, 0.33117449283599854, 0.35847941040992737, -0.33052578568458557, 0.021677793934941292, 0.06060248613357544, -0.2712496221065521, 0.2958768308162689, 0.07100889086723328, -0.14972321689128876, -0.25852006673812866, -0.4680052697658539, 0.1733199506998062, -0.15049779415130615, 0.3007069230079651, -0.4399888217449188, 0.008426742628216743, -0.433341383934021, 0.2824033200740814, -0.03134641796350479, -0.10404080152511597, 0.11095871031284332, -0.22206410765647888, 0.028530750423669815, 0.5023260116577148, -0.0001237382530234754, -0.05809182673692703, 0.38278430700302124, -0.07923934608697891, -0.3645923435688019, -0.2240438014268875, -0.528587818145752, -0.21975181996822357, -0.07419151067733765, -0.44097018241882324, 0.13613447546958923, -0.4252728223800659, 0.10126867145299911, -0.3523351848125458, 0.3348711133003235, 0.15646816790103912, 0.12436558306217194, -0.10388664901256561, -0.14852114021778107, -0.1136048287153244, 0.04790393263101578, 0.45757198333740234, 0.0593390017747879, 0.18663087487220764, 0.1465306133031845, -0.3613651692867279, 0.19248473644256592, 0.3805333375930786, -0.08531542122364044, -0.010553605854511261, 0.3869057297706604, 0.1348394900560379, -0.008848518133163452, -0.48250260949134827, 0.31377163529396057, 0.1028558611869812, 0.4693727195262909, -0.24288222193717957, -0.4062136113643646, -0.3492008149623871, 0.039563581347465515, 0.1390586793422699, 0.08533824980258942, 0.06113278120756149, -0.0977732241153717, -0.04796803370118141, -0.32757800817489624, -0.22307537496089935, 0.024990804493427277, 0.17770975828170776, -0.2437674105167389, 0.006587788462638855, 0.03231328725814819, 0.24059349298477173, 0.06298588961362839, -0.04873330146074295, -0.11667386442422867, -0.09215662628412247, 0.044577959924936295, 0.38037246465682983, 0.1153181940317154, 0.0460212379693985, 0.038340743631124496, 0.261223167181015, 0.025414813309907913, -0.449326753616333, -0.41808146238327026, -0.21462950110435486, -0.025620480999350548, 0.07508644461631775, 0.26803964376449585, 0.35880768299102783, 0.0361168198287487, 0.5942150950431824, 0.05789199098944664, -0.16005265712738037, -0.1661117821931839, -0.06227055937051773, -0.19517844915390015, -0.1653289794921875, 0.33994030952453613, 0.13137751817703247, 0.19823096692562103, 0.07658758759498596, 0.2765146493911743, 0.029969174414873123, 0.12815779447555542, 0.05764787644147873, -0.3248156011104584, 0.2896093726158142, 0.08528397232294083, 0.020108163356781006, 0.2765270471572876, 0.1884855479001999, -0.11160646378993988, 0.01261331420391798, -0.21088021993637085, 0.31107908487319946, -0.45328888297080994, -0.04840264469385147, -0.07409468293190002, -0.05445778742432594, 0.202180877327919, -0.12029232084751129, -0.0033464133739471436, 0.1784718781709671, -0.2817744314670563, -0.10385620594024658, 0.20491793751716614, 0.3524014353752136, -0.041768137365579605, 0.36061832308769226, 0.43333789706230164, -0.36919498443603516, -0.025037486106157303, 0.29474547505378723, -0.4625452756881714, -0.0012658201158046722, -0.019506609067320824, 0.03607100620865822, -0.3135048747062683, 0.03987133130431175, -0.6820296049118042, 0.0818236768245697, 0.24868053197860718, -0.00734715536236763, 0.15035271644592285, -0.18055564165115356, -0.2084200382232666, -0.12903529405593872, 0.017841076478362083, 0.6849644184112549, -0.6063416004180908, -0.13462474942207336, -0.1339256763458252, -0.01720615103840828, -0.046415217220783234, -0.062216904014348984, -0.018353242427110672, 0.4591878652572632, -0.37083256244659424, 0.14299866557121277, 0.16371721029281616, -0.5161159038543701, -0.35517746210098267, 0.3549804091453552, -0.16500116884708405, -0.173416867852211, -0.07296944409608841, 0.1565427929162979, 0.26725369691848755, 0.1512879878282547, -0.002230525016784668, 0.1620100736618042, -0.19220252335071564, 0.22386306524276733, -0.023279467597603798, 0.04079589992761612, -0.02116554230451584, 0.16211549937725067, 0.4777938425540924, 0.48908373713493347, 0.0758405327796936, 0.3215160667896271, -0.1320270299911499, -0.06875047087669373, 0.15121598541736603, 0.27500346302986145, 0.09308016300201416, -0.0725497454404831, 0.26413729786872864, 0.12560859322547913, -0.1721108853816986, 0.24972239136695862, 0.0100141242146492, 0.07337930053472519, -0.5407454371452332, 0.14427590370178223, -0.3338871896266937, 0.07116683572530746, -0.23025085031986237, -0.19821862876415253, 0.006514746695756912, 0.0018646642565727234, 0.0299491286277771, 0.3422907292842865, -0.1370963454246521, 0.24112941324710846, 0.11756342649459839, 0.07246677577495575, -0.2877049148082733, 0.21733209490776062, -0.059646278619766235, -0.1644553393125534, -0.1880349963903427, -0.16393473744392395, 0.06809498369693756, -0.01785087212920189, -0.1618698537349701, 0.44255393743515015, 0.14130982756614685, 0.1438356637954712, 0.013787131756544113, 0.06075003743171692, 0.4276396632194519, -0.44742926955223083, 0.027005448937416077, -0.06386016309261322, 0.3040165305137634, -0.02193695679306984, -0.34083378314971924, 0.18017332255840302, -0.051691990345716476, 0.4120117425918579, -0.025265462696552277, 0.27859166264533997, -0.012045806273818016, -0.10850898921489716, -0.18999083340168, -0.2265874594449997, -0.0954982340335846, -0.5873388051986694, 0.13999128341674805, -0.040577568113803864, 0.02308209240436554, -0.17057260870933533, 0.29513388872146606, 0.13264960050582886, 0.27033156156539917, 0.13610601425170898, -0.2669859826564789, 0.36136865615844727, 0.09730570018291473, 0.3826902210712433, 0.6096726059913635, 0.11081913858652115, -0.3154732882976532, 0.04184585064649582, 0.08771304786205292, 0.15955154597759247, -0.09121658653020859, -0.05936020612716675, 0.21536996960639954, -0.0025136061012744904, 0.03141632676124573, 0.13251057267189026, 0.0013084672391414642, -0.18531416356563568, -0.12586471438407898, 0.41475507616996765, -0.18484018743038177, 0.20287980139255524, -0.28638598322868347, -0.5297968983650208, 0.14577928185462952, 0.29898691177368164, 0.10796947777271271, -0.35195258259773254, -0.006508734077215195, -0.16357466578483582, -0.0026102978736162186, 0.11543931812047958, -0.21976937353610992, -0.14558695256710052, 0.0683656856417656, -0.3103465139865875, -0.34831303358078003, -0.22515948116779327, -0.21173015236854553, -0.04735372215509415, 0.11563639342784882, -0.14229661226272583, 0.15734106302261353, -0.350042462348938, 0.04994384944438934, -0.33510512113571167, -0.20780938863754272, 0.2205989807844162, -0.15882201492786407, 0.3251001536846161, 0.280616819858551, 0.4468631148338318, -0.4469297528266907, -0.1527736634016037, 0.5118894577026367, -0.24019990861415863, -0.39049461483955383, 0.17321261763572693, -0.0140767153352499, -0.17885930836200714, -0.23800016939640045, -0.044296957552433014, -0.07535101473331451, -0.06383715569972992, -0.022321298718452454, -0.05878923833370209, -0.003520756959915161, 0.33211615681648254, 0.5127058625221252, -0.1888541430234909, 0.07337905466556549, -0.3374021649360657, 0.06907466053962708, 0.058898430317640305, 0.2907867431640625, -0.0445997379720211, -0.39186909794807434, -0.09840847551822662, -0.2515867352485657, 0.13452330231666565, 0.2325752079486847, -0.464898943901062, -0.08477248251438141, -0.0291480403393507, 0.30012989044189453, 0.1089867353439331, -0.005119683220982552, 0.31420665979385376, 0.05111344903707504, -0.03509523719549179, -0.4094218313694, 0.07340086996555328, -0.059298478066921234, 0.06812775135040283, 0.3114163279533386, 0.19413632154464722, 0.4733062982559204, 0.029196832329034805, 0.6183464527130127, -0.24337242543697357, -0.1742079257965088, 0.2521696388721466, -0.44877806305885315, 0.360157310962677, -0.22721558809280396, -0.5549502372741699, 0.09396089613437653, 0.27861344814300537, -0.22252507507801056, 0.06185394525527954, -0.14955684542655945, -0.25049954652786255, -0.1936502307653427, 0.18926776945590973, -0.6431413292884827, 0.09716621041297913, -0.021093914285302162, -0.18553583323955536, 0.11025349795818329, 0.03143937513232231, -0.10241332650184631, -0.09929603338241577, 0.14258438348770142, 0.09244830906391144, 0.25114452838897705, 0.4196722209453583, 0.15251274406909943, -0.08839040249586105, -0.283808171749115, -0.17385965585708618, 0.02694135159254074, -0.042890679091215134, 0.300985187292099, -0.4160429835319519, -0.03253887593746185, -0.037934914231300354, 0.14577926695346832, 0.7827246189117432, -0.3587474524974823, 0.012929029762744904, 0.08097416162490845, -0.15756282210350037, -0.6299304366111755, -0.05689304322004318, -0.0040178559720516205, 0.3614719808101654, -0.33607545495033264, 0.952446699142456, 0.025696970522403717, 0.10360395163297653, 0.12459719181060791, 0.10940278321504593, -0.25770846009254456, -0.22920961678028107, -0.37078768014907837, -0.3082921504974365, -0.4742871820926666, 0.11822658777236938, 0.1047503724694252, -0.08055547624826431, 0.2987232506275177, 0.17743532359600067, -0.09672486037015915, 0.03195691481232643, -0.24427716434001923, 0.05749307945370674, 0.28274771571159363, -0.016078518703579903, 0.16099902987480164, 0.11917684972286224, 0.16763845086097717, 0.09694207459688187, 0.2532910704612732, 0.024640396237373352, -0.35654768347740173, 0.10023659467697144, -0.17807404696941376, 0.09497715532779694, 0.044542327523231506, -0.19581462442874908, -0.4529816508293152, 0.076810821890831, 0.04475455731153488, -0.23981860280036926, 0.11804742366075516, 0.1838107854127884, -0.21841967105865479, -0.18042536079883575, -0.36491626501083374, 0.35734111070632935, 0.2207856923341751, -0.07798204571008682, 0.24957579374313354, 0.12574037909507751, -0.2935132384300232, 0.41863805055618286, 0.1568010449409485, 0.6220704913139343, -0.25892752408981323, 0.06728491187095642, 0.15036754310131073, 0.07843625545501709, 0.3830382227897644, 0.2517644166946411, -0.1626652181148529, -0.24514427781105042, -0.28508076071739197, -0.06536630541086197, -0.06863251328468323, 0.15769127011299133, 0.1533397138118744, -0.16027618944644928, 0.19896537065505981, -0.3184800148010254, -0.0968279242515564, 0.0026933355256915092, -0.1877679079771042, 0.10060518980026245, -0.19492526352405548, 0.10442265123128891, 0.1317252814769745, 0.06247491016983986, 0.4608318507671356, -0.03164047747850418, 0.09709516167640686, -0.48637259006500244, -0.23908871412277222, -0.3068636655807495, -0.03828231617808342, -0.13184699416160583, 0.010328521952033043, -0.12616761028766632, -0.16915559768676758, -0.1555456817150116, 0.7565407752990723, 0.2684205174446106, 0.1277427077293396, -0.07403512299060822, 0.24205636978149414, -0.07645832747220993, 0.329156756401062, -0.03509385883808136, -0.137149378657341, 0.1915418952703476, 0.09451305121183395, -0.12067478895187378, -0.19048470258712769, -0.1855768859386444, -0.041791267693042755, -0.2943980097770691, 0.11236797273159027, -0.12290194630622864, 0.09818480908870697, -0.24890875816345215, -0.10857483744621277, 0.109013631939888, -0.005610629916191101, 0.03359866142272949, 0.0036102160811424255, 0.24150420725345612, 0.26770883798599243, -0.14144837856292725, -0.32984253764152527, 0.05991443619132042, 0.5912405252456665, -0.044293858110904694, -0.04850050061941147, 0.35854703187942505, -0.09833893924951553, 0.035789407789707184, -0.175126314163208, 0.14800682663917542, 0.4282267093658447, -0.5345396995544434, 0.1700923889875412, -0.048387493938207626, 0.2081526666879654, -0.1293024718761444, 0.08406086266040802, 0.009370148181915283, -0.2844208776950836, -0.020844025537371635, -0.2566327750682831, -0.3511792719364166, 0.30648326873779297, -0.2844296991825104, 0.0723617821931839, -0.07490965723991394, -0.18879999220371246, 0.3478574752807617, -0.08616793900728226, -0.19660082459449768, -0.07229787856340408, -0.2078285664319992, 0.1851399689912796, 0.47097247838974, 0.6409897208213806, -0.03562067449092865, -0.2231418937444687, 0.020210033282637596, 0.07040812820196152, 0.0740862488746643, -0.13598182797431946, 0.031642474234104156, 0.18728257715702057, 0.17586076259613037, 0.12941059470176697, 0.035972822457551956, -0.1434682458639145, 0.003569306805729866, -0.15675565600395203, 0.006399344652891159, 0.2841332256793976, -0.2679620385169983, 0.3977542817592621, 0.12071582674980164, 0.2498948574066162, 0.3024801015853882, 0.18032841384410858, -0.026702411472797394, 0.10984838008880615, 0.03862006962299347, 0.11973440647125244, 0.47043874859809875, 0.03993554413318634, -0.053312886506319046, -0.13113060593605042, -0.37660402059555054, 0.1529850959777832, 0.36274605989456177, -0.3352052569389343, 0.5221238136291504, 0.3450866639614105, 0.22109830379486084, -0.09277158975601196, -0.3312915861606598, 0.07907242327928543, 0.38276466727256775, 0.11458339542150497, -0.236568421125412, -0.10157924145460129, 0.3075175881385803, 0.17295196652412415, -0.1539381742477417, 0.08449448645114899, 0.01952960714697838, -0.028578627854585648, -0.21931855380535126, 0.07914140820503235, 0.5082218050956726, -0.4141002297401428, 0.12817859649658203, 0.8141908049583435, -0.24807560443878174, 0.28030627965927124, 0.160042867064476, 0.296968549489975, -0.21869060397148132, 0.7152099609375, -0.11234191805124283, 0.25387445092201233, 0.1262950301170349, 0.13594672083854675, 0.3102916479110718, -0.24378007650375366, 0.13873188197612762, -0.0626235157251358, -0.10557231307029724, 0.12147627770900726, -0.14327630400657654, 0.10020172595977783, 0.06333768367767334, -0.050508685410022736, 0.13827814161777496, 0.060699574649333954, -0.13207221031188965, 0.10877014696598053, -0.34389209747314453, -0.06569762527942657, -0.09207119047641754, -0.029987171292304993, 0.02157873846590519, -0.29795920848846436, 0.35413917899131775, 0.061043426394462585, -0.22675518691539764, 0.008562943898141384, -0.32822293043136597, 0.35716813802719116, 0.08839303255081177, -0.20451320707798004, -0.04687321186065674, 0.035543106496334076, 0.034890297800302505, 0.41309720277786255, 0.549994170665741, 0.30271705985069275, 0.40139150619506836, -0.030809558928012848, 0.26126888394355774, -0.21000991761684418, -0.18028098344802856, -0.0880206823348999, 0.3721497654914856, -0.06549949944019318, 0.09034555405378342, 0.12236753106117249, 0.09291329979896545, 0.00002891942858695984, 0.38386738300323486, 0.08399182558059692, 0.25737079977989197, 0.24990183115005493, -0.13741633296012878, -0.34293001890182495, -0.11343176662921906, -0.012656062841415405, 0.23795366287231445, -0.31533291935920715, -0.1315423548221588, 0.331234872341156, 0.06406758725643158, 0.07636953145265579, -0.08350319415330887, -0.03144359216094017, -0.10177673399448395, 0.3243890404701233, 0.6529427766799927, 0.10993883013725281, -0.23263122141361237, -0.05341031402349472, -0.5609846115112305, -0.056199811398983, -0.24252107739448547, -0.16940873861312866, 0.03134572133421898, 0.0708886981010437, 0.020000286400318146, 0.09086285531520844, 0.2534233629703522, -0.011279735714197159, -0.09292447566986084, 0.5938348770141602, -0.09362992644309998, -0.5162169337272644, -0.07628573477268219, 0.3115272521972656, -0.09058868885040283, -0.1367374062538147, 0.08107927441596985, 0.018163729459047318, 0.0013034045696258545, -0.07260457426309586, -0.22115689516067505, -0.0755227655172348, -0.201494961977005, 0.4251178801059723, 0.2250947803258896, 0.32982420921325684, -0.05057121068239212, 0.21638470888137817, -0.19030579924583435, -0.15077923238277435, -0.2574860453605652, -0.021601364016532898, 0.07049180567264557, 0.39453762769699097, -0.1786547303199768, -0.11223530769348145, -0.25059300661087036, -0.14625580608844757, 0.20755155384540558, 0.05510193109512329, -0.28799405694007874, 0.16210395097732544, 0.04186451435089111, -0.1342889815568924, -0.0424138680100441, 0.12772434949874878, -0.016384072601795197, 0.08219791203737259, -0.20443305373191833, -0.4666200280189514, 0.39729028940200806, -0.5594139695167542, -0.27965664863586426, 0.062005795538425446, -0.03322495520114899, -0.09282197803258896, 0.029786542057991028, 0.0372529998421669, -0.09574423730373383, 0.2885717451572418, 0.031719502061605453, 0.007330212742090225, 0.01601497083902359, 0.05937137082219124, 0.20005418360233307, -0.03827439621090889, 0.073184072971344, -0.14725598692893982, 0.05932477116584778, 0.20657168328762054, -0.15162599086761475 ]
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
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.
[ -0.22105185687541962, -0.05650898069143295, -0.060585517436265945, 0.10834081470966339, 0.2632572054862976, 0.1530718207359314, 0.47241756319999695, 0.2116657942533493, 0.12337958812713623, 0.16673406958580017, 0.2963007390499115, 0.31560662388801575, -0.33497437834739685, 0.0900607630610466, 0.07807714492082596, -0.26831722259521484, 0.2543313205242157, 0.05102761834859848, -0.16069091856479645, -0.234289288520813, -0.4243946671485901, 0.19226816296577454, -0.1841754913330078, 0.19716989994049072, -0.4763962924480438, -0.010748909786343575, -0.3853923976421356, 0.21124345064163208, 0.029560435563325882, -0.18921850621700287, 0.16238050162792206, -0.20089611411094666, 0.06758534163236618, 0.47937828302383423, -0.0001221692218678072, 0.00535593181848526, 0.3364502787590027, -0.11743699759244919, -0.4036915898323059, -0.17737682163715363, -0.4253527522087097, -0.22403249144554138, -0.09701342135667801, -0.43424221873283386, 0.11097470670938492, -0.4430277347564697, 0.04261532798409462, -0.374685138463974, 0.3017171025276184, 0.19298429787158966, 0.13451942801475525, -0.01729562133550644, -0.11297862976789474, -0.04066624864935875, -0.009664401412010193, 0.4321247935295105, 0.05096466839313507, 0.15536554157733917, 0.20074081420898438, -0.316984623670578, 0.2306891679763794, 0.4278726875782013, -0.02100059948861599, -0.05068306252360344, 0.3245171010494232, 0.19404006004333496, 0.09117692708969116, -0.5345325469970703, 0.2856537401676178, 0.030750209465622902, 0.35803839564323425, -0.16537907719612122, -0.497954398393631, -0.46479231119155884, -0.012066999450325966, 0.06348427385091782, -0.0037385374307632446, 0.06180144101381302, -0.10538811981678009, -0.006770268082618713, -0.3934882879257202, -0.10643843561410904, 0.04560041427612305, 0.23138293623924255, -0.1265941858291626, 0.057547811418771744, 0.015197908505797386, 0.2239704430103302, 0.07937934994697571, 0.02720111608505249, -0.1354207694530487, -0.11181443929672241, 0.08429858088493347, 0.3511122167110443, 0.07077395170927048, 0.10744944214820862, 0.07472025603055954, 0.10094001889228821, 0.01982174813747406, -0.4107203483581543, -0.35039255023002625, -0.19801118969917297, 0.023804854601621628, 0.035038068890571594, 0.23480316996574402, 0.37410610914230347, 0.06229012832045555, 0.6092025637626648, -0.011811062693595886, -0.11278631538152695, -0.16915345191955566, -0.0627555251121521, -0.18750052154064178, -0.2086438685655594, 0.3822363317012787, 0.22150224447250366, 0.20130740106105804, 0.1438068449497223, 0.16682998836040497, 0.14027944207191467, 0.06328098475933075, 0.026643233373761177, -0.2651028037071228, 0.2712877094745636, 0.09209956228733063, 0.10904563963413239, 0.25725990533828735, 0.23064036667346954, -0.16965094208717346, 0.057137664407491684, -0.24301615357398987, 0.24532774090766907, -0.4142555296421051, -0.06238742172718048, -0.013142604380846024, -0.04627053067088127, 0.2901509702205658, -0.1248985305428505, 0.02594870701432228, 0.08767363429069519, -0.2054748237133026, -0.1293613165616989, 0.3076210618019104, 0.3766114115715027, -0.1075262576341629, 0.3997466564178467, 0.46931520104408264, -0.31985968351364136, -0.03462771326303482, 0.2696011960506439, -0.44821012020111084, -0.0032307468354701996, -0.03877630829811096, 0.04563157260417938, -0.24303004145622253, 0.06048376113176346, -0.7241249680519104, 0.1203455775976181, 0.31662535667419434, 0.145221546292305, 0.1408385932445526, -0.25305747985839844, -0.17233842611312866, -0.14494873583316803, 0.16069583594799042, 0.5728596448898315, -0.641749382019043, -0.1510799378156662, -0.017345786094665527, 0.03785965219140053, 0.04211188480257988, -0.15782085061073303, -0.08770571649074554, 0.5277339220046997, -0.3821842670440674, 0.11282935738563538, 0.13972386717796326, -0.58965003490448, -0.36464715003967285, 0.3214035928249359, -0.12616705894470215, -0.09245038777589798, -0.08163266628980637, 0.1239418312907219, 0.26909777522087097, 0.17768558859825134, 0.06673078238964081, 0.1702505499124527, -0.19594968855381012, 0.19215089082717896, 0.010538998991250992, 0.034580767154693604, -0.027120888233184814, 0.14220771193504333, 0.476606160402298, 0.36563315987586975, 0.008239351212978363, 0.20762614905834198, -0.021360300481319427, -0.09025877714157104, 0.19197051227092743, 0.29550105333328247, 0.03719291463494301, -0.03176175057888031, 0.27935972809791565, 0.13390904664993286, -0.19981029629707336, 0.310289204120636, -0.019537582993507385, 0.032461900264024734, -0.48643600940704346, 0.08598853647708893, -0.36197924613952637, 0.1051873043179512, -0.30080652236938477, -0.38221487402915955, 0.015133555978536606, 0.08635039627552032, 0.05616110935807228, 0.2974730432033539, -0.11173621565103531, 0.17427043616771698, 0.07342863082885742, 0.08386498689651489, -0.26456648111343384, 0.23371879756450653, -0.014582069590687752, -0.22658482193946838, -0.18798305094242096, -0.11542076617479324, 0.039065998047590256, -0.043047595769166946, -0.18786612153053284, 0.45975786447525024, 0.24474695324897766, 0.0972977727651596, -0.08802299946546555, 0.07237463444471359, 0.3631758391857147, -0.32811790704727173, -0.06458909064531326, -0.037084877490997314, 0.238627091050148, -0.056507255882024765, -0.2702588438987732, 0.2620982825756073, 0.02046096883714199, 0.46277517080307007, -0.020027704536914825, 0.2492438554763794, -0.012202795594930649, -0.08804041147232056, -0.245104119181633, -0.2500990927219391, -0.1678895652294159, -0.6099152565002441, 0.21116285026073456, -0.06813778728246689, 0.0174708291888237, -0.07199753075838089, 0.31130358576774597, 0.15175794064998627, 0.18452629446983337, 0.01881692372262478, -0.27243128418922424, 0.36881783604621887, 0.13553524017333984, 0.35665979981422424, 0.4971662759780884, 0.14607375860214233, -0.25679704546928406, -0.02508951537311077, 0.0653727576136589, 0.15850219130516052, -0.11323853582143784, 0.055330172181129456, 0.27358609437942505, 0.00930812954902649, 0.0002079731784760952, 0.12729153037071228, -0.01882762648165226, -0.1159130334854126, -0.12358609586954117, 0.3451344668865204, -0.19523754715919495, 0.23261360824108124, -0.26839929819107056, -0.44547975063323975, 0.1124996691942215, 0.19284984469413757, 0.15532255172729492, -0.42912447452545166, -0.09092607349157333, -0.16989757120609283, -0.05015897750854492, 0.14072580635547638, -0.28042757511138916, -0.19571824371814728, 0.08922483026981354, -0.3475283682346344, -0.24250443279743195, -0.20228885114192963, -0.2895301282405853, -0.04338464140892029, 0.06791673600673676, -0.16396039724349976, 0.23654164373874664, -0.23985320329666138, 0.008726624771952629, -0.2174651175737381, -0.2945021688938141, 0.2022847831249237, -0.20894530415534973, 0.3684837520122528, 0.20645672082901, 0.3945040702819824, -0.4795875549316406, -0.19398050010204315, 0.49773046374320984, -0.1775631606578827, -0.3670768737792969, 0.06501069664955139, 0.10514092445373535, -0.20633408427238464, -0.23365655541419983, -0.13470607995986938, -0.14688681066036224, -0.09044792503118515, -0.06801649928092957, -0.08393484354019165, -0.018361888825893402, 0.36173295974731445, 0.4965209364891052, -0.08191779255867004, 0.14128552377223969, -0.27132222056388855, 0.01809108816087246, 0.007795501500368118, 0.2732960879802704, -0.05884900316596031, -0.3723752200603485, -0.11101067811250687, -0.3524048924446106, 0.17485560476779938, 0.23897671699523926, -0.5152304172515869, -0.12370521575212479, -0.08654777705669403, 0.2520768642425537, 0.17007064819335938, 0.07787111401557922, 0.34131181240081787, -0.016303392127156258, -0.044559210538864136, -0.42054837942123413, -0.03521290794014931, 0.035402148962020874, 0.08002074062824249, 0.29011186957359314, 0.11345669627189636, 0.4407595098018646, 0.052080292254686356, 0.7281198501586914, -0.1502067893743515, -0.2564127445220947, 0.22855636477470398, -0.43077290058135986, 0.3369485139846802, -0.2158660590648651, -0.5711135864257812, 0.15090452134609222, 0.21668830513954163, -0.22012196481227875, 0.06291839480400085, -0.14399191737174988, -0.1822241246700287, -0.13302944600582123, 0.25851649045944214, -0.7099380493164062, 0.01066383346915245, 0.033603914082050323, -0.27817368507385254, 0.1921960711479187, -0.030937299132347107, 0.06133907288312912, -0.12069571018218994, 0.1753770112991333, 0.006085807457566261, 0.1435527205467224, 0.449406236410141, 0.15139009058475494, -0.12208123505115509, -0.3043069541454315, -0.24990364909172058, 0.05610804632306099, 0.058372482657432556, 0.3843732178211212, -0.3190268278121948, -0.08251207321882248, -0.021970748901367188, 0.10945874452590942, 0.8251120448112488, -0.3944642245769501, -0.08316069841384888, 0.10791867971420288, -0.2232305109500885, -0.5548207759857178, -0.17896929383277893, -0.02971508912742138, 0.3361848294734955, -0.24368353188037872, 0.8831846117973328, -0.005536578595638275, 0.050249338150024414, 0.09802034497261047, 0.09264636039733887, -0.28015854954719543, -0.1424155831336975, -0.37216272950172424, -0.3145507574081421, -0.48777955770492554, 0.12279187887907028, 0.1266544610261917, -0.015409361571073532, 0.21446095407009125, 0.145570769906044, -0.09952577948570251, 0.06962201744318008, -0.0869743674993515, 0.06788431107997894, 0.31846100091934204, 0.12267566472291946, 0.16878412663936615, 0.10742183029651642, 0.18029502034187317, 0.23405878245830536, 0.3087732493877411, -0.0390460304915905, -0.3800705671310425, 0.12307552993297577, -0.19272814691066742, 0.18510857224464417, 0.08457930386066437, -0.19508814811706543, -0.4640071988105774, 0.12675774097442627, 0.0165228433907032, -0.35676679015159607, 0.25414714217185974, 0.3099832534790039, -0.1838018149137497, -0.23937541246414185, -0.44794854521751404, 0.3313862085342407, 0.1987086981534958, -0.11701858043670654, 0.22449833154678345, 0.11838535219430923, -0.32081010937690735, 0.40127110481262207, 0.22285917401313782, 0.5119656920433044, -0.21828149259090424, 0.1307324916124344, 0.17167675495147705, 0.14780275523662567, 0.31459495425224304, 0.3677435517311096, -0.0747525691986084, -0.22305777668952942, -0.26533418893814087, -0.05044625699520111, -0.10716985166072845, 0.1043626144528389, 0.26315003633499146, -0.13456088304519653, 0.17708082497119904, -0.30674245953559875, -0.068640798330307, -0.04971102625131607, -0.16274939477443695, 0.17582564055919647, -0.22329889237880707, 0.1298852562904358, 0.14564475417137146, 0.08311568200588226, 0.4265226423740387, -0.011643878184258938, 0.05002034083008766, -0.5480877161026001, -0.19827628135681152, -0.2785860300064087, 0.025946233421564102, -0.2507954239845276, 0.05487348139286041, -0.08764335513114929, -0.19641494750976562, -0.22170227766036987, 0.688169538974762, 0.38642627000808716, 0.11399722099304199, -0.011208662763237953, 0.21639668941497803, -0.04731563478708267, 0.28829294443130493, 0.017027687281370163, -0.2182694375514984, 0.29086756706237793, 0.1434817612171173, -0.11523541063070297, -0.1102074459195137, -0.13250058889389038, -0.07551565766334534, -0.311960905790329, 0.10892622172832489, -0.14315856993198395, 0.012599527835845947, -0.2528311312198639, -0.025462128221988678, 0.07712104916572571, -0.0035133101046085358, 0.031459078192710876, 0.026665665209293365, 0.195587620139122, 0.3389739990234375, -0.16261574625968933, -0.33961600065231323, 0.04977988451719284, 0.5517610311508179, 0.012874679639935493, -0.15304052829742432, 0.47991248965263367, -0.1441110372543335, 0.05687075853347778, -0.17277845740318298, 0.1266041100025177, 0.42805758118629456, -0.4457983672618866, 0.21538974344730377, 0.01928992196917534, 0.21808697283267975, -0.048975132405757904, 0.06077814847230911, -0.015145093202590942, -0.29890644550323486, -0.046306539326906204, -0.22044537961483002, -0.4115254282951355, 0.29722389578819275, -0.2821073532104492, 0.19009093940258026, -0.13347958028316498, -0.09092183411121368, 0.24928992986679077, -0.044035837054252625, -0.21037201583385468, -0.1203857958316803, -0.19863374531269073, 0.18399746716022491, 0.33338022232055664, 0.5500332713127136, 0.04155619069933891, -0.1864340454339981, 0.026825284585356712, 0.03470301255583763, 0.007054949179291725, -0.1480679214000702, -0.031131166964769363, 0.16407731175422668, 0.16758176684379578, 0.107137031853199, 0.02713596448302269, -0.15825185179710388, -0.020798824727535248, -0.22569939494132996, 0.10568678379058838, 0.25948241353034973, -0.24154286086559296, 0.4514652192592621, 0.08308262377977371, 0.3111925721168518, 0.4022858738899231, 0.06264729052782059, -0.0895102471113205, 0.19384990632534027, 0.16533046960830688, 0.14323130249977112, 0.4722778797149658, 0.06570485234260559, -0.10838136076927185, -0.10705975443124771, -0.3295232653617859, 0.1048230230808258, 0.3282071053981781, -0.3928402066230774, 0.4407999515533447, 0.2784407436847687, 0.23402979969978333, -0.0814390629529953, -0.30691829323768616, 0.08856876194477081, 0.35556983947753906, 0.1440952867269516, -0.20112508535385132, -0.05630835145711899, 0.28212621808052063, 0.14187011122703552, -0.046352218836545944, 0.14039790630340576, 0.09677407145500183, 0.01537344604730606, -0.23648701608181, 0.053852349519729614, 0.4300583302974701, -0.34807199239730835, 0.2098684459924698, 0.8231470584869385, -0.17960382997989655, 0.2372988909482956, 0.15301385521888733, 0.29443925619125366, -0.15860408544540405, 0.5478957891464233, -0.0493876114487648, 0.3272033631801605, 0.17201390862464905, 0.09655983746051788, 0.22086560726165771, -0.30629685521125793, 0.049972087144851685, -0.06412473320960999, -0.1671520173549652, 0.24585771560668945, -0.16281743347644806, 0.18245522677898407, 0.02375904470682144, -0.1490904837846756, 0.09630395472049713, 0.0629117339849472, -0.17073985934257507, 0.10268136858940125, -0.3835703432559967, -0.02668636292219162, -0.16303634643554688, -0.07195746898651123, 0.04822260141372681, -0.38675934076309204, 0.28498542308807373, 0.007103398442268372, -0.29304468631744385, -0.04515916854143143, -0.41850414872169495, 0.3183206021785736, 0.11237021535634995, -0.17611145973205566, -0.0049509648233652115, 0.047317225486040115, 0.00854010134935379, 0.3743981719017029, 0.5605368614196777, 0.33751317858695984, 0.42558878660202026, -0.0706414133310318, 0.18297883868217468, -0.07705533504486084, -0.12865996360778809, -0.16700755059719086, 0.3172767758369446, -0.10721877217292786, 0.005709188058972359, 0.17625506222248077, 0.09241802990436554, 0.0007809903472661972, 0.31552937626838684, 0.05940108373761177, 0.24147528409957886, 0.19566603004932404, -0.12441764026880264, -0.28308331966400146, -0.000890977680683136, -0.005782250314950943, 0.20288997888565063, -0.3349459171295166, -0.2421727031469345, 0.3738764226436615, 0.018226707354187965, 0.16100051999092102, -0.0503387376666069, -0.014977674931287766, -0.22004427015781403, 0.349378377199173, 0.6706637740135193, 0.1581714004278183, -0.27685627341270447, -0.041549477726221085, -0.5652067065238953, -0.12935712933540344, -0.2993897795677185, -0.21212585270404816, 0.028974242508411407, 0.09327086806297302, 0.06504707783460617, 0.06987851858139038, 0.28501495718955994, -0.10257846117019653, -0.10785765945911407, 0.5780853033065796, -0.1286495178937912, -0.445624440908432, -0.14436490833759308, 0.3206820487976074, -0.03423262760043144, -0.17971399426460266, 0.05292240530252457, -0.007739768363535404, 0.016253873705863953, -0.0653342753648758, -0.15764248371124268, -0.058531828224658966, -0.11714862287044525, 0.424836665391922, 0.24639840424060822, 0.3153461813926697, -0.07341517508029938, 0.18329373002052307, -0.24942126870155334, -0.15529710054397583, -0.2503989338874817, -0.052841342985630035, 0.025524552911520004, 0.5383056402206421, -0.17439286410808563, -0.1582772135734558, -0.22442960739135742, -0.12315922975540161, 0.29335808753967285, -0.1009572222828865, -0.20964570343494415, 0.188658207654953, -0.05970039591193199, -0.13309581577777863, 0.01949905976653099, 0.20815712213516235, -0.03643062710762024, 0.11980059742927551, -0.17173972725868225, -0.5024548172950745, 0.4158945381641388, -0.5098033547401428, -0.30668944120407104, -0.01828739419579506, -0.052591800689697266, -0.1195254847407341, 0.13047336041927338, -0.02078446000814438, -0.1066010370850563, 0.3091921806335449, -0.0035882405936717987, -0.09652793407440186, 0.07803493738174438, 0.05338052287697792, 0.1899777501821518, -0.009870501235127449, -0.03468022495508194, -0.12432821840047836, 0.08060837537050247, 0.18326200544834137, -0.149662584066391 ]
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
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.
[ -0.315396249294281, -0.1061716303229332, -0.01786620169878006, 0.12197808176279068, 0.21011845767498016, 0.11844345182180405, 0.4634915888309479, 0.20816485583782196, 0.21189354360103607, 0.12302280217409134, 0.30953651666641235, 0.3759862184524536, -0.3384236991405487, 0.018395783379673958, 0.04212091118097305, -0.2526935338973999, 0.2913418114185333, 0.07602527737617493, -0.1750900149345398, -0.2553942799568176, -0.4571002721786499, 0.16980597376823425, -0.16327790915966034, 0.28160178661346436, -0.4252300262451172, -0.006026832386851311, -0.41362738609313965, 0.2742369472980499, -0.03058522380888462, -0.09416048228740692, 0.10970982909202576, -0.23174741864204407, 0.007236789911985397, 0.49838680028915405, -0.00012388985487632453, -0.06064688414335251, 0.3674902319908142, -0.08516198396682739, -0.3637680113315582, -0.21195174753665924, -0.5288519263267517, -0.1956067681312561, -0.07779649645090103, -0.4310917258262634, 0.13721343874931335, -0.4558437764644623, 0.07378596812486649, -0.37951287627220154, 0.342504620552063, 0.17797710001468658, 0.123806431889534, -0.09620308130979538, -0.18653371930122375, -0.1019674614071846, 0.04786771163344383, 0.44807112216949463, 0.051797159016132355, 0.16560594737529755, 0.1562623381614685, -0.36218777298927307, 0.17756807804107666, 0.37296921014785767, -0.10033538192510605, -0.02819148451089859, 0.38901257514953613, 0.13580472767353058, -0.00821349024772644, -0.4657346308231354, 0.34630298614501953, 0.11599887907505035, 0.4415401816368103, -0.25483715534210205, -0.4079176187515259, -0.3732282221317291, 0.04193725809454918, 0.13590063154697418, 0.07295706868171692, 0.06148744374513626, -0.10793246328830719, -0.017240513116121292, -0.36792290210723877, -0.2316223680973053, 0.035546183586120605, 0.1628279983997345, -0.2607898414134979, 0.010833218693733215, 0.029063284397125244, 0.23312976956367493, 0.06085057929158211, -0.032975032925605774, -0.07684595137834549, -0.11130371689796448, 0.053870007395744324, 0.3940871059894562, 0.11419086158275604, 0.06653416156768799, 0.07934844493865967, 0.2577863931655884, 0.034886062145233154, -0.45784348249435425, -0.4094904661178589, -0.2067810297012329, -0.03650499880313873, 0.05973024666309357, 0.28896453976631165, 0.37125852704048157, 0.04050739109516144, 0.6056997179985046, 0.053486257791519165, -0.16109733283519745, -0.12349097430706024, -0.047687798738479614, -0.16886141896247864, -0.1317722648382187, 0.34364748001098633, 0.14895832538604736, 0.21103140711784363, 0.07237263023853302, 0.2454419732093811, 0.06236642599105835, 0.11341405659914017, 0.05699421465396881, -0.32382798194885254, 0.2682408392429352, 0.11131515353918076, 0.02567664347589016, 0.2534022927284241, 0.1746511459350586, -0.12964719533920288, 0.015249011106789112, -0.22458776831626892, 0.30764105916023254, -0.44226810336112976, -0.059900857508182526, -0.04577452316880226, -0.05225387588143349, 0.21491052210330963, -0.10516376048326492, -0.007034957408905029, 0.19452401995658875, -0.28973889350891113, -0.10312718152999878, 0.22342461347579956, 0.34831714630126953, -0.04357033222913742, 0.36576467752456665, 0.4387703835964203, -0.3857579231262207, -0.03324289992451668, 0.30963635444641113, -0.44525420665740967, 0.004459496587514877, -0.03325638920068741, 0.033291369676589966, -0.3252396583557129, 0.053840745240449905, -0.67223060131073, 0.09407041221857071, 0.24138948321342468, 0.01764298975467682, 0.14437462389469147, -0.20010454952716827, -0.2083802968263626, -0.12679745256900787, 0.025212014093995094, 0.691594660282135, -0.6458629369735718, -0.1513291597366333, -0.10411010682582855, -0.013747338205575943, -0.06529668718576431, -0.06342543661594391, -0.027051320299506187, 0.4578254222869873, -0.3732565641403198, 0.14673234522342682, 0.13157840073108673, -0.52019864320755, -0.3532373309135437, 0.37360504269599915, -0.1541408747434616, -0.17238569259643555, -0.09607385843992233, 0.1351013481616974, 0.28455355763435364, 0.1489408016204834, 0.012962453067302704, 0.15160425007343292, -0.1981009691953659, 0.21006642282009125, -0.011490900069475174, 0.03041485883295536, -0.01071428507566452, 0.1511964648962021, 0.4908709228038788, 0.48629239201545715, 0.07792393118143082, 0.29051896929740906, -0.10962677747011185, -0.06866586208343506, 0.18516193330287933, 0.29252123832702637, 0.09891769289970398, -0.0924992710351944, 0.26397719979286194, 0.12148896604776382, -0.19701212644577026, 0.24606332182884216, 0.018604807555675507, 0.07260721176862717, -0.565085232257843, 0.12454777956008911, -0.32583680748939514, 0.078248031437397, -0.2409277707338333, -0.1939307451248169, 0.007435470819473267, -0.022942520678043365, 0.02065311372280121, 0.3273978531360626, -0.14122648537158966, 0.24691742658615112, 0.1305144876241684, 0.0722605288028717, -0.3020085394382477, 0.22050605714321136, -0.05604013055562973, -0.17715215682983398, -0.16106241941452026, -0.15513324737548828, 0.043010812252759933, -0.01600840501487255, -0.13644984364509583, 0.4289681613445282, 0.13101503252983093, 0.13222891092300415, 0.0074026621878147125, 0.07047764956951141, 0.4338299334049225, -0.4203725755214691, 0.04252529889345169, -0.07175302505493164, 0.29110217094421387, -0.02148161455988884, -0.3713226616382599, 0.17630620300769806, -0.06821563839912415, 0.4207240343093872, -0.02847697213292122, 0.2705136835575104, -0.020887810736894608, -0.12033073604106903, -0.19171042740345, -0.24444396793842316, -0.11926169693470001, -0.5536996126174927, 0.1558913141489029, -0.025548258796334267, 0.035284414887428284, -0.14048677682876587, 0.2895565629005432, 0.122348353266716, 0.24049964547157288, 0.11260761320590973, -0.2686571180820465, 0.34669432044029236, 0.12682008743286133, 0.4006003141403198, 0.6104682683944702, 0.11794973164796829, -0.28978827595710754, 0.05572829768061638, 0.09572122246026993, 0.16129203140735626, -0.08761277049779892, -0.027941137552261353, 0.22437407076358795, 0.018875930458307266, 0.03160304203629494, 0.1222091019153595, -0.02903648279607296, -0.18542487919330597, -0.11902724206447601, 0.4284954071044922, -0.1770315021276474, 0.1996101588010788, -0.3090228736400604, -0.5141729116439819, 0.1546768695116043, 0.30772164463996887, 0.09954935312271118, -0.37940382957458496, -0.009979236871004105, -0.16663512587547302, -0.019656803458929062, 0.12466125935316086, -0.24730856716632843, -0.1436227411031723, 0.07136482000350952, -0.292240709066391, -0.3258476257324219, -0.2460746020078659, -0.21873518824577332, -0.044011134654283524, 0.1055322214961052, -0.14109042286872864, 0.15769894421100616, -0.3310575485229492, 0.03911231830716133, -0.3379528820514679, -0.1845197081565857, 0.24261540174484253, -0.1755370795726776, 0.3288072943687439, 0.2944972515106201, 0.4535626769065857, -0.46514785289764404, -0.13250190019607544, 0.4929741621017456, -0.2508230209350586, -0.39059126377105713, 0.15653450787067413, -0.022453365847468376, -0.18499432504177094, -0.24077661335468292, -0.06104887276887894, -0.05399133265018463, -0.06728443503379822, -0.022165119647979736, -0.08065720647573471, 0.0017119720578193665, 0.3251875042915344, 0.5039724111557007, -0.18561623990535736, 0.08048854023218155, -0.3552156090736389, 0.06282197684049606, 0.04327836260199547, 0.2854974865913391, -0.034618549048900604, -0.37723666429519653, -0.09567064791917801, -0.2372344583272934, 0.14021213352680206, 0.24638628959655762, -0.4555399417877197, -0.08138512820005417, -0.029105814173817635, 0.31122079491615295, 0.10670940577983856, 0.010136540979146957, 0.3418973386287689, 0.08317703008651733, -0.03182273358106613, -0.40370509028434753, 0.06178600713610649, -0.05828314274549484, 0.07031133770942688, 0.27802717685699463, 0.2037597894668579, 0.4557226896286011, 0.06993143260478973, 0.6251301765441895, -0.23282261192798615, -0.15840047597885132, 0.2343955636024475, -0.44056832790374756, 0.3936379849910736, -0.21828866004943848, -0.5436654686927795, 0.09445620328187943, 0.2902566194534302, -0.22847972810268402, 0.09559610486030579, -0.1381065547466278, -0.24479101598262787, -0.17823873460292816, 0.2019960731267929, -0.660495936870575, 0.07826818525791168, -0.0113466065376997, -0.180388942360878, 0.12468749284744263, 0.04505966231226921, -0.08062225580215454, -0.11291033029556274, 0.11879131942987442, 0.08708375692367554, 0.20985400676727295, 0.43223437666893005, 0.1641765534877777, -0.1020459532737732, -0.25982415676116943, -0.22191044688224792, 0.027261346578598022, -0.049441900104284286, 0.29639244079589844, -0.40300849080085754, -0.055104225873947144, -0.044220760464668274, 0.15265865623950958, 0.7738456726074219, -0.35537534952163696, 0.01057848334312439, 0.08665086328983307, -0.13638946413993835, -0.6321832537651062, -0.0645686686038971, -0.026313288137316704, 0.36704951524734497, -0.34471753239631653, 0.945219099521637, 0.02602614462375641, 0.07070860266685486, 0.12548847496509552, 0.11858761310577393, -0.25004106760025024, -0.22882752120494843, -0.34838372468948364, -0.31693947315216064, -0.4664822816848755, 0.10284876823425293, 0.11550750583410263, -0.06449706852436066, 0.2895885705947876, 0.1720743179321289, -0.06710763275623322, 0.024734728038311005, -0.2062671035528183, 0.0399908609688282, 0.2854101061820984, -0.006115213502198458, 0.15287449955940247, 0.12360924482345581, 0.1924562007188797, 0.08359182626008987, 0.25441551208496094, 0.011323174461722374, -0.3554196059703827, 0.10379865765571594, -0.20676526427268982, 0.11871588975191116, 0.04943252354860306, -0.19169360399246216, -0.4626607894897461, 0.06788575649261475, 0.055288270115852356, -0.23614050447940826, 0.11593754589557648, 0.17358841001987457, -0.23415036499500275, -0.18344053626060486, -0.35470259189605713, 0.3275511562824249, 0.21377642452716827, -0.09493371099233627, 0.25446388125419617, 0.142991304397583, -0.3092566132545471, 0.4371706247329712, 0.14683279395103455, 0.5944947600364685, -0.2736469507217407, 0.07237481325864792, 0.14311519265174866, 0.10257963836193085, 0.38071173429489136, 0.2652304768562317, -0.14207898080348969, -0.23996613919734955, -0.27444788813591003, -0.07170440256595612, -0.05420480668544769, 0.15880605578422546, 0.18849609792232513, -0.12200309336185455, 0.21876269578933716, -0.3128794729709625, -0.05922069773077965, 0.006524878554046154, -0.19090144336223602, 0.1205228641629219, -0.2039739042520523, 0.10634012520313263, 0.129497230052948, 0.0461609773337841, 0.4305172562599182, -0.027070660144090652, 0.11954338848590851, -0.4908607304096222, -0.22227907180786133, -0.28768256306648254, -0.04494494944810867, -0.12035199254751205, 0.035346098244190216, -0.11162956058979034, -0.1825164556503296, -0.17192263901233673, 0.7544264793395996, 0.26833856105804443, 0.10657081007957458, -0.07103316485881805, 0.23788364231586456, -0.07792093604803085, 0.3312090337276459, -0.02625664509832859, -0.13937321305274963, 0.18466342985630035, 0.1116207167506218, -0.12515518069267273, -0.18979981541633606, -0.18485021591186523, -0.046352285891771317, -0.2933771014213562, 0.09093663096427917, -0.12742729485034943, 0.07993390411138535, -0.25386562943458557, -0.1002122014760971, 0.14206494390964508, 0.003721088171005249, 0.029243245720863342, 0.019960936158895493, 0.25111499428749084, 0.2844609022140503, -0.1465638130903244, -0.3244321048259735, 0.05780132859945297, 0.5839855670928955, -0.03995303064584732, -0.04951058700680733, 0.3583928346633911, -0.08551313728094101, 0.03828110545873642, -0.1774534285068512, 0.13933849334716797, 0.4534783661365509, -0.5098826289176941, 0.17032204568386078, -0.06673543155193329, 0.20988456904888153, -0.1210634708404541, 0.07828418165445328, -0.020352937281131744, -0.2840781807899475, -0.011970490217208862, -0.2352326512336731, -0.34260293841362, 0.3260415196418762, -0.2754344344139099, 0.06664454191923141, -0.08456746488809586, -0.18728391826152802, 0.33413171768188477, -0.09636332839727402, -0.1977560818195343, -0.05672939866781235, -0.2077273428440094, 0.19852818548679352, 0.46833720803260803, 0.6400368809700012, -0.038022514432668686, -0.23991747200489044, 0.017478177323937416, 0.060675524175167084, 0.07365726679563522, -0.13714785873889923, 0.0160871222615242, 0.18306605517864227, 0.16650080680847168, 0.1360982060432434, 0.03469064459204674, -0.1489259898662567, -0.011111263185739517, -0.17393696308135986, 0.044148754328489304, 0.3159489035606384, -0.2606393098831177, 0.4178984463214874, 0.1048702746629715, 0.23708578944206238, 0.3000530004501343, 0.1540384739637375, -0.02427215874195099, 0.10261690616607666, 0.042836107313632965, 0.13827599585056305, 0.4976680874824524, 0.04983821511268616, -0.05712501332163811, -0.11242123693227768, -0.38840049505233765, 0.152125746011734, 0.349319726228714, -0.34433501958847046, 0.5113431215286255, 0.35649266839027405, 0.23433244228363037, -0.11130024492740631, -0.33365342020988464, 0.07105765491724014, 0.36275678873062134, 0.11582856625318527, -0.23738859593868256, -0.11019665002822876, 0.3231062591075897, 0.19491878151893616, -0.1313050240278244, 0.08110791444778442, 0.021060403436422348, -0.031309835612773895, -0.21933315694332123, 0.08377698063850403, 0.514832615852356, -0.4287415146827698, 0.12647661566734314, 0.8168131113052368, -0.24586278200149536, 0.25927454233169556, 0.16633394360542297, 0.28685230016708374, -0.2277836799621582, 0.744597315788269, -0.09393877536058426, 0.25360116362571716, 0.11834175139665604, 0.15692590177059174, 0.29374539852142334, -0.27723079919815063, 0.13443905115127563, -0.06477130949497223, -0.1264493614435196, 0.11045359075069427, -0.12349337339401245, 0.12044116109609604, 0.0735083818435669, -0.07285404205322266, 0.13961990177631378, 0.06730100512504578, -0.15071284770965576, 0.09764623641967773, -0.33820176124572754, -0.07923353463411331, -0.0638873428106308, -0.010595608502626419, 0.023274404928088188, -0.32039034366607666, 0.35291486978530884, 0.05407990142703056, -0.23673216998577118, -0.000017605721950531006, -0.3291459083557129, 0.3374687731266022, 0.08196504414081573, -0.1831662654876709, -0.06512917578220367, 0.02563486248254776, 0.04602030664682388, 0.4025903046131134, 0.5419334173202515, 0.2848387062549591, 0.3572433292865753, -0.027589108794927597, 0.2682439088821411, -0.21399788558483124, -0.19416716694831848, -0.10303143411874771, 0.3700680434703827, -0.08151155710220337, 0.09560902416706085, 0.12103180587291718, 0.09517284482717514, 0.0072904909029603004, 0.3688284754753113, 0.09231184422969818, 0.2546733617782593, 0.2565116584300995, -0.12941858172416687, -0.32641756534576416, -0.13599225878715515, 0.004034321755170822, 0.23393452167510986, -0.29232165217399597, -0.14777439832687378, 0.3481931686401367, 0.06088979169726372, 0.08600640296936035, -0.08418937027454376, -0.03236948698759079, -0.10545341670513153, 0.2986292839050293, 0.6536590456962585, 0.08455170691013336, -0.24474233388900757, -0.054287269711494446, -0.5806484818458557, -0.06242980808019638, -0.25989070534706116, -0.1609177142381668, 0.029561761766672134, 0.07870513945817947, 0.03841358795762062, 0.09729503095149994, 0.21996751427650452, -0.0187141802161932, -0.10301026701927185, 0.5774098634719849, -0.08422261476516724, -0.5010045766830444, -0.07080009579658508, 0.30603480339050293, -0.0788026973605156, -0.15486320853233337, 0.0860401913523674, 0.039391595870256424, -0.0019273944199085236, -0.08481141924858093, -0.1838817000389099, -0.07624946534633636, -0.20291519165039062, 0.4069519639015198, 0.2394099235534668, 0.29845336079597473, -0.03747386857867241, 0.1970883160829544, -0.19814792275428772, -0.13781192898750305, -0.2559770941734314, -0.013533756136894226, 0.06164596974849701, 0.39917758107185364, -0.18190248310565948, -0.12855613231658936, -0.236856609582901, -0.1478225290775299, 0.2086513191461563, 0.07681874930858612, -0.31043100357055664, 0.18348924815654755, 0.022770792245864868, -0.11173361539840698, -0.03971650078892708, 0.13837745785713196, -0.02087133377790451, 0.08461993932723999, -0.1953355371952057, -0.4693586230278015, 0.3811926543712616, -0.573411762714386, -0.30371546745300293, 0.05065450072288513, -0.03689219057559967, -0.10342425853013992, -0.0056819431483745575, 0.021457113325595856, -0.09722242504358292, 0.28400012850761414, -0.011462721973657608, -0.017772730439901352, 0.026348214596509933, 0.029158536344766617, 0.19561202824115753, -0.031973373144865036, 0.06912513077259064, -0.1216915175318718, 0.047392770648002625, 0.20195962488651276, -0.13978120684623718 ]
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
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
[ -0.17238695919513702, -0.16476114094257355, -0.010105390101671219, 0.16590508818626404, 0.17817983031272888, 0.1107020452618599, 0.40471282601356506, 0.2250402718782425, 0.16491904854774475, 0.19509533047676086, 0.3144141733646393, 0.3826318383216858, -0.3329390287399292, 0.06640633940696716, -0.05160324275493622, -0.19769641757011414, 0.28553637862205505, 0.09437763690948486, -0.07178713381290436, -0.255048930644989, -0.5275387167930603, 0.11614272743463516, -0.14536815881729126, 0.27280664443969727, -0.43452006578445435, -0.05541414022445679, -0.3747526705265045, 0.2567180395126343, -0.04797933250665665, -0.12923377752304077, 0.02547481842339039, -0.17627626657485962, -0.07658322900533676, 0.4468465745449066, -0.0001278076961170882, -0.037849780172109604, 0.38589566946029663, -0.10220800340175629, -0.40125373005867004, -0.16990847885608673, -0.5132812261581421, -0.10303530842065811, -0.014417596161365509, -0.42839735746383667, 0.19396844506263733, -0.49568554759025574, 0.042911261320114136, -0.3543529808521271, 0.37938034534454346, 0.18475398421287537, 0.10056902468204498, -0.19004663825035095, -0.18648532032966614, -0.010907001793384552, 0.07644914090633392, 0.3904529809951782, 0.11482573300600052, 0.16091203689575195, 0.17899058759212494, -0.3226306140422821, 0.19593721628189087, 0.38754916191101074, -0.1557140201330185, -0.030552901327610016, 0.43039754033088684, 0.024512290954589844, 0.08327950537204742, -0.6132452487945557, 0.393980473279953, 0.09760889410972595, 0.45646077394485474, -0.20512151718139648, -0.43384209275245667, -0.42759206891059875, 0.033389754593372345, 0.06645994633436203, 0.007174469530582428, 0.06030437350273132, -0.20918118953704834, -0.04346325621008873, -0.3461703360080719, -0.29935622215270996, -0.008601721376180649, 0.14806011319160461, -0.24589967727661133, 0.10961475968360901, 0.07208926975727081, 0.2270733118057251, 0.07507866621017456, 0.09009268879890442, -0.03994636610150337, -0.10099975019693375, 0.09627377986907959, 0.3386822044849396, 0.09935042262077332, 0.08484987914562225, 0.06569644808769226, 0.2421756088733673, -0.005228186026215553, -0.4470043182373047, -0.5062907338142395, -0.10681664198637009, 0.02081560343503952, 0.0603613555431366, 0.3553224205970764, 0.35508862137794495, 0.1366998851299286, 0.5536133050918579, 0.10887277871370316, -0.18501512706279755, -0.11251284182071686, -0.030885711312294006, -0.113589346408844, -0.07359965890645981, 0.29724955558776855, 0.17793303728103638, 0.2395436316728592, 0.07658582925796509, 0.18510083854198456, 0.008367971517145634, 0.11343108862638474, 0.07436317950487137, -0.3094344139099121, 0.2802899181842804, 0.08334574103355408, 0.1310390830039978, 0.246499702334404, 0.1718032956123352, -0.1695777177810669, 0.07714837789535522, -0.20238161087036133, 0.28618156909942627, -0.3705991506576538, -0.13593503832817078, 0.010203629732131958, -0.04600765183568001, 0.23913933336734772, -0.06095628812909126, 0.016990285366773605, 0.14016923308372498, -0.25955894589424133, -0.16109901666641235, 0.2341550588607788, 0.38017043471336365, -0.08061155676841736, 0.3849766254425049, 0.42938685417175293, -0.4190453886985779, -0.007389739155769348, 0.34052759408950806, -0.43189582228660583, -0.0035287700593471527, 0.06204170733690262, 0.006969323381781578, -0.25226491689682007, 0.0953226238489151, -0.6512401700019836, 0.10429641604423523, 0.1921992301940918, 0.07886047661304474, 0.042176730930805206, -0.19122514128684998, -0.1861703097820282, -0.14051197469234467, -0.01400379091501236, 0.6709105372428894, -0.6312061548233032, -0.16796749830245972, -0.07977885752916336, -0.01256588101387024, 0.034289754927158356, -0.005700264126062393, -0.052411288022994995, 0.5209304094314575, -0.3237209618091583, 0.08366003632545471, 0.06711897253990173, -0.5798285007476807, -0.37826600670814514, 0.40137332677841187, -0.14086323976516724, -0.11389599740505219, -0.06742986291646957, 0.14498402178287506, 0.32347238063812256, 0.18384820222854614, -0.03124125301837921, 0.08334868401288986, -0.185332790017128, 0.18263106048107147, 0.01709948107600212, 0.0365309864282608, 0.011950293555855751, 0.10608620941638947, 0.5382447838783264, 0.5622203946113586, 0.02982918918132782, 0.2889702022075653, -0.02627425640821457, -0.05739177390933037, 0.21069712936878204, 0.309368371963501, 0.09224268049001694, -0.06117880344390869, 0.2821451425552368, 0.14496362209320068, -0.16741517186164856, 0.29909324645996094, -0.04224371165037155, 0.11277995258569717, -0.6442784667015076, 0.07770321518182755, -0.2833530604839325, 0.06416332721710205, -0.2825854420661926, -0.21305310726165771, -0.02751200832426548, -0.05731081962585449, -0.014759540557861328, 0.28883734345436096, -0.18167363107204437, 0.2332720309495926, 0.09008511155843735, 0.13664574921131134, -0.22400736808776855, 0.13668940961360931, -0.060045160353183746, -0.15659107267856598, -0.1669551432132721, -0.1420009732246399, 0.07472386211156845, -0.024959856644272804, -0.13976135849952698, 0.40326476097106934, 0.18911178410053253, 0.07146231830120087, -0.047689951956272125, 0.08728918433189392, 0.448624849319458, -0.3561657667160034, -0.005252009257674217, -0.08135873079299927, 0.3504151701927185, -0.029124390333890915, -0.3452535569667816, 0.14368946850299835, -0.0923490822315216, 0.5224118232727051, 0.023621834814548492, 0.2538200318813324, -0.01818014308810234, -0.16192393004894257, -0.18168286979198456, -0.2187308520078659, -0.18877632915973663, -0.6474984884262085, 0.11959905922412872, -0.07374945282936096, 0.01627252995967865, -0.16013121604919434, 0.3256720304489136, 0.16874031722545624, 0.25589293241500854, 0.08498194068670273, -0.26491162180900574, 0.35131576657295227, 0.114546038210392, 0.35679537057876587, 0.5610660910606384, 0.11153101176023483, -0.27462857961654663, 0.042971171438694, 0.19427573680877686, 0.1542828232049942, -0.00006517767906188965, 0.08866898715496063, 0.2517949342727661, 0.060539502650499344, 0.043534718453884125, 0.17004576325416565, -0.06716369837522507, -0.1522359549999237, -0.12902292609214783, 0.39008429646492004, -0.16036847233772278, 0.17541049420833588, -0.35125914216041565, -0.6250013709068298, 0.2065482884645462, 0.3882313072681427, 0.03066474013030529, -0.3856755197048187, 0.04934605956077576, -0.1934695541858673, -0.057239141315221786, 0.062044642865657806, -0.18654941022396088, -0.17105261981487274, 0.023797741159796715, -0.3267788887023926, -0.3547973930835724, -0.27297788858413696, -0.18893519043922424, -0.060690078884363174, 0.06234230101108551, -0.16855376958847046, 0.21052449941635132, -0.3410428464412689, -0.07674352824687958, -0.2445656955242157, -0.20471248030662537, 0.2668522596359253, -0.1892366260290146, 0.3256411552429199, 0.2715983986854553, 0.5325117707252502, -0.46161848306655884, -0.1358477771282196, 0.46939703822135925, -0.2386999875307083, -0.438829630613327, 0.139805406332016, 0.054043494164943695, -0.10457713156938553, -0.2842119634151459, -0.04661960154771805, -0.04439298063516617, -0.09141808748245239, 0.053298018872737885, -0.0407801978290081, 0.07770374417304993, 0.30058443546295166, 0.42853057384490967, -0.24720214307308197, 0.09440290182828903, -0.25257888436317444, 0.09152873605489731, 0.09517352283000946, 0.1981111764907837, 0.03260853514075279, -0.32800641655921936, -0.0694575086236, -0.18838466703891754, 0.17785531282424927, 0.26064836978912354, -0.5224294066429138, -0.13111554086208344, -0.05748307704925537, 0.3282013535499573, 0.09919482469558716, 0.05954933166503906, 0.36590051651000977, 0.12835779786109924, -0.01893092505633831, -0.4026811420917511, 0.05402059480547905, -0.04295460134744644, 0.005226399749517441, 0.22714868187904358, 0.21521756052970886, 0.4598848521709442, 0.09288494288921356, 0.716563880443573, -0.3211071193218231, -0.07761068642139435, 0.25192588567733765, -0.35502052307128906, 0.38520896434783936, -0.2356756031513214, -0.5562468767166138, 0.09069465100765228, 0.21142829954624176, -0.20915815234184265, 0.0871782973408699, -0.18107250332832336, -0.2635875642299652, -0.21404814720153809, 0.1956138014793396, -0.7114017605781555, 0.02087320014834404, -0.05030369758605957, -0.20966100692749023, 0.14206349849700928, 0.09183371067047119, -0.07588670402765274, -0.024286115542054176, 0.1712309718132019, 0.10001064836978912, 0.20127519965171814, 0.5163567662239075, 0.1252407282590866, -0.13407248258590698, -0.2942970097064972, -0.23421314358711243, 0.04861258715391159, -0.031100738793611526, 0.281726211309433, -0.3725155293941498, -0.045871540904045105, 0.02344561368227005, 0.1538611352443695, 0.8323474526405334, -0.309278666973114, 0.012493520975112915, 0.06447091698646545, -0.18700720369815826, -0.6176959872245789, -0.031118273735046387, -0.019525211304426193, 0.3756761848926544, -0.22779347002506256, 0.9286007881164551, -0.019809268414974213, 0.014981891959905624, 0.02438056655228138, 0.21105317771434784, -0.2932758927345276, -0.2049882858991623, -0.3941420614719391, -0.37341412901878357, -0.5144349336624146, 0.12728658318519592, 0.16845814883708954, -0.045774925500154495, 0.23154912889003754, 0.1548691689968109, -0.15435384213924408, -0.011824794113636017, -0.17279256880283356, -0.03557225316762924, 0.2763962745666504, -0.031106138601899147, 0.11058486998081207, 0.06930255144834518, 0.2963414192199707, 0.10836342722177505, 0.26167386770248413, 0.018726492300629616, -0.41347867250442505, 0.12217829376459122, -0.25265154242515564, 0.13793061673641205, 0.19950273633003235, -0.14846250414848328, -0.39297962188720703, 0.09156852215528488, 0.07278063893318176, -0.25659042596817017, 0.14650897681713104, 0.16418401896953583, -0.26491254568099976, -0.22021867334842682, -0.300261914730072, 0.210222065448761, 0.2405528575181961, -0.17858469486236572, 0.24247685074806213, 0.16398552060127258, -0.370576947927475, 0.4367925524711609, 0.16760611534118652, 0.747771680355072, -0.26201939582824707, 0.101409912109375, 0.025187823921442032, 0.09772400557994843, 0.3990287780761719, 0.2524383068084717, -0.017534863203763962, -0.23799172043800354, -0.32667598128318787, -0.050488561391830444, -0.05606918781995773, 0.16212528944015503, 0.24112354218959808, -0.05298179015517235, 0.25460031628608704, -0.384465754032135, -0.14452095329761505, 0.06609092652797699, -0.08651973307132721, 0.1257171928882599, -0.16990618407726288, 0.14780251681804657, 0.07102131843566895, 0.05075888708233833, 0.4158261716365814, -0.06331957876682281, 0.1189015805721283, -0.45488330721855164, -0.2859111428260803, -0.17484325170516968, -0.06456732749938965, -0.23322661221027374, 0.06393897533416748, -0.2443278729915619, -0.10253920406103134, -0.15346269309520721, 0.7051041126251221, 0.3065621256828308, 0.17319266498088837, -0.008291693404316902, 0.2540809214115143, -0.010149553418159485, 0.3485754728317261, -0.02297760359942913, -0.06499918550252914, 0.17772707343101501, 0.08082994073629379, -0.11358791589736938, -0.20101267099380493, -0.2913607358932495, -0.10470794886350632, -0.36100009083747864, 0.12072480469942093, -0.11640031635761261, 0.13525904715061188, -0.19584320485591888, -0.08968427777290344, 0.14266718924045563, -0.04297475889325142, 0.0049289073795080185, 0.06216060370206833, 0.21821169555187225, 0.3764690160751343, -0.21409814059734344, -0.3542616367340088, 0.04932549595832825, 0.5025840401649475, 0.0877189189195633, -0.06950876861810684, 0.41339194774627686, -0.18617194890975952, 0.029670625925064087, -0.1731904149055481, 0.05985034257173538, 0.33316439390182495, -0.5205094814300537, 0.2568165957927704, -0.03568767383694649, 0.15251673758029938, -0.18971021473407745, 0.07744964212179184, -0.0989537388086319, -0.24287864565849304, -0.05980271100997925, -0.1973397433757782, -0.3325077295303345, 0.36764252185821533, -0.2760933041572571, 0.07235544174909592, -0.10415850579738617, -0.16912157833576202, 0.29126742482185364, -0.07754016667604446, -0.17466847598552704, -0.0915539562702179, -0.1904444396495819, 0.2808796465396881, 0.4790230095386505, 0.6056617498397827, -0.11679749190807343, -0.21527902781963348, -0.016155268996953964, 0.06403297185897827, 0.167342409491539, -0.10648531466722488, 0.02642078697681427, 0.21361787617206573, 0.14617908000946045, 0.15803465247154236, 0.0370367132127285, -0.12907764315605164, -0.001914195716381073, -0.11559280008077621, 0.05547204986214638, 0.27626851201057434, -0.22329451143741608, 0.47165557742118835, 0.1286998987197876, 0.3426983058452606, 0.3061627149581909, 0.1783723682165146, -0.05643492937088013, 0.16823861002922058, 0.06919904798269272, 0.1329033076763153, 0.4757755994796753, 0.05039018392562866, -0.09387721121311188, -0.1920432448387146, -0.4099355936050415, 0.12242112308740616, 0.30575400590896606, -0.3461533188819885, 0.4983796775341034, 0.3408576548099518, 0.21940548717975616, -0.010793797671794891, -0.31184348464012146, 0.015248620882630348, 0.4210490584373474, 0.1026972159743309, -0.24667853116989136, -0.1544661521911621, 0.34827685356140137, 0.08011270314455032, -0.14898499846458435, 0.12294791638851166, 0.04190976545214653, 0.035937488079071045, -0.23182262480258942, 0.033181045204401016, 0.43823277950286865, -0.4436933398246765, 0.16476848721504211, 0.7715485095977783, -0.2441800832748413, 0.20269355177879333, 0.15153828263282776, 0.2734837234020233, -0.2885817885398865, 0.6977818608283997, -0.11622811108827591, 0.25763317942619324, 0.11234784871339798, 0.1182214617729187, 0.32910072803497314, -0.21622297167778015, 0.10918629169464111, -0.05504371225833893, -0.21188613772392273, 0.1381104737520218, -0.110862597823143, 0.05363306403160095, 0.1266927868127823, -0.16337423026561737, 0.216279536485672, 0.10728584229946136, -0.17016464471817017, 0.09031540155410767, -0.37944549322128296, -0.10704147070646286, -0.026794642210006714, -0.02509230375289917, 0.007674064487218857, -0.3106287717819214, 0.30798614025115967, 0.06218473240733147, -0.28244906663894653, -0.05337284505367279, -0.3590194880962372, 0.2765834629535675, 0.18915900588035583, -0.17978401482105255, -0.188992440700531, 0.038555361330509186, 0.06066209822893143, 0.3116571307182312, 0.5192856192588806, 0.22549989819526672, 0.32339122891426086, -0.08818113803863525, 0.2102677822113037, -0.21271900832653046, -0.17741002142429352, -0.16402915120124817, 0.41100043058395386, 0.02124602347612381, 0.16768212616443634, 0.13433241844177246, 0.05279149115085602, 0.01814071089029312, 0.304452121257782, 0.09588824212551117, 0.267600953578949, 0.24373605847358704, -0.05490758270025253, -0.2356247901916504, -0.1377437710762024, 0.08054763823747635, 0.2786085605621338, -0.27806246280670166, -0.14821377396583557, 0.3171944320201874, 0.09194042533636093, 0.09986802935600281, -0.12444815039634705, -0.04343510419130325, -0.17211748659610748, 0.26238855719566345, 0.6321688294410706, 0.17307232320308685, -0.2536115348339081, 0.0028037354350090027, -0.5640813112258911, -0.046314142644405365, -0.19658887386322021, -0.20094141364097595, 0.11160363256931305, 0.08103397488594055, 0.07151869684457779, 0.08285597711801529, 0.15757346153259277, -0.09471521526575089, -0.0421551950275898, 0.5367687940597534, -0.08277037739753723, -0.35896483063697815, -0.09361356496810913, 0.36194026470184326, -0.06894568353891373, -0.1973189115524292, 0.10195624828338623, 0.05241294577717781, -0.024872327223420143, -0.08696594089269638, -0.1565365344285965, -0.059849612414836884, -0.16044782102108002, 0.3363994359970093, 0.2990794777870178, 0.28338658809661865, -0.07616506516933441, 0.07865887135267258, -0.13067466020584106, -0.10893529653549194, -0.36277249455451965, -0.027893848717212677, 0.13487592339515686, 0.3911329507827759, -0.1342039704322815, -0.10413151979446411, -0.2512756288051605, -0.12291093170642853, 0.16010630130767822, 0.037370987236499786, -0.27753373980522156, 0.15186545252799988, 0.05826123058795929, -0.05906162038445473, -0.02204107865691185, 0.1637740135192871, 0.021365374326705933, -0.0255744569003582, -0.34040820598602295, -0.464516282081604, 0.4388209581375122, -0.5533767342567444, -0.3727947175502777, 0.035270076245069504, 0.020272746682167053, -0.06371892243623734, -0.0011317785829305649, 0.08452372997999191, -0.14983132481575012, 0.29974445700645447, -0.009368713945150375, -0.07611952722072601, 0.0509837344288826, -0.04938651993870735, 0.15991640090942383, -0.02866571769118309, -0.04658565670251846, -0.0670841857790947, 0.020881084725260735, 0.1342056691646576, -0.17141766846179962 ]
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
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.
[ -0.3361896872520447, -0.09481362253427505, -0.013615678064525127, 0.11722642928361893, 0.2425266057252884, 0.10842419415712357, 0.4697721302509308, 0.2000844031572342, 0.1968294233083725, 0.1282198429107666, 0.3283745050430298, 0.38420748710632324, -0.3407844603061676, 0.03303402662277222, 0.07700082659721375, -0.2610790729522705, 0.2912265658378601, 0.08057282119989395, -0.21310955286026, -0.23923638463020325, -0.4572463631629944, 0.19989807903766632, -0.18204358220100403, 0.2938682436943054, -0.4572467505931854, 0.006909750401973724, -0.4315340220928192, 0.2598024606704712, -0.040249958634376526, -0.11691746860742569, 0.11974646151065826, -0.23331990838050842, 0.04057479649782181, 0.5234628319740295, -0.00012229278218001127, -0.03795499727129936, 0.3583025336265564, -0.09638804942369461, -0.32999175786972046, -0.22936905920505524, -0.5258890390396118, -0.20787861943244934, -0.06339795887470245, -0.45941662788391113, 0.11648835986852646, -0.4443151652812958, 0.08734201639890671, -0.36933934688568115, 0.3481988310813904, 0.20035198330879211, 0.13521650433540344, -0.07793505489826202, -0.1943155974149704, -0.10448924452066422, 0.039144039154052734, 0.4301533102989197, 0.026480993255972862, 0.13572083413600922, 0.15681466460227966, -0.37908586859703064, 0.17313367128372192, 0.3501144349575043, -0.0585658997297287, -0.03972891345620155, 0.36218059062957764, 0.17488406598567963, -0.030147649347782135, -0.4472684860229492, 0.2808806896209717, 0.1138065904378891, 0.4210483729839325, -0.25425437092781067, -0.3878973126411438, -0.36299800872802734, 0.023465171456336975, 0.09265078604221344, 0.10743743181228638, 0.06169009953737259, -0.12501539289951324, -0.01226804405450821, -0.38002800941467285, -0.19556380808353424, 0.03970766067504883, 0.17222923040390015, -0.22373510897159576, 0.02009514719247818, 0.020805055275559425, 0.23431307077407837, 0.029028499498963356, -0.0211893729865551, -0.07346688956022263, -0.12208276987075806, 0.06712359189987183, 0.40270236134529114, 0.08743412792682648, 0.06485805660486221, 0.054429128766059875, 0.2038804590702057, 0.012677710503339767, -0.4352191686630249, -0.3916446566581726, -0.22639751434326172, -0.025483720004558563, 0.06528694927692413, 0.2660507559776306, 0.35412365198135376, 0.01876787468791008, 0.5952318906784058, 0.07595576345920563, -0.13487617671489716, -0.1312066912651062, -0.06164560467004776, -0.21226035058498383, -0.17137674987316132, 0.35052797198295593, 0.15440091490745544, 0.19250410795211792, 0.08630424737930298, 0.2640109658241272, 0.10136564075946808, 0.1301352083683014, 0.029721135273575783, -0.3098727762699127, 0.2792157828807831, 0.07469061017036438, 0.03557676449418068, 0.25487810373306274, 0.13568004965782166, -0.11928754299879074, 0.00843143928796053, -0.23278556764125824, 0.2992156744003296, -0.5039147138595581, -0.03258511424064636, -0.02897992916405201, -0.02705485373735428, 0.2215779423713684, -0.07804574072360992, -0.02470961958169937, 0.16354332864284515, -0.2691091299057007, -0.10972630977630615, 0.24869570136070251, 0.35861238837242126, -0.04413217306137085, 0.38629260659217834, 0.4170099198818207, -0.3391103148460388, -0.03879409655928612, 0.31467223167419434, -0.48224884271621704, -0.013562038540840149, -0.037321582436561584, 0.04781023785471916, -0.3315556049346924, 0.07089662551879883, -0.6356044411659241, 0.0583970807492733, 0.2683278024196625, 0.03040601685643196, 0.15969374775886536, -0.18768155574798584, -0.22383947670459747, -0.1258104294538498, 0.09462491422891617, 0.6475912928581238, -0.6407672762870789, -0.14380338788032532, -0.06065190210938454, -0.008169859647750854, -0.02716437727212906, -0.09269979596138, -0.03547130152583122, 0.484184205532074, -0.3788149356842041, 0.12464886903762817, 0.16416972875595093, -0.49155834317207336, -0.3314675986766815, 0.3640621304512024, -0.1635398417711258, -0.17813539505004883, -0.0668296292424202, 0.11364142596721649, 0.24504782259464264, 0.1529948115348816, 0.01786213368177414, 0.18129770457744598, -0.2146516740322113, 0.20626291632652283, 0.010021522641181946, 0.01393573172390461, -0.07324370741844177, 0.17365844547748566, 0.4916377067565918, 0.44458281993865967, 0.03990398719906807, 0.2841653823852539, -0.09435742348432541, -0.05562609061598778, 0.15515729784965515, 0.29970937967300415, 0.11298134922981262, -0.07873527705669403, 0.2594805955886841, 0.12087451666593552, -0.1835167407989502, 0.2730288803577423, 0.051381565630435944, 0.04603935778141022, -0.5548986196517944, 0.14091117680072784, -0.3438641130924225, 0.08335909247398376, -0.251412034034729, -0.24236172437667847, 0.013998474925756454, 0.004359602928161621, 0.0037908516824245453, 0.3075121343135834, -0.1686251163482666, 0.25094014406204224, 0.07020044326782227, 0.07512594014406204, -0.27909937500953674, 0.20953468978405, -0.07736034691333771, -0.2137644737958908, -0.19617746770381927, -0.15549099445343018, 0.0170990489423275, -0.022140946239233017, -0.16083985567092896, 0.44827499985694885, 0.16433602571487427, 0.12639972567558289, -0.027695879340171814, 0.08323834091424942, 0.4086481034755707, -0.4075549244880676, -0.007484769448637962, -0.10884502530097961, 0.2693895399570465, -0.017011024057865143, -0.3904506266117096, 0.18435704708099365, -0.0745416134595871, 0.43018487095832825, -0.016744442284107208, 0.2552448809146881, -0.04045489802956581, -0.11180463433265686, -0.20167893171310425, -0.23524129390716553, -0.10113641619682312, -0.5321699380874634, 0.16404815018177032, -0.0028828512877225876, 0.038801081478595734, -0.20056462287902832, 0.32441768050193787, 0.12939609587192535, 0.24665918946266174, 0.10962224006652832, -0.23133420944213867, 0.36541473865509033, 0.1513342559337616, 0.3799087703227997, 0.5697734355926514, 0.12575753033161163, -0.30216607451438904, 0.05700499564409256, 0.04626805707812309, 0.1422218233346939, -0.10778968781232834, -0.0289422869682312, 0.2409227192401886, 0.00907180830836296, -0.012302234768867493, 0.1510792374610901, 0.006503436714410782, -0.1849527209997177, -0.09571543335914612, 0.39116209745407104, -0.18754252791404724, 0.19853681325912476, -0.29723939299583435, -0.45501747727394104, 0.12573347985744476, 0.3309739828109741, 0.1360790729522705, -0.3409830331802368, -0.0566413477063179, -0.22068876028060913, -0.0022247284650802612, 0.15072345733642578, -0.29750868678092957, -0.12326772511005402, 0.07822675257921219, -0.28804776072502136, -0.29297351837158203, -0.21966248750686646, -0.23117941617965698, -0.03583166003227234, 0.10612902045249939, -0.17101040482521057, 0.15554369986057281, -0.314334511756897, 0.04578344523906708, -0.26140686869621277, -0.2081235945224762, 0.2638951539993286, -0.16555702686309814, 0.3444468677043915, 0.2775229215621948, 0.4328407645225525, -0.42026805877685547, -0.15894517302513123, 0.5039772987365723, -0.20972216129302979, -0.38169753551483154, 0.12116247415542603, -0.008810210041701794, -0.19199419021606445, -0.23883450031280518, -0.08907530456781387, -0.04456343501806259, -0.05737782269716263, -0.03203275799751282, -0.09262025356292725, 0.019466876983642578, 0.31928059458732605, 0.5174515247344971, -0.15737256407737732, 0.0539393275976181, -0.2879458963871002, 0.06560051441192627, 0.038950737565755844, 0.2878054082393646, -0.04409951716661453, -0.37446078658103943, -0.10218003392219543, -0.2716110348701477, 0.14776530861854553, 0.233491912484169, -0.4811948537826538, -0.09776085615158081, -0.058428093791007996, 0.3230384290218353, 0.11828514188528061, 0.013162183575332165, 0.34301042556762695, 0.058025993406772614, -0.025662221014499664, -0.42220866680145264, 0.059338320046663284, -0.007932603359222412, 0.046718623489141464, 0.26678231358528137, 0.20379719138145447, 0.49537429213523865, 0.06758230924606323, 0.6670225262641907, -0.20856964588165283, -0.1931271106004715, 0.2599255442619324, -0.44249582290649414, 0.3710671365261078, -0.22171053290367126, -0.5274104475975037, 0.09448707848787308, 0.2710456848144531, -0.23227465152740479, 0.05655338987708092, -0.1402827501296997, -0.23901055753231049, -0.187843918800354, 0.253994345664978, -0.6283789277076721, 0.06260807812213898, 0.01794121228158474, -0.17425654828548431, 0.14811523258686066, 0.002705354243516922, -0.0630173608660698, -0.09081128239631653, 0.14432024955749512, 0.11847066879272461, 0.18108603358268738, 0.41080206632614136, 0.13255184888839722, -0.1079133152961731, -0.2767716944217682, -0.20591884851455688, -0.01482902467250824, -0.0390172153711319, 0.3342914283275604, -0.3973129689693451, -0.07566700875759125, -0.044489920139312744, 0.13096654415130615, 0.7565440535545349, -0.3849169909954071, -0.01971524953842163, 0.11039404571056366, -0.14386361837387085, -0.6080485582351685, -0.0973849967122078, -0.03662317991256714, 0.3691590428352356, -0.34003931283950806, 0.9584872126579285, 0.034249015152454376, 0.06699427217245102, 0.16222631931304932, 0.06748597323894501, -0.26332664489746094, -0.2612912356853485, -0.3399538993835449, -0.2704659700393677, -0.42586737871170044, 0.08591029047966003, 0.13262061774730682, -0.07667877525091171, 0.2645251154899597, 0.13748377561569214, -0.07386791706085205, 0.057734131813049316, -0.19607727229595184, 0.04535593464970589, 0.2662464380264282, 0.003873875830322504, 0.2141525149345398, 0.13116295635700226, 0.17355124652385712, 0.06874775141477585, 0.2948135733604431, -0.04664982482790947, -0.3189237713813782, 0.16521796584129333, -0.1919643133878708, 0.15478095412254333, 0.06497263163328171, -0.18156784772872925, -0.47343969345092773, 0.07483608275651932, 0.0123458132147789, -0.29789063334465027, 0.16559848189353943, 0.22189867496490479, -0.19030709564685822, -0.15031665563583374, -0.4059573709964752, 0.359211266040802, 0.26608172059059143, -0.1071099042892456, 0.26312607526779175, 0.11952345073223114, -0.28139036893844604, 0.41786670684814453, 0.18485993146896362, 0.6091036200523376, -0.27113139629364014, 0.0971776694059372, 0.1331409513950348, 0.09563931822776794, 0.35272881388664246, 0.248673215508461, -0.17170199751853943, -0.2625753581523895, -0.3012814223766327, -0.05667047202587128, -0.09302790462970734, 0.16898290812969208, 0.18086948990821838, -0.10149282962083817, 0.20384915173053741, -0.28205910325050354, -0.07701164484024048, 0.022575005888938904, -0.1870589405298233, 0.13530132174491882, -0.24267742037773132, 0.14700311422348022, 0.13150395452976227, 0.061871591955423355, 0.4289015531539917, -0.021363303065299988, 0.12869364023208618, -0.4871634840965271, -0.19655504822731018, -0.30738189816474915, -0.0231015607714653, -0.12721385061740875, 0.009147253818809986, -0.10763882100582123, -0.20329496264457703, -0.14892911911010742, 0.7575439810752869, 0.2707517147064209, 0.14080117642879486, -0.04583153873682022, 0.26077279448509216, -0.06496205180883408, 0.32539230585098267, -0.031463637948036194, -0.14932745695114136, 0.23486244678497314, 0.12543612718582153, -0.12119732797145844, -0.16851261258125305, -0.18787474930286407, -0.01780838891863823, -0.27411413192749023, 0.09143467247486115, -0.09781572222709656, 0.047942694276571274, -0.28215914964675903, -0.09910821914672852, 0.17848725616931915, 0.007210463285446167, 0.052314143627882004, 0.012118209153413773, 0.26246342062950134, 0.29422473907470703, -0.1452028751373291, -0.3341817557811737, 0.06624403595924377, 0.5920327305793762, -0.022198230028152466, -0.053213950246572495, 0.39551571011543274, -0.06977631151676178, 0.05580070614814758, -0.16461876034736633, 0.14572733640670776, 0.5030286908149719, -0.5171137452125549, 0.12972894310951233, -0.0803467184305191, 0.17950667440891266, -0.12083454430103302, 0.08339390158653259, 0.030358221381902695, -0.31943169236183167, -0.013857632875442505, -0.22739951312541962, -0.356462687253952, 0.3211336135864258, -0.26583752036094666, 0.08479335159063339, -0.06125251203775406, -0.2198142558336258, 0.2947097420692444, -0.10270906984806061, -0.21122942864894867, -0.09435958415269852, -0.23689499497413635, 0.1811978816986084, 0.45515018701553345, 0.614754855632782, -0.02130299061536789, -0.2562767267227173, 0.032396405935287476, 0.08196599781513214, 0.07601385563611984, -0.15018580853939056, 0.01308496668934822, 0.17337025701999664, 0.16187551617622375, 0.11203109472990036, 0.028135664761066437, -0.14805477857589722, -0.034894607961177826, -0.18407943844795227, 0.016606595367193222, 0.2777618169784546, -0.26440590620040894, 0.3960878849029541, 0.07572375237941742, 0.23610761761665344, 0.2647225260734558, 0.14921772480010986, -0.052492380142211914, 0.1401267647743225, 0.07393614947795868, 0.1263749897480011, 0.4735611081123352, 0.060948535799980164, -0.06513532996177673, -0.10832991451025009, -0.3794386386871338, 0.13875463604927063, 0.3645229637622833, -0.32982563972473145, 0.501583456993103, 0.3299790918827057, 0.2616894841194153, -0.1006578803062439, -0.34914353489875793, 0.07827233523130417, 0.404700368642807, 0.13662578165531158, -0.209633931517601, -0.08676747232675552, 0.28593456745147705, 0.1876545548439026, -0.11473177373409271, 0.09330039471387863, 0.04593938961625099, -0.0024851635098457336, -0.2212676852941513, 0.07824479043483734, 0.48274117708206177, -0.38210785388946533, 0.12492351233959198, 0.8185732364654541, -0.2346877008676529, 0.27596768736839294, 0.20806404948234558, 0.2857641279697418, -0.21154999732971191, 0.705676794052124, -0.0994102731347084, 0.21959035098552704, 0.14121931791305542, 0.15638865530490875, 0.3047982454299927, -0.32658499479293823, 0.14668837189674377, -0.1272258758544922, -0.13206958770751953, 0.12917539477348328, -0.17598196864128113, 0.14589044451713562, 0.05467510223388672, -0.05557960271835327, 0.10842616111040115, 0.04629558324813843, -0.1509968340396881, 0.0928972065448761, -0.3789447546005249, -0.061036333441734314, -0.0958048403263092, -0.01861175335943699, 0.018651114776730537, -0.30872929096221924, 0.36675044894218445, 0.05418579280376434, -0.23572029173374176, -0.006923740729689598, -0.32473453879356384, 0.3350183069705963, 0.10300082713365555, -0.1863900125026703, 0.0228663831949234, 0.006651006639003754, 0.0261240154504776, 0.3700128495693207, 0.533870279788971, 0.2953788936138153, 0.3963855504989624, -0.022594783455133438, 0.24175997078418732, -0.15988147258758545, -0.17310762405395508, -0.09898560494184494, 0.3594529628753662, -0.091942697763443, 0.1063089519739151, 0.13405825197696686, 0.09325604885816574, -0.008753526024520397, 0.34188124537467957, 0.07543063908815384, 0.27875426411628723, 0.23904575407505035, -0.1384972333908081, -0.31308531761169434, -0.12537872791290283, 0.023582961410284042, 0.2397143542766571, -0.3192589282989502, -0.14701378345489502, 0.37604033946990967, 0.053254105150699615, 0.09683807939291, -0.08483570069074631, -0.022189471870660782, -0.11290395259857178, 0.3096016049385071, 0.6482158303260803, 0.08422093838453293, -0.2413327395915985, -0.06387469172477722, -0.580475389957428, -0.06853925436735153, -0.26672399044036865, -0.19174551963806152, 0.025677362456917763, 0.06293167918920517, 0.024517491459846497, 0.07306519895792007, 0.2454584538936615, -0.02875424176454544, -0.09354905039072037, 0.6208827495574951, -0.14181780815124512, -0.5207048654556274, -0.08280088007450104, 0.28778016567230225, -0.09149256348609924, -0.14168858528137207, 0.08538705110549927, 0.028198357671499252, -0.0025162026286125183, -0.08136668801307678, -0.2262388914823532, -0.060803644359111786, -0.17666716873645782, 0.4493868052959442, 0.19317631423473358, 0.3118826150894165, -0.03371186926960945, 0.2326364815235138, -0.19784265756607056, -0.146930530667305, -0.22988957166671753, -0.02027668058872223, 0.017004450783133507, 0.37065109610557556, -0.18048818409442902, -0.14496631920337677, -0.24985620379447937, -0.17106753587722778, 0.19467169046401978, -0.002170474035665393, -0.2955158054828644, 0.1593094915151596, -0.007327821105718613, -0.13167977333068848, -0.00700424937531352, 0.1522025614976883, -0.03328584134578705, 0.07691032439470291, -0.1879764199256897, -0.49121272563934326, 0.38475528359413147, -0.5550436973571777, -0.2713811695575714, 0.02284017577767372, -0.054844409227371216, -0.12056479603052139, 0.07974791526794434, 0.02321024239063263, -0.10291916131973267, 0.30509185791015625, -0.016832780092954636, -0.032598886638879776, 0.03698619455099106, 0.03924164921045303, 0.22486911714076996, -0.03977314755320549, 0.11517088115215302, -0.16842743754386902, 0.024348607286810875, 0.1616305261850357, -0.1319303810596466 ]
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
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.
[ -0.189932182431221, -0.05999205261468887, -0.01674068719148636, 0.15395531058311462, 0.30590397119522095, 0.2208966314792633, 0.5759837627410889, 0.20979993045330048, -0.06959941983222961, 0.17101134359836578, 0.22148264944553375, 0.3101060390472412, -0.3101203143596649, 0.018727703019976616, 0.0705043151974678, -0.3332872986793518, 0.24941876530647278, 0.036148130893707275, -0.07022422552108765, -0.2353009581565857, -0.4248746931552887, 0.20574761927127838, -0.1682720184326172, 0.17842687666416168, -0.5364774465560913, 0.01235898956656456, -0.4262953996658325, 0.2646232545375824, 0.07035941630601883, -0.09349394589662552, 0.24238575994968414, -0.20411217212677002, -0.006171185523271561, 0.4807894229888916, -0.00012270206934772432, 0.008795574307441711, 0.3375902771949768, -0.1485549956560135, -0.3682613670825958, -0.2480621486902237, -0.26637840270996094, -0.2310742735862732, -0.09856894612312317, -0.4630576968193054, -0.0023305900394916534, -0.4633627235889435, 0.001933431252837181, -0.389400452375412, 0.2740745544433594, 0.1881035566329956, 0.11256624013185501, 0.050638847053050995, -0.04629229009151459, -0.07517248392105103, 0.09422539919614792, 0.26741594076156616, 0.02223893441259861, 0.10139693319797516, 0.16824060678482056, -0.2524270713329315, 0.16040267050266266, 0.38027769327163696, -0.06348738819360733, -0.019805587828159332, 0.3381471037864685, 0.1454809159040451, -0.11897952109575272, -0.5373305082321167, 0.22905787825584412, 0.07901855558156967, 0.29079192876815796, -0.19637447595596313, -0.40582388639450073, -0.4185240566730499, 0.02109065279364586, -0.07062961906194687, 0.05241668224334717, 0.15402919054031372, -0.12705346941947937, -0.03395221754908562, -0.27443140745162964, -0.05563589930534363, 0.030289888381958008, 0.2803621292114258, -0.1562151312828064, 0.020904026925563812, -0.014512491412460804, 0.2934243083000183, 0.18766404688358307, 0.03135800361633301, -0.04434773325920105, -0.08665326982736588, 0.16498295962810516, 0.38461488485336304, -0.08209671080112457, 0.0882071703672409, 0.09553582221269608, 0.10568370670080185, 0.06538227945566177, -0.4247092008590698, -0.3899495303630829, -0.20286330580711365, 0.07445551455020905, 0.11139680445194244, 0.21675115823745728, 0.34731829166412354, 0.029152575880289078, 0.48040318489074707, 0.06429599225521088, -0.200270414352417, -0.12471260130405426, -0.06155667454004288, -0.263444185256958, -0.28986918926239014, 0.26556238532066345, 0.31540992856025696, 0.16386178135871887, 0.13408729434013367, 0.13176940381526947, 0.15807867050170898, 0.023027263581752777, 0.0465918593108654, -0.28129178285598755, 0.3013894855976105, 0.11426712572574615, 0.10892905294895172, 0.3057869076728821, 0.2284262776374817, -0.1272067278623581, 0.004053887911140919, -0.2092776745557785, 0.3057788610458374, -0.3609873950481415, -0.09462324529886246, 0.016649235039949417, -0.2813988924026489, 0.2246265858411789, -0.1384383738040924, 0.09493058174848557, 0.0755130872130394, -0.17957037687301636, -0.15502648055553436, 0.34374678134918213, 0.3563767969608307, -0.05663862079381943, 0.35654598474502563, 0.49748215079307556, -0.32173389196395874, -0.07169703394174576, 0.2719224691390991, -0.5373650193214417, -0.12560290098190308, -0.13961435854434967, -0.00218395609408617, -0.2081068456172943, 0.11253739893436432, -0.5917955636978149, 0.09534740447998047, 0.29563984274864197, 0.15290415287017822, 0.0382002592086792, -0.19434373080730438, -0.1874009221792221, -0.19423344731330872, 0.22915148735046387, 0.5316870808601379, -0.6285639405250549, -0.17890363931655884, -0.09288299083709717, 0.03595623001456261, -0.052763454616069794, 0.004664832726120949, -0.15522880852222443, 0.5048213005065918, -0.35732531547546387, 0.05586491525173187, 0.2016284465789795, -0.5247192978858948, -0.3713728189468384, 0.30330464243888855, -0.06707694381475449, -0.09183318167924881, -0.1091284528374672, 0.23444044589996338, 0.29621830582618713, 0.17901965975761414, 0.22680367529392242, 0.2550419569015503, -0.1933630257844925, 0.14871333539485931, -0.0038669779896736145, 0.036664389073848724, 0.12530338764190674, 0.17483669519424438, 0.4326685965061188, 0.35175055265426636, -0.04466699808835983, 0.07815799862146378, -0.1292797029018402, -0.1349067986011505, 0.17069335281848907, 0.3639363646507263, 0.09385145455598831, -0.1671333611011505, 0.30480170249938965, 0.22493869066238403, -0.2788342535495758, 0.2861531674861908, 0.10735049843788147, 0.11237305402755737, -0.5680476427078247, 0.09769207239151001, -0.2284189760684967, 0.03401997685432434, -0.30933865904808044, -0.42584747076034546, -0.006732219830155373, -0.0038835033774375916, 0.012193918228149414, 0.26765176653862, -0.10017058998346329, 0.2136278748512268, 0.08298089355230331, 0.06499674171209335, -0.3293331265449524, 0.24313069880008698, -0.1128864660859108, -0.22889511287212372, -0.18419085443019867, -0.05337793380022049, 0.05862932652235031, -0.08353202790021896, -0.1670823097229004, 0.49469536542892456, 0.14585989713668823, 0.07641564309597015, -0.1619592010974884, 0.07904490828514099, 0.4130982756614685, -0.30717864632606506, -0.13330446183681488, -0.10590198636054993, 0.20959258079528809, -0.018224526196718216, -0.209855318069458, 0.389101505279541, 0.1168079674243927, 0.4222137928009033, -0.0369202196598053, 0.21312829852104187, 0.006479540839791298, -0.06491409242153168, -0.22142185270786285, -0.13643383979797363, -0.05890720710158348, -0.5367250442504883, 0.20810575783252716, -0.031613729894161224, -0.07151331752538681, -0.15983065962791443, 0.3188416659832001, 0.18425820767879486, 0.17321252822875977, 0.06148085743188858, -0.3406994044780731, 0.35571157932281494, 0.16318511962890625, 0.2990647852420807, 0.5045945644378662, 0.15080349147319794, -0.28523173928260803, 0.03210553154349327, 0.01893196627497673, 0.20043475925922394, -0.10272178798913956, 0.030963528901338577, 0.2839134931564331, 0.06979551166296005, 0.043946705758571625, 0.210567444562912, -0.014303276315331459, -0.10123766958713531, -0.10198499262332916, 0.3601283133029938, -0.2184353917837143, 0.24388284981250763, -0.29618901014328003, -0.43394356966018677, 0.15433774888515472, 0.23702436685562134, 0.12064185738563538, -0.370190292596817, -0.05119781941175461, -0.199883833527565, -0.06049793213605881, 0.18794666230678558, -0.1283903419971466, -0.09429065883159637, 0.19546924531459808, -0.3585042357444763, -0.25345665216445923, -0.32035577297210693, -0.1793278157711029, -0.0582999661564827, 0.0783844068646431, -0.23774747550487518, 0.23473723232746124, -0.2226416915655136, 0.025096852332353592, -0.22515274584293365, -0.34170055389404297, 0.2516438066959381, -0.2126946896314621, 0.3229462504386902, 0.19198235869407654, 0.4012266993522644, -0.43450891971588135, -0.30819931626319885, 0.5172312259674072, -0.18402372300624847, -0.3689855635166168, 0.09799643605947495, 0.06999075412750244, -0.22159110009670258, -0.24964940547943115, -0.1706043779850006, -0.11457850784063339, -0.12459436058998108, -0.04682498425245285, -0.16235917806625366, -0.013368561863899231, 0.22537855803966522, 0.5101364254951477, -0.04964384064078331, 0.19107748568058014, -0.2141905277967453, -0.029572738334536552, -0.09792616963386536, 0.3605150282382965, -0.1092848852276802, -0.4649750292301178, -0.09348196536302567, -0.3865422010421753, 0.1361236274242401, 0.31523776054382324, -0.48119300603866577, -0.13062067329883575, -0.027159100398421288, 0.2850472331047058, 0.12449107319116592, 0.09856153279542923, 0.2858864963054657, -0.017096981406211853, 0.011529209092259407, -0.3736812472343445, -0.07602517306804657, -0.011410214006900787, 0.12696334719657898, 0.3405408561229706, 0.140578955411911, 0.5638031959533691, 0.10022711753845215, 0.787162721157074, -0.2571794092655182, -0.4054873585700989, 0.22710824012756348, -0.4031784236431122, 0.41359707713127136, -0.19331711530685425, -0.5850049257278442, 0.20162655413150787, 0.15932650864124298, -0.1501241773366928, 0.022121794521808624, -0.17690300941467285, -0.23437519371509552, -0.23276619613170624, 0.27688050270080566, -0.6673380732536316, -0.011320177465677261, 0.08583885431289673, -0.17189492285251617, 0.20813599228858948, -0.055284805595874786, 0.003552250564098358, -0.10829871892929077, 0.1550751030445099, 0.07124961912631989, 0.18208442628383636, 0.4157523512840271, 0.12413385510444641, 0.06612387299537659, -0.2892039120197296, -0.315436989068985, 0.05353613197803497, 0.07917184382677078, 0.34809964895248413, -0.28737956285476685, -0.07362669706344604, -0.017259202897548676, 0.12599895894527435, 0.902660608291626, -0.33900192379951477, -0.197356715798378, 0.10167771577835083, -0.13045987486839294, -0.5646674036979675, -0.15808814764022827, -0.022969761863350868, 0.35355982184410095, -0.18014012277126312, 0.996674656867981, -0.014644540846347809, 0.014598838984966278, 0.07086949795484543, 0.16280172765254974, -0.25492116808891296, -0.1520860344171524, -0.3812063932418823, -0.3065899908542633, -0.554991602897644, 0.13978087902069092, 0.16702599823474884, 0.022459208965301514, 0.16543754935264587, 0.1467149704694748, -0.141449972987175, 0.08617855608463287, -0.11071744561195374, -0.0011134827509522438, 0.37207868695259094, 0.08595988899469376, 0.19244484603405, 0.0766318216919899, 0.2834685444831848, 0.19606180489063263, 0.3782208263874054, 0.008813850581645966, -0.34085923433303833, 0.18240976333618164, -0.1693514883518219, 0.15811103582382202, 0.055472232401371, -0.20285938680171967, -0.3891235291957855, 0.006622485816478729, 0.025980651378631592, -0.31465181708335876, 0.28050583600997925, 0.35937631130218506, -0.14537246525287628, -0.3455408215522766, -0.31906893849372864, 0.3219027519226074, 0.12882035970687866, -0.025435946881771088, 0.2952258884906769, 0.05591274052858353, -0.26492780447006226, 0.38082319498062134, 0.20863428711891174, 0.5872727632522583, -0.26105594635009766, 0.205956369638443, 0.13620328903198242, 0.148350790143013, 0.37295064330101013, 0.18544280529022217, 0.007635468617081642, -0.23808428645133972, -0.3503853380680084, -0.08141129463911057, -0.13667233288288116, 0.08843100070953369, 0.2256600260734558, -0.14295528829097748, 0.18217049539089203, -0.28157922625541687, -0.10227325558662415, -0.06932182610034943, -0.17594215273857117, 0.2143610417842865, -0.2831728756427765, 0.12745685875415802, 0.11760574579238892, 0.054663658142089844, 0.44408103823661804, -0.007964711636304855, 0.06243741884827614, -0.45835790038108826, -0.20680631697177887, -0.22770148515701294, 0.017012104392051697, -0.27636024355888367, 0.1576790064573288, -0.010714568197727203, -0.33778780698776245, -0.1726396530866623, 0.6552062630653381, 0.3559136390686035, 0.07517419755458832, 0.022616950795054436, 0.2102629691362381, -0.019159242510795593, 0.2638036012649536, 0.029530970379710197, -0.20406198501586914, 0.3012310266494751, 0.13062617182731628, -0.05514782294631004, -0.12357517331838608, -0.14165763556957245, -0.15129858255386353, -0.17627492547035217, 0.1652076244354248, -0.19100937247276306, 0.06747251003980637, -0.32676172256469727, 0.022047925740480423, 0.06117803975939751, 0.0023855790495872498, 0.040783531963825226, 0.044932764023542404, 0.0693262591958046, 0.24466070532798767, -0.2290029376745224, -0.3145219385623932, 0.09104575216770172, 0.5975215435028076, 0.018049104139208794, -0.10895746201276779, 0.4332500398159027, -0.05974123626947403, 0.030703358352184296, -0.10928318649530411, 0.12648549675941467, 0.4893685579299927, -0.47704750299453735, 0.20613934099674225, -0.03869660943746567, 0.2177806943655014, -0.1923641711473465, -0.0006352663040161133, -0.04331068694591522, -0.24724248051643372, -0.06562919914722443, -0.20370236039161682, -0.4155336022377014, 0.27524706721305847, -0.25419849157333374, 0.1815781444311142, -0.05465728044509888, 0.008762169629335403, 0.25002625584602356, -0.05879329890012741, -0.21009589731693268, -0.03032955341041088, -0.22457405924797058, 0.19825397431850433, 0.3669367730617523, 0.5762493014335632, 0.06666534394025803, -0.16796964406967163, -0.0010987576097249985, 0.09170695394277573, 0.04035404324531555, -0.13823866844177246, -0.08149005472660065, 0.16308021545410156, 0.1714262068271637, 0.0782252848148346, 0.09433433413505554, -0.18022240698337555, -0.037128299474716187, -0.20991505682468414, 0.15926577150821686, 0.24781081080436707, -0.24509890377521515, 0.4563455879688263, -0.0011870674788951874, 0.3029821515083313, 0.34827184677124023, 0.01834562048316002, -0.05606059730052948, 0.15722201764583588, 0.19942961633205414, 0.12169348448514938, 0.39380478858947754, 0.11211395263671875, -0.11564936488866806, -0.12471359223127365, -0.35763436555862427, -0.016160011291503906, 0.28521499037742615, -0.3727133274078369, 0.3484237492084503, 0.14646171033382416, 0.24932679533958435, -0.11376805603504181, -0.4158465266227722, 0.1845431625843048, 0.41396617889404297, 0.11365171521902084, -0.21739746630191803, -0.08212553709745407, 0.20320843160152435, 0.10711159557104111, -0.06793345510959625, 0.02538326382637024, 0.07253925502300262, 0.0933542400598526, -0.22560696303844452, 0.021938424557447433, 0.3735610544681549, -0.39733564853668213, 0.2528802454471588, 0.6943510174751282, -0.15409140288829803, 0.22119958698749542, 0.14082157611846924, 0.23699228465557098, -0.1341034471988678, 0.4227619767189026, -0.05889356881380081, 0.22799637913703918, 0.2593042552471161, 0.0994509607553482, 0.29249218106269836, -0.3087691068649292, 0.17516884207725525, -0.08378815650939941, -0.1412895917892456, 0.15344151854515076, -0.19631242752075195, 0.31987446546554565, 0.042713988572359085, -0.1469765156507492, 0.09177301079034805, 0.17224344611167908, -0.16589850187301636, 0.09082652628421783, -0.22761192917823792, 0.016985587775707245, -0.20530061423778534, -0.02798255905508995, 0.049623966217041016, -0.3885931372642517, 0.1790471076965332, 0.08653732389211655, -0.2549576163291931, 0.018511855974793434, -0.3466545641422272, 0.37961137294769287, 0.13406258821487427, -0.13447430729866028, 0.009487682953476906, 0.06794260442256927, -0.027137555181980133, 0.34759190678596497, 0.42660099267959595, 0.37038758397102356, 0.45275717973709106, -0.11467635631561279, 0.21271683275699615, -0.00002937018871307373, -0.13985194265842438, -0.10162848234176636, 0.2674999237060547, -0.08183781802654266, -0.04242263361811638, 0.214885413646698, 0.07884878665208817, -0.009939695708453655, 0.25998350977897644, 0.08807797729969025, 0.27289193868637085, 0.2007780224084854, -0.180963397026062, -0.3566814661026001, -0.07173281162977219, -0.003537788987159729, 0.1637832671403885, -0.3616594076156616, -0.18438178300857544, 0.43957191705703735, 0.052329663187265396, 0.14427995681762695, 0.0012005139142274857, -0.01499977707862854, -0.19217422604560852, 0.37594929337501526, 0.6408964395523071, 0.14864173531532288, -0.2707985043525696, -0.10163137316703796, -0.6065292954444885, -0.060471825301647186, -0.21258017420768738, -0.24425525963306427, 0.057376015931367874, 0.16797003149986267, 0.07185757160186768, 0.10202904790639877, 0.18407537043094635, -0.26242899894714355, 0.018773503601551056, 0.4543735384941101, -0.19971731305122375, -0.4804837703704834, -0.1737617701292038, 0.2672548294067383, -0.010748935863375664, -0.13545353710651398, -0.06700442731380463, 0.08320411294698715, 0.012090466916561127, -0.10956871509552002, -0.16433097422122955, -0.11674509942531586, -0.2010529339313507, 0.38090431690216064, 0.15732058882713318, 0.3760695159435272, -0.024974245578050613, 0.22867605090141296, -0.17447979748249054, -0.21265611052513123, -0.26465970277786255, -0.10386306792497635, 0.08197550475597382, 0.43035709857940674, -0.09370875358581543, -0.24776475131511688, -0.29137805104255676, -0.004141498357057571, 0.30805784463882446, -0.07874375581741333, -0.22328805923461914, 0.2830599844455719, -0.02226538211107254, -0.10395698994398117, 0.030495215207338333, 0.20648807287216187, -0.05492144078016281, 0.13069142401218414, -0.1797797530889511, -0.4800488352775574, 0.4707169830799103, -0.5182597637176514, -0.2184673547744751, 0.007280969992280006, -0.11424009501934052, -0.058822207152843475, 0.2225775569677353, -0.0904625877737999, -0.0979757010936737, 0.26199066638946533, -0.04604697972536087, -0.14674495160579681, 0.14068037271499634, 0.05060887709259987, 0.24426178634166718, -0.0012656152248382568, -0.21647492051124573, -0.026259563863277435, 0.09817394614219666, 0.11775723099708557, -0.20412135124206543 ]
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
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
[ -0.17624354362487793, -0.28966188430786133, -0.08112603425979614, 0.21007438004016876, 0.23333759605884552, -0.10606656968593597, 0.3419617712497711, 0.3747365474700928, -0.07112058997154236, 0.045171499252319336, -0.052811406552791595, 0.3634183704853058, -0.19713012874126434, 0.04573068767786026, -0.1829141527414322, -0.006891336292028427, -0.1312440037727356, 0.02086278796195984, -0.20673313736915588, 0.003379177302122116, -0.1716488152742386, 0.4683595299720764, -0.080109603703022, 0.130054771900177, -0.25565606355667114, -0.2034904807806015, 0.16306188702583313, 0.35027533769607544, -0.007030397653579712, -0.3035110533237457, -0.11140670627355576, -0.10185988247394562, -0.05263591930270195, 0.43116188049316406, -0.00010188113083131611, 0.017224304378032684, 0.20431245863437653, 0.02890448085963726, -0.02919580414891243, 0.23244011402130127, -0.08936241269111633, -0.32429683208465576, 0.06823194772005081, -0.4151137173175812, 0.10848928242921829, 0.06326379626989365, -0.19405749440193176, -0.23127169907093048, 0.3206300735473633, 0.3468671441078186, 0.33750995993614197, 0.6315900087356567, 0.1175851970911026, -0.29747408628463745, 0.13813918828964233, -0.6866142153739929, -0.14529088139533997, 0.3828819692134857, 0.3930685222148895, -0.15615162253379822, -0.12577277421951294, 0.4463542401790619, -0.20600301027297974, 0.1279686540365219, 0.05292053148150444, 0.002329339273273945, 0.31163206696510315, -0.2424154281616211, 0.07748236507177353, 0.17080146074295044, 0.2890000641345978, -0.2158908247947693, -0.2434055358171463, 0.09301462024450302, 0.04800596088171005, -0.004885148257017136, 0.12650062143802643, 0.050010621547698975, -0.06385292112827301, 0.2622418999671936, 0.15560607612133026, 0.04079676792025566, 0.02551368623971939, 0.013189375400543213, -0.11713570356369019, 0.07929804176092148, -0.048669543117284775, -0.07651215046644211, 0.077355295419693, -0.10525152087211609, 0.14313018321990967, 0.18866610527038574, -0.04673637077212334, -0.05241565406322479, -0.24947072565555573, -0.21683387458324432, 0.2561160922050476, -0.005165316164493561, 0.058670416474342346, 0.30365413427352905, -0.15571144223213196, 0.005434580147266388, 0.25511670112609863, 0.20487657189369202, -0.06266537308692932, 0.06939743459224701, -0.17865562438964844, 0.2492244988679886, 0.33593082427978516, 0.13168206810951233, -0.41118040680885315, 0.023218374699354172, 0.12441423535346985, -0.5652228593826294, 0.46770668029785156, 0.21887516975402832, 0.3554539084434509, 0.00939202681183815, -0.10201749205589294, 0.31701523065567017, 0.06359981745481491, 0.123066246509552, 0.030711673200130463, 0.5289991497993469, 0.06685378402471542, 0.026433806866407394, 0.16250860691070557, 0.0787363350391388, -0.25355881452560425, -0.19508421421051025, -0.38241249322891235, 0.27257469296455383, 0.0947088748216629, -0.17660197615623474, -0.21808455884456635, 0.021640140563249588, 0.3145618140697479, 0.09877462685108185, 0.28230899572372437, -0.10110408812761307, 0.2161392867565155, -0.11841018497943878, -0.13367146253585815, 0.2945243716239929, -0.18075565993785858, 0.026631662622094154, 0.385258287191391, -0.1650356650352478, -0.10753414034843445, 0.07099157571792603, -0.3095545768737793, -0.3607315123081207, -0.07286527752876282, 0.33589816093444824, 0.2892540693283081, -0.1008228063583374, 0.2075134962797165, -0.09548473358154297, 0.19716708362102509, -0.0021497607231140137, 0.13766272366046906, -0.18475447595119476, 0.11319924890995026, -0.26059311628341675, 0.011992266401648521, 0.43202394247055054, -0.12376086413860321, 0.06401284039020538, 0.06927739083766937, -0.24720561504364014, 0.030836589634418488, 0.14972610771656036, -0.10958550125360489, 0.2524068355560303, -0.2578505873680115, 0.12189193069934845, 0.40975767374038696, -0.46245816349983215, -0.47753751277923584, 0.2878195643424988, -0.3083671033382416, -0.2022576928138733, 0.17586392164230347, 0.151665598154068, 0.1058250218629837, 0.04770880565047264, 0.1349738985300064, 0.07823187857866287, -0.012863764539361, 0.14650958776474, -0.33783477544784546, 0.009831776842474937, -0.06713269650936127, -0.03894622251391411, 0.22446230053901672, 0.10187199711799622, 0.23127701878547668, -0.016842246055603027, 0.051870524883270264, 0.06404447555541992, -0.10972367227077484, 0.23697277903556824, 0.21071796119213104, -0.12287308275699615, -0.062977634370327, -0.21147465705871582, -0.3710154891014099, 0.1996072232723236, -0.1813734471797943, 0.11976950615644455, -0.13116171956062317, -0.06717070937156677, -0.4082633852958679, 0.05361109972000122, -0.1396603137254715, -0.23769217729568481, 0.3391566276550293, -0.034152477979660034, -0.18240873515605927, 0.021303318440914154, -0.2120845913887024, 0.23390021920204163, -0.08712997287511826, 0.03133421763777733, 0.09578722715377808, 0.19024880230426788, -0.3547942638397217, -0.2100379765033722, 0.01658529043197632, -0.0010830312967300415, 0.2228078842163086, -0.040578942745923996, -0.15474611520767212, 0.4137457013130188, 0.21876218914985657, 0.20871353149414062, 0.12224513292312622, 0.02715921401977539, 0.04666317254304886, -0.05883576348423958, -0.19298256933689117, 0.10744328796863556, 0.1737794280052185, -0.05330120027065277, 0.44121116399765015, 0.38804930448532104, 0.08838427811861038, -0.01845281571149826, 0.09897057712078094, 0.18281182646751404, 0.20703931152820587, -0.17483051121234894, 0.05743832141160965, -0.11844341456890106, 0.18179671466350555, 0.29003095626831055, 0.12432298064231873, -0.19877466559410095, -0.3176753520965576, 0.09158362448215485, 0.4236051142215729, 0.19340281188488007, 0.1327504813671112, -0.2905075252056122, -0.03624199330806732, 0.21948882937431335, -0.1433979719877243, 0.3318910598754883, 0.3839685320854187, 0.15319843590259552, -0.05525178089737892, 0.19961659610271454, 0.028303243219852448, -0.21175026893615723, 0.1488860547542572, 0.06971030682325363, 0.11572463810443878, 0.3716864585876465, 0.013979977928102016, -0.0358184278011322, -0.17296314239501953, -0.5833545923233032, 0.030848583206534386, 0.3276607096195221, -0.27489033341407776, -0.027151376008987427, -0.24907183647155762, 0.16089826822280884, -0.005646825768053532, -0.18654100596904755, -0.10606829822063446, -0.4009953737258911, 0.1303604692220688, 0.14989155530929565, -0.25143155455589294, 0.0932011753320694, -0.33063367009162903, 0.05896405875682831, 0.2605493664741516, 0.13764828443527222, -0.08581191301345825, -0.2859732508659363, -0.023156289011240005, 0.12512105703353882, 0.16462062299251556, -0.11435960233211517, 0.36511924862861633, -0.09647676348686218, -0.09289836138486862, -0.16814208030700684, -0.14692333340644836, -0.054308727383613586, -0.06969506293535233, 0.39649641513824463, 0.22913964092731476, 0.3598936200141907, -0.20959605276584625, 0.014201472513377666, 0.2692476511001587, -0.15935811400413513, -0.1855553239583969, 0.13302598893642426, 0.09044186770915985, -0.17475642263889313, -0.14481264352798462, -0.39754825830459595, -0.31302788853645325, -0.5213375091552734, -0.15239986777305603, 0.018257025629281998, 0.23235726356506348, 0.24619726836681366, -0.06183220073580742, 0.3732982277870178, 0.12861356139183044, 0.36356624960899353, -0.0931716114282608, -0.3933489918708801, 0.30689650774002075, -0.29320642352104187, -0.5069097876548767, -0.04347372427582741, -0.137781023979187, 0.2502909004688263, -0.2514771819114685, -0.29335278272628784, -0.4690936505794525, -0.11449432373046875, 0.24946054816246033, -0.2808765769004822, 0.08051086217164993, 0.2564232349395752, 0.03449174761772156, -0.2961099445819855, -0.08493980020284653, 0.14733295142650604, -0.046672798693180084, 0.012392975389957428, -0.24388355016708374, -0.1096639409661293, 0.07931353151798248, 0.12174661457538605, 0.5469100475311279, 0.0889824777841568, 0.2852962613105774, 0.2871621251106262, -0.19751660525798798, 0.05431470647454262, -0.0757988765835762, -0.44408130645751953, -0.24680937826633453, 0.12811511754989624, -0.18241508305072784, 0.1709485948085785, -0.2582050561904907, 0.26678308844566345, -0.1896941363811493, 0.03103739395737648, -0.23754116892814636, -0.17226426303386688, -0.14695876836776733, 0.05623580142855644, 0.15923462808132172, -0.15053558349609375, 0.12115743011236191, 0.03438499569892883, 0.341538667678833, 0.35949942469596863, 0.5301387310028076, -0.3401508033275604, -0.15933652222156525, -0.3693677484989166, -0.02782560884952545, -0.22526532411575317, 0.1913948953151703, -0.014698069542646408, 0.2415267378091812, 0.011217135936021805, -0.19436123967170715, 0.06760870665311813, -0.2165011316537857, 0.3101826310157776, 0.11110036820173264, 0.13396136462688446, 0.3004104793071747, -0.1980467587709427, 0.09785131365060806, -0.10747340321540833, -0.32157453894615173, -0.20235314965248108, 0.35070857405662537, 0.3277987837791443, -0.19233176112174988, -0.0035698781721293926, -0.19763951003551483, -0.12292639911174774, -0.2336283028125763, -0.08256173133850098, -0.19146911799907684, -0.20608440041542053, -0.5143700242042542, 0.22853821516036987, 0.21522557735443115, 0.3045167326927185, 0.22863458096981049, -0.06604097038507462, -0.04535926878452301, -0.34206095337867737, -0.007541567087173462, 0.13191314041614532, 0.16354450583457947, -0.19367100298404694, 0.18786390125751495, -0.30443745851516724, -0.1363782286643982, -0.04647024720907211, 0.4324776530265808, 0.05416283756494522, -0.2391466498374939, -0.12887293100357056, -0.08782391995191574, 0.13407215476036072, 0.11724883317947388, -0.224715456366539, 0.02093687653541565, 0.05608901381492615, 0.2689254879951477, 0.22183847427368164, -0.08973746001720428, 0.1942427158355713, -0.1170136108994484, 0.0614723265171051, -0.04573448374867439, 0.10718332976102829, -0.06026102975010872, 0.056403473019599915, 0.15334263443946838, -0.008362144231796265, 0.0007911673747003078, 0.07465845346450806, 0.04577047750353813, 0.8141487836837769, 0.07185586541891098, 0.028817193582654, 0.39878711104393005, -0.07649169862270355, 0.02656690403819084, -0.053773775696754456, -0.04726684093475342, -0.4759179353713989, -0.4287513792514801, -0.004331227391958237, -0.18773382902145386, 0.39592960476875305, -0.09594498574733734, -0.2564138174057007, 0.01684178225696087, -0.21192799508571625, 0.06972397118806839, -0.2553555369377136, 0.059220097959041595, -0.1666865348815918, -0.04262261465191841, -0.26659542322158813, 0.24246054887771606, 0.038528770208358765, 0.06736224889755249, -0.22382953763008118, -0.16280321776866913, -0.10836721956729889, -0.2362053245306015, -0.14957374334335327, 0.04498327523469925, -0.489735871553421, 0.36337578296661377, 0.16941387951374054, -0.17303521931171417, -0.24627521634101868, -0.04804361239075661, 0.04229355975985527, 0.1616162806749344, 0.009072251617908478, 0.1605139672756195, 0.3387368619441986, 0.017196210101246834, 0.06971300393342972, 0.12951849400997162, 0.6255918145179749, -0.29617515206336975, -0.06997159123420715, 0.25819119811058044, -0.07037936896085739, -0.16811203956604004, 0.25123921036720276, 0.08516914397478104, 0.11444179713726044, -0.1549883782863617, -0.22314392030239105, 0.030415277928113937, -0.246032252907753, -0.33370837569236755, 0.2120128720998764, 0.18348661065101624, -0.28036949038505554, 0.11846797168254852, -0.048934098333120346, -0.18533438444137573, -0.14668771624565125, 0.27956756949424744, -0.020329397171735764, 0.21112042665481567, 0.41807204484939575, 0.14858393371105194, -0.3208756446838379, -0.42044347524642944, 0.1520601212978363, -0.13581989705562592, -0.2077387571334839, 0.4573822617530823, 0.028350872918963432, -0.13380251824855804, 0.06009451299905777, 0.5471389293670654, 0.04352826997637749, 0.07778794318437576, -0.014750391244888306, -0.5255997180938721, -0.5390858054161072, -0.027754224836826324, -0.15863101184368134, 0.13955943286418915, -0.08613070100545883, 0.3869231045246124, -0.17648935317993164, 0.14282482862472534, -0.4534685015678406, -0.010904248803853989, -0.30431562662124634, 0.012121027335524559, 0.3330516815185547, -0.12599319219589233, 0.18834394216537476, 0.35374915599823, 0.25105541944503784, 0.25616616010665894, -0.1985633224248886, -0.3743054270744324, -0.22375263273715973, 0.100924551486969, 0.10287749767303467, -0.036064743995666504, 0.01460020150989294, -0.16241857409477234, -0.07640860974788666, 0.045876096934080124, 0.012400131672620773, 0.19031193852424622, -0.03191293776035309, 0.42837992310523987, 0.06608046591281891, 0.017683900892734528, -0.08185742795467377, 0.11410684883594513, -0.05253155529499054, -0.09036073088645935, -0.07530796527862549, -0.08022778481245041, -0.09977731108665466, -0.0787414163351059, -0.3449898958206177, 0.04051874577999115, -0.1406915783882141, 0.09585246443748474, 0.370185911655426, 0.005360070616006851, -0.12509970366954803, 0.345363050699234, 0.19379019737243652, 0.1545022577047348, -0.20998074114322662, -0.11246280372142792, 0.20599710941314697, 0.33222994208335876, -0.3889957070350647, -0.06613880395889282, -0.07266166806221008, -0.013331000693142414, 0.14208732545375824, 0.2165171355009079, -0.0956607460975647, -0.11437909305095673, -0.21403922140598297, 0.21055474877357483, 0.0040034637786448, -0.278022825717926, 0.06721308827400208, 0.09774358570575714, 0.001604083925485611, 0.09462382644414902, 0.38939064741134644, 0.1985999345779419, 0.06525404751300812, 0.04238636791706085, -0.24829423427581787, 0.042799774557352066, 0.022747013717889786, -0.13915163278579712, 0.13277025520801544, -0.19137407839298248, 0.3528232276439667, 0.02645041048526764, 0.0793117880821228, -0.15092754364013672, -0.01495707780122757, 0.13642717897891998, 0.10998803377151489, 0.19470320641994476, 0.011231103911995888, 0.25554412603378296, -0.30219659209251404, 0.024952124804258347, 0.45057764649391174, 0.0012914091348648071, 0.01060766726732254, -0.11430080235004425, 0.12656301259994507, 0.14691957831382751, 0.36392882466316223, 0.28376734256744385, 0.12361595034599304, -0.2854912579059601, -0.24918755888938904, 0.1783471703529358, -0.013511672616004944, -0.5115432143211365, -0.140528604388237, 0.16903997957706451, 0.09186042100191116, -0.0014996640384197235, 0.19675351679325104, 0.3545474112033844, 0.30715978145599365, -0.14513370394706726, -0.040751054883003235, -0.06163578853011131, -0.10663419961929321, -0.05946559086441994, 0.16613659262657166, -0.10609745979309082, 0.16498291492462158, 0.3342292308807373, 0.20221242308616638, -0.33099761605262756, -0.08569306135177612, 0.100333571434021, -0.1815444827079773, -0.14718832075595856, 0.4650386869907379, 0.0791240930557251, -0.293016254901886, -0.18671171367168427, 0.14762960374355316, -0.314522922039032, -0.3138011693954468, 0.07677499949932098, -0.060843728482723236, 0.18347585201263428, -0.27726638317108154, 0.16979888081550598, 0.044774726033210754, 0.23666870594024658, 0.4011516571044922, -0.05484389513731003, -0.41469916701316833, 0.008219428360462189, -0.5747376680374146, 0.445812463760376, 0.11493846774101257, -0.4076003432273865, -0.07454340904951096, 0.2775898277759552, -0.19463559985160828, 0.16969643533229828, 0.3113998770713806, -0.2594892382621765, 0.028853237628936768, 0.2740807831287384, -0.28403106331825256, -0.058122772723436356, -0.1493946760892868, -0.2160840928554535, 0.07854126393795013, -0.14316590130329132, 0.08864662796258926, -0.12808984518051147, 0.2598353326320648, -0.06764095276594162, -0.3588828146457672, 0.17348900437355042, 0.21292118728160858, 0.3397989273071289, 0.054932303726673126, 0.323615700006485, -0.2871124744415283, 0.03701208531856537, 0.022650785744190216, -0.15750707685947418, -0.02693595364689827, -0.04059024155139923, 0.15620644390583038, 0.21000200510025024, 0.04087945073843002, -0.10207214951515198, -0.3193330764770508, 0.5023037791252136, -0.15918445587158203, -0.21462289988994598, -0.20822028815746307, 0.3630656898021698, 0.062129080295562744, 0.10627064853906631, 0.06056070700287819, 0.2618609368801117, 0.04060881584882736, 0.3412996828556061, -0.47204703092575073, -0.6365745663642883, 0.44734659790992737, -0.3823888897895813, -0.2945074439048767, 0.032262492924928665, 0.4139116704463959, -0.12446051090955734, 0.03081994131207466, -0.4388790428638458, 0.0522969588637352, 0.2644752860069275, -0.06371208280324936, -0.10672187805175781, 0.4192754328250885, -0.03998034447431564, 0.14795774221420288, 0.025188546627759933, 0.21676090359687805, 0.08250159025192261, 0.07250124216079712, -0.10108263790607452, -0.042484208941459656 ]
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
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.
[ -0.17624354362487793, -0.28966188430786133, -0.08112603425979614, 0.21007438004016876, 0.23333759605884552, -0.10606656968593597, 0.3419617712497711, 0.3747365474700928, -0.07112058997154236, 0.045171499252319336, -0.052811406552791595, 0.3634183704853058, -0.19713012874126434, 0.04573068767786026, -0.1829141527414322, -0.006891336292028427, -0.1312440037727356, 0.02086278796195984, -0.20673313736915588, 0.003379177302122116, -0.1716488152742386, 0.4683595299720764, -0.080109603703022, 0.130054771900177, -0.25565606355667114, -0.2034904807806015, 0.16306188702583313, 0.35027533769607544, -0.007030397653579712, -0.3035110533237457, -0.11140670627355576, -0.10185988247394562, -0.05263591930270195, 0.43116188049316406, -0.00010188113083131611, 0.017224304378032684, 0.20431245863437653, 0.02890448085963726, -0.02919580414891243, 0.23244011402130127, -0.08936241269111633, -0.32429683208465576, 0.06823194772005081, -0.4151137173175812, 0.10848928242921829, 0.06326379626989365, -0.19405749440193176, -0.23127169907093048, 0.3206300735473633, 0.3468671441078186, 0.33750995993614197, 0.6315900087356567, 0.1175851970911026, -0.29747408628463745, 0.13813918828964233, -0.6866142153739929, -0.14529088139533997, 0.3828819692134857, 0.3930685222148895, -0.15615162253379822, -0.12577277421951294, 0.4463542401790619, -0.20600301027297974, 0.1279686540365219, 0.05292053148150444, 0.002329339273273945, 0.31163206696510315, -0.2424154281616211, 0.07748236507177353, 0.17080146074295044, 0.2890000641345978, -0.2158908247947693, -0.2434055358171463, 0.09301462024450302, 0.04800596088171005, -0.004885148257017136, 0.12650062143802643, 0.050010621547698975, -0.06385292112827301, 0.2622418999671936, 0.15560607612133026, 0.04079676792025566, 0.02551368623971939, 0.013189375400543213, -0.11713570356369019, 0.07929804176092148, -0.048669543117284775, -0.07651215046644211, 0.077355295419693, -0.10525152087211609, 0.14313018321990967, 0.18866610527038574, -0.04673637077212334, -0.05241565406322479, -0.24947072565555573, -0.21683387458324432, 0.2561160922050476, -0.005165316164493561, 0.058670416474342346, 0.30365413427352905, -0.15571144223213196, 0.005434580147266388, 0.25511670112609863, 0.20487657189369202, -0.06266537308692932, 0.06939743459224701, -0.17865562438964844, 0.2492244988679886, 0.33593082427978516, 0.13168206810951233, -0.41118040680885315, 0.023218374699354172, 0.12441423535346985, -0.5652228593826294, 0.46770668029785156, 0.21887516975402832, 0.3554539084434509, 0.00939202681183815, -0.10201749205589294, 0.31701523065567017, 0.06359981745481491, 0.123066246509552, 0.030711673200130463, 0.5289991497993469, 0.06685378402471542, 0.026433806866407394, 0.16250860691070557, 0.0787363350391388, -0.25355881452560425, -0.19508421421051025, -0.38241249322891235, 0.27257469296455383, 0.0947088748216629, -0.17660197615623474, -0.21808455884456635, 0.021640140563249588, 0.3145618140697479, 0.09877462685108185, 0.28230899572372437, -0.10110408812761307, 0.2161392867565155, -0.11841018497943878, -0.13367146253585815, 0.2945243716239929, -0.18075565993785858, 0.026631662622094154, 0.385258287191391, -0.1650356650352478, -0.10753414034843445, 0.07099157571792603, -0.3095545768737793, -0.3607315123081207, -0.07286527752876282, 0.33589816093444824, 0.2892540693283081, -0.1008228063583374, 0.2075134962797165, -0.09548473358154297, 0.19716708362102509, -0.0021497607231140137, 0.13766272366046906, -0.18475447595119476, 0.11319924890995026, -0.26059311628341675, 0.011992266401648521, 0.43202394247055054, -0.12376086413860321, 0.06401284039020538, 0.06927739083766937, -0.24720561504364014, 0.030836589634418488, 0.14972610771656036, -0.10958550125360489, 0.2524068355560303, -0.2578505873680115, 0.12189193069934845, 0.40975767374038696, -0.46245816349983215, -0.47753751277923584, 0.2878195643424988, -0.3083671033382416, -0.2022576928138733, 0.17586392164230347, 0.151665598154068, 0.1058250218629837, 0.04770880565047264, 0.1349738985300064, 0.07823187857866287, -0.012863764539361, 0.14650958776474, -0.33783477544784546, 0.009831776842474937, -0.06713269650936127, -0.03894622251391411, 0.22446230053901672, 0.10187199711799622, 0.23127701878547668, -0.016842246055603027, 0.051870524883270264, 0.06404447555541992, -0.10972367227077484, 0.23697277903556824, 0.21071796119213104, -0.12287308275699615, -0.062977634370327, -0.21147465705871582, -0.3710154891014099, 0.1996072232723236, -0.1813734471797943, 0.11976950615644455, -0.13116171956062317, -0.06717070937156677, -0.4082633852958679, 0.05361109972000122, -0.1396603137254715, -0.23769217729568481, 0.3391566276550293, -0.034152477979660034, -0.18240873515605927, 0.021303318440914154, -0.2120845913887024, 0.23390021920204163, -0.08712997287511826, 0.03133421763777733, 0.09578722715377808, 0.19024880230426788, -0.3547942638397217, -0.2100379765033722, 0.01658529043197632, -0.0010830312967300415, 0.2228078842163086, -0.040578942745923996, -0.15474611520767212, 0.4137457013130188, 0.21876218914985657, 0.20871353149414062, 0.12224513292312622, 0.02715921401977539, 0.04666317254304886, -0.05883576348423958, -0.19298256933689117, 0.10744328796863556, 0.1737794280052185, -0.05330120027065277, 0.44121116399765015, 0.38804930448532104, 0.08838427811861038, -0.01845281571149826, 0.09897057712078094, 0.18281182646751404, 0.20703931152820587, -0.17483051121234894, 0.05743832141160965, -0.11844341456890106, 0.18179671466350555, 0.29003095626831055, 0.12432298064231873, -0.19877466559410095, -0.3176753520965576, 0.09158362448215485, 0.4236051142215729, 0.19340281188488007, 0.1327504813671112, -0.2905075252056122, -0.03624199330806732, 0.21948882937431335, -0.1433979719877243, 0.3318910598754883, 0.3839685320854187, 0.15319843590259552, -0.05525178089737892, 0.19961659610271454, 0.028303243219852448, -0.21175026893615723, 0.1488860547542572, 0.06971030682325363, 0.11572463810443878, 0.3716864585876465, 0.013979977928102016, -0.0358184278011322, -0.17296314239501953, -0.5833545923233032, 0.030848583206534386, 0.3276607096195221, -0.27489033341407776, -0.027151376008987427, -0.24907183647155762, 0.16089826822280884, -0.005646825768053532, -0.18654100596904755, -0.10606829822063446, -0.4009953737258911, 0.1303604692220688, 0.14989155530929565, -0.25143155455589294, 0.0932011753320694, -0.33063367009162903, 0.05896405875682831, 0.2605493664741516, 0.13764828443527222, -0.08581191301345825, -0.2859732508659363, -0.023156289011240005, 0.12512105703353882, 0.16462062299251556, -0.11435960233211517, 0.36511924862861633, -0.09647676348686218, -0.09289836138486862, -0.16814208030700684, -0.14692333340644836, -0.054308727383613586, -0.06969506293535233, 0.39649641513824463, 0.22913964092731476, 0.3598936200141907, -0.20959605276584625, 0.014201472513377666, 0.2692476511001587, -0.15935811400413513, -0.1855553239583969, 0.13302598893642426, 0.09044186770915985, -0.17475642263889313, -0.14481264352798462, -0.39754825830459595, -0.31302788853645325, -0.5213375091552734, -0.15239986777305603, 0.018257025629281998, 0.23235726356506348, 0.24619726836681366, -0.06183220073580742, 0.3732982277870178, 0.12861356139183044, 0.36356624960899353, -0.0931716114282608, -0.3933489918708801, 0.30689650774002075, -0.29320642352104187, -0.5069097876548767, -0.04347372427582741, -0.137781023979187, 0.2502909004688263, -0.2514771819114685, -0.29335278272628784, -0.4690936505794525, -0.11449432373046875, 0.24946054816246033, -0.2808765769004822, 0.08051086217164993, 0.2564232349395752, 0.03449174761772156, -0.2961099445819855, -0.08493980020284653, 0.14733295142650604, -0.046672798693180084, 0.012392975389957428, -0.24388355016708374, -0.1096639409661293, 0.07931353151798248, 0.12174661457538605, 0.5469100475311279, 0.0889824777841568, 0.2852962613105774, 0.2871621251106262, -0.19751660525798798, 0.05431470647454262, -0.0757988765835762, -0.44408130645751953, -0.24680937826633453, 0.12811511754989624, -0.18241508305072784, 0.1709485948085785, -0.2582050561904907, 0.26678308844566345, -0.1896941363811493, 0.03103739395737648, -0.23754116892814636, -0.17226426303386688, -0.14695876836776733, 0.05623580142855644, 0.15923462808132172, -0.15053558349609375, 0.12115743011236191, 0.03438499569892883, 0.341538667678833, 0.35949942469596863, 0.5301387310028076, -0.3401508033275604, -0.15933652222156525, -0.3693677484989166, -0.02782560884952545, -0.22526532411575317, 0.1913948953151703, -0.014698069542646408, 0.2415267378091812, 0.011217135936021805, -0.19436123967170715, 0.06760870665311813, -0.2165011316537857, 0.3101826310157776, 0.11110036820173264, 0.13396136462688446, 0.3004104793071747, -0.1980467587709427, 0.09785131365060806, -0.10747340321540833, -0.32157453894615173, -0.20235314965248108, 0.35070857405662537, 0.3277987837791443, -0.19233176112174988, -0.0035698781721293926, -0.19763951003551483, -0.12292639911174774, -0.2336283028125763, -0.08256173133850098, -0.19146911799907684, -0.20608440041542053, -0.5143700242042542, 0.22853821516036987, 0.21522557735443115, 0.3045167326927185, 0.22863458096981049, -0.06604097038507462, -0.04535926878452301, -0.34206095337867737, -0.007541567087173462, 0.13191314041614532, 0.16354450583457947, -0.19367100298404694, 0.18786390125751495, -0.30443745851516724, -0.1363782286643982, -0.04647024720907211, 0.4324776530265808, 0.05416283756494522, -0.2391466498374939, -0.12887293100357056, -0.08782391995191574, 0.13407215476036072, 0.11724883317947388, -0.224715456366539, 0.02093687653541565, 0.05608901381492615, 0.2689254879951477, 0.22183847427368164, -0.08973746001720428, 0.1942427158355713, -0.1170136108994484, 0.0614723265171051, -0.04573448374867439, 0.10718332976102829, -0.06026102975010872, 0.056403473019599915, 0.15334263443946838, -0.008362144231796265, 0.0007911673747003078, 0.07465845346450806, 0.04577047750353813, 0.8141487836837769, 0.07185586541891098, 0.028817193582654, 0.39878711104393005, -0.07649169862270355, 0.02656690403819084, -0.053773775696754456, -0.04726684093475342, -0.4759179353713989, -0.4287513792514801, -0.004331227391958237, -0.18773382902145386, 0.39592960476875305, -0.09594498574733734, -0.2564138174057007, 0.01684178225696087, -0.21192799508571625, 0.06972397118806839, -0.2553555369377136, 0.059220097959041595, -0.1666865348815918, -0.04262261465191841, -0.26659542322158813, 0.24246054887771606, 0.038528770208358765, 0.06736224889755249, -0.22382953763008118, -0.16280321776866913, -0.10836721956729889, -0.2362053245306015, -0.14957374334335327, 0.04498327523469925, -0.489735871553421, 0.36337578296661377, 0.16941387951374054, -0.17303521931171417, -0.24627521634101868, -0.04804361239075661, 0.04229355975985527, 0.1616162806749344, 0.009072251617908478, 0.1605139672756195, 0.3387368619441986, 0.017196210101246834, 0.06971300393342972, 0.12951849400997162, 0.6255918145179749, -0.29617515206336975, -0.06997159123420715, 0.25819119811058044, -0.07037936896085739, -0.16811203956604004, 0.25123921036720276, 0.08516914397478104, 0.11444179713726044, -0.1549883782863617, -0.22314392030239105, 0.030415277928113937, -0.246032252907753, -0.33370837569236755, 0.2120128720998764, 0.18348661065101624, -0.28036949038505554, 0.11846797168254852, -0.048934098333120346, -0.18533438444137573, -0.14668771624565125, 0.27956756949424744, -0.020329397171735764, 0.21112042665481567, 0.41807204484939575, 0.14858393371105194, -0.3208756446838379, -0.42044347524642944, 0.1520601212978363, -0.13581989705562592, -0.2077387571334839, 0.4573822617530823, 0.028350872918963432, -0.13380251824855804, 0.06009451299905777, 0.5471389293670654, 0.04352826997637749, 0.07778794318437576, -0.014750391244888306, -0.5255997180938721, -0.5390858054161072, -0.027754224836826324, -0.15863101184368134, 0.13955943286418915, -0.08613070100545883, 0.3869231045246124, -0.17648935317993164, 0.14282482862472534, -0.4534685015678406, -0.010904248803853989, -0.30431562662124634, 0.012121027335524559, 0.3330516815185547, -0.12599319219589233, 0.18834394216537476, 0.35374915599823, 0.25105541944503784, 0.25616616010665894, -0.1985633224248886, -0.3743054270744324, -0.22375263273715973, 0.100924551486969, 0.10287749767303467, -0.036064743995666504, 0.01460020150989294, -0.16241857409477234, -0.07640860974788666, 0.045876096934080124, 0.012400131672620773, 0.19031193852424622, -0.03191293776035309, 0.42837992310523987, 0.06608046591281891, 0.017683900892734528, -0.08185742795467377, 0.11410684883594513, -0.05253155529499054, -0.09036073088645935, -0.07530796527862549, -0.08022778481245041, -0.09977731108665466, -0.0787414163351059, -0.3449898958206177, 0.04051874577999115, -0.1406915783882141, 0.09585246443748474, 0.370185911655426, 0.005360070616006851, -0.12509970366954803, 0.345363050699234, 0.19379019737243652, 0.1545022577047348, -0.20998074114322662, -0.11246280372142792, 0.20599710941314697, 0.33222994208335876, -0.3889957070350647, -0.06613880395889282, -0.07266166806221008, -0.013331000693142414, 0.14208732545375824, 0.2165171355009079, -0.0956607460975647, -0.11437909305095673, -0.21403922140598297, 0.21055474877357483, 0.0040034637786448, -0.278022825717926, 0.06721308827400208, 0.09774358570575714, 0.001604083925485611, 0.09462382644414902, 0.38939064741134644, 0.1985999345779419, 0.06525404751300812, 0.04238636791706085, -0.24829423427581787, 0.042799774557352066, 0.022747013717889786, -0.13915163278579712, 0.13277025520801544, -0.19137407839298248, 0.3528232276439667, 0.02645041048526764, 0.0793117880821228, -0.15092754364013672, -0.01495707780122757, 0.13642717897891998, 0.10998803377151489, 0.19470320641994476, 0.011231103911995888, 0.25554412603378296, -0.30219659209251404, 0.024952124804258347, 0.45057764649391174, 0.0012914091348648071, 0.01060766726732254, -0.11430080235004425, 0.12656301259994507, 0.14691957831382751, 0.36392882466316223, 0.28376734256744385, 0.12361595034599304, -0.2854912579059601, -0.24918755888938904, 0.1783471703529358, -0.013511672616004944, -0.5115432143211365, -0.140528604388237, 0.16903997957706451, 0.09186042100191116, -0.0014996640384197235, 0.19675351679325104, 0.3545474112033844, 0.30715978145599365, -0.14513370394706726, -0.040751054883003235, -0.06163578853011131, -0.10663419961929321, -0.05946559086441994, 0.16613659262657166, -0.10609745979309082, 0.16498291492462158, 0.3342292308807373, 0.20221242308616638, -0.33099761605262756, -0.08569306135177612, 0.100333571434021, -0.1815444827079773, -0.14718832075595856, 0.4650386869907379, 0.0791240930557251, -0.293016254901886, -0.18671171367168427, 0.14762960374355316, -0.314522922039032, -0.3138011693954468, 0.07677499949932098, -0.060843728482723236, 0.18347585201263428, -0.27726638317108154, 0.16979888081550598, 0.044774726033210754, 0.23666870594024658, 0.4011516571044922, -0.05484389513731003, -0.41469916701316833, 0.008219428360462189, -0.5747376680374146, 0.445812463760376, 0.11493846774101257, -0.4076003432273865, -0.07454340904951096, 0.2775898277759552, -0.19463559985160828, 0.16969643533229828, 0.3113998770713806, -0.2594892382621765, 0.028853237628936768, 0.2740807831287384, -0.28403106331825256, -0.058122772723436356, -0.1493946760892868, -0.2160840928554535, 0.07854126393795013, -0.14316590130329132, 0.08864662796258926, -0.12808984518051147, 0.2598353326320648, -0.06764095276594162, -0.3588828146457672, 0.17348900437355042, 0.21292118728160858, 0.3397989273071289, 0.054932303726673126, 0.323615700006485, -0.2871124744415283, 0.03701208531856537, 0.022650785744190216, -0.15750707685947418, -0.02693595364689827, -0.04059024155139923, 0.15620644390583038, 0.21000200510025024, 0.04087945073843002, -0.10207214951515198, -0.3193330764770508, 0.5023037791252136, -0.15918445587158203, -0.21462289988994598, -0.20822028815746307, 0.3630656898021698, 0.062129080295562744, 0.10627064853906631, 0.06056070700287819, 0.2618609368801117, 0.04060881584882736, 0.3412996828556061, -0.47204703092575073, -0.6365745663642883, 0.44734659790992737, -0.3823888897895813, -0.2945074439048767, 0.032262492924928665, 0.4139116704463959, -0.12446051090955734, 0.03081994131207466, -0.4388790428638458, 0.0522969588637352, 0.2644752860069275, -0.06371208280324936, -0.10672187805175781, 0.4192754328250885, -0.03998034447431564, 0.14795774221420288, 0.025188546627759933, 0.21676090359687805, 0.08250159025192261, 0.07250124216079712, -0.10108263790607452, -0.042484208941459656 ]
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
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.
[ -0.17624354362487793, -0.28966188430786133, -0.08112603425979614, 0.21007438004016876, 0.23333759605884552, -0.10606656968593597, 0.3419617712497711, 0.3747365474700928, -0.07112058997154236, 0.045171499252319336, -0.052811406552791595, 0.3634183704853058, -0.19713012874126434, 0.04573068767786026, -0.1829141527414322, -0.006891336292028427, -0.1312440037727356, 0.02086278796195984, -0.20673313736915588, 0.003379177302122116, -0.1716488152742386, 0.4683595299720764, -0.080109603703022, 0.130054771900177, -0.25565606355667114, -0.2034904807806015, 0.16306188702583313, 0.35027533769607544, -0.007030397653579712, -0.3035110533237457, -0.11140670627355576, -0.10185988247394562, -0.05263591930270195, 0.43116188049316406, -0.00010188113083131611, 0.017224304378032684, 0.20431245863437653, 0.02890448085963726, -0.02919580414891243, 0.23244011402130127, -0.08936241269111633, -0.32429683208465576, 0.06823194772005081, -0.4151137173175812, 0.10848928242921829, 0.06326379626989365, -0.19405749440193176, -0.23127169907093048, 0.3206300735473633, 0.3468671441078186, 0.33750995993614197, 0.6315900087356567, 0.1175851970911026, -0.29747408628463745, 0.13813918828964233, -0.6866142153739929, -0.14529088139533997, 0.3828819692134857, 0.3930685222148895, -0.15615162253379822, -0.12577277421951294, 0.4463542401790619, -0.20600301027297974, 0.1279686540365219, 0.05292053148150444, 0.002329339273273945, 0.31163206696510315, -0.2424154281616211, 0.07748236507177353, 0.17080146074295044, 0.2890000641345978, -0.2158908247947693, -0.2434055358171463, 0.09301462024450302, 0.04800596088171005, -0.004885148257017136, 0.12650062143802643, 0.050010621547698975, -0.06385292112827301, 0.2622418999671936, 0.15560607612133026, 0.04079676792025566, 0.02551368623971939, 0.013189375400543213, -0.11713570356369019, 0.07929804176092148, -0.048669543117284775, -0.07651215046644211, 0.077355295419693, -0.10525152087211609, 0.14313018321990967, 0.18866610527038574, -0.04673637077212334, -0.05241565406322479, -0.24947072565555573, -0.21683387458324432, 0.2561160922050476, -0.005165316164493561, 0.058670416474342346, 0.30365413427352905, -0.15571144223213196, 0.005434580147266388, 0.25511670112609863, 0.20487657189369202, -0.06266537308692932, 0.06939743459224701, -0.17865562438964844, 0.2492244988679886, 0.33593082427978516, 0.13168206810951233, -0.41118040680885315, 0.023218374699354172, 0.12441423535346985, -0.5652228593826294, 0.46770668029785156, 0.21887516975402832, 0.3554539084434509, 0.00939202681183815, -0.10201749205589294, 0.31701523065567017, 0.06359981745481491, 0.123066246509552, 0.030711673200130463, 0.5289991497993469, 0.06685378402471542, 0.026433806866407394, 0.16250860691070557, 0.0787363350391388, -0.25355881452560425, -0.19508421421051025, -0.38241249322891235, 0.27257469296455383, 0.0947088748216629, -0.17660197615623474, -0.21808455884456635, 0.021640140563249588, 0.3145618140697479, 0.09877462685108185, 0.28230899572372437, -0.10110408812761307, 0.2161392867565155, -0.11841018497943878, -0.13367146253585815, 0.2945243716239929, -0.18075565993785858, 0.026631662622094154, 0.385258287191391, -0.1650356650352478, -0.10753414034843445, 0.07099157571792603, -0.3095545768737793, -0.3607315123081207, -0.07286527752876282, 0.33589816093444824, 0.2892540693283081, -0.1008228063583374, 0.2075134962797165, -0.09548473358154297, 0.19716708362102509, -0.0021497607231140137, 0.13766272366046906, -0.18475447595119476, 0.11319924890995026, -0.26059311628341675, 0.011992266401648521, 0.43202394247055054, -0.12376086413860321, 0.06401284039020538, 0.06927739083766937, -0.24720561504364014, 0.030836589634418488, 0.14972610771656036, -0.10958550125360489, 0.2524068355560303, -0.2578505873680115, 0.12189193069934845, 0.40975767374038696, -0.46245816349983215, -0.47753751277923584, 0.2878195643424988, -0.3083671033382416, -0.2022576928138733, 0.17586392164230347, 0.151665598154068, 0.1058250218629837, 0.04770880565047264, 0.1349738985300064, 0.07823187857866287, -0.012863764539361, 0.14650958776474, -0.33783477544784546, 0.009831776842474937, -0.06713269650936127, -0.03894622251391411, 0.22446230053901672, 0.10187199711799622, 0.23127701878547668, -0.016842246055603027, 0.051870524883270264, 0.06404447555541992, -0.10972367227077484, 0.23697277903556824, 0.21071796119213104, -0.12287308275699615, -0.062977634370327, -0.21147465705871582, -0.3710154891014099, 0.1996072232723236, -0.1813734471797943, 0.11976950615644455, -0.13116171956062317, -0.06717070937156677, -0.4082633852958679, 0.05361109972000122, -0.1396603137254715, -0.23769217729568481, 0.3391566276550293, -0.034152477979660034, -0.18240873515605927, 0.021303318440914154, -0.2120845913887024, 0.23390021920204163, -0.08712997287511826, 0.03133421763777733, 0.09578722715377808, 0.19024880230426788, -0.3547942638397217, -0.2100379765033722, 0.01658529043197632, -0.0010830312967300415, 0.2228078842163086, -0.040578942745923996, -0.15474611520767212, 0.4137457013130188, 0.21876218914985657, 0.20871353149414062, 0.12224513292312622, 0.02715921401977539, 0.04666317254304886, -0.05883576348423958, -0.19298256933689117, 0.10744328796863556, 0.1737794280052185, -0.05330120027065277, 0.44121116399765015, 0.38804930448532104, 0.08838427811861038, -0.01845281571149826, 0.09897057712078094, 0.18281182646751404, 0.20703931152820587, -0.17483051121234894, 0.05743832141160965, -0.11844341456890106, 0.18179671466350555, 0.29003095626831055, 0.12432298064231873, -0.19877466559410095, -0.3176753520965576, 0.09158362448215485, 0.4236051142215729, 0.19340281188488007, 0.1327504813671112, -0.2905075252056122, -0.03624199330806732, 0.21948882937431335, -0.1433979719877243, 0.3318910598754883, 0.3839685320854187, 0.15319843590259552, -0.05525178089737892, 0.19961659610271454, 0.028303243219852448, -0.21175026893615723, 0.1488860547542572, 0.06971030682325363, 0.11572463810443878, 0.3716864585876465, 0.013979977928102016, -0.0358184278011322, -0.17296314239501953, -0.5833545923233032, 0.030848583206534386, 0.3276607096195221, -0.27489033341407776, -0.027151376008987427, -0.24907183647155762, 0.16089826822280884, -0.005646825768053532, -0.18654100596904755, -0.10606829822063446, -0.4009953737258911, 0.1303604692220688, 0.14989155530929565, -0.25143155455589294, 0.0932011753320694, -0.33063367009162903, 0.05896405875682831, 0.2605493664741516, 0.13764828443527222, -0.08581191301345825, -0.2859732508659363, -0.023156289011240005, 0.12512105703353882, 0.16462062299251556, -0.11435960233211517, 0.36511924862861633, -0.09647676348686218, -0.09289836138486862, -0.16814208030700684, -0.14692333340644836, -0.054308727383613586, -0.06969506293535233, 0.39649641513824463, 0.22913964092731476, 0.3598936200141907, -0.20959605276584625, 0.014201472513377666, 0.2692476511001587, -0.15935811400413513, -0.1855553239583969, 0.13302598893642426, 0.09044186770915985, -0.17475642263889313, -0.14481264352798462, -0.39754825830459595, -0.31302788853645325, -0.5213375091552734, -0.15239986777305603, 0.018257025629281998, 0.23235726356506348, 0.24619726836681366, -0.06183220073580742, 0.3732982277870178, 0.12861356139183044, 0.36356624960899353, -0.0931716114282608, -0.3933489918708801, 0.30689650774002075, -0.29320642352104187, -0.5069097876548767, -0.04347372427582741, -0.137781023979187, 0.2502909004688263, -0.2514771819114685, -0.29335278272628784, -0.4690936505794525, -0.11449432373046875, 0.24946054816246033, -0.2808765769004822, 0.08051086217164993, 0.2564232349395752, 0.03449174761772156, -0.2961099445819855, -0.08493980020284653, 0.14733295142650604, -0.046672798693180084, 0.012392975389957428, -0.24388355016708374, -0.1096639409661293, 0.07931353151798248, 0.12174661457538605, 0.5469100475311279, 0.0889824777841568, 0.2852962613105774, 0.2871621251106262, -0.19751660525798798, 0.05431470647454262, -0.0757988765835762, -0.44408130645751953, -0.24680937826633453, 0.12811511754989624, -0.18241508305072784, 0.1709485948085785, -0.2582050561904907, 0.26678308844566345, -0.1896941363811493, 0.03103739395737648, -0.23754116892814636, -0.17226426303386688, -0.14695876836776733, 0.05623580142855644, 0.15923462808132172, -0.15053558349609375, 0.12115743011236191, 0.03438499569892883, 0.341538667678833, 0.35949942469596863, 0.5301387310028076, -0.3401508033275604, -0.15933652222156525, -0.3693677484989166, -0.02782560884952545, -0.22526532411575317, 0.1913948953151703, -0.014698069542646408, 0.2415267378091812, 0.011217135936021805, -0.19436123967170715, 0.06760870665311813, -0.2165011316537857, 0.3101826310157776, 0.11110036820173264, 0.13396136462688446, 0.3004104793071747, -0.1980467587709427, 0.09785131365060806, -0.10747340321540833, -0.32157453894615173, -0.20235314965248108, 0.35070857405662537, 0.3277987837791443, -0.19233176112174988, -0.0035698781721293926, -0.19763951003551483, -0.12292639911174774, -0.2336283028125763, -0.08256173133850098, -0.19146911799907684, -0.20608440041542053, -0.5143700242042542, 0.22853821516036987, 0.21522557735443115, 0.3045167326927185, 0.22863458096981049, -0.06604097038507462, -0.04535926878452301, -0.34206095337867737, -0.007541567087173462, 0.13191314041614532, 0.16354450583457947, -0.19367100298404694, 0.18786390125751495, -0.30443745851516724, -0.1363782286643982, -0.04647024720907211, 0.4324776530265808, 0.05416283756494522, -0.2391466498374939, -0.12887293100357056, -0.08782391995191574, 0.13407215476036072, 0.11724883317947388, -0.224715456366539, 0.02093687653541565, 0.05608901381492615, 0.2689254879951477, 0.22183847427368164, -0.08973746001720428, 0.1942427158355713, -0.1170136108994484, 0.0614723265171051, -0.04573448374867439, 0.10718332976102829, -0.06026102975010872, 0.056403473019599915, 0.15334263443946838, -0.008362144231796265, 0.0007911673747003078, 0.07465845346450806, 0.04577047750353813, 0.8141487836837769, 0.07185586541891098, 0.028817193582654, 0.39878711104393005, -0.07649169862270355, 0.02656690403819084, -0.053773775696754456, -0.04726684093475342, -0.4759179353713989, -0.4287513792514801, -0.004331227391958237, -0.18773382902145386, 0.39592960476875305, -0.09594498574733734, -0.2564138174057007, 0.01684178225696087, -0.21192799508571625, 0.06972397118806839, -0.2553555369377136, 0.059220097959041595, -0.1666865348815918, -0.04262261465191841, -0.26659542322158813, 0.24246054887771606, 0.038528770208358765, 0.06736224889755249, -0.22382953763008118, -0.16280321776866913, -0.10836721956729889, -0.2362053245306015, -0.14957374334335327, 0.04498327523469925, -0.489735871553421, 0.36337578296661377, 0.16941387951374054, -0.17303521931171417, -0.24627521634101868, -0.04804361239075661, 0.04229355975985527, 0.1616162806749344, 0.009072251617908478, 0.1605139672756195, 0.3387368619441986, 0.017196210101246834, 0.06971300393342972, 0.12951849400997162, 0.6255918145179749, -0.29617515206336975, -0.06997159123420715, 0.25819119811058044, -0.07037936896085739, -0.16811203956604004, 0.25123921036720276, 0.08516914397478104, 0.11444179713726044, -0.1549883782863617, -0.22314392030239105, 0.030415277928113937, -0.246032252907753, -0.33370837569236755, 0.2120128720998764, 0.18348661065101624, -0.28036949038505554, 0.11846797168254852, -0.048934098333120346, -0.18533438444137573, -0.14668771624565125, 0.27956756949424744, -0.020329397171735764, 0.21112042665481567, 0.41807204484939575, 0.14858393371105194, -0.3208756446838379, -0.42044347524642944, 0.1520601212978363, -0.13581989705562592, -0.2077387571334839, 0.4573822617530823, 0.028350872918963432, -0.13380251824855804, 0.06009451299905777, 0.5471389293670654, 0.04352826997637749, 0.07778794318437576, -0.014750391244888306, -0.5255997180938721, -0.5390858054161072, -0.027754224836826324, -0.15863101184368134, 0.13955943286418915, -0.08613070100545883, 0.3869231045246124, -0.17648935317993164, 0.14282482862472534, -0.4534685015678406, -0.010904248803853989, -0.30431562662124634, 0.012121027335524559, 0.3330516815185547, -0.12599319219589233, 0.18834394216537476, 0.35374915599823, 0.25105541944503784, 0.25616616010665894, -0.1985633224248886, -0.3743054270744324, -0.22375263273715973, 0.100924551486969, 0.10287749767303467, -0.036064743995666504, 0.01460020150989294, -0.16241857409477234, -0.07640860974788666, 0.045876096934080124, 0.012400131672620773, 0.19031193852424622, -0.03191293776035309, 0.42837992310523987, 0.06608046591281891, 0.017683900892734528, -0.08185742795467377, 0.11410684883594513, -0.05253155529499054, -0.09036073088645935, -0.07530796527862549, -0.08022778481245041, -0.09977731108665466, -0.0787414163351059, -0.3449898958206177, 0.04051874577999115, -0.1406915783882141, 0.09585246443748474, 0.370185911655426, 0.005360070616006851, -0.12509970366954803, 0.345363050699234, 0.19379019737243652, 0.1545022577047348, -0.20998074114322662, -0.11246280372142792, 0.20599710941314697, 0.33222994208335876, -0.3889957070350647, -0.06613880395889282, -0.07266166806221008, -0.013331000693142414, 0.14208732545375824, 0.2165171355009079, -0.0956607460975647, -0.11437909305095673, -0.21403922140598297, 0.21055474877357483, 0.0040034637786448, -0.278022825717926, 0.06721308827400208, 0.09774358570575714, 0.001604083925485611, 0.09462382644414902, 0.38939064741134644, 0.1985999345779419, 0.06525404751300812, 0.04238636791706085, -0.24829423427581787, 0.042799774557352066, 0.022747013717889786, -0.13915163278579712, 0.13277025520801544, -0.19137407839298248, 0.3528232276439667, 0.02645041048526764, 0.0793117880821228, -0.15092754364013672, -0.01495707780122757, 0.13642717897891998, 0.10998803377151489, 0.19470320641994476, 0.011231103911995888, 0.25554412603378296, -0.30219659209251404, 0.024952124804258347, 0.45057764649391174, 0.0012914091348648071, 0.01060766726732254, -0.11430080235004425, 0.12656301259994507, 0.14691957831382751, 0.36392882466316223, 0.28376734256744385, 0.12361595034599304, -0.2854912579059601, -0.24918755888938904, 0.1783471703529358, -0.013511672616004944, -0.5115432143211365, -0.140528604388237, 0.16903997957706451, 0.09186042100191116, -0.0014996640384197235, 0.19675351679325104, 0.3545474112033844, 0.30715978145599365, -0.14513370394706726, -0.040751054883003235, -0.06163578853011131, -0.10663419961929321, -0.05946559086441994, 0.16613659262657166, -0.10609745979309082, 0.16498291492462158, 0.3342292308807373, 0.20221242308616638, -0.33099761605262756, -0.08569306135177612, 0.100333571434021, -0.1815444827079773, -0.14718832075595856, 0.4650386869907379, 0.0791240930557251, -0.293016254901886, -0.18671171367168427, 0.14762960374355316, -0.314522922039032, -0.3138011693954468, 0.07677499949932098, -0.060843728482723236, 0.18347585201263428, -0.27726638317108154, 0.16979888081550598, 0.044774726033210754, 0.23666870594024658, 0.4011516571044922, -0.05484389513731003, -0.41469916701316833, 0.008219428360462189, -0.5747376680374146, 0.445812463760376, 0.11493846774101257, -0.4076003432273865, -0.07454340904951096, 0.2775898277759552, -0.19463559985160828, 0.16969643533229828, 0.3113998770713806, -0.2594892382621765, 0.028853237628936768, 0.2740807831287384, -0.28403106331825256, -0.058122772723436356, -0.1493946760892868, -0.2160840928554535, 0.07854126393795013, -0.14316590130329132, 0.08864662796258926, -0.12808984518051147, 0.2598353326320648, -0.06764095276594162, -0.3588828146457672, 0.17348900437355042, 0.21292118728160858, 0.3397989273071289, 0.054932303726673126, 0.323615700006485, -0.2871124744415283, 0.03701208531856537, 0.022650785744190216, -0.15750707685947418, -0.02693595364689827, -0.04059024155139923, 0.15620644390583038, 0.21000200510025024, 0.04087945073843002, -0.10207214951515198, -0.3193330764770508, 0.5023037791252136, -0.15918445587158203, -0.21462289988994598, -0.20822028815746307, 0.3630656898021698, 0.062129080295562744, 0.10627064853906631, 0.06056070700287819, 0.2618609368801117, 0.04060881584882736, 0.3412996828556061, -0.47204703092575073, -0.6365745663642883, 0.44734659790992737, -0.3823888897895813, -0.2945074439048767, 0.032262492924928665, 0.4139116704463959, -0.12446051090955734, 0.03081994131207466, -0.4388790428638458, 0.0522969588637352, 0.2644752860069275, -0.06371208280324936, -0.10672187805175781, 0.4192754328250885, -0.03998034447431564, 0.14795774221420288, 0.025188546627759933, 0.21676090359687805, 0.08250159025192261, 0.07250124216079712, -0.10108263790607452, -0.042484208941459656 ]
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
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
[ -0.17624354362487793, -0.28966188430786133, -0.08112603425979614, 0.21007438004016876, 0.23333759605884552, -0.10606656968593597, 0.3419617712497711, 0.3747365474700928, -0.07112058997154236, 0.045171499252319336, -0.052811406552791595, 0.3634183704853058, -0.19713012874126434, 0.04573068767786026, -0.1829141527414322, -0.006891336292028427, -0.1312440037727356, 0.02086278796195984, -0.20673313736915588, 0.003379177302122116, -0.1716488152742386, 0.4683595299720764, -0.080109603703022, 0.130054771900177, -0.25565606355667114, -0.2034904807806015, 0.16306188702583313, 0.35027533769607544, -0.007030397653579712, -0.3035110533237457, -0.11140670627355576, -0.10185988247394562, -0.05263591930270195, 0.43116188049316406, -0.00010188113083131611, 0.017224304378032684, 0.20431245863437653, 0.02890448085963726, -0.02919580414891243, 0.23244011402130127, -0.08936241269111633, -0.32429683208465576, 0.06823194772005081, -0.4151137173175812, 0.10848928242921829, 0.06326379626989365, -0.19405749440193176, -0.23127169907093048, 0.3206300735473633, 0.3468671441078186, 0.33750995993614197, 0.6315900087356567, 0.1175851970911026, -0.29747408628463745, 0.13813918828964233, -0.6866142153739929, -0.14529088139533997, 0.3828819692134857, 0.3930685222148895, -0.15615162253379822, -0.12577277421951294, 0.4463542401790619, -0.20600301027297974, 0.1279686540365219, 0.05292053148150444, 0.002329339273273945, 0.31163206696510315, -0.2424154281616211, 0.07748236507177353, 0.17080146074295044, 0.2890000641345978, -0.2158908247947693, -0.2434055358171463, 0.09301462024450302, 0.04800596088171005, -0.004885148257017136, 0.12650062143802643, 0.050010621547698975, -0.06385292112827301, 0.2622418999671936, 0.15560607612133026, 0.04079676792025566, 0.02551368623971939, 0.013189375400543213, -0.11713570356369019, 0.07929804176092148, -0.048669543117284775, -0.07651215046644211, 0.077355295419693, -0.10525152087211609, 0.14313018321990967, 0.18866610527038574, -0.04673637077212334, -0.05241565406322479, -0.24947072565555573, -0.21683387458324432, 0.2561160922050476, -0.005165316164493561, 0.058670416474342346, 0.30365413427352905, -0.15571144223213196, 0.005434580147266388, 0.25511670112609863, 0.20487657189369202, -0.06266537308692932, 0.06939743459224701, -0.17865562438964844, 0.2492244988679886, 0.33593082427978516, 0.13168206810951233, -0.41118040680885315, 0.023218374699354172, 0.12441423535346985, -0.5652228593826294, 0.46770668029785156, 0.21887516975402832, 0.3554539084434509, 0.00939202681183815, -0.10201749205589294, 0.31701523065567017, 0.06359981745481491, 0.123066246509552, 0.030711673200130463, 0.5289991497993469, 0.06685378402471542, 0.026433806866407394, 0.16250860691070557, 0.0787363350391388, -0.25355881452560425, -0.19508421421051025, -0.38241249322891235, 0.27257469296455383, 0.0947088748216629, -0.17660197615623474, -0.21808455884456635, 0.021640140563249588, 0.3145618140697479, 0.09877462685108185, 0.28230899572372437, -0.10110408812761307, 0.2161392867565155, -0.11841018497943878, -0.13367146253585815, 0.2945243716239929, -0.18075565993785858, 0.026631662622094154, 0.385258287191391, -0.1650356650352478, -0.10753414034843445, 0.07099157571792603, -0.3095545768737793, -0.3607315123081207, -0.07286527752876282, 0.33589816093444824, 0.2892540693283081, -0.1008228063583374, 0.2075134962797165, -0.09548473358154297, 0.19716708362102509, -0.0021497607231140137, 0.13766272366046906, -0.18475447595119476, 0.11319924890995026, -0.26059311628341675, 0.011992266401648521, 0.43202394247055054, -0.12376086413860321, 0.06401284039020538, 0.06927739083766937, -0.24720561504364014, 0.030836589634418488, 0.14972610771656036, -0.10958550125360489, 0.2524068355560303, -0.2578505873680115, 0.12189193069934845, 0.40975767374038696, -0.46245816349983215, -0.47753751277923584, 0.2878195643424988, -0.3083671033382416, -0.2022576928138733, 0.17586392164230347, 0.151665598154068, 0.1058250218629837, 0.04770880565047264, 0.1349738985300064, 0.07823187857866287, -0.012863764539361, 0.14650958776474, -0.33783477544784546, 0.009831776842474937, -0.06713269650936127, -0.03894622251391411, 0.22446230053901672, 0.10187199711799622, 0.23127701878547668, -0.016842246055603027, 0.051870524883270264, 0.06404447555541992, -0.10972367227077484, 0.23697277903556824, 0.21071796119213104, -0.12287308275699615, -0.062977634370327, -0.21147465705871582, -0.3710154891014099, 0.1996072232723236, -0.1813734471797943, 0.11976950615644455, -0.13116171956062317, -0.06717070937156677, -0.4082633852958679, 0.05361109972000122, -0.1396603137254715, -0.23769217729568481, 0.3391566276550293, -0.034152477979660034, -0.18240873515605927, 0.021303318440914154, -0.2120845913887024, 0.23390021920204163, -0.08712997287511826, 0.03133421763777733, 0.09578722715377808, 0.19024880230426788, -0.3547942638397217, -0.2100379765033722, 0.01658529043197632, -0.0010830312967300415, 0.2228078842163086, -0.040578942745923996, -0.15474611520767212, 0.4137457013130188, 0.21876218914985657, 0.20871353149414062, 0.12224513292312622, 0.02715921401977539, 0.04666317254304886, -0.05883576348423958, -0.19298256933689117, 0.10744328796863556, 0.1737794280052185, -0.05330120027065277, 0.44121116399765015, 0.38804930448532104, 0.08838427811861038, -0.01845281571149826, 0.09897057712078094, 0.18281182646751404, 0.20703931152820587, -0.17483051121234894, 0.05743832141160965, -0.11844341456890106, 0.18179671466350555, 0.29003095626831055, 0.12432298064231873, -0.19877466559410095, -0.3176753520965576, 0.09158362448215485, 0.4236051142215729, 0.19340281188488007, 0.1327504813671112, -0.2905075252056122, -0.03624199330806732, 0.21948882937431335, -0.1433979719877243, 0.3318910598754883, 0.3839685320854187, 0.15319843590259552, -0.05525178089737892, 0.19961659610271454, 0.028303243219852448, -0.21175026893615723, 0.1488860547542572, 0.06971030682325363, 0.11572463810443878, 0.3716864585876465, 0.013979977928102016, -0.0358184278011322, -0.17296314239501953, -0.5833545923233032, 0.030848583206534386, 0.3276607096195221, -0.27489033341407776, -0.027151376008987427, -0.24907183647155762, 0.16089826822280884, -0.005646825768053532, -0.18654100596904755, -0.10606829822063446, -0.4009953737258911, 0.1303604692220688, 0.14989155530929565, -0.25143155455589294, 0.0932011753320694, -0.33063367009162903, 0.05896405875682831, 0.2605493664741516, 0.13764828443527222, -0.08581191301345825, -0.2859732508659363, -0.023156289011240005, 0.12512105703353882, 0.16462062299251556, -0.11435960233211517, 0.36511924862861633, -0.09647676348686218, -0.09289836138486862, -0.16814208030700684, -0.14692333340644836, -0.054308727383613586, -0.06969506293535233, 0.39649641513824463, 0.22913964092731476, 0.3598936200141907, -0.20959605276584625, 0.014201472513377666, 0.2692476511001587, -0.15935811400413513, -0.1855553239583969, 0.13302598893642426, 0.09044186770915985, -0.17475642263889313, -0.14481264352798462, -0.39754825830459595, -0.31302788853645325, -0.5213375091552734, -0.15239986777305603, 0.018257025629281998, 0.23235726356506348, 0.24619726836681366, -0.06183220073580742, 0.3732982277870178, 0.12861356139183044, 0.36356624960899353, -0.0931716114282608, -0.3933489918708801, 0.30689650774002075, -0.29320642352104187, -0.5069097876548767, -0.04347372427582741, -0.137781023979187, 0.2502909004688263, -0.2514771819114685, -0.29335278272628784, -0.4690936505794525, -0.11449432373046875, 0.24946054816246033, -0.2808765769004822, 0.08051086217164993, 0.2564232349395752, 0.03449174761772156, -0.2961099445819855, -0.08493980020284653, 0.14733295142650604, -0.046672798693180084, 0.012392975389957428, -0.24388355016708374, -0.1096639409661293, 0.07931353151798248, 0.12174661457538605, 0.5469100475311279, 0.0889824777841568, 0.2852962613105774, 0.2871621251106262, -0.19751660525798798, 0.05431470647454262, -0.0757988765835762, -0.44408130645751953, -0.24680937826633453, 0.12811511754989624, -0.18241508305072784, 0.1709485948085785, -0.2582050561904907, 0.26678308844566345, -0.1896941363811493, 0.03103739395737648, -0.23754116892814636, -0.17226426303386688, -0.14695876836776733, 0.05623580142855644, 0.15923462808132172, -0.15053558349609375, 0.12115743011236191, 0.03438499569892883, 0.341538667678833, 0.35949942469596863, 0.5301387310028076, -0.3401508033275604, -0.15933652222156525, -0.3693677484989166, -0.02782560884952545, -0.22526532411575317, 0.1913948953151703, -0.014698069542646408, 0.2415267378091812, 0.011217135936021805, -0.19436123967170715, 0.06760870665311813, -0.2165011316537857, 0.3101826310157776, 0.11110036820173264, 0.13396136462688446, 0.3004104793071747, -0.1980467587709427, 0.09785131365060806, -0.10747340321540833, -0.32157453894615173, -0.20235314965248108, 0.35070857405662537, 0.3277987837791443, -0.19233176112174988, -0.0035698781721293926, -0.19763951003551483, -0.12292639911174774, -0.2336283028125763, -0.08256173133850098, -0.19146911799907684, -0.20608440041542053, -0.5143700242042542, 0.22853821516036987, 0.21522557735443115, 0.3045167326927185, 0.22863458096981049, -0.06604097038507462, -0.04535926878452301, -0.34206095337867737, -0.007541567087173462, 0.13191314041614532, 0.16354450583457947, -0.19367100298404694, 0.18786390125751495, -0.30443745851516724, -0.1363782286643982, -0.04647024720907211, 0.4324776530265808, 0.05416283756494522, -0.2391466498374939, -0.12887293100357056, -0.08782391995191574, 0.13407215476036072, 0.11724883317947388, -0.224715456366539, 0.02093687653541565, 0.05608901381492615, 0.2689254879951477, 0.22183847427368164, -0.08973746001720428, 0.1942427158355713, -0.1170136108994484, 0.0614723265171051, -0.04573448374867439, 0.10718332976102829, -0.06026102975010872, 0.056403473019599915, 0.15334263443946838, -0.008362144231796265, 0.0007911673747003078, 0.07465845346450806, 0.04577047750353813, 0.8141487836837769, 0.07185586541891098, 0.028817193582654, 0.39878711104393005, -0.07649169862270355, 0.02656690403819084, -0.053773775696754456, -0.04726684093475342, -0.4759179353713989, -0.4287513792514801, -0.004331227391958237, -0.18773382902145386, 0.39592960476875305, -0.09594498574733734, -0.2564138174057007, 0.01684178225696087, -0.21192799508571625, 0.06972397118806839, -0.2553555369377136, 0.059220097959041595, -0.1666865348815918, -0.04262261465191841, -0.26659542322158813, 0.24246054887771606, 0.038528770208358765, 0.06736224889755249, -0.22382953763008118, -0.16280321776866913, -0.10836721956729889, -0.2362053245306015, -0.14957374334335327, 0.04498327523469925, -0.489735871553421, 0.36337578296661377, 0.16941387951374054, -0.17303521931171417, -0.24627521634101868, -0.04804361239075661, 0.04229355975985527, 0.1616162806749344, 0.009072251617908478, 0.1605139672756195, 0.3387368619441986, 0.017196210101246834, 0.06971300393342972, 0.12951849400997162, 0.6255918145179749, -0.29617515206336975, -0.06997159123420715, 0.25819119811058044, -0.07037936896085739, -0.16811203956604004, 0.25123921036720276, 0.08516914397478104, 0.11444179713726044, -0.1549883782863617, -0.22314392030239105, 0.030415277928113937, -0.246032252907753, -0.33370837569236755, 0.2120128720998764, 0.18348661065101624, -0.28036949038505554, 0.11846797168254852, -0.048934098333120346, -0.18533438444137573, -0.14668771624565125, 0.27956756949424744, -0.020329397171735764, 0.21112042665481567, 0.41807204484939575, 0.14858393371105194, -0.3208756446838379, -0.42044347524642944, 0.1520601212978363, -0.13581989705562592, -0.2077387571334839, 0.4573822617530823, 0.028350872918963432, -0.13380251824855804, 0.06009451299905777, 0.5471389293670654, 0.04352826997637749, 0.07778794318437576, -0.014750391244888306, -0.5255997180938721, -0.5390858054161072, -0.027754224836826324, -0.15863101184368134, 0.13955943286418915, -0.08613070100545883, 0.3869231045246124, -0.17648935317993164, 0.14282482862472534, -0.4534685015678406, -0.010904248803853989, -0.30431562662124634, 0.012121027335524559, 0.3330516815185547, -0.12599319219589233, 0.18834394216537476, 0.35374915599823, 0.25105541944503784, 0.25616616010665894, -0.1985633224248886, -0.3743054270744324, -0.22375263273715973, 0.100924551486969, 0.10287749767303467, -0.036064743995666504, 0.01460020150989294, -0.16241857409477234, -0.07640860974788666, 0.045876096934080124, 0.012400131672620773, 0.19031193852424622, -0.03191293776035309, 0.42837992310523987, 0.06608046591281891, 0.017683900892734528, -0.08185742795467377, 0.11410684883594513, -0.05253155529499054, -0.09036073088645935, -0.07530796527862549, -0.08022778481245041, -0.09977731108665466, -0.0787414163351059, -0.3449898958206177, 0.04051874577999115, -0.1406915783882141, 0.09585246443748474, 0.370185911655426, 0.005360070616006851, -0.12509970366954803, 0.345363050699234, 0.19379019737243652, 0.1545022577047348, -0.20998074114322662, -0.11246280372142792, 0.20599710941314697, 0.33222994208335876, -0.3889957070350647, -0.06613880395889282, -0.07266166806221008, -0.013331000693142414, 0.14208732545375824, 0.2165171355009079, -0.0956607460975647, -0.11437909305095673, -0.21403922140598297, 0.21055474877357483, 0.0040034637786448, -0.278022825717926, 0.06721308827400208, 0.09774358570575714, 0.001604083925485611, 0.09462382644414902, 0.38939064741134644, 0.1985999345779419, 0.06525404751300812, 0.04238636791706085, -0.24829423427581787, 0.042799774557352066, 0.022747013717889786, -0.13915163278579712, 0.13277025520801544, -0.19137407839298248, 0.3528232276439667, 0.02645041048526764, 0.0793117880821228, -0.15092754364013672, -0.01495707780122757, 0.13642717897891998, 0.10998803377151489, 0.19470320641994476, 0.011231103911995888, 0.25554412603378296, -0.30219659209251404, 0.024952124804258347, 0.45057764649391174, 0.0012914091348648071, 0.01060766726732254, -0.11430080235004425, 0.12656301259994507, 0.14691957831382751, 0.36392882466316223, 0.28376734256744385, 0.12361595034599304, -0.2854912579059601, -0.24918755888938904, 0.1783471703529358, -0.013511672616004944, -0.5115432143211365, -0.140528604388237, 0.16903997957706451, 0.09186042100191116, -0.0014996640384197235, 0.19675351679325104, 0.3545474112033844, 0.30715978145599365, -0.14513370394706726, -0.040751054883003235, -0.06163578853011131, -0.10663419961929321, -0.05946559086441994, 0.16613659262657166, -0.10609745979309082, 0.16498291492462158, 0.3342292308807373, 0.20221242308616638, -0.33099761605262756, -0.08569306135177612, 0.100333571434021, -0.1815444827079773, -0.14718832075595856, 0.4650386869907379, 0.0791240930557251, -0.293016254901886, -0.18671171367168427, 0.14762960374355316, -0.314522922039032, -0.3138011693954468, 0.07677499949932098, -0.060843728482723236, 0.18347585201263428, -0.27726638317108154, 0.16979888081550598, 0.044774726033210754, 0.23666870594024658, 0.4011516571044922, -0.05484389513731003, -0.41469916701316833, 0.008219428360462189, -0.5747376680374146, 0.445812463760376, 0.11493846774101257, -0.4076003432273865, -0.07454340904951096, 0.2775898277759552, -0.19463559985160828, 0.16969643533229828, 0.3113998770713806, -0.2594892382621765, 0.028853237628936768, 0.2740807831287384, -0.28403106331825256, -0.058122772723436356, -0.1493946760892868, -0.2160840928554535, 0.07854126393795013, -0.14316590130329132, 0.08864662796258926, -0.12808984518051147, 0.2598353326320648, -0.06764095276594162, -0.3588828146457672, 0.17348900437355042, 0.21292118728160858, 0.3397989273071289, 0.054932303726673126, 0.323615700006485, -0.2871124744415283, 0.03701208531856537, 0.022650785744190216, -0.15750707685947418, -0.02693595364689827, -0.04059024155139923, 0.15620644390583038, 0.21000200510025024, 0.04087945073843002, -0.10207214951515198, -0.3193330764770508, 0.5023037791252136, -0.15918445587158203, -0.21462289988994598, -0.20822028815746307, 0.3630656898021698, 0.062129080295562744, 0.10627064853906631, 0.06056070700287819, 0.2618609368801117, 0.04060881584882736, 0.3412996828556061, -0.47204703092575073, -0.6365745663642883, 0.44734659790992737, -0.3823888897895813, -0.2945074439048767, 0.032262492924928665, 0.4139116704463959, -0.12446051090955734, 0.03081994131207466, -0.4388790428638458, 0.0522969588637352, 0.2644752860069275, -0.06371208280324936, -0.10672187805175781, 0.4192754328250885, -0.03998034447431564, 0.14795774221420288, 0.025188546627759933, 0.21676090359687805, 0.08250159025192261, 0.07250124216079712, -0.10108263790607452, -0.042484208941459656 ]
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`
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.
[ -0.32103079557418823, -0.7901479601860046, 0.07416689395904541, 0.47603583335876465, 0.19198888540267944, -0.20305147767066956, 0.33363714814186096, -0.0628698319196701, 0.286129355430603, 0.10323995351791382, 0.09885290265083313, 0.4266767203807831, 0.10860054194927216, -0.27073538303375244, 0.26226481795310974, -0.11581364274024963, 0.04877167567610741, -0.11253069341182709, -0.252058744430542, -0.1637345850467682, -0.0487695187330246, 0.0414799302816391, -0.28428131341934204, -0.14575743675231934, -0.2898796796798706, -0.20695112645626068, -0.12485390901565552, 0.048837900161743164, 0.12250620871782303, -0.4142809212207794, 0.07270662486553192, 0.025524906814098358, 0.25117695331573486, 0.7024824023246765, -0.00012532874825410545, 0.12123237550258636, 0.035358987748622894, 0.08784221112728119, -0.11136370897293091, -0.21161548793315887, 0.04012761265039444, 0.00676652230322361, 0.1880064457654953, -0.31016719341278076, -0.07990702241659164, -0.12284412235021591, -0.04892589896917343, -0.19009628891944885, 0.5397404432296753, 0.03262680023908615, 0.05645390972495079, 0.3101397454738617, -0.24512331187725067, -0.11089834570884705, -0.17450836300849915, 0.3002590835094452, -0.07534076273441315, 0.5350344777107239, 0.16150128841400146, -0.08843748271465302, -0.4192807078361511, 0.26674073934555054, -0.24642790853977203, 0.550044059753418, 0.13305066525936127, 0.12014231830835342, 0.0316767543554306, -0.2911273241043091, 0.059651926159858704, 0.06908492743968964, -0.09921068698167801, -0.30998149514198303, 0.15371190011501312, -0.2582712471485138, -0.11648422479629517, -0.26406481862068176, 0.16126006841659546, 0.1586766242980957, -0.14056190848350525, -0.10502283275127411, -0.5622199177742004, 0.14480701088905334, 0.09224562346935272, -0.048315808176994324, -0.07534404844045639, 0.4892396628856659, 0.02302127704024315, 0.3770473003387451, 0.2719418704509735, 0.3056620955467224, -0.00923085119575262, 0.017283953726291656, 0.08918757736682892, -0.06200950965285301, -0.35988086462020874, 0.2191305160522461, 0.2168000340461731, -0.16578546166419983, 0.09063727408647537, -0.07611571252346039, 0.04283568263053894, -0.039567455649375916, 0.32623201608657837, 0.08787092566490173, 0.10524044930934906, 0.3472019135951996, 0.03898501768708229, 0.5393655896186829, 0.2395363748073578, 0.011268090456724167, -0.2852794826030731, 0.1443077027797699, 0.17589342594146729, -0.1336120218038559, 0.11007124185562134, -0.12112586945295334, 0.3196724057197571, 0.06094689294695854, -0.19688403606414795, -0.2789364755153656, -0.2145068347454071, -0.25530195236206055, 0.10427346080541611, 0.36482012271881104, 0.12008316069841385, -0.08746015280485153, 0.11024084687232971, 0.1192273199558258, -0.28099945187568665, -0.0710441991686821, -0.08085693418979645, -0.17239342629909515, -0.2692178785800934, 0.13414692878723145, 0.10696470737457275, -0.11755011975765228, 0.2842019200325012, 0.42022061347961426, 0.10877522081136703, -0.09469015896320343, 0.2539525628089905, -0.11998875439167023, 0.17431610822677612, 0.17003858089447021, -0.042824894189834595, 0.09917542338371277, 0.20438580214977264, 0.5848973393440247, -0.015030361711978912, 0.35025155544281006, -0.18256264925003052, -0.14699827134609222, 0.34957319498062134, -0.011410093866288662, 0.23411248624324799, 0.29897549748420715, -0.19871580600738525, 0.18534457683563232, 0.3968257009983063, -0.43091851472854614, 0.25223714113235474, -0.21273808181285858, -0.7713395953178406, -0.14055755734443665, 0.3055550456047058, 0.5337103009223938, 0.28961917757987976, -0.12634888291358948, 0.42376241087913513, 0.145217627286911, 0.32502657175064087, 0.262372225522995, -0.4677087664604187, 0.3233739733695984, -0.40510064363479614, -0.3190336525440216, 0.15427948534488678, -0.40845987200737, -0.3975279629230499, 0.3596333861351013, -0.5518221855163574, 0.05944698303937912, 0.08789768069982529, 0.0710991695523262, 0.2553240656852722, 0.26625511050224304, 0.22006596624851227, 0.04205168038606644, 0.025810007005929947, 0.3425556719303131, -0.24576592445373535, 0.25786158442497253, 0.5458126664161682, 0.007495012134313583, -0.158840149641037, 0.11281581223011017, 0.08242449164390564, 0.08996120095252991, 0.3640334904193878, 0.10886339098215103, -0.1140267550945282, 0.007277581840753555, -0.3960050046443939, -0.20402033627033234, 0.04767921194434166, -0.07438115775585175, -0.22941815853118896, 0.3985099494457245, -0.12211298942565918, -0.028364844620227814, -0.003702804446220398, 0.014123577624559402, 0.1808559000492096, -0.04021308571100235, -0.3480614423751831, -0.3720845878124237, -0.13439518213272095, 0.18901818990707397, 0.07952666282653809, -0.07242104411125183, -0.10399419069290161, 0.2854953408241272, -0.09906431287527084, -0.042192377150058746, -0.30290842056274414, 0.052930571138858795, 0.023318849503993988, -0.05225232243537903, -0.19600895047187805, -0.08476000279188156, 0.30008721351623535, -0.3161182999610901, -0.19754096865653992, 0.31970542669296265, 0.11068552732467651, 0.030985191464424133, -0.03420526534318924, -0.16434402763843536, 0.441107839345932, -0.00830407440662384, 0.061553314328193665, 0.4732600152492523, 0.06943885236978531, -0.1465321034193039, -0.1924816071987152, 0.25467923283576965, 0.14265163242816925, 0.13472715020179749, -0.15512707829475403, -0.1455821990966797, -0.09947439283132553, 0.05844362452626228, -0.05991959571838379, 0.20915737748146057, 0.2657236158847809, 0.20881855487823486, 0.27354326844215393, 0.11554966121912003, -0.2268325537443161, -0.12739193439483643, 0.13313952088356018, 0.023160420358181, 0.08099918812513351, -0.0669543445110321, -0.1164705827832222, 0.032385725528001785, 0.29902487993240356, -0.01712091639637947, 0.45884203910827637, 0.1188306212425232, 0.2843678295612335, 0.03116626664996147, -0.21665999293327332, -0.029790719971060753, 0.0601813942193985, -0.15033602714538574, 0.09821663051843643, -0.06067065894603729, 0.41385141015052795, -0.04729698225855827, -0.3590408265590668, -0.06880398094654083, 0.33778753876686096, 0.07448824495077133, -0.24584439396858215, 0.1695537120103836, -0.24102358520030975, 0.014985635876655579, -0.28827860951423645, 0.2793470621109009, -0.16765937209129333, 0.1733199805021286, -0.11825309693813324, 0.40815269947052, 0.1852995604276657, 0.3976530134677887, 0.35181379318237305, 0.04142336547374725, -0.14881299436092377, -0.1478588581085205, 0.24787873029708862, -0.09317871928215027, -0.08223885297775269, -0.060490526258945465, 0.050327498465776443, -0.08713763952255249, 0.5514772534370422, 0.110911525785923, -0.48693394660949707, -0.1813449114561081, 0.08564876765012741, 0.08983262628316879, 0.10212339460849762, -0.2983282208442688, -0.08353815972805023, -0.013611279428005219, -0.2700583338737488, 0.13113538920879364, 0.3442874252796173, -0.46287381649017334, -0.1850377768278122, 0.11619985103607178, 0.00006789498729631305, -0.12305669486522675, -0.19957034289836884, -0.32445600628852844, 0.058491453528404236, -0.15177074074745178, 0.33425843715667725, -0.20589804649353027, 0.28581559658050537, -0.12700217962265015, 0.09779071062803268, -0.010174524039030075, -0.021022237837314606, -0.030537525191903114, -0.08207453042268753, -0.4267660081386566, -0.04151875153183937, -0.08720116317272186, -0.2174292951822281, -0.21946954727172852, 0.10197077691555023, -0.1804666668176651, 0.4664597511291504, -0.4788520336151123, -0.42627355456352234, -0.23839150369167328, 0.3545773923397064, -0.19474446773529053, 0.20557723939418793, 0.5381612777709961, -0.10454200953245163, 0.05447181314229965, 0.0959867611527443, -0.2025066614151001, 0.3153032660484314, 0.1699507236480713, 0.13322578370571136, 0.28371089696884155, 0.49443989992141724, -0.002390839159488678, 0.8055756688117981, 0.2815590500831604, -0.13309888541698456, 0.0940239354968071, -0.4099041521549225, 0.03872787579894066, -0.11614079028367996, -0.39916279911994934, 0.15716923773288727, -0.12431621551513672, -0.13921211659908295, 0.11112935096025467, -0.13672643899917603, -0.08218690007925034, -0.08475898206233978, -0.26178446412086487, 0.041426293551921844, -0.1333567053079605, -0.0016668792814016342, -0.09317921102046967, 0.3270926773548126, -0.039084289222955704, 0.20677593350410461, -0.10299736261367798, 0.12215272337198257, 0.04603682830929756, -0.274757444858551, 0.34444355964660645, -0.009908664040267467, -0.22914281487464905, 0.1980474591255188, -0.3875443935394287, 0.23339885473251343, 0.13931645452976227, 0.09074775874614716, -0.15318109095096588, 0.2440476417541504, 0.3723222613334656, 0.016393374651670456, 0.8515886068344116, 0.20654833316802979, 0.3926392197608948, -0.06385266780853271, -0.5782081484794617, -0.4568253755569458, -0.01565798558294773, -0.1717875599861145, 0.3817780911922455, 0.28464409708976746, -0.04700228571891785, -0.13081541657447815, -0.058145925402641296, -0.0574006512761116, 0.12532353401184082, -0.19049738347530365, -0.28003251552581787, -0.49488312005996704, -0.058312784880399704, -0.44502735137939453, 0.3669358193874359, 0.28467971086502075, -0.1102384477853775, -0.020069284364581108, -0.21457457542419434, 0.09521373361349106, 0.0783785879611969, -0.04237249493598938, 0.23867206275463104, 0.2561562657356262, 0.10197323560714722, 0.189732626080513, 0.47036075592041016, 0.31322312355041504, 0.014635802246630192, 0.49203062057495117, -0.28032976388931274, -0.12606830894947052, 0.05534486100077629, 0.09950830787420273, 0.13294872641563416, 0.40727323293685913, 0.13329820334911346, 0.058510199189186096, -0.10428757965564728, 0.18158623576164246, -0.3366774320602417, -0.11681554466485977, 0.37885841727256775, 0.1245688870549202, -0.06399158388376236, -0.43456748127937317, 0.19299457967281342, 0.04701342061161995, -0.2752251625061035, 0.6179054975509644, -0.44700735807418823, -0.2240835726261139, 0.07093412429094315, -0.17497453093528748, 0.7820191979408264, -0.17448173463344574, 0.041305817663669586, 0.08099673688411713, -0.054910965263843536, 0.28766804933547974, -0.13424521684646606, 0.3840335011482239, -0.3718142807483673, -0.23508688807487488, 0.0589635968208313, -0.1996956169605255, 0.07527957856655121, -0.019774019718170166, 0.041475530713796616, 0.12689346075057983, -0.03389688581228256, 0.1993168145418167, -0.12998703122138977, 0.17681679129600525, 0.3123520016670227, -0.18389922380447388, -0.03766591101884842, -0.04231400787830353, -0.02352254092693329, 0.2826218605041504, -0.01078194472938776, 0.03039892017841339, 0.19777187705039978, -0.3241971731185913, -0.04907397925853729, 0.1419382095336914, -0.5082390308380127, 0.434684157371521, -0.152037113904953, -0.2642524838447571, -0.10143692791461945, 0.7358688712120056, 0.08062467724084854, -0.22749869525432587, 0.09769950807094574, -0.0021508336067199707, 0.1871088147163391, 0.24321913719177246, -0.31424379348754883, -0.22403204441070557, -0.19225719571113586, -0.06264728307723999, -0.4601982533931732, -0.18495473265647888, -0.07633832842111588, -0.3196958303451538, -0.24082478880882263, 0.5648025870323181, 0.10051055997610092, 0.06293772906064987, 0.04463646188378334, 0.12916620075702667, 0.04437645897269249, -0.24744592607021332, -0.06726667284965515, 0.05077718570828438, -0.2799234986305237, 0.11551667749881744, 0.009563058614730835, -0.38125503063201904, 0.050519660115242004, 0.5093289613723755, 0.16595208644866943, 0.4076870381832123, 0.19413132965564728, 0.12486809492111206, -0.049744363874197006, -0.12555637955665588, -0.06231280043721199, 0.15009571611881256, -0.28732722997665405, 0.22064393758773804, -0.06300695240497589, 0.07249070703983307, -0.0950632095336914, 0.13673171401023865, -0.06849775463342667, 0.013890337198972702, -0.08418715745210648, -0.09499183297157288, -0.3169296085834503, -0.18090729415416718, 0.03409714624285698, -0.0005235671997070312, 0.3702935576438904, 0.33438533544540405, 0.24987903237342834, 0.4636765718460083, -0.14911608397960663, 0.04224507510662079, 0.23245400190353394, 0.33408334851264954, -0.02351248636841774, -0.008763592690229416, 0.048214804381132126, -0.016042843461036682, -0.08510630577802658, 0.3576098084449768, -0.1007848009467125, -0.052683308720588684, -0.15263940393924713, 0.23410794138908386, -0.20396706461906433, -0.06581883132457733, -0.17026539146900177, -0.47974127531051636, 0.06136385723948479, -0.32725343108177185, 0.400524765253067, 0.4074561595916748, -0.0351499542593956, -0.09914941340684891, 0.2587668299674988, 0.05589257925748825, -0.201152965426445, -0.008764687925577164, -0.32532167434692383, -0.34483855962753296, 0.14392027258872986, -0.007134892046451569, 0.05552545189857483, -0.03736119344830513, -0.3768669366836548, -0.15646737813949585, 0.4180071949958801, -0.07706824690103531, 0.007746361196041107, -0.22814474999904633, -0.11427368223667145, -0.08735553175210953, 0.40227705240249634, 0.09043391048908234, -0.31199169158935547, -0.0732547789812088, -0.13250568509101868, 0.01673966646194458, -0.35503292083740234, -0.11912628263235092, 0.31738558411598206, 0.009169426746666431, 0.13769277930259705, 0.42766597867012024, 0.2895326316356659, -0.03956487774848938, -0.2120404690504074, 0.011784400790929794, 0.15766817331314087, -0.3562094569206238, 0.0728011280298233, -0.18851566314697266, -0.09778659045696259, 0.011627137660980225, 0.2780611217021942, 0.085076704621315, 0.10676451027393341, 0.0913032665848732, 0.030378535389900208, 0.6768696904182434, 0.09205833077430725, 0.14612556993961334, 0.26083120703697205, -0.22782111167907715, 0.2882983386516571, 0.07550743222236633, -0.3025502860546112, -0.07109903544187546, -0.07912801206111908, 0.19735431671142578, -0.5555618405342102, -0.3993319571018219, -0.31075039505958557, 0.18628135323524475, -0.21436002850532532, -0.057783596217632294, 0.13677942752838135, -0.13642269372940063, 0.07552677392959595, 0.2659592032432556, 0.12978869676589966, 0.029940105974674225, 0.5465022325515747, 0.09842720627784729, -0.25007152557373047, -0.2736549973487854, -0.4249815344810486, 0.12966710329055786, 0.15650267899036407, -0.32088330388069153, 0.2355489283800125, 0.192893385887146, -0.14153258502483368, -0.2070872187614441, 0.3230237662792206, 0.2224525809288025, 0.2408064901828766, -0.14938390254974365, 0.1486433893442154, 0.15672439336776733, 0.26859769225120544, -0.12406449019908905, 0.11281517148017883, -0.0550432950258255, 0.26080211997032166, 0.1379396766424179, -0.07691366970539093, -0.11137448251247406, -0.036428723484277725, 0.26485297083854675, 0.1318778693675995, -0.04035188630223274, 0.5132677555084229, -0.32104262709617615, -0.034849464893341064, -0.09981666505336761, 0.06669803708791733, -0.22419294714927673, 0.2018769085407257, 0.2715461552143097, -0.20290374755859375, -0.02589893713593483, -0.14843277633190155, -0.022203022614121437, -0.12431560456752777, 0.29038530588150024, -0.05832197889685631, 0.13950906693935394, -0.5078444480895996, -0.12499171495437622, -0.6539651155471802, 0.4035416543483734, -0.3416750729084015, 0.10131295025348663, -0.04546726495027542, 0.012462258338928223, -0.0929098054766655, 0.08096993714570999, 0.04091903567314148, -0.33709391951560974, 0.1674814671278, 0.2378125786781311, -0.1938323974609375, 0.08604010939598083, -0.5267013311386108, 0.09388597309589386, 0.19810236990451813, -0.238215833902359, 0.3681207001209259, -0.3649635314941406, -0.053779181092977524, -0.0013591218739748001, 0.13489912450313568, 0.001299908384680748, -0.06714160740375519, 0.42324966192245483, 0.21226224303245544, 0.4378967583179474, 0.06804201006889343, 0.08424177765846252, 0.004541996866464615, 0.08080094307661057, -0.2294752448797226, 0.20281371474266052, 0.1967403143644333, 0.4024077355861664, -0.21268755197525024, -0.5200229287147522, -0.40589791536331177, 0.47653040289878845, 0.11305734515190125, -0.16179132461547852, -0.04964817315340042, -0.13779659569263458, -0.11923139542341232, 0.17818710207939148, 0.12312325835227966, 0.421247273683548, 0.13837656378746033, -0.04294337332248688, -0.1960497498512268, -0.24784301221370697, 0.34234052896499634, -0.7567548751831055, -0.301139235496521, -0.25887924432754517, 0.28307992219924927, 0.07498926669359207, -0.11602167040109634, -0.7164037823677063, -0.13075655698776245, 0.09190855175256729, -0.19980072975158691, -0.23095357418060303, 0.0996546596288681, -0.3373797833919525, -0.05446142703294754, -0.010408652946352959, 0.35961201786994934, -0.13169533014297485, -0.5107800960540771, 0.16256853938102722, -0.09332829713821411 ]
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`
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.
[ -0.32103079557418823, -0.7901479601860046, 0.07416689395904541, 0.47603583335876465, 0.19198888540267944, -0.20305147767066956, 0.33363714814186096, -0.0628698319196701, 0.286129355430603, 0.10323995351791382, 0.09885290265083313, 0.4266767203807831, 0.10860054194927216, -0.27073538303375244, 0.26226481795310974, -0.11581364274024963, 0.04877167567610741, -0.11253069341182709, -0.252058744430542, -0.1637345850467682, -0.0487695187330246, 0.0414799302816391, -0.28428131341934204, -0.14575743675231934, -0.2898796796798706, -0.20695112645626068, -0.12485390901565552, 0.048837900161743164, 0.12250620871782303, -0.4142809212207794, 0.07270662486553192, 0.025524906814098358, 0.25117695331573486, 0.7024824023246765, -0.00012532874825410545, 0.12123237550258636, 0.035358987748622894, 0.08784221112728119, -0.11136370897293091, -0.21161548793315887, 0.04012761265039444, 0.00676652230322361, 0.1880064457654953, -0.31016719341278076, -0.07990702241659164, -0.12284412235021591, -0.04892589896917343, -0.19009628891944885, 0.5397404432296753, 0.03262680023908615, 0.05645390972495079, 0.3101397454738617, -0.24512331187725067, -0.11089834570884705, -0.17450836300849915, 0.3002590835094452, -0.07534076273441315, 0.5350344777107239, 0.16150128841400146, -0.08843748271465302, -0.4192807078361511, 0.26674073934555054, -0.24642790853977203, 0.550044059753418, 0.13305066525936127, 0.12014231830835342, 0.0316767543554306, -0.2911273241043091, 0.059651926159858704, 0.06908492743968964, -0.09921068698167801, -0.30998149514198303, 0.15371190011501312, -0.2582712471485138, -0.11648422479629517, -0.26406481862068176, 0.16126006841659546, 0.1586766242980957, -0.14056190848350525, -0.10502283275127411, -0.5622199177742004, 0.14480701088905334, 0.09224562346935272, -0.048315808176994324, -0.07534404844045639, 0.4892396628856659, 0.02302127704024315, 0.3770473003387451, 0.2719418704509735, 0.3056620955467224, -0.00923085119575262, 0.017283953726291656, 0.08918757736682892, -0.06200950965285301, -0.35988086462020874, 0.2191305160522461, 0.2168000340461731, -0.16578546166419983, 0.09063727408647537, -0.07611571252346039, 0.04283568263053894, -0.039567455649375916, 0.32623201608657837, 0.08787092566490173, 0.10524044930934906, 0.3472019135951996, 0.03898501768708229, 0.5393655896186829, 0.2395363748073578, 0.011268090456724167, -0.2852794826030731, 0.1443077027797699, 0.17589342594146729, -0.1336120218038559, 0.11007124185562134, -0.12112586945295334, 0.3196724057197571, 0.06094689294695854, -0.19688403606414795, -0.2789364755153656, -0.2145068347454071, -0.25530195236206055, 0.10427346080541611, 0.36482012271881104, 0.12008316069841385, -0.08746015280485153, 0.11024084687232971, 0.1192273199558258, -0.28099945187568665, -0.0710441991686821, -0.08085693418979645, -0.17239342629909515, -0.2692178785800934, 0.13414692878723145, 0.10696470737457275, -0.11755011975765228, 0.2842019200325012, 0.42022061347961426, 0.10877522081136703, -0.09469015896320343, 0.2539525628089905, -0.11998875439167023, 0.17431610822677612, 0.17003858089447021, -0.042824894189834595, 0.09917542338371277, 0.20438580214977264, 0.5848973393440247, -0.015030361711978912, 0.35025155544281006, -0.18256264925003052, -0.14699827134609222, 0.34957319498062134, -0.011410093866288662, 0.23411248624324799, 0.29897549748420715, -0.19871580600738525, 0.18534457683563232, 0.3968257009983063, -0.43091851472854614, 0.25223714113235474, -0.21273808181285858, -0.7713395953178406, -0.14055755734443665, 0.3055550456047058, 0.5337103009223938, 0.28961917757987976, -0.12634888291358948, 0.42376241087913513, 0.145217627286911, 0.32502657175064087, 0.262372225522995, -0.4677087664604187, 0.3233739733695984, -0.40510064363479614, -0.3190336525440216, 0.15427948534488678, -0.40845987200737, -0.3975279629230499, 0.3596333861351013, -0.5518221855163574, 0.05944698303937912, 0.08789768069982529, 0.0710991695523262, 0.2553240656852722, 0.26625511050224304, 0.22006596624851227, 0.04205168038606644, 0.025810007005929947, 0.3425556719303131, -0.24576592445373535, 0.25786158442497253, 0.5458126664161682, 0.007495012134313583, -0.158840149641037, 0.11281581223011017, 0.08242449164390564, 0.08996120095252991, 0.3640334904193878, 0.10886339098215103, -0.1140267550945282, 0.007277581840753555, -0.3960050046443939, -0.20402033627033234, 0.04767921194434166, -0.07438115775585175, -0.22941815853118896, 0.3985099494457245, -0.12211298942565918, -0.028364844620227814, -0.003702804446220398, 0.014123577624559402, 0.1808559000492096, -0.04021308571100235, -0.3480614423751831, -0.3720845878124237, -0.13439518213272095, 0.18901818990707397, 0.07952666282653809, -0.07242104411125183, -0.10399419069290161, 0.2854953408241272, -0.09906431287527084, -0.042192377150058746, -0.30290842056274414, 0.052930571138858795, 0.023318849503993988, -0.05225232243537903, -0.19600895047187805, -0.08476000279188156, 0.30008721351623535, -0.3161182999610901, -0.19754096865653992, 0.31970542669296265, 0.11068552732467651, 0.030985191464424133, -0.03420526534318924, -0.16434402763843536, 0.441107839345932, -0.00830407440662384, 0.061553314328193665, 0.4732600152492523, 0.06943885236978531, -0.1465321034193039, -0.1924816071987152, 0.25467923283576965, 0.14265163242816925, 0.13472715020179749, -0.15512707829475403, -0.1455821990966797, -0.09947439283132553, 0.05844362452626228, -0.05991959571838379, 0.20915737748146057, 0.2657236158847809, 0.20881855487823486, 0.27354326844215393, 0.11554966121912003, -0.2268325537443161, -0.12739193439483643, 0.13313952088356018, 0.023160420358181, 0.08099918812513351, -0.0669543445110321, -0.1164705827832222, 0.032385725528001785, 0.29902487993240356, -0.01712091639637947, 0.45884203910827637, 0.1188306212425232, 0.2843678295612335, 0.03116626664996147, -0.21665999293327332, -0.029790719971060753, 0.0601813942193985, -0.15033602714538574, 0.09821663051843643, -0.06067065894603729, 0.41385141015052795, -0.04729698225855827, -0.3590408265590668, -0.06880398094654083, 0.33778753876686096, 0.07448824495077133, -0.24584439396858215, 0.1695537120103836, -0.24102358520030975, 0.014985635876655579, -0.28827860951423645, 0.2793470621109009, -0.16765937209129333, 0.1733199805021286, -0.11825309693813324, 0.40815269947052, 0.1852995604276657, 0.3976530134677887, 0.35181379318237305, 0.04142336547374725, -0.14881299436092377, -0.1478588581085205, 0.24787873029708862, -0.09317871928215027, -0.08223885297775269, -0.060490526258945465, 0.050327498465776443, -0.08713763952255249, 0.5514772534370422, 0.110911525785923, -0.48693394660949707, -0.1813449114561081, 0.08564876765012741, 0.08983262628316879, 0.10212339460849762, -0.2983282208442688, -0.08353815972805023, -0.013611279428005219, -0.2700583338737488, 0.13113538920879364, 0.3442874252796173, -0.46287381649017334, -0.1850377768278122, 0.11619985103607178, 0.00006789498729631305, -0.12305669486522675, -0.19957034289836884, -0.32445600628852844, 0.058491453528404236, -0.15177074074745178, 0.33425843715667725, -0.20589804649353027, 0.28581559658050537, -0.12700217962265015, 0.09779071062803268, -0.010174524039030075, -0.021022237837314606, -0.030537525191903114, -0.08207453042268753, -0.4267660081386566, -0.04151875153183937, -0.08720116317272186, -0.2174292951822281, -0.21946954727172852, 0.10197077691555023, -0.1804666668176651, 0.4664597511291504, -0.4788520336151123, -0.42627355456352234, -0.23839150369167328, 0.3545773923397064, -0.19474446773529053, 0.20557723939418793, 0.5381612777709961, -0.10454200953245163, 0.05447181314229965, 0.0959867611527443, -0.2025066614151001, 0.3153032660484314, 0.1699507236480713, 0.13322578370571136, 0.28371089696884155, 0.49443989992141724, -0.002390839159488678, 0.8055756688117981, 0.2815590500831604, -0.13309888541698456, 0.0940239354968071, -0.4099041521549225, 0.03872787579894066, -0.11614079028367996, -0.39916279911994934, 0.15716923773288727, -0.12431621551513672, -0.13921211659908295, 0.11112935096025467, -0.13672643899917603, -0.08218690007925034, -0.08475898206233978, -0.26178446412086487, 0.041426293551921844, -0.1333567053079605, -0.0016668792814016342, -0.09317921102046967, 0.3270926773548126, -0.039084289222955704, 0.20677593350410461, -0.10299736261367798, 0.12215272337198257, 0.04603682830929756, -0.274757444858551, 0.34444355964660645, -0.009908664040267467, -0.22914281487464905, 0.1980474591255188, -0.3875443935394287, 0.23339885473251343, 0.13931645452976227, 0.09074775874614716, -0.15318109095096588, 0.2440476417541504, 0.3723222613334656, 0.016393374651670456, 0.8515886068344116, 0.20654833316802979, 0.3926392197608948, -0.06385266780853271, -0.5782081484794617, -0.4568253755569458, -0.01565798558294773, -0.1717875599861145, 0.3817780911922455, 0.28464409708976746, -0.04700228571891785, -0.13081541657447815, -0.058145925402641296, -0.0574006512761116, 0.12532353401184082, -0.19049738347530365, -0.28003251552581787, -0.49488312005996704, -0.058312784880399704, -0.44502735137939453, 0.3669358193874359, 0.28467971086502075, -0.1102384477853775, -0.020069284364581108, -0.21457457542419434, 0.09521373361349106, 0.0783785879611969, -0.04237249493598938, 0.23867206275463104, 0.2561562657356262, 0.10197323560714722, 0.189732626080513, 0.47036075592041016, 0.31322312355041504, 0.014635802246630192, 0.49203062057495117, -0.28032976388931274, -0.12606830894947052, 0.05534486100077629, 0.09950830787420273, 0.13294872641563416, 0.40727323293685913, 0.13329820334911346, 0.058510199189186096, -0.10428757965564728, 0.18158623576164246, -0.3366774320602417, -0.11681554466485977, 0.37885841727256775, 0.1245688870549202, -0.06399158388376236, -0.43456748127937317, 0.19299457967281342, 0.04701342061161995, -0.2752251625061035, 0.6179054975509644, -0.44700735807418823, -0.2240835726261139, 0.07093412429094315, -0.17497453093528748, 0.7820191979408264, -0.17448173463344574, 0.041305817663669586, 0.08099673688411713, -0.054910965263843536, 0.28766804933547974, -0.13424521684646606, 0.3840335011482239, -0.3718142807483673, -0.23508688807487488, 0.0589635968208313, -0.1996956169605255, 0.07527957856655121, -0.019774019718170166, 0.041475530713796616, 0.12689346075057983, -0.03389688581228256, 0.1993168145418167, -0.12998703122138977, 0.17681679129600525, 0.3123520016670227, -0.18389922380447388, -0.03766591101884842, -0.04231400787830353, -0.02352254092693329, 0.2826218605041504, -0.01078194472938776, 0.03039892017841339, 0.19777187705039978, -0.3241971731185913, -0.04907397925853729, 0.1419382095336914, -0.5082390308380127, 0.434684157371521, -0.152037113904953, -0.2642524838447571, -0.10143692791461945, 0.7358688712120056, 0.08062467724084854, -0.22749869525432587, 0.09769950807094574, -0.0021508336067199707, 0.1871088147163391, 0.24321913719177246, -0.31424379348754883, -0.22403204441070557, -0.19225719571113586, -0.06264728307723999, -0.4601982533931732, -0.18495473265647888, -0.07633832842111588, -0.3196958303451538, -0.24082478880882263, 0.5648025870323181, 0.10051055997610092, 0.06293772906064987, 0.04463646188378334, 0.12916620075702667, 0.04437645897269249, -0.24744592607021332, -0.06726667284965515, 0.05077718570828438, -0.2799234986305237, 0.11551667749881744, 0.009563058614730835, -0.38125503063201904, 0.050519660115242004, 0.5093289613723755, 0.16595208644866943, 0.4076870381832123, 0.19413132965564728, 0.12486809492111206, -0.049744363874197006, -0.12555637955665588, -0.06231280043721199, 0.15009571611881256, -0.28732722997665405, 0.22064393758773804, -0.06300695240497589, 0.07249070703983307, -0.0950632095336914, 0.13673171401023865, -0.06849775463342667, 0.013890337198972702, -0.08418715745210648, -0.09499183297157288, -0.3169296085834503, -0.18090729415416718, 0.03409714624285698, -0.0005235671997070312, 0.3702935576438904, 0.33438533544540405, 0.24987903237342834, 0.4636765718460083, -0.14911608397960663, 0.04224507510662079, 0.23245400190353394, 0.33408334851264954, -0.02351248636841774, -0.008763592690229416, 0.048214804381132126, -0.016042843461036682, -0.08510630577802658, 0.3576098084449768, -0.1007848009467125, -0.052683308720588684, -0.15263940393924713, 0.23410794138908386, -0.20396706461906433, -0.06581883132457733, -0.17026539146900177, -0.47974127531051636, 0.06136385723948479, -0.32725343108177185, 0.400524765253067, 0.4074561595916748, -0.0351499542593956, -0.09914941340684891, 0.2587668299674988, 0.05589257925748825, -0.201152965426445, -0.008764687925577164, -0.32532167434692383, -0.34483855962753296, 0.14392027258872986, -0.007134892046451569, 0.05552545189857483, -0.03736119344830513, -0.3768669366836548, -0.15646737813949585, 0.4180071949958801, -0.07706824690103531, 0.007746361196041107, -0.22814474999904633, -0.11427368223667145, -0.08735553175210953, 0.40227705240249634, 0.09043391048908234, -0.31199169158935547, -0.0732547789812088, -0.13250568509101868, 0.01673966646194458, -0.35503292083740234, -0.11912628263235092, 0.31738558411598206, 0.009169426746666431, 0.13769277930259705, 0.42766597867012024, 0.2895326316356659, -0.03956487774848938, -0.2120404690504074, 0.011784400790929794, 0.15766817331314087, -0.3562094569206238, 0.0728011280298233, -0.18851566314697266, -0.09778659045696259, 0.011627137660980225, 0.2780611217021942, 0.085076704621315, 0.10676451027393341, 0.0913032665848732, 0.030378535389900208, 0.6768696904182434, 0.09205833077430725, 0.14612556993961334, 0.26083120703697205, -0.22782111167907715, 0.2882983386516571, 0.07550743222236633, -0.3025502860546112, -0.07109903544187546, -0.07912801206111908, 0.19735431671142578, -0.5555618405342102, -0.3993319571018219, -0.31075039505958557, 0.18628135323524475, -0.21436002850532532, -0.057783596217632294, 0.13677942752838135, -0.13642269372940063, 0.07552677392959595, 0.2659592032432556, 0.12978869676589966, 0.029940105974674225, 0.5465022325515747, 0.09842720627784729, -0.25007152557373047, -0.2736549973487854, -0.4249815344810486, 0.12966710329055786, 0.15650267899036407, -0.32088330388069153, 0.2355489283800125, 0.192893385887146, -0.14153258502483368, -0.2070872187614441, 0.3230237662792206, 0.2224525809288025, 0.2408064901828766, -0.14938390254974365, 0.1486433893442154, 0.15672439336776733, 0.26859769225120544, -0.12406449019908905, 0.11281517148017883, -0.0550432950258255, 0.26080211997032166, 0.1379396766424179, -0.07691366970539093, -0.11137448251247406, -0.036428723484277725, 0.26485297083854675, 0.1318778693675995, -0.04035188630223274, 0.5132677555084229, -0.32104262709617615, -0.034849464893341064, -0.09981666505336761, 0.06669803708791733, -0.22419294714927673, 0.2018769085407257, 0.2715461552143097, -0.20290374755859375, -0.02589893713593483, -0.14843277633190155, -0.022203022614121437, -0.12431560456752777, 0.29038530588150024, -0.05832197889685631, 0.13950906693935394, -0.5078444480895996, -0.12499171495437622, -0.6539651155471802, 0.4035416543483734, -0.3416750729084015, 0.10131295025348663, -0.04546726495027542, 0.012462258338928223, -0.0929098054766655, 0.08096993714570999, 0.04091903567314148, -0.33709391951560974, 0.1674814671278, 0.2378125786781311, -0.1938323974609375, 0.08604010939598083, -0.5267013311386108, 0.09388597309589386, 0.19810236990451813, -0.238215833902359, 0.3681207001209259, -0.3649635314941406, -0.053779181092977524, -0.0013591218739748001, 0.13489912450313568, 0.001299908384680748, -0.06714160740375519, 0.42324966192245483, 0.21226224303245544, 0.4378967583179474, 0.06804201006889343, 0.08424177765846252, 0.004541996866464615, 0.08080094307661057, -0.2294752448797226, 0.20281371474266052, 0.1967403143644333, 0.4024077355861664, -0.21268755197525024, -0.5200229287147522, -0.40589791536331177, 0.47653040289878845, 0.11305734515190125, -0.16179132461547852, -0.04964817315340042, -0.13779659569263458, -0.11923139542341232, 0.17818710207939148, 0.12312325835227966, 0.421247273683548, 0.13837656378746033, -0.04294337332248688, -0.1960497498512268, -0.24784301221370697, 0.34234052896499634, -0.7567548751831055, -0.301139235496521, -0.25887924432754517, 0.28307992219924927, 0.07498926669359207, -0.11602167040109634, -0.7164037823677063, -0.13075655698776245, 0.09190855175256729, -0.19980072975158691, -0.23095357418060303, 0.0996546596288681, -0.3373797833919525, -0.05446142703294754, -0.010408652946352959, 0.35961201786994934, -0.13169533014297485, -0.5107800960540771, 0.16256853938102722, -0.09332829713821411 ]
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`
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.
[ -0.32103079557418823, -0.7901479601860046, 0.07416689395904541, 0.47603583335876465, 0.19198888540267944, -0.20305147767066956, 0.33363714814186096, -0.0628698319196701, 0.286129355430603, 0.10323995351791382, 0.09885290265083313, 0.4266767203807831, 0.10860054194927216, -0.27073538303375244, 0.26226481795310974, -0.11581364274024963, 0.04877167567610741, -0.11253069341182709, -0.252058744430542, -0.1637345850467682, -0.0487695187330246, 0.0414799302816391, -0.28428131341934204, -0.14575743675231934, -0.2898796796798706, -0.20695112645626068, -0.12485390901565552, 0.048837900161743164, 0.12250620871782303, -0.4142809212207794, 0.07270662486553192, 0.025524906814098358, 0.25117695331573486, 0.7024824023246765, -0.00012532874825410545, 0.12123237550258636, 0.035358987748622894, 0.08784221112728119, -0.11136370897293091, -0.21161548793315887, 0.04012761265039444, 0.00676652230322361, 0.1880064457654953, -0.31016719341278076, -0.07990702241659164, -0.12284412235021591, -0.04892589896917343, -0.19009628891944885, 0.5397404432296753, 0.03262680023908615, 0.05645390972495079, 0.3101397454738617, -0.24512331187725067, -0.11089834570884705, -0.17450836300849915, 0.3002590835094452, -0.07534076273441315, 0.5350344777107239, 0.16150128841400146, -0.08843748271465302, -0.4192807078361511, 0.26674073934555054, -0.24642790853977203, 0.550044059753418, 0.13305066525936127, 0.12014231830835342, 0.0316767543554306, -0.2911273241043091, 0.059651926159858704, 0.06908492743968964, -0.09921068698167801, -0.30998149514198303, 0.15371190011501312, -0.2582712471485138, -0.11648422479629517, -0.26406481862068176, 0.16126006841659546, 0.1586766242980957, -0.14056190848350525, -0.10502283275127411, -0.5622199177742004, 0.14480701088905334, 0.09224562346935272, -0.048315808176994324, -0.07534404844045639, 0.4892396628856659, 0.02302127704024315, 0.3770473003387451, 0.2719418704509735, 0.3056620955467224, -0.00923085119575262, 0.017283953726291656, 0.08918757736682892, -0.06200950965285301, -0.35988086462020874, 0.2191305160522461, 0.2168000340461731, -0.16578546166419983, 0.09063727408647537, -0.07611571252346039, 0.04283568263053894, -0.039567455649375916, 0.32623201608657837, 0.08787092566490173, 0.10524044930934906, 0.3472019135951996, 0.03898501768708229, 0.5393655896186829, 0.2395363748073578, 0.011268090456724167, -0.2852794826030731, 0.1443077027797699, 0.17589342594146729, -0.1336120218038559, 0.11007124185562134, -0.12112586945295334, 0.3196724057197571, 0.06094689294695854, -0.19688403606414795, -0.2789364755153656, -0.2145068347454071, -0.25530195236206055, 0.10427346080541611, 0.36482012271881104, 0.12008316069841385, -0.08746015280485153, 0.11024084687232971, 0.1192273199558258, -0.28099945187568665, -0.0710441991686821, -0.08085693418979645, -0.17239342629909515, -0.2692178785800934, 0.13414692878723145, 0.10696470737457275, -0.11755011975765228, 0.2842019200325012, 0.42022061347961426, 0.10877522081136703, -0.09469015896320343, 0.2539525628089905, -0.11998875439167023, 0.17431610822677612, 0.17003858089447021, -0.042824894189834595, 0.09917542338371277, 0.20438580214977264, 0.5848973393440247, -0.015030361711978912, 0.35025155544281006, -0.18256264925003052, -0.14699827134609222, 0.34957319498062134, -0.011410093866288662, 0.23411248624324799, 0.29897549748420715, -0.19871580600738525, 0.18534457683563232, 0.3968257009983063, -0.43091851472854614, 0.25223714113235474, -0.21273808181285858, -0.7713395953178406, -0.14055755734443665, 0.3055550456047058, 0.5337103009223938, 0.28961917757987976, -0.12634888291358948, 0.42376241087913513, 0.145217627286911, 0.32502657175064087, 0.262372225522995, -0.4677087664604187, 0.3233739733695984, -0.40510064363479614, -0.3190336525440216, 0.15427948534488678, -0.40845987200737, -0.3975279629230499, 0.3596333861351013, -0.5518221855163574, 0.05944698303937912, 0.08789768069982529, 0.0710991695523262, 0.2553240656852722, 0.26625511050224304, 0.22006596624851227, 0.04205168038606644, 0.025810007005929947, 0.3425556719303131, -0.24576592445373535, 0.25786158442497253, 0.5458126664161682, 0.007495012134313583, -0.158840149641037, 0.11281581223011017, 0.08242449164390564, 0.08996120095252991, 0.3640334904193878, 0.10886339098215103, -0.1140267550945282, 0.007277581840753555, -0.3960050046443939, -0.20402033627033234, 0.04767921194434166, -0.07438115775585175, -0.22941815853118896, 0.3985099494457245, -0.12211298942565918, -0.028364844620227814, -0.003702804446220398, 0.014123577624559402, 0.1808559000492096, -0.04021308571100235, -0.3480614423751831, -0.3720845878124237, -0.13439518213272095, 0.18901818990707397, 0.07952666282653809, -0.07242104411125183, -0.10399419069290161, 0.2854953408241272, -0.09906431287527084, -0.042192377150058746, -0.30290842056274414, 0.052930571138858795, 0.023318849503993988, -0.05225232243537903, -0.19600895047187805, -0.08476000279188156, 0.30008721351623535, -0.3161182999610901, -0.19754096865653992, 0.31970542669296265, 0.11068552732467651, 0.030985191464424133, -0.03420526534318924, -0.16434402763843536, 0.441107839345932, -0.00830407440662384, 0.061553314328193665, 0.4732600152492523, 0.06943885236978531, -0.1465321034193039, -0.1924816071987152, 0.25467923283576965, 0.14265163242816925, 0.13472715020179749, -0.15512707829475403, -0.1455821990966797, -0.09947439283132553, 0.05844362452626228, -0.05991959571838379, 0.20915737748146057, 0.2657236158847809, 0.20881855487823486, 0.27354326844215393, 0.11554966121912003, -0.2268325537443161, -0.12739193439483643, 0.13313952088356018, 0.023160420358181, 0.08099918812513351, -0.0669543445110321, -0.1164705827832222, 0.032385725528001785, 0.29902487993240356, -0.01712091639637947, 0.45884203910827637, 0.1188306212425232, 0.2843678295612335, 0.03116626664996147, -0.21665999293327332, -0.029790719971060753, 0.0601813942193985, -0.15033602714538574, 0.09821663051843643, -0.06067065894603729, 0.41385141015052795, -0.04729698225855827, -0.3590408265590668, -0.06880398094654083, 0.33778753876686096, 0.07448824495077133, -0.24584439396858215, 0.1695537120103836, -0.24102358520030975, 0.014985635876655579, -0.28827860951423645, 0.2793470621109009, -0.16765937209129333, 0.1733199805021286, -0.11825309693813324, 0.40815269947052, 0.1852995604276657, 0.3976530134677887, 0.35181379318237305, 0.04142336547374725, -0.14881299436092377, -0.1478588581085205, 0.24787873029708862, -0.09317871928215027, -0.08223885297775269, -0.060490526258945465, 0.050327498465776443, -0.08713763952255249, 0.5514772534370422, 0.110911525785923, -0.48693394660949707, -0.1813449114561081, 0.08564876765012741, 0.08983262628316879, 0.10212339460849762, -0.2983282208442688, -0.08353815972805023, -0.013611279428005219, -0.2700583338737488, 0.13113538920879364, 0.3442874252796173, -0.46287381649017334, -0.1850377768278122, 0.11619985103607178, 0.00006789498729631305, -0.12305669486522675, -0.19957034289836884, -0.32445600628852844, 0.058491453528404236, -0.15177074074745178, 0.33425843715667725, -0.20589804649353027, 0.28581559658050537, -0.12700217962265015, 0.09779071062803268, -0.010174524039030075, -0.021022237837314606, -0.030537525191903114, -0.08207453042268753, -0.4267660081386566, -0.04151875153183937, -0.08720116317272186, -0.2174292951822281, -0.21946954727172852, 0.10197077691555023, -0.1804666668176651, 0.4664597511291504, -0.4788520336151123, -0.42627355456352234, -0.23839150369167328, 0.3545773923397064, -0.19474446773529053, 0.20557723939418793, 0.5381612777709961, -0.10454200953245163, 0.05447181314229965, 0.0959867611527443, -0.2025066614151001, 0.3153032660484314, 0.1699507236480713, 0.13322578370571136, 0.28371089696884155, 0.49443989992141724, -0.002390839159488678, 0.8055756688117981, 0.2815590500831604, -0.13309888541698456, 0.0940239354968071, -0.4099041521549225, 0.03872787579894066, -0.11614079028367996, -0.39916279911994934, 0.15716923773288727, -0.12431621551513672, -0.13921211659908295, 0.11112935096025467, -0.13672643899917603, -0.08218690007925034, -0.08475898206233978, -0.26178446412086487, 0.041426293551921844, -0.1333567053079605, -0.0016668792814016342, -0.09317921102046967, 0.3270926773548126, -0.039084289222955704, 0.20677593350410461, -0.10299736261367798, 0.12215272337198257, 0.04603682830929756, -0.274757444858551, 0.34444355964660645, -0.009908664040267467, -0.22914281487464905, 0.1980474591255188, -0.3875443935394287, 0.23339885473251343, 0.13931645452976227, 0.09074775874614716, -0.15318109095096588, 0.2440476417541504, 0.3723222613334656, 0.016393374651670456, 0.8515886068344116, 0.20654833316802979, 0.3926392197608948, -0.06385266780853271, -0.5782081484794617, -0.4568253755569458, -0.01565798558294773, -0.1717875599861145, 0.3817780911922455, 0.28464409708976746, -0.04700228571891785, -0.13081541657447815, -0.058145925402641296, -0.0574006512761116, 0.12532353401184082, -0.19049738347530365, -0.28003251552581787, -0.49488312005996704, -0.058312784880399704, -0.44502735137939453, 0.3669358193874359, 0.28467971086502075, -0.1102384477853775, -0.020069284364581108, -0.21457457542419434, 0.09521373361349106, 0.0783785879611969, -0.04237249493598938, 0.23867206275463104, 0.2561562657356262, 0.10197323560714722, 0.189732626080513, 0.47036075592041016, 0.31322312355041504, 0.014635802246630192, 0.49203062057495117, -0.28032976388931274, -0.12606830894947052, 0.05534486100077629, 0.09950830787420273, 0.13294872641563416, 0.40727323293685913, 0.13329820334911346, 0.058510199189186096, -0.10428757965564728, 0.18158623576164246, -0.3366774320602417, -0.11681554466485977, 0.37885841727256775, 0.1245688870549202, -0.06399158388376236, -0.43456748127937317, 0.19299457967281342, 0.04701342061161995, -0.2752251625061035, 0.6179054975509644, -0.44700735807418823, -0.2240835726261139, 0.07093412429094315, -0.17497453093528748, 0.7820191979408264, -0.17448173463344574, 0.041305817663669586, 0.08099673688411713, -0.054910965263843536, 0.28766804933547974, -0.13424521684646606, 0.3840335011482239, -0.3718142807483673, -0.23508688807487488, 0.0589635968208313, -0.1996956169605255, 0.07527957856655121, -0.019774019718170166, 0.041475530713796616, 0.12689346075057983, -0.03389688581228256, 0.1993168145418167, -0.12998703122138977, 0.17681679129600525, 0.3123520016670227, -0.18389922380447388, -0.03766591101884842, -0.04231400787830353, -0.02352254092693329, 0.2826218605041504, -0.01078194472938776, 0.03039892017841339, 0.19777187705039978, -0.3241971731185913, -0.04907397925853729, 0.1419382095336914, -0.5082390308380127, 0.434684157371521, -0.152037113904953, -0.2642524838447571, -0.10143692791461945, 0.7358688712120056, 0.08062467724084854, -0.22749869525432587, 0.09769950807094574, -0.0021508336067199707, 0.1871088147163391, 0.24321913719177246, -0.31424379348754883, -0.22403204441070557, -0.19225719571113586, -0.06264728307723999, -0.4601982533931732, -0.18495473265647888, -0.07633832842111588, -0.3196958303451538, -0.24082478880882263, 0.5648025870323181, 0.10051055997610092, 0.06293772906064987, 0.04463646188378334, 0.12916620075702667, 0.04437645897269249, -0.24744592607021332, -0.06726667284965515, 0.05077718570828438, -0.2799234986305237, 0.11551667749881744, 0.009563058614730835, -0.38125503063201904, 0.050519660115242004, 0.5093289613723755, 0.16595208644866943, 0.4076870381832123, 0.19413132965564728, 0.12486809492111206, -0.049744363874197006, -0.12555637955665588, -0.06231280043721199, 0.15009571611881256, -0.28732722997665405, 0.22064393758773804, -0.06300695240497589, 0.07249070703983307, -0.0950632095336914, 0.13673171401023865, -0.06849775463342667, 0.013890337198972702, -0.08418715745210648, -0.09499183297157288, -0.3169296085834503, -0.18090729415416718, 0.03409714624285698, -0.0005235671997070312, 0.3702935576438904, 0.33438533544540405, 0.24987903237342834, 0.4636765718460083, -0.14911608397960663, 0.04224507510662079, 0.23245400190353394, 0.33408334851264954, -0.02351248636841774, -0.008763592690229416, 0.048214804381132126, -0.016042843461036682, -0.08510630577802658, 0.3576098084449768, -0.1007848009467125, -0.052683308720588684, -0.15263940393924713, 0.23410794138908386, -0.20396706461906433, -0.06581883132457733, -0.17026539146900177, -0.47974127531051636, 0.06136385723948479, -0.32725343108177185, 0.400524765253067, 0.4074561595916748, -0.0351499542593956, -0.09914941340684891, 0.2587668299674988, 0.05589257925748825, -0.201152965426445, -0.008764687925577164, -0.32532167434692383, -0.34483855962753296, 0.14392027258872986, -0.007134892046451569, 0.05552545189857483, -0.03736119344830513, -0.3768669366836548, -0.15646737813949585, 0.4180071949958801, -0.07706824690103531, 0.007746361196041107, -0.22814474999904633, -0.11427368223667145, -0.08735553175210953, 0.40227705240249634, 0.09043391048908234, -0.31199169158935547, -0.0732547789812088, -0.13250568509101868, 0.01673966646194458, -0.35503292083740234, -0.11912628263235092, 0.31738558411598206, 0.009169426746666431, 0.13769277930259705, 0.42766597867012024, 0.2895326316356659, -0.03956487774848938, -0.2120404690504074, 0.011784400790929794, 0.15766817331314087, -0.3562094569206238, 0.0728011280298233, -0.18851566314697266, -0.09778659045696259, 0.011627137660980225, 0.2780611217021942, 0.085076704621315, 0.10676451027393341, 0.0913032665848732, 0.030378535389900208, 0.6768696904182434, 0.09205833077430725, 0.14612556993961334, 0.26083120703697205, -0.22782111167907715, 0.2882983386516571, 0.07550743222236633, -0.3025502860546112, -0.07109903544187546, -0.07912801206111908, 0.19735431671142578, -0.5555618405342102, -0.3993319571018219, -0.31075039505958557, 0.18628135323524475, -0.21436002850532532, -0.057783596217632294, 0.13677942752838135, -0.13642269372940063, 0.07552677392959595, 0.2659592032432556, 0.12978869676589966, 0.029940105974674225, 0.5465022325515747, 0.09842720627784729, -0.25007152557373047, -0.2736549973487854, -0.4249815344810486, 0.12966710329055786, 0.15650267899036407, -0.32088330388069153, 0.2355489283800125, 0.192893385887146, -0.14153258502483368, -0.2070872187614441, 0.3230237662792206, 0.2224525809288025, 0.2408064901828766, -0.14938390254974365, 0.1486433893442154, 0.15672439336776733, 0.26859769225120544, -0.12406449019908905, 0.11281517148017883, -0.0550432950258255, 0.26080211997032166, 0.1379396766424179, -0.07691366970539093, -0.11137448251247406, -0.036428723484277725, 0.26485297083854675, 0.1318778693675995, -0.04035188630223274, 0.5132677555084229, -0.32104262709617615, -0.034849464893341064, -0.09981666505336761, 0.06669803708791733, -0.22419294714927673, 0.2018769085407257, 0.2715461552143097, -0.20290374755859375, -0.02589893713593483, -0.14843277633190155, -0.022203022614121437, -0.12431560456752777, 0.29038530588150024, -0.05832197889685631, 0.13950906693935394, -0.5078444480895996, -0.12499171495437622, -0.6539651155471802, 0.4035416543483734, -0.3416750729084015, 0.10131295025348663, -0.04546726495027542, 0.012462258338928223, -0.0929098054766655, 0.08096993714570999, 0.04091903567314148, -0.33709391951560974, 0.1674814671278, 0.2378125786781311, -0.1938323974609375, 0.08604010939598083, -0.5267013311386108, 0.09388597309589386, 0.19810236990451813, -0.238215833902359, 0.3681207001209259, -0.3649635314941406, -0.053779181092977524, -0.0013591218739748001, 0.13489912450313568, 0.001299908384680748, -0.06714160740375519, 0.42324966192245483, 0.21226224303245544, 0.4378967583179474, 0.06804201006889343, 0.08424177765846252, 0.004541996866464615, 0.08080094307661057, -0.2294752448797226, 0.20281371474266052, 0.1967403143644333, 0.4024077355861664, -0.21268755197525024, -0.5200229287147522, -0.40589791536331177, 0.47653040289878845, 0.11305734515190125, -0.16179132461547852, -0.04964817315340042, -0.13779659569263458, -0.11923139542341232, 0.17818710207939148, 0.12312325835227966, 0.421247273683548, 0.13837656378746033, -0.04294337332248688, -0.1960497498512268, -0.24784301221370697, 0.34234052896499634, -0.7567548751831055, -0.301139235496521, -0.25887924432754517, 0.28307992219924927, 0.07498926669359207, -0.11602167040109634, -0.7164037823677063, -0.13075655698776245, 0.09190855175256729, -0.19980072975158691, -0.23095357418060303, 0.0996546596288681, -0.3373797833919525, -0.05446142703294754, -0.010408652946352959, 0.35961201786994934, -0.13169533014297485, -0.5107800960540771, 0.16256853938102722, -0.09332829713821411 ]
https://github.com/huggingface/datasets/issues/6060
Dataset.map() execute twice when in PyTorch DDP mode
I finally figure it out. The fingerprint of the function will change if other key-value pairs change in `args` even the `args.num_stations_list` is not changed. ```python lambda x: cut_reorder_keys(x, num_stations_list=args.num_stations_list, is_pad=True, is_train=True) ``` My `args` contains the key `rank` which refers the rank of its GPU, so the fingerprints change among the GPUs. I use `partial` in `functools` to generate a partial function that fixs the argument `num_stations_list=args.num_stations_list`, and the fingerprint of this partial function keeps among the GPUs. Finally I can reuse the mapped 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`
86
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` I finally figure it out. The fingerprint of the function will change if other key-value pairs change in `args` even the `args.num_stations_list` is not changed. ```python lambda x: cut_reorder_keys(x, num_stations_list=args.num_stations_list, is_pad=True, is_train=True) ``` My `args` contains the key `rank` which refers the rank of its GPU, so the fingerprints change among the GPUs. I use `partial` in `functools` to generate a partial function that fixs the argument `num_stations_list=args.num_stations_list`, and the fingerprint of this partial function keeps among the GPUs. Finally I can reuse the mapped cache.
[ -0.32103079557418823, -0.7901479601860046, 0.07416689395904541, 0.47603583335876465, 0.19198888540267944, -0.20305147767066956, 0.33363714814186096, -0.0628698319196701, 0.286129355430603, 0.10323995351791382, 0.09885290265083313, 0.4266767203807831, 0.10860054194927216, -0.27073538303375244, 0.26226481795310974, -0.11581364274024963, 0.04877167567610741, -0.11253069341182709, -0.252058744430542, -0.1637345850467682, -0.0487695187330246, 0.0414799302816391, -0.28428131341934204, -0.14575743675231934, -0.2898796796798706, -0.20695112645626068, -0.12485390901565552, 0.048837900161743164, 0.12250620871782303, -0.4142809212207794, 0.07270662486553192, 0.025524906814098358, 0.25117695331573486, 0.7024824023246765, -0.00012532874825410545, 0.12123237550258636, 0.035358987748622894, 0.08784221112728119, -0.11136370897293091, -0.21161548793315887, 0.04012761265039444, 0.00676652230322361, 0.1880064457654953, -0.31016719341278076, -0.07990702241659164, -0.12284412235021591, -0.04892589896917343, -0.19009628891944885, 0.5397404432296753, 0.03262680023908615, 0.05645390972495079, 0.3101397454738617, -0.24512331187725067, -0.11089834570884705, -0.17450836300849915, 0.3002590835094452, -0.07534076273441315, 0.5350344777107239, 0.16150128841400146, -0.08843748271465302, -0.4192807078361511, 0.26674073934555054, -0.24642790853977203, 0.550044059753418, 0.13305066525936127, 0.12014231830835342, 0.0316767543554306, -0.2911273241043091, 0.059651926159858704, 0.06908492743968964, -0.09921068698167801, -0.30998149514198303, 0.15371190011501312, -0.2582712471485138, -0.11648422479629517, -0.26406481862068176, 0.16126006841659546, 0.1586766242980957, -0.14056190848350525, -0.10502283275127411, -0.5622199177742004, 0.14480701088905334, 0.09224562346935272, -0.048315808176994324, -0.07534404844045639, 0.4892396628856659, 0.02302127704024315, 0.3770473003387451, 0.2719418704509735, 0.3056620955467224, -0.00923085119575262, 0.017283953726291656, 0.08918757736682892, -0.06200950965285301, -0.35988086462020874, 0.2191305160522461, 0.2168000340461731, -0.16578546166419983, 0.09063727408647537, -0.07611571252346039, 0.04283568263053894, -0.039567455649375916, 0.32623201608657837, 0.08787092566490173, 0.10524044930934906, 0.3472019135951996, 0.03898501768708229, 0.5393655896186829, 0.2395363748073578, 0.011268090456724167, -0.2852794826030731, 0.1443077027797699, 0.17589342594146729, -0.1336120218038559, 0.11007124185562134, -0.12112586945295334, 0.3196724057197571, 0.06094689294695854, -0.19688403606414795, -0.2789364755153656, -0.2145068347454071, -0.25530195236206055, 0.10427346080541611, 0.36482012271881104, 0.12008316069841385, -0.08746015280485153, 0.11024084687232971, 0.1192273199558258, -0.28099945187568665, -0.0710441991686821, -0.08085693418979645, -0.17239342629909515, -0.2692178785800934, 0.13414692878723145, 0.10696470737457275, -0.11755011975765228, 0.2842019200325012, 0.42022061347961426, 0.10877522081136703, -0.09469015896320343, 0.2539525628089905, -0.11998875439167023, 0.17431610822677612, 0.17003858089447021, -0.042824894189834595, 0.09917542338371277, 0.20438580214977264, 0.5848973393440247, -0.015030361711978912, 0.35025155544281006, -0.18256264925003052, -0.14699827134609222, 0.34957319498062134, -0.011410093866288662, 0.23411248624324799, 0.29897549748420715, -0.19871580600738525, 0.18534457683563232, 0.3968257009983063, -0.43091851472854614, 0.25223714113235474, -0.21273808181285858, -0.7713395953178406, -0.14055755734443665, 0.3055550456047058, 0.5337103009223938, 0.28961917757987976, -0.12634888291358948, 0.42376241087913513, 0.145217627286911, 0.32502657175064087, 0.262372225522995, -0.4677087664604187, 0.3233739733695984, -0.40510064363479614, -0.3190336525440216, 0.15427948534488678, -0.40845987200737, -0.3975279629230499, 0.3596333861351013, -0.5518221855163574, 0.05944698303937912, 0.08789768069982529, 0.0710991695523262, 0.2553240656852722, 0.26625511050224304, 0.22006596624851227, 0.04205168038606644, 0.025810007005929947, 0.3425556719303131, -0.24576592445373535, 0.25786158442497253, 0.5458126664161682, 0.007495012134313583, -0.158840149641037, 0.11281581223011017, 0.08242449164390564, 0.08996120095252991, 0.3640334904193878, 0.10886339098215103, -0.1140267550945282, 0.007277581840753555, -0.3960050046443939, -0.20402033627033234, 0.04767921194434166, -0.07438115775585175, -0.22941815853118896, 0.3985099494457245, -0.12211298942565918, -0.028364844620227814, -0.003702804446220398, 0.014123577624559402, 0.1808559000492096, -0.04021308571100235, -0.3480614423751831, -0.3720845878124237, -0.13439518213272095, 0.18901818990707397, 0.07952666282653809, -0.07242104411125183, -0.10399419069290161, 0.2854953408241272, -0.09906431287527084, -0.042192377150058746, -0.30290842056274414, 0.052930571138858795, 0.023318849503993988, -0.05225232243537903, -0.19600895047187805, -0.08476000279188156, 0.30008721351623535, -0.3161182999610901, -0.19754096865653992, 0.31970542669296265, 0.11068552732467651, 0.030985191464424133, -0.03420526534318924, -0.16434402763843536, 0.441107839345932, -0.00830407440662384, 0.061553314328193665, 0.4732600152492523, 0.06943885236978531, -0.1465321034193039, -0.1924816071987152, 0.25467923283576965, 0.14265163242816925, 0.13472715020179749, -0.15512707829475403, -0.1455821990966797, -0.09947439283132553, 0.05844362452626228, -0.05991959571838379, 0.20915737748146057, 0.2657236158847809, 0.20881855487823486, 0.27354326844215393, 0.11554966121912003, -0.2268325537443161, -0.12739193439483643, 0.13313952088356018, 0.023160420358181, 0.08099918812513351, -0.0669543445110321, -0.1164705827832222, 0.032385725528001785, 0.29902487993240356, -0.01712091639637947, 0.45884203910827637, 0.1188306212425232, 0.2843678295612335, 0.03116626664996147, -0.21665999293327332, -0.029790719971060753, 0.0601813942193985, -0.15033602714538574, 0.09821663051843643, -0.06067065894603729, 0.41385141015052795, -0.04729698225855827, -0.3590408265590668, -0.06880398094654083, 0.33778753876686096, 0.07448824495077133, -0.24584439396858215, 0.1695537120103836, -0.24102358520030975, 0.014985635876655579, -0.28827860951423645, 0.2793470621109009, -0.16765937209129333, 0.1733199805021286, -0.11825309693813324, 0.40815269947052, 0.1852995604276657, 0.3976530134677887, 0.35181379318237305, 0.04142336547374725, -0.14881299436092377, -0.1478588581085205, 0.24787873029708862, -0.09317871928215027, -0.08223885297775269, -0.060490526258945465, 0.050327498465776443, -0.08713763952255249, 0.5514772534370422, 0.110911525785923, -0.48693394660949707, -0.1813449114561081, 0.08564876765012741, 0.08983262628316879, 0.10212339460849762, -0.2983282208442688, -0.08353815972805023, -0.013611279428005219, -0.2700583338737488, 0.13113538920879364, 0.3442874252796173, -0.46287381649017334, -0.1850377768278122, 0.11619985103607178, 0.00006789498729631305, -0.12305669486522675, -0.19957034289836884, -0.32445600628852844, 0.058491453528404236, -0.15177074074745178, 0.33425843715667725, -0.20589804649353027, 0.28581559658050537, -0.12700217962265015, 0.09779071062803268, -0.010174524039030075, -0.021022237837314606, -0.030537525191903114, -0.08207453042268753, -0.4267660081386566, -0.04151875153183937, -0.08720116317272186, -0.2174292951822281, -0.21946954727172852, 0.10197077691555023, -0.1804666668176651, 0.4664597511291504, -0.4788520336151123, -0.42627355456352234, -0.23839150369167328, 0.3545773923397064, -0.19474446773529053, 0.20557723939418793, 0.5381612777709961, -0.10454200953245163, 0.05447181314229965, 0.0959867611527443, -0.2025066614151001, 0.3153032660484314, 0.1699507236480713, 0.13322578370571136, 0.28371089696884155, 0.49443989992141724, -0.002390839159488678, 0.8055756688117981, 0.2815590500831604, -0.13309888541698456, 0.0940239354968071, -0.4099041521549225, 0.03872787579894066, -0.11614079028367996, -0.39916279911994934, 0.15716923773288727, -0.12431621551513672, -0.13921211659908295, 0.11112935096025467, -0.13672643899917603, -0.08218690007925034, -0.08475898206233978, -0.26178446412086487, 0.041426293551921844, -0.1333567053079605, -0.0016668792814016342, -0.09317921102046967, 0.3270926773548126, -0.039084289222955704, 0.20677593350410461, -0.10299736261367798, 0.12215272337198257, 0.04603682830929756, -0.274757444858551, 0.34444355964660645, -0.009908664040267467, -0.22914281487464905, 0.1980474591255188, -0.3875443935394287, 0.23339885473251343, 0.13931645452976227, 0.09074775874614716, -0.15318109095096588, 0.2440476417541504, 0.3723222613334656, 0.016393374651670456, 0.8515886068344116, 0.20654833316802979, 0.3926392197608948, -0.06385266780853271, -0.5782081484794617, -0.4568253755569458, -0.01565798558294773, -0.1717875599861145, 0.3817780911922455, 0.28464409708976746, -0.04700228571891785, -0.13081541657447815, -0.058145925402641296, -0.0574006512761116, 0.12532353401184082, -0.19049738347530365, -0.28003251552581787, -0.49488312005996704, -0.058312784880399704, -0.44502735137939453, 0.3669358193874359, 0.28467971086502075, -0.1102384477853775, -0.020069284364581108, -0.21457457542419434, 0.09521373361349106, 0.0783785879611969, -0.04237249493598938, 0.23867206275463104, 0.2561562657356262, 0.10197323560714722, 0.189732626080513, 0.47036075592041016, 0.31322312355041504, 0.014635802246630192, 0.49203062057495117, -0.28032976388931274, -0.12606830894947052, 0.05534486100077629, 0.09950830787420273, 0.13294872641563416, 0.40727323293685913, 0.13329820334911346, 0.058510199189186096, -0.10428757965564728, 0.18158623576164246, -0.3366774320602417, -0.11681554466485977, 0.37885841727256775, 0.1245688870549202, -0.06399158388376236, -0.43456748127937317, 0.19299457967281342, 0.04701342061161995, -0.2752251625061035, 0.6179054975509644, -0.44700735807418823, -0.2240835726261139, 0.07093412429094315, -0.17497453093528748, 0.7820191979408264, -0.17448173463344574, 0.041305817663669586, 0.08099673688411713, -0.054910965263843536, 0.28766804933547974, -0.13424521684646606, 0.3840335011482239, -0.3718142807483673, -0.23508688807487488, 0.0589635968208313, -0.1996956169605255, 0.07527957856655121, -0.019774019718170166, 0.041475530713796616, 0.12689346075057983, -0.03389688581228256, 0.1993168145418167, -0.12998703122138977, 0.17681679129600525, 0.3123520016670227, -0.18389922380447388, -0.03766591101884842, -0.04231400787830353, -0.02352254092693329, 0.2826218605041504, -0.01078194472938776, 0.03039892017841339, 0.19777187705039978, -0.3241971731185913, -0.04907397925853729, 0.1419382095336914, -0.5082390308380127, 0.434684157371521, -0.152037113904953, -0.2642524838447571, -0.10143692791461945, 0.7358688712120056, 0.08062467724084854, -0.22749869525432587, 0.09769950807094574, -0.0021508336067199707, 0.1871088147163391, 0.24321913719177246, -0.31424379348754883, -0.22403204441070557, -0.19225719571113586, -0.06264728307723999, -0.4601982533931732, -0.18495473265647888, -0.07633832842111588, -0.3196958303451538, -0.24082478880882263, 0.5648025870323181, 0.10051055997610092, 0.06293772906064987, 0.04463646188378334, 0.12916620075702667, 0.04437645897269249, -0.24744592607021332, -0.06726667284965515, 0.05077718570828438, -0.2799234986305237, 0.11551667749881744, 0.009563058614730835, -0.38125503063201904, 0.050519660115242004, 0.5093289613723755, 0.16595208644866943, 0.4076870381832123, 0.19413132965564728, 0.12486809492111206, -0.049744363874197006, -0.12555637955665588, -0.06231280043721199, 0.15009571611881256, -0.28732722997665405, 0.22064393758773804, -0.06300695240497589, 0.07249070703983307, -0.0950632095336914, 0.13673171401023865, -0.06849775463342667, 0.013890337198972702, -0.08418715745210648, -0.09499183297157288, -0.3169296085834503, -0.18090729415416718, 0.03409714624285698, -0.0005235671997070312, 0.3702935576438904, 0.33438533544540405, 0.24987903237342834, 0.4636765718460083, -0.14911608397960663, 0.04224507510662079, 0.23245400190353394, 0.33408334851264954, -0.02351248636841774, -0.008763592690229416, 0.048214804381132126, -0.016042843461036682, -0.08510630577802658, 0.3576098084449768, -0.1007848009467125, -0.052683308720588684, -0.15263940393924713, 0.23410794138908386, -0.20396706461906433, -0.06581883132457733, -0.17026539146900177, -0.47974127531051636, 0.06136385723948479, -0.32725343108177185, 0.400524765253067, 0.4074561595916748, -0.0351499542593956, -0.09914941340684891, 0.2587668299674988, 0.05589257925748825, -0.201152965426445, -0.008764687925577164, -0.32532167434692383, -0.34483855962753296, 0.14392027258872986, -0.007134892046451569, 0.05552545189857483, -0.03736119344830513, -0.3768669366836548, -0.15646737813949585, 0.4180071949958801, -0.07706824690103531, 0.007746361196041107, -0.22814474999904633, -0.11427368223667145, -0.08735553175210953, 0.40227705240249634, 0.09043391048908234, -0.31199169158935547, -0.0732547789812088, -0.13250568509101868, 0.01673966646194458, -0.35503292083740234, -0.11912628263235092, 0.31738558411598206, 0.009169426746666431, 0.13769277930259705, 0.42766597867012024, 0.2895326316356659, -0.03956487774848938, -0.2120404690504074, 0.011784400790929794, 0.15766817331314087, -0.3562094569206238, 0.0728011280298233, -0.18851566314697266, -0.09778659045696259, 0.011627137660980225, 0.2780611217021942, 0.085076704621315, 0.10676451027393341, 0.0913032665848732, 0.030378535389900208, 0.6768696904182434, 0.09205833077430725, 0.14612556993961334, 0.26083120703697205, -0.22782111167907715, 0.2882983386516571, 0.07550743222236633, -0.3025502860546112, -0.07109903544187546, -0.07912801206111908, 0.19735431671142578, -0.5555618405342102, -0.3993319571018219, -0.31075039505958557, 0.18628135323524475, -0.21436002850532532, -0.057783596217632294, 0.13677942752838135, -0.13642269372940063, 0.07552677392959595, 0.2659592032432556, 0.12978869676589966, 0.029940105974674225, 0.5465022325515747, 0.09842720627784729, -0.25007152557373047, -0.2736549973487854, -0.4249815344810486, 0.12966710329055786, 0.15650267899036407, -0.32088330388069153, 0.2355489283800125, 0.192893385887146, -0.14153258502483368, -0.2070872187614441, 0.3230237662792206, 0.2224525809288025, 0.2408064901828766, -0.14938390254974365, 0.1486433893442154, 0.15672439336776733, 0.26859769225120544, -0.12406449019908905, 0.11281517148017883, -0.0550432950258255, 0.26080211997032166, 0.1379396766424179, -0.07691366970539093, -0.11137448251247406, -0.036428723484277725, 0.26485297083854675, 0.1318778693675995, -0.04035188630223274, 0.5132677555084229, -0.32104262709617615, -0.034849464893341064, -0.09981666505336761, 0.06669803708791733, -0.22419294714927673, 0.2018769085407257, 0.2715461552143097, -0.20290374755859375, -0.02589893713593483, -0.14843277633190155, -0.022203022614121437, -0.12431560456752777, 0.29038530588150024, -0.05832197889685631, 0.13950906693935394, -0.5078444480895996, -0.12499171495437622, -0.6539651155471802, 0.4035416543483734, -0.3416750729084015, 0.10131295025348663, -0.04546726495027542, 0.012462258338928223, -0.0929098054766655, 0.08096993714570999, 0.04091903567314148, -0.33709391951560974, 0.1674814671278, 0.2378125786781311, -0.1938323974609375, 0.08604010939598083, -0.5267013311386108, 0.09388597309589386, 0.19810236990451813, -0.238215833902359, 0.3681207001209259, -0.3649635314941406, -0.053779181092977524, -0.0013591218739748001, 0.13489912450313568, 0.001299908384680748, -0.06714160740375519, 0.42324966192245483, 0.21226224303245544, 0.4378967583179474, 0.06804201006889343, 0.08424177765846252, 0.004541996866464615, 0.08080094307661057, -0.2294752448797226, 0.20281371474266052, 0.1967403143644333, 0.4024077355861664, -0.21268755197525024, -0.5200229287147522, -0.40589791536331177, 0.47653040289878845, 0.11305734515190125, -0.16179132461547852, -0.04964817315340042, -0.13779659569263458, -0.11923139542341232, 0.17818710207939148, 0.12312325835227966, 0.421247273683548, 0.13837656378746033, -0.04294337332248688, -0.1960497498512268, -0.24784301221370697, 0.34234052896499634, -0.7567548751831055, -0.301139235496521, -0.25887924432754517, 0.28307992219924927, 0.07498926669359207, -0.11602167040109634, -0.7164037823677063, -0.13075655698776245, 0.09190855175256729, -0.19980072975158691, -0.23095357418060303, 0.0996546596288681, -0.3373797833919525, -0.05446142703294754, -0.010408652946352959, 0.35961201786994934, -0.13169533014297485, -0.5107800960540771, 0.16256853938102722, -0.09332829713821411 ]
https://github.com/huggingface/datasets/issues/6059
Provide ability to load label mappings from file
I would like this also as I have been working with a dataset with hierarchical classes. In fact, I encountered this very issue when trying to define the dataset with a script. I couldn't find a work around and reverted to hard coding the class names in the readme yaml. @david-waterworth do you envision also being able to define the hierarchical structure of the classes?
### Feature request My task is classification of a dataset containing a large label set that includes a hierarchy. Even ignoring the hierarchy I'm not able to find an example using `datasets` where the label names aren't hard-coded. This works find for classification of a handful of labels but ideally there would be a way of loading the name/id mappings required for `datasets.features.ClassLabel` from a file. It is possible to pass a file to ClassLabel but I cannot see an easy way of using this with `GeneratorBasedBuilder` since `self._info` is called before the `dl_manager` is constructed so even if my dataset contains say `label_mappings.json` there's no way of loading it in order to construct the `datasets.DatasetInfo` I can see other uses to accessing the `download_manager` from `self._info` - i.e. if the files contain a schema (i.e. `arrow` or `parquet` files) the `datasets.DatasetInfo` could be inferred. The workaround that was suggested in the forum is to generate a `.py` file from the `label_mappings.json` and import it. ``` class TestDatasetBuilder(datasets.GeneratorBasedBuilder): VERSION = datasets.Version("1.0.0") def _info(self): return datasets.DatasetInfo( description=_DESCRIPTION, features=datasets.Features( { "text": datasets.Value("string"), "label": datasets.features.ClassLabel(names=["label_1", "label_2"]), } ), task_templates=[TextClassification(text_column="text", label_column="label")], ) def _split_generators(self, dl_manager): train_path = dl_manager.download_and_extract(_TRAIN_DOWNLOAD_URL) test_path = dl_manager.download_and_extract(_TEST_DOWNLOAD_URL) return [ datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"filepath": train_path}), datasets.SplitGenerator(name=datasets.Split.TEST, gen_kwargs={"filepath": test_path}), ] def _generate_examples(self, filepath): """Generate AG News examples.""" with open(filepath, encoding="utf-8") as csv_file: csv_reader = csv.DictReader(csv_file) for id_, row in enumerate(csv_reader): yield id_, row ``` ### Motivation Allow `datasets.DatasetInfo` to be generated based on the contents of the dataset. ### Your contribution I'm willing to work on a PR with guidence.
65
Provide ability to load label mappings from file ### Feature request My task is classification of a dataset containing a large label set that includes a hierarchy. Even ignoring the hierarchy I'm not able to find an example using `datasets` where the label names aren't hard-coded. This works find for classification of a handful of labels but ideally there would be a way of loading the name/id mappings required for `datasets.features.ClassLabel` from a file. It is possible to pass a file to ClassLabel but I cannot see an easy way of using this with `GeneratorBasedBuilder` since `self._info` is called before the `dl_manager` is constructed so even if my dataset contains say `label_mappings.json` there's no way of loading it in order to construct the `datasets.DatasetInfo` I can see other uses to accessing the `download_manager` from `self._info` - i.e. if the files contain a schema (i.e. `arrow` or `parquet` files) the `datasets.DatasetInfo` could be inferred. The workaround that was suggested in the forum is to generate a `.py` file from the `label_mappings.json` and import it. ``` class TestDatasetBuilder(datasets.GeneratorBasedBuilder): VERSION = datasets.Version("1.0.0") def _info(self): return datasets.DatasetInfo( description=_DESCRIPTION, features=datasets.Features( { "text": datasets.Value("string"), "label": datasets.features.ClassLabel(names=["label_1", "label_2"]), } ), task_templates=[TextClassification(text_column="text", label_column="label")], ) def _split_generators(self, dl_manager): train_path = dl_manager.download_and_extract(_TRAIN_DOWNLOAD_URL) test_path = dl_manager.download_and_extract(_TEST_DOWNLOAD_URL) return [ datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"filepath": train_path}), datasets.SplitGenerator(name=datasets.Split.TEST, gen_kwargs={"filepath": test_path}), ] def _generate_examples(self, filepath): """Generate AG News examples.""" with open(filepath, encoding="utf-8") as csv_file: csv_reader = csv.DictReader(csv_file) for id_, row in enumerate(csv_reader): yield id_, row ``` ### Motivation Allow `datasets.DatasetInfo` to be generated based on the contents of the dataset. ### Your contribution I'm willing to work on a PR with guidence. I would like this also as I have been working with a dataset with hierarchical classes. In fact, I encountered this very issue when trying to define the dataset with a script. I couldn't find a work around and reverted to hard coding the class names in the readme yaml. @david-waterworth do you envision also being able to define the hierarchical structure of the classes?
[ -0.23057903349399567, 0.43088358640670776, 0.06760111451148987, 0.6072050333023071, 0.2155102789402008, 0.08691208809614182, 0.3997461199760437, 0.3549935221672058, 0.2451525330543518, 0.1859813779592514, -0.130423441529274, 0.39898958802223206, -0.254896342754364, 0.10869807749986649, 0.18760795891284943, 0.12914979457855225, -0.09684178978204727, 0.00358416885137558, 0.10065644234418869, -0.01689455658197403, -0.3099740147590637, 0.0452151894569397, 0.12456320226192474, 0.16742408275604248, -0.4248066544532776, 0.09734290838241577, -0.003389241173863411, 0.37423110008239746, -0.21767012774944305, -0.5119655728340149, 0.30092838406562805, 0.2814905345439911, 0.21640807390213013, 0.21412000060081482, -0.00012094969861209393, 0.026777833700180054, 0.11155667901039124, -0.18140809237957, -0.3819776475429535, -0.20960833132266998, -0.30738207697868347, -0.23744738101959229, -0.05069659650325775, -0.34473735094070435, 0.00960063561797142, -0.17893272638320923, 0.08573068678379059, -0.05516983941197395, 0.05090627819299698, 0.06828495115041733, 0.07729168236255646, -0.1734102964401245, 0.05906743183732033, -0.17704720795154572, 0.49654120206832886, -0.02813420444726944, -0.029353903606534004, 0.28565454483032227, 0.3563497066497803, -0.10694184899330139, 0.10804405808448792, 0.3096383213996887, -0.09403646737337112, -0.3813200294971466, 0.5842485427856445, 0.019077030941843987, 0.5597437620162964, -0.4182142913341522, 0.12306379526853561, 0.3218383193016052, 0.5154881477355957, -0.22368356585502625, -0.5705039501190186, -0.5428787469863892, 0.11864123493432999, -0.23023943603038788, 0.16599330306053162, -0.05121437460184097, -0.2807352840900421, 0.16740654408931732, 0.06485076993703842, -0.5150917768478394, -0.029975857585668564, -0.12385056912899017, -0.1078815758228302, 0.33461809158325195, -0.08439242094755173, -0.08012085407972336, 0.32334086298942566, 0.07583989202976227, 0.07088026404380798, -0.1327257752418518, -0.2222830355167389, 0.45999065041542053, -0.24319256842136383, -0.03661099821329117, 0.024863384664058685, 0.10325469821691513, 0.16924387216567993, 0.050778262317180634, -0.04260161146521568, -0.0795261561870575, -0.29334455728530884, 0.26617953181266785, 0.27104660868644714, 0.1915261298418045, 0.4738948941230774, 0.13777348399162292, 0.10895168781280518, -0.048146482557058334, -0.22079059481620789, -0.022383589297533035, -0.7501751780509949, -0.14485333859920502, 0.2764033079147339, 0.09306849539279938, -0.3093213438987732, -0.27066996693611145, 0.045430541038513184, -0.09158904105424881, -0.209360271692276, 0.006479915697127581, 0.33186036348342896, 0.4980998635292053, 0.028841204941272736, 0.20848703384399414, 0.07270051538944244, -0.011280294507741928, 0.16957160830497742, -0.46325066685676575, 0.06886602193117142, 0.0015494544059038162, -0.22554641962051392, 0.15588150918483734, 0.11265116930007935, -0.11427806317806244, 0.2758852541446686, -0.1566983461380005, -0.008628733456134796, -0.16960409283638, -0.032699137926101685, 0.00907127559185028, 0.1433110535144806, 0.2161833643913269, -0.1425723284482956, -0.015734044834971428, 0.16841140389442444, -0.5957471132278442, -0.38815194368362427, 0.11118650436401367, -0.29327139258384705, -0.2536139190196991, 0.13965855538845062, 0.07016085088253021, 0.05011467635631561, 0.19912783801555634, -0.5986013412475586, 0.10632704198360443, 0.12296755611896515, -0.18622036278247833, -0.09555160254240036, -0.2490169256925583, 0.045407939702272415, -0.09845267981290817, 0.08582441508769989, 0.4090333580970764, -0.43880951404571533, -0.36289384961128235, -0.05431399121880531, -0.0421195887029171, 0.10651553422212601, 0.01884830743074417, -0.2256479263305664, 0.35316386818885803, -0.026082541793584824, -0.16190269589424133, 0.7248156070709229, -0.299510657787323, -0.15883712470531464, 0.2892078757286072, -0.04625023901462555, 0.05827956646680832, 0.3691229820251465, 0.20734335482120514, 0.1323593556880951, -0.15027979016304016, 0.2407822608947754, 0.14115390181541443, 0.050419919192790985, -0.12371458113193512, 0.1823086440563202, -0.06391096115112305, -0.338492751121521, 0.43445026874542236, 0.05561532825231552, 0.17037750780582428, 0.04371605068445206, 0.11477065831422806, 0.1631583273410797, -0.33761101961135864, 0.13882729411125183, 0.28314799070358276, -0.22308818995952606, 0.4081224203109741, 0.03798137232661247, -0.08669659495353699, -0.3266933262348175, 0.4221542477607727, -0.054470133036375046, -0.0797346979379654, -0.21174956858158112, -0.33408254384994507, 0.12374953180551529, 0.19988621771335602, -0.12821558117866516, 0.0018350891768932343, -0.07578377425670624, 0.11614702641963959, -0.11176754534244537, -0.3162861168384552, -0.31166407465934753, -0.0956229567527771, -0.279066801071167, 0.27092525362968445, -0.1259661167860031, -0.2694986164569855, 0.33619749546051025, 0.24937862157821655, -0.14243409037590027, -0.00023658573627471924, -0.03523784130811691, -0.0726415291428566, 0.13301900029182434, 0.1631549596786499, 0.3635256290435791, -0.4023783206939697, -0.1090250089764595, 0.33309897780418396, 0.0843406617641449, 0.17135576903820038, -0.09798043221235275, -0.20418056845664978, 0.14792610704898834, -0.1627536416053772, -0.1733807623386383, 0.4024882912635803, 0.04414018988609314, 0.44147157669067383, 0.12858417630195618, -0.002501828595995903, 0.2152206003665924, 0.036731820553541183, -0.15476389229297638, 0.05096126347780228, -0.025896865874528885, -0.10691964626312256, 0.26903262734413147, 0.16609404981136322, -0.18941831588745117, 0.09698601812124252, 0.38496944308280945, -0.09684088826179504, -0.10094957798719406, -0.10162346810102463, -0.25226926803588867, 0.2574938237667084, -0.06350456178188324, 0.42067059874534607, 0.014570221304893494, 0.14424018561840057, 0.20556561648845673, -0.03995846211910248, 0.16149841248989105, -0.0020295195281505585, 0.2783086597919464, -0.020464688539505005, 0.14944469928741455, -0.04680846631526947, -0.17669305205345154, 0.0332091748714447, -0.07733134925365448, -0.4296296238899231, 0.030595576390624046, -0.14467011392116547, -0.2241975963115692, 0.23593522608280182, 0.05479297786951065, -0.2729986310005188, -0.09531725198030472, -0.1246739849448204, -0.29722481966018677, -0.1426873505115509, -0.07585594058036804, 0.13955847918987274, 0.01543385162949562, 0.02355842851102352, 0.12942905724048615, 0.2185821682214737, -0.04015449061989784, -0.375205397605896, 0.0807066410779953, -0.3492937386035919, -0.0068870000541210175, -0.06549274176359177, 0.2121163308620453, -0.3485089838504791, 0.12338604778051376, -0.13141047954559326, -0.09286938607692719, -0.15705515444278717, -0.12323464453220367, 0.2509828805923462, 0.05748362094163895, 0.03580070286989212, 0.167741060256958, -0.2276201993227005, 0.0007205978035926819, 0.05045715719461441, 0.12256000190973282, 0.045992255210876465, -0.04060690104961395, -0.2843438982963562, 0.16435180604457855, -0.1920766532421112, -0.23563723266124725, 0.009741626679897308, -0.3718142807483673, -0.31799668073654175, 0.31804853677749634, 0.291228711605072, 0.24891258776187897, 0.15215665102005005, -0.3750404417514801, 0.14668139815330505, 0.03491706773638725, 0.20747461915016174, 0.11520320177078247, -0.37241384387016296, 0.2585522532463074, -0.18922215700149536, -0.0329236201941967, 0.12253142893314362, -0.07268975675106049, 0.2225579172372818, 0.13411563634872437, -0.22876496613025665, 0.09535323083400726, 0.18625463545322418, 0.11904223263263702, 0.0655163899064064, 0.3312780559062958, 0.018368877470493317, 0.4670288860797882, 0.0673646330833435, -0.10704052448272705, 0.11873042583465576, 0.08116069436073303, -0.1818515658378601, 0.12848499417304993, 0.10980807989835739, 0.2252335548400879, -0.13108350336551666, 0.6988933682441711, 0.014163203537464142, 0.18085342645645142, 0.006848860532045364, -0.0965607538819313, 0.197904571890831, -0.00937923789024353, -0.1816515177488327, -0.38123592734336853, -0.1656501591205597, -0.1918162852525711, 0.23359990119934082, 0.08900412172079086, -0.07531542330980301, -0.25777769088745117, 0.2158890962600708, 0.029540590941905975, -0.13886769115924835, 0.03422616422176361, -0.07726594060659409, 0.22355812788009644, -0.013476574793457985, 0.24314460158348083, -0.3469444513320923, 0.145944744348526, 0.07702840864658356, 0.19855809211730957, 0.298920214176178, -0.05143836513161659, -0.2772437334060669, -0.2124442160129547, -0.3087732791900635, -0.03395162522792816, 0.23795996606349945, -0.29868918657302856, -0.08558755367994308, 0.11834263056516647, -0.08353982865810394, 0.012613765895366669, 0.5330385565757751, -0.20070885121822357, 0.3335912227630615, 0.4303818643093109, -0.3583923876285553, 0.09758993983268738, 0.23932434618473053, -0.09591089189052582, -0.024415597319602966, 0.21104243397712708, 0.18591049313545227, -0.3010775148868561, -0.17140638828277588, -0.10224305093288422, -0.040304359048604965, -0.264446496963501, -0.05295109376311302, 0.07162640988826752, 0.016087427735328674, -0.18834322690963745, -0.17405924201011658, 0.13957753777503967, 0.2615107297897339, -0.017876891419291496, 0.27210095524787903, -0.13433125615119934, 0.3442680239677429, 0.4137439727783203, 0.23420172929763794, -0.01603022962808609, 0.22925865650177002, 0.06562522053718567, 0.20096372067928314, 0.48569414019584656, 0.30236566066741943, 0.7190078496932983, -0.005359984934329987, -0.6194478869438171, -0.11564639955759048, 0.0933130607008934, 0.5773990154266357, 0.28053730726242065, -0.1508297324180603, -0.028207696974277496, -0.23585370182991028, -0.09150883555412292, -0.23047447204589844, 0.1445738524198532, -0.02713879384100437, -0.010012057609856129, -0.4424048960208893, -0.7926709055900574, 0.8134676814079285, 0.19302158057689667, -0.27180784940719604, 0.16241422295570374, -0.05445803701877594, -0.5367110371589661, 0.11537767946720123, 0.0496702566742897, 0.7724859714508057, -0.17055824398994446, 0.2526921331882477, 0.08456023037433624, 0.21760474145412445, 0.7103065252304077, -0.1631830334663391, 0.15510423481464386, -0.4428158104419708, -0.2895817160606384, -0.16594792902469635, -0.04565071687102318, -0.15138506889343262, 0.5537253618240356, 0.12941573560237885, 0.38675829768180847, -0.004340417683124542, -0.13544726371765137, 0.17767201364040375, 0.016994334757328033, -0.008405651897192001, -0.5843508243560791, -0.38940414786338806, -0.01274239830672741, 0.1399863362312317, 0.22274942696094513, -0.161436527967453, -0.16799356043338776, -0.10964173823595047, 0.11029066145420074, 0.06792010366916656, 0.19064384698867798, -0.28008341789245605, -0.002172432839870453, -0.005241021513938904, 0.2981126308441162, 0.23550233244895935, 0.3058570623397827, 0.20247580111026764, 0.1749832034111023, -0.009150145575404167, 0.2774841785430908, -0.07917997986078262, 0.16729804873466492, 0.18057581782341003, 0.20822760462760925, 0.43520575761795044, 0.2332027554512024, 0.20114624500274658, 0.21211671829223633, -0.3110821843147278, -0.2138625830411911, -0.03681083768606186, -0.2087080031633377, 0.1962302327156067, 0.011063028126955032, -0.021727997809648514, -0.02950330078601837, -0.07508228719234467, -0.031084444373846054, 0.025682179257273674, 0.02856401726603508, -0.3534712493419647, -0.14497756958007812, -0.12454313039779663, -0.22479061782360077, 0.11994947493076324, 0.34281110763549805, -0.20127084851264954, 0.3792208135128021, 0.2977212965488434, 0.048370759934186935, -0.0040598064661026, -0.10413162410259247, 0.2692692279815674, 0.33375096321105957, -0.34184420108795166, 0.13028168678283691, 0.2602939009666443, -0.194471538066864, 0.1401575654745102, 0.222694993019104, 0.3301812410354614, -0.07178197056055069, -0.1461532860994339, -0.3044144809246063, -0.1713048666715622, 0.19605407118797302, -0.09134343266487122, 0.14313337206840515, -0.03404383733868599, -0.2528286278247833, -0.4823305904865265, -0.015675438567996025, -0.20448072254657745, -0.10790404677391052, -0.20174607634544373, 0.03722459822893143, 0.2648034691810608, 0.3273879885673523, 0.16363191604614258, 0.10669505596160889, -0.010567077435553074, -0.22019053995609283, -0.08219657093286514, -0.033509884029626846, -0.20341555774211884, 0.20980729162693024, 0.018336966633796692, 0.34391897916793823, 0.012329869903624058, -0.2456592470407486, -0.2595597505569458, -0.30991560220718384, 0.47432321310043335, -0.23223155736923218, 0.022721368819475174, 0.1693558543920517, -0.07942888140678406, 0.14985160529613495, -0.46601706743240356, 0.5615052580833435, 0.17085346579551697, 0.2478143721818924, -0.2033131867647171, 0.17121654748916626, -0.336261123418808, -0.1015458032488823, -0.06418053805828094, 0.3043285310268402, -0.07003791630268097, -0.3293599486351013, 0.7536719441413879, -0.162875697016716, 0.39946937561035156, 0.4526086151599884, 0.19732636213302612, 0.2702872157096863, 0.0093837296590209, 0.3759400546550751, 0.22556447982788086, 0.052709490060806274, -0.17338207364082336, -0.24295639991760254, 0.05400634557008743, -0.30697113275527954, 0.0027811750769615173, 0.5167113542556763, -0.0020060166716575623, -0.07191944122314453, -0.18391932547092438, -0.23781579732894897, 0.16988584399223328, 0.08642568439245224, -0.060158293694257736, 0.7760298848152161, 0.19625885784626007, 0.29623791575431824, 0.4942864179611206, 0.6024806499481201, 0.4076550602912903, 0.5740909576416016, 0.0048075467348098755, 0.19695141911506653, 0.06551426649093628, 0.09404824674129486, 0.04177171364426613, -0.27041739225387573, -0.16198581457138062, 0.412505567073822, 0.14593705534934998, 0.18766039609909058, -0.4154452085494995, -0.08253061026334763, -0.47711798548698425, -0.2025306224822998, 0.008777448907494545, 0.31447941064834595, 0.030379951000213623, -0.1632109135389328, -0.2972318232059479, -0.2559393048286438, -0.20298327505588531, 0.057438161224126816, -0.15679574012756348, -0.2951500415802002, -0.21572571992874146, -0.01556466519832611, 0.35776233673095703, -0.08335475623607635, -0.3795323371887207, 0.023783329874277115, 0.3324580490589142, -0.4619421362876892, -0.023492882028222084, -0.3914462924003601, 0.225563183426857, 0.28463730216026306, 0.001300344243645668, 0.11582349240779877, 0.22113265097141266, 0.04159752279520035, -0.3252652883529663, -0.2249550074338913, -0.11137601733207703, -0.14734351634979248, 0.0017964188009500504, -0.14234846830368042, -0.22866319119930267, 0.34180110692977905, -0.07372593134641647, -0.021768439561128616, -0.3034582734107971, 0.009879227727651596, 0.12010808289051056, 0.10669633746147156, 0.610139787197113, 0.051192089915275574, -0.2745372951030731, -0.07973870635032654, 0.05762768164277077, -0.18824559450149536, -0.2655468285083771, 0.3930310010910034, 0.12174571305513382, 0.184202641248703, 0.12325119227170944, 0.03475024923682213, -0.11789493262767792, 0.4059997797012329, 0.32273241877555847, -0.216406911611557, -0.040512815117836, -0.04355216398835182, -0.5403915643692017, -0.18537849187850952, 0.08043704926967621, -0.49876412749290466, 0.37588444352149963, -0.10934461653232574, 0.331632137298584, 0.05989467352628708, -0.28272926807403564, -0.29899635910987854, 0.3287186324596405, 0.017269868403673172, -0.2398764044046402, -0.32114315032958984, 0.151347815990448, 0.2177094668149948, -0.03717837482690811, -0.4682859182357788, 0.10547783970832825, -0.48702409863471985, -0.15907911956310272, 0.12485600262880325, 0.2629503309726715, 0.09932729601860046, 0.015347544103860855, 0.40161770582199097, -0.2877916991710663, 0.3399282693862915, 0.08833365887403488, -0.10278691351413727, 0.12137921154499054, -0.20542125403881073, -0.05570955574512482, 0.30231931805610657, -0.12374673783779144, 0.38700371980667114, -0.1614195704460144, 0.16873568296432495, -0.26576757431030273, -0.11529140174388885, -0.018623298034071922, 0.07725095003843307, -0.4153369069099426, -0.04611030966043472, -0.45183736085891724, 0.2426767796278, 0.2971823513507843, 0.17604747414588928, -0.11787430942058563, -0.0393034964799881, -0.1610647588968277, -0.1243227943778038, 0.521449089050293, -0.216356098651886, -0.3528743386268616, 0.0009755785576999187, 0.032656192779541016, 0.12551778554916382, -0.09565509855747223, -0.017040006816387177, 0.10744417458772659, 0.3388504087924957, -0.19747740030288696, -0.51375812292099, -0.042870230972766876, -0.1871291846036911, 0.11870098114013672, -0.2278895527124405, -0.1811453104019165, -0.21796828508377075, -0.08631689846515656, -0.2516236901283264, -0.21771368384361267 ]
https://github.com/huggingface/datasets/issues/6059
Provide ability to load label mappings from file
@danielduckworth yes I did need to do that (but I ended up ditching datasets as it looks like this is a "wont fix").
### Feature request My task is classification of a dataset containing a large label set that includes a hierarchy. Even ignoring the hierarchy I'm not able to find an example using `datasets` where the label names aren't hard-coded. This works find for classification of a handful of labels but ideally there would be a way of loading the name/id mappings required for `datasets.features.ClassLabel` from a file. It is possible to pass a file to ClassLabel but I cannot see an easy way of using this with `GeneratorBasedBuilder` since `self._info` is called before the `dl_manager` is constructed so even if my dataset contains say `label_mappings.json` there's no way of loading it in order to construct the `datasets.DatasetInfo` I can see other uses to accessing the `download_manager` from `self._info` - i.e. if the files contain a schema (i.e. `arrow` or `parquet` files) the `datasets.DatasetInfo` could be inferred. The workaround that was suggested in the forum is to generate a `.py` file from the `label_mappings.json` and import it. ``` class TestDatasetBuilder(datasets.GeneratorBasedBuilder): VERSION = datasets.Version("1.0.0") def _info(self): return datasets.DatasetInfo( description=_DESCRIPTION, features=datasets.Features( { "text": datasets.Value("string"), "label": datasets.features.ClassLabel(names=["label_1", "label_2"]), } ), task_templates=[TextClassification(text_column="text", label_column="label")], ) def _split_generators(self, dl_manager): train_path = dl_manager.download_and_extract(_TRAIN_DOWNLOAD_URL) test_path = dl_manager.download_and_extract(_TEST_DOWNLOAD_URL) return [ datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"filepath": train_path}), datasets.SplitGenerator(name=datasets.Split.TEST, gen_kwargs={"filepath": test_path}), ] def _generate_examples(self, filepath): """Generate AG News examples.""" with open(filepath, encoding="utf-8") as csv_file: csv_reader = csv.DictReader(csv_file) for id_, row in enumerate(csv_reader): yield id_, row ``` ### Motivation Allow `datasets.DatasetInfo` to be generated based on the contents of the dataset. ### Your contribution I'm willing to work on a PR with guidence.
23
Provide ability to load label mappings from file ### Feature request My task is classification of a dataset containing a large label set that includes a hierarchy. Even ignoring the hierarchy I'm not able to find an example using `datasets` where the label names aren't hard-coded. This works find for classification of a handful of labels but ideally there would be a way of loading the name/id mappings required for `datasets.features.ClassLabel` from a file. It is possible to pass a file to ClassLabel but I cannot see an easy way of using this with `GeneratorBasedBuilder` since `self._info` is called before the `dl_manager` is constructed so even if my dataset contains say `label_mappings.json` there's no way of loading it in order to construct the `datasets.DatasetInfo` I can see other uses to accessing the `download_manager` from `self._info` - i.e. if the files contain a schema (i.e. `arrow` or `parquet` files) the `datasets.DatasetInfo` could be inferred. The workaround that was suggested in the forum is to generate a `.py` file from the `label_mappings.json` and import it. ``` class TestDatasetBuilder(datasets.GeneratorBasedBuilder): VERSION = datasets.Version("1.0.0") def _info(self): return datasets.DatasetInfo( description=_DESCRIPTION, features=datasets.Features( { "text": datasets.Value("string"), "label": datasets.features.ClassLabel(names=["label_1", "label_2"]), } ), task_templates=[TextClassification(text_column="text", label_column="label")], ) def _split_generators(self, dl_manager): train_path = dl_manager.download_and_extract(_TRAIN_DOWNLOAD_URL) test_path = dl_manager.download_and_extract(_TEST_DOWNLOAD_URL) return [ datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"filepath": train_path}), datasets.SplitGenerator(name=datasets.Split.TEST, gen_kwargs={"filepath": test_path}), ] def _generate_examples(self, filepath): """Generate AG News examples.""" with open(filepath, encoding="utf-8") as csv_file: csv_reader = csv.DictReader(csv_file) for id_, row in enumerate(csv_reader): yield id_, row ``` ### Motivation Allow `datasets.DatasetInfo` to be generated based on the contents of the dataset. ### Your contribution I'm willing to work on a PR with guidence. @danielduckworth yes I did need to do that (but I ended up ditching datasets as it looks like this is a "wont fix").
[ -0.23057903349399567, 0.43088358640670776, 0.06760111451148987, 0.6072050333023071, 0.2155102789402008, 0.08691208809614182, 0.3997461199760437, 0.3549935221672058, 0.2451525330543518, 0.1859813779592514, -0.130423441529274, 0.39898958802223206, -0.254896342754364, 0.10869807749986649, 0.18760795891284943, 0.12914979457855225, -0.09684178978204727, 0.00358416885137558, 0.10065644234418869, -0.01689455658197403, -0.3099740147590637, 0.0452151894569397, 0.12456320226192474, 0.16742408275604248, -0.4248066544532776, 0.09734290838241577, -0.003389241173863411, 0.37423110008239746, -0.21767012774944305, -0.5119655728340149, 0.30092838406562805, 0.2814905345439911, 0.21640807390213013, 0.21412000060081482, -0.00012094969861209393, 0.026777833700180054, 0.11155667901039124, -0.18140809237957, -0.3819776475429535, -0.20960833132266998, -0.30738207697868347, -0.23744738101959229, -0.05069659650325775, -0.34473735094070435, 0.00960063561797142, -0.17893272638320923, 0.08573068678379059, -0.05516983941197395, 0.05090627819299698, 0.06828495115041733, 0.07729168236255646, -0.1734102964401245, 0.05906743183732033, -0.17704720795154572, 0.49654120206832886, -0.02813420444726944, -0.029353903606534004, 0.28565454483032227, 0.3563497066497803, -0.10694184899330139, 0.10804405808448792, 0.3096383213996887, -0.09403646737337112, -0.3813200294971466, 0.5842485427856445, 0.019077030941843987, 0.5597437620162964, -0.4182142913341522, 0.12306379526853561, 0.3218383193016052, 0.5154881477355957, -0.22368356585502625, -0.5705039501190186, -0.5428787469863892, 0.11864123493432999, -0.23023943603038788, 0.16599330306053162, -0.05121437460184097, -0.2807352840900421, 0.16740654408931732, 0.06485076993703842, -0.5150917768478394, -0.029975857585668564, -0.12385056912899017, -0.1078815758228302, 0.33461809158325195, -0.08439242094755173, -0.08012085407972336, 0.32334086298942566, 0.07583989202976227, 0.07088026404380798, -0.1327257752418518, -0.2222830355167389, 0.45999065041542053, -0.24319256842136383, -0.03661099821329117, 0.024863384664058685, 0.10325469821691513, 0.16924387216567993, 0.050778262317180634, -0.04260161146521568, -0.0795261561870575, -0.29334455728530884, 0.26617953181266785, 0.27104660868644714, 0.1915261298418045, 0.4738948941230774, 0.13777348399162292, 0.10895168781280518, -0.048146482557058334, -0.22079059481620789, -0.022383589297533035, -0.7501751780509949, -0.14485333859920502, 0.2764033079147339, 0.09306849539279938, -0.3093213438987732, -0.27066996693611145, 0.045430541038513184, -0.09158904105424881, -0.209360271692276, 0.006479915697127581, 0.33186036348342896, 0.4980998635292053, 0.028841204941272736, 0.20848703384399414, 0.07270051538944244, -0.011280294507741928, 0.16957160830497742, -0.46325066685676575, 0.06886602193117142, 0.0015494544059038162, -0.22554641962051392, 0.15588150918483734, 0.11265116930007935, -0.11427806317806244, 0.2758852541446686, -0.1566983461380005, -0.008628733456134796, -0.16960409283638, -0.032699137926101685, 0.00907127559185028, 0.1433110535144806, 0.2161833643913269, -0.1425723284482956, -0.015734044834971428, 0.16841140389442444, -0.5957471132278442, -0.38815194368362427, 0.11118650436401367, -0.29327139258384705, -0.2536139190196991, 0.13965855538845062, 0.07016085088253021, 0.05011467635631561, 0.19912783801555634, -0.5986013412475586, 0.10632704198360443, 0.12296755611896515, -0.18622036278247833, -0.09555160254240036, -0.2490169256925583, 0.045407939702272415, -0.09845267981290817, 0.08582441508769989, 0.4090333580970764, -0.43880951404571533, -0.36289384961128235, -0.05431399121880531, -0.0421195887029171, 0.10651553422212601, 0.01884830743074417, -0.2256479263305664, 0.35316386818885803, -0.026082541793584824, -0.16190269589424133, 0.7248156070709229, -0.299510657787323, -0.15883712470531464, 0.2892078757286072, -0.04625023901462555, 0.05827956646680832, 0.3691229820251465, 0.20734335482120514, 0.1323593556880951, -0.15027979016304016, 0.2407822608947754, 0.14115390181541443, 0.050419919192790985, -0.12371458113193512, 0.1823086440563202, -0.06391096115112305, -0.338492751121521, 0.43445026874542236, 0.05561532825231552, 0.17037750780582428, 0.04371605068445206, 0.11477065831422806, 0.1631583273410797, -0.33761101961135864, 0.13882729411125183, 0.28314799070358276, -0.22308818995952606, 0.4081224203109741, 0.03798137232661247, -0.08669659495353699, -0.3266933262348175, 0.4221542477607727, -0.054470133036375046, -0.0797346979379654, -0.21174956858158112, -0.33408254384994507, 0.12374953180551529, 0.19988621771335602, -0.12821558117866516, 0.0018350891768932343, -0.07578377425670624, 0.11614702641963959, -0.11176754534244537, -0.3162861168384552, -0.31166407465934753, -0.0956229567527771, -0.279066801071167, 0.27092525362968445, -0.1259661167860031, -0.2694986164569855, 0.33619749546051025, 0.24937862157821655, -0.14243409037590027, -0.00023658573627471924, -0.03523784130811691, -0.0726415291428566, 0.13301900029182434, 0.1631549596786499, 0.3635256290435791, -0.4023783206939697, -0.1090250089764595, 0.33309897780418396, 0.0843406617641449, 0.17135576903820038, -0.09798043221235275, -0.20418056845664978, 0.14792610704898834, -0.1627536416053772, -0.1733807623386383, 0.4024882912635803, 0.04414018988609314, 0.44147157669067383, 0.12858417630195618, -0.002501828595995903, 0.2152206003665924, 0.036731820553541183, -0.15476389229297638, 0.05096126347780228, -0.025896865874528885, -0.10691964626312256, 0.26903262734413147, 0.16609404981136322, -0.18941831588745117, 0.09698601812124252, 0.38496944308280945, -0.09684088826179504, -0.10094957798719406, -0.10162346810102463, -0.25226926803588867, 0.2574938237667084, -0.06350456178188324, 0.42067059874534607, 0.014570221304893494, 0.14424018561840057, 0.20556561648845673, -0.03995846211910248, 0.16149841248989105, -0.0020295195281505585, 0.2783086597919464, -0.020464688539505005, 0.14944469928741455, -0.04680846631526947, -0.17669305205345154, 0.0332091748714447, -0.07733134925365448, -0.4296296238899231, 0.030595576390624046, -0.14467011392116547, -0.2241975963115692, 0.23593522608280182, 0.05479297786951065, -0.2729986310005188, -0.09531725198030472, -0.1246739849448204, -0.29722481966018677, -0.1426873505115509, -0.07585594058036804, 0.13955847918987274, 0.01543385162949562, 0.02355842851102352, 0.12942905724048615, 0.2185821682214737, -0.04015449061989784, -0.375205397605896, 0.0807066410779953, -0.3492937386035919, -0.0068870000541210175, -0.06549274176359177, 0.2121163308620453, -0.3485089838504791, 0.12338604778051376, -0.13141047954559326, -0.09286938607692719, -0.15705515444278717, -0.12323464453220367, 0.2509828805923462, 0.05748362094163895, 0.03580070286989212, 0.167741060256958, -0.2276201993227005, 0.0007205978035926819, 0.05045715719461441, 0.12256000190973282, 0.045992255210876465, -0.04060690104961395, -0.2843438982963562, 0.16435180604457855, -0.1920766532421112, -0.23563723266124725, 0.009741626679897308, -0.3718142807483673, -0.31799668073654175, 0.31804853677749634, 0.291228711605072, 0.24891258776187897, 0.15215665102005005, -0.3750404417514801, 0.14668139815330505, 0.03491706773638725, 0.20747461915016174, 0.11520320177078247, -0.37241384387016296, 0.2585522532463074, -0.18922215700149536, -0.0329236201941967, 0.12253142893314362, -0.07268975675106049, 0.2225579172372818, 0.13411563634872437, -0.22876496613025665, 0.09535323083400726, 0.18625463545322418, 0.11904223263263702, 0.0655163899064064, 0.3312780559062958, 0.018368877470493317, 0.4670288860797882, 0.0673646330833435, -0.10704052448272705, 0.11873042583465576, 0.08116069436073303, -0.1818515658378601, 0.12848499417304993, 0.10980807989835739, 0.2252335548400879, -0.13108350336551666, 0.6988933682441711, 0.014163203537464142, 0.18085342645645142, 0.006848860532045364, -0.0965607538819313, 0.197904571890831, -0.00937923789024353, -0.1816515177488327, -0.38123592734336853, -0.1656501591205597, -0.1918162852525711, 0.23359990119934082, 0.08900412172079086, -0.07531542330980301, -0.25777769088745117, 0.2158890962600708, 0.029540590941905975, -0.13886769115924835, 0.03422616422176361, -0.07726594060659409, 0.22355812788009644, -0.013476574793457985, 0.24314460158348083, -0.3469444513320923, 0.145944744348526, 0.07702840864658356, 0.19855809211730957, 0.298920214176178, -0.05143836513161659, -0.2772437334060669, -0.2124442160129547, -0.3087732791900635, -0.03395162522792816, 0.23795996606349945, -0.29868918657302856, -0.08558755367994308, 0.11834263056516647, -0.08353982865810394, 0.012613765895366669, 0.5330385565757751, -0.20070885121822357, 0.3335912227630615, 0.4303818643093109, -0.3583923876285553, 0.09758993983268738, 0.23932434618473053, -0.09591089189052582, -0.024415597319602966, 0.21104243397712708, 0.18591049313545227, -0.3010775148868561, -0.17140638828277588, -0.10224305093288422, -0.040304359048604965, -0.264446496963501, -0.05295109376311302, 0.07162640988826752, 0.016087427735328674, -0.18834322690963745, -0.17405924201011658, 0.13957753777503967, 0.2615107297897339, -0.017876891419291496, 0.27210095524787903, -0.13433125615119934, 0.3442680239677429, 0.4137439727783203, 0.23420172929763794, -0.01603022962808609, 0.22925865650177002, 0.06562522053718567, 0.20096372067928314, 0.48569414019584656, 0.30236566066741943, 0.7190078496932983, -0.005359984934329987, -0.6194478869438171, -0.11564639955759048, 0.0933130607008934, 0.5773990154266357, 0.28053730726242065, -0.1508297324180603, -0.028207696974277496, -0.23585370182991028, -0.09150883555412292, -0.23047447204589844, 0.1445738524198532, -0.02713879384100437, -0.010012057609856129, -0.4424048960208893, -0.7926709055900574, 0.8134676814079285, 0.19302158057689667, -0.27180784940719604, 0.16241422295570374, -0.05445803701877594, -0.5367110371589661, 0.11537767946720123, 0.0496702566742897, 0.7724859714508057, -0.17055824398994446, 0.2526921331882477, 0.08456023037433624, 0.21760474145412445, 0.7103065252304077, -0.1631830334663391, 0.15510423481464386, -0.4428158104419708, -0.2895817160606384, -0.16594792902469635, -0.04565071687102318, -0.15138506889343262, 0.5537253618240356, 0.12941573560237885, 0.38675829768180847, -0.004340417683124542, -0.13544726371765137, 0.17767201364040375, 0.016994334757328033, -0.008405651897192001, -0.5843508243560791, -0.38940414786338806, -0.01274239830672741, 0.1399863362312317, 0.22274942696094513, -0.161436527967453, -0.16799356043338776, -0.10964173823595047, 0.11029066145420074, 0.06792010366916656, 0.19064384698867798, -0.28008341789245605, -0.002172432839870453, -0.005241021513938904, 0.2981126308441162, 0.23550233244895935, 0.3058570623397827, 0.20247580111026764, 0.1749832034111023, -0.009150145575404167, 0.2774841785430908, -0.07917997986078262, 0.16729804873466492, 0.18057581782341003, 0.20822760462760925, 0.43520575761795044, 0.2332027554512024, 0.20114624500274658, 0.21211671829223633, -0.3110821843147278, -0.2138625830411911, -0.03681083768606186, -0.2087080031633377, 0.1962302327156067, 0.011063028126955032, -0.021727997809648514, -0.02950330078601837, -0.07508228719234467, -0.031084444373846054, 0.025682179257273674, 0.02856401726603508, -0.3534712493419647, -0.14497756958007812, -0.12454313039779663, -0.22479061782360077, 0.11994947493076324, 0.34281110763549805, -0.20127084851264954, 0.3792208135128021, 0.2977212965488434, 0.048370759934186935, -0.0040598064661026, -0.10413162410259247, 0.2692692279815674, 0.33375096321105957, -0.34184420108795166, 0.13028168678283691, 0.2602939009666443, -0.194471538066864, 0.1401575654745102, 0.222694993019104, 0.3301812410354614, -0.07178197056055069, -0.1461532860994339, -0.3044144809246063, -0.1713048666715622, 0.19605407118797302, -0.09134343266487122, 0.14313337206840515, -0.03404383733868599, -0.2528286278247833, -0.4823305904865265, -0.015675438567996025, -0.20448072254657745, -0.10790404677391052, -0.20174607634544373, 0.03722459822893143, 0.2648034691810608, 0.3273879885673523, 0.16363191604614258, 0.10669505596160889, -0.010567077435553074, -0.22019053995609283, -0.08219657093286514, -0.033509884029626846, -0.20341555774211884, 0.20980729162693024, 0.018336966633796692, 0.34391897916793823, 0.012329869903624058, -0.2456592470407486, -0.2595597505569458, -0.30991560220718384, 0.47432321310043335, -0.23223155736923218, 0.022721368819475174, 0.1693558543920517, -0.07942888140678406, 0.14985160529613495, -0.46601706743240356, 0.5615052580833435, 0.17085346579551697, 0.2478143721818924, -0.2033131867647171, 0.17121654748916626, -0.336261123418808, -0.1015458032488823, -0.06418053805828094, 0.3043285310268402, -0.07003791630268097, -0.3293599486351013, 0.7536719441413879, -0.162875697016716, 0.39946937561035156, 0.4526086151599884, 0.19732636213302612, 0.2702872157096863, 0.0093837296590209, 0.3759400546550751, 0.22556447982788086, 0.052709490060806274, -0.17338207364082336, -0.24295639991760254, 0.05400634557008743, -0.30697113275527954, 0.0027811750769615173, 0.5167113542556763, -0.0020060166716575623, -0.07191944122314453, -0.18391932547092438, -0.23781579732894897, 0.16988584399223328, 0.08642568439245224, -0.060158293694257736, 0.7760298848152161, 0.19625885784626007, 0.29623791575431824, 0.4942864179611206, 0.6024806499481201, 0.4076550602912903, 0.5740909576416016, 0.0048075467348098755, 0.19695141911506653, 0.06551426649093628, 0.09404824674129486, 0.04177171364426613, -0.27041739225387573, -0.16198581457138062, 0.412505567073822, 0.14593705534934998, 0.18766039609909058, -0.4154452085494995, -0.08253061026334763, -0.47711798548698425, -0.2025306224822998, 0.008777448907494545, 0.31447941064834595, 0.030379951000213623, -0.1632109135389328, -0.2972318232059479, -0.2559393048286438, -0.20298327505588531, 0.057438161224126816, -0.15679574012756348, -0.2951500415802002, -0.21572571992874146, -0.01556466519832611, 0.35776233673095703, -0.08335475623607635, -0.3795323371887207, 0.023783329874277115, 0.3324580490589142, -0.4619421362876892, -0.023492882028222084, -0.3914462924003601, 0.225563183426857, 0.28463730216026306, 0.001300344243645668, 0.11582349240779877, 0.22113265097141266, 0.04159752279520035, -0.3252652883529663, -0.2249550074338913, -0.11137601733207703, -0.14734351634979248, 0.0017964188009500504, -0.14234846830368042, -0.22866319119930267, 0.34180110692977905, -0.07372593134641647, -0.021768439561128616, -0.3034582734107971, 0.009879227727651596, 0.12010808289051056, 0.10669633746147156, 0.610139787197113, 0.051192089915275574, -0.2745372951030731, -0.07973870635032654, 0.05762768164277077, -0.18824559450149536, -0.2655468285083771, 0.3930310010910034, 0.12174571305513382, 0.184202641248703, 0.12325119227170944, 0.03475024923682213, -0.11789493262767792, 0.4059997797012329, 0.32273241877555847, -0.216406911611557, -0.040512815117836, -0.04355216398835182, -0.5403915643692017, -0.18537849187850952, 0.08043704926967621, -0.49876412749290466, 0.37588444352149963, -0.10934461653232574, 0.331632137298584, 0.05989467352628708, -0.28272926807403564, -0.29899635910987854, 0.3287186324596405, 0.017269868403673172, -0.2398764044046402, -0.32114315032958984, 0.151347815990448, 0.2177094668149948, -0.03717837482690811, -0.4682859182357788, 0.10547783970832825, -0.48702409863471985, -0.15907911956310272, 0.12485600262880325, 0.2629503309726715, 0.09932729601860046, 0.015347544103860855, 0.40161770582199097, -0.2877916991710663, 0.3399282693862915, 0.08833365887403488, -0.10278691351413727, 0.12137921154499054, -0.20542125403881073, -0.05570955574512482, 0.30231931805610657, -0.12374673783779144, 0.38700371980667114, -0.1614195704460144, 0.16873568296432495, -0.26576757431030273, -0.11529140174388885, -0.018623298034071922, 0.07725095003843307, -0.4153369069099426, -0.04611030966043472, -0.45183736085891724, 0.2426767796278, 0.2971823513507843, 0.17604747414588928, -0.11787430942058563, -0.0393034964799881, -0.1610647588968277, -0.1243227943778038, 0.521449089050293, -0.216356098651886, -0.3528743386268616, 0.0009755785576999187, 0.032656192779541016, 0.12551778554916382, -0.09565509855747223, -0.017040006816387177, 0.10744417458772659, 0.3388504087924957, -0.19747740030288696, -0.51375812292099, -0.042870230972766876, -0.1871291846036911, 0.11870098114013672, -0.2278895527124405, -0.1811453104019165, -0.21796828508377075, -0.08631689846515656, -0.2516236901283264, -0.21771368384361267 ]
https://github.com/huggingface/datasets/issues/6059
Provide ability to load label mappings from file
@david-waterworth Hmm, that's a shame. What are you using now? Also, I’m curious to know about the work you’re doing that involves hierarchical classes, if you don’t mind sharing.
### Feature request My task is classification of a dataset containing a large label set that includes a hierarchy. Even ignoring the hierarchy I'm not able to find an example using `datasets` where the label names aren't hard-coded. This works find for classification of a handful of labels but ideally there would be a way of loading the name/id mappings required for `datasets.features.ClassLabel` from a file. It is possible to pass a file to ClassLabel but I cannot see an easy way of using this with `GeneratorBasedBuilder` since `self._info` is called before the `dl_manager` is constructed so even if my dataset contains say `label_mappings.json` there's no way of loading it in order to construct the `datasets.DatasetInfo` I can see other uses to accessing the `download_manager` from `self._info` - i.e. if the files contain a schema (i.e. `arrow` or `parquet` files) the `datasets.DatasetInfo` could be inferred. The workaround that was suggested in the forum is to generate a `.py` file from the `label_mappings.json` and import it. ``` class TestDatasetBuilder(datasets.GeneratorBasedBuilder): VERSION = datasets.Version("1.0.0") def _info(self): return datasets.DatasetInfo( description=_DESCRIPTION, features=datasets.Features( { "text": datasets.Value("string"), "label": datasets.features.ClassLabel(names=["label_1", "label_2"]), } ), task_templates=[TextClassification(text_column="text", label_column="label")], ) def _split_generators(self, dl_manager): train_path = dl_manager.download_and_extract(_TRAIN_DOWNLOAD_URL) test_path = dl_manager.download_and_extract(_TEST_DOWNLOAD_URL) return [ datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"filepath": train_path}), datasets.SplitGenerator(name=datasets.Split.TEST, gen_kwargs={"filepath": test_path}), ] def _generate_examples(self, filepath): """Generate AG News examples.""" with open(filepath, encoding="utf-8") as csv_file: csv_reader = csv.DictReader(csv_file) for id_, row in enumerate(csv_reader): yield id_, row ``` ### Motivation Allow `datasets.DatasetInfo` to be generated based on the contents of the dataset. ### Your contribution I'm willing to work on a PR with guidence.
29
Provide ability to load label mappings from file ### Feature request My task is classification of a dataset containing a large label set that includes a hierarchy. Even ignoring the hierarchy I'm not able to find an example using `datasets` where the label names aren't hard-coded. This works find for classification of a handful of labels but ideally there would be a way of loading the name/id mappings required for `datasets.features.ClassLabel` from a file. It is possible to pass a file to ClassLabel but I cannot see an easy way of using this with `GeneratorBasedBuilder` since `self._info` is called before the `dl_manager` is constructed so even if my dataset contains say `label_mappings.json` there's no way of loading it in order to construct the `datasets.DatasetInfo` I can see other uses to accessing the `download_manager` from `self._info` - i.e. if the files contain a schema (i.e. `arrow` or `parquet` files) the `datasets.DatasetInfo` could be inferred. The workaround that was suggested in the forum is to generate a `.py` file from the `label_mappings.json` and import it. ``` class TestDatasetBuilder(datasets.GeneratorBasedBuilder): VERSION = datasets.Version("1.0.0") def _info(self): return datasets.DatasetInfo( description=_DESCRIPTION, features=datasets.Features( { "text": datasets.Value("string"), "label": datasets.features.ClassLabel(names=["label_1", "label_2"]), } ), task_templates=[TextClassification(text_column="text", label_column="label")], ) def _split_generators(self, dl_manager): train_path = dl_manager.download_and_extract(_TRAIN_DOWNLOAD_URL) test_path = dl_manager.download_and_extract(_TEST_DOWNLOAD_URL) return [ datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"filepath": train_path}), datasets.SplitGenerator(name=datasets.Split.TEST, gen_kwargs={"filepath": test_path}), ] def _generate_examples(self, filepath): """Generate AG News examples.""" with open(filepath, encoding="utf-8") as csv_file: csv_reader = csv.DictReader(csv_file) for id_, row in enumerate(csv_reader): yield id_, row ``` ### Motivation Allow `datasets.DatasetInfo` to be generated based on the contents of the dataset. ### Your contribution I'm willing to work on a PR with guidence. @david-waterworth Hmm, that's a shame. What are you using now? Also, I’m curious to know about the work you’re doing that involves hierarchical classes, if you don’t mind sharing.
[ -0.23057903349399567, 0.43088358640670776, 0.06760111451148987, 0.6072050333023071, 0.2155102789402008, 0.08691208809614182, 0.3997461199760437, 0.3549935221672058, 0.2451525330543518, 0.1859813779592514, -0.130423441529274, 0.39898958802223206, -0.254896342754364, 0.10869807749986649, 0.18760795891284943, 0.12914979457855225, -0.09684178978204727, 0.00358416885137558, 0.10065644234418869, -0.01689455658197403, -0.3099740147590637, 0.0452151894569397, 0.12456320226192474, 0.16742408275604248, -0.4248066544532776, 0.09734290838241577, -0.003389241173863411, 0.37423110008239746, -0.21767012774944305, -0.5119655728340149, 0.30092838406562805, 0.2814905345439911, 0.21640807390213013, 0.21412000060081482, -0.00012094969861209393, 0.026777833700180054, 0.11155667901039124, -0.18140809237957, -0.3819776475429535, -0.20960833132266998, -0.30738207697868347, -0.23744738101959229, -0.05069659650325775, -0.34473735094070435, 0.00960063561797142, -0.17893272638320923, 0.08573068678379059, -0.05516983941197395, 0.05090627819299698, 0.06828495115041733, 0.07729168236255646, -0.1734102964401245, 0.05906743183732033, -0.17704720795154572, 0.49654120206832886, -0.02813420444726944, -0.029353903606534004, 0.28565454483032227, 0.3563497066497803, -0.10694184899330139, 0.10804405808448792, 0.3096383213996887, -0.09403646737337112, -0.3813200294971466, 0.5842485427856445, 0.019077030941843987, 0.5597437620162964, -0.4182142913341522, 0.12306379526853561, 0.3218383193016052, 0.5154881477355957, -0.22368356585502625, -0.5705039501190186, -0.5428787469863892, 0.11864123493432999, -0.23023943603038788, 0.16599330306053162, -0.05121437460184097, -0.2807352840900421, 0.16740654408931732, 0.06485076993703842, -0.5150917768478394, -0.029975857585668564, -0.12385056912899017, -0.1078815758228302, 0.33461809158325195, -0.08439242094755173, -0.08012085407972336, 0.32334086298942566, 0.07583989202976227, 0.07088026404380798, -0.1327257752418518, -0.2222830355167389, 0.45999065041542053, -0.24319256842136383, -0.03661099821329117, 0.024863384664058685, 0.10325469821691513, 0.16924387216567993, 0.050778262317180634, -0.04260161146521568, -0.0795261561870575, -0.29334455728530884, 0.26617953181266785, 0.27104660868644714, 0.1915261298418045, 0.4738948941230774, 0.13777348399162292, 0.10895168781280518, -0.048146482557058334, -0.22079059481620789, -0.022383589297533035, -0.7501751780509949, -0.14485333859920502, 0.2764033079147339, 0.09306849539279938, -0.3093213438987732, -0.27066996693611145, 0.045430541038513184, -0.09158904105424881, -0.209360271692276, 0.006479915697127581, 0.33186036348342896, 0.4980998635292053, 0.028841204941272736, 0.20848703384399414, 0.07270051538944244, -0.011280294507741928, 0.16957160830497742, -0.46325066685676575, 0.06886602193117142, 0.0015494544059038162, -0.22554641962051392, 0.15588150918483734, 0.11265116930007935, -0.11427806317806244, 0.2758852541446686, -0.1566983461380005, -0.008628733456134796, -0.16960409283638, -0.032699137926101685, 0.00907127559185028, 0.1433110535144806, 0.2161833643913269, -0.1425723284482956, -0.015734044834971428, 0.16841140389442444, -0.5957471132278442, -0.38815194368362427, 0.11118650436401367, -0.29327139258384705, -0.2536139190196991, 0.13965855538845062, 0.07016085088253021, 0.05011467635631561, 0.19912783801555634, -0.5986013412475586, 0.10632704198360443, 0.12296755611896515, -0.18622036278247833, -0.09555160254240036, -0.2490169256925583, 0.045407939702272415, -0.09845267981290817, 0.08582441508769989, 0.4090333580970764, -0.43880951404571533, -0.36289384961128235, -0.05431399121880531, -0.0421195887029171, 0.10651553422212601, 0.01884830743074417, -0.2256479263305664, 0.35316386818885803, -0.026082541793584824, -0.16190269589424133, 0.7248156070709229, -0.299510657787323, -0.15883712470531464, 0.2892078757286072, -0.04625023901462555, 0.05827956646680832, 0.3691229820251465, 0.20734335482120514, 0.1323593556880951, -0.15027979016304016, 0.2407822608947754, 0.14115390181541443, 0.050419919192790985, -0.12371458113193512, 0.1823086440563202, -0.06391096115112305, -0.338492751121521, 0.43445026874542236, 0.05561532825231552, 0.17037750780582428, 0.04371605068445206, 0.11477065831422806, 0.1631583273410797, -0.33761101961135864, 0.13882729411125183, 0.28314799070358276, -0.22308818995952606, 0.4081224203109741, 0.03798137232661247, -0.08669659495353699, -0.3266933262348175, 0.4221542477607727, -0.054470133036375046, -0.0797346979379654, -0.21174956858158112, -0.33408254384994507, 0.12374953180551529, 0.19988621771335602, -0.12821558117866516, 0.0018350891768932343, -0.07578377425670624, 0.11614702641963959, -0.11176754534244537, -0.3162861168384552, -0.31166407465934753, -0.0956229567527771, -0.279066801071167, 0.27092525362968445, -0.1259661167860031, -0.2694986164569855, 0.33619749546051025, 0.24937862157821655, -0.14243409037590027, -0.00023658573627471924, -0.03523784130811691, -0.0726415291428566, 0.13301900029182434, 0.1631549596786499, 0.3635256290435791, -0.4023783206939697, -0.1090250089764595, 0.33309897780418396, 0.0843406617641449, 0.17135576903820038, -0.09798043221235275, -0.20418056845664978, 0.14792610704898834, -0.1627536416053772, -0.1733807623386383, 0.4024882912635803, 0.04414018988609314, 0.44147157669067383, 0.12858417630195618, -0.002501828595995903, 0.2152206003665924, 0.036731820553541183, -0.15476389229297638, 0.05096126347780228, -0.025896865874528885, -0.10691964626312256, 0.26903262734413147, 0.16609404981136322, -0.18941831588745117, 0.09698601812124252, 0.38496944308280945, -0.09684088826179504, -0.10094957798719406, -0.10162346810102463, -0.25226926803588867, 0.2574938237667084, -0.06350456178188324, 0.42067059874534607, 0.014570221304893494, 0.14424018561840057, 0.20556561648845673, -0.03995846211910248, 0.16149841248989105, -0.0020295195281505585, 0.2783086597919464, -0.020464688539505005, 0.14944469928741455, -0.04680846631526947, -0.17669305205345154, 0.0332091748714447, -0.07733134925365448, -0.4296296238899231, 0.030595576390624046, -0.14467011392116547, -0.2241975963115692, 0.23593522608280182, 0.05479297786951065, -0.2729986310005188, -0.09531725198030472, -0.1246739849448204, -0.29722481966018677, -0.1426873505115509, -0.07585594058036804, 0.13955847918987274, 0.01543385162949562, 0.02355842851102352, 0.12942905724048615, 0.2185821682214737, -0.04015449061989784, -0.375205397605896, 0.0807066410779953, -0.3492937386035919, -0.0068870000541210175, -0.06549274176359177, 0.2121163308620453, -0.3485089838504791, 0.12338604778051376, -0.13141047954559326, -0.09286938607692719, -0.15705515444278717, -0.12323464453220367, 0.2509828805923462, 0.05748362094163895, 0.03580070286989212, 0.167741060256958, -0.2276201993227005, 0.0007205978035926819, 0.05045715719461441, 0.12256000190973282, 0.045992255210876465, -0.04060690104961395, -0.2843438982963562, 0.16435180604457855, -0.1920766532421112, -0.23563723266124725, 0.009741626679897308, -0.3718142807483673, -0.31799668073654175, 0.31804853677749634, 0.291228711605072, 0.24891258776187897, 0.15215665102005005, -0.3750404417514801, 0.14668139815330505, 0.03491706773638725, 0.20747461915016174, 0.11520320177078247, -0.37241384387016296, 0.2585522532463074, -0.18922215700149536, -0.0329236201941967, 0.12253142893314362, -0.07268975675106049, 0.2225579172372818, 0.13411563634872437, -0.22876496613025665, 0.09535323083400726, 0.18625463545322418, 0.11904223263263702, 0.0655163899064064, 0.3312780559062958, 0.018368877470493317, 0.4670288860797882, 0.0673646330833435, -0.10704052448272705, 0.11873042583465576, 0.08116069436073303, -0.1818515658378601, 0.12848499417304993, 0.10980807989835739, 0.2252335548400879, -0.13108350336551666, 0.6988933682441711, 0.014163203537464142, 0.18085342645645142, 0.006848860532045364, -0.0965607538819313, 0.197904571890831, -0.00937923789024353, -0.1816515177488327, -0.38123592734336853, -0.1656501591205597, -0.1918162852525711, 0.23359990119934082, 0.08900412172079086, -0.07531542330980301, -0.25777769088745117, 0.2158890962600708, 0.029540590941905975, -0.13886769115924835, 0.03422616422176361, -0.07726594060659409, 0.22355812788009644, -0.013476574793457985, 0.24314460158348083, -0.3469444513320923, 0.145944744348526, 0.07702840864658356, 0.19855809211730957, 0.298920214176178, -0.05143836513161659, -0.2772437334060669, -0.2124442160129547, -0.3087732791900635, -0.03395162522792816, 0.23795996606349945, -0.29868918657302856, -0.08558755367994308, 0.11834263056516647, -0.08353982865810394, 0.012613765895366669, 0.5330385565757751, -0.20070885121822357, 0.3335912227630615, 0.4303818643093109, -0.3583923876285553, 0.09758993983268738, 0.23932434618473053, -0.09591089189052582, -0.024415597319602966, 0.21104243397712708, 0.18591049313545227, -0.3010775148868561, -0.17140638828277588, -0.10224305093288422, -0.040304359048604965, -0.264446496963501, -0.05295109376311302, 0.07162640988826752, 0.016087427735328674, -0.18834322690963745, -0.17405924201011658, 0.13957753777503967, 0.2615107297897339, -0.017876891419291496, 0.27210095524787903, -0.13433125615119934, 0.3442680239677429, 0.4137439727783203, 0.23420172929763794, -0.01603022962808609, 0.22925865650177002, 0.06562522053718567, 0.20096372067928314, 0.48569414019584656, 0.30236566066741943, 0.7190078496932983, -0.005359984934329987, -0.6194478869438171, -0.11564639955759048, 0.0933130607008934, 0.5773990154266357, 0.28053730726242065, -0.1508297324180603, -0.028207696974277496, -0.23585370182991028, -0.09150883555412292, -0.23047447204589844, 0.1445738524198532, -0.02713879384100437, -0.010012057609856129, -0.4424048960208893, -0.7926709055900574, 0.8134676814079285, 0.19302158057689667, -0.27180784940719604, 0.16241422295570374, -0.05445803701877594, -0.5367110371589661, 0.11537767946720123, 0.0496702566742897, 0.7724859714508057, -0.17055824398994446, 0.2526921331882477, 0.08456023037433624, 0.21760474145412445, 0.7103065252304077, -0.1631830334663391, 0.15510423481464386, -0.4428158104419708, -0.2895817160606384, -0.16594792902469635, -0.04565071687102318, -0.15138506889343262, 0.5537253618240356, 0.12941573560237885, 0.38675829768180847, -0.004340417683124542, -0.13544726371765137, 0.17767201364040375, 0.016994334757328033, -0.008405651897192001, -0.5843508243560791, -0.38940414786338806, -0.01274239830672741, 0.1399863362312317, 0.22274942696094513, -0.161436527967453, -0.16799356043338776, -0.10964173823595047, 0.11029066145420074, 0.06792010366916656, 0.19064384698867798, -0.28008341789245605, -0.002172432839870453, -0.005241021513938904, 0.2981126308441162, 0.23550233244895935, 0.3058570623397827, 0.20247580111026764, 0.1749832034111023, -0.009150145575404167, 0.2774841785430908, -0.07917997986078262, 0.16729804873466492, 0.18057581782341003, 0.20822760462760925, 0.43520575761795044, 0.2332027554512024, 0.20114624500274658, 0.21211671829223633, -0.3110821843147278, -0.2138625830411911, -0.03681083768606186, -0.2087080031633377, 0.1962302327156067, 0.011063028126955032, -0.021727997809648514, -0.02950330078601837, -0.07508228719234467, -0.031084444373846054, 0.025682179257273674, 0.02856401726603508, -0.3534712493419647, -0.14497756958007812, -0.12454313039779663, -0.22479061782360077, 0.11994947493076324, 0.34281110763549805, -0.20127084851264954, 0.3792208135128021, 0.2977212965488434, 0.048370759934186935, -0.0040598064661026, -0.10413162410259247, 0.2692692279815674, 0.33375096321105957, -0.34184420108795166, 0.13028168678283691, 0.2602939009666443, -0.194471538066864, 0.1401575654745102, 0.222694993019104, 0.3301812410354614, -0.07178197056055069, -0.1461532860994339, -0.3044144809246063, -0.1713048666715622, 0.19605407118797302, -0.09134343266487122, 0.14313337206840515, -0.03404383733868599, -0.2528286278247833, -0.4823305904865265, -0.015675438567996025, -0.20448072254657745, -0.10790404677391052, -0.20174607634544373, 0.03722459822893143, 0.2648034691810608, 0.3273879885673523, 0.16363191604614258, 0.10669505596160889, -0.010567077435553074, -0.22019053995609283, -0.08219657093286514, -0.033509884029626846, -0.20341555774211884, 0.20980729162693024, 0.018336966633796692, 0.34391897916793823, 0.012329869903624058, -0.2456592470407486, -0.2595597505569458, -0.30991560220718384, 0.47432321310043335, -0.23223155736923218, 0.022721368819475174, 0.1693558543920517, -0.07942888140678406, 0.14985160529613495, -0.46601706743240356, 0.5615052580833435, 0.17085346579551697, 0.2478143721818924, -0.2033131867647171, 0.17121654748916626, -0.336261123418808, -0.1015458032488823, -0.06418053805828094, 0.3043285310268402, -0.07003791630268097, -0.3293599486351013, 0.7536719441413879, -0.162875697016716, 0.39946937561035156, 0.4526086151599884, 0.19732636213302612, 0.2702872157096863, 0.0093837296590209, 0.3759400546550751, 0.22556447982788086, 0.052709490060806274, -0.17338207364082336, -0.24295639991760254, 0.05400634557008743, -0.30697113275527954, 0.0027811750769615173, 0.5167113542556763, -0.0020060166716575623, -0.07191944122314453, -0.18391932547092438, -0.23781579732894897, 0.16988584399223328, 0.08642568439245224, -0.060158293694257736, 0.7760298848152161, 0.19625885784626007, 0.29623791575431824, 0.4942864179611206, 0.6024806499481201, 0.4076550602912903, 0.5740909576416016, 0.0048075467348098755, 0.19695141911506653, 0.06551426649093628, 0.09404824674129486, 0.04177171364426613, -0.27041739225387573, -0.16198581457138062, 0.412505567073822, 0.14593705534934998, 0.18766039609909058, -0.4154452085494995, -0.08253061026334763, -0.47711798548698425, -0.2025306224822998, 0.008777448907494545, 0.31447941064834595, 0.030379951000213623, -0.1632109135389328, -0.2972318232059479, -0.2559393048286438, -0.20298327505588531, 0.057438161224126816, -0.15679574012756348, -0.2951500415802002, -0.21572571992874146, -0.01556466519832611, 0.35776233673095703, -0.08335475623607635, -0.3795323371887207, 0.023783329874277115, 0.3324580490589142, -0.4619421362876892, -0.023492882028222084, -0.3914462924003601, 0.225563183426857, 0.28463730216026306, 0.001300344243645668, 0.11582349240779877, 0.22113265097141266, 0.04159752279520035, -0.3252652883529663, -0.2249550074338913, -0.11137601733207703, -0.14734351634979248, 0.0017964188009500504, -0.14234846830368042, -0.22866319119930267, 0.34180110692977905, -0.07372593134641647, -0.021768439561128616, -0.3034582734107971, 0.009879227727651596, 0.12010808289051056, 0.10669633746147156, 0.610139787197113, 0.051192089915275574, -0.2745372951030731, -0.07973870635032654, 0.05762768164277077, -0.18824559450149536, -0.2655468285083771, 0.3930310010910034, 0.12174571305513382, 0.184202641248703, 0.12325119227170944, 0.03475024923682213, -0.11789493262767792, 0.4059997797012329, 0.32273241877555847, -0.216406911611557, -0.040512815117836, -0.04355216398835182, -0.5403915643692017, -0.18537849187850952, 0.08043704926967621, -0.49876412749290466, 0.37588444352149963, -0.10934461653232574, 0.331632137298584, 0.05989467352628708, -0.28272926807403564, -0.29899635910987854, 0.3287186324596405, 0.017269868403673172, -0.2398764044046402, -0.32114315032958984, 0.151347815990448, 0.2177094668149948, -0.03717837482690811, -0.4682859182357788, 0.10547783970832825, -0.48702409863471985, -0.15907911956310272, 0.12485600262880325, 0.2629503309726715, 0.09932729601860046, 0.015347544103860855, 0.40161770582199097, -0.2877916991710663, 0.3399282693862915, 0.08833365887403488, -0.10278691351413727, 0.12137921154499054, -0.20542125403881073, -0.05570955574512482, 0.30231931805610657, -0.12374673783779144, 0.38700371980667114, -0.1614195704460144, 0.16873568296432495, -0.26576757431030273, -0.11529140174388885, -0.018623298034071922, 0.07725095003843307, -0.4153369069099426, -0.04611030966043472, -0.45183736085891724, 0.2426767796278, 0.2971823513507843, 0.17604747414588928, -0.11787430942058563, -0.0393034964799881, -0.1610647588968277, -0.1243227943778038, 0.521449089050293, -0.216356098651886, -0.3528743386268616, 0.0009755785576999187, 0.032656192779541016, 0.12551778554916382, -0.09565509855747223, -0.017040006816387177, 0.10744417458772659, 0.3388504087924957, -0.19747740030288696, -0.51375812292099, -0.042870230972766876, -0.1871291846036911, 0.11870098114013672, -0.2278895527124405, -0.1811453104019165, -0.21796828508377075, -0.08631689846515656, -0.2516236901283264, -0.21771368384361267 ]
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
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)
[ -0.15487737953662872, -0.2053687572479248, 0.004702892154455185, 0.2853047847747803, 0.23897741734981537, -0.14961348474025726, -0.010636117309331894, 0.27262720465660095, -0.08417125046253204, -0.002077333629131317, -0.06044921278953552, 0.6115537285804749, -0.06062483787536621, 0.30978459119796753, -0.17548006772994995, 0.04989968240261078, -0.007291428744792938, 0.17123231291770935, 0.23024532198905945, 0.0019138343632221222, -0.23779551684856415, 0.1575596034526825, 0.007895879447460175, 0.11645659804344177, 0.034524109214544296, -0.3172885477542877, -0.22661037743091583, 0.09242218732833862, -0.5408954620361328, -0.47294342517852783, 0.4456939399242401, 0.011239958927035332, 0.2864491939544678, 0.1254177987575531, -0.00010623532580211759, 0.078070268034935, 0.5441405177116394, -0.08902557939291, -0.195256307721138, -0.29674071073532104, -0.5597663521766663, -0.3942488431930542, 0.1312565952539444, -0.3221539855003357, 0.16338279843330383, 0.2952103316783905, -0.1358821988105774, -0.0450676754117012, 0.34667888283729553, 0.37826985120773315, 0.26190969347953796, 0.22517135739326477, 0.2458416074514389, -0.0009547121590003371, 0.3786148130893707, -0.1280847191810608, -0.10302704572677612, 0.3213815689086914, 0.08951110392808914, -0.05807659775018692, 0.027673877775669098, 0.27633097767829895, 0.07943107932806015, -0.3736172318458557, 0.011477861553430557, -0.1049203872680664, 0.20708009600639343, -0.3919040858745575, -0.14094054698944092, 0.1483944207429886, 0.29948094487190247, -0.09057346731424332, -0.35456061363220215, -0.08983197808265686, 0.11353924870491028, -0.7718367576599121, 0.266748309135437, 0.3740904629230499, -0.1495489776134491, -0.006752971559762955, -0.23319022357463837, -0.05451109632849693, -0.004946604371070862, 0.04308263957500458, 0.056206606328487396, 0.23143750429153442, -0.05661986023187637, -0.07317585498094559, 0.2316768318414688, 0.0028471052646636963, 0.19119983911514282, -0.03861848637461662, -0.12009666860103607, -0.0038019688799977303, -0.26868146657943726, -0.28205788135528564, -0.014528505504131317, 0.3003566861152649, 0.14780005812644958, 0.2930164337158203, 0.10951874405145645, -0.14752542972564697, -0.015576405450701714, -0.0554683580994606, 0.17364181578159332, 0.4386928975582123, -0.10006364434957504, -0.043167341500520706, 0.11872921884059906, 0.729966402053833, 0.2542512118816376, -0.09058257192373276, -0.04478628560900688, 0.047501303255558014, -0.11860805749893188, 0.045799389481544495, 0.22515787184238434, -0.2714974582195282, -0.3570239841938019, 0.15868812799453735, -0.07569335401058197, 0.22382478415966034, 0.12818238139152527, 0.38717758655548096, -0.34985241293907166, 0.12641796469688416, 0.004613671451807022, 0.24828843772411346, 0.01470365934073925, -0.1362326294183731, -0.20365458726882935, 0.1763487160205841, -0.18999630212783813, -0.024110304191708565, 0.014176014810800552, -0.21730953454971313, 0.35924142599105835, 0.17882613837718964, -0.034080132842063904, -0.08008702099323273, 0.033763572573661804, -0.2682858109474182, -0.2033921182155609, 0.1180592030286789, -0.24619507789611816, -0.10887833684682846, 0.22942231595516205, -0.12411428987979889, -0.09255484491586685, -0.06519483774900436, -0.07111115008592606, -0.3426530659198761, 0.0020326636731624603, 0.27658894658088684, -0.26607048511505127, 0.002015314996242523, 0.14268308877944946, -0.010576333850622177, 0.15042245388031006, 0.1755969375371933, -0.009780317544937134, -0.10069926083087921, -0.11640914529561996, -0.14773762226104736, 0.18922217190265656, 0.24895823001861572, 0.05430920049548149, 0.026529401540756226, -0.41396665573120117, -0.1573331356048584, 0.35345134139060974, -0.04863090440630913, -0.161842942237854, 0.02102702483534813, -0.24900980293750763, -0.1961764246225357, 0.0763082429766655, -0.38205668330192566, -0.3286436200141907, 0.24341914057731628, -0.1328030228614807, 0.3499629497528076, -0.040688760578632355, -0.03299979865550995, -0.14407159388065338, -0.03876468166708946, 0.23759660124778748, -0.03125520423054695, -0.0388580858707428, -0.07315824180841446, -0.5278933048248291, -0.344357430934906, 0.31836968660354614, 0.019307807087898254, 0.0548078790307045, 0.07396776229143143, -0.08359380811452866, 0.33204495906829834, 0.31337058544158936, 0.043539661914110184, -0.04109194874763489, 0.15267401933670044, 0.46461230516433716, 0.12242171168327332, -0.2952699363231659, 0.12730568647384644, -0.21858593821525574, 0.1770232915878296, 0.2176869511604309, 0.1912904679775238, -0.458701491355896, -0.3075038194656372, -0.17260098457336426, 0.17302511632442474, -0.09985116124153137, -0.1943146288394928, 0.22268882393836975, 0.09361522644758224, 0.3055357038974762, 0.12604181468486786, -0.09633424878120422, 0.5437780618667603, -0.22907692193984985, 0.2426522672176361, -0.2364727109670639, 0.09871779382228851, -0.242906853556633, -0.07298765331506729, 0.24225088953971863, 0.18340815603733063, 0.2509135901927948, -0.13187608122825623, 0.005806160159409046, 0.3234352469444275, 0.09883337467908859, 0.09747593104839325, -0.2004023790359497, -0.30509692430496216, 0.3078112006187439, -0.23599322140216827, 0.05137746036052704, -0.06461234390735626, 0.022267572581768036, 0.21952125430107117, -0.02903241664171219, 0.1884893774986267, -0.15963314473628998, -0.1272645890712738, 0.24711231887340546, -0.03564056381583214, 0.18321463465690613, -0.01052754744887352, -0.08659528940916061, -0.13245993852615356, 0.36272749304771423, 0.01705126278102398, 0.1016731709241867, 0.013879658654332161, -0.44681316614151, -0.00888776034116745, 0.25568896532058716, 0.0523514486849308, -0.02500253915786743, 0.0568975955247879, 0.20668330788612366, -0.04545652121305466, 0.1440444141626358, 0.30869245529174805, 0.3959006071090698, 0.15747535228729248, -0.05933423712849617, 0.10582752525806427, -0.18000248074531555, -0.16940708458423615, 0.33398962020874023, 0.015993159264326096, 0.2994146943092346, 0.08341700583696365, 0.21994049847126007, 0.11824407428503036, -0.2954825162887573, -0.21389545500278473, 0.0995728075504303, 0.41461628675460815, -0.049371927976608276, -0.11360929161310196, -0.23354429006576538, 0.011521842330694199, -0.09149331599473953, -0.2189977467060089, -0.22861972451210022, -0.3098895847797394, -0.023489926010370255, 0.2058536261320114, 0.02087356150150299, 0.02894352190196514, -0.5628071427345276, 0.0059782713651657104, -0.002955438569188118, -0.09694202989339828, -0.31408998370170593, -0.043831437826156616, -0.2759854197502136, 0.13422638177871704, 0.09235204011201859, -0.2728230953216553, 0.1389736384153366, -0.19118812680244446, -0.08274857699871063, -0.012320315465331078, -0.43014761805534363, 0.12305748462677002, -0.2245057076215744, -0.01898772083222866, 0.3362194299697876, 0.08094406127929688, 0.015804599970579147, -0.3781094253063202, 0.23739749193191528, -0.04562811553478241, -0.2729135751724243, -0.04491956904530525, 0.1866891235113144, 0.16187193989753723, -0.4017921984195709, -0.3504786789417267, -0.3525466322898865, -0.39214280247688293, 0.25497862696647644, 0.16553393006324768, -0.019216269254684448, 0.3638669550418854, 0.04923092946410179, 0.2201681286096573, 0.1340269148349762, -0.023801462724804878, -0.16811694204807281, -0.4163869321346283, 0.23560404777526855, -0.1512254774570465, -0.31303197145462036, -0.06340956687927246, -0.1955946683883667, 0.39996591210365295, 0.0636170357465744, -0.5727652907371521, -0.22978326678276062, -0.22921572625637054, 0.14706364274024963, -0.17272035777568817, -0.4902194142341614, 0.19185644388198853, 0.09401668608188629, -0.09934896975755692, -0.11569757014513016, 0.11157411336898804, 0.07158252596855164, -0.1814621388912201, 0.4321111738681793, -0.10686831921339035, 0.3907272517681122, 0.34350189566612244, 0.26391303539276123, 0.18562345206737518, -0.09934671223163605, 0.5776379108428955, 0.040808986872434616, 0.3864723742008209, 0.12652739882469177, -0.14508488774299622, -0.015413995832204819, -0.06715111434459686, -0.12462887167930603, -0.01721213012933731, -0.18972522020339966, -0.18846938014030457, -0.3269194960594177, -0.006079422309994698, -0.027710875496268272, -0.2216285914182663, -0.18136006593704224, 0.24004974961280823, 0.15107522904872894, 0.02655932679772377, 0.08694574981927872, -0.02027520351111889, -0.10350916534662247, 0.1887197345495224, 0.22990740835666656, -0.1269451081752777, -0.10171794891357422, -0.3341962397098541, -0.38726598024368286, -0.5768500566482544, 0.0617072768509388, 0.06149948388338089, 0.2818850576877594, 0.09789170324802399, -0.20566609501838684, -0.1847800761461258, -0.18865244090557098, 0.5046223998069763, -0.04998745024204254, 0.24666373431682587, 0.042900849133729935, -0.07239653170108795, -0.38593006134033203, -0.11253945529460907, -0.31614363193511963, -0.07868253439664841, 0.2856828570365906, 0.810253381729126, -0.3607233464717865, 0.12222978472709656, 0.11922133713960648, 0.04075796157121658, 0.0669240951538086, 0.06274500489234924, -0.3348143696784973, -0.3739311993122101, -0.23958060145378113, 0.3544723689556122, 0.013153960928320885, 0.5338473916053772, -0.33309581875801086, -0.17540836334228516, 0.14091706275939941, 0.19873455166816711, -0.0941811054944992, 0.11524249613285065, 0.11304505914449692, 0.13065682351589203, 0.21477091312408447, -0.18184809386730194, 0.3212994933128357, 0.2962046265602112, 0.41717711091041565, 0.1265440583229065, -0.5414107441902161, -0.19968661665916443, 0.012566297315061092, 0.002788461744785309, 0.20765329897403717, 0.06581810116767883, -0.15121027827262878, -0.12596191465854645, 0.15994608402252197, 0.06290791928768158, 0.2748786509037018, 0.2803893983364105, -0.1901901215314865, -0.38015469908714294, 0.0779835432767868, 0.22481581568717957, -0.07799959182739258, 0.05290701985359192, 0.06648475676774979, -0.17847101390361786, -0.2233501672744751, 0.17634257674217224, 0.21986111998558044, 0.9673251509666443, 0.03806278109550476, -0.15546779334545135, 0.52410888671875, -0.18579018115997314, 0.7209030985832214, -0.3975985050201416, 0.2597418427467346, -0.15923714637756348, -0.5294055342674255, 0.14232398569583893, -0.0017225220799446106, 0.21350643038749695, 0.016857381910085678, -0.33164042234420776, -0.014917370863258839, -0.1334187239408493, 0.10494858026504517, 0.08619493991136551, 0.24337679147720337, -0.2499431073665619, -0.07520347833633423, -0.2853235602378845, 0.26858001947402954, 0.09813660383224487, 0.19943369925022125, -0.20749852061271667, -0.1361631602048874, -0.17994864284992218, -0.2696921229362488, -0.1426243782043457, 0.32552042603492737, -0.23524649441242218, 0.07006675004959106, -0.26555922627449036, 0.10675294697284698, -0.08694227039813995, 0.30693602561950684, 0.30539625883102417, 0.2565351724624634, -0.09749136865139008, 0.10577233135700226, 0.005204431712627411, -0.231892928481102, 0.08470947295427322, -0.04473954811692238, 0.050524141639471054, -0.2573575973510742, -0.2448461949825287, 0.1155557632446289, -0.16058148443698883, 0.07200823724269867, 0.32636916637420654, -0.3075439929962158, 0.06945756077766418, -0.13638345897197723, 0.07406158745288849, -0.005759760737419128, 0.1601434201002121, -0.18842940032482147, 0.1892978399991989, -0.07850953936576843, -0.2159491628408432, -0.1280638873577118, -0.14079122245311737, -0.3728845417499542, -0.18370242416858673, 0.4213293194770813, -0.04918467998504639, 0.38166865706443787, 0.31629085540771484, -0.036608122289180756, -0.1258169710636139, -0.2445909082889557, -0.2516982853412628, -0.23214001953601837, -0.2414402961730957, 0.002074996940791607, -0.08428072929382324, 0.09013143181800842, -0.13580924272537231, 0.40935397148132324, 0.31311309337615967, 0.13785679638385773, 0.2633558511734009, -0.5009856224060059, -0.263162761926651, 0.19088725745677948, 0.009136669337749481, 0.26839959621429443, 0.07552682608366013, 0.27181193232536316, 0.1270948350429535, -0.007449595257639885, -0.36941853165626526, -0.07521314173936844, -0.4141751229763031, 0.07093912363052368, 0.20769168436527252, -0.07943450659513474, 0.2701544165611267, 0.052297476679086685, 0.22607146203517914, 0.39036333560943604, -0.07763633131980896, -0.24799811840057373, 0.01696772873401642, 0.09023875743150711, 0.22136831283569336, 0.08777616918087006, 0.06281576305627823, 0.03923870623111725, 0.06728772819042206, 0.13092952966690063, -0.08818554878234863, -0.07280246913433075, 0.02920743077993393, 0.00043679866939783096, 0.03561199828982353, 0.3610226511955261, -0.14047333598136902, -0.1043642908334732, 0.00758255273103714, 0.1557987928390503, 0.09760583937168121, 0.11929410696029663, 0.028764717280864716, -0.021836355328559875, 0.25131386518478394, -0.20680853724479675, -0.2758006453514099, 0.19022533297538757, 0.1717848926782608, -0.06664961576461792, -0.07513517141342163, 0.21646258234977722, 0.030683737248182297, 0.41346922516822815, -0.0365896075963974, -0.18013405799865723, 0.2624884247779846, 0.3284206688404083, -0.31897395849227905, -0.00040038139559328556, 0.046513982117176056, -0.036303117871284485, -0.1895509511232376, 0.2766924500465393, 0.043540675193071365, -0.051081374287605286, 0.20632286369800568, 0.03855207562446594, 0.5935821533203125, -0.0052259378135204315, 0.42859283089637756, 0.33607372641563416, -0.35240545868873596, -0.000244826078414917, 0.11488630622625351, -0.12306782603263855, 0.29173916578292847, 0.10209009796380997, -0.22918596863746643, -0.07107216119766235, 0.035284146666526794, 0.1684958040714264, 0.057735200971364975, -0.28940820693969727, -0.22918368875980377, 0.278838574886322, -0.26067113876342773, -0.04689231514930725, 0.03813638910651207, 0.19787263870239258, -0.034790948033332825, -0.08184383064508438, -0.4028497338294983, 0.33942127227783203, -0.13817021250724792, 0.07250060141086578, -0.16724440455436707, -0.24524861574172974, -0.2895020544528961, 0.2421015501022339, 0.15126699209213257, -0.06013762950897217, 0.20222207903862, 0.07378678768873215, -0.16478131711483002, -0.28736257553100586, -0.1535010039806366, 0.36673203110694885, 0.16511011123657227, -0.41845574975013733, 0.2254624217748642, 0.09797532111406326, -0.26443734765052795, -0.13114440441131592, 0.0989331528544426, 0.2387305498123169, 0.2902930974960327, 0.17272868752479553, 0.10450845211744308, 0.1416144222021103, 0.03163135051727295, -0.11920880526304245, 0.18868422508239746, 0.5572322607040405, 0.3835815489292145, 0.3301485776901245, 0.21428942680358887, -0.25737887620925903, -0.016920611262321472, 0.08509894460439682, -0.015355203300714493, -0.18213874101638794, 0.29401126503944397, 0.23422257602214813, 0.01414162665605545, -0.19400937855243683, 0.16268333792686462, -0.24475017189979553, 0.24977415800094604, -0.07827338576316833, 0.031403470784425735, 0.20248106122016907, -0.07485005259513855, 0.12178100645542145, -0.14401836693286896, 0.21334943175315857, 0.37698259949684143, -0.42602524161338806, -0.27143266797065735, -0.44297266006469727, -0.4412626326084137, 0.30653002858161926, -0.06990785896778107, -0.20057077705860138, -0.04087219014763832, 0.006907448172569275, -0.12522131204605103, 0.25375908613204956, -0.21839039027690887, 0.2172824889421463, 0.14990057051181793, 0.07934153079986572, -0.2277323603630066, 0.17727772891521454, 0.04041966795921326, -0.06905614584684372, 0.08179084211587906, -0.2463352084159851, 0.1780230551958084, -0.10240242630243301, 0.13600191473960876, 0.09539909660816193, -0.1893373727798462, -0.23920279741287231, -0.25810664892196655, 0.755398154258728, 0.13437972962856293, 0.1538504958152771, -0.02262837439775467, -0.3380557596683502, -0.17639878392219543, -0.06558635085821152, -0.15980181097984314, 0.39506447315216064, 0.02738841436803341, 0.12672850489616394, -0.10495384782552719, 0.3990633487701416, -0.4595474600791931, 0.6067323088645935, 0.301990270614624, -0.23978856205940247, -0.013242309913039207, -0.03861752152442932, 0.02166283130645752, -0.15384016931056976, 0.17103156447410583, 0.2560257017612457, -0.036656372249126434, 0.11296451091766357, -0.23927439749240875, -0.43256187438964844, 0.26285332441329956, -0.5577971339225769, -0.1553308665752411, 0.14279033243656158, 0.18009009957313538, 0.2502574622631073, -0.26435133814811707, -0.24534139037132263, 0.10437431186437607, 0.25524747371673584, 0.009321169927716255, -0.3113739788532257, 0.06594084203243256, -0.049675848335027695, -0.06560664623975754, 0.016537752002477646, 0.28302091360092163, -0.05671825259923935, -0.26335254311561584, 0.23545411229133606, -0.14513349533081055 ]
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.
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?
[ -0.20529842376708984, -0.3432776629924774, -0.09249891340732574, 0.23858214914798737, 0.20685581862926483, 0.04926350712776184, 0.2642042636871338, 0.3207882344722748, -0.26615071296691895, 0.2926475405693054, 0.5328459739685059, 0.21491014957427979, -0.04361525550484657, 0.1080227717757225, -0.18307267129421234, -0.38684532046318054, 0.22690069675445557, 0.1642899513244629, -0.12168651819229126, -0.2588270306587219, 0.0578656867146492, -0.019054951146245003, -0.1479322612285614, -0.09008581936359406, -0.17056913673877716, -0.06558912992477417, 0.20518885552883148, 0.009012673050165176, -0.22900308668613434, -0.30799657106399536, 0.028812410309910774, -0.14590202271938324, 0.12953412532806396, 0.475164532661438, -0.00012132643314544111, 0.09081991016864777, 0.2897566258907318, 0.07786592096090317, -0.2838393449783325, -0.070725217461586, 0.14413568377494812, 0.02082468383014202, -0.02859925478696823, -0.22966662049293518, -0.06843645870685577, -0.27725788950920105, 0.08733253926038742, -0.2837846577167511, 0.23441806435585022, 0.11991589516401291, 0.10227727890014648, 0.03543451055884361, -0.480564147233963, 0.02446085959672928, 0.19609831273555756, 0.4710932970046997, -0.3956347703933716, 0.30094513297080994, 0.09031900018453598, -0.04675787687301636, -0.04146427661180496, 0.23974718153476715, 0.0018952097743749619, 0.2771683633327484, 0.3752954602241516, 0.20477606356143951, 0.31945714354515076, 0.06080034375190735, -0.01631295680999756, 0.46078962087631226, 0.27259936928749084, 0.17769187688827515, -0.3443894684314728, -0.2711448073387146, -0.25492846965789795, -0.28515952825546265, -0.10423580557107925, 0.2640128433704376, -0.36171820759773254, -0.05388825014233589, -0.7276849746704102, 0.3080609142780304, -0.15109069645404816, 0.040892645716667175, 0.1981666088104248, 0.030215229839086533, -0.043768346309661865, 0.18496736884117126, 0.2895272374153137, 0.06897008419036865, 0.26996517181396484, -0.42085909843444824, 0.1925794929265976, 0.12800978124141693, 0.0856950655579567, -0.10858795046806335, 0.002437293529510498, -0.20743265748023987, -0.04467792436480522, 0.06851420551538467, 0.09319741278886795, -0.07083477824926376, 0.01851550117135048, -0.018377967178821564, -0.07227593660354614, 0.27667567133903503, -0.0457671657204628, 0.1932390183210373, -0.03213946521282196, 0.33234548568725586, -0.47364968061447144, 0.17295053601264954, 0.07262425124645233, -0.1266898214817047, 0.1645818054676056, -0.13770195841789246, -0.3295454978942871, -0.13470785319805145, -0.37790122628211975, 0.04713849350810051, -0.6401581764221191, -0.20026223361492157, -0.011387933976948261, 0.022496476769447327, -0.27844032645225525, -0.024457845836877823, -0.04220275208353996, 0.17523382604122162, -0.3503195643424988, 0.08901989459991455, -0.2341214269399643, -0.06491008400917053, -0.04684627428650856, 0.3981722891330719, -0.15730436146259308, 0.08011888712644577, 0.3337748944759369, 0.23869986832141876, -0.04495104402303696, 0.15008136630058289, 0.6041498780250549, -0.34542638063430786, 0.10906179249286652, -0.06346815824508667, -0.305072158575058, 0.22496521472930908, 0.044753920286893845, 0.031036853790283203, -0.27265772223472595, 0.1137671023607254, -0.0787271186709404, -0.34187573194503784, 0.27405548095703125, 0.07674511522054672, -0.1750374436378479, -0.02302466332912445, -0.19336780905723572, 0.3922954499721527, -0.2639263868331909, -0.07981985807418823, 0.01366385817527771, -0.06560927629470825, -0.5163551568984985, -0.1585230976343155, 0.11228501051664352, 0.2359238862991333, -0.07042139023542404, -0.06305703520774841, 0.11198115348815918, 0.3184985816478729, 0.43536120653152466, 0.33877137303352356, -0.39320626854896545, 0.25027990341186523, -0.17315524816513062, -0.23038627207279205, 0.39318594336509705, -0.2858208417892456, 0.010667549446225166, 0.6612650156021118, -0.048278309404850006, 0.29679766297340393, 0.4342260956764221, -0.015610539354383945, 0.09782402217388153, -0.3256451189517975, -0.025443032383918762, 0.531631350517273, 0.2336311787366867, 0.21801766753196716, -0.360580712556839, -0.3174097239971161, 0.09878355264663696, 0.033727798610925674, -0.5166739225387573, 0.14764846861362457, -0.030901938676834106, -0.06530100107192993, 0.5358563661575317, -0.3311833143234253, -0.16557589173316956, 0.31365782022476196, 0.23174980282783508, -0.14747117459774017, -0.017935149371623993, 0.31933143734931946, 0.005227122455835342, 0.20182839035987854, 0.027537178248167038, 0.08453579246997833, 0.2465798258781433, 0.03153698891401291, -0.10327480733394623, -0.1761891394853592, -0.028637725859880447, -0.2929101288318634, 0.020976416766643524, -0.0789300799369812, 0.46351438760757446, -0.0627896785736084, 0.4031834304332733, 0.1639680564403534, -0.29886406660079956, -0.09032145887613297, -0.33603936433792114, 0.04848767817020416, 0.3408479392528534, -0.14332319796085358, -0.12865406274795532, -0.23291003704071045, -0.15386074781417847, -0.11909512430429459, -0.4815044701099396, 0.20927771925926208, 0.2919481694698334, 0.3471888303756714, 0.21507158875465393, 0.15763743221759796, -0.008327651768922806, 0.017488103359937668, 0.3014410138130188, 0.13331596553325653, -0.00436037965118885, 0.02369792014360428, -0.6111503839492798, 0.5663595795631409, 0.3187487721443176, 0.3390663266181946, 0.17700554430484772, -0.47564443945884705, -0.054508551955223083, 0.11751504242420197, -0.08960062265396118, 0.0439017191529274, 0.35926946997642517, 0.39865776896476746, 0.3479412794113159, 0.1524561047554016, -0.18858814239501953, 0.15539632737636566, 0.40618154406547546, -0.24357923865318298, -0.4128729999065399, 0.230706125497818, -0.010129719972610474, -0.3260205388069153, 0.05653342604637146, 0.15313822031021118, 0.7508706450462341, 0.0016426400979980826, 0.22728969156742096, 0.021457111462950706, -0.1225847378373146, -0.05035381019115448, 0.3192189633846283, -0.03228217363357544, 0.40204259753227234, -0.3389257490634918, 0.20434817671775818, 0.06382235139608383, -0.28383713960647583, -0.2533772587776184, -0.05688304454088211, 0.3783787488937378, 0.12599870562553406, 0.45281675457954407, -0.07798626273870468, 0.32891014218330383, -0.250478059053421, 0.07427320629358292, 0.11895421147346497, -0.019808264449238777, -0.19612963497638702, 0.11010000109672546, 0.22409814596176147, -0.25812727212905884, 0.23047631978988647, -0.13684578239917755, -0.00178489089012146, -0.1638326197862625, -0.04461807757616043, 0.02751423418521881, -0.46602457761764526, -0.022571716457605362, 0.09941897541284561, 0.2942681312561035, 0.0556819811463356, -0.3423827588558197, -0.3294081687927246, 0.00974953267723322, -0.4420347213745117, -0.07292643189430237, 0.07587923109531403, 0.522024929523468, 0.0867135152220726, 0.12737858295440674, -0.19170750677585602, -0.09116456657648087, 0.19054698944091797, -0.27080926299095154, -0.25209668278694153, -0.13325166702270508, -0.3794780373573303, 0.292407751083374, 0.06946481764316559, -0.04041238874197006, 0.001903897151350975, -0.10390423238277435, 0.4406746029853821, 0.2869490683078766, 0.11036769300699234, 0.2984848618507385, 0.13003693521022797, -0.04961886256933212, 0.24479010701179504, 0.3767985999584198, -0.1900015026330948, -0.735078752040863, 0.03463120013475418, -0.2476157546043396, -0.07380099594593048, -0.5117013454437256, -0.2857586145401001, 0.12097273766994476, 0.2654040455818176, -0.560909628868103, -0.2541193962097168, -0.6531519293785095, 0.18801149725914001, -0.2810812294483185, -0.013575678691267967, 0.1350269317626953, -0.12185772508382797, -0.04172062128782272, -0.14304685592651367, -0.08596352487802505, -0.04153557866811752, 0.0164340790361166, 0.057363782078027725, -0.18678918480873108, 0.2526778280735016, -0.04193948954343796, 0.48447859287261963, 0.4196361303329468, -0.367836058139801, -0.05941110849380493, -0.009194055572152138, -0.12595105171203613, -0.41843292117118835, 0.2580065429210663, 0.1764853149652481, 0.03079971671104431, -0.32480746507644653, 0.034155115485191345, 0.013228310272097588, -0.1485559344291687, -0.022280920296907425, 0.08396485447883606, -0.08971630781888962, -0.19706591963768005, 0.035757288336753845, -0.0482306033372879, 0.12206175923347473, 0.0403643436729908, 0.2251434028148651, -0.4627876579761505, -0.022106532007455826, -0.017546994611620903, 0.10870669782161713, 0.2628375291824341, 0.052969906479120255, -0.4566337466239929, -0.1845518797636032, -0.2191460132598877, -0.003339625895023346, 0.17466388642787933, -0.09846078604459763, 0.21585004031658173, -0.20448458194732666, 0.39662373065948486, 0.00519405584782362, 0.40872830152511597, -0.22355906665325165, -0.017104744911193848, -0.08657997846603394, -0.31901246309280396, -0.4155831038951874, -0.18434512615203857, -0.17196710407733917, -0.0012591076083481312, 0.24297654628753662, 0.7056467533111572, -0.06698781251907349, -0.40819570422172546, 0.3963201642036438, 0.4817972481250763, 0.33274734020233154, -0.22881706058979034, -0.29316505789756775, -0.14856573939323425, 0.20880351960659027, -0.06607865542173386, -0.4411696195602417, 0.15746676921844482, -0.2624852955341339, -0.17788304388523102, -0.15004587173461914, 0.33921289443969727, 0.032523900270462036, 0.26043203473091125, 0.2809804379940033, -0.010929498821496964, 0.36780846118927, 0.22229434549808502, -0.2495715618133545, -0.07350359112024307, 0.11230916529893875, 0.07890135049819946, 0.05377674847841263, -0.005388492718338966, 0.2715426981449127, -0.2538573443889618, 0.5091027021408081, 0.15475334227085114, -0.04983719438314438, -0.03996114805340767, 0.2650929391384125, -0.1847030222415924, 0.041089873760938644, 0.6644746661186218, 0.06143973022699356, -0.07940823584794998, -0.7278592586517334, 0.6203233003616333, 0.5127937197685242, -0.09597159922122955, 0.2912052273750305, -0.6081719398498535, 0.208570197224617, 0.21392184495925903, 0.06155843287706375, 0.7920991778373718, 0.04384683445096016, 0.3532920181751251, 0.3423733413219452, 0.05145402252674103, 0.26007574796676636, 0.0777437761425972, 0.0926971510052681, -0.2504587769508362, -0.3028608560562134, 0.14950425922870636, -0.29523998498916626, 0.3112107515335083, 0.15792816877365112, -0.022434815764427185, 0.05772143602371216, -0.14229843020439148, -0.011028721928596497, -0.20977234840393066, 0.030942969024181366, -0.11643623560667038, -0.0018144212663173676, -0.27411770820617676, -0.016688987612724304, 0.2469121813774109, 0.18883946537971497, 0.12019620090723038, -0.22806350886821747, -0.5834861397743225, -0.008506497368216515, -0.09066497534513474, -0.19117987155914307, -0.15846024453639984, 0.2638627886772156, 0.27381449937820435, -0.6233025193214417, -0.12883956730365753, 0.18978366255760193, 0.17435622215270996, 0.10821640491485596, -0.02264132909476757, 0.19559381902217865, -0.09121250361204147, 0.3765382468700409, 0.26639148592948914, -0.44640037417411804, 0.24750904738903046, -0.11483875662088394, -0.1316453069448471, -0.053321585059165955, -0.41441038250923157, 0.08129435777664185, -0.2885875105857849, -0.027518510818481445, -0.1657343953847885, 0.05844239145517349, -0.1369093358516693, 0.16679689288139343, -0.169275164604187, -0.12843388319015503, 0.06070343777537346, 0.08405701816082001, -0.09837472438812256, 0.4319278597831726, -0.08332481980323792, -0.5684734582901001, -0.029108740389347076, 0.18397316336631775, 0.2904489040374756, 0.10924944281578064, 0.46843066811561584, -0.2667023837566376, 0.04281143099069595, -0.07212023437023163, 0.48771315813064575, 0.07594520598649979, -0.27139320969581604, 0.2857750952243805, -0.03585109859704971, 0.027174293994903564, 0.3055448532104492, 0.1927386224269867, -0.19501115381717682, 0.1374402493238449, -0.1271214485168457, -0.0046122074127197266, -0.16229252517223358, -0.23691783845424652, -0.14915168285369873, 0.007521703839302063, -0.24513110518455505, -0.06498458981513977, -0.04951940104365349, -0.04323232173919678, -0.19106358289718628, 0.231869637966156, 0.006178716197609901, 0.06461254507303238, -0.06486348062753677, -0.15957549214363098, 0.4216231405735016, 0.20223526656627655, 0.09747222065925598, 0.05037185549736023, -0.23196536302566528, -0.13647016882896423, -0.3544543981552124, 0.16664381325244904, -0.18018785119056702, -0.26186805963516235, 0.29472285509109497, 0.23370616137981415, 0.05107036232948303, -0.03707916662096977, 0.14226804673671722, 0.12047960609197617, 0.07761724293231964, 0.008188790641725063, -0.18874894082546234, 0.2134055495262146, 0.030996710062026978, -0.04419747740030289, -0.39256682991981506, 0.39329278469085693, 0.07207582145929337, 0.052288759499788284, 0.28355470299720764, -0.27398520708084106, -0.25688835978507996, -0.11072110384702682, -0.3867056369781494, 0.12043673545122147, 0.15281756222248077, -0.04413757473230362, 0.2312086522579193, -0.10985977202653885, 0.10425017774105072, 0.4642287492752075, 0.04895279183983803, -0.127793550491333, 0.13590246438980103, 0.11098124086856842, 0.11409042775630951, -0.3255153000354767, -0.07907648384571075, -0.06388125568628311, 0.20060110092163086, 0.24572528898715973, 0.019678007811307907, 0.27911263704299927, -0.09393496811389923, -0.37552952766418457, 0.1402314007282257, 0.007672291249036789, 0.11889117956161499, 0.6737577319145203, 0.2731778919696808, -0.12283870577812195, -0.02388789691030979, 0.08734023571014404, 0.269928514957428, 0.07991904020309448, 0.23322555422782898, 0.3194113075733185, -0.04874113202095032, 0.07133430242538452, -0.0550670251250267, -0.3345825672149658, 0.04130462557077408, 0.3441242575645447, -0.42218101024627686, 0.11432068049907684, -0.03268567472696304, 0.38185298442840576, -0.05726374313235283, 0.04026825726032257, -0.1940947324037552, -0.08426558971405029, 0.2583142817020416, -0.4000913202762604, -0.15420211851596832, 0.05557263642549515, -0.2156064808368683, 0.19169338047504425, -0.2348986268043518, 0.06944344937801361, 0.19219833612442017, -0.0535338819026947, 0.2215002477169037, -0.011471590027213097, -0.11820230633020401, -0.2102614939212799, 0.32899147272109985, 0.03524346277117729, -0.013112006708979607, 0.02250899374485016, -0.20111513137817383, 0.01932956650853157, 0.10270272195339203, 0.454352468252182, 0.16304253041744232, 0.03672190010547638, 0.04752068966627121, 0.029291458427906036, -0.055443175137043, 0.019250772893428802, 0.04613225534558296, 0.1134929358959198, -0.206539124250412, 0.12186938524246216, -0.02656630054116249, -0.2013741284608841, 0.24937821924686432, -0.025299709290266037, -0.05336311087012291, -0.46510401368141174, 0.0844157263636589, -0.24851882457733154, 0.17037585377693176, -0.20966601371765137, 0.1856115758419037, -0.2205081284046173, 0.042893871665000916, -0.10116942226886749, -0.027294283732771873, 0.06372786313295364, 0.06238989904522896, -0.0045126453042030334, -0.4074804484844208, 0.5165233016014099, 0.041636716574430466, 0.3064762353897095, -0.10443515330553055, -0.1462617665529251, -0.15964749455451965, -0.08893292397260666, -0.5015440583229065, 0.1533382385969162, 0.042255401611328125, 0.2731453478336334, -0.01756058633327484, 0.09511867165565491, 0.19486507773399353, 0.2577342987060547, -0.24445655941963196, 0.48959168791770935, -0.22459329664707184, -0.1840917021036148, -0.19513417780399323, -0.1334540843963623, -0.20653143525123596, -0.438922256231308, 0.1389293074607849, -0.1426391899585724, 0.01916724443435669, -0.08883579820394516, 0.16319622099399567, 0.16561070084571838, 0.3971688151359558, 0.4298444390296936, 0.24321003258228302, 0.004572540521621704, -0.1199149414896965, -0.5304663777351379, -0.157333642244339, 0.21932998299598694, 0.0005005216225981712, 0.31649550795555115, 0.00791858695447445, 0.26695072650909424, -0.1432407945394516, -0.034490834921598434, 0.08651245385408401, 0.36729326844215393, 0.026568703353405, -0.4549596905708313, -0.18364496529102325, 0.17990820109844208, -0.2702328860759735, 0.1514022946357727, 0.07085871696472168, 0.3094589114189148, 0.05617330223321915, -0.24900348484516144, -0.22523418068885803, 0.027480168268084526, 0.5451721549034119, -0.35277462005615234, -0.018803618848323822, -0.2764957845211029, -0.07314936816692352, 0.0009454786777496338, -0.026787230744957924, -0.055875636637210846, 0.15594828128814697, 0.3441935181617737, -0.023186516016721725, 0.016639210283756256, 0.5259159803390503, 0.3384445011615753, -0.014144767075777054, 0.2228991687297821, 0.30955618619918823, -0.14245504140853882, -0.13827355206012726, 0.2796635627746582, -0.15022647380828857 ]
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
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)
[ -0.3791671097278595, 0.050338536500930786, 0.09748871624469757, -0.04825696349143982, 0.002400001510977745, -0.21923071146011353, 0.3753836452960968, 0.1487511396408081, -0.3108586072921753, 0.21819643676280975, 0.30581262707710266, 0.3561643660068512, 0.16858717799186707, -0.14990901947021484, 0.006437202915549278, 0.10368333756923676, -0.07220534235239029, 0.19826646149158478, 0.06753367930650711, -0.3354039192199707, -0.2386721670627594, -0.13017752766609192, -0.2205159068107605, -0.10501463711261749, -0.1917945146560669, -0.05285772681236267, 0.26170799136161804, 0.4899827539920807, 0.12371724843978882, -0.1780557483434677, 0.3291616439819336, 0.06668902933597565, -0.04528326541185379, 0.2033991515636444, -0.00013153968029655516, 0.03050772100687027, 0.3061804175376892, -0.022305024787783623, -0.09310220181941986, 0.12928681075572968, -0.3902131915092468, 0.06908408552408218, -0.07806740701198578, -0.3590134382247925, 0.11118134111166, 0.2647046446800232, 0.006277225911617279, -0.04756319895386696, 0.08632462471723557, -0.10147935897111893, -0.024293486028909683, 0.3496359586715698, -0.1721944659948349, -0.01862076111137867, 0.2617880403995514, 0.2782248258590698, -0.0969105139374733, 0.28093627095222473, 0.22975441813468933, 0.19835224747657776, -0.1951904296875, 0.3816770315170288, -0.3715249300003052, 0.23813068866729736, -0.02185436338186264, 0.0084657808765769, 0.10850052535533905, -0.07012440264225006, 0.06671226024627686, 0.08553904294967651, 0.03268667683005333, -0.06929662078619003, -0.3268125057220459, -0.2611371576786041, -0.05794714763760567, -0.6687778830528259, 0.24140864610671997, -0.18899257481098175, -0.22161553800106049, 0.24602657556533813, -0.17905963957309723, -0.24691446125507355, 0.01304548978805542, 0.06890298426151276, 0.16610784828662872, -0.18708708882331848, 0.2741837799549103, 0.08819170296192169, 0.06579598784446716, 0.09910859167575836, -0.12394445389509201, -0.12267450988292694, 0.27583903074264526, -0.0004414292052388191, -0.47962498664855957, -0.022571679204702377, 0.21987998485565186, -0.029476895928382874, 0.09809411317110062, 0.6454098224639893, -0.14463311433792114, 0.2676209807395935, 0.2168571799993515, 0.023235958069562912, 0.12660221755504608, -0.142768993973732, -0.06810884922742844, 0.2728596031665802, 0.23731866478919983, 0.17784163355827332, -0.01491197943687439, 0.04794450104236603, -0.02685311809182167, -0.28303712606430054, 0.3757818937301636, 0.24065139889717102, 0.29742366075515747, -0.059355393052101135, -0.0932813212275505, -0.03799359127879143, -0.17479208111763, -0.11309056729078293, 0.056841712445020676, 0.14631864428520203, 0.11523599922657013, -0.11697744578123093, -0.509255588054657, 0.10168341547250748, -0.39076870679855347, -0.23062483966350555, -0.02020266093313694, -0.07020282745361328, -0.054421789944171906, 0.2726138234138489, 0.09124094247817993, -0.21129685640335083, 0.012766841799020767, 0.062313199043273926, 0.6031616926193237, 0.27672770619392395, 0.3480805456638336, -0.09001392126083374, 0.18389123678207397, 0.3039773404598236, -0.08536119759082794, 0.34808632731437683, 0.1656492054462433, -0.2572820782661438, -0.23733043670654297, 0.46790364384651184, -0.19310474395751953, -0.5917116403579712, 0.032729484140872955, -0.11661629378795624, -0.1090761125087738, 0.051525089889764786, -0.6531386375427246, -0.2790510654449463, 0.12065975368022919, 0.040279876440763474, 0.08621364831924438, 0.0506722554564476, -0.2118503898382187, -0.19280748069286346, 0.3601130545139313, 0.4810897707939148, -0.41019386053085327, -0.02215142920613289, -0.3223768174648285, 0.1264675259590149, 0.47132083773612976, 0.4305625855922699, -0.2945897579193115, 0.04404730349779129, -0.4104922115802765, 0.5247132182121277, 0.28796419501304626, -0.2255866378545761, -0.572117805480957, 0.03929545730352402, -0.4843524694442749, 0.3238891065120697, 0.15673992037773132, 0.13182440400123596, 0.13671189546585083, -0.12546224892139435, -0.004781089723110199, 0.39360684156417847, -0.18206065893173218, 0.00171566940844059, -0.318983793258667, -0.009443342685699463, 0.01190144196152687, 0.26334112882614136, 0.20262400805950165, 0.05922745168209076, 0.059776369482278824, -0.38970747590065, 0.31263986229896545, 0.0005280114710330963, 0.013343129307031631, 0.05199338495731354, 0.5070810317993164, -0.5280716419219971, 0.10874038934707642, -0.027055367827415466, -0.2552510201931, 0.3817961513996124, 0.33905690908432007, -0.1803838014602661, -0.34524422883987427, -0.09034108370542526, -0.18540343642234802, -0.05125343054533005, -0.30155137181282043, 0.37874677777290344, -0.1373753845691681, 0.006872944533824921, -0.014864090830087662, 0.12188078463077545, -0.17054155468940735, -0.08840153366327286, -0.5698511600494385, 0.16455335915088654, -0.253631591796875, 0.575193464756012, 0.31777507066726685, -0.07245268672704697, -0.15342561900615692, -0.19951197504997253, 0.20121163129806519, -0.34820812940597534, 0.03009389340877533, 0.351289838552475, -0.012870652601122856, 0.5196894407272339, 0.3709700107574463, 0.11189064383506775, 0.019814644008874893, -0.10645727813243866, -0.14318512380123138, -0.08530212938785553, -0.06504841148853302, -0.09259581565856934, 0.12947481870651245, 0.5261216163635254, -0.3205986022949219, 0.45226019620895386, 0.07392323017120361, -0.07035756856203079, 0.31199318170547485, -0.3051135241985321, -0.1915166974067688, -0.006132360547780991, 0.26970648765563965, 0.3648209869861603, -0.18960270285606384, 0.09061237424612045, -0.30235880613327026, 0.2800285518169403, 0.5543304085731506, -0.10465840995311737, -0.0799076184630394, 0.22055518627166748, 0.17723557353019714, -0.017235830426216125, 0.027138641104102135, 0.540419340133667, 0.348785936832428, -0.047955673187971115, 0.12723183631896973, -0.38159993290901184, -0.07951037585735321, -0.1905898153781891, 0.08392760902643204, 0.16555312275886536, -0.013910790905356407, 0.27609023451805115, 0.09724985808134079, -0.12403232604265213, -0.23922193050384521, -0.037938885390758514, 0.15937665104866028, 0.02550235018134117, 0.010599277913570404, 0.14770323038101196, -0.34348589181900024, 0.14982014894485474, -0.06780542433261871, -0.02590043470263481, -0.22826820611953735, -0.2399577498435974, -0.02741686999797821, 0.050881508737802505, -0.07822879403829575, 0.39767536520957947, 0.33281341195106506, 0.05749191343784332, -0.07592231035232544, -0.5630614757537842, -0.14521905779838562, -0.08924373984336853, 0.2137671709060669, -0.12471283972263336, 0.41854169964790344, 0.335020512342453, 0.3061690330505371, -0.13658401370048523, -0.15892422199249268, -0.4925891160964966, 0.07764101773500443, 0.09429793804883957, 0.0856194943189621, 0.21924962103366852, -0.10575692355632782, 0.03426272049546242, -0.19161131978034973, 0.056559108197689056, 0.25269195437431335, 0.04997248947620392, -0.021165205165743828, 0.30399563908576965, -0.2380949854850769, 0.28339260816574097, 0.19858504831790924, 0.030464909970760345, -0.011287050321698189, -0.16362281143665314, 0.07614726573228836, 0.27502569556236267, 0.10867831110954285, -0.12696392834186554, -0.15408556163311005, -0.0786706879734993, -0.13596679270267487, -0.25056710839271545, 0.03547836095094681, -0.49920228123664856, 0.43710947036743164, 0.024475596845149994, -0.022025663405656815, -0.006495758891105652, -0.31707799434661865, 0.03262218460440636, 0.49684202671051025, -0.5602245926856995, -0.17755338549613953, -0.28286653757095337, 0.26383882761001587, 0.010496832430362701, -0.12880775332450867, 0.35933148860931396, -0.06906160712242126, -0.04014534503221512, 0.06957708299160004, 0.04586349055171013, 0.13623705506324768, 0.2709784507751465, -0.13223636150360107, 0.15627923607826233, 0.40563634037971497, -0.013250337913632393, 1.4252471923828125, 0.023546073585748672, 0.10168035328388214, 0.14811637997627258, 0.10512801259756088, -0.00396723672747612, -0.18911123275756836, -0.2473946511745453, -0.19967083632946014, -0.05970010161399841, -0.26480865478515625, -0.2690991163253784, -0.13786691427230835, 0.006304863374680281, -0.014929646626114845, -0.2350541055202484, 0.06809112429618835, -0.5601547956466675, 0.10386910289525986, -0.05887170881032944, 0.30687370896339417, 0.3096943795681, 0.04026687890291214, -0.3766030967235565, -0.048664554953575134, 0.12254086136817932, 0.15589970350265503, 0.7305282950401306, -0.14000310003757477, -0.20777417719364166, -0.08891277015209198, -0.4380952715873718, 0.06976993381977081, 0.24937552213668823, -0.14342401921749115, 0.40496373176574707, -0.20378684997558594, 0.2707134485244751, 0.007185048423707485, 0.233364075422287, -0.13335581123828888, 0.2022353708744049, 0.11086826026439667, -0.37645772099494934, -0.13651823997497559, 0.10492099821567535, 0.13968725502490997, 0.38062483072280884, 0.1339094340801239, 0.2962867021560669, -0.27696698904037476, -0.040763530880212784, 0.14888402819633484, 0.34436482191085815, -0.30390557646751404, -0.23304490745067596, -0.284827321767807, 0.03936295211315155, -0.5592682361602783, 0.16831067204475403, 0.030322792008519173, -0.06880517303943634, -0.14111734926700592, -0.10541434586048126, -0.22090549767017365, 0.020499195903539658, -0.2770622968673706, 0.005460098385810852, 0.34445643424987793, -0.27552130818367004, 0.3923220932483673, 0.05176137387752533, -0.1501912921667099, 0.46846798062324524, 0.5152263641357422, 0.1701550930738449, 0.1901034414768219, -0.09496250748634338, -0.15471623837947845, 0.23093129694461823, 0.517268180847168, -0.27372559905052185, 0.3305896818637848, -0.1545480489730835, 0.2858733832836151, -0.26616355776786804, -0.3756423890590668, 0.29675525426864624, -0.13346043229103088, 0.05457959324121475, 0.07556746900081635, 0.3022230863571167, -0.2905503213405609, -0.01837768405675888, 0.21842361986637115, 0.6414003372192383, 0.18315492570400238, 0.10632403194904327, 0.07466233521699905, 1.0935248136520386, 0.0678735002875328, 0.1425943523645401, 0.02394217625260353, 0.23226450383663177, 0.20526684820652008, 0.04167664796113968, 0.12911665439605713, -0.06401359289884567, -0.38996565341949463, 0.08172960579395294, -0.2583949565887451, -0.05417478829622269, 0.08106197416782379, -0.00024210289120674133, 0.2690967619419098, -0.15576669573783875, 0.13601413369178772, -0.13609176874160767, -0.18931037187576294, 0.16903038322925568, -0.14523717761039734, 0.186923086643219, -0.19942191243171692, 0.30521488189697266, -0.14510774612426758, 0.04266433045268059, -0.056758470833301544, 0.056586284190416336, -0.000539734959602356, -0.25209659337997437, 0.02207707241177559, 0.19682511687278748, 0.047730207443237305, 0.003246024250984192, -0.5262996554374695, -0.1158086359500885, -0.12080848217010498, 0.18496465682983398, -0.14043037593364716, 0.02291037328541279, 0.1418284922838211, 0.25904718041419983, 0.21974970400333405, -0.10372482240200043, -0.20908810198307037, 0.1681847870349884, 0.010991368442773819, -0.05250885337591171, -0.00691840797662735, -0.24301296472549438, -0.464760422706604, -0.25855687260627747, 0.1847674399614334, 0.1482420712709427, 0.332156777381897, 0.04590485990047455, 0.17266395688056946, -0.16621845960617065, -0.3143472969532013, -0.06885889172554016, 0.2724088430404663, 0.23198910057544708, 0.20718854665756226, -0.09704183042049408, -0.2084294557571411, -0.14038854837417603, 0.14715169370174408, 0.05574822425842285, 0.08752232789993286, 0.31344735622406006, -0.1563781201839447, -0.25849950313568115, -0.01544412225484848, -0.005257643759250641, -0.08479780703783035, -0.7229936718940735, 0.2779177129268646, -0.09644815325737, 0.4907277822494507, -0.045727234333753586, -0.21261104941368103, -0.11195124685764313, -0.2000492513179779, -0.6360455751419067, -0.06520840525627136, 0.04598414897918701, -0.018101826310157776, 0.1309284269809723, 0.07060199230909348, -0.4426499307155609, -0.09006714820861816, -0.12702132761478424, 0.12859731912612915, -0.08447710424661636, 0.18781742453575134, -0.27372297644615173, 0.25083127617836, 0.20734462141990662, 0.10395766794681549, -0.021748382598161697, -0.08931070566177368, -0.1413797289133072, 0.2660558819770813, -0.021916087716817856, 0.010466169565916061, -0.09339162707328796, 0.28727981448173523, -0.01345226913690567, 0.022764280438423157, 0.3965557813644409, -0.1129327267408371, -0.047790590673685074, -0.10789870470762253, -0.0500287301838398, -0.06261494010686874, 0.07971419394016266, -0.16892628371715546, 0.7873846292495728, -0.11161213368177414, -0.1740972399711609, 0.04099436104297638, -0.14438915252685547, 0.4722750186920166, -0.27905598282814026, 0.16638708114624023, -0.021585848182439804, -0.054189883172512054, 0.023114455863833427, -0.23091068863868713, 0.17579026520252228, 0.19562360644340515, 0.33968406915664673, -0.24834732711315155, -0.3097093999385834, -0.2515905201435089, 0.5282261371612549, 0.34030449390411377, -0.04745268449187279, -0.25782057642936707, 0.17070478200912476, 0.044294774532318115, -0.3581778407096863, -0.45627057552337646, 0.38398972153663635, -0.008632452227175236, 0.09267301857471466, 0.15970629453659058, -0.0592360645532608, 0.028823867440223694, 0.11559058725833893, 0.10354966670274734, -0.02270950749516487, -0.42647528648376465, -0.17100967466831207, 0.09393024444580078, 0.1300627589225769, -0.11984504759311676, 0.1693786233663559, 0.34771662950515747, 0.3069648742675781, 0.3209526538848877, -0.2118128538131714, 0.583736777305603, 0.09084440767765045, 0.0820441022515297, -0.05989114195108414, -0.47411099076271057, 0.07093030959367752, 0.3155612051486969, -0.027843400835990906, -0.03211141377687454, 0.2014845460653305, 0.1693294495344162, 0.37024733424186707, 0.12862195074558258, -0.32482025027275085, 0.1744484007358551, 0.05823788046836853, -0.06454712152481079, 0.15453147888183594, -0.028890326619148254, -0.3056446313858032, 0.05964890494942665, 0.010386727750301361, 0.3346332907676697, 0.5342023372650146, 0.17586827278137207, 0.3329770565032959, -0.11814488470554352, 0.1994679868221283, -0.36719098687171936, 0.1550237238407135, -0.20344211161136627, -0.3532309830188751, 0.4187939167022705, -0.06991340219974518, -0.07639704644680023, 0.0264084842056036, 0.045991770923137665, -0.015347827225923538, -0.01235906034708023, 0.26463842391967773, 0.23065538704395294, 0.03870438039302826, -0.04660843312740326, 0.2855084538459778, -0.27863913774490356, 0.1961754560470581, 0.10069890320301056, -0.10542833805084229, -0.13189101219177246, -0.04266119375824928, 0.1353267878293991, 0.22388984262943268, -0.4501492977142334, 0.27203163504600525, 0.05801005661487579, -0.12752792239189148, -0.205839142203331, 0.06023859605193138, -0.06180402636528015, -0.07177478820085526, 0.25856146216392517, -0.31723442673683167, -0.15313801169395447, -0.08989160507917404, -0.01790088415145874, -0.5782341361045837, 0.3833732604980469, 0.22635787725448608, 0.11598721146583557, -0.4116402566432953, -0.24513553082942963, -0.544548511505127, 0.27302849292755127, -0.2579136788845062, 0.24688324332237244, 0.38669347763061523, 0.5223082900047302, 0.11593194305896759, 0.29797452688217163, 0.3860936760902405, -0.28721997141838074, -0.36536848545074463, 0.3642432987689972, -0.2079724371433258, -0.4147810935974121, -0.11462041735649109, -0.5639613270759583, -0.20859655737876892, -0.4442308247089386, 0.30792248249053955, 0.05118045210838318, -0.04219821095466614, 0.17533673346042633, -0.33400958776474, 0.5419373512268066, 0.2562052309513092, 0.28879082202911377, 0.055819958448410034, -0.18368154764175415, 0.03056856244802475, -0.25634127855300903, 0.21570032835006714, -0.10522283613681793, -0.23002482950687408, -0.08201714605093002, -0.18292400240898132, 0.3358318507671356, -0.10111559927463531, 0.015264099463820457, -0.3035027086734772, -0.1596158891916275, -0.019455881789326668, 0.1024903878569603, -0.2358548790216446, 0.011866047978401184, 0.05912172794342041, 0.17514795064926147, -0.1627824306488037, -0.06420274823904037, 0.0967305600643158, 0.39081189036369324, -0.1939622461795807, -0.23686179518699646, 0.5835202932357788, -0.42323365807533264, 0.02173987776041031, -0.1635127067565918, 0.17569836974143982, 0.10860001295804977, -0.15556871891021729, -0.17747530341148376, -0.15527912974357605, 0.32542452216148376, 0.22589319944381714, -0.02027174085378647, 0.08229178190231323, 0.14980460703372955, 0.09893418848514557, -0.16361890733242035, 0.08931230753660202, 0.014965035021305084, -0.09784092009067535, -0.024482320994138718, -0.20954445004463196 ]
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
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
[ -0.32499897480010986, -0.07473821938037872, 0.0636654794216156, 0.04388701170682907, 0.06393728405237198, -0.15074098110198975, 0.4119350016117096, 0.19467374682426453, -0.29617542028427124, 0.24161304533481598, 0.26046234369277954, 0.25967657566070557, 0.14979690313339233, -0.1403394639492035, 0.08380487561225891, 0.13497722148895264, -0.036867283284664154, 0.1938260942697525, 0.17893287539482117, -0.30946093797683716, -0.22010450065135956, -0.10850907862186432, -0.12326764315366745, -0.19970740377902985, -0.23670189082622528, -0.03457615524530411, 0.23952564597129822, 0.5196138024330139, 0.13116736710071564, -0.1673688441514969, 0.23931999504566193, 0.1051412969827652, -0.000636308453977108, 0.26328185200691223, -0.00013120142102707177, 0.037309132516384125, 0.3117481470108032, -0.04346825182437897, -0.018552685156464577, 0.1342913657426834, -0.37047865986824036, 0.027649113908410072, -0.08023981750011444, -0.42987895011901855, 0.16600146889686584, 0.2973264455795288, 0.08046796917915344, -0.11521290987730026, 0.21137705445289612, -0.10540443658828735, -0.02594052627682686, 0.3243975341320038, -0.2889990508556366, 0.08299464732408524, 0.3775250017642975, 0.24288557469844818, -0.07135564833879471, 0.1863313615322113, 0.21247056126594543, 0.2526628077030182, -0.22372868657112122, 0.4713173508644104, -0.39958587288856506, 0.2872883081436157, 0.052484042942523956, 0.02483612298965454, 0.06735434383153915, -0.20551073551177979, -0.0010522715747356415, 0.1011049747467041, 0.05569007247686386, -0.11492279917001724, -0.3592931628227234, -0.2902752161026001, -0.1458803415298462, -0.7246290445327759, 0.18796461820602417, -0.13661585748195648, -0.22082701325416565, 0.21355889737606049, -0.3488255739212036, -0.29365795850753784, -0.056546833366155624, 0.07252457737922668, 0.16078294813632965, -0.3665658235549927, 0.26039719581604004, 0.0534687414765358, 0.024363389238715172, 0.14761003851890564, 0.001103182788938284, -0.14658142626285553, 0.2790694534778595, -0.04797784984111786, -0.4045161008834839, -0.04564392939209938, 0.1737433522939682, 0.008800029754638672, 0.1395309865474701, 0.5941048860549927, -0.19594933092594147, 0.297380656003952, 0.19732969999313354, 0.09483152627944946, 0.09007668495178223, -0.05962109565734863, -0.09619205445051193, 0.22986148297786713, 0.27095139026641846, 0.13142916560173035, -0.10305890440940857, -0.035212911665439606, 0.0060053542256355286, -0.2005886286497116, 0.4036942422389984, 0.20347481966018677, 0.2587783932685852, -0.08650083839893341, -0.04821211099624634, -0.07079187780618668, -0.07518531382083893, -0.1199905052781105, -0.007782741449773312, 0.18869638442993164, 0.09311141073703766, -0.12421707063913345, -0.5065881609916687, 0.12905985116958618, -0.300204873085022, -0.2574836313724518, -0.037384625524282455, -0.045079369097948074, -0.03789110481739044, 0.2726426124572754, 0.1453593224287033, -0.2621471583843231, 0.12934476137161255, -0.014886031858623028, 0.6737458109855652, 0.2936341166496277, 0.3898298740386963, -0.1747722178697586, 0.32010555267333984, 0.3734275698661804, -0.09728903323411942, 0.25547248125076294, 0.23417210578918457, -0.15837472677230835, -0.23114794492721558, 0.4247194528579712, -0.2481009066104889, -0.5607312321662903, 0.0602525994181633, -0.12240767478942871, -0.14690342545509338, 0.09548686444759369, -0.7098556756973267, -0.25954553484916687, 0.1572239100933075, 0.0209171362221241, 0.08469795435667038, 0.06985926628112793, -0.20484523475170135, -0.17392048239707947, 0.3420913517475128, 0.5207296013832092, -0.3369382321834564, -0.05212288349866867, -0.2594470977783203, 0.1501452624797821, 0.4565013647079468, 0.4182490408420563, -0.2548319101333618, 0.04710763692855835, -0.48314622044563293, 0.46125710010528564, 0.2876199185848236, -0.35219869017601013, -0.546180009841919, 0.08882268518209457, -0.35701698064804077, 0.3264813721179962, 0.25083377957344055, 0.1923750787973404, 0.2305241823196411, -0.15959244966506958, -0.02295777201652527, 0.4392480254173279, -0.24691659212112427, 0.07577094435691833, -0.3227618932723999, -0.06737523525953293, -0.006425864994525909, 0.27478665113449097, 0.20599132776260376, 0.14248330891132355, 0.11964312940835953, -0.34254753589630127, 0.21230477094650269, -0.004955656826496124, 0.004072353709489107, 0.06231136620044708, 0.4659331738948822, -0.539210319519043, 0.15874841809272766, -0.007563533261418343, -0.34488585591316223, 0.36396047472953796, 0.24458229541778564, -0.1817217469215393, -0.36547327041625977, -0.0906517282128334, -0.17830458283424377, -0.14565521478652954, -0.30362436175346375, 0.2940060794353485, -0.12360065430402756, 0.04979179427027702, -0.10271435976028442, 0.15927156805992126, -0.2261279672384262, 0.05073866248130798, -0.5411615967750549, 0.16133008897304535, -0.2296341210603714, 0.5251862406730652, 0.28460192680358887, -0.07523277401924133, -0.17807045578956604, -0.2302505373954773, 0.159628227353096, -0.39797502756118774, 0.009937501512467861, 0.3253130614757538, 0.023594573140144348, 0.576038658618927, 0.3497959077358246, 0.17196524143218994, 0.08217360079288483, -0.1504470407962799, -0.13086430728435516, -0.07252825796604156, -0.08606434613466263, -0.11109791696071625, 0.04832997918128967, 0.49016934633255005, -0.2193521112203598, 0.4028363525867462, 0.05291484296321869, -0.1095188707113266, 0.25010818243026733, -0.3066604435443878, -0.26333582401275635, -0.04043810814619064, 0.2549576163291931, 0.3590061366558075, -0.08130288124084473, 0.04031362012028694, -0.19002513587474823, 0.24061080813407898, 0.5471373796463013, 0.023625437170267105, -0.10912258177995682, 0.21921202540397644, 0.14383822679519653, -0.028000418096780777, 0.10279668122529984, 0.5566016435623169, 0.2925684452056885, 0.04249086603522301, 0.10740754008293152, -0.3307639956474304, -0.01675501838326454, -0.1373918056488037, 0.05557207763195038, 0.17946453392505646, 0.058762528002262115, 0.265400230884552, 0.16744661331176758, -0.02559465914964676, -0.2711641788482666, -0.01970883086323738, 0.1201479509472847, -0.02598496712744236, 0.024265866726636887, 0.11171839386224747, -0.30967602133750916, 0.0616690069437027, -0.015298900194466114, 0.05641854926943779, -0.2595672309398651, -0.22167661786079407, 0.01766778528690338, 0.017312433570623398, -0.07103640586137772, 0.39306673407554626, 0.3094065189361572, 0.13538995385169983, -0.05691490322351456, -0.5811395645141602, -0.2408187985420227, -0.03592376038432121, 0.27731388807296753, -0.12896686792373657, 0.5342959761619568, 0.2592969536781311, 0.40336185693740845, -0.16680952906608582, -0.141884908080101, -0.5394373536109924, 0.0029378458857536316, 0.12309950590133667, 0.11547020077705383, 0.2736322283744812, -0.1667575240135193, 0.069375179708004, -0.24674992263317108, 0.06057062745094299, 0.21719378232955933, 0.029526429250836372, -0.11811807751655579, 0.22444824874401093, -0.20579083263874054, 0.32069656252861023, 0.13615116477012634, 0.0185559019446373, -0.0774892121553421, -0.19109110534191132, -0.010463610291481018, 0.26856529712677, 0.13416175544261932, -0.024484973400831223, -0.11870010197162628, -0.13710126280784607, -0.13358664512634277, -0.23487430810928345, 0.07778628915548325, -0.6401602625846863, 0.4053158164024353, -0.00820181891322136, -0.025903206318616867, 0.012616906315088272, -0.2814111113548279, -0.018121089786291122, 0.5768061280250549, -0.6384986042976379, -0.36369839310646057, -0.239817276597023, 0.24544090032577515, -0.0005408227443695068, -0.10943470895290375, 0.36419057846069336, -0.0847606435418129, -0.04719991981983185, 0.02021770179271698, 0.08391837775707245, 0.09346755594015121, 0.20406538248062134, -0.09497948735952377, 0.1798703968524933, 0.47556668519973755, 0.00389862060546875, 1.363340139389038, -0.05297216773033142, 0.08340473473072052, 0.2741624712944031, 0.07453175634145737, 0.10760907828807831, -0.23997697234153748, -0.2533927857875824, -0.14786185324192047, -0.08372281491756439, -0.2845190763473511, -0.2666356563568115, -0.1350109875202179, -0.02918732352554798, -0.08157442510128021, -0.18474993109703064, -0.028516970574855804, -0.4532405734062195, 0.02915237657725811, -0.10501120984554291, 0.33178168535232544, 0.35265424847602844, -0.0758182555437088, -0.3927382528781891, -0.07478266209363937, 0.1317237913608551, 0.1705654412508011, 0.7642403841018677, -0.08412612974643707, -0.19707992672920227, -0.060157883912324905, -0.43801355361938477, 0.04373084008693695, 0.29485416412353516, -0.2121460884809494, 0.35458919405937195, -0.1278088390827179, 0.24737846851348877, 0.0038703102618455887, 0.35890334844589233, -0.1395016461610794, 0.16312634944915771, 0.06565405428409576, -0.38222870230674744, -0.08420439064502716, 0.09987285733222961, 0.1717568188905716, 0.35976099967956543, 0.12930703163146973, 0.39137017726898193, -0.27015259861946106, -0.02124946005642414, 0.08370812237262726, 0.36944207549095154, -0.2697576880455017, -0.2597273290157318, -0.2941187620162964, 0.04186058044433594, -0.5921725034713745, 0.16156324744224548, 0.13951243460178375, -0.11073069274425507, -0.19911199808120728, -0.150590181350708, -0.2355511337518692, 0.07491248846054077, -0.23505155742168427, 0.0008154427632689476, 0.40211954712867737, -0.27099138498306274, 0.3010689914226532, -0.0032512061297893524, -0.07159039378166199, 0.4454101622104645, 0.4336536228656769, 0.1071985512971878, 0.1844753473997116, -0.0695556029677391, -0.1821538507938385, 0.16767676174640656, 0.5309290885925293, -0.2216242551803589, 0.24995005130767822, -0.19498087465763092, 0.2753536105155945, -0.17710450291633606, -0.2802145183086395, 0.24943450093269348, -0.17943070828914642, 0.13792964816093445, 0.0958210900425911, 0.3210888206958771, -0.26585739850997925, 0.012774862349033356, 0.21405427157878876, 0.5415531992912292, 0.160874143242836, 0.07011912763118744, 0.0866292417049408, 1.1595650911331177, 0.05101022124290466, 0.24217215180397034, 0.012096751481294632, 0.257168173789978, 0.21352215111255646, -0.09464973211288452, 0.15209703147411346, -0.0514925941824913, -0.3363654613494873, 0.04977338761091232, -0.3003864884376526, -0.08770626038312912, 0.12170203775167465, -0.03358960896730423, 0.24168437719345093, -0.09171748906373978, 0.23917394876480103, -0.1528652012348175, -0.15438780188560486, 0.1190757304430008, -0.1876521110534668, 0.08786429464817047, -0.16514091193675995, 0.28276342153549194, -0.16239845752716064, 0.015507219359278679, -0.08211342245340347, 0.06476318836212158, 0.029510177671909332, -0.15355291962623596, 0.0012905783951282501, 0.10234904289245605, 0.10494724661111832, -0.09680157899856567, -0.58560711145401, -0.19038906693458557, -0.05052264407277107, 0.3058314919471741, -0.22028197348117828, -0.01683838851749897, 0.1310889571905136, 0.22661420702934265, 0.21582354605197906, -0.19208993017673492, -0.25994619727134705, 0.18854708969593048, -0.05563519895076752, -0.023381613194942474, 0.0013350620865821838, -0.25788414478302, -0.5171258449554443, -0.1635473072528839, 0.22269083559513092, 0.20561988651752472, 0.33682459592819214, 0.0029345396906137466, 0.1480441689491272, -0.1383073925971985, -0.2781747877597809, -0.06244640424847603, 0.2695077657699585, 0.2225034236907959, 0.26845693588256836, -0.07145810127258301, -0.18645289540290833, -0.13392432034015656, 0.14023946225643158, 0.053911447525024414, 0.0020112060010433197, 0.3313460648059845, -0.27201589941978455, -0.24168023467063904, -0.01313728280365467, 0.06153937429189682, -0.1569349318742752, -0.7108496427536011, 0.2824392020702362, -0.050151266157627106, 0.4663339853286743, -0.12848462164402008, -0.24921149015426636, -0.1072351485490799, -0.12579187750816345, -0.5731110572814941, -0.06327087432146072, -0.01413825061172247, -0.0219731405377388, -0.007281690835952759, 0.1747613549232483, -0.3731231689453125, -0.10312719643115997, -0.1062546968460083, 0.13196679949760437, -0.10975848138332367, 0.20203045010566711, -0.3130597174167633, 0.2103724628686905, 0.19641214609146118, 0.11853809654712677, 0.0047227004542946815, -0.08371537923812866, -0.18860508501529694, 0.299022376537323, -0.13352727890014648, -0.010676110163331032, -0.05054129660129547, 0.2772977352142334, 0.044569551944732666, 0.021983329206705093, 0.37099871039390564, -0.055074870586395264, -0.05928761139512062, -0.09188316762447357, 0.0032510291785001755, -0.07974812388420105, 0.0827988013625145, -0.15534374117851257, 0.8998810052871704, -0.06999237090349197, -0.13426001369953156, 0.01274813897907734, -0.07245789468288422, 0.5003685355186462, -0.23557265102863312, 0.14853334426879883, -0.08105555921792984, 0.008151546120643616, 0.0694851279258728, -0.21819502115249634, 0.27020537853240967, 0.1738303005695343, 0.31260383129119873, -0.25243669748306274, -0.28692084550857544, -0.15324442088603973, 0.4532717168331146, 0.23985525965690613, -0.12745845317840576, -0.24399258196353912, 0.20712345838546753, 0.05331999808549881, -0.3312380909919739, -0.3983713388442993, 0.4815496504306793, -0.11843351274728775, 0.06722226738929749, 0.09124046564102173, 0.1216290295124054, 0.0815577507019043, 0.25037139654159546, 0.12730610370635986, 0.24543297290802002, -0.5501194596290588, -0.20590804517269135, -0.08532507717609406, 0.14647576212882996, -0.08068521320819855, 0.1493200808763504, 0.3827018141746521, 0.3109825551509857, 0.22449015080928802, -0.1932971179485321, 0.5477530360221863, 0.023401862010359764, 0.1067715436220169, -0.08143643289804459, -0.4922751486301422, 0.12547269463539124, 0.332522988319397, 0.013951748609542847, -0.010655194520950317, 0.11824895441532135, 0.1724248230457306, 0.4404657185077667, 0.12218423187732697, -0.2663010060787201, 0.23222394287586212, 0.10969920456409454, -0.029122907668352127, 0.23961302638053894, -0.03811842203140259, -0.2669748365879059, 0.029971402138471603, 0.019822699949145317, 0.30984586477279663, 0.4490880072116852, 0.21460171043872833, 0.19064593315124512, 0.01116124540567398, 0.16560840606689453, -0.2850392460823059, 0.17289525270462036, -0.21715395152568817, -0.2939487099647522, 0.3897016644477844, -0.08821399509906769, -0.04496927931904793, 0.1516573280096054, 0.02465040050446987, -0.0022032149136066437, 0.031683363020420074, 0.17917004227638245, 0.266412615776062, 0.050026632845401764, -0.11361673474311829, 0.21939244866371155, -0.27386918663978577, 0.07246291637420654, 0.05259077623486519, -0.09365425258874893, -0.15153563022613525, -0.023462433367967606, 0.08883607387542725, 0.12763860821723938, -0.4126698672771454, 0.1709492802619934, 0.04803825169801712, -0.12827010452747345, -0.18965177237987518, 0.03898363932967186, -0.137383371591568, -0.07906327396631241, 0.3070741593837738, -0.34483352303504944, -0.15306219458580017, -0.03501492738723755, -0.014585028402507305, -0.6176919937133789, 0.3550315797328949, 0.31751975417137146, 0.13312987983226776, -0.4350467622280121, -0.28619492053985596, -0.5738707780838013, 0.349089115858078, -0.22629740834236145, 0.19642232358455658, 0.38860711455345154, 0.560986340045929, 0.12553071975708008, 0.30058783292770386, 0.3146229386329651, -0.2853309214115143, -0.349234402179718, 0.29331308603286743, -0.27337610721588135, -0.3349831998348236, -0.10300454497337341, -0.4664687514305115, -0.18348832428455353, -0.42972052097320557, 0.29819345474243164, 0.06086438521742821, -0.040857695043087006, 0.17039865255355835, -0.25186342000961304, 0.5118829011917114, 0.23489147424697876, 0.3171296715736389, 0.0830589160323143, -0.21225208044052124, -0.008823757991194725, -0.23515020310878754, 0.23581722378730774, -0.15614436566829681, -0.24260592460632324, -0.24066373705863953, -0.13140448927879333, 0.37905025482177734, -0.17792238295078278, -0.16108889877796173, -0.29518255591392517, 0.02412070706486702, -0.04319441691040993, 0.021449746564030647, -0.08270727843046188, -0.014377834275364876, 0.06097087264060974, 0.1402387171983719, -0.16594786942005157, -0.09753497689962387, 0.10529930889606476, 0.34199053049087524, -0.2794879078865051, -0.2347773164510727, 0.5797295570373535, -0.43341583013534546, 0.03060305491089821, -0.1463990956544876, 0.1883193552494049, 0.02761218696832657, -0.11775141209363937, -0.15971091389656067, -0.10427197068929672, 0.3427581489086151, 0.23948654532432556, -0.09096729010343552, 0.23175886273384094, 0.2207486480474472, 0.09730930626392365, -0.1320667713880539, -0.04364345967769623, 0.011841004714369774, -0.017262525856494904, -0.13704681396484375, -0.1691703349351883 ]
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
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.
[ -0.47941604256629944, 0.13001763820648193, 0.048481207340955734, 0.24561132490634918, 0.19157905876636505, 0.01985044777393341, 0.06988294422626495, 0.007371118292212486, -0.10162252187728882, 0.028838932514190674, -0.2577296495437622, 0.0185047946870327, 0.16833677887916565, -0.15974703431129456, -0.12856338918209076, -0.06466706842184067, -0.024791918694972992, 0.12850938737392426, -0.1653439998626709, 0.0805395096540451, -0.21475277841091156, 0.19036899507045746, -0.19386523962020874, -0.032751813530921936, -0.14702971279621124, -0.11619345098733902, -0.07267764210700989, 0.33671602606773376, -0.06737684458494186, -0.5940631628036499, 0.31360235810279846, -0.035747598856687546, 0.2208145409822464, 0.43504273891448975, -0.00012662424705922604, 0.06172558665275574, 0.4740002751350403, -0.07114317268133163, -0.36867114901542664, -0.3259328007698059, -0.5980454683303833, 0.03848745673894882, 0.12239380925893784, 0.003993697464466095, 0.15405571460723877, 0.07706409692764282, -0.02352508343756199, -0.348113089799881, 0.4756125807762146, 0.40651655197143555, 0.07598276436328888, 0.2552172839641571, 0.2897399365901947, 0.062160179018974304, 0.1613682210445404, -0.23368938267230988, -0.045489344745874405, 0.5535508394241333, 0.25346606969833374, -0.02389240637421608, 0.08605866879224777, -0.021980326622724533, 0.07648050785064697, 0.2718890309333801, 0.1442667543888092, 0.05677342414855957, -0.17233434319496155, -0.3504337668418884, -0.024725742638111115, 0.29421648383140564, 0.6490100026130676, -0.25542891025543213, -0.3942347466945648, 0.020923174917697906, -0.07723648846149445, -0.20820148289203644, 0.2876889407634735, 0.14277900755405426, -0.1771421581506729, 0.34328529238700867, -0.3466852605342865, -0.26573389768600464, -0.276372492313385, 0.4135652780532837, 0.08170981705188751, 0.15284773707389832, -0.21139052510261536, 0.3451628088951111, 0.15783925354480743, -0.005399491637945175, 0.1444578915834427, -0.06607072055339813, -0.07215453684329987, 0.15900473296642303, -0.3528973460197449, 0.015618890523910522, -0.18035441637039185, 0.26800206303596497, 0.15659749507904053, 0.31372714042663574, -0.036184001713991165, -0.04986371099948883, -0.09375873953104019, 0.17350387573242188, 0.3932109475135803, 0.08728256821632385, -0.13330814242362976, -0.06712805479764938, 0.5524076223373413, 0.29085734486579895, 0.10432977974414825, -0.09206338971853256, 0.04405944049358368, -0.21599653363227844, 0.3986082375049591, -0.10868319123983383, 0.5447553992271423, -0.20190858840942383, -0.28787901997566223, 0.05356612429022789, -0.28156888484954834, 0.02477002888917923, -0.0681207999587059, 0.3218804895877838, -0.3127772808074951, 0.15214532613754272, -0.060310713946819305, 0.39055949449539185, -0.053796641528606415, -0.03322118893265724, -0.026554375886917114, -0.344855397939682, 0.1942252516746521, 0.13986732065677643, 0.23085586726665497, -0.2254813313484192, 0.18466593325138092, 0.10718312114477158, 0.12661615014076233, -0.18556177616119385, 0.07685088366270065, -0.15652135014533997, -0.19431322813034058, 0.37380605936050415, 0.29704251885414124, 0.15166805684566498, 0.21479485929012299, -0.07935995608568192, -0.10795939713716507, 0.03787193074822426, -0.3297211825847626, -0.483660489320755, -0.0039199721068143845, 0.05641357973217964, -0.16651205718517303, 0.09685912728309631, -0.3504056930541992, -0.31859657168388367, 0.1168113648891449, -0.38921985030174255, -0.08369190245866776, -0.2988002300262451, -0.16498520970344543, -0.14499375224113464, 0.3499515652656555, 0.5565464496612549, -0.09663870185613632, -0.04961368814110756, -0.24264155328273773, -0.0894424319267273, 0.14360156655311584, 0.2573101222515106, -0.09466882795095444, 0.1024700328707695, -0.3067251741886139, -0.07125042378902435, 0.5349612236022949, -0.3749430179595947, -0.8387019634246826, 0.4603312611579895, -0.2414407879114151, 0.10099165886640549, -0.13148608803749084, 0.08368239551782608, 0.16381196677684784, 0.15164196491241455, 0.2460775226354599, 0.37058454751968384, -0.07084207236766815, -0.015419778414070606, -0.00654413178563118, -0.3953341841697693, 0.19337506592273712, 0.021140240132808685, -0.1784541755914688, 0.32183486223220825, 0.3546666204929352, -0.10856760293245316, 0.27651795744895935, 0.08526375889778137, 0.35096099972724915, 0.26148489117622375, 0.40509143471717834, 0.13284339010715485, -0.006078515667468309, -0.019409582018852234, -0.4544908404350281, 0.18549782037734985, 0.09421519935131073, 0.09080518782138824, -0.4055129289627075, -0.015952864661812782, -0.38281306624412537, 0.008412642404437065, -0.41538962721824646, 0.15728473663330078, -0.05827759951353073, 0.3836781978607178, 0.22258871793746948, 0.06573851406574249, -0.0812818706035614, 0.4021596610546112, 0.10012020170688629, 0.1190391406416893, -0.4195883870124817, 0.4322963356971741, -0.24038849771022797, 0.03311949223279953, 0.08061636239290237, 0.15614527463912964, 0.2472822666168213, -0.1393541693687439, -0.13717830181121826, 0.4770044982433319, -0.05102238804101944, 0.3334672152996063, -0.02956146001815796, 0.26732146739959717, 0.06057821214199066, -0.5514342188835144, 0.09206357598304749, 0.23484745621681213, 0.2014518529176712, -0.10114999115467072, 0.19196215271949768, 0.04278509318828583, 0.12573464214801788, 0.5579736828804016, 0.03626818209886551, 0.17806166410446167, 0.20035061240196228, 0.13285955786705017, -0.1665326952934265, 0.014486052095890045, -0.10863324999809265, -0.12182539701461792, 0.42075008153915405, -0.22375930845737457, -0.12037429213523865, -0.0776529535651207, 0.05528143048286438, -0.14684174954891205, 0.22812187671661377, 0.2501048147678375, -0.08724094182252884, -0.27621880173683167, 0.046028655022382736, 0.14275281131267548, 0.5572831630706787, 0.028135519474744797, 0.17406140267848969, 0.2508934438228607, -0.008713318966329098, -0.11726471036672592, 0.08991739153862, 0.06998840719461441, 0.13916653394699097, 0.40255001187324524, 0.23054999113082886, -0.042284272611141205, -0.29807284474372864, -0.3458721339702606, -0.112623430788517, 0.319052129983902, -0.46936535835266113, 0.19501079618930817, -0.15198247134685516, 0.06118457764387131, -0.1276368945837021, -0.288889080286026, -0.3728131949901581, -0.3325308859348297, -0.2236148864030838, 0.421378493309021, 0.1495753973722458, 0.05036839842796326, -0.2642521858215332, 0.21649989485740662, 0.19253945350646973, -0.22475068271160126, -0.11369594931602478, -0.02767886221408844, -0.2964278757572174, -0.08794376254081726, 0.06477271020412445, -0.07810668647289276, 0.16199052333831787, -0.235416978597641, -0.1345541626214981, -0.16853022575378418, 0.08096618205308914, 0.002093091607093811, 0.10492046177387238, 0.40680986642837524, 0.24082320928573608, 0.48649322986602783, 0.1999257355928421, -0.11953086405992508, 0.4028121829032898, -0.04432668909430504, 0.026157742366194725, 0.08773443847894669, -0.13743281364440918, 0.11356544494628906, 0.21510723233222961, -0.5167573094367981, -0.4305969178676605, -0.42963963747024536, 0.38128477334976196, -0.1446075439453125, 0.1152113676071167, 0.10361476242542267, 0.13729575276374817, 0.05431259423494339, -0.05178222432732582, 0.3371966779232025, -0.2967987656593323, -0.4987969398498535, 0.23244136571884155, -0.040864042937755585, -0.3047245740890503, 0.015574116259813309, 0.0768107920885086, 0.3723248839378357, 0.15196830034255981, -0.6588557958602905, -0.20696640014648438, -0.20257924497127533, 0.2531037926673889, -0.17286190390586853, 0.2607792913913727, 0.25258904695510864, 0.0019490274135023355, 0.06963646411895752, -0.007163472473621368, -0.05912545323371887, -0.08796622604131699, 0.22357326745986938, 0.26426443457603455, 0.33024534583091736, 0.5863553285598755, -0.1867770403623581, 0.7246809601783752, 0.29352644085884094, 0.28390079736709595, 0.4047968089580536, -0.26786357164382935, 0.5165363550186157, -0.0472356453537941, -0.25693124532699585, 0.021426916122436523, -0.22285476326942444, -0.07718817889690399, 0.09150448441505432, 0.20775046944618225, -0.003132246434688568, -0.3972030580043793, -0.14950227737426758, -0.2282218039035797, -0.2447434812784195, 0.05505567789077759, -0.15760427713394165, 0.2740567624568939, 0.07283720374107361, -0.07795680314302444, 0.022694561630487442, -0.07029559463262558, -0.10476571321487427, 0.32860028743743896, 0.05998595431447029, 0.17378224432468414, -0.3197498619556427, -0.11616499722003937, -0.3760451376438141, 0.2688809037208557, 0.13673743605613708, 0.9046522974967957, -0.229441836476326, 0.07294214516878128, 0.010411538183689117, 0.032080646604299545, 0.5320068597793579, -0.38149702548980713, 0.2480335682630539, 0.02406426891684532, 0.2008359581232071, -0.44701772928237915, 0.07361678779125214, -0.01123136281967163, -0.008738523349165916, 0.12877358496189117, 0.2867368459701538, -0.10087887197732925, 0.10505347698926926, -0.09989628195762634, 0.3440653085708618, -0.15633395314216614, -0.10583566129207611, -0.2457275241613388, -0.3146612048149109, -0.4145797789096832, -0.010340198874473572, -0.14802369475364685, 0.2140975147485733, 0.02284998632967472, -0.10525064170360565, 0.2942323684692383, 0.0039057657122612, -0.09559261798858643, -0.03024367056787014, -0.24121537804603577, 0.024604950100183487, 0.10387226939201355, 0.3558591902256012, -0.09729190170764923, 0.24855881929397583, 0.7927830219268799, -0.123707115650177, -0.25256800651550293, -0.043141476809978485, 0.22315867245197296, 0.19386640191078186, 0.20548033714294434, 0.009026053361594677, 0.008146442472934723, 0.4744587540626526, 0.1936831772327423, -0.2935158610343933, 0.1326151341199875, 0.32587525248527527, -0.07714031636714935, -0.12678973376750946, -0.46767741441726685, 0.31657230854034424, -0.11423905193805695, -0.1939001977443695, 0.33305487036705017, 0.21078556776046753, -0.011916868388652802, 0.02471805363893509, -0.38988178968429565, 0.9231324195861816, 0.367861270904541, 0.21946844458580017, 0.15637022256851196, -0.2968285381793976, 0.11903557181358337, -0.3175814747810364, 0.1641516089439392, -0.07776344567537308, 0.05830542370676994, -0.1540105789899826, -0.3301287293434143, 0.09014632552862167, -0.1632329225540161, -0.15415538847446442, 0.39005202054977417, -0.12505877017974854, 0.14312130212783813, 0.19602729380130768, 0.1265755593776703, -0.505862832069397, -0.08831553161144257, -0.20097331702709198, 0.06716550141572952, -0.09429629147052765, 0.4131494164466858, -0.0200326070189476, -0.02642473578453064, -0.04788047447800636, -0.48907470703125, -0.26681697368621826, 0.23452794551849365, -0.38563278317451477, 0.2203730195760727, 0.025629792362451553, -0.13394291698932648, 0.10413669049739838, 0.16916847229003906, -0.057145461440086365, -0.006685443222522736, -0.40051862597465515, 0.07058437168598175, -0.12218210846185684, 0.17201019823551178, 0.16679345071315765, -0.027393564581871033, -0.03189367055892944, -0.018582087010145187, -0.46979349851608276, 0.06097343564033508, -0.14617972075939178, -0.2538151144981384, 0.25525957345962524, 0.04404763877391815, 0.07343509793281555, -0.33329835534095764, -0.0274506863206625, -0.15430906414985657, 0.06844951212406158, -0.21351809799671173, -0.017046179622411728, 0.06364563852548599, -0.22227263450622559, 0.1401979625225067, 0.05362088978290558, -0.13099801540374756, 0.059293411672115326, 0.641423225402832, -0.1103963628411293, 0.17034758627414703, 0.39887115359306335, 0.05578154698014259, -0.0169084295630455, -0.11548688262701035, 0.20021185278892517, 0.14909934997558594, -0.320883184671402, 0.03702325373888016, -0.19063644111156464, 0.26455914974212646, -0.25893884897232056, 0.10585527867078781, 0.08983317017555237, 0.1759083867073059, -0.04648609459400177, -0.5655027627944946, -0.28995031118392944, 0.1145283430814743, 0.13360300660133362, 0.11950817704200745, -0.031492795795202255, -0.17461398243904114, 0.013796603307127953, -0.15235494077205658, -0.1611623913049698, -0.02779027260839939, -0.23573720455169678, 0.080319344997406, 0.2567156255245209, -0.2853466868400574, 0.4107418656349182, -0.14900729060173035, -0.037038981914520264, -0.15676872432231903, -0.22542904317378998, 0.014727916568517685, -0.06220012158155441, 0.2423788607120514, 0.23377951979637146, -0.5439650416374207, -0.15804947912693024, -0.28841519355773926, -0.10702556371688843, 0.03674500435590744, 0.3316706717014313, 0.040619708597660065, -0.09573103487491608, -0.10393325984477997, -0.16103017330169678, -0.09987830370664597, -0.17828400433063507, 0.11180572211742401, -0.019902721047401428, 0.2432120144367218, 0.11173098534345627, 0.2577205300331116, 0.051088105887174606, -0.15572088956832886, -0.2312241941690445, 0.21747320890426636, 0.30982542037963867, -0.13345429301261902, 0.4626518189907074, -0.2785990834236145, -0.05932210385799408, 0.058037109673023224, 0.49069973826408386, 0.4431401789188385, -0.263252317905426, 0.09200135618448257, 0.03213931620121002, 0.05333065241575241, -0.07896709442138672, -0.1702667623758316, 0.0700826495885849, -0.03958841413259506, 0.04802366718649864, 0.07473676651716232, 0.08774051070213318, -0.336641788482666, -0.2944853901863098, -0.06561984121799469, 0.4967126250267029, -0.08726556599140167, 0.021746737882494926, 0.3124846816062927, -0.06976398825645447, 0.11958543956279755, 0.1010521799325943, 0.017050817608833313, 0.12124527990818024, 0.21734905242919922, -0.2987896800041199, 0.08227705210447311, 0.049976155161857605, 0.10362651199102402, 0.10990777611732483, -0.43720969557762146, 0.031217001378536224, -0.09358501434326172, -0.0012137964367866516, -0.1866215467453003, 0.04080425202846527, 0.3296854794025421, -0.44505223631858826, 0.10341235995292664, -0.2882236838340759, -0.044755492359399796, 0.06844332069158554, -0.28389671444892883, 0.007260918617248535, -0.24149110913276672, -0.09750412404537201, -0.07587460428476334, -0.016648776829242706, -0.3037482500076294, 0.11094871163368225, -0.042737871408462524, -0.09062576293945312, -0.5665932893753052, -0.21057984232902527, 0.33709782361984253, -0.09234895557165146, -0.26661133766174316, 0.33489468693733215, 0.4026763439178467, -0.15320855379104614, 0.06089502573013306, 0.4140767753124237, 0.7394434213638306, 0.1910044103860855, 0.16067638993263245, 0.2619000971317291, 0.08413976430892944, -0.2015390545129776, -0.0420471653342247, 0.22032351791858673, 0.10124558210372925, 0.17816337943077087, 0.2880270779132843, 0.0936276912689209, 0.03751397132873535, 0.34345659613609314, -0.06969369947910309, 0.23816365003585815, -0.21904073655605316, 0.3233053386211395, -0.34498801827430725, -0.06966910511255264, -0.16557571291923523, 0.21881040930747986, -0.5301284790039062, 0.18942444026470184, 0.41023722290992737, -0.2779449224472046, 0.18720942735671997, -0.24439339339733124, -0.028411513194441795, -0.19788409769535065, 0.4610697329044342, 0.45572641491889954, 0.2500725984573364, -0.06820859014987946, -0.18769752979278564, -0.5745607614517212, 0.11802946031093597, -0.23860180377960205, -0.031016677618026733, -0.07531321793794632, 0.12619905173778534, -0.19064587354660034, 0.41071730852127075, 0.021522998809814453, 0.1761247217655182, -0.220945343375206, 0.06720921397209167, 0.050473470240831375, -0.32486945390701294, 0.11496159434318542, 0.3605029582977295, -0.16143125295639038, -0.4947204291820526, 0.33396053314208984, -0.12833072245121002, -0.10559502989053726, 0.09269804507493973, -0.00984090194106102, -0.11017382144927979, -0.25603097677230835, 0.4218606948852539, 0.3831695020198822, 0.6233530044555664, -0.05770206078886986, 0.026658406481146812, -0.31334805488586426, -0.3151436746120453, -0.0016491897404193878, -0.09357544034719467, -0.10826882719993591, 0.36697763204574585, -0.24735069274902344, -0.2019546627998352, -0.4584321677684784, 0.04052732512354851, -0.011593710631132126, 0.1586751639842987, 0.07123588770627975, -0.029907437041401863, -0.25548046827316284, 0.22823192179203033, 0.03435227647423744, -0.33658790588378906, 0.016117427498102188, -0.02552640065550804, -0.2107761800289154, -0.2625405192375183, 0.38596606254577637, -0.28225165605545044, -0.2740156054496765, -0.33205997943878174, 0.4361231327056885, -0.027787894010543823, -0.23187395930290222, -0.20252081751823425, 0.21196326613426208, 0.438092440366745, -0.11342953890562057, -0.43478864431381226, 0.1607140153646469, -0.23085135221481323, 0.11639422178268433, 0.05238032713532448, 0.4389033913612366, -0.06807392090559006, -0.2940637469291687, 0.15873803198337555, -0.22091186046600342 ]
https://github.com/huggingface/datasets/issues/6046
Support proxy and user-agent in fsspec calls
You can reply "#self-assign" to this issue to automatically get assigned to it :) Let me know if you have any questions or if I can help
Since we switched to the new HfFileSystem we no longer apply user's proxy and user-agent. Using the HTTP_PROXY and HTTPS_PROXY environment variables works though since we use aiohttp to call the HF Hub. This can be implemented in `_prepare_single_hop_path_and_storage_options`. Though ideally the `HfFileSystem` could support passing at least the proxies
27
Support proxy and user-agent in fsspec calls Since we switched to the new HfFileSystem we no longer apply user's proxy and user-agent. Using the HTTP_PROXY and HTTPS_PROXY environment variables works though since we use aiohttp to call the HF Hub. This can be implemented in `_prepare_single_hop_path_and_storage_options`. Though ideally the `HfFileSystem` could support passing at least the proxies You can reply "#self-assign" to this issue to automatically get assigned to it :) Let me know if you have any questions or if I can help
[ -0.29325535893440247, -0.2153841257095337, -0.036762334406375885, -0.34647536277770996, 0.17299111187458038, -0.4385748505592346, 0.18761727213859558, -0.017031587660312653, 0.47794926166534424, 0.343361496925354, -0.40745311975479126, 0.044297561049461365, 0.27715572714805603, 0.4175855219364166, 0.06572651118040085, 0.21069113910198212, -0.03426592797040939, -0.01464572548866272, -0.27271461486816406, 0.0028640739619731903, -0.12830635905265808, 0.12993140518665314, 0.2220289558172226, 0.08070514351129532, -0.1914099007844925, 0.26252731680870056, -0.08558082580566406, 0.3385963439941406, -0.024178018793463707, -0.34047600626945496, 0.34344542026519775, 0.34952133893966675, 0.11364680528640747, -0.0108712837100029, -0.00010124589607585222, 0.14235925674438477, 0.19623741507530212, -0.019132928922772408, -0.17413274943828583, 0.13964243233203888, -0.16585850715637207, 0.16458147764205933, -0.007481257896870375, -0.18768104910850525, -0.16942843794822693, 0.07553207129240036, 0.127908855676651, -0.09441156685352325, 0.36703014373779297, 0.37852126359939575, 0.2947150766849518, 0.1738266497850418, -0.19265609979629517, -0.07107547670602798, 0.1854688972234726, -0.07215176522731781, -0.029864726588129997, -0.3606206178665161, 0.07863679528236389, -0.18772651255130768, -0.06354085355997086, -0.1546628326177597, -0.04226347804069519, 0.10136954486370087, 0.1471026986837387, -0.18987713754177094, 0.24254968762397766, -0.14115279912948608, -0.039008431136608124, 0.2741791307926178, 0.2625354528427124, 0.03163526952266693, -0.1620427817106247, 0.1396264135837555, -0.19367387890815735, 0.09176010638475418, 0.2925983667373657, -0.3489089608192444, -0.1459527611732483, 0.05241928622126579, 0.45019859075546265, -0.21198011934757233, -0.23178435862064362, 0.14765766263008118, 0.014532439410686493, 0.2698487937450409, 0.05180274695158005, 0.03569507598876953, 0.15756583213806152, -0.02297951653599739, -0.12893657386302948, -0.021798275411128998, -0.09626995027065277, -0.18529020249843597, -0.308738648891449, -0.13149425387382507, 0.24243423342704773, 0.20224952697753906, -0.03733298182487488, 0.11259422451257706, -0.12491300702095032, 0.27735990285873413, -0.057831358164548874, 0.41413530707359314, -0.28235211968421936, 0.072359099984169, -0.06477192789316177, 0.0199715755879879, 0.2871769666671753, -0.017349744215607643, -0.003417354077100754, -0.06343674659729004, 0.17531722784042358, -0.09999596327543259, -0.49701249599456787, 0.03188767284154892, -0.17311586439609528, -0.1502968966960907, -0.04670017957687378, -0.1659374088048935, 0.12939971685409546, 0.24086996912956238, 0.17421214282512665, 0.42989203333854675, 0.08649498224258423, 0.47458502650260925, 0.2194204479455948, -0.009120915085077286, -0.4560565948486328, -0.013750072568655014, -0.17901699244976044, 0.19473375380039215, -0.18698088824748993, 0.24304264783859253, 0.07013754546642303, 0.26522114872932434, 0.10221035778522491, -0.1993197351694107, 0.2684195637702942, 0.19272659718990326, 0.18464656174182892, -0.17711809277534485, 0.0063208118081092834, 0.3246769607067108, 0.16043177247047424, -0.22845681011676788, -0.08144904673099518, -0.07691031694412231, -0.10452736914157867, -0.1817726194858551, -0.15776699781417847, -0.3076270520687103, 0.042794857174158096, 0.2177947759628296, 0.1334967166185379, -0.23038160800933838, -0.3449229300022125, -0.07188884913921356, -0.2687823474407196, 0.10735748708248138, 0.10338570177555084, 0.02857116609811783, -0.25299331545829773, 0.0068589141592383385, 0.05452701449394226, 0.21774828433990479, 0.29308274388313293, -0.2278260737657547, -0.017874523997306824, -0.22167198359966278, 0.09929632395505905, -0.10425299406051636, 0.0826537162065506, -0.008489899337291718, -0.2671739161014557, 0.454715371131897, 0.22517652809619904, -0.6981157660484314, -0.13000847399234772, 0.33147940039634705, 0.0830797553062439, -0.11213687062263489, 0.1736457794904709, -0.14863096177577972, 0.30857014656066895, -0.006066574715077877, -0.10083037614822388, 0.5093598365783691, 0.01985006593167782, 0.19270260632038116, -0.23530957102775574, -0.3834989070892334, -0.3059077262878418, 0.15343168377876282, 0.32358047366142273, 0.2803563177585602, 0.08512543886899948, -0.18024273216724396, 0.38288190960884094, -0.054684046655893326, 0.17911994457244873, -0.1625751256942749, 0.3702327311038971, 0.5157557725906372, 0.04862414300441742, 0.08151300996541977, 0.1639963984489441, 0.19106891751289368, -0.38102081418037415, 0.11565259844064713, 0.3983761668205261, -0.16508525609970093, -0.08329320698976517, -0.05714079737663269, -0.009022880345582962, -0.05385776236653328, 0.24697604775428772, 0.18046754598617554, -0.17037737369537354, -0.10344021022319794, 0.1502116322517395, 0.5207735300064087, 0.20787613093852997, 0.15415677428245544, -0.013961683958768845, 0.49490320682525635, -0.07930879294872284, -0.1483965814113617, 0.0751548558473587, 0.06178726255893707, 0.38161134719848633, -0.058252546936273575, -0.17180952429771423, 0.23771730065345764, 0.24612045288085938, 0.11515026539564133, 0.26828110218048096, 0.3252599537372589, 0.1721418797969818, -0.04443719983100891, 0.05768255144357681, 0.05304202064871788, 0.16435833275318146, 0.13714635372161865, 0.3101083040237427, 0.23424996435642242, 0.3508618175983429, 0.09675592929124832, 0.22808395326137543, 0.18922439217567444, 0.23183682560920715, -0.2568719983100891, 0.1188265010714531, 0.03601881116628647, 0.037652384489774704, 0.04684780538082123, 0.07006703317165375, -0.08348006755113602, 0.08213825523853302, 0.18504688143730164, -0.04990074411034584, 0.30043110251426697, 0.16644638776779175, 0.15418127179145813, 0.11597344279289246, -0.15306434035301208, 0.5463871359825134, -0.19993124902248383, 0.1090671718120575, 0.3133532404899597, -0.09628042578697205, -0.020908599719405174, 0.024040430784225464, -0.05977853015065193, 0.18993884325027466, -0.20315350592136383, 0.02779853343963623, -0.11921104043722153, 0.02268819697201252, -0.1183846965432167, -0.4041045904159546, -0.3113517761230469, -0.20693235099315643, -0.12641412019729614, -0.390646368265152, -0.022856352850794792, -0.3260369598865509, -0.22322559356689453, 0.37021979689598083, 0.2452293485403061, 0.23435810208320618, -0.3529808819293976, 0.13472416996955872, 0.42684629559516907, -0.23722895979881287, 0.15352694690227509, -0.29356464743614197, 0.3563956022262573, -0.26507723331451416, 0.34757646918296814, -0.3951795697212219, 0.2253941297531128, -0.24459558725357056, 0.11691093444824219, 0.07743742316961288, 0.21691031754016876, 0.1212034672498703, 0.19968967139720917, -0.08763620257377625, -0.2635098993778229, -0.16516490280628204, 0.1962442845106125, 0.22496290504932404, 0.054463088512420654, -0.0615663081407547, 0.036509688943624496, 0.25617408752441406, 0.09980952739715576, 0.18375985324382782, -0.1945049911737442, -0.000929730013012886, 0.07412907481193542, -0.06951680779457092, -0.16207477450370789, -0.1747920662164688, -0.02236458659172058, -0.3232904374599457, -0.3319774270057678, -0.02277965098619461, -0.33571678400039673, 0.17814680933952332, -0.12321532517671585, -0.023267142474651337, -0.12902876734733582, -0.1938612014055252, -0.22365981340408325, -0.2816045880317688, -0.4614678919315338, 0.14171597361564636, -0.29508495330810547, -0.1749052256345749, -0.018733803182840347, 0.05416703224182129, -0.22184669971466064, -0.12155461311340332, -0.24638497829437256, -0.5855592489242554, -0.23624645173549652, 0.17973214387893677, -0.12507522106170654, -0.0106451865285635, 0.3533373475074768, -0.06751293689012527, -0.3103398084640503, -0.17183959484100342, 0.009093008935451508, 0.29979875683784485, 0.2259388267993927, 0.09219663590192795, -0.09656410664319992, 0.08696790039539337, 0.14805464446544647, 0.23998458683490753, 0.08767206966876984, 0.3688732087612152, 0.6560505628585815, -0.14326715469360352, 0.06439927965402603, -0.08596350997686386, -0.00451110303401947, 0.31822967529296875, -0.07184627652168274, 0.06323593109846115, 0.2955836057662964, 0.13400200009346008, 0.06496234238147736, -0.10337872803211212, -0.03402965888381004, 0.036450594663619995, -0.43796858191490173, -0.11451596021652222, -0.2190888524055481, -0.021593831479549408, -0.0265921950340271, -0.04247016832232475, -0.15917836129665375, 0.041267029941082, 0.29914042353630066, 0.3694366216659546, -0.040983326733112335, 0.0023516230285167694, -0.04101528227329254, 0.05541282519698143, -0.5763204097747803, 0.34905752539634705, -0.093325674533844, 0.1968267261981964, -0.39367786049842834, 0.006724368780851364, 0.12073463946580887, -0.11428013443946838, 0.2993941605091095, -0.29033559560775757, 0.1735219806432724, -0.022174393758177757, 0.0295126810669899, -0.037259433418512344, 0.014048837125301361, 0.2422572672367096, -0.014988305047154427, -0.08321711421012878, -0.21599435806274414, -0.05038681626319885, -0.28127771615982056, -0.4160858392715454, -0.7275916337966919, -0.21683716773986816, -0.11818969249725342, -0.07794368267059326, -0.34992682933807373, -0.06323915719985962, -0.04076463729143143, -0.08452997356653214, -0.26407235860824585, -0.05045542120933533, -0.3248077929019928, 0.07771714776754379, -0.07378993928432465, 0.14174306392669678, 0.09704051911830902, -0.13308608531951904, -0.15604127943515778, -0.022959649562835693, 0.08734382688999176, 0.22199586033821106, 0.2093128263950348, 0.36676403880119324, -0.1160753071308136, -0.1145147830247879, 0.05781750753521919, -0.0379178412258625, 0.030400939285755157, 0.3698384165763855, -0.09135766327381134, 0.3599873185157776, -0.15467803180217743, 0.2129865139722824, -0.35014569759368896, 0.1860278844833374, 0.0768832117319107, 0.07555385679006577, 0.36215317249298096, -0.04566115140914917, 0.3422955572605133, -0.0959935188293457, -0.22808612883090973, 0.06720329821109772, 0.45709753036499023, -0.3041156232357025, 0.621124804019928, -0.20993036031723022, 0.6750496029853821, 0.17184430360794067, 0.05400577187538147, 0.2447497844696045, -0.268643319606781, -0.19257332384586334, -0.5099817514419556, -0.07426343858242035, 0.022574324160814285, 0.17591740190982819, -0.11376221477985382, 0.05015672370791435, 0.27543485164642334, -0.0511649027466774, -0.1605684608221054, 0.12079089879989624, 0.04262392967939377, -0.20981886982917786, 0.00042379647493362427, 0.31772270798683167, -0.22249825298786163, -0.382889986038208, -0.14651907980442047, 0.4345790147781372, 0.06956639140844345, 0.11802157759666443, 0.0006483010947704315, -0.13611915707588196, -0.037834540009498596, -0.1301160454750061, -0.11240532994270325, 0.2449849545955658, -0.1987031102180481, 0.1036071702837944, -0.00036778301000595093, 0.6059913635253906, -0.03937474638223648, -0.3884471654891968, 0.1113073006272316, -0.14496161043643951, -0.13177907466888428, 0.30175715684890747, 0.13431501388549805, 0.3882025182247162, -0.13848625123500824, -0.30000582337379456, 0.1474718153476715, -0.2061431109905243, -0.33365684747695923, -0.07452429085969925, -0.07376036792993546, -0.4089709520339966, 0.0934150367975235, -0.21559195220470428, 0.45147496461868286, 0.0834299847483635, 0.43936699628829956, 0.14202959835529327, -0.04219026118516922, -0.06488175690174103, 0.2464018017053604, -0.1095917671918869, -0.22443817555904388, 0.41367197036743164, 0.04097374156117439, -0.027724768966436386, -0.03523041680455208, 0.10897675156593323, -0.2306530773639679, 0.31258735060691833, 0.22783969342708588, -0.306138277053833, -0.22657527029514313, -0.2370474934577942, -0.10887274146080017, -0.016908030956983566, 0.20933690667152405, 0.045973096042871475, 0.000019616447389125824, -0.6148357391357422, -0.02776411361992359, 0.14119359850883484, -0.03694751113653183, 0.013965420424938202, -0.020018164068460464, -0.232103168964386, -0.09379322826862335, -0.019545167684555054, -0.3760617673397064, 0.16456963121891022, -0.12325669080018997, 0.402163028717041, 0.004463694989681244, 0.13196103274822235, -0.4514343738555908, -0.11129114776849747, -0.24008795619010925, 0.04292262718081474, -0.31894874572753906, -0.2489457130432129, 0.15069417655467987, -0.12916220724582672, 0.17484498023986816, 0.0396217405796051, -0.37602612376213074, -0.2645465135574341, -0.25090235471725464, 0.08578714728355408, 0.1794017255306244, -0.14258478581905365, -0.05660732835531235, -0.08559706807136536, -0.10696426033973694, -0.011360794305801392, 0.11781845986843109, 0.3390728533267975, -0.29190850257873535, 0.02155127376317978, 0.23366881906986237, -0.09423141926527023, 0.015178963541984558, 0.3219010531902313, 0.28055405616760254, 0.2206898331642151, -0.2747581899166107, 0.007738430052995682, -0.30762824416160583, -0.0948442667722702, 0.3436821699142456, 0.24262186884880066, 0.3803222179412842, 0.14696820080280304, 0.10797059535980225, 0.1988346427679062, -0.11579261720180511, -0.00836706068366766, -0.05711400508880615, -0.014241844415664673, 0.08822889626026154, 0.05439551919698715, 0.15726473927497864, 0.3411683440208435, -0.008048729971051216, 0.0738823339343071, 0.1907566338777542, -0.2647172212600708, 0.20063883066177368, -0.009542979300022125, 0.35927119851112366, -0.03636840730905533, 0.1913401484489441, 0.11426471918821335, -0.28416046500205994, 0.031028319150209427, -0.13181084394454956, -0.5889089107513428, -0.362839937210083, 0.2593197524547577, 0.16117364168167114, -0.1450536698102951, 0.14776329696178436, 0.43164366483688354, 0.22498014569282532, 0.3732747733592987, -0.2636865973472595, 0.2913428843021393, 0.04068765789270401, -0.5772369503974915, -0.032326068729162216, -0.40906113386154175, -0.15175673365592957, 0.05787292495369911, -0.03927797079086304, 0.25269651412963867, -0.14590641856193542, -0.29988032579421997, -0.2075704038143158, 0.036919958889484406, -0.11924722045660019, -0.38403037190437317, 0.06979379057884216, 0.13034799695014954, -0.37743276357650757, -0.23593035340309143, 0.16621460020542145, -0.10308599472045898, 0.28333279490470886, 0.10562692582607269, 0.09538743644952774, 0.11175372451543808, -0.33103519678115845, 0.09798984229564667, 0.3446814715862274, -0.05168931931257248, 0.20049861073493958, -0.1668272167444229, -0.16711251437664032, 0.16475488245487213, 0.0509922131896019, 0.19170859456062317, 0.13534337282180786, -0.31969261169433594, -0.02605988085269928, 0.21715830266475677, 0.10378716886043549, -0.22077494859695435, -0.15726988017559052, 0.10479767620563507, -0.07309505343437195, 0.1249808818101883, 0.2157619148492813, -0.2462959885597229, -0.0243745855987072, -0.3848249614238739, 0.18960145115852356, -0.048515722155570984, 0.4645485579967499, 0.3884302079677582, 0.32551708817481995, -0.08503305912017822, 0.05847117677330971, -0.4536980092525482, 0.006955506280064583, 0.15219663083553314, -0.4129170775413513, 0.23992836475372314, -0.2203555554151535, 0.13685420155525208, -0.13552632927894592, 0.3297611176967621, -0.04066916182637215, -0.052594274282455444, -0.09372613579034805, 0.030377298593521118, -0.05665205419063568, -0.024133510887622833, -0.001842111349105835, -0.20429550111293793, -0.15972624719142914, 0.20998455584049225, 0.10014227032661438, -0.24596808850765228, 0.17586150765419006, -0.08803193271160126, 0.48798882961273193, 0.10051561892032623, -0.25409993529319763, 0.2741960883140564, -0.0703391432762146, 0.1296754777431488, 0.22944355010986328, -0.4022082984447479, 0.18169470131397247, 0.3833296298980713, 0.1787584125995636, 0.20048922300338745, -0.3300865888595581, 0.22969627380371094, -0.5608981847763062, 0.3900074064731598, -0.00946805439889431, 0.17685285210609436, -0.3270273208618164, 0.052473850548267365, 0.11239613592624664, -0.20100049674510956, -0.16411256790161133, -0.7290138006210327, -0.2061346471309662, 0.018275082111358643, -0.07583747804164886, 0.18332639336585999, -0.2883632779121399, 0.023288249969482422, -0.1062832623720169, -0.2750295102596283, -0.19893676042556763, 0.21921321749687195, -0.21237754821777344, 0.18530841171741486, -0.2787424325942993, 0.25832831859588623, 0.05862043425440788, -0.008666222915053368, -0.12709327042102814, -0.13087494671344757, 0.526929497718811, 0.008717942051589489, -0.02870267629623413, -0.39965465664863586, 0.39700862765312195, -0.16167393326759338, 0.11772183328866959, -0.009626641869544983, 0.0025938451290130615, -0.11531317234039307, 0.005395181477069855, 0.07599547505378723, 0.23724645376205444, -0.015123099088668823, 0.11032116413116455, -0.24671980738639832, 0.046818140894174576, 0.1394936442375183, 0.30322328209877014, 0.09908890724182129, -0.07873263955116272 ]
https://github.com/huggingface/datasets/issues/6046
Support proxy and user-agent in fsspec calls
Actually i am quite new to figure it out how everything goes and done > You can reply "#self-assign" to this issue to automatically get assigned to it :) > Let me know if you have any questions or if I can help when i wrote #self-assign it automatically got converted to some number is it correct or i have done it some wrong way, I am quite new to open source thus wanna try to learn and explore it
Since we switched to the new HfFileSystem we no longer apply user's proxy and user-agent. Using the HTTP_PROXY and HTTPS_PROXY environment variables works though since we use aiohttp to call the HF Hub. This can be implemented in `_prepare_single_hop_path_and_storage_options`. Though ideally the `HfFileSystem` could support passing at least the proxies
80
Support proxy and user-agent in fsspec calls Since we switched to the new HfFileSystem we no longer apply user's proxy and user-agent. Using the HTTP_PROXY and HTTPS_PROXY environment variables works though since we use aiohttp to call the HF Hub. This can be implemented in `_prepare_single_hop_path_and_storage_options`. Though ideally the `HfFileSystem` could support passing at least the proxies Actually i am quite new to figure it out how everything goes and done > You can reply "#self-assign" to this issue to automatically get assigned to it :) > Let me know if you have any questions or if I can help when i wrote #self-assign it automatically got converted to some number is it correct or i have done it some wrong way, I am quite new to open source thus wanna try to learn and explore it
[ -0.18757739663124084, -0.25471335649490356, -0.02686111442744732, -0.33133238554000854, 0.18308410048484802, -0.46210700273513794, 0.10263852775096893, -0.05182304605841637, 0.47567930817604065, 0.31738123297691345, -0.3946908712387085, 0.12045890092849731, 0.2528078258037567, 0.48665523529052734, 0.09826993942260742, 0.10050792992115021, -0.009645722806453705, -0.05600064992904663, -0.34212812781333923, 0.005168929696083069, -0.2190403938293457, 0.14257048070430756, 0.1991962045431137, 0.056001223623752594, -0.16036492586135864, 0.23608464002609253, -0.15016572177410126, 0.26882582902908325, -0.09991700947284698, -0.4243881106376648, 0.2951878607273102, 0.39626115560531616, 0.12743636965751648, -0.0400567427277565, -0.00010483863297849894, 0.05972336232662201, 0.18570412695407867, -0.026025623083114624, -0.12346349656581879, 0.08795079588890076, -0.13623690605163574, 0.12974587082862854, -0.01717040129005909, -0.19287031888961792, -0.0964704155921936, 0.07416194677352905, 0.10281790047883987, -0.181947261095047, 0.3791632056236267, 0.3631870746612549, 0.25678494572639465, 0.10110393911600113, -0.07823733985424042, -0.03952871635556221, 0.24758708477020264, -0.022868618369102478, -0.03230919688940048, -0.3738768994808197, 0.1994541585445404, -0.14146685600280762, -0.024134628474712372, -0.16597573459148407, -0.07741710543632507, 0.05712728947401047, 0.2647351622581482, -0.18406711518764496, 0.21913668513298035, -0.30974236130714417, -0.13041889667510986, 0.33378639817237854, 0.36874520778656006, -0.025885634124279022, -0.17157888412475586, 0.1779850721359253, -0.19024448096752167, 0.12289072573184967, 0.2222142517566681, -0.3129292130470276, -0.16457560658454895, 0.09600432217121124, 0.5454889535903931, -0.24534443020820618, -0.2624136805534363, 0.16256028413772583, 0.050890371203422546, 0.34302347898483276, 0.000366459134966135, 0.09424974024295807, 0.1886775940656662, 0.025106975808739662, -0.11698315292596817, -0.08263960480690002, -0.11336085200309753, -0.07807669788599014, -0.28357863426208496, -0.13950881361961365, 0.22050005197525024, 0.19407561421394348, 0.06065983325242996, 0.13978400826454163, -0.1845405101776123, 0.19114777445793152, -0.23766741156578064, 0.48867449164390564, -0.2954489290714264, 0.06842906773090363, -0.08529161661863327, 0.1153712347149849, 0.2420939952135086, -0.10918179154396057, 0.12081278860569, -0.07942098379135132, 0.12216552346944809, -0.0770430713891983, -0.5240926742553711, 0.07806231081485748, -0.0808737725019455, -0.13715828955173492, -0.02851557917892933, -0.1413942277431488, 0.09701370447874069, 0.18482853472232819, 0.2200833112001419, 0.3762451112270355, 0.05974098667502403, 0.5047333836555481, 0.2250596433877945, -0.03959033638238907, -0.43088436126708984, -0.08370748162269592, -0.12955106794834137, 0.2476169466972351, -0.23719565570354462, 0.25357410311698914, -0.001322329044342041, 0.19533580541610718, 0.14602045714855194, -0.1738489717245102, 0.22488778829574585, 0.1367517113685608, 0.22596700489521027, -0.21348042786121368, -0.043704114854335785, 0.2698000967502594, 0.031621333211660385, -0.2911399006843567, -0.08415208756923676, -0.09060065448284149, -0.1987677365541458, -0.09562603384256363, -0.23945149779319763, -0.29494187235832214, -0.03695089370012283, 0.18222187459468842, 0.16588561236858368, -0.2314460277557373, -0.3413866460323334, -0.005339924246072769, -0.3088114261627197, 0.10153040289878845, 0.18277207016944885, -0.012802112847566605, -0.1794714331626892, -0.0016440683975815773, 0.10901432484388351, 0.24785606563091278, 0.3535524308681488, -0.2629450857639313, -0.007189529947936535, -0.2221979796886444, 0.15964603424072266, -0.1846456378698349, 0.1279570311307907, -0.029671505093574524, -0.2547214925289154, 0.38631105422973633, 0.29406118392944336, -0.6970905065536499, -0.08794910460710526, 0.3131633400917053, 0.1436985731124878, -0.0928613543510437, 0.217844158411026, -0.05111101269721985, 0.3332345485687256, -0.011947756633162498, -0.15968658030033112, 0.5335997939109802, -0.07299420982599258, 0.1600417047739029, -0.23570063710212708, -0.4121931493282318, -0.3595726490020752, 0.13524727523326874, 0.33295539021492004, 0.3494906425476074, 0.09793902188539505, -0.23257917165756226, 0.3597622215747833, -0.07931900024414062, 0.189854234457016, -0.25097113847732544, 0.4542314410209656, 0.533959686756134, 0.06572940945625305, -0.0069918520748615265, 0.2041221559047699, 0.13919243216514587, -0.41246816515922546, 0.04629151150584221, 0.4581378102302551, -0.18355202674865723, -0.11544006317853928, -0.02561844140291214, 0.02430737018585205, -0.055074941366910934, 0.16027192771434784, 0.18155688047409058, -0.1742788851261139, -0.182964488863945, 0.09762760996818542, 0.5389408469200134, 0.18290066719055176, 0.17583104968070984, -0.021093830466270447, 0.45696452260017395, -0.07384681701660156, -0.12059502303600311, 0.074491947889328, 0.10621605813503265, 0.39096155762672424, -0.055291976779699326, -0.16915416717529297, 0.17517712712287903, 0.27309659123420715, 0.09812035411596298, 0.29433673620224, 0.4071199595928192, 0.17899523675441742, -0.08093515038490295, 0.1143748089671135, 0.019324377179145813, 0.18496030569076538, 0.07335371524095535, 0.35875973105430603, 0.22940804064273834, 0.32197800278663635, 0.07220810651779175, 0.13784129917621613, 0.21493294835090637, 0.14833581447601318, -0.23339174687862396, 0.06990987807512283, 0.08210206031799316, -0.031789351254701614, 0.08773738145828247, 0.08749768137931824, -0.0493120476603508, 0.07120606303215027, 0.14886316657066345, -0.018732812255620956, 0.24142539501190186, 0.11186367273330688, 0.199988454580307, 0.11475275456905365, -0.14722293615341187, 0.4968656003475189, -0.18613137304782867, 0.11111757904291153, 0.3141342103481293, -0.22118410468101501, 0.014111850410699844, 0.06251958757638931, -0.0015116846188902855, 0.16154222190380096, -0.13316111266613007, 0.04296485707163811, -0.10466200858354568, -0.06544988602399826, 0.01434080209583044, -0.23320341110229492, -0.43778303265571594, -0.24270445108413696, -0.07561103254556656, -0.40704602003097534, -0.0705762431025505, -0.27794817090034485, -0.15624532103538513, 0.32151904702186584, 0.26877638697624207, 0.2936473786830902, -0.2553068697452545, 0.0570928156375885, 0.39644885063171387, -0.2258172631263733, 0.18170087039470673, -0.2941845953464508, 0.4444856345653534, -0.34641915559768677, 0.412331759929657, -0.38658571243286133, 0.20243453979492188, -0.22000166773796082, 0.07125572860240936, 0.16631276905536652, 0.10298644751310349, 0.1915731430053711, 0.21977531909942627, -0.05555466189980507, -0.29326316714286804, -0.20287665724754333, 0.19028739631175995, 0.20243260264396667, 0.08370380848646164, -0.036918118596076965, 0.005391299724578857, 0.257487952709198, 0.10313742607831955, 0.053445279598236084, -0.14857333898544312, -0.006881239823997021, 0.001933600753545761, -0.14753657579421997, -0.1566225290298462, -0.18309123814105988, -0.036228030920028687, -0.40852800011634827, -0.3696601092815399, 0.07081418484449387, -0.345605731010437, 0.2308405339717865, -0.1544894278049469, -0.07805630564689636, -0.05525275692343712, -0.12298831343650818, -0.1902213990688324, -0.20808914303779602, -0.4615985155105591, 0.16367259621620178, -0.26134517788887024, -0.14254724979400635, -0.05618123337626457, -0.045569490641355515, -0.22130820155143738, -0.13604934513568878, -0.2742891311645508, -0.6137535572052002, -0.17885738611221313, 0.21636703610420227, -0.17198780179023743, 0.09760918468236923, 0.3711203634738922, -0.028973350301384926, -0.23780344426631927, -0.17961588501930237, 0.014123871922492981, 0.2353011965751648, 0.3088904023170471, 0.07650375366210938, 0.04771767556667328, 0.07612749189138412, 0.09779277443885803, 0.38798683881759644, 0.07973732054233551, 0.3619966506958008, 0.6255524158477783, -0.005781693384051323, 0.01920928806066513, -0.10248970240354538, -0.028653625398874283, 0.32640451192855835, -0.087165966629982, 0.1388331949710846, 0.2866695523262024, 0.1504710614681244, 0.13322526216506958, -0.08665122836828232, -0.06219363212585449, 0.015321768820285797, -0.35451266169548035, -0.07125604152679443, -0.3338335156440735, 0.014012310653924942, -0.16194796562194824, -0.16387298703193665, -0.1838478446006775, 0.09520462155342102, 0.27560335397720337, 0.34942561388015747, 0.03747524321079254, 0.030275018885731697, -0.05707463249564171, 0.06171322241425514, -0.5540215373039246, 0.39323562383651733, -0.11822427064180374, 0.04108445346355438, -0.30157583951950073, 0.10712327808141708, 0.13552765548229218, -0.06283249706029892, 0.23235571384429932, -0.18097907304763794, 0.04587116464972496, -0.0019150376319885254, 0.07901456207036972, 0.060336604714393616, 0.042012084275484085, 0.2462785840034485, -0.04075681418180466, -0.06735746562480927, -0.3001438081264496, -0.03893455117940903, -0.3113594949245453, -0.33371853828430176, -0.7408836483955383, -0.19085262715816498, -0.11975579708814621, -0.02669348008930683, -0.42182406783103943, -0.02729969471693039, -0.016943074762821198, 0.02861942909657955, -0.17738547921180725, -0.05952414870262146, -0.3452712595462799, 0.06738176941871643, -0.025837386026978493, 0.2171095311641693, -0.02139972522854805, -0.1600925624370575, -0.13604214787483215, 0.0011553280055522919, 0.00735091045498848, 0.2024543285369873, 0.23781394958496094, 0.36218374967575073, -0.1789458692073822, -0.12347443401813507, 0.08547593653202057, -0.004610260017216206, 0.1292591094970703, 0.28644511103630066, -0.02100994437932968, 0.3738149404525757, -0.19187548756599426, 0.22876764833927155, -0.4242940843105316, 0.17433862388134003, 0.08624415099620819, 0.1245514377951622, 0.3027764856815338, -0.15580810606479645, 0.4244612753391266, -0.08812840282917023, -0.28571707010269165, 0.20079244673252106, 0.4931808114051819, -0.26672863960266113, 0.6601479649543762, -0.15413615107536316, 0.8263921141624451, 0.1802106499671936, 0.03005708009004593, 0.18170252442359924, -0.4120715856552124, -0.12323222309350967, -0.6022037863731384, -0.14711631834506989, 0.0016735605895519257, 0.24591222405433655, -0.17620791494846344, 0.0015739835798740387, 0.387570321559906, -0.11756007373332977, -0.3144143223762512, 0.1024872288107872, 0.059795573353767395, -0.33876878023147583, 0.023086603730916977, 0.3400250971317291, -0.18494443595409393, -0.4423978626728058, -0.07197683304548264, 0.3763028085231781, -0.00031570717692375183, 0.18071788549423218, 0.008808426558971405, -0.15062782168388367, -0.03428474813699722, -0.08316153287887573, -0.15880003571510315, 0.19141548871994019, -0.16963905096054077, 0.05923858657479286, 0.0853557288646698, 0.629582941532135, 0.05547088012099266, -0.3081335127353668, 0.17997236549854279, -0.18271009624004364, -0.07062746584415436, 0.28651493787765503, 0.18407265841960907, 0.41451752185821533, -0.0622614324092865, -0.27292850613594055, 0.21377260982990265, -0.23575785756111145, -0.3691174387931824, 0.033790454268455505, -0.09989972412586212, -0.40083450078964233, -0.003528907895088196, -0.26914483308792114, 0.6076210737228394, 0.07579386234283447, 0.40995436906814575, 0.1935153603553772, -0.030632875859737396, -0.011700797826051712, 0.21379883587360382, -0.0015027597546577454, -0.3031133711338043, 0.45513540506362915, 0.008139397948980331, -0.017073556780815125, -0.003030586987733841, -0.04976876825094223, -0.1845085322856903, 0.3266437351703644, 0.18478766083717346, -0.3718568980693817, -0.19046610593795776, -0.15902560949325562, -0.07380606234073639, -0.05364990234375, 0.21806126832962036, 0.017636939883232117, 0.04854429513216019, -0.649988055229187, -0.04412771761417389, 0.16146019101142883, 0.000453755259513855, 0.12706516683101654, -0.011838383972644806, -0.22691427171230316, -0.12186967581510544, -0.0843489021062851, -0.4611283242702484, 0.1250769942998886, -0.13631771504878998, 0.3210321068763733, 0.002789309248328209, 0.2534099221229553, -0.4144752025604248, -0.18275824189186096, -0.27319666743278503, 0.08140037953853607, -0.22943991422653198, -0.2421436309814453, -0.011100905947387218, -0.06904761493206024, 0.1353760063648224, 0.03585319221019745, -0.4067811369895935, -0.19505858421325684, -0.3272150754928589, 0.1300022155046463, 0.09550132602453232, -0.1621374785900116, -0.07575120031833649, -0.08807435631752014, -0.11047962307929993, -0.01569049432873726, 0.08945183455944061, 0.3195990025997162, -0.309665322303772, 0.06145217642188072, 0.26992765069007874, -0.05659811943769455, 0.043874867260456085, 0.4139319658279419, 0.3619433343410492, 0.21636903285980225, -0.2528080940246582, 0.09133875370025635, -0.29560258984565735, -0.12629178166389465, 0.3216803967952728, 0.2502337098121643, 0.47094476222991943, 0.062228068709373474, 0.1872454583644867, 0.3016926944255829, -0.029994618147611618, -0.02395365759730339, -0.1438140869140625, -0.09644924104213715, 0.12358970195055008, 0.14122581481933594, 0.18525266647338867, 0.3092014789581299, 0.033136025071144104, 0.09270928055047989, 0.24316975474357605, -0.2672719955444336, 0.1422659456729889, -0.03224199265241623, 0.3850066065788269, 0.0037102922797203064, 0.2416583001613617, 0.05860748142004013, -0.27888795733451843, 0.08079886436462402, -0.0747457891702652, -0.6889016628265381, -0.3375460207462311, 0.2540849447250366, 0.17025549709796906, -0.13586923480033875, 0.15662065148353577, 0.2259044349193573, 0.1553141176700592, 0.34997323155403137, -0.28077253699302673, 0.39459678530693054, 0.09578821063041687, -0.6041722893714905, 0.03275274112820625, -0.4291048049926758, -0.18896496295928955, 0.09781120717525482, -0.05778735876083374, 0.20810028910636902, -0.12412894517183304, -0.3513772189617157, -0.11816226691007614, 0.07398317009210587, -0.11439480632543564, -0.4263971149921417, 0.09792512655258179, 0.1033383384346962, -0.4077250361442566, -0.2780081629753113, 0.20625054836273193, -0.16133460402488708, 0.2746659517288208, 0.12261316180229187, 0.062319062650203705, 0.16433270275592804, -0.3562149703502655, 0.12523120641708374, 0.3874145448207855, -0.11171159893274307, 0.24485258758068085, -0.23394747078418732, -0.17686602473258972, 0.14060693979263306, 0.11325632035732269, 0.17884461581707, 0.17454591393470764, -0.33296558260917664, -0.049930986016988754, 0.23532205820083618, 0.13176308572292328, -0.1316143274307251, -0.2021293193101883, 0.09513324499130249, -0.09225925803184509, 0.02685178816318512, 0.15619352459907532, -0.17472819983959198, -0.031921934336423874, -0.46322202682495117, 0.1513567864894867, -0.1617930829524994, 0.48857638239860535, 0.43455278873443604, 0.21481460332870483, -0.014659490436315536, 0.16273699700832367, -0.5346627831459045, 0.041985392570495605, 0.1657339483499527, -0.4399721026420593, 0.16165632009506226, -0.20535260438919067, 0.11178469657897949, -0.146950826048851, 0.22115112841129303, 0.0085403211414814, -0.026353612542152405, -0.10012460500001907, 0.009490884840488434, -0.01707759127020836, 0.015525579452514648, 0.09837473183870316, -0.30479174852371216, -0.08688343316316605, 0.12197215855121613, 0.13091666996479034, -0.27405112981796265, 0.1825980693101883, -0.14558929204940796, 0.5305391550064087, 0.18316981196403503, -0.26015886664390564, 0.2848750948905945, -0.0853995829820633, 0.14440731704235077, 0.2516550123691559, -0.3212525248527527, 0.13126839697360992, 0.4128125309944153, 0.11905121058225632, 0.12946709990501404, -0.3366617262363434, 0.327464759349823, -0.5764448642730713, 0.41154101490974426, 0.023391148075461388, 0.2042711079120636, -0.31136152148246765, 0.06428993493318558, 0.22152628004550934, -0.2208508551120758, -0.12271352857351303, -0.7590776681900024, -0.23392677307128906, 0.024747300893068314, -0.12873344123363495, 0.09732931107282639, -0.31112805008888245, 0.056566301733255386, -0.18462969362735748, -0.33483123779296875, -0.17418964207172394, 0.11883259564638138, -0.3199879229068756, 0.11544596403837204, -0.23111039400100708, 0.2506948411464691, 0.13072431087493896, 0.01678132824599743, -0.13633769750595093, -0.026059141382575035, 0.4771234393119812, 0.07018841058015823, 0.03270769119262695, -0.3983347713947296, 0.43102186918258667, -0.1905733048915863, 0.1494448184967041, -0.05808541178703308, -0.017911873757839203, -0.02161715179681778, 0.02210916578769684, 0.11708283424377441, 0.281754732131958, 0.020650997757911682, 0.15420769155025482, -0.2583784759044647, -0.036547087132930756, 0.07517467439174652, 0.41503456234931946, 0.14625422656536102, -0.13580787181854248 ]
https://github.com/huggingface/datasets/issues/6046
Support proxy and user-agent in fsspec calls
Ah yea github tries to replace the #self-assign with an issue link. I guess you can try to copy-paste instead to see if it works Anyway let me assign you manually
Since we switched to the new HfFileSystem we no longer apply user's proxy and user-agent. Using the HTTP_PROXY and HTTPS_PROXY environment variables works though since we use aiohttp to call the HF Hub. This can be implemented in `_prepare_single_hop_path_and_storage_options`. Though ideally the `HfFileSystem` could support passing at least the proxies
31
Support proxy and user-agent in fsspec calls Since we switched to the new HfFileSystem we no longer apply user's proxy and user-agent. Using the HTTP_PROXY and HTTPS_PROXY environment variables works though since we use aiohttp to call the HF Hub. This can be implemented in `_prepare_single_hop_path_and_storage_options`. Though ideally the `HfFileSystem` could support passing at least the proxies Ah yea github tries to replace the #self-assign with an issue link. I guess you can try to copy-paste instead to see if it works Anyway let me assign you manually
[ -0.21246153116226196, -0.128409743309021, -0.012975232675671577, -0.43043720722198486, 0.32901376485824585, -0.36426088213920593, 0.2749658226966858, -0.04147286340594292, 0.4883716106414795, 0.3668381869792938, -0.4511350393295288, 0.2056722790002823, 0.22914643585681915, 0.4269670844078064, 0.1411089152097702, 0.2510007917881012, -0.056280024349689484, -0.18674519658088684, -0.16543343663215637, -0.013205289840698242, -0.18393976986408234, 0.205747589468956, 0.21673063933849335, 0.07195229083299637, -0.15602941811084747, 0.32202333211898804, 0.03703981637954712, 0.3286907970905304, -0.08574238419532776, -0.3995010256767273, 0.3573181629180908, 0.386422723531723, 0.053518734872341156, -0.13918182253837585, -0.0001036570974974893, 0.16484907269477844, 0.32190001010894775, -0.03917679563164711, -0.23265966773033142, -0.003349989652633667, -0.2045907974243164, 0.13607537746429443, 0.027839744463562965, -0.2609374225139618, -0.1662859320640564, 0.22452591359615326, 0.2289334535598755, -0.061559904366731644, 0.39152681827545166, 0.39438092708587646, 0.28535160422325134, 0.15594439208507538, -0.02793058007955551, -0.27633586525917053, 0.3026970624923706, -0.10281303524971008, -0.06050214171409607, -0.12349934875965118, 0.08055399358272552, -0.18442928791046143, -0.02583789825439453, -0.21892285346984863, -0.013906236737966537, 0.15029379725456238, 0.19732648134231567, -0.13226823508739471, 0.3558712899684906, -0.14494693279266357, -0.07927089929580688, 0.19664311408996582, 0.23143741488456726, -0.031499117612838745, -0.13988205790519714, 0.19893261790275574, -0.17523033916950226, 0.11336283385753632, 0.21719175577163696, -0.23321795463562012, -0.1569293588399887, 0.032075636088848114, 0.4789784550666809, -0.16645047068595886, -0.2613261938095093, 0.21918229758739471, -0.007955949753522873, 0.4009638726711273, -0.029057927429676056, 0.12045933306217194, 0.29381823539733887, 0.03353239968419075, -0.19478848576545715, 0.012486496940255165, -0.11187201738357544, -0.19172151386737823, -0.20752932131290436, -0.04083389416337013, 0.28880491852760315, 0.07157541066408157, -0.00886688381433487, 0.1436191201210022, -0.13212324678897858, 0.23100212216377258, -0.08381776511669159, 0.39919397234916687, -0.34644362330436707, 0.13736706972122192, 0.014766842126846313, 0.1707962453365326, 0.23885995149612427, 0.023366611450910568, 0.07704184949398041, -0.051969148218631744, 0.10610617697238922, -0.11720547080039978, -0.5063778162002563, 0.07408291101455688, -0.13768067955970764, -0.1075630784034729, -0.15029390156269073, -0.08743533492088318, 0.06742905080318451, 0.23768435418605804, 0.051307447254657745, 0.4476625621318817, 0.12602469325065613, 0.28665411472320557, 0.3355168104171753, 0.087253138422966, -0.4530608355998993, 0.07930862158536911, -0.21218834817409515, 0.2170696258544922, -0.26055946946144104, 0.13946567475795746, 0.017040498554706573, 0.1952839344739914, 0.14814651012420654, -0.2545536756515503, 0.2510288953781128, 0.17696525156497955, -0.009880894795060158, -0.05961822718381882, -0.007285565137863159, 0.29642537236213684, 0.11222730576992035, -0.2209681272506714, -0.05715477839112282, -0.24894998967647552, -0.16408464312553406, -0.14868488907814026, -0.08770272880792618, -0.3128824234008789, -0.014100061729550362, 0.1964435875415802, 0.18870195746421814, -0.2422727346420288, -0.486387699842453, -0.021150972694158554, -0.2631494998931885, 0.22988805174827576, 0.08181942254304886, -0.09592902660369873, -0.14180605113506317, 0.002470148028805852, 0.12157552689313889, 0.22553342580795288, 0.3257893919944763, -0.23720575869083405, -0.04418916255235672, -0.25762858986854553, 0.25757166743278503, -0.054372694343328476, 0.09044291079044342, -0.023454934358596802, -0.21023282408714294, 0.4354897737503052, 0.23493196070194244, -0.7193493843078613, -0.2344994693994522, 0.2666186988353729, 0.0731792002916336, -0.09925799071788788, 0.03949544578790665, -0.0030051718931645155, 0.2584797441959381, 0.01313377358019352, 0.03553180396556854, 0.4279049038887024, 0.06562068313360214, 0.1116672083735466, -0.299152672290802, -0.38883185386657715, -0.39628440141677856, 0.08455029129981995, 0.2665966749191284, 0.4117201268672943, 0.16224825382232666, -0.262201189994812, 0.3659071922302246, -0.09520597755908966, 0.1928832232952118, -0.1492658257484436, 0.5190830230712891, 0.4524955749511719, -0.028065737336874008, 0.10361599177122116, 0.06605244427919388, 0.2535894215106964, -0.323379248380661, 0.16943711042404175, 0.45079606771469116, -0.13485631346702576, -0.12822842597961426, 0.030597148463129997, -0.005950894206762314, -0.13328471779823303, 0.18866975605487823, 0.14936470985412598, -0.13208717107772827, -0.10695190727710724, 0.1267392635345459, 0.4376204013824463, 0.06138778477907181, 0.1328161060810089, 0.006436164490878582, 0.42573896050453186, -0.11201667040586472, -0.1445273458957672, -0.017585651949048042, 0.10522639751434326, 0.30436384677886963, -0.03816136345267296, -0.11361082643270493, 0.13195452094078064, 0.23081377148628235, -0.05642133951187134, 0.17900097370147705, 0.1775708943605423, 0.04766955226659775, -0.1384785920381546, -0.1717807799577713, 0.09181787073612213, 0.15033431351184845, 0.07847075909376144, 0.2848023772239685, 0.26289403438568115, 0.2430020272731781, 0.09233839809894562, 0.09687632322311401, 0.22405672073364258, 0.31527963280677795, -0.12265251576900482, 0.03077230043709278, 0.034136153757572174, 0.03604547679424286, 0.037324726581573486, 0.1088017076253891, -0.12457315623760223, 0.009035594761371613, 0.13482260704040527, -0.16396094858646393, 0.24200385808944702, 0.07619164139032364, 0.1657068431377411, 0.13360987603664398, -0.10159779340028763, 0.3577115535736084, -0.028430026024580002, 0.12700358033180237, 0.2963448464870453, -0.07160669565200806, 0.022766852751374245, 0.0014069718308746815, -0.09527203440666199, 0.14384140074253082, -0.26505744457244873, -0.007987825199961662, -0.08443113416433334, 0.06095240265130997, -0.14757250249385834, -0.2750265598297119, -0.2505156397819519, -0.2042912095785141, 0.037575408816337585, -0.5208541750907898, -0.1482727825641632, -0.2682066261768341, -0.2135416567325592, 0.4046877920627594, 0.17931289970874786, 0.16170434653759003, -0.4449322521686554, 0.09466573596000671, 0.4369499087333679, -0.2755908668041229, 0.18349426984786987, -0.20392672717571259, 0.2404177188873291, -0.29349252581596375, 0.2571714222431183, -0.30786454677581787, 0.10348057001829147, -0.20512667298316956, 0.11007560789585114, 0.09276784211397171, -0.001750514144077897, 0.1591329127550125, 0.19353334605693817, -0.1786588877439499, -0.361380398273468, -0.17704778909683228, 0.11858342587947845, 0.161058247089386, 0.16991408169269562, -0.009622864425182343, 0.04456568509340286, 0.3183451294898987, 0.1292027235031128, 0.1924467533826828, -0.15045280754566193, -0.040641024708747864, -0.008966411463916302, -0.14387819170951843, -0.2645810544490814, -0.28241270780563354, 0.012140326201915741, -0.31233835220336914, -0.37814828753471375, 0.12734933197498322, -0.14211007952690125, 0.20836631953716278, 0.00619571702554822, -0.12661151587963104, -0.11289335787296295, -0.08006613701581955, -0.2720438241958618, -0.30119559168815613, -0.5375021696090698, 0.22811304032802582, -0.24414798617362976, -0.22304435074329376, 0.0016355253756046295, 0.059766121208667755, -0.13576431572437286, -0.09103797376155853, -0.18264444172382355, -0.5904738903045654, -0.172930046916008, 0.186258465051651, -0.07022466510534286, 0.02006668969988823, 0.2557913362979889, -0.04671633243560791, -0.29084527492523193, -0.15400274097919464, -0.05006338655948639, 0.5036150813102722, 0.4430564045906067, 0.056403517723083496, -0.023130245506763458, 0.10775715857744217, 0.0999288260936737, 0.4897259473800659, 0.10815171897411346, 0.2719413936138153, 0.6556808948516846, -0.265748530626297, -0.017373990267515182, -0.06985049694776535, -0.07217352837324142, 0.21259044110774994, -0.003920450806617737, 0.14673630893230438, 0.3224223256111145, 0.07661087065935135, 0.01339911762624979, -0.07341726869344711, -0.005052637308835983, -0.010509882122278214, -0.4443988502025604, -0.12050320208072662, -0.263261079788208, -0.06274756044149399, -0.11821681261062622, -0.04584626853466034, -0.19875696301460266, 0.016677411273121834, 0.2993786633014679, 0.3371884226799011, -0.08075066655874252, 0.043372586369514465, -0.04514503851532936, 0.0946597084403038, -0.6289864778518677, 0.4328843355178833, -0.1738692671060562, 0.07877609878778458, -0.40393882989883423, -0.015989821404218674, 0.19446730613708496, -0.12272878736257553, 0.172369584441185, -0.324655681848526, 0.14853587746620178, 0.08433185517787933, 0.10732506215572357, -0.07315444201231003, -0.04988262057304382, 0.263007253408432, 0.09625594317913055, -0.035262446850538254, -0.2521105706691742, -0.13697633147239685, -0.2095137983560562, -0.2898661196231842, -0.8375263810157776, -0.11113631725311279, 0.0023345034569501877, -0.19204428791999817, -0.42459145188331604, -0.13890047371387482, 0.02458282560110092, 0.04701651632785797, -0.10100965201854706, 0.011923491954803467, -0.19638197124004364, 0.1055760458111763, -0.0789056122303009, 0.19707462191581726, -0.0003822147846221924, -0.1360366940498352, -0.044431064277887344, -0.07063533365726471, 0.038185004144907, 0.14236903190612793, 0.18070316314697266, 0.5016218423843384, -0.15578283369541168, -0.08698137104511261, 0.06349577009677887, -0.00598660483956337, 0.027791231870651245, 0.4006884694099426, -0.06407077610492706, 0.28019773960113525, -0.09625203162431717, 0.15130864083766937, -0.30683934688568115, 0.24472206830978394, 0.087166927754879, -0.06741858273744583, 0.3021704852581024, -0.11698835343122482, 0.34278780221939087, -0.21113964915275574, -0.22514528036117554, 0.1760113388299942, 0.5051013827323914, -0.2419070452451706, 0.5634379386901855, -0.12988749146461487, 0.7094660997390747, 0.06742943078279495, 0.02094874158501625, 0.18040096759796143, -0.31548213958740234, -0.12723685801029205, -0.5465604662895203, -0.007262080907821655, -0.10310357809066772, 0.3397878110408783, -0.1036069244146347, -0.028276318684220314, 0.3000211715698242, -0.09931129217147827, -0.0567074716091156, 0.03961003199219704, 0.061159729957580566, -0.2352512776851654, 0.02536136284470558, 0.1863096058368683, -0.17436771094799042, -0.2578412592411041, -0.07910428941249847, 0.4259548783302307, -0.05456140637397766, 0.3364658057689667, -0.0020873844623565674, -0.15270821750164032, -0.14917759597301483, -0.1346244066953659, -0.19251319766044617, 0.32324308156967163, -0.2077963650226593, 0.14701300859451294, 0.08474749326705933, 0.642337441444397, -0.017536485567688942, -0.3781607747077942, 0.15444019436836243, -0.23287059366703033, -0.07574306428432465, 0.3525081276893616, 0.0923217162489891, 0.48881763219833374, -0.13575179874897003, -0.24338769912719727, 0.14493787288665771, -0.2385350465774536, -0.30840611457824707, -0.003286600112915039, -0.07368350774049759, -0.5476630926132202, -0.034223467111587524, -0.12581434845924377, 0.44202321767807007, 0.10242792963981628, 0.31302469968795776, 0.261452317237854, 0.028291549533605576, -0.026920348405838013, 0.1996551752090454, -0.08538146317005157, -0.28308919072151184, 0.36726778745651245, -0.03438451513648033, -0.09266667068004608, 0.028783993795514107, 0.17075076699256897, -0.2516990602016449, 0.4051514267921448, 0.18531200289726257, -0.3409927487373352, -0.1989559382200241, -0.20645248889923096, -0.20622819662094116, -0.036107681691646576, 0.09406401962041855, 0.13147662580013275, -0.06587425619363785, -0.5610384345054626, -0.08625397086143494, 0.3194767236709595, -0.03794184327125549, 0.007087200880050659, 0.09506060183048248, -0.13211767375469208, -0.11144477128982544, -0.10466848313808441, -0.4693058431148529, 0.2489994764328003, -0.11660591512918472, 0.513314962387085, 0.0017232634127140045, 0.10408134758472443, -0.4305589199066162, -0.022319991141557693, -0.31966447830200195, 0.018055276945233345, -0.2568732500076294, -0.242047518491745, 0.19496266543865204, -0.19490471482276917, 0.17659762501716614, -0.015100963413715363, -0.30893614888191223, -0.24509164690971375, -0.34509360790252686, 0.09285534173250198, 0.1208205595612526, -0.043621160089969635, -0.008349386975169182, -0.059815142303705215, -0.17425744235515594, 0.026554236188530922, 0.3029872179031372, 0.3476274907588959, -0.37015610933303833, 0.12672719359397888, 0.2690822184085846, -0.091831736266613, 0.050074175000190735, 0.31639742851257324, 0.30666714906692505, 0.3210080564022064, -0.28762754797935486, 0.04296361282467842, -0.32458510994911194, -0.04125913977622986, 0.25094926357269287, 0.24603158235549927, 0.4038318991661072, 0.18124908208847046, 0.09439335763454437, 0.1488959789276123, -0.12890870869159698, -0.04059014841914177, -0.0520637072622776, -0.11665302515029907, 0.07263030856847763, 0.022685693576931953, 0.15527161955833435, 0.28000935912132263, -0.030699823051691055, 0.18659773468971252, 0.3044380843639374, -0.28905946016311646, 0.2564731240272522, -0.037226833403110504, 0.3805270493030548, 0.023693792521953583, 0.022503159940242767, 0.044585101306438446, -0.2153528779745102, 0.02744896337389946, -0.057406727224588394, -0.6282975077629089, -0.26068782806396484, 0.3015058636665344, 0.09266561269760132, -0.14373695850372314, 0.1362481564283371, 0.32771599292755127, 0.2618350684642792, 0.3234044909477234, -0.15712705254554749, 0.2605867385864258, 0.1014169454574585, -0.6144984364509583, 0.13870413601398468, -0.3621826767921448, -0.06041225790977478, 0.14394111931324005, 0.006568886339664459, 0.10132113099098206, -0.16821204125881195, -0.31885066628456116, -0.14326871931552887, 0.08150514960289001, -0.13517087697982788, -0.5012130737304688, 0.07602641731500626, 0.041144534945487976, -0.39300423860549927, -0.13738596439361572, 0.1140616238117218, -0.15873129665851593, 0.3306981921195984, 0.0995141863822937, 0.13232187926769257, 0.06907036155462265, -0.3325543999671936, 0.06155383214354515, 0.3953469395637512, -0.06849048286676407, 0.24933399260044098, -0.26022201776504517, -0.23975178599357605, 0.20462927222251892, 0.1490548849105835, 0.26764723658561707, 0.08853437751531601, -0.23281113803386688, -0.09411144256591797, 0.22980448603630066, 0.11631941795349121, -0.1849549114704132, -0.1695796400308609, 0.14725276827812195, -0.11643856763839722, 0.1467336118221283, 0.18259239196777344, -0.19882971048355103, -0.09671832621097565, -0.3906432092189789, 0.2618876099586487, -0.05608989670872688, 0.5689520239830017, 0.26595884561538696, 0.20843800902366638, -0.02800094336271286, 0.06283784657716751, -0.5004042387008667, -0.030421365052461624, 0.07129430025815964, -0.28086966276168823, 0.26090046763420105, -0.2617405951023102, 0.1446167528629303, -0.04645634815096855, 0.2874634265899658, -0.1040668934583664, -0.13491031527519226, -0.08716624230146408, 0.04075847566127777, -0.05826092138886452, 0.033668361604213715, 0.012385223060846329, -0.1554395854473114, -0.13430115580558777, 0.3026207983493805, 0.18076160550117493, -0.2768171429634094, 0.21596896648406982, -0.2593124508857727, 0.42818403244018555, 0.2349415272474289, -0.15062148869037628, 0.3148283064365387, -0.04430301487445831, 0.03388272598385811, 0.23145213723182678, -0.30871543288230896, -0.00457516685128212, 0.3208974301815033, 0.15438592433929443, 0.20706306397914886, -0.35621178150177, 0.38803955912590027, -0.6009938716888428, 0.3762540817260742, -0.00862467847764492, 0.16888241469860077, -0.2719492018222809, -0.006541198119521141, 0.13902780413627625, -0.24604110419750214, -0.10196300595998764, -0.6867200136184692, -0.30504900217056274, 0.15623721480369568, -0.03725709393620491, 0.12999080121517181, -0.3411065936088562, -0.05533968657255173, -0.12574338912963867, -0.1736050397157669, -0.2785092890262604, 0.21907557547092438, -0.29512083530426025, 0.158238485455513, -0.2756960391998291, 0.27669358253479004, 0.16731922328472137, 0.09251713007688522, -0.22069838643074036, -0.07370124757289886, 0.4789573550224304, -0.017637191340327263, -0.08623436093330383, -0.27851489186286926, 0.40399739146232605, -0.1393270492553711, 0.21814222633838654, -0.1588849127292633, 0.07444994896650314, -0.021655220538377762, -0.10926248878240585, 0.014443125575780869, 0.2597411870956421, -0.15408597886562347, 0.0798952728509903, -0.26033303141593933, -0.02112865447998047, 0.10912539809942245, 0.23560430109500885, 0.08098460733890533, -0.1240105852484703 ]
https://github.com/huggingface/datasets/issues/6046
Support proxy and user-agent in fsspec calls
thanks a lot @lhoestq ! though i have a very lil idea of the issue, i am new. as i said before, but gonna try my best shot to do it. can you please suggest some tips or anything from your side, how basically we approach it will be really helpfull. Will try my best!
Since we switched to the new HfFileSystem we no longer apply user's proxy and user-agent. Using the HTTP_PROXY and HTTPS_PROXY environment variables works though since we use aiohttp to call the HF Hub. This can be implemented in `_prepare_single_hop_path_and_storage_options`. Though ideally the `HfFileSystem` could support passing at least the proxies
55
Support proxy and user-agent in fsspec calls Since we switched to the new HfFileSystem we no longer apply user's proxy and user-agent. Using the HTTP_PROXY and HTTPS_PROXY environment variables works though since we use aiohttp to call the HF Hub. This can be implemented in `_prepare_single_hop_path_and_storage_options`. Though ideally the `HfFileSystem` could support passing at least the proxies thanks a lot @lhoestq ! though i have a very lil idea of the issue, i am new. as i said before, but gonna try my best shot to do it. can you please suggest some tips or anything from your side, how basically we approach it will be really helpfull. Will try my best!
[ -0.19895200431346893, -0.22095391154289246, -0.009242072701454163, -0.2762700915336609, 0.25704318284988403, -0.47810062766075134, 0.06524555385112762, 0.011893115937709808, 0.44202566146850586, 0.289785236120224, -0.40862515568733215, 0.09876830130815506, 0.2533799111843109, 0.43592146039009094, 0.046440187841653824, 0.09458277374505997, -0.042265139520168304, -0.004304036498069763, -0.2544800043106079, 0.05668739229440689, -0.09115919470787048, 0.14527857303619385, 0.18923036754131317, 0.043481431901454926, -0.21816371381282806, 0.18152320384979248, -0.12394123524427414, 0.3569067120552063, -0.10683371871709824, -0.38404324650764465, 0.34372517466545105, 0.31190225481987, 0.15990829467773438, -0.005534633994102478, -0.00010559687507338822, 0.11706659197807312, 0.23458264768123627, 0.017362548038363457, -0.04592752829194069, 0.15316346287727356, -0.040587168186903, 0.15617048740386963, -0.0323546901345253, -0.14774107933044434, -0.2112015187740326, 0.10505658388137817, -0.07877618819475174, -0.18514569103717804, 0.4838406443595886, 0.41891103982925415, 0.24413368105888367, 0.1350642889738083, -0.16774624586105347, -0.05295000225305557, 0.18808281421661377, -0.011592015624046326, -0.056051868945360184, -0.44484472274780273, 0.22471177577972412, -0.234054297208786, -0.046268291771411896, -0.12826600670814514, -0.06599495559930801, 0.017751365900039673, 0.13111895322799683, -0.24350206553936005, 0.19148987531661987, -0.19090232253074646, -0.0015576966106891632, 0.2650955319404602, 0.33958572149276733, 0.09748352319002151, -0.17746269702911377, 0.19658583402633667, -0.20979811251163483, 0.11643923819065094, 0.2899293899536133, -0.4323877692222595, -0.13081158697605133, 0.10327894985675812, 0.4474143385887146, -0.18811814486980438, -0.2867203950881958, 0.13797619938850403, 0.07382912933826447, 0.21551920473575592, 0.038001637905836105, 0.028381075710058212, 0.18881750106811523, -0.022269356995821, -0.10921955108642578, 0.03101680800318718, -0.18290802836418152, -0.17157110571861267, -0.3200973868370056, -0.1777360737323761, 0.24018853902816772, 0.20589515566825867, -0.015582291409373283, 0.10345511138439178, -0.1979532241821289, 0.2601391673088074, -0.12036067992448807, 0.4250970482826233, -0.2859123647212982, 0.1076219379901886, 0.03547227382659912, 0.04530973732471466, 0.27108776569366455, -0.03580041602253914, 0.0344076044857502, -0.04286206513643265, 0.1606028825044632, -0.10918283462524414, -0.48881277441978455, 0.07856588065624237, -0.17783348262310028, -0.28328895568847656, -0.010979145765304565, -0.18529821932315826, 0.08066397160291672, 0.18414582312107086, 0.17194001376628876, 0.4157726764678955, 0.06829499453306198, 0.4870501756668091, 0.2095346301794052, 0.012713251635432243, -0.40212416648864746, -0.08363614976406097, -0.14858661592006683, 0.24107803404331207, -0.25543245673179626, 0.252263605594635, 0.10728918015956879, 0.22649584710597992, 0.14527085423469543, -0.11897289752960205, 0.1966531127691269, 0.16611485183238983, 0.20668062567710876, -0.19455420970916748, -0.06930134445428848, 0.2565838098526001, 0.14484632015228271, -0.22359684109687805, -0.0761527419090271, -0.10076358914375305, -0.05897282809019089, -0.11293864995241165, -0.19343498349189758, -0.3288630545139313, -0.004561824724078178, 0.1707136183977127, 0.06720784306526184, -0.23223328590393066, -0.36558452248573303, -0.0820610523223877, -0.2784830629825592, 0.15856388211250305, 0.08653482794761658, 0.02642923966050148, -0.2535610496997833, -0.009982991963624954, 0.09760428220033646, 0.16165874898433685, 0.26077303290367126, -0.22696392238140106, 0.008372124284505844, -0.19314855337142944, 0.16370388865470886, -0.0034766197204589844, 0.04583805054426193, -0.07173348218202591, -0.26646995544433594, 0.4116683602333069, 0.2522667944431305, -0.7025855183601379, -0.0672910138964653, 0.4310586154460907, 0.19752182066440582, -0.11763985455036163, 0.25505781173706055, -0.2229340374469757, 0.297413170337677, -0.01583215408027172, -0.1919616460800171, 0.5440678596496582, -0.07678581774234772, 0.24977099895477295, -0.25875160098075867, -0.34274178743362427, -0.22490428388118744, 0.18030552566051483, 0.30856627225875854, 0.23173853754997253, 0.07525233924388885, -0.26507648825645447, 0.371277779340744, -0.10974335670471191, 0.20035427808761597, -0.16882114112377167, 0.42182600498199463, 0.5945963263511658, 0.062044546008110046, 0.06746625900268555, 0.20980936288833618, 0.1927240788936615, -0.3747641146183014, 0.136377215385437, 0.3838260769844055, -0.1408684253692627, -0.14948028326034546, -0.07091167569160461, -0.023767154663801193, -0.13109810650348663, 0.1850607693195343, 0.16967543959617615, -0.1705847978591919, -0.11742033064365387, 0.2229038029909134, 0.47955846786499023, 0.21644443273544312, 0.14238262176513672, 0.02409318834543228, 0.5171801447868347, -0.12920507788658142, -0.1978910267353058, 0.0783606693148613, 0.09602010250091553, 0.47483840584754944, -0.02021646313369274, -0.2181832194328308, 0.16203007102012634, 0.2859422266483307, 0.12038159370422363, 0.3280901312828064, 0.3080897927284241, 0.21487893164157867, -0.08533412963151932, 0.12150298058986664, 0.00411863811314106, 0.14432653784751892, 0.0547981858253479, 0.3416663110256195, 0.23709002137184143, 0.3641611933708191, 0.11945432424545288, 0.19254477322101593, 0.23317912220954895, 0.14806130528450012, -0.3197520971298218, 0.1679253727197647, 0.0991666316986084, 0.05750671774148941, 0.08135513961315155, 0.009117960929870605, -0.11710485816001892, 0.12409047782421112, 0.21040451526641846, -0.05837542936205864, 0.2942488491535187, 0.10429428517818451, 0.21350839734077454, 0.14551669359207153, -0.18900972604751587, 0.5554075837135315, -0.22410130500793457, 0.03989323973655701, 0.2854253351688385, -0.19697892665863037, -0.040088050067424774, 0.06738435477018356, 0.035475004464387894, 0.1564268171787262, -0.212754026055336, 0.08073283731937408, -0.13149264454841614, -0.0016522710211575031, -0.03116540238261223, -0.29602083563804626, -0.36795052886009216, -0.152619868516922, -0.09066485613584518, -0.4029026925563812, -0.10984069108963013, -0.32719385623931885, -0.23406749963760376, 0.29159870743751526, 0.19833636283874512, 0.32980772852897644, -0.30060771107673645, 0.04348529875278473, 0.4209131896495819, -0.16093163192272186, 0.20131643116474152, -0.2328253537416458, 0.31603574752807617, -0.24861052632331848, 0.4534507691860199, -0.38930079340934753, 0.20271477103233337, -0.21351242065429688, 0.07000291347503662, 0.17511144280433655, 0.22952298820018768, 0.12444557994604111, 0.2699545919895172, -0.02480122819542885, -0.26367807388305664, -0.28324732184410095, 0.19142717123031616, 0.1649625301361084, 0.09382438659667969, -0.070782870054245, -0.03669741749763489, 0.21752555668354034, 0.08174435049295425, 0.16607849299907684, -0.192536398768425, 0.012673338875174522, 0.12932687997817993, -0.1294264793395996, -0.20016805827617645, -0.17079192399978638, -0.08143424242734909, -0.3901599943637848, -0.3073553740978241, -0.020482033491134644, -0.3959709107875824, 0.1716437190771103, -0.17303799092769623, 0.012122591026127338, -0.1497776210308075, -0.17784495651721954, -0.1376139521598816, -0.2129468321800232, -0.4455319046974182, 0.15284639596939087, -0.2848260700702667, -0.21664173901081085, 0.0141831673681736, 0.11678926646709442, -0.2961459755897522, -0.12514449656009674, -0.24251221120357513, -0.5632134079933167, -0.25583964586257935, 0.20568634569644928, -0.14925061166286469, -0.038756683468818665, 0.3155440092086792, -0.052701421082019806, -0.2482035607099533, -0.1832459568977356, -0.06577003002166748, 0.24511295557022095, 0.21871697902679443, 0.08627763390541077, -0.07383453845977783, 0.1762109100818634, 0.17835599184036255, 0.2598680257797241, 0.09346766769886017, 0.35349220037460327, 0.6295058727264404, -0.019744211807847023, 0.0035053789615631104, -0.0702274814248085, -0.06814611703157425, 0.34946805238723755, -0.09047557413578033, 0.19208131730556488, 0.22012609243392944, 0.16849413514137268, 0.10283121466636658, -0.09063169360160828, -0.03018740564584732, 0.10044573992490768, -0.3526383340358734, 0.010587509721517563, -0.18954117596149445, -0.03270220756530762, -0.08155974745750427, -0.044603168964385986, -0.16078847646713257, 0.05863306671380997, 0.3250651955604553, 0.3905388116836548, -0.029998980462551117, 0.02511020004749298, -0.07125286012887955, 0.06225058063864708, -0.5342410206794739, 0.3306010961532593, -0.036362454295158386, 0.2211732119321823, -0.3728668689727783, 0.10552110522985458, 0.0949835479259491, -0.011539598926901817, 0.2830885052680969, -0.29767757654190063, 0.1315876543521881, 0.015014056116342545, -0.07073762267827988, 0.038663409650325775, 0.01851074770092964, 0.21090227365493774, 0.016603849828243256, -0.022156309336423874, -0.19641897082328796, 0.017962202429771423, -0.31800317764282227, -0.4509219229221344, -0.7635583281517029, -0.19269807636737823, -0.1584613025188446, 0.0052728913724422455, -0.3446907699108124, -0.06657364964485168, -0.09117629379034042, -0.015465003438293934, -0.27898460626602173, -0.17045548558235168, -0.36139926314353943, 0.11246366798877716, -0.044544849544763565, 0.18868470191955566, 0.001883363351225853, -0.13239535689353943, -0.18447108566761017, 0.02992343157529831, 0.04505788907408714, 0.22470885515213013, 0.21837513148784637, 0.32800063490867615, -0.13689939677715302, -0.13920414447784424, -0.0004134140908718109, -0.11105567961931229, 0.08855482190847397, 0.29622769355773926, -0.10549226403236389, 0.3842530846595764, -0.19184577465057373, 0.21703341603279114, -0.3743847608566284, 0.13700656592845917, 0.11182056367397308, 0.12887103855609894, 0.3519294559955597, -0.1012146919965744, 0.31067630648612976, -0.06815001368522644, -0.22083783149719238, 0.10873669385910034, 0.44458454847335815, -0.2545182406902313, 0.6669684052467346, -0.2925010621547699, 0.6747592091560364, 0.24945862591266632, 0.019722457975149155, 0.2476736307144165, -0.33555400371551514, -0.1669841855764389, -0.46675336360931396, -0.16454553604125977, 0.005219843238592148, 0.17595577239990234, -0.09645812958478928, 0.032934632152318954, 0.3776986002922058, -0.12671495974063873, -0.30265408754348755, 0.153181254863739, 0.03265254199504852, -0.32166939973831177, 0.0021340297535061836, 0.31696081161499023, -0.1418776661157608, -0.38234490156173706, -0.1281197965145111, 0.3712736964225769, 0.023656509816646576, 0.07586893439292908, 0.07872047275304794, -0.23395763337612152, -0.08613255620002747, -0.061220087110996246, -0.13336952030658722, 0.2515720725059509, -0.1840231865644455, 0.12685361504554749, 0.03453884273767471, 0.586120069026947, 0.2153303474187851, -0.3281921148300171, 0.16434840857982635, -0.18820250034332275, -0.1467159390449524, 0.2880781888961792, 0.17480182647705078, 0.3252542316913605, -0.11920447647571564, -0.2723935842514038, 0.2111760377883911, -0.17519983649253845, -0.41995543241500854, -0.07295941561460495, -0.09731651097536087, -0.37991243600845337, 0.05245877802371979, -0.306177020072937, 0.5168992280960083, -0.05509716272354126, 0.4030112326145172, 0.10184092819690704, -0.08470644056797028, -0.06167113035917282, 0.2243257761001587, 0.024557538330554962, -0.24098798632621765, 0.471719354391098, 0.05516273155808449, -0.007805824279785156, 0.03197507932782173, 0.04941568523645401, -0.24253126978874207, 0.2964012920856476, 0.1986863762140274, -0.2221197783946991, -0.2711229622364044, -0.2016344666481018, -0.1695059984922409, -0.007579650729894638, 0.20858070254325867, -0.018911316990852356, 0.08145764470100403, -0.6237215399742126, 0.01980867050588131, 0.10036510229110718, -0.028409481048583984, 0.050772033631801605, 0.025503646582365036, -0.2521480619907379, -0.11175265908241272, -0.07088577747344971, -0.44340744614601135, 0.10658060014247894, -0.1833643615245819, 0.38057368993759155, -0.015229418873786926, 0.26086899638175964, -0.4076076149940491, -0.06317014992237091, -0.17388634383678436, 0.08646491169929504, -0.2715756297111511, -0.3130981922149658, 0.08238951861858368, -0.12152282893657684, 0.1367928683757782, 0.0423617884516716, -0.36855679750442505, -0.1927579939365387, -0.25542008876800537, 0.12445646524429321, 0.17509356141090393, -0.16123273968696594, -0.05234290659427643, -0.086607426404953, -0.10624587535858154, 0.021484240889549255, 0.06988757848739624, 0.3066251277923584, -0.2758088707923889, 0.09616812318563461, 0.2302381694316864, -0.10223626345396042, 0.031113065779209137, 0.3453048765659332, 0.274236798286438, 0.21601301431655884, -0.2877759039402008, 0.034815672785043716, -0.2724301815032959, -0.1343434453010559, 0.3476295471191406, 0.18030884861946106, 0.36063873767852783, 0.15481963753700256, 0.16481010615825653, 0.1967724710702896, -0.0767979845404625, -0.007724930997937918, -0.07978812605142593, -0.017511308193206787, 0.038514912128448486, 0.17841239273548126, 0.1925850510597229, 0.3342590928077698, 0.09494411945343018, 0.093645378947258, 0.20113585889339447, -0.247663214802742, 0.16767898201942444, -0.0794665589928627, 0.3863508999347687, -0.026619646698236465, 0.27057763934135437, 0.11015907675027847, -0.2738862931728363, -0.010074816644191742, -0.19567541778087616, -0.6534706354141235, -0.3818567097187042, 0.19442881643772125, 0.20337577164173126, -0.15049758553504944, 0.11051452904939651, 0.30940157175064087, 0.20249903202056885, 0.38117632269859314, -0.3345262110233307, 0.3225737512111664, 0.0706043541431427, -0.6080692410469055, 0.0006887465715408325, -0.3800925016403198, -0.16256514191627502, 0.025126658380031586, -0.11149586737155914, 0.46122732758522034, -0.05497228726744652, -0.33329108357429504, -0.15545602142810822, 0.02689274773001671, -0.15413492918014526, -0.3251473307609558, 0.09216305613517761, 0.15930110216140747, -0.47090598940849304, -0.27171412110328674, 0.1306031495332718, -0.06953684985637665, 0.25983327627182007, 0.13014231622219086, -0.03455120325088501, 0.09780503809452057, -0.4419574737548828, 0.13609758019447327, 0.28257566690444946, -0.060255687683820724, 0.24949294328689575, -0.1382605880498886, -0.17244400084018707, 0.151358500123024, 0.04896800220012665, 0.2522949278354645, 0.18177735805511475, -0.3784814774990082, -0.04216223210096359, 0.2807772755622864, 0.03155854344367981, -0.058392614126205444, -0.13095547258853912, 0.0558924674987793, -0.053425949066877365, 0.05990162864327431, 0.15974459052085876, -0.23343448340892792, -0.08467787504196167, -0.40818753838539124, 0.1792864352464676, -0.017418576404452324, 0.4590412676334381, 0.49554476141929626, 0.24302417039871216, -0.06909752637147903, -0.008984290063381195, -0.5004288554191589, 0.053584180772304535, 0.16584134101867676, -0.4048886001110077, 0.18686705827713013, -0.22216443717479706, 0.11354288458824158, -0.09634524583816528, 0.24040929973125458, 0.0032815076410770416, -0.00029819831252098083, -0.12831687927246094, -0.0027509555220603943, -0.03791564702987671, -0.04766736179590225, 0.11987246572971344, -0.28167539834976196, -0.08079300820827484, 0.12347027659416199, 0.10014528781175613, -0.29451507329940796, 0.19158431887626648, -0.11425568163394928, 0.6152048110961914, 0.09286297857761383, -0.34574249386787415, 0.32583168148994446, 0.06680850684642792, 0.15480494499206543, 0.24289897084236145, -0.35881829261779785, 0.22007456421852112, 0.4802599847316742, 0.1444188356399536, 0.07615591585636139, -0.36512258648872375, 0.20689396560192108, -0.5225696563720703, 0.38489094376564026, 0.0286509171128273, 0.2838887572288513, -0.2940026819705963, 0.044185295701026917, 0.21090780198574066, -0.21720589697360992, -0.13323865830898285, -0.7549608945846558, -0.1477797031402588, 0.10843586921691895, -0.11851394921541214, 0.1787559688091278, -0.36361896991729736, 0.07190661877393723, -0.20499593019485474, -0.3267163038253784, -0.2534084916114807, 0.21781876683235168, -0.20372125506401062, 0.09832903742790222, -0.2632251977920532, 0.2664155066013336, 0.10047973692417145, 0.033133767545223236, -0.21233302354812622, -0.09915430843830109, 0.5329734683036804, 0.06429420411586761, 0.041755560785532, -0.3926456868648529, 0.3800826072692871, -0.16701292991638184, 0.10098478198051453, -0.12380674481391907, -0.01833416521549225, -0.1293940246105194, 0.07230296730995178, 0.07763475179672241, 0.2907131612300873, 0.02635239064693451, 0.16516046226024628, -0.18927934765815735, 0.014508005231618881, 0.15340954065322876, 0.37200137972831726, 0.09300413727760315, -0.027689015492796898 ]
https://github.com/huggingface/datasets/issues/6046
Support proxy and user-agent in fsspec calls
The HfFileSystem from the `huggingface_hub` package can already read the HTTP_PROXY and HTTPS_PROXY environment variables. So the remaining thing missing is the `user_agent` that the user may include in a `DownloadConfig` object. The user agent can be used for regular http calls but also calls to the HfFileSystem. - for http, the `user_agent` isn't passed from `DownloadConfig` to `get_datasets_user_agent` in `_prepare_single_hop_path_and_storage_options` in `streaming_download_manager.py` so we need to include it - for HfFileSystem I think it requires a PR in https://github.com/huggingface/huggingface_hub to include it in the `HfFileSystem.__init__`
Since we switched to the new HfFileSystem we no longer apply user's proxy and user-agent. Using the HTTP_PROXY and HTTPS_PROXY environment variables works though since we use aiohttp to call the HF Hub. This can be implemented in `_prepare_single_hop_path_and_storage_options`. Though ideally the `HfFileSystem` could support passing at least the proxies
86
Support proxy and user-agent in fsspec calls Since we switched to the new HfFileSystem we no longer apply user's proxy and user-agent. Using the HTTP_PROXY and HTTPS_PROXY environment variables works though since we use aiohttp to call the HF Hub. This can be implemented in `_prepare_single_hop_path_and_storage_options`. Though ideally the `HfFileSystem` could support passing at least the proxies The HfFileSystem from the `huggingface_hub` package can already read the HTTP_PROXY and HTTPS_PROXY environment variables. So the remaining thing missing is the `user_agent` that the user may include in a `DownloadConfig` object. The user agent can be used for regular http calls but also calls to the HfFileSystem. - for http, the `user_agent` isn't passed from `DownloadConfig` to `get_datasets_user_agent` in `_prepare_single_hop_path_and_storage_options` in `streaming_download_manager.py` so we need to include it - for HfFileSystem I think it requires a PR in https://github.com/huggingface/huggingface_hub to include it in the `HfFileSystem.__init__`
[ -0.1525508314371109, -0.35849183797836304, -0.016341475769877434, -0.18941755592823029, 0.29788440465927124, -0.33972495794296265, 0.009544987231492996, -0.018750153481960297, 0.4224054217338562, 0.19645920395851135, -0.5797526240348816, 0.039395201951265335, 0.0445692352950573, 0.5652254819869995, 0.18675944209098816, -0.08144518733024597, 0.014970742166042328, 0.040029317140579224, -0.3453902304172516, 0.1500558853149414, -0.0983738824725151, 0.2038392424583435, 0.28804755210876465, 0.050342511385679245, -0.08051234483718872, 0.2572726607322693, -0.24427780508995056, 0.38884440064430237, -0.30567553639411926, -0.5073792934417725, 0.3897306025028229, 0.38064390420913696, 0.18456797301769257, 0.07926348596811295, -0.00011001425446011126, 0.036125876009464264, 0.1220167800784111, -0.11527924239635468, -0.26837560534477234, -0.08824151754379272, 0.0210249200463295, -0.03926537185907364, 0.1537553369998932, -0.1264197826385498, -0.047645699232816696, 0.0705757811665535, 0.07389066368341446, 0.02803707867860794, 0.49357670545578003, 0.25260618329048157, 0.2093779593706131, 0.26309964060783386, -0.08001843839883804, -0.060110945254564285, 0.25516924262046814, 0.14989404380321503, -0.045381009578704834, -0.12780824303627014, 0.2160073071718216, -0.0385315828025341, -0.0024823546409606934, -0.11658072471618652, -0.16522102057933807, 0.022128144279122353, 0.43322694301605225, -0.07469737529754639, 0.09591443836688995, -0.32581910490989685, -0.21120932698249817, 0.38038942217826843, 0.2994019091129303, -0.14490193128585815, -0.3773080110549927, -0.15274664759635925, -0.07704904675483704, -0.11396244913339615, 0.2004634141921997, -0.22254341840744019, -0.36253347992897034, 0.03869052976369858, 0.3275543749332428, -0.2375124841928482, -0.19013462960720062, 0.11632581055164337, 0.0938355028629303, 0.19537387788295746, -0.034991130232810974, -0.03844929486513138, 0.44568300247192383, 0.03144194930791855, -0.24897980690002441, -0.11852265894412994, -0.046808239072561264, 0.0023405314423143864, -0.2792074978351593, -0.1038854569196701, 0.26969507336616516, 0.39872121810913086, 0.05450240522623062, 0.2044215053319931, -0.17047570645809174, 0.12298344820737839, -0.16291621327400208, 0.4026595950126648, -0.2606455683708191, 0.10596880316734314, -0.04434841126203537, -0.06966295093297958, 0.2309887409210205, 0.18520908057689667, 0.25179874897003174, -0.1491681933403015, 0.21249867975711823, 0.01862579956650734, -0.5164321064949036, 0.03266732767224312, -0.13460081815719604, -0.10787104815244675, 0.008450852707028389, -0.2759864628314972, 0.16693228483200073, 0.0748625099658966, 0.23033633828163147, 0.44202592968940735, -0.09722262620925903, 0.3539525270462036, 0.15566805005073547, 0.12785974144935608, -0.23712649941444397, 0.08968222141265869, -0.17224787175655365, 0.08778201043605804, -0.09045244753360748, 0.318278968334198, 0.08257092535495758, -0.1705400049686432, 0.32599586248397827, -0.1909235268831253, 0.30053067207336426, 0.3042350113391876, -0.006163126789033413, -0.06066185608506203, -0.14778530597686768, 0.33278870582580566, -0.03182163089513779, -0.1924019306898117, 0.040110863745212555, -0.018040772527456284, -0.2315475046634674, -0.2579560875892639, -0.0424191877245903, -0.45482149720191956, 0.1247955784201622, 0.13969141244888306, -0.03734203055500984, -0.15578067302703857, -0.35704171657562256, 0.039584770798683167, -0.41659078001976013, 0.037190649658441544, 0.2010083794593811, -0.033865004777908325, -0.2680916488170624, -0.1325521469116211, 0.212630495429039, 0.44247186183929443, 0.32780495285987854, -0.4585348665714264, -0.04574930667877197, -0.3360222578048706, 0.04328016936779022, -0.09240972995758057, 0.02965930849313736, -0.08902633935213089, -0.20914271473884583, 0.369174599647522, 0.3392997086048126, -0.6602675914764404, -0.1861741691827774, 0.2994574308395386, 0.14183112978935242, 0.212711364030838, 0.43590041995048523, -0.1094231829047203, 0.3265160620212555, -0.050540126860141754, -0.1685566008090973, 0.36122649908065796, -0.049098722636699677, 0.12893235683441162, -0.08077864348888397, -0.523594319820404, -0.21430973708629608, 0.2616004943847656, 0.14555060863494873, 0.28694581985473633, 0.03681042790412903, -0.3176528811454773, 0.364876389503479, -0.03562960401177406, 0.14654405415058136, -0.2399154156446457, 0.34926140308380127, 0.6648353934288025, -0.11140114814043045, -0.0008599460124969482, -0.10225116461515427, 0.26282480359077454, -0.3448430001735687, 0.14893466234207153, 0.20917603373527527, -0.32904964685440063, -0.10330286622047424, -0.07080525904893875, 0.04574298858642578, -0.2189142107963562, 0.09558841586112976, 0.13180580735206604, 0.11843079328536987, -0.08696967363357544, 0.026224549859762192, 0.6676400899887085, 0.22784246504306793, 0.37223759293556213, -0.15770694613456726, 0.38531234860420227, -0.021395502611994743, -0.12730678915977478, 0.07517508417367935, 0.08470453321933746, 0.2818630039691925, -0.10312049835920334, -0.04643446207046509, 0.3020648956298828, 0.1474061757326126, 0.18508225679397583, 0.1021982729434967, 0.3867521286010742, 0.2536301016807556, 0.01873714104294777, 0.11478757113218307, 0.028478870168328285, 0.3152390718460083, 0.03417770564556122, 0.2539560794830322, 0.36859971284866333, 0.3032057285308838, 0.13934722542762756, 0.22415168583393097, 0.1900816559791565, 0.12389744818210602, -0.08782300353050232, 0.008338037878274918, 0.14651110768318176, 0.025918103754520416, -0.07810993492603302, 0.08904597163200378, -0.18044054508209229, -0.08897387236356735, 0.20210504531860352, 0.049385227262973785, 0.19519813358783722, -0.0668560341000557, 0.30009227991104126, 0.01045672595500946, -0.18578040599822998, 0.41412603855133057, -0.15229909121990204, 0.3580417037010193, 0.2893219590187073, -0.057162586599588394, 0.2875255048274994, 0.15058588981628418, -0.10949832946062088, 0.2647271454334259, -0.0689842700958252, -0.19071154296398163, -0.13758167624473572, -0.19671568274497986, -0.031969986855983734, -0.2542648911476135, -0.37859880924224854, -0.2495099902153015, -0.06095879524946213, -0.3705129027366638, -0.08913586288690567, -0.30145180225372314, -0.5132083296775818, 0.24472735822200775, 0.05836670100688934, 0.13623137772083282, -0.29409846663475037, -0.050234824419021606, 0.5491870641708374, -0.1437271237373352, 0.05920213460922241, -0.1773129552602768, 0.3163721263408661, -0.3467000722885132, 0.16469088196754456, -0.5633495450019836, 0.22224414348602295, -0.1115061417222023, 0.04370545223355293, 0.15964244306087494, 0.041995055973529816, 0.12970022857189178, 0.07722155004739761, -0.07002371549606323, -0.23282726109027863, -0.1307738721370697, 0.14984768629074097, 0.054277531802654266, 0.046061448752880096, 0.11613064259290695, 0.0030132457613945007, 0.1852661818265915, 0.12929373979568481, 0.2341701239347458, -0.20836637914180756, -0.03972525894641876, -0.046297065913677216, 0.0681484118103981, -0.07654909789562225, -0.1849406510591507, 0.000771641731262207, -0.5862964987754822, -0.4623447358608246, 0.3028568625450134, -0.21348071098327637, 0.18193630874156952, -0.1190650686621666, -0.01032231468707323, 0.09736945480108261, -0.32038459181785583, -0.03398750722408295, -0.17636272311210632, -0.5031941533088684, 0.11306911706924438, -0.2116401195526123, -0.1653020828962326, -0.00006791576743125916, 0.11555306613445282, -0.3019871413707733, -0.059765011072158813, -0.36808866262435913, -0.5210735201835632, -0.22543704509735107, 0.12743881344795227, 0.02275257557630539, 0.25419220328330994, 0.4216253161430359, -0.04913324862718582, -0.14385555684566498, -0.09911783039569855, -0.13065730035305023, 0.14464794099330902, 0.32337963581085205, 0.002516619861125946, -0.07134874910116196, 0.17885041236877441, 0.015334304422140121, 0.4967825412750244, 0.2635425627231598, 0.38795891404151917, 0.6306174993515015, -0.02007346786558628, 0.17547957599163055, -0.08132839947938919, -0.08304288238286972, 0.31108149886131287, -0.1654365360736847, 0.2636890411376953, 0.2840709686279297, 0.17488569021224976, 0.2936685383319855, -0.2807260751724243, -0.05688585340976715, -0.017038501799106598, -0.36986279487609863, 0.013747330754995346, -0.055671751499176025, -0.06842074543237686, -0.05668996274471283, -0.03070317581295967, -0.08231355249881744, 0.08295078575611115, 0.1813625544309616, 0.6074853539466858, 0.011216141283512115, 0.2415911704301834, 0.03616604581475258, -0.02115883305668831, -0.6797740459442139, 0.3161736726760864, 0.08727864921092987, 0.08277644217014313, -0.24026358127593994, -0.1128510981798172, 0.04363008216023445, -0.004235618282109499, 0.3135042190551758, -0.17114652693271637, -0.1307409405708313, -0.025619028136134148, -0.1823631078004837, -0.08877698332071304, -0.013869589194655418, 0.14705823361873627, -0.07865919172763824, -0.09690120816230774, -0.062872514128685, -0.2108910083770752, -0.38798728585243225, -0.35664281249046326, -0.4573045074939728, -0.07625162601470947, -0.07784735411405563, -0.1326362043619156, -0.4149909019470215, -0.22661881148815155, -0.025981619954109192, -0.13286344707012177, -0.19164742529392242, -0.12641844153404236, -0.1396322250366211, 0.18251357972621918, 0.08760333061218262, 0.18543201684951782, 0.0839703232049942, -0.08431818336248398, -0.2611418068408966, -0.012088151648640633, 0.11381572484970093, 0.16408267617225647, 0.21284225583076477, 0.6268503665924072, -0.18677975237369537, -0.26962316036224365, 0.030147843062877655, 0.14823339879512787, 0.041412048041820526, 0.4042353928089142, -0.05477796122431755, 0.41351377964019775, 0.021891916170716286, 0.2179349660873413, -0.42396795749664307, 0.1360529363155365, 0.2539477050304413, 0.07468163222074509, 0.30847498774528503, -0.32492348551750183, 0.52051842212677, -0.07996425032615662, -0.21516621112823486, 0.22221919894218445, 0.5501290559768677, -0.2436055690050125, 0.38379931449890137, -0.30966076254844666, 0.8854303956031799, 0.21255923807621002, 0.2806151211261749, 0.3977254033088684, -0.5644600987434387, 0.11216770857572556, -0.36419379711151123, -0.0979030653834343, 0.030697714537382126, 0.19840317964553833, -0.21529431641101837, 0.02232913300395012, 0.3828369081020355, -0.24784596264362335, -0.3942408263683319, 0.20218895375728607, 0.01844419538974762, -0.05856598541140556, 0.09717319905757904, 0.29197749495506287, -0.4738704562187195, -0.44060003757476807, -0.24162176251411438, 0.32000869512557983, 0.05297408625483513, 0.2929965555667877, -0.009390698745846748, -0.23646280169487, -0.14342887699604034, -0.06477124989032745, -0.2116721123456955, 0.12042679637670517, -0.33991679549217224, -0.02260587364435196, 0.03722548112273216, 0.4931079149246216, 0.06648127734661102, -0.20499065518379211, 0.015084773302078247, -0.2831774652004242, -0.16412776708602905, 0.09128755331039429, -0.02240794152021408, 0.4108138680458069, -0.007144593633711338, -0.24187983572483063, 0.4082529842853546, -0.18875950574874878, -0.2427678406238556, 0.08943897485733032, -0.08919064700603485, -0.18002484738826752, 0.12497946619987488, -0.27250075340270996, 0.38065165281295776, -0.07967615872621536, 0.27230456471443176, 0.11682102084159851, -0.015021808445453644, -0.11233656108379364, 0.1391889899969101, 0.01844080537557602, -0.34772685170173645, 0.2775321304798126, -0.10555888712406158, 0.05260774493217468, -0.14185155928134918, 0.11077137291431427, -0.27135810256004333, 0.11848284304141998, 0.16691340506076813, -0.2825595438480377, -0.22192206978797913, -0.18037724494934082, -0.20909735560417175, -0.10213357210159302, 0.016877956688404083, 0.08823022246360779, 0.12430760264396667, -0.4418365955352783, -0.12204218655824661, 0.11732308566570282, 0.10878337919712067, -0.05499713867902756, 0.023879308253526688, -0.32020384073257446, -0.2236148566007614, 0.0599123053252697, -0.300035297870636, 0.16958986222743988, -0.14167970418930054, 0.2976837456226349, 0.0439068004488945, 0.13647115230560303, -0.37395620346069336, -0.11904529482126236, 0.0008446667343378067, -0.06932102143764496, 0.011042164638638496, -0.06751036643981934, 0.31973952054977417, -0.08840957283973694, 0.06226880103349686, 0.13100019097328186, -0.5954173803329468, -0.17488399147987366, -0.36498531699180603, 0.1384235918521881, 0.17794445157051086, -0.23675887286663055, -0.07388229668140411, -0.02442624419927597, -0.10890299081802368, -0.056075289845466614, 0.2183372974395752, 0.28516924381256104, -0.19565488398075104, 0.050965700298547745, 0.28623661398887634, -0.010959818959236145, -0.04632974788546562, 0.30046209692955017, 0.2594742774963379, 0.18987798690795898, -0.1667773425579071, 0.025663942098617554, -0.4220987558364868, -0.1029980331659317, 0.422977477312088, 0.26852184534072876, 0.4467020034790039, 0.06469780206680298, 0.33049723505973816, 0.27465134859085083, 0.003015507012605667, -0.1686377227306366, 0.09909266978502274, 0.23166587948799133, 0.16916127502918243, 0.16495926678180695, 0.43138596415519714, 0.20757828652858734, 0.017107460647821426, 0.10161661356687546, 0.261748343706131, -0.1588018536567688, 0.16254355013370514, 0.10141968727111816, 0.3812006413936615, 0.04615733027458191, 0.2182260900735855, -0.0429815873503685, -0.11890209466218948, 0.3247617483139038, 0.04124133661389351, -0.3080570101737976, -0.18276779353618622, 0.3036704361438751, 0.21427755057811737, 0.06685440242290497, 0.26560646295547485, 0.1517552137374878, -0.10562234371900558, 0.30916306376457214, -0.5278850793838501, 0.23442700505256653, 0.04402787983417511, -0.6410595178604126, -0.09068556129932404, -0.3380407989025116, -0.13677629828453064, 0.09636208415031433, -0.17145022749900818, 0.5596611499786377, -0.2927514612674713, -0.39106079936027527, -0.07650954276323318, 0.19724881649017334, -0.02135653793811798, -0.3216979205608368, 0.29188692569732666, 0.08403488248586655, -0.3834134638309479, -0.16236355900764465, 0.14963850378990173, -0.36367321014404297, 0.3720453679561615, 0.01739681512117386, 0.18947145342826843, -0.046499960124492645, -0.4895198941230774, 0.08822944760322571, 0.22625023126602173, -0.05989082157611847, 0.035018011927604675, 0.04240546375513077, -0.19508042931556702, 0.11686362326145172, 0.1383032351732254, 0.3376837968826294, 0.027206461876630783, -0.2555919587612152, 0.06999682635068893, 0.18597497045993805, 0.1439216285943985, -0.11570461094379425, -0.18763238191604614, 0.168840691447258, 0.07660780847072601, 0.020154424011707306, 0.12377993762493134, -0.20829755067825317, -0.12583550810813904, -0.5065214037895203, 0.14493751525878906, -0.22368137538433075, 0.6164544224739075, 0.22596684098243713, 0.2695932686328888, -0.0015449374914169312, 0.0878470242023468, -0.5867308378219604, 0.21185901761054993, 0.20804499089717865, -0.2153398096561432, 0.21575221419334412, -0.12170660495758057, 0.07165276259183884, 0.11138176918029785, 0.30871233344078064, 0.12374071776866913, 0.012177694588899612, -0.10658349096775055, 0.0425870418548584, -0.175669327378273, -0.17196664214134216, 0.1670316904783249, -0.3628387451171875, -0.1236562728881836, 0.015318630263209343, 0.1430782526731491, -0.1158890575170517, 0.13045695424079895, -0.10612881183624268, 0.599753201007843, -0.08678668737411499, -0.12358054518699646, 0.08008387684822083, -0.13312746584415436, 0.13255733251571655, 0.20691242814064026, -0.23114970326423645, 0.16600510478019714, 0.15109992027282715, 0.044733792543411255, 0.02577211521565914, -0.09901099652051926, 0.10720477998256683, -0.6892328262329102, 0.3876112103462219, -0.036205850541591644, 0.19930213689804077, -0.25982019305229187, -0.03773696348071098, 0.1718328297138214, 0.003630658145993948, -0.1890156865119934, -0.6684246063232422, -0.3326466381549835, 0.19029265642166138, -0.2702460289001465, 0.04731547087430954, -0.5070387721061707, 0.25857314467430115, -0.008887194097042084, -0.45119911432266235, -0.16193923354148865, 0.12348981946706772, -0.30659735202789307, 0.04324138164520264, 0.0011980002745985985, 0.3934800624847412, -0.051483407616615295, 0.017364880070090294, -0.3217451274394989, -0.10007274895906448, 0.7145668864250183, 0.14739811420440674, 0.13863398134708405, -0.30655282735824585, 0.30812034010887146, 0.08872197568416595, 0.16763463616371155, -0.4361410439014435, 0.17144042253494263, -0.11620419472455978, -0.013308931142091751, -0.016284000128507614, 0.4266972541809082, -0.1669248789548874, 0.006964147090911865, -0.2677512764930725, 0.01203957200050354, 0.10046770423650742, 0.21790723502635956, 0.14142575860023499, -0.1802094727754593 ]
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`
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!
[ -0.13724297285079956, 0.02748769521713257, -0.018048088997602463, -0.14137516915798187, 0.333095908164978, 0.2379491925239563, 0.3183326721191406, 0.37501099705696106, -0.1385553777217865, 0.20809578895568848, 0.17708706855773926, 0.29512932896614075, -0.058476269245147705, -0.053730301558971405, 0.15530221164226532, 0.05285606160759926, 0.28731873631477356, 0.13904879987239838, 0.11191773414611816, -0.07827310264110565, -0.36370113492012024, 0.09732966125011444, -0.11624357104301453, 0.002207830548286438, -0.1683325320482254, -0.14933215081691742, -0.2958090603351593, 0.13100501894950867, -0.047335051000118256, -0.2787569761276245, 0.35638052225112915, -0.05611680820584297, 0.25053152441978455, 0.3781625032424927, -0.00010954697791021317, -0.09355292469263077, 0.4269465208053589, -0.07604028284549713, -0.4827500581741333, -0.20793621242046356, -0.21949657797813416, -0.7127156257629395, -0.19631905853748322, -0.3589135408401489, 0.11117661744356155, -0.26609280705451965, 0.05312805250287056, -0.5082575082778931, 0.3311459422111511, 0.2714690566062927, 0.2184760570526123, 0.12363235652446747, -0.0657246932387352, -0.14970281720161438, -0.25564539432525635, 0.1028386577963829, -0.3181382417678833, 0.20033353567123413, -0.37597447633743286, -0.06642340868711472, -0.01413070410490036, -0.040492258965969086, -0.22604499757289886, -0.09986890852451324, 0.15581530332565308, 0.1554240733385086, -0.11010993272066116, -0.23545929789543152, 0.18992045521736145, 0.08777818083763123, 0.14260748028755188, -0.2861339747905731, -0.5548040270805359, -0.33059680461883545, 0.1464427411556244, -0.6045392751693726, 0.16362643241882324, 0.38179394602775574, -0.14803898334503174, -0.07576635479927063, -0.29785141348838806, 0.4286034405231476, -0.16724467277526855, 0.029891110956668854, 0.1879332810640335, 0.011167436838150024, -0.228982076048851, -0.07579927891492844, 0.19740621745586395, 0.1383870244026184, -0.06656093150377274, -0.6948896050453186, -0.020268019288778305, 0.11507030576467514, -0.25422486662864685, 0.08969913423061371, 0.1011689230799675, -0.05926487594842911, 0.06199215352535248, -0.1494598388671875, 0.14000548422336578, -0.09014572948217392, 0.5071129202842712, -0.020128823816776276, 0.14455966651439667, 0.3456189036369324, 0.07857384532690048, 0.18765591084957123, 0.1897137314081192, 0.17574018239974976, 0.08274610340595245, -0.1099303588271141, -0.018595274537801743, -0.2374836951494217, 0.3485782742500305, 0.09231247752904892, 0.2640860080718994, 0.02358872815966606, -0.18292824923992157, 0.05328315123915672, 0.15072289109230042, 0.2296053022146225, -0.32425761222839355, 0.07490617781877518, 0.005681750364601612, 0.14513596892356873, -0.27059972286224365, 0.2377619445323944, 0.01575281284749508, 0.4115458130836487, -0.21476618945598602, -0.07949650287628174, -0.05031789839267731, 0.0038418136537075043, 0.11017771065235138, -0.5727177262306213, 0.17326627671718597, 0.3524138927459717, 0.1662813127040863, 0.05942656099796295, -0.1677187830209732, -0.1260351985692978, 0.24956485629081726, 0.31582972407341003, 0.07121999561786652, 0.25819921493530273, 0.2673032581806183, -0.21453392505645752, -0.1947043538093567, 0.07935411483049393, -0.29112324118614197, -0.05470185726881027, 0.07576277107000351, 0.1235736608505249, -0.2878727912902832, 0.02452828362584114, -0.3753257393836975, 0.2521757483482361, 0.2711464464664459, -0.04840567708015442, 0.063962921500206, -0.049491867423057556, -0.10914810001850128, -0.38532066345214844, 0.3478764593601227, 0.1349354386329651, -0.440962553024292, 0.09462785720825195, -0.24873009324073792, 0.3400735557079315, 0.5808011293411255, 0.2847411632537842, -0.10770603269338608, -0.266758531332016, -0.07117555290460587, 0.17583297193050385, 0.26208338141441345, 0.04002087935805321, -0.3635697066783905, 0.16304722428321838, -0.04076738655567169, 0.5474808812141418, 0.22723308205604553, -0.13493764400482178, 0.0819406732916832, 0.015090223401784897, -0.043418847024440765, 0.29215866327285767, -0.06375408917665482, -0.023079730570316315, -0.5035680532455444, -0.22750405967235565, 0.42742955684661865, -0.2361409217119217, -0.024693835526704788, 0.2494010031223297, 0.029758460819721222, -0.286888986825943, 0.1280495822429657, -0.13596096634864807, 0.10809902101755142, 0.21044017374515533, 0.08321940898895264, -0.29179811477661133, 0.20575746893882751, 0.26546186208724976, -0.07574506849050522, 0.15363281965255737, 0.016500432044267654, -0.14176908135414124, -0.2896975874900818, -0.2659263610839844, -0.12834784388542175, -0.14435018599033356, -0.05849811062216759, -0.3277128338813782, 0.10157352685928345, 0.08570076525211334, 0.22288495302200317, 0.3205965459346771, -0.07173949480056763, 0.09653735905885696, 0.018524037674069405, -0.05981150269508362, -0.19752740859985352, -0.04586026072502136, -0.09600915014743805, -0.22389602661132812, 0.20704232156276703, -0.015670672059059143, 0.01588435098528862, -0.07453097403049469, -0.26164281368255615, 0.25066807866096497, -0.15272074937820435, 0.33935385942459106, -0.2227075695991516, -0.1960262507200241, 0.09832032024860382, 0.3276475965976715, 0.032082948833703995, 0.4609795808792114, 0.22146402299404144, 0.19007790088653564, -0.3822469115257263, 0.5861092209815979, 0.06781147420406342, 0.09113240987062454, -0.05209022015333176, 0.0415535569190979, 0.15167072415351868, 0.03268611803650856, -0.21100358664989471, 0.09025450050830841, -0.1896551549434662, -0.39686790108680725, 0.1759093850851059, 0.15469038486480713, -0.08685773611068726, 0.035161666572093964, 0.4947236180305481, 0.037062015384435654, -0.07478000968694687, 0.3327568471431732, -0.15456649661064148, -0.2748936414718628, 0.19782152771949768, 0.37532711029052734, 0.49737584590911865, 0.11363475769758224, 0.14303697645664215, -0.32424601912498474, -0.16373860836029053, -0.25603073835372925, 0.3175186812877655, 0.11597850918769836, 0.06969420611858368, 0.24592462182044983, 0.025342445820569992, 0.30808311700820923, -0.1500510424375534, 0.3834780156612396, -0.05985138565301895, -0.09294334053993225, -0.24677252769470215, 0.35470640659332275, -0.3486630916595459, -0.09650766849517822, 0.061142854392528534, 0.012722436338663101, -0.056780990213155746, -0.3140382468700409, -0.1166524887084961, -0.035191383212804794, -0.2428223341703415, 0.06492061913013458, -0.2937409281730652, 0.27870967984199524, 0.18874043226242065, -0.3300553858280182, -0.19436727464199066, 0.00027051568031311035, -0.23775887489318848, 0.13681228458881378, -0.0014337031170725822, -0.3281870484352112, 0.07073376327753067, 0.17756842076778412, 0.07303997129201889, 0.011593762785196304, -0.10500672459602356, -0.15774820744991302, -0.2600916624069214, 0.27417218685150146, -0.06345885992050171, 0.1094929426908493, -0.26158982515335083, -0.4929622709751129, 0.13549180328845978, -0.0016175545752048492, 0.017384489998221397, 0.32479122281074524, 0.26337572932243347, -0.20268243551254272, -0.18367227911949158, -0.13213470578193665, -0.17758415639400482, -0.2296421378850937, 0.12193572521209717, -0.19921055436134338, -0.10009719431400299, 0.5425707697868347, 0.43891558051109314, 0.027376949787139893, 0.2685214579105377, -0.0975131019949913, 0.010527235455811024, -0.4845796823501587, 0.840724527835846, -0.12131582200527191, -0.5743758678436279, -0.16719476878643036, -0.18350228667259216, 0.1124621331691742, 0.07266519218683243, -0.22869864106178284, 0.20956210792064667, -0.3872302174568176, 0.21781525015830994, 0.3118327856063843, 0.03825141116976738, 0.0580543577671051, -0.10947120189666748, -0.19391626119613647, -0.11263059824705124, -0.15247800946235657, -0.06871931999921799, 0.268778920173645, 0.3930380344390869, -0.04058350622653961, 0.28236809372901917, 0.15262338519096375, 0.2594464421272278, 0.24850085377693176, -0.0507473461329937, 0.39542141556739807, -0.002106606960296631, 0.5783195495605469, -0.05134686082601547, -0.44241923093795776, 0.00012027076445519924, -0.24484485387802124, -0.18434876203536987, 0.23539622128009796, 0.010773644782602787, -0.11391476541757584, 0.040038079023361206, -0.08676928281784058, -0.038683563470840454, -0.28393006324768066, -0.01127413846552372, -0.11956748366355896, 0.06510356813669205, 0.181604266166687, 0.13459309935569763, -0.1352071464061737, -0.0782506987452507, 0.0340447761118412, 0.2332947701215744, 0.3765459656715393, 0.0636497437953949, 0.17685964703559875, -0.06632638722658157, -0.515192449092865, 0.13006819784641266, 0.1208098828792572, 0.35162362456321716, -0.03821992874145508, -0.22704046964645386, -0.0690390020608902, -0.002688682172447443, 0.5561444163322449, -0.040125198662281036, -0.17133159935474396, 0.31474706530570984, 0.15225762128829956, -0.28951841592788696, -0.18265223503112793, 0.05171331390738487, 0.02182161435484886, -0.045352157205343246, 0.30733686685562134, 0.16143059730529785, 0.024408064782619476, -0.26892343163490295, 0.29786697030067444, -0.016928426921367645, -0.09249117970466614, -0.5677167773246765, -0.18558529019355774, -0.10094483196735382, 0.04365335404872894, 0.037248387932777405, 0.2345772385597229, -0.5441382527351379, -0.1672728955745697, -0.1977309286594391, -0.2709205150604248, 0.27739280462265015, 0.017330557107925415, 0.3572559952735901, 0.07775432616472244, 0.002076122909784317, -0.08842314779758453, 0.1483229249715805, 0.19870924949645996, 0.24041032791137695, 0.09148134291172028, -0.5016947984695435, 0.0009618084877729416, -0.21416813135147095, 0.27846255898475647, 0.14059321582317352, -0.5508820414543152, -0.015106700360774994, -0.14274893701076508, 0.11315260827541351, -0.30763065814971924, -0.10332203656435013, 0.3864040672779083, -0.018999386578798294, -0.4575033187866211, -0.13982130587100983, 0.3960261344909668, 0.19603067636489868, 0.04885980486869812, 0.14097744226455688, -0.05590648949146271, -0.1961008906364441, 0.12446895241737366, 0.19413918256759644, 0.6024678945541382, 0.07752566784620285, 0.3030576705932617, 0.1982327103614807, -0.003191974014043808, 0.5606464743614197, 0.12982279062271118, 0.2993420362472534, 0.05465508624911308, -0.42479410767555237, -0.022586045786738396, 0.07031507790088654, 0.35170063376426697, 0.20831021666526794, -0.4264683425426483, 0.2331710308790207, -0.32205116748809814, 0.08125084638595581, -0.13129258155822754, 0.03898206353187561, -0.20004475116729736, -0.32625260949134827, -0.5076843500137329, 0.21867698431015015, 0.24094775319099426, 0.23609288036823273, 0.30200743675231934, -0.3931006193161011, -0.338948130607605, -0.16174885630607605, -0.1808290034532547, 0.2572334110736847, 0.06308462470769882, 0.029291648417711258, -0.3069644868373871, -0.4416881799697876, 0.03343435749411583, 0.24352280795574188, 0.30424827337265015, 0.11230462789535522, -0.12919646501541138, -0.19059376418590546, -0.09313241392374039, 0.20497365295886993, -0.17680346965789795, -0.24525706470012665, 0.14789819717407227, 0.16027754545211792, 0.25624045729637146, 0.10944758355617523, -0.15569204092025757, -0.08896501362323761, 0.2964645028114319, -0.05189600586891174, -0.15685901045799255, -0.28449320793151855, -0.15814389288425446, -0.3429033160209656, 0.020745325833559036, -0.23245130479335785, 0.17413076758384705, -0.06672403216362, 0.1983814686536789, 0.3605705797672272, -0.28525498509407043, -0.1764165163040161, -0.08062529563903809, 0.43846869468688965, -0.12942498922348022, 0.05938570201396942, 0.36996859312057495, -0.3391997814178467, -0.2733464241027832, -0.05083701014518738, 0.1959967315196991, -0.10015600919723511, -0.03672688454389572, 0.4621034562587738, 0.10293713957071304, 0.1751839965581894, -0.20319366455078125, 0.13602417707443237, 0.2136574685573578, -0.05019783228635788, -0.1969931423664093, -0.25243085622787476, -0.2814326286315918, -0.05249039828777313, 0.10006560385227203, 0.28263258934020996, 0.057527557015419006, -0.10831092298030853, 0.3191874921321869, 0.05563785135746002, -0.2674616575241089, -0.23328834772109985, 0.10642767697572708, 0.014890301041305065, 0.2505997121334076, 0.19542399048805237, 0.11136315017938614, -0.23220592737197876, 0.10670731961727142, 0.14166012406349182, 0.238153338432312, -0.3106570243835449, -0.21596969664096832, 0.05082492530345917, 0.025957850739359856, -0.025917312130331993, 0.1880524456501007, -0.0805150642991066, -0.10858558118343353, -0.3388400077819824, 0.019158657640218735, 0.018489010632038116, -0.07813389599323273, 0.03156767413020134, -0.013084162026643753, 0.2413862645626068, 0.03970247507095337, -0.17425580322742462, -0.4193507134914398, 0.19693981111049652, 0.07176049798727036, 0.14847281575202942, 0.09677693992853165, 0.08587273955345154, -0.1750507950782776, -0.21835190057754517, -0.27523893117904663, -0.05661821365356445, 0.2787139415740967, -0.17184527218341827, -0.18250834941864014, 0.12695163488388062, 0.041645001620054245, 0.36440563201904297, -0.06356776505708694, -0.04436729848384857, 0.14363911747932434, 0.17470689117908478, -0.25628605484962463, -0.02878100425004959, -0.4430633783340454, 0.01080433651804924, -0.1553523689508438, -0.024018771946430206, 0.136017844080925, -0.10315794497728348, -0.003922902047634125, -0.11956387013196945, 0.5044566988945007, -0.05443074554204941, 0.4863690435886383, 0.5873802900314331, 0.23172889649868011, 0.32267269492149353, -0.09063209593296051, -0.150709331035614, -0.04780057817697525, -0.03573250025510788, -0.05254576355218887, 0.14383231103420258, 0.449750155210495, 0.06682667136192322, -0.32814309000968933, -0.3288445472717285, 0.2801918089389801, 0.11178146302700043, -0.40861767530441284, 0.40949547290802, 0.4652363955974579, 0.39486658573150635, -0.46117883920669556, -0.03453981503844261, -0.2509804368019104, 0.09934379905462265, -0.0530104786157608, -0.004624645691365004, 0.06986769288778305, -0.0020705536007881165, -0.05814357101917267, 0.01445433497428894, 0.09793107211589813, 0.0383702889084816, 0.18954938650131226, 0.053130507469177246, 0.04037695378065109, 0.0219065360724926, 0.07179012894630432, 0.15044131875038147, 0.4917083978652954, -0.09549106657505035, -0.04751160740852356, 0.24172866344451904, -0.0913572907447815, -0.14255401492118835, 0.2685902416706085, 0.7944121956825256, 0.2924921214580536, 0.3717190623283386, 0.10885769128799438, 0.17711412906646729, -0.14472927153110504, 0.13343434035778046, 0.4025634527206421, 0.09976401180028915, -0.11628833413124084, 0.1334751546382904, 0.2183157354593277, -0.12267985194921494, 0.17692981660366058, 0.03189287707209587, 0.09234064817428589, -0.17194236814975739, 0.23667147755622864, 0.02474028244614601, -0.12114483118057251, 0.02225125953555107, -0.08727136999368668, 0.07522540539503098, -0.09453251212835312, 0.32950717210769653, 0.055580127984285355, 0.05878077447414398, -0.2550569474697113, 0.10763488709926605, 0.10599958896636963, 0.3496685326099396, 0.1491951197385788, -0.18280521035194397, -0.3688051998615265, 0.18191279470920563, -0.34118950366973877, -0.02861175686120987, -0.07126188278198242, -0.19174893200397491, -0.1515435129404068, 0.017825370654463768, -0.14574384689331055, 0.11911068111658096, -0.1497160643339157, 0.2951979637145996, 0.1002751961350441, 0.14419755339622498, -0.1360781192779541, 0.0066183507442474365, 0.061254940927028656, -0.044862955808639526, -0.01984352245926857, -0.39950841665267944, 0.29674986004829407, -0.23147007822990417, 0.07111349701881409, -0.09059152752161026, 0.1109323799610138, -0.005860047414898872, 0.46515530347824097, 0.1546248197555542, 0.16604405641555786, 0.14880110323429108, -0.2334335744380951, -0.025547925382852554, -0.397988498210907, 0.341530978679657, -0.15252165496349335, 0.07143250852823257, 0.13693466782569885, 0.19651395082473755, -0.1640539914369583, -0.23615072667598724, -0.06386281549930573, 0.3424186706542969, 0.24607886373996735, -0.2525883615016937, 0.010721869766712189, -0.021277647465467453, -0.06762074679136276, -0.13085608184337616, 0.21569037437438965, 0.10745956003665924, -0.14398276805877686, 0.17642337083816528, -0.018190860748291016, -0.5468440055847168, 0.3067377209663391, -0.48303598165512085, -0.23949521780014038, -0.05571252852678299, 0.11631154268980026, 0.21467480063438416, 0.1198696568608284, -0.14170080423355103, -0.03347916156053543, 0.26065540313720703, -0.01135680079460144, 0.10467320680618286, 0.25811266899108887, -0.22574138641357422, 0.14774508774280548, -0.1477685570716858, 0.15546377003192902, 0.05357503145933151, -0.12015223503112793, 0.1274189054965973, -0.3981751799583435 ]
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`
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
[ -0.13724297285079956, 0.02748769521713257, -0.018048088997602463, -0.14137516915798187, 0.333095908164978, 0.2379491925239563, 0.3183326721191406, 0.37501099705696106, -0.1385553777217865, 0.20809578895568848, 0.17708706855773926, 0.29512932896614075, -0.058476269245147705, -0.053730301558971405, 0.15530221164226532, 0.05285606160759926, 0.28731873631477356, 0.13904879987239838, 0.11191773414611816, -0.07827310264110565, -0.36370113492012024, 0.09732966125011444, -0.11624357104301453, 0.002207830548286438, -0.1683325320482254, -0.14933215081691742, -0.2958090603351593, 0.13100501894950867, -0.047335051000118256, -0.2787569761276245, 0.35638052225112915, -0.05611680820584297, 0.25053152441978455, 0.3781625032424927, -0.00010954697791021317, -0.09355292469263077, 0.4269465208053589, -0.07604028284549713, -0.4827500581741333, -0.20793621242046356, -0.21949657797813416, -0.7127156257629395, -0.19631905853748322, -0.3589135408401489, 0.11117661744356155, -0.26609280705451965, 0.05312805250287056, -0.5082575082778931, 0.3311459422111511, 0.2714690566062927, 0.2184760570526123, 0.12363235652446747, -0.0657246932387352, -0.14970281720161438, -0.25564539432525635, 0.1028386577963829, -0.3181382417678833, 0.20033353567123413, -0.37597447633743286, -0.06642340868711472, -0.01413070410490036, -0.040492258965969086, -0.22604499757289886, -0.09986890852451324, 0.15581530332565308, 0.1554240733385086, -0.11010993272066116, -0.23545929789543152, 0.18992045521736145, 0.08777818083763123, 0.14260748028755188, -0.2861339747905731, -0.5548040270805359, -0.33059680461883545, 0.1464427411556244, -0.6045392751693726, 0.16362643241882324, 0.38179394602775574, -0.14803898334503174, -0.07576635479927063, -0.29785141348838806, 0.4286034405231476, -0.16724467277526855, 0.029891110956668854, 0.1879332810640335, 0.011167436838150024, -0.228982076048851, -0.07579927891492844, 0.19740621745586395, 0.1383870244026184, -0.06656093150377274, -0.6948896050453186, -0.020268019288778305, 0.11507030576467514, -0.25422486662864685, 0.08969913423061371, 0.1011689230799675, -0.05926487594842911, 0.06199215352535248, -0.1494598388671875, 0.14000548422336578, -0.09014572948217392, 0.5071129202842712, -0.020128823816776276, 0.14455966651439667, 0.3456189036369324, 0.07857384532690048, 0.18765591084957123, 0.1897137314081192, 0.17574018239974976, 0.08274610340595245, -0.1099303588271141, -0.018595274537801743, -0.2374836951494217, 0.3485782742500305, 0.09231247752904892, 0.2640860080718994, 0.02358872815966606, -0.18292824923992157, 0.05328315123915672, 0.15072289109230042, 0.2296053022146225, -0.32425761222839355, 0.07490617781877518, 0.005681750364601612, 0.14513596892356873, -0.27059972286224365, 0.2377619445323944, 0.01575281284749508, 0.4115458130836487, -0.21476618945598602, -0.07949650287628174, -0.05031789839267731, 0.0038418136537075043, 0.11017771065235138, -0.5727177262306213, 0.17326627671718597, 0.3524138927459717, 0.1662813127040863, 0.05942656099796295, -0.1677187830209732, -0.1260351985692978, 0.24956485629081726, 0.31582972407341003, 0.07121999561786652, 0.25819921493530273, 0.2673032581806183, -0.21453392505645752, -0.1947043538093567, 0.07935411483049393, -0.29112324118614197, -0.05470185726881027, 0.07576277107000351, 0.1235736608505249, -0.2878727912902832, 0.02452828362584114, -0.3753257393836975, 0.2521757483482361, 0.2711464464664459, -0.04840567708015442, 0.063962921500206, -0.049491867423057556, -0.10914810001850128, -0.38532066345214844, 0.3478764593601227, 0.1349354386329651, -0.440962553024292, 0.09462785720825195, -0.24873009324073792, 0.3400735557079315, 0.5808011293411255, 0.2847411632537842, -0.10770603269338608, -0.266758531332016, -0.07117555290460587, 0.17583297193050385, 0.26208338141441345, 0.04002087935805321, -0.3635697066783905, 0.16304722428321838, -0.04076738655567169, 0.5474808812141418, 0.22723308205604553, -0.13493764400482178, 0.0819406732916832, 0.015090223401784897, -0.043418847024440765, 0.29215866327285767, -0.06375408917665482, -0.023079730570316315, -0.5035680532455444, -0.22750405967235565, 0.42742955684661865, -0.2361409217119217, -0.024693835526704788, 0.2494010031223297, 0.029758460819721222, -0.286888986825943, 0.1280495822429657, -0.13596096634864807, 0.10809902101755142, 0.21044017374515533, 0.08321940898895264, -0.29179811477661133, 0.20575746893882751, 0.26546186208724976, -0.07574506849050522, 0.15363281965255737, 0.016500432044267654, -0.14176908135414124, -0.2896975874900818, -0.2659263610839844, -0.12834784388542175, -0.14435018599033356, -0.05849811062216759, -0.3277128338813782, 0.10157352685928345, 0.08570076525211334, 0.22288495302200317, 0.3205965459346771, -0.07173949480056763, 0.09653735905885696, 0.018524037674069405, -0.05981150269508362, -0.19752740859985352, -0.04586026072502136, -0.09600915014743805, -0.22389602661132812, 0.20704232156276703, -0.015670672059059143, 0.01588435098528862, -0.07453097403049469, -0.26164281368255615, 0.25066807866096497, -0.15272074937820435, 0.33935385942459106, -0.2227075695991516, -0.1960262507200241, 0.09832032024860382, 0.3276475965976715, 0.032082948833703995, 0.4609795808792114, 0.22146402299404144, 0.19007790088653564, -0.3822469115257263, 0.5861092209815979, 0.06781147420406342, 0.09113240987062454, -0.05209022015333176, 0.0415535569190979, 0.15167072415351868, 0.03268611803650856, -0.21100358664989471, 0.09025450050830841, -0.1896551549434662, -0.39686790108680725, 0.1759093850851059, 0.15469038486480713, -0.08685773611068726, 0.035161666572093964, 0.4947236180305481, 0.037062015384435654, -0.07478000968694687, 0.3327568471431732, -0.15456649661064148, -0.2748936414718628, 0.19782152771949768, 0.37532711029052734, 0.49737584590911865, 0.11363475769758224, 0.14303697645664215, -0.32424601912498474, -0.16373860836029053, -0.25603073835372925, 0.3175186812877655, 0.11597850918769836, 0.06969420611858368, 0.24592462182044983, 0.025342445820569992, 0.30808311700820923, -0.1500510424375534, 0.3834780156612396, -0.05985138565301895, -0.09294334053993225, -0.24677252769470215, 0.35470640659332275, -0.3486630916595459, -0.09650766849517822, 0.061142854392528534, 0.012722436338663101, -0.056780990213155746, -0.3140382468700409, -0.1166524887084961, -0.035191383212804794, -0.2428223341703415, 0.06492061913013458, -0.2937409281730652, 0.27870967984199524, 0.18874043226242065, -0.3300553858280182, -0.19436727464199066, 0.00027051568031311035, -0.23775887489318848, 0.13681228458881378, -0.0014337031170725822, -0.3281870484352112, 0.07073376327753067, 0.17756842076778412, 0.07303997129201889, 0.011593762785196304, -0.10500672459602356, -0.15774820744991302, -0.2600916624069214, 0.27417218685150146, -0.06345885992050171, 0.1094929426908493, -0.26158982515335083, -0.4929622709751129, 0.13549180328845978, -0.0016175545752048492, 0.017384489998221397, 0.32479122281074524, 0.26337572932243347, -0.20268243551254272, -0.18367227911949158, -0.13213470578193665, -0.17758415639400482, -0.2296421378850937, 0.12193572521209717, -0.19921055436134338, -0.10009719431400299, 0.5425707697868347, 0.43891558051109314, 0.027376949787139893, 0.2685214579105377, -0.0975131019949913, 0.010527235455811024, -0.4845796823501587, 0.840724527835846, -0.12131582200527191, -0.5743758678436279, -0.16719476878643036, -0.18350228667259216, 0.1124621331691742, 0.07266519218683243, -0.22869864106178284, 0.20956210792064667, -0.3872302174568176, 0.21781525015830994, 0.3118327856063843, 0.03825141116976738, 0.0580543577671051, -0.10947120189666748, -0.19391626119613647, -0.11263059824705124, -0.15247800946235657, -0.06871931999921799, 0.268778920173645, 0.3930380344390869, -0.04058350622653961, 0.28236809372901917, 0.15262338519096375, 0.2594464421272278, 0.24850085377693176, -0.0507473461329937, 0.39542141556739807, -0.002106606960296631, 0.5783195495605469, -0.05134686082601547, -0.44241923093795776, 0.00012027076445519924, -0.24484485387802124, -0.18434876203536987, 0.23539622128009796, 0.010773644782602787, -0.11391476541757584, 0.040038079023361206, -0.08676928281784058, -0.038683563470840454, -0.28393006324768066, -0.01127413846552372, -0.11956748366355896, 0.06510356813669205, 0.181604266166687, 0.13459309935569763, -0.1352071464061737, -0.0782506987452507, 0.0340447761118412, 0.2332947701215744, 0.3765459656715393, 0.0636497437953949, 0.17685964703559875, -0.06632638722658157, -0.515192449092865, 0.13006819784641266, 0.1208098828792572, 0.35162362456321716, -0.03821992874145508, -0.22704046964645386, -0.0690390020608902, -0.002688682172447443, 0.5561444163322449, -0.040125198662281036, -0.17133159935474396, 0.31474706530570984, 0.15225762128829956, -0.28951841592788696, -0.18265223503112793, 0.05171331390738487, 0.02182161435484886, -0.045352157205343246, 0.30733686685562134, 0.16143059730529785, 0.024408064782619476, -0.26892343163490295, 0.29786697030067444, -0.016928426921367645, -0.09249117970466614, -0.5677167773246765, -0.18558529019355774, -0.10094483196735382, 0.04365335404872894, 0.037248387932777405, 0.2345772385597229, -0.5441382527351379, -0.1672728955745697, -0.1977309286594391, -0.2709205150604248, 0.27739280462265015, 0.017330557107925415, 0.3572559952735901, 0.07775432616472244, 0.002076122909784317, -0.08842314779758453, 0.1483229249715805, 0.19870924949645996, 0.24041032791137695, 0.09148134291172028, -0.5016947984695435, 0.0009618084877729416, -0.21416813135147095, 0.27846255898475647, 0.14059321582317352, -0.5508820414543152, -0.015106700360774994, -0.14274893701076508, 0.11315260827541351, -0.30763065814971924, -0.10332203656435013, 0.3864040672779083, -0.018999386578798294, -0.4575033187866211, -0.13982130587100983, 0.3960261344909668, 0.19603067636489868, 0.04885980486869812, 0.14097744226455688, -0.05590648949146271, -0.1961008906364441, 0.12446895241737366, 0.19413918256759644, 0.6024678945541382, 0.07752566784620285, 0.3030576705932617, 0.1982327103614807, -0.003191974014043808, 0.5606464743614197, 0.12982279062271118, 0.2993420362472534, 0.05465508624911308, -0.42479410767555237, -0.022586045786738396, 0.07031507790088654, 0.35170063376426697, 0.20831021666526794, -0.4264683425426483, 0.2331710308790207, -0.32205116748809814, 0.08125084638595581, -0.13129258155822754, 0.03898206353187561, -0.20004475116729736, -0.32625260949134827, -0.5076843500137329, 0.21867698431015015, 0.24094775319099426, 0.23609288036823273, 0.30200743675231934, -0.3931006193161011, -0.338948130607605, -0.16174885630607605, -0.1808290034532547, 0.2572334110736847, 0.06308462470769882, 0.029291648417711258, -0.3069644868373871, -0.4416881799697876, 0.03343435749411583, 0.24352280795574188, 0.30424827337265015, 0.11230462789535522, -0.12919646501541138, -0.19059376418590546, -0.09313241392374039, 0.20497365295886993, -0.17680346965789795, -0.24525706470012665, 0.14789819717407227, 0.16027754545211792, 0.25624045729637146, 0.10944758355617523, -0.15569204092025757, -0.08896501362323761, 0.2964645028114319, -0.05189600586891174, -0.15685901045799255, -0.28449320793151855, -0.15814389288425446, -0.3429033160209656, 0.020745325833559036, -0.23245130479335785, 0.17413076758384705, -0.06672403216362, 0.1983814686536789, 0.3605705797672272, -0.28525498509407043, -0.1764165163040161, -0.08062529563903809, 0.43846869468688965, -0.12942498922348022, 0.05938570201396942, 0.36996859312057495, -0.3391997814178467, -0.2733464241027832, -0.05083701014518738, 0.1959967315196991, -0.10015600919723511, -0.03672688454389572, 0.4621034562587738, 0.10293713957071304, 0.1751839965581894, -0.20319366455078125, 0.13602417707443237, 0.2136574685573578, -0.05019783228635788, -0.1969931423664093, -0.25243085622787476, -0.2814326286315918, -0.05249039828777313, 0.10006560385227203, 0.28263258934020996, 0.057527557015419006, -0.10831092298030853, 0.3191874921321869, 0.05563785135746002, -0.2674616575241089, -0.23328834772109985, 0.10642767697572708, 0.014890301041305065, 0.2505997121334076, 0.19542399048805237, 0.11136315017938614, -0.23220592737197876, 0.10670731961727142, 0.14166012406349182, 0.238153338432312, -0.3106570243835449, -0.21596969664096832, 0.05082492530345917, 0.025957850739359856, -0.025917312130331993, 0.1880524456501007, -0.0805150642991066, -0.10858558118343353, -0.3388400077819824, 0.019158657640218735, 0.018489010632038116, -0.07813389599323273, 0.03156767413020134, -0.013084162026643753, 0.2413862645626068, 0.03970247507095337, -0.17425580322742462, -0.4193507134914398, 0.19693981111049652, 0.07176049798727036, 0.14847281575202942, 0.09677693992853165, 0.08587273955345154, -0.1750507950782776, -0.21835190057754517, -0.27523893117904663, -0.05661821365356445, 0.2787139415740967, -0.17184527218341827, -0.18250834941864014, 0.12695163488388062, 0.041645001620054245, 0.36440563201904297, -0.06356776505708694, -0.04436729848384857, 0.14363911747932434, 0.17470689117908478, -0.25628605484962463, -0.02878100425004959, -0.4430633783340454, 0.01080433651804924, -0.1553523689508438, -0.024018771946430206, 0.136017844080925, -0.10315794497728348, -0.003922902047634125, -0.11956387013196945, 0.5044566988945007, -0.05443074554204941, 0.4863690435886383, 0.5873802900314331, 0.23172889649868011, 0.32267269492149353, -0.09063209593296051, -0.150709331035614, -0.04780057817697525, -0.03573250025510788, -0.05254576355218887, 0.14383231103420258, 0.449750155210495, 0.06682667136192322, -0.32814309000968933, -0.3288445472717285, 0.2801918089389801, 0.11178146302700043, -0.40861767530441284, 0.40949547290802, 0.4652363955974579, 0.39486658573150635, -0.46117883920669556, -0.03453981503844261, -0.2509804368019104, 0.09934379905462265, -0.0530104786157608, -0.004624645691365004, 0.06986769288778305, -0.0020705536007881165, -0.05814357101917267, 0.01445433497428894, 0.09793107211589813, 0.0383702889084816, 0.18954938650131226, 0.053130507469177246, 0.04037695378065109, 0.0219065360724926, 0.07179012894630432, 0.15044131875038147, 0.4917083978652954, -0.09549106657505035, -0.04751160740852356, 0.24172866344451904, -0.0913572907447815, -0.14255401492118835, 0.2685902416706085, 0.7944121956825256, 0.2924921214580536, 0.3717190623283386, 0.10885769128799438, 0.17711412906646729, -0.14472927153110504, 0.13343434035778046, 0.4025634527206421, 0.09976401180028915, -0.11628833413124084, 0.1334751546382904, 0.2183157354593277, -0.12267985194921494, 0.17692981660366058, 0.03189287707209587, 0.09234064817428589, -0.17194236814975739, 0.23667147755622864, 0.02474028244614601, -0.12114483118057251, 0.02225125953555107, -0.08727136999368668, 0.07522540539503098, -0.09453251212835312, 0.32950717210769653, 0.055580127984285355, 0.05878077447414398, -0.2550569474697113, 0.10763488709926605, 0.10599958896636963, 0.3496685326099396, 0.1491951197385788, -0.18280521035194397, -0.3688051998615265, 0.18191279470920563, -0.34118950366973877, -0.02861175686120987, -0.07126188278198242, -0.19174893200397491, -0.1515435129404068, 0.017825370654463768, -0.14574384689331055, 0.11911068111658096, -0.1497160643339157, 0.2951979637145996, 0.1002751961350441, 0.14419755339622498, -0.1360781192779541, 0.0066183507442474365, 0.061254940927028656, -0.044862955808639526, -0.01984352245926857, -0.39950841665267944, 0.29674986004829407, -0.23147007822990417, 0.07111349701881409, -0.09059152752161026, 0.1109323799610138, -0.005860047414898872, 0.46515530347824097, 0.1546248197555542, 0.16604405641555786, 0.14880110323429108, -0.2334335744380951, -0.025547925382852554, -0.397988498210907, 0.341530978679657, -0.15252165496349335, 0.07143250852823257, 0.13693466782569885, 0.19651395082473755, -0.1640539914369583, -0.23615072667598724, -0.06386281549930573, 0.3424186706542969, 0.24607886373996735, -0.2525883615016937, 0.010721869766712189, -0.021277647465467453, -0.06762074679136276, -0.13085608184337616, 0.21569037437438965, 0.10745956003665924, -0.14398276805877686, 0.17642337083816528, -0.018190860748291016, -0.5468440055847168, 0.3067377209663391, -0.48303598165512085, -0.23949521780014038, -0.05571252852678299, 0.11631154268980026, 0.21467480063438416, 0.1198696568608284, -0.14170080423355103, -0.03347916156053543, 0.26065540313720703, -0.01135680079460144, 0.10467320680618286, 0.25811266899108887, -0.22574138641357422, 0.14774508774280548, -0.1477685570716858, 0.15546377003192902, 0.05357503145933151, -0.12015223503112793, 0.1274189054965973, -0.3981751799583435 ]
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`
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?
[ -0.13724297285079956, 0.02748769521713257, -0.018048088997602463, -0.14137516915798187, 0.333095908164978, 0.2379491925239563, 0.3183326721191406, 0.37501099705696106, -0.1385553777217865, 0.20809578895568848, 0.17708706855773926, 0.29512932896614075, -0.058476269245147705, -0.053730301558971405, 0.15530221164226532, 0.05285606160759926, 0.28731873631477356, 0.13904879987239838, 0.11191773414611816, -0.07827310264110565, -0.36370113492012024, 0.09732966125011444, -0.11624357104301453, 0.002207830548286438, -0.1683325320482254, -0.14933215081691742, -0.2958090603351593, 0.13100501894950867, -0.047335051000118256, -0.2787569761276245, 0.35638052225112915, -0.05611680820584297, 0.25053152441978455, 0.3781625032424927, -0.00010954697791021317, -0.09355292469263077, 0.4269465208053589, -0.07604028284549713, -0.4827500581741333, -0.20793621242046356, -0.21949657797813416, -0.7127156257629395, -0.19631905853748322, -0.3589135408401489, 0.11117661744356155, -0.26609280705451965, 0.05312805250287056, -0.5082575082778931, 0.3311459422111511, 0.2714690566062927, 0.2184760570526123, 0.12363235652446747, -0.0657246932387352, -0.14970281720161438, -0.25564539432525635, 0.1028386577963829, -0.3181382417678833, 0.20033353567123413, -0.37597447633743286, -0.06642340868711472, -0.01413070410490036, -0.040492258965969086, -0.22604499757289886, -0.09986890852451324, 0.15581530332565308, 0.1554240733385086, -0.11010993272066116, -0.23545929789543152, 0.18992045521736145, 0.08777818083763123, 0.14260748028755188, -0.2861339747905731, -0.5548040270805359, -0.33059680461883545, 0.1464427411556244, -0.6045392751693726, 0.16362643241882324, 0.38179394602775574, -0.14803898334503174, -0.07576635479927063, -0.29785141348838806, 0.4286034405231476, -0.16724467277526855, 0.029891110956668854, 0.1879332810640335, 0.011167436838150024, -0.228982076048851, -0.07579927891492844, 0.19740621745586395, 0.1383870244026184, -0.06656093150377274, -0.6948896050453186, -0.020268019288778305, 0.11507030576467514, -0.25422486662864685, 0.08969913423061371, 0.1011689230799675, -0.05926487594842911, 0.06199215352535248, -0.1494598388671875, 0.14000548422336578, -0.09014572948217392, 0.5071129202842712, -0.020128823816776276, 0.14455966651439667, 0.3456189036369324, 0.07857384532690048, 0.18765591084957123, 0.1897137314081192, 0.17574018239974976, 0.08274610340595245, -0.1099303588271141, -0.018595274537801743, -0.2374836951494217, 0.3485782742500305, 0.09231247752904892, 0.2640860080718994, 0.02358872815966606, -0.18292824923992157, 0.05328315123915672, 0.15072289109230042, 0.2296053022146225, -0.32425761222839355, 0.07490617781877518, 0.005681750364601612, 0.14513596892356873, -0.27059972286224365, 0.2377619445323944, 0.01575281284749508, 0.4115458130836487, -0.21476618945598602, -0.07949650287628174, -0.05031789839267731, 0.0038418136537075043, 0.11017771065235138, -0.5727177262306213, 0.17326627671718597, 0.3524138927459717, 0.1662813127040863, 0.05942656099796295, -0.1677187830209732, -0.1260351985692978, 0.24956485629081726, 0.31582972407341003, 0.07121999561786652, 0.25819921493530273, 0.2673032581806183, -0.21453392505645752, -0.1947043538093567, 0.07935411483049393, -0.29112324118614197, -0.05470185726881027, 0.07576277107000351, 0.1235736608505249, -0.2878727912902832, 0.02452828362584114, -0.3753257393836975, 0.2521757483482361, 0.2711464464664459, -0.04840567708015442, 0.063962921500206, -0.049491867423057556, -0.10914810001850128, -0.38532066345214844, 0.3478764593601227, 0.1349354386329651, -0.440962553024292, 0.09462785720825195, -0.24873009324073792, 0.3400735557079315, 0.5808011293411255, 0.2847411632537842, -0.10770603269338608, -0.266758531332016, -0.07117555290460587, 0.17583297193050385, 0.26208338141441345, 0.04002087935805321, -0.3635697066783905, 0.16304722428321838, -0.04076738655567169, 0.5474808812141418, 0.22723308205604553, -0.13493764400482178, 0.0819406732916832, 0.015090223401784897, -0.043418847024440765, 0.29215866327285767, -0.06375408917665482, -0.023079730570316315, -0.5035680532455444, -0.22750405967235565, 0.42742955684661865, -0.2361409217119217, -0.024693835526704788, 0.2494010031223297, 0.029758460819721222, -0.286888986825943, 0.1280495822429657, -0.13596096634864807, 0.10809902101755142, 0.21044017374515533, 0.08321940898895264, -0.29179811477661133, 0.20575746893882751, 0.26546186208724976, -0.07574506849050522, 0.15363281965255737, 0.016500432044267654, -0.14176908135414124, -0.2896975874900818, -0.2659263610839844, -0.12834784388542175, -0.14435018599033356, -0.05849811062216759, -0.3277128338813782, 0.10157352685928345, 0.08570076525211334, 0.22288495302200317, 0.3205965459346771, -0.07173949480056763, 0.09653735905885696, 0.018524037674069405, -0.05981150269508362, -0.19752740859985352, -0.04586026072502136, -0.09600915014743805, -0.22389602661132812, 0.20704232156276703, -0.015670672059059143, 0.01588435098528862, -0.07453097403049469, -0.26164281368255615, 0.25066807866096497, -0.15272074937820435, 0.33935385942459106, -0.2227075695991516, -0.1960262507200241, 0.09832032024860382, 0.3276475965976715, 0.032082948833703995, 0.4609795808792114, 0.22146402299404144, 0.19007790088653564, -0.3822469115257263, 0.5861092209815979, 0.06781147420406342, 0.09113240987062454, -0.05209022015333176, 0.0415535569190979, 0.15167072415351868, 0.03268611803650856, -0.21100358664989471, 0.09025450050830841, -0.1896551549434662, -0.39686790108680725, 0.1759093850851059, 0.15469038486480713, -0.08685773611068726, 0.035161666572093964, 0.4947236180305481, 0.037062015384435654, -0.07478000968694687, 0.3327568471431732, -0.15456649661064148, -0.2748936414718628, 0.19782152771949768, 0.37532711029052734, 0.49737584590911865, 0.11363475769758224, 0.14303697645664215, -0.32424601912498474, -0.16373860836029053, -0.25603073835372925, 0.3175186812877655, 0.11597850918769836, 0.06969420611858368, 0.24592462182044983, 0.025342445820569992, 0.30808311700820923, -0.1500510424375534, 0.3834780156612396, -0.05985138565301895, -0.09294334053993225, -0.24677252769470215, 0.35470640659332275, -0.3486630916595459, -0.09650766849517822, 0.061142854392528534, 0.012722436338663101, -0.056780990213155746, -0.3140382468700409, -0.1166524887084961, -0.035191383212804794, -0.2428223341703415, 0.06492061913013458, -0.2937409281730652, 0.27870967984199524, 0.18874043226242065, -0.3300553858280182, -0.19436727464199066, 0.00027051568031311035, -0.23775887489318848, 0.13681228458881378, -0.0014337031170725822, -0.3281870484352112, 0.07073376327753067, 0.17756842076778412, 0.07303997129201889, 0.011593762785196304, -0.10500672459602356, -0.15774820744991302, -0.2600916624069214, 0.27417218685150146, -0.06345885992050171, 0.1094929426908493, -0.26158982515335083, -0.4929622709751129, 0.13549180328845978, -0.0016175545752048492, 0.017384489998221397, 0.32479122281074524, 0.26337572932243347, -0.20268243551254272, -0.18367227911949158, -0.13213470578193665, -0.17758415639400482, -0.2296421378850937, 0.12193572521209717, -0.19921055436134338, -0.10009719431400299, 0.5425707697868347, 0.43891558051109314, 0.027376949787139893, 0.2685214579105377, -0.0975131019949913, 0.010527235455811024, -0.4845796823501587, 0.840724527835846, -0.12131582200527191, -0.5743758678436279, -0.16719476878643036, -0.18350228667259216, 0.1124621331691742, 0.07266519218683243, -0.22869864106178284, 0.20956210792064667, -0.3872302174568176, 0.21781525015830994, 0.3118327856063843, 0.03825141116976738, 0.0580543577671051, -0.10947120189666748, -0.19391626119613647, -0.11263059824705124, -0.15247800946235657, -0.06871931999921799, 0.268778920173645, 0.3930380344390869, -0.04058350622653961, 0.28236809372901917, 0.15262338519096375, 0.2594464421272278, 0.24850085377693176, -0.0507473461329937, 0.39542141556739807, -0.002106606960296631, 0.5783195495605469, -0.05134686082601547, -0.44241923093795776, 0.00012027076445519924, -0.24484485387802124, -0.18434876203536987, 0.23539622128009796, 0.010773644782602787, -0.11391476541757584, 0.040038079023361206, -0.08676928281784058, -0.038683563470840454, -0.28393006324768066, -0.01127413846552372, -0.11956748366355896, 0.06510356813669205, 0.181604266166687, 0.13459309935569763, -0.1352071464061737, -0.0782506987452507, 0.0340447761118412, 0.2332947701215744, 0.3765459656715393, 0.0636497437953949, 0.17685964703559875, -0.06632638722658157, -0.515192449092865, 0.13006819784641266, 0.1208098828792572, 0.35162362456321716, -0.03821992874145508, -0.22704046964645386, -0.0690390020608902, -0.002688682172447443, 0.5561444163322449, -0.040125198662281036, -0.17133159935474396, 0.31474706530570984, 0.15225762128829956, -0.28951841592788696, -0.18265223503112793, 0.05171331390738487, 0.02182161435484886, -0.045352157205343246, 0.30733686685562134, 0.16143059730529785, 0.024408064782619476, -0.26892343163490295, 0.29786697030067444, -0.016928426921367645, -0.09249117970466614, -0.5677167773246765, -0.18558529019355774, -0.10094483196735382, 0.04365335404872894, 0.037248387932777405, 0.2345772385597229, -0.5441382527351379, -0.1672728955745697, -0.1977309286594391, -0.2709205150604248, 0.27739280462265015, 0.017330557107925415, 0.3572559952735901, 0.07775432616472244, 0.002076122909784317, -0.08842314779758453, 0.1483229249715805, 0.19870924949645996, 0.24041032791137695, 0.09148134291172028, -0.5016947984695435, 0.0009618084877729416, -0.21416813135147095, 0.27846255898475647, 0.14059321582317352, -0.5508820414543152, -0.015106700360774994, -0.14274893701076508, 0.11315260827541351, -0.30763065814971924, -0.10332203656435013, 0.3864040672779083, -0.018999386578798294, -0.4575033187866211, -0.13982130587100983, 0.3960261344909668, 0.19603067636489868, 0.04885980486869812, 0.14097744226455688, -0.05590648949146271, -0.1961008906364441, 0.12446895241737366, 0.19413918256759644, 0.6024678945541382, 0.07752566784620285, 0.3030576705932617, 0.1982327103614807, -0.003191974014043808, 0.5606464743614197, 0.12982279062271118, 0.2993420362472534, 0.05465508624911308, -0.42479410767555237, -0.022586045786738396, 0.07031507790088654, 0.35170063376426697, 0.20831021666526794, -0.4264683425426483, 0.2331710308790207, -0.32205116748809814, 0.08125084638595581, -0.13129258155822754, 0.03898206353187561, -0.20004475116729736, -0.32625260949134827, -0.5076843500137329, 0.21867698431015015, 0.24094775319099426, 0.23609288036823273, 0.30200743675231934, -0.3931006193161011, -0.338948130607605, -0.16174885630607605, -0.1808290034532547, 0.2572334110736847, 0.06308462470769882, 0.029291648417711258, -0.3069644868373871, -0.4416881799697876, 0.03343435749411583, 0.24352280795574188, 0.30424827337265015, 0.11230462789535522, -0.12919646501541138, -0.19059376418590546, -0.09313241392374039, 0.20497365295886993, -0.17680346965789795, -0.24525706470012665, 0.14789819717407227, 0.16027754545211792, 0.25624045729637146, 0.10944758355617523, -0.15569204092025757, -0.08896501362323761, 0.2964645028114319, -0.05189600586891174, -0.15685901045799255, -0.28449320793151855, -0.15814389288425446, -0.3429033160209656, 0.020745325833559036, -0.23245130479335785, 0.17413076758384705, -0.06672403216362, 0.1983814686536789, 0.3605705797672272, -0.28525498509407043, -0.1764165163040161, -0.08062529563903809, 0.43846869468688965, -0.12942498922348022, 0.05938570201396942, 0.36996859312057495, -0.3391997814178467, -0.2733464241027832, -0.05083701014518738, 0.1959967315196991, -0.10015600919723511, -0.03672688454389572, 0.4621034562587738, 0.10293713957071304, 0.1751839965581894, -0.20319366455078125, 0.13602417707443237, 0.2136574685573578, -0.05019783228635788, -0.1969931423664093, -0.25243085622787476, -0.2814326286315918, -0.05249039828777313, 0.10006560385227203, 0.28263258934020996, 0.057527557015419006, -0.10831092298030853, 0.3191874921321869, 0.05563785135746002, -0.2674616575241089, -0.23328834772109985, 0.10642767697572708, 0.014890301041305065, 0.2505997121334076, 0.19542399048805237, 0.11136315017938614, -0.23220592737197876, 0.10670731961727142, 0.14166012406349182, 0.238153338432312, -0.3106570243835449, -0.21596969664096832, 0.05082492530345917, 0.025957850739359856, -0.025917312130331993, 0.1880524456501007, -0.0805150642991066, -0.10858558118343353, -0.3388400077819824, 0.019158657640218735, 0.018489010632038116, -0.07813389599323273, 0.03156767413020134, -0.013084162026643753, 0.2413862645626068, 0.03970247507095337, -0.17425580322742462, -0.4193507134914398, 0.19693981111049652, 0.07176049798727036, 0.14847281575202942, 0.09677693992853165, 0.08587273955345154, -0.1750507950782776, -0.21835190057754517, -0.27523893117904663, -0.05661821365356445, 0.2787139415740967, -0.17184527218341827, -0.18250834941864014, 0.12695163488388062, 0.041645001620054245, 0.36440563201904297, -0.06356776505708694, -0.04436729848384857, 0.14363911747932434, 0.17470689117908478, -0.25628605484962463, -0.02878100425004959, -0.4430633783340454, 0.01080433651804924, -0.1553523689508438, -0.024018771946430206, 0.136017844080925, -0.10315794497728348, -0.003922902047634125, -0.11956387013196945, 0.5044566988945007, -0.05443074554204941, 0.4863690435886383, 0.5873802900314331, 0.23172889649868011, 0.32267269492149353, -0.09063209593296051, -0.150709331035614, -0.04780057817697525, -0.03573250025510788, -0.05254576355218887, 0.14383231103420258, 0.449750155210495, 0.06682667136192322, -0.32814309000968933, -0.3288445472717285, 0.2801918089389801, 0.11178146302700043, -0.40861767530441284, 0.40949547290802, 0.4652363955974579, 0.39486658573150635, -0.46117883920669556, -0.03453981503844261, -0.2509804368019104, 0.09934379905462265, -0.0530104786157608, -0.004624645691365004, 0.06986769288778305, -0.0020705536007881165, -0.05814357101917267, 0.01445433497428894, 0.09793107211589813, 0.0383702889084816, 0.18954938650131226, 0.053130507469177246, 0.04037695378065109, 0.0219065360724926, 0.07179012894630432, 0.15044131875038147, 0.4917083978652954, -0.09549106657505035, -0.04751160740852356, 0.24172866344451904, -0.0913572907447815, -0.14255401492118835, 0.2685902416706085, 0.7944121956825256, 0.2924921214580536, 0.3717190623283386, 0.10885769128799438, 0.17711412906646729, -0.14472927153110504, 0.13343434035778046, 0.4025634527206421, 0.09976401180028915, -0.11628833413124084, 0.1334751546382904, 0.2183157354593277, -0.12267985194921494, 0.17692981660366058, 0.03189287707209587, 0.09234064817428589, -0.17194236814975739, 0.23667147755622864, 0.02474028244614601, -0.12114483118057251, 0.02225125953555107, -0.08727136999368668, 0.07522540539503098, -0.09453251212835312, 0.32950717210769653, 0.055580127984285355, 0.05878077447414398, -0.2550569474697113, 0.10763488709926605, 0.10599958896636963, 0.3496685326099396, 0.1491951197385788, -0.18280521035194397, -0.3688051998615265, 0.18191279470920563, -0.34118950366973877, -0.02861175686120987, -0.07126188278198242, -0.19174893200397491, -0.1515435129404068, 0.017825370654463768, -0.14574384689331055, 0.11911068111658096, -0.1497160643339157, 0.2951979637145996, 0.1002751961350441, 0.14419755339622498, -0.1360781192779541, 0.0066183507442474365, 0.061254940927028656, -0.044862955808639526, -0.01984352245926857, -0.39950841665267944, 0.29674986004829407, -0.23147007822990417, 0.07111349701881409, -0.09059152752161026, 0.1109323799610138, -0.005860047414898872, 0.46515530347824097, 0.1546248197555542, 0.16604405641555786, 0.14880110323429108, -0.2334335744380951, -0.025547925382852554, -0.397988498210907, 0.341530978679657, -0.15252165496349335, 0.07143250852823257, 0.13693466782569885, 0.19651395082473755, -0.1640539914369583, -0.23615072667598724, -0.06386281549930573, 0.3424186706542969, 0.24607886373996735, -0.2525883615016937, 0.010721869766712189, -0.021277647465467453, -0.06762074679136276, -0.13085608184337616, 0.21569037437438965, 0.10745956003665924, -0.14398276805877686, 0.17642337083816528, -0.018190860748291016, -0.5468440055847168, 0.3067377209663391, -0.48303598165512085, -0.23949521780014038, -0.05571252852678299, 0.11631154268980026, 0.21467480063438416, 0.1198696568608284, -0.14170080423355103, -0.03347916156053543, 0.26065540313720703, -0.01135680079460144, 0.10467320680618286, 0.25811266899108887, -0.22574138641357422, 0.14774508774280548, -0.1477685570716858, 0.15546377003192902, 0.05357503145933151, -0.12015223503112793, 0.1274189054965973, -0.3981751799583435 ]
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?
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"])}) ```
[ -0.4313148856163025, 0.14907023310661316, -0.0375169962644577, 0.40986794233322144, 0.32805049419403076, -0.05865391343832016, 0.43193957209587097, 0.4054521322250366, 0.09521950781345367, 0.30330950021743774, 0.20488519966602325, 0.14702971279621124, -0.10485392063856125, 0.1725999116897583, -0.21751005947589874, -0.5215805768966675, -0.38953718543052673, 0.35714223980903625, 0.24092526733875275, 0.0872737318277359, -0.2509526014328003, 0.3741832375526428, -0.06347399950027466, 0.1896345317363739, -0.3479044437408447, 0.1670255810022354, 0.05028705298900604, 0.35885751247406006, -0.007616598159074783, -0.4380542039871216, 0.0715334415435791, -0.04888574406504631, 0.2486555576324463, 0.2460625171661377, -0.00011354114394634962, 0.1460227221250534, 0.13701434433460236, 0.05711330473423004, -0.4989677965641022, -0.46331971883773804, -0.3687431812286377, -0.16443103551864624, 0.2619190514087677, -0.4126057028770447, -0.04022444784641266, -0.17446662485599518, -0.13323329389095306, -0.3073183596134186, 0.35694313049316406, 0.4003106951713562, 0.18680042028427124, 0.16958260536193848, 0.015365678817033768, -0.23450198769569397, 0.3742249310016632, 0.17111416161060333, -0.01640823855996132, 0.12615108489990234, -0.11584888398647308, 0.08964942395687103, 0.005297668278217316, 0.18779699504375458, -0.23169603943824768, 0.24944254755973816, 0.22850579023361206, 0.11773797124624252, 0.03664929047226906, -0.26572346687316895, 0.14235202968120575, 0.13484054803848267, 0.26678523421287537, 0.07065250724554062, -0.15757960081100464, -0.34370291233062744, -0.15127384662628174, -0.18501795828342438, 0.22939401865005493, 0.1774059385061264, -0.590197741985321, 0.1562167853116989, -0.26530808210372925, -0.3019917905330658, -0.20758332312107086, 0.033803146332502365, -0.219023197889328, 0.23382845520973206, -0.17655761539936066, 0.04953861981630325, 0.21884895861148834, 0.42363762855529785, 0.10345407575368881, -0.03750968724489212, 0.022041497752070427, 0.15787072479724884, -0.038854192942380905, 0.13540814816951752, 0.00331675261259079, -0.32618677616119385, -0.10409770905971527, 0.26029258966445923, 0.1604028344154358, -0.13917231559753418, 0.3594932556152344, 0.13984918594360352, 0.14286571741104126, 0.23030611872673035, 0.06898729503154755, 0.2629908323287964, 0.12210380285978317, 0.21606342494487762, -0.19666117429733276, -0.16849586367607117, -0.18143987655639648, -0.32029688358306885, 0.06845802068710327, 0.2165808379650116, 0.510968029499054, -0.13581037521362305, -0.2780317962169647, 0.07047596573829651, -0.2655806243419647, -0.32896187901496887, 0.15219971537590027, 0.3156052231788635, -0.0025095471646636724, 0.24073392152786255, 0.09115844964981079, 0.028320224955677986, -0.02301670052111149, -0.1376166194677353, -0.21748211979866028, 0.2143293023109436, -0.1625070571899414, 0.07602156698703766, 0.014732219278812408, -0.41197869181632996, 0.03420482575893402, -0.1888812631368637, -0.0299421027302742, -0.20870186388492584, 0.08018642663955688, -0.15203195810317993, 0.1196088194847107, 0.4111660122871399, -0.028495866805315018, 0.201898992061615, 0.32384926080703735, -0.3406902551651001, -0.14641474187374115, 0.27455878257751465, -0.42311784625053406, -0.7456306219100952, -0.19566091895103455, 0.2238382250070572, -0.07365047931671143, 0.19787698984146118, 0.1885831207036972, -0.27528131008148193, 0.27229663729667664, -0.11155213415622711, -0.09071151167154312, -0.18785446882247925, -0.19335520267486572, -0.19065114855766296, 0.4255260229110718, 0.5266328454017639, -0.3641706705093384, -0.207724928855896, -0.3591485321521759, -0.23266571760177612, 0.4333825409412384, 0.08630156517028809, -0.28574803471565247, 0.4770635962486267, -0.28821176290512085, 0.20215217769145966, 0.8287099003791809, 0.04753682389855385, -0.14322572946548462, 0.7921678423881531, -0.28335142135620117, -0.10017751157283783, 0.3363880217075348, -0.15958663821220398, 0.3306867182254791, 0.05646675080060959, -0.023050375282764435, 0.16000954806804657, -0.009781377390027046, 0.0011955704540014267, -0.349628210067749, -0.08108141273260117, 0.09016489237546921, 0.26379847526550293, 0.35066065192222595, 0.2090173065662384, 0.06772369146347046, 0.194093257188797, 0.3326263427734375, -0.09945076704025269, 0.05956035107374191, 0.1627098172903061, 0.1186026781797409, 0.13080817461013794, -0.0456835962831974, -0.24404752254486084, -0.13007000088691711, 0.05190173536539078, -0.27687308192253113, -0.017525508999824524, -0.3371606469154358, -0.003189925104379654, -0.4524488151073456, 0.16602087020874023, -0.5311630368232727, -0.2737659811973572, 0.12944884598255157, 0.3688955008983612, 0.18978926539421082, -0.1662430763244629, -0.387240469455719, 0.10817280411720276, -0.1206565648317337, 0.06610406190156937, -0.10960350930690765, 0.48560571670532227, -0.22673146426677704, -0.09191279113292694, -0.21563421189785004, 0.13781015574932098, 0.031383268535137177, -0.11482563614845276, -0.22147873044013977, 0.3860074281692505, 0.003862367942929268, -0.12073865532875061, -0.19273367524147034, -0.0692790150642395, -0.039156489074230194, -0.044643890112638474, 0.06297393143177032, 0.028487978503108025, 0.05338669568300247, 0.2704920172691345, -0.009270116686820984, 0.13603493571281433, -0.16328781843185425, 0.3982424736022949, 0.16685928404331207, 0.02083413489162922, 0.15039870142936707, -0.2021781951189041, 0.08906333893537521, -0.30055785179138184, 0.1957762986421585, -0.006557093933224678, 0.2511284053325653, 0.09023057669401169, -0.08966415375471115, -0.00203520804643631, 0.5382501482963562, -0.037024952471256256, -0.13339975476264954, 0.16823604702949524, -0.1254810094833374, 0.09026535600423813, -0.09338366240262985, 0.5734847784042358, 0.3539668321609497, 0.07267548888921738, 0.020978178828954697, 0.10857877880334854, 0.057045791298151016, -0.23908984661102295, 0.39191311597824097, 0.21730168163776398, 0.14637839794158936, 0.4745147228240967, -0.28586897253990173, 0.14161942899227142, -0.26452556252479553, -0.4580683410167694, -0.023571748286485672, 0.4483819901943207, -0.2703514099121094, 0.22091777622699738, -0.1348753124475479, -0.12936247885227203, -0.37967997789382935, -0.33594247698783875, -0.11206747591495514, -0.32692569494247437, -0.11521758139133453, -0.012368671596050262, -0.19286775588989258, 0.052100248634815216, -0.1262446939945221, -0.05622170865535736, 0.08502206951379776, -0.39152899384498596, -0.1560579240322113, -0.08352263271808624, -0.19451835751533508, 0.05203777924180031, 0.27292540669441223, -0.000537247397005558, 0.1058686152100563, -0.24963635206222534, -0.027279630303382874, 0.053974226117134094, 0.20223823189735413, 0.301230788230896, 0.07035158574581146, -0.11552838981151581, 0.22426743805408478, 0.30693119764328003, 0.21398191154003143, -0.5858131647109985, 0.3827553987503052, -0.09081491082906723, -0.050312817096710205, 0.17620126903057098, 0.2201099544763565, -0.035175226628780365, -0.21001267433166504, -0.5178930759429932, -0.31933146715164185, -0.5126546621322632, 0.17072659730911255, 0.14494195580482483, 0.4240310788154602, 0.013678748160600662, 0.12659230828285217, 0.16082985699176788, -0.08143074810504913, 0.11324112117290497, -0.06858360767364502, -0.31857433915138245, 0.1213853657245636, -0.23429395258426666, -0.23631198704242706, -0.1602383553981781, -0.20537398755550385, -0.010848071426153183, -0.027377448976039886, -0.38389939069747925, 0.13885460793972015, -0.293634295463562, 0.1135924905538559, -0.10309714078903198, 0.019744114950299263, 0.5523139834403992, 0.21687252819538116, -0.1350981444120407, 0.202467143535614, 0.20405395328998566, 0.07128502428531647, -0.06832657754421234, -0.07473618537187576, -0.029180169105529785, 0.27043843269348145, -0.19129478931427002, 0.5091885328292847, 0.0007141139358282089, 0.01550125703215599, 0.22497346997261047, -0.18706835806369781, 0.1043551117181778, -0.11497905105352402, -0.5762465000152588, -0.036139409989118576, -0.1498454213142395, -0.3747343420982361, 0.1722022294998169, -0.015332896262407303, 0.009097241796553135, -0.4227067232131958, -0.09911060333251953, -0.13085444271564484, -0.3677424490451813, 0.03185827285051346, 0.05684103071689606, 0.35353365540504456, -0.2004273682832718, 0.13285133242607117, 0.039434585720300674, 0.12921980023384094, 0.10101407766342163, 0.47347867488861084, 0.2221841812133789, -0.11179079115390778, -0.29199621081352234, -0.12013274431228638, -0.18360331654548645, 0.23479734361171722, 0.37830105423927307, 0.017379630357027054, -0.08443381637334824, -0.30060291290283203, 0.07330494374036789, -0.13580940663814545, 0.453366219997406, 0.1199730932712555, 0.0970597118139267, 0.249790221452713, -0.2002439796924591, 0.1426028609275818, -0.14036262035369873, -0.12164215743541718, 0.1042664647102356, 0.12812884151935577, 0.2800692617893219, -0.08054611831903458, -0.38610032200813293, 0.553464412689209, 0.19263817369937897, -0.3505716621875763, -0.11423913389444351, -0.2361205667257309, -0.14321130514144897, -0.363044798374176, -0.09781888872385025, -0.1419658064842224, 0.6038717031478882, 0.03518126904964447, 0.0035439394414424896, 0.13438372313976288, -0.2054574191570282, 0.09143778681755066, 0.08005504310131073, 0.22212138772010803, -0.16077174246311188, -0.10854361951351166, 0.06490813940763474, 0.30816948413848877, 0.004153970628976822, 0.5797473788261414, -0.17489434778690338, -0.3587443232536316, 0.29075780510902405, -0.16288430988788605, 0.42689695954322815, 0.10719554126262665, -0.36621999740600586, -0.14400219917297363, -0.025732073932886124, 0.39458709955215454, -0.2246643602848053, 0.17776598036289215, 0.2195805013179779, -0.17360283434391022, -0.030414504930377007, -0.5798046588897705, 0.2997015416622162, -0.09116330742835999, 0.01543281227350235, 0.26093462109565735, -0.12376730144023895, -0.045322485268116, 0.3260624408721924, 0.024788402020931244, 0.8981190323829651, 0.04254806414246559, -0.0019338354468345642, 0.2674086391925812, -0.05099460110068321, 0.3269183039665222, -0.14565998315811157, 0.15490888059139252, -0.461398184299469, -0.17500001192092896, -0.1381571888923645, -0.1286880522966385, 0.37235286831855774, 0.12748655676841736, -0.02445293962955475, -0.021714476868510246, -0.13701757788658142, 0.016687659546732903, 0.05515098571777344, 0.3929786682128906, -0.06797240674495697, -0.07930026948451996, -0.22948043048381805, 0.04515169560909271, -0.025952503085136414, 0.451408714056015, 0.10988447070121765, 0.0565311573445797, 0.047954630106687546, -0.25642186403274536, -0.2176629900932312, 0.1970861852169037, -0.08949804306030273, 0.15077850222587585, -0.02047796919941902, -0.3598051071166992, 0.030153777450323105, 0.21077682077884674, -0.039207056164741516, 0.06539761275053024, 0.012017454020678997, -0.10564020276069641, -0.18850359320640564, -0.06197533756494522, -0.030715638771653175, 0.23423747718334198, 0.46655625104904175, -0.2259332537651062, -0.16645294427871704, 0.25884324312210083, -0.24077822268009186, -0.2470114380121231, 0.04718463122844696, 0.08640649169683456, 0.3314759135246277, -0.5644139051437378, 0.03950503468513489, -0.09285162389278412, 0.0650939792394638, -0.14163824915885925, 0.09390749037265778, 0.006250433623790741, -0.33724620938301086, -0.16681119799613953, -0.023687291890382767, -0.4543456733226776, -0.03739913925528526, 0.2611059546470642, 0.12454511970281601, 0.21207547187805176, 0.5600275993347168, -0.07795438170433044, -0.040637072175741196, -0.3511148989200592, 0.10349837690591812, 0.043074969202280045, -0.6007830500602722, 0.16937345266342163, 0.026073528453707695, -0.029467612504959106, 0.022507574409246445, 0.3516507148742676, 0.06409972906112671, 0.3599260151386261, -0.1369263380765915, -0.7386270761489868, -0.13235600292682648, -0.18987800180912018, 0.11828789114952087, 0.12464262545108795, -0.003307584673166275, 0.4192385673522949, 0.11296457052230835, 0.09937015920877457, -0.2865521311759949, 0.012999322265386581, -0.20812980830669403, -0.0038073882460594177, 0.030729983001947403, -0.16881465911865234, 0.3470500707626343, 0.08275534212589264, 0.17051249742507935, -0.030676372349262238, -0.10907284170389175, -0.20246508717536926, -0.17876100540161133, 0.13912351429462433, -0.005181301385164261, -0.1065719798207283, -0.20085649192333221, -0.013867312110960484, -0.001804746687412262, -0.022022634744644165, 0.19692490994930267, 0.1851424276828766, -0.1197013258934021, 0.3793245255947113, 0.23978273570537567, 0.04629280045628548, -0.5541489720344543, 0.2532239258289337, -0.2923319339752197, 0.4187660217285156, 0.10142191499471664, 0.2078792005777359, -0.1518711894750595, -0.04183700308203697, -0.22906078398227692, 0.036395445466041565, 0.11244620382785797, -0.051050759851932526, 0.4439350962638855, -0.39343172311782837, -0.014261184260249138, -0.1242654025554657, 0.3427794873714447, 0.33456510305404663, -0.07392727583646774, 0.30513522028923035, 0.046665042638778687, 0.2049812376499176, -0.23795463144779205, -0.10769186168909073, 0.04174460098147392, -0.20103858411312103, 0.0955633670091629, 0.30282261967658997, -0.09019054472446442, -0.15452441573143005, 0.027556683868169785, 0.11178889125585556, 0.42430251836776733, 0.19945673644542694, 0.006743310950696468, 0.6949061155319214, -0.11830684542655945, 0.12356151640415192, 0.0825134813785553, 0.06443940103054047, 0.1638721078634262, 0.1696285903453827, -0.24851521849632263, 0.08108840137720108, -0.09769422560930252, 0.05340954661369324, 0.05968654528260231, -0.4134488105773926, 0.23549538850784302, 0.03643821179866791, -0.1898491084575653, -0.24040940403938293, -0.21353191137313843, 0.3986046612262726, -0.15124765038490295, 0.13146035373210907, 0.07414263486862183, 0.3215717375278473, -0.1583220660686493, 0.002702665515244007, -0.23088866472244263, -0.36191534996032715, -0.4221189320087433, -0.13455553352832794, 0.2279156595468521, -0.08311966061592102, 0.2829243540763855, 0.05354095995426178, -0.06347574293613434, 0.14658068120479584, 0.12477672845125198, 0.02563038468360901, -0.07666895538568497, -0.44819775223731995, 0.234490767121315, 0.35565197467803955, 0.19403812289237976, 0.1822524070739746, -0.02514571137726307, 0.43227270245552063, 0.27693605422973633, -0.15671870112419128, -0.24857375025749207, -0.19178178906440735, -0.15320254862308502, -0.09668942540884018, 0.02034534141421318, -0.22229117155075073, 0.26034459471702576, 0.48682406544685364, 0.16282278299331665, -0.20368853211402893, 0.28391385078430176, 0.022813275456428528, 0.14660677313804626, -0.09600389003753662, 0.8893517851829529, 0.1482698917388916, -0.19941675662994385, -0.016110897064208984, -0.12910202145576477, -0.3928128182888031, -0.31451523303985596, 0.1822715848684311, -0.062148869037628174, 0.10750169306993484, -0.031114373356103897, 0.09929973632097244, 0.01143364142626524, 0.4037732481956482, 0.2701529860496521, 0.08406063169240952, -0.28075844049453735, -0.2469954490661621, -0.6139659285545349, 0.18763518333435059, 0.08566983044147491, -0.12440460920333862, 0.0803307443857193, 0.13576968014240265, -0.1890186071395874, 0.3993116021156311, -0.17872218787670135, 0.3130198121070862, 0.0009693475440144539, 0.020014513283967972, -0.17493698000907898, -0.02637002244591713, 0.017082106322050095, 0.09962790459394455, -0.04120444506406784, -0.3604991137981415, 0.14887972176074982, -0.40670838952064514, 0.06639552116394043, 0.08900849521160126, -0.24612274765968323, 0.34042447805404663, -0.0877918154001236, 0.005455270409584045, 0.03730031102895737, 0.3479834496974945, -0.07882294058799744, 0.07392863184213638, 0.21389763057231903, 0.11478374898433685, -0.14364704489707947, 0.2695797383785248, 0.2807500660419464, 0.4002353847026825, 0.03446792811155319, -0.01174578070640564, -0.630031943321228, 0.2848765254020691, -0.09762140363454819, 0.23178744316101074, -0.18369066715240479, 0.04751288890838623, -0.08843041956424713, 0.18163008987903595, 0.45225581526756287, -0.0032378248870372772, -0.0026565641164779663, -0.007317857816815376, -0.39858174324035645, -0.3638148307800293, 0.5529706478118896, -0.3081752061843872, -0.36808091402053833, -0.1632726937532425, 0.21544823050498962, 0.06245805695652962, 0.03921719267964363, -0.4456601142883301, -0.029054909944534302, 0.5159177780151367, -0.08212680369615555, -0.052487898617982864, -0.040824756026268005, 0.04913795739412308, 0.1874910593032837, 0.04411716386675835, 0.3311096429824829, 0.02802714891731739, -0.016854722052812576, -0.11835445463657379, -0.13158296048641205 ]
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
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)
[ 0.023814212530851364, -0.09865827113389969, 0.03794043883681297, 0.19491174817085266, 0.12027594447135925, 0.12439770251512527, 0.19488351047039032, 0.2199343889951706, 0.011479754000902176, 0.05286344140768051, -0.055786848068237305, 0.08662964403629303, -0.07946711778640747, 0.18708601593971252, 0.3534020781517029, -0.2868921458721161, 0.05397810414433479, -0.06264698505401611, -0.2121240198612213, -0.054586607962846756, -0.0671578198671341, 0.34171485900878906, -0.13973453640937805, 0.060674235224723816, -0.2869875133037567, 0.07204850763082504, -0.260130912065506, 0.1584313064813614, -0.031148342415690422, -0.5359758734703064, 0.13060207664966583, -0.09459666907787323, 0.07277500629425049, 0.23164668679237366, -0.00010822749754879624, -0.06016440689563751, 0.30609261989593506, 0.082807756960392, -0.37067705392837524, -0.20580093562602997, -0.17781665921211243, -0.07617617398500443, -0.04942833632230759, 0.12147218734025955, -0.0946245938539505, -0.14478884637355804, 0.05672559142112732, 0.10968686640262604, 0.1977953016757965, 0.2688027024269104, 0.2574373185634613, 0.30416491627693176, 0.35774171352386475, -0.45857566595077515, 0.1962658315896988, 0.3570466637611389, -0.21038496494293213, 0.4913860857486725, 0.15627269446849823, -0.09231141209602356, 0.03173096477985382, 0.47662514448165894, 0.20456726849079132, -0.16086602210998535, 0.2504890561103821, 0.133391872048378, -0.22461077570915222, -0.1814976930618286, 0.12708787620067596, 0.49450773000717163, 0.3722878396511078, -0.19120070338249207, -0.4916296601295471, -0.21988272666931152, -0.020754706114530563, -0.19284667074680328, 0.10467259585857391, 0.3129562735557556, 0.15184006094932556, 0.3437923491001129, -0.01742955483496189, -0.26454707980155945, -0.11403945088386536, 0.29838037490844727, 0.3746595084667206, -0.10560700297355652, -0.2534511089324951, -0.07138480991125107, 0.22202806174755096, -0.1280478835105896, -0.1337205171585083, 0.1228049024939537, -0.19351531565189362, 0.18925327062606812, 0.16069158911705017, 0.07831744849681854, 0.08143934607505798, 0.19650673866271973, 0.49876177310943604, -0.014850892126560211, -0.17914119362831116, 0.037567898631095886, -0.24345183372497559, 0.21531516313552856, -0.04611986503005028, 0.04131406918168068, 0.02686791867017746, 0.12544406950473785, 0.36885321140289307, 0.6128203868865967, 0.1910247504711151, -0.05898623168468475, -0.051848895847797394, -0.19702011346817017, -0.27350500226020813, -0.2547544836997986, 0.15727418661117554, -0.1696167290210724, -0.2395726889371872, 0.17471575736999512, -0.17577609419822693, -0.018959056586027145, -0.10057265311479568, 0.3322920501232147, -0.028086211532354355, -0.27070432901382446, -0.0003244243562221527, 0.33435678482055664, -0.06979720294475555, -0.23110158741474152, -0.2264322191476822, 0.11920307576656342, -0.20964376628398895, 0.28694573044776917, 0.16554142534732819, -0.2259817272424698, 0.37604111433029175, 0.10906413942575455, 0.0005605816841125488, -0.14984792470932007, -0.1580822467803955, 0.003510766662657261, 0.05569087341427803, 0.2485349178314209, -0.025455845519900322, 0.1754463016986847, 0.2688708007335663, -0.1869194358587265, -0.14254656434059143, -0.19027698040008545, -0.38392630219459534, -0.17930801212787628, -0.21332041919231415, 0.1693783700466156, 0.05968800187110901, -0.003374822437763214, -0.3302612006664276, 0.2870268225669861, -0.18945401906967163, -0.06834638118743896, 0.03460564464330673, 0.11585573107004166, -0.13067451119422913, -0.07843402773141861, 0.46716856956481934, 0.605353593826294, 0.00448106974363327, -0.18408960103988647, 0.12477266043424606, 0.08674593269824982, -0.2181502878665924, 0.2594059109687805, -0.2732607126235962, 0.14724062383174896, -0.4406779408454895, -0.14418873190879822, 0.06927220523357391, -0.43881145119667053, -0.04152340441942215, 0.041445277631282806, 0.18179424107074738, -0.03335121273994446, -0.14444953203201294, -0.23128443956375122, 0.03261474519968033, 0.058371685445308685, -0.09685097634792328, 0.06999819725751877, 0.1326518952846527, 0.023085063323378563, -0.23758560419082642, -0.20383727550506592, -0.14017648994922638, -0.06205767020583153, 0.02890682779252529, 0.15301328897476196, 0.18808770179748535, -0.053084712475538254, 0.3430323004722595, -0.15669813752174377, 0.08247701078653336, 0.5467972755432129, 0.36610475182533264, 0.1556689441204071, 0.03198307380080223, -0.22884076833724976, -0.31728395819664, 0.026397638022899628, -0.06357653439044952, 0.3114599585533142, 0.04579900577664375, -0.2315790355205536, -0.35352247953414917, -0.025712063536047935, 0.044601794332265854, -0.6013520359992981, 0.12713149189949036, 0.03743443638086319, 0.027540776878595352, 0.38951659202575684, -0.10577019304037094, 0.2828895151615143, -0.13270330429077148, 0.37260687351226807, -0.26363804936408997, 0.43150368332862854, -0.13862991333007812, -0.03780559450387955, 0.09791362285614014, 0.16483330726623535, 0.18612056970596313, -0.2625073194503784, -0.09125418961048126, 0.5180585980415344, 0.08512309193611145, 0.3324992060661316, 0.14018529653549194, 0.024890169501304626, 0.31590452790260315, -0.4130997955799103, -0.0890185609459877, 0.1741505116224289, -0.11196467280387878, 0.06714314967393875, -0.3065866231918335, 0.16391709446907043, 0.11667661368846893, 0.18149042129516602, 0.39558303356170654, 0.299640029668808, 0.12639428675174713, -0.028474388644099236, -0.20330199599266052, -0.2883402109146118, 0.17760314047336578, -0.22826318442821503, 0.13413138687610626, -0.12133651971817017, -0.3895455300807953, 0.10213275253772736, 0.2237028181552887, 0.017945628613233566, 0.12391425669193268, 0.3222593367099762, -0.415470689535141, -0.05770009011030197, 0.3337770104408264, 0.10634167492389679, 0.08352798223495483, 0.09850548207759857, 0.025846634060144424, 0.22055469453334808, -0.15655946731567383, -0.10347804427146912, 0.06463965773582458, 0.03343280404806137, 0.026945140212774277, -0.15214771032333374, 0.022964391857385635, 0.10545101016759872, -0.3875062167644501, -0.08137759566307068, -0.311563104391098, 0.016638023778796196, -0.4948587119579315, 0.1977171003818512, -0.2517290413379669, -0.27385780215263367, -0.4601173996925354, -0.16057106852531433, -0.2877717614173889, -0.28544238209724426, -0.08929850906133652, 0.11421167850494385, -0.161043182015419, 0.1847050040960312, 0.017294876277446747, 0.08515596389770508, -0.2492859959602356, 0.380246102809906, -0.08812057226896286, 0.12775889039039612, -0.33709830045700073, 0.06538708508014679, 0.016846779733896255, 0.13487353920936584, 0.12468857318162918, -0.22342020273208618, -0.10714758187532425, -0.5157748460769653, -0.633823812007904, 0.20148929953575134, -0.1296890377998352, 0.2588922381401062, 0.30882424116134644, 0.09507155418395996, -0.24199233949184418, -0.32800599932670593, 0.31553247570991516, -0.2872065603733063, 0.06558768451213837, -0.11999592930078506, -0.04171910136938095, -0.09929531067609787, -0.184747576713562, -0.3987174332141876, -0.03618372976779938, -0.16401229798793793, 0.3451003432273865, 0.08165405690670013, -0.028815746307373047, 0.3805134892463684, 0.09266552329063416, 0.2619219720363617, -0.281735360622406, 0.1338213086128235, -0.12424134463071823, -0.274908185005188, 0.0906582772731781, -0.5187421441078186, -0.4204919934272766, 0.02277534082531929, -0.03883543238043785, 0.13200704753398895, -0.2548072338104248, -0.4300433397293091, -0.17728190124034882, -0.23292212188243866, -0.058115214109420776, -0.012180637568235397, 0.18300525844097137, 0.01399155706167221, 0.03963548690080643, -0.09899014234542847, -0.24048152565956116, -0.16206151247024536, 0.006419271230697632, -0.33733221888542175, 0.27258920669555664, -0.17868474125862122, 0.2394474744796753, 0.13902494311332703, 0.3564085364341736, 0.5294390320777893, 0.05019064620137215, 0.24847087264060974, -0.18528886139392853, 0.6270015239715576, -0.1207379475235939, -0.28539925813674927, 0.19191084802150726, -0.10805755853652954, 0.1827448010444641, 0.12537041306495667, 0.4374832212924957, 0.14799663424491882, -0.1285092532634735, -0.08233565092086792, -0.23670917749404907, -0.32229819893836975, -0.2650185525417328, -0.08803126215934753, 0.2506979703903198, 0.04694579169154167, 0.09039124101400375, 0.06091897562146187, -0.09745599329471588, 0.2490273118019104, 0.5101957321166992, 0.12071037292480469, 0.11337131261825562, -0.425970196723938, -0.020767614245414734, -0.3466256856918335, -0.06404975056648254, -0.08494555950164795, 0.10782504081726074, -0.16117611527442932, 0.05626349151134491, -0.09180107712745667, 0.15396630764007568, 0.3328191339969635, -0.18908542394638062, 0.03340081870555878, 0.11485551297664642, 0.05980239808559418, -0.37322819232940674, 0.008801523596048355, -0.14994363486766815, -0.008080726489424706, 0.3967726230621338, 0.3800731301307678, -0.2518858015537262, -0.11829178780317307, 0.5299789905548096, -0.0037831494119018316, 0.08845439553260803, 0.1667303591966629, 0.004888705909252167, -0.18168026208877563, -0.24244774878025055, -0.17685464024543762, 0.11367303878068924, -0.05313654616475105, -0.1842627078294754, -0.16594107449054718, 0.18376679718494415, -0.004193061962723732, 0.022492609918117523, 0.11175359785556793, 0.2588682770729065, 0.12964652478694916, 0.14298969507217407, 0.2554704546928406, 0.19203080236911774, 0.542877733707428, 0.42802372574806213, -0.26740458607673645, -0.34447258710861206, -0.16443806886672974, 0.023615531623363495, 0.32664743065834045, 0.20042243599891663, -0.09647758305072784, 0.1478661149740219, 0.104222372174263, 0.0946662649512291, -0.30922579765319824, 0.21405625343322754, 0.45538854598999023, 0.05968876928091049, -0.29137155413627625, -0.261064350605011, 0.47357290983200073, -0.02625240385532379, -0.010559327900409698, 0.28923988342285156, 0.5968016386032104, -0.2596265375614166, 0.061878420412540436, -0.014067843556404114, 0.7958049178123474, 0.1573023796081543, 0.2499774694442749, 0.226369708776474, -0.38267046213150024, 0.5273588299751282, 0.09350818395614624, -0.11508253216743469, -0.28210848569869995, -0.2243504524230957, -0.05354975163936615, -0.1619996428489685, 0.12853819131851196, -0.061263374984264374, -0.21123236417770386, 0.23627513647079468, -0.10414613783359528, 0.46267032623291016, -0.05233187973499298, 0.09419578313827515, -0.13558512926101685, -0.24449864029884338, -0.3501548171043396, 0.23308065533638, 0.17190323770046234, 0.3135470747947693, -0.1779349148273468, -0.20428359508514404, -0.04870351031422615, -0.17050990462303162, -0.37544167041778564, 0.11094234138727188, -0.10616758465766907, 0.03887079283595085, 0.3252842426300049, -0.1512899398803711, 0.22162780165672302, 0.3164287507534027, 0.4151778221130371, 0.2473703920841217, -0.5191956758499146, 0.12947127223014832, -0.38374900817871094, -0.09170322865247726, -0.03044559247791767, 0.0867074728012085, 0.2964927852153778, -0.02796720527112484, -0.22046729922294617, 0.09742601960897446, 0.0109249884262681, 0.0573880597949028, -0.08695878833532333, -0.27970170974731445, -0.43506282567977905, -0.21786373853683472, 0.09909649193286896, 0.08138728886842728, -0.009863881394267082, -0.44812554121017456, 0.1658850908279419, 0.11075128614902496, 0.13660107553005219, -0.20107325911521912, 0.40176671743392944, -0.05307124927639961, -0.23146958649158478, 0.4804225564002991, -0.42635485529899597, -0.025250591337680817, 0.2125006765127182, 0.2751098871231079, -0.1737014353275299, -0.15345647931098938, 0.14879369735717773, 0.32721567153930664, -0.3455372452735901, -0.005760054104030132, 0.00021277694031596184, 0.20859290659427643, -0.04875943809747696, 0.2355850338935852, 0.18806886672973633, -0.14138540625572205, 0.08157625794410706, -0.28848010301589966, -0.35061517357826233, 0.4193541407585144, -0.22416503727436066, 0.006092526018619537, -0.11776954680681229, 0.06883285939693451, 0.1923661082983017, -0.04651325196027756, -0.35573849081993103, 0.15670020878314972, -0.08312476426362991, -0.14517872035503387, 0.1895279884338379, 0.16026270389556885, 0.42364707589149475, -0.17220816016197205, 0.05332515388727188, -0.15967704355716705, -0.0828060582280159, -0.12051113694906235, -0.309773325920105, 0.06326024234294891, 0.08298804610967636, -0.3282601535320282, -0.004364212974905968, -0.06854873895645142, 0.022691698744893074, -0.20050619542598724, 0.2776351571083069, 0.15689200162887573, 0.00148773193359375, 0.19375206530094147, -0.3008541762828827, 0.13911467790603638, 0.22029687464237213, -0.15515723824501038, 0.10587847232818604, 0.13577304780483246, 0.14768972992897034, -0.21634581685066223, -0.15086044371128082, -0.06457743048667908, 0.01496270764619112, 0.2003401815891266, -0.04582478106021881, -0.02775111049413681, 0.4761669933795929, -0.2172248512506485, -0.002472132444381714, -0.055722057819366455, 0.5668193101882935, -0.011339984834194183, -0.16541171073913574, 0.30791175365448, 0.3981509208679199, 0.16638754308223724, -0.1658436357975006, -0.03788972645998001, -0.06474193930625916, 0.011865525506436825, 0.1398845911026001, 0.11198299378156662, 0.3799632787704468, 0.011067748069763184, -0.005967773497104645, 0.06976387649774551, 0.25739505887031555, 0.03635754808783531, 0.19424185156822205, 0.30658742785453796, -0.09670676290988922, 0.22277171909809113, 0.15469428896903992, 0.05855106562376022, 0.27786439657211304, -0.12136059999465942, 0.013806954026222229, 0.2073677033185959, -0.1441231369972229, 0.17153458297252655, 0.3275429904460907, -0.22344623506069183, -0.1315760314464569, 0.00881330668926239, 0.04263286292552948, -0.0800967738032341, -0.1765008270740509, 0.5373219847679138, -0.2597508430480957, -0.32586175203323364, -0.10947276651859283, 0.12864863872528076, 0.01362483762204647, -0.2267887443304062, 0.1911655217409134, -0.0876583382487297, -0.022311653941869736, -0.11340600252151489, 0.015811633318662643, -0.3865187168121338, 0.1966490000486374, -0.23478661477565765, -0.11590620875358582, -0.4802247881889343, 0.024255402386188507, 0.16292721033096313, 0.4471205174922943, 0.03626970574259758, 0.19410566985607147, -0.08671809732913971, -0.06371007859706879, -0.18523479998111725, 0.4443049430847168, 0.4746796786785126, 0.10369587689638138, 0.2628946900367737, -0.0326322540640831, -0.10738708078861237, 0.08722089231014252, 0.08561942726373672, 0.23103465139865875, 0.18148715794086456, -0.20697277784347534, 0.277486115694046, 0.1280156522989273, -0.1637142151594162, 0.24603287875652313, -0.11363780498504639, 0.2946648597717285, -0.2579135000705719, 0.26112332940101624, -0.42055994272232056, -0.08997654169797897, -0.20285770297050476, -0.1762138307094574, -0.1455257683992386, 0.15771056711673737, 0.4311692714691162, -0.055035386234521866, 0.10390612483024597, -0.19444184005260468, 0.09671496599912643, 0.3036425709724426, 0.4147997796535492, 0.5329135656356812, 0.10521958768367767, -0.06803785264492035, -0.38412731885910034, -0.3616311848163605, -0.0038391128182411194, -0.23895832896232605, 0.23345947265625, -0.025269772857427597, -0.2507735788822174, -0.12544387578964233, -0.03896681219339371, 0.15500684082508087, -0.16589264571666718, 0.04160834476351738, -0.08617578446865082, -0.2279694378376007, -0.12296772003173828, -0.29193323850631714, 0.15908777713775635, 0.0816725417971611, 0.1414037048816681, 0.1881663203239441, -0.20503152906894684, -0.03697511553764343, -0.048851802945137024, 0.4038330614566803, -0.3070391118526459, -0.14141376316547394, 0.34663626551628113, 0.05022504925727844, 0.09935835003852844, -0.13981163501739502, -0.279241144657135, -0.49202215671539307, -0.45831865072250366, 0.07504202425479889, 0.34977659583091736, -0.3039744794368744, 0.18015502393245697, -0.037379056215286255, -0.5454701781272888, -0.22841408848762512, 0.271453857421875, 0.35476887226104736, -0.011293251067399979, -0.31999003887176514, 0.3250998556613922, -0.10241389274597168, -0.18540829420089722, 0.4303939640522003, 0.2605860233306885, -0.28554221987724304, 0.04708077758550644, -0.19874829053878784, -0.4600842297077179, 0.4595611095428467, -0.19806554913520813, 0.1141156554222107, -0.1612379103899002, 0.4169614315032959, 0.35028666257858276, -0.33740508556365967, -0.8366900086402893, -0.04250990226864815, 0.27293020486831665, 0.2371310591697693, -0.3489457070827484, 0.12415270507335663, -0.04628170654177666, -0.04738103970885277, 0.04962928965687752, 0.4838927388191223, 0.16786134243011475, -0.2630135118961334, 0.3930171728134155, -0.09095831215381622 ]
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.
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.
[ -0.3421572148799896, -0.17921365797519684, 0.04200564697384834, 0.1359594315290451, 0.22275720536708832, 0.20644846558570862, 0.5331799983978271, -0.05518869683146477, 0.7224938273429871, 0.03790576756000519, 0.1282070279121399, 0.10376717150211334, 0.30889639258384705, 0.14097093045711517, 0.1369776874780655, -0.09364084899425507, 0.1692124307155609, 0.022962763905525208, 0.12087786942720413, 0.12117740511894226, -0.16090214252471924, 0.0361671969294548, -0.2463739663362503, -0.1509934961795807, -0.25212034583091736, 0.07533834129571915, -0.07951731234788895, -0.11432943493127823, -0.02389666624367237, -0.33916106820106506, 0.6933758854866028, 0.0673736035823822, 0.03823620453476906, 0.11358634382486343, -0.00011708354577422142, -0.05050654709339142, 0.307359516620636, 0.1880187839269638, -0.48752301931381226, -0.15123675763607025, -0.21236646175384521, -0.11130896955728531, 0.39849746227264404, 0.13945895433425903, -0.16366976499557495, 0.2092115730047226, 0.029745450243353844, -0.4943449795246124, 0.4988851547241211, -0.06105199083685875, 0.17469941079616547, 0.30528855323791504, -0.04852909967303276, -0.23059658706188202, 0.08363306522369385, -0.03478352725505829, -0.16259293258190155, 0.08684876561164856, 0.3014792799949646, -0.05301515758037567, -0.1497696042060852, 0.1725805252790451, -0.10852271318435669, 0.16945227980613708, 0.3398727476596832, -0.00298131350427866, -0.24809607863426208, -0.17939013242721558, 0.36129507422447205, 0.24421057105064392, 0.6548482179641724, 0.03113294020295143, -0.08806861191987991, -0.23285165429115295, 0.2950548529624939, -0.1134897843003273, 0.42385971546173096, 0.2521870732307434, -0.1621386557817459, 0.2438139170408249, -0.01821458525955677, 0.10829803347587585, -0.12580960988998413, -0.009590789675712585, -0.11005030572414398, 0.14022961258888245, -0.022742953151464462, 0.39522790908813477, 0.054505329579114914, -0.0082072913646698, 0.1381465196609497, -0.21760833263397217, -0.1372036337852478, -0.07972423732280731, -0.6954277157783508, 0.38160261511802673, 0.10481211543083191, 0.5880733132362366, 0.004903614521026611, 0.13882401585578918, -0.01629844680428505, -0.07066190242767334, 0.4156658351421356, 0.07365129142999649, 0.31349658966064453, -0.05812458321452141, -0.07855216413736343, -0.29338914155960083, 0.06681922823190689, 0.11927815526723862, -0.27419403195381165, -0.019569940865039825, -0.08754421025514603, -0.06956090033054352, 0.10873971879482269, -0.4019834101200104, 0.36585843563079834, -0.22635598480701447, -0.3172872066497803, 0.15854716300964355, -0.207085520029068, 0.11556937545537949, 0.23289506137371063, 0.5967628359794617, -0.2490653097629547, 0.5201707482337952, 0.3808351159095764, -0.17035125195980072, -0.23277410864830017, -0.19772396981716156, -0.14372678101062775, -0.20258775353431702, -0.07518608868122101, 0.12067802250385284, 0.2665489912033081, -0.061041612178087234, -0.06924600154161453, 0.11098961532115936, 0.12531420588493347, -0.20914660394191742, 0.145525261759758, 0.06250159442424774, 0.19687381386756897, 0.4266349673271179, -0.0362006276845932, 0.346117228269577, -0.12006475031375885, -0.13414329290390015, -0.13566118478775024, -0.009212084114551544, -0.04390562325716019, -0.11133535206317902, -0.07593419402837753, 0.13128124177455902, -0.2044665813446045, -0.2007233202457428, -0.079497791826725, -0.1384434849023819, 0.05553573742508888, 0.18458150327205658, 0.015841461718082428, -0.19168344140052795, -0.23309458792209625, -0.08953351527452469, 0.4320482313632965, 0.5559825301170349, 0.012093015015125275, 0.046283237636089325, 0.059648770838975906, 0.2351052165031433, -0.12651300430297852, 0.22053103148937225, -0.12638509273529053, -0.028705574572086334, -0.14785310626029968, -0.08424410969018936, 0.2862684428691864, -0.27111127972602844, -0.49812063574790955, 0.3614274859428406, -0.16599790751934052, 0.33668938279151917, 0.11227640509605408, 0.42998674511909485, -0.014789164066314697, -0.04459357634186745, -0.11326256394386292, 0.4187086224555969, -0.13995900750160217, -0.00009373016655445099, -0.061943262815475464, -0.1643691509962082, 0.2651597857475281, 0.3156029284000397, -0.37271004915237427, -0.32500559091567993, -0.12672805786132812, 0.4043623208999634, 0.2240157425403595, 0.017083335667848587, -0.02510494366288185, -0.04664928466081619, 0.11943213641643524, 0.21648599207401276, 0.17553353309631348, 0.04653772711753845, -0.7529013156890869, 0.37138378620147705, 0.4126580059528351, -0.155191108584404, 0.09542690217494965, -0.17171610891819, -0.084999218583107, 0.36412250995635986, -0.4516330659389496, -0.01372302696108818, -0.1289859414100647, 0.011175781488418579, 0.1545128971338272, 0.14754165709018707, -0.1186416745185852, 0.3955899477005005, -0.3701663911342621, 0.028933055698871613, -0.5195817947387695, -0.026135673746466637, -0.007613057270646095, 0.133090540766716, -0.08768346905708313, 0.06474541127681732, -0.07981692999601364, 0.10039569437503815, -0.13781306147575378, 0.08328113704919815, -0.07498256117105484, 0.3177843987941742, -0.34434768557548523, 0.3515329957008362, -0.04252048581838608, -0.21393892168998718, 0.33107462525367737, -0.08565151691436768, 0.18111677467823029, -0.3096942901611328, -0.20016059279441833, -0.009395301342010498, 0.2379462867975235, 0.30375757813453674, -0.27969157695770264, -0.04082903265953064, 0.29697757959365845, 0.03835761174559593, -0.1505778580904007, 0.057968586683273315, 0.3076647222042084, -0.3832476735115051, 0.39657869935035706, -0.02906212769448757, -0.11351122707128525, 0.3032810389995575, 0.49369391798973083, -0.016756536439061165, 0.021342746913433075, 0.18446549773216248, -0.0284101739525795, -0.258472740650177, 0.10355018824338913, 0.04225686565041542, 0.3874858021736145, 0.08274183422327042, 0.06430784612894058, 0.040670718997716904, -0.16584959626197815, -0.25025230646133423, 0.027185961604118347, 0.0018524080514907837, -0.13667424023151398, -0.01958589255809784, 0.2513798773288727, 0.05487412214279175, -0.20365846157073975, -0.02150869183242321, -0.2843708097934723, -0.02587481029331684, -0.19459477066993713, 0.38717201352119446, -0.16889739036560059, -0.10520966351032257, -0.04527415335178375, 0.24196505546569824, -0.11598017811775208, -0.27840474247932434, -0.23301081359386444, 0.2954610288143158, 0.048491332679986954, 0.21820691227912903, -0.08274662494659424, 0.47647625207901, 0.2003808468580246, -0.12498932331800461, -0.5416686534881592, -0.3286062180995941, -0.24720290303230286, -0.07923310995101929, 0.4818370044231415, -0.007573436480015516, 0.3253493905067444, -0.16255046427249908, -0.13986119627952576, -0.21485844254493713, -0.3025974929332733, -0.11537297070026398, -0.05761586129665375, 0.06578417867422104, 0.32389065623283386, 0.3698720335960388, 0.013258658349514008, 0.04499327763915062, 0.3545137643814087, -0.42425522208213806, -0.055692777037620544, 0.07129683345556259, -0.10153164714574814, -0.09648056328296661, -0.08130685985088348, -0.2108127474784851, -0.18892641365528107, -0.3307321071624756, 0.37307751178741455, 0.007226299494504929, -0.2035062164068222, 0.05193379521369934, 0.17505130171775818, -0.005271423142403364, -0.0974479541182518, 0.19534610211849213, -0.1813642829656601, -0.46988150477409363, 0.31048834323883057, 0.06648653745651245, -0.4040217995643616, 0.258046418428421, 0.0892745852470398, -0.11228477954864502, 0.014267399907112122, -0.7155368328094482, 0.0541108064353466, -0.4204276502132416, 0.2652031183242798, -0.02804512530565262, -0.06905368715524673, 0.05952248349785805, -0.04304008558392525, 0.18561814725399017, -0.025561219081282616, -0.20963697135448456, 0.20498478412628174, 0.10274041444063187, 0.11412313580513, 0.002954689785838127, 0.3410032391548157, -0.11084093153476715, 0.14562712609767914, 0.19108626246452332, -0.3845619857311249, 0.1195608526468277, 0.18197773396968842, 0.2901119291782379, -0.4231196343898773, -0.1817396879196167, 0.2234676629304886, -0.09256060421466827, -0.06774367392063141, 0.03138955682516098, 0.21455281972885132, -0.047425203025341034, -0.20631523430347443, -0.14459280669689178, 0.02337568998336792, -0.27902665734291077, 0.18864919245243073, -0.1309247761964798, -0.045894138514995575, 0.13699570298194885, 0.2464519441127777, -0.08392798900604248, -0.3607744574546814, 0.22709554433822632, 0.2879509925842285, 0.16885411739349365, -0.023517902940511703, -0.14498579502105713, 0.10964445024728775, -0.6280690431594849, 0.21013258397579193, -0.10608366131782532, 0.27490147948265076, -0.20802752673625946, -0.2697128653526306, 0.32861125469207764, -0.3333916962146759, 0.3648654818534851, -0.09909555315971375, 0.158523291349411, 0.09680657088756561, 0.06612914055585861, -0.2871655523777008, 0.04877464100718498, 0.15075500309467316, -0.027459701523184776, 0.020022571086883545, -0.06322965025901794, -0.14439541101455688, -0.33585983514785767, 0.16288241744041443, 0.4854346513748169, -0.22957688570022583, -0.28283464908599854, -0.316910058259964, -0.444759339094162, 0.013757197186350822, -0.0826912596821785, 0.0325828418135643, 0.06956508755683899, -0.014856893569231033, -0.21828657388687134, -0.286857545375824, 0.08694662153720856, -0.18050290644168854, 0.2229764461517334, -0.11784534901380539, -0.1840871274471283, 0.5251224040985107, 0.13922786712646484, 0.4123148024082184, 0.11828722059726715, 0.5112841129302979, -0.20353558659553528, -0.13833995163440704, 0.09140579402446747, 0.02216143161058426, -0.18495890498161316, 0.4150956869125366, -0.10203061997890472, 0.21155112981796265, 0.07662282139062881, 0.12281689047813416, -0.6578248739242554, 0.04934542626142502, 0.3610178530216217, 0.42204293608665466, -0.17289355397224426, -0.5308786630630493, 0.4196922779083252, -0.15056143701076508, -0.08399998396635056, 0.5754793286323547, -0.011302389204502106, 0.060274168848991394, 0.2838946580886841, -0.05554627627134323, 0.8268203139305115, -0.22404558956623077, 0.21940982341766357, 0.3263194262981415, -0.31338435411453247, 0.35035061836242676, -0.1751084178686142, 0.14471954107284546, -0.29010283946990967, -0.17140640318393707, 0.020613374188542366, -0.1566915065050125, 0.20081430673599243, -0.1517399698495865, 0.03433588519692421, -0.015636315569281578, -0.0239277184009552, 0.41104239225387573, -0.06108735501766205, 0.3594017028808594, -0.3556036949157715, -0.22364367544651031, -0.6419792175292969, 0.14153964817523956, 0.06811612844467163, 0.29193076491355896, -0.15391474962234497, 0.11852788925170898, 0.1681646853685379, -0.223138228058815, -0.2709331214427948, 0.29679444432258606, -0.059176765382289886, 0.020198846235871315, -0.002535872161388397, -0.2453889399766922, 0.18971584737300873, 0.42834922671318054, -0.07815414667129517, 0.0028681680560112, -0.13031622767448425, 0.6660156846046448, -0.32489120960235596, 0.14338259398937225, 0.2074248045682907, -0.18375389277935028, -0.122968390583992, -0.06584982573986053, -0.13664785027503967, -0.07987064868211746, -0.04581470414996147, -0.2576623558998108, 0.19480839371681213, 0.22173894941806793, 0.5157126784324646, -0.22379769384860992, 0.00632154755294323, -0.07163403928279877, 0.20392848551273346, -0.11596302688121796, 0.09636203944683075, 0.12821364402770996, 0.016854193061590195, 0.2450764775276184, -0.26500827074050903, -0.22393697500228882, -0.07729844748973846, 0.5229432582855225, -0.36120331287384033, -0.22916686534881592, 0.29201287031173706, 0.46832650899887085, -0.17949433624744415, -0.23259076476097107, 0.2840210199356079, -0.015319828875362873, -0.6017407774925232, -0.08182885497808456, 0.0597698874771595, 0.12204210460186005, 0.06994420289993286, 0.2638108730316162, -0.05456778407096863, -0.27352163195610046, 0.10487942397594452, -0.42193692922592163, -0.12064533680677414, -0.0018431320786476135, 0.09633331745862961, 0.062295835465192795, 0.00955747440457344, -0.17650562524795532, 0.040930233895778656, 0.17448066174983978, -0.21325820684432983, -0.13464727997779846, -0.38440871238708496, -0.16549870371818542, 0.05686669424176216, -0.2044225037097931, 0.5122641324996948, -0.11780400574207306, 0.0762774720788002, -0.052363887429237366, -0.14888912439346313, -0.14684948325157166, -0.07213173806667328, 0.16950182616710663, -0.27465105056762695, 0.092303067445755, -0.012646922841668129, -0.3794858455657959, -0.002683643251657486, -0.24109695851802826, 0.35881033539772034, 0.12706372141838074, -0.23351944983005524, -0.35239747166633606, 0.14178703725337982, 0.37194928526878357, -0.19548822939395905, 0.3693212866783142, -0.24777811765670776, 0.19859349727630615, 0.07543883472681046, -0.002164699137210846, 0.2593313157558441, 0.1494370549917221, 0.18276984989643097, 0.16640245914459229, 0.1665215790271759, -0.3322332203388214, 0.501335859298706, -0.07733120024204254, -0.10564839839935303, 0.05798208713531494, 0.26008641719818115, 0.5029072761535645, -0.11311077326536179, -0.026048779487609863, 0.03682447597384453, 0.12721103429794312, -0.22321486473083496, 0.011791861616075039, 0.274008184671402, 0.10755355656147003, -0.1125083789229393, 0.04617604613304138, 0.07285715639591217, -0.32007837295532227, -0.25731420516967773, 0.26031625270843506, 0.5831711888313293, 0.05214403569698334, 0.005453207064419985, 0.09762425720691681, 0.055417854338884354, 0.04764493554830551, 0.0018088780343532562, 0.22553987801074982, 0.06720630079507828, 0.25832563638687134, -0.025601796805858612, 0.2721092104911804, 0.031215066090226173, 0.5950923562049866, -0.07527744024991989, -0.5527669787406921, -0.01734546199440956, 0.08489924669265747, -0.2608533501625061, -0.13327237963676453, -0.015037447214126587, 0.3239242434501648, 0.03672289475798607, -0.40935248136520386, -0.28605929017066956, 0.2675055265426636, -0.1018482968211174, -0.1243203729391098, 0.03705351799726486, 0.12514299154281616, -0.09008917957544327, -0.019423825666308403, 0.12116850912570953, -0.03323349356651306, 0.4121566712856293, 0.14500191807746887, 0.21735289692878723, -0.3054664134979248, -0.31835806369781494, -0.02655559778213501, 0.08725368231534958, -0.18477551639080048, 0.3157144784927368, 0.38137179613113403, -0.07902383804321289, 0.11382752656936646, -0.08284367620944977, 0.2923549711704254, 0.20128802955150604, -0.1853829026222229, 0.4257682263851166, 0.09516449272632599, -0.05846866965293884, -0.0879010558128357, 0.299548476934433, -0.12351179122924805, 0.04497043415904045, 0.3188919723033905, 0.06837750971317291, -0.06055546924471855, 0.07639852166175842, -0.31192246079444885, 0.3332977592945099, -0.5204007029533386, 0.28240591287612915, -0.24391281604766846, -0.03353887051343918, -0.38695091009140015, 0.3119807839393616, -0.24383392930030823, -0.06936932355165482, 0.2466050237417221, -0.07663848996162415, -0.04593977332115173, -0.27500513195991516, 0.04584705829620361, -0.09721185266971588, 0.740157425403595, 0.11261316388845444, 0.5675967931747437, -0.15518592298030853, -0.3938143253326416, -0.37085068225860596, 0.12059307843446732, -0.39565277099609375, -0.09264989197254181, -0.10359179973602295, 0.1547197550535202, 0.014453284442424774, 0.05609038099646568, 0.07211033999919891, 0.16955126821994781, 0.30370327830314636, 0.21947890520095825, -0.2363603711128235, -0.248897984623909, 0.2533581852912903, 0.010138426907360554, -0.25763827562332153, -0.39935359358787537, 0.25122636556625366, -0.13200505077838898, -0.04970559850335121, -0.23476655781269073, -0.1574133038520813, 0.11306244134902954, -0.11265283823013306, 0.3671160936355591, 0.1141219288110733, 0.28241753578186035, 0.177469402551651, -0.34724855422973633, -0.3648993670940399, -0.3452363908290863, 0.15685325860977173, -0.01822003722190857, -0.172371044754982, 0.040024563670158386, -0.17834720015525818, 0.20129801332950592, -0.20194879174232483, -0.07526230067014694, -0.07936280965805054, 0.01792449876666069, -0.2456531524658203, 0.004733588546514511, -0.2061586081981659, 0.582903265953064, 0.16703228652477264, 0.115176260471344, 0.034183986485004425, -0.11302103847265244, -0.0836767926812172, 0.06998814642429352, 0.453841894865036, -0.41851136088371277, -0.18368902802467346, -0.128343403339386, 0.25201618671417236, -0.3200170397758484, 0.022393129765987396, -0.4983352720737457, 0.017709068953990936, 0.12999145686626434, 0.056784987449645996, -0.25614210963249207, 0.32890263199806213, 0.17784570157527924, 0.04825500026345253, -0.1633315533399582, 0.059499919414520264, -0.07283861935138702, 0.010667221620678902, 0.03135574981570244, -0.3227618932723999 ]
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.
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)
[ -0.3078531324863434, -0.1364150047302246, 0.03494182229042053, 0.10264672338962555, 0.22161364555358887, 0.19913870096206665, 0.540233314037323, -0.039556149393320084, 0.7148915529251099, -0.0008791759610176086, 0.1685941517353058, 0.16317249834537506, 0.2954546809196472, 0.06407970190048218, 0.12856179475784302, -0.058493077754974365, 0.18344977498054504, 0.03582216799259186, 0.13919967412948608, 0.11932231485843658, -0.1669837236404419, -0.05145411193370819, -0.22993077337741852, -0.1591736376285553, -0.2069353610277176, 0.10760550200939178, -0.12432114779949188, -0.16953325271606445, 0.055165424942970276, -0.3654210567474365, 0.6622169613838196, 0.08860990405082703, 0.04717784374952316, 0.08753332495689392, -0.00011793139128712937, -0.0686400979757309, 0.3264557123184204, 0.20769523084163666, -0.4810948371887207, -0.11539991199970245, -0.26637083292007446, -0.10236525535583496, 0.42658814787864685, 0.12523651123046875, -0.10182595998048782, 0.2228718400001526, 0.0324893593788147, -0.4769262671470642, 0.47206228971481323, -0.0075516002252697945, 0.169398695230484, 0.2102096974849701, -0.09664790332317352, -0.1735657900571823, 0.14174798130989075, -0.025268062949180603, -0.12456415593624115, 0.07965530455112457, 0.3850215971469879, -0.04180575907230377, -0.15976619720458984, 0.12906038761138916, -0.10766740888357162, 0.16274556517601013, 0.321406751871109, -0.0005831336602568626, -0.14221689105033875, -0.1568143218755722, 0.34827515482902527, 0.18623384833335876, 0.7253139615058899, 0.0010762475430965424, -0.024881863966584206, -0.14136222004890442, 0.3611502945423126, -0.08344967663288116, 0.3880746364593506, 0.2555364668369293, -0.183586984872818, 0.19690817594528198, 0.05364374816417694, 0.1519956886768341, -0.15322771668434143, 0.021513961255550385, -0.09485525637865067, 0.16800564527511597, 0.0779258981347084, 0.4369504451751709, 0.02365749143064022, -0.011507004499435425, 0.30315420031547546, -0.23540028929710388, -0.12159109115600586, -0.07664274424314499, -0.7380451560020447, 0.3873823881149292, 0.10632023215293884, 0.5062676072120667, -0.04185142368078232, 0.1271289885044098, -0.008341406472027302, -0.07838809490203857, 0.5045122504234314, 0.06924179196357727, 0.27957218885421753, -0.14495542645454407, -0.09416627138853073, -0.23509222269058228, 0.04745230823755264, 0.0643942654132843, -0.33238890767097473, -0.005150418728590012, -0.13719622790813446, -0.0893055722117424, 0.16189202666282654, -0.39473363757133484, 0.3059126138687134, -0.2011333554983139, -0.3254518508911133, 0.1885138899087906, -0.28616178035736084, 0.13589933514595032, 0.2743515372276306, 0.5571072697639465, -0.21877923607826233, 0.5237747430801392, 0.4114041328430176, -0.17274799942970276, -0.19298580288887024, -0.141346737742424, -0.1305220127105713, -0.20217490196228027, -0.08178775012493134, 0.07249362766742706, 0.27109113335609436, 0.015193321742117405, -0.13135521113872528, 0.11923176795244217, 0.10406512767076492, -0.2806015908718109, 0.20775650441646576, 0.023083865642547607, 0.1774360090494156, 0.42438212037086487, -0.03946856036782265, 0.3793511986732483, -0.15649159252643585, -0.1212000623345375, -0.1347261667251587, 0.06519797444343567, -0.056550294160842896, -0.06788520514965057, -0.08089173585176468, 0.12515006959438324, -0.20391489565372467, -0.17859189212322235, 0.04739784076809883, -0.2394588142633438, 0.0787297710776329, 0.17190702259540558, -0.03317960351705551, -0.2729647755622864, -0.21946443617343903, -0.11001894623041153, 0.37966346740722656, 0.48746228218078613, 0.02616734430193901, 0.11531002819538116, 0.0035130432806909084, 0.2646564543247223, -0.07321915775537491, 0.1802254319190979, -0.12090088427066803, -0.07135731726884842, -0.1359378844499588, -0.06194508075714111, 0.3076281249523163, -0.2976306080818176, -0.5112085938453674, 0.3652976453304291, -0.1752229928970337, 0.28793227672576904, 0.11415968835353851, 0.48756471276283264, -0.0744924321770668, -0.0563025027513504, -0.1073799729347229, 0.42556798458099365, -0.09595408290624619, -0.00016200728714466095, -0.04645782336592674, -0.13848651945590973, 0.29902195930480957, 0.30444204807281494, -0.33514404296875, -0.34664446115493774, -0.1255468726158142, 0.48048773407936096, 0.24641695618629456, 0.04367430880665779, -0.011147341690957546, -0.039805322885513306, 0.15137417614459991, 0.18858924508094788, 0.1793564260005951, 0.10053233057260513, -0.6269553303718567, 0.3404427468776703, 0.42796066403388977, -0.19591845571994781, 0.12495633959770203, -0.1313944309949875, -0.0839979276061058, 0.40969136357307434, -0.42742079496383667, 0.049688439816236496, -0.12986606359481812, 0.015734989196062088, 0.07533130049705505, 0.12654346227645874, -0.03101075068116188, 0.36346277594566345, -0.3798765242099762, -0.025650963187217712, -0.42432183027267456, 0.0024560298770666122, -0.03138386458158493, 0.0943046510219574, -0.06888863444328308, 0.034809984266757965, -0.06420568376779556, 0.1736561357975006, -0.14350271224975586, 0.004784874618053436, -0.058877673000097275, 0.2665623426437378, -0.3712410032749176, 0.3304980993270874, -0.09050844609737396, -0.23201356828212738, 0.34799253940582275, -0.03198825195431709, 0.20697332918643951, -0.3664494454860687, -0.17867067456245422, -0.08675359189510345, 0.24994677305221558, 0.3072047233581543, -0.28338080644607544, 0.005166752263903618, 0.3109400272369385, 0.0022981874644756317, -0.11838554590940475, 0.10765421390533447, 0.30744028091430664, -0.40993058681488037, 0.40755218267440796, -0.0023179352283477783, -0.1030956357717514, 0.3196440041065216, 0.43132928013801575, -0.03856752812862396, 0.06611890345811844, 0.2227552831172943, -0.03397274762392044, -0.28126245737075806, 0.11848318576812744, 0.04775435850024223, 0.4221611022949219, 0.055551692843437195, 0.06428387761116028, -0.0343741700053215, -0.1587568074464798, -0.2488710880279541, 0.01765073835849762, 0.03163047134876251, -0.13451501727104187, 0.018116600811481476, 0.30126428604125977, 0.041006747633218765, -0.13610562682151794, -0.07707340270280838, -0.258537620306015, 0.001104447990655899, -0.17653504014015198, 0.387210875749588, -0.18100044131278992, -0.06013002619147301, -0.03403722867369652, 0.2721557915210724, -0.021457362920045853, -0.2871585786342621, -0.27090877294540405, 0.24761149287223816, 0.06433415412902832, 0.1969974786043167, -0.07666444033384323, 0.435992956161499, 0.24971212446689606, -0.14187666773796082, -0.5237749218940735, -0.35031890869140625, -0.2503252625465393, -0.07567901909351349, 0.48445799946784973, 0.015611197799444199, 0.2967661917209625, -0.10854225605726242, -0.140314519405365, -0.1796000450849533, -0.25064364075660706, -0.12749861180782318, 0.017256949096918106, 0.04516667127609253, 0.29511603713035583, 0.355490505695343, 0.03950314223766327, 0.017509199678897858, 0.33238449692726135, -0.3980081081390381, -0.03125815838575363, 0.13183660805225372, -0.09142832458019257, -0.10973896831274033, -0.0458068810403347, -0.17449653148651123, -0.23363085091114044, -0.3324286639690399, 0.2874191999435425, 0.0023078694939613342, -0.1898968666791916, 0.005664261989295483, 0.22430889308452606, 0.014611016027629375, -0.025769690051674843, 0.18165725469589233, -0.1461416631937027, -0.36022713780403137, 0.3221205174922943, 0.0719086080789566, -0.37564617395401, 0.24184542894363403, 0.060147881507873535, -0.11281174421310425, 0.05817493423819542, -0.7062675356864929, 0.12967582046985626, -0.43285083770751953, 0.24164080619812012, -0.07251551747322083, -0.10072547197341919, 0.03256858512759209, -0.03726368024945259, 0.19857943058013916, -0.03701246529817581, -0.1848253607749939, 0.2013394683599472, 0.16530796885490417, 0.17040187120437622, 0.004314560443162918, 0.3262915313243866, -0.10024832934141159, 0.08634509146213531, 0.159725159406662, -0.3951861560344696, 0.08315235376358032, 0.15210731327533722, 0.1763807237148285, -0.3660549223423004, -0.17596496641635895, 0.24631889164447784, -0.09792506694793701, -0.07313776761293411, 0.007319614291191101, 0.20077970623970032, -0.11154323071241379, -0.15782541036605835, -0.16444317996501923, 0.022339433431625366, -0.28304755687713623, 0.24756401777267456, -0.22318366169929504, -0.023522421717643738, 0.10360434651374817, 0.20193016529083252, -0.091866135597229, -0.3855847120285034, 0.15947329998016357, 0.27905189990997314, 0.12392006814479828, -0.04123366251587868, -0.10118046402931213, 0.08587381988763809, -0.5676045417785645, 0.1599539816379547, -0.1350899040699005, 0.3413596749305725, -0.2437056601047516, -0.26360228657722473, 0.34892600774765015, -0.36345353722572327, 0.31712156534194946, -0.1253145933151245, 0.16674059629440308, 0.13086393475532532, 0.11004374921321869, -0.3096713721752167, 0.009259935468435287, 0.14176829159259796, 0.009443290531635284, -0.010749869048595428, -0.1293960064649582, -0.07368157804012299, -0.2889239192008972, 0.13172855973243713, 0.4736986458301544, -0.21584422886371613, -0.3373739421367645, -0.26729175448417664, -0.4700453579425812, 0.04238521307706833, -0.09529361873865128, 0.024665093049407005, 0.06971899420022964, -0.009660536423325539, -0.25310391187667847, -0.28627705574035645, 0.1097845509648323, -0.13280048966407776, 0.2001914232969284, -0.10023506730794907, -0.2077770233154297, 0.570796012878418, 0.08007732778787613, 0.3530791401863098, 0.14940305054187775, 0.443450927734375, -0.17777104675769806, -0.12787508964538574, 0.14237888157367706, -0.09387946873903275, -0.18630194664001465, 0.39020854234695435, -0.13914963603019714, 0.25316980481147766, -0.00965244323015213, 0.06904350221157074, -0.6373658180236816, 0.04522665590047836, 0.36719751358032227, 0.39678528904914856, -0.1709006130695343, -0.5468169450759888, 0.3757469058036804, -0.18055792152881622, -0.1273401975631714, 0.5919063687324524, -0.1817198544740677, 0.04472910612821579, 0.31824392080307007, -0.00970759242773056, 0.8222500681877136, -0.22637902200222015, 0.20636314153671265, 0.28686097264289856, -0.3700847029685974, 0.27725568413734436, -0.1845342516899109, 0.1632554829120636, -0.3162010908126831, -0.1719796061515808, 0.04097266495227814, -0.24954383075237274, 0.1967928111553192, -0.09945255517959595, 0.0012410953640937805, -0.10722742229700089, -0.09810606390237808, 0.3655864894390106, -0.0001595616340637207, 0.3852158188819885, -0.3620051145553589, -0.1704656332731247, -0.5309045910835266, 0.15225888788700104, 0.020022232085466385, 0.24442963302135468, -0.1364976167678833, 0.17529048025608063, 0.06780725717544556, -0.21171170473098755, -0.2962690591812134, 0.30122843384742737, -0.0013357950374484062, 0.046413127332925797, -0.06376223266124725, -0.24703183770179749, 0.2188769429922104, 0.4304666817188263, -0.16374678909778595, 0.033693812787532806, -0.10284793376922607, 0.7485913634300232, -0.27240854501724243, 0.17387695610523224, 0.2712717056274414, -0.23321844637393951, -0.144242525100708, -0.051072798669338226, -0.16041846573352814, -0.07121989876031876, -0.0007756985723972321, -0.260155588388443, 0.14592579007148743, 0.2703854441642761, 0.564808189868927, -0.18824298679828644, -0.00360316876322031, -0.08774273097515106, 0.12101942300796509, -0.11121039092540741, 0.1041424423456192, 0.14633862674236298, -0.01825311779975891, 0.3274954855442047, -0.33613836765289307, -0.1920398771762848, -0.01241915300488472, 0.5023832321166992, -0.3017040491104126, -0.1932247132062912, 0.3095402717590332, 0.45339906215667725, -0.19174548983573914, -0.24116253852844238, 0.33218181133270264, -0.12602320313453674, -0.5803343653678894, -0.10530605912208557, -0.005001110024750233, 0.06262511014938354, 0.07703465223312378, 0.1977042853832245, -0.1113673597574234, -0.21876099705696106, 0.10563920438289642, -0.4630463123321533, -0.10486167669296265, -0.07707618176937103, 0.10828326642513275, 0.0873890221118927, -0.08226330578327179, -0.1747303158044815, 0.04769203066825867, 0.18107132613658905, -0.19696012139320374, -0.16035349667072296, -0.39194899797439575, -0.16061359643936157, -0.02839307114481926, -0.20418724417686462, 0.4379156529903412, -0.14518940448760986, 0.0815126970410347, -0.046261876821517944, -0.07135487347841263, -0.13322970271110535, -0.0742686539888382, 0.17395608127117157, -0.2750215232372284, 0.15519393980503082, -0.022278398275375366, -0.4247601628303528, 0.062180664390325546, -0.1900726854801178, 0.2742907702922821, 0.10231830924749374, -0.2706618309020996, -0.3433067202568054, 0.168179452419281, 0.33476579189300537, -0.16782580316066742, 0.43039849400520325, -0.29462945461273193, 0.2024211585521698, 0.10888733714818954, 0.001363314688205719, 0.3464517295360565, 0.1767377257347107, 0.16767634451389313, 0.13435016572475433, 0.08156504482030869, -0.372060626745224, 0.50466388463974, -0.07085587084293365, -0.04262864962220192, -0.021114975214004517, 0.20405521988868713, 0.5800780653953552, -0.1265123337507248, -0.04620260000228882, 0.03418942168354988, 0.1308935135602951, -0.19573849439620972, -0.012791600078344345, 0.2549334466457367, 0.10617595911026001, -0.15897591412067413, 0.00995028018951416, 0.035657260566949844, -0.38876843452453613, -0.32963061332702637, 0.2787931263446808, 0.5923911929130554, 0.047132305800914764, -0.0348825640976429, 0.14919738471508026, 0.05153487250208855, 0.03308306634426117, -0.051666975021362305, 0.17524556815624237, 0.016932666301727295, 0.29902195930480957, 0.010085754096508026, 0.2608851194381714, 0.09749700129032135, 0.560422420501709, -0.0856558308005333, -0.4642226994037628, -0.03936147317290306, 0.06079132854938507, -0.25852465629577637, -0.14813494682312012, 0.006894208490848541, 0.2683901786804199, 0.10128676891326904, -0.38110172748565674, -0.2405940443277359, 0.23091645538806915, -0.09553059190511703, -0.11373716592788696, 0.025292057543992996, 0.15089541673660278, -0.1216525062918663, -0.0627790093421936, 0.10000700503587723, -0.004077017307281494, 0.36876180768013, 0.2225600630044937, 0.24264593422412872, -0.27206796407699585, -0.27622294425964355, -0.005029443651437759, 0.03631628677248955, -0.23324696719646454, 0.2750026285648346, 0.38185369968414307, -0.008388705551624298, 0.13568171858787537, -0.19569070637226105, 0.29831454157829285, 0.26111865043640137, -0.2424527406692505, 0.4361236095428467, 0.1222791075706482, -0.08154873549938202, -0.10303815454244614, 0.3109349012374878, -0.03984643518924713, 0.08593198657035828, 0.3096182644367218, 0.05305979400873184, -0.054766807705163956, 0.09552313387393951, -0.2597993314266205, 0.30145373940467834, -0.4650439918041229, 0.27647027373313904, -0.17140111327171326, -0.07430543005466461, -0.3317969739437103, 0.32203271985054016, -0.22043803334236145, -0.11700072884559631, 0.2977379262447357, -0.09642834961414337, -0.03451531380414963, -0.28907036781311035, 0.037510138005018234, -0.16119709610939026, 0.7567853331565857, 0.039815809577703476, 0.6107361316680908, -0.22095488011837006, -0.40348291397094727, -0.337128221988678, 0.13596463203430176, -0.4755755662918091, -0.1513996124267578, -0.06744693964719772, 0.14466463029384613, 0.009095199406147003, -0.010021395981311798, 0.08107523620128632, 0.19680435955524445, 0.24502405524253845, 0.2785922586917877, -0.24301275610923767, -0.3087556064128876, 0.2977903485298157, 0.033449266105890274, -0.2952660322189331, -0.4027048647403717, 0.2470272183418274, -0.09565792232751846, -0.011822029948234558, -0.2721870541572571, -0.2715946435928345, 0.22236943244934082, -0.0003840252757072449, 0.39267000555992126, 0.0913882777094841, 0.34539705514907837, 0.16480737924575806, -0.29333779215812683, -0.3362785875797272, -0.37998461723327637, 0.15242443978786469, -0.038266777992248535, -0.17765390872955322, -0.0026320796459913254, -0.17539557814598083, 0.2606279253959656, -0.18145844340324402, -0.14544202387332916, -0.1502985656261444, -0.013577173464000225, -0.23263956606388092, -0.045805834233760834, -0.17305094003677368, 0.6169850826263428, 0.15082891285419464, 0.11062996089458466, 0.018801014870405197, -0.13474591076374054, -0.08936425298452377, 0.06935179233551025, 0.4097009301185608, -0.3756684362888336, -0.2207319289445877, -0.07677002251148224, 0.2450217604637146, -0.456983745098114, 0.13460177183151245, -0.41975274682044983, -0.027586504817008972, 0.1612679362297058, 0.02224891446530819, -0.27057817578315735, 0.2834652364253998, 0.2668406367301941, 0.10239788889884949, -0.16871339082717896, -0.00956389307975769, -0.07326516509056091, 0.05715898424386978, -0.03133431077003479, -0.3462451696395874 ]
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.
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).
[ -0.32367029786109924, -0.1406785398721695, 0.03590309992432594, 0.10654602944850922, 0.2100633829832077, 0.1854037046432495, 0.5049698352813721, -0.01526910811662674, 0.6805390119552612, 0.01739136129617691, 0.11339011043310165, 0.14148923754692078, 0.3411608040332794, 0.0357728973031044, 0.10766806453466415, -0.0740680992603302, 0.1755032241344452, 0.06500934809446335, 0.11135515570640564, 0.12299908697605133, -0.15375754237174988, -0.06267444789409637, -0.20326995849609375, -0.10948066413402557, -0.17249314486980438, 0.0654681995511055, -0.140904501080513, -0.13770046830177307, -0.008265476673841476, -0.34243547916412354, 0.6133220791816711, 0.07524394989013672, 0.059822745621204376, 0.10568729788064957, -0.00011708333477145061, -0.06142262741923332, 0.31054800748825073, 0.2061033844947815, -0.49345123767852783, -0.12915228307247162, -0.34035730361938477, -0.07774028927087784, 0.38445010781288147, 0.12493506819009781, -0.06349131464958191, 0.2237713634967804, 0.04863099008798599, -0.48409393429756165, 0.49625831842422485, 0.034611884504556656, 0.1647864729166031, 0.22745470702648163, -0.07678616046905518, -0.1452101469039917, 0.16839176416397095, -0.03624987602233887, -0.12573902308940887, 0.08615009486675262, 0.37537503242492676, 0.002331946976482868, -0.14728543162345886, 0.14742739498615265, -0.13316579163074493, 0.1707276552915573, 0.31093794107437134, -0.024803895503282547, -0.16181844472885132, -0.18617108464241028, 0.33049431443214417, 0.22323182225227356, 0.7000970840454102, 0.022508811205625534, -0.05387619882822037, -0.11541777849197388, 0.3508508503437042, -0.12922531366348267, 0.3591550290584564, 0.2613900303840637, -0.19166377186775208, 0.1880098283290863, 0.10377747565507889, 0.14163422584533691, -0.19735924899578094, 0.0859350934624672, -0.0839826762676239, 0.1825583279132843, 0.08699303865432739, 0.40625059604644775, -0.002096794545650482, -0.0429457426071167, 0.26004043221473694, -0.231667160987854, -0.15876148641109467, -0.08955515921115875, -0.7735292911529541, 0.3834783136844635, 0.12426068633794785, 0.4892314374446869, -0.06194669008255005, 0.13566100597381592, 0.04594247788190842, -0.03246472030878067, 0.45454275608062744, 0.0708259791135788, 0.3122713267803192, -0.11618097126483917, -0.08859256654977798, -0.2530047595500946, 0.0495830699801445, 0.11989183723926544, -0.3081417679786682, -0.009871594607830048, -0.10560433566570282, -0.054235413670539856, 0.11689774692058563, -0.43160712718963623, 0.3338158130645752, -0.19977740943431854, -0.3352706730365753, 0.1661967784166336, -0.3241352140903473, 0.12086056172847748, 0.24856875836849213, 0.5592695474624634, -0.2294207364320755, 0.52080899477005, 0.4289565086364746, -0.129762664437294, -0.17997512221336365, -0.17009657621383667, -0.12134388834238052, -0.200601726770401, -0.018657293170690536, 0.09946578741073608, 0.2541000545024872, -0.0022341571748256683, -0.13540145754814148, 0.09908147901296616, 0.16600234806537628, -0.2515767216682434, 0.24321770668029785, 0.036623578518629074, 0.1911279261112213, 0.4280683398246765, 0.00999615341424942, 0.3432502746582031, -0.14545778930187225, -0.1374593824148178, -0.11671478301286697, 0.03532436490058899, -0.04312742501497269, -0.06878984719514847, -0.08890791982412338, 0.12955830991268158, -0.180207759141922, -0.20243917405605316, 0.031249836087226868, -0.250539094209671, 0.03955371677875519, 0.17484013736248016, -0.04358305782079697, -0.26013994216918945, -0.18478550016880035, -0.10323765128850937, 0.3781696557998657, 0.46660923957824707, 0.05241541191935539, 0.0974157452583313, -0.03971370682120323, 0.28392836451530457, -0.10913462191820145, 0.2211911678314209, -0.07872916013002396, -0.11581290513277054, -0.10090184956789017, -0.030825771391391754, 0.34545597434043884, -0.28544968366622925, -0.504412829875946, 0.36295774579048157, -0.14545142650604248, 0.3144253194332123, 0.13135837018489838, 0.4736660122871399, -0.02137414738535881, -0.05152538791298866, -0.05099238455295563, 0.4164677858352661, -0.10356856882572174, -0.007896492257714272, -0.04059576615691185, -0.14580564200878143, 0.24561017751693726, 0.3274378776550293, -0.3702144920825958, -0.32684001326560974, -0.11640726774930954, 0.4098227024078369, 0.256806880235672, 0.014374978840351105, 0.000008818693459033966, -0.07266070693731308, 0.18733514845371246, 0.21922610700130463, 0.18229500949382782, 0.07367867976427078, -0.5963186025619507, 0.3207979202270508, 0.40024280548095703, -0.13647648692131042, 0.10930679738521576, -0.12663650512695312, -0.07795490324497223, 0.39262068271636963, -0.414160817861557, 0.1139889508485794, -0.11676418781280518, -0.01528208702802658, 0.05675226077437401, 0.1288895159959793, -0.03765185922384262, 0.42015814781188965, -0.38937392830848694, -0.011054407805204391, -0.44679224491119385, -0.0011632591485977173, -0.042402587831020355, 0.0698637068271637, -0.012045560404658318, 0.02387697622179985, -0.07591397315263748, 0.17290158569812775, -0.15939652919769287, 0.00976395234465599, -0.08914723992347717, 0.2666228413581848, -0.36748307943344116, 0.3158028721809387, -0.08719298988580704, -0.2561814486980438, 0.3713500499725342, -0.022368669509887695, 0.1938970685005188, -0.3713698983192444, -0.1681850254535675, -0.08978423476219177, 0.2856222093105316, 0.3062305450439453, -0.265523225069046, 0.014143986627459526, 0.3131597638130188, 0.02594941481947899, -0.15302494168281555, 0.10619689524173737, 0.2951350212097168, -0.44607922434806824, 0.3661515414714813, -0.014015914872288704, -0.11630445718765259, 0.3038075864315033, 0.43674492835998535, -0.0682263895869255, 0.07975773513317108, 0.23212581872940063, -0.030758969485759735, -0.2740025818347931, 0.1319303661584854, 0.002193879336118698, 0.444155752658844, 0.05159064754843712, 0.07643568515777588, -0.019822606816887856, -0.14461493492126465, -0.2728829085826874, 0.02799498289823532, 0.033123720437288284, -0.12793585658073425, -0.05429183691740036, 0.27598434686660767, 0.03071475587785244, -0.1453685164451599, -0.10037536919116974, -0.3177916407585144, 0.026686307042837143, -0.19670043885707855, 0.3982963263988495, -0.16596971452236176, -0.08776897192001343, -0.0065939826890826225, 0.22906264662742615, -0.04391300305724144, -0.2918352484703064, -0.282371461391449, 0.26110777258872986, 0.053399790078401566, 0.18322210013866425, -0.08135408908128738, 0.4085535705089569, 0.2840080261230469, -0.1123829260468483, -0.5522743463516235, -0.3263278603553772, -0.2779591977596283, -0.05769128352403641, 0.4875047206878662, 0.04647798091173172, 0.2847514748573303, -0.1043798103928566, -0.1404135525226593, -0.15788479149341583, -0.24716421961784363, -0.1466149538755417, -0.007172159850597382, 0.03532931208610535, 0.2766059637069702, 0.41975510120391846, 0.013751856982707977, 0.023818813264369965, 0.32869723439216614, -0.35712793469429016, -0.020067935809493065, 0.15294216573238373, -0.10414144396781921, -0.10177505016326904, -0.013769719749689102, -0.23090478777885437, -0.22851161658763885, -0.36055585741996765, 0.3211286664009094, -0.002428114414215088, -0.1535341590642929, -0.011620604433119297, 0.2502032518386841, 0.037013620138168335, -0.030442139133810997, 0.18068274855613708, -0.14438574016094208, -0.3804858922958374, 0.35940879583358765, 0.06835097074508667, -0.392974853515625, 0.23654130101203918, 0.08723700791597366, -0.10634957253932953, 0.061140406876802444, -0.7024459838867188, 0.12062650173902512, -0.4319378137588501, 0.21740567684173584, -0.07969388365745544, -0.11546261608600616, 0.008903585374355316, -0.05583306774497032, 0.1736880987882614, -0.05030776187777519, -0.15981028974056244, 0.16702041029930115, 0.22480395436286926, 0.13284072279930115, 0.01713445782661438, 0.34478944540023804, -0.10205725580453873, 0.07167691737413406, 0.20875248312950134, -0.3875351846218109, 0.12891925871372223, 0.1812562346458435, 0.18054869771003723, -0.35699188709259033, -0.1619872897863388, 0.22263625264167786, -0.09942173957824707, -0.0550847090780735, 0.0013429522514343262, 0.20514410734176636, -0.1508261114358902, -0.1991596221923828, -0.1340353935956955, 0.03151863068342209, -0.2839393615722656, 0.24737773835659027, -0.26745668053627014, -0.034156233072280884, 0.10838207602500916, 0.19385701417922974, -0.08036443591117859, -0.3757625222206116, 0.1481858491897583, 0.2775505781173706, 0.09854483604431152, -0.04121853783726692, -0.06203961744904518, 0.05681699514389038, -0.5902972221374512, 0.20668262243270874, -0.09559787809848785, 0.3654232621192932, -0.2584359049797058, -0.21940827369689941, 0.3419152796268463, -0.3424951732158661, 0.27383291721343994, -0.18792547285556793, 0.14162912964820862, 0.13868282735347748, 0.19454874098300934, -0.3201374411582947, 0.06476691365242004, 0.09550303220748901, -0.03371419385075569, 0.03963058441877365, -0.12405270338058472, -0.11526583135128021, -0.2979392409324646, 0.10026133060455322, 0.4429114758968353, -0.2038533091545105, -0.31185609102249146, -0.3071831166744232, -0.49534380435943604, 0.048493459820747375, -0.0879165306687355, 0.03041321597993374, 0.03806857019662857, -0.027541261166334152, -0.2590999901294708, -0.22728033363819122, 0.14827892184257507, -0.1180025041103363, 0.1965189278125763, -0.11813650280237198, -0.17702330648899078, 0.5200299620628357, 0.10008454322814941, 0.35610759258270264, 0.14633962512016296, 0.4789842963218689, -0.12169533967971802, -0.1925821304321289, 0.10582558810710907, -0.046868760138750076, -0.185368150472641, 0.36744385957717896, -0.07147123664617538, 0.2461099922657013, 0.05679246410727501, 0.09431355446577072, -0.5865621566772461, 0.07415210455656052, 0.4055168926715851, 0.3769993185997009, -0.1424083560705185, -0.5626736879348755, 0.3905680477619171, -0.19434916973114014, -0.11035052686929703, 0.623847246170044, -0.14300993084907532, 0.06844503432512283, 0.32933610677719116, -0.024855196475982666, 0.8391499519348145, -0.22718574106693268, 0.21614404022693634, 0.3566805124282837, -0.45256268978118896, 0.27292758226394653, -0.18706323206424713, 0.15026961266994476, -0.2633911371231079, -0.15754695236682892, 0.041577599942684174, -0.22778081893920898, 0.23205283284187317, -0.10799697041511536, -0.049477942287921906, -0.12251152843236923, -0.0671292096376419, 0.34602153301239014, 0.059536658227443695, 0.4075786769390106, -0.4106326401233673, -0.17200623452663422, -0.5553485155105591, 0.16429686546325684, -0.002647433429956436, 0.18864582479000092, -0.11126440018415451, 0.15534093976020813, 0.05068787559866905, -0.20270493626594543, -0.2848564386367798, 0.3170759379863739, 0.008075743913650513, 0.033881887793540955, -0.12815988063812256, -0.23130561411380768, 0.25348156690597534, 0.4133738875389099, -0.22461964190006256, -0.02120089903473854, -0.10617217421531677, 0.7579583525657654, -0.26556214690208435, 0.19612333178520203, 0.2855052649974823, -0.23836317658424377, -0.1256852149963379, -0.056448794901371, -0.20819801092147827, -0.016019336879253387, 0.015728533267974854, -0.24819636344909668, 0.13981473445892334, 0.2688460350036621, 0.5626096129417419, -0.20303279161453247, 0.04587807506322861, -0.10864768922328949, 0.1254456639289856, -0.08375858515501022, 0.10559174418449402, 0.1564798802137375, -0.019486254081130028, 0.3348220884799957, -0.31352072954177856, -0.19107668101787567, -0.03624479100108147, 0.49735772609710693, -0.3088112473487854, -0.17373140156269073, 0.32574087381362915, 0.44793087244033813, -0.1791689246892929, -0.23901739716529846, 0.3184434771537781, -0.1797446310520172, -0.4912157952785492, -0.1164456382393837, 0.013711165636777878, 0.08336435258388519, 0.020600344985723495, 0.13852930068969727, -0.12387359142303467, -0.20916837453842163, 0.10349087417125702, -0.4428996443748474, -0.08239155262708664, -0.06068381667137146, 0.14693009853363037, 0.09940296411514282, -0.1009078323841095, -0.2185637205839157, 0.06571651250123978, 0.18131788074970245, -0.1996729075908661, -0.1638435274362564, -0.35785868763923645, -0.15262751281261444, -0.030040543526411057, -0.2116730511188507, 0.4657903015613556, -0.1566251516342163, 0.08903510123491287, -0.0507378876209259, -0.09843799471855164, -0.13876542448997498, -0.06318330764770508, 0.17524178326129913, -0.25544077157974243, 0.10765129327774048, -0.049159593880176544, -0.4246838688850403, 0.0694974809885025, -0.18240495026111603, 0.28253602981567383, 0.0674683004617691, -0.30531322956085205, -0.37693482637405396, 0.17536494135856628, 0.3103262186050415, -0.19751931726932526, 0.4040490388870239, -0.3010238707065582, 0.18070653080940247, 0.10452449321746826, 0.002240348607301712, 0.33627888560295105, 0.14922837913036346, 0.19881762564182281, 0.13870471715927124, 0.11210028827190399, -0.3606087565422058, 0.543907880783081, -0.0776948630809784, -0.05796345695853233, -0.054715752601623535, 0.20714135468006134, 0.5676324367523193, -0.08601837605237961, -0.0684795081615448, 0.014932360500097275, 0.13961289823055267, -0.1709633767604828, -0.004009070340543985, 0.255380243062973, 0.09329517185688019, -0.15396837890148163, -0.029543645679950714, -0.02640540711581707, -0.38200655579566956, -0.35226577520370483, 0.26544877886772156, 0.5678746700286865, 0.09619402140378952, -0.020522821694612503, 0.06779161840677261, 0.04248921200633049, -0.006548028439283371, -0.07142745703458786, 0.1138601303100586, 0.05151370167732239, 0.2848186492919922, 0.02262309566140175, 0.2583228051662445, 0.04684813320636749, 0.5493495464324951, -0.0873207077383995, -0.48251205682754517, -0.09266746044158936, 0.05000113695859909, -0.2644369900226593, -0.09747032076120377, 0.053197216242551804, 0.3223128914833069, 0.0864834114909172, -0.3687237501144409, -0.2558957636356354, 0.19201667606830597, -0.07517748326063156, -0.07179421186447144, -0.01572480984032154, 0.14596855640411377, -0.11600985378026962, -0.08811385929584503, 0.13616220653057098, 0.019266899675130844, 0.36781880259513855, 0.24644920229911804, 0.22921903431415558, -0.2695080637931824, -0.3051702082157135, -0.01003015786409378, 0.048165008425712585, -0.22226840257644653, 0.2513565421104431, 0.43909674882888794, -0.045153893530368805, 0.13408297300338745, -0.1900806576013565, 0.3210205137729645, 0.24401535093784332, -0.2419658601284027, 0.48500725626945496, 0.1498759239912033, -0.09861546009778976, -0.10069239884614944, 0.27097535133361816, -0.031961649656295776, 0.07504473626613617, 0.3134238123893738, 0.06749128550291061, -0.07089318335056305, 0.04820027947425842, -0.277218759059906, 0.3084588050842285, -0.4821346402168274, 0.283382773399353, -0.20708347856998444, -0.08549028635025024, -0.3419544994831085, 0.2573605179786682, -0.2510935962200165, -0.05715729296207428, 0.26196396350860596, -0.12118608504533768, -0.05108662694692612, -0.28555363416671753, 0.035780228674411774, -0.16013459861278534, 0.7740055918693542, 0.06392224133014679, 0.6008002758026123, -0.20959274470806122, -0.42096447944641113, -0.34100645780563354, 0.14125820994377136, -0.4831521511077881, -0.14356869459152222, -0.06486301124095917, 0.17234443128108978, 0.03648896515369415, -0.023051902651786804, 0.07448726892471313, 0.16670385003089905, 0.18433858454227448, 0.28185927867889404, -0.2855723202228546, -0.33064234256744385, 0.30472442507743835, 0.06576089560985565, -0.3036661148071289, -0.4068671464920044, 0.2636781930923462, -0.09526191651821136, -0.009420022368431091, -0.2569139003753662, -0.2840813100337982, 0.21657545864582062, -0.05486547201871872, 0.42392459511756897, 0.11594750732183456, 0.3394806385040283, 0.1434234380722046, -0.32897451519966125, -0.29334285855293274, -0.3463488817214966, 0.1598334014415741, -0.05262342840433121, -0.2066013365983963, 0.07056137174367905, -0.17075775563716888, 0.22064870595932007, -0.17772755026817322, -0.06325162202119827, -0.13295847177505493, -0.06531994044780731, -0.2082810252904892, -0.028645820915699005, -0.18425253033638, 0.6162384152412415, 0.12240727245807648, 0.0978870689868927, 0.008556336164474487, -0.13458338379859924, -0.10478585958480835, 0.08597011119127274, 0.4295746386051178, -0.3767775297164917, -0.2269565761089325, -0.0910511240363121, 0.2726747989654541, -0.4391329884529114, 0.1401270180940628, -0.3948999345302582, -0.001281730830669403, 0.17496049404144287, 0.03371449187397957, -0.27942076325416565, 0.2744812071323395, 0.26934128999710083, 0.08226406574249268, -0.17614729702472687, 0.02048179879784584, -0.0736083984375, 0.03393600881099701, 0.029312212020158768, -0.32761847972869873 ]
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
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.
[ -0.21935895085334778, -0.31487125158309937, 0.06531679630279541, 0.3223288655281067, 0.29418671131134033, -0.19984403252601624, 0.21879905462265015, -0.057646024972200394, -0.08462768793106079, -0.013216361403465271, -0.3229539692401886, -0.06117996200919151, 0.4231877326965332, 0.3672679364681244, 0.16207340359687805, -0.14923404157161713, -0.0989697054028511, -0.1788976788520813, -0.12950846552848816, 0.10980243980884552, -0.30403193831443787, 0.368655264377594, -0.08796714246273041, 0.0012359470129013062, -0.08175306767225266, 0.3536854684352875, -0.20472469925880432, 0.3785621225833893, 0.12363719195127487, -0.13532741367816925, 0.6031814813613892, 0.3583618700504303, 0.1949320286512375, 0.18696890771389008, -0.00011897735384991392, 0.3225939869880676, 0.4397277235984802, -0.022785719484090805, -0.3661191165447235, -0.27511781454086304, -0.4720534384250641, -0.19201134145259857, 0.008742459118366241, 0.04332906752824783, -0.1365279108285904, -0.009691634215414524, -0.10557697713375092, -0.05593119189143181, 0.24870717525482178, 0.19582706689834595, 0.15927442908287048, 0.5668259859085083, 0.026543553918600082, -0.12551474571228027, 0.0992651954293251, 0.11436757445335388, -0.09025076031684875, -0.01569095253944397, 0.20566138625144958, 0.28077006340026855, 0.16307686269283295, 0.17966614663600922, -0.1528872400522232, 0.045079514384269714, 0.3748367726802826, 0.045542992651462555, -0.021455496549606323, -0.24504244327545166, 0.11591994017362595, 0.3286697268486023, 0.4840281307697296, -0.38049617409706116, -0.23981787264347076, -0.2683376669883728, -0.06610246747732162, 0.0783616304397583, 0.4096699655056, 0.1375713348388672, -0.2322026640176773, 0.06662705540657043, -0.1498076170682907, -0.3307597041130066, 0.025347962975502014, 0.12547902762889862, 0.18404105305671692, 0.056497324258089066, -0.1946098953485489, 0.17094546556472778, -0.06396512687206268, -0.08230796456336975, -0.004896523430943489, -0.6193797588348389, 0.09019215404987335, 0.05302831158041954, -0.22490091621875763, 0.11877210438251495, 0.031713828444480896, 0.49939781427383423, 0.1810729205608368, 0.47401249408721924, -0.157704696059227, 0.21912434697151184, -0.09520477801561356, 0.19665443897247314, 0.13261328637599945, -0.1274862289428711, 0.06450460106134415, 0.11076758801937103, 0.18597663938999176, 0.5338066816329956, 0.09074527025222778, -0.11295782774686813, 0.30137649178504944, -0.1138986274600029, -0.33917009830474854, -0.39778661727905273, 0.2559727430343628, -0.137946218252182, -0.09196726977825165, 0.0773976519703865, -0.06605656445026398, -0.1716901808977127, 0.2965271770954132, 0.4534708261489868, -0.3127278685569763, 0.15587294101715088, 0.18166933953762054, 0.22015300393104553, -0.1931382715702057, -0.08049896359443665, -0.23798437416553497, -0.21887297928333282, 0.02896130457520485, 0.3515828549861908, 0.16149309277534485, -0.43648555874824524, 0.3304908573627472, 0.14914867281913757, 0.23647429049015045, 0.027036234736442566, -0.0004902463406324387, -0.009743073023855686, -0.014320768415927887, 0.3174170255661011, 0.06757889688014984, 0.006064275279641151, 0.06995842605829239, -0.1892005056142807, -0.0592760294675827, -0.11573856323957443, -0.21772471070289612, -0.20417524874210358, 0.04425807669758797, 0.07870440930128098, -0.17647437751293182, -0.001241583377122879, -0.3184066414833069, 0.047979243099689484, 0.044674333184957504, 0.05776577070355415, -0.07091736048460007, 0.024035904556512833, -0.1628660261631012, -0.043538279831409454, 0.5825130939483643, 0.5188955068588257, 0.25965094566345215, -0.356110543012619, 0.05796514451503754, -0.40229490399360657, 0.2108648419380188, -0.10534235835075378, -0.014560076408088207, -0.07838236540555954, -0.266653448343277, -0.14752644300460815, 0.22189399600028992, -0.5190544128417969, -0.3013659715652466, 0.38504940271377563, 0.1656600534915924, 0.23407281935214996, 0.12991958856582642, -0.051611028611660004, -0.14104808866977692, 0.06327927857637405, -0.0632358193397522, 0.31696033477783203, 0.0027294084429740906, 0.02296994812786579, -0.17696985602378845, -0.3150429427623749, -0.29271185398101807, 0.25981688499450684, 0.05321051552891731, 0.526107668876648, -0.09633367508649826, -0.2839266359806061, 0.3326626718044281, 0.18570920825004578, 0.13332310318946838, 0.08262208849191666, 0.05761727690696716, 0.5053633451461792, 0.16074296832084656, -0.04221959784626961, -0.3039111793041229, 0.1912340521812439, -0.26022976636886597, -0.06930419057607651, -0.07458055019378662, -0.11618345975875854, -0.27536720037460327, -0.07558007538318634, -0.1374761015176773, -0.2718760073184967, 0.02083391323685646, 0.287908136844635, 0.31525343656539917, -0.0394788458943367, 0.002091728150844574, 0.7432488799095154, 0.03158529847860336, 0.2724238336086273, -0.30090898275375366, 0.5123581290245056, 0.18780958652496338, 0.0089146438986063, 0.03740007430315018, 0.1892630159854889, 0.23669442534446716, -0.010127106681466103, -0.0019952701404690742, 0.3964313864707947, -0.10235101729631424, 0.1738089621067047, 0.09602023661136627, -0.18175475299358368, 0.24164171516895294, -0.150348961353302, -0.06009344756603241, 0.025532184168696404, 0.22678011655807495, 0.02101226896047592, 0.07586713135242462, 0.20696938037872314, 0.19885535538196564, 0.48964378237724304, 0.23774610459804535, 0.1487220823764801, 0.12110044062137604, -0.03241657465696335, -0.20323079824447632, -0.0986621081829071, 0.0037382878363132477, -0.09740372002124786, 0.43838831782341003, -0.023681780323386192, -0.38193878531455994, 0.05654957517981529, 0.1749671995639801, 0.17194852232933044, -0.2814909815788269, 0.199245423078537, -0.2268815040588379, 0.17580872774124146, 0.43715235590934753, 0.09575390815734863, 0.29776301980018616, 0.036328453570604324, -0.13986486196517944, 0.3691130578517914, -0.12270157784223557, -0.1940614879131317, 0.2196102887392044, 0.17137259244918823, -0.31178638339042664, -0.24667325615882874, 0.012592198327183723, -0.06615632772445679, -0.26762890815734863, -0.11848476529121399, -0.26007044315338135, -0.21705901622772217, -0.561111569404602, 0.06462579220533371, -0.3082204759120941, -0.2379312813282013, -0.03914059326052666, -0.14753791689872742, -0.18698766827583313, -0.4013139009475708, -0.208402618765831, 0.2813035845756531, 0.06545834243297577, 0.03699929639697075, -0.2104911357164383, 0.1631699800491333, -0.1724753975868225, -0.3887704014778137, -0.2998349666595459, 0.3397118151187897, -0.23130172491073608, -0.034967273473739624, 0.0167292058467865, -0.023304006084799767, 0.10624728351831436, -0.48533862829208374, -0.17850369215011597, -0.29023805260658264, -0.09371891617774963, 0.24843716621398926, 0.0994112491607666, 0.2477327436208725, 0.10500362515449524, -0.04508988559246063, 0.16067752242088318, -0.11780434101819992, 0.48349490761756897, 0.2820099890232086, 0.04998096823692322, 0.08528951555490494, 0.10917064547538757, 0.04137011989951134, -0.13564370572566986, -0.015494942665100098, -0.10581262409687042, -0.20828887820243835, 0.07220280170440674, 0.11139525473117828, 0.004649393260478973, -0.018593456596136093, 0.18192775547504425, 0.14086076617240906, -0.30921438336372375, 0.19864985346794128, -0.26755455136299133, -0.8593419790267944, 0.22196315228939056, -0.05380665510892868, -0.31880176067352295, -0.11154846847057343, -0.006476994603872299, 0.09826713800430298, 0.060972265899181366, -0.49552232027053833, -0.3273468017578125, -0.2972254157066345, 0.3916579484939575, 0.1955132633447647, 0.32566121220588684, 0.010640397667884827, -0.12236882001161575, 0.040560364723205566, -0.18497365713119507, -0.13039633631706238, 0.1785918027162552, -0.30106815695762634, 0.3577449917793274, 0.26504307985305786, 0.1993001401424408, -0.18053846061229706, 0.6675537824630737, 0.39978018403053284, -0.060362618416547775, 0.6682120561599731, -0.1369915008544922, 0.48577219247817993, 0.017809316515922546, -0.2575059235095978, 0.16631798446178436, 0.053921788930892944, 0.37968844175338745, 0.04218099266290665, 0.28530675172805786, 0.23451103270053864, -0.3353167772293091, 0.06564289331436157, -0.025865258648991585, -0.340391606092453, -0.40639322996139526, -0.1120617687702179, 0.1035269945859909, 0.13185065984725952, 0.24004030227661133, -0.19828297197818756, -0.10960512608289719, 0.11571680009365082, 0.444332480430603, 0.2312527894973755, -0.00873658899217844, 0.07714252173900604, -0.10363631695508957, -0.6938773989677429, 0.3556634783744812, -0.06648946553468704, 0.23949465155601501, -0.17430387437343597, 0.02964787185192108, 0.18827417492866516, -0.09497705101966858, 0.5607877969741821, 0.009984204545617104, -0.08927039802074432, 0.14211805164813995, -0.16981083154678345, -0.6273061037063599, -0.053479522466659546, 0.08494871854782104, 0.21825118362903595, 0.07846476137638092, 0.29319965839385986, -0.4171743392944336, -0.1809747815132141, 0.021117983385920525, -0.12683390080928802, -0.037118569016456604, -0.25489744544029236, -0.285765677690506, -0.498291015625, -0.25406378507614136, -0.01634562760591507, -0.19668728113174438, 0.21929381787776947, -0.19981983304023743, -0.24609693884849548, 0.2072690725326538, 0.11881227046251297, -0.00586283951997757, 0.02062837779521942, 0.0382971316576004, -0.07245118170976639, 0.27427199482917786, 0.15813112258911133, 0.23023487627506256, 0.25526541471481323, 0.7322544455528259, 0.07281774282455444, -0.5043365955352783, -0.07126978039741516, 0.13827869296073914, 0.004041299223899841, 0.1298823356628418, -0.22730553150177002, 0.00857110321521759, 0.24433493614196777, 0.3721839189529419, -0.48309990763664246, 0.10746998339891434, 0.4019940495491028, 0.07121475040912628, 0.02684030495584011, -0.4736984372138977, 0.535515546798706, 0.0644841194152832, -0.007583841681480408, 0.33932557702064514, 0.3704898953437805, -0.17150509357452393, -0.11949142068624496, -0.19059979915618896, 0.680048406124115, 0.13704627752304077, 0.03285861015319824, 0.4167172610759735, -0.20468859374523163, 0.2727639079093933, -0.16435730457305908, 0.004524203948676586, -0.05881456658244133, -0.19091536104679108, -0.08009438216686249, -0.17754888534545898, 0.28018367290496826, -0.03601192682981491, -0.22235043346881866, 0.23305551707744598, -0.10491052269935608, -0.015856586396694183, 0.10416295379400253, 0.08582846820354462, -0.6369776129722595, -0.3080771267414093, -0.34151792526245117, 0.17811985313892365, 0.08778102695941925, 0.40444526076316833, -0.0018504532054066658, -0.09474851191043854, -0.05458758398890495, -0.14336392283439636, -0.20743733644485474, 0.25105467438697815, -0.15599118173122406, -0.26990067958831787, 0.5422404408454895, 0.19386981427669525, 0.17243285477161407, 0.0976107120513916, 0.2614794075489044, -0.14943678677082062, -0.3203069269657135, 0.19330604374408722, -0.11994203180074692, 0.26209646463394165, -0.013789894990622997, -0.042340174317359924, 0.1767355352640152, -0.09973922371864319, -0.45738154649734497, -0.003651231527328491, -0.013336628675460815, -0.10770110785961151, 0.01300080120563507, -0.11021716892719269, 0.0653572604060173, -0.21080905199050903, 0.17634016275405884, 0.023484107106924057, 0.16082216799259186, -0.20134906470775604, 0.10281144082546234, 0.10192210972309113, -0.23462611436843872, 0.23963603377342224, -0.10174539685249329, -0.04458620399236679, -0.13510625064373016, 0.6019145846366882, -0.20437580347061157, 0.2746843695640564, 0.3368874788284302, -0.002848885953426361, -0.13552632927894592, -0.027158908545970917, -0.14501941204071045, -0.3032952845096588, -0.04192705824971199, 0.11189647018909454, 0.14524830877780914, -0.016693033277988434, -0.4140472710132599, 0.042244911193847656, -0.2789250612258911, -0.32308676838874817, 0.14541049301624298, -0.3087241053581238, -0.24474667012691498, -0.0788765698671341, -0.1953946202993393, -0.12999330461025238, 0.14069288969039917, 0.2872929573059082, 0.357645183801651, -0.013219648972153664, -0.21852853894233704, -0.038924314081668854, -0.179229274392128, -0.06364854425191879, 0.26564276218414307, 0.08401133120059967, 0.21867935359477997, -0.08923166990280151, -0.011448096483945847, -0.048252321779727936, -0.2782902121543884, -0.09336124360561371, -0.28927597403526306, 0.15959982573986053, 0.014484858140349388, -0.3740529417991638, 0.009065605700016022, -0.03483271971344948, -0.17457053065299988, -0.2543488144874573, 0.4593428373336792, 0.170877605676651, -0.1405715048313141, -0.1313418447971344, 0.032254673540592194, 0.00244845449924469, -0.34701383113861084, 0.04135292023420334, 0.023115530610084534, 0.2701616883277893, 0.03438479080796242, 0.11267876625061035, -0.29598915576934814, -0.06006739288568497, 0.11153227090835571, 0.0988534688949585, 0.24207653105258942, -0.004299815744161606, 0.6478322148323059, -0.09642291069030762, -0.052582450211048126, 0.09814805537462234, 0.19117337465286255, 0.24661380052566528, 0.10890413075685501, 0.09971040487289429, 0.059837158769369125, 0.1099066510796547, -0.151687890291214, -0.07315094023942947, 0.37175115942955017, 0.06877639144659042, -0.00023777782917022705, 0.06514003127813339, 0.20040103793144226, -0.06622639298439026, 0.1767907738685608, 0.09656376391649246, 0.35290080308914185, 0.016420036554336548, 0.11655566096305847, 0.06013304740190506, 0.03609456494450569, 0.4562182128429413, 0.21633155643939972, 0.0815262719988823, -0.12502452731132507, 0.13053902983665466, 0.019415445625782013, 0.30858534574508667, -0.2785770893096924, 0.19980935752391815, 0.07228542119264603, -0.6872013211250305, 0.021436940878629684, -0.0992387980222702, -0.10146722197532654, 0.10613864660263062, -0.30515098571777344, 0.456527441740036, -0.27025505900382996, 0.07271657884120941, -0.3896190822124481, 0.31479209661483765, -0.01843881607055664, -0.5011209845542908, -0.0794999822974205, -0.1527789831161499, -0.1903979778289795, -0.0938560962677002, 0.2519887089729309, -0.4124642610549927, 0.5564992427825928, -0.2292284220457077, -0.11207498610019684, -0.6101825833320618, -0.10567446798086166, 0.13151434063911438, 0.1205226257443428, -0.06415261328220367, 0.3123973608016968, 0.0012010186910629272, -0.1926366090774536, 0.21217285096645355, 0.23643885552883148, 0.36611053347587585, 0.12204884737730026, 0.20724478363990784, -0.12076874822378159, 0.14675721526145935, 0.1171843558549881, -0.39853888750076294, 0.28009673953056335, -0.05152738094329834, -0.1592501997947693, 0.2268555462360382, 0.08412323147058487, -0.14353007078170776, -0.1069045215845108, -0.053714293986558914, 0.623796820640564, -0.49256107211112976, 0.6402955055236816, -0.39522212743759155, 0.1440468430519104, -0.1185736358165741, -0.17617729306221008, -0.31654447317123413, 0.32422056794166565, 0.3777230679988861, -0.19910244643688202, 0.18148189783096313, -0.36312901973724365, 0.03012016788125038, -0.02380208671092987, 0.3451891541481018, 0.31178709864616394, -0.14110666513442993, -0.1495497226715088, -0.06503430008888245, -0.36815592646598816, -0.03477943688631058, 0.13452769815921783, -0.15331684052944183, 0.06269100308418274, 0.16401487588882446, -0.10413637012243271, 0.013447722420096397, -0.01941293478012085, 0.04669211804866791, 0.4886523485183716, -0.16507567465305328, -0.13541066646575928, -0.15504644811153412, -0.48143017292022705, 0.1907188445329666, 0.13843406736850739, -0.23033452033996582, 0.2091996669769287, -0.19546101987361908, -0.07837419211864471, 0.1741020679473877, -0.14532187581062317, 0.17887382209300995, -0.37301522493362427, 0.35703015327453613, 0.15847353637218475, 0.032620906829833984, -0.16346824169158936, -0.007799377664923668, -0.25422772765159607, -0.11926129460334778, -0.16658109426498413, -0.19929254055023193, -0.469938188791275, 0.04197315871715546, -0.2658977508544922, -0.0186036117374897, -0.42800891399383545, 0.3274851441383362, 0.30180126428604126, -0.1043843999505043, 0.022968309000134468, 0.04077368229627609, -0.3119186460971832, 0.029876362532377243, 0.15609139204025269, 0.2509145438671112, -0.24083414673805237, 0.23016858100891113, -0.07995090633630753, -0.2591668665409088, 0.4812617003917694, -0.17797701060771942, -0.14897112548351288, -0.33531084656715393, 0.21908022463321686, -0.1018471047282219, -0.1742735356092453, -0.1303231120109558, 0.15673133730888367, 0.286325067281723, -0.12551411986351013, 0.050240758806467056, 0.0996299684047699, 0.10295820236206055, 0.13872218132019043, -0.16640490293502808, 0.06027289107441902, 0.10725652426481247, -0.12493081390857697, 0.24728620052337646, -0.06554055213928223 ]
https://github.com/huggingface/datasets/issues/6032
DownloadConfig.proxies not work when load_dataset_builder calling HfApi.dataset_info
@mariosasko are you saying if I do the following: ``` def backend_factory() -> requests.Session: session = requests.Session() session.proxies = { "https": "127.0.0.1:8887", "http": "127.0.0.1:8887", } session.verify = "/etc/ssl/certs/ca-certificates.crt" return session # Set it as the default session factory configure_http_backend(backend_factory=backend_factory) ``` which works nicely with transformer library: ``` def download_gpt_2_model(): tokenizer = GPT2Tokenizer.from_pretrained( "gpt2", force_download=True, resume_download=False ) text = "Replace me by any text you'd like." encoded_input = tokenizer(text, return_tensors="pt") print(encoded_input) model = GPT2Model.from_pretrained( "gpt2", force_download=True, resume_download=False ) output = model(**encoded_input) ``` should work for datasets library as well ? In my case if I just do: ``` def download_sts12_sts_dataset(): dataset = load_dataset( "mteb/sts12-sts", download_mode="force_redownload", verification_mode="basic_checks", revision="main", ) ``` I am getting: `ConnectionError: Couldn't reach https://huggingface.co/datasets/mteb/sts12-sts/resolve/main/dataset_infos.json (ConnectTimeout(MaxRetryError("HTTPSConnectionPool(host='huggingface.co', port=443): Max retries exceeded with url: /datasets/mteb/sts12-sts/resolve/main/dataset_infos.json (Caused by ConnectTimeoutError(<urllib3.connection.HTTPSConnection object at 0x7f429e87a3a0>, 'Connection to huggingface.co timed out. (connect timeout=100)'))")))` which is typical when the proxy server is not defined. Looks like what is set in configure_http_backend(backend_factory=backend_factory) is ignore. If I use env variable instead, it is working ``` def download_sts12_sts_dataset(): os.environ["https_proxy"] = "127.0.0.1:8887" os.environ["http_proxy"] = "127.0.0.1:8887" os.environ["REQUESTS_CA_BUNDLE"] = "/etc/ssl/certs/ca-certificates.crt" dataset = load_dataset( "mteb/sts12-sts", download_mode="force_redownload", verification_mode="basic_checks", revision="main", ) ``` Should I add something ? I am using `huggingface_hub 0.15.1`, `datasets 2.13.0`, `transformers 4.30.2`
### 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
199
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 @mariosasko are you saying if I do the following: ``` def backend_factory() -> requests.Session: session = requests.Session() session.proxies = { "https": "127.0.0.1:8887", "http": "127.0.0.1:8887", } session.verify = "/etc/ssl/certs/ca-certificates.crt" return session # Set it as the default session factory configure_http_backend(backend_factory=backend_factory) ``` which works nicely with transformer library: ``` def download_gpt_2_model(): tokenizer = GPT2Tokenizer.from_pretrained( "gpt2", force_download=True, resume_download=False ) text = "Replace me by any text you'd like." encoded_input = tokenizer(text, return_tensors="pt") print(encoded_input) model = GPT2Model.from_pretrained( "gpt2", force_download=True, resume_download=False ) output = model(**encoded_input) ``` should work for datasets library as well ? In my case if I just do: ``` def download_sts12_sts_dataset(): dataset = load_dataset( "mteb/sts12-sts", download_mode="force_redownload", verification_mode="basic_checks", revision="main", ) ``` I am getting: `ConnectionError: Couldn't reach https://huggingface.co/datasets/mteb/sts12-sts/resolve/main/dataset_infos.json (ConnectTimeout(MaxRetryError("HTTPSConnectionPool(host='huggingface.co', port=443): Max retries exceeded with url: /datasets/mteb/sts12-sts/resolve/main/dataset_infos.json (Caused by ConnectTimeoutError(<urllib3.connection.HTTPSConnection object at 0x7f429e87a3a0>, 'Connection to huggingface.co timed out. (connect timeout=100)'))")))` which is typical when the proxy server is not defined. Looks like what is set in configure_http_backend(backend_factory=backend_factory) is ignore. If I use env variable instead, it is working ``` def download_sts12_sts_dataset(): os.environ["https_proxy"] = "127.0.0.1:8887" os.environ["http_proxy"] = "127.0.0.1:8887" os.environ["REQUESTS_CA_BUNDLE"] = "/etc/ssl/certs/ca-certificates.crt" dataset = load_dataset( "mteb/sts12-sts", download_mode="force_redownload", verification_mode="basic_checks", revision="main", ) ``` Should I add something ? I am using `huggingface_hub 0.15.1`, `datasets 2.13.0`, `transformers 4.30.2`
[ -0.2879650592803955, -0.09048698842525482, 0.062012676149606705, 0.2935779094696045, 0.23151029646396637, -0.19603276252746582, 0.47543320059776306, -0.017514623701572418, -0.1941140741109848, -0.08183430135250092, -0.21388939023017883, -0.08288484811782837, 0.509202778339386, 0.13407880067825317, 0.19329145550727844, -0.10976535081863403, -0.11932753771543503, -0.052026644349098206, -0.2635321021080017, 0.036282166838645935, -0.2703145742416382, 0.27052903175354004, -0.06600651890039444, 0.11572689563035965, -0.03542107343673706, 0.2848626375198364, -0.09077747166156769, 0.2296309769153595, 0.1318863183259964, 0.006921953521668911, 0.49653589725494385, 0.35756465792655945, 0.24036622047424316, 0.3045772612094879, -0.00011974460358032957, 0.41078537702560425, 0.4937436580657959, -0.08646437525749207, -0.355256587266922, -0.1568353921175003, -0.6016091704368591, -0.10702570527791977, -0.053168416023254395, -0.13722674548625946, -0.21844583749771118, -0.09868468344211578, -0.17907370626926422, -0.06095995754003525, 0.2753373980522156, 0.26128795742988586, 0.12040755152702332, 0.5021077394485474, -0.01298794150352478, -0.07501376420259476, 0.20510193705558777, 0.0014760121703147888, -0.10203022509813309, -0.20232240855693817, 0.10367533564567566, 0.23398499190807343, 0.25523707270622253, 0.12464065849781036, -0.16086184978485107, 0.06556427478790283, 0.20757260918617249, 0.13295388221740723, 0.08180996775627136, -0.3057706952095032, 0.1337682604789734, 0.3260996341705322, 0.6190252304077148, -0.3777564764022827, -0.297260582447052, -0.25250473618507385, -0.18289412558078766, 0.0628732442855835, 0.37641194462776184, 0.1125408336520195, -0.21034635603427887, 0.18143878877162933, -0.0728624165058136, -0.30233660340309143, 0.038396865129470825, 0.12706977128982544, 0.0020923763513565063, 0.17812862992286682, -0.05015210807323456, 0.3118418753147125, -0.2150356024503708, 0.047061845660209656, 0.11026248335838318, -0.6021695137023926, 0.0660434365272522, 0.0582125261425972, -0.24725840985774994, -0.02279023826122284, 0.07667931169271469, 0.25485995411872864, 0.08412187546491623, 0.6501063108444214, -0.26532676815986633, 0.1715889871120453, -0.08394011110067368, 0.13984674215316772, 0.036684550344944, 0.019512206315994263, -0.12324780970811844, 0.30174776911735535, 0.3266717791557312, 0.3676093816757202, 0.01563429832458496, -0.11868330091238022, 0.16856275498867035, -0.17160427570343018, -0.1557275801897049, -0.16581284999847412, 0.3735361695289612, -0.19959580898284912, -0.08721065521240234, 0.03227120637893677, -0.035925883799791336, -0.2747219204902649, 0.04386276751756668, 0.3577343821525574, -0.25131961703300476, 0.3812688887119293, 0.3169122338294983, -0.028048574924468994, -0.2722988426685333, -0.2446712702512741, -0.16544322669506073, -0.2524649202823639, -0.05079212784767151, 0.34429246187210083, 0.08246767520904541, -0.2443040907382965, 0.3514838218688965, 0.12454979866743088, 0.13920141756534576, 0.13631384074687958, 0.24834072589874268, -0.18035505712032318, -0.026936665177345276, 0.41348719596862793, 0.06410741806030273, 0.07523883134126663, 0.06531845033168793, -0.20867528021335602, -0.051105182617902756, 0.08749817311763763, -0.23538580536842346, -0.13638411462306976, 0.05406651645898819, 0.07335461676120758, -0.16235414147377014, 0.0029856860637664795, -0.41478875279426575, -0.12536750733852386, 0.33957576751708984, 0.07303367555141449, -0.07187636941671371, -0.1641773134469986, -0.03294301778078079, -0.006988220848143101, 0.5045235753059387, 0.5657960176467896, -0.01133342832326889, -0.335283100605011, 0.1216573491692543, -0.41421422362327576, 0.23342740535736084, -0.01255832239985466, -0.10217725485563278, 0.15071943402290344, -0.25421005487442017, -0.14459973573684692, 0.4649209976196289, -0.44701582193374634, -0.437122106552124, 0.41035160422325134, 0.016826599836349487, 0.3192925453186035, 0.1153779923915863, 0.00257133855484426, 0.06310731172561646, -0.08680808544158936, -0.19034016132354736, 0.39536052942276, -0.03916691988706589, 0.08937729895114899, -0.2174224853515625, -0.2554674446582794, -0.018773138523101807, 0.15861782431602478, 0.13339108228683472, 0.5592029094696045, -0.23808559775352478, -0.09734773635864258, 0.2662394344806671, 0.09884776175022125, 0.1695030927658081, -0.043885789811611176, 0.05144777521491051, 0.395679771900177, 0.238154336810112, 0.15873661637306213, -0.24132901430130005, 0.1413196623325348, -0.34337079524993896, 0.05856304243206978, -0.05504542589187622, 0.019752349704504013, -0.27790889143943787, -0.2208588421344757, -0.2388647347688675, -0.2317611277103424, -0.011279178783297539, 0.472521036863327, 0.20643672347068787, -0.13642501831054688, 0.07196776568889618, 0.7011690139770508, 0.09696787595748901, 0.25564318895339966, -0.2768360674381256, 0.41662606596946716, 0.11841672658920288, 0.08147114515304565, -0.12239544838666916, -0.003036484122276306, 0.29395171999931335, -0.11674260348081589, -0.09459318220615387, 0.35440436005592346, -0.006317879538983107, 0.1330408751964569, -0.016591988503932953, -0.04766377806663513, 0.30532774329185486, -0.09792697429656982, -0.024939270690083504, 0.2594587504863739, 0.31259962916374207, -0.012572873383760452, 0.08896547555923462, 0.0956549420952797, 0.46033617854118347, 0.4154093563556671, 0.18456846475601196, 0.07246794551610947, 0.25526008009910583, -0.12847167253494263, -0.2143268585205078, 0.02875528484582901, -0.1286688894033432, -0.13240891695022583, 0.45911461114883423, 0.009461501613259315, -0.23649321496486664, 0.19996559619903564, 0.3300052881240845, 0.07661131024360657, -0.21627065539360046, 0.17436137795448303, -0.27312135696411133, 0.07862967252731323, 0.31672027707099915, 0.2370627373456955, 0.4040426015853882, -0.014957110397517681, -0.15940900146961212, 0.28495702147483826, -0.1250455230474472, -0.2137174904346466, 0.23922359943389893, 0.1621273010969162, -0.24340936541557312, -0.12770932912826538, 0.055997155606746674, 0.05818985775113106, -0.040449321269989014, -0.21062980592250824, -0.056948356330394745, -0.01974082551896572, -0.6143612861633301, 0.1314331293106079, -0.20561857521533966, -0.13554653525352478, 0.008074984885752201, 0.02801021933555603, 0.07009492814540863, -0.34261012077331543, -0.22209616005420685, 0.17402392625808716, 0.07801902294158936, 0.03478075563907623, -0.2931577265262604, 0.17476576566696167, 0.028510773554444313, -0.48830854892730713, -0.19426316022872925, 0.3031867444515228, -0.39664164185523987, -0.0047783441841602325, 0.006826636381447315, -0.18736784160137177, 0.07990074902772903, -0.42748671770095825, -0.3070639967918396, -0.28339260816574097, -0.15264961123466492, 0.2727367877960205, -0.015369683504104614, 0.2804996073246002, 0.07446680963039398, 0.036784350872039795, 0.3506202697753906, -0.09798722714185715, 0.3566685914993286, 0.3440316319465637, -0.019916875287890434, 0.02704164758324623, 0.036210641264915466, 0.002930469112470746, -0.1435202956199646, -0.24559864401817322, -0.04873815178871155, -0.20905561745166779, -0.13632646203041077, 0.20078253746032715, 0.07732826471328735, -0.009519261308014393, 0.06863400340080261, 0.0018382370471954346, -0.02284182421863079, 0.16615009307861328, -0.2710321247577667, -0.7304017543792725, 0.2847401201725006, -0.07126689702272415, -0.283718466758728, -0.15469075739383698, -0.012010972946882248, 0.12466387450695038, 0.23206520080566406, -0.5957648158073425, -0.3190497159957886, -0.3255790174007416, 0.2985454797744751, 0.1826714426279068, 0.22033555805683136, 0.2092638462781906, -0.10696204006671906, 0.04294039309024811, -0.2329171597957611, -0.23282021284103394, 0.21941187977790833, -0.3126336336135864, 0.3898687958717346, 0.28721773624420166, 0.35475364327430725, -0.1247018575668335, 0.8787169456481934, 0.3193762004375458, -0.17530980706214905, 0.4936840832233429, -0.06129208952188492, 0.24447332322597504, -0.030275069177150726, -0.17346428334712982, 0.09757629036903381, 0.00007134675979614258, 0.3182234764099121, 0.03497806936502457, 0.12245199084281921, -0.09393312782049179, -0.38765156269073486, 0.18384884297847748, -0.17484813928604126, -0.423966646194458, -0.33689653873443604, -0.16818420588970184, 0.22936800122261047, 0.15032625198364258, 0.2571929395198822, -0.20401528477668762, 0.022730190306901932, 0.13290229439735413, 0.3800129294395447, 0.294689804315567, -0.0566023513674736, -0.09280169755220413, 0.03295421972870827, -0.5632233619689941, 0.38169485330581665, -0.10516957938671112, 0.39509108662605286, -0.12490202486515045, 0.028539404273033142, 0.11006061732769012, -0.20021921396255493, 0.5922373533248901, -0.0566672682762146, -0.0378766730427742, 0.28749772906303406, -0.27557259798049927, -0.49582698941230774, -0.22117117047309875, 0.0448727048933506, 0.11309955269098282, 0.0327209010720253, 0.199565589427948, -0.5115242004394531, -0.10680954903364182, -0.03759875148534775, -0.1834115833044052, -0.1627981960773468, -0.1515994817018509, -0.2215498387813568, -0.5715346932411194, -0.22987130284309387, -0.06360439211130142, -0.19032953679561615, 0.20785021781921387, -0.28297659754753113, -0.14733169972896576, 0.1403827667236328, 0.1677195131778717, 0.07991234958171844, 0.09578526020050049, 0.08149367570877075, -0.014756486751139164, 0.2778744399547577, 0.002214200794696808, 0.30643635988235474, 0.06427042931318283, 0.6043344736099243, 0.2430458813905716, -0.5631422996520996, 0.13798874616622925, 0.005467616021633148, -0.07911982387304306, 0.10606397688388824, -0.20799168944358826, -0.023587428033351898, 0.15969619154930115, 0.38294506072998047, -0.3013104796409607, 0.20137207210063934, 0.395693838596344, 0.04313317686319351, -0.08446216583251953, -0.7125820517539978, 0.4117007553577423, 0.083973228931427, -0.07886821031570435, 0.31877413392066956, 0.10878761112689972, -0.26070117950439453, -0.04427485167980194, -0.16320928931236267, 0.8126471042633057, 0.24068167805671692, 0.05107317864894867, 0.5034693479537964, -0.16456058621406555, 0.25123560428619385, -0.4371733069419861, -0.021390635520219803, -0.05242422968149185, -0.13561491668224335, -0.13610856235027313, -0.22404536604881287, 0.33470287919044495, -0.005515296012163162, -0.30256152153015137, 0.24175643920898438, -0.1789642721414566, -0.08539323508739471, 0.3031184673309326, 0.1414930373430252, -0.3960636556148529, -0.2602442502975464, -0.02273223176598549, 0.1500062346458435, 0.05909652262926102, 0.3765970468521118, -0.02956937626004219, -0.05905681848526001, -0.10248832404613495, -0.05526808649301529, -0.31766098737716675, 0.26186347007751465, -0.18707330524921417, -0.18050016462802887, 0.3317033648490906, 0.07220247387886047, 0.21485115587711334, -0.030084770172834396, 0.2553023099899292, -0.07127095758914948, -0.25175362825393677, 0.16557425260543823, -0.22400808334350586, 0.44135698676109314, 0.16599710285663605, -0.09362682700157166, 0.2629466950893402, -0.07554121315479279, -0.4573497176170349, 0.15646669268608093, -0.08746980875730515, -0.31432366371154785, -0.10880830883979797, -0.16567446291446686, 0.21208065748214722, -0.3673021197319031, 0.19159869849681854, 0.17518161237239838, -0.03497312217950821, -0.21179001033306122, 0.07891100645065308, 0.10246409475803375, -0.320824533700943, 0.3720758557319641, -0.19564202427864075, -0.2226317822933197, -0.07167677581310272, 0.5779815912246704, -0.02907925844192505, 0.2825815975666046, 0.47006121277809143, -0.10109521448612213, -0.14046472311019897, -0.03800123929977417, -0.18228891491889954, -0.4436399042606354, -0.17054276168346405, 0.1524561196565628, 0.03465942665934563, -0.046914175152778625, -0.35967856645584106, 0.009776026010513306, -0.27980631589889526, -0.06284517794847488, 0.05329233780503273, -0.2997947931289673, -0.06168336421251297, -0.21178381145000458, -0.1836855709552765, -0.1461336314678192, 0.13274887204170227, 0.26372525095939636, 0.39863789081573486, -0.09341413527727127, -0.2080657184123993, -0.09059219062328339, -0.17278067767620087, 0.16682030260562897, 0.2648007273674011, 0.05084514990448952, 0.023786058649420738, -0.033089593052864075, -0.0421096496284008, -0.025465115904808044, -0.21419543027877808, -0.09598147869110107, -0.23605477809906006, 0.20837128162384033, 0.04336513951420784, -0.4800749123096466, 0.07460780441761017, -0.06704534590244293, -0.16888387501239777, -0.1579262912273407, 0.4974086880683899, 0.03725290298461914, -0.13384512066841125, -0.0278334878385067, 0.02379763498902321, 0.0136827751994133, -0.4930204749107361, 0.12126370519399643, -0.05159983038902283, 0.1316714584827423, 0.19919195771217346, 0.20386619865894318, -0.20320364832878113, -0.0005753040313720703, -0.23587332665920258, 0.07877828180789948, 0.3214079439640045, 0.23915618658065796, 0.7465490698814392, -0.2833021283149719, 0.057352256029844284, 0.16202986240386963, 0.06749807298183441, 0.14554473757743835, 0.02429218590259552, -0.0011429991573095322, 0.12279617786407471, 0.12423646450042725, -0.155367910861969, -0.003876041155308485, 0.3541944921016693, 0.02153347060084343, 0.01506366953253746, 0.1282125562429428, 0.12790772318840027, -0.11870905756950378, 0.3197702169418335, 0.07542054355144501, 0.5041716694831848, -0.13033811748027802, 0.2230188101530075, 0.26177743077278137, -0.21816791594028473, 0.5241463780403137, 0.23167762160301208, -0.03994579240679741, -0.2745206952095032, 0.14851084351539612, 0.08981849253177643, 0.2204386293888092, -0.09053070098161697, 0.11866924166679382, -0.041755519807338715, -0.6272900104522705, -0.009013723582029343, -0.019770801067352295, -0.0941060483455658, 0.0966029167175293, -0.1677001416683197, 0.12193303555250168, -0.07193030416965485, 0.15160797536373138, -0.3582620918750763, 0.2850545644760132, -0.00348760187625885, -0.40600714087486267, -0.15994955599308014, -0.09051310271024704, -0.15312370657920837, -0.14095032215118408, 0.17997609078884125, -0.3924473524093628, 0.4063994586467743, -0.1428636908531189, -0.3184390068054199, -0.4936097264289856, -0.02510896697640419, -0.028446778655052185, 0.0967528223991394, -0.08482664823532104, 0.36954182386398315, -0.009111829102039337, -0.16671688854694366, 0.07280338555574417, 0.3648949861526489, 0.175043523311615, 0.29860761761665344, 0.14229890704154968, -0.17350554466247559, 0.1720614731311798, 0.12344200909137726, -0.3935834467411041, 0.3093682825565338, -0.15095624327659607, -0.2130233496427536, 0.1829901486635208, 0.06609299033880234, -0.1302555799484253, 0.010685663670301437, -0.059544239193201065, 0.4980466067790985, -0.49592965841293335, 0.7125440835952759, -0.1834908127784729, 0.1271570324897766, 0.0034826286137104034, -0.07187744230031967, -0.34415319561958313, 0.2679356634616852, 0.5596933960914612, -0.1788492351770401, 0.2200375199317932, -0.3073144555091858, 0.026249215006828308, -0.1574249565601349, 0.21371465921401978, 0.27534836530685425, -0.22815439105033875, -0.2093641310930252, 0.011594220995903015, -0.29640448093414307, 0.016316190361976624, 0.12990213930606842, -0.3536290228366852, -0.02296779677271843, 0.3412574231624603, 0.09031546860933304, 0.1272280365228653, -0.04294353723526001, 0.03871046006679535, 0.44307318329811096, 0.0052784159779548645, -0.1729431003332138, -0.12321016192436218, -0.419558584690094, 0.40102285146713257, 0.06896719336509705, -0.45328736305236816, 0.1731933057308197, 0.061700258404016495, 0.0092308409512043, 0.11748093366622925, -0.31003761291503906, 0.3897266983985901, -0.11317659914493561, 0.5237647294998169, 0.23360700905323029, 0.07579877972602844, -0.10258659720420837, 0.1473212093114853, -0.37361034750938416, -0.1394769251346588, -0.20511500537395477, -0.29503732919692993, -0.40207305550575256, 0.019621465355157852, -0.1535547971725464, 0.11913605034351349, -0.45545241236686707, 0.18380622565746307, 0.1736828088760376, -0.07930668443441391, -0.027429450303316116, -0.08597400039434433, -0.36417174339294434, -0.04474208876490593, 0.015043198131024837, 0.14265109598636627, -0.23897460103034973, 0.07393466681241989, -0.15196743607521057, -0.3183457553386688, 0.4366241693496704, -0.26231902837753296, -0.2719235122203827, -0.4151863753795624, 0.23890191316604614, -0.2994827628135681, 0.0017693284898996353, 0.07799234241247177, 0.13186490535736084, 0.42673376202583313, -0.1459169089794159, 0.01406792551279068, 0.20962996780872345, 0.23785284161567688, 0.29908487200737, -0.17396658658981323, 0.1297004520893097, -0.012593571096658707, -0.12476709485054016, 0.015635300427675247, -0.1803964376449585 ]
https://github.com/huggingface/datasets/issues/6032
DownloadConfig.proxies not work when load_dataset_builder calling HfApi.dataset_info
`huggingface_hub.configure_http_backend` works for `transformers` because they only use the `huggingface_hub` lib for downloads. Our download logic is a bit more complex (e.g., we also support downloading non-Hub files), so we are not aligned with them yet. In the meantime, it's best to use the env vars.
### 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
46
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 `huggingface_hub.configure_http_backend` works for `transformers` because they only use the `huggingface_hub` lib for downloads. Our download logic is a bit more complex (e.g., we also support downloading non-Hub files), so we are not aligned with them yet. In the meantime, it's best to use the env vars.
[ -0.2718684673309326, -0.31287360191345215, 0.07217483222484589, 0.2777329087257385, 0.28893572092056274, -0.19712373614311218, 0.2673003077507019, -0.08293774724006653, -0.0851227343082428, -0.01037551462650299, -0.32631367444992065, -0.03736462816596031, 0.43747177720069885, 0.3451574444770813, 0.13903746008872986, -0.12490984797477722, -0.08848143368959427, -0.14895039796829224, -0.1292102038860321, 0.03783971071243286, -0.25948476791381836, 0.36716654896736145, -0.08111805468797684, 0.002599291503429413, -0.11392869800329208, 0.40436267852783203, -0.15566600859165192, 0.360167920589447, 0.13421598076820374, -0.0687069222331047, 0.6356086730957031, 0.3461860418319702, 0.257075697183609, 0.14621971547603607, -0.0001201081249746494, 0.39361417293548584, 0.48927128314971924, -0.07777915894985199, -0.2823593020439148, -0.25838369131088257, -0.5175967216491699, -0.18960778415203094, 0.0218802560120821, -0.02126900851726532, -0.08014160394668579, 0.02050875313580036, -0.08270306885242462, 0.0024907104671001434, 0.26371824741363525, 0.2120036780834198, 0.13514132797718048, 0.6639845371246338, -0.010344188660383224, -0.13297733664512634, 0.08211569488048553, 0.11664968729019165, -0.08376304805278778, -0.11969704926013947, 0.15907281637191772, 0.28923314809799194, 0.1342368721961975, 0.1350427120923996, -0.17617031931877136, -0.004849659278988838, 0.3685256838798523, 0.08581685274839401, 0.02189076691865921, -0.2157476544380188, 0.09329113364219666, 0.3381326496601105, 0.5294001698493958, -0.3853369653224945, -0.2951619625091553, -0.25711730122566223, -0.10517267137765884, 0.11899012327194214, 0.432441771030426, 0.09269291907548904, -0.22629636526107788, 0.11823093891143799, -0.18918868899345398, -0.33437028527259827, 0.01143725961446762, 0.18607260286808014, 0.14684459567070007, 0.14060617983341217, -0.15592196583747864, 0.1824788898229599, -0.07487115263938904, -0.022163350135087967, 0.07947851717472076, -0.6737764477729797, 0.12806697189807892, -0.001932736486196518, -0.1589457243680954, 0.037607043981552124, -0.012736395001411438, 0.46530264616012573, 0.15496525168418884, 0.5214194059371948, -0.1941651552915573, 0.22817397117614746, -0.1676785796880722, 0.19616281986236572, 0.1262412816286087, -0.05656873434782028, -0.01854880154132843, 0.1995072215795517, 0.2933015525341034, 0.5258238315582275, 0.13877812027931213, -0.09572064131498337, 0.2681715488433838, -0.12426979839801788, -0.33117198944091797, -0.30944061279296875, 0.26060742139816284, -0.13663886487483978, -0.051783058792352676, 0.021583914756774902, 0.02118825912475586, -0.16149380803108215, 0.3458700478076935, 0.45876455307006836, -0.34666281938552856, 0.28417158126831055, 0.13623477518558502, 0.18424250185489655, -0.21259379386901855, -0.04147219657897949, -0.20877359807491302, -0.17071281373500824, -0.0031678378582000732, 0.3361266553401947, 0.2123252898454666, -0.319277822971344, 0.34831491112709045, 0.10386975109577179, 0.3129618167877197, 0.09560765326023102, -0.06435598433017731, 0.0018471553921699524, -0.0485755130648613, 0.40831640362739563, 0.05648535117506981, 0.0427604541182518, 0.04836759716272354, -0.20014765858650208, -0.10247072577476501, -0.09141045063734055, -0.18468904495239258, -0.2450375109910965, 0.06310463696718216, 0.04891779646277428, -0.2578960061073303, -0.0732329934835434, -0.3545507788658142, -0.017290998250246048, 0.07926161587238312, 0.06614764034748077, -0.028726153075695038, 0.021443942561745644, -0.12686492502689362, -0.05306977778673172, 0.5933398008346558, 0.5449197292327881, 0.23873186111450195, -0.3466116487979889, 0.0036893938668072224, -0.3716529607772827, 0.26277956366539, -0.090974360704422, -0.020738983526825905, -0.10137491673231125, -0.23845741152763367, -0.20674410462379456, 0.3024282455444336, -0.5959416031837463, -0.3531881272792816, 0.4059305787086487, 0.19665266573429108, 0.22760482132434845, 0.1794024109840393, -0.01192319206893444, -0.11740629374980927, 0.024956222623586655, -0.13952945172786713, 0.38165926933288574, -0.016745219007134438, 0.04130791872739792, -0.15648271143436432, -0.3368375897407532, -0.3881409168243408, 0.28771111369132996, 0.11872223019599915, 0.5857508778572083, -0.17634201049804688, -0.2508309483528137, 0.30951616168022156, 0.17081210017204285, 0.22793954610824585, 0.1242324560880661, 0.02230694331228733, 0.41335999965667725, 0.1971932351589203, -0.07741032540798187, -0.3618486523628235, 0.21086770296096802, -0.2695968747138977, -0.07232436537742615, -0.15012945234775543, -0.10972286760807037, -0.2984747886657715, -0.12329181283712387, -0.15898346900939941, -0.24451863765716553, -0.011133123189210892, 0.23950111865997314, 0.26915138959884644, -0.0907023623585701, -0.03310426324605942, 0.7235969305038452, 0.1019940972328186, 0.27781423926353455, -0.25475195050239563, 0.5272228717803955, 0.12952037155628204, 0.04795043542981148, -0.06046656519174576, 0.145090252161026, 0.18003150820732117, 0.014090707525610924, -0.0037095537409186363, 0.3276650309562683, -0.09955262392759323, 0.1494034379720688, 0.1378849744796753, -0.08813641965389252, 0.2991896867752075, -0.23289886116981506, 0.018577121198177338, 0.10972589254379272, 0.23938842117786407, 0.01605413854122162, 0.008598830550909042, 0.15745481848716736, 0.13382112979888916, 0.48730987310409546, 0.23000605404376984, 0.15370026230812073, 0.1551150381565094, -0.0461542047560215, -0.2669372856616974, -0.09827321767807007, -0.054573941975831985, -0.09043794870376587, 0.42081040143966675, -0.03214487433433533, -0.2954476475715637, 0.043852515518665314, 0.21598181128501892, 0.16472971439361572, -0.23112812638282776, 0.22684693336486816, -0.22842437028884888, 0.19507676362991333, 0.37833085656166077, 0.1507544219493866, 0.2555937170982361, -0.005895898677408695, -0.10773102939128876, 0.376659631729126, -0.12528806924819946, -0.1650334894657135, 0.19897788763046265, 0.19888535141944885, -0.30175352096557617, -0.17503687739372253, -0.018023503944277763, -0.037287499755620956, -0.21771425008773804, -0.21590235829353333, -0.22952625155448914, -0.2246207594871521, -0.5632098317146301, 0.09377036243677139, -0.28713101148605347, -0.16633284091949463, -0.01468662265688181, -0.2642677426338196, -0.16966547071933746, -0.3933478891849518, -0.19686874747276306, 0.25564226508140564, 0.01263970136642456, 0.04617320001125336, -0.2195434868335724, 0.11083172261714935, -0.1483219861984253, -0.4808061718940735, -0.33726099133491516, 0.31954479217529297, -0.2278871238231659, -0.06382790207862854, -0.027439672499895096, -0.06196245551109314, -0.004076236858963966, -0.4485863745212555, -0.16226685047149658, -0.28786173462867737, -0.04462298005819321, 0.2446364015340805, 0.11194701492786407, 0.19971883296966553, 0.09673426300287247, -0.0738789290189743, 0.16421964764595032, -0.12339819967746735, 0.48232826590538025, 0.3170414865016937, 0.10586120188236237, 0.12342722713947296, 0.11592665314674377, -0.04702030122280121, -0.09712176769971848, 0.010252334177494049, -0.14775635302066803, -0.25555744767189026, 0.014797244220972061, 0.1138683557510376, -0.021034084260463715, 0.03723006322979927, 0.17268191277980804, 0.07123830914497375, -0.19563284516334534, 0.16364151239395142, -0.17271707952022552, -0.7840266227722168, 0.30959922075271606, -0.03167061507701874, -0.30695050954818726, -0.11502808332443237, -0.034740298986434937, 0.06341872364282608, 0.09922190010547638, -0.44824349880218506, -0.35500791668891907, -0.3292940557003021, 0.3563832938671112, 0.21352025866508484, 0.37218523025512695, 0.07562727481126785, -0.10346510261297226, 0.07664418965578079, -0.16423435509204865, -0.10693444311618805, 0.14519649744033813, -0.31427106261253357, 0.38063713908195496, 0.22739475965499878, 0.1932545304298401, -0.21464915573596954, 0.7437688708305359, 0.3798009753227234, -0.04844458028674126, 0.6803182363510132, -0.06311270594596863, 0.45329737663269043, 0.010494634509086609, -0.23268291354179382, 0.06193492189049721, 0.06027134507894516, 0.30046403408050537, 0.013761311769485474, 0.23314979672431946, 0.21015015244483948, -0.38640037178993225, 0.10104264318943024, 0.0005107708275318146, -0.3638148307800293, -0.3568516671657562, -0.03936684876680374, 0.051479410380125046, 0.1630256474018097, 0.27083778381347656, -0.17308539152145386, -0.0640459954738617, 0.1592247635126114, 0.4802793860435486, 0.136151522397995, -0.029394904151558876, 0.07690627872943878, -0.12752650678157806, -0.6671526432037354, 0.35578015446662903, -0.08000420778989792, 0.27049437165260315, -0.08070075511932373, 0.04642121493816376, 0.13404953479766846, -0.13112400472164154, 0.6030439138412476, -0.020286260172724724, -0.14336609840393066, 0.14736053347587585, -0.19522938132286072, -0.6012380719184875, -0.11309908330440521, 0.0803678035736084, 0.18866819143295288, 0.01748860999941826, 0.2750781774520874, -0.4146963655948639, -0.13056893646717072, 0.03825896233320236, -0.13106824457645416, -0.05729592591524124, -0.23909837007522583, -0.2886240482330322, -0.5256463289260864, -0.26025697588920593, -0.022610194981098175, -0.18443132936954498, 0.1517907977104187, -0.1785898059606552, -0.25274303555488586, 0.22299593687057495, 0.11513752490282059, 0.0010551661252975464, 0.039558716118335724, 0.016740094870328903, -0.1190759688615799, 0.24828538298606873, 0.06874707341194153, 0.2155417501926422, 0.16302713751792908, 0.7130996584892273, 0.06898251175880432, -0.6087666153907776, -0.03671085461974144, 0.13754472136497498, -0.01171894371509552, 0.12778964638710022, -0.20622338354587555, -0.06825191527605057, 0.3078683018684387, 0.344765305519104, -0.42934179306030273, 0.11618247628211975, 0.362265408039093, 0.08763065934181213, -0.010143200866878033, -0.5098755359649658, 0.5994758605957031, 0.054938677698373795, -0.008266225457191467, 0.268659770488739, 0.36329585313796997, -0.1254987120628357, -0.03431757912039757, -0.19179767370224, 0.7337639331817627, 0.1285436749458313, 0.06791261583566666, 0.3725484311580658, -0.20045916736125946, 0.3025355637073517, -0.3055950999259949, 0.009029438719153404, -0.06419534981250763, -0.19043804705142975, -0.12514528632164001, -0.17855951189994812, 0.22814145684242249, -0.04180116206407547, -0.25788164138793945, 0.28821277618408203, -0.08685386180877686, -0.028195645660161972, 0.1009901911020279, 0.054756999015808105, -0.6116630434989929, -0.3957662582397461, -0.27139925956726074, 0.1415770798921585, 0.07900242507457733, 0.4486519694328308, -0.00893916841596365, -0.07231650501489639, -0.1018843874335289, -0.14396986365318298, -0.26923292875289917, 0.29702404141426086, -0.047388989478349686, -0.21894969046115875, 0.5246627926826477, 0.16854606568813324, 0.1716717779636383, 0.14292924106121063, 0.33280330896377563, -0.13328559696674347, -0.33328598737716675, 0.21770699322223663, -0.19809675216674805, 0.23150402307510376, -0.02514949068427086, -0.058020494878292084, 0.13335049152374268, -0.10264412313699722, -0.5209025740623474, -0.012582123279571533, 0.0025996388867497444, -0.12767362594604492, 0.08882611989974976, -0.1418738067150116, 0.13228189945220947, -0.20420695841312408, 0.2113785296678543, 0.036763280630111694, 0.11395333707332611, -0.1847999393939972, 0.08624131977558136, 0.10331417620182037, -0.23015257716178894, 0.31463077664375305, -0.12271727621555328, -0.08762770146131516, -0.08840350806713104, 0.5993088483810425, -0.18815365433692932, 0.2766457498073578, 0.31533217430114746, -0.012028995901346207, -0.1429693102836609, -0.013854585587978363, -0.2077387571334839, -0.3645036518573761, -0.07171472907066345, 0.12464246153831482, 0.13564378023147583, -0.1453874707221985, -0.41174644231796265, 0.024468474090099335, -0.1879391372203827, -0.276517391204834, 0.11244270205497742, -0.307985782623291, -0.29589954018592834, -0.03828231990337372, -0.16487370431423187, -0.11328360438346863, 0.11261511594057083, 0.18236219882965088, 0.3804320991039276, -0.07537368685007095, -0.19430914521217346, -0.08060766011476517, -0.2480783462524414, -0.07900075614452362, 0.18203063309192657, 0.011666759848594666, 0.24142351746559143, -0.06829621642827988, -0.03402046114206314, -0.10795538127422333, -0.2986642122268677, -0.06585121899843216, -0.2570324242115021, 0.17899152636528015, 0.05740772932767868, -0.3865455090999603, 0.003561987541615963, -0.02599085494875908, -0.21167729794979095, -0.28259387612342834, 0.4579073190689087, 0.22347384691238403, -0.10510276257991791, -0.05224194377660751, 0.047262128442525864, -0.009677708148956299, -0.41571539640426636, 0.08784390985965729, 0.06632600724697113, 0.2880590558052063, 0.04705042764544487, 0.17049087584018707, -0.26318594813346863, -0.05769071727991104, 0.05930105969309807, 0.05888907611370087, 0.31667184829711914, 0.039921410381793976, 0.6752417087554932, -0.08619935810565948, 0.04468606039881706, 0.10702289640903473, 0.13054631650447845, 0.28246909379959106, 0.14977487921714783, 0.0938248410820961, 0.10067769140005112, 0.10000371932983398, -0.17674168944358826, -0.0598946288228035, 0.39923718571662903, 0.07847410440444946, 0.019983243197202682, 0.07206432521343231, 0.1906120479106903, -0.10772719979286194, 0.29445725679397583, 0.1002252995967865, 0.4439323842525482, 0.029089393094182014, 0.12205465137958527, 0.14229005575180054, 0.05122559890151024, 0.5183068513870239, 0.19465817511081696, 0.08471781015396118, -0.0942162349820137, 0.21522195637226105, -0.01911381632089615, 0.21244384348392487, -0.2588631510734558, 0.21001416444778442, 0.05252838879823685, -0.7062923908233643, 0.024285098537802696, -0.1491205096244812, -0.039231911301612854, 0.07566875219345093, -0.2477971613407135, 0.35180869698524475, -0.26092150807380676, 0.19973169267177582, -0.46685364842414856, 0.31204551458358765, 0.010724321007728577, -0.5501343607902527, -0.04996136948466301, -0.1311861276626587, -0.14556369185447693, -0.09224653244018555, 0.24284487962722778, -0.3713873028755188, 0.4770352840423584, -0.192207470536232, -0.11790475249290466, -0.48007261753082275, -0.024040501564741135, 0.05885262414813042, 0.12030229717493057, -0.047759149223566055, 0.2798033356666565, 0.07699655741453171, -0.17247775197029114, 0.14953450858592987, 0.20245565474033356, 0.3203199803829193, 0.118062824010849, 0.15326984226703644, -0.09788665920495987, 0.1563388705253601, 0.11038148403167725, -0.4157198369503021, 0.24183787405490875, -0.06452219188213348, -0.1272611916065216, 0.19808807969093323, 0.06960661709308624, -0.1285526007413864, -0.1683375984430313, -0.16345401108264923, 0.5267654061317444, -0.3876996338367462, 0.7031175494194031, -0.3313412368297577, 0.1591317057609558, -0.10102073848247528, -0.17281270027160645, -0.3273285925388336, 0.28860798478126526, 0.411240816116333, -0.20540551841259003, 0.191038578748703, -0.2487652599811554, 0.015477277338504791, -0.06632757186889648, 0.32417812943458557, 0.3949441909790039, -0.12705063819885254, -0.12491845339536667, 0.05814430117607117, -0.3132096529006958, 0.009176649153232574, 0.13072113692760468, -0.21559230983257294, 0.054106589406728745, 0.2079096883535385, -0.10530965775251389, 0.028424913063645363, -0.05455729365348816, 0.1122855693101883, 0.5103113055229187, -0.05610267072916031, -0.07688285410404205, -0.15336187183856964, -0.46419334411621094, 0.1955512911081314, 0.14802655577659607, -0.29553118348121643, 0.18820956349372864, -0.008886907249689102, -0.09162236005067825, 0.17915788292884827, -0.1629614531993866, 0.22738653421401978, -0.3713501989841461, 0.3386172652244568, 0.12437059730291367, 0.11061812937259674, -0.15646831691265106, -0.003419959917664528, -0.28826314210891724, -0.12262710928916931, -0.1724635660648346, -0.26850229501724243, -0.48405423760414124, -0.05531368777155876, -0.2976721227169037, 0.11594700813293457, -0.46572357416152954, 0.28450602293014526, 0.23764844238758087, -0.10014805197715759, 0.0308194812387228, 0.006418971344828606, -0.3808373510837555, 0.06800976395606995, 0.14063669741153717, 0.19741883873939514, -0.2620736062526703, 0.1794729381799698, -0.08413446694612503, -0.2727988362312317, 0.5009785294532776, -0.10023915767669678, -0.17551180720329285, -0.3867783844470978, 0.1964598447084427, -0.13149771094322205, -0.10089360177516937, -0.06736643612384796, 0.12379730492830276, 0.23539268970489502, -0.16058459877967834, -0.03680239990353584, 0.047159116715192795, 0.15783056616783142, 0.12121523916721344, -0.21193459630012512, 0.09235897660255432, 0.07196241617202759, -0.11971547454595566, 0.13614791631698608, -0.09478135406970978 ]
https://github.com/huggingface/datasets/issues/6032
DownloadConfig.proxies not work when load_dataset_builder calling HfApi.dataset_info
@mariosasko I fully understand that the logic for dataset is different. I see 2 issues with the current implementation of the env variables: - having the same https_proxy/http_prox/no_proxy env variables for all tools is not good in some case. For example I have 2 differents proxy server. In 2019 we had discussion with the Tensorflow teams and they recommended to do the following: TFDS_HTTP_PROXY, TFDS_HTTPS_PROXY ... - with recent version of requests, it is not possible to deactivate TLS interception (verify=false) by using env variable. This is useful to debug things and in some case TLS is not working and you need to ignore verifying the SSL certificate (probably not recommended) One of the best way is to able to pass our requests.Session() directly ``` import openai session = requests.Session() session.cert = CERT session.verify = False openai.requestssession = session ``` My 2 cents in this discussion
### 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
146
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 @mariosasko I fully understand that the logic for dataset is different. I see 2 issues with the current implementation of the env variables: - having the same https_proxy/http_prox/no_proxy env variables for all tools is not good in some case. For example I have 2 differents proxy server. In 2019 we had discussion with the Tensorflow teams and they recommended to do the following: TFDS_HTTP_PROXY, TFDS_HTTPS_PROXY ... - with recent version of requests, it is not possible to deactivate TLS interception (verify=false) by using env variable. This is useful to debug things and in some case TLS is not working and you need to ignore verifying the SSL certificate (probably not recommended) One of the best way is to able to pass our requests.Session() directly ``` import openai session = requests.Session() session.cert = CERT session.verify = False openai.requestssession = session ``` My 2 cents in this discussion
[ -0.2724524140357971, -0.1954692006111145, 0.027852557599544525, 0.20180076360702515, 0.2376095950603485, -0.28152039647102356, 0.5187769532203674, 0.05172602832317352, -0.041373804211616516, 0.06968019902706146, -0.17300494015216827, 0.11520985513925552, 0.4824943542480469, 0.23684285581111908, 0.14011666178703308, -0.11716130375862122, 0.02119273692369461, -0.11532117426395416, -0.19701358675956726, -0.06042557954788208, -0.2861444056034088, -0.021801849827170372, -0.07357776165008545, 0.08364307135343552, 0.20439060032367706, 0.30180758237838745, -0.3372634947299957, 0.15250548720359802, 0.19398871064186096, 0.0901225283741951, 0.4831383228302002, 0.40993329882621765, 0.28465643525123596, 0.20304611325263977, -0.0001267338520847261, 0.5116857886314392, 0.30449235439300537, -0.13797993957996368, -0.20969946682453156, -0.22088490426540375, -0.7104848027229309, -0.2055293321609497, 0.02625039592385292, -0.2551095187664032, 0.09546691924333572, -0.2790071666240692, 0.036174923181533813, -0.44919759035110474, 0.16519677639007568, 0.3247932195663452, 0.04512360692024231, 0.42649003863334656, -0.051645394414663315, 0.1271609365940094, 0.19994720816612244, -0.1307641565799713, -0.0447717159986496, -0.22362223267555237, 0.1620827317237854, 0.22784486413002014, 0.12192687392234802, 0.1530485898256302, -0.1544209122657776, 0.13852159678936005, 0.49936455488204956, 0.09345215559005737, 0.2498239278793335, -0.3455035984516144, 0.2028663158416748, 0.4929278492927551, 0.6590229868888855, -0.24837055802345276, -0.3935457170009613, -0.24130353331565857, -0.04351184517145157, -0.11851858347654343, 0.40413394570350647, 0.18402983248233795, -0.17667873203754425, 0.13615040481090546, -0.10920461267232895, -0.31390872597694397, -0.19698870182037354, 0.282069593667984, 0.04927749186754227, 0.34512951970100403, 0.05630026385188103, 0.3067794442176819, -0.23157964646816254, 0.10250610113143921, 0.339635968208313, -0.5526624321937561, 0.22121202945709229, -0.10556333512067795, -0.430418998003006, 0.12470896542072296, 0.04139351099729538, -0.016725316643714905, 0.0060760751366615295, 0.33310604095458984, -0.2329641878604889, 0.1955220103263855, -0.06891943514347076, 0.2776068449020386, 0.20776741206645966, -0.07787136733531952, 0.012941353023052216, 0.21547819674015045, 0.2968829870223999, 0.18492670357227325, 0.02102981135249138, 0.04369846731424332, 0.16751636564731598, -0.21292391419410706, -0.33207523822784424, -0.057296015322208405, 0.36890125274658203, -0.07479564845561981, -0.20938773453235626, 0.06286732852458954, -0.4336664080619812, -0.3025858402252197, 0.19215205311775208, 0.43816906213760376, -0.39295127987861633, 0.48182839155197144, 0.16324052214622498, 0.14385798573493958, -0.2715948224067688, -0.028800759464502335, -0.10655141621828079, -0.09690135717391968, 0.09677274525165558, 0.19922620058059692, -0.03703444451093674, -0.21827490627765656, 0.388021856546402, 0.08724263310432434, 0.228042334318161, 0.07638507336378098, 0.22622978687286377, -0.13632433116436005, 0.17496301233768463, 0.2623943090438843, -0.007382551208138466, -0.17632098495960236, -0.09291891753673553, -0.26206618547439575, -0.04996051266789436, 0.10843051970005035, -0.30297693610191345, -0.2581115663051605, 0.03649011254310608, 0.013226154260337353, -0.20683954656124115, -0.13434696197509766, -0.11609617620706558, 0.1797565370798111, 0.12228842079639435, 0.2766523063182831, -0.1058473065495491, -0.23960848152637482, -0.292274534702301, -0.0695323795080185, 0.6279488801956177, 0.3424625098705292, -0.1091482937335968, -0.1993737518787384, 0.1299719512462616, -0.26132917404174805, 0.0386962816119194, -0.00849110633134842, -0.08504465967416763, 0.11778668314218521, -0.1319032609462738, -0.3422008156776428, 0.2504689395427704, -0.7325258851051331, -0.4139193296432495, 0.377485454082489, 0.3778773546218872, -0.000169314444065094, 0.23789140582084656, -0.04418841749429703, 0.030122505500912666, -0.08656542003154755, -0.10451629757881165, 0.3488621711730957, -0.15051570534706116, 0.09588336199522018, -0.17907774448394775, -0.41071048378944397, 0.009837478399276733, 0.19750931859016418, 0.09761469066143036, 0.3521276116371155, -0.17594638466835022, -0.33909595012664795, 0.327460378408432, -0.21778610348701477, 0.03593423217535019, 0.032597944140434265, 0.03844654560089111, 0.35177505016326904, 0.14247824251651764, 0.20198866724967957, -0.47657132148742676, 0.09240982681512833, -0.24356450140476227, -0.10373479127883911, 0.004421763122081757, -0.08548490703105927, 0.055078983306884766, -0.06598931550979614, -0.29384639859199524, -0.23393937945365906, -0.07435919344425201, 0.22004467248916626, -0.08610308170318604, -0.20260001718997955, -0.07770124822854996, 0.4080846905708313, -0.09585415571928024, 0.1318352222442627, -0.10875508189201355, 0.2905096411705017, 0.06170142441987991, 0.24660499393939972, 0.04815823584794998, 0.2411346733570099, 0.14518380165100098, -0.08305072784423828, -0.17149779200553894, 0.276716947555542, -0.11501630395650864, 0.05856838449835777, -0.0694814920425415, -0.007029742002487183, 0.3574317395687103, -0.20849089324474335, 0.1460748016834259, -0.01618976891040802, 0.1591152548789978, 0.1268237829208374, -0.19538840651512146, 0.2786802053451538, 0.43435195088386536, 0.4272923767566681, 0.31581276655197144, -0.13576418161392212, 0.13390792906284332, -0.02995372749865055, -0.24337749183177948, -0.07855584472417831, -0.1414855718612671, 0.09395958483219147, 0.45071181654930115, -0.04935157299041748, -0.40807247161865234, 0.16517911851406097, 0.362644225358963, 0.29432833194732666, -0.07146582752466202, 0.15944570302963257, 0.024696867913007736, -0.019327376037836075, 0.4311602711677551, 0.1977316290140152, 0.3780706524848938, -0.0010195317445322871, -0.1333334892988205, 0.32713037729263306, -0.13185665011405945, -0.22927984595298767, 0.321126252412796, 0.3069242835044861, -0.10257022082805634, -0.12995395064353943, -0.01836569607257843, 0.029797449707984924, -0.08738246560096741, -0.206238254904747, -0.026052216067910194, -0.055456168949604034, -0.5837923288345337, 0.17219854891300201, -0.45248204469680786, -0.2302810251712799, 0.12570196390151978, 0.13659483194351196, 0.06916946172714233, -0.30970901250839233, -0.13465017080307007, 0.04280567541718483, -0.20188313722610474, 0.1503467559814453, -0.2555729150772095, 0.008522555232048035, 0.009152645245194435, -0.2478940337896347, -0.18912570178508759, 0.17611895501613617, -0.25279027223587036, -0.14014075696468353, 0.07654048502445221, -0.1650574505329132, 0.18637892603874207, -0.09487704932689667, -0.20813141763210297, -0.35961124300956726, -0.36856842041015625, 0.288122296333313, 0.10802032798528671, 0.3421706557273865, 0.015992648899555206, -0.027753934264183044, 0.11910219490528107, -0.15968714654445648, 0.30369433760643005, 0.313704252243042, 0.1252717226743698, -0.08039364218711853, 0.06266334652900696, -0.11927585303783417, -0.2022758573293686, -0.553242027759552, -0.2434224933385849, -0.20849265158176422, -0.1701662391424179, 0.04679010435938835, 0.1967805176973343, 0.1556888371706009, 0.1611139327287674, 0.09683342278003693, 0.030226193368434906, 0.15647949278354645, -0.14150084555149078, -0.6714044809341431, 0.2817525565624237, -0.08405738323926926, -0.2088068276643753, -0.20954959094524384, -0.10684367269277573, 0.2224656194448471, 0.4172528386116028, -0.5104829668998718, -0.35862109065055847, -0.16242367029190063, 0.33616548776626587, 0.1999857872724533, 0.19315515458583832, 0.060480643063783646, -0.13959699869155884, 0.09866215288639069, -0.29212313890457153, -0.09138599038124084, 0.21610084176063538, -0.11974600702524185, 0.27905502915382385, 0.4241248071193695, 0.5622621178627014, 0.07932539284229279, 0.7194437384605408, 0.23543572425842285, -0.21257023513317108, 0.5997161865234375, -0.12320861965417862, 0.384991854429245, 0.18649636209011078, -0.20200768113136292, 0.29730314016342163, 0.06815023720264435, 0.38485729694366455, 0.04767956957221031, 0.05346406623721123, -0.012343818321824074, -0.3079892098903656, 0.2990959882736206, -0.05382450670003891, -0.5087143182754517, -0.23806367814540863, -0.29624876379966736, 0.24936282634735107, 0.14817696809768677, 0.3998492956161499, -0.19634099304676056, -0.02675524353981018, 0.058367837220430374, 0.38609981536865234, 0.23466357588768005, -0.05289050191640854, -0.09074437618255615, -0.1711263507604599, -0.5317143797874451, 0.4787755608558655, -0.012668605893850327, 0.6536871194839478, -0.10245392471551895, 0.05126563459634781, 0.10596659779548645, -0.1524791568517685, 0.43459439277648926, -0.23687241971492767, -0.08782051503658295, 0.0918731540441513, -0.13628819584846497, -0.5145525932312012, -0.15144243836402893, 0.018046054989099503, 0.17770302295684814, 0.09782284498214722, 0.1864469051361084, -0.4418390393257141, -0.3417760729789734, 0.14518265426158905, -0.16815729439258575, -0.06684465706348419, -0.24039864540100098, -0.24847860634326935, -0.5245044231414795, -0.25057995319366455, -0.005963236093521118, -0.2754223644733429, 0.0017827167175710201, -0.29490727186203003, -0.23866026103496552, -0.01869559846818447, 0.15459159016609192, 0.04512784257531166, 0.029474440962076187, -0.09221141040325165, 0.013832038268446922, 0.23747164011001587, 0.04633570462465286, 0.31062760949134827, 0.24639493227005005, 0.4084910750389099, -0.14112119376659393, -0.6639283895492554, 0.0020670443773269653, -0.11861805617809296, 0.13765208423137665, 0.17269372940063477, -0.2914576828479767, -0.07936722785234451, 0.35776934027671814, 0.2502446174621582, -0.03409452736377716, 0.17618542909622192, 0.2857895493507385, 0.12191271036863327, -0.016058050096035004, -0.7894514203071594, 0.3844599425792694, 0.12672746181488037, -0.036025408655405045, 0.3523919880390167, -0.12117867171764374, -0.17270125448703766, -0.050175100564956665, 0.0002292841672897339, 0.6600335836410522, 0.19042176008224487, 0.029115881770849228, 0.5542620420455933, -0.1424650251865387, 0.2530655562877655, -0.4053325653076172, 0.021086934953927994, -0.0957578644156456, -0.2497854083776474, -0.08975923806428909, -0.21113640069961548, 0.2913241386413574, 0.09204359352588654, -0.17590667307376862, 0.3902814984321594, 0.21728526055812836, -0.21109727025032043, 0.3057067096233368, 0.28178146481513977, -0.3644591271877289, -0.2979925274848938, -0.1370735913515091, 0.02186354249715805, 0.14153699576854706, 0.14514264464378357, 0.012135140597820282, -0.14555145800113678, -0.023574694991111755, -0.07071144878864288, -0.07332233339548111, 0.21656349301338196, -0.34117573499679565, 0.08695709705352783, 0.23422928154468536, -0.05740278959274292, 0.3095087707042694, 0.3661574423313141, 0.27439412474632263, -0.016301408410072327, -0.1994534283876419, 0.23799706995487213, -0.21104291081428528, 0.4566430449485779, 0.15112356841564178, -0.26440322399139404, 0.3464354872703552, -0.07427570223808289, -0.5764073133468628, -0.05651906132698059, -0.09033466875553131, -0.3403882384300232, -0.1499963104724884, -0.12815773487091064, 0.350544273853302, -0.054694365710020065, 0.27851980924606323, 0.01527375727891922, -0.13989520072937012, -0.0910695493221283, -0.01284145936369896, 0.052002500742673874, -0.03243441507220268, 0.39908283948898315, -0.18929970264434814, -0.3632793128490448, 0.08584100008010864, 0.414761483669281, -0.09239774197340012, 0.4232412278652191, 0.4624118506908417, -0.033674292266368866, -0.053950030356645584, 0.02020404487848282, -0.1573805809020996, -0.5128940343856812, 0.1026621088385582, -0.06294788420200348, 0.02811869978904724, -0.07895013689994812, -0.4250292479991913, -0.24659088253974915, -0.44291162490844727, -0.22646015882492065, 0.07159598171710968, -0.33106184005737305, -0.19211478531360626, -0.04144500941038132, -0.3171217441558838, -0.03729734942317009, 0.19589918851852417, 0.24538946151733398, 0.30096757411956787, -0.07200150191783905, -0.11692146211862564, -0.09809082746505737, 0.07110309600830078, 0.11153411120176315, 0.3116377890110016, 0.12093570828437805, 0.152289018034935, -0.04694914445281029, -0.08307455480098724, -0.2065650224685669, -0.3133707344532013, -0.02040158212184906, -0.31113725900650024, 0.23698937892913818, 0.13756510615348816, -0.3745565414428711, -0.001411603530868888, -0.17386305332183838, -0.2228088080883026, -0.20321045815944672, 0.4815472364425659, 0.05486892908811569, -0.2290583699941635, 0.0997302234172821, -0.2521544098854065, 0.1438349187374115, -0.22613494098186493, 0.05651593953371048, 0.10125894844532013, 0.36659735441207886, 0.0336766317486763, 0.3596486449241638, -0.15938466787338257, -0.05831919237971306, -0.19258759915828705, -0.03919653594493866, 0.23125508427619934, 0.190248042345047, 0.46760594844818115, -0.028024539351463318, 0.06502644717693329, 0.0876542255282402, -0.13342416286468506, 0.3589514493942261, 0.025769323110580444, 0.11699223518371582, 0.1874145269393921, 0.05129612982273102, -0.08198320865631104, 0.06088601052761078, 0.467740535736084, -0.0313953272998333, 0.06743411719799042, 0.019474580883979797, 0.2255198061466217, -0.018636755645275116, 0.27028656005859375, -0.0381585955619812, 0.275606244802475, -0.35104233026504517, 0.230366513133049, 0.18840020895004272, -0.12286843359470367, 0.45749393105506897, 0.10829053819179535, -0.11176523566246033, -0.10829370468854904, 0.3956206440925598, 0.22131729125976562, 0.22909918427467346, 0.13827477395534515, 0.14594897627830505, 0.07733596861362457, -0.5741909146308899, -0.022104647010564804, -0.08001954853534698, -0.27308303117752075, 0.19548484683036804, -0.035597220063209534, 0.37268874049186707, 0.006074540317058563, 0.1421317607164383, -0.26954585313796997, 0.26740124821662903, 0.014619709923863411, -0.5388490557670593, -0.3010958731174469, -0.035594649612903595, -0.04699394851922989, -0.005614187568426132, 0.10358878970146179, -0.28326094150543213, 0.149332657456398, 0.13832469284534454, -0.18418513238430023, -0.4276435077190399, 0.2011910378932953, 0.023523366078734398, 0.09323262423276901, 0.015939470380544662, 0.35983315110206604, 0.04509635269641876, -0.18238547444343567, 0.13316665589809418, 0.13631278276443481, 0.1909792423248291, 0.20849885046482086, -0.04041426256299019, -0.11666906625032425, 0.3098432719707489, 0.10907116532325745, -0.35446178913116455, 0.055395014584064484, -0.10106781125068665, -0.15115191042423248, 0.2807207405567169, -0.025012390688061714, 0.011280047707259655, 0.022755103185772896, 0.07624870538711548, 0.3531360328197479, -0.477238267660141, 0.46680212020874023, 0.08751384913921356, 0.0855378732085228, 0.24806548655033112, -0.16854026913642883, -0.39011484384536743, 0.18959937989711761, 0.6280433535575867, -0.15810152888298035, 0.27007949352264404, -0.2449035495519638, -0.01896623894572258, -0.12816914916038513, 0.2047208845615387, 0.1627490520477295, -0.07339907437562943, -0.14932206273078918, 0.3471461534500122, -0.43614739179611206, -0.08644791692495346, 0.3481917977333069, -0.2629474103450775, 0.029321322217583656, 0.3882409930229187, 0.041862405836582184, 0.014355437830090523, 0.11232802271842957, -0.1896977573633194, 0.6637827754020691, -0.012198351323604584, -0.2537849545478821, -0.08545637130737305, -0.4088578224182129, 0.4042659401893616, 0.2214176207780838, -0.5210458636283875, 0.09702306985855103, 0.050362665206193924, -0.1342056393623352, -0.04654644429683685, -0.1539943814277649, 0.367573082447052, -0.31422531604766846, 0.5347769260406494, 0.12436951696872711, 0.32410264015197754, -0.11065611243247986, 0.0019968878477811813, -0.23991873860359192, -0.03880149498581886, -0.21470871567726135, -0.003874965012073517, -0.2818673551082611, -0.06604498624801636, -0.23708459734916687, -0.00852084532380104, -0.3261295258998871, 0.25531265139579773, 0.08997012674808502, -0.27140581607818604, 0.011230593547224998, 0.18325452506542206, -0.12045735120773315, 0.032723139971494675, -0.10485277324914932, 0.18786326050758362, -0.22179046273231506, 0.1728767603635788, -0.11919206380844116, -0.2219742387533188, 0.4252486228942871, -0.24812233448028564, -0.01699841581285, -0.4982700049877167, 0.24344512820243835, -0.10776475816965103, 0.23243051767349243, -0.07080342620611191, 0.10607952624559402, 0.33719316124916077, -0.20290854573249817, -0.19927483797073364, 0.0747050866484642, 0.3540249764919281, 0.18083350360393524, -0.266920804977417, 0.08758392184972763, -0.05255811661481857, -0.35329240560531616, 0.06869912147521973, -0.17105816304683685 ]
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.
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. `
[ 0.04401044920086861, 0.1051892638206482, 0.04210076853632927, 0.271170049905777, 0.4153468608856201, 0.40644606947898865, 0.6712467670440674, 0.12305933237075806, 0.37308964133262634, 0.13794007897377014, -0.2559000551700592, 0.2542686462402344, 0.011830683797597885, 0.3167993426322937, -0.34988611936569214, 0.020823614671826363, 0.016965053975582123, 0.14395564794540405, -0.060689106583595276, 0.045482486486434937, -0.287631630897522, -0.12349905073642731, -0.35584741830825806, 0.20018604397773743, -0.6617883443832397, -0.1004900261759758, -0.01637948304414749, 0.09171061217784882, 0.13154727220535278, -0.17407841980457306, 0.4844242334365845, -0.14224036037921906, 0.22268052399158478, 0.3210432529449463, -0.00012183876242488623, 0.032930053770542145, 0.24094271659851074, -0.04504871740937233, -0.28768470883369446, -0.2766337990760803, -0.503639817237854, -0.044190049171447754, -0.07436402142047882, -0.3406754434108734, -0.24817907810211182, -0.030698217451572418, -0.32722848653793335, -0.7566540241241455, -0.24044851958751678, 0.1526908576488495, 0.13557833433151245, 0.38393357396125793, 0.1801142692565918, 0.02120051719248295, 0.5015769004821777, -0.012613363564014435, -0.10238195955753326, 0.32411083579063416, 0.2389003336429596, -0.25997352600097656, 0.3831690549850464, 0.3191671371459961, 0.03486074507236481, -0.0991356372833252, 0.27314990758895874, 0.25397056341171265, 0.07990764081478119, -0.20858515799045563, -0.0159527026116848, 0.23780164122581482, 0.7662020921707153, -0.249578595161438, -0.2804569602012634, 0.05408436805009842, 0.02884204313158989, -0.6597926616668701, -0.05866234749555588, 0.17527920007705688, 0.2646556794643402, 0.35575684905052185, 0.15843428671360016, 0.2564583420753479, -0.2014465481042862, 0.13043181598186493, 0.12718242406845093, 0.3361928164958954, -0.0645282194018364, 0.30164507031440735, 0.1734829694032669, -0.11086516082286835, 0.0599774606525898, 0.20510224997997284, 0.040889691561460495, -0.09671053290367126, -0.614690363407135, -0.28925031423568726, -0.2879551947116852, -0.11643803864717484, -0.144012451171875, 0.3623351454734802, -0.18436448276042938, -0.27182695269584656, 0.1654062122106552, 0.2320834994316101, 0.6536477208137512, 0.13669566810131073, 0.05267171561717987, 0.5237644910812378, 0.30053460597991943, -0.02627621404826641, -0.10655337572097778, -0.18314871191978455, -0.015016742050647736, 0.031388502568006516, 0.43389102816581726, -0.05339927226305008, 0.3382680416107178, -0.19974800944328308, -0.5414418578147888, -0.07040751725435257, -0.23420339822769165, -0.08410251885652542, 0.07139021158218384, 0.25181204080581665, 0.08889712393283844, 0.062219616025686264, -0.13345354795455933, 0.3533191680908203, 0.1770636886358261, -0.46732985973358154, -0.13975311815738678, 0.3426568806171417, -0.14757421612739563, -0.03071153350174427, -0.08433640003204346, 0.10339143872261047, 0.10778121650218964, -0.13288670778274536, 0.1662977933883667, -0.28917545080184937, 0.0350506529211998, -0.2898823618888855, -0.08010997623205185, 0.10466630756855011, 0.007890604436397552, -0.07101117074489594, 0.4569505453109741, -0.30444273352622986, -0.23298361897468567, 0.16004347801208496, -0.28489407896995544, -0.357820600271225, -0.30927616357803345, 0.051296085119247437, 0.00902179628610611, -0.15174315869808197, 0.011268623173236847, -0.23701892793178558, 0.33037590980529785, -0.1714777946472168, 0.15936246514320374, -0.03995963931083679, 0.07542136311531067, -0.21146303415298462, -0.07834084331989288, 0.3467504382133484, -0.6978262662887573, -0.0501093789935112, -0.07157618552446365, 0.18195636570453644, 0.3522035777568817, 0.4425756335258484, -0.09952633082866669, 0.10688184946775436, 0.06560865789651871, -0.12775567173957825, 0.18025025725364685, -0.4821668565273285, -0.3024861812591553, 0.1961195170879364, -0.12681788206100464, 0.1691863089799881, -0.015352435410022736, 0.6423231363296509, 0.0036536664701998234, -0.10906965285539627, 0.08774778246879578, 0.32344377040863037, -0.10187394917011261, -0.18800221383571625, -0.09842780232429504, -0.025693507865071297, 0.5177499651908875, 0.16467779874801636, -0.11487913131713867, 0.5107844471931458, 0.04056210815906525, -0.3274655342102051, -0.044261634349823, -0.02774963155388832, 0.2648352384567261, -0.015981975942850113, 0.5597980618476868, 0.4932422637939453, -0.19827555119991302, -0.010327823460102081, -0.12293229252099991, 0.2049957811832428, 0.343009352684021, 0.05438212677836418, 0.04287637397646904, -0.502602219581604, -0.4142123758792877, 0.09237904846668243, -0.1387430876493454, -0.28607168793678284, -0.054364077746868134, -0.043166786432266235, 0.02341412752866745, -0.1295652985572815, -0.27661657333374023, 0.24028995633125305, -0.2099357545375824, 0.058779891580343246, -0.2590232789516449, 0.4183793067932129, -0.12292084842920303, 0.04940979182720184, -0.13363607227802277, 0.3499619662761688, 0.1510988175868988, -0.005900846794247627, -0.03416045010089874, 0.5960913896560669, -0.011423127725720406, -0.08123989403247833, 0.2019793689250946, -0.001985207200050354, 0.141321063041687, -0.462624728679657, 0.0032236799597740173, -0.09939412772655487, 0.28551873564720154, -0.014605477452278137, 0.12271920591592789, 0.39831340312957764, -0.045853521674871445, 0.38809651136398315, 0.015482805669307709, 0.20489376783370972, 0.08946700394153595, -0.2306048423051834, -0.14190322160720825, -0.1568857878446579, -0.09549486637115479, -0.7143245935440063, 0.1375284045934677, 0.03403589129447937, -0.25583797693252563, 0.023991823196411133, 0.2837793529033661, 0.026784125715494156, 0.1553097516298294, -0.0014750249683856964, 0.04747454822063446, 0.11298822611570358, -0.04689174145460129, -0.15556170046329498, 0.48672574758529663, 0.0714239850640297, -0.1663018763065338, -0.11999037116765976, 0.0017788945697247982, -0.03104083240032196, 0.009351290762424469, 0.1576506644487381, 0.28406116366386414, -0.04939793795347214, 0.002360084094107151, 0.02432134374976158, 0.30340924859046936, -0.3861405849456787, -0.14125363528728485, 0.15394200384616852, -0.2647722065448761, 0.2767574191093445, -0.44507482647895813, -0.12929214537143707, 0.02610126882791519, -0.48588570952415466, 0.03693411499261856, -0.32612186670303345, -0.15583230555057526, 0.13329583406448364, -0.10089576244354248, 0.23585762083530426, -0.4746617078781128, 0.27731937170028687, -0.023444555699825287, -0.04378403723239899, 0.029927052557468414, -0.5602403879165649, -0.1299644410610199, 0.005948081612586975, -0.16733135282993317, -0.03215799108147621, 0.2783590853214264, 0.06494158506393433, -0.14357523620128632, -0.26786693930625916, -0.09023171663284302, 0.07828646153211594, -0.055550724267959595, 0.4007367491722107, -0.04279394447803497, -0.06756366789340973, 0.05591592192649841, -0.18760469555854797, 0.3062705993652344, -0.1286064237356186, 0.10834474861621857, 0.031028714030981064, -0.03557544946670532, -0.11221478879451752, 0.18832148611545563, -0.4446548521518707, -0.4118089973926544, -0.35566920042037964, -0.09572309255599976, -0.18849986791610718, -0.1630878746509552, -0.1281721591949463, -0.025916896760463715, -0.02909594029188156, 0.5508634448051453, 0.06375735253095627, -0.3401748239994049, -0.148456871509552, 0.1314808875322342, -0.1419711410999298, -0.14436089992523193, 0.07048508524894714, -0.20753982663154602, 0.18826459348201752, -0.00741833820939064, -0.3686468005180359, 0.27647289633750916, -0.15541061758995056, 0.022143911570310593, 0.072548508644104, 0.037950098514556885, 0.22461892664432526, -0.21229970455169678, 0.01821429468691349, -0.04120928794145584, -0.32125118374824524, 0.27002814412117004, 0.17193132638931274, 0.19582220911979675, 0.36068570613861084, 0.3412971496582031, -0.18323399126529694, 0.594617486000061, -0.0029865261167287827, -0.05180451646447182, 0.3927667737007141, -0.2789005935192108, 0.4324164092540741, -0.056426964700222015, -0.41013258695602417, -0.022374266758561134, -0.039527133107185364, -0.1768546998500824, -0.02858424186706543, -0.21576541662216187, -0.0862727090716362, -0.33939921855926514, 0.13273492455482483, -0.2601298987865448, -0.03921008110046387, -0.10602536797523499, 0.14553165435791016, 0.21206682920455933, 0.16147607564926147, -0.14968454837799072, 0.11348748207092285, -0.16911831498146057, -0.13483169674873352, 0.15330645442008972, 0.18045085668563843, 0.023663681000471115, -0.1254514455795288, -0.32914847135543823, 0.003478728234767914, 0.21904806792736053, 0.1372167021036148, 0.3767004907131195, -0.06215799227356911, -0.341866672039032, -0.08981940150260925, 0.24476200342178345, 0.636892557144165, -0.2119244635105133, -0.13369032740592957, 0.15053747594356537, 0.1775447130203247, -0.006968334317207336, -0.14644695818424225, -0.175153449177742, -0.20341730117797852, 0.32910671830177307, 0.15747982263565063, -0.10668864846229553, 0.18933169543743134, 0.6644372940063477, -0.02921062335371971, -0.15426112711429596, -0.24198728799819946, -0.37116342782974243, -0.06277459859848022, -0.3505362570285797, 0.07966946065425873, 0.1360424906015396, 0.23515409231185913, -0.07794128358364105, 0.21388377249240875, -0.22495806217193604, -0.08895348012447357, 0.23750124871730804, 0.22241637110710144, 0.1980629563331604, -0.1795731782913208, 0.314362108707428, -0.05247368663549423, 0.08026756346225739, 0.43579772114753723, 0.8861547112464905, -0.0678337961435318, -0.6140271425247192, 0.19874295592308044, -0.2542503774166107, 0.6224567294120789, 0.16529393196105957, -0.022883888334035873, 0.0599886029958725, -0.3251398205757141, -0.08989925682544708, -0.060660313814878464, -0.18320685625076294, 0.1797880381345749, -0.005124405957758427, -0.4724994897842407, -0.229075625538826, 0.2692170739173889, 0.1084669977426529, -0.01770225167274475, 0.12972742319107056, 0.44929200410842896, -0.0802866518497467, 0.18677076697349548, 0.04448598250746727, 1.1028748750686646, 0.14821040630340576, 0.18303832411766052, 0.010874437168240547, 0.11790657043457031, 0.5575262308120728, -0.07359354943037033, 0.12785650789737701, -0.30547696352005005, -0.6951587200164795, -0.10694946348667145, -0.10505621135234833, 0.25485551357269287, 0.15198233723640442, -0.18856845796108246, 0.5362847447395325, -0.44712209701538086, 0.38151320815086365, 0.10670159757137299, -0.25351935625076294, 0.34704163670539856, -0.1795061230659485, 0.10424545407295227, -0.01649797149002552, -0.05339517444372177, 0.2886194884777069, -0.09739123284816742, 0.27989864349365234, -0.22777460515499115, -0.030986066907644272, -0.29224663972854614, 0.16677212715148926, 0.29213517904281616, 0.26374441385269165, 0.218693807721138, -0.030932951718568802, 0.20429179072380066, 0.049660760909318924, 0.4926137328147888, 0.12639224529266357, 0.11572004109621048, -0.0005619227886199951, 0.34545931220054626, 0.01975172571837902, 0.017035318538546562, 0.28449466824531555, 0.3469969928264618, 0.00975004956126213, -0.4670303165912628, 0.3913508355617523, 0.1622520238161087, -0.3622148633003235, -0.16901984810829163, 0.04121135175228119, 0.11526139080524445, -0.38520777225494385, -0.39967066049575806, 0.08469486981630325, 0.03690134361386299, -0.519853949546814, 0.024296849966049194, -0.019783973693847656, -0.14358432590961456, -0.02372635155916214, -0.14922522008419037, -0.4050735831260681, -0.23071758449077606, -0.0023803412914276123, 0.15608973801136017, 0.21310317516326904, 0.18417829275131226, -0.06302911788225174, -0.10093852132558823, -0.14811384677886963, 0.1879018247127533, 0.07369464635848999, -0.22133198380470276, 0.19747690856456757, 0.011341636069118977, 0.13985364139080048, -0.23311756551265717, 0.13546118140220642, 0.17860068380832672, 0.16222265362739563, -0.061369284987449646, -0.6186674237251282, -0.08032327145338058, 0.22995227575302124, 0.2932274639606476, 0.16081704199314117, -0.223827064037323, 0.2968862056732178, -0.30188098549842834, 0.1583222895860672, -0.20315515995025635, -0.17174895107746124, -0.3435540497303009, 0.12943747639656067, 0.6164475679397583, 0.1389758586883545, 0.09569510817527771, -0.03548785299062729, 0.04650568217039108, 0.158985435962677, 0.255449503660202, -0.06333035230636597, -0.35704582929611206, 0.19367754459381104, -0.06928861886262894, -0.1035081073641777, -0.24641069769859314, -0.280534029006958, -0.19626089930534363, -0.12929053604602814, 0.06381338834762573, 0.15009552240371704, 0.05227988213300705, 0.3288498818874359, -0.33821848034858704, -0.055665113031864166, -0.21753394603729248, 0.2487838715314865, -0.010340280830860138, 0.035296838730573654, 0.09483911097049713, 0.11366591602563858, 0.13883808255195618, -0.040124181658029556, -0.19841808080673218, -0.13606324791908264, -0.08870097994804382, 0.027774861082434654, 0.2256617248058319, -0.2763173580169678, 0.2579174041748047, 0.22517985105514526, 0.2325569987297058, 0.24777743220329285, 0.0032824836671352386, 0.014386812224984169, 0.14632445573806763, 0.0757550448179245, -0.44529250264167786, -0.08059895783662796, 0.03267534822225571, -0.07795438170433044, 0.05449372157454491, 0.5507078766822815, 0.06692717969417572, 0.37928131222724915, -0.10781125724315643, -0.033585891127586365, 0.2572822570800781, -0.269835889339447, 0.07392227649688721, 0.09019903838634491, -0.04140042886137962, 0.17399746179580688, 0.3011423647403717, 0.3204214870929718, 0.10260741412639618, 0.26101595163345337, -0.13378795981407166, 0.23033283650875092, 0.08206115663051605, 0.046980179846286774, -0.16432592272758484, -0.2617557942867279, 0.3236065208911896, 0.2821957767009735, -0.3251343369483948, 0.062392108142375946, -0.17765194177627563, 0.11584898829460144, -0.42015260457992554, 0.04089688882231712, 0.05607379972934723, -0.12294109165668488, -0.05396465212106705, -0.07631267607212067, -0.0018054582178592682, -0.17185689508914948, -0.2069481611251831, -0.09162744879722595, 0.12939505279064178, 0.013348955661058426, 0.0311291441321373, -0.2155981808900833, 0.046972472220659256, -0.4325757920742035, 0.09968741983175278, 0.20989811420440674, 0.26943376660346985, -0.1848120242357254, -0.02820401079952717, 0.09886038303375244, 0.032207392156124115, 0.4395230710506439, -0.041414275765419006, 0.3784931004047394, 0.20070955157279968, 0.11294016242027283, -0.08431953191757202, -0.16971956193447113, -0.3784656524658203, 0.10190778970718384, 0.3852231800556183, 0.15588070452213287, -0.21332967281341553, 0.22428534924983978, 0.05270884186029434, -0.08511730283498764, 0.29006698727607727, 0.13307073712348938, 0.6639918088912964, -0.5651229023933411, 0.20628713071346283, -0.07150912284851074, -0.3776088058948517, 0.08810584247112274, -0.034888021647930145, -0.15817704796791077, -0.16944019496440887, 0.13177569210529327, -0.12360486388206482, 0.11808965355157852, 0.0982016772031784, 0.03295143321156502, -0.14638619124889374, 0.2334672510623932, 0.4864667057991028, -0.21304389834403992, -0.3305496275424957, 0.10722553730010986, -0.4834999442100525, 0.23487898707389832, -0.2949458658695221, -0.5651181936264038, 0.013128596358001232, 0.1441151350736618, 0.14568567276000977, 0.29414796829223633, 0.12322074174880981, -0.14194051921367645, -0.09759840369224548, -0.1576182097196579, -0.2630940079689026, -0.4215463697910309, -0.1444341391324997, 0.0713864415884018, 0.10129009187221527, -0.27599576115608215, -0.10281538963317871, 0.2894901931285858, -0.12729015946388245, -0.1161828339099884, -0.21694914996623993, 0.15023313462734222, -0.01964656263589859, 0.09078700095415115, 0.04965200275182724, 0.7384727001190186, -0.02232680842280388, 0.060318879783153534, 0.0694049745798111, -0.3870488107204437, -0.2735742926597595, -0.009469576179981232, 0.2247498631477356, 0.2364715337753296, -0.22787252068519592, -0.023609135299921036, -0.2672159969806671, 0.4708019196987152, 0.18833893537521362, 0.024164285510778427, -0.22946420311927795, 0.12214862555265427, -0.030230339616537094, -0.0991448387503624, 0.14778611063957214, 0.1003328263759613, 0.027193864807486534, 0.2830205261707306, -0.0144585520029068, -0.30078303813934326, 0.5963174104690552, 0.029269665479660034, -0.4251505732536316, -0.11749395728111267, 0.05348275229334831, 0.39381664991378784, -0.08028656989336014, -0.11950655281543732, 0.11026421934366226, 0.31520557403564453, 0.031075861304998398, -0.010121176019310951, 0.161407008767128, -0.3991340696811676, 0.17303411662578583, 0.08592648804187775, 0.21521352231502533, -0.06493527442216873, -0.07357495278120041, 0.19113749265670776, -0.16094312071800232 ]
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
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) ```
[ -0.2229905128479004, -0.335707426071167, -0.05927114933729172, 0.1883198320865631, 0.1620415896177292, -0.1879776120185852, 0.4985237121582031, 0.06349752843379974, -0.009108362719416618, 0.07977113127708435, 0.3565216660499573, 0.2385641634464264, -0.0017630523070693016, 0.27904415130615234, -0.4352375566959381, -0.2027876079082489, 0.28105399012565613, 0.05386682599782944, 0.12135065346956253, 0.14021962881088257, -0.17497263848781586, 0.11300520598888397, -0.3761160373687744, -0.17217351496219635, -0.5670257806777954, -0.1121697947382927, -0.23887762427330017, -0.25603121519088745, 0.29950907826423645, -0.0691734030842781, 0.06811809539794922, -0.15275977551937103, -0.5374451875686646, 0.6407016515731812, -0.00011376518523320556, 0.07682335376739502, 0.37345588207244873, -0.13790306448936462, 0.019297786056995392, -0.2946815490722656, -0.41829460859298706, -0.2667688727378845, -0.20658676326274872, -0.13904935121536255, 0.19874504208564758, 0.12161620706319809, -0.07985979318618774, -0.4875127077102661, 0.08307962864637375, -0.008404863066971302, 0.12355813384056091, 0.34666451811790466, 0.022191759198904037, -0.09067945182323456, 0.07586441189050674, 0.17080506682395935, -0.08473316580057144, -0.5547665357589722, 0.24418577551841736, -0.05079107731580734, -0.06619221717119217, 0.2381320595741272, -0.22431521117687225, 0.1213676780462265, 0.004520837217569351, 0.09637703001499176, 0.06903453171253204, -0.3964322805404663, 0.043794889003038406, 0.31072360277175903, -0.12854710221290588, 0.25727272033691406, -0.3534408211708069, -0.5165061950683594, -0.21679553389549255, -0.39076730608940125, 0.1933148354291916, 0.16103000938892365, 0.0590178482234478, 0.014156118035316467, -0.5104671120643616, 0.24941188097000122, 0.2379201054573059, 0.07215899974107742, -0.23978930711746216, 0.21055099368095398, 0.10950078815221786, 0.2537113428115845, -0.2625390291213989, -0.1311676949262619, -0.22446486353874207, -0.19224008917808533, -0.06528580188751221, 0.032946161925792694, -0.28832632303237915, 0.1840945929288864, 0.33310019969940186, -0.2300204336643219, 0.046819351613521576, -0.14082057774066925, -0.11975093185901642, -0.11533207446336746, -0.022935785353183746, 0.24444806575775146, 0.35569047927856445, -0.1885640174150467, 0.10692232847213745, 0.011736300773918629, -0.1619013398885727, -0.08393948525190353, -0.10531386733055115, 0.029513301327824593, 0.6747017502784729, -0.1681838035583496, 0.0889320820569992, 0.20808979868888855, 0.15993863344192505, 0.08845224976539612, -0.13685917854309082, 0.20656415820121765, -0.25848743319511414, 0.0731370747089386, -0.18921758234500885, -0.16082683205604553, 0.011983243748545647, 0.7013283967971802, -0.0019404701888561249, 0.31043630838394165, -0.10293293744325638, -0.20688295364379883, -0.06463292986154556, -0.2099570631980896, -0.2350085973739624, 0.01942422054708004, -0.028833236545324326, 0.27350714802742004, -0.080624520778656, 0.264763742685318, 0.13067413866519928, -0.2018287479877472, -0.31074365973472595, -0.4364768862724304, 0.34310922026634216, 0.2545246183872223, 0.16337911784648895, 0.12272695451974869, -0.12599895894527435, -0.12585663795471191, -0.139990895986557, 0.1527416706085205, -0.08251357823610306, -0.3000655770301819, 0.02747325785458088, 0.15905505418777466, -0.1707354187965393, 0.37770670652389526, -0.07928150147199631, 0.2464175522327423, 0.4465136229991913, 0.04506337270140648, -0.20587679743766785, -0.363542377948761, -0.2345183938741684, -0.3046639859676361, -0.042412854731082916, 0.34005987644195557, -0.037531644105911255, 0.20705559849739075, -0.11760338395833969, 0.21785758435726166, 0.026918955147266388, 0.24835632741451263, 0.19982939958572388, 0.11536991596221924, -0.2020602524280548, 0.48122745752334595, -0.13076400756835938, -0.04962548613548279, -0.11198164522647858, 0.45217767357826233, -0.10326528549194336, 0.42110636830329895, -0.0727405771613121, 0.07165024429559708, 0.3067508339881897, -0.013405616395175457, 0.4197026491165161, 0.2928202748298645, -0.30785486102104187, 0.11201123148202896, -0.3280889689922333, -0.0441519096493721, 0.0998113602399826, -0.1376817673444748, 0.020643487572669983, -0.06189281493425369, -0.0682186707854271, -0.30564528703689575, 0.2685620188713074, -0.05162157490849495, 0.1950177252292633, 0.12375417351722717, 0.15923234820365906, 0.20657995343208313, -0.19966255128383636, -0.1963452398777008, -0.8078374266624451, 0.2682746350765228, 0.05970533937215805, -0.09627148509025574, -0.15421031415462494, -0.19230377674102783, 0.18549540638923645, 0.2461564689874649, -0.14758293330669403, 0.0870843380689621, 0.09863556921482086, 0.028730716556310654, -0.16993765532970428, -0.23100382089614868, 0.1061508059501648, 0.2439103126525879, 0.27360042929649353, -0.20243535935878754, -0.13996925950050354, 0.3352660834789276, 0.009184924885630608, -0.11076226085424423, -0.10933758318424225, 0.07953692227602005, 0.2645373046398163, 0.17666685581207275, 0.03193146735429764, 0.3969723880290985, 0.20989099144935608, -0.016878493130207062, -0.22258281707763672, 0.13263601064682007, 0.18220233917236328, 0.11132964491844177, -0.13414478302001953, 0.21575282514095306, -0.00045350659638643265, -0.26517602801322937, -0.008424162864685059, 0.35100841522216797, 0.010937266051769257, 0.5071073174476624, -0.16946306824684143, 0.155697762966156, 0.4410797357559204, -0.10814861953258514, -0.047216691076755524, -0.21608752012252808, 0.2678268849849701, -0.05057442560791969, -0.29053518176078796, 0.10274312645196915, -0.5407801866531372, 0.19644871354103088, 0.4119817018508911, 0.09783047437667847, 0.062485676258802414, -0.11702773720026016, 0.12196330726146698, 0.09859081357717514, 0.06763578951358795, 0.05555769428610802, 0.42813295125961304, 0.012576274573802948, -0.2407972812652588, 0.001520337536931038, -0.12471272796392441, -0.06382371485233307, 0.09064149856567383, 0.11520694196224213, 0.10620732605457306, 0.3642045557498932, 0.3328858017921448, 0.23631055653095245, 0.27275213599205017, -0.20079271495342255, 0.06007126718759537, -0.2716585397720337, -0.3013075590133667, 0.10527626425027847, -0.44347062706947327, 0.320463091135025, -0.07833663374185562, 0.016799483448266983, -0.4730793833732605, -0.7042862772941589, -0.006240908056497574, 0.4228776693344116, -0.34946054220199585, 0.22512270510196686, 0.11441770195960999, -0.09967298805713654, 0.058936528861522675, -0.11238565295934677, 0.05230649560689926, -0.00012236926704645157, -0.08947620540857315, -0.08365753293037415, 0.18813806772232056, -0.0056811729446053505, 0.05539855360984802, 0.14455923438072205, -0.2821806073188782, -0.36540940403938293, -0.07215292751789093, 0.0936899483203888, -0.2253730744123459, 0.1675317883491516, 0.23595041036605835, -0.14278057217597961, 0.03711219131946564, -0.21015961468219757, 0.42820295691490173, 0.12106727063655853, -0.16109950840473175, 0.308646559715271, 0.1410035938024521, -0.3798794448375702, -0.3461477756500244, -0.08975791186094284, 0.06672391295433044, -0.3404028117656708, 0.2853437662124634, -0.3672187030315399, 0.22836118936538696, -0.12423104792833328, 0.20253527164459229, -0.4052532911300659, -0.23669862747192383, -0.3135282099246979, -0.23612332344055176, 0.27990013360977173, 0.28017517924308777, 0.031829092651605606, -0.2118370234966278, -0.021586094051599503, -0.2198050320148468, -0.23973289132118225, 0.6537202596664429, -0.2020011991262436, 0.019030407071113586, 0.029462352395057678, 0.13516652584075928, 0.18419811129570007, 0.06977209448814392, 0.18439793586730957, 0.06713724881410599, 0.04042842239141464, -0.22890320420265198, -0.34403926134109497, 0.21569466590881348, 0.26112326979637146, 0.1027497947216034, 0.23388531804084778, -0.10863310843706131, 0.12345775961875916, 0.5089367628097534, 0.438254177570343, -0.16329991817474365, 0.05269478261470795, -0.0636567771434784, -0.0903317779302597, -0.35079801082611084, -0.05964156240224838, -0.13490797579288483, -0.2641074061393738, -0.06410853564739227, -0.10628414154052734, -0.09655718505382538, -0.04617522656917572, 0.06432636082172394, 0.5109121203422546, -0.4111848473548889, -0.37375298142433167, 0.3225444555282593, -0.08331559598445892, 0.35584110021591187, 0.007458973675966263, 0.04239298403263092, -0.07500092685222626, 0.057531796395778656, -0.11857208609580994, 0.012462705373764038, 0.2065061330795288, -0.17068003118038177, -0.268376886844635, 0.09305991232395172, -0.17495295405387878, 0.35525795817375183, 0.3217892646789551, 0.30833882093429565, 0.09338827431201935, -0.18543654680252075, -0.17580263316631317, 0.08796613663434982, 0.6004254817962646, -0.2978893518447876, -0.11420044302940369, 0.2481158971786499, -0.2609941363334656, 0.1331983059644699, -0.2302224338054657, -0.1377941370010376, 0.6016181111335754, 0.27359387278556824, 0.414499968290329, -0.36199963092803955, 0.19441522657871246, -0.17646323144435883, 0.06703238934278488, -0.11233239620923996, -0.0534307137131691, -0.016121894121170044, 0.14842447638511658, -0.17227625846862793, -0.15337610244750977, 0.43545863032341003, 0.36444732546806335, -0.022666282951831818, -0.08012211322784424, -0.2845110595226288, 0.0020050667226314545, 0.017284691333770752, -0.05086980760097504, 0.5098164081573486, -0.38155102729797363, 0.3117648661136627, -0.4028148055076599, 0.143844336271286, 0.008092100732028484, 0.2424638420343399, 0.07420185953378677, 0.04229608550667763, 0.08836566656827927, -0.6263484954833984, 0.18752041459083557, 0.37741273641586304, 0.17107568681240082, 0.15865732729434967, -0.010969836264848709, 0.2765616774559021, -0.24586498737335205, -0.1682577133178711, 0.3588906228542328, 0.03946420177817345, -0.12301657348871231, 0.06277802586555481, 0.05254964157938957, -0.0365377739071846, 0.0052793025970458984, 0.3418962061405182, -0.1625911295413971, -0.06482332944869995, 0.16157266497612, 0.016537614166736603, 0.6283394694328308, 0.1125686839222908, 0.03252488747239113, 0.21447226405143738, 0.12858779728412628, 0.032223138958215714, 0.21438856422901154, 0.5292062163352966, -0.1913493126630783, -0.13730601966381073, -0.07347003370523453, -0.10064302384853363, -0.13358628749847412, 0.21476061642169952, -0.11760225892066956, 0.35720035433769226, 0.025236688554286957, -0.03568060323596001, -0.11845892667770386, -0.19340860843658447, 0.22923554480075836, -0.2549993693828583, -0.1889854073524475, 0.007549237459897995, 0.1347004622220993, 0.07801260054111481, -0.08758522570133209, 0.009597021155059338, -0.046541761606931686, -0.19700567424297333, -0.5435235500335693, 0.10683275014162064, -0.10938646644353867, 0.12997585535049438, 0.33686816692352295, -0.11076623201370239, -0.16902676224708557, -0.02622484788298607, -0.5276888608932495, -0.02616354450583458, 0.1611308604478836, -0.03292922303080559, 0.3559497892856598, 0.09499133378267288, 0.021696878597140312, -0.3095080852508545, 0.11864899843931198, 0.049829162657260895, -0.21984130144119263, -0.1894911825656891, -0.18382519483566284, -0.284737229347229, -0.16714981198310852, 0.21930181980133057, -0.16126024723052979, 0.021310575306415558, -0.2669251263141632, 0.18849393725395203, 0.23127052187919617, 0.011249836534261703, 0.007610876113176346, 0.19983747601509094, -0.14694510400295258, 0.365181565284729, -0.33011630177497864, -0.05392204225063324, -0.07503354549407959, -0.03192048519849777, -0.01956668123602867, 0.015372809022665024, 0.117188461124897, 0.27291345596313477, 0.0007330328226089478, -0.099390409886837, -0.11971873044967651, -0.16612331569194794, -0.26837536692619324, 0.26630672812461853, -0.42190128564834595, -0.31643280386924744, -0.03920859098434448, 0.1593753546476364, 0.2415696084499359, 0.4991161823272705, -0.06273458898067474, -0.43992072343826294, 0.11330623179674149, 0.12346680462360382, 0.059244945645332336, -0.03766694292426109, -0.12881456315517426, 0.1396697461605072, 0.140487402677536, 0.21765731275081635, -0.22904592752456665, -0.08324289321899414, -0.0037856437265872955, 0.36642324924468994, 0.11928670853376389, -0.1493038535118103, 0.029715048149228096, -0.2106647491455078, 0.06615953147411346, -0.05594027787446976, -0.22435910999774933, -0.16177400946617126, -0.08098173141479492, 0.13210174441337585, 0.17849037051200867, 0.10039869695901871, -0.054275352507829666, -0.07087225466966629, 0.11490479111671448, -0.37438276410102844, 0.006172327324748039, 0.39364370703697205, -0.28611791133880615, -0.03764210641384125, 0.10613072663545609, 0.321468710899353, -0.21201664209365845, 0.12325312942266464, 0.02179558575153351, -0.013894043862819672, -0.057667192071676254, 0.198542520403862, 0.12142869085073471, 0.09316788613796234, -0.08520184457302094, -0.08815305680036545, -0.3300169110298157, 0.36289599537849426, 0.4204157888889313, -0.06463704258203506, -0.008498664945363998, 0.14022879302501678, 0.30902332067489624, 0.20609763264656067, -0.2118973433971405, -0.057338960468769073, -0.04596982151269913, 0.20594638586044312, -0.07713761925697327, -0.14182598888874054, 0.5797915458679199, 0.3293886184692383, 0.0851956158876419, 0.2962101399898529, 0.2942748963832855, -0.1702987253665924, -0.11355461180210114, 0.3188401460647583, 0.06387685239315033, -0.35597121715545654, 0.09357379376888275, 0.3028051257133484, 0.17035768926143646, 0.43759745359420776, 0.02299303188920021, -0.06756962835788727, 0.1463603526353836, 0.345278799533844, 0.084612175822258, 0.3514637053012848, 0.18346378207206726, -0.2586458921432495, 0.15241679549217224, -0.33820927143096924, -0.04705745354294777, -0.043384164571762085, 0.09957274049520493, 0.496317595243454, 0.22243283689022064, -0.17906880378723145, -0.32415956258773804, -0.42328080534935, -0.194156676530838, 0.09245845675468445, -0.25104913115501404, 0.08102697134017944, 0.14946411550045013, 0.007088281214237213, -0.36379674077033997, -0.18888123333454132, 0.14143584668636322, 0.20337188243865967, 1.1223894357681274, 0.09965772926807404, 0.018354780972003937, -0.07037798315286636, 0.08801649510860443, 0.0006208345293998718, 0.34046822786331177, -0.16510401666164398, 0.13833387196063995, 0.3348845839500427, -0.04909887909889221, 0.35026153922080994, 0.24994727969169617, 0.4641593396663666, 0.5902642011642456, -0.3894340991973877, 0.14890795946121216, 0.053158972412347794, -0.004048017784953117, -0.11891830712556839, -0.009975682944059372, -0.36700060963630676, 0.11954635381698608, 0.2304123193025589, 0.11194829642772675, -0.15384763479232788, 0.3549532890319824, -0.030448440462350845, 0.2934347689151764, -0.22218960523605347, 0.35804057121276855, 0.01953023299574852, -0.05628355219960213, 0.10433101654052734, -0.01549018919467926, -0.11274664103984833, -0.38308480381965637, 0.4904431104660034, -0.0833081528544426, 0.19961565732955933, 0.12259898334741592, 0.04821372032165527, 0.003851708024740219, 0.11113195866346359, 0.413088321685791, 0.052539270371198654, -0.18168394267559052, 0.22228778898715973, -0.6451485753059387, 0.254008412361145, -0.5041254758834839, 0.06484544277191162, 0.23707860708236694, 0.358747273683548, 0.021666377782821655, 0.1003115251660347, 0.26876139640808105, -0.47892752289772034, -0.027863111346960068, 0.3437908887863159, -0.46084216237068176, -0.04254930838942528, 0.05039774626493454, -0.31664225459098816, 0.15860681235790253, -0.3456783592700958, 0.16129867732524872, 0.1468314230442047, 0.11947926133871078, 0.18325068056583405, -0.12972694635391235, 0.034841958433389664, 0.15726670622825623, -0.12084643542766571, 0.426436185836792, -0.019239626824855804, -0.17483088374137878, -0.27141645550727844, -0.3383846879005432, 0.25107431411743164, -0.18548059463500977, 0.24201112985610962, -0.028839360922574997, 0.4207511246204376, -0.4322679936885834, 0.3473735749721527, -0.032402101904153824, 0.014690153300762177, 0.0003153868019580841, 0.10616380721330643, -0.15114764869213104, 0.3642754554748535, -0.32713446021080017, 0.2872067391872406, 0.17580226063728333, 0.43213391304016113, -0.025820329785346985, 0.1492180973291397, -0.07903481274843216, -0.28492721915245056, 0.05876009166240692, -0.47379422187805176, -0.38926270604133606, -0.348869651556015, -0.032488614320755005, -0.01987425982952118, 0.39867934584617615, -0.514850914478302, -0.4925316870212555, 0.21790051460266113, -0.20598873496055603, -0.11055782437324524, -0.3600332736968994, -0.15599828958511353, -0.5394279956817627, -0.11173239350318909, -0.05484490096569061, -0.04917547106742859, -0.4839751422405243, 0.33166855573654175, -0.1192784309387207 ]
https://github.com/huggingface/datasets/issues/6020
Inconsistent "The features can't be aligned" error when combining map, multiprocessing, and variable length outputs
I just encountered the same error in the same situation (multiprocessing with variable length outputs). The funny (or dangerous?) thing is, that this error only showed up when testing with a small test dataset (16 examples, ValueError with `num_proc` >1) but the same code works fine for the full dataset (~70k examples). @mariosasko Any idea on how to do that with a nested feature with lists of variable lengths containing dicts? EDIT: Was able to narrow it down: >200 Examples: no error, <150 Examples: Error. Now idea what to make of this but pretty obvious that this is a bug....
### 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
100
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 I just encountered the same error in the same situation (multiprocessing with variable length outputs). The funny (or dangerous?) thing is, that this error only showed up when testing with a small test dataset (16 examples, ValueError with `num_proc` >1) but the same code works fine for the full dataset (~70k examples). @mariosasko Any idea on how to do that with a nested feature with lists of variable lengths containing dicts? EDIT: Was able to narrow it down: >200 Examples: no error, <150 Examples: Error. Now idea what to make of this but pretty obvious that this is a bug....
[ -0.2229905128479004, -0.335707426071167, -0.05927114933729172, 0.1883198320865631, 0.1620415896177292, -0.1879776120185852, 0.4985237121582031, 0.06349752843379974, -0.009108362719416618, 0.07977113127708435, 0.3565216660499573, 0.2385641634464264, -0.0017630523070693016, 0.27904415130615234, -0.4352375566959381, -0.2027876079082489, 0.28105399012565613, 0.05386682599782944, 0.12135065346956253, 0.14021962881088257, -0.17497263848781586, 0.11300520598888397, -0.3761160373687744, -0.17217351496219635, -0.5670257806777954, -0.1121697947382927, -0.23887762427330017, -0.25603121519088745, 0.29950907826423645, -0.0691734030842781, 0.06811809539794922, -0.15275977551937103, -0.5374451875686646, 0.6407016515731812, -0.00011376518523320556, 0.07682335376739502, 0.37345588207244873, -0.13790306448936462, 0.019297786056995392, -0.2946815490722656, -0.41829460859298706, -0.2667688727378845, -0.20658676326274872, -0.13904935121536255, 0.19874504208564758, 0.12161620706319809, -0.07985979318618774, -0.4875127077102661, 0.08307962864637375, -0.008404863066971302, 0.12355813384056091, 0.34666451811790466, 0.022191759198904037, -0.09067945182323456, 0.07586441189050674, 0.17080506682395935, -0.08473316580057144, -0.5547665357589722, 0.24418577551841736, -0.05079107731580734, -0.06619221717119217, 0.2381320595741272, -0.22431521117687225, 0.1213676780462265, 0.004520837217569351, 0.09637703001499176, 0.06903453171253204, -0.3964322805404663, 0.043794889003038406, 0.31072360277175903, -0.12854710221290588, 0.25727272033691406, -0.3534408211708069, -0.5165061950683594, -0.21679553389549255, -0.39076730608940125, 0.1933148354291916, 0.16103000938892365, 0.0590178482234478, 0.014156118035316467, -0.5104671120643616, 0.24941188097000122, 0.2379201054573059, 0.07215899974107742, -0.23978930711746216, 0.21055099368095398, 0.10950078815221786, 0.2537113428115845, -0.2625390291213989, -0.1311676949262619, -0.22446486353874207, -0.19224008917808533, -0.06528580188751221, 0.032946161925792694, -0.28832632303237915, 0.1840945929288864, 0.33310019969940186, -0.2300204336643219, 0.046819351613521576, -0.14082057774066925, -0.11975093185901642, -0.11533207446336746, -0.022935785353183746, 0.24444806575775146, 0.35569047927856445, -0.1885640174150467, 0.10692232847213745, 0.011736300773918629, -0.1619013398885727, -0.08393948525190353, -0.10531386733055115, 0.029513301327824593, 0.6747017502784729, -0.1681838035583496, 0.0889320820569992, 0.20808979868888855, 0.15993863344192505, 0.08845224976539612, -0.13685917854309082, 0.20656415820121765, -0.25848743319511414, 0.0731370747089386, -0.18921758234500885, -0.16082683205604553, 0.011983243748545647, 0.7013283967971802, -0.0019404701888561249, 0.31043630838394165, -0.10293293744325638, -0.20688295364379883, -0.06463292986154556, -0.2099570631980896, -0.2350085973739624, 0.01942422054708004, -0.028833236545324326, 0.27350714802742004, -0.080624520778656, 0.264763742685318, 0.13067413866519928, -0.2018287479877472, -0.31074365973472595, -0.4364768862724304, 0.34310922026634216, 0.2545246183872223, 0.16337911784648895, 0.12272695451974869, -0.12599895894527435, -0.12585663795471191, -0.139990895986557, 0.1527416706085205, -0.08251357823610306, -0.3000655770301819, 0.02747325785458088, 0.15905505418777466, -0.1707354187965393, 0.37770670652389526, -0.07928150147199631, 0.2464175522327423, 0.4465136229991913, 0.04506337270140648, -0.20587679743766785, -0.363542377948761, -0.2345183938741684, -0.3046639859676361, -0.042412854731082916, 0.34005987644195557, -0.037531644105911255, 0.20705559849739075, -0.11760338395833969, 0.21785758435726166, 0.026918955147266388, 0.24835632741451263, 0.19982939958572388, 0.11536991596221924, -0.2020602524280548, 0.48122745752334595, -0.13076400756835938, -0.04962548613548279, -0.11198164522647858, 0.45217767357826233, -0.10326528549194336, 0.42110636830329895, -0.0727405771613121, 0.07165024429559708, 0.3067508339881897, -0.013405616395175457, 0.4197026491165161, 0.2928202748298645, -0.30785486102104187, 0.11201123148202896, -0.3280889689922333, -0.0441519096493721, 0.0998113602399826, -0.1376817673444748, 0.020643487572669983, -0.06189281493425369, -0.0682186707854271, -0.30564528703689575, 0.2685620188713074, -0.05162157490849495, 0.1950177252292633, 0.12375417351722717, 0.15923234820365906, 0.20657995343208313, -0.19966255128383636, -0.1963452398777008, -0.8078374266624451, 0.2682746350765228, 0.05970533937215805, -0.09627148509025574, -0.15421031415462494, -0.19230377674102783, 0.18549540638923645, 0.2461564689874649, -0.14758293330669403, 0.0870843380689621, 0.09863556921482086, 0.028730716556310654, -0.16993765532970428, -0.23100382089614868, 0.1061508059501648, 0.2439103126525879, 0.27360042929649353, -0.20243535935878754, -0.13996925950050354, 0.3352660834789276, 0.009184924885630608, -0.11076226085424423, -0.10933758318424225, 0.07953692227602005, 0.2645373046398163, 0.17666685581207275, 0.03193146735429764, 0.3969723880290985, 0.20989099144935608, -0.016878493130207062, -0.22258281707763672, 0.13263601064682007, 0.18220233917236328, 0.11132964491844177, -0.13414478302001953, 0.21575282514095306, -0.00045350659638643265, -0.26517602801322937, -0.008424162864685059, 0.35100841522216797, 0.010937266051769257, 0.5071073174476624, -0.16946306824684143, 0.155697762966156, 0.4410797357559204, -0.10814861953258514, -0.047216691076755524, -0.21608752012252808, 0.2678268849849701, -0.05057442560791969, -0.29053518176078796, 0.10274312645196915, -0.5407801866531372, 0.19644871354103088, 0.4119817018508911, 0.09783047437667847, 0.062485676258802414, -0.11702773720026016, 0.12196330726146698, 0.09859081357717514, 0.06763578951358795, 0.05555769428610802, 0.42813295125961304, 0.012576274573802948, -0.2407972812652588, 0.001520337536931038, -0.12471272796392441, -0.06382371485233307, 0.09064149856567383, 0.11520694196224213, 0.10620732605457306, 0.3642045557498932, 0.3328858017921448, 0.23631055653095245, 0.27275213599205017, -0.20079271495342255, 0.06007126718759537, -0.2716585397720337, -0.3013075590133667, 0.10527626425027847, -0.44347062706947327, 0.320463091135025, -0.07833663374185562, 0.016799483448266983, -0.4730793833732605, -0.7042862772941589, -0.006240908056497574, 0.4228776693344116, -0.34946054220199585, 0.22512270510196686, 0.11441770195960999, -0.09967298805713654, 0.058936528861522675, -0.11238565295934677, 0.05230649560689926, -0.00012236926704645157, -0.08947620540857315, -0.08365753293037415, 0.18813806772232056, -0.0056811729446053505, 0.05539855360984802, 0.14455923438072205, -0.2821806073188782, -0.36540940403938293, -0.07215292751789093, 0.0936899483203888, -0.2253730744123459, 0.1675317883491516, 0.23595041036605835, -0.14278057217597961, 0.03711219131946564, -0.21015961468219757, 0.42820295691490173, 0.12106727063655853, -0.16109950840473175, 0.308646559715271, 0.1410035938024521, -0.3798794448375702, -0.3461477756500244, -0.08975791186094284, 0.06672391295433044, -0.3404028117656708, 0.2853437662124634, -0.3672187030315399, 0.22836118936538696, -0.12423104792833328, 0.20253527164459229, -0.4052532911300659, -0.23669862747192383, -0.3135282099246979, -0.23612332344055176, 0.27990013360977173, 0.28017517924308777, 0.031829092651605606, -0.2118370234966278, -0.021586094051599503, -0.2198050320148468, -0.23973289132118225, 0.6537202596664429, -0.2020011991262436, 0.019030407071113586, 0.029462352395057678, 0.13516652584075928, 0.18419811129570007, 0.06977209448814392, 0.18439793586730957, 0.06713724881410599, 0.04042842239141464, -0.22890320420265198, -0.34403926134109497, 0.21569466590881348, 0.26112326979637146, 0.1027497947216034, 0.23388531804084778, -0.10863310843706131, 0.12345775961875916, 0.5089367628097534, 0.438254177570343, -0.16329991817474365, 0.05269478261470795, -0.0636567771434784, -0.0903317779302597, -0.35079801082611084, -0.05964156240224838, -0.13490797579288483, -0.2641074061393738, -0.06410853564739227, -0.10628414154052734, -0.09655718505382538, -0.04617522656917572, 0.06432636082172394, 0.5109121203422546, -0.4111848473548889, -0.37375298142433167, 0.3225444555282593, -0.08331559598445892, 0.35584110021591187, 0.007458973675966263, 0.04239298403263092, -0.07500092685222626, 0.057531796395778656, -0.11857208609580994, 0.012462705373764038, 0.2065061330795288, -0.17068003118038177, -0.268376886844635, 0.09305991232395172, -0.17495295405387878, 0.35525795817375183, 0.3217892646789551, 0.30833882093429565, 0.09338827431201935, -0.18543654680252075, -0.17580263316631317, 0.08796613663434982, 0.6004254817962646, -0.2978893518447876, -0.11420044302940369, 0.2481158971786499, -0.2609941363334656, 0.1331983059644699, -0.2302224338054657, -0.1377941370010376, 0.6016181111335754, 0.27359387278556824, 0.414499968290329, -0.36199963092803955, 0.19441522657871246, -0.17646323144435883, 0.06703238934278488, -0.11233239620923996, -0.0534307137131691, -0.016121894121170044, 0.14842447638511658, -0.17227625846862793, -0.15337610244750977, 0.43545863032341003, 0.36444732546806335, -0.022666282951831818, -0.08012211322784424, -0.2845110595226288, 0.0020050667226314545, 0.017284691333770752, -0.05086980760097504, 0.5098164081573486, -0.38155102729797363, 0.3117648661136627, -0.4028148055076599, 0.143844336271286, 0.008092100732028484, 0.2424638420343399, 0.07420185953378677, 0.04229608550667763, 0.08836566656827927, -0.6263484954833984, 0.18752041459083557, 0.37741273641586304, 0.17107568681240082, 0.15865732729434967, -0.010969836264848709, 0.2765616774559021, -0.24586498737335205, -0.1682577133178711, 0.3588906228542328, 0.03946420177817345, -0.12301657348871231, 0.06277802586555481, 0.05254964157938957, -0.0365377739071846, 0.0052793025970458984, 0.3418962061405182, -0.1625911295413971, -0.06482332944869995, 0.16157266497612, 0.016537614166736603, 0.6283394694328308, 0.1125686839222908, 0.03252488747239113, 0.21447226405143738, 0.12858779728412628, 0.032223138958215714, 0.21438856422901154, 0.5292062163352966, -0.1913493126630783, -0.13730601966381073, -0.07347003370523453, -0.10064302384853363, -0.13358628749847412, 0.21476061642169952, -0.11760225892066956, 0.35720035433769226, 0.025236688554286957, -0.03568060323596001, -0.11845892667770386, -0.19340860843658447, 0.22923554480075836, -0.2549993693828583, -0.1889854073524475, 0.007549237459897995, 0.1347004622220993, 0.07801260054111481, -0.08758522570133209, 0.009597021155059338, -0.046541761606931686, -0.19700567424297333, -0.5435235500335693, 0.10683275014162064, -0.10938646644353867, 0.12997585535049438, 0.33686816692352295, -0.11076623201370239, -0.16902676224708557, -0.02622484788298607, -0.5276888608932495, -0.02616354450583458, 0.1611308604478836, -0.03292922303080559, 0.3559497892856598, 0.09499133378267288, 0.021696878597140312, -0.3095080852508545, 0.11864899843931198, 0.049829162657260895, -0.21984130144119263, -0.1894911825656891, -0.18382519483566284, -0.284737229347229, -0.16714981198310852, 0.21930181980133057, -0.16126024723052979, 0.021310575306415558, -0.2669251263141632, 0.18849393725395203, 0.23127052187919617, 0.011249836534261703, 0.007610876113176346, 0.19983747601509094, -0.14694510400295258, 0.365181565284729, -0.33011630177497864, -0.05392204225063324, -0.07503354549407959, -0.03192048519849777, -0.01956668123602867, 0.015372809022665024, 0.117188461124897, 0.27291345596313477, 0.0007330328226089478, -0.099390409886837, -0.11971873044967651, -0.16612331569194794, -0.26837536692619324, 0.26630672812461853, -0.42190128564834595, -0.31643280386924744, -0.03920859098434448, 0.1593753546476364, 0.2415696084499359, 0.4991161823272705, -0.06273458898067474, -0.43992072343826294, 0.11330623179674149, 0.12346680462360382, 0.059244945645332336, -0.03766694292426109, -0.12881456315517426, 0.1396697461605072, 0.140487402677536, 0.21765731275081635, -0.22904592752456665, -0.08324289321899414, -0.0037856437265872955, 0.36642324924468994, 0.11928670853376389, -0.1493038535118103, 0.029715048149228096, -0.2106647491455078, 0.06615953147411346, -0.05594027787446976, -0.22435910999774933, -0.16177400946617126, -0.08098173141479492, 0.13210174441337585, 0.17849037051200867, 0.10039869695901871, -0.054275352507829666, -0.07087225466966629, 0.11490479111671448, -0.37438276410102844, 0.006172327324748039, 0.39364370703697205, -0.28611791133880615, -0.03764210641384125, 0.10613072663545609, 0.321468710899353, -0.21201664209365845, 0.12325312942266464, 0.02179558575153351, -0.013894043862819672, -0.057667192071676254, 0.198542520403862, 0.12142869085073471, 0.09316788613796234, -0.08520184457302094, -0.08815305680036545, -0.3300169110298157, 0.36289599537849426, 0.4204157888889313, -0.06463704258203506, -0.008498664945363998, 0.14022879302501678, 0.30902332067489624, 0.20609763264656067, -0.2118973433971405, -0.057338960468769073, -0.04596982151269913, 0.20594638586044312, -0.07713761925697327, -0.14182598888874054, 0.5797915458679199, 0.3293886184692383, 0.0851956158876419, 0.2962101399898529, 0.2942748963832855, -0.1702987253665924, -0.11355461180210114, 0.3188401460647583, 0.06387685239315033, -0.35597121715545654, 0.09357379376888275, 0.3028051257133484, 0.17035768926143646, 0.43759745359420776, 0.02299303188920021, -0.06756962835788727, 0.1463603526353836, 0.345278799533844, 0.084612175822258, 0.3514637053012848, 0.18346378207206726, -0.2586458921432495, 0.15241679549217224, -0.33820927143096924, -0.04705745354294777, -0.043384164571762085, 0.09957274049520493, 0.496317595243454, 0.22243283689022064, -0.17906880378723145, -0.32415956258773804, -0.42328080534935, -0.194156676530838, 0.09245845675468445, -0.25104913115501404, 0.08102697134017944, 0.14946411550045013, 0.007088281214237213, -0.36379674077033997, -0.18888123333454132, 0.14143584668636322, 0.20337188243865967, 1.1223894357681274, 0.09965772926807404, 0.018354780972003937, -0.07037798315286636, 0.08801649510860443, 0.0006208345293998718, 0.34046822786331177, -0.16510401666164398, 0.13833387196063995, 0.3348845839500427, -0.04909887909889221, 0.35026153922080994, 0.24994727969169617, 0.4641593396663666, 0.5902642011642456, -0.3894340991973877, 0.14890795946121216, 0.053158972412347794, -0.004048017784953117, -0.11891830712556839, -0.009975682944059372, -0.36700060963630676, 0.11954635381698608, 0.2304123193025589, 0.11194829642772675, -0.15384763479232788, 0.3549532890319824, -0.030448440462350845, 0.2934347689151764, -0.22218960523605347, 0.35804057121276855, 0.01953023299574852, -0.05628355219960213, 0.10433101654052734, -0.01549018919467926, -0.11274664103984833, -0.38308480381965637, 0.4904431104660034, -0.0833081528544426, 0.19961565732955933, 0.12259898334741592, 0.04821372032165527, 0.003851708024740219, 0.11113195866346359, 0.413088321685791, 0.052539270371198654, -0.18168394267559052, 0.22228778898715973, -0.6451485753059387, 0.254008412361145, -0.5041254758834839, 0.06484544277191162, 0.23707860708236694, 0.358747273683548, 0.021666377782821655, 0.1003115251660347, 0.26876139640808105, -0.47892752289772034, -0.027863111346960068, 0.3437908887863159, -0.46084216237068176, -0.04254930838942528, 0.05039774626493454, -0.31664225459098816, 0.15860681235790253, -0.3456783592700958, 0.16129867732524872, 0.1468314230442047, 0.11947926133871078, 0.18325068056583405, -0.12972694635391235, 0.034841958433389664, 0.15726670622825623, -0.12084643542766571, 0.426436185836792, -0.019239626824855804, -0.17483088374137878, -0.27141645550727844, -0.3383846879005432, 0.25107431411743164, -0.18548059463500977, 0.24201112985610962, -0.028839360922574997, 0.4207511246204376, -0.4322679936885834, 0.3473735749721527, -0.032402101904153824, 0.014690153300762177, 0.0003153868019580841, 0.10616380721330643, -0.15114764869213104, 0.3642754554748535, -0.32713446021080017, 0.2872067391872406, 0.17580226063728333, 0.43213391304016113, -0.025820329785346985, 0.1492180973291397, -0.07903481274843216, -0.28492721915245056, 0.05876009166240692, -0.47379422187805176, -0.38926270604133606, -0.348869651556015, -0.032488614320755005, -0.01987425982952118, 0.39867934584617615, -0.514850914478302, -0.4925316870212555, 0.21790051460266113, -0.20598873496055603, -0.11055782437324524, -0.3600332736968994, -0.15599828958511353, -0.5394279956817627, -0.11173239350318909, -0.05484490096569061, -0.04917547106742859, -0.4839751422405243, 0.33166855573654175, -0.1192784309387207 ]
https://github.com/huggingface/datasets/issues/6014
Request to Share/Update Dataset Viewer Code
Hi ! The huggingface/dataset-viewer code was not maintained anymore because we switched to a new dataset viewer that is deployed available for each dataset the Hugging Face website. What are you using this old repository for ?
Overview: The repository (huggingface/datasets-viewer) was recently archived and when I tried to run the code, there was the error message "AttributeError: module 'datasets.load' has no attribute 'prepare_module'". I could not resolve the issue myself due to lack of documentation of that attribute. Request: I kindly request the sharing of the code responsible for the dataset preview functionality or help with resolving the error. The dataset viewer on the Hugging Face website is incredibly useful since it is compatible with different types of inputs. It allows users to find datasets that meet their needs more efficiently. If needed, I am willing to contribute to the project by testing, documenting, and providing feedback on the dataset viewer code. Thank you for considering this request, and I look forward to your response.
37
Request to Share/Update Dataset Viewer Code Overview: The repository (huggingface/datasets-viewer) was recently archived and when I tried to run the code, there was the error message "AttributeError: module 'datasets.load' has no attribute 'prepare_module'". I could not resolve the issue myself due to lack of documentation of that attribute. Request: I kindly request the sharing of the code responsible for the dataset preview functionality or help with resolving the error. The dataset viewer on the Hugging Face website is incredibly useful since it is compatible with different types of inputs. It allows users to find datasets that meet their needs more efficiently. If needed, I am willing to contribute to the project by testing, documenting, and providing feedback on the dataset viewer code. Thank you for considering this request, and I look forward to your response. Hi ! The huggingface/dataset-viewer code was not maintained anymore because we switched to a new dataset viewer that is deployed available for each dataset the Hugging Face website. What are you using this old repository for ?
[ -0.18576379120349884, 0.04342000186443329, -0.05034683644771576, 0.34636425971984863, 0.0627560019493103, 0.13257750868797302, 0.10639741271734238, 0.3743211030960083, -0.06356143951416016, 0.17300695180892944, -0.2012244313955307, 0.15556076169013977, -0.08831065893173218, 0.16802476346492767, 0.018161075189709663, -0.0701802596449852, -0.10250825434923172, 0.12706422805786133, -0.09926076233386993, 0.01831050217151642, 0.10186395049095154, 0.15640100836753845, -0.2371198534965515, -0.05866283178329468, -0.10348555445671082, 0.20375077426433563, -0.1284446269273758, 0.19171276688575745, -0.10519780963659286, -0.4768396317958832, 0.21174409985542297, 0.28793519735336304, 0.1482974737882614, 0.48425018787384033, -0.00011981177522102371, -0.02859700843691826, 0.3565772771835327, -0.02914249151945114, -0.469230592250824, -0.0849640816450119, 0.0345461443066597, -0.19125649333000183, 0.11451061069965363, -0.09615228325128555, -0.31895458698272705, -0.23535917699337006, -0.023214420303702354, -0.41845014691352844, 0.5440291166305542, 0.06857632100582123, 0.1773366928100586, 0.4283735156059265, 0.3642096519470215, -0.27724790573120117, -0.13468697667121887, 0.3266078233718872, 0.0019231345504522324, 0.3121621012687683, 0.3773054778575897, 0.18629877269268036, -0.09424837678670883, 0.3944643437862396, 0.1039486825466156, -0.25638288259506226, 0.3381044268608093, -0.12774676084518433, -0.023905768990516663, -0.24829021096229553, 0.1351020634174347, -0.12998929619789124, 0.8280371427536011, -0.3445340096950531, -0.2539995610713959, -0.25441694259643555, 0.008116146549582481, 0.15949320793151855, 0.05689708888530731, 0.03075896017253399, -0.1697879135608673, 0.31925445795059204, -0.3861183524131775, -0.5684493184089661, -0.19742165505886078, -0.2199854999780655, 0.03569423407316208, 0.049782220274209976, -0.36038315296173096, 0.007918883115053177, 0.12287935614585876, -0.235464945435524, 0.016032762825489044, -0.053141504526138306, 0.043987661600112915, 0.06563179939985275, 0.007633186876773834, -0.2283097356557846, 0.02110244333744049, 0.15410220623016357, -0.08761236071586609, 0.4079160690307617, -0.00238074641674757, 0.07436574995517731, -0.06948736310005188, -0.012736581265926361, 0.42451411485671997, 0.11591862142086029, 0.36010757088661194, 0.1110846996307373, 0.1271640509366989, 0.2819506824016571, 0.24300488829612732, -0.05793779343366623, -0.29825666546821594, -0.008510677143931389, -0.1731768548488617, -0.1716737151145935, 0.3376113772392273, -0.16760127246379852, -0.05964721739292145, -0.17899158596992493, 0.2151797115802765, -0.18200379610061646, 0.1468520313501358, 0.3442610204219818, -0.15995508432388306, -0.008828308433294296, -0.005358170717954636, -0.3124392032623291, -0.06564448028802872, -0.8174993991851807, -0.13217638432979584, 0.02812393568456173, -0.3074999451637268, 0.106981061398983, 0.061413880437612534, -0.5804857611656189, 0.02216425910592079, -0.0052020433358848095, 0.5541390180587769, 0.020828917622566223, -0.2604503631591797, 0.22823487222194672, -0.06858796626329422, 0.13376198709011078, 0.07001194357872009, 0.09973439574241638, 0.1652182787656784, -0.21056759357452393, -0.08034662902355194, 0.09603509306907654, -0.3769795894622803, -0.3232615888118744, -0.13717862963676453, 0.07940426468849182, -0.17331409454345703, 0.09961347281932831, -0.29890626668930054, 0.16612842679023743, -0.24121436476707458, -0.22237341105937958, 0.1166117787361145, 0.22840705513954163, 0.060532305389642715, -0.23951639235019684, 0.4822164475917816, 0.8745830655097961, -0.300601989030838, -0.17273300886154175, -0.14132963120937347, -0.24428582191467285, -0.17714166641235352, 0.17220978438854218, -0.13452816009521484, -0.1986318826675415, -0.20084157586097717, -0.1528194546699524, 0.48006269335746765, -0.5718719959259033, -0.40113404393196106, 0.16297367215156555, -0.15982329845428467, 0.04897405952215195, 0.04046420753002167, -0.08408979326486588, -0.07233349233865738, -0.2692011296749115, -0.27620601654052734, 0.08900938183069229, -0.11257398128509521, -0.09859149158000946, -0.10915283858776093, -0.3199772536754608, 0.07773760706186295, 0.4341830313205719, -0.16684965789318085, 0.1406944990158081, 0.2900921106338501, -0.19620853662490845, 0.46132346987724304, 0.02664274536073208, 0.12827269732952118, -0.0452272891998291, 0.1823824644088745, 0.5466082096099854, -0.01965339295566082, -0.07405609637498856, -0.2049088180065155, 0.14408844709396362, 0.15460973978042603, -0.24211695790290833, -0.14664383232593536, -0.19190484285354614, -0.465726375579834, 0.012791136279702187, -0.24269036948680878, -0.3995368778705597, 0.08194445818662643, -0.0064822956919670105, 0.12425319850444794, 0.22572575509548187, -0.2080473154783249, 0.4186721444129944, -0.07275088876485825, 0.029052002355456352, -0.596386730670929, 0.3392865061759949, -0.11844000965356827, 0.028881728649139404, 0.1423676311969757, 0.23445647954940796, 0.1151229590177536, 0.005748252384364605, 0.09445146471261978, 0.3828257620334625, -0.2364865094423294, 0.377704918384552, 0.1963501274585724, 0.1519671380519867, 0.1439349204301834, -0.47779902815818787, 0.4251369535923004, -0.2316444367170334, -0.057554058730602264, 0.17594283819198608, -0.16685768961906433, 0.08547921478748322, -0.15149396657943726, -0.06171172112226486, 0.11843352019786835, 0.12461192160844803, -0.2370510846376419, 0.25223803520202637, -0.19175978004932404, -0.2149650752544403, 0.029015040025115013, -0.025755811482667923, 0.35276344418525696, -0.14534926414489746, -0.1825180947780609, 0.08811382204294205, 0.20063401758670807, -0.1889350265264511, 0.0012393444776535034, 0.10891897231340408, -0.1597125232219696, -0.055845968425273895, 0.09850025922060013, -0.14931192994117737, 0.13024157285690308, 0.07923366874456406, -0.05507655069231987, 0.337397038936615, 0.5245107412338257, -0.12150243669748306, 0.0973600447177887, 0.014182977378368378, 0.2756712734699249, -0.17713648080825806, -0.04237748682498932, 0.24691689014434814, -0.04336459934711456, -0.0966777503490448, -0.14981333911418915, 0.10356012731790543, -0.2512182891368866, 0.06338507682085037, -0.05884619057178497, -0.2262435257434845, -0.2033039927482605, 0.06047713756561279, -0.28050705790519714, -0.017945900559425354, -0.25494152307510376, 0.02433111146092415, 0.08848367631435394, 0.039343129843473434, -0.2904384732246399, 0.5090299844741821, -0.0388994961977005, 0.13598991930484772, -0.20555570721626282, 0.0195904653519392, 0.0035502538084983826, 0.0145244300365448, 0.14697209000587463, -0.1139790415763855, 0.3487066626548767, -0.23671428859233856, 0.45832669734954834, -0.35178127884864807, -0.29446372389793396, 0.02028646320104599, -0.03427132964134216, 0.11023211479187012, 0.28050661087036133, 0.07359892874956131, 0.007843859493732452, -0.041008252650499344, 0.21229137480258942, -0.24271564185619354, -0.22664280235767365, -0.2818911075592041, 0.2477649599313736, -0.048733700066804886, 0.0071511827409267426, -0.07490407675504684, -0.33328163623809814, -0.35059595108032227, 0.4120866060256958, -0.2713732123374939, 0.07792117446660995, 0.20427305996418, 0.06446473300457001, 0.06433793902397156, -0.28615087270736694, 0.019633742049336433, -0.10740672051906586, -0.5194118618965149, 0.18145793676376343, -0.537944495677948, -0.19319359958171844, -0.0005943290889263153, 0.403744637966156, 0.1439220905303955, -0.10981384664773941, -0.3775360584259033, -0.05185265094041824, -0.00717623345553875, 0.053699102252721786, -0.0009295307099819183, 0.07619019597768784, 0.2158360779285431, 0.1882224828004837, 0.022712403908371925, -0.0032838284969329834, -0.29246973991394043, -0.288484126329422, -0.12042922526597977, -0.10183154791593552, 0.2654629349708557, 0.1579837203025818, 0.017403502017259598, 0.6407167315483093, 0.5091353058815002, 0.13279277086257935, 0.11460156738758087, 0.0714566633105278, 0.6921265125274658, 0.03422458842396736, -0.46789586544036865, -0.017493875697255135, 0.14790187776088715, 0.1819627434015274, 0.0663910061120987, -0.012111574411392212, 0.17036807537078857, -0.3136386573314667, -0.5329543948173523, -0.2679581940174103, -0.23420600593090057, -0.16711081564426422, 0.015194538980722427, 0.534106969833374, -0.1251695156097412, 0.06646154075860977, -0.15056821703910828, -0.016227558255195618, 0.3458265960216522, 0.490684449672699, 0.23121726512908936, 0.03882746770977974, -0.2638782858848572, 0.1923823356628418, -0.27331018447875977, 0.17455382645130157, -0.02476443350315094, 0.05232507362961769, -0.16353732347488403, -0.007930133491754532, 0.10831163078546524, 0.0847000777721405, 0.6689706444740295, -0.022396089509129524, 0.18922977149486542, -0.04224023222923279, -0.2870491147041321, -0.12298254668712616, 0.21665255725383759, 0.20941537618637085, 0.11566811800003052, -0.2801765501499176, 0.017779693007469177, -0.0955379381775856, -0.37912288308143616, 0.4850117564201355, -0.11201510578393936, -0.2514217793941498, -0.00785546563565731, 0.13645988702774048, -0.14129337668418884, -0.14241525530815125, -0.3452480137348175, -0.09675726294517517, 0.08787451684474945, -0.14010897278785706, 0.3174876570701599, -0.08242762833833694, 0.0643555223941803, 0.18496772646903992, 0.028650611639022827, 0.26395392417907715, 0.25227850675582886, 0.14946414530277252, 0.7605822086334229, -0.05334028601646423, 0.5006100535392761, 0.4585088789463043, -0.03794458135962486, -0.38340505957603455, 0.09606090933084488, 0.11107845604419708, 0.3200046718120575, 0.43848153948783875, -0.07607296109199524, -0.1718955636024475, 0.061457306146621704, 0.06882504373788834, -0.5380590558052063, -0.2133428007364273, 0.20572198927402496, 0.00699755921959877, -0.3515074551105499, -0.7192889451980591, 0.27965036034584045, -0.07709622383117676, 0.007597275078296661, -0.04427728056907654, 0.46313726902008057, -0.078605055809021, -0.3960334062576294, -0.08577687293291092, 0.954666256904602, 0.21805863082408905, 0.25341835618019104, 0.19451871514320374, -0.12221167236566544, 0.2555244266986847, -0.12602457404136658, -0.011084355413913727, -0.29105517268180847, -0.16090963780879974, 0.012476062402129173, -0.08608479797840118, 0.3627876043319702, -0.2509832978248596, -0.11747562885284424, 0.06495682150125504, -0.07296275347471237, -0.06028199568390846, -0.027966586872935295, 0.2478257715702057, -0.00940345972776413, 0.05182219296693802, -0.30909109115600586, 0.10387513041496277, 0.13209956884384155, 0.2397942990064621, -0.0626981109380722, -0.38335591554641724, 0.02196211740374565, -0.023217251524329185, -0.36927735805511475, -0.03024519793689251, -0.05177885666489601, 0.31435686349868774, 0.15566518902778625, -0.2855725586414337, 0.9121890664100647, 0.4055980443954468, 0.21958597004413605, 0.2131994068622589, -0.26744160056114197, 0.09775499999523163, -0.2530038356781006, -0.1533077359199524, -0.16400766372680664, 0.22083549201488495, 0.14981146156787872, -0.14132261276245117, -0.21843233704566956, 0.4085747003555298, -0.028190068900585175, -0.10761293768882751, -0.47344139218330383, 0.08406001329421997, 0.09922310709953308, -0.3306998908519745, 0.11558189988136292, -0.16019579768180847, 0.18020768463611603, -0.04166865721344948, 0.019057419151067734, 0.1588851511478424, 0.09827729314565659, -0.2355729341506958, 0.3554232716560364, -0.08851312845945358, 0.13873155415058136, 0.4769816994667053, -0.09358184784650803, -0.492796927690506, 0.6168009042739868, 0.08440171182155609, -0.11832385510206223, -0.060744449496269226, 0.12666857242584229, 0.3777232766151428, -0.582474410533905, 0.048547614365816116, -0.18213053047657013, 0.31937670707702637, 0.17985129356384277, 0.1769380271434784, 0.0976591631770134, -0.15470868349075317, 0.016901005059480667, -0.18755246698856354, -0.15396833419799805, 0.14386266469955444, -0.18838755786418915, 0.009866230189800262, -0.04894229769706726, -0.03524245694279671, 0.09790337085723877, -0.051115505397319794, -0.2933345139026642, 0.23582139611244202, -0.11704327911138535, -0.07947598397731781, 0.44037389755249023, 0.0032781921327114105, 0.07784813642501831, -0.23525817692279816, -0.05285272002220154, 0.048293374478816986, -0.3882372975349426, -0.034081295132637024, -0.021746540442109108, 0.2102399468421936, -0.20888608694076538, -0.10356830060482025, -0.004511476028710604, -0.13293203711509705, -0.1917196661233902, 0.004238870460540056, 0.07772310078144073, 0.09521622210741043, 0.19962988793849945, -0.0453704409301281, 0.07505258917808533, 0.06610806286334991, -0.10367574542760849, 0.30685940384864807, 0.3894774317741394, 0.49951934814453125, 0.14143839478492737, 0.020309047773480415, -0.2688720226287842, -0.07049909234046936, 0.28147783875465393, 0.4632894694805145, 0.40419238805770874, -0.07555314153432846, 0.3311457931995392, -0.055211424827575684, 0.13318872451782227, 0.18816255033016205, 0.22030667960643768, 0.24685606360435486, -0.353692889213562, 0.02463739551603794, 0.14990442991256714, 0.08223817497491837, -0.16513018310070038, 0.040610942989587784, 0.18808704614639282, 0.07465166598558426, -0.10174322128295898, 0.17067958414554596, 0.042540449649095535, 0.32187730073928833, 0.11473184823989868, 0.224456787109375, 0.5657409429550171, 0.16529107093811035, 0.4225997030735016, 0.22259174287319183, -0.042899519205093384, -0.05183958634734154, 0.2378915399312973, 0.554969847202301, 0.1382863074541092, 0.3061351180076599, -0.39397287368774414, 0.24732111394405365, -0.09527849406003952, 0.00974210724234581, 0.21672022342681885, -0.368721604347229, 0.08232782781124115, 0.19041727483272552, 0.13090047240257263, 0.17314258217811584, -0.26096081733703613, 0.32135656476020813, 0.1301843225955963, -0.02389158494770527, 0.04174724221229553, 0.2331513613462448, 0.03131498768925667, -0.004842047113925219, 0.4373891055583954, -0.34099042415618896, -0.43695929646492004, 0.013965073972940445, 0.03532552719116211, -0.3709147572517395, 0.17180657386779785, -0.20044298470020294, -0.15821616351604462, -0.40646809339523315, -0.06518816202878952, 0.22065386176109314, 0.3503178060054779, -0.16094911098480225, -0.1700536608695984, 0.2738528847694397, -0.0027904286980628967, 0.308790385723114, 0.43490585684776306, 0.44599995017051697, 0.015217334032058716, 0.2067754715681076, 0.15866349637508392, -0.010392541065812111, -0.13434919714927673, 0.0680403783917427, -0.017499160021543503, 0.06563812494277954, -0.06782741844654083, 0.06672337651252747, 0.08283696323633194, -0.04419412091374397, -0.1312747597694397, 0.05865544080734253, 0.16045281291007996, -0.756115198135376, 0.1685142070055008, -0.34711477160453796, -0.0991736575961113, -0.13705912232398987, 0.012509584426879883, -0.47799623012542725, 0.012021002359688282, 0.30372607707977295, 0.10960496217012405, -0.20283231139183044, -0.16783949732780457, 0.03133539855480194, 0.2733125686645508, 0.46296781301498413, 0.47183462977409363, 0.12855452299118042, -0.07585889101028442, -0.6442524790763855, -0.6195736527442932, -0.07186891883611679, 0.40396150946617126, 0.07102060317993164, 0.07272055000066757, -0.04811977222561836, 0.1953200101852417, 0.06830133497714996, 0.21129213273525238, -0.07992059737443924, 0.10905490815639496, -0.09124915301799774, 0.004952084273099899, -0.02893183007836342, 0.027672793716192245, 0.059633202850818634, 0.09979672729969025, 0.05788738280534744, 0.16826479136943817, -0.05244375765323639, -0.05986274406313896, -0.22533942759037018, 0.2997102439403534, -0.034992605447769165, -0.41764184832572937, 0.29351335763931274, -0.12167583405971527, 0.15865284204483032, 0.10921759158372879, -0.486117422580719, -0.29715675115585327, -0.03938886895775795, 0.10171420872211456, 0.3599849045276642, 0.18628399074077606, 0.18252961337566376, -0.33979105949401855, -0.5139271020889282, -0.40095916390419006, 0.20142762362957, 0.1610928624868393, 0.11714047193527222, -0.23559102416038513, -0.011887414380908012, 0.022128887474536896, 0.0808829814195633, 0.32125455141067505, 0.052326690405607224, -0.09245835244655609, 0.19214531779289246, -0.44308650493621826, -0.11162704974412918, 0.6060922145843506, -0.48692262172698975, -0.14240877330303192, -0.3151233196258545, 0.18152394890785217, 0.09139112383127213, -0.39732518792152405, -0.6795107126235962, 0.24631035327911377, 0.2950151264667511, -0.009251315146684647, -0.007111934944987297, 0.28343579173088074, -0.2242177128791809, 0.057381581515073776, -0.0579957515001297, 0.6256870031356812, -0.029306672513484955, -0.1992669254541397, 0.28567567467689514, -0.14693419635295868 ]
https://github.com/huggingface/datasets/issues/6014
Request to Share/Update Dataset Viewer Code
I think these parts are outdated: * https://github.com/huggingface/datasets-viewer/blob/8efad8eae313a891f713469983bf4c744786f26e/run.py#L126-L131 * https://github.com/huggingface/datasets-viewer/blob/8efad8eae313a891f713469983bf4c744786f26e/run.py#L145-L150 To make the viewer work, the first one should be replaced with the following: ```python dataset_module = datasets.load.dataset_module_factory(path) builder_cls = datasets.load.import_main_class(dataset_module.module_path) confs = builder_cls.BUILDER_CONFIGS ``` And the second one: ```python dataset_module = datasets.load.dataset_module_factory(path) builder_cls = datasets.load.import_main_class(dataset_module.module_path) if conf: builder_instance = builder_cls(name=conf, cache_dir=path if path_to_datasets is not None else None) else: builder_instance = builder_cls(cache_dir=path if path_to_datasets is not None else None) ``` But as @lhoestq suggested, it's better to use the `datasets-server` API nowadays to [fetch the rows](https://huggingface.co/docs/datasets-server/rows).
Overview: The repository (huggingface/datasets-viewer) was recently archived and when I tried to run the code, there was the error message "AttributeError: module 'datasets.load' has no attribute 'prepare_module'". I could not resolve the issue myself due to lack of documentation of that attribute. Request: I kindly request the sharing of the code responsible for the dataset preview functionality or help with resolving the error. The dataset viewer on the Hugging Face website is incredibly useful since it is compatible with different types of inputs. It allows users to find datasets that meet their needs more efficiently. If needed, I am willing to contribute to the project by testing, documenting, and providing feedback on the dataset viewer code. Thank you for considering this request, and I look forward to your response.
87
Request to Share/Update Dataset Viewer Code Overview: The repository (huggingface/datasets-viewer) was recently archived and when I tried to run the code, there was the error message "AttributeError: module 'datasets.load' has no attribute 'prepare_module'". I could not resolve the issue myself due to lack of documentation of that attribute. Request: I kindly request the sharing of the code responsible for the dataset preview functionality or help with resolving the error. The dataset viewer on the Hugging Face website is incredibly useful since it is compatible with different types of inputs. It allows users to find datasets that meet their needs more efficiently. If needed, I am willing to contribute to the project by testing, documenting, and providing feedback on the dataset viewer code. Thank you for considering this request, and I look forward to your response. I think these parts are outdated: * https://github.com/huggingface/datasets-viewer/blob/8efad8eae313a891f713469983bf4c744786f26e/run.py#L126-L131 * https://github.com/huggingface/datasets-viewer/blob/8efad8eae313a891f713469983bf4c744786f26e/run.py#L145-L150 To make the viewer work, the first one should be replaced with the following: ```python dataset_module = datasets.load.dataset_module_factory(path) builder_cls = datasets.load.import_main_class(dataset_module.module_path) confs = builder_cls.BUILDER_CONFIGS ``` And the second one: ```python dataset_module = datasets.load.dataset_module_factory(path) builder_cls = datasets.load.import_main_class(dataset_module.module_path) if conf: builder_instance = builder_cls(name=conf, cache_dir=path if path_to_datasets is not None else None) else: builder_instance = builder_cls(cache_dir=path if path_to_datasets is not None else None) ``` But as @lhoestq suggested, it's better to use the `datasets-server` API nowadays to [fetch the rows](https://huggingface.co/docs/datasets-server/rows).
[ -0.25805845856666565, -0.015305012464523315, -0.02590107172727585, 0.33421534299850464, 0.14130879938602448, 0.17428895831108093, 0.17373082041740417, 0.4034422039985657, -0.04206863045692444, 0.14834578335285187, -0.16766896843910217, 0.22764699161052704, -0.14093898236751556, 0.2068369835615158, 0.07746250182390213, -0.0839608907699585, 0.0027681514620780945, 0.1898987591266632, -0.09367065131664276, 0.026701830327510834, 0.07373189181089401, 0.21220973134040833, -0.25219273567199707, -0.06827817857265472, -0.07246962189674377, 0.21186786890029907, -0.10295050591230392, 0.1221703439950943, -0.14027400314807892, -0.610971212387085, 0.19967159628868103, 0.2596456706523895, 0.13656480610370636, 0.4695335030555725, -0.00012344401329755783, -0.009098600596189499, 0.3741530179977417, -0.09079941362142563, -0.4620967209339142, -0.10121756792068481, 0.055602073669433594, -0.23689796030521393, 0.251054048538208, -0.09497221559286118, -0.3155180811882019, -0.31434890627861023, -0.09117516130208969, -0.3276316225528717, 0.5458074808120728, 0.09768513590097427, 0.15825186669826508, 0.4251599609851837, 0.431031733751297, -0.24328413605690002, -0.13789930939674377, 0.33624809980392456, -0.011363178491592407, 0.3286580443382263, 0.2543850541114807, 0.1438688188791275, -0.09834421426057816, 0.40295690298080444, 0.04588767886161804, -0.18844588100910187, 0.492124080657959, -0.12607720494270325, 0.06796465814113617, -0.31951582431793213, -0.04487248510122299, -0.08062327653169632, 0.6967701315879822, -0.3949953019618988, -0.37978342175483704, -0.4044532775878906, -0.04674656316637993, 0.07682903110980988, 0.06911782920360565, 0.015411220490932465, -0.14045147597789764, 0.2312387228012085, -0.36372730135917664, -0.5265491604804993, -0.17137515544891357, -0.17865125834941864, 0.046346232295036316, 0.029890604317188263, -0.383422315120697, 0.04718485847115517, 0.11121979355812073, -0.20605134963989258, 0.06272654235363007, -0.11161449551582336, 0.10861806571483612, 0.15850302577018738, -0.055018287152051926, -0.1757623851299286, 0.0608963668346405, 0.1693911999464035, -0.08503282070159912, 0.35803526639938354, -0.036986131221055984, 0.023878494277596474, 0.04846395179629326, 0.06111492961645126, 0.3345409333705902, 0.11664941906929016, 0.3671782612800598, 0.14022384583950043, 0.017324935644865036, 0.2986557185649872, 0.2529200315475464, -0.06699017435312271, -0.3147332966327667, -0.16525961458683014, -0.19347502291202545, -0.09692935645580292, 0.29116296768188477, -0.13916023075580597, -0.10471057891845703, -0.0780722126364708, 0.186621755361557, -0.14100240170955658, 0.12669530510902405, 0.3440732955932617, -0.2222537249326706, -0.024324454367160797, 0.10561814904212952, -0.15657581388950348, -0.1321881264448166, -0.6928467750549316, -0.11002900451421738, 0.09712423384189606, -0.26759040355682373, 0.08779129385948181, 0.07976815104484558, -0.5483375787734985, 0.0705946534872055, -0.020254742354154587, 0.5228900909423828, -0.01978629268705845, -0.2290797084569931, 0.24484609067440033, -0.05241360515356064, 0.18524272739887238, 0.11108621954917908, 0.12100555747747421, 0.19408603012561798, -0.30349287390708923, -0.16730938851833344, 0.03039296343922615, -0.30657824873924255, -0.4038131535053253, -0.06808730959892273, 0.07548798620700836, -0.35017305612564087, 0.12257412821054459, -0.2935355305671692, 0.12046152353286743, -0.143275648355484, -0.1981102079153061, 0.07778803259134293, 0.09856963902711868, 0.007797274738550186, -0.2138836681842804, 0.5601894855499268, 0.8168842792510986, -0.2807173430919647, -0.2101271152496338, -0.07978462427854538, -0.26053300499916077, -0.2148953676223755, 0.014001866802573204, -0.07115461677312851, -0.029533959925174713, -0.21427437663078308, -0.21045216917991638, 0.48995304107666016, -0.5807790160179138, -0.2523860037326813, 0.2479843944311142, -0.015627358108758926, 0.11130502074956894, 0.030806131660938263, -0.13809943199157715, -0.10827281326055527, -0.325548380613327, -0.17862772941589355, 0.09319490194320679, -0.059950366616249084, -0.14126253128051758, -0.12985369563102722, -0.36185893416404724, 0.07277822494506836, 0.3900824189186096, -0.09802128374576569, 0.08826576918363571, 0.14517538249492645, -0.15634413063526154, 0.46827855706214905, 0.051448654383420944, 0.09328566491603851, 0.08738371729850769, 0.19080878794193268, 0.5021211504936218, -0.0627686157822609, -0.12045082449913025, -0.24482610821723938, 0.17559024691581726, 0.09169313311576843, -0.18637347221374512, -0.20959170162677765, -0.16883236169815063, -0.38236403465270996, 0.041560426354408264, -0.3198513388633728, -0.3699769377708435, 0.06652010232210159, -0.10358239710330963, 0.1969815492630005, 0.1597273200750351, -0.19536355137825012, 0.37131908535957336, -0.19064435362815857, 0.06133357807993889, -0.5639129877090454, 0.3292233347892761, -0.13811548054218292, 0.007447425276041031, 0.14426307380199432, 0.20861506462097168, 0.1532335728406906, -0.06403651833534241, 0.07114314287900925, 0.4270001947879791, -0.15163680911064148, 0.37924671173095703, -0.0212569460272789, 0.1234884113073349, 0.1356215626001358, -0.36357343196868896, 0.2907889485359192, -0.2428213506937027, -0.07684626430273056, 0.131454199552536, -0.16397374868392944, 0.1264566332101822, -0.1710646003484726, 0.06626085937023163, 0.22239579260349274, 0.11962319165468216, -0.19019493460655212, 0.3144925534725189, -0.23410290479660034, -0.24702011048793793, 0.03039560653269291, 0.010946364142000675, 0.27388790249824524, -0.15412501990795135, -0.1833299994468689, 0.04948246851563454, 0.19827549159526825, -0.13975892961025238, -0.019239112734794617, 0.10770774632692337, -0.1960936188697815, 0.01913071796298027, 0.09829611331224442, -0.049645356833934784, 0.16627898812294006, 0.08184023201465607, -0.07852557301521301, 0.4191874861717224, 0.37225550413131714, -0.07178033888339996, 0.20382219552993774, 0.1408768743276596, 0.23664632439613342, -0.07898170500993729, -0.17708203196525574, 0.24645841121673584, -0.03520026057958603, -0.13906168937683105, -0.18017898499965668, 0.15993563830852509, -0.41641974449157715, 0.08345682173967361, -0.07049871981143951, -0.15382276475429535, -0.13726159930229187, -0.08565668016672134, -0.2746847867965698, -0.10838904231786728, -0.24620108306407928, 0.0882524773478508, 0.06383560597896576, 0.08050217479467392, -0.3810526430606842, 0.32145145535469055, -0.024376755580306053, -0.003682684153318405, -0.1684722900390625, 0.003828673157840967, -0.005164220929145813, -0.0114592295140028, 0.17008043825626373, -0.14347967505455017, 0.3127726912498474, -0.29863670468330383, 0.3529016971588135, -0.2362651228904724, -0.34547528624534607, 0.06398453563451767, -0.13393868505954742, 0.2748178243637085, 0.28811413049697876, 0.03804653137922287, 0.060629040002822876, -0.06013156473636627, 0.30900514125823975, -0.26372385025024414, -0.18822011351585388, -0.23401813209056854, 0.23103706538677216, -0.0973423644900322, -0.044802144169807434, -0.05348218232393265, -0.2823837101459503, -0.4207276403903961, 0.3249112367630005, -0.07976272702217102, 0.1473618745803833, 0.32981061935424805, 0.15172356367111206, 0.08102408051490784, -0.2799002528190613, 0.16631090641021729, -0.05844104290008545, -0.5344445109367371, 0.267188161611557, -0.533065140247345, -0.2506085932254791, 0.04065205529332161, 0.33724546432495117, 0.23593474924564362, -0.05862438678741455, -0.35991716384887695, -0.12496481835842133, -0.04144161939620972, -0.01878574676811695, -0.04008523374795914, 0.12652303278446198, 0.1681857854127884, 0.31534790992736816, 0.09175971150398254, -0.0001895129680633545, -0.22908540070056915, -0.24931389093399048, -0.1956733763217926, -0.1035088375210762, 0.21117839217185974, 0.2728806734085083, -0.014264410361647606, 0.6474791169166565, 0.5301297903060913, 0.10298198461532593, 0.10480740666389465, 0.018678948283195496, 0.6793028712272644, 0.02421419322490692, -0.4494287967681885, -0.04893132671713829, 0.0690593495965004, 0.19398629665374756, 0.0807013064622879, -0.04829588532447815, 0.30928319692611694, -0.38784751296043396, -0.3007802963256836, -0.2938670217990875, -0.307105153799057, -0.11808334290981293, -0.052518539130687714, 0.5230433940887451, -0.19881078600883484, 0.1149647906422615, -0.18919382989406586, 0.005073457024991512, 0.26727721095085144, 0.5544176697731018, 0.29324910044670105, 0.08906833082437515, -0.22846615314483643, 0.12848030030727386, -0.2996211051940918, 0.16355383396148682, -0.048831112682819366, 0.05183692276477814, -0.11589211970567703, -0.03672194108366966, 0.048164308071136475, 0.0629449263215065, 0.5816048383712769, -0.03487991541624069, 0.15028101205825806, 0.0669335126876831, -0.25337278842926025, -0.33776190876960754, 0.09341186285018921, 0.17852698266506195, 0.1693505495786667, -0.3304421901702881, 0.03220132365822792, -0.08054819703102112, -0.46205973625183105, 0.4605422019958496, -0.007367550861090422, -0.2644239068031311, -0.12400837242603302, 0.05450126901268959, -0.12011567503213882, -0.238698348402977, -0.3569658696651459, 0.010923752561211586, 0.11486972123384476, -0.1030365452170372, 0.30544301867485046, -0.150896817445755, 0.05052658170461655, 0.2513423562049866, 0.07899163663387299, 0.3111121952533722, 0.09559612721204758, 0.225104421377182, 0.6609718799591064, -0.1526462584733963, 0.4039849042892456, 0.5309408903121948, -0.07172568142414093, -0.4247598648071289, 0.0882989838719368, 0.11300485581159592, 0.3172566890716553, 0.40829771757125854, -0.15844020247459412, -0.11894302815198898, 0.04330708831548691, 0.05168752744793892, -0.612769365310669, -0.13966119289398193, 0.22297465801239014, -0.036985963582992554, -0.31087982654571533, -0.7720839381217957, 0.41601237654685974, -0.05430850014090538, 0.01040678471326828, -0.0014683865010738373, 0.5361977219581604, -0.15697148442268372, -0.33097583055496216, -0.04993218928575516, 0.9167620539665222, 0.27683624625205994, 0.19675132632255554, 0.2651878595352173, -0.10316600650548935, 0.284174382686615, -0.149551659822464, 0.006905343383550644, -0.2739524245262146, -0.19609147310256958, 0.01675696112215519, -0.11940459907054901, 0.3590824604034424, -0.198598250746727, -0.14939647912979126, 0.13320019841194153, -0.15057192742824554, -0.052672866731882095, -0.01835131272673607, 0.30134108662605286, -0.03501827269792557, -0.012948818504810333, -0.3841474652290344, 0.08300348371267319, 0.13074930012226105, 0.22465606033802032, -0.06750410795211792, -0.2597302198410034, 0.03357229009270668, -0.03515851870179176, -0.34140151739120483, 0.018763374537229538, 0.017750460654497147, 0.2802359461784363, 0.12958616018295288, -0.2691851854324341, 0.8798475861549377, 0.35402873158454895, 0.16122622787952423, 0.1772291213274002, -0.2526484727859497, 0.12437354028224945, -0.3221927285194397, -0.11925949156284332, -0.17608098685741425, 0.27030321955680847, 0.21103768050670624, -0.1344425082206726, -0.1022859513759613, 0.3522675335407257, -0.06607883423566818, -0.0423467643558979, -0.3300236463546753, 0.030359912663698196, 0.12132053822278976, -0.3595442771911621, 0.0611388273537159, -0.16499905288219452, 0.13832947611808777, -0.017052141949534416, 0.012581043876707554, 0.1800183206796646, -0.03781672939658165, -0.10671093314886093, 0.22099056839942932, -0.047048065811395645, 0.17134305834770203, 0.4532204270362854, -0.08690787106752396, -0.4411430060863495, 0.615088939666748, 0.1494647115468979, -0.1843995302915573, -0.04410466551780701, 0.06646829098463058, 0.36597150564193726, -0.5541616678237915, 0.03537865728139877, -0.1464385986328125, 0.36024612188339233, 0.0960082858800888, 0.18134094774723053, 0.16912704706192017, -0.14806890487670898, 0.10139627754688263, -0.21895281970500946, -0.19683964550495148, 0.15257278084754944, -0.15791873633861542, 0.10271701216697693, -0.06350763142108917, -0.018106132745742798, 0.10708752274513245, -0.00537065789103508, -0.26694750785827637, 0.1569700539112091, -0.02859446406364441, -0.02115418016910553, 0.3773093819618225, -0.006332147866487503, 0.14282159507274628, -0.27862441539764404, -0.042927078902721405, -0.03850965201854706, -0.3881525695323944, -0.015794361010193825, -0.09875474870204926, 0.22032445669174194, -0.18796664476394653, -0.15395766496658325, 0.10726621001958847, -0.049974437803030014, -0.2291525900363922, -0.04904123395681381, 0.09178358316421509, 0.15156397223472595, 0.12299865484237671, 0.06792791187763214, 0.026414595544338226, 0.07027200609445572, -0.1472579389810562, 0.1984729766845703, 0.3564116954803467, 0.5176507234573364, 0.2213073968887329, 0.03589216619729996, -0.18312928080558777, -0.054173313081264496, 0.2903438210487366, 0.47328826785087585, 0.25491568446159363, -0.17759165167808533, 0.39092740416526794, -0.12393973767757416, 0.21343153715133667, 0.09101960808038712, 0.3199053406715393, 0.38859301805496216, -0.299361914396286, 0.042032480239868164, 0.1682606041431427, 0.05548008531332016, -0.19316637516021729, 0.06598104536533356, 0.17535053193569183, 0.11445407569408417, 0.003060426563024521, 0.17995865643024445, 0.056275490671396255, 0.27246221899986267, 0.09201182425022125, 0.3334275484085083, 0.5674105286598206, 0.1030379980802536, 0.5005629658699036, 0.2858063876628876, -0.022547762840986252, 0.0025838203728199005, 0.24634331464767456, 0.5552289485931396, 0.1717955768108368, 0.35908937454223633, -0.42815351486206055, 0.2047836184501648, -0.1762019693851471, -0.01967247948050499, 0.2365497350692749, -0.3896203935146332, 0.1611231565475464, 0.18359783291816711, 0.08099061250686646, 0.15890678763389587, -0.26584741473197937, 0.3507433831691742, 0.036719679832458496, 0.009958143346011639, 0.0364973321557045, 0.18925386667251587, 0.08885239064693451, -0.07909202575683594, 0.34760284423828125, -0.2841653525829315, -0.4586814343929291, -0.06962430477142334, 0.054744623601436615, -0.4937017560005188, 0.13858936727046967, -0.10163286328315735, -0.11116166412830353, -0.3873232305049896, -0.044289037585258484, 0.25923535227775574, 0.38499802350997925, -0.17057013511657715, -0.08864273130893707, 0.35789066553115845, -0.038950949907302856, 0.23981697857379913, 0.39924582839012146, 0.5815078616142273, 0.08200035989284515, 0.15485386550426483, 0.16342107951641083, 0.012223550118505955, -0.07734886556863785, 0.11239978671073914, -0.001103987917304039, -0.027390852570533752, -0.06334133446216583, 0.144004225730896, 0.08165442943572998, -0.04439949244260788, -0.1878081113100052, 0.005275551229715347, 0.08668330311775208, -0.6534529328346252, 0.3137686252593994, -0.29879653453826904, -0.12328154593706131, -0.11129060387611389, 0.01857265830039978, -0.5363257527351379, -0.015783723443746567, 0.41205307841300964, 0.19492904841899872, -0.16534140706062317, -0.13459834456443787, 0.017017550766468048, 0.35378792881965637, 0.4998733103275299, 0.43503791093826294, 0.15365901589393616, -0.14070242643356323, -0.49712032079696655, -0.6417444944381714, -0.16613861918449402, 0.3622303307056427, 0.05051064491271973, 0.15578261017799377, -0.02684791386127472, 0.10258707404136658, 0.16645006835460663, 0.1756771206855774, -0.03987804055213928, 0.09677073359489441, -0.0928753912448883, -0.028403617441654205, -0.10103209316730499, -0.015224792063236237, 0.029808832332491875, 0.1005861908197403, 0.05119837820529938, 0.046109627932310104, -0.15129578113555908, -0.055829375982284546, -0.19053557515144348, 0.2698236405849457, -0.014571362175047398, -0.39013320207595825, 0.30347543954849243, -0.05905483663082123, 0.2927263677120209, 0.09680763632059097, -0.4807259738445282, -0.29792261123657227, -0.04624137654900551, 0.007043483667075634, 0.434069961309433, 0.08064212650060654, 0.1548582762479782, -0.33712244033813477, -0.5766646265983582, -0.5043294429779053, 0.18512240052223206, 0.1355053037405014, 0.0057748290710151196, -0.286555677652359, 0.09982477873563766, -0.009022127836942673, 0.24159426987171173, 0.3400355875492096, -0.000360637903213501, -0.1253582239151001, 0.32049718499183655, -0.5169850587844849, -0.23019473254680634, 0.6401768326759338, -0.45509153604507446, -0.1335468888282776, -0.26525527238845825, 0.1636745035648346, 0.04361332580447197, -0.28368911147117615, -0.7796631455421448, 0.22169700264930725, 0.3330394923686981, -0.07740268856287003, 0.04687673971056938, 0.30974331498146057, -0.2361571043729782, -0.003389861434698105, -0.11673036217689514, 0.5788273811340332, -0.07766959816217422, -0.13639356195926666, 0.17532342672348022, -0.19217106699943542 ]
https://github.com/huggingface/datasets/issues/6014
Request to Share/Update Dataset Viewer Code
> The dataset viewer on the Hugging Face website is incredibly useful @mariosasko i think @lilyorlilypad wants to run the new dataset-viewer, not the old one
Overview: The repository (huggingface/datasets-viewer) was recently archived and when I tried to run the code, there was the error message "AttributeError: module 'datasets.load' has no attribute 'prepare_module'". I could not resolve the issue myself due to lack of documentation of that attribute. Request: I kindly request the sharing of the code responsible for the dataset preview functionality or help with resolving the error. The dataset viewer on the Hugging Face website is incredibly useful since it is compatible with different types of inputs. It allows users to find datasets that meet their needs more efficiently. If needed, I am willing to contribute to the project by testing, documenting, and providing feedback on the dataset viewer code. Thank you for considering this request, and I look forward to your response.
26
Request to Share/Update Dataset Viewer Code Overview: The repository (huggingface/datasets-viewer) was recently archived and when I tried to run the code, there was the error message "AttributeError: module 'datasets.load' has no attribute 'prepare_module'". I could not resolve the issue myself due to lack of documentation of that attribute. Request: I kindly request the sharing of the code responsible for the dataset preview functionality or help with resolving the error. The dataset viewer on the Hugging Face website is incredibly useful since it is compatible with different types of inputs. It allows users to find datasets that meet their needs more efficiently. If needed, I am willing to contribute to the project by testing, documenting, and providing feedback on the dataset viewer code. Thank you for considering this request, and I look forward to your response. > The dataset viewer on the Hugging Face website is incredibly useful @mariosasko i think @lilyorlilypad wants to run the new dataset-viewer, not the old one
[ -0.27421343326568604, 0.07217858731746674, -0.06602142006158829, 0.3316424489021301, 0.006425380706787109, 0.12299644201993942, 0.10355931520462036, 0.4018329679965973, -0.04186240956187248, 0.2205033302307129, -0.21188001334667206, 0.2641458809375763, -0.11946781724691391, 0.23027877509593964, 0.005597062408924103, -0.058073244988918304, -0.07654724270105362, 0.14816094934940338, -0.11701063811779022, 0.02599666267633438, 0.08600105345249176, 0.13288073241710663, -0.25742360949516296, -0.027071058750152588, -0.050496459007263184, 0.20471002161502838, -0.14819779992103577, 0.15406115353107452, -0.12475418299436569, -0.5209565162658691, 0.18547040224075317, 0.3354834318161011, 0.19925840198993683, 0.4793159067630768, -0.00011888841254403815, -0.04868246987462044, 0.34028005599975586, 0.0010334085673093796, -0.4015354514122009, -0.06362709403038025, 0.009834837168455124, -0.18532373011112213, 0.17383408546447754, -0.10909611731767654, -0.28949883580207825, -0.2607658803462982, -0.0742720291018486, -0.435930997133255, 0.5555288195610046, 0.07260581105947495, 0.17667976021766663, 0.42302751541137695, 0.32482442259788513, -0.2854687571525574, -0.09301566332578659, 0.32662755250930786, -0.033281829208135605, 0.257822722196579, 0.3299168646335602, 0.14911632239818573, -0.07340919226408005, 0.3639446496963501, 0.057726696133613586, -0.22338822484016418, 0.3404446840286255, -0.1466483473777771, -0.049098119139671326, -0.2998843789100647, 0.08949066698551178, -0.08081837743520737, 0.8519561886787415, -0.3600984215736389, -0.26386281847953796, -0.22913146018981934, 0.03314675763249397, 0.17380014061927795, 0.053804729133844376, 0.005835855845361948, -0.18905320763587952, 0.2857878804206848, -0.3553718626499176, -0.5372399687767029, -0.21715247631072998, -0.22283212840557098, 0.07692116498947144, 0.06861887127161026, -0.32628124952316284, 0.005641564726829529, 0.12744852900505066, -0.21833045780658722, 0.11617749184370041, -0.0357334241271019, 0.04888967052102089, 0.00820397399365902, -0.028704579919576645, -0.2214733511209488, -0.02216486632823944, 0.11373520642518997, -0.09708491712808609, 0.3665198087692261, 0.01813567243516445, 0.07548929750919342, -0.0030669444240629673, -0.008438095450401306, 0.40903720259666443, 0.06726779043674469, 0.3573637902736664, 0.1190391555428505, 0.13565611839294434, 0.23653483390808105, 0.24329042434692383, -0.014558795839548111, -0.3104296624660492, -0.07408186793327332, -0.20086504518985748, -0.13365474343299866, 0.285228431224823, -0.1811600774526596, -0.06859198212623596, -0.1712050437927246, 0.2595585882663727, -0.19814211130142212, 0.13389192521572113, 0.2845243513584137, -0.17390085756778717, -0.02218404784798622, 0.04538973420858383, -0.2726666331291199, -0.07598672807216644, -0.8182584643363953, -0.11622026562690735, 0.0010524466633796692, -0.32363709807395935, 0.15340690314769745, 0.07078754901885986, -0.5319697260856628, 0.014235123991966248, -0.03696204349398613, 0.6073698401451111, 0.02592547982931137, -0.1840081512928009, 0.3075186610221863, -0.11375207453966141, 0.15312005579471588, 0.11318507790565491, 0.08853662014007568, 0.1527758091688156, -0.18424656987190247, -0.07549279183149338, 0.1627209484577179, -0.326401025056839, -0.31589770317077637, -0.15060649812221527, 0.08315036445856094, -0.19955375790596008, 0.0861421674489975, -0.29347437620162964, 0.1514672040939331, -0.24026194214820862, -0.24146081507205963, 0.09114585816860199, 0.18435443937778473, 0.07919073104858398, -0.25743961334228516, 0.48571905493736267, 0.8622172474861145, -0.3275041878223419, -0.1244107186794281, -0.16004274785518646, -0.1945689469575882, -0.2079097032546997, 0.08739334344863892, -0.1361534297466278, -0.14644134044647217, -0.1658060997724533, -0.0960281640291214, 0.5218258500099182, -0.5836123824119568, -0.3668123483657837, 0.199238583445549, -0.14816780388355255, -0.051203787326812744, 0.08332112431526184, -0.0796416848897934, -0.05324627086520195, -0.2549784183502197, -0.2368253469467163, 0.09069234132766724, -0.06956463307142258, -0.10458043962717056, -0.11771628260612488, -0.3816630244255066, 0.11324535310268402, 0.4328429400920868, -0.13266046345233917, 0.11888622492551804, 0.3145069479942322, -0.2089754045009613, 0.5073299407958984, -0.0144733227789402, 0.07513231039047241, -0.06365795433521271, 0.19530467689037323, 0.5001713633537292, -0.040414780378341675, -0.12351483851671219, -0.15851250290870667, 0.12346332520246506, 0.15506784617900848, -0.23754534125328064, -0.10325193405151367, -0.18097195029258728, -0.45612359046936035, 0.023196926340460777, -0.2376699000597, -0.39100706577301025, 0.08706457167863846, 0.029218174517154694, 0.131196528673172, 0.15780331194400787, -0.21082253754138947, 0.3631802797317505, -0.1174592450261116, 0.014480199664831161, -0.5519450306892395, 0.31777849793434143, -0.11859389394521713, -0.007855174131691456, 0.1688580960035324, 0.1890590488910675, 0.12964759767055511, 0.0371137373149395, 0.062046367675065994, 0.40411442518234253, -0.21528255939483643, 0.348741352558136, 0.16753745079040527, 0.11324256658554077, 0.10487327724695206, -0.4358840584754944, 0.4586978256702423, -0.21686005592346191, -0.10341013222932816, 0.18213900923728943, -0.1747087836265564, 0.10849116742610931, -0.22357945144176483, -0.06535621732473373, 0.1332443654537201, 0.13310495018959045, -0.27251318097114563, 0.2876524329185486, -0.21469488739967346, -0.15805473923683167, 0.03448767960071564, -0.032914627343416214, 0.3039231300354004, -0.17516621947288513, -0.2115904688835144, 0.09385542571544647, 0.20082002878189087, -0.17588458955287933, 0.03173292800784111, 0.06181410700082779, -0.14913341403007507, -0.0011897142976522446, 0.1346326619386673, -0.10862209647893906, 0.15673984587192535, 0.12122996896505356, -0.04693106934428215, 0.36197179555892944, 0.4680127501487732, -0.1297500729560852, 0.11989042162895203, 0.0240643247961998, 0.2445344179868698, -0.16119500994682312, -0.08166059106588364, 0.21216057240962982, -0.04653547704219818, -0.11490218341350555, -0.12476807087659836, 0.09418059140443802, -0.28014203906059265, 0.03232944756746292, -0.05526237189769745, -0.15953081846237183, -0.2090267539024353, 0.02984766662120819, -0.21221871674060822, -0.02023308537900448, -0.20277757942676544, 0.07841693609952927, 0.08144384622573853, 0.052599333226680756, -0.34624335169792175, 0.4769914746284485, -0.046824850142002106, 0.11665084213018417, -0.1627875417470932, 0.05300341174006462, -0.02085307613015175, 0.028562650084495544, 0.18067651987075806, -0.04997289553284645, 0.3623318076133728, -0.22644275426864624, 0.5005932450294495, -0.27274835109710693, -0.30654117465019226, 0.00008496269583702087, -0.06629149615764618, 0.1368618607521057, 0.2638171911239624, 0.07968650013208389, -0.0052580684423446655, -0.07951384037733078, 0.21984972059726715, -0.24106718599796295, -0.22534571588039398, -0.27787089347839355, 0.2777821123600006, -0.09777885675430298, -0.004666529595851898, -0.15748485922813416, -0.33339011669158936, -0.37032440304756165, 0.41306108236312866, -0.2479671984910965, 0.09163789451122284, 0.21324552595615387, 0.14022940397262573, 0.10306623578071594, -0.2371332049369812, 0.019541513174772263, -0.0712561085820198, -0.5251644253730774, 0.20730629563331604, -0.5937285423278809, -0.2084968239068985, -0.003037981688976288, 0.4605370759963989, 0.13890597224235535, -0.0725339949131012, -0.40472692251205444, -0.03991153463721275, 0.009519005194306374, 0.09092055261135101, -0.030254490673542023, 0.11007802933454514, 0.22304710745811462, 0.2587144672870636, 0.036004163324832916, -0.007626272737979889, -0.2829377353191376, -0.2900005578994751, -0.139123797416687, -0.13320541381835938, 0.2570751905441284, 0.1591610312461853, -0.010483555495738983, 0.6424641013145447, 0.5002743005752563, 0.15466713905334473, 0.09642481803894043, 0.036982521414756775, 0.6634348630905151, 0.06455361098051071, -0.4875091016292572, -0.02631315030157566, 0.1388380527496338, 0.15411266684532166, 0.07935142517089844, -0.05332575738430023, 0.12599194049835205, -0.34129276871681213, -0.492674320936203, -0.24011552333831787, -0.22014066576957703, -0.15729790925979614, 0.02031700313091278, 0.5030862092971802, -0.1296769082546234, 0.0899009183049202, -0.2182067632675171, -0.025209257379174232, 0.3387141525745392, 0.4716835021972656, 0.22499853372573853, 0.015036490745842457, -0.2407023310661316, 0.17087045311927795, -0.26634326577186584, 0.22093966603279114, -0.0416860394179821, 0.05058899521827698, -0.1843714416027069, -0.04112566262483597, 0.14759497344493866, 0.09606156498193741, 0.6940125226974487, -0.09272322058677673, 0.12992531061172485, -0.04904307425022125, -0.22449249029159546, -0.1423010379076004, 0.17793314158916473, 0.19700317084789276, 0.1729610413312912, -0.31556984782218933, -0.015949711203575134, -0.049382779747247696, -0.37692737579345703, 0.49021536111831665, -0.08357656747102737, -0.2602599263191223, -0.06876581907272339, 0.12721216678619385, -0.16404983401298523, -0.16630734503269196, -0.36728858947753906, -0.08954431861639023, 0.0720430389046669, -0.16489143669605255, 0.2845204472541809, -0.1093682199716568, 0.07599327713251114, 0.18767544627189636, 0.0667584091424942, 0.24971869587898254, 0.2530253231525421, 0.16894587874412537, 0.6931003332138062, -0.03824050724506378, 0.4601633548736572, 0.4466162323951721, -0.04599848762154579, -0.38077813386917114, 0.1168200820684433, 0.04535079747438431, 0.3237912058830261, 0.4517357647418976, -0.10873119533061981, -0.18046680092811584, 0.07374560832977295, 0.07400184869766235, -0.5282679796218872, -0.2204659879207611, 0.2364080399274826, -0.026676800101995468, -0.3371695876121521, -0.7802692651748657, 0.2988494336605072, -0.04732407256960869, -0.025989867746829987, 0.003924742341041565, 0.43954771757125854, -0.10636014491319656, -0.3476106524467468, -0.07852747291326523, 0.983955979347229, 0.20455607771873474, 0.21507486701011658, 0.19043457508087158, -0.10243284702301025, 0.2756102979183197, -0.229660764336586, 0.02630523219704628, -0.28904953598976135, -0.19976621866226196, 0.03340114653110504, -0.08697111904621124, 0.3718201518058777, -0.20427419245243073, -0.10574615001678467, 0.06256981194019318, -0.06518010795116425, -0.071597158908844, -0.028709756210446358, 0.3092706501483917, 0.01512626837939024, 0.05221382528543472, -0.28080126643180847, 0.11039027571678162, 0.12709838151931763, 0.15072762966156006, -0.04338344186544418, -0.4057773947715759, 0.0070188455283641815, -0.03784256428480148, -0.365386426448822, -0.006286377087235451, -0.0194015484303236, 0.31722378730773926, 0.07676967233419418, -0.257857084274292, 0.9587457776069641, 0.44456323981285095, 0.21275541186332703, 0.2352941334247589, -0.25661712884902954, 0.061999037861824036, -0.2691940367221832, -0.17038817703723907, -0.18699222803115845, 0.22472020983695984, 0.13647493720054626, -0.14806979894638062, -0.257232666015625, 0.40513816475868225, 0.023756057024002075, -0.16568027436733246, -0.44797077775001526, 0.06335200369358063, 0.13405777513980865, -0.3843696117401123, 0.15199922025203705, -0.20325246453285217, 0.1725153774023056, -0.04022270813584328, 0.039879292249679565, 0.13364914059638977, 0.04598091542720795, -0.12053453177213669, 0.3869093358516693, -0.10172863304615021, 0.14159131050109863, 0.4758068025112152, -0.045114465057849884, -0.4771384000778198, 0.6174219846725464, 0.12859712541103363, -0.140223890542984, -0.08349601924419403, 0.15463566780090332, 0.361529678106308, -0.5737597942352295, 0.009150718338787556, -0.21167264878749847, 0.3040841221809387, 0.2073179930448532, 0.18111996352672577, 0.10322831571102142, -0.11547354608774185, 0.04603986814618111, -0.18339908123016357, -0.12171577662229538, 0.14549580216407776, -0.15640424191951752, 0.05828101187944412, -0.0613245964050293, -0.06885656714439392, 0.055527955293655396, -0.05603949725627899, -0.3035130798816681, 0.1980261504650116, -0.051122069358825684, -0.09422843903303146, 0.4265337288379669, 0.06212152913212776, 0.06672555208206177, -0.21368013322353363, -0.0468611940741539, 0.10471151769161224, -0.34979328513145447, -0.047194577753543854, 0.018371082842350006, 0.21961051225662231, -0.23683637380599976, -0.08335866779088974, -0.015313268639147282, -0.1721647083759308, -0.23184800148010254, 0.03337842971086502, 0.04791637137532234, 0.04653967171907425, 0.16288647055625916, -0.05906796455383301, 0.045797526836395264, 0.07771536707878113, -0.07622717320919037, 0.331968754529953, 0.3892086148262024, 0.4944171905517578, 0.10637450963258743, 0.07205364853143692, -0.20416514575481415, -0.05232743173837662, 0.2807391881942749, 0.44556406140327454, 0.3836895823478699, -0.05300740897655487, 0.28227877616882324, -0.08977048099040985, 0.11353170871734619, 0.1640092134475708, 0.27283549308776855, 0.27539169788360596, -0.3113774061203003, 0.041089318692684174, 0.1787336766719818, 0.086310014128685, -0.16986940801143646, 0.025318048894405365, 0.18546627461910248, 0.0545625239610672, -0.09720772504806519, 0.198270782828331, 0.03390902653336525, 0.3140143156051636, 0.12847082316875458, 0.24695762991905212, 0.4955648183822632, 0.1606968343257904, 0.4645440876483917, 0.2588918209075928, -0.08614519238471985, -0.052189525216817856, 0.24028772115707397, 0.5874278545379639, 0.09317411482334137, 0.3957523703575134, -0.39740028977394104, 0.23594452440738678, -0.0754179060459137, -0.04003963991999626, 0.19923074543476105, -0.35197222232818604, 0.16251148283481598, 0.12049958109855652, 0.1423242837190628, 0.16694234311580658, -0.23208487033843994, 0.31597161293029785, 0.059588152915239334, 0.016105936840176582, 0.0044297873973846436, 0.19307051599025726, 0.0674515813589096, -0.01319817453622818, 0.3660586476325989, -0.366913765668869, -0.4374690651893616, 0.020452111959457397, 0.03175630047917366, -0.38491201400756836, 0.21676644682884216, -0.19395984709262848, -0.13059014081954956, -0.37301063537597656, -0.07602565735578537, 0.22571784257888794, 0.3232196271419525, -0.19825179874897003, -0.19758395850658417, 0.2380412518978119, 0.0010266602039337158, 0.29205819964408875, 0.39957183599472046, 0.45852166414260864, 0.05980587750673294, 0.1341496706008911, 0.13510340452194214, 0.0006710682064294815, -0.12496348470449448, 0.08627842366695404, -0.002209167927503586, 0.05215897038578987, -0.04366563633084297, 0.08609814941883087, 0.0895090252161026, -0.056983426213264465, -0.1256996989250183, 0.05741415172815323, 0.14033813774585724, -0.7623273134231567, 0.15712344646453857, -0.27667883038520813, -0.07627508044242859, -0.09841194748878479, -0.04290764778852463, -0.5144190192222595, 0.01823960617184639, 0.36360371112823486, 0.12583963572978973, -0.19948062300682068, -0.20851373672485352, 0.03323955833911896, 0.2667766511440277, 0.47360438108444214, 0.42503324151039124, 0.14394709467887878, -0.08061859011650085, -0.567818284034729, -0.6357157230377197, -0.0743379220366478, 0.4319967031478882, 0.10437148809432983, 0.05946294218301773, -0.06268476694822311, 0.22113779187202454, 0.13441233336925507, 0.2095794379711151, -0.06335348635911942, 0.11384514719247818, 0.009172692894935608, 0.003153569996356964, -0.04218938574194908, 0.03239147737622261, 0.09532161802053452, 0.09536897391080856, 0.05725661665201187, 0.14062291383743286, -0.029244091361761093, -0.06123854219913483, -0.2953870892524719, 0.28010663390159607, 0.005659669637680054, -0.4673072397708893, 0.2945435047149658, -0.14574243128299713, 0.2424364686012268, 0.11470948904752731, -0.4860786497592926, -0.3172449767589569, -0.08034870773553848, 0.061366986483335495, 0.40785935521125793, 0.17873287200927734, 0.1588989943265915, -0.3337467610836029, -0.5457340478897095, -0.4723469614982605, 0.1863221973180771, 0.11340776085853577, 0.16445519030094147, -0.18558186292648315, -0.0420379638671875, 0.03741578012704849, 0.11144348233938217, 0.35266971588134766, 0.02261495590209961, -0.08991414308547974, 0.2314198762178421, -0.44288867712020874, -0.1504908949136734, 0.5633208751678467, -0.5615382790565491, -0.14979277551174164, -0.29732972383499146, 0.16800379753112793, 0.04568016901612282, -0.3788461685180664, -0.7236249446868896, 0.2574494183063507, 0.2755599021911621, -0.06485261023044586, 0.04875371977686882, 0.3362269401550293, -0.21537552773952484, 0.08019046485424042, -0.05433151125907898, 0.6143088340759277, -0.07834134250879288, -0.17714299261569977, 0.22649303078651428, -0.18259042501449585 ]
https://github.com/huggingface/datasets/issues/6014
Request to Share/Update Dataset Viewer Code
> wants to run the new dataset-viewer, not the old one Thanks for the clarification for me. I do want to run the new dataset-viewer.
Overview: The repository (huggingface/datasets-viewer) was recently archived and when I tried to run the code, there was the error message "AttributeError: module 'datasets.load' has no attribute 'prepare_module'". I could not resolve the issue myself due to lack of documentation of that attribute. Request: I kindly request the sharing of the code responsible for the dataset preview functionality or help with resolving the error. The dataset viewer on the Hugging Face website is incredibly useful since it is compatible with different types of inputs. It allows users to find datasets that meet their needs more efficiently. If needed, I am willing to contribute to the project by testing, documenting, and providing feedback on the dataset viewer code. Thank you for considering this request, and I look forward to your response.
25
Request to Share/Update Dataset Viewer Code Overview: The repository (huggingface/datasets-viewer) was recently archived and when I tried to run the code, there was the error message "AttributeError: module 'datasets.load' has no attribute 'prepare_module'". I could not resolve the issue myself due to lack of documentation of that attribute. Request: I kindly request the sharing of the code responsible for the dataset preview functionality or help with resolving the error. The dataset viewer on the Hugging Face website is incredibly useful since it is compatible with different types of inputs. It allows users to find datasets that meet their needs more efficiently. If needed, I am willing to contribute to the project by testing, documenting, and providing feedback on the dataset viewer code. Thank you for considering this request, and I look forward to your response. > wants to run the new dataset-viewer, not the old one Thanks for the clarification for me. I do want to run the new dataset-viewer.
[ -0.26142677664756775, 0.04871746897697449, -0.04760851711034775, 0.3212714195251465, -0.004702135920524597, 0.13446781039237976, 0.0914936512708664, 0.36667507886886597, -0.029751833528280258, 0.21518801152706146, -0.21123361587524414, 0.23290039598941803, -0.1249937191605568, 0.2289770394563675, 0.03218425437808037, -0.02355477213859558, -0.06755252927541733, 0.17144201695919037, -0.07886667549610138, 0.021157950162887573, 0.08932946622371674, 0.1421964019536972, -0.23201625049114227, -0.01774369180202484, -0.03907930478453636, 0.1832738220691681, -0.14592799544334412, 0.17075178027153015, -0.12421653419733047, -0.5344420671463013, 0.1803649663925171, 0.3438391387462616, 0.1862795501947403, 0.5005993843078613, -0.00012127304944442585, -0.049667906016111374, 0.3446805477142334, -0.007007170468568802, -0.4003860652446747, -0.08285941183567047, 0.027803823351860046, -0.18911904096603394, 0.19071421027183533, -0.12315003573894501, -0.2819978594779968, -0.22633017599582672, -0.07042508572340012, -0.41714078187942505, 0.5824147462844849, 0.058025483042001724, 0.15561765432357788, 0.43014949560165405, 0.3286897838115692, -0.28679391741752625, -0.11990047246217728, 0.34834545850753784, -0.0069388821721076965, 0.2727542519569397, 0.3413894772529602, 0.1510869413614273, -0.08644885569810867, 0.3348177969455719, 0.06134603172540665, -0.22658134996891022, 0.3599964380264282, -0.15723782777786255, -0.007682397961616516, -0.2721756100654602, 0.09944705665111542, -0.07516153901815414, 0.8572000861167908, -0.3679236173629761, -0.28474488854408264, -0.23671424388885498, 0.05131325498223305, 0.15180324018001556, 0.05566117540001869, 0.009799199178814888, -0.2123221457004547, 0.2852935492992401, -0.35448965430259705, -0.5489212870597839, -0.20490987598896027, -0.2373702973127365, 0.054638102650642395, 0.031033210456371307, -0.32646864652633667, 0.015195943415164948, 0.15330156683921814, -0.22884021699428558, 0.07292801141738892, -0.014300685375928879, 0.05675108730792999, 0.0029072193428874016, -0.023337382823228836, -0.22328932583332062, -0.0077028945088386536, 0.125919371843338, -0.0806819275021553, 0.34030354022979736, 0.01424630731344223, 0.06421451270580292, -0.015578430145978928, -0.014947891235351562, 0.4140895903110504, 0.03646871820092201, 0.37487906217575073, 0.11772314459085464, 0.13305813074111938, 0.255153089761734, 0.2236863374710083, -0.033151499927043915, -0.3033488094806671, -0.0657726526260376, -0.20311228930950165, -0.13363611698150635, 0.2934330105781555, -0.17189963161945343, -0.04928836226463318, -0.16129973530769348, 0.2609751522541046, -0.1978815644979477, 0.13898500800132751, 0.3053962290287018, -0.17583397030830383, -0.058415040373802185, 0.052939534187316895, -0.2721138596534729, -0.08344606310129166, -0.8230459094047546, -0.11211521923542023, 0.00800033938139677, -0.3299233317375183, 0.1630556583404541, 0.05333957448601723, -0.5200130343437195, 0.017197828739881516, -0.030034653842449188, 0.6142533421516418, 0.01703423261642456, -0.2178407907485962, 0.2956235408782959, -0.13332366943359375, 0.14912725985050201, 0.1332527995109558, 0.10241220891475677, 0.1362122893333435, -0.22879178822040558, -0.07254556566476822, 0.15221725404262543, -0.33275413513183594, -0.3394869565963745, -0.13200394809246063, 0.056744012981653214, -0.21324323117733002, 0.12160300463438034, -0.2750892639160156, 0.13474643230438232, -0.2555136978626251, -0.25099238753318787, 0.0663701593875885, 0.18324245512485504, 0.07238970696926117, -0.2580574154853821, 0.4729235768318176, 0.8818504214286804, -0.3338068127632141, -0.133438840508461, -0.15280087292194366, -0.1686869114637375, -0.21998807787895203, 0.09898768365383148, -0.12544825673103333, -0.1764470934867859, -0.18056657910346985, -0.11430498957633972, 0.5382043123245239, -0.6018006801605225, -0.3728712797164917, 0.18405313789844513, -0.13687065243721008, -0.06010085344314575, 0.09012135118246078, -0.08458756655454636, -0.0432068295776844, -0.26949986815452576, -0.242567241191864, 0.06580261886119843, -0.0735091120004654, -0.12996011972427368, -0.09746597707271576, -0.370792031288147, 0.09755932539701462, 0.42771244049072266, -0.1498422771692276, 0.12810450792312622, 0.3049212098121643, -0.19537679851055145, 0.5369933843612671, -0.011725518852472305, 0.06556505709886551, -0.04576890170574188, 0.1988120973110199, 0.5187275409698486, -0.030461713671684265, -0.10486925393342972, -0.14550542831420898, 0.14629629254341125, 0.14826421439647675, -0.24214044213294983, -0.09456442296504974, -0.18682871758937836, -0.45995333790779114, 0.03861308842897415, -0.2124493569135666, -0.3805636465549469, 0.05716719478368759, 0.03712495043873787, 0.13347069919109344, 0.16541928052902222, -0.21891221404075623, 0.3544541299343109, -0.15124055743217468, 0.030338265001773834, -0.5491183996200562, 0.28944623470306396, -0.1269741654396057, -0.016737721860408783, 0.17964737117290497, 0.19959402084350586, 0.12866444885730743, 0.05260276794433594, 0.07194066047668457, 0.3714708089828491, -0.23770637810230255, 0.35383617877960205, 0.13560622930526733, 0.10849876701831818, 0.12293516844511032, -0.4302808344364166, 0.44801774621009827, -0.23051847517490387, -0.08501829952001572, 0.18492156267166138, -0.15474510192871094, 0.09236419200897217, -0.19119255244731903, -0.046406932175159454, 0.1690746545791626, 0.13813115656375885, -0.2740142047405243, 0.28413084149360657, -0.21224795281887054, -0.1468442976474762, 0.04927436634898186, -0.0199601948261261, 0.3112339377403259, -0.21026337146759033, -0.19206355512142181, 0.0850689634680748, 0.22276757657527924, -0.1888521909713745, 0.04633444920182228, 0.07847613096237183, -0.1527787744998932, 0.01346518099308014, 0.11026054620742798, -0.11811815947294235, 0.1402919590473175, 0.10954908281564713, -0.052034858614206314, 0.37151360511779785, 0.4891515076160431, -0.1250278353691101, 0.08538395166397095, -0.0011153742671012878, 0.2739528715610504, -0.16494986414909363, -0.09541582316160202, 0.20864266157150269, -0.04064992070198059, -0.12043794989585876, -0.1291910856962204, 0.09419616311788559, -0.2700367569923401, 0.027283335104584694, -0.0438573956489563, -0.15834581851959229, -0.18455493450164795, 0.06324071437120438, -0.23713168501853943, -0.0032507525756955147, -0.2296929508447647, 0.10163553804159164, 0.09631316363811493, 0.04137017950415611, -0.35624346137046814, 0.465409517288208, -0.04718033969402313, 0.13089987635612488, -0.1511017233133316, 0.04097815975546837, -0.03921525925397873, 0.0029278621077537537, 0.14693886041641235, -0.08912836760282516, 0.33178916573524475, -0.22812403738498688, 0.4855891466140747, -0.284047394990921, -0.296885222196579, 0.014750819653272629, -0.06468480825424194, 0.12324315309524536, 0.27940648794174194, 0.09420760720968246, -0.017184995114803314, -0.05423138290643692, 0.21437588334083557, -0.2735181152820587, -0.23905062675476074, -0.2831610441207886, 0.2854117453098297, -0.07717195153236389, 0.03142067417502403, -0.1131148561835289, -0.33814969658851624, -0.3705284595489502, 0.4120436906814575, -0.23916909098625183, 0.08666791021823883, 0.21895325183868408, 0.120909184217453, 0.09496770799160004, -0.23352138698101044, 0.031780555844306946, -0.07402610778808594, -0.5215367078781128, 0.18926963210105896, -0.5777574777603149, -0.21706338226795197, 0.012330148369073868, 0.4545530676841736, 0.13556994497776031, -0.06770804524421692, -0.40496116876602173, -0.05698363110423088, 0.01798352599143982, 0.08841501176357269, -0.04482835531234741, 0.10916967689990997, 0.23237578570842743, 0.25164106488227844, 0.04826909303665161, -0.02708507515490055, -0.3196788728237152, -0.28021934628486633, -0.08996440470218658, -0.14810287952423096, 0.3003036677837372, 0.19384843111038208, -0.022286390885710716, 0.6231662631034851, 0.48961734771728516, 0.16764584183692932, 0.09587614238262177, 0.018468935042619705, 0.6503539681434631, 0.08272579312324524, -0.4828667938709259, -0.044054992496967316, 0.13717830181121826, 0.14887018501758575, 0.07899541407823563, -0.05295679718255997, 0.14813025295734406, -0.3359315097332001, -0.5061275959014893, -0.24587976932525635, -0.23417556285858154, -0.15768489241600037, 0.03661622107028961, 0.5193920731544495, -0.1501407027244568, 0.08635798841714859, -0.20131270587444305, 0.0035869553685188293, 0.3463663160800934, 0.4928078055381775, 0.2530694901943207, 0.01863744668662548, -0.23439228534698486, 0.17592132091522217, -0.280622273683548, 0.20438526570796967, -0.05270933359861374, 0.02654096856713295, -0.21464242041110992, -0.011226866394281387, 0.14334453642368317, 0.08588316291570663, 0.7173316478729248, -0.08873554319143295, 0.1808701604604721, -0.06366623938083649, -0.2545141577720642, -0.15505121648311615, 0.19831931591033936, 0.20509681105613708, 0.17587780952453613, -0.34755945205688477, -0.0498306006193161, -0.0683477595448494, -0.3759385943412781, 0.4828350245952606, -0.07793309539556503, -0.26994848251342773, -0.06259957700967789, 0.1312350332736969, -0.19255095720291138, -0.17454050481319427, -0.3726747930049896, -0.10167418420314789, 0.07216503471136093, -0.12760880589485168, 0.29219698905944824, -0.1171155720949173, 0.044471338391304016, 0.1871892809867859, 0.06381435692310333, 0.2527243196964264, 0.24081756174564362, 0.16524705290794373, 0.7020711898803711, -0.06294088065624237, 0.44917863607406616, 0.46515169739723206, -0.03855179622769356, -0.4008997976779938, 0.12366240471601486, 0.05904316529631615, 0.3191434144973755, 0.48773398995399475, -0.1072763055562973, -0.15528452396392822, 0.08042550086975098, 0.05501210317015648, -0.53348308801651, -0.2283395379781723, 0.25329601764678955, -0.015609555877745152, -0.3467458486557007, -0.7661541104316711, 0.2860465347766876, -0.031397026032209396, -0.026870213449001312, -0.03183073550462723, 0.4885615110397339, -0.1055823564529419, -0.3516332507133484, -0.09428855031728745, 1.0215768814086914, 0.208448126912117, 0.22013603150844574, 0.19828274846076965, -0.12895311415195465, 0.27634763717651367, -0.20642924308776855, 0.02244376949965954, -0.29403579235076904, -0.1968899965286255, 0.020824817940592766, -0.08223062753677368, 0.3562968373298645, -0.19902001321315765, -0.07989652454853058, 0.060689639300107956, -0.055288881063461304, -0.08969368040561676, -0.010564608499407768, 0.31200507283210754, 0.015124091878533363, 0.04587829113006592, -0.29893940687179565, 0.08338555693626404, 0.12934252619743347, 0.16449220478534698, -0.039520494639873505, -0.3997349739074707, 0.03243923559784889, -0.05147465690970421, -0.38394176959991455, -0.014307004399597645, -0.014855191111564636, 0.2869225740432739, 0.083261638879776, -0.2905002534389496, 0.9687226414680481, 0.4144868850708008, 0.1887255609035492, 0.23326937854290009, -0.24564316868782043, 0.06121249124407768, -0.28215858340263367, -0.1676752269268036, -0.206938236951828, 0.23823495209217072, 0.13021114468574524, -0.1548125147819519, -0.24137187004089355, 0.4177781641483307, 0.008649257011711597, -0.15912935137748718, -0.42873069643974304, 0.06666998565196991, 0.13812395930290222, -0.389297753572464, 0.15521679818630219, -0.2009049355983734, 0.15413574874401093, -0.03082883358001709, 0.01559159904718399, 0.12861986458301544, 0.03496653959155083, -0.16121217608451843, 0.38157036900520325, -0.08386167138814926, 0.15923039615154266, 0.4634703993797302, -0.02964494377374649, -0.4624551236629486, 0.638529896736145, 0.10742603242397308, -0.13352319598197937, -0.06406141817569733, 0.11463258415460587, 0.4143839180469513, -0.5819210410118103, 0.020682677626609802, -0.20359353721141815, 0.30954211950302124, 0.2028777152299881, 0.16481220722198486, 0.11255985498428345, -0.11001010984182358, 0.038133230060338974, -0.21140557527542114, -0.11611673980951309, 0.15585625171661377, -0.1647336781024933, 0.04200337827205658, -0.026076633483171463, -0.06872554123401642, 0.05378904938697815, -0.04195640981197357, -0.2803565263748169, 0.19775167107582092, -0.03638528659939766, -0.09720359742641449, 0.4340071678161621, 0.05350268632173538, 0.06671146303415298, -0.20416663587093353, -0.0669451653957367, 0.10505451261997223, -0.3537146747112274, -0.02099769189953804, 0.02166876196861267, 0.23657642304897308, -0.2327733039855957, -0.0641094297170639, 0.00773993507027626, -0.15279848873615265, -0.21698544919490814, 0.04630720987915993, 0.04821983352303505, 0.029952071607112885, 0.16784614324569702, -0.08057811111211777, 0.04412791132926941, 0.09843558073043823, -0.12267599999904633, 0.3301437199115753, 0.3876948952674866, 0.4922102689743042, 0.09664662182331085, 0.0759681761264801, -0.20280662178993225, -0.046275682747364044, 0.2839355766773224, 0.4365052580833435, 0.37757354974746704, -0.06268762052059174, 0.3056221306324005, -0.07780605554580688, 0.14249038696289062, 0.14948350191116333, 0.27244603633880615, 0.2752457559108734, -0.2997324764728546, 0.0387704074382782, 0.18460670113563538, 0.05803694576025009, -0.1761869192123413, 0.022698836401104927, 0.19996671378612518, 0.03135010972619057, -0.09030146151781082, 0.21665893495082855, 0.01672026887536049, 0.33203962445259094, 0.11027048528194427, 0.24794599413871765, 0.5172940492630005, 0.1426033079624176, 0.43759918212890625, 0.28608906269073486, -0.08375918120145798, -0.034365128725767136, 0.2495187520980835, 0.5898413062095642, 0.1117519661784172, 0.39936965703964233, -0.4093916714191437, 0.24312253296375275, -0.07386773824691772, -0.05278187617659569, 0.21647942066192627, -0.3631269931793213, 0.16718675196170807, 0.1471438854932785, 0.16773751378059387, 0.16781648993492126, -0.23241880536079407, 0.2895204424858093, 0.06362868845462799, 0.014266518875956535, 0.0014104172587394714, 0.1876276582479477, 0.06421856582164764, -0.003472261130809784, 0.35754770040512085, -0.35403650999069214, -0.45431506633758545, 0.04084665700793266, 0.02135804109275341, -0.3773452043533325, 0.20570653676986694, -0.1961202174425125, -0.10814161598682404, -0.36268243193626404, -0.11165719479322433, 0.22047343850135803, 0.3360515832901001, -0.1819031834602356, -0.19440770149230957, 0.24840177595615387, 0.017673030495643616, 0.2979443073272705, 0.4177350699901581, 0.46519720554351807, 0.03207818418741226, 0.15243235230445862, 0.1675766259431839, 0.002063295803964138, -0.11270376294851303, 0.09257364273071289, -0.0318293422460556, 0.05580969527363777, -0.05684422329068184, 0.05998210981488228, 0.06769002974033356, -0.03660954162478447, -0.14098471403121948, 0.04360218718647957, 0.09069302678108215, -0.755890429019928, 0.16112549602985382, -0.2601231336593628, -0.07385468482971191, -0.10103005170822144, -0.039917655289173126, -0.48790210485458374, 0.023201582953333855, 0.36977139115333557, 0.1255115568637848, -0.2144080400466919, -0.17304293811321259, 0.019575968384742737, 0.24899107217788696, 0.4653908610343933, 0.4373258352279663, 0.14877793192863464, -0.0738440454006195, -0.5488011240959167, -0.6187459826469421, -0.060653410851955414, 0.42389217019081116, 0.07114695012569427, 0.05794920027256012, -0.07104089111089706, 0.22105851769447327, 0.12083359062671661, 0.23683807253837585, -0.07120781391859055, 0.09584007412195206, -0.006737411022186279, 0.02267051488161087, -0.07326225936412811, 0.07940710335969925, 0.0835910215973854, 0.07895126193761826, 0.08634836226701736, 0.13568562269210815, -0.039669569581747055, -0.08509716391563416, -0.26385819911956787, 0.26671671867370605, 0.003025956451892853, -0.47804686427116394, 0.2886549234390259, -0.14003843069076538, 0.25563663244247437, 0.12018103152513504, -0.4966983199119568, -0.27091988921165466, -0.052736733108758926, 0.05597997084259987, 0.429943710565567, 0.19665923714637756, 0.14495520293712616, -0.34139424562454224, -0.5101132392883301, -0.47666680812835693, 0.18740764260292053, 0.11164717376232147, 0.1554517149925232, -0.18679924309253693, -0.032430168241262436, 0.04115523397922516, 0.12522044777870178, 0.37334099411964417, 0.023902354761958122, -0.09857989847660065, 0.22594767808914185, -0.46767646074295044, -0.15085138380527496, 0.5912026166915894, -0.5483286380767822, -0.13591952621936798, -0.29666393995285034, 0.18634450435638428, 0.0494350865483284, -0.3694947361946106, -0.7214063405990601, 0.25180596113204956, 0.2758357524871826, -0.05751083791255951, 0.05012310668826103, 0.3164571523666382, -0.2100960910320282, 0.06927120685577393, -0.05047912895679474, 0.6136969327926636, -0.06417474895715714, -0.20934569835662842, 0.23566144704818726, -0.169717475771904 ]
https://github.com/huggingface/datasets/issues/6014
Request to Share/Update Dataset Viewer Code
It should be possible to run it locally using the HF datasets-server API (docs [here](https://huggingface.co/docs/datasets-server)) but the front end part is not open source (yet ?) The back-end is open source though if you're interested: https://github.com/huggingface/datasets-server It automatically converts datasets on HF to Parquet, which is the format we use to power the viewer.
Overview: The repository (huggingface/datasets-viewer) was recently archived and when I tried to run the code, there was the error message "AttributeError: module 'datasets.load' has no attribute 'prepare_module'". I could not resolve the issue myself due to lack of documentation of that attribute. Request: I kindly request the sharing of the code responsible for the dataset preview functionality or help with resolving the error. The dataset viewer on the Hugging Face website is incredibly useful since it is compatible with different types of inputs. It allows users to find datasets that meet their needs more efficiently. If needed, I am willing to contribute to the project by testing, documenting, and providing feedback on the dataset viewer code. Thank you for considering this request, and I look forward to your response.
54
Request to Share/Update Dataset Viewer Code Overview: The repository (huggingface/datasets-viewer) was recently archived and when I tried to run the code, there was the error message "AttributeError: module 'datasets.load' has no attribute 'prepare_module'". I could not resolve the issue myself due to lack of documentation of that attribute. Request: I kindly request the sharing of the code responsible for the dataset preview functionality or help with resolving the error. The dataset viewer on the Hugging Face website is incredibly useful since it is compatible with different types of inputs. It allows users to find datasets that meet their needs more efficiently. If needed, I am willing to contribute to the project by testing, documenting, and providing feedback on the dataset viewer code. Thank you for considering this request, and I look forward to your response. It should be possible to run it locally using the HF datasets-server API (docs [here](https://huggingface.co/docs/datasets-server)) but the front end part is not open source (yet ?) The back-end is open source though if you're interested: https://github.com/huggingface/datasets-server It automatically converts datasets on HF to Parquet, which is the format we use to power the viewer.
[ -0.3023461401462555, -0.039006151258945465, -0.020467743277549744, 0.2967481017112732, 0.009397780522704124, 0.13059893250465393, 0.0453820675611496, 0.38922399282455444, -0.012390386313199997, 0.1952628195285797, -0.2966969311237335, 0.22623898088932037, -0.1591140627861023, 0.3827345073223114, 0.0907038152217865, -0.09622934460639954, -0.03479830175638199, 0.13482064008712769, -0.20354947447776794, -0.044193021953105927, 0.08353018760681152, 0.1667044758796692, -0.22522547841072083, 0.06465644389390945, 0.03845558688044548, 0.18584425747394562, -0.22543257474899292, 0.18488988280296326, -0.11050807684659958, -0.4082416296005249, 0.15992584824562073, 0.35682740807533264, 0.19190995395183563, 0.476846307516098, -0.00011918856762349606, -0.05336053669452667, 0.23889759182929993, -0.0008906293660402298, -0.357237845659256, -0.16464565694332123, 0.08656535297632217, -0.1195748969912529, 0.15598657727241516, -0.08023083209991455, -0.2878834009170532, -0.3284648358821869, -0.0654406026005745, -0.4444449841976166, 0.5301884412765503, 0.07165775448083878, 0.14495910704135895, 0.42970484495162964, 0.2581227719783783, -0.20913462340831757, -0.0406319797039032, 0.44154465198516846, -0.037303730845451355, 0.21835586428642273, 0.2366487979888916, 0.03760794550180435, -0.1342707872390747, 0.32507577538490295, 0.08565589785575867, -0.16984444856643677, 0.4671086370944977, -0.13735733926296234, -0.16026076674461365, -0.24003717303276062, 0.10097377002239227, 0.02678333781659603, 0.722350537776947, -0.44323888421058655, -0.307980477809906, -0.2652899920940399, 0.034812379628419876, 0.14679650962352753, 0.011345811188220978, 0.1960332840681076, -0.1264229565858841, 0.2460026890039444, -0.3531934916973114, -0.5556281208992004, -0.22651219367980957, -0.19730423390865326, 0.07818479835987091, 0.032920777797698975, -0.3342169225215912, 0.010728172957897186, 0.10275798290967941, -0.23674659430980682, 0.06331892311573029, -0.15046338737010956, 0.08642547577619553, 0.08591321855783463, -0.045959051698446274, -0.174477219581604, -0.03442845493555069, 0.13953396677970886, 0.03725104779005051, 0.18595245480537415, -0.04338693618774414, 0.14148515462875366, -0.058186665177345276, 0.04055240377783775, 0.45153501629829407, -0.031653568148612976, 0.3504270017147064, 0.15335896611213684, 0.04940657317638397, 0.26946598291397095, 0.26363471150398254, -0.018132179975509644, -0.29419976472854614, -0.020572438836097717, -0.3653804063796997, -0.24480465054512024, 0.21476463973522186, -0.25216659903526306, -0.08139708638191223, -0.09685203433036804, 0.24028930068016052, -0.10645124316215515, 0.10941434651613235, 0.34898605942726135, -0.21221673488616943, -0.033259280025959015, 0.04046148806810379, -0.2234780341386795, -0.16445286571979523, -0.7894430160522461, -0.0863693505525589, 0.035021692514419556, -0.2558131814002991, 0.18961670994758606, 0.05981877073645592, -0.5493646860122681, -0.011812491342425346, -0.026518242433667183, 0.6413706541061401, 0.14029087126255035, -0.17287933826446533, 0.2336265593767166, -0.11679575592279434, 0.10339541733264923, 0.12599115073680878, 0.0025134719908237457, 0.23747578263282776, -0.16501149535179138, -0.09840337932109833, 0.04279602691531181, -0.30967578291893005, -0.2635539472103119, -0.2357230931520462, 0.05265546962618828, -0.19569043815135956, 0.08844836801290512, -0.3395228981971741, 0.20462635159492493, -0.30471065640449524, -0.2035195380449295, 0.043559689074754715, 0.13734006881713867, -0.044515304267406464, -0.21594269573688507, 0.527262270450592, 0.8897866010665894, -0.3399917185306549, -0.1312912404537201, -0.05026458203792572, -0.1951328068971634, -0.19461306929588318, 0.11194665729999542, -0.14075209200382233, -0.11072925478219986, -0.20226937532424927, -0.11649733781814575, 0.41488465666770935, -0.5457674860954285, -0.22771407663822174, 0.2918556332588196, -0.011182412505149841, -0.06957715004682541, 0.025523267686367035, -0.21334131062030792, -0.023221455514431, -0.21749423444271088, -0.23822647333145142, 0.12130029499530792, -0.0683278888463974, -0.10762817412614822, -0.13194666802883148, -0.38814297318458557, 0.008998202160000801, 0.4689907729625702, -0.050105731934309006, 0.12466055899858475, 0.32012835144996643, -0.21026702225208282, 0.5442492365837097, -0.09530118107795715, 0.12919996678829193, -0.022221755236387253, 0.18638725578784943, 0.599583089351654, -0.0464223176240921, -0.14941024780273438, -0.1679251790046692, 0.06861849874258041, 0.018223542720079422, -0.20667549967765808, -0.1400734782218933, -0.2704821825027466, -0.37110278010368347, 0.08802225440740585, -0.20778532326221466, -0.34459197521209717, 0.07739640027284622, -0.01477649062871933, 0.08933855593204498, 0.1526835560798645, -0.25174829363822937, 0.42814791202545166, -0.18647444248199463, -0.015333365648984909, -0.4811878800392151, 0.4006846249103546, -0.03427375108003616, 0.03883272781968117, 0.2573796510696411, 0.1594737470149994, 0.11020675301551819, -0.02047305926680565, 0.04483784735202789, 0.44663023948669434, -0.1959141492843628, 0.3479100465774536, 0.2183401882648468, 0.13017210364341736, 0.118150494992733, -0.44407299160957336, 0.4207577407360077, -0.28389760851860046, -0.07554429024457932, 0.17370980978012085, -0.2586757242679596, 0.1579250693321228, -0.22042210400104523, 0.001825094223022461, 0.14098255336284637, 0.11832001060247421, -0.2813509702682495, 0.32733622193336487, -0.17814867198467255, -0.1499321609735489, 0.10110507905483246, -0.11622977256774902, 0.2797532379627228, -0.22086869180202484, -0.26210352778434753, 0.10756389796733856, 0.27206626534461975, -0.15574558079242706, -0.03673116862773895, 0.15741005539894104, -0.14935094118118286, 0.032923173159360886, 0.1978638470172882, -0.1782890409231186, 0.10059242695569992, 0.11939703673124313, -0.07033254206180573, 0.4540209472179413, 0.3585076332092285, 0.010867798700928688, 0.06599408388137817, 0.03565652668476105, 0.23264949023723602, -0.14970803260803223, -0.15707197785377502, 0.21990691125392914, -0.10273928940296173, -0.12288255989551544, -0.15754897892475128, 0.06718417257070541, -0.3310287296772003, 0.09355466067790985, -0.17609570920467377, -0.1522907316684723, -0.1823810487985611, 0.1509510576725006, -0.23214098811149597, -0.07060869038105011, -0.21776236593723297, 0.08037105202674866, 0.08175356686115265, 0.004504380747675896, -0.3735533356666565, 0.4129544794559479, -0.09097755700349808, 0.04088623821735382, -0.1886606067419052, 0.018366193398833275, -0.08808725327253342, -0.00021629594266414642, 0.2795584499835968, -0.0016545993275940418, 0.3696090877056122, -0.24851462244987488, 0.4117293953895569, -0.3252062499523163, -0.298387348651886, 0.05834334343671799, -0.02858681231737137, 0.14708340167999268, 0.310091108083725, 0.011928386986255646, -0.19896118342876434, -0.011816827580332756, 0.2173680067062378, -0.2818909287452698, -0.1763603389263153, -0.1943444460630417, 0.20424896478652954, -0.1212930828332901, -0.026264116168022156, -0.040229685604572296, -0.3107828199863434, -0.4034773111343384, 0.38997137546539307, -0.18938614428043365, 0.16038045287132263, 0.09519875049591064, 0.07396040856838226, 0.19870565831661224, -0.2752113938331604, 0.025667108595371246, -0.10120285302400589, -0.5150478482246399, 0.23261858522891998, -0.617234468460083, -0.3144855201244354, 0.045647550374269485, 0.40603649616241455, 0.09013773500919342, -0.07387486100196838, -0.4829842448234558, -0.015602054074406624, 0.08768419921398163, 0.031867992132902145, -0.08245350420475006, 0.13018172979354858, 0.1830722689628601, 0.2205030769109726, 0.09404465556144714, -0.08339512348175049, -0.2612881064414978, -0.3056582510471344, -0.09829292446374893, -0.13735291361808777, 0.2998700439929962, 0.21689406037330627, 0.057491663843393326, 0.5985252857208252, 0.47424331307411194, 0.16740581393241882, 0.20127594470977783, 0.03916361555457115, 0.673973798751831, 0.0018739476799964905, -0.38745900988578796, -0.026170307770371437, 0.08233842998743057, 0.20260371267795563, 0.1812186986207962, -0.02974279224872589, 0.17058143019676208, -0.30023977160453796, -0.46225202083587646, -0.22252312302589417, -0.21501754224300385, -0.1625521332025528, 0.007102940231561661, 0.48919394612312317, -0.10407526791095734, 0.1101912185549736, -0.19138823449611664, -0.05991152673959732, 0.4264973998069763, 0.508725106716156, 0.3063164949417114, 0.13174107670783997, -0.16141377389431, 0.14387701451778412, -0.2539091408252716, 0.20527836680412292, -0.06299256533384323, 0.03222208097577095, -0.28795814514160156, -0.0064437370747327805, 0.14392581582069397, -0.02203286625444889, 0.6792668104171753, -0.031019998714327812, 0.09324600547552109, -0.04011136665940285, -0.22334297001361847, -0.20828886330127716, 0.1471031904220581, 0.18310047686100006, 0.0954548791050911, -0.36015844345092773, 0.09238997846841812, -0.1437164843082428, -0.5122084021568298, 0.44656985998153687, -0.13263438642024994, -0.23735597729682922, -0.06226428970694542, 0.1360553652048111, -0.1244911476969719, -0.1794515997171402, -0.3604912757873535, -0.09318028390407562, 0.10198410600423813, -0.04246740788221359, 0.33536678552627563, -0.10098676383495331, 0.1436944603919983, 0.20971226692199707, -0.019355837255716324, 0.23744434118270874, 0.23683568835258484, 0.1627829670906067, 0.6062841415405273, -0.0039392560720443726, 0.37405169010162354, 0.5037319660186768, 0.016214925795793533, -0.3589267134666443, 0.20377734303474426, 0.12725885212421417, 0.30913370847702026, 0.36201173067092896, -0.05452899634838104, -0.15595248341560364, 0.12369933724403381, 0.2263209968805313, -0.5852645635604858, -0.1213943287730217, 0.20219828188419342, -0.09133968502283096, -0.34151890873908997, -0.6597554087638855, 0.3782009184360504, -0.1104678064584732, 0.016494281589984894, 0.06683170050382614, 0.6670681834220886, -0.03652140498161316, -0.22645364701747894, -0.007973626255989075, 0.9136323928833008, 0.10339480638504028, 0.19878391921520233, 0.19525274634361267, -0.3233083486557007, 0.238565593957901, -0.2989767789840698, -0.07503942400217056, -0.24722136557102203, -0.18048490583896637, -0.030207982286810875, -0.0777551680803299, 0.39480847120285034, -0.15059925615787506, -0.06317708641290665, 0.11513480544090271, 0.01384955644607544, -0.013941708952188492, -0.03429367393255234, 0.380548357963562, -0.02687777765095234, -0.10915423929691315, -0.35828733444213867, 0.11933359503746033, 0.11380553245544434, 0.14561660587787628, -0.0643145740032196, -0.4023817181587219, 0.07644639909267426, 0.06921465694904327, -0.3189595341682434, 0.015404436737298965, 0.02752513438463211, 0.2062419205904007, 0.09702044725418091, -0.14254575967788696, 0.9857890009880066, 0.31381896138191223, 0.15206566452980042, 0.23826804757118225, -0.3081566393375397, 0.029539279639720917, -0.31472712755203247, -0.13404732942581177, -0.20619797706604004, 0.27797096967697144, 0.16807712614536285, -0.14094889163970947, -0.22388803958892822, 0.32228776812553406, -0.0006070006638765335, -0.09461130201816559, -0.3014283776283264, -0.025887317955493927, 0.12891852855682373, -0.34475699067115784, 0.19618359208106995, -0.13550500571727753, 0.18293093144893646, 0.038634609431028366, 0.01565771922469139, 0.07907290756702423, 0.012474272400140762, -0.13931208848953247, 0.3690195083618164, -0.005219422280788422, 0.07878221571445465, 0.4496288597583771, -0.11501672118902206, -0.3690342903137207, 0.5258028507232666, 0.24877743422985077, -0.20392021536827087, -0.04548896104097366, 0.1356368362903595, 0.39094918966293335, -0.49153298139572144, -0.10205516219139099, -0.16724471747875214, 0.3199111819267273, 0.14633235335350037, 0.12369813024997711, 0.12795814871788025, -0.2295861840248108, 0.09115810692310333, -0.22332526743412018, -0.13187925517559052, 0.15244604647159576, -0.17969410121440887, 0.05527082830667496, 0.10379090160131454, -0.013415975496172905, 0.06445751339197159, 0.0028090737760066986, -0.27849888801574707, 0.14697685837745667, -0.00890246219933033, -0.09700493514537811, 0.44584375619888306, 0.1168973371386528, 0.11670026183128357, -0.22383476793766022, -0.05911695212125778, 0.12228278815746307, -0.39051204919815063, -0.031628869473934174, -0.07742529362440109, 0.22494812309741974, -0.14663076400756836, -0.11289041489362717, 0.007411736063659191, -0.15672163665294647, -0.32547080516815186, -0.04336541146039963, 0.13622084259986877, 0.0717092826962471, 0.10814712941646576, -0.03114430233836174, 0.1208268404006958, -0.008980005979537964, -0.1460021734237671, 0.22313785552978516, 0.5686630010604858, 0.43029314279556274, 0.04203495383262634, 0.06759603321552277, -0.2048357129096985, -0.07999167591333389, 0.21316343545913696, 0.49048322439193726, 0.38959139585494995, -0.17983925342559814, 0.4111080765724182, -0.12442484498023987, 0.16969671845436096, 0.06111149489879608, 0.3919294476509094, 0.2228558361530304, -0.24893175065517426, 0.009371684864163399, 0.2982179820537567, 0.047398850321769714, -0.16691450774669647, -0.017579015344381332, 0.1573266237974167, 0.06441747397184372, -0.07250003516674042, 0.1579464226961136, 0.06145789101719856, 0.3381761908531189, 0.0319652296602726, 0.2561306357383728, 0.44902294874191284, 0.1576240062713623, 0.36222490668296814, 0.2942356467247009, -0.11622826009988785, 0.044498540461063385, 0.16753850877285004, 0.5923236012458801, 0.08325023949146271, 0.3895184397697449, -0.3448474705219269, 0.17992402613162994, -0.1209196224808693, 0.056503552943468094, 0.2887842357158661, -0.454434335231781, 0.1441514492034912, 0.1714886724948883, 0.26225757598876953, 0.19254261255264282, -0.32636505365371704, 0.34874865412712097, 0.1425643414258957, -0.1519125998020172, 0.011763842776417732, 0.290113240480423, 0.09239444881677628, 0.03716905042529106, 0.3103896975517273, -0.30595624446868896, -0.4366956949234009, 0.030819114297628403, 0.09597650915384293, -0.4194754958152771, 0.18804219365119934, -0.11298733949661255, -0.015195675194263458, -0.2853664755821228, -0.04599166661500931, 0.23189127445220947, 0.3616876006126404, -0.17166045308113098, -0.17811833322048187, 0.187326118350029, 0.026477303355932236, 0.19905279576778412, 0.30930548906326294, 0.3656438887119293, 0.047744981944561005, 0.11609295010566711, 0.15079128742218018, 0.005002971738576889, -0.037893593311309814, 0.2254411280155182, -0.033891573548316956, -0.05293762683868408, -0.05541108921170235, 0.18310539424419403, 0.03818923979997635, -0.014264375902712345, -0.2179449051618576, -0.000544469803571701, 0.13880643248558044, -0.7263160943984985, 0.15104493498802185, -0.26307010650634766, -0.03211108595132828, -0.018530838191509247, -0.05522824078798294, -0.46933943033218384, 0.026372220367193222, 0.33423179388046265, 0.16801004111766815, -0.13967324793338776, -0.1426202356815338, 0.025272779166698456, 0.2917684018611908, 0.4769451916217804, 0.38580504059791565, 0.12935662269592285, -0.07459092140197754, -0.5595292448997498, -0.626775324344635, -0.1286531686782837, 0.34377655386924744, 0.0424349382519722, 0.1898977905511856, -0.04852216690778732, 0.2800482213497162, 0.11197421699762344, 0.12422864884138107, -0.047913260757923126, 0.07246971875429153, 0.07828143984079361, 0.09393906593322754, -0.0761348158121109, -0.10804936289787292, 0.08409658074378967, 0.09796372056007385, -0.015485629439353943, 0.13625651597976685, -0.0723077729344368, -0.08979664742946625, -0.22688037157058716, 0.3143100440502167, -0.0026381108909845352, -0.6219638586044312, 0.17945727705955505, -0.13785147666931152, 0.1569257378578186, 0.08952253311872482, -0.4074338376522064, -0.1948145031929016, -0.04384492710232735, 0.0081144655123353, 0.36878857016563416, -0.0032185278832912445, 0.16060785949230194, -0.2609998881816864, -0.6503846645355225, -0.43117377161979675, 0.20303380489349365, 0.14375534653663635, 0.14328549802303314, -0.18488915264606476, 0.07253559678792953, -0.05025624483823776, 0.11811936646699905, 0.34963294863700867, 0.023665931075811386, -0.08469840884208679, 0.20048247277736664, -0.39766359329223633, -0.11198747158050537, 0.5922970771789551, -0.606919527053833, -0.12937402725219727, -0.24256916344165802, 0.19426962733268738, 0.10619351267814636, -0.48553118109703064, -0.777270495891571, 0.2643543779850006, 0.24100792407989502, -0.03682324290275574, 0.17587365210056305, 0.3088020980358124, -0.26488184928894043, 0.02757534757256508, -0.1336156576871872, 0.5399760007858276, -0.13602116703987122, -0.18783819675445557, 0.269212931394577, -0.17223785817623138 ]
https://github.com/huggingface/datasets/issues/6014
Request to Share/Update Dataset Viewer Code
the new frontend would probably be hard to open source, as is, as it's quite intertwined with the Hub's code. However, at some point it would be amazing to have a community-driven open source implementation of a frontend to datasets-server!
Overview: The repository (huggingface/datasets-viewer) was recently archived and when I tried to run the code, there was the error message "AttributeError: module 'datasets.load' has no attribute 'prepare_module'". I could not resolve the issue myself due to lack of documentation of that attribute. Request: I kindly request the sharing of the code responsible for the dataset preview functionality or help with resolving the error. The dataset viewer on the Hugging Face website is incredibly useful since it is compatible with different types of inputs. It allows users to find datasets that meet their needs more efficiently. If needed, I am willing to contribute to the project by testing, documenting, and providing feedback on the dataset viewer code. Thank you for considering this request, and I look forward to your response.
40
Request to Share/Update Dataset Viewer Code Overview: The repository (huggingface/datasets-viewer) was recently archived and when I tried to run the code, there was the error message "AttributeError: module 'datasets.load' has no attribute 'prepare_module'". I could not resolve the issue myself due to lack of documentation of that attribute. Request: I kindly request the sharing of the code responsible for the dataset preview functionality or help with resolving the error. The dataset viewer on the Hugging Face website is incredibly useful since it is compatible with different types of inputs. It allows users to find datasets that meet their needs more efficiently. If needed, I am willing to contribute to the project by testing, documenting, and providing feedback on the dataset viewer code. Thank you for considering this request, and I look forward to your response. the new frontend would probably be hard to open source, as is, as it's quite intertwined with the Hub's code. However, at some point it would be amazing to have a community-driven open source implementation of a frontend to datasets-server!
[ -0.3248501420021057, -0.059220895171165466, -0.09017603099346161, 0.27208662033081055, -0.060776062309741974, 0.03568772226572037, 0.15050993859767914, 0.34016814827919006, 0.12809468805789948, 0.19909483194351196, -0.3107962906360626, 0.23992475867271423, -0.18274010717868805, 0.4267304539680481, 0.06401201337575912, 0.08031335473060608, 0.0667172521352768, 0.1848931908607483, -0.21829292178153992, 0.008542217314243317, 0.05405135452747345, 0.1585906594991684, -0.2218930721282959, 0.05084725469350815, -0.08185037970542908, 0.2605116367340088, -0.23867259919643402, 0.14547055959701538, -0.24105204641819, -0.33624267578125, 0.08145534247159958, 0.3470425009727478, 0.06091805547475815, 0.5524011850357056, -0.00011931698099942878, -0.05553695559501648, 0.20292390882968903, 0.08673259615898132, -0.28981128334999084, -0.12601999938488007, -0.005174312740564346, -0.1675732582807541, 0.07297369837760925, -0.06072646379470825, -0.11205732077360153, -0.29272812604904175, -0.07322610169649124, -0.3101583421230316, 0.48197901248931885, -0.008195100352168083, 0.11482077836990356, 0.44448333978652954, 0.27160564064979553, -0.18654291331768036, -0.17064917087554932, 0.41162949800491333, -0.15948452055454254, 0.019070236012339592, 0.3174605369567871, 0.05799943208694458, -0.18838107585906982, 0.27740392088890076, 0.0796915739774704, -0.2747589349746704, 0.45256882905960083, -0.10586632043123245, -0.21616441011428833, -0.17956553399562836, -0.005889277905225754, 0.0022616982460021973, 0.7491016983985901, -0.40708422660827637, -0.38256245851516724, -0.298483282327652, -0.0037381257861852646, 0.13157792389392853, -0.007282964885234833, 0.07467314600944519, -0.11410926282405853, 0.3282357454299927, -0.32887959480285645, -0.6647838354110718, -0.2550712823867798, -0.17042312026023865, 0.16877487301826477, 0.2931200861930847, -0.2952379882335663, 0.058011043816804886, 0.05704571679234505, -0.12998519837856293, 0.2655324637889862, -0.13478317856788635, 0.09916232526302338, -0.012532812543213367, -0.04557507857680321, -0.298059344291687, 0.06749327480792999, 0.0807720348238945, 0.05521613359451294, 0.39665549993515015, -0.017506573349237442, 0.06355167925357819, -0.34950491786003113, -0.05129137635231018, 0.42348966002464294, -0.017860274761915207, 0.23472750186920166, 0.21374531090259552, 0.21066220104694366, 0.20988835394382477, 0.3627689778804779, 0.10668035596609116, -0.2526014745235443, -0.0030016805976629257, -0.2862641215324402, -0.19732508063316345, 0.37125635147094727, -0.0650046318769455, 0.04263715445995331, -0.1920463740825653, 0.481082558631897, -0.05973590910434723, 0.17198745906352997, 0.09825607389211655, -0.12106271088123322, 0.11667869985103607, 0.06755103915929794, -0.24245132505893707, -0.07012417167425156, -0.851772665977478, -0.05084158480167389, -0.04232081398367882, -0.23864777386188507, 0.2933114469051361, 0.03947095945477486, -0.47782278060913086, 0.06298118084669113, 0.024426758289337158, 0.5611563324928284, 0.017126217484474182, -0.13221313059329987, 0.37660661339759827, -0.2261812686920166, 0.023373432457447052, 0.05290427431464195, 0.02304784394800663, 0.13303345441818237, -0.07142767310142517, -0.10877742618322372, 0.06244378909468651, -0.2717311978340149, -0.42101263999938965, -0.3236949145793915, 0.03760090842843056, -0.20501960813999176, 0.12582460045814514, -0.3152464032173157, 0.22264616191387177, -0.4096492826938629, -0.21309806406497955, 0.0943383052945137, 0.33467984199523926, -0.005269642919301987, -0.21106980741024017, 0.4570580720901489, 0.8993596434593201, -0.30833104252815247, -0.04304211959242821, -0.14163275063037872, -0.13735078275203705, -0.3364166021347046, 0.052577100694179535, -0.0939534530043602, -0.15284430980682373, -0.13225451111793518, -0.13135653734207153, 0.30678898096084595, -0.6728352308273315, -0.3055063784122467, 0.220733180642128, -0.11652479320764542, -0.13489852845668793, 0.022131934762001038, 0.018838562071323395, -0.06934653222560883, -0.1916709542274475, -0.23682045936584473, 0.1446431279182434, -0.10332973301410675, -0.08629068732261658, -0.1092778667807579, -0.42976444959640503, -0.09220664203166962, 0.4917089343070984, -0.09271968901157379, 0.10500351339578629, 0.22801488637924194, -0.2576974034309387, 0.46128049492836, -0.12310631573200226, 0.16523101925849915, -0.18092012405395508, 0.18189379572868347, 0.44930559396743774, -0.038501664996147156, -0.27273887395858765, -0.28885558247566223, 0.05758635699748993, 0.20746178925037384, -0.11222347617149353, -0.023728057742118835, -0.2400122731924057, -0.3751136362552643, 0.16871163249015808, -0.1830541044473648, -0.12712450325489044, 0.053947970271110535, -0.07860198616981506, -0.031116537749767303, 0.02179950848221779, -0.3419213891029358, 0.41546401381492615, -0.1143224760890007, 0.06424897164106369, -0.49687594175338745, 0.31095877289772034, -0.024203060194849968, 0.13845187425613403, 0.1772317737340927, 0.1840657889842987, 0.10595186054706573, 0.049710024148225784, 0.11889678984880447, 0.45520439743995667, -0.21623742580413818, 0.461483359336853, 0.41619521379470825, 0.1438663899898529, 0.15154394507408142, -0.3405335247516632, 0.41319817304611206, -0.33866938948631287, -0.11306555569171906, 0.16255804896354675, -0.19714811444282532, 0.12107867002487183, -0.36528512835502625, -0.052954547107219696, -0.027861637994647026, 0.20928679406642914, -0.29232272505760193, 0.266300231218338, -0.26485028862953186, -0.18950194120407104, -0.021333027631044388, -0.04517393931746483, 0.11828425526618958, -0.17074695229530334, -0.11428610235452652, 0.1207461953163147, 0.1227106899023056, -0.17271874845027924, 0.09234446287155151, 0.0704723447561264, -0.12358545511960983, -0.038783781230449677, 0.21789167821407318, -0.19159086048603058, 0.15226906538009644, 0.06174681708216667, -0.15309946238994598, 0.4228252172470093, 0.46905913949012756, -0.008066050708293915, 0.11388520151376724, 0.18836307525634766, 0.3302338123321533, -0.1408694088459015, -0.15577583014965057, 0.2511332035064697, 0.05258263647556305, -0.23173381388187408, -0.10859854519367218, 0.004323828034102917, -0.23524321615695953, -0.07280173897743225, -0.015396534465253353, 0.12228905409574509, 0.0030684275552630424, -0.1455453336238861, -0.23516374826431274, -0.0449715256690979, -0.11769664287567139, 0.07461434602737427, -0.049108102917671204, -0.015171930193901062, -0.3561233878135681, 0.6014884114265442, -0.04124269634485245, 0.14647015929222107, -0.2607592046260834, 0.012750165536999702, 0.11825081706047058, -0.03244058042764664, 0.21845456957817078, -0.12571415305137634, 0.39310935139656067, -0.1794736087322235, 0.597896933555603, -0.43005990982055664, -0.1876581907272339, 0.033928997814655304, -0.07160460948944092, 0.19793936610221863, 0.31554436683654785, -0.062308356165885925, -0.017777621746063232, -0.00832456536591053, 0.12977342307567596, -0.23179690539836884, -0.16612614691257477, -0.2609563171863556, 0.21953600645065308, -0.1325092315673828, 0.04205562546849251, -0.010805532336235046, -0.30319491028785706, -0.4357883036136627, 0.34266263246536255, -0.2586553394794464, 0.1611597239971161, 0.061829257756471634, 0.13937270641326904, 0.05130928009748459, -0.08159830421209335, -0.08252563327550888, -0.04567357897758484, -0.4941396713256836, 0.20721794664859772, -0.6696649193763733, -0.18936406075954437, 0.02149501070380211, 0.4444003105163574, 0.22273771464824677, -0.10424443334341049, -0.5097495913505554, -0.10540297627449036, 0.1717538684606552, 0.13713009655475616, -0.051156409084796906, 0.15446411073207855, 0.24744616448879242, 0.36718058586120605, 0.037044405937194824, -0.08989489078521729, -0.27598944306373596, -0.38572463393211365, -0.20601066946983337, -0.21359708905220032, 0.23366722464561462, 0.05511666461825371, 0.0473058708012104, 0.7308990955352783, 0.3612575829029083, 0.23546454310417175, 0.12197617441415787, 0.13318604230880737, 0.6800159811973572, -0.04056970030069351, -0.41030022501945496, -0.1599186509847641, 0.03818634897470474, 0.22411376237869263, 0.11121582239866257, 0.12346237897872925, 0.23654122650623322, -0.3805880546569824, -0.4189607501029968, -0.3077166974544525, -0.16772668063640594, -0.2832302749156952, 0.04243896156549454, 0.43321627378463745, -0.05469460040330887, 0.016934938728809357, -0.4050302505493164, -0.02254990115761757, 0.3863171637058258, 0.3977730870246887, 0.32673487067222595, -0.04939864203333855, -0.23711606860160828, 0.19191446900367737, -0.22519445419311523, 0.1922132670879364, -0.1377720832824707, -0.11787961423397064, -0.08988599479198456, 0.08470293879508972, 0.0655880868434906, 0.025875717401504517, 0.733511209487915, -0.09632845222949982, 0.030326740816235542, -0.19167956709861755, -0.15359456837177277, -0.22826863825321198, 0.22794659435749054, 0.3103591799736023, 0.1064520999789238, -0.27862635254859924, 0.16864687204360962, -0.09509314596652985, -0.4352871775627136, 0.44708383083343506, -0.1615666151046753, -0.23143289983272552, -0.0995526909828186, 0.20026905834674835, -0.07728241384029388, -0.11283218860626221, -0.4600457549095154, -0.09612898528575897, 0.07875245809555054, 0.022950416430830956, 0.23457442224025726, -0.0752098336815834, 0.13945400714874268, 0.18775859475135803, -0.0023234831169247627, 0.12943212687969208, 0.22158527374267578, 0.17069266736507416, 0.4952572286128998, 0.006434950977563858, 0.17679886519908905, 0.40241333842277527, 0.05568373203277588, -0.37756291031837463, 0.19552505016326904, 0.08461268991231918, 0.18844276666641235, 0.47713524103164673, 0.03701700270175934, -0.20259138941764832, 0.03325232118368149, 0.13887560367584229, -0.5576021671295166, -0.10030578076839447, 0.14568914473056793, 0.06803630292415619, -0.44709286093711853, -0.5960083603858948, 0.3913402855396271, -0.14227263629436493, -0.09668273478746414, 0.2979576885700226, 0.7984709739685059, -0.029519980773329735, -0.12411636114120483, -0.10010676831007004, 0.9594631791114807, 0.1890581250190735, 0.1889869123697281, 0.2424030303955078, -0.29960960149765015, 0.40693026781082153, -0.30374598503112793, -0.06600303202867508, -0.21181891858577728, -0.1781579703092575, -0.03272831067442894, -0.024780776351690292, 0.2157214879989624, -0.14338254928588867, 0.039168830960989, -0.01894252933561802, 0.19957409799098969, -0.16226744651794434, 0.0029953205958008766, 0.464918851852417, 0.0049138739705085754, -0.14544162154197693, -0.18584638833999634, 0.09694129228591919, 0.12635059654712677, 0.11128529906272888, -0.0798301175236702, -0.390262246131897, -0.08139947056770325, 0.1401199847459793, -0.438818097114563, -0.03779956325888634, 0.18888208270072937, 0.23671290278434753, 0.11926671862602234, -0.08119609951972961, 0.8795965313911438, 0.2882857918739319, 0.32187503576278687, 0.2135368436574936, -0.34450265765190125, 0.04207439720630646, -0.3805207312107086, -0.11568863689899445, -0.13901135325431824, 0.15407969057559967, 0.18367503583431244, -0.1816316843032837, -0.3017856776714325, 0.3351428210735321, 0.0777067318558693, -0.24886180460453033, -0.42031586170196533, -0.09446023404598236, 0.2801322340965271, -0.4909292757511139, 0.1283630132675171, -0.07848381996154785, 0.2058069407939911, -0.03819126635789871, -0.002813326194882393, 0.1252424418926239, 0.02287118323147297, -0.12255410104990005, 0.36351343989372253, 0.0030840933322906494, 0.1304602324962616, 0.2157692015171051, -0.036123573780059814, -0.40079155564308167, 0.39862173795700073, 0.15260161459445953, -0.12072861194610596, -0.0461270846426487, 0.22047007083892822, 0.4078108072280884, -0.5378923416137695, -0.03990510478615761, -0.17515695095062256, 0.06346668303012848, 0.21453112363815308, 0.11599007248878479, 0.2491878718137741, -0.03663487732410431, 0.08028745651245117, -0.1103203222155571, -0.09058341383934021, 0.1881662905216217, -0.1757313758134842, 0.13180111348628998, 0.10360493510961533, -0.1362673044204712, -0.016923813149333, -0.011004405096173286, -0.25460582971572876, 0.1302330642938614, 0.042752884328365326, -0.1876000314950943, 0.2939114272594452, 0.015380635857582092, -0.005479288287460804, -0.23913522064685822, -0.09019459038972855, -0.00680144876241684, -0.36491280794143677, 0.010282061994075775, -0.06572404503822327, 0.25045841932296753, -0.1385684311389923, -0.12998215854167938, -0.0044748494401574135, -0.1481063812971115, -0.285185307264328, -0.04438295587897301, 0.12955519556999207, 0.14555862545967102, 0.1264035403728485, -0.1380651593208313, 0.09454125165939331, 0.06476733088493347, -0.19137324392795563, 0.36997348070144653, 0.6327967643737793, 0.5084878206253052, 0.07604040950536728, 0.21342797577381134, -0.12910500168800354, -0.11056569963693619, 0.13183818757534027, 0.46773281693458557, 0.3771442770957947, -0.031426042318344116, 0.4985557198524475, -0.03247801214456558, 0.14627623558044434, 0.2505587637424469, 0.3835870921611786, 0.17558525502681732, -0.22012096643447876, 0.07500243932008743, 0.12503859400749207, 0.05499237775802612, -0.2304806262254715, -0.0055489856749773026, 0.15743586421012878, 0.05330644175410271, -0.013725049793720245, 0.15177719295024872, 0.001946963369846344, 0.27095258235931396, 0.0828476995229721, 0.24322661757469177, 0.40592536330223083, 0.1969088762998581, 0.4273524284362793, 0.1922389268875122, -0.17506447434425354, 0.08661658316850662, 0.25858938694000244, 0.4973180592060089, 0.026694267988204956, 0.4467768669128418, -0.3712995946407318, 0.2514553964138031, -0.1063229963183403, -0.008742358535528183, 0.37478363513946533, -0.2608639597892761, 0.18293225765228271, 0.0013317465782165527, 0.2504463195800781, 0.14987477660179138, -0.21572601795196533, 0.19653534889221191, -0.05967649444937706, -0.07390482723712921, -0.041905954480171204, 0.2601345479488373, 0.14786219596862793, 0.02118469402194023, 0.22425076365470886, -0.28546473383903503, -0.2630850076675415, 0.04229440912604332, 0.029740851372480392, -0.42029815912246704, 0.05896782502532005, -0.14592605829238892, -0.1005084365606308, -0.14569289982318878, -0.04908325523138046, 0.2383473515510559, 0.3638913929462433, -0.12697049975395203, -0.3018823266029358, 0.15172439813613892, 0.049374040216207504, 0.16814392805099487, 0.4029419720172882, 0.24357226490974426, 0.06820204854011536, 0.11757150292396545, 0.21825875341892242, -0.0030164383351802826, -0.03156007453799248, 0.15121187269687653, -0.06525282561779022, 0.05255874618887901, 0.10308429598808289, 0.09315967559814453, 0.03523416817188263, -0.011967450380325317, -0.1842048317193985, 0.04896172881126404, 0.023798836395144463, -0.7351258397102356, 0.13723206520080566, -0.24940988421440125, -0.18985730409622192, -0.06124556064605713, 0.05341228470206261, -0.3630134165287018, 0.03402114659547806, 0.3177080750465393, 0.006662040017545223, -0.2115018367767334, -0.229044109582901, 0.02952880784869194, 0.253980427980423, 0.27933353185653687, 0.46027037501335144, 0.11555767059326172, -0.0046785930171608925, -0.5266991257667542, -0.5350388288497925, 0.014051772654056549, 0.4964570701122284, 0.0002542175352573395, 0.03446989506483078, -0.05282527208328247, 0.25971904397010803, 0.11994361877441406, 0.13362066447734833, -0.050456490367650986, 0.018210384994745255, 0.14894922077655792, 0.04175163432955742, 0.03325476124882698, -0.06926698982715607, 0.1416250467300415, 0.13299648463726044, 0.005971744656562805, 0.1652027666568756, 0.12358251214027405, -0.1403472125530243, -0.15891364216804504, 0.3353513479232788, 0.04654158279299736, -0.3949326276779175, 0.31178760528564453, -0.12013417482376099, 0.0958390161395073, 0.03670485317707062, -0.4458382725715637, -0.4752974510192871, -0.16060757637023926, -0.034968167543411255, 0.32773926854133606, 0.15022028982639313, 0.01956072449684143, -0.32156848907470703, -0.5439911484718323, -0.3149629533290863, 0.15481846034526825, 0.09965330362319946, 0.15019391477108002, -0.16429363191127777, -0.025964824482798576, -0.08785408735275269, 0.004613437689840794, 0.38200438022613525, 0.014730196446180344, -0.1602853238582611, 0.1692422330379486, -0.3256010413169861, -0.10542013496160507, 0.48047399520874023, -0.4771309494972229, -0.11753979325294495, -0.2564273774623871, 0.20895825326442719, 0.1689085066318512, -0.4668321907520294, -0.7197741866111755, 0.14014825224876404, 0.21136559545993805, 0.03490085154771805, 0.18576212227344513, 0.29874321818351746, -0.23198288679122925, -0.0223526768386364, -0.14227047562599182, 0.6437430381774902, -0.09150121361017227, -0.28210991621017456, 0.3815125524997711, -0.15457966923713684 ]
https://github.com/huggingface/datasets/issues/6014
Request to Share/Update Dataset Viewer Code
For the frontend viewer, see https://github.com/huggingface/datasets/issues/6139. Also mentioned in https://github.com/huggingface/datasets-server/issues/213 and https://github.com/huggingface/datasets-server/issues/441 Closing as a duplicate of https://github.com/huggingface/datasets/issues/6139
Overview: The repository (huggingface/datasets-viewer) was recently archived and when I tried to run the code, there was the error message "AttributeError: module 'datasets.load' has no attribute 'prepare_module'". I could not resolve the issue myself due to lack of documentation of that attribute. Request: I kindly request the sharing of the code responsible for the dataset preview functionality or help with resolving the error. The dataset viewer on the Hugging Face website is incredibly useful since it is compatible with different types of inputs. It allows users to find datasets that meet their needs more efficiently. If needed, I am willing to contribute to the project by testing, documenting, and providing feedback on the dataset viewer code. Thank you for considering this request, and I look forward to your response.
18
Request to Share/Update Dataset Viewer Code Overview: The repository (huggingface/datasets-viewer) was recently archived and when I tried to run the code, there was the error message "AttributeError: module 'datasets.load' has no attribute 'prepare_module'". I could not resolve the issue myself due to lack of documentation of that attribute. Request: I kindly request the sharing of the code responsible for the dataset preview functionality or help with resolving the error. The dataset viewer on the Hugging Face website is incredibly useful since it is compatible with different types of inputs. It allows users to find datasets that meet their needs more efficiently. If needed, I am willing to contribute to the project by testing, documenting, and providing feedback on the dataset viewer code. Thank you for considering this request, and I look forward to your response. For the frontend viewer, see https://github.com/huggingface/datasets/issues/6139. Also mentioned in https://github.com/huggingface/datasets-server/issues/213 and https://github.com/huggingface/datasets-server/issues/441 Closing as a duplicate of https://github.com/huggingface/datasets/issues/6139
[ -0.23733484745025635, -0.07210078835487366, -0.05713219195604324, 0.35936957597732544, 0.11453083157539368, 0.1331862509250641, 0.10088923573493958, 0.34784752130508423, -0.07706053555011749, 0.18915942311286926, -0.1832512617111206, 0.21624311804771423, -0.1487387865781784, 0.3128073811531067, 0.09004952758550644, -0.09984460473060608, -0.08274457603693008, 0.14623409509658813, -0.13721799850463867, 0.0328696072101593, 0.14720338582992554, 0.21018484234809875, -0.2393846958875656, -0.030873872339725494, -0.10189082473516464, 0.1937112957239151, -0.1304122358560562, 0.17860206961631775, -0.12277508527040482, -0.4877699613571167, 0.1771177053451538, 0.28333333134651184, 0.12767350673675537, 0.4430321455001831, -0.00012048592179780826, -0.03549652919173241, 0.3357870578765869, -0.06150055676698685, -0.442272812128067, -0.10581375658512115, 0.03775612264871597, -0.15859630703926086, 0.17598921060562134, -0.05084065720438957, -0.2994026839733124, -0.2666763663291931, -0.05788278579711914, -0.3876746594905853, 0.5753040313720703, 0.05616990849375725, 0.16475720703601837, 0.4655117988586426, 0.3922054171562195, -0.2331371009349823, -0.14270010590553284, 0.39024704694747925, -0.02892599068582058, 0.3103819489479065, 0.29147467017173767, 0.1404685229063034, -0.10484353452920914, 0.35809212923049927, 0.10989038646221161, -0.2113308310508728, 0.4214557111263275, -0.1382697969675064, -0.0816541388630867, -0.28652453422546387, 0.06674768775701523, -0.0647617056965828, 0.763106107711792, -0.3929297626018524, -0.34434714913368225, -0.32530027627944946, 0.06928312033414841, 0.12597116827964783, 0.09808126091957092, 0.06513646990060806, -0.15013331174850464, 0.25611910223960876, -0.4175199866294861, -0.5067597031593323, -0.19212612509727478, -0.23956097662448883, 0.07485565543174744, -0.0475543737411499, -0.3754251301288605, 0.004795331507921219, 0.12793752551078796, -0.2736564874649048, 0.007370143663138151, -0.08163212239742279, 0.0652773529291153, 0.07756615430116653, -0.050464171916246414, -0.21851831674575806, -0.0007366538047790527, 0.10216595977544785, -0.072777658700943, 0.349870502948761, 0.059616100043058395, 0.07431910932064056, -0.04108485206961632, 0.005565963685512543, 0.4258497655391693, 0.10922610759735107, 0.35302022099494934, 0.0972626730799675, 0.07504425197839737, 0.2284179925918579, 0.28324174880981445, -0.033244289457798004, -0.2869166433811188, -0.02874096855521202, -0.23721468448638916, -0.15394598245620728, 0.20673756301403046, -0.14664223790168762, -0.10549058765172958, -0.1403285562992096, 0.24125251173973083, -0.16140174865722656, 0.1377210021018982, 0.3344442844390869, -0.14467760920524597, -0.008056260645389557, 0.05643253028392792, -0.23829402029514313, -0.08653330057859421, -0.7695367336273193, -0.11154790222644806, 0.056981295347213745, -0.29354000091552734, 0.1414056271314621, 0.0964282751083374, -0.592422366142273, 0.05174224078655243, -0.03688948601484299, 0.5807815790176392, -0.031176069751381874, -0.1870507001876831, 0.30751746892929077, -0.09371670335531235, 0.1542142927646637, 0.1158195436000824, 0.07091083377599716, 0.17609012126922607, -0.16854575276374817, -0.08949761837720871, 0.03207556530833244, -0.3550151586532593, -0.3359644114971161, -0.0940249040722847, 0.0667211189866066, -0.2813671827316284, 0.14015477895736694, -0.2951827645301819, 0.14940252900123596, -0.23485159873962402, -0.18416820466518402, 0.10098714381456375, 0.186824768781662, -0.002283480018377304, -0.22340606153011322, 0.5149651169776917, 0.8353955149650574, -0.2813431918621063, -0.1952769011259079, -0.07881035655736923, -0.27117881178855896, -0.2189578115940094, 0.07018998265266418, -0.08850100636482239, -0.11045714467763901, -0.20202618837356567, -0.12036354839801788, 0.4547237753868103, -0.553049623966217, -0.29687821865081787, 0.20700033009052277, -0.10458549857139587, -0.021494973450899124, 0.05093228816986084, -0.12174291908740997, -0.1090141236782074, -0.23747164011001587, -0.19396546483039856, 0.10379193723201752, -0.06710858643054962, -0.08388261497020721, -0.11506408452987671, -0.3890538513660431, 0.031955476850271225, 0.45674023032188416, -0.15977215766906738, 0.06700735539197922, 0.28271567821502686, -0.2091303914785385, 0.4345568120479584, -0.010060016065835953, 0.0944809690117836, 0.013658713549375534, 0.1308516263961792, 0.4942837357521057, -0.03961455076932907, -0.10611014068126678, -0.18652990460395813, 0.11681803315877914, 0.09089165925979614, -0.2823966145515442, -0.15552319586277008, -0.19905860722064972, -0.4114416241645813, 0.014970654621720314, -0.2068423479795456, -0.3650180399417877, 0.07887616008520126, -0.04130442440509796, 0.1366698294878006, 0.19431373476982117, -0.23793095350265503, 0.3954603672027588, -0.12735264003276825, 0.013382195495069027, -0.588300883769989, 0.3303380012512207, -0.08182424306869507, -0.0024672606959939003, 0.2564694285392761, 0.2248045802116394, 0.10342006385326385, -0.03403112292289734, 0.05820974335074425, 0.42756250500679016, -0.20380429923534393, 0.4153396487236023, 0.13807204365730286, 0.11845649778842926, 0.1345730870962143, -0.4108327627182007, 0.34535184502601624, -0.2644631266593933, -0.08879700303077698, 0.14573818445205688, -0.21931755542755127, 0.13247360289096832, -0.28018712997436523, -0.043701909482479095, 0.18183113634586334, 0.16499504446983337, -0.24759092926979065, 0.30138981342315674, -0.22242006659507751, -0.21815305948257446, 0.07593832910060883, -0.09554928541183472, 0.3143266439437866, -0.17207032442092896, -0.19894488155841827, 0.05563816800713539, 0.19460679590702057, -0.1368291974067688, 0.01819676160812378, 0.09348231554031372, -0.1890771985054016, 0.032116182148456573, 0.11838781833648682, -0.1267940104007721, 0.1426662802696228, 0.09393268078565598, -0.0823129266500473, 0.3524821102619171, 0.4792059659957886, -0.08132633566856384, 0.1188361644744873, 0.061109717935323715, 0.2211344838142395, -0.11938304454088211, -0.14319859445095062, 0.21828779578208923, -0.04372216761112213, -0.08787950128316879, -0.14712245762348175, 0.09246814250946045, -0.34615620970726013, 0.028196247294545174, -0.07366421073675156, -0.1678917407989502, -0.1823549121618271, 0.004721427336335182, -0.2621472179889679, -0.025597209110856056, -0.21766191720962524, 0.06164442002773285, 0.02119886502623558, 0.013833345845341682, -0.32325080037117004, 0.4484579861164093, -0.0383220836520195, 0.11495386809110641, -0.1828753501176834, 0.06986088305711746, 0.02124541439116001, 0.008784990757703781, 0.20702067017555237, -0.06673742830753326, 0.3779319226741791, -0.2893862724304199, 0.4477895498275757, -0.246089905500412, -0.3007837235927582, 0.0524664930999279, -0.06834028661251068, 0.15121030807495117, 0.31775641441345215, 0.05125804618000984, -0.020877564325928688, -0.07757418602705002, 0.256293922662735, -0.2463614046573639, -0.24556055665016174, -0.21462710201740265, 0.28832897543907166, -0.09505646675825119, -0.0633673146367073, -0.09857139736413956, -0.2784084975719452, -0.3956551253795624, 0.42896634340286255, -0.24581894278526306, 0.12615397572517395, 0.19308407604694366, 0.12867742776870728, 0.16612543165683746, -0.31891754269599915, 0.07912721484899521, -0.08038986474275589, -0.5488015413284302, 0.1958695948123932, -0.5720621943473816, -0.2533949315547943, 0.03723009303212166, 0.40480488538742065, 0.19337840378284454, -0.07099311798810959, -0.3704981803894043, -0.091749407351017, 0.01808742992579937, 0.008489254862070084, -0.07907207310199738, 0.1189187616109848, 0.19135043025016785, 0.2473214566707611, 0.04982432723045349, -0.03515703231096268, -0.2767437994480133, -0.2938573956489563, -0.17511874437332153, -0.09493423253297806, 0.2013055980205536, 0.16055598855018616, 0.012149069458246231, 0.6459492444992065, 0.523897111415863, 0.11939734220504761, 0.08560585975646973, 0.03927863761782646, 0.6709176301956177, 0.05787866935133934, -0.44065940380096436, -0.03750286623835564, 0.11513611674308777, 0.2525869607925415, 0.09259065985679626, -0.016195595264434814, 0.23543815314769745, -0.32225143909454346, -0.45260658860206604, -0.27241429686546326, -0.23758967220783234, -0.15243875980377197, 0.01695994660258293, 0.5282988548278809, -0.17082932591438293, 0.08644939213991165, -0.14423958957195282, -0.024548429995775223, 0.3030383586883545, 0.4990153908729553, 0.2803850471973419, 0.049209050834178925, -0.23278768360614777, 0.09853968769311905, -0.2617046535015106, 0.17476730048656464, -0.026434456929564476, 0.08513534069061279, -0.2117985039949417, -0.028447063639760017, 0.10812534391880035, 0.061025191098451614, 0.6832217574119568, -0.04715222865343094, 0.15922360122203827, -0.055191848427057266, -0.2896232604980469, -0.20460788905620575, 0.19476187229156494, 0.19257605075836182, 0.1462816596031189, -0.2600236237049103, 0.04404093697667122, -0.06865604221820831, -0.42861178517341614, 0.4219883382320404, -0.10007914900779724, -0.24264708161354065, -0.12232881039381027, 0.12699007987976074, -0.06617964059114456, -0.20294634997844696, -0.3456040024757385, -0.07665375620126724, 0.09454429149627686, -0.10455918312072754, 0.2781757414340973, -0.1228678971529007, 0.05048487335443497, 0.220800518989563, 0.02215759828686714, 0.2894956171512604, 0.21658606827259064, 0.21325097978115082, 0.7365458011627197, -0.06269102543592453, 0.41837188601493835, 0.48801225423812866, 0.01161317341029644, -0.3460353910923004, 0.15041813254356384, 0.07481177896261215, 0.30898353457450867, 0.38965240120887756, -0.13310453295707703, -0.1551033854484558, 0.0657673329114914, 0.076295405626297, -0.5920417904853821, -0.16706699132919312, 0.19866475462913513, -0.02859204262495041, -0.3155302405357361, -0.6708974242210388, 0.3223951756954193, -0.0667567104101181, 0.021453045308589935, 0.03569643944501877, 0.5321536660194397, -0.09340716898441315, -0.3765498995780945, -0.05887273699045181, 0.926498532295227, 0.19388341903686523, 0.2183685153722763, 0.15793752670288086, -0.12590789794921875, 0.281705766916275, -0.16267576813697815, 0.006823384203016758, -0.2610369622707367, -0.22392627596855164, 0.01813523657619953, -0.09844353049993515, 0.3420199155807495, -0.1997361034154892, -0.10866683721542358, 0.06223395839333534, -0.01840362697839737, -0.06610962748527527, -0.056955114006996155, 0.31233540177345276, -0.042266152799129486, 0.00046206265687942505, -0.3483049273490906, 0.08891217410564423, 0.1542421579360962, 0.19629375636577606, -0.008811557665467262, -0.3731842041015625, 0.042257215827703476, -0.026408156380057335, -0.3533927798271179, -0.024188367649912834, -0.0020127517636865377, 0.2693440318107605, 0.13828065991401672, -0.2341112345457077, 0.9839866757392883, 0.3650939166545868, 0.14740419387817383, 0.22690582275390625, -0.3121474087238312, 0.0563032329082489, -0.336622029542923, -0.14476004242897034, -0.22102931141853333, 0.2904748320579529, 0.18070223927497864, -0.15442466735839844, -0.14716143906116486, 0.3721455931663513, 0.002514670602977276, -0.04973521828651428, -0.36771726608276367, 0.05317900329828262, 0.056839779019355774, -0.3759042024612427, 0.1426013708114624, -0.1900147795677185, 0.15152612328529358, -0.0009298510849475861, 0.02447742223739624, 0.173686221241951, 0.016947181895375252, -0.13780081272125244, 0.3810284733772278, -0.0636453926563263, 0.1495591104030609, 0.5190576314926147, -0.09317230433225632, -0.4481958746910095, 0.5887036323547363, 0.11886383593082428, -0.1316014528274536, -0.07485035806894302, 0.10479546338319778, 0.35907796025276184, -0.569817304611206, 0.018478553742170334, -0.14143311977386475, 0.33951258659362793, 0.13397052884101868, 0.15011416375637054, 0.12580008804798126, -0.1723715364933014, 0.08537463843822479, -0.20938903093338013, -0.1850709170103073, 0.14169052243232727, -0.14397990703582764, 0.09644858539104462, -0.052519723773002625, -0.010518861934542656, 0.10234168916940689, 0.020013853907585144, -0.2798977494239807, 0.1740296334028244, -0.05404501408338547, -0.10538902878761292, 0.45013388991355896, 0.05628037452697754, 0.11659132689237595, -0.2510083019733429, -0.06011923402547836, 0.06913856416940689, -0.3929058611392975, -0.026476657018065453, -0.037335313856601715, 0.22247855365276337, -0.20537811517715454, -0.10199728608131409, 0.062105026096105576, -0.09275615215301514, -0.23279893398284912, -0.011227043345570564, 0.0705297589302063, 0.06250010430812836, 0.15267568826675415, -0.016630083322525024, 0.01866064965724945, 0.08272922039031982, -0.12625396251678467, 0.24623963236808777, 0.41837725043296814, 0.45366233587265015, 0.13870972394943237, 0.02834480255842209, -0.24169667065143585, -0.056908249855041504, 0.2635495960712433, 0.4401390552520752, 0.3528802990913391, -0.17039355635643005, 0.3141246438026428, -0.07182539999485016, 0.10709315538406372, 0.11551389843225479, 0.2948661744594574, 0.25934258103370667, -0.33928704261779785, 0.07656829804182053, 0.17920255661010742, 0.07600197941064835, -0.14994598925113678, 0.046304360032081604, 0.12210297584533691, 0.12580707669258118, -0.07957443594932556, 0.1371772438287735, 0.06491534411907196, 0.2926906645298004, 0.14358508586883545, 0.2462257742881775, 0.49873149394989014, 0.15955670177936554, 0.44213971495628357, 0.2312927395105362, -0.1085645779967308, -0.020733822137117386, 0.21843181550502777, 0.5586645603179932, 0.11109483242034912, 0.30505985021591187, -0.4017663896083832, 0.20395858585834503, -0.1944078505039215, -0.005563613027334213, 0.22576549649238586, -0.38324639201164246, 0.12146733701229095, 0.14702251553535461, 0.17369785904884338, 0.18472251296043396, -0.2655436396598816, 0.39864999055862427, 0.07169743627309799, -0.010552914813160896, 0.013031190261244774, 0.21459032595157623, 0.08872287720441818, 0.00936397910118103, 0.36764782667160034, -0.3316541910171509, -0.42919498682022095, 0.011126656085252762, 0.05624811351299286, -0.3967224955558777, 0.22682487964630127, -0.13166214525699615, -0.1027827113866806, -0.4058621823787689, -0.0554874911904335, 0.3039354979991913, 0.37517961859703064, -0.17525209486484528, -0.1497039496898651, 0.29915928840637207, 0.035531871020793915, 0.28385257720947266, 0.39782488346099854, 0.4682181179523468, 0.04010767117142677, 0.24385477602481842, 0.1404530555009842, -0.01833532750606537, -0.07761890441179276, 0.09206661581993103, 0.06556592881679535, 0.020331434905529022, -0.06162393465638161, 0.11372727155685425, 0.07519576698541641, -0.04723203182220459, -0.21671755611896515, 0.027575582265853882, 0.16577459871768951, -0.744384765625, 0.20539319515228271, -0.33652177453041077, -0.07554164528846741, -0.13339763879776, -0.014371134340763092, -0.5008094310760498, 0.05124321207404137, 0.3263744115829468, 0.1731160432100296, -0.21707960963249207, -0.1789756566286087, 0.027812708169221878, 0.3047168254852295, 0.49918898940086365, 0.4423147141933441, 0.17265193164348602, -0.08934888988733292, -0.5622697472572327, -0.615449845790863, -0.1306217908859253, 0.4336729645729065, 0.11794735491275787, 0.09665487706661224, -0.041529037058353424, 0.1817515343427658, 0.10894350707530975, 0.18213072419166565, -0.040460310876369476, 0.11842247098684311, -0.05746975541114807, 0.011798836290836334, -0.07618354260921478, -0.04941125214099884, 0.05674412101507187, 0.11310239136219025, 0.08133877068758011, 0.10954055190086365, -0.06128208711743355, -0.07801894843578339, -0.2510579228401184, 0.3276279866695404, -0.09158205986022949, -0.40949755907058716, 0.27065199613571167, -0.11181055009365082, 0.25402501225471497, 0.09123929589986801, -0.4670630693435669, -0.28986603021621704, -0.06922601163387299, 0.06459739804267883, 0.365276038646698, 0.1892540603876114, 0.16934794187545776, -0.32235974073410034, -0.6269418597221375, -0.4405505359172821, 0.2145749181509018, 0.12113647162914276, 0.10386684536933899, -0.20634490251541138, 0.019925689324736595, -0.006131663918495178, 0.127391055226326, 0.3456558883190155, 0.06545599550008774, -0.118583083152771, 0.1994265466928482, -0.45424073934555054, -0.15974122285842896, 0.5754096508026123, -0.5373481512069702, -0.11694328486919403, -0.24486835300922394, 0.20680022239685059, 0.10218731313943863, -0.3884165287017822, -0.7726700901985168, 0.2468855381011963, 0.28093528747558594, -0.05470024794340134, 0.092084601521492, 0.3445710837841034, -0.25359252095222473, 0.04090442135930061, -0.09260536730289459, 0.6460894346237183, -0.018849004060029984, -0.1821117103099823, 0.27579864859580994, -0.18554283678531647 ]
https://github.com/huggingface/datasets/issues/6013
[FR] `map` should reuse unchanged columns from the previous dataset to avoid disk usage
You can use the `remove_columns` parameter in `map` to avoid duplicating the columns (and save disk space) and then concatenate the original dataset with the map result: ```python from datasets import concatenate_datasets # dummy example ds_new = ds.map(lambda x: {"new_col": x["col"] + 2}, remove_columns=ds.column_names) ds_combined = concatenate_datasets([ds, ds_new], axis=1) ``` Doing this automatically is hard to implement efficiently unless we know ahead of time which existing columns will be modified by a `map` transform. We have this info when `input_columns` are specified, so I think this is the only case we can optimize.
### Feature request Currently adding a new column with `map` will cause all the data in the dataset to be duplicated and stored/cached on the disk again. It should reuse unchanged columns. ### Motivation This allows having datasets with different columns but sharing some basic columns. Currently, these datasets would become too expensive to store and one would need some kind of on-the-fly join; which also doesn't seem implemented. ### Your contribution _
93
[FR] `map` should reuse unchanged columns from the previous dataset to avoid disk usage ### Feature request Currently adding a new column with `map` will cause all the data in the dataset to be duplicated and stored/cached on the disk again. It should reuse unchanged columns. ### Motivation This allows having datasets with different columns but sharing some basic columns. Currently, these datasets would become too expensive to store and one would need some kind of on-the-fly join; which also doesn't seem implemented. ### Your contribution _ You can use the `remove_columns` parameter in `map` to avoid duplicating the columns (and save disk space) and then concatenate the original dataset with the map result: ```python from datasets import concatenate_datasets # dummy example ds_new = ds.map(lambda x: {"new_col": x["col"] + 2}, remove_columns=ds.column_names) ds_combined = concatenate_datasets([ds, ds_new], axis=1) ``` Doing this automatically is hard to implement efficiently unless we know ahead of time which existing columns will be modified by a `map` transform. We have this info when `input_columns` are specified, so I think this is the only case we can optimize.
[ -0.2323707789182663, -0.22844350337982178, -0.17978732287883759, 0.04431470111012459, 0.08519688248634338, 0.3523919880390167, 0.1729741245508194, 0.528941810131073, 0.36176013946533203, 0.08009155839681625, -0.21657496690750122, 0.5258408188819885, 0.004911593161523342, 0.15665891766548157, -0.10771779716014862, -0.1182556003332138, 0.07873338460922241, 0.3219473958015442, -0.4633847177028656, 0.023537129163742065, -0.46535417437553406, -0.010389244183897972, -0.1556728631258011, -0.37368422746658325, 0.02742534875869751, 0.07813464105129242, -0.38131028413772583, -0.03737230598926544, -0.05932094156742096, -0.022862989455461502, 0.09048423171043396, 0.14604972302913666, 0.11426183581352234, 0.2188437581062317, -0.00009570617112331092, -0.08501874655485153, -0.22586868703365326, -0.03662771359086037, -0.1026938408613205, -0.04844886064529419, -0.1352221965789795, -0.443356990814209, -0.21317583322525024, -0.4868110418319702, -0.021064283326268196, -0.196465402841568, -0.2244725078344345, -0.35272178053855896, 0.36074942350387573, -0.20456530153751373, 0.33848682045936584, -0.003756863996386528, -0.10886389017105103, -0.10581625998020172, -0.010811090469360352, -0.03516561537981033, -0.05280161648988724, -0.07981894910335541, 0.10970954596996307, -0.10392408818006516, 0.11922115832567215, 0.499969482421875, -0.25102025270462036, -0.0002858508378267288, 0.14159545302391052, 0.14894773066043854, 0.36777520179748535, -0.12159022688865662, 0.19960162043571472, 0.22078153491020203, 0.29206642508506775, -0.3477421998977661, -0.13793721795082092, -0.15808886289596558, 0.07305467128753662, -0.1887052208185196, -0.0718662217259407, -0.07959780842065811, 0.2508164644241333, 0.02144201099872589, -0.20998378098011017, -0.1333148330450058, 0.03818821907043457, 0.056041963398456573, -0.12959811091423035, 0.0982743352651596, 0.07981380075216293, 0.06495271623134613, 0.20036271214485168, -0.08184976875782013, -0.06093151494860649, -0.31875282526016235, 0.07109281420707703, 0.2512000501155853, -0.3473859131336212, -0.38942041993141174, -0.005507521331310272, -0.23440086841583252, 0.1369245946407318, -0.07409234344959259, 0.11395164579153061, -0.07140010595321655, 0.07503020018339157, 0.16726139187812805, 0.17199769616127014, 0.12550190091133118, -0.22704246640205383, 0.061012715101242065, 0.016269125044345856, -0.07957381010055542, -0.06104545295238495, -0.06259796023368835, 0.06039554625749588, -0.022016678005456924, 0.21013353765010834, -0.2329557240009308, 0.2151820808649063, 0.20980742573738098, -0.08109001815319061, -0.084741972386837, 0.09980500489473343, -0.04412178695201874, -0.11349932104349136, 0.09283645451068878, 0.06604178994894028, 0.25194841623306274, -0.012301091104745865, 0.022053072229027748, 0.13268810510635376, 0.07493477314710617, -0.22915653884410858, 0.04559771716594696, -0.09129922091960907, 0.0008540311828255653, -0.048214033246040344, 0.05393325537443161, -0.019181717187166214, 0.1454242318868637, -0.13489018380641937, 0.15293994545936584, 0.0789613351225853, -0.06560656428337097, 0.3815114498138428, 0.17486289143562317, 0.1322849690914154, -0.08163957297801971, 0.028059089556336403, 0.003565095365047455, -0.41432324051856995, 0.2536643147468567, -0.19654405117034912, -0.2398679256439209, -0.22286872565746307, 0.3366355299949646, 0.1744401901960373, 0.047383181750774384, -0.1915898621082306, 0.27673956751823425, 0.058544643223285675, -0.22715920209884644, -0.014093182981014252, 0.022102875635027885, -0.18640552461147308, -0.39952605962753296, 0.07202766835689545, 0.10746732354164124, -0.25613319873809814, 0.021113023161888123, -0.0007561235688626766, 0.09069153666496277, -0.021598830819129944, 0.3085927963256836, -0.19881221652030945, -0.051776714622974396, -0.07858476787805557, -0.017408467829227448, 0.39079588651657104, -0.005264300853013992, -0.24708884954452515, 0.09917382150888443, -0.07204953581094742, 0.08747093379497528, 0.06981077790260315, 0.24364465475082397, 0.26944708824157715, -0.05197497829794884, 0.10521838068962097, 0.16990886628627777, -0.14126300811767578, 0.0726543739438057, -0.19851668179035187, -0.29764074087142944, 0.28419798612594604, -0.10094437003135681, -0.13551010191440582, 0.16494083404541016, 0.04444894939661026, -0.08715835958719254, 0.2028588354587555, -0.1656210571527481, 0.11231239885091782, 0.12361468374729156, 0.18428142368793488, -0.22587703168392181, -0.07636343687772751, -0.049971915781497955, -0.577725350856781, 0.06719467043876648, 0.33565425872802734, -0.21822819113731384, 0.18991900980472565, -0.3243984580039978, -0.0908345878124237, -0.11852436512708664, 0.06794393062591553, 0.21343383193016052, 0.3155817985534668, 0.012177892029285431, 0.18095961213111877, -0.3957649767398834, -0.16451184451580048, 0.14232416450977325, -0.12175731360912323, -0.11160701513290405, -0.272487998008728, 0.2251804918050766, -0.03531022369861603, 0.1940802037715912, -0.04896606132388115, 0.19085097312927246, 0.16419312357902527, -0.019277483224868774, 0.25806787610054016, 0.12813350558280945, -0.25519439578056335, 0.3394797444343567, 0.020387616008520126, 0.2677493989467621, 0.12344763427972794, 0.2656973898410797, 0.2146165519952774, -0.19979114830493927, 0.15141375362873077, -0.05243120715022087, -0.20271790027618408, 0.1412746161222458, 0.05212846398353577, 0.10412413626909256, 0.11736135184764862, 0.057346343994140625, 0.058432914316654205, -0.15635168552398682, 0.02788894809782505, -0.3783693015575409, -0.20429061353206635, 0.2159859538078308, -0.0556434728205204, 0.3030692934989929, -0.18597619235515594, 0.24594363570213318, 0.5025928616523743, -0.063582643866539, 0.016546625643968582, 0.0821007788181305, -0.2077484130859375, -0.061738625168800354, -0.03780069202184677, 0.42771175503730774, 0.42182594537734985, 0.39450931549072266, 0.16585859656333923, 0.09665797650814056, -0.074442557990551, 0.053552791476249695, 0.23246538639068604, 0.05576327070593834, 0.21927912533283234, 0.1878843605518341, 0.16769829392433167, 0.17016448080539703, -0.1099759042263031, 0.020016532391309738, 0.09201893210411072, 0.14918965101242065, 0.07598058879375458, -0.293887197971344, -0.10128676891326904, 0.03759434074163437, -0.03736848384141922, -0.035463374108076096, 0.1295866221189499, -0.31950414180755615, -0.03802605718374252, 0.162260040640831, -0.270796537399292, 0.2217848151922226, 0.08930215239524841, 0.23093877732753754, 0.03855478763580322, -0.27862754464149475, -0.06921165436506271, -0.13946861028671265, 0.21637433767318726, 0.3002033531665802, 0.012032111175358295, -0.1895797699689865, 0.2698127329349518, -0.0038386108353734016, 0.12819059193134308, -0.29984402656555176, -0.314332515001297, 0.005826450884342194, -0.2582859396934509, -0.23888614773750305, 0.048144154250621796, 0.24920745193958282, -0.16916434466838837, -0.16436725854873657, 0.05597350373864174, -0.1513611078262329, -0.14549192786216736, -0.005004609934985638, 0.10927140712738037, -0.14209870994091034, -0.11169266700744629, -0.3839312791824341, -0.17529627680778503, -0.3312267065048218, 0.1581467092037201, 0.000998716801404953, 0.14155694842338562, -0.31740087270736694, 0.1878882348537445, -0.09506760537624359, 0.060566987842321396, 0.03193603828549385, -0.4269810616970062, -0.26069653034210205, 0.40768811106681824, -0.0730786919593811, -0.10474179685115814, -0.0020963475108146667, -0.2678816616535187, 0.1774805635213852, 0.13290226459503174, -0.23575659096240997, -0.3540155589580536, -0.1515447348356247, 0.2356572449207306, -0.12509754300117493, 0.2840198278427124, 0.443947434425354, 0.31629323959350586, -0.21540364623069763, 0.08054132014513016, -0.027727942913770676, -0.08779571205377579, 0.4631977379322052, -0.03839202970266342, -0.06106702238321304, 0.22006282210350037, 0.05361047759652138, 0.15618391335010529, 0.29812783002853394, 0.05950035899877548, 0.14424145221710205, 0.023276105523109436, 0.3999961316585541, -0.1556270718574524, -0.18510247766971588, -0.2476702779531479, -0.21157953143119812, 0.1439792960882187, 0.09970512986183167, 0.04311230778694153, -0.22308577597141266, -0.0044456347823143005, 0.028087090700864792, -0.14590764045715332, -0.1163652241230011, 0.20937517285346985, -0.013896632939577103, 0.21185892820358276, 0.07331706583499908, -0.134371817111969, -0.3284589350223541, 0.022928275167942047, 0.06584808230400085, -0.06849126517772675, 0.16225281357765198, -0.2591620087623596, -0.2865644693374634, -0.02926594950258732, -0.5898313522338867, 0.2726665735244751, 0.06894644349813461, -0.15933853387832642, 0.24085427820682526, -0.38772517442703247, -0.3484336733818054, 0.013963520526885986, 0.42443591356277466, -0.24449972808361053, -0.465850830078125, 0.16498644649982452, -0.05133097246289253, -0.3073248863220215, 0.14908452332019806, -0.04548363760113716, -0.1515979915857315, 0.13446232676506042, 0.7064840793609619, -0.09810250252485275, -0.12001541256904602, 0.38478919863700867, 0.4414549171924591, -0.041232869029045105, 0.028601832687854767, -0.08636648952960968, -0.1333237886428833, -0.37067756056785583, -0.19097578525543213, -0.004552492871880531, 0.08357556164264679, 0.11358226090669632, -0.03529595583677292, -0.02551290951669216, -0.11819344758987427, 0.27394646406173706, 0.1921805441379547, 0.3425412178039551, 0.21297687292099, 0.2719446122646332, 0.13541065156459808, 0.052237655967473984, -0.06773412227630615, 0.39990338683128357, -0.32694709300994873, -0.004594787955284119, -0.056967929005622864, -0.07130121439695358, 0.22092531621456146, 0.09081685543060303, 0.0837029218673706, 0.11255957931280136, -0.5618677139282227, 0.17672118544578552, -0.473766952753067, -0.2698967456817627, 0.1755489706993103, 0.06628302484750748, -0.24525409936904907, -0.3666694760322571, 0.36993658542633057, 0.21076123416423798, -0.18953904509544373, 0.3818652629852295, -0.04691945016384125, -0.15649808943271637, 0.3288652300834656, 0.21360492706298828, 0.8158726096153259, -0.13534289598464966, 0.15840426087379456, 0.10750813782215118, -0.17917007207870483, 0.11798186600208282, -0.1895754635334015, 0.18212071061134338, -0.0991283506155014, -0.26742205023765564, -0.05419374257326126, -0.0027763359248638153, 0.1855868697166443, 0.18260018527507782, -0.3896503448486328, 0.041267022490501404, -0.01308952271938324, 0.35367146134376526, -0.14155560731887817, 0.09559246897697449, 0.014360157772898674, -0.40355727076530457, -0.1375482827425003, 0.23364046216011047, 0.158403217792511, -0.3231950104236603, 0.03385170176625252, 0.08223604410886765, 0.060665521770715714, -0.13271409273147583, 0.08063967525959015, -0.1301562786102295, 0.09474369138479233, 0.3432977795600891, -0.13231152296066284, -0.14373157918453217, -0.09156158566474915, 0.15584906935691833, 0.038181547075510025, 0.05373511463403702, 0.1378684639930725, -0.13075204193592072, 0.2097691297531128, 0.3033132553100586, -0.016176749020814896, -0.1646832972764969, 0.055584318935871124, 0.2259279489517212, 0.04924396425485611, 0.17851856350898743, 0.11877995729446411, -0.16213196516036987, -0.4057101309299469, 0.1627717763185501, 0.2156357318162918, -0.3708290755748749, -0.18832184374332428, 0.27284955978393555, -0.20948444306850433, -0.23584720492362976, 0.2573489546775818, -0.07376110553741455, -0.16851121187210083, 0.4690839946269989, 0.036714181303977966, -0.32029053568840027, -0.1528031826019287, 0.2767716348171234, 0.4433363080024719, 0.15254701673984528, 0.16688688099384308, -0.3075614869594574, -0.17994984984397888, -0.3197021484375, 0.14908701181411743, -0.01850954443216324, -0.03935910016298294, 0.11616171896457672, -0.16717635095119476, -0.0820840448141098, 0.05802897363901138, 0.03757632523775101, 0.04453040659427643, 0.2842281758785248, 0.009461987763643265, -0.06898308545351028, -0.3738117516040802, 0.37758946418762207, 0.3931943476200104, 0.40546301007270813, 0.1628691852092743, 0.05524417757987976, -0.2746469974517822, 0.35422202944755554, -0.5368198156356812, 0.0610649511218071, 0.12944293022155762, 0.12453087419271469, 0.2902822494506836, -0.05201578885316849, -0.05409260466694832, -0.2505302429199219, 0.3436538577079773, 0.22134825587272644, -0.06178709864616394, -0.4380207061767578, -0.12349829077720642, 0.01857687532901764, -0.11992061883211136, 0.044862352311611176, -0.10254289954900742, -0.12755826115608215, -0.11089654266834259, -0.32575082778930664, 0.11974351108074188, 0.057452164590358734, -0.07910142838954926, -0.11666344851255417, 0.021955538541078568, -0.3570919632911682, 0.03236030042171478, 0.05988046154379845, 0.02747941017150879, -0.04920659959316254, -0.03250736743211746, 0.1941249966621399, -0.15896858274936676, -0.04105652496218681, -0.021976331248879433, 0.08195999264717102, 0.17559802532196045, -0.1298111379146576, 0.3645026683807373, 0.1792948842048645, -0.15291716158390045, 0.22467917203903198, 0.38130587339401245, -0.14458130300045013, -0.12327305227518082, -0.06527312844991684, 0.026445969939231873, 0.41878119111061096, -0.5710079669952393, -0.23931019008159637, 0.3246636688709259, 0.1256609410047531, 0.38738030195236206, 0.24622610211372375, 0.1558755487203598, 0.1374550312757492, -0.02479543536901474, 0.017666533589363098, 0.16200661659240723, -0.2410401850938797, 0.30229493975639343, 0.5416370630264282, 0.1829596310853958, -0.13510996103286743, 0.1403156965970993, 0.3261198103427887, 0.22796222567558289, 0.17929361760616302, -0.10044107586145401, 0.2426559180021286, 0.06499731540679932, 0.012105938047170639, -0.05978766828775406, -0.2157592624425888, 0.45459213852882385, 0.19164803624153137, -0.16740164160728455, 0.21881508827209473, 0.2984347939491272, -0.09259053319692612, -0.03703170269727707, -0.21178261935710907, -0.08901050686836243, 0.3865285813808441, -0.2726803421974182, -0.1154378354549408, 0.26596832275390625, -0.16531938314437866, 0.011219188570976257, -0.011216029524803162, 0.034467633813619614, -0.3354158401489258, 0.5989680290222168, -0.11798618733882904, 0.34449344873428345, 0.10974487662315369, 0.1284029334783554, -0.011391960084438324, 0.25954756140708923, -0.2587163746356964, -0.11500849574804306, 0.17195096611976624, -0.02412845939397812, -0.14421908557415009, 0.1693306565284729, 0.24457386136054993, -0.025003600865602493, 0.04052835330367088, 0.36021560430526733, 0.03284993767738342, -0.18682880699634552, -0.10482630878686905, -0.1679212898015976, 0.04844379052519798, -0.10481347143650055, 0.18936270475387573, 0.3241736590862274, -0.28037434816360474, 0.06163708120584488, 0.06576310098171234, 0.12096361815929413, -0.31225988268852234, 0.1256735771894455, 0.3663511872291565, -0.4503670930862427, 0.1505753993988037, -0.01101171225309372, -0.09671640396118164, -0.3434634208679199, 0.32343682646751404, -0.198866069316864, 0.08579572290182114, 0.001034032553434372, 0.20826587080955505, 0.2545560300350189, 0.24098922312259674, 0.11456115543842316, -0.3659958839416504, -0.35159313678741455, -0.28691762685775757, -0.5305483341217041, -0.19515570998191833, -0.0979844480752945, -0.12133490294218063, 0.04062904044985771, 0.26973849534988403, 0.2883736789226532, 0.19292642176151276, 0.07656708359718323, -0.15846335887908936, -0.13989152014255524, -0.039543889462947845, -0.15802522003650665, -0.15467683970928192, 0.07509263604879379, -0.13927990198135376, 0.10337050259113312, -0.39314520359039307, 0.22117938101291656, 0.19824664294719696, 0.23146703839302063, -0.25288206338882446, 0.2586395740509033, -0.019626211374998093, 0.15502837300300598, 0.25886934995651245, -0.005815908312797546, -0.09993469715118408, -0.3343369960784912, -0.01608896255493164, 0.1602393239736557, -0.05405077710747719, -0.11604227125644684, 0.10102906823158264, 0.12651295959949493, 0.07649703323841095, -0.33988335728645325, -0.10005630552768707, 0.009812898002564907, -0.18774427473545074, 0.17637166380882263, -0.08869313448667526, -0.2159191220998764, 0.1664118766784668, 0.09911606460809708, 0.12929029762744904, -0.07430481910705566, 0.47186803817749023, 0.033195555210113525, 0.2136564552783966, 0.05891913175582886, -0.2559768855571747, 0.3187164068222046, -0.055340271443128586, -0.29160675406455994, -0.07911713421344757, -0.040914520621299744, -0.009886607527732849, 0.11952731758356094, -0.32436665892601013, -0.0580902025103569, 0.28425517678260803, -0.26656845211982727, 0.009212207049131393, 0.4032023251056671, -0.1166626513004303, -0.039965834468603134, -0.1263274997472763, 0.18760451674461365, -0.07539962977170944, -0.3816273808479309, -0.09060442447662354, -0.4267738461494446 ]
https://github.com/huggingface/datasets/issues/6012
[FR] Transform Chaining, Lazy Mapping
You can use `with_transform` to get a new dataset object. Support for lazy `map` has already been discussed [here](https://github.com/huggingface/datasets/issues/3385) a little bit. Personally, I'm not a fan, as this would make `map` even more complex.
### Feature request Currently using a `map` call processes and duplicates the whole dataset, which takes both time and disk space. The solution is to allow lazy mapping, which is essentially a saved chain of transforms that are applied on the fly whenever a slice of the dataset is requested. The API should look like `map`, as `set_transform` changes the current dataset while `map` returns another dataset. ### Motivation Lazy processing allows lower disk usage and faster experimentation. ### Your contribution _
35
[FR] Transform Chaining, Lazy Mapping ### Feature request Currently using a `map` call processes and duplicates the whole dataset, which takes both time and disk space. The solution is to allow lazy mapping, which is essentially a saved chain of transforms that are applied on the fly whenever a slice of the dataset is requested. The API should look like `map`, as `set_transform` changes the current dataset while `map` returns another dataset. ### Motivation Lazy processing allows lower disk usage and faster experimentation. ### Your contribution _ You can use `with_transform` to get a new dataset object. Support for lazy `map` has already been discussed [here](https://github.com/huggingface/datasets/issues/3385) a little bit. Personally, I'm not a fan, as this would make `map` even more complex.
[ -0.24778230488300323, -0.4162163734436035, -0.17038147151470184, -0.06715802848339081, -0.0025982558727264404, -0.03832296282052994, -0.03812460973858833, 0.40684834122657776, 0.2943812906742096, 0.18187548220157623, -0.06886462867259979, 0.42894870042800903, -0.22558295726776123, 0.35840627551078796, 0.12850812077522278, -0.1340501606464386, 0.12620876729488373, 0.18901923298835754, -0.37549445033073425, -0.010495420545339584, -0.40557393431663513, 0.10751676559448242, 0.008576981723308563, -0.050867125391960144, -0.021795621141791344, -0.06624803692102432, -0.2851542830467224, -0.1326390504837036, -0.053332485258579254, 0.021432586014270782, 0.20676933228969574, 0.2997102737426758, -0.13591036200523376, 0.1491721272468567, -0.00009640333155402914, -0.017173394560813904, 0.05461170896887779, 0.015919925644993782, -0.03776787221431732, -0.254835844039917, -0.20526573061943054, -0.30012789368629456, -0.09884455054998398, -0.3435746729373932, -0.22085309028625488, -0.2081356644630432, 0.20584875345230103, -0.3702934682369232, 0.48446571826934814, -0.23892949521541595, 0.3295719623565674, 0.05875711143016815, -0.2670711278915405, -0.22261181473731995, 0.17531344294548035, 0.27559202909469604, 0.007213374599814415, -0.12605684995651245, 0.16497929394245148, 0.07767116278409958, -0.15716147422790527, 0.34429648518562317, -0.16259075701236725, -0.05599905177950859, 0.46537670493125916, -0.04765713959932327, -0.10260730236768723, -0.1769694983959198, 0.03426331654191017, 0.17483307421207428, 0.17987725138664246, -0.2305138111114502, -0.25307002663612366, -0.3588922321796417, -0.274976909160614, -0.1496364027261734, -0.16870704293251038, 0.03806839883327484, 0.023016273975372314, 0.19450372457504272, -0.3565523326396942, -0.1996115744113922, 0.07932588458061218, 0.09601005911827087, 0.02016209065914154, -0.03994004428386688, -0.13046666979789734, -0.008544035255908966, 0.23964691162109375, -0.06088615208864212, -0.02581235021352768, -0.14426331222057343, 0.03672170266509056, 0.193118616938591, -0.20326422154903412, -0.3326208293437958, 0.22062534093856812, 0.08668281883001328, 0.3657928705215454, 0.26428934931755066, -0.035445455461740494, 0.16813132166862488, -0.33879607915878296, 0.16427507996559143, 0.21354635059833527, 0.1337454617023468, -0.06232888251543045, -0.2350100725889206, 0.17223475873470306, -0.23044969141483307, 0.055709999054670334, 0.02952534705400467, 0.163331538438797, 0.06724229454994202, -0.08532237261533737, -0.06598784774541855, 0.16772975027561188, 0.08895470201969147, -0.00993536226451397, -0.26817139983177185, 0.16022375226020813, 0.09977289289236069, 0.0004966920241713524, 0.37227073311805725, 0.02611175924539566, 0.20756393671035767, 0.18984444439411163, 0.015973718836903572, 0.029608888551592827, 0.03390173241496086, -0.24732741713523865, -0.18127241730690002, -0.17834630608558655, 0.1632947027683258, -0.014225602149963379, 0.017952056601643562, 0.15799294412136078, 0.042890291661024094, -0.07540678977966309, 0.15754812955856323, 0.30882203578948975, 0.04479745030403137, 0.2056836485862732, 0.01245344802737236, -0.06931865215301514, -0.008879289962351322, 0.13256444036960602, 0.0831506997346878, -0.42918631434440613, 0.12878262996673584, -0.2940957248210907, -0.2812393009662628, 0.06559092551469803, 0.30230289697647095, -0.031826093792915344, -0.08397504687309265, -0.24266007542610168, 0.5922921299934387, -0.08993460983037949, -0.21384504437446594, 0.1043662577867508, 0.08552590757608414, -0.3343789875507355, -0.1955810934305191, -0.05815096199512482, 0.14480170607566833, 0.11777785420417786, -0.3537641167640686, -0.040522489696741104, -0.0030036866664886475, -0.14613869786262512, 0.3200751543045044, -0.25214746594429016, 0.009288296103477478, -0.19720405340194702, 0.12284792959690094, 0.3099290430545807, 0.02918831631541252, -0.20239315927028656, 0.10256858170032501, -0.22506777942180634, -0.10994957387447357, -0.02337159961462021, 0.38267800211906433, 0.2979162335395813, -0.1672053337097168, -0.007514044642448425, 0.3797992467880249, -0.10335966944694519, 0.17827357351779938, -0.0035445354878902435, -0.2993563711643219, -0.0871816873550415, -0.05597689002752304, -0.012179780751466751, 0.11390581727027893, 0.03600155562162399, 0.13961182534694672, 0.22507277131080627, -0.25245338678359985, 0.21432022750377655, 0.15145285427570343, 0.1347304880619049, -0.1352047324180603, -0.060851894319057465, -0.3599615693092346, -0.47841572761535645, -0.04653330147266388, 0.09195025265216827, -0.15721462666988373, 0.1856609582901001, -0.33400386571884155, 0.006195260211825371, 0.013298949226737022, 0.06433326750993729, 0.19712592661380768, 0.24242925643920898, 0.1545080840587616, -0.06316281855106354, -0.17556385695934296, -0.37705832719802856, -0.016965458169579506, 0.03046438656747341, -0.005885052960366011, -0.41459909081459045, 0.2415250688791275, 0.23364117741584778, 0.09802577644586563, -0.019479677081108093, -0.0010281577706336975, -0.057769499719142914, -0.1565052568912506, 0.2779555022716522, 0.05525772646069527, 0.05908310413360596, 0.24529482424259186, -0.06466810405254364, 0.61463862657547, 0.2120671570301056, -0.03244534507393837, 0.27865785360336304, 0.028119638562202454, 0.09161829203367233, -0.1298600137233734, -0.4368366301059723, 0.4054079055786133, -0.2528403401374817, 0.1360875517129898, 0.017096608877182007, 0.057624153792858124, 0.161030575633049, -0.1545829474925995, -0.2282295823097229, -0.1710464060306549, 0.05384218692779541, 0.06502632796764374, 0.22835396230220795, 0.09676145762205124, -0.2266945093870163, 0.2831161916255951, 0.5104623436927795, -0.18781933188438416, 0.2012527585029602, 0.23041948676109314, -0.05797547847032547, -0.13003164529800415, 0.015770044177770615, 0.22837047278881073, 0.26747292280197144, 0.3183157444000244, 0.13051635026931763, 0.0756998062133789, 0.2557261884212494, 0.018475331366062164, 0.3663822114467621, 0.004825115203857422, 0.24098722636699677, -0.07217124849557877, 0.20478405058383942, -0.03864156827330589, -0.32783475518226624, -0.3263358175754547, 0.13856783509254456, -0.07640746980905533, 0.11525982618331909, -0.03565722703933716, -0.16251687705516815, -0.012206152081489563, -0.2573772370815277, -0.3306732475757599, 0.007709594443440437, -0.30400800704956055, 0.011647334322333336, 0.2545875608921051, -0.413019597530365, 0.25801748037338257, 0.06768755614757538, 0.4639793336391449, 0.004174565896391869, -0.24515412747859955, -0.2779358923435211, -0.20012442767620087, 0.21565234661102295, 0.1876084804534912, 0.04238547384738922, -0.2598864734172821, 0.428316205739975, -0.2295428067445755, 0.1981452852487564, -0.31008023023605347, -0.40991365909576416, 0.30468687415122986, -0.07086516916751862, -0.047950759530067444, 0.2129993587732315, 0.20220662653446198, 0.16225413978099823, -0.07507642358541489, 0.049202244728803635, -0.37804049253463745, -0.29871901869773865, -0.15730462968349457, 0.09910771995782852, 0.0969248116016388, -0.22213180363178253, -0.09222329407930374, -0.10734415799379349, -0.43672704696655273, 0.5739482045173645, -0.04951827973127365, 0.16565276682376862, 0.055736612528562546, 0.010468344204127789, 0.08173992484807968, 0.06535936892032623, -0.047833219170570374, -0.23906457424163818, -0.3973592221736908, 0.11097204685211182, -0.23720286786556244, -0.07035835087299347, -0.25602197647094727, -0.12513932585716248, 0.0008570924401283264, 0.04758431762456894, -0.28094661235809326, -0.4310856759548187, -0.2581526041030884, 0.5016738176345825, 0.13788598775863647, 0.16871501505374908, 0.45089593529701233, 0.28238072991371155, -0.24953904747962952, -0.059300318360328674, -0.28527185320854187, -0.05327136069536209, 0.22914090752601624, -0.09003042429685593, 0.23741570115089417, 0.291103333234787, 0.216535747051239, 0.6903377771377563, 0.16062098741531372, -0.020374875515699387, 0.18716827034950256, 0.048502251505851746, 0.19791512191295624, -0.3055223226547241, -0.2908152937889099, -0.206096813082695, -0.22629910707473755, -0.08028194308280945, 0.2575511336326599, 0.006245572119951248, -0.3831692934036255, 0.06048966944217682, -0.3724541962146759, -0.07720933854579926, -0.21298229694366455, 0.217702254652977, 0.015449967235326767, -0.009060747921466827, 0.1979718953371048, -0.0013956576585769653, -0.4150870442390442, 0.061153098940849304, 0.22645686566829681, -0.0426553338766098, 0.28845056891441345, -0.14629364013671875, -0.20944301784038544, 0.005044044926762581, -0.5810480117797852, 0.4426175355911255, 0.053419310599565506, -0.33246758580207825, -0.022670261561870575, -0.30692464113235474, -0.16051389276981354, -0.03938024118542671, 0.5701736211776733, 0.006825024262070656, -0.29640376567840576, -0.05805009976029396, -0.49157872796058655, -0.1322772055864334, 0.28260475397109985, -0.023816365748643875, 0.016066797077655792, 0.23492421209812164, 0.6012458801269531, -0.3529561758041382, -0.20757976174354553, 0.1767156720161438, 0.16343730688095093, -0.25768399238586426, 0.06360341608524323, 0.04955398663878441, -0.3330368399620056, -0.30783557891845703, 0.025372043251991272, 0.007697435095906258, -0.07851806282997131, 0.31534087657928467, -0.05486762151122093, -0.2274789661169052, 0.00886930525302887, 0.10707297921180725, 0.04753798246383667, 0.11114772409200668, 0.12866422533988953, 0.09900401532649994, 0.1353665441274643, 0.12159956991672516, -0.16846442222595215, 0.4299664795398712, -0.20942433178424835, -0.23408085107803345, 0.07687021046876907, 0.1926625370979309, 0.18039028346538544, 0.1855681836605072, 0.34745118021965027, 0.17609244585037231, 0.26065969467163086, 0.17173370718955994, -0.6235682964324951, -0.08421418815851212, 0.1455044150352478, 0.12089716643095016, -0.27171415090560913, -0.47369587421417236, 0.5301852822303772, 0.14987818896770477, -0.2616909146308899, 0.30835577845573425, -0.03978407382965088, -0.2309579998254776, 0.47547364234924316, 0.2868846654891968, 0.9568655490875244, 0.003575235605239868, 0.2549547553062439, 0.08548562973737717, -0.1879141926765442, 0.5247297883033752, -0.29876673221588135, 0.159758523106575, -0.3049687147140503, -0.5421872138977051, -0.10754519701004028, -0.05025671422481537, -0.17836591601371765, 0.0469583123922348, -0.36575543880462646, 0.2550514340400696, 0.2408468872308731, 0.12142075598239899, -0.14931640028953552, -0.02318694069981575, -0.05842070281505585, -0.32550182938575745, -0.21943888068199158, 0.28572356700897217, 0.09113103151321411, 0.14588746428489685, -0.11275910586118698, -0.23624902963638306, 0.10440607368946075, -0.0638807937502861, -0.015561811625957489, -0.0987822487950325, -0.07635154575109482, 0.27143001556396484, -0.12796859443187714, 0.1481359601020813, -0.18550777435302734, 0.03652847185730934, 0.05807048827409744, 0.0541243702173233, -0.1169709712266922, -0.023601140826940536, -0.10413021594285965, 0.3646872341632843, -0.09155076742172241, -0.22103270888328552, 0.3707130253314972, 0.08797790855169296, 0.08709011226892471, -0.05453518033027649, 0.16815689206123352, -0.22633835673332214, -0.35277873277664185, 0.07750105857849121, -0.22445617616176605, -0.19802819192409515, -0.0792158842086792, 0.386644184589386, -0.007078574970364571, -0.21279263496398926, 0.2043103724718094, 0.038224466145038605, -0.04999003931879997, 0.3352470099925995, 0.060755033046007156, -0.15516582131385803, -0.03626352921128273, 0.28151413798332214, 0.29708337783813477, 0.025956913828849792, 0.23570561408996582, -0.11874578893184662, -0.2304728925228119, -0.3043014407157898, 0.1985597312450409, 0.19879849255084991, -0.4199413061141968, 0.43486443161964417, -0.34346622228622437, -0.32505524158477783, -0.05624175816774368, 0.21231506764888763, 0.16012918949127197, 0.13858860731124878, -0.15607795119285583, -0.06312239170074463, -0.2819019556045532, 0.4270353317260742, 0.06739529222249985, 0.5077733397483826, 0.061684802174568176, 0.05078701302409172, -0.1020214632153511, 0.2476838380098343, -0.504860520362854, 0.008274784311652184, -0.08808193355798721, 0.05185803025960922, 0.045740000903606415, -0.21671923995018005, 0.05452851578593254, 0.022779731079936028, 0.1414998173713684, 0.1565260887145996, -0.23915919661521912, -0.30968570709228516, -0.21721148490905762, 0.10410935431718826, -0.19235017895698547, 0.2107444554567337, 0.0907486230134964, -0.025349946692585945, -0.03630079701542854, -0.41692307591438293, 0.19571885466575623, 0.08740109950304031, 0.08216885477304459, -0.0922853872179985, 0.14631511270999908, -0.2722119390964508, 0.03281951695680618, 0.03760335594415665, 0.39615312218666077, -0.04805293679237366, -0.20644375681877136, 0.22555790841579437, -0.17325688898563385, -0.20346742868423462, 0.14241376519203186, 0.28842735290527344, 0.5714291334152222, -0.22056007385253906, 0.3795430660247803, 0.13835227489471436, -0.19603373110294342, 0.3424385190010071, 0.5556603670120239, -0.09799081087112427, 0.010944333858788013, 0.15019498765468597, 0.08812525123357773, 0.36997631192207336, -0.3900127708911896, -0.1353328824043274, 0.36219361424446106, 0.11042115837335587, 0.22695273160934448, 0.18177126348018646, -0.02529444731771946, 0.15854360163211823, 0.10808444768190384, -0.12338876724243164, 0.19386303424835205, -0.29909950494766235, 0.16237370669841766, 0.14730657637119293, 0.08583158254623413, -0.12476518750190735, 0.40910282731056213, 0.3029109537601471, 0.5008546710014343, 0.21561741828918457, -0.13284406065940857, 0.2543303370475769, 0.036793556064367294, 0.0680648609995842, 0.2177574336528778, -0.17112338542938232, 0.1692143678665161, 0.17911314964294434, -0.01086791604757309, 0.30371901392936707, 0.17391592264175415, 0.04867403954267502, -0.01822000741958618, -0.12974636256694794, -0.33211198449134827, 0.6950958967208862, -0.1960119903087616, -0.27518343925476074, 0.08516336232423782, -0.1885896623134613, -0.10377764701843262, 0.037642043083906174, -0.039815131574869156, -0.288326621055603, 0.5481202602386475, 0.04394039139151573, 0.47681689262390137, 0.04001227021217346, -0.04293479770421982, 0.016075430437922478, 0.3288164436817169, -0.30512192845344543, -0.04020104557275772, 0.2351440191268921, -0.2296433448791504, -0.04641618952155113, 0.5561135411262512, 0.1516624391078949, -0.06146268546581268, -0.21290336549282074, 0.4006519019603729, -0.24040476977825165, -0.11549604684114456, -0.2490517497062683, 0.14722424745559692, -0.046472325921058655, 0.07521607726812363, 0.3491974174976349, 0.2573244869709015, -0.2163848727941513, 0.12354503571987152, -0.01521584764122963, -0.0038455016911029816, -0.2608562409877777, 0.3626098036766052, 0.1282048225402832, -0.08626734465360641, -0.039542585611343384, -0.04614982753992081, -0.19189345836639404, -0.08493201434612274, 0.14929234981536865, -0.44865334033966064, 0.17672017216682434, 0.06185804679989815, 0.16422401368618011, 0.04301922023296356, 0.3045513331890106, 0.13586486876010895, 0.02839019149541855, -0.04027160629630089, -0.09656155109405518, -0.23067224025726318, 0.08152046799659729, 0.17868255078792572, 0.13818655908107758, 0.04821828380227089, 0.040356412529945374, 0.251078337430954, 0.12948644161224365, -0.17853794991970062, -0.35576653480529785, -0.07072994858026505, 0.1948259025812149, -0.059713926166296005, -0.0019649527966976166, -0.12656839191913605, -0.07833023369312286, 0.26205340027809143, -0.4035392701625824, -0.06096726283431053, -0.015265950001776218, 0.12557867169380188, -0.17810645699501038, 0.2970908582210541, -0.119508758187294, -0.2739989161491394, 0.38707050681114197, 0.30025699734687805, -0.16946643590927124, -0.25415608286857605, -0.1064661294221878, 0.08076346665620804, -0.27908918261528015, -0.3228735327720642, 0.061903733760118484, 0.04168454557657242, 0.16880550980567932, -0.19525828957557678, -0.18763862550258636, -0.09275548905134201, -0.14130671322345734, 0.19556523859500885, 0.1609046906232834, -0.29991257190704346, 0.16743288934230804, -0.42317888140678406, -0.0897270068526268, 0.020260699093341827, 0.6125141382217407, 0.060952771455049515, 0.20755963027477264, 0.0014108791947364807, -0.2668853998184204, 0.44237956404685974, -0.3905383348464966, -0.3343670666217804, 0.059912942349910736, 0.0743662416934967, 0.0871879979968071, -0.20129382610321045, -0.17644695937633514, -0.0061211735010147095, 0.23735485970973969, -0.08760377019643784, -0.0974036306142807, 0.3040584623813629, -0.015128916129469872, -0.2670231759548187, -0.2385333776473999, 0.5089596509933472, 0.19786357879638672, -0.41592445969581604, 0.17365607619285583, -0.3546178936958313 ]
https://github.com/huggingface/datasets/issues/6012
[FR] Transform Chaining, Lazy Mapping
> You can use `with_transform` to get a new dataset object. > > Support for lazy `map` has already been discussed [here](https://github.com/huggingface/datasets/issues/3385) a little bit. Personally, I'm not a fan, as this would make `map` even more complex. I read about IterableDataset, and it seems to have lazy mapping. But I can't figure out how to convert an IterableDataset into a normal one when needed. `with_transform` still does not chain AFAIU.
### Feature request Currently using a `map` call processes and duplicates the whole dataset, which takes both time and disk space. The solution is to allow lazy mapping, which is essentially a saved chain of transforms that are applied on the fly whenever a slice of the dataset is requested. The API should look like `map`, as `set_transform` changes the current dataset while `map` returns another dataset. ### Motivation Lazy processing allows lower disk usage and faster experimentation. ### Your contribution _
71
[FR] Transform Chaining, Lazy Mapping ### Feature request Currently using a `map` call processes and duplicates the whole dataset, which takes both time and disk space. The solution is to allow lazy mapping, which is essentially a saved chain of transforms that are applied on the fly whenever a slice of the dataset is requested. The API should look like `map`, as `set_transform` changes the current dataset while `map` returns another dataset. ### Motivation Lazy processing allows lower disk usage and faster experimentation. ### Your contribution _ > You can use `with_transform` to get a new dataset object. > > Support for lazy `map` has already been discussed [here](https://github.com/huggingface/datasets/issues/3385) a little bit. Personally, I'm not a fan, as this would make `map` even more complex. I read about IterableDataset, and it seems to have lazy mapping. But I can't figure out how to convert an IterableDataset into a normal one when needed. `with_transform` still does not chain AFAIU.
[ -0.27461275458335876, -0.4056375324726105, -0.1270228624343872, -0.0834740400314331, 0.027343885973095894, 0.07320728152990341, -0.0010264180600643158, 0.3469204604625702, 0.15508490800857544, 0.04703850299119949, -0.1103539764881134, 0.3395669162273407, -0.2917414605617523, 0.2753731608390808, 0.03291960805654526, -0.039247170090675354, 0.1535097062587738, 0.07826098054647446, -0.36404910683631897, 0.021864406764507294, -0.37692296504974365, 0.18362504243850708, -0.03131380304694176, -0.10852345824241638, 0.0027895017992705107, -0.12865443527698517, -0.2743743658065796, -0.18551456928253174, 0.031710781157016754, -0.020137744024395943, 0.36657339334487915, 0.3641245365142822, -0.09525450319051743, 0.08781903237104416, -0.00010313655366189778, -0.0220523402094841, 0.013898994773626328, -0.00022623874247074127, -0.035800062119960785, -0.21773777902126312, -0.26750648021698, -0.2551248371601105, -0.12138377875089645, -0.28535348176956177, -0.21585097908973694, -0.3208825886249542, 0.23530398309230804, -0.4036131501197815, 0.4956790804862976, -0.21770311892032623, 0.24826274812221527, -0.1461348533630371, -0.2747197449207306, -0.24372681975364685, 0.003006063401699066, 0.25633442401885986, -0.07936690747737885, 0.0016038333997130394, 0.2774943709373474, 0.10724565386772156, -0.1020766869187355, 0.20116116106510162, -0.09023098647594452, -0.08987414836883545, 0.48563820123672485, -0.04598015174269676, -0.05031740665435791, -0.21500924229621887, 0.08093668520450592, 0.2045896053314209, 0.13961225748062134, -0.2151792049407959, -0.20764073729515076, -0.5087724924087524, -0.18392647802829742, -0.076134093105793, -0.22182369232177734, -0.05452125519514084, 0.08303804695606232, 0.22479867935180664, -0.3799192011356354, -0.19801346957683563, 0.04110760986804962, 0.09697630256414413, 0.15610183775424957, -0.14846165478229523, -0.1477527916431427, 0.02141321450471878, 0.21220608055591583, -0.11600369215011597, 0.20719805359840393, -0.20897427201271057, 0.0846504271030426, 0.28154802322387695, -0.14096683263778687, -0.33397793769836426, 0.16476741433143616, 0.11159758269786835, 0.41605499386787415, 0.25670039653778076, -0.12140476703643799, 0.07740943878889084, -0.5029070973396301, 0.02271057665348053, 0.31780803203582764, 0.055617805570364, -0.12633630633354187, -0.06729832291603088, 0.09427477419376373, -0.1282786726951599, 0.07442186772823334, 0.060221876949071884, 0.15693753957748413, 0.07438240200281143, 0.08845464885234833, 0.016105104237794876, 0.21467259526252747, 0.04922359809279442, -0.05024778097867966, -0.3669501543045044, -0.022390788421034813, 0.013656619936227798, 0.003407716751098633, 0.20167328417301178, 0.036694835871458054, 0.1678113043308258, 0.10663573443889618, 0.06463485956192017, 0.1576257348060608, 0.11578475683927536, -0.19472280144691467, -0.3215042054653168, -0.13790102303028107, 0.2256951928138733, -0.003585919737815857, -0.025155171751976013, 0.15351828932762146, 0.047770820558071136, -0.18495167791843414, 0.14671754837036133, 0.34625136852264404, -0.07589113712310791, 0.2849874794483185, -0.06390027701854706, -0.08824126422405243, 0.09793969243764877, 0.13262683153152466, -0.0706164538860321, -0.42339685559272766, 0.09400177747011185, -0.2814047932624817, -0.2848101854324341, 0.1349623203277588, 0.20684312283992767, -0.1548902690410614, -0.13339881598949432, -0.21460026502609253, 0.6047586798667908, 0.01297605037689209, -0.23512905836105347, 0.1064252108335495, -0.02464323490858078, -0.28315773606300354, -0.17510564625263214, -0.07039860635995865, 0.17656227946281433, 0.12158511579036713, -0.3544491231441498, -0.06504341959953308, -0.01720137521624565, -0.09327929466962814, 0.4058228135108948, -0.19320380687713623, 0.20247071981430054, -0.29174014925956726, 0.06865176558494568, 0.13432815670967102, 0.1917724460363388, -0.2340151071548462, 0.1254311352968216, -0.09558068215847015, 0.1408080756664276, -0.13388237357139587, 0.3549956977367401, 0.29420217871665955, -0.33987361192703247, 0.055021919310092926, 0.3778146505355835, -0.24214380979537964, 0.03705538064241409, 0.057403814047575, -0.2269277721643448, -0.06426173448562622, -0.12986505031585693, 0.021115973591804504, 0.2753446400165558, -0.01639372855424881, 0.234268456697464, 0.288650780916214, -0.2789015471935272, 0.2310723513364792, 0.17866437137126923, 0.13541434705257416, -0.12358847260475159, 0.006416453514248133, -0.339079886674881, -0.5651982426643372, -0.07155910134315491, 0.1638915240764618, -0.14745108783245087, 0.12300051748752594, -0.34689223766326904, -0.023952264338731766, -0.03584282100200653, -0.016555074602365494, 0.21031904220581055, 0.17414164543151855, 0.21273480355739594, -0.07237371057271957, -0.16709592938423157, -0.4318506717681885, 0.020562902092933655, 0.005758984014391899, -0.10773397237062454, -0.491915225982666, 0.21654781699180603, 0.3431904911994934, 0.11724008619785309, 0.022866569459438324, 0.1315353363752365, -0.046190306544303894, -0.2738540768623352, 0.27586793899536133, 0.028781909495592117, 0.003298178780823946, 0.1559179723262787, -0.08757265657186508, 0.7862424850463867, 0.24622543156147003, -0.007627137005329132, 0.12331853806972504, 0.0290418341755867, 0.05674608424305916, -0.21902671456336975, -0.42572876811027527, 0.3116592764854431, -0.5682321786880493, 0.2828808128833771, 0.013616375625133514, 0.07657314091920853, 0.2636624574661255, -0.11694292724132538, -0.389239639043808, -0.12584584951400757, 0.013428829610347748, -0.00871933251619339, 0.22616265714168549, 0.009481269866228104, -0.12069979310035706, 0.3636512756347656, 0.5208203792572021, -0.20975007116794586, 0.14142650365829468, 0.14366275072097778, -0.04705452919006348, -0.03970092162489891, 0.030293576419353485, 0.27922675013542175, 0.30826956033706665, 0.2036428153514862, 0.16249054670333862, 0.12547379732131958, 0.22412581741809845, 0.08466823399066925, 0.3654930591583252, 0.007890686392784119, 0.36501047015190125, -0.045464105904102325, 0.1379309445619583, -0.01532334927469492, -0.301887184381485, -0.49462151527404785, 0.10283080488443375, 0.020081613212823868, 0.12699224054813385, -0.042319200932979584, -0.12850013375282288, -0.02406647615134716, -0.2679464519023895, -0.3955613672733307, 0.09315304458141327, -0.3643295168876648, -0.08665534853935242, 0.37377968430519104, -0.24774576723575592, 0.2891848385334015, 0.020673785358667374, 0.44845259189605713, 0.015080897137522697, -0.3169638514518738, -0.33595022559165955, -0.20630526542663574, 0.20394501090049744, 0.1343555897474289, 0.1594851016998291, -0.460824579000473, 0.30185019969940186, -0.259854257106781, 0.0777239128947258, -0.3016834557056427, -0.314510703086853, 0.30775293707847595, -0.10393302142620087, -0.08120644837617874, 0.26189494132995605, 0.24362339079380035, 0.2138156145811081, -0.11349005997180939, 0.03334059193730354, -0.2715960443019867, -0.16178233921527863, -0.11943251639604568, 0.005360806360840797, 0.09727693349123001, -0.09933850169181824, -0.09067150205373764, -0.009660622105002403, -0.31283697485923767, 0.57186359167099, -0.08091079443693161, 0.1263023018836975, 0.26074910163879395, -0.01542657520622015, 0.08966248482465744, 0.1609681248664856, -0.10922226309776306, -0.1857333928346634, -0.33048200607299805, 0.20992505550384521, -0.15341411530971527, -0.09222568571567535, -0.23149816691875458, -0.21144284307956696, 0.026842905208468437, 0.016688404604792595, -0.27407804131507874, -0.2804033160209656, -0.23765219748020172, 0.45782262086868286, 0.0961018055677414, 0.08793528378009796, 0.43676719069480896, 0.32705289125442505, -0.1421966701745987, -0.03327781707048416, -0.26763150095939636, 0.054173391312360764, 0.17856189608573914, -0.022223539650440216, 0.3753306269645691, 0.3191658556461334, 0.3023967146873474, 0.7648841142654419, 0.3693021237850189, 0.06661641597747803, 0.13671043515205383, -0.006058262661099434, 0.08498075604438782, -0.31485679745674133, -0.3932522237300873, -0.2788676917552948, -0.2368273138999939, -0.16725055873394012, 0.19267916679382324, -0.028536275029182434, -0.4098190665245056, 0.13124023377895355, -0.30776676535606384, -0.000699605792760849, -0.2684725821018219, 0.2168729156255722, -0.08718074858188629, 0.028183232992887497, 0.15703167021274567, -0.0015853308141231537, -0.2904262840747833, -0.029054466634988785, 0.2982828617095947, -0.12727361917495728, 0.33610379695892334, -0.12838822603225708, -0.2145523726940155, 0.005329468287527561, -0.5823999643325806, 0.392825186252594, -0.017066441476345062, -0.1891728639602661, -0.04068116843700409, -0.28959962725639343, -0.14638745784759521, -0.04022951424121857, 0.6998797655105591, -0.053858011960983276, -0.2810964584350586, 0.02610141411423683, -0.42119458317756653, -0.08333604037761688, 0.22141419351100922, -0.07653259485960007, 0.18615296483039856, 0.34001749753952026, 0.696413516998291, -0.39573410153388977, -0.17698991298675537, 0.20151308178901672, 0.15888704359531403, -0.25307372212409973, 0.09093351662158966, 0.08473961055278778, -0.3614984452724457, -0.19409355521202087, -0.017630666494369507, 0.02861136756837368, 0.009820006787776947, 0.33628910779953003, -0.05786248296499252, -0.3602718710899353, -0.07869145274162292, 0.02724568545818329, -0.007130376994609833, 0.059580568224191666, 0.23301242291927338, 0.2440285086631775, 0.24995996057987213, 0.0458257794380188, -0.24073627591133118, 0.476085364818573, -0.14845408499240875, -0.2342124879360199, 0.09190250188112259, 0.14138436317443848, 0.18634293973445892, 0.1793929934501648, 0.2858271598815918, 0.03200170025229454, 0.41041621565818787, 0.13591794669628143, -0.62021404504776, -0.16235095262527466, 0.10891971737146378, 0.09194736182689667, -0.35738393664360046, -0.5204814076423645, 0.4709821045398712, 0.19632327556610107, -0.27043044567108154, 0.34809157252311707, -0.03872954845428467, -0.24924443662166595, 0.5029732584953308, 0.2635383903980255, 0.8977885842323303, -0.11377289891242981, 0.1754097193479538, 0.02899300307035446, -0.05760035291314125, 0.4684601426124573, -0.37157607078552246, 0.17132101953029633, -0.28552183508872986, -0.7100879549980164, -0.129251167178154, -0.07053297758102417, -0.16973373293876648, 0.09804239869117737, -0.3231734037399292, 0.33649367094039917, 0.30223548412323, 0.11094069480895996, -0.06723867356777191, -0.07757796347141266, -0.13042490184307098, -0.25590503215789795, -0.17370262742042542, 0.2211242914199829, 0.10075519979000092, 0.15256133675575256, -0.07473726570606232, -0.22834722697734833, 0.20724382996559143, 0.07361716777086258, -0.06367737799882889, -0.05187518894672394, -0.1037573292851448, 0.1315004527568817, -0.035257477313280106, 0.12767677009105682, -0.1584538370370865, 0.07238156348466873, 0.14681127667427063, -0.05250432714819908, -0.1772635281085968, -0.07318282127380371, -0.09049432724714279, 0.31779003143310547, -0.08596803992986679, -0.2483198344707489, 0.4018050730228424, 0.12494181841611862, 0.2373281717300415, -0.017963320016860962, 0.20884981751441956, -0.224245086312294, -0.37329527735710144, 0.014594469219446182, -0.14569897949695587, -0.2872393727302551, -0.14246238768100739, 0.5391584634780884, 0.08248730003833771, -0.13236281275749207, 0.14440350234508514, 0.086332306265831, -0.00039592362008988857, 0.3965001106262207, -0.09013406932353973, -0.14267733693122864, 0.014433901757001877, 0.2635341286659241, 0.28698593378067017, 0.009219899773597717, 0.3124706745147705, -0.09472334384918213, -0.1305028200149536, -0.2023889720439911, 0.18265214562416077, 0.2358485758304596, -0.4801790118217468, 0.36204415559768677, -0.4374617040157318, -0.1604880392551422, -0.16204023361206055, 0.2331104278564453, 0.11047818511724472, 0.14643988013267517, -0.20666135847568512, -0.14708688855171204, -0.2540467381477356, 0.3790167570114136, 0.18526741862297058, 0.47856926918029785, -0.010024523362517357, -0.07001405954360962, -0.072352334856987, 0.19852544367313385, -0.4238235354423523, -0.02636275254189968, -0.08166856318712234, 0.06743396818637848, -0.1308947056531906, -0.18235045671463013, 0.11618275195360184, -0.02679847925901413, 0.08920581638813019, 0.13973090052604675, -0.1360854059457779, -0.23155727982521057, -0.1761602759361267, 0.11847842484712601, -0.06592484563589096, 0.1513608992099762, 0.017851978540420532, -0.08624458312988281, -0.0774887204170227, -0.4663024842739105, 0.19155386090278625, 0.027689039707183838, 0.13714993000030518, -0.07869712263345718, 0.08405637741088867, -0.3035633862018585, -0.09003062546253204, -0.11763796210289001, 0.3980807363986969, -0.09536904096603394, -0.18182158470153809, 0.26077741384506226, -0.15111158788204193, -0.22406475245952606, 0.08394566923379898, 0.32006415724754333, 0.6599322557449341, -0.21646830439567566, 0.45924219489097595, 0.07190901041030884, -0.20489630103111267, 0.38385558128356934, 0.5525263547897339, -0.0027511194348335266, -0.07353760302066803, 0.22351044416427612, 0.056105758994817734, 0.2665470540523529, -0.35147130489349365, -0.1051306203007698, 0.28962239623069763, 0.23809896409511566, 0.14992225170135498, 0.22090503573417664, -0.11106035113334656, 0.0261722132563591, 0.2604098320007324, -0.13946795463562012, 0.20631928741931915, -0.3708193302154541, 0.14917340874671936, 0.18175363540649414, 0.11641831696033478, -0.13615107536315918, 0.4013929069042206, 0.21195194125175476, 0.45977020263671875, 0.21551841497421265, -0.10010471194982529, 0.17131870985031128, 0.10234706848859787, 0.04336972534656525, 0.3025539517402649, -0.14468559622764587, 0.10161593556404114, 0.17729026079177856, 0.05382370576262474, 0.23244664072990417, 0.23110748827457428, -0.15041601657867432, 0.1023046150803566, -0.14341603219509125, -0.2404777556657791, 0.543965756893158, -0.13722699880599976, -0.23994824290275574, 0.11520351469516754, -0.16882173717021942, -0.15409599244594574, 0.0006447881460189819, -0.13344033062458038, -0.3833919167518616, 0.5979052782058716, -0.004132978618144989, 0.5209758877754211, -0.07342971116304398, 0.10822077840566635, 0.04847404360771179, 0.43759340047836304, -0.25206148624420166, 0.04760150611400604, 0.1472657024860382, -0.2350195050239563, -0.15744413435459137, 0.687832772731781, 0.10101665556430817, 0.04848048835992813, -0.1998680830001831, 0.4567166864871979, -0.26596665382385254, -0.1628313809633255, -0.09746117144823074, 0.28823190927505493, -0.16499274969100952, 0.038204092532396317, 0.324729859828949, 0.16126912832260132, -0.10419771075248718, 0.25457602739334106, -0.025661300867795944, -0.03357085585594177, -0.28524544835090637, 0.4263160824775696, 0.10601912438869476, -0.07401275634765625, 0.1014641746878624, -0.07345902174711227, -0.049561507999897, -0.197654590010643, 0.15599870681762695, -0.550362229347229, 0.2016752064228058, 0.04148202762007713, 0.13403406739234924, -0.006559751927852631, 0.17656104266643524, 0.18624912202358246, 0.045143015682697296, -0.1136198416352272, -0.03699943795800209, -0.14579954743385315, -0.04941687732934952, 0.16383835673332214, 0.19616396725177765, 0.11302328109741211, 0.10738836228847504, 0.2140738070011139, 0.27874282002449036, -0.18636135756969452, -0.3723700940608978, -0.15844590961933136, 0.3669684827327728, 0.11375685036182404, -0.14914026856422424, -0.06296698749065399, -0.009628823027014732, 0.17353267967700958, -0.41813167929649353, 0.006632618606090546, -0.1440129578113556, 0.05247163027524948, -0.005796927958726883, 0.19667595624923706, -0.027269272133708, -0.33111515641212463, 0.3058350682258606, 0.3615397810935974, -0.29219910502433777, -0.18831202387809753, -0.03308103606104851, 0.006593972444534302, -0.2493235021829605, -0.2614614963531494, 0.26455992460250854, 0.07867741584777832, 0.0966288149356842, -0.2666257619857788, -0.16419894993305206, -0.13058596849441528, -0.24639976024627686, 0.2149442881345749, 0.25806042551994324, -0.4115335941314697, 0.24995842576026917, -0.4902340769767761, 0.047462910413742065, -0.01596185564994812, 0.6414689421653748, 0.023347847163677216, 0.31480711698532104, -0.01960904151201248, -0.17429322004318237, 0.41382896900177, -0.5008531212806702, -0.338346391916275, 0.23249809443950653, 0.05732477083802223, 0.18344354629516602, -0.29017218947410583, -0.07613033801317215, -0.0312701016664505, 0.31549015641212463, -0.15917226672172546, -0.12379997968673706, 0.22985590994358063, 0.11937186121940613, -0.21090395748615265, -0.21740593016147614, 0.6522443294525146, 0.2560094892978668, -0.4689393937587738, 0.2000061422586441, -0.3748970031738281 ]
https://github.com/huggingface/datasets/issues/6012
[FR] Transform Chaining, Lazy Mapping
> I read about IterableDataset, and it seems to have lazy mapping. But I can't figure out how to convert an IterableDataset into a normal one when needed. You must cache an `IterableDataset` to disk to load it as a `Dataset`. One way to do this is with `Dataset.from_generator`: ```python from functools import partial from datasets import Dataset def gen_from_iterable_dataset(iterable_ds) yield from iterable_ds ds = Dataset.from_generator(partial(gen_from_iterable_dataset, iterable_ds), features=iterable_ds.features}) ``` > with_transform still does not chain AFAIU. Yes, not supported yet - the solution is to combine the transforms into a single one.
### Feature request Currently using a `map` call processes and duplicates the whole dataset, which takes both time and disk space. The solution is to allow lazy mapping, which is essentially a saved chain of transforms that are applied on the fly whenever a slice of the dataset is requested. The API should look like `map`, as `set_transform` changes the current dataset while `map` returns another dataset. ### Motivation Lazy processing allows lower disk usage and faster experimentation. ### Your contribution _
92
[FR] Transform Chaining, Lazy Mapping ### Feature request Currently using a `map` call processes and duplicates the whole dataset, which takes both time and disk space. The solution is to allow lazy mapping, which is essentially a saved chain of transforms that are applied on the fly whenever a slice of the dataset is requested. The API should look like `map`, as `set_transform` changes the current dataset while `map` returns another dataset. ### Motivation Lazy processing allows lower disk usage and faster experimentation. ### Your contribution _ > I read about IterableDataset, and it seems to have lazy mapping. But I can't figure out how to convert an IterableDataset into a normal one when needed. You must cache an `IterableDataset` to disk to load it as a `Dataset`. One way to do this is with `Dataset.from_generator`: ```python from functools import partial from datasets import Dataset def gen_from_iterable_dataset(iterable_ds) yield from iterable_ds ds = Dataset.from_generator(partial(gen_from_iterable_dataset, iterable_ds), features=iterable_ds.features}) ``` > with_transform still does not chain AFAIU. Yes, not supported yet - the solution is to combine the transforms into a single one.
[ -0.23495735228061676, -0.32557356357574463, -0.16109183430671692, -0.18144196271896362, 0.10616957396268845, 0.13453632593154907, 0.05579795688390732, 0.4533076584339142, 0.008160348981618881, -0.04647892713546753, 0.01055005844682455, 0.4062657952308655, -0.383439302444458, 0.17144876718521118, -0.008140061981976032, -0.006094392389059067, 0.16904950141906738, 0.13566803932189941, -0.29485881328582764, 0.0002898015081882477, -0.37019678950309753, 0.09793134033679962, -0.024127736687660217, -0.18691150844097137, -0.02394884079694748, -0.12674693763256073, -0.18127353489398956, -0.2065650224685669, 0.0270097553730011, -0.10256800055503845, 0.2762499749660492, 0.3333823084831238, -0.013881126418709755, 0.049323804676532745, -0.00010174432827625424, -0.04101942107081413, -0.02925342321395874, -0.04174936190247536, -0.09292049705982208, -0.1821114867925644, -0.22441625595092773, -0.24538344144821167, -0.05466219782829285, -0.30734628438949585, -0.2128242552280426, -0.365990549325943, 0.1897493451833725, -0.5085781812667847, 0.43978410959243774, -0.1203678771853447, 0.252861887216568, -0.18352988362312317, -0.27303412556648254, -0.179471954703331, 0.0022582784295082092, 0.1528720259666443, -0.17226287722587585, -0.0036181602627038956, 0.3102770745754242, 0.054716840386390686, -0.05096811801195145, 0.23971344530582428, -0.15842337906360626, -0.0784960687160492, 0.5851927399635315, -0.07213377207517624, 0.14605721831321716, -0.3335682153701782, 0.07847504317760468, 0.0682159960269928, 0.16327537596225739, -0.22731748223304749, -0.1731288880109787, -0.4906957745552063, -0.24747991561889648, -0.1277511566877365, -0.21727776527404785, -0.053771473467350006, 0.015927040949463844, 0.1884414702653885, -0.3272956609725952, -0.24567697942256927, 0.025369755923748016, 0.053571172058582306, 0.1511608362197876, -0.049722880125045776, -0.09404751658439636, -0.02847563475370407, 0.12118245661258698, -0.12049199640750885, 0.5339971780776978, -0.2255847156047821, 0.2319435030221939, 0.2881903648376465, -0.13013039529323578, -0.32400521636009216, 0.18462230265140533, -0.023831553757190704, 0.31747862696647644, 0.3182228207588196, -0.1645926535129547, 0.042108505964279175, -0.4109329283237457, 0.01077953726053238, 0.2751616835594177, 0.15191325545310974, -0.16640502214431763, -0.008973917923867702, -0.004078079015016556, -0.19552235305309296, -0.041384220123291016, 0.0008284859359264374, 0.07780253887176514, -0.012564955279231071, 0.27226707339286804, 0.04332444816827774, 0.19962078332901, 0.10477901995182037, -0.040958989411592484, -0.3522129952907562, 0.019349105656147003, 0.06126530468463898, 0.034846410155296326, 0.17810140550136566, 0.06263972818851471, 0.2687905430793762, 0.025478504598140717, 0.10425979644060135, 0.23751287162303925, 0.13933143019676208, -0.17858529090881348, -0.25415360927581787, -0.07986758649349213, 0.15271048247814178, 0.020204368978738785, 0.01111681293696165, 0.1337011605501175, 0.05339118093252182, -0.19900105893611908, 0.13947218656539917, 0.4576880633831024, -0.07994985580444336, 0.36581507325172424, -0.05700627341866493, -0.08225435763597488, 0.13957223296165466, 0.20019930601119995, -0.08052361756563187, -0.4193035960197449, 0.18489903211593628, -0.25192755460739136, -0.30909308791160583, 0.12068497389554977, 0.23023073375225067, -0.20059213042259216, -0.10758191347122192, -0.10265905410051346, 0.45137861371040344, 0.17168322205543518, -0.20339639484882355, 0.07263880968093872, -0.15059436857700348, -0.2095639556646347, -0.26312997937202454, -0.01993856206536293, 0.12084128707647324, 0.11904706060886383, -0.2647760510444641, -0.12323018163442612, 0.10640117526054382, 0.015840739011764526, 0.3769041895866394, -0.17855404317378998, 0.23253604769706726, -0.24989700317382812, -0.04397589713335037, 0.2577628195285797, 0.16234292089939117, -0.2655155062675476, 0.23696380853652954, -0.03336897864937782, 0.23694582283496857, -0.07984428852796555, 0.3393925428390503, 0.3111051619052887, -0.3454427421092987, 0.17689308524131775, 0.3998107314109802, -0.28873124718666077, 0.014439156278967857, -0.11464504897594452, -0.21662534773349762, 0.09412747621536255, -0.13409839570522308, 0.12811800837516785, 0.2979218065738678, -0.15924537181854248, 0.20109833776950836, 0.32724642753601074, -0.2992740869522095, 0.2218552529811859, 0.12772729992866516, 0.13689738512039185, -0.07647399604320526, 0.04450505971908569, -0.3425854742527008, -0.42814934253692627, 0.030590079724788666, 0.14713941514492035, -0.144942507147789, 0.05058112367987633, -0.3162161707878113, -0.05860177427530289, -0.027390804141759872, -0.12752123177051544, 0.15832079946994781, 0.23021599650382996, 0.17739491164684296, -0.08737654238939285, -0.1417652666568756, -0.44823604822158813, 0.005967930890619755, 0.061748355627059937, -0.21373507380485535, -0.3994683027267456, 0.2020418494939804, 0.3028263449668884, 0.083280049264431, -0.02612810768187046, 0.15758788585662842, -0.02790401130914688, -0.21564337611198425, 0.1471693515777588, -0.03367844223976135, -0.00256802374497056, 0.09057480096817017, -0.12812578678131104, 0.8224422335624695, 0.1926395744085312, -0.0690729022026062, 0.15250907838344574, 0.1509867161512375, 0.07505688071250916, -0.18725447356700897, -0.3010603189468384, 0.29113391041755676, -0.5515795350074768, 0.2864969074726105, 0.03543735295534134, 0.13290926814079285, 0.2699669897556305, -0.083437480032444, -0.31211158633232117, -0.1841982752084732, -0.06747429072856903, 0.04801468551158905, 0.19637857377529144, -0.022411173209547997, -0.041897475719451904, 0.45407387614250183, 0.3945824205875397, -0.12281207740306854, 0.11434374749660492, 0.020145578309893608, -0.10373523086309433, -0.08054252713918686, 0.06144179403781891, 0.3171873390674591, 0.30288928747177124, 0.17900864779949188, 0.1989811658859253, 0.1018114909529686, 0.19980956614017487, 0.14052894711494446, 0.3691171109676361, 0.010828398168087006, 0.39396363496780396, 0.03899829462170601, 0.060129955410957336, 0.03551454842090607, -0.23488286137580872, -0.5078787803649902, 0.13618303835391998, 0.033404022455215454, 0.173706516623497, -0.02139272168278694, -0.11567023396492004, 0.0389949232339859, -0.1447107344865799, -0.36238574981689453, 0.13163776695728302, -0.36546093225479126, -0.06360878795385361, 0.3888738453388214, -0.15988317131996155, 0.3018016815185547, -0.07021019607782364, 0.30635008215904236, 0.08056306093931198, -0.40915530920028687, -0.21959125995635986, -0.2396528273820877, 0.21062541007995605, 0.17214365303516388, 0.1805161088705063, -0.3986368775367737, 0.3060978651046753, -0.22779761254787445, 0.04215535521507263, -0.25294411182403564, -0.2080320417881012, 0.17016258835792542, -0.1083383560180664, -0.09320437163114548, 0.18333029747009277, 0.1684233844280243, 0.25684452056884766, -0.12780582904815674, 0.016765611246228218, -0.20767396688461304, 0.013061845675110817, -0.13789041340351105, -0.01724468357861042, 0.03359774500131607, -0.03876075893640518, -0.0760754868388176, -0.13750921189785004, -0.3240436017513275, 0.4081290364265442, 0.05472658947110176, 0.14228960871696472, 0.22087499499320984, 0.01714387536048889, -0.07679732888936996, 0.3664483428001404, -0.08856700360774994, -0.127958282828331, -0.20855921506881714, 0.3068510890007019, -0.20508791506290436, -0.04699316248297691, -0.16398723423480988, -0.3167012929916382, 0.07904334366321564, 0.0817076712846756, -0.19148243963718414, -0.10836627334356308, -0.2756766676902771, 0.48612910509109497, 0.023832501843571663, -0.025784188881516457, 0.3851988911628723, 0.44305694103240967, -0.11347304284572601, -0.04721424728631973, -0.07295741140842438, -0.01586071401834488, 0.09361357241868973, 0.026660487055778503, 0.4163413941860199, 0.23341098427772522, 0.32531502842903137, 0.7197090983390808, 0.34161376953125, 0.08166041225194931, 0.16551938652992249, 0.009582098573446274, -0.02450462058186531, -0.2687034010887146, -0.4637399911880493, -0.31789636611938477, -0.31589093804359436, -0.2657478451728821, 0.1273287981748581, -0.06760034710168839, -0.4737481474876404, 0.09069515764713287, -0.2897450625896454, 0.03903551399707794, -0.2555003762245178, 0.27967044711112976, -0.2905777394771576, 0.16095954179763794, 0.14952631294727325, 0.0002259761095046997, -0.4020093083381653, 0.012324020266532898, 0.24015864729881287, -0.16137240827083588, 0.3014557659626007, -0.18874110281467438, -0.1254272609949112, 0.018728608265519142, -0.5409843325614929, 0.2663308084011078, 0.02682189829647541, -0.1772264689207077, 0.04961078241467476, -0.34282392263412476, -0.1690896898508072, -0.039381664246320724, 0.5930209159851074, -0.09771545231342316, -0.2225390523672104, 0.14748717844486237, -0.3926127552986145, -0.018481703475117683, 0.15250961482524872, -0.0382545180618763, 0.19366905093193054, 0.28919562697410583, 0.6319041848182678, -0.2656938135623932, -0.13101716339588165, 0.06299777328968048, 0.18180574476718903, -0.25381797552108765, 0.11291074007749557, 0.11975426971912384, -0.31246218085289, -0.2020927518606186, -0.1394824981689453, 0.1252806931734085, 0.05504082143306732, 0.19927990436553955, -0.06400085985660553, -0.4474315941333771, -0.04367838427424431, 0.13036710023880005, 0.060217563062906265, 0.06808765232563019, 0.08147086203098297, 0.24734929203987122, 0.13901790976524353, 0.009419851005077362, -0.2791948914527893, 0.37258368730545044, -0.07693354785442352, -0.21953290700912476, 0.011092995293438435, 0.16047260165214539, 0.12061703950166702, 0.13769172132015228, 0.20344771444797516, -0.07598041743040085, 0.18054133653640747, 0.17120788991451263, -0.5334353446960449, -0.16954189538955688, 0.07814814150333405, -0.06821396201848984, -0.2634061276912689, -0.6623310446739197, 0.4748312830924988, 0.13299445807933807, -0.23576553165912628, 0.2626339793205261, -0.2105627804994583, -0.21188399195671082, 0.603850245475769, 0.34312406182289124, 0.8547747731208801, -0.08271875977516174, 0.1284399926662445, 0.01812705025076866, 0.10211862623691559, 0.42203405499458313, -0.448036253452301, 0.2466081827878952, -0.26254040002822876, -0.8626648187637329, -0.10942216962575912, -0.03773584961891174, -0.21126925945281982, 0.10475237667560577, -0.32782989740371704, 0.29528412222862244, 0.1961524933576584, 0.024590611457824707, 0.03187313675880432, -0.09716245532035828, -0.09290828555822372, -0.22508659958839417, -0.11004886031150818, 0.2331024706363678, 0.16176030039787292, 0.11869578063488007, -0.04433880373835564, -0.2687501907348633, 0.1822817027568817, 0.13093537092208862, -0.05100715160369873, 0.023424584418535233, -0.10165583342313766, 0.2607027590274811, -0.12469080090522766, 0.04296717047691345, -0.15105147659778595, 0.11096727848052979, 0.1655580997467041, -0.07453618943691254, -0.15063051879405975, -0.03977726772427559, 0.11151722818613052, 0.2522055506706238, -0.1330121010541916, -0.12068884074687958, 0.3826630115509033, 0.031211279332637787, 0.2192399501800537, 0.037198182195425034, 0.13381829857826233, -0.1969679743051529, -0.3992379605770111, -0.0359547957777977, -0.018240340054035187, -0.31607529520988464, -0.16584423184394836, 0.5308963060379028, -0.025927022099494934, -0.08798344433307648, 0.18865594267845154, 0.06076974421739578, -0.062105268239974976, 0.4596724510192871, -0.26361221075057983, -0.09505106508731842, 0.04043387621641159, 0.1792922019958496, 0.3220440447330475, -0.0025321021676063538, 0.31401121616363525, -0.19023314118385315, -0.17499712109565735, -0.2166062593460083, 0.1401039958000183, 0.09449733793735504, -0.3919200003147125, 0.3505954444408417, -0.4366554617881775, -0.12039566785097122, -0.20863257348537445, 0.166168212890625, 0.17662586271762848, 0.24194908142089844, -0.24801413714885712, -0.061952583491802216, -0.24845965206623077, 0.28003770112991333, 0.1831701099872589, 0.4373408555984497, -0.1271907240152359, -0.07100416719913483, -0.08861486613750458, 0.20164692401885986, -0.445235013961792, -0.019297068938612938, -0.003941969946026802, 0.09707560390233994, -0.23682233691215515, -0.28519946336746216, 0.007499236613512039, 0.07910756766796112, 0.1744692325592041, 0.0908692255616188, -0.08201272785663605, -0.2824353575706482, -0.09141503274440765, 0.09282606095075607, 0.0024526696652173996, 0.05707523226737976, -0.04872776195406914, -0.10123798996210098, -0.15997131168842316, -0.4226287007331848, 0.21957941353321075, -0.0015767700970172882, 0.0740751177072525, -0.0042465063743293285, 0.03352969139814377, -0.28262627124786377, -0.19703437387943268, -0.11596493422985077, 0.3678811192512512, -0.03496730327606201, -0.20217368006706238, 0.2908383011817932, -0.12203614413738251, -0.22389119863510132, -0.1055811271071434, 0.3032180666923523, 0.451951801776886, -0.1956382393836975, 0.5510225296020508, 0.038600437343120575, -0.10493199527263641, 0.3370240330696106, 0.41590866446495056, 0.14514857530593872, -0.09687041491270065, 0.21840578317642212, 0.049331437796354294, 0.29392459988594055, -0.3348385989665985, -0.1175699457526207, 0.14010585844516754, 0.21802625060081482, 0.15474407374858856, 0.2503533661365509, -0.05365397408604622, -0.09725220501422882, 0.325676828622818, -0.1318964958190918, 0.28692370653152466, -0.40958625078201294, 0.1612233817577362, 0.2823927700519562, 0.23168237507343292, -0.1674400418996811, 0.26751604676246643, 0.1783490628004074, 0.4447273015975952, 0.3282501697540283, -0.1186421737074852, 0.125501811504364, 0.1574314534664154, -0.13104328513145447, 0.2519019544124603, -0.03616636246442795, 0.002412930130958557, 0.19322670996189117, 0.06381118297576904, 0.28510844707489014, 0.22688521444797516, -0.29621511697769165, 0.11288824677467346, -0.14887961745262146, -0.19749313592910767, 0.5247459411621094, -0.08395984023809433, -0.19737336039543152, 0.18043629825115204, -0.17087502777576447, -0.2807242274284363, -0.08883589506149292, -0.13376446068286896, -0.2867134213447571, 0.5062413215637207, 0.07101673632860184, 0.495947003364563, 0.03754563257098198, 0.3091534376144409, 0.0632205680012703, 0.47093114256858826, -0.3135354816913605, -0.009496694430708885, 0.16955263912677765, -0.23568734526634216, -0.2676197290420532, 0.5619533658027649, 0.19402576982975006, 0.2828819453716278, -0.346420019865036, 0.4162496030330658, -0.20895476639270782, -0.243545800447464, -0.1042533665895462, 0.21203435957431793, -0.2009192407131195, 0.12348173558712006, 0.26522067189216614, 0.1744295209646225, -0.1215098649263382, 0.3065633475780487, -0.002400629222393036, -0.028749294579029083, -0.26116272807121277, 0.45497405529022217, 0.1906028538942337, -0.13044576346874237, 0.19325411319732666, -0.03060634434223175, -0.13328099250793457, -0.3156583905220032, 0.22124765813350677, -0.5098289847373962, 0.21271377801895142, 0.062339287251234055, 0.1398385912179947, -0.13094639778137207, 0.1479613333940506, 0.07550260424613953, 0.09160986542701721, -0.15813863277435303, -0.08480872213840485, -0.09484733641147614, -0.04064632207155228, 0.18308082222938538, 0.07833514362573624, 0.17559954524040222, 0.1630060225725174, 0.10674185305833817, 0.31464630365371704, -0.283441424369812, -0.36213812232017517, -0.28047776222229004, 0.47479286789894104, 0.14417783915996552, -0.12519550323486328, -0.07486841082572937, 0.09191552549600601, 0.15403038263320923, -0.4835822284221649, 0.0017717741429805756, -0.28703126311302185, 0.14075219631195068, 0.04230223596096039, 0.07955645024776459, 0.1859772950410843, -0.1534363180398941, 0.33688676357269287, 0.3390096127986908, -0.1899275779724121, -0.15907099843025208, -0.04017369821667671, 0.026577595621347427, -0.18489183485507965, -0.2052430659532547, 0.2489740550518036, 0.18932634592056274, 0.08197463303804398, -0.2673250138759613, -0.03477559611201286, -0.1641520857810974, -0.1506538987159729, 0.23302997648715973, 0.22401642799377441, -0.3638797700405121, 0.20128212869167328, -0.44334596395492554, 0.1945219784975052, -0.003912579268217087, 0.5423682928085327, -0.06972180306911469, 0.34753116965293884, -0.11040932685136795, -0.25509750843048096, 0.28210076689720154, -0.42803120613098145, -0.43819931149482727, 0.17938847839832306, 0.08381448686122894, 0.20433980226516724, -0.11215382069349289, 0.023639194667339325, -0.04952237010002136, 0.3574736416339874, -0.13150054216384888, -0.13598968088626862, 0.16879373788833618, 0.17515139281749725, -0.25343626737594604, -0.21599535644054413, 0.6188023090362549, 0.07267161458730698, -0.3496228754520416, 0.04014436528086662, -0.4111829996109009 ]
https://github.com/huggingface/datasets/issues/6012
[FR] Transform Chaining, Lazy Mapping
I wonder if it would be beneficial to have a dedicated method to do that ? Maybe a `.save_to_disk()` so that the user can reload the resulting dataset later ?
### Feature request Currently using a `map` call processes and duplicates the whole dataset, which takes both time and disk space. The solution is to allow lazy mapping, which is essentially a saved chain of transforms that are applied on the fly whenever a slice of the dataset is requested. The API should look like `map`, as `set_transform` changes the current dataset while `map` returns another dataset. ### Motivation Lazy processing allows lower disk usage and faster experimentation. ### Your contribution _
30
[FR] Transform Chaining, Lazy Mapping ### Feature request Currently using a `map` call processes and duplicates the whole dataset, which takes both time and disk space. The solution is to allow lazy mapping, which is essentially a saved chain of transforms that are applied on the fly whenever a slice of the dataset is requested. The API should look like `map`, as `set_transform` changes the current dataset while `map` returns another dataset. ### Motivation Lazy processing allows lower disk usage and faster experimentation. ### Your contribution _ I wonder if it would be beneficial to have a dedicated method to do that ? Maybe a `.save_to_disk()` so that the user can reload the resulting dataset later ?
[ -0.1378847360610962, -0.2570561170578003, -0.16355741024017334, -0.2913748621940613, 0.0028413981199264526, 0.06371340900659561, -0.05337003245949745, 0.3641149699687958, 0.09568753838539124, 0.07889712601900101, 0.04469800740480423, 0.5188761353492737, -0.3693695366382599, 0.13355118036270142, 0.10490116477012634, -0.007591418921947479, 0.18340212106704712, 0.25660330057144165, -0.2667595446109772, -0.04112112149596214, -0.4068526327610016, 0.10360740125179291, 0.04370522499084473, -0.20536912977695465, -0.03370329737663269, -0.121956966817379, -0.2617632746696472, -0.3155907392501831, 0.04178176820278168, 0.01682896539568901, 0.2656623423099518, 0.3588204085826874, -0.029107093811035156, 0.04488055408000946, -0.00010774569091154262, -0.01634383201599121, -0.06844387948513031, -0.07997562736272812, -0.03739409148693085, -0.19757674634456635, -0.4175582230091095, -0.2746680676937103, -0.023900453001260757, -0.3657173216342926, -0.0018337778747081757, -0.2169349193572998, 0.2918672561645508, -0.542839765548706, 0.4798901677131653, -0.29778632521629333, 0.2390902191400528, -0.2051278054714203, -0.44616878032684326, -0.13492824137210846, 0.08347628265619278, 0.28811758756637573, -0.05581733584403992, -0.10946148633956909, 0.11887616664171219, 0.09174776822328568, -0.1140485480427742, 0.2652909457683563, -0.08381937444210052, -0.28155168890953064, 0.5761288404464722, -0.11033003032207489, 0.07959596067667007, -0.38181594014167786, 0.04426233097910881, 0.005267191678285599, 0.15364286303520203, -0.19591611623764038, -0.197843998670578, -0.3995015025138855, -0.2755493223667145, -0.04295942932367325, -0.29426252841949463, -0.002331143245100975, 0.08325612545013428, 0.18006116151809692, -0.4008501470088959, -0.427329957485199, 0.04619660973548889, 0.062328699976205826, 0.2072039246559143, -0.10736264288425446, -0.005481036379933357, -0.08627486974000931, 0.22259801626205444, 0.01606721058487892, 0.4143323004245758, -0.2876678705215454, 0.11755706369876862, 0.2208441197872162, -0.09267117083072662, -0.34956198930740356, 0.1244242787361145, 0.058792080730199814, 0.13554924726486206, 0.3512803912162781, 0.011969349347054958, 0.11856234073638916, -0.28871387243270874, 0.04645700752735138, 0.11614812910556793, 0.2071112096309662, -0.10460338741540909, -0.05086866393685341, 0.17305096983909607, -0.3332083225250244, 0.06683313846588135, 0.08801646530628204, 0.17539818584918976, 0.12321185320615768, 0.1534060686826706, 0.009519637562334538, 0.11724595725536346, 0.12908272445201874, 0.012689715251326561, -0.28079965710639954, 0.08983210474252701, 0.05164894834160805, -0.08587347716093063, 0.3886181116104126, 0.05133833363652229, 0.3094940781593323, 0.24435074627399445, 0.05242198333144188, 0.11164537817239761, 0.21109899878501892, -0.12093997001647949, -0.2259778380393982, -0.06624016910791397, 0.16953694820404053, 0.05008229985833168, 0.08225812017917633, 0.07067203521728516, 0.06508839130401611, -0.19854886829853058, -0.0007717348635196686, 0.4335707128047943, 0.05791303887963295, 0.33656802773475647, -0.036352772265672684, -0.053788281977176666, 0.09406308084726334, 0.16801638901233673, 0.029740378260612488, -0.4073691666126251, 0.3570247292518616, -0.42337414622306824, -0.2999285161495209, 0.13046292960643768, 0.1965852826833725, -0.07624597102403641, -0.15250839293003082, -0.18244993686676025, 0.49727863073349, 0.07483849674463272, -0.25163206458091736, 0.16212525963783264, 0.036578401923179626, -0.32273897528648376, -0.26236164569854736, -0.11446201801300049, 0.017728641629219055, 0.12008857727050781, -0.2875858545303345, -0.18844342231750488, 0.18065491318702698, -0.1040111854672432, 0.25336650013923645, -0.1849328875541687, 0.15565600991249084, -0.14087717235088348, 0.1606011688709259, 0.4291301369667053, 0.14740538597106934, -0.15746106207370758, 0.1238572970032692, -0.1566430926322937, -0.0627385675907135, -0.04690440744161606, 0.45267656445503235, 0.5610387325286865, -0.2792280614376068, 0.10544916242361069, 0.36280572414398193, -0.07975953817367554, 0.19999735057353973, -0.09456314891576767, -0.2755802869796753, -0.0650734007358551, -0.1347043365240097, 0.0625636875629425, 0.2425645887851715, -0.005846582353115082, 0.35527732968330383, 0.3489547073841095, -0.2733611464500427, 0.2650178372859955, 0.18644297122955322, 0.09238395094871521, -0.17812585830688477, -0.15148688852787018, -0.11473945528268814, -0.4710922837257385, -0.0678412988781929, 0.0955883115530014, -0.2967882454395294, 0.19008685648441315, -0.30658775568008423, 0.15909618139266968, -0.08719097077846527, -0.04056486114859581, 0.2003633826971054, 0.14824382960796356, 0.14957311749458313, -0.1846850961446762, -0.041321683675050735, -0.30525991320610046, -0.062453627586364746, 0.16103780269622803, -0.14691349864006042, -0.312510222196579, 0.3063059151172638, 0.25825268030166626, 0.08391104638576508, -0.10277403891086578, -0.03712404519319534, -0.06882058829069138, -0.17897912859916687, 0.16379064321517944, 0.0019903667271137238, 0.08736807107925415, 0.21218399703502655, -0.07993636280298233, 0.7097306847572327, 0.18178465962409973, -0.08665664494037628, 0.32766127586364746, 0.12366713583469391, 0.06051476299762726, -0.17836827039718628, -0.4128033220767975, 0.3437909483909607, -0.45187780261039734, 0.19077995419502258, -0.11734277009963989, 0.026861468330025673, 0.12088431417942047, -0.11806909739971161, -0.1738545298576355, -0.23590029776096344, 0.045349083840847015, 0.11640924215316772, 0.20540869235992432, 0.007589258253574371, -0.029339440166950226, 0.3623470067977905, 0.26101815700531006, -0.1633833646774292, 0.16829729080200195, 0.1372840255498886, 0.11041562259197235, -0.13516226410865784, -0.021423613652586937, 0.370374470949173, 0.37519076466560364, 0.18348334729671478, 0.1015746146440506, 0.05136121064424515, 0.31132611632347107, 0.019833575934171677, 0.37299346923828125, 0.015980001538991928, 0.463626503944397, 0.023490961641073227, 0.14530900120735168, -0.00885122362524271, -0.2779039740562439, -0.3804457187652588, 0.20717982947826385, -0.11200261116027832, 0.1772225946187973, -0.1531926542520523, -0.08765292912721634, 0.055166974663734436, -0.15745264291763306, -0.4819030463695526, 0.040985412895679474, -0.3561178743839264, 0.01891244389116764, 0.15642192959785461, -0.28221189975738525, 0.3388903737068176, -0.0545000322163105, 0.5393373370170593, -0.08611275255680084, -0.3787859380245209, -0.32382693886756897, -0.22338181734085083, 0.30264121294021606, 0.07593436539173126, -0.033476822078228, -0.3740915358066559, 0.29173994064331055, -0.21893680095672607, 0.15336009860038757, -0.19090507924556732, -0.30067676305770874, 0.14509084820747375, -0.026265069842338562, -0.18991713225841522, 0.11901510506868362, 0.24264095723628998, 0.2388898879289627, -0.09653329849243164, -0.18167485296726227, -0.29749709367752075, -0.06691516935825348, -0.28311148285865784, 0.21573935449123383, 0.11642187088727951, -0.16847681999206543, 0.021037906408309937, -0.1649705171585083, -0.3678939640522003, 0.4640984535217285, -0.039600323885679245, 0.06899664551019669, -0.11321071535348892, 0.013310783542692661, -0.10480254888534546, 0.22000057995319366, -0.1430397778749466, -0.11316107958555222, -0.3008553981781006, 0.24781565368175507, -0.30256175994873047, 0.011900780722498894, -0.16534173488616943, -0.14923980832099915, -0.02200252190232277, 0.036145955324172974, -0.37848013639450073, -0.11451950669288635, -0.21533921360969543, 0.4957659840583801, -0.011519994586706161, 0.10062982887029648, 0.4411487281322479, 0.3957621157169342, -0.08631185442209244, -0.06987420469522476, -0.2807299494743347, -0.05276487022638321, 0.2691289186477661, 0.03671402484178543, 0.18307125568389893, 0.22067314386367798, 0.3152136504650116, 0.694239616394043, 0.18847931921482086, 0.024689195677638054, 0.15774965286254883, 0.17861799895763397, 0.17441554367542267, -0.2002442181110382, -0.25438612699508667, -0.40828272700309753, -0.34884193539619446, -0.28313732147216797, 0.09979428350925446, -0.05003151297569275, -0.5292696952819824, 0.16503730416297913, -0.45054709911346436, 0.009160283952951431, -0.19095110893249512, 0.2600668668746948, -0.2841539978981018, 0.08395672589540482, 0.1933337152004242, 0.06228305399417877, -0.44039157032966614, -0.016454268246889114, 0.2648787498474121, -0.07050278782844543, 0.462494432926178, -0.18003879487514496, 0.03700604662299156, 0.005232346244156361, -0.616401195526123, 0.36022984981536865, 0.007946967147290707, -0.2828769385814667, 0.006097409874200821, -0.22315022349357605, -0.18870379030704498, 0.07377801835536957, 0.47983241081237793, -0.08266759663820267, -0.23991604149341583, -0.01982816308736801, -0.5475897192955017, -0.021337801590561867, 0.14421774446964264, 0.11312995851039886, -0.11706116795539856, 0.2556135058403015, 0.6806005239486694, -0.1965324878692627, -0.08068560063838959, 0.03653566539287567, 0.15293432772159576, -0.3947073817253113, 0.0630187839269638, 0.16157442331314087, -0.3188187777996063, -0.2772623300552368, -0.029459752142429352, 0.051183298230171204, -0.14801834523677826, 0.2973666191101074, 0.03617298975586891, -0.26654237508773804, 0.09723658114671707, -0.0030266791582107544, -0.08985847234725952, 0.08157128840684891, 0.24547642469406128, 0.09436537325382233, 0.01166587509214878, -0.027464762330055237, -0.24934592843055725, 0.27694225311279297, -0.2975118160247803, -0.05286185443401337, 0.14368689060211182, 0.14274773001670837, 0.17462866008281708, 0.24151524901390076, 0.32033348083496094, 0.024807989597320557, 0.29599103331565857, 0.19434499740600586, -0.6192482113838196, -0.1640312224626541, 0.013572582975029945, -0.03703847527503967, -0.3222171366214752, -0.554305374622345, 0.5445977449417114, 0.13977475464344025, -0.2055395245552063, 0.1691523790359497, -0.2239672988653183, -0.25318169593811035, 0.7534158825874329, 0.4942324459552765, 0.9249066114425659, -0.03450186550617218, 0.36967945098876953, -0.16611886024475098, -0.10288822650909424, 0.5102327466011047, -0.4636935591697693, 0.22574612498283386, -0.3061913847923279, -0.6893766522407532, -0.1834845095872879, -0.05967388674616814, -0.23677211999893188, -0.02143910527229309, -0.40435099601745605, 0.18758584558963776, 0.31969064474105835, -0.0582164041697979, -0.017167171463370323, -0.14359726011753082, 0.016328200697898865, -0.32789695262908936, 0.05695291981101036, 0.18695655465126038, 0.16892683506011963, 0.14384804666042328, -0.18915656208992004, -0.22807860374450684, 0.0180506594479084, 0.051189810037612915, 0.015854381024837494, -0.013504435308277607, 0.01688772439956665, 0.4921060800552368, -0.3884326219558716, 0.14639759063720703, -0.16207198798656464, 0.1184542179107666, 0.006533697247505188, 0.06198020651936531, -0.10883828997612, -0.019843202084302902, 0.031410153955221176, 0.3074149191379547, -0.06635764986276627, -0.22502493858337402, 0.4273826479911804, 0.033954598009586334, 0.2188687026500702, -0.06516862660646439, 0.010271347127854824, -0.23521195352077484, -0.6658638119697571, 0.08588019013404846, -0.28396934270858765, -0.1287062168121338, -0.2062135487794876, 0.5395953059196472, -0.05431440472602844, -0.13706086575984955, 0.1164361983537674, 0.10933792591094971, 0.004931068047881126, 0.5606020092964172, -0.13669098913669586, -0.20199570059776306, 0.03972272202372551, 0.3595418930053711, 0.2636094391345978, -0.041206907480955124, 0.2015434354543686, -0.26897141337394714, -0.26818910241127014, -0.23080000281333923, 0.3116104006767273, -0.03820518031716347, -0.3687262237071991, 0.32939398288726807, -0.6216781139373779, -0.19205820560455322, -0.19672895967960358, 0.1431860476732254, 0.22520843148231506, 0.21605387330055237, -0.18512670695781708, -0.02198006585240364, -0.2761627733707428, 0.26978617906570435, 0.12032610177993774, 0.4486376941204071, -0.032965052872896194, 0.0054517388343811035, -0.02916836366057396, 0.22056786715984344, -0.3693748712539673, 0.0042374879121780396, 0.05457959324121475, 0.047130223363637924, -0.2774960696697235, -0.1505749225616455, 0.02162623591721058, 0.02874671295285225, 0.02764315716922283, 0.10546165704727173, -0.14865781366825104, -0.1622842252254486, -0.15617826581001282, 0.13929778337478638, -0.07754509896039963, 0.30852586030960083, -0.06640755385160446, -0.13530811667442322, -0.00566801056265831, -0.311419278383255, 0.03053291141986847, 0.08611003309488297, -0.02818882465362549, -0.16127660870552063, 0.07639391720294952, -0.33229535818099976, -0.09224435687065125, 0.07672463357448578, 0.4090122580528259, 0.010789282619953156, -0.30910542607307434, 0.34336230158805847, -0.20728102326393127, -0.2030935436487198, -0.034567490220069885, 0.2488710582256317, 0.49311667680740356, -0.10161679238080978, 0.40142324566841125, 0.04209025949239731, -0.09192675352096558, 0.23763103783130646, 0.4645021855831146, 0.041334282606840134, -0.03043418750166893, 0.12730099260807037, 0.006869832053780556, 0.23184141516685486, -0.185724675655365, -0.1098722293972969, 0.36444857716560364, 0.2033945620059967, 0.049244437366724014, 0.20420381426811218, -0.020879309624433517, 0.028997190296649933, 0.05594037100672722, -0.05895758792757988, 0.20139145851135254, -0.48389339447021484, 0.17536050081253052, 0.22553522884845734, 0.03642437234520912, -0.02578163519501686, 0.37135857343673706, 0.2832126021385193, 0.43870171904563904, 0.20796504616737366, -0.06625422090291977, 0.24755434691905975, 0.23241084814071655, -0.07719069719314575, 0.05001015216112137, -0.04240184277296066, 0.08205126971006393, 0.09103959798812866, 0.03674309700727463, 0.3529301583766937, 0.33545804023742676, -0.291842520236969, 0.1139063686132431, -0.13280509412288666, -0.2879738509654999, 0.7678229808807373, -0.14989420771598816, -0.23181892931461334, 0.2339017391204834, -0.16240455210208893, -0.0910896360874176, 0.061774786561727524, -0.0850868672132492, -0.18499326705932617, 0.5679843425750732, 0.29580944776535034, 0.5288452506065369, 0.3335319757461548, 0.01779765821993351, -0.05724285542964935, 0.4099786877632141, -0.33846035599708557, -0.21803952753543854, 0.06362766027450562, -0.22784709930419922, -0.2453477680683136, 0.4253392219543457, 0.12006935477256775, 0.09758588671684265, -0.18927231431007385, 0.4555051028728485, -0.13891451060771942, -0.05778523534536362, -0.13804784417152405, 0.2279151976108551, 0.010098360478878021, 0.1587297022342682, 0.34469419717788696, 0.1521090567111969, -0.08668962866067886, 0.32174763083457947, 0.09392359852790833, 0.047181859612464905, -0.116631418466568, 0.48013928532600403, 0.3063777983188629, -0.1255665272474289, 0.17031046748161316, 0.0649476870894432, -0.10905762761831284, -0.01046812068670988, 0.2166830152273178, -0.5680665373802185, 0.09768937528133392, 0.1080097034573555, 0.10024158656597137, -0.047731343656778336, 0.22659780085086823, 0.0839318186044693, -0.05059828609228134, -0.17387185990810394, -0.11322417855262756, -0.0931054949760437, -0.028643153607845306, 0.21390682458877563, 0.17328418791294098, 0.09279673546552658, 0.044279903173446655, 0.19483989477157593, 0.19001157581806183, -0.2689759135246277, -0.4681646525859833, -0.21580716967582703, 0.4961356818675995, 0.022723622620105743, 0.08114159852266312, -0.04784296452999115, 0.08943954855203629, 0.21492944657802582, -0.374684602022171, 0.006683509796857834, 0.020554348826408386, 0.10699989646673203, -0.08746013790369034, 0.19239690899848938, -0.014106768183410168, -0.13425292074680328, 0.484535813331604, 0.24328351020812988, -0.22940793633460999, -0.27382010221481323, -0.08206705003976822, 0.18448904156684875, -0.1671002358198166, -0.12744972109794617, 0.0870039239525795, 0.16461117565631866, 0.10322098433971405, -0.29038798809051514, -0.03821014240384102, -0.22158604860305786, -0.32097697257995605, 0.10663428902626038, 0.40118739008903503, -0.35017114877700806, 0.11664915829896927, -0.415538489818573, 0.1137615442276001, 0.09356783330440521, 0.5771234035491943, 0.0628124549984932, 0.39211905002593994, -0.13751628994941711, -0.1621169149875641, 0.34160315990448, -0.39483022689819336, -0.41467535495758057, 0.11264735460281372, 0.11613520979881287, 0.04981500655412674, -0.11093560606241226, -0.04288026690483093, -0.05941145122051239, 0.28161102533340454, -0.20585286617279053, -0.14074987173080444, 0.2790808379650116, 0.018069956451654434, -0.26999178528785706, -0.1575489193201065, 0.6834229230880737, 0.12727557122707367, -0.3088299632072449, 0.0946103185415268, -0.4918438792228699 ]
https://github.com/huggingface/datasets/issues/6012
[FR] Transform Chaining, Lazy Mapping
> ```python > from functools import partial > from datasets import Dataset > > def gen_from_iterable_dataset(iterable_ds) > yield from iterable_ds > > ds = Dataset.from_generator(partial(gen_from_iterable_dataset, iterable_ds), features=iterable_ds.features}) > ``` @mariosasko With these complex mapping functions, what hash will be used to cache this dataset?
### Feature request Currently using a `map` call processes and duplicates the whole dataset, which takes both time and disk space. The solution is to allow lazy mapping, which is essentially a saved chain of transforms that are applied on the fly whenever a slice of the dataset is requested. The API should look like `map`, as `set_transform` changes the current dataset while `map` returns another dataset. ### Motivation Lazy processing allows lower disk usage and faster experimentation. ### Your contribution _
44
[FR] Transform Chaining, Lazy Mapping ### Feature request Currently using a `map` call processes and duplicates the whole dataset, which takes both time and disk space. The solution is to allow lazy mapping, which is essentially a saved chain of transforms that are applied on the fly whenever a slice of the dataset is requested. The API should look like `map`, as `set_transform` changes the current dataset while `map` returns another dataset. ### Motivation Lazy processing allows lower disk usage and faster experimentation. ### Your contribution _ > ```python > from functools import partial > from datasets import Dataset > > def gen_from_iterable_dataset(iterable_ds) > yield from iterable_ds > > ds = Dataset.from_generator(partial(gen_from_iterable_dataset, iterable_ds), features=iterable_ds.features}) > ``` @mariosasko With these complex mapping functions, what hash will be used to cache this dataset?
[ -0.006097901612520218, -0.42071229219436646, -0.15540745854377747, -0.06829307973384857, 0.06173672527074814, 0.19080334901809692, 0.02012288197875023, 0.4010327160358429, 0.13905228674411774, -0.03475162386894226, 0.12666432559490204, 0.21405458450317383, -0.3584165871143341, 0.1618133783340454, 0.1536332070827484, -0.04624482989311218, 0.18389104306697845, 0.1200520247220993, -0.2854897081851959, -0.2076570987701416, -0.524495542049408, 0.05155337601900101, 0.0671098381280899, -0.28747910261154175, -0.18531042337417603, 0.009396715089678764, -0.20644012093544006, -0.12844139337539673, 0.0030853794887661934, -0.14619863033294678, 0.1823466271162033, 0.26398763060569763, -0.014489183202385902, -0.0014833807945251465, -0.00010380809544585645, 0.029831968247890472, -0.005415119230747223, -0.17578861117362976, 0.1402347981929779, -0.21134813129901886, -0.5405325293540955, -0.42480698227882385, -0.18164661526679993, -0.3016824424266815, -0.06113653630018234, -0.14860676229000092, 0.2457992136478424, -0.5571874380111694, 0.4125860929489136, -0.09084483236074448, 0.28221288323402405, -0.2110397219657898, -0.27058714628219604, -0.013683432713150978, 0.28504112362861633, -0.06743760406970978, -0.05093139782547951, -0.1656932532787323, -0.06376069784164429, 0.08217653632164001, -0.049522481858730316, 0.38518795371055603, -0.08900551497936249, -0.12626689672470093, 0.5562276244163513, 0.05415046960115433, 0.230253666639328, -0.3974744379520416, 0.18957126140594482, -0.061502568423748016, 0.1961435228586197, -0.15796419978141785, -0.13191048800945282, -0.16137290000915527, -0.49298790097236633, -0.06083856523036957, 0.02252708375453949, -0.03463486582040787, 0.1362251341342926, 0.016431612893939018, -0.4357888400554657, -0.15994621813297272, 0.09747789800167084, 0.0488053597509861, 0.23200851678848267, -0.15821953117847443, -0.0033403579145669937, -0.036263421177864075, 0.1365906149148941, -0.07832466065883636, 0.2523050904273987, -0.2558574378490448, 0.2747023403644562, 0.31232067942619324, -0.03736627474427223, -0.18162086606025696, 0.23412859439849854, 0.08900387585163116, 0.1605667769908905, 0.3151301145553589, -0.21827912330627441, 0.11972736567258835, -0.06905928999185562, 0.1464882493019104, -0.03672216460108757, 0.08068373799324036, -0.007745802402496338, -0.10604128986597061, -0.04141804575920105, -0.372383713722229, -0.2706640064716339, -0.024792127311229706, 0.14060764014720917, 0.04342810437083244, 0.3049871623516083, -0.020270399749279022, 0.10833655297756195, 0.11137343943119049, 0.16189277172088623, -0.07864832133054733, -0.02779575251042843, -0.04458463937044144, 0.06108193099498749, 0.23596227169036865, 0.012555675581097603, 0.22496482729911804, -0.005133386701345444, -0.09076394885778427, 0.1512029767036438, 0.21570183336734772, -0.33788996934890747, -0.09788806736469269, -0.0892678052186966, 0.16580478847026825, 0.12091480195522308, -0.06991855800151825, 0.19586223363876343, 0.09782125800848007, -0.15780490636825562, -0.002893943339586258, 0.5061015486717224, -0.017845449969172478, 0.43076789379119873, 0.09801622480154037, -0.12861621379852295, 0.07678873836994171, 0.1728801280260086, 0.18207760155200958, -0.45029741525650024, 0.06899642944335938, -0.38500818610191345, -0.43022620677948, 0.2517958879470825, 0.25795790553092957, -0.21287426352500916, 0.08832544088363647, 0.022876590490341187, 0.35079559683799744, 0.24264276027679443, -0.07227808237075806, 0.17344024777412415, 0.06045905500650406, -0.24214057624340057, -0.44214141368865967, -0.04881279170513153, 0.20021569728851318, 0.2549336552619934, -0.2545987367630005, 0.03783100098371506, 0.2054995596408844, 0.006471559405326843, 0.2868158221244812, -0.18049755692481995, -0.07959399372339249, -0.10463114827871323, 0.05654652416706085, 0.4062419831752777, -0.10700377821922302, -0.3988683819770813, 0.09517182409763336, 0.06787548959255219, -0.016877328976988792, 0.10298356413841248, 0.3484226167201996, 0.24971425533294678, -0.44795483350753784, 0.1901007890701294, 0.3399462103843689, -0.23554828763008118, -0.03523708134889603, -0.1661798357963562, -0.20213229954242706, -0.0003462359309196472, -0.14446794986724854, 0.43318748474121094, 0.028808623552322388, -0.08161427825689316, 0.2531787157058716, 0.026392724364995956, -0.08760376274585724, 0.24134096503257751, 0.14045557379722595, 0.07935095578432083, -0.0982985645532608, 0.12174779176712036, -0.21952104568481445, -0.27413210272789, 0.09804926067590714, 0.04826456308364868, -0.19348308444023132, -0.0721997320652008, -0.15325616300106049, 0.09435012936592102, -0.025349535048007965, -0.1443755179643631, 0.13311496376991272, 0.22456490993499756, 0.07152298092842102, 0.027007292956113815, -0.16004987061023712, -0.3639203906059265, 0.15280407667160034, 0.17253096401691437, -0.15975169837474823, -0.4002973437309265, 0.16198953986167908, 0.18741539120674133, 0.04266831651329994, -0.07698838412761688, 0.13008472323417664, 0.21279916167259216, -0.12987954914569855, 0.1537051498889923, -0.050055451691150665, 0.021277662366628647, -0.0564294159412384, -0.019764766097068787, 0.8647520542144775, 0.038597434759140015, -0.28615033626556396, 0.38579317927360535, 0.033072035759687424, 0.09901750832796097, -0.18223926424980164, -0.18041113018989563, 0.24362273514270782, -0.4571991562843323, 0.009571179747581482, -0.057695481926202774, 0.035823121666908264, 0.010995777323842049, -0.04217657074332237, -0.1754945069551468, -0.3424507975578308, 0.03766423091292381, -0.02233871817588806, 0.23357336223125458, 0.2239481657743454, 0.08175785839557648, 0.34049105644226074, 0.6746522188186646, -0.18892325460910797, 0.04842458292841911, 0.04405931383371353, -0.07520533353090286, -0.3690145015716553, -0.05145532637834549, 0.20620043575763702, 0.1628386378288269, 0.15924450755119324, 0.28634753823280334, 0.09518556296825409, 0.24378909170627594, 0.06183342635631561, 0.38450780510902405, -0.14643780887126923, 0.17792853713035583, -0.17902600765228271, 0.03171246126294136, -0.04981059208512306, -0.15818053483963013, -0.19235093891620636, 0.26325419545173645, 0.08301348984241486, 0.15890660881996155, 0.07562737911939621, -0.07383276522159576, 0.2649507522583008, -0.08510606735944748, -0.37720778584480286, -0.10396018624305725, -0.355867862701416, 0.054619766771793365, 0.2287941873073578, -0.09753018617630005, 0.21270687878131866, -0.26903101801872253, 0.18923962116241455, 0.07775628566741943, -0.5141379833221436, -0.23265404999256134, -0.238135427236557, 0.17140167951583862, 0.12788386642932892, 0.03725944086909294, -0.3817157745361328, 0.26035621762275696, -0.3847559094429016, 0.03151894360780716, -0.08208628743886948, -0.21495458483695984, 0.07411864399909973, -0.2184208482503891, -0.18050771951675415, 0.20171260833740234, 0.14153249561786652, 0.07524175941944122, -0.11216000467538834, 0.09641274809837341, -0.2831706702709198, -0.06375813484191895, -0.0499882809817791, 0.023261146619915962, 0.06753548234701157, 0.10076175630092621, -0.03362935036420822, -0.1794457733631134, -0.1895270198583603, 0.3570019602775574, 0.08931712806224823, 0.12375783175230026, 0.1306518167257309, -0.09168268740177155, -0.23031796514987946, 0.21069733798503876, -0.07737688720226288, -0.41425395011901855, -0.5082849264144897, 0.3958219289779663, -0.11853048205375671, 0.07038193941116333, -0.07052545249462128, -0.16902506351470947, 0.03225504606962204, 0.2908428907394409, -0.2544565200805664, -0.043220266699790955, -0.25346019864082336, 0.6065464019775391, 0.1664769947528839, 0.08825185894966125, 0.4455907940864563, 0.411330908536911, -0.17285332083702087, -0.24845650792121887, -0.1519498974084854, 0.09183193743228912, 0.17642280459403992, 0.1388072967529297, 0.31698092818260193, 0.2450312077999115, 0.34872370958328247, 0.890687882900238, 0.2872218191623688, 0.023548873141407967, 0.15583664178848267, 0.24777422845363617, 0.0712861567735672, -0.18948403000831604, -0.3361297845840454, -0.23338216543197632, -0.14990413188934326, -0.20686663687229156, 0.07586788386106491, -0.019148938357830048, -0.4193812608718872, -0.012024670839309692, -0.428750604391098, -0.21822303533554077, -0.257680207490921, 0.40852001309394836, -0.5120366811752319, 0.20817166566848755, 0.21957242488861084, 0.01654519885778427, -0.666378378868103, -0.07889018952846527, 0.22099748253822327, -0.1964632123708725, 0.2430187165737152, 0.0011953748762607574, 0.0410696379840374, 0.15305481851100922, -0.4505711793899536, 0.33270955085754395, 0.11832121014595032, -0.10515880584716797, -0.10334378480911255, -0.34780153632164, -0.16400636732578278, -0.060614969581365585, 0.5252108573913574, -0.21808983385562897, -0.06696774065494537, -0.020643454045057297, -0.5077693462371826, 0.08911120891571045, 0.16182765364646912, 0.07449449598789215, 0.21453283727169037, 0.24103325605392456, 0.34287628531455994, -0.24457401037216187, -0.08942151069641113, 0.02072145603597164, 0.04067494347691536, -0.19052448868751526, 0.03981548547744751, 0.1512293517589569, -0.2500784695148468, -0.03606173396110535, -0.1303192675113678, 0.053322091698646545, -0.10835398733615875, 0.23499161005020142, 0.14502879977226257, -0.3066597282886505, -0.008418450132012367, 0.2703377902507782, 0.03918398544192314, 0.03724158555269241, 0.11318958550691605, 0.17557495832443237, 0.1776151806116104, -0.05802202969789505, -0.32452017068862915, 0.2536177635192871, -0.11582410335540771, -0.20923280715942383, -0.08388589322566986, 0.15718212723731995, 0.026046469807624817, 0.22007787227630615, 0.07856862246990204, -0.14271017909049988, 0.2748287320137024, 0.11802617460489273, -0.3966486155986786, -0.245041623711586, 0.07578565925359726, 0.05635105073451996, -0.44073671102523804, -0.6332184672355652, 0.5218568444252014, 0.18761993944644928, -0.26048481464385986, 0.09132641553878784, -0.20957051217556, -0.259440153837204, 0.533493161201477, 0.42790091037750244, 1.0234061479568481, -0.1110001802444458, 0.25559383630752563, -0.0905473530292511, 0.24603135883808136, 0.4950604736804962, -0.4924578070640564, 0.17556972801685333, -0.25778937339782715, -0.7263482809066772, -0.18696585297584534, -0.11784109473228455, -0.2511714696884155, 0.034343868494033813, -0.17658071219921112, 0.3654805123806, 0.13819967210292816, 0.22242161631584167, -0.0029285065829753876, -0.30802077054977417, -0.08541785180568695, -0.12274307012557983, -0.19372712075710297, 0.26954174041748047, 0.2608332931995392, 0.1958041489124298, -0.12600553035736084, -0.2698947787284851, 0.06575044989585876, -0.12454809993505478, -0.04606667533516884, -0.02644256129860878, -0.0489371120929718, 0.3949264883995056, -0.1285105049610138, 0.005348682403564453, -0.3654981553554535, -0.020276334136724472, 0.27672916650772095, -0.11052973568439484, -0.10133926570415497, -0.07447533309459686, 0.25593581795692444, 0.12518249452114105, -0.05093611776828766, -0.10280558466911316, 0.4847354590892792, -0.05462965369224548, 0.11076685041189194, -0.01406417042016983, 0.08391059190034866, -0.251282662153244, -0.329281747341156, 0.10279190540313721, -0.2767176032066345, -0.16613870859146118, -0.1817014515399933, 0.33369430899620056, -0.16040323674678802, 0.03451309725642204, 0.20663517713546753, 0.059866975992918015, -0.17524266242980957, 0.455972820520401, -0.28154894709587097, -0.08676179498434067, 0.08077862858772278, 0.21105444431304932, 0.384404718875885, -0.06740505993366241, 0.19484446942806244, -0.21263183653354645, -0.3167918920516968, -0.18245649337768555, 0.0241653174161911, 0.06588827818632126, -0.2953396141529083, 0.29935765266418457, -0.4250229299068451, -0.1490401327610016, -0.20057164132595062, 0.17152000963687897, 0.17093399167060852, 0.18328134715557098, -0.09929907321929932, -0.0855814516544342, -0.39219406247138977, 0.32124951481819153, 0.07496286183595657, 0.35618627071380615, -0.1421360820531845, -0.012134060263633728, -0.024055415764451027, 0.3588620126247406, -0.44314658641815186, 0.10951077938079834, -0.1460641473531723, 0.10399487614631653, -0.18643397092819214, -0.29939213395118713, 0.16534265875816345, 0.15495218336582184, 0.16084997355937958, 0.054967544972896576, -0.41561421751976013, -0.25749537348747253, -0.04205188900232315, 0.10038306564092636, -0.10552928596735, -0.012762697413563728, -0.10764775425195694, -0.05300961434841156, -0.07638873159885406, -0.2461276352405548, 0.08772681653499603, 0.2629334330558777, 0.12402679026126862, 0.012774531729519367, -0.03463681414723396, -0.1935882270336151, -0.09668692201375961, 0.011488238349556923, 0.21879206597805023, 0.1618615984916687, -0.17601008713245392, 0.24866658449172974, -0.22434726357460022, -0.1308094561100006, -0.09292761236429214, 0.33228594064712524, 0.2587941288948059, -0.30266088247299194, 0.5378760695457458, -0.018969513475894928, -0.1477077603340149, 0.3111666142940521, 0.22168201208114624, 0.040145911276340485, -0.07741968333721161, 0.04209426790475845, -0.08931184560060501, 0.2857491672039032, -0.28764015436172485, -0.12528660893440247, 0.3017052114009857, 0.2421588897705078, 0.09614551067352295, 0.21128910779953003, 0.1286441534757614, -0.05592016130685806, 0.21424902975559235, -0.035804979503154755, 0.3331390619277954, -0.5263228416442871, 0.22370420396327972, 0.08316794037818909, 0.22744052112102509, 0.003581549972295761, 0.34908807277679443, 0.3984602987766266, 0.37143927812576294, 0.3413810729980469, -0.0428217276930809, 0.12574121356010437, 0.12962520122528076, -0.18898646533489227, 0.0025688186287879944, -0.13980142772197723, -0.013487696647644043, 0.36842402815818787, -0.018184587359428406, 0.3759779930114746, 0.10334831476211548, -0.12468192726373672, 0.20871615409851074, -0.016261417418718338, -0.2908898591995239, 0.5840548276901245, -0.10414185374975204, -0.3147052526473999, 0.28747910261154175, -0.22161683440208435, -0.3385528028011322, 0.009113892912864685, 0.03462224453687668, -0.23052306473255157, 0.7233474254608154, 0.24082320928573608, 0.5439285039901733, 0.13038204610347748, 0.19466862082481384, 0.07751531898975372, 0.4163288474082947, -0.34091323614120483, 0.052673399448394775, 0.2005290985107422, -0.37947022914886475, -0.05310838297009468, 0.12089100480079651, 0.2468392252922058, 0.0014420822262763977, -0.34318798780441284, 0.48708245158195496, -0.08435612916946411, -0.24780893325805664, -0.24796335399150848, 0.33799663186073303, 0.02445283532142639, 0.15853439271450043, 0.08397065103054047, 0.21410533785820007, -0.09246475994586945, 0.23509438335895538, -0.0685582160949707, 0.03725076839327812, 0.03296789154410362, 0.4892055094242096, 0.18119823932647705, -0.023780841380357742, 0.11650558561086655, 0.14483344554901123, -0.1621548980474472, -0.3805569112300873, 0.2409585863351822, -0.1588996946811676, 0.25365638732910156, 0.17049798369407654, 0.11846096813678741, -0.10783594846725464, 0.2375757247209549, 0.0057792067527771, 0.17686446011066437, -0.21254609525203705, 0.03107622265815735, 0.08417937159538269, -0.03112710267305374, 0.10557173192501068, 0.11997891962528229, 0.008729256689548492, 0.23134271800518036, 0.32433339953422546, 0.10950037837028503, -0.31814783811569214, -0.1675868183374405, -0.19816729426383972, 0.4713004529476166, 0.1795862764120102, 0.05528644472360611, -0.14940939843654633, 0.20317569375038147, 0.17631031572818756, -0.32331910729408264, -0.09684476256370544, -0.16707023978233337, 0.22006061673164368, -0.2620876431465149, -0.024368274956941605, 0.18320496380329132, -0.20964542031288147, 0.35787904262542725, 0.3832947611808777, -0.10771940648555756, -0.1963728964328766, -0.1388348937034607, 0.006874114274978638, -0.04490698128938675, -0.1007414236664772, 0.10516081750392914, 0.09961657226085663, 0.12303774058818817, -0.31098607182502747, 0.10759364068508148, -0.13339689373970032, -0.048684120178222656, 0.052895016968250275, 0.21306093037128448, -0.1977270245552063, 0.050029270350933075, -0.4467606246471405, 0.09383779019117355, 0.08230586349964142, 0.6097869277000427, -0.08123192191123962, 0.21183030307292938, -0.15569870173931122, -0.22066324949264526, 0.3618468642234802, -0.4927067756652832, -0.4350113868713379, -0.025474578142166138, 0.10905377566814423, 0.2090783417224884, -0.07275286316871643, -0.10693881660699844, -0.01767822355031967, 0.26852795481681824, -0.09303521364927292, -0.29704514145851135, 0.0872412770986557, 0.1233285665512085, -0.11941882967948914, -0.18971696496009827, 0.36874058842658997, -0.09544528275728226, -0.21310706436634064, -0.08509400486946106, -0.3592327833175659 ]
https://github.com/huggingface/datasets/issues/6012
[FR] Transform Chaining, Lazy Mapping
The params passed to `Dataset.from_generator` will be used to compute the hash (`partial` encapsulates the `iterable_ds` value, so changing it will also change the hash)
### Feature request Currently using a `map` call processes and duplicates the whole dataset, which takes both time and disk space. The solution is to allow lazy mapping, which is essentially a saved chain of transforms that are applied on the fly whenever a slice of the dataset is requested. The API should look like `map`, as `set_transform` changes the current dataset while `map` returns another dataset. ### Motivation Lazy processing allows lower disk usage and faster experimentation. ### Your contribution _
25
[FR] Transform Chaining, Lazy Mapping ### Feature request Currently using a `map` call processes and duplicates the whole dataset, which takes both time and disk space. The solution is to allow lazy mapping, which is essentially a saved chain of transforms that are applied on the fly whenever a slice of the dataset is requested. The API should look like `map`, as `set_transform` changes the current dataset while `map` returns another dataset. ### Motivation Lazy processing allows lower disk usage and faster experimentation. ### Your contribution _ The params passed to `Dataset.from_generator` will be used to compute the hash (`partial` encapsulates the `iterable_ds` value, so changing it will also change the hash)
[ -0.2502358555793762, -0.2847062349319458, -0.1987450122833252, -0.03752274811267853, 0.08460214734077454, -0.01908019930124283, 0.06320126354694366, 0.40587395429611206, 0.15362338721752167, 0.22613492608070374, 0.16613809764385223, 0.45469486713409424, -0.36086052656173706, 0.2259894758462906, 0.19368192553520203, 0.052076153457164764, 0.1212901771068573, 0.2374158650636673, -0.4160343408584595, -0.1793283075094223, -0.3923092484474182, 0.08101803064346313, -0.002773784101009369, -0.2089197188615799, 0.0426364466547966, -0.03949610888957977, -0.10877102613449097, -0.1173676922917366, -0.031007414683699608, -0.12447502464056015, 0.06200777739286423, 0.35461923480033875, -0.10153079777956009, -0.016969673335552216, -0.00009784785652300343, 0.09474441409111023, 0.024325460195541382, -0.0867554098367691, -0.009369617328047752, -0.23663415014743805, -0.5164351463317871, -0.18733838200569153, -0.2939298748970032, -0.3295288681983948, -0.04022523760795593, -0.22073327004909515, 0.17584216594696045, -0.514821469783783, 0.3671095371246338, -0.10925038903951645, 0.3262866139411926, -0.1570371389389038, -0.26487845182418823, -0.14343227446079254, 0.28868550062179565, 0.07484745234251022, -0.03490427881479263, -0.09581755101680756, -0.0790187269449234, 0.04554510861635208, -0.19725602865219116, 0.35677793622016907, -0.0756356343626976, -0.12584659457206726, 0.4577828347682953, -0.055977046489715576, 0.19276843965053558, -0.25100916624069214, 0.1723659634590149, 0.09110571444034576, 0.170953631401062, -0.25450223684310913, -0.2093432992696762, -0.0550118125975132, -0.46217694878578186, -0.10566916316747665, -0.02929706871509552, -0.024766026064753532, 0.0763142853975296, 0.1772233545780182, -0.3693868815898895, -0.11840945482254028, 0.03848307579755783, -0.04431263357400894, 0.14646044373512268, -0.07327760756015778, 0.03198278322815895, -0.014530256390571594, 0.2916386127471924, -0.04206642508506775, 0.24037718772888184, -0.07306957989931107, 0.07166557759046555, 0.18765658140182495, -0.1367429941892624, -0.27377432584762573, 0.18352249264717102, -0.014873236417770386, 0.2390386164188385, 0.3335648775100708, -0.02708403766155243, 0.16757497191429138, -0.1226864606142044, 0.12815000116825104, -0.040884312242269516, 0.03990643098950386, 0.03739793226122856, -0.09350528568029404, 0.04915618896484375, -0.4116586148738861, -0.06196814402937889, 0.02152550220489502, 0.12209451198577881, -0.12820999324321747, 0.1616184413433075, -0.01232847198843956, -0.0507013164460659, 0.187221959233284, 0.10628394037485123, -0.23781505227088928, 0.03794796019792557, -0.011857377365231514, 0.050289738923311234, 0.34355854988098145, 0.10291579365730286, 0.15152783691883087, 0.029524654150009155, -0.041980013251304626, 0.10558603703975677, 0.18413038551807404, -0.28156018257141113, -0.0645410418510437, -0.10373879224061966, 0.11001006513834, -0.018174821510910988, 0.015611974522471428, 0.08635283261537552, 0.014609548263251781, -0.07933677732944489, 0.12505090236663818, 0.4206797480583191, 0.08430860936641693, 0.4584713280200958, 0.05222436785697937, -0.02995687536895275, 0.022335359826683998, 0.053848858922719955, 0.05266451835632324, -0.4644775688648224, 0.1953977644443512, -0.2695426642894745, -0.3153713345527649, 0.17514482140541077, 0.3275696933269501, -0.10186155140399933, 0.03930066153407097, 0.07645905762910843, 0.4044545888900757, 0.12103446573019028, -0.1855163872241974, 0.19720448553562164, 0.058161716908216476, -0.2484571933746338, -0.324044793844223, -0.03526473045349121, 0.10663341730833054, 0.04730445519089699, -0.18134261667728424, -0.023164834827184677, 0.01708558015525341, -0.009180977940559387, 0.13034798204898834, -0.21363641321659088, -0.07047023624181747, -0.20464687049388885, 0.10312165319919586, 0.48995524644851685, 0.002219501882791519, -0.32024669647216797, 0.2265644669532776, -0.10675208270549774, -0.2013867050409317, 0.16015179455280304, 0.3531469404697418, 0.2589642107486725, -0.27702265977859497, 0.04460303485393524, 0.2566063404083252, -0.1579817235469818, 0.036887891590595245, -0.15752652287483215, -0.10661877691745758, -0.002343948930501938, -0.13214294612407684, 0.29345211386680603, 0.075316421687603, 0.03202119097113609, 0.2579033672809601, 0.2650335729122162, -0.22929129004478455, 0.26054832339286804, 0.12085242569446564, 0.1580614596605301, -0.37141430377960205, 0.1005328893661499, -0.2568524479866028, -0.20935380458831787, 0.05352330207824707, -0.048353228718042374, -0.05113818496465683, 0.022489048540592194, -0.1809638887643814, 0.025866985321044922, 0.04031684249639511, -0.06802418828010559, 0.19387346506118774, 0.25556811690330505, 0.1323414146900177, -0.10026705265045166, -0.19627642631530762, -0.400034099817276, -0.04815986752510071, -0.024084176868200302, -0.27710631489753723, -0.40516531467437744, 0.21362453699111938, 0.13349179923534393, 0.11887034773826599, -0.09718646109104156, -0.008024491369724274, 0.04166864603757858, -0.15886831283569336, 0.19989368319511414, 0.019107218831777573, 0.06943177431821823, 0.0848548486828804, -0.041442565619945526, 0.7669129371643066, 0.1232929602265358, -0.21823012828826904, 0.3333386182785034, 0.007399603724479675, 0.0028860922902822495, -0.15219898521900177, -0.2082928717136383, 0.36620789766311646, -0.5378219485282898, 0.10985375195741653, 0.02216527611017227, 0.05211380124092102, 0.23029252886772156, -0.09587578475475311, -0.2866115868091583, -0.34900373220443726, -0.03667939081788063, 0.13295961916446686, 0.16182345151901245, 0.17696377635002136, 0.09990932047367096, 0.28552091121673584, 0.612689733505249, -0.23320823907852173, -0.006979614496231079, 0.09168151021003723, 0.016914386302232742, -0.2707979679107666, -0.09494616091251373, 0.32525819540023804, 0.1630403697490692, 0.22708958387374878, 0.33052095770835876, -0.005825122818350792, 0.20747311413288116, -0.021363522857427597, 0.4539627134799957, -0.10869188606739044, 0.33076658844947815, 0.009491853415966034, 0.08201604336500168, -0.14309625327587128, -0.2889774739742279, -0.29614633321762085, 0.32792359590530396, 0.07327897846698761, 0.07040327787399292, 0.028034815564751625, -0.17824803292751312, 0.1900692582130432, -0.13283543288707733, -0.31075721979141235, -0.05167986825108528, -0.28515198826789856, 0.1086377426981926, 0.2053535282611847, -0.32281696796417236, 0.2608455419540405, -0.01643519289791584, 0.2760753333568573, 0.17152082920074463, -0.38178375363349915, -0.3543289005756378, -0.31896770000457764, 0.18499472737312317, 0.18349353969097137, 0.05567409098148346, -0.3798147737979889, 0.3363664150238037, -0.3269807696342468, 0.02498406171798706, -0.12802927196025848, -0.3301845192909241, 0.1948220431804657, -0.07808583974838257, -0.08905850350856781, 0.2638017237186432, 0.05483395233750343, 0.11532919108867645, -0.039673663675785065, -0.022982100024819374, -0.39668411016464233, -0.23466026782989502, -0.08426712453365326, 0.03877442702651024, 0.117268405854702, -0.19033777713775635, -0.1480952799320221, -0.08911219984292984, -0.3218715488910675, 0.4090738892555237, 0.03237563744187355, 0.31742703914642334, 0.07575009763240814, 0.0032422076910734177, -0.09920591861009598, 0.17586976289749146, -0.1383979320526123, -0.3455289304256439, -0.47040697932243347, 0.30140289664268494, -0.30182674527168274, -0.035942766815423965, -0.10389868915081024, -0.27117156982421875, 0.17031189799308777, 0.2697414755821228, -0.21601128578186035, -0.2051120400428772, -0.11965739727020264, 0.5024560689926147, 0.07892367243766785, 0.03589272499084473, 0.3334816098213196, 0.4211462438106537, -0.24345384538173676, -0.19623219966888428, -0.09723830223083496, 0.07113634049892426, 0.1515648365020752, 0.10392627865076065, 0.3564482033252716, 0.32880687713623047, 0.35345515608787537, 0.7433779835700989, 0.05004764720797539, -0.03192494437098503, 0.13397948443889618, -0.004221925511956215, 0.05489710345864296, -0.09132561832666397, -0.2843092381954193, -0.21202901005744934, -0.025295063853263855, -0.23271141946315765, 0.12344285845756531, -0.10167306661605835, -0.39558741450309753, 0.04396771639585495, -0.3228456974029541, -0.11249106377363205, -0.19419024884700775, 0.3405551314353943, -0.31396546959877014, 0.08232908695936203, 0.1732884645462036, 0.09968449920415878, -0.4387565851211548, 0.03638536483049393, 0.3306684195995331, -0.16127778589725494, 0.32172441482543945, -0.22173140943050385, 0.0620591901242733, 0.09946248680353165, -0.45331400632858276, 0.2926442623138428, 0.12652820348739624, -0.17023125290870667, -0.028881387785077095, -0.372749000787735, -0.17146970331668854, -0.1530832201242447, 0.6278868317604065, -0.14962626993656158, -0.09201550483703613, 0.04626442864537239, -0.5170495510101318, 0.0810186117887497, 0.2380216270685196, 0.04670403525233269, 0.0019276118837296963, 0.23232586681842804, 0.4222888648509979, -0.2986462712287903, -0.16090428829193115, 0.11848233640193939, -0.025058329105377197, -0.3068978786468506, -0.008353689685463905, 0.08759458363056183, -0.369306743144989, -0.19494961202144623, -0.07492033392190933, 0.01104256696999073, 0.01682964153587818, 0.16803233325481415, -0.019442584365606308, -0.20145581662654877, 0.022666994482278824, 0.18319490551948547, 0.032902419567108154, 0.07580592483282089, 0.08480077981948853, 0.08368460834026337, -0.009034786373376846, 0.04542148858308792, -0.19146402180194855, 0.16159342229366302, -0.11981111764907837, 0.020809054374694824, 0.010655295103788376, 0.08448609709739685, 0.0691661462187767, 0.194959357380867, 0.07339604198932648, 0.011724710464477539, 0.2456071674823761, 0.14282310009002686, -0.4911515712738037, -0.1311548352241516, 0.06460243463516235, -0.1183587908744812, -0.3072105646133423, -0.562944233417511, 0.5829662680625916, 0.16482600569725037, -0.2873886823654175, 0.17208823561668396, -0.1732504516839981, -0.3163073658943176, 0.5441625714302063, 0.48379001021385193, 1.0000618696212769, -0.042202673852443695, 0.1518581509590149, 0.05863695591688156, 0.0452522411942482, 0.42175665497779846, -0.4675482511520386, 0.19015267491340637, -0.360770583152771, -0.6681636571884155, -0.1463637799024582, -0.094439297914505, -0.21528375148773193, 0.24365122616291046, -0.18092401325702667, 0.1751442551612854, 0.2613292336463928, 0.13979516923427582, -0.07484787702560425, -0.10078442096710205, -0.11134717613458633, -0.1696176379919052, -0.0671386569738388, 0.25820836424827576, 0.26766493916511536, 0.03576700761914253, -0.1562226116657257, -0.4065234661102295, 0.17372216284275055, -0.14673152565956116, -0.006860397756099701, 0.015448067337274551, 0.017811769619584084, 0.2792447805404663, -0.16311073303222656, 0.0836838036775589, -0.19585628807544708, -0.08386331796646118, 0.16155585646629333, -0.010136574506759644, -0.05753648281097412, 0.07625876367092133, 0.09276135265827179, 0.3743745684623718, -0.04810437932610512, -0.07553698122501373, 0.4674268364906311, -0.030723486095666885, 0.11946199089288712, -0.10490045696496964, 0.1309003382921219, -0.25534337759017944, -0.37673020362854004, 0.023269258439540863, -0.2802605628967285, -0.0589078813791275, 0.08112338185310364, 0.35351306200027466, -0.20822694897651672, -0.10874713957309723, 0.23323512077331543, -0.017661698162555695, -0.23610781133174896, 0.5648046135902405, -0.11504416167736053, -0.12390275299549103, 0.08345232903957367, 0.33113378286361694, 0.3079777657985687, -0.03003057837486267, 0.16005688905715942, -0.24469399452209473, -0.34402239322662354, -0.29319003224372864, -0.0017086602747440338, 0.08423501998186111, -0.3020564019680023, 0.4359988272190094, -0.4049435555934906, -0.21108131110668182, -0.0015754139749333262, 0.1256580352783203, 0.13358888030052185, 0.38997694849967957, -0.08582773804664612, 0.01641872525215149, -0.31357142329216003, 0.2766585648059845, 0.08733244985342026, 0.516456663608551, -0.11600464582443237, -0.020528998225927353, -0.15977154672145844, 0.3449997305870056, -0.5093926787376404, -0.025777356699109077, -0.04198167845606804, 0.0986802950501442, -0.18369407951831818, -0.2436058521270752, 0.02295566350221634, 0.08832691609859467, 0.21370485424995422, 0.20307984948158264, -0.27483856678009033, -0.27690374851226807, -0.11304600536823273, 0.11901143193244934, -0.09976668655872345, 0.022418364882469177, -0.036254990845918655, -0.08896027505397797, -0.17748920619487762, -0.23579618334770203, 0.15790055692195892, 0.10129959136247635, -0.008756294846534729, 0.038688842207193375, 0.07945378124713898, -0.19881901144981384, 0.009577713906764984, -0.05676216632127762, 0.2661018967628479, 0.150095596909523, -0.19128595292568207, 0.3290465772151947, -0.22484667599201202, -0.20235148072242737, 0.06492423266172409, 0.2908940017223358, 0.4154064655303955, -0.280452698469162, 0.576478898525238, 0.061064496636390686, -0.2228248119354248, 0.28587400913238525, 0.5775525569915771, 0.006964154541492462, -0.024657128378748894, -0.0013721305876970291, 0.0033366545103490353, 0.3361739218235016, -0.36015355587005615, -0.062422335147857666, 0.1614944338798523, 0.1512303203344345, 0.16482135653495789, 0.14539483189582825, 0.06024867668747902, -0.10743609815835953, 0.09967496991157532, -0.08101214468479156, 0.1676630824804306, -0.5353279113769531, 0.0767662525177002, 0.1684592366218567, -0.01744849979877472, -0.012525226920843124, 0.4523634910583496, 0.22327996790409088, 0.42893674969673157, 0.4118613004684448, -0.17452523112297058, 0.33235225081443787, 0.11014440655708313, -0.08195964992046356, -0.005644991993904114, -0.051660891622304916, 0.06740619242191315, 0.3045775592327118, 0.08432739228010178, 0.3127085268497467, 0.27331027388572693, -0.18123045563697815, 0.273495614528656, 0.052969273179769516, -0.3321782052516937, 0.629361629486084, -0.109955333173275, -0.29160284996032715, 0.013230308890342712, -0.31314244866371155, -0.2830198407173157, 0.058384139090776443, 0.02777048759162426, -0.19197972118854523, 0.6304166316986084, 0.3053596615791321, 0.49909889698028564, 0.19308654963970184, 0.12946712970733643, -0.028326109051704407, 0.3076891303062439, -0.4314001798629761, -0.09289228171110153, 0.3527282476425171, -0.30245906114578247, -0.12067356705665588, 0.2753845751285553, 0.10577978193759918, 0.03380359709262848, -0.22600919008255005, 0.3110051155090332, -0.07521159946918488, -0.13393458724021912, -0.2861117422580719, 0.37116003036499023, -0.03445432335138321, 0.1916801631450653, 0.2742619514465332, 0.216273695230484, -0.1725092977285385, 0.18641264736652374, 0.07148025184869766, 0.07954980432987213, -0.015919096767902374, 0.4490301012992859, 0.27610090374946594, -0.020344216376543045, 0.08279496431350708, 0.01759134978055954, -0.08468283712863922, -0.3803854286670685, 0.22280548512935638, -0.37886399030685425, 0.27312472462654114, 0.04046400263905525, 0.14633718132972717, -0.0008175503462553024, 0.33807265758514404, 0.015463363379240036, -0.007274150848388672, -0.13842476904392242, -0.045384909957647324, -0.011703193187713623, 0.08209864795207977, 0.24479825794696808, 0.29347479343414307, -0.05171790346503258, 0.23172719776630402, 0.31049200892448425, -0.009193841367959976, -0.27848148345947266, -0.31431272625923157, -0.19793543219566345, 0.5181604623794556, 0.15114940702915192, 0.04965566098690033, -0.2355087250471115, -0.0025124605745077133, 0.13896477222442627, -0.4212067127227783, -0.07276374101638794, -0.21466779708862305, 0.2371928095817566, -0.21147798001766205, 0.14495927095413208, 0.1522434800863266, -0.24867969751358032, 0.4059877395629883, 0.3294173777103424, -0.13645383715629578, -0.35396480560302734, -0.015450313687324524, 0.12652340531349182, -0.1497325301170349, -0.2407497614622116, 0.10977804660797119, 0.09272567182779312, 0.048800282180309296, 0.012033123522996902, -0.02642977610230446, -0.14932484924793243, -0.14200937747955322, -0.009477637708187103, 0.19199028611183167, -0.3117429316043854, 0.11663133651018143, -0.42042648792266846, -0.09249289333820343, -0.006069505587220192, 0.431267112493515, 0.07486256211996078, 0.2109803408384323, -0.14318299293518066, -0.3563157320022583, 0.30873623490333557, -0.4520171582698822, -0.3963167667388916, 0.056790582835674286, 0.10231752693653107, 0.04781234264373779, -0.07597901672124863, -0.04233715683221817, -0.018798530101776123, 0.2713724374771118, -0.13315215706825256, -0.07334092259407043, 0.21018202602863312, 0.10160599648952484, -0.14414042234420776, -0.2628428637981415, 0.2721394896507263, 0.1045871153473854, -0.2549677789211273, -0.09400665760040283, -0.4037274122238159 ]
https://github.com/huggingface/datasets/issues/6012
[FR] Transform Chaining, Lazy Mapping
Hi, I think this feature would be very useful. I want to concatenate large datasets with heterogeneous columns. I dislike `map` since I don't want multiple copy of that datasets locally. I tried to use "set_transform" on each dataset to convert it to a standard features format, but `datasets.concatenate_datasets` ignores the updated format of the datasets.  A work around is to use `torch.utils.data.ConcatDataset`. Is there a neat way to do it using HF datasets?
### Feature request Currently using a `map` call processes and duplicates the whole dataset, which takes both time and disk space. The solution is to allow lazy mapping, which is essentially a saved chain of transforms that are applied on the fly whenever a slice of the dataset is requested. The API should look like `map`, as `set_transform` changes the current dataset while `map` returns another dataset. ### Motivation Lazy processing allows lower disk usage and faster experimentation. ### Your contribution _
74
[FR] Transform Chaining, Lazy Mapping ### Feature request Currently using a `map` call processes and duplicates the whole dataset, which takes both time and disk space. The solution is to allow lazy mapping, which is essentially a saved chain of transforms that are applied on the fly whenever a slice of the dataset is requested. The API should look like `map`, as `set_transform` changes the current dataset while `map` returns another dataset. ### Motivation Lazy processing allows lower disk usage and faster experimentation. ### Your contribution _ Hi, I think this feature would be very useful. I want to concatenate large datasets with heterogeneous columns. I dislike `map` since I don't want multiple copy of that datasets locally. I tried to use "set_transform" on each dataset to convert it to a standard features format, but `datasets.concatenate_datasets` ignores the updated format of the datasets.  A work around is to use `torch.utils.data.ConcatDataset`. Is there a neat way to do it using HF datasets?
[ -0.44856005907058716, -0.21093851327896118, 0.009915970265865326, -0.20319347083568573, -0.004091832786798477, 0.23192811012268066, 0.18682855367660522, 0.45677390694618225, -0.05524810031056404, -0.0972633957862854, -0.2656952142715454, 0.27904820442199707, -0.0351531021296978, 0.08542140573263168, -0.19138571619987488, -0.20907065272331238, 0.22704023122787476, 0.1497654914855957, -0.5164504051208496, -0.172186478972435, -0.39869022369384766, -0.04844393581151962, -0.01621490716934204, -0.08393099904060364, -0.14702560007572174, 0.10288593918085098, -0.3621237874031067, -0.10854078084230423, 0.20618367195129395, 0.20585356652736664, 0.30905506014823914, 0.618587851524353, 0.15791310369968414, 0.10039591789245605, -0.00011570986680453643, -0.05100187659263611, -0.0610286146402359, -0.05122799798846245, -0.08926844596862793, -0.17888684570789337, -0.33228397369384766, -0.414816677570343, -0.10591694712638855, -0.12385459244251251, 0.058135129511356354, -0.2498713880777359, 0.036186955869197845, -0.5723525881767273, 0.21816971898078918, -0.1599559783935547, 0.10792315006256104, -0.14260335266590118, -0.31547439098358154, -0.2083045244216919, 0.1703331172466278, 0.36606329679489136, 0.0034526903182268143, -0.1463368684053421, 0.13265174627304077, -0.2645811438560486, -0.15481069684028625, 0.1740645468235016, -0.10666745156049728, -0.3685078024864197, 0.32313820719718933, -0.02398303523659706, -0.20326846837997437, -0.2815527617931366, 0.12779337167739868, 0.29889875650405884, 0.19100496172904968, -0.17112842202186584, -0.15994243323802948, -0.3097326457500458, -0.21350383758544922, -0.0023594610393047333, -0.3475070297718048, 0.21486544609069824, 0.028320174664258957, 0.10943964123725891, -0.248366117477417, -0.2644558548927307, 0.00952371209859848, 0.11930432170629501, 0.11881086230278015, -0.015956051647663116, 0.21985545754432678, 0.007215466350317001, 0.1546357423067093, -0.18795932829380035, 0.3733542263507843, -0.42516469955444336, 0.07134521007537842, 0.3394606113433838, -0.4569159150123596, -0.15090636909008026, 0.024363353848457336, -0.10909850150346756, 0.4816274046897888, 0.0526513010263443, -0.25379517674446106, 0.1975860595703125, -0.32944148778915405, -0.002932719886302948, 0.013042676262557507, 0.08823738992214203, -0.05192296952009201, 0.17104990780353546, -0.02490624040365219, -0.3197246193885803, 0.004111628979444504, 0.09843748062849045, 0.11822300404310226, -0.11764805018901825, -0.22117936611175537, 0.1116589903831482, -0.10087737441062927, 0.059563133865594864, 0.044944003224372864, -0.13329578936100006, 0.021276935935020447, -0.06322704255580902, -0.10675954818725586, 0.23913344740867615, -0.02722340077161789, 0.3420703709125519, 0.14480334520339966, 0.1953485906124115, 0.0680684819817543, 0.07310055941343307, -0.025973191484808922, -0.27342236042022705, -0.0731242224574089, 0.13570743799209595, 0.025124017149209976, -0.13588197529315948, -0.22765453159809113, 0.18585895001888275, 0.03849290311336517, 0.4516393840312958, 0.1839955747127533, -0.09367415308952332, 0.3664620518684387, -0.1908273845911026, -0.0705145075917244, -0.022693991661071777, 0.3094482123851776, 0.16759957373142242, -0.4054916203022003, 0.21483391523361206, -0.3774888813495636, -0.24254152178764343, -0.3185049295425415, 0.05160200968384743, 0.12242253124713898, -0.09943962097167969, -0.03149617463350296, 0.5300223231315613, 0.20602762699127197, -0.09801845252513885, 0.08623064309358597, -0.10693925619125366, -0.15423080325126648, -0.1717039793729782, -0.07408623397350311, 0.3632548451423645, 0.14711645245552063, -0.2302865833044052, 0.19957102835178375, 0.22167523205280304, 0.11197707802057266, 0.3332681655883789, -0.18067559599876404, 0.02965288981795311, -0.2606086730957031, -0.08096730709075928, 0.5031456351280212, 0.11954742670059204, 0.058545537292957306, 0.40023481845855713, -0.1041160523891449, -0.0018502883613109589, 0.16978181898593903, 0.0928545594215393, 0.3565531075000763, -0.15705719590187073, 0.2805408239364624, 0.4910050630569458, -0.08273053914308548, -0.03243843838572502, 0.021085787564516068, -0.29105934500694275, 0.14852315187454224, -0.21487635374069214, 0.04234931617975235, 0.3445940315723419, 0.03612060099840164, 0.08009444922208786, 0.49414101243019104, -0.39526262879371643, 0.3198031485080719, 0.3336140513420105, -0.14831134676933289, 0.1056058257818222, -0.08559684455394745, 0.08289064466953278, -0.4903729557991028, -0.1491129994392395, 0.19587436318397522, -0.13463500142097473, 0.21053466200828552, -0.3704318404197693, 0.32152679562568665, -0.06473647803068161, -0.0699310153722763, 0.31643030047416687, -0.003825034946203232, 0.2295079529285431, -0.13003121316432953, -0.14897803962230682, -0.2056317776441574, 0.42312437295913696, 0.21710078418254852, -0.09739100933074951, -0.311372309923172, 0.40052321553230286, 0.2453150600194931, 0.2281782478094101, -0.08962425589561462, 0.2055700123310089, 0.04031795263290405, -0.140642449259758, 0.041185587644577026, 0.04114636033773422, -0.2937299311161041, -0.025907129049301147, 0.058627162128686905, 0.5423991680145264, 0.10617619752883911, -0.06732452660799026, 0.2198503464460373, -0.20605579018592834, -0.08849300444126129, -0.3070249855518341, -0.41547152400016785, 0.3267914652824402, -0.41136300563812256, 0.32025760412216187, -0.13649585843086243, 0.0043503399938344955, 0.060559436678886414, -0.149592325091362, -0.1483989655971527, -0.19772978127002716, 0.2597905099391937, 0.049992725253105164, 0.17285440862178802, 0.048712968826293945, -0.34536507725715637, 0.3735696077346802, 0.34131401777267456, -0.012876313179731369, -0.03188207745552063, 0.24772530794143677, 0.05246153473854065, 0.08549747616052628, 0.11063838750123978, -0.1561669409275055, 0.3894924521446228, 0.20820479094982147, 0.0769394189119339, 0.1182340458035469, 0.08318259567022324, 0.1705208718776703, 0.22317379713058472, -0.1625913679599762, 0.27699416875839233, 0.23430666327476501, 0.38136473298072815, 0.088004469871521, -0.31822332739830017, -0.33570683002471924, 0.2087210863828659, -0.3023819327354431, -0.02493385598063469, 0.08448100835084915, -0.32287025451660156, -0.05039019137620926, -0.3399238586425781, -0.5656284093856812, -0.026370082050561905, -0.35474032163619995, -0.07215958833694458, 0.20001378655433655, -0.08770785480737686, 0.4134403467178345, -0.1823529750108719, 0.3572077751159668, 0.13442499935626984, -0.5958706736564636, -0.23707053065299988, -0.09170505404472351, 0.12817136943340302, -0.05501747876405716, 0.02144111692905426, -0.39399561285972595, 0.0512169785797596, -0.18242362141609192, 0.049705468118190765, -0.377698689699173, -0.2393905222415924, 0.28009629249572754, -0.059722959995269775, -0.5112132430076599, 0.2974701523780823, -0.06730422377586365, 0.1180867999792099, -0.2891610860824585, -0.022886693477630615, 0.12791050970554352, 0.00490470789372921, 0.1074560135602951, 0.04343429580330849, 0.04225625842809677, -0.032156091183423996, 0.005545526742935181, -0.14012174308300018, -0.3753294050693512, 0.28259479999542236, -0.21111179888248444, 0.09682866930961609, 0.0017059464007616043, 0.007921057753264904, -0.3226807415485382, 0.02518256939947605, -0.11676092445850372, -0.1281196027994156, -0.18783579766750336, 0.3811332583427429, -0.19201365113258362, -0.22813619673252106, -0.3161291182041168, -0.26887622475624084, -0.22233450412750244, 0.35163646936416626, -0.27118271589279175, 0.14521971344947815, -0.09052903950214386, 0.618432343006134, -0.13955292105674744, 0.2405352145433426, 0.2667315900325775, 0.40820857882499695, 0.06288517266511917, -0.009497635066509247, -0.00667443685233593, 0.04752425104379654, 0.10936539620161057, 0.28147953748703003, 0.17321673035621643, 0.33102357387542725, 0.22599446773529053, 0.4625037908554077, 0.3641136586666107, -0.06113162264227867, 0.34418565034866333, 0.010699400678277016, 0.2466939091682434, -0.147300124168396, -0.4860208332538605, -0.3042856752872467, -0.3317262828350067, 0.07560396194458008, 0.05947912111878395, -0.12936246395111084, -0.30116650462150574, 0.1454218178987503, -0.2437034249305725, 0.3485695719718933, -0.2513982355594635, 0.37796542048454285, -0.5767934322357178, 0.23085132241249084, 0.19129259884357452, -0.01224411278963089, -0.5407941341400146, -0.16155630350112915, 0.4425894618034363, 0.10719330608844757, 0.25419047474861145, -0.02008586749434471, 0.06739003956317902, -0.0722947046160698, -0.4896354079246521, 0.5179296135902405, 0.1823970526456833, 0.07481765002012253, -0.08019206672906876, -0.19255545735359192, -0.31736040115356445, 0.017249563708901405, 0.7108890414237976, 0.027153225615620613, -0.4118420481681824, 0.20785588026046753, -0.2938242554664612, 0.005294440314173698, -0.09018751978874207, 0.21544566750526428, 0.026778951287269592, 0.050371989607810974, 0.5635952949523926, -0.39984822273254395, -0.29127374291419983, 0.17818453907966614, 0.25536656379699707, -0.1720801740884781, 0.11492574959993362, 0.16166386008262634, 0.010919757187366486, -0.22880777716636658, -0.3330627381801605, -0.08243099600076675, 0.09427877515554428, -0.04605010896921158, 0.07112626731395721, -0.30250969529151917, 0.059746257960796356, 0.16930696368217468, -0.2402942031621933, 0.036706723272800446, 0.4338735342025757, 0.15182216465473175, -0.03004586696624756, 0.21825705468654633, -0.05994941294193268, 0.40581077337265015, -0.11674407124519348, -0.32283732295036316, 0.02418404072523117, 0.043249890208244324, 0.40941181778907776, 0.08445684611797333, 0.26177021861076355, 0.09673027694225311, 0.15992529690265656, 0.3149574398994446, -0.44258177280426025, 0.06037453934550285, 0.06689826399087906, 0.04302596673369408, -0.6757226586341858, -0.4661008417606354, 0.5324419736862183, 0.17968471348285675, -0.16567420959472656, 0.21768593788146973, -0.2880655527114868, -0.2558614909648895, 0.5443892478942871, 0.26049041748046875, 0.8386492133140564, 0.057163678109645844, 0.34009799361228943, -0.2073410451412201, -0.12134227156639099, 0.3601748049259186, -0.5043062567710876, 0.14504528045654297, -0.3356150984764099, -0.7188389897346497, -0.1967136263847351, -0.14340582489967346, -0.09988608211278915, -0.010624736547470093, -0.3106040060520172, 0.3495282828807831, 0.010995760560035706, 0.12490122020244598, -0.08214376866817474, -0.2667718529701233, -0.004161974415183067, -0.5179981589317322, 0.14827385544776917, 0.04688645899295807, 0.16209539771080017, 0.2183220535516739, -0.15258485078811646, -0.323489248752594, 0.02505670115351677, -0.03665459528565407, -0.08045656234025955, 0.11175722628831863, 0.025648050010204315, 0.4098978638648987, -0.08852589130401611, -0.04692096263170242, 0.025291651487350464, -0.10550329089164734, 0.24812746047973633, -0.06997255980968475, 0.11843489110469818, -0.297004371881485, 0.22605007886886597, 0.2225400060415268, -0.16754963994026184, -0.24698680639266968, 0.5273667573928833, 0.2786896824836731, 0.15752696990966797, 0.08446825295686722, 0.14645865559577942, -0.20161078870296478, -0.505628228187561, -0.003390483558177948, -0.0387539342045784, -0.22795630991458893, 0.0028927763924002647, 0.5076990723609924, 0.0378119982779026, 0.12558536231517792, 0.005643031559884548, -0.028166942298412323, -0.04749113693833351, 0.4110301434993744, -0.23661457002162933, -0.060789354145526886, -0.10732920467853546, 0.35797595977783203, 0.18481963872909546, -0.03591198846697807, 0.18334272503852844, 0.12490527331829071, -0.2733305096626282, -0.01886189728975296, 0.15556055307388306, 0.17119041085243225, -0.4064885675907135, -0.017381682991981506, -0.5067508220672607, -0.2807066738605499, -0.20169904828071594, 0.26097843050956726, 0.0010357201099395752, 0.06617571413516998, -0.11260376870632172, -0.0478765144944191, -0.3396197259426117, 0.18880021572113037, -0.03704270347952843, 0.21589863300323486, 0.0645742192864418, 0.27721354365348816, -0.0891343504190445, 0.2159937024116516, -0.2324136197566986, -0.13027213513851166, 0.15633037686347961, 0.037134040147066116, -0.18726277351379395, -0.047272130846977234, -0.16613416373729706, -0.1354263424873352, -0.0236229095607996, 0.14092639088630676, 0.009841827675700188, -0.11312585324048996, -0.1844375878572464, 0.14003629982471466, 0.09240681678056717, 0.3042224943637848, -0.08496682345867157, -0.14448928833007812, -0.1161576509475708, -0.4182356894016266, 0.12296289205551147, 0.07603868842124939, -0.0981357991695404, -0.05378223583102226, 0.04260767996311188, -0.4264478385448456, -0.10961824655532837, 0.08790762722492218, 0.6888735294342041, 0.053303517401218414, -0.3650505840778351, 0.2945386469364166, -0.3263884484767914, -0.13637995719909668, -0.25095415115356445, 0.345216304063797, 0.6231549978256226, -0.20791566371917725, 0.3518359065055847, 0.012030307203531265, -0.15734192728996277, 0.09726550430059433, 0.38727867603302, 0.05426758527755737, -0.012360523454844952, 0.03785765916109085, 0.17772042751312256, 0.08434136211872101, -0.27311691641807556, -0.44747915863990784, 0.05813276022672653, 0.0549384243786335, 0.057285409420728683, 0.2582983672618866, 0.08197581768035889, -0.06981287896633148, 0.08537954837083817, -0.07283060252666473, 0.06635623425245285, -0.13183163106441498, 0.13802774250507355, 0.3996858596801758, 0.22977448999881744, 0.2008717656135559, 0.37688329815864563, 0.4172241985797882, 0.31151553988456726, -0.03612983226776123, 0.18822239339351654, 0.05786922574043274, 0.3954616189002991, -0.12679222226142883, 0.12724637985229492, -0.39766451716423035, 0.09648686647415161, 0.020568937063217163, 0.3644397258758545, 0.4347436726093292, 0.1359991729259491, -0.16895782947540283, 0.21459178626537323, -0.41586005687713623, -0.09864076226949692, 0.8256580233573914, -0.057518310844898224, -0.14395666122436523, 0.35613059997558594, 0.0675579383969307, -0.2029789686203003, -0.040061745792627335, 0.009982213377952576, -0.20447464287281036, 0.7597405910491943, 0.1007772833108902, 0.715874195098877, 0.15159572660923004, 0.3305613398551941, 0.16480708122253418, 0.30820679664611816, -0.2655062675476074, -0.13858740031719208, 0.028399214148521423, -0.16859455406665802, -0.10842067003250122, 0.3109193444252014, 0.1606220155954361, 0.28818559646606445, -0.10782480239868164, 0.2523753046989441, -0.22336286306381226, -0.0002382323145866394, 0.09575742483139038, 0.03791452944278717, -0.19486752152442932, -0.2925582826137543, 0.46003076434135437, 0.013582184910774231, -0.009897413663566113, 0.37897875905036926, -0.09805192053318024, -0.03262444585561752, -0.20568764209747314, 0.340878963470459, 0.39212992787361145, -0.0873894914984703, 0.3344181478023529, -0.12277998775243759, -0.06549516320228577, 0.09730761498212814, 0.46360528469085693, -0.28381308913230896, 0.1535855531692505, 0.1402451992034912, 0.051890842616558075, 0.13093604147434235, 0.18987153470516205, 0.15130126476287842, 0.07170188426971436, -0.18179556727409363, -0.13873599469661713, -0.029082041233778, -0.07356666773557663, 0.16414053738117218, 0.027337519451975822, 0.21830756962299347, 0.0060707032680511475, 0.3812210261821747, 0.05997943878173828, -0.27374178171157837, -0.5071181058883667, -0.07448642700910568, 0.5874327421188354, -0.10256312787532806, -0.19005407392978668, -0.07007372379302979, 0.18055842816829681, -0.02492290362715721, -0.41054579615592957, 0.31823867559432983, 0.26419293880462646, -0.014894049614667892, -0.10080260783433914, 0.15500546991825104, 0.17284797132015228, -0.33254191279411316, 0.12908999621868134, 0.19639736413955688, -0.1373618096113205, -0.2754909098148346, 0.13460351526737213, 0.14282511174678802, -0.24711431562900543, -0.11201044917106628, 0.2904247045516968, 0.008238596841692924, -0.09294618666172028, -0.2832760512828827, -0.13262802362442017, -0.13520273566246033, -0.20424893498420715, 0.3326682448387146, 0.321237176656723, -0.38147348165512085, 0.3646318018436432, -0.4085615277290344, 0.04621172323822975, 0.09093941748142242, 0.7041285634040833, 0.07646025717258453, 0.4057949185371399, 0.06911946833133698, -0.30044493079185486, 0.3494168817996979, -0.39702311158180237, -0.5351529121398926, -0.0029524846468120813, -0.06998223066329956, 0.271787166595459, -0.02901853434741497, -0.04775519296526909, -0.08069869130849838, 0.2208106517791748, -0.27402693033218384, -0.025840086862444878, 0.17142821848392487, 0.22111715376377106, -0.21238581836223602, -0.2801491320133209, 0.3494005799293518, 0.05371365696191788, -0.3490888178348541, -0.007692784070968628, -0.2808716297149658 ]
https://github.com/huggingface/datasets/issues/6011
Documentation: wiki_dpr Dataset has no metric_type for Faiss Index
Hi! You can do `ds.get_index("embeddings").faiss_index.metric_type` to get the metric type and then match the result with the FAISS metric [enum](https://github.com/facebookresearch/faiss/blob/43d86e30736ede853c384b24667fc3ab897d6ba9/faiss/MetricType.h#L22-L36) (should be L2).
### Describe the bug After loading `wiki_dpr` using: ```py ds = load_dataset(path='wiki_dpr', name='psgs_w100.multiset.compressed', split='train') print(ds.get_index("embeddings").metric_type) # prints nothing because the value is None ``` the index does not have a defined `metric_type`. This is an issue because I do not know how the `scores` are being computed for `get_nearest_examples()`. ### Steps to reproduce the bug System: Python 3.9.16, Transformers 4.30.2, WSL After loading `wiki_dpr` using: ```py ds = load_dataset(path='wiki_dpr', name='psgs_w100.multiset.compressed', split='train') print(ds.get_index("embeddings").metric_type) # prints nothing because the value is None ``` the index does not have a defined `metric_type`. This is an issue because I do not know how the `scores` are being computed for `get_nearest_examples()`. ```py from transformers import DPRQuestionEncoder, DPRContextEncoder, DPRQuestionEncoderTokenizer, DPRContextEncoderTokenizer tokenizer = DPRQuestionEncoderTokenizer.from_pretrained("facebook/dpr-question_encoder-multiset-base") encoder = DPRQuestionEncoder.from_pretrained("facebook/dpr-question_encoder-multiset-base") def encode_question(query, tokenizer=tokenizer, encoder=encoder): inputs = tokenizer(query, return_tensors='pt') question_embedding = encoder(**inputs)[0].detach().numpy() return question_embedding def get_knn(query, k=5, tokenizer=tokenizer, encoder=encoder, verbose=False): enc_question = encode_question(query, tokenizer, encoder) topk_results = ds.get_nearest_examples(index_name='embeddings', query=enc_question, k=k) a = torch.tensor(enc_question[0]).reshape(768) b = torch.tensor(topk_results.examples['embeddings'][0]) print(a.shape, b.shape) print(torch.dot(a, b)) print((a-b).pow(2).sum()) return topk_results ``` The [FAISS documentation](https://github.com/facebookresearch/faiss/wiki/MetricType-and-distances) suggests the metric is usually L2 distance (without the square root) or the inner product. I compute both for the sample query: ```py query = """ it catapulted into popular culture along with a line of action figures and other toys by Bandai.[2] By 2001, the media franchise had generated over $6 billion in toy sales. Despite initial criticism that its action violence targeted child audiences, the franchise has been commercially successful.""" get_knn(query,k=5) ``` Here, I get dot product of 80.6020 and L2 distance of 77.6616 and ```py NearestExamplesResults(scores=array([76.20431 , 75.312416, 74.945404, 74.866394, 74.68506 ], dtype=float32), examples={'id': ['3081096', '2004811', '8908258', '9594124', '286575'], 'text': ['actors, resulting in the "Power Rangers" franchise which has continued since then into sequel TV series (with "Power Rangers Beast Morphers" set to premiere in 2019), comic books, video games, and three feature films, with a further cinematic universe planned. Following from the success of "Power Rangers", Saban acquired the rights to more of Toei\'s library, creating "VR Troopers" and "Big Bad Beetleborgs" from several Metal Hero Series shows and "Masked Rider" from Kamen Rider Series footage. DIC Entertainment joined this boom by acquiring the rights to "Gridman the Hyper Agent" and turning it into "Superhuman Samurai Syber-Squad". In 2002,', ``` Doing `k=1` indicates the higher the outputted number, the better the match, so the metric should not be L2 distance. However, my manually computed inner product (80.6) has a discrepancy with the reported (76.2). Perhaps, this has to do with me using the `compressed` embeddings? ### Expected behavior ```py ds = load_dataset(path='wiki_dpr', name='psgs_w100.multiset.compressed', split='train') print(ds.get_index("embeddings").metric_type) # METRIC_INNER_PRODUCT ``` ### Environment info - `datasets` version: 2.12.0 - Platform: Linux-4.18.0-477.13.1.el8_8.x86_64-x86_64-with-glibc2.28 - Python version: 3.9.16 - Huggingface_hub version: 0.14.1 - PyArrow version: 12.0.0 - Pandas version: 2.0.1
23
Documentation: wiki_dpr Dataset has no metric_type for Faiss Index ### Describe the bug After loading `wiki_dpr` using: ```py ds = load_dataset(path='wiki_dpr', name='psgs_w100.multiset.compressed', split='train') print(ds.get_index("embeddings").metric_type) # prints nothing because the value is None ``` the index does not have a defined `metric_type`. This is an issue because I do not know how the `scores` are being computed for `get_nearest_examples()`. ### Steps to reproduce the bug System: Python 3.9.16, Transformers 4.30.2, WSL After loading `wiki_dpr` using: ```py ds = load_dataset(path='wiki_dpr', name='psgs_w100.multiset.compressed', split='train') print(ds.get_index("embeddings").metric_type) # prints nothing because the value is None ``` the index does not have a defined `metric_type`. This is an issue because I do not know how the `scores` are being computed for `get_nearest_examples()`. ```py from transformers import DPRQuestionEncoder, DPRContextEncoder, DPRQuestionEncoderTokenizer, DPRContextEncoderTokenizer tokenizer = DPRQuestionEncoderTokenizer.from_pretrained("facebook/dpr-question_encoder-multiset-base") encoder = DPRQuestionEncoder.from_pretrained("facebook/dpr-question_encoder-multiset-base") def encode_question(query, tokenizer=tokenizer, encoder=encoder): inputs = tokenizer(query, return_tensors='pt') question_embedding = encoder(**inputs)[0].detach().numpy() return question_embedding def get_knn(query, k=5, tokenizer=tokenizer, encoder=encoder, verbose=False): enc_question = encode_question(query, tokenizer, encoder) topk_results = ds.get_nearest_examples(index_name='embeddings', query=enc_question, k=k) a = torch.tensor(enc_question[0]).reshape(768) b = torch.tensor(topk_results.examples['embeddings'][0]) print(a.shape, b.shape) print(torch.dot(a, b)) print((a-b).pow(2).sum()) return topk_results ``` The [FAISS documentation](https://github.com/facebookresearch/faiss/wiki/MetricType-and-distances) suggests the metric is usually L2 distance (without the square root) or the inner product. I compute both for the sample query: ```py query = """ it catapulted into popular culture along with a line of action figures and other toys by Bandai.[2] By 2001, the media franchise had generated over $6 billion in toy sales. Despite initial criticism that its action violence targeted child audiences, the franchise has been commercially successful.""" get_knn(query,k=5) ``` Here, I get dot product of 80.6020 and L2 distance of 77.6616 and ```py NearestExamplesResults(scores=array([76.20431 , 75.312416, 74.945404, 74.866394, 74.68506 ], dtype=float32), examples={'id': ['3081096', '2004811', '8908258', '9594124', '286575'], 'text': ['actors, resulting in the "Power Rangers" franchise which has continued since then into sequel TV series (with "Power Rangers Beast Morphers" set to premiere in 2019), comic books, video games, and three feature films, with a further cinematic universe planned. Following from the success of "Power Rangers", Saban acquired the rights to more of Toei\'s library, creating "VR Troopers" and "Big Bad Beetleborgs" from several Metal Hero Series shows and "Masked Rider" from Kamen Rider Series footage. DIC Entertainment joined this boom by acquiring the rights to "Gridman the Hyper Agent" and turning it into "Superhuman Samurai Syber-Squad". In 2002,', ``` Doing `k=1` indicates the higher the outputted number, the better the match, so the metric should not be L2 distance. However, my manually computed inner product (80.6) has a discrepancy with the reported (76.2). Perhaps, this has to do with me using the `compressed` embeddings? ### Expected behavior ```py ds = load_dataset(path='wiki_dpr', name='psgs_w100.multiset.compressed', split='train') print(ds.get_index("embeddings").metric_type) # METRIC_INNER_PRODUCT ``` ### Environment info - `datasets` version: 2.12.0 - Platform: Linux-4.18.0-477.13.1.el8_8.x86_64-x86_64-with-glibc2.28 - Python version: 3.9.16 - Huggingface_hub version: 0.14.1 - PyArrow version: 12.0.0 - Pandas version: 2.0.1 Hi! You can do `ds.get_index("embeddings").faiss_index.metric_type` to get the metric type and then match the result with the FAISS metric [enum](https://github.com/facebookresearch/faiss/blob/43d86e30736ede853c384b24667fc3ab897d6ba9/faiss/MetricType.h#L22-L36) (should be L2).
[ -0.36273178458213806, -0.5373350381851196, 0.06526792049407959, 0.3944724202156067, 0.3347804546356201, 0.13995018601417542, 0.3388691544532776, 0.33496665954589844, 0.38180679082870483, 0.3302499055862427, 0.13445782661437988, 0.2328336238861084, 0.18522213399410248, -0.1447066217660904, -0.029888171702623367, -0.35495612025260925, 0.05146270617842674, 0.07226181030273438, 0.1456199288368225, -0.2550848722457886, -0.36355191469192505, 0.11959333717823029, -0.48091161251068115, -0.1454005092382431, -0.3482484519481659, 0.10831703245639801, -0.05393999069929123, -0.13415226340293884, -0.1150478944182396, -0.6324169635772705, 0.5448923707008362, -0.19124136865139008, 0.4148244559764862, 0.3715345859527588, -0.00011936266673728824, 0.06424076855182648, 0.5459179878234863, -0.06515868753194809, -0.06828448176383972, 0.03330491483211517, -0.32037705183029175, -0.2035902887582779, 0.16180557012557983, -0.45351332426071167, -0.2244139015674591, -0.3341008126735687, -0.11903181672096252, -0.19030873477458954, 0.23532910645008087, 0.3775245249271393, 0.11184446513652802, 0.09138883650302887, -0.0064123161137104034, -0.23228558897972107, -0.08828113228082657, -0.094528928399086, -0.14435283839702606, 0.1685289740562439, -0.19659385085105896, 0.1420925110578537, 0.17313197255134583, 0.24463127553462982, 0.0639677569270134, 0.07574169337749481, 0.16775764524936676, 0.2691022753715515, 0.5262352824211121, -0.04542677849531174, 0.11601453274488449, 0.35904523730278015, 0.44730743765830994, -0.03713245689868927, -0.17720483243465424, 0.026111193001270294, -0.012931935489177704, -0.3250134289264679, 0.07395844161510468, -0.2228125035762787, -0.10998983681201935, 0.06575263291597366, -0.2624474763870239, 0.3647003173828125, -0.23453785479068756, 0.33281129598617554, -0.33205682039260864, 0.6909904479980469, -0.0238783098757267, 0.09009873867034912, -0.20534224808216095, -0.02062610164284706, -0.11236850917339325, -0.22736617922782898, 0.002746693789958954, 0.20848307013511658, -0.22785033285617828, -0.2579265534877777, 0.2347252070903778, -0.3936085104942322, 0.08056285977363586, -0.19241823256015778, -0.3221387565135956, 0.12095393985509872, 0.560075044631958, -0.09038502722978592, 0.23954036831855774, 0.4910549819469452, -0.004355639219284058, 0.3218015730381012, 0.04243745654821396, 0.3899444043636322, 0.021312464028596878, 0.0009309016168117523, -0.017121214419603348, 0.039184413850307465, 0.06904549896717072, 0.05818184092640877, 0.041860952973365784, -0.0697183907032013, -0.2607974410057068, 0.24607442319393158, -0.05744754895567894, -0.06334050744771957, -0.0015647606924176216, 0.49836939573287964, -0.08289304375648499, 0.4962906241416931, 0.10873354971408844, 0.17284391820430756, -0.21151505410671234, 0.3316090703010559, -0.1937151849269867, -0.12367810308933258, -0.0028633475303649902, 0.17015397548675537, 0.2358729988336563, 0.024750428274273872, 0.17568819224834442, -0.10891123861074448, 0.11241353303194046, -0.194586843252182, -0.04780178517103195, 0.12750965356826782, 0.37394654750823975, 0.19864171743392944, -0.019924229010939598, 0.2708970308303833, 0.1951409876346588, -0.4425995349884033, -0.25271615386009216, 0.046938784420490265, -0.3891981542110443, -0.20734447240829468, -0.06586721539497375, 0.18242612481117249, -0.06475700438022614, -0.0692564994096756, -0.14445149898529053, 0.33146604895591736, 0.17328277230262756, -0.020032772794365883, 0.11455189436674118, -0.06909718364477158, -0.17618457973003387, -0.10004493594169617, 0.42317214608192444, 0.11499488353729248, -0.13905656337738037, -0.31628069281578064, 0.03926829248666763, 0.09014458954334259, 0.23987624049186707, -0.013668466359376907, -0.006925636902451515, 0.1615503877401352, -0.004497603513300419, 0.21410973370075226, 0.5303261280059814, -0.7963215112686157, -0.3819703757762909, 0.10407097637653351, 0.10231941938400269, 0.08385492116212845, 0.14739128947257996, -0.03527151048183441, 0.20893938839435577, 0.3189920485019684, 0.31888455152511597, 0.3621947169303894, 0.0865980014204979, -0.038936764001846313, -0.39466530084609985, -0.334979772567749, 0.2395104318857193, 0.21263332664966583, 0.27904006838798523, -0.08854881674051285, 0.054143212735652924, 0.3025630712509155, 0.26032736897468567, -0.03087998554110527, -0.08162079006433487, 0.1483108252286911, 0.08815596997737885, -0.38451045751571655, 0.4469735622406006, -0.44909825921058655, -0.12497719377279282, 0.2620772421360016, -0.24678416550159454, 0.14305396378040314, 0.19012311100959778, -0.2115900069475174, -0.5357022881507874, -0.06854221224784851, -0.2574717104434967, -0.29292771220207214, 0.10653574764728546, -0.10110051929950714, -0.07530070096254349, 0.10313184559345245, -0.22473955154418945, -0.4532228708267212, -0.019569359719753265, -0.24088528752326965, -0.11878111958503723, 0.1513805091381073, -0.17197874188423157, -0.004895432852208614, -0.09042932093143463, 0.5494767427444458, 0.3549346327781677, 0.10410322993993759, -0.18883219361305237, 0.1588973104953766, 0.17747187614440918, -0.1692018061876297, 0.07050429284572601, 0.00510936975479126, 0.1755649447441101, -0.4899854063987732, -0.212058424949646, 0.35284674167633057, 0.07011350989341736, 0.08396568149328232, -0.34327417612075806, 0.49366796016693115, 0.4972117245197296, 0.2187194973230362, -0.06711006164550781, -0.009209114126861095, 0.06866001337766647, -0.07733835279941559, 0.17879992723464966, -0.6360125541687012, -0.11583992838859558, 0.002712046727538109, -0.3520047068595886, -0.06085310876369476, 0.3221627473831177, 0.007851183414459229, 0.535102367401123, -0.3102361559867859, 0.21174612641334534, 0.16689655184745789, -0.23717465996742249, -0.22412461042404175, -0.06074032187461853, -0.32233360409736633, 0.26395076513290405, 0.14261482656002045, 0.09127707779407501, -0.18130624294281006, -0.1262352615594864, -0.18861716985702515, 0.22720187902450562, 0.08733020722866058, -0.20680874586105347, 0.33567726612091064, 0.14402443170547485, -0.0007152659818530083, -0.02613922953605652, 0.24972644448280334, -0.11087954044342041, 0.14134493470191956, -0.3804965317249298, 0.06163806468248367, -0.34319502115249634, 0.09147150069475174, 0.03942554071545601, -0.044486310333013535, -0.05815797671675682, -0.2395072728395462, 0.3174018859863281, -0.39532285928726196, 0.0009900778532028198, 0.3843906819820404, 0.03686724975705147, 0.2074621021747589, 0.180208221077919, -0.2162051498889923, -0.10617706179618835, -0.42531874775886536, -0.5265461802482605, -0.013807158917188644, -0.05498826131224632, 0.21128994226455688, 0.1315717250108719, -0.20079873502254486, -0.09603966772556305, -0.20328931510448456, -0.3311852216720581, 0.10668078064918518, 0.005159199237823486, 0.5423402190208435, 0.08162281662225723, 0.06436467170715332, -0.23058801889419556, -0.07863029092550278, 0.1916847825050354, -0.14610514044761658, -0.018807750195264816, 0.18672709167003632, -0.2653251886367798, 0.013072831556200981, -0.06597845256328583, -0.5332692265510559, -0.03577890247106552, -0.1628330796957016, -0.07364620268344879, 0.12720857560634613, 0.028871554881334305, 0.014616094529628754, 0.1394098401069641, 0.10030127316713333, 0.010647129267454147, 0.11864349246025085, -0.37579941749572754, 0.14306674897670746, 0.4438839852809906, -0.11630596220493317, -0.6027724742889404, -0.18997807800769806, -0.33729302883148193, 0.15618054568767548, -0.03495044261217117, -0.29979997873306274, -0.38387951254844666, -0.0422043651342392, 0.2829277813434601, 0.13741454482078552, 0.2788803279399872, 0.38084372878074646, -0.19911494851112366, -0.04133911430835724, -0.2670075595378876, 0.17263631522655487, 0.1567610800266266, -0.1671484410762787, 0.18759934604167938, -0.11221487075090408, 0.18939289450645447, -0.16150647401809692, 0.755671501159668, 0.30298087000846863, -0.23276396095752716, 0.24845008552074432, -0.1737375110387802, 0.16012151539325714, -0.04158129543066025, 0.025339016690850258, 0.3213290274143219, 0.0685947835445404, 0.156620055437088, 0.3667299747467041, 0.041958339512348175, -0.3852428197860718, -0.06662525236606598, 0.1649581789970398, -0.378932923078537, -0.20519709587097168, -0.02006308175623417, 0.2579376697540283, 0.16088633239269257, 0.024006418883800507, 0.3917594850063324, -0.4468192756175995, -0.2155817151069641, 0.25431028008461, 0.337154358625412, -0.17323684692382812, -0.03429589420557022, 0.08918116986751556, -0.21204012632369995, -0.30835917592048645, 0.4016519784927368, 0.32759806513786316, 0.4353266954421997, -0.10750848054885864, 0.024960104376077652, 0.13235051929950714, 0.026772012934088707, 0.347750186920166, -0.38117286562919617, 0.08894656598567963, 0.36403992772102356, 0.2865223288536072, -0.527336835861206, -0.16314023733139038, -0.32165130972862244, -0.3493211269378662, -0.11714887619018555, 0.6443760991096497, -0.42019760608673096, -0.21677151322364807, 0.1822337806224823, 0.10806398093700409, -0.25985872745513916, -0.1339237540960312, -0.45775797963142395, -0.40013739466667175, -0.02957429736852646, 0.16375425457954407, 0.12592972815036774, 0.6089535355567932, -0.1950562745332718, -0.088067427277565, -0.5045980215072632, 0.14990022778511047, -0.2555244565010071, 0.2705611288547516, 0.3105528652667999, 0.1523614376783371, 0.020475219935178757, 0.08353209495544434, 0.15605899691581726, 0.0287303626537323, 0.04723032936453819, 0.2197960466146469, -0.07432298362255096, 0.2707195580005646, 0.03243038058280945, -0.12929460406303406, 0.17668846249580383, -0.3299228847026825, 0.04659208655357361, 0.137227863073349, 0.35324907302856445, -0.38751280307769775, 0.0375542975962162, 0.4753812849521637, 0.003957980312407017, -0.21726980805397034, -0.19400286674499512, 0.8071786165237427, 0.07335144281387329, -0.07286516577005386, 0.1501476764678955, 0.32991552352905273, -0.15949395298957825, 0.4889225363731384, 0.5268919467926025, 0.7543568015098572, 0.004069723188877106, 0.02590855024755001, 0.4947260618209839, 0.08886280655860901, 0.3563673496246338, -0.47670239210128784, 0.24820645153522491, -0.2657144367694855, -0.16924533247947693, -0.04252135753631592, 0.02877845987677574, -0.01299615204334259, -0.038771457970142365, -0.3453570008277893, 0.16665078699588776, -0.0491313673555851, -0.0010447986423969269, 0.0692107230424881, 0.21545621752738953, -0.028169674798846245, -0.12558740377426147, -0.16539308428764343, 0.016713708639144897, 0.13180992007255554, 0.12081354856491089, 0.032086849212646484, -0.05945609509944916, -0.20820212364196777, -0.3268355131149292, -0.3169930577278137, -0.10628954321146011, -0.009776676073670387, 0.22355608642101288, 0.09122613817453384, -0.2311660647392273, 0.024999268352985382, 0.283547043800354, 0.2906745672225952, -0.028806444257497787, -0.5874632000923157, 0.4653032124042511, -0.4874248504638672, 0.18235419690608978, 0.022325826808810234, -0.1253892034292221, 0.24505615234375, -0.11260423064231873, -0.3584786355495453, 0.04010239616036415, -0.015448126010596752, 0.03608439862728119, -0.083360955119133, -0.050165414810180664, -0.24105457961559296, -0.18052907288074493, 0.12163373827934265, -0.2518971860408783, 0.1775505244731903, -0.20141130685806274, 0.10272322595119476, -0.1585955023765564, -0.2016988843679428, 0.26234766840934753, 0.12140437960624695, -0.2738267183303833, 0.08552403748035431, 0.688002347946167, 0.2266676425933838, -0.40132835507392883, 0.33923131227493286, -0.07405208051204681, -0.2109556645154953, -0.20992827415466309, -0.12838785350322723, 0.4196533262729645, -0.20055565237998962, 0.047863900661468506, 0.1438274085521698, -0.21717718243598938, 0.009051340632140636, 0.44947707653045654, 0.12698444724082947, -0.079945869743824, -0.28219521045684814, -0.24881231784820557, -0.19518698751926422, 0.20374777913093567, -0.10594220459461212, 0.24159899353981018, -0.17117521166801453, -0.032699860632419586, -0.03652651235461235, 0.17691922187805176, -0.23057255148887634, -0.03479894995689392, -0.5351477861404419, 0.177531898021698, -0.3105661869049072, -0.15886586904525757, 0.14510539174079895, 0.09188088774681091, 0.033957913517951965, -0.15948128700256348, -0.12970201671123505, -0.1953449249267578, -0.21739232540130615, 0.19098305702209473, 0.12355747073888779, -0.013979442417621613, -0.04384256526827812, 0.042004384100437164, -0.2513403296470642, -0.2898194193840027, 0.22906464338302612, -0.07495863735675812, -0.21265153586864471, 0.2700505256652832, 0.013272780925035477, 0.2429954707622528, -0.10100120306015015, -0.07002328336238861, 0.17579230666160583, 0.42751359939575195, 0.013900717720389366, 0.0033308565616607666, 0.032683033496141434, 0.10225972533226013, -0.1402447372674942, 0.08724664151668549, 0.2184172123670578, 0.017465615645051003, 0.28432828187942505, -0.19871081411838531, -0.23059909045696259, 0.1879865825176239, 0.16020745038986206, 0.10702551901340485, -0.20773760974407196, -0.10365699976682663, -0.08929190039634705, 0.1077604740858078, -0.14926530420780182, -0.08481153845787048, 0.3550736606121063, 0.029912222176790237, 0.056006480008363724, 0.07062648236751556, 0.1530473679304123, -0.06991171836853027, -0.08167813718318939, -0.010545080527663231, 0.023319456726312637, -0.08081609010696411, 0.18102522194385529, 0.4042762815952301, 0.19508935511112213, 0.1504773646593094, -0.07142683863639832, -0.1528446078300476, 0.24661880731582642, 0.33429956436157227, -0.1497383713722229, 0.6204267740249634, -0.20885047316551208, 0.17186568677425385, -0.07492750138044357, -0.049774251878261566, 0.36163201928138733, -0.2238054871559143, -0.04892045259475708, 0.040605053305625916, -0.08810563385486603, 0.16202658414840698, -0.11301172524690628, -0.04830940440297127, -0.4860078692436218, -0.12844611704349518, -0.13852012157440186, -0.2879200577735901, -0.10826341062784195, -0.023952599614858627, -0.20036780834197998, -0.14491458237171173, 0.13264580070972443, 0.12900584936141968, -0.19142574071884155, 0.06148434057831764, -0.27196204662323, 0.047143302857875824, -0.008832555264234543, 0.3554241955280304, 0.555003821849823, -0.01019032672047615, 0.1898830384016037, 0.3754767179489136, 0.025730907917022705, -0.014038942754268646, 0.3448927402496338, 0.1716790795326233, 0.2499091774225235, -0.3992232084274292, -0.04275761544704437, 0.41510987281799316, -0.13599835336208344, 0.022319354116916656, 0.27052927017211914, 0.13472864031791687, -0.04636980965733528, 0.11902573704719543, 0.10659363865852356, -0.17237205803394318, -0.12367744743824005, -0.1115235835313797, 0.2663850784301758, -0.12252721190452576, 0.13915248215198517, -0.400703102350235, 0.0977921411395073, -0.016217384487390518, -0.023076623678207397, -0.3587903380393982, 0.37320858240127563, 0.10808290541172028, 0.3330177366733551, 0.32581332325935364, -0.16194814443588257, 0.05024034529924393, -0.07631330192089081, 0.5051532983779907, 0.027082182466983795, 0.17093777656555176, -0.34731242060661316, 0.11948010325431824, -0.43436574935913086, 0.351284921169281, 0.14222578704357147, -0.1471158117055893, 0.4047258794307709, 0.1730346530675888, -0.33560922741889954, 0.13240477442741394, 0.11003279685974121, 0.22781522572040558, 0.4484528601169586, 0.4670368731021881, -0.27542150020599365, -0.277262419462204, -0.12302358448505402, -0.16658270359039307, -0.09395818412303925, -0.33834293484687805, 0.07831954210996628, -0.17962640523910522, -0.047783780843019485, -0.04022243618965149, -0.12410348653793335, 0.09840132296085358, 0.27503299713134766, 0.23241892457008362, 0.29732680320739746, 0.4687875211238861, -0.2146444320678711, 0.16356609761714935, -0.189250648021698, -0.10736668109893799, -0.03266112878918648, -0.03795280307531357, -0.28761130571365356, 0.1999237835407257, -0.08265123516321182, -0.2079460471868515, -0.10995703190565109, 0.1716710925102234, 0.16537700593471527, -0.05610717833042145, -0.17644214630126953, 0.030883891507983208, -0.22960719466209412, -0.06670905649662018, 0.191102534532547, 0.10321393609046936, 0.011770728975534439, 0.2576734721660614, 0.10850986838340759, -0.43216922879219055, 0.4834274351596832, -0.6419905424118042, -0.22843116521835327, -0.22336046397686005, 0.23645707964897156, 0.22049090266227722, 0.13840146362781525, -0.5475015044212341, 0.013679973781108856, 0.4465344250202179, 0.1955212652683258, -0.2005624622106552, -0.0884106457233429, -0.0015552453696727753, 0.04863521084189415, -0.21299681067466736, -0.0027839913964271545, 0.08010430634021759, 0.13539719581604004, -0.15412376821041107, -0.276711642742157 ]
https://github.com/huggingface/datasets/issues/6011
Documentation: wiki_dpr Dataset has no metric_type for Faiss Index
Ah! Thank you for pointing this out. FYI: the enum indicates it's using the inner product. Using `torch.inner` or `torch.dot` still produces a discrepancy compared to the built-in score. I think this is because of the compression/quantization that occurs with the FAISS index.
### Describe the bug After loading `wiki_dpr` using: ```py ds = load_dataset(path='wiki_dpr', name='psgs_w100.multiset.compressed', split='train') print(ds.get_index("embeddings").metric_type) # prints nothing because the value is None ``` the index does not have a defined `metric_type`. This is an issue because I do not know how the `scores` are being computed for `get_nearest_examples()`. ### Steps to reproduce the bug System: Python 3.9.16, Transformers 4.30.2, WSL After loading `wiki_dpr` using: ```py ds = load_dataset(path='wiki_dpr', name='psgs_w100.multiset.compressed', split='train') print(ds.get_index("embeddings").metric_type) # prints nothing because the value is None ``` the index does not have a defined `metric_type`. This is an issue because I do not know how the `scores` are being computed for `get_nearest_examples()`. ```py from transformers import DPRQuestionEncoder, DPRContextEncoder, DPRQuestionEncoderTokenizer, DPRContextEncoderTokenizer tokenizer = DPRQuestionEncoderTokenizer.from_pretrained("facebook/dpr-question_encoder-multiset-base") encoder = DPRQuestionEncoder.from_pretrained("facebook/dpr-question_encoder-multiset-base") def encode_question(query, tokenizer=tokenizer, encoder=encoder): inputs = tokenizer(query, return_tensors='pt') question_embedding = encoder(**inputs)[0].detach().numpy() return question_embedding def get_knn(query, k=5, tokenizer=tokenizer, encoder=encoder, verbose=False): enc_question = encode_question(query, tokenizer, encoder) topk_results = ds.get_nearest_examples(index_name='embeddings', query=enc_question, k=k) a = torch.tensor(enc_question[0]).reshape(768) b = torch.tensor(topk_results.examples['embeddings'][0]) print(a.shape, b.shape) print(torch.dot(a, b)) print((a-b).pow(2).sum()) return topk_results ``` The [FAISS documentation](https://github.com/facebookresearch/faiss/wiki/MetricType-and-distances) suggests the metric is usually L2 distance (without the square root) or the inner product. I compute both for the sample query: ```py query = """ it catapulted into popular culture along with a line of action figures and other toys by Bandai.[2] By 2001, the media franchise had generated over $6 billion in toy sales. Despite initial criticism that its action violence targeted child audiences, the franchise has been commercially successful.""" get_knn(query,k=5) ``` Here, I get dot product of 80.6020 and L2 distance of 77.6616 and ```py NearestExamplesResults(scores=array([76.20431 , 75.312416, 74.945404, 74.866394, 74.68506 ], dtype=float32), examples={'id': ['3081096', '2004811', '8908258', '9594124', '286575'], 'text': ['actors, resulting in the "Power Rangers" franchise which has continued since then into sequel TV series (with "Power Rangers Beast Morphers" set to premiere in 2019), comic books, video games, and three feature films, with a further cinematic universe planned. Following from the success of "Power Rangers", Saban acquired the rights to more of Toei\'s library, creating "VR Troopers" and "Big Bad Beetleborgs" from several Metal Hero Series shows and "Masked Rider" from Kamen Rider Series footage. DIC Entertainment joined this boom by acquiring the rights to "Gridman the Hyper Agent" and turning it into "Superhuman Samurai Syber-Squad". In 2002,', ``` Doing `k=1` indicates the higher the outputted number, the better the match, so the metric should not be L2 distance. However, my manually computed inner product (80.6) has a discrepancy with the reported (76.2). Perhaps, this has to do with me using the `compressed` embeddings? ### Expected behavior ```py ds = load_dataset(path='wiki_dpr', name='psgs_w100.multiset.compressed', split='train') print(ds.get_index("embeddings").metric_type) # METRIC_INNER_PRODUCT ``` ### Environment info - `datasets` version: 2.12.0 - Platform: Linux-4.18.0-477.13.1.el8_8.x86_64-x86_64-with-glibc2.28 - Python version: 3.9.16 - Huggingface_hub version: 0.14.1 - PyArrow version: 12.0.0 - Pandas version: 2.0.1
43
Documentation: wiki_dpr Dataset has no metric_type for Faiss Index ### Describe the bug After loading `wiki_dpr` using: ```py ds = load_dataset(path='wiki_dpr', name='psgs_w100.multiset.compressed', split='train') print(ds.get_index("embeddings").metric_type) # prints nothing because the value is None ``` the index does not have a defined `metric_type`. This is an issue because I do not know how the `scores` are being computed for `get_nearest_examples()`. ### Steps to reproduce the bug System: Python 3.9.16, Transformers 4.30.2, WSL After loading `wiki_dpr` using: ```py ds = load_dataset(path='wiki_dpr', name='psgs_w100.multiset.compressed', split='train') print(ds.get_index("embeddings").metric_type) # prints nothing because the value is None ``` the index does not have a defined `metric_type`. This is an issue because I do not know how the `scores` are being computed for `get_nearest_examples()`. ```py from transformers import DPRQuestionEncoder, DPRContextEncoder, DPRQuestionEncoderTokenizer, DPRContextEncoderTokenizer tokenizer = DPRQuestionEncoderTokenizer.from_pretrained("facebook/dpr-question_encoder-multiset-base") encoder = DPRQuestionEncoder.from_pretrained("facebook/dpr-question_encoder-multiset-base") def encode_question(query, tokenizer=tokenizer, encoder=encoder): inputs = tokenizer(query, return_tensors='pt') question_embedding = encoder(**inputs)[0].detach().numpy() return question_embedding def get_knn(query, k=5, tokenizer=tokenizer, encoder=encoder, verbose=False): enc_question = encode_question(query, tokenizer, encoder) topk_results = ds.get_nearest_examples(index_name='embeddings', query=enc_question, k=k) a = torch.tensor(enc_question[0]).reshape(768) b = torch.tensor(topk_results.examples['embeddings'][0]) print(a.shape, b.shape) print(torch.dot(a, b)) print((a-b).pow(2).sum()) return topk_results ``` The [FAISS documentation](https://github.com/facebookresearch/faiss/wiki/MetricType-and-distances) suggests the metric is usually L2 distance (without the square root) or the inner product. I compute both for the sample query: ```py query = """ it catapulted into popular culture along with a line of action figures and other toys by Bandai.[2] By 2001, the media franchise had generated over $6 billion in toy sales. Despite initial criticism that its action violence targeted child audiences, the franchise has been commercially successful.""" get_knn(query,k=5) ``` Here, I get dot product of 80.6020 and L2 distance of 77.6616 and ```py NearestExamplesResults(scores=array([76.20431 , 75.312416, 74.945404, 74.866394, 74.68506 ], dtype=float32), examples={'id': ['3081096', '2004811', '8908258', '9594124', '286575'], 'text': ['actors, resulting in the "Power Rangers" franchise which has continued since then into sequel TV series (with "Power Rangers Beast Morphers" set to premiere in 2019), comic books, video games, and three feature films, with a further cinematic universe planned. Following from the success of "Power Rangers", Saban acquired the rights to more of Toei\'s library, creating "VR Troopers" and "Big Bad Beetleborgs" from several Metal Hero Series shows and "Masked Rider" from Kamen Rider Series footage. DIC Entertainment joined this boom by acquiring the rights to "Gridman the Hyper Agent" and turning it into "Superhuman Samurai Syber-Squad". In 2002,', ``` Doing `k=1` indicates the higher the outputted number, the better the match, so the metric should not be L2 distance. However, my manually computed inner product (80.6) has a discrepancy with the reported (76.2). Perhaps, this has to do with me using the `compressed` embeddings? ### Expected behavior ```py ds = load_dataset(path='wiki_dpr', name='psgs_w100.multiset.compressed', split='train') print(ds.get_index("embeddings").metric_type) # METRIC_INNER_PRODUCT ``` ### Environment info - `datasets` version: 2.12.0 - Platform: Linux-4.18.0-477.13.1.el8_8.x86_64-x86_64-with-glibc2.28 - Python version: 3.9.16 - Huggingface_hub version: 0.14.1 - PyArrow version: 12.0.0 - Pandas version: 2.0.1 Ah! Thank you for pointing this out. FYI: the enum indicates it's using the inner product. Using `torch.inner` or `torch.dot` still produces a discrepancy compared to the built-in score. I think this is because of the compression/quantization that occurs with the FAISS index.
[ -0.36273178458213806, -0.5373350381851196, 0.06526792049407959, 0.3944724202156067, 0.3347804546356201, 0.13995018601417542, 0.3388691544532776, 0.33496665954589844, 0.38180679082870483, 0.3302499055862427, 0.13445782661437988, 0.2328336238861084, 0.18522213399410248, -0.1447066217660904, -0.029888171702623367, -0.35495612025260925, 0.05146270617842674, 0.07226181030273438, 0.1456199288368225, -0.2550848722457886, -0.36355191469192505, 0.11959333717823029, -0.48091161251068115, -0.1454005092382431, -0.3482484519481659, 0.10831703245639801, -0.05393999069929123, -0.13415226340293884, -0.1150478944182396, -0.6324169635772705, 0.5448923707008362, -0.19124136865139008, 0.4148244559764862, 0.3715345859527588, -0.00011936266673728824, 0.06424076855182648, 0.5459179878234863, -0.06515868753194809, -0.06828448176383972, 0.03330491483211517, -0.32037705183029175, -0.2035902887582779, 0.16180557012557983, -0.45351332426071167, -0.2244139015674591, -0.3341008126735687, -0.11903181672096252, -0.19030873477458954, 0.23532910645008087, 0.3775245249271393, 0.11184446513652802, 0.09138883650302887, -0.0064123161137104034, -0.23228558897972107, -0.08828113228082657, -0.094528928399086, -0.14435283839702606, 0.1685289740562439, -0.19659385085105896, 0.1420925110578537, 0.17313197255134583, 0.24463127553462982, 0.0639677569270134, 0.07574169337749481, 0.16775764524936676, 0.2691022753715515, 0.5262352824211121, -0.04542677849531174, 0.11601453274488449, 0.35904523730278015, 0.44730743765830994, -0.03713245689868927, -0.17720483243465424, 0.026111193001270294, -0.012931935489177704, -0.3250134289264679, 0.07395844161510468, -0.2228125035762787, -0.10998983681201935, 0.06575263291597366, -0.2624474763870239, 0.3647003173828125, -0.23453785479068756, 0.33281129598617554, -0.33205682039260864, 0.6909904479980469, -0.0238783098757267, 0.09009873867034912, -0.20534224808216095, -0.02062610164284706, -0.11236850917339325, -0.22736617922782898, 0.002746693789958954, 0.20848307013511658, -0.22785033285617828, -0.2579265534877777, 0.2347252070903778, -0.3936085104942322, 0.08056285977363586, -0.19241823256015778, -0.3221387565135956, 0.12095393985509872, 0.560075044631958, -0.09038502722978592, 0.23954036831855774, 0.4910549819469452, -0.004355639219284058, 0.3218015730381012, 0.04243745654821396, 0.3899444043636322, 0.021312464028596878, 0.0009309016168117523, -0.017121214419603348, 0.039184413850307465, 0.06904549896717072, 0.05818184092640877, 0.041860952973365784, -0.0697183907032013, -0.2607974410057068, 0.24607442319393158, -0.05744754895567894, -0.06334050744771957, -0.0015647606924176216, 0.49836939573287964, -0.08289304375648499, 0.4962906241416931, 0.10873354971408844, 0.17284391820430756, -0.21151505410671234, 0.3316090703010559, -0.1937151849269867, -0.12367810308933258, -0.0028633475303649902, 0.17015397548675537, 0.2358729988336563, 0.024750428274273872, 0.17568819224834442, -0.10891123861074448, 0.11241353303194046, -0.194586843252182, -0.04780178517103195, 0.12750965356826782, 0.37394654750823975, 0.19864171743392944, -0.019924229010939598, 0.2708970308303833, 0.1951409876346588, -0.4425995349884033, -0.25271615386009216, 0.046938784420490265, -0.3891981542110443, -0.20734447240829468, -0.06586721539497375, 0.18242612481117249, -0.06475700438022614, -0.0692564994096756, -0.14445149898529053, 0.33146604895591736, 0.17328277230262756, -0.020032772794365883, 0.11455189436674118, -0.06909718364477158, -0.17618457973003387, -0.10004493594169617, 0.42317214608192444, 0.11499488353729248, -0.13905656337738037, -0.31628069281578064, 0.03926829248666763, 0.09014458954334259, 0.23987624049186707, -0.013668466359376907, -0.006925636902451515, 0.1615503877401352, -0.004497603513300419, 0.21410973370075226, 0.5303261280059814, -0.7963215112686157, -0.3819703757762909, 0.10407097637653351, 0.10231941938400269, 0.08385492116212845, 0.14739128947257996, -0.03527151048183441, 0.20893938839435577, 0.3189920485019684, 0.31888455152511597, 0.3621947169303894, 0.0865980014204979, -0.038936764001846313, -0.39466530084609985, -0.334979772567749, 0.2395104318857193, 0.21263332664966583, 0.27904006838798523, -0.08854881674051285, 0.054143212735652924, 0.3025630712509155, 0.26032736897468567, -0.03087998554110527, -0.08162079006433487, 0.1483108252286911, 0.08815596997737885, -0.38451045751571655, 0.4469735622406006, -0.44909825921058655, -0.12497719377279282, 0.2620772421360016, -0.24678416550159454, 0.14305396378040314, 0.19012311100959778, -0.2115900069475174, -0.5357022881507874, -0.06854221224784851, -0.2574717104434967, -0.29292771220207214, 0.10653574764728546, -0.10110051929950714, -0.07530070096254349, 0.10313184559345245, -0.22473955154418945, -0.4532228708267212, -0.019569359719753265, -0.24088528752326965, -0.11878111958503723, 0.1513805091381073, -0.17197874188423157, -0.004895432852208614, -0.09042932093143463, 0.5494767427444458, 0.3549346327781677, 0.10410322993993759, -0.18883219361305237, 0.1588973104953766, 0.17747187614440918, -0.1692018061876297, 0.07050429284572601, 0.00510936975479126, 0.1755649447441101, -0.4899854063987732, -0.212058424949646, 0.35284674167633057, 0.07011350989341736, 0.08396568149328232, -0.34327417612075806, 0.49366796016693115, 0.4972117245197296, 0.2187194973230362, -0.06711006164550781, -0.009209114126861095, 0.06866001337766647, -0.07733835279941559, 0.17879992723464966, -0.6360125541687012, -0.11583992838859558, 0.002712046727538109, -0.3520047068595886, -0.06085310876369476, 0.3221627473831177, 0.007851183414459229, 0.535102367401123, -0.3102361559867859, 0.21174612641334534, 0.16689655184745789, -0.23717465996742249, -0.22412461042404175, -0.06074032187461853, -0.32233360409736633, 0.26395076513290405, 0.14261482656002045, 0.09127707779407501, -0.18130624294281006, -0.1262352615594864, -0.18861716985702515, 0.22720187902450562, 0.08733020722866058, -0.20680874586105347, 0.33567726612091064, 0.14402443170547485, -0.0007152659818530083, -0.02613922953605652, 0.24972644448280334, -0.11087954044342041, 0.14134493470191956, -0.3804965317249298, 0.06163806468248367, -0.34319502115249634, 0.09147150069475174, 0.03942554071545601, -0.044486310333013535, -0.05815797671675682, -0.2395072728395462, 0.3174018859863281, -0.39532285928726196, 0.0009900778532028198, 0.3843906819820404, 0.03686724975705147, 0.2074621021747589, 0.180208221077919, -0.2162051498889923, -0.10617706179618835, -0.42531874775886536, -0.5265461802482605, -0.013807158917188644, -0.05498826131224632, 0.21128994226455688, 0.1315717250108719, -0.20079873502254486, -0.09603966772556305, -0.20328931510448456, -0.3311852216720581, 0.10668078064918518, 0.005159199237823486, 0.5423402190208435, 0.08162281662225723, 0.06436467170715332, -0.23058801889419556, -0.07863029092550278, 0.1916847825050354, -0.14610514044761658, -0.018807750195264816, 0.18672709167003632, -0.2653251886367798, 0.013072831556200981, -0.06597845256328583, -0.5332692265510559, -0.03577890247106552, -0.1628330796957016, -0.07364620268344879, 0.12720857560634613, 0.028871554881334305, 0.014616094529628754, 0.1394098401069641, 0.10030127316713333, 0.010647129267454147, 0.11864349246025085, -0.37579941749572754, 0.14306674897670746, 0.4438839852809906, -0.11630596220493317, -0.6027724742889404, -0.18997807800769806, -0.33729302883148193, 0.15618054568767548, -0.03495044261217117, -0.29979997873306274, -0.38387951254844666, -0.0422043651342392, 0.2829277813434601, 0.13741454482078552, 0.2788803279399872, 0.38084372878074646, -0.19911494851112366, -0.04133911430835724, -0.2670075595378876, 0.17263631522655487, 0.1567610800266266, -0.1671484410762787, 0.18759934604167938, -0.11221487075090408, 0.18939289450645447, -0.16150647401809692, 0.755671501159668, 0.30298087000846863, -0.23276396095752716, 0.24845008552074432, -0.1737375110387802, 0.16012151539325714, -0.04158129543066025, 0.025339016690850258, 0.3213290274143219, 0.0685947835445404, 0.156620055437088, 0.3667299747467041, 0.041958339512348175, -0.3852428197860718, -0.06662525236606598, 0.1649581789970398, -0.378932923078537, -0.20519709587097168, -0.02006308175623417, 0.2579376697540283, 0.16088633239269257, 0.024006418883800507, 0.3917594850063324, -0.4468192756175995, -0.2155817151069641, 0.25431028008461, 0.337154358625412, -0.17323684692382812, -0.03429589420557022, 0.08918116986751556, -0.21204012632369995, -0.30835917592048645, 0.4016519784927368, 0.32759806513786316, 0.4353266954421997, -0.10750848054885864, 0.024960104376077652, 0.13235051929950714, 0.026772012934088707, 0.347750186920166, -0.38117286562919617, 0.08894656598567963, 0.36403992772102356, 0.2865223288536072, -0.527336835861206, -0.16314023733139038, -0.32165130972862244, -0.3493211269378662, -0.11714887619018555, 0.6443760991096497, -0.42019760608673096, -0.21677151322364807, 0.1822337806224823, 0.10806398093700409, -0.25985872745513916, -0.1339237540960312, -0.45775797963142395, -0.40013739466667175, -0.02957429736852646, 0.16375425457954407, 0.12592972815036774, 0.6089535355567932, -0.1950562745332718, -0.088067427277565, -0.5045980215072632, 0.14990022778511047, -0.2555244565010071, 0.2705611288547516, 0.3105528652667999, 0.1523614376783371, 0.020475219935178757, 0.08353209495544434, 0.15605899691581726, 0.0287303626537323, 0.04723032936453819, 0.2197960466146469, -0.07432298362255096, 0.2707195580005646, 0.03243038058280945, -0.12929460406303406, 0.17668846249580383, -0.3299228847026825, 0.04659208655357361, 0.137227863073349, 0.35324907302856445, -0.38751280307769775, 0.0375542975962162, 0.4753812849521637, 0.003957980312407017, -0.21726980805397034, -0.19400286674499512, 0.8071786165237427, 0.07335144281387329, -0.07286516577005386, 0.1501476764678955, 0.32991552352905273, -0.15949395298957825, 0.4889225363731384, 0.5268919467926025, 0.7543568015098572, 0.004069723188877106, 0.02590855024755001, 0.4947260618209839, 0.08886280655860901, 0.3563673496246338, -0.47670239210128784, 0.24820645153522491, -0.2657144367694855, -0.16924533247947693, -0.04252135753631592, 0.02877845987677574, -0.01299615204334259, -0.038771457970142365, -0.3453570008277893, 0.16665078699588776, -0.0491313673555851, -0.0010447986423969269, 0.0692107230424881, 0.21545621752738953, -0.028169674798846245, -0.12558740377426147, -0.16539308428764343, 0.016713708639144897, 0.13180992007255554, 0.12081354856491089, 0.032086849212646484, -0.05945609509944916, -0.20820212364196777, -0.3268355131149292, -0.3169930577278137, -0.10628954321146011, -0.009776676073670387, 0.22355608642101288, 0.09122613817453384, -0.2311660647392273, 0.024999268352985382, 0.283547043800354, 0.2906745672225952, -0.028806444257497787, -0.5874632000923157, 0.4653032124042511, -0.4874248504638672, 0.18235419690608978, 0.022325826808810234, -0.1253892034292221, 0.24505615234375, -0.11260423064231873, -0.3584786355495453, 0.04010239616036415, -0.015448126010596752, 0.03608439862728119, -0.083360955119133, -0.050165414810180664, -0.24105457961559296, -0.18052907288074493, 0.12163373827934265, -0.2518971860408783, 0.1775505244731903, -0.20141130685806274, 0.10272322595119476, -0.1585955023765564, -0.2016988843679428, 0.26234766840934753, 0.12140437960624695, -0.2738267183303833, 0.08552403748035431, 0.688002347946167, 0.2266676425933838, -0.40132835507392883, 0.33923131227493286, -0.07405208051204681, -0.2109556645154953, -0.20992827415466309, -0.12838785350322723, 0.4196533262729645, -0.20055565237998962, 0.047863900661468506, 0.1438274085521698, -0.21717718243598938, 0.009051340632140636, 0.44947707653045654, 0.12698444724082947, -0.079945869743824, -0.28219521045684814, -0.24881231784820557, -0.19518698751926422, 0.20374777913093567, -0.10594220459461212, 0.24159899353981018, -0.17117521166801453, -0.032699860632419586, -0.03652651235461235, 0.17691922187805176, -0.23057255148887634, -0.03479894995689392, -0.5351477861404419, 0.177531898021698, -0.3105661869049072, -0.15886586904525757, 0.14510539174079895, 0.09188088774681091, 0.033957913517951965, -0.15948128700256348, -0.12970201671123505, -0.1953449249267578, -0.21739232540130615, 0.19098305702209473, 0.12355747073888779, -0.013979442417621613, -0.04384256526827812, 0.042004384100437164, -0.2513403296470642, -0.2898194193840027, 0.22906464338302612, -0.07495863735675812, -0.21265153586864471, 0.2700505256652832, 0.013272780925035477, 0.2429954707622528, -0.10100120306015015, -0.07002328336238861, 0.17579230666160583, 0.42751359939575195, 0.013900717720389366, 0.0033308565616607666, 0.032683033496141434, 0.10225972533226013, -0.1402447372674942, 0.08724664151668549, 0.2184172123670578, 0.017465615645051003, 0.28432828187942505, -0.19871081411838531, -0.23059909045696259, 0.1879865825176239, 0.16020745038986206, 0.10702551901340485, -0.20773760974407196, -0.10365699976682663, -0.08929190039634705, 0.1077604740858078, -0.14926530420780182, -0.08481153845787048, 0.3550736606121063, 0.029912222176790237, 0.056006480008363724, 0.07062648236751556, 0.1530473679304123, -0.06991171836853027, -0.08167813718318939, -0.010545080527663231, 0.023319456726312637, -0.08081609010696411, 0.18102522194385529, 0.4042762815952301, 0.19508935511112213, 0.1504773646593094, -0.07142683863639832, -0.1528446078300476, 0.24661880731582642, 0.33429956436157227, -0.1497383713722229, 0.6204267740249634, -0.20885047316551208, 0.17186568677425385, -0.07492750138044357, -0.049774251878261566, 0.36163201928138733, -0.2238054871559143, -0.04892045259475708, 0.040605053305625916, -0.08810563385486603, 0.16202658414840698, -0.11301172524690628, -0.04830940440297127, -0.4860078692436218, -0.12844611704349518, -0.13852012157440186, -0.2879200577735901, -0.10826341062784195, -0.023952599614858627, -0.20036780834197998, -0.14491458237171173, 0.13264580070972443, 0.12900584936141968, -0.19142574071884155, 0.06148434057831764, -0.27196204662323, 0.047143302857875824, -0.008832555264234543, 0.3554241955280304, 0.555003821849823, -0.01019032672047615, 0.1898830384016037, 0.3754767179489136, 0.025730907917022705, -0.014038942754268646, 0.3448927402496338, 0.1716790795326233, 0.2499091774225235, -0.3992232084274292, -0.04275761544704437, 0.41510987281799316, -0.13599835336208344, 0.022319354116916656, 0.27052927017211914, 0.13472864031791687, -0.04636980965733528, 0.11902573704719543, 0.10659363865852356, -0.17237205803394318, -0.12367744743824005, -0.1115235835313797, 0.2663850784301758, -0.12252721190452576, 0.13915248215198517, -0.400703102350235, 0.0977921411395073, -0.016217384487390518, -0.023076623678207397, -0.3587903380393982, 0.37320858240127563, 0.10808290541172028, 0.3330177366733551, 0.32581332325935364, -0.16194814443588257, 0.05024034529924393, -0.07631330192089081, 0.5051532983779907, 0.027082182466983795, 0.17093777656555176, -0.34731242060661316, 0.11948010325431824, -0.43436574935913086, 0.351284921169281, 0.14222578704357147, -0.1471158117055893, 0.4047258794307709, 0.1730346530675888, -0.33560922741889954, 0.13240477442741394, 0.11003279685974121, 0.22781522572040558, 0.4484528601169586, 0.4670368731021881, -0.27542150020599365, -0.277262419462204, -0.12302358448505402, -0.16658270359039307, -0.09395818412303925, -0.33834293484687805, 0.07831954210996628, -0.17962640523910522, -0.047783780843019485, -0.04022243618965149, -0.12410348653793335, 0.09840132296085358, 0.27503299713134766, 0.23241892457008362, 0.29732680320739746, 0.4687875211238861, -0.2146444320678711, 0.16356609761714935, -0.189250648021698, -0.10736668109893799, -0.03266112878918648, -0.03795280307531357, -0.28761130571365356, 0.1999237835407257, -0.08265123516321182, -0.2079460471868515, -0.10995703190565109, 0.1716710925102234, 0.16537700593471527, -0.05610717833042145, -0.17644214630126953, 0.030883891507983208, -0.22960719466209412, -0.06670905649662018, 0.191102534532547, 0.10321393609046936, 0.011770728975534439, 0.2576734721660614, 0.10850986838340759, -0.43216922879219055, 0.4834274351596832, -0.6419905424118042, -0.22843116521835327, -0.22336046397686005, 0.23645707964897156, 0.22049090266227722, 0.13840146362781525, -0.5475015044212341, 0.013679973781108856, 0.4465344250202179, 0.1955212652683258, -0.2005624622106552, -0.0884106457233429, -0.0015552453696727753, 0.04863521084189415, -0.21299681067466736, -0.0027839913964271545, 0.08010430634021759, 0.13539719581604004, -0.15412376821041107, -0.276711642742157 ]
https://github.com/huggingface/datasets/issues/6010
Improve `Dataset`'s string representation
Yes, feel free to work on this. You can check the PyArrow Table `__repr__` and Polars DataFrame `__repr__`/`_repr_html_` implementations for some pointers/ideas.
Currently, `Dataset.__repr__` outputs a dataset's column names and the number of rows. We could improve it by printing its features and the first few rows. We should also implement `_repr_html_` to have a rich HTML representation in notebooks/Streamlit.
22
Improve `Dataset`'s string representation Currently, `Dataset.__repr__` outputs a dataset's column names and the number of rows. We could improve it by printing its features and the first few rows. We should also implement `_repr_html_` to have a rich HTML representation in notebooks/Streamlit. Yes, feel free to work on this. You can check the PyArrow Table `__repr__` and Polars DataFrame `__repr__`/`_repr_html_` implementations for some pointers/ideas.
[ -0.26115238666534424, -0.06325656175613403, -0.13544955849647522, 0.18778547644615173, 0.4518064856529236, 0.0696428045630455, 0.07831285893917084, 0.4281676113605499, -0.25408488512039185, 0.0606195405125618, -0.212770015001297, 0.42051488161087036, 0.17750640213489532, 0.28437989950180054, 0.129835307598114, -0.31896016001701355, 0.06471841037273407, 0.4039645493030548, 0.015249937772750854, -0.08866926282644272, -0.13798129558563232, -0.03254971653223038, 0.026838958263397217, 0.2511647939682007, -0.10878252238035202, -0.09075555950403214, -0.20228436589241028, 0.03453177958726883, -0.2525400221347809, -0.32612234354019165, -0.16928385198116302, 0.13970302045345306, 0.2811744511127472, 0.1099451556801796, -0.00010154438496101648, -0.15941748023033142, 0.26106053590774536, 0.158487007021904, -0.2900000512599945, 0.12118598073720932, 0.18206673860549927, -0.22911886870861053, 0.24706609547138214, -0.34555137157440186, 0.04917056858539581, -0.545755922794342, 0.007397616282105446, 0.10693664848804474, 0.22148030996322632, 0.15030406415462494, 0.3215348720550537, 0.35835498571395874, -0.2558756172657013, 0.14641225337982178, 0.6256157755851746, 0.3524007201194763, -0.2407199740409851, 0.07478932291269302, 0.41512590646743774, -0.1650068163871765, -0.350273996591568, 0.3357728123664856, -0.13157881796360016, 0.0319795086979866, 0.020718906074762344, 0.2722344696521759, -0.03633835166692734, -0.06292319297790527, 0.0507027842104435, 0.3521522283554077, 0.4453338384628296, -0.45153728127479553, -0.0694284737110138, 0.015539832413196564, 0.05845397710800171, -0.2686803340911865, -0.015707142651081085, 0.22731110453605652, -0.09700168669223785, 0.3692478835582733, -0.11252917349338531, -0.11752999573945999, -0.3150004744529724, 0.09690403938293457, -0.02079092711210251, 0.24770545959472656, 0.05988718569278717, 0.01139039546251297, -0.07387620210647583, -0.011558633297681808, 0.3842678666114807, -0.039672933518886566, -0.031696487218141556, -0.08465472608804703, -0.11648564040660858, 0.09188422560691833, 0.01847437024116516, -0.05260206013917923, 0.1130063608288765, 0.07518036663532257, 0.3261953294277191, 0.2300904393196106, 0.18333934247493744, 0.17579790949821472, 0.03122875653207302, -0.0837545394897461, -0.020806066691875458, 0.3574962019920349, 0.44572025537490845, 0.008596347644925117, 0.1320885717868805, -0.24670368432998657, -0.1511484831571579, 0.2363276332616806, 0.2031993865966797, -0.16687139868736267, 0.05634090304374695, -0.11702343821525574, -0.20441271364688873, 0.23137731850147247, -0.21056225895881653, -0.07975797355175018, 0.04283769801259041, 0.5208723545074463, -0.21298226714134216, 0.16849857568740845, 0.13857083022594452, -0.11909100413322449, 0.045271046459674835, -0.35571005940437317, -0.182295024394989, 0.011676128022372723, -0.2872607707977295, 0.00070225540548563, -0.07752984762191772, -0.15973210334777832, -0.058413684368133545, -0.008182314224541187, 0.3062326908111572, 0.18965184688568115, 0.07498117536306381, -0.10388480126857758, 0.20982512831687927, 0.2375352531671524, -0.1866903007030487, 0.0429854616522789, -0.10527481138706207, -0.02553457021713257, -0.09528633207082748, 0.16365790367126465, 0.1265791952610016, -0.15921786427497864, -0.32209476828575134, 0.2772669494152069, -0.07552330195903778, 0.059858761727809906, -0.09699415415525436, 0.25186988711357117, -0.051443494856357574, -0.005737990140914917, 0.021061971783638, -0.0008922964334487915, 0.1003684252500534, -0.2942982316017151, 0.28792113065719604, 0.12789486348628998, -0.41164258122444153, 0.027858451008796692, 0.11812254786491394, -0.1340874880552292, 0.5801013112068176, 0.23004019260406494, -0.07921680063009262, 0.11853867769241333, 0.03789011389017105, 0.14731614291667938, 0.402535617351532, -0.0525563508272171, -0.3687599003314972, 0.4460523724555969, 0.15983912348747253, -0.04986137896776199, 0.12730258703231812, 0.24026145040988922, 0.3275478482246399, 0.1731531172990799, 0.01211642473936081, 0.35338205099105835, -0.06683258712291718, 0.14724312722682953, -0.3224742114543915, -0.08938892930746078, 0.21636389195919037, 0.447377473115921, 0.01874086633324623, -0.05392969399690628, 0.006284564733505249, -0.1639793962240219, 0.4414876103401184, -0.34842637181282043, 0.10701006650924683, -0.09739111363887787, 0.3925164043903351, 0.0792636126279831, -0.018263818696141243, -0.30636051297187805, -0.18089300394058228, -0.03218517079949379, 0.04571527987718582, 0.21682997047901154, -0.19711793959140778, -0.377302348613739, -0.03965029865503311, 0.1756240278482437, -0.03972601518034935, 0.027910945937037468, 0.29645857214927673, 0.12394323199987411, -0.07172471284866333, -0.03661132603883743, -0.12377732992172241, 0.35927149653434753, -0.43942198157310486, -0.027905892580747604, -0.0026419255882501602, 0.4066019356250763, -0.010113460943102837, -0.06564795970916748, 0.19022314250469208, 0.12349997460842133, 0.028999269008636475, 0.07749142497777939, 0.10286963731050491, 0.38351956009864807, -0.07465619593858719, -0.15991003811359406, 0.04614958539605141, 0.0682210698723793, 0.1784093976020813, -0.23481200635433197, 0.0020278412848711014, 0.04681088775396347, 0.01900983601808548, 0.07390681654214859, -0.08825432509183884, 0.16090473532676697, -0.05058657005429268, 0.03042546659708023, -0.058874666690826416, 0.08168885111808777, 0.15469671785831451, 0.11368677020072937, -0.10151497274637222, -0.12591437995433807, 0.08264581859111786, 0.24787822365760803, 0.1117686778306961, -0.012733792886137962, -0.7459776997566223, 0.1588635891675949, 0.3759649693965912, -0.23822611570358276, 0.08377909660339355, 0.1964523196220398, -0.19659554958343506, -0.08385070413351059, 0.23421673476696014, 0.23378758132457733, 0.07809417694807053, 0.448229044675827, -0.0039040111005306244, -0.04048781096935272, -0.2681390643119812, -0.11850959062576294, 0.0948401540517807, 0.14566434919834137, -0.04434001445770264, -0.01629222184419632, 0.2798428535461426, -0.11923610419034958, -0.3133803904056549, -0.15029339492321014, -0.08502279967069626, 0.3626497983932495, -0.13755609095096588, 0.08106159418821335, -0.2200288325548172, -0.39874163269996643, 0.0691789761185646, -0.16492067277431488, -0.03408099338412285, -0.33324694633483887, 0.21005761623382568, -0.10947751998901367, -0.17826370894908905, 0.30648720264434814, 0.19811315834522247, 0.22250691056251526, 0.0470883846282959, 0.0321117639541626, -0.43774551153182983, -0.249058797955513, -0.28497472405433655, 0.21228478848934174, 0.08763184398412704, 0.23516573011875153, 0.3506481647491455, -0.29554513096809387, 0.2468308061361313, -0.5815830230712891, -0.3325994610786438, 0.2613093852996826, -0.10660518705844879, 0.31540828943252563, 0.21866542100906372, 0.19618651270866394, -0.1559012234210968, 0.04832632094621658, 0.28800898790359497, -0.10441301763057709, -0.09109992533922195, 0.23756301403045654, -0.05344885587692261, -0.14503580331802368, -0.07500742375850677, -0.20885354280471802, -0.26536697149276733, -0.4099535346031189, 0.16529634594917297, -0.06856665015220642, 0.25878483057022095, -0.30917882919311523, 0.09149637818336487, -0.04318101704120636, -0.08347684890031815, 0.06264469772577286, -0.21939970552921295, -0.15839239954948425, 0.48868945240974426, -0.13603933155536652, -0.42027223110198975, -0.15828722715377808, 0.11540637910366058, -0.15222814679145813, 0.16961826384067535, -0.3753998279571533, -0.12253838032484055, -0.2336588054895401, 0.14645344018936157, -0.010942604392766953, 0.2115970402956009, -0.03219062089920044, 0.2083766758441925, -0.23398493230342865, 0.06753327697515488, -0.022335488349199295, -0.015832729637622833, -0.052897803485393524, 0.08623486757278442, -0.0524095743894577, 0.21221747994422913, -0.07014450430870056, 0.12099934369325638, -0.04218428581953049, -0.20756544172763824, 0.2261132001876831, -0.23228323459625244, 0.3141040503978729, 0.09716825187206268, -0.1477748602628708, -0.05804107338190079, -0.1358070969581604, 0.022807341068983078, 0.29183894395828247, -0.05214103311300278, -0.17451807856559753, -0.006194621324539185, -0.17906880378723145, -0.19874945282936096, -0.09142491966485977, 0.34438014030456543, 0.18114762008190155, 0.3264119625091553, -0.13619042932987213, 0.028486430644989014, 0.013995908200740814, -0.17740598320960999, 0.08899109065532684, 0.03319048881530762, -0.07041668146848679, -0.03381697088479996, -0.16689704358577728, -0.1472647339105606, -0.3951076567173004, 0.2853049635887146, 0.2062000185251236, 0.045508645474910736, -0.04178629815578461, -0.270134836435318, 0.10156106948852539, -0.021256301552057266, 0.29905790090560913, -0.20423316955566406, -0.38463783264160156, 0.11504366993904114, -0.1487589180469513, -0.15212857723236084, 0.09729614853858948, -0.47229066491127014, 0.0326710119843483, -0.09923191368579865, 0.26480913162231445, -0.25012874603271484, -0.17652574181556702, 0.3519589602947235, 0.20513473451137543, -0.3472481667995453, -0.19392366707324982, -0.26871591806411743, -0.0022265389561653137, -0.024781543761491776, 0.006709367036819458, -0.0006108414381742477, -0.03552001714706421, 0.03041369467973709, -0.1561201512813568, -0.05316879600286484, 0.026665914803743362, 0.18554270267486572, 0.637253999710083, 0.23777908086776733, -0.4532110095024109, 0.011194255203008652, -0.011972915381193161, 0.12165188044309616, 0.5663915276527405, 0.22313490509986877, -0.33123162388801575, -0.2072468101978302, 0.046451419591903687, -0.30226197838783264, 0.48474380373954773, 0.016739189624786377, -0.06080902740359306, 0.15624219179153442, -0.031775400042533875, 0.19605253636837006, -0.24598628282546997, -0.02556990645825863, 0.23110227286815643, 0.13678301870822906, -0.1569698005914688, -0.507906436920166, 0.3272404670715332, -0.06615923345088959, -0.2127317190170288, 0.07961966842412949, 0.1886974275112152, -0.05895093083381653, 0.32689523696899414, 0.3316168189048767, 1.0911139249801636, -0.33309537172317505, 0.1785958856344223, 0.09968289732933044, -0.5094999074935913, 0.295825719833374, -0.386863112449646, -0.0190211683511734, -0.4859274625778198, -0.15715226531028748, -0.07101427763700485, 0.0639301985502243, 0.2006339132785797, -0.14253020286560059, -0.392560750246048, 0.11579383164644241, 0.10348716378211975, 0.09268159419298172, 0.20498763024806976, 0.2743254601955414, 0.11601484566926956, -0.27539747953414917, -0.5050889849662781, 0.20863015949726105, -0.355146586894989, -0.5389158725738525, -0.011343234218657017, -0.14279234409332275, -0.03642120957374573, 0.022632520645856857, -0.12612180411815643, -0.06905215978622437, -0.15382850170135498, -0.1254202127456665, 0.04314746707677841, -0.25420844554901123, -0.053479909896850586, 0.0761808529496193, -0.03945977985858917, 0.1561249941587448, -0.03485148400068283, 0.06740996241569519, -0.0934557244181633, 0.11505790054798126, -0.04566150903701782, 0.014227529056370258, 0.2237778604030609, 0.025921054184436798, -0.3922573924064636, 0.20279920101165771, 0.2738795876502991, -0.052021171897649765, -0.14126421511173248, 0.0015666037797927856, 0.37777942419052124, -0.3550722301006317, 0.2479819804430008, -0.1720389723777771, -0.17754806578159332, -0.3220798671245575, 0.2367231249809265, 0.001997426152229309, -0.1386602520942688, 0.08512799441814423, 0.33269354701042175, -0.05637091398239136, -0.26425233483314514, 0.021390385925769806, 0.15312665700912476, 0.17913386225700378, -0.12640713155269623, 0.30892202258110046, -0.3324424624443054, -0.3466223180294037, 0.16134166717529297, 0.24857287108898163, -0.3099164366722107, 0.04053083434700966, -0.22071221470832825, -0.2328946888446808, -0.1457078903913498, 0.2620835602283478, 0.25289446115493774, -0.21394279599189758, -0.26926904916763306, -0.08360449969768524, -0.5212862491607666, 0.3030799627304077, 0.2720203697681427, 0.14513079822063446, 0.04582803696393967, -0.04533643648028374, -0.11261609196662903, 0.2104501575231552, -0.475884348154068, -0.21932795643806458, -0.19292384386062622, 0.10061026364564896, -0.04937857389450073, -0.00677156075835228, 0.25990474224090576, -0.16566291451454163, 0.2311401069164276, 0.23171977698802948, -0.008268842473626137, -0.3556133806705475, -0.18696454167366028, 0.04331965744495392, -0.06338897347450256, 0.04474613815546036, -0.024166546761989594, 0.04064615070819855, -0.09092026948928833, -0.3498137891292572, 0.1478661745786667, 0.07421129941940308, -0.07347863912582397, 0.3802950382232666, 0.2998427450656891, -0.30953505635261536, -0.14716854691505432, -0.13238294422626495, -0.17736348509788513, 0.16991454362869263, 0.11909191310405731, -0.025427639484405518, 0.07894806563854218, -0.2010384202003479, 0.2115904986858368, 0.10265453904867172, 0.21147429943084717, 0.026405945420265198, 0.3262663185596466, 0.04050673544406891, -0.07651009410619736, -0.06400921195745468, 0.5510303974151611, 0.14407968521118164, 0.03648796305060387, -0.14605896174907684, 0.3046882450580597, 0.35135355591773987, -0.4535452723503113, -0.259573370218277, 0.011639219708740711, -0.2098446786403656, 0.1795637607574463, 0.2960972487926483, -0.008697763085365295, 0.018820106983184814, -0.03257821500301361, -0.043284088373184204, 0.3497309386730194, -0.20773078501224518, -0.3735054135322571, 0.2640432119369507, 0.11368092894554138, 0.13271988928318024, 0.32710689306259155, 0.3234957754611969, 0.05132092162966728, 0.467602014541626, 0.009272903203964233, 0.006770102307200432, 0.10214510560035706, 0.2368621677160263, 0.05377538129687309, 0.17735986411571503, 0.06727039813995361, 0.1522185057401657, 0.013270542025566101, 0.1645975112915039, 0.21763019263744354, 0.47439825534820557, 0.46884411573410034, -0.03958619385957718, -0.07561001181602478, 0.18683071434497833, -0.07987897098064423, -0.04565959423780441, -0.188158318400383, -0.11061541736125946, -0.28745102882385254, -0.05743725597858429, 0.07164506614208221, -0.12503425776958466, 0.47111421823501587, 0.07416901737451553, 0.2859504818916321, -0.29483380913734436, -0.0439591184258461, 0.05401900038123131, 0.18221893906593323, -0.24807408452033997, -0.09860006719827652, 0.26746493577957153, 0.09486135095357895, 0.04081738367676735, 0.2452775537967682, 0.2607862651348114, 0.11451411992311478, -0.13287365436553955, 0.09910164773464203, -0.263497918844223, -0.12817102670669556, -0.07325713336467743, 0.14039158821105957, 0.3548929989337921, 0.26173293590545654, 0.07139608263969421, 0.23851469159126282, -0.2735058069229126, 0.10726234316825867, 0.0025522448122501373, 0.05699021369218826, 0.03806091472506523, 0.1506558060646057, 0.19683197140693665, -0.5286504626274109, -0.19672183692455292, -0.37900492548942566, -0.5372137427330017, 0.2728042006492615, 0.36794430017471313, -0.0012104255147278309, -0.018751472234725952, -0.043932899832725525, 0.15594299137592316, 0.09617532789707184, 0.5469945073127747, 0.30661967396736145, 0.1692032366991043, -0.2144530862569809, -0.2473888397216797, -0.5666813254356384, 0.15527436137199402, -0.2993222773075104, -0.40702295303344727, 0.2274412214756012, 0.10371868312358856, 0.2630351185798645, 0.06442093104124069, 0.24988104403018951, -0.08671760559082031, -0.4137572646141052, 0.05158254876732826, -0.46674925088882446, -0.1687394380569458, 0.06967198103666306, 0.09054438024759293, -0.09110261499881744, -0.10267085582017899, 0.19426672160625458, 0.1123751699924469, 0.2486289143562317, -0.30697834491729736, -0.01824222132563591, -0.027040794491767883, 0.12383691221475601, 0.23743928968906403, 0.05430028587579727, 0.058192428201436996, -0.31523436307907104, -0.06916799396276474, 0.2433958649635315, -0.15141940116882324, 0.11552600562572479, 0.310553640127182, 0.09796041250228882, 0.26323193311691284, -0.046467505395412445, -0.41256415843963623, -0.3081914782524109, 0.05759231746196747, 0.11148448288440704, -0.11550706624984741, -0.29923325777053833, 0.29750630259513855, 0.1828848421573639, -0.11766978353261948, -0.2611042559146881, 0.24429073929786682, 0.06133591756224632, -0.19711029529571533, -0.3108687996864319, -0.36867210268974304, 0.4142915606498718, -0.5133086442947388, -0.380999892950058, 0.2397727072238922, -0.01806551218032837, 0.4696127772331238, 0.1887977570295334, -0.6306344866752625, -0.032574016600847244, 0.1667119860649109, -0.1099870577454567, -0.3672095537185669, 0.3264692425727844, 0.0014551430940628052, 0.16616536676883698, -0.13244661688804626, 0.050241097807884216, 0.05126459151506424, -0.28999391198158264, -0.26039057970046997, -0.43450331687927246 ]
https://github.com/huggingface/datasets/issues/6010
Improve `Dataset`'s string representation
@mariosasko are there any other similar issues that I could work on? I see this has been already solved.
Currently, `Dataset.__repr__` outputs a dataset's column names and the number of rows. We could improve it by printing its features and the first few rows. We should also implement `_repr_html_` to have a rich HTML representation in notebooks/Streamlit.
19
Improve `Dataset`'s string representation Currently, `Dataset.__repr__` outputs a dataset's column names and the number of rows. We could improve it by printing its features and the first few rows. We should also implement `_repr_html_` to have a rich HTML representation in notebooks/Streamlit. @mariosasko are there any other similar issues that I could work on? I see this has been already solved.
[ -0.24637500941753387, -0.0939534604549408, -0.15906314551830292, 0.2803182601928711, 0.4878693222999573, 0.09331364184617996, 0.081155925989151, 0.46818289160728455, -0.20165389776229858, 0.05637352168560028, 0.0302964448928833, 0.23728081583976746, 0.06472806632518768, 0.32773154973983765, 0.18072612583637238, -0.3050394654273987, 0.17368696630001068, 0.22153328359127045, 0.00020486116409301758, -0.19426579773426056, -0.1183195635676384, 0.10095413029193878, -0.029639925807714462, 0.12251830101013184, -0.08139549195766449, -0.115180604159832, -0.02921711467206478, 0.008190464228391647, -0.20730136334896088, -0.2394399344921112, -0.30452588200569153, 0.0380273312330246, 0.2422124743461609, -0.06608285754919052, -0.00010934031888609752, -0.1968066394329071, 0.28603506088256836, 0.12401674687862396, -0.41642308235168457, 0.09944839775562286, -0.12008081376552582, -0.38661301136016846, 0.1963968575000763, -0.14567847549915314, 0.12382049113512039, -0.22274376451969147, -0.06010976433753967, -0.29364490509033203, 0.19933779537677765, 0.22507351636886597, 0.24401608109474182, 0.1763346791267395, -0.35071781277656555, 0.07592210173606873, 0.4502173662185669, 0.655104398727417, -0.2868490219116211, -0.03243197873234749, 0.5934630632400513, 0.027148136869072914, -0.11725432425737381, 0.31002798676490784, -0.2774871289730072, 0.06566411256790161, 0.08487209677696228, 0.2606085538864136, -0.2311999499797821, -0.010012339800596237, 0.30245310068130493, 0.19650563597679138, 0.7088383436203003, -0.16577017307281494, -0.14227089285850525, -0.05996093899011612, 0.08710208535194397, -0.2142191380262375, 0.07205960154533386, 0.17954881489276886, -0.04166816920042038, 0.4426717162132263, -0.40446779131889343, -0.3549380600452423, -0.2877648174762726, 0.029062122106552124, 0.08139349520206451, 0.0073073506355285645, -0.08271494507789612, -0.09122172743082047, -0.13126645982265472, 0.026391159743070602, 0.3211219608783722, -0.09284264594316483, -0.11427721381187439, -0.11149747669696808, -0.18901251256465912, 0.200656920671463, -0.13114693760871887, -0.01821894943714142, 0.11568509787321091, 0.11943651735782623, 0.5118367671966553, 0.39000415802001953, 0.12333421409130096, 0.05047166720032692, -0.0005815606564283371, 0.09221284091472626, 0.2071627378463745, 0.49743589758872986, 0.40614283084869385, -0.024623950943350792, 0.008374180644750595, -0.2341647446155548, -0.2648572027683258, 0.4407646358013153, 0.21918292343616486, 0.01609990932047367, 0.09135404974222183, -0.22600139677524567, -0.16459527611732483, 0.39887353777885437, -0.25965508818626404, -0.2146141529083252, 0.08441047370433807, 0.3673419952392578, -0.2222396731376648, 0.3437633812427521, 0.17328189313411713, -0.14266681671142578, 0.18172071874141693, -0.7180560231208801, -0.10558626055717468, -0.18316811323165894, -0.28142836689949036, 0.062369465827941895, -0.07251511514186859, -0.0660744458436966, -0.09622161835432053, -0.12123985588550568, 0.18143188953399658, 0.036649174988269806, 0.12433615326881409, -0.1404636949300766, 0.10973101854324341, 0.06585747748613358, -0.2829098403453827, 0.18920132517814636, -0.04282654449343681, -0.010701078921556473, -0.07610435783863068, 0.08688214421272278, -0.1174575611948967, -0.22340649366378784, -0.27753421664237976, 0.23019781708717346, 0.013273276388645172, 0.055856186896562576, -0.3539876937866211, 0.19792824983596802, -0.05126228183507919, 0.09527607262134552, -0.05544225126504898, -0.049890339374542236, 0.06075211241841316, -0.29717957973480225, 0.35927411913871765, 0.059681013226509094, -0.5064218640327454, 0.09409329295158386, -0.06398212164640427, -0.0847625732421875, 0.5918558835983276, 0.17899689078330994, 0.08765438199043274, 0.2552097737789154, 0.020560642704367638, 0.057620882987976074, 0.5428396463394165, -0.14380177855491638, -0.32246899604797363, 0.4955475330352783, 0.2492244988679886, 0.0338953360915184, 0.04304155707359314, 0.16586576402187347, 0.36191001534461975, 0.2616439163684845, -0.05049693584442139, 0.46152621507644653, -0.037156276404857635, 0.03997772932052612, -0.3039979934692383, 0.047149017453193665, 0.008001307025551796, 0.38617995381355286, 0.05240893363952637, 0.03031120076775551, 0.0033915340900421143, -0.15604835748672485, 0.348202645778656, -0.2892725169658661, 0.23323002457618713, -0.13777853548526764, 0.3868470788002014, 0.182227224111557, -0.1051819697022438, -0.25029581785202026, -0.2994921803474426, -0.03829265385866165, 0.19568273425102234, -0.08303576707839966, 0.046947747468948364, -0.2864570617675781, -0.02204773761332035, 0.2660492956638336, 0.02871481515467167, 0.13746146857738495, 0.14960987865924835, 0.28424781560897827, -0.2246919572353363, 0.026222843676805496, -0.16298580169677734, 0.4765298366546631, -0.45091158151626587, -0.08413644880056381, -0.02915208786725998, 0.2895362973213196, 0.16259032487869263, -0.08866031467914581, 0.03453657776117325, 0.13906241953372955, -0.04279332607984543, 0.12440279871225357, -0.019086714833974838, 0.3297205865383148, 0.05353417992591858, -0.12033779919147491, 0.020347321406006813, -0.02704070508480072, 0.28298652172088623, -0.10200509428977966, 0.14394007623195648, 0.18357639014720917, -0.09826340526342392, -0.0031245797872543335, -0.24511834979057312, 0.004491813480854034, -0.1411341279745102, 0.14305779337882996, -0.03364865109324455, 0.1485101282596588, 0.10150212049484253, 0.19592930376529694, -0.024202989414334297, -0.23462481796741486, 0.15741586685180664, 0.10845336318016052, 0.31667470932006836, -0.039605140686035156, -0.7575669884681702, 0.181115984916687, 0.32614099979400635, -0.2842021882534027, 0.030022572726011276, 0.3212963342666626, -0.12329260259866714, -0.05101613700389862, 0.2644382119178772, 0.3626459240913391, 0.028352558612823486, 0.30196163058280945, 0.17247438430786133, 0.005332814529538155, 0.046265341341495514, -0.07396592199802399, 0.12842749059200287, -0.031719863414764404, 0.013443414121866226, 0.042280275374650955, 0.1333603709936142, -0.15698902308940887, -0.12955021858215332, -0.1423208862543106, -0.10153710842132568, 0.36119189858436584, -0.1942688524723053, -0.14765748381614685, -0.4629859924316406, -0.4259665608406067, -0.08498484641313553, -0.09204647690057755, -0.04608361795544624, -0.32522156834602356, 0.1228858157992363, -0.11276233196258545, -0.09751361608505249, 0.14269061386585236, -0.015562260523438454, 0.32082948088645935, -0.029723916202783585, 0.2143377959728241, -0.3861829340457916, -0.10197263956069946, -0.4257551431655884, 0.09298701584339142, 0.2516583800315857, 0.22412988543510437, 0.3806532621383667, -0.3559664189815521, 0.18771255016326904, -0.5588141083717346, -0.09612041711807251, 0.30056580901145935, -0.013984017074108124, 0.29735034704208374, 0.255540132522583, 0.030415497720241547, -0.17553222179412842, 0.0229991152882576, 0.2965497672557831, 0.019815737381577492, -0.09442831575870514, 0.15419995784759521, 0.1541912853717804, -0.25746700167655945, 0.04380538687109947, -0.1760619580745697, -0.2410043627023697, -0.3992205560207367, 0.2076950967311859, -0.2615545094013214, 0.23021939396858215, -0.27667877078056335, -0.08780208975076675, 0.008661245927214622, 0.03763743117451668, 0.1837754100561142, -0.1759534627199173, -0.38297438621520996, 0.5001043081283569, -0.0845138281583786, -0.348602294921875, -0.09992971271276474, 0.27632611989974976, -0.28941911458969116, 0.3351173996925354, -0.4509088397026062, -0.05949531868100166, -0.12321358919143677, -0.05257822945713997, 0.007308755069971085, 0.05928632989525795, -0.09958885610103607, 0.20476418733596802, -0.1725165843963623, 0.030367255210876465, -0.1901906579732895, -0.0067557692527771, -0.058720335364341736, 0.1816038191318512, 0.11135786026716232, 0.3729374408721924, -0.13138289749622345, 0.003409355878829956, 0.10323736071586609, 0.020750507712364197, 0.12349377572536469, -0.055402226746082306, 0.20730142295360565, 0.0431537851691246, -0.26865413784980774, -0.01623513177037239, -0.1545981764793396, -0.181135892868042, 0.36332815885543823, 0.03155048191547394, -0.01698644645512104, -0.004629682749509811, -0.19381719827651978, -0.20037758350372314, -0.1158636063337326, 0.3712863028049469, -0.16921989619731903, 0.4385779798030853, -0.2392425537109375, 0.16771432757377625, 0.1457822322845459, -0.11238423734903336, 0.19233398139476776, -0.1047523021697998, -0.019460298120975494, -0.04418559744954109, -0.4196479320526123, -0.1530425250530243, -0.22534283995628357, 0.448492169380188, 0.2405479997396469, 0.3687933087348938, -0.1883416324853897, -0.2895070016384125, 0.028179079294204712, 0.12036101520061493, 0.2878282964229584, -0.5260470509529114, -0.3011048436164856, 0.0880950540304184, -0.1979243904352188, 0.26321035623550415, -0.044960133731365204, -0.2936185598373413, 0.22073127329349518, -0.023317620158195496, 0.29066944122314453, -0.04500008746981621, -0.19107945263385773, 0.3202676475048065, 0.19765830039978027, -0.333322137594223, 0.006300241686403751, -0.06154056638479233, 0.13769087195396423, 0.1983046978712082, -0.058800287544727325, -0.2806752920150757, -0.12547291815280914, 0.1649482101202011, -0.24771395325660706, -0.1351570039987564, -0.02695597894489765, 0.2656693458557129, 0.46407440304756165, 0.31553158164024353, -0.410184770822525, 0.08474013209342957, 0.08693969249725342, 0.4030921459197998, 0.5526230931282043, 0.21842223405838013, -0.3893122673034668, -0.44014978408813477, 0.009926035068929195, -0.5505465269088745, 0.722175121307373, 0.05412746220827103, -0.10628965497016907, 0.04002702981233597, 0.11919687688350677, 0.10382654517889023, -0.26065605878829956, -0.08894651383161545, 0.29350700974464417, 0.14900705218315125, -0.3029192388057709, -0.58779376745224, 0.27269887924194336, -0.07324043661355972, -0.1645999252796173, 0.09635908156633377, 0.04368837922811508, -0.18900896608829498, 0.1586827039718628, 0.4145560562610626, 1.0873337984085083, -0.17537225782871246, -0.06654922664165497, -0.200651615858078, -0.594275176525116, 0.21857957541942596, -0.38650965690612793, -0.0341520681977272, -0.36110472679138184, -0.28067079186439514, -0.13096289336681366, 0.06568753719329834, 0.28118517994880676, -0.01993747055530548, -0.46243712306022644, 0.14868350327014923, 0.13295528292655945, 0.10366545617580414, 0.1590471714735031, 0.2734545171260834, 0.09581508487462997, -0.17080916464328766, -0.36721503734588623, 0.1408243179321289, -0.39670032262802124, -0.7062702775001526, -0.006747919134795666, -0.01899906061589718, 0.056291673332452774, 0.04794680327177048, -0.33672377467155457, -0.14287680387496948, -0.18129584193229675, -0.13621288537979126, 0.165474534034729, -0.4581759572029114, 0.08585849404335022, 0.08058319985866547, 0.033747170120477676, 0.26400047540664673, -0.013750175014138222, -0.03492531552910805, -0.17321962118148804, 0.33539706468582153, 0.03254985064268112, -0.060359179973602295, 0.25977733731269836, 0.0322890505194664, -0.24710646271705627, 0.1353672444820404, 0.26586052775382996, -0.11715321242809296, -0.25025704503059387, -0.20225296914577484, 0.46035802364349365, -0.39960119128227234, 0.05050460621714592, -0.09362630546092987, -0.0616200789809227, -0.271929532289505, 0.14207617938518524, 0.014480959624052048, -0.11198544502258301, 0.19495636224746704, 0.3486582338809967, -0.08254677057266235, -0.09892670810222626, -0.03781648725271225, 0.17555677890777588, -0.12876224517822266, -0.04366430640220642, 0.33198001980781555, -0.38709795475006104, -0.33161455392837524, 0.25056758522987366, 0.25863438844680786, -0.06138524040579796, 0.11784765124320984, -0.4190157651901245, -0.31836313009262085, -0.12877067923545837, 0.31785106658935547, 0.20918215811252594, -0.26300734281539917, -0.3223952353000641, -0.15646860003471375, -0.39329665899276733, 0.3126005530357361, 0.33574238419532776, 0.21101157367229462, -0.2237548530101776, -0.31035006046295166, -0.11279679089784622, 0.2773723006248474, -0.355578750371933, -0.2972516417503357, -0.09365946799516678, -0.02233622968196869, -0.13295750319957733, 0.1222413182258606, 0.13197879493236542, -0.20266416668891907, 0.139364093542099, 0.03683866560459137, 0.05215360224246979, -0.2000320553779602, -0.15485967695713043, 0.1378098428249359, -0.1318703293800354, 0.17810611426830292, 0.020932435989379883, -0.03113975003361702, 0.04612330347299576, -0.4817716181278229, -0.008641216903924942, 0.03400319814682007, -0.03910118341445923, 0.44724950194358826, 0.19094666838645935, -0.13013169169425964, -0.19403649866580963, -0.001812133938074112, -0.13454918563365936, 0.23629657924175262, 0.06447166949510574, -0.0939837247133255, 0.44682928919792175, -0.17545625567436218, 0.1256084144115448, 0.08250749856233597, 0.2990749478340149, -0.010891091078519821, 0.49237242341041565, -0.03185778856277466, 0.09740489721298218, 0.18906278908252716, 0.4554098844528198, 0.19553400576114655, 0.10299456864595413, -0.15192705392837524, 0.24362334609031677, 0.2718401253223419, -0.33302927017211914, -0.3067777454853058, 0.16839100420475006, -0.21121598780155182, -0.13107366859912872, 0.22779804468154907, 0.0057983919978141785, 0.005951650440692902, 0.003000296652317047, -0.017826013267040253, 0.4268953502178192, -0.24091719090938568, -0.17513999342918396, 0.24293914437294006, 0.09588697552680969, 0.1406785100698471, 0.1092061772942543, 0.1834488958120346, 0.022785231471061707, 0.5106213092803955, 0.08872070908546448, 0.021699953824281693, 0.3488202393054962, 0.4903450310230255, -0.02036401629447937, -0.022629547864198685, 0.1895684152841568, 0.12325062602758408, -0.08227922022342682, 0.2887914478778839, 0.107408307492733, 0.30359676480293274, 0.26541364192962646, -0.09945943206548691, -0.12536026537418365, 0.009168744087219238, -0.05123591423034668, 0.049690619111061096, -0.12943720817565918, -0.12022002041339874, -0.3287877142429352, 0.050614725798368454, -0.012155819684267044, 0.066534124314785, 0.5475669503211975, 0.06227339059114456, 0.20703065395355225, -0.2936149835586548, -0.019326258450746536, -0.1672581136226654, 0.13561341166496277, -0.3228200674057007, 0.03791347146034241, 0.10391522198915482, 0.27003201842308044, 0.12538889050483704, 0.30443698167800903, 0.18996380269527435, 0.3566497266292572, -0.10048818588256836, 0.1201472356915474, -0.26462382078170776, -0.08652355521917343, -0.06447170674800873, 0.3967391848564148, 0.3074803054332733, 0.16768862307071686, -0.013995804823935032, 0.13587497174739838, -0.08098655939102173, 0.3183319568634033, -0.12951631844043732, -0.16869376599788666, 0.09318488836288452, 0.22055953741073608, 0.29062026739120483, -0.5930887460708618, -0.21356864273548126, -0.44019052386283875, -0.49288833141326904, 0.17050737142562866, 0.4376009702682495, 0.06634233891963959, -0.05359485745429993, 0.09290802478790283, 0.10389646142721176, 0.0978015810251236, 0.42045876383781433, 0.3549847900867462, 0.004868209362030029, -0.18188178539276123, -0.3718581795692444, -0.503809928894043, 0.10015448927879333, -0.12832573056221008, -0.42780986428260803, 0.2649919092655182, 0.06516069173812866, 0.37222692370414734, 0.07933975756168365, 0.2286500334739685, -0.17848050594329834, -0.4460591971874237, 0.11730879545211792, -0.40066927671432495, -0.24375705420970917, 0.3752264976501465, 0.14728616178035736, -0.19700933992862701, -0.04577082395553589, 0.37351271510124207, 0.21807806193828583, 0.07671629637479782, -0.33524298667907715, -0.023644492030143738, 0.06330810487270355, 0.07936553657054901, 0.27507734298706055, 0.11750684678554535, 0.07255738973617554, -0.19165000319480896, -0.10445015877485275, 0.09238661825656891, -0.23311981558799744, 0.20836853981018066, 0.5544770956039429, 0.031899482011795044, 0.15994448959827423, -0.09478788822889328, -0.14562112092971802, -0.4106508791446686, 0.11797083914279938, 0.0909673273563385, 0.03550029546022415, -0.4983829855918884, 0.23152808845043182, 0.023274220526218414, -0.11218912154436111, -0.06965082138776779, 0.17972421646118164, -0.024395637214183807, -0.16379305720329285, -0.3955061435699463, -0.1830817013978958, 0.36040446162223816, -0.3482534885406494, -0.3547816574573517, 0.08940479904413223, 0.09716551005840302, 0.47497743368148804, 0.2773859202861786, -0.8428736329078674, -0.3434154689311981, 0.28230226039886475, -0.24363598227500916, -0.25079670548439026, 0.460798978805542, 0.16013458371162415, 0.19067499041557312, -0.07823289930820465, 0.2057383805513382, -0.004514891654253006, -0.2811393141746521, -0.1976647973060608, -0.3645075559616089 ]
https://github.com/huggingface/datasets/issues/6008
Dataset.from_generator consistently freezes at ~1000 rows
By default, we write data to disk (so it can be memory-mapped) every 1000 rows/samples. You can control this with the `writer_batch_size` parameter. Also, when working with fixed-size arrays, the `ArrayXD` feature types yield better performance (e.g., in your case, `features=datasets.Features({"i": datasets.Array3D(shape=(512,512,3), dtype="float32")})` should be faster). Our support for multi-dim arrays could be better, and we plan to improve it as part of https://github.com/huggingface/datasets/issues/5272.
### Describe the bug Whenever I try to create a dataset which contains images using `Dataset.from_generator`, it freezes around 996 rows. I suppose it has something to do with memory consumption, but there's more memory available. I Somehow it worked a few times but mostly this makes the datasets library much more cumbersome to work with because generators are the easiest way to turn an existing dataset into a Hugging Face dataset. I've let it run in the frozen state for way longer than it can possibly take to load the actual dataset. Let me know if you have ideas how to resolve it! ### Steps to reproduce the bug ```python from datasets import Dataset import numpy as np def gen(): for row in range(10000): yield {"i": np.random.rand(512, 512, 3)} Dataset.from_generator(gen) # -> 90% of the time gets stuck around 1000 rows ``` ### Expected behavior Should continue and go through all the examples yielded by the generator, or at least throw an error or somehow communicate what's going on. ### Environment info - `datasets` version: 2.8.0 - Platform: Linux-5.15.0-52-generic-x86_64-with-glibc2.29 - Python version: 3.8.10 - PyArrow version: 12.0.1 - Pandas version: 1.5.1
64
Dataset.from_generator consistently freezes at ~1000 rows ### Describe the bug Whenever I try to create a dataset which contains images using `Dataset.from_generator`, it freezes around 996 rows. I suppose it has something to do with memory consumption, but there's more memory available. I Somehow it worked a few times but mostly this makes the datasets library much more cumbersome to work with because generators are the easiest way to turn an existing dataset into a Hugging Face dataset. I've let it run in the frozen state for way longer than it can possibly take to load the actual dataset. Let me know if you have ideas how to resolve it! ### Steps to reproduce the bug ```python from datasets import Dataset import numpy as np def gen(): for row in range(10000): yield {"i": np.random.rand(512, 512, 3)} Dataset.from_generator(gen) # -> 90% of the time gets stuck around 1000 rows ``` ### Expected behavior Should continue and go through all the examples yielded by the generator, or at least throw an error or somehow communicate what's going on. ### Environment info - `datasets` version: 2.8.0 - Platform: Linux-5.15.0-52-generic-x86_64-with-glibc2.29 - Python version: 3.8.10 - PyArrow version: 12.0.1 - Pandas version: 1.5.1 By default, we write data to disk (so it can be memory-mapped) every 1000 rows/samples. You can control this with the `writer_batch_size` parameter. Also, when working with fixed-size arrays, the `ArrayXD` feature types yield better performance (e.g., in your case, `features=datasets.Features({"i": datasets.Array3D(shape=(512,512,3), dtype="float32")})` should be faster). Our support for multi-dim arrays could be better, and we plan to improve it as part of https://github.com/huggingface/datasets/issues/5272.
[ -0.2339242845773697, 0.08639436960220337, -0.02167588099837303, 0.5308255553245544, 0.2555151581764221, 0.06502681225538254, 0.182708278298378, 0.12610264122486115, 0.018689483404159546, 0.1380024403333664, 0.36856281757354736, 0.07000739127397537, -0.11341311782598495, -0.04352317750453949, 0.21163654327392578, -0.16280098259449005, 0.18643957376480103, 0.03335843235254288, -0.15204721689224243, 0.11200597882270813, -0.19376787543296814, 0.2295466661453247, -0.08766485005617142, -0.13756433129310608, -0.5043576955795288, 0.02291923016309738, 0.0786878913640976, 0.07606557756662369, -0.0935613214969635, -0.3485187292098999, 0.05156251788139343, 0.0006254091858863831, -0.11453161388635635, 0.56371009349823, -0.00011657401046250015, -0.22443652153015137, 0.39466774463653564, 0.16028814017772675, -0.2565641403198242, 0.06415940076112747, 0.11963290721178055, -0.19873064756393433, -0.17921046912670135, 0.1356724202632904, 0.07975412160158157, -0.17916239798069, -0.0719754695892334, -0.34648165106773376, 0.12234572321176529, -0.052465926855802536, 0.0836464986205101, 0.32239341735839844, 0.2965673506259918, -0.039050716906785965, 0.10245531797409058, 0.13681796193122864, -0.20453248918056488, 0.11878266930580139, 0.10920624434947968, -0.38344332575798035, 0.16552290320396423, 0.212992325425148, -0.13124793767929077, -0.09944620728492737, 0.6180314421653748, 0.039833661168813705, -0.43631935119628906, -0.4537251591682434, 0.14489130675792694, 0.5133005380630493, 0.11524388194084167, -0.1417311429977417, -0.055018775165081024, -0.40547722578048706, 0.013362499885261059, -0.15448826551437378, 0.12960326671600342, 0.15959233045578003, -0.5288105010986328, -0.11928938329219818, -0.44601646065711975, -0.3094353973865509, -0.13826051354408264, 0.052703555673360825, -0.0919216126203537, -0.4760788381099701, 0.01987532526254654, 0.15269649028778076, 0.6393073797225952, 0.05576656758785248, 0.14567765593528748, -0.32421875, -0.08046428859233856, -0.026995889842510223, -0.5286961793899536, 0.11996722221374512, 0.08159863203763962, 0.13800597190856934, 0.3292008936405182, -0.17087315022945404, 0.031215589493513107, -0.05156987905502319, 0.1684882640838623, 0.01943099871277809, 0.18005360662937164, -0.02663315460085869, -0.20193257927894592, -0.0011540399864315987, 0.36103731393814087, 0.22731593251228333, -0.19872480630874634, 0.012686396017670631, -0.04656762257218361, -0.4156593978404999, 0.3721015155315399, -0.5013092160224915, -0.06593114137649536, 0.002784010022878647, -0.08749765902757645, 0.34681782126426697, -0.20416906476020813, 0.07764464616775513, 0.16241909563541412, 0.14718177914619446, -0.04884220287203789, 0.22698935866355896, 0.06431835889816284, -0.057846084237098694, -0.2545604109764099, -0.3987875282764435, -0.20120328664779663, -0.15626463294029236, -0.18685288727283478, 0.1627143919467926, 0.11031953990459442, -0.34844088554382324, -0.11849089711904526, 0.04467504471540451, 0.13505002856254578, -0.03561892360448837, 0.18020349740982056, -0.24428167939186096, 0.09055499732494354, 0.28259027004241943, -0.12830811738967896, 0.05915544182062149, -0.011513292789459229, 0.005954228341579437, -0.017676793038845062, 0.2485702633857727, 0.22160977125167847, -0.06542231887578964, 0.08365195244550705, 0.03248782455921173, -0.19016076624393463, 0.47275030612945557, -0.34200960397720337, 0.11639811098575592, 0.3018113672733307, 0.1216130405664444, 0.06464564800262451, -0.2228817492723465, -0.12663495540618896, -0.1705966293811798, 0.33967211842536926, 0.7386093139648438, -0.4170776307582855, 0.42112305760383606, -0.17905783653259277, -0.15526796877384186, 0.02246137708425522, 0.319103479385376, -0.04872683435678482, 0.13422688841819763, -0.23529770970344543, -0.3763854503631592, -0.15549427270889282, 0.41494011878967285, -0.35555437207221985, 0.17374612390995026, -0.06527628749608994, 0.1792386770248413, 0.03592032939195633, 0.3857303559780121, -0.018471185117959976, -0.01209160964936018, 0.3832307755947113, 0.4003511667251587, -0.29625973105430603, 0.10788682848215103, -0.3289835453033447, -0.34207653999328613, -0.14016053080558777, 0.19892092049121857, -0.18257814645767212, 0.110768161714077, -0.10606306046247482, -0.03638960048556328, -0.04959601163864136, -0.20370402932167053, 0.031920988112688065, 0.3001624345779419, 0.12946908175945282, -0.0019057393074035645, 0.03213571757078171, -0.17600971460342407, -0.6538846492767334, 0.2607221305370331, -0.058562830090522766, 0.035242024809122086, -0.2697523832321167, 0.059418320655822754, 0.14944928884506226, 0.11284338682889938, -0.004324126988649368, -0.06958721578121185, -0.10223670303821564, -0.010988228023052216, 0.21149961650371552, 0.16260111331939697, -0.14252610504627228, 0.3788323700428009, -0.026922104880213737, 0.22426635026931763, -0.7463832497596741, 0.420979380607605, 0.09347020834684372, -0.2340456247329712, -0.14855453372001648, -0.08477125316858292, -0.13188767433166504, -0.009320235811173916, -0.09299805015325546, 0.3700833320617676, 0.11927381157875061, 0.35191261768341064, -0.39572691917419434, 0.05162233114242554, 0.13523615896701813, -0.009808361530303955, 0.22749541699886322, -0.1294926553964615, 0.09893946349620819, 0.05881546437740326, 0.22371095418930054, 0.09396787732839584, -0.4959443509578705, 0.19043603539466858, -0.041861940175294876, -0.043387167155742645, -0.044614605605602264, 0.26734626293182373, 0.06470023095607758, 0.008942373096942902, 0.2823007106781006, 0.3480304181575775, 0.20729926228523254, 0.1525491178035736, -0.475543349981308, 0.15201696753501892, 0.3833356201648712, -0.07467646896839142, -0.05778130888938904, 0.1749253273010254, -0.13718169927597046, -0.15486103296279907, -0.039632417261600494, 0.39283204078674316, 0.3056361675262451, 0.045123495161533356, -0.1983313262462616, -0.02264818735420704, -0.15364238619804382, -0.18778659403324127, 0.2800896167755127, 0.09417610615491867, 0.23293045163154602, -0.04142928123474121, 0.009295151568949223, -0.12162835150957108, -0.22597873210906982, -0.11652754247188568, -0.10880076885223389, 0.4225665032863617, -0.14041148126125336, 0.29356926679611206, -0.07319609820842743, -0.08334831893444061, 0.10467629879713058, 0.16933414340019226, -0.48246490955352783, -0.12345688045024872, -0.24440045654773712, 0.3734411597251892, -0.12301205098628998, -0.20959381759166718, 0.002443332225084305, 0.23579737544059753, 0.24343375861644745, 0.08454626798629761, -0.3009316921234131, -0.18750689923763275, -0.2553950846195221, -0.06293674558401108, 0.398822546005249, -0.008273696526885033, 0.2974627912044525, 0.0390506237745285, -0.12552610039710999, -0.1492868959903717, -0.1377391219139099, 0.07000753283500671, -0.1348264217376709, 0.6961286664009094, 0.24182824790477753, 0.5243452191352844, -0.15677094459533691, 0.20799443125724792, 0.22887204587459564, -0.3231235146522522, -0.09123419970273972, 0.22948460280895233, 0.11591679602861404, 0.07779064774513245, -0.0981278270483017, 0.16325995326042175, 0.007563754916191101, -0.2673751711845398, 0.2538442611694336, -0.16862745583057404, 0.12815259397029877, 0.17685993015766144, 0.574389636516571, 0.034689076244831085, -0.09613896906375885, -0.1622679978609085, -0.11418354511260986, -0.5402122139930725, 0.426730751991272, -0.09792431443929672, -0.3194722831249237, -0.11411996185779572, -0.2176811397075653, -0.22161716222763062, 0.4473404288291931, -0.5426098704338074, -0.016586262732744217, -0.5411640405654907, 0.1384376883506775, -0.10257802903652191, 0.0884106382727623, -0.0010573342442512512, 0.04470520839095116, 0.03796910494565964, -0.09483465552330017, -0.06028202176094055, 0.0441761277616024, -0.13504472374916077, 0.059644222259521484, 0.2843797206878662, 0.465899795293808, 0.013570889830589294, 0.26043206453323364, 0.27781644463539124, -0.13462255895137787, 0.3719537854194641, 0.12347417324781418, 0.4209561347961426, -0.3797391951084137, -0.3551585078239441, -0.036929331719875336, 0.08644767850637436, -0.34745514392852783, -0.291306734085083, 0.03640356659889221, 0.21862973272800446, -0.11573919653892517, 0.1517157107591629, 0.3093591630458832, -0.21223242580890656, 0.13112418353557587, 0.00641150027513504, 0.3983347415924072, 0.005881067365407944, 0.2078888714313507, -0.04257131367921829, -0.14664563536643982, -0.19522884488105774, -0.15762846171855927, 0.421654611825943, -0.19828517735004425, -0.3358948230743408, -0.10421495884656906, -0.5805976986885071, 0.0938255712389946, 0.16216063499450684, 0.10058718174695969, 0.07801422476768494, 0.17767292261123657, 0.09486749023199081, -0.12060138583183289, 1.0974544286727905, 0.015834281221032143, -0.06996235251426697, 0.00006704218685626984, -0.10945639759302139, -0.26345470547676086, 0.35207492113113403, 0.18852709233760834, -0.32875558733940125, -0.075916588306427, 0.06809782236814499, -0.47216764092445374, -0.20336249470710754, 0.034995876252651215, 0.624157726764679, -0.05062515661120415, -0.15180060267448425, -0.24309669435024261, -0.14317142963409424, -0.16863955557346344, -0.044025324285030365, -0.018406344577670097, 0.12501321732997894, 0.062283582985401154, -0.08375359326601028, 0.02791668474674225, -0.027171898633241653, -0.013280779123306274, 0.26331567764282227, 0.33036983013153076, -0.40560686588287354, 0.5287519693374634, 0.24808667600154877, -0.6128926277160645, 0.46123987436294556, 0.4296264350414276, -0.09441916644573212, 0.015258453786373138, 0.03870634734630585, 0.1996224969625473, -0.009989328682422638, 0.5633193254470825, -0.10577479004859924, -0.07147107273340225, -0.015736334025859833, 0.4421921372413635, -0.1002524197101593, -0.04850849136710167, 0.3595348596572876, 0.09013481438159943, 0.0025660493411123753, -0.6119263768196106, 0.3072562515735626, 0.15121476352214813, 0.14855295419692993, 0.3999929130077362, 0.31005024909973145, -0.0590582937002182, 0.1789553314447403, 0.1033361628651619, 0.8632712960243225, -0.19596154987812042, 0.35471242666244507, 0.13945268094539642, -0.022790761664509773, 0.7570593357086182, 0.11996603012084961, 0.05090570077300072, -0.32940220832824707, -0.2961343824863434, 0.05674825608730316, -0.33704331517219543, 0.2566690444946289, 0.1025700494647026, 0.24285724759101868, 0.10615433007478714, -0.06613367050886154, -0.11809661984443665, -0.12884828448295593, 0.1781240701675415, -0.267714262008667, -0.16856609284877777, -0.3257848024368286, 0.048863112926483154, -0.11632896959781647, 0.04948362335562706, 0.013527389615774155, -0.08572766929864883, -0.005187485367059708, 0.04467375576496124, -0.4197944402694702, 0.0540354922413826, -0.018729617819190025, 0.013864213600754738, 0.4368048906326294, -0.29648029804229736, -0.05772773176431656, 0.12379603087902069, 0.13290700316429138, 0.12584376335144043, -0.021202722564339638, 0.18998748064041138, -0.03817449510097504, -0.043272700160741806, 0.0981866791844368, -0.18745526671409607, 0.2639933228492737, -0.040150236338377, -0.20140774548053741, -0.061496295034885406, 0.07067665457725525, -0.21505814790725708, -0.18801435828208923, 0.02808212861418724, -0.19392912089824677, 0.019957736134529114, -0.1486324667930603, -0.10693870484828949, -0.07323801517486572, -0.20962700247764587, 0.08099103718996048, 0.42873185873031616, 0.13934607803821564, 0.22669553756713867, -0.24174420535564423, 0.058318883180618286, -0.133037269115448, 0.24039894342422485, -0.18028926849365234, 0.058334946632385254, 0.31285300850868225, 0.4756777882575989, -0.11913277953863144, -0.17886045575141907, 0.1993892788887024, 0.20876038074493408, -0.5592325329780579, 0.5895861387252808, -0.005668860860168934, 0.05646960437297821, -0.03960181027650833, -0.07314977049827576, -0.17206062376499176, -0.36698588728904724, 0.18529924750328064, -0.1737755835056305, -0.45336514711380005, 0.07354520261287689, 0.18138150870800018, 0.26566341519355774, -0.020304761826992035, -0.201903834939003, -0.14266295731067657, 0.08278998732566833, -0.18476462364196777, 0.004083878826349974, -0.07572545111179352, -0.016619067639112473, -0.021864190697669983, -0.2802450358867645, 0.1806815266609192, -0.26824381947517395, 0.03527048975229263, 0.21594791114330292, -0.23249249160289764, -0.13207599520683289, -0.11473579704761505, 0.1628599464893341, -0.09713633358478546, -0.6547066569328308, 0.15946732461452484, -0.28892970085144043, -0.09890548884868622, -0.11093349754810333, 0.2862955927848816, 0.08668344467878342, -0.13293881714344025, -0.27825042605400085, 0.16949833929538727, 0.19057613611221313, -0.06032118573784828, 0.2203228771686554, -0.32415008544921875, 0.36924779415130615, 0.2731044888496399, 0.15091918408870697, 0.01663113571703434, -0.20014238357543945, -0.5196341276168823, 0.16462114453315735, -0.14126059412956238, -0.16545754671096802, 0.766793429851532, -0.3258700966835022, -0.2017994374036789, 0.13711611926555634, 0.3459358811378479, 0.47160282731056213, -0.16363608837127686, -0.16450361907482147, 0.20841801166534424, 0.07714634388685226, -0.04701624810695648, -0.09400533139705658, -0.2670629620552063, 0.1125006228685379, -0.019959192723035812, 0.18356971442699432, -0.11430403590202332, -0.0812142863869667, -0.21115700900554657, 0.24105870723724365, 0.4802252948284149, -0.08598863333463669, 0.07862032949924469, 0.3106495440006256, 0.1790299415588379, 0.015534859150648117, 0.2109237164258957, 0.2803294360637665, 0.24983832240104675, 0.40788519382476807, 0.09858803451061249, -0.015324825420975685, -0.082815982401371, 0.16499409079551697, 0.13320115208625793, -0.3211570680141449, 0.04973319172859192, 0.5653847455978394, -0.18763118982315063, 0.06005525961518288, -0.09178248047828674, 0.09459125995635986, -0.19308669865131378, -0.06932162493467331, -0.12197688221931458, 0.3069690465927124, 0.11773674190044403, 0.057744015008211136, -0.08739250153303146, -0.11780476570129395, -0.03118344023823738, 0.35876211524009705, -0.04153895750641823, -0.3874041438102722, 0.18697158992290497, 0.29007697105407715, -0.015304900705814362, -0.24478794634342194, 0.20449692010879517, -0.02458084374666214, 0.25181642174720764, -0.049124825745821, -0.01747303642332554, 0.3373268246650696, -0.3114342987537384, -0.03231879696249962, 0.34226492047309875, 0.3323354423046112, 0.3261606991291046, -0.05573400482535362, 0.18288737535476685, -0.05339358374476433, -0.11417298763990402, -0.010387158021330833, 0.27637046575546265, -0.05423708260059357, 0.12269945442676544, 0.07855245471000671, -0.020124511793255806, -0.14687582850456238, -0.15111486613750458, 0.1356925219297409, 0.35144978761672974, -0.40088292956352234, 0.40587905049324036, -0.20795999467372894, -0.14696601033210754, -0.07752840965986252, -0.12639585137367249, -0.36320045590400696, 0.0008513424545526505, 0.24968022108078003, -0.26866331696510315, -0.10143710672855377, -0.23958592116832733, 0.02033008635044098, -0.10666033625602722, 0.6461856961250305, 0.2431517392396927, 0.21129441261291504, -0.20873504877090454, -0.2525949478149414, -0.47847485542297363, -0.09714806824922562, -0.37859463691711426, 0.25629982352256775, 0.21410605311393738, 0.13908573985099792, -0.11252181977033615, 0.2046934962272644, -0.05171850323677063, 0.2251238226890564, -0.21120429039001465, 0.5177876949310303, -0.18980029225349426, -0.2160613089799881, -0.04021889716386795, -0.16928233206272125, -0.2578893303871155, -0.46210822463035583, 0.45204848051071167, -0.49677902460098267, -0.034653037786483765, -0.014245361089706421, 0.1496862918138504, 0.025320880115032196, 0.3030042350292206, 0.1944015920162201, 0.3658526539802551, -0.0749521404504776, 0.20505058765411377, -0.4188143312931061, -0.29024577140808105, 0.14138799905776978, 0.06048059090971947, 0.019404157996177673, 0.21483038365840912, 0.4724711775779724, -0.1486993432044983, -0.3457716703414917, -0.4064646065235138, 0.39422017335891724, -0.08334377408027649, 0.1683218628168106, -0.2262357622385025, -0.07028892636299133, -0.06502006947994232, 0.18304544687271118, 0.4016066789627075, 0.289659708738327, -0.045858852565288544, -0.030209679156541824, -0.40768277645111084, -0.10458824783563614, 0.21130923926830292, -0.39488935470581055, -0.4355938732624054, -0.03606927767395973, 0.051042355597019196, 0.11796846240758896, -0.3705902099609375, -0.0831715539097786, 0.11642379313707352, 0.03550664335489273, -0.0701126828789711, -0.026235338300466537, 0.30898576974868774, 0.020198578014969826, 0.04631516709923744, 0.10777580738067627, 0.4146457612514496, 0.14089378714561462, -0.16383051872253418, 0.20123383402824402, -0.09567464143037796 ]
https://github.com/huggingface/datasets/issues/6008
Dataset.from_generator consistently freezes at ~1000 rows
> By default, we write data to disk (so it can be memory-mapped) every 1000 rows/samples. You can control this with the `writer_batch_size` parameter. Also, when working with fixed-size arrays, the `ArrayXD` feature types yield better performance (e.g., in your case, `features=datasets.Features({"i": datasets.Array3D(shape=(512,512,3), dtype="float32")})` should be faster). > > Our support for multi-dim arrays could be better, and we plan to improve it as part of #5272. Thanks for the explanation! The Image array was just for demonstration, I use PIL Images in practice. Does that make a difference? What's the best approach for a dataset with PIL Images as rows?
### Describe the bug Whenever I try to create a dataset which contains images using `Dataset.from_generator`, it freezes around 996 rows. I suppose it has something to do with memory consumption, but there's more memory available. I Somehow it worked a few times but mostly this makes the datasets library much more cumbersome to work with because generators are the easiest way to turn an existing dataset into a Hugging Face dataset. I've let it run in the frozen state for way longer than it can possibly take to load the actual dataset. Let me know if you have ideas how to resolve it! ### Steps to reproduce the bug ```python from datasets import Dataset import numpy as np def gen(): for row in range(10000): yield {"i": np.random.rand(512, 512, 3)} Dataset.from_generator(gen) # -> 90% of the time gets stuck around 1000 rows ``` ### Expected behavior Should continue and go through all the examples yielded by the generator, or at least throw an error or somehow communicate what's going on. ### Environment info - `datasets` version: 2.8.0 - Platform: Linux-5.15.0-52-generic-x86_64-with-glibc2.29 - Python version: 3.8.10 - PyArrow version: 12.0.1 - Pandas version: 1.5.1
101
Dataset.from_generator consistently freezes at ~1000 rows ### Describe the bug Whenever I try to create a dataset which contains images using `Dataset.from_generator`, it freezes around 996 rows. I suppose it has something to do with memory consumption, but there's more memory available. I Somehow it worked a few times but mostly this makes the datasets library much more cumbersome to work with because generators are the easiest way to turn an existing dataset into a Hugging Face dataset. I've let it run in the frozen state for way longer than it can possibly take to load the actual dataset. Let me know if you have ideas how to resolve it! ### Steps to reproduce the bug ```python from datasets import Dataset import numpy as np def gen(): for row in range(10000): yield {"i": np.random.rand(512, 512, 3)} Dataset.from_generator(gen) # -> 90% of the time gets stuck around 1000 rows ``` ### Expected behavior Should continue and go through all the examples yielded by the generator, or at least throw an error or somehow communicate what's going on. ### Environment info - `datasets` version: 2.8.0 - Platform: Linux-5.15.0-52-generic-x86_64-with-glibc2.29 - Python version: 3.8.10 - PyArrow version: 12.0.1 - Pandas version: 1.5.1 > By default, we write data to disk (so it can be memory-mapped) every 1000 rows/samples. You can control this with the `writer_batch_size` parameter. Also, when working with fixed-size arrays, the `ArrayXD` feature types yield better performance (e.g., in your case, `features=datasets.Features({"i": datasets.Array3D(shape=(512,512,3), dtype="float32")})` should be faster). > > Our support for multi-dim arrays could be better, and we plan to improve it as part of #5272. Thanks for the explanation! The Image array was just for demonstration, I use PIL Images in practice. Does that make a difference? What's the best approach for a dataset with PIL Images as rows?
[ -0.2846595048904419, 0.239802747964859, -0.03189597651362419, 0.5401877164840698, 0.27455562353134155, 0.07768196612596512, 0.22943243384361267, 0.1456352174282074, -0.06428156048059464, 0.14791373908519745, 0.4732198119163513, 0.16201145946979523, -0.09623213112354279, -0.16894274950027466, 0.17633026838302612, -0.14536423981189728, 0.17721855640411377, 0.05540236085653305, -0.1101391464471817, 0.09326446056365967, -0.2248648703098297, 0.1319873034954071, -0.10973401367664337, -0.0991465151309967, -0.508811891078949, -0.038587503135204315, 0.06685835868120193, 0.060702551156282425, -0.11363238841295242, -0.32608550786972046, -0.004764024168252945, -0.028464797884225845, -0.07937705516815186, 0.5585958957672119, -0.00011423924297560006, -0.21501223742961884, 0.4292653203010559, 0.16199922561645508, -0.23918814957141876, 0.07229970395565033, 0.020624011754989624, -0.18559490144252777, -0.23882189393043518, 0.03292163461446762, 0.1540999710559845, -0.18168725073337555, -0.047275930643081665, -0.3537895083427429, 0.07014448940753937, -0.03960934281349182, 0.09901700913906097, 0.20086482167243958, 0.2419448345899582, 0.016087081283330917, 0.123680479824543, 0.08559858798980713, -0.17550282180309296, 0.05448409914970398, 0.10861026495695114, -0.4039516746997833, 0.16115286946296692, 0.19589145481586456, -0.1628556251525879, -0.047279227524995804, 0.5518106818199158, 0.03771766647696495, -0.39661911129951477, -0.4543820023536682, 0.16855168342590332, 0.46481117606163025, 0.18407827615737915, -0.10139002650976181, -0.039075084030628204, -0.3371534049510956, 0.031242627650499344, -0.12696707248687744, 0.12672139704227448, 0.16789796948432922, -0.5472927689552307, -0.17538921535015106, -0.4267662465572357, -0.3240813910961151, -0.18479403853416443, 0.07540815323591232, -0.14951476454734802, -0.4421360194683075, 0.1047431230545044, 0.1763295978307724, 0.5535299777984619, 0.070227712392807, 0.33982881903648376, -0.4138679802417755, -0.061943117529153824, -0.05519915744662285, -0.48624348640441895, 0.13043037056922913, 0.04955174773931503, 0.018605533987283707, 0.25602999329566956, -0.26107311248779297, 0.05149013549089432, -0.06929045170545578, 0.1707654595375061, 0.055719491094350815, 0.20428332686424255, -0.02168743684887886, -0.22509059309959412, 0.11299920827150345, 0.3567558526992798, 0.14369754493236542, -0.26876676082611084, -0.0031385235488414764, -0.1021999940276146, -0.4228528141975403, 0.46596285700798035, -0.49220672249794006, -0.10321589559316635, -0.0001438632607460022, -0.10941336303949356, 0.3178337514400482, -0.25733187794685364, 0.07459531724452972, 0.14202995598316193, 0.10734386742115021, -0.036780714988708496, 0.2691381871700287, 0.09381403028964996, -0.045787446200847626, -0.24137690663337708, -0.4076399505138397, -0.17741313576698303, -0.13618098199367523, -0.19936226308345795, 0.13767892122268677, 0.06167598441243172, -0.22392436861991882, -0.18993492424488068, 0.016704164445400238, 0.08496268838644028, -0.019469544291496277, 0.2818620502948761, -0.31127142906188965, 0.10189390927553177, 0.2587311267852783, -0.11112873256206512, 0.052220284938812256, -0.04122340306639671, -0.00006760656833648682, 0.012864910066127777, 0.390630841255188, 0.17808157205581665, -0.05274982005357742, 0.08184827864170074, 0.06520900875329971, -0.20729880034923553, 0.4525909423828125, -0.3437381982803345, 0.03610311448574066, 0.3395194411277771, 0.0786362737417221, 0.04291978105902672, -0.31120526790618896, -0.1099289134144783, -0.21468645334243774, 0.2633896470069885, 0.6580013036727905, -0.5300191044807434, 0.5070761442184448, -0.25761088728904724, -0.12670733034610748, 0.06389164924621582, 0.28498488664627075, -0.07725369930267334, 0.20646017789840698, -0.19473499059677124, -0.3684687614440918, -0.08012198656797409, 0.4132980406284332, -0.3649273216724396, 0.18403756618499756, -0.023284651339054108, 0.13829265534877777, -0.0033810213208198547, 0.40275120735168457, 0.036133773624897, -0.023336676880717278, 0.3640660047531128, 0.438848614692688, -0.33500662446022034, 0.1230710968375206, -0.36691346764564514, -0.3216547667980194, -0.16356295347213745, 0.20161554217338562, -0.09025141596794128, 0.06953123211860657, -0.07498065382242203, 0.026551377028226852, -0.10125129669904709, -0.17789900302886963, 0.05903758108615875, 0.2763136625289917, 0.13977870345115662, -0.04326123744249344, 0.04553641378879547, -0.1161709874868393, -0.5486614108085632, 0.23908817768096924, -0.06756764650344849, 0.0035025514662265778, -0.3159750699996948, 0.1373143494129181, 0.13877835869789124, 0.11780942231416702, -0.01899046078324318, -0.05549240484833717, -0.07075092196464539, -0.00813378393650055, 0.12623330950737, 0.11124399304389954, -0.08086007088422775, 0.3727066218852997, -0.03943434730172157, 0.17230941355228424, -0.6514274477958679, 0.46134212613105774, 0.044099826365709305, -0.24963527917861938, -0.14358964562416077, -0.15568828582763672, -0.13020175695419312, 0.028553731739521027, -0.1780426800251007, 0.3773748576641083, 0.15661731362342834, 0.33322465419769287, -0.4252701699733734, 0.04429173469543457, 0.14451056718826294, -0.019872348755598068, 0.29161351919174194, -0.11689335107803345, 0.1466475874185562, 0.044308170676231384, 0.1917681097984314, 0.016018085181713104, -0.5017141699790955, 0.23192492127418518, -0.043078891932964325, -0.041255511343479156, -0.04434821382164955, 0.2570446729660034, 0.10654851794242859, 0.024127230048179626, 0.23407261073589325, 0.3863133490085602, 0.15317827463150024, 0.16451363265514374, -0.427898108959198, 0.13772021234035492, 0.3752506971359253, -0.0546451061964035, -0.0554831400513649, 0.14723536372184753, -0.13377892971038818, -0.16619175672531128, -0.00235927477478981, 0.4644368588924408, 0.3013448715209961, 0.05763350799679756, -0.22933292388916016, -0.07177001982927322, -0.207459956407547, -0.17823410034179688, 0.25132468342781067, 0.1293078064918518, 0.30999332666397095, 0.004553917795419693, 0.02961776964366436, -0.08892542868852615, -0.13208384811878204, -0.19377952814102173, -0.041977979242801666, 0.44176822900772095, -0.12757208943367004, 0.2924894094467163, -0.11439093947410583, -0.12023261934518814, 0.1408609300851822, 0.26622486114501953, -0.4049035608768463, -0.12877845764160156, -0.23305965960025787, 0.3224628269672394, -0.12721596658229828, -0.21361923217773438, -0.06292340904474258, 0.22511160373687744, 0.2765217125415802, 0.06393369287252426, -0.2573774456977844, -0.23236136138439178, -0.2699401378631592, -0.025175129994750023, 0.41678762435913086, 0.03837627172470093, 0.3071311414241791, 0.0852758064866066, -0.09852948784828186, -0.12772905826568604, -0.11341302841901779, 0.08658755570650101, -0.053561851382255554, 0.7252303957939148, 0.19585204124450684, 0.5032238364219666, -0.13764023780822754, 0.20172595977783203, 0.21536506712436676, -0.29764848947525024, -0.05174326151609421, 0.2595905661582947, 0.13635702431201935, 0.058489419519901276, -0.05076046660542488, 0.1282562017440796, 0.001820247620344162, -0.2990734577178955, 0.08434765040874481, -0.13901330530643463, 0.19168685376644135, 0.16255272924900055, 0.6198645234107971, -0.003631406929343939, -0.021231500431895256, -0.20401790738105774, -0.10830827802419662, -0.5015449523925781, 0.45245102047920227, -0.0804799273610115, -0.2766599953174591, -0.15129001438617706, -0.2639968693256378, -0.17915616929531097, 0.5246623754501343, -0.5350551009178162, 0.032150086015462875, -0.48699498176574707, 0.0994669497013092, -0.11846169829368591, 0.044890373945236206, -0.03374588489532471, 0.1093054860830307, 0.033898599445819855, -0.13142141699790955, -0.018755950033664703, 0.003588065505027771, -0.08577144891023636, 0.11131030321121216, 0.3232469856739044, 0.4690190255641937, 0.0701422244310379, 0.27061980962753296, 0.22585555911064148, -0.16583497822284698, 0.3391442596912384, 0.14920957386493683, 0.35421520471572876, -0.34698814153671265, -0.30394020676612854, -0.04191356897354126, 0.07870939373970032, -0.43068283796310425, -0.3505069613456726, 0.01523642148822546, 0.11482091248035431, -0.09395526349544525, 0.20657895505428314, 0.25960496068000793, -0.20024779438972473, 0.19473128020763397, -0.06097076088190079, 0.4160272181034088, 0.043826017528772354, 0.1961718499660492, -0.07425553351640701, -0.13151302933692932, -0.24491466581821442, -0.2172866314649582, 0.40574246644973755, -0.2556464970111847, -0.3121424913406372, -0.12207493931055069, -0.46171456575393677, 0.11557863652706146, 0.17959602177143097, 0.16855335235595703, 0.07579298317432404, 0.212269127368927, 0.08575843274593353, -0.1249995008111, 1.0327807664871216, -0.11388199776411057, -0.10005876421928406, 0.10485684871673584, -0.044580139219760895, -0.23656147718429565, 0.3151359260082245, 0.17007914185523987, -0.29740145802497864, -0.10053186118602753, 0.03125125542283058, -0.41917407512664795, -0.1532941311597824, 0.011574018746614456, 0.6201238632202148, -0.08009538054466248, -0.2132757306098938, -0.21533004939556122, -0.11055951565504074, -0.17079365253448486, -0.07435000687837601, -0.0959874764084816, 0.1243705227971077, 0.0432574599981308, -0.12064121663570404, 0.008626398630440235, -0.0013900808990001678, -0.05077587068080902, 0.2760029435157776, 0.34053680300712585, -0.508439838886261, 0.506742000579834, 0.17861784994602203, -0.6698696613311768, 0.5357413291931152, 0.3336404263973236, -0.08477014303207397, 0.13206934928894043, 0.07857751846313477, 0.13110069930553436, -0.030620984733104706, 0.4823598861694336, -0.11249241977930069, -0.1591469943523407, -0.07786775380373001, 0.37562990188598633, -0.041399069130420685, -0.03534729778766632, 0.3380686342716217, 0.04396532103419304, 0.0085191261023283, -0.6939517259597778, 0.30449652671813965, 0.20630143582820892, 0.09173759818077087, 0.4553503394126892, 0.09996519237756729, -0.07385800033807755, 0.23287244141101837, 0.17587438225746155, 0.8161522150039673, -0.19825534522533417, 0.2948389947414398, 0.10579612851142883, -0.007920656353235245, 0.7045266032218933, 0.03968140482902527, 0.0795377641916275, -0.3167242705821991, -0.2598387598991394, 0.06638330966234207, -0.3918266296386719, 0.2517760992050171, 0.19651083648204803, 0.22845757007598877, 0.10417020320892334, -0.08198663592338562, -0.17375490069389343, -0.10664141923189163, 0.17520146071910858, -0.28255173563957214, -0.11755286157131195, -0.2576197385787964, 0.08071113377809525, -0.11739897727966309, -0.0275447778403759, -0.007425679359585047, -0.05826587229967117, -0.061826907098293304, 0.0640854611992836, -0.4177447557449341, 0.08635679632425308, 0.01183299906551838, 0.09858421981334686, 0.328078031539917, -0.2815326750278473, -0.0704616904258728, 0.08935675024986267, 0.015062622725963593, 0.09448006749153137, 0.024697590619325638, 0.20392581820487976, 0.035970140248537064, -0.008213256485760212, 0.1337595283985138, -0.19299866259098053, 0.30670368671417236, -0.052537720650434494, -0.17955714464187622, -0.037258319556713104, 0.0503963939845562, -0.23622538149356842, -0.15941663086414337, 0.05038940906524658, -0.08777821063995361, 0.055657874792814255, -0.12346683442592621, -0.09099119901657104, -0.15722163021564484, -0.17488564550876617, 0.10156437754631042, 0.3925216794013977, 0.16465730965137482, 0.37337633967399597, -0.2682577669620514, 0.03448957949876785, -0.09408517181873322, 0.1563108265399933, -0.11974961310625076, 0.1301332712173462, 0.29121142625808716, 0.42470598220825195, -0.11652044951915741, -0.1980327069759369, 0.23756170272827148, 0.11947895586490631, -0.49768510460853577, 0.6020321846008301, -0.09340106695890427, 0.07517452538013458, -0.026150962337851524, -0.15179066359996796, -0.17517384886741638, -0.2675262689590454, 0.14566171169281006, -0.20450326800346375, -0.3929592967033386, 0.060587719082832336, 0.16621871292591095, 0.2766619920730591, -0.10529989749193192, -0.23696424067020416, -0.11069883406162262, 0.07359239459037781, -0.19775280356407166, 0.01910901442170143, -0.11177361756563187, 0.058995094150304794, -0.0702274888753891, -0.20929306745529175, 0.05893579125404358, -0.2892414927482605, 0.04133986681699753, 0.18662111461162567, -0.1829637736082077, -0.14935234189033508, -0.05912604555487633, 0.16921281814575195, -0.07339809089899063, -0.6382339000701904, 0.14559993147850037, -0.3549879193305969, -0.07542335987091064, -0.060313910245895386, 0.17905035614967346, 0.050523482263088226, -0.1995459645986557, -0.304519385099411, 0.16555005311965942, 0.20341718196868896, -0.06849681586027145, 0.29285770654678345, -0.383587509393692, 0.4205054044723511, 0.3100588023662567, 0.2183728814125061, 0.11214890331029892, -0.19279944896697998, -0.5685247182846069, 0.12513375282287598, -0.2022031992673874, -0.11424855142831802, 0.8146553039550781, -0.3179047107696533, -0.1179550439119339, 0.17514696717262268, 0.27931877970695496, 0.5136362910270691, -0.19589845836162567, -0.19506151974201202, 0.1960211992263794, 0.11726975440979004, -0.011586420238018036, -0.06989119946956635, -0.32694289088249207, 0.10254640132188797, -0.03369736298918724, 0.1478842794895172, -0.10813827067613602, -0.12347747385501862, -0.23796863853931427, 0.2435760200023651, 0.5091850161552429, -0.14045760035514832, 0.05737537518143654, 0.3702346682548523, 0.14121027290821075, 0.025253333151340485, 0.208012655377388, 0.21653437614440918, 0.21064184606075287, 0.4395415782928467, 0.1574368178844452, -0.02722262404859066, 0.01761557161808014, 0.1467665135860443, 0.12894906103610992, -0.2734738886356354, 0.0463964007794857, 0.6055735349655151, -0.16326236724853516, 0.040422990918159485, -0.06592032313346863, -0.028558775782585144, -0.0968446433544159, -0.009737927466630936, -0.046528175473213196, 0.2678637206554413, 0.1316884607076645, 0.1407865583896637, -0.18529468774795532, -0.14741745591163635, -0.07852059602737427, 0.3192179501056671, -0.05565187707543373, -0.33248114585876465, 0.15029382705688477, 0.341616690158844, -0.027999289333820343, -0.23770229518413544, 0.31781628727912903, -0.012500330805778503, 0.24047228693962097, -0.10663211345672607, -0.013994170352816582, 0.30176979303359985, -0.26202064752578735, 0.002537660300731659, 0.36136481165885925, 0.3465311527252197, 0.41616636514663696, -0.08501240611076355, 0.1116475835442543, -0.01859438791871071, -0.1359604150056839, -0.039614446461200714, 0.25217339396476746, -0.03754076361656189, 0.08781015872955322, 0.09876707196235657, 0.0036038532853126526, -0.15071558952331543, -0.12393335998058319, 0.18058061599731445, 0.29842233657836914, -0.3481695353984833, 0.3919430673122406, -0.12447701394557953, -0.19625967741012573, 0.00331968255341053, -0.1263904869556427, -0.3523958921432495, -0.002619020640850067, 0.27323421835899353, -0.3093319833278656, -0.08192863315343857, -0.21557524800300598, 0.027289949357509613, -0.1334552764892578, 0.5787813067436218, 0.2186199128627777, 0.22811779379844666, -0.2245105504989624, -0.2510080933570862, -0.5032126307487488, -0.07793349772691727, -0.45260074734687805, 0.21182478964328766, 0.22997869551181793, 0.20446500182151794, -0.11925128847360611, 0.23795539140701294, -0.037295401096343994, 0.23291780054569244, -0.23402900993824005, 0.6040444374084473, -0.25433486700057983, -0.2369592934846878, 0.04452529922127724, -0.1552809327840805, -0.30946817994117737, -0.5237336158752441, 0.42123350501060486, -0.49923062324523926, 0.01384144276380539, 0.009801534004509449, 0.03192460536956787, 0.13219547271728516, 0.360090047121048, 0.255567729473114, 0.3562539517879486, -0.01802479475736618, 0.20099371671676636, -0.35690024495124817, -0.2880410850048065, 0.14757388830184937, 0.04951523244380951, 0.006261318922042847, 0.2508120834827423, 0.436876505613327, -0.12755058705806732, -0.29142242670059204, -0.39917677640914917, 0.31796395778656006, -0.19393613934516907, 0.199174702167511, -0.2312302589416504, -0.10659076273441315, -0.0653461441397667, 0.20349827408790588, 0.3467831015586853, 0.2090531587600708, -0.02312856912612915, -0.06056680530309677, -0.44882136583328247, -0.12680116295814514, 0.13858625292778015, -0.3832707107067108, -0.4773244559764862, -0.07424881309270859, 0.04801171272993088, 0.026925522834062576, -0.2379223108291626, 0.024818584322929382, 0.06911598891019821, 0.12935252487659454, -0.09868695586919785, 0.0037330836057662964, 0.25961509346961975, 0.12006860971450806, 0.09673163294792175, 0.09136651456356049, 0.3783232569694519, 0.06643683463335037, -0.15843072533607483, 0.12385706603527069, -0.09332703799009323 ]
https://github.com/huggingface/datasets/issues/6007
Get an error "OverflowError: Python int too large to convert to C long" when loading a large dataset
This error means that one of the int32 (`Value("int32")`) columns in the dataset has a value that is out of the valid (int32) range. I'll open a PR to print the name of a problematic column to make debugging such errors easier.
### Describe the bug When load a large dataset with the following code ```python from datasets import load_dataset dataset = load_dataset("liwu/MNBVC", 'news_peoples_daily', split='train') ``` We encountered the error: "OverflowError: Python int too large to convert to C long" The error look something like: ``` OverflowError: Python int too large to convert to C long During handling of the above exception, another exception occurred: OverflowError Traceback (most recent call last) <ipython-input-7-0ed8700e662d> in <module> ----> 1 dataset = load_dataset("liwu/MNBVC", 'news_peoples_daily', split='train', cache_dir='/sfs/MNBVC/.cache/') /sfs/MNBVC/venv/lib64/python3.6/site-packages/datasets/load.py in load_dataset(path, name, data_dir, data_files, split, cache_dir, features, download_config, download_mode, ignore_verifications, keep_in_memory, save_infos, revision, use_auth_token, task, streaming, **config_kwargs) 1749 ignore_verifications=ignore_verifications, 1750 try_from_hf_gcs=try_from_hf_gcs, -> 1751 use_auth_token=use_auth_token, 1752 ) 1753 /sfs/MNBVC/venv/lib64/python3.6/site-packages/datasets/builder.py in download_and_prepare(self, download_config, download_mode, ignore_verifications, try_from_hf_gcs, dl_manager, base_path, use_auth_token, **download_and_prepare_kwargs) 703 if not downloaded_from_gcs: 704 self._download_and_prepare( --> 705 dl_manager=dl_manager, verify_infos=verify_infos, **download_and_prepare_kwargs 706 ) 707 # Sync info /sfs/MNBVC/venv/lib64/python3.6/site-packages/datasets/builder.py in _download_and_prepare(self, dl_manager, verify_infos) 1225 1226 def _download_and_prepare(self, dl_manager, verify_infos): -> 1227 super()._download_and_prepare(dl_manager, verify_infos, check_duplicate_keys=verify_infos) 1228 1229 def _get_examples_iterable_for_split(self, split_generator: SplitGenerator) -> ExamplesIterable: /sfs/MNBVC/venv/lib64/python3.6/site-packages/datasets/builder.py in _download_and_prepare(self, dl_manager, verify_infos, **prepare_split_kwargs) 791 try: 792 # Prepare split will record examples associated to the split --> 793 self._prepare_split(split_generator, **prepare_split_kwargs) 794 except OSError as e: 795 raise OSError( /sfs/MNBVC/venv/lib64/python3.6/site-packages/datasets/builder.py in _prepare_split(self, split_generator, check_duplicate_keys) 1219 writer.write(example, key) 1220 finally: -> 1221 num_examples, num_bytes = writer.finalize() 1222 1223 split_generator.split_info.num_examples = num_examples /sfs/MNBVC/venv/lib64/python3.6/site-packages/datasets/arrow_writer.py in finalize(self, close_stream) 536 # Re-intializing to empty list for next batch 537 self.hkey_record = [] --> 538 self.write_examples_on_file() 539 if self.pa_writer is None: 540 if self.schema: /sfs/MNBVC/venv/lib64/python3.6/site-packages/datasets/arrow_writer.py in write_examples_on_file(self) 407 # Since current_examples contains (example, key) tuples 408 batch_examples[col] = [row[0][col] for row in self.current_examples] --> 409 self.write_batch(batch_examples=batch_examples) 410 self.current_examples = [] 411 /sfs/MNBVC/venv/lib64/python3.6/site-packages/datasets/arrow_writer.py in write_batch(self, batch_examples, writer_batch_size) 506 col_try_type = try_features[col] if try_features is not None and col in try_features else None 507 typed_sequence = OptimizedTypedSequence(batch_examples[col], type=col_type, try_type=col_try_type, col=col) --> 508 arrays.append(pa.array(typed_sequence)) 509 inferred_features[col] = typed_sequence.get_inferred_type() 510 schema = inferred_features.arrow_schema if self.pa_writer is None else self.schema /sfs/MNBVC/venv/lib64/python3.6/site-packages/pyarrow/array.pxi in pyarrow.lib.array() /sfs/MNBVC/venv/lib64/python3.6/site-packages/pyarrow/array.pxi in pyarrow.lib._handle_arrow_array_protocol() /sfs/MNBVC/venv/lib64/python3.6/site-packages/datasets/arrow_writer.py in __arrow_array__(self, type) 180 else: 181 trying_cast_to_python_objects = True --> 182 out = pa.array(cast_to_python_objects(data, only_1d_for_numpy=True)) 183 # use smaller integer precisions if possible 184 if self.trying_int_optimization: /sfs/MNBVC/venv/lib64/python3.6/site-packages/pyarrow/array.pxi in pyarrow.lib.array() /sfs/MNBVC/venv/lib64/python3.6/site-packages/pyarrow/array.pxi in pyarrow.lib._sequence_to_array() /sfs/MNBVC/venv/lib64/python3.6/site-packages/pyarrow/error.pxi in pyarrow.lib.pyarrow_internal_check_status() OverflowError: Python int too large to convert to C long ``` However, that dataset can be loaded in a streaming manner: ```python from datasets import load_dataset dataset = load_dataset("liwu/MNBVC", 'news_peoples_daily', split='train', streaming=True) for i in dataset: pass # it work well ``` Another issue is reported in our dataset hub: https://huggingface.co/datasets/liwu/MNBVC/discussions/2 ### Steps to reproduce the bug from datasets import load_dataset dataset = load_dataset("liwu/MNBVC", 'news_peoples_daily', split='train') ### Expected behavior the dataset can be safely loaded ### Environment info - `datasets` version: 2.4.0 - Platform: Linux-3.10.0-1160.an7.x86_64-x86_64-with-centos-7.9 - Python version: 3.6.8 - PyArrow version: 6.0.1 - Pandas version: 1.1.5
42
Get an error "OverflowError: Python int too large to convert to C long" when loading a large dataset ### Describe the bug When load a large dataset with the following code ```python from datasets import load_dataset dataset = load_dataset("liwu/MNBVC", 'news_peoples_daily', split='train') ``` We encountered the error: "OverflowError: Python int too large to convert to C long" The error look something like: ``` OverflowError: Python int too large to convert to C long During handling of the above exception, another exception occurred: OverflowError Traceback (most recent call last) <ipython-input-7-0ed8700e662d> in <module> ----> 1 dataset = load_dataset("liwu/MNBVC", 'news_peoples_daily', split='train', cache_dir='/sfs/MNBVC/.cache/') /sfs/MNBVC/venv/lib64/python3.6/site-packages/datasets/load.py in load_dataset(path, name, data_dir, data_files, split, cache_dir, features, download_config, download_mode, ignore_verifications, keep_in_memory, save_infos, revision, use_auth_token, task, streaming, **config_kwargs) 1749 ignore_verifications=ignore_verifications, 1750 try_from_hf_gcs=try_from_hf_gcs, -> 1751 use_auth_token=use_auth_token, 1752 ) 1753 /sfs/MNBVC/venv/lib64/python3.6/site-packages/datasets/builder.py in download_and_prepare(self, download_config, download_mode, ignore_verifications, try_from_hf_gcs, dl_manager, base_path, use_auth_token, **download_and_prepare_kwargs) 703 if not downloaded_from_gcs: 704 self._download_and_prepare( --> 705 dl_manager=dl_manager, verify_infos=verify_infos, **download_and_prepare_kwargs 706 ) 707 # Sync info /sfs/MNBVC/venv/lib64/python3.6/site-packages/datasets/builder.py in _download_and_prepare(self, dl_manager, verify_infos) 1225 1226 def _download_and_prepare(self, dl_manager, verify_infos): -> 1227 super()._download_and_prepare(dl_manager, verify_infos, check_duplicate_keys=verify_infos) 1228 1229 def _get_examples_iterable_for_split(self, split_generator: SplitGenerator) -> ExamplesIterable: /sfs/MNBVC/venv/lib64/python3.6/site-packages/datasets/builder.py in _download_and_prepare(self, dl_manager, verify_infos, **prepare_split_kwargs) 791 try: 792 # Prepare split will record examples associated to the split --> 793 self._prepare_split(split_generator, **prepare_split_kwargs) 794 except OSError as e: 795 raise OSError( /sfs/MNBVC/venv/lib64/python3.6/site-packages/datasets/builder.py in _prepare_split(self, split_generator, check_duplicate_keys) 1219 writer.write(example, key) 1220 finally: -> 1221 num_examples, num_bytes = writer.finalize() 1222 1223 split_generator.split_info.num_examples = num_examples /sfs/MNBVC/venv/lib64/python3.6/site-packages/datasets/arrow_writer.py in finalize(self, close_stream) 536 # Re-intializing to empty list for next batch 537 self.hkey_record = [] --> 538 self.write_examples_on_file() 539 if self.pa_writer is None: 540 if self.schema: /sfs/MNBVC/venv/lib64/python3.6/site-packages/datasets/arrow_writer.py in write_examples_on_file(self) 407 # Since current_examples contains (example, key) tuples 408 batch_examples[col] = [row[0][col] for row in self.current_examples] --> 409 self.write_batch(batch_examples=batch_examples) 410 self.current_examples = [] 411 /sfs/MNBVC/venv/lib64/python3.6/site-packages/datasets/arrow_writer.py in write_batch(self, batch_examples, writer_batch_size) 506 col_try_type = try_features[col] if try_features is not None and col in try_features else None 507 typed_sequence = OptimizedTypedSequence(batch_examples[col], type=col_type, try_type=col_try_type, col=col) --> 508 arrays.append(pa.array(typed_sequence)) 509 inferred_features[col] = typed_sequence.get_inferred_type() 510 schema = inferred_features.arrow_schema if self.pa_writer is None else self.schema /sfs/MNBVC/venv/lib64/python3.6/site-packages/pyarrow/array.pxi in pyarrow.lib.array() /sfs/MNBVC/venv/lib64/python3.6/site-packages/pyarrow/array.pxi in pyarrow.lib._handle_arrow_array_protocol() /sfs/MNBVC/venv/lib64/python3.6/site-packages/datasets/arrow_writer.py in __arrow_array__(self, type) 180 else: 181 trying_cast_to_python_objects = True --> 182 out = pa.array(cast_to_python_objects(data, only_1d_for_numpy=True)) 183 # use smaller integer precisions if possible 184 if self.trying_int_optimization: /sfs/MNBVC/venv/lib64/python3.6/site-packages/pyarrow/array.pxi in pyarrow.lib.array() /sfs/MNBVC/venv/lib64/python3.6/site-packages/pyarrow/array.pxi in pyarrow.lib._sequence_to_array() /sfs/MNBVC/venv/lib64/python3.6/site-packages/pyarrow/error.pxi in pyarrow.lib.pyarrow_internal_check_status() OverflowError: Python int too large to convert to C long ``` However, that dataset can be loaded in a streaming manner: ```python from datasets import load_dataset dataset = load_dataset("liwu/MNBVC", 'news_peoples_daily', split='train', streaming=True) for i in dataset: pass # it work well ``` Another issue is reported in our dataset hub: https://huggingface.co/datasets/liwu/MNBVC/discussions/2 ### Steps to reproduce the bug from datasets import load_dataset dataset = load_dataset("liwu/MNBVC", 'news_peoples_daily', split='train') ### Expected behavior the dataset can be safely loaded ### Environment info - `datasets` version: 2.4.0 - Platform: Linux-3.10.0-1160.an7.x86_64-x86_64-with-centos-7.9 - Python version: 3.6.8 - PyArrow version: 6.0.1 - Pandas version: 1.1.5 This error means that one of the int32 (`Value("int32")`) columns in the dataset has a value that is out of the valid (int32) range. I'll open a PR to print the name of a problematic column to make debugging such errors easier.
[ -0.42730045318603516, -0.3950994908809662, -0.02665611356496811, 0.3553202748298645, 0.3509588837623596, -0.004374183714389801, 0.10522277653217316, 0.331129789352417, 0.31195196509361267, 0.1922844648361206, -0.027331490069627762, 0.16219580173492432, -0.11134413629770279, 0.08958712965250015, -0.2046218365430832, -0.1775018572807312, 0.1220521628856659, -0.17765238881111145, -0.25584712624549866, 0.18601104617118835, -0.3780885636806488, -0.07006936520338058, -0.17661845684051514, 0.048064276576042175, -0.23183873295783997, -0.21604019403457642, 0.12426722049713135, 0.36674559116363525, -0.2756235599517822, -0.3445779085159302, 0.0034113675355911255, -0.3893600404262543, 0.35168981552124023, 0.4516564607620239, -0.00011814466415671632, -0.18242916464805603, 0.11768415570259094, -0.042029090225696564, -0.32315704226493835, 0.09475971758365631, -0.039298251271247864, -0.5150787830352783, -0.006220826879143715, -0.45916715264320374, 0.16284555196762085, -0.05158706381917, -0.17475268244743347, -0.08125865459442139, 0.18807296454906464, 0.5761505961418152, 0.19275711476802826, 0.055086515843868256, 0.38476377725601196, 0.06680193543434143, 0.22039756178855896, -0.03740207850933075, -0.06243707239627838, 0.4031565189361572, 0.2108921855688095, 0.22969180345535278, -0.028704509139060974, -0.06308931857347488, -0.1489473581314087, -0.18602950870990753, 0.11887466907501221, -0.16871783137321472, 0.0570891909301281, -0.19999699294567108, 0.007225114852190018, -0.00796797126531601, 0.10818733274936676, -0.08280960470438004, -0.10172402858734131, -0.04120077192783356, 0.04498547315597534, -0.4488227963447571, -0.10353534668684006, 0.19530950486660004, 0.006717499345541, 0.08620800077915192, -0.18851512670516968, -0.2502252757549286, -0.2554998993873596, 0.2120245397090912, -0.32102394104003906, -0.11662086844444275, -0.14016851782798767, 0.21713149547576904, 0.21627303957939148, -0.18306414783000946, 0.017507245764136314, -0.024290628731250763, 0.03425518423318863, 0.18231849372386932, -0.3292953372001648, -0.1898389309644699, 0.003925345838069916, 0.10165248066186905, 0.2865700423717499, -0.04653023183345795, 0.06803923845291138, -0.018249500542879105, -0.11352144926786423, 0.14824597537517548, 0.18170928955078125, 0.1451261043548584, -0.6392795443534851, 0.4040762484073639, 0.3212814927101135, -0.02512778528034687, -0.1858256608247757, -0.08128379285335541, -0.04995885491371155, -0.306194007396698, 0.2521118223667145, 0.10100943595170975, 0.3818824291229248, -0.3228907883167267, -0.41205209493637085, 0.14715653657913208, -0.21592304110527039, 0.28504449129104614, 0.28412044048309326, 0.34671279788017273, -0.09875354915857315, 0.23286649584770203, 0.07463964074850082, 0.08334185183048248, -0.23511558771133423, -0.20238308608531952, -0.15069420635700226, 0.10457052290439606, -0.07249986380338669, -0.04433203488588333, 0.0936983972787857, -0.07169461250305176, 0.17004035413265228, 0.28497105836868286, 0.18396618962287903, -0.33783644437789917, 0.005977662280201912, -0.4781578481197357, 0.03976692631840706, 0.08606648445129395, -0.07800450921058655, -0.11582841724157333, 0.37072739005088806, 0.15519371628761292, -0.1194450706243515, 0.3418324589729309, -0.5060864686965942, -0.3711854815483093, -0.18037086725234985, 0.1869175285100937, 0.014307916164398193, -0.01662929356098175, -0.26676449179649353, -0.17007222771644592, 0.21955472230911255, -0.18516604602336884, 0.21145731210708618, -0.4256848096847534, 0.2160862684249878, -0.16842709481716156, -0.04905072972178459, 0.17450213432312012, -0.2994723916053772, 0.25893083214759827, -0.01978052407503128, 0.19197964668273926, 0.41219577193260193, 0.5086793899536133, -0.18264180421829224, -0.033356644213199615, -0.3783024847507477, -0.33097341656684875, 0.3757345378398895, -0.18065184354782104, -0.43467360734939575, 0.4298314154148102, -0.04181225225329399, -0.04125894606113434, -0.14741253852844238, 0.10902555286884308, 0.18719500303268433, -0.0816936120390892, 0.19337141513824463, 0.40117591619491577, -0.2251415252685547, 0.1918102353811264, -0.4496757984161377, -0.2674904465675354, 0.24783213436603546, 0.1967029720544815, 0.17562878131866455, -0.06670371443033218, 0.21777880191802979, -0.07312412559986115, 0.2588134706020355, -0.06310270726680756, -0.22276179492473602, 0.2580525279045105, 0.11467486619949341, 0.13091275095939636, -0.21843716502189636, -0.2864813506603241, 0.010846499353647232, -0.02313442900776863, -0.010160811245441437, -0.16320107877254486, 0.09471727907657623, -0.15478797256946564, -0.51869136095047, 0.23062573373317719, 0.07093244045972824, 0.3605084717273712, 0.04756245017051697, 0.018511291593313217, 0.16914500296115875, -0.06382670253515244, 0.1751853972673416, 0.45256394147872925, -0.434812992811203, 0.005193493328988552, -0.07389724254608154, 0.14947402477264404, -0.13532640039920807, -0.1558477133512497, 0.026621952652931213, 0.12149637192487717, 0.3321802616119385, -0.03791804984211922, -0.3654502332210541, 0.18011757731437683, -0.009776225313544273, -0.29486942291259766, -0.3651312291622162, -0.2157198041677475, 0.22062039375305176, -0.3945513963699341, 0.29898008704185486, 0.19280105829238892, 0.24524268507957458, -0.047357313334941864, 0.04771691560745239, 0.2859414219856262, -0.3086586892604828, 0.12132122367620468, 0.09259235858917236, -0.041770800948143005, 0.3189939856529236, -0.12412536144256592, 0.20322884619235992, 0.007417544722557068, 0.0014881305396556854, 0.19949939846992493, 0.15952810645103455, -0.05024313926696777, -0.2033296376466751, -0.13109645247459412, 0.6715540289878845, -0.06587813794612885, 0.10676909983158112, 0.2518104910850525, -0.20792314410209656, -0.03859367221593857, 0.06895805150270462, -0.21736617386341095, 0.5505901575088501, 0.3331361413002014, -0.08229184150695801, -0.06867225468158722, 0.014712135307490826, -0.09951192140579224, 0.2664300203323364, 0.16960284113883972, 0.32267507910728455, 0.15934407711029053, 0.4819996654987335, -0.04444257169961929, -0.20974647998809814, -0.27626344561576843, 0.04477187991142273, 0.26742932200431824, -0.3840709626674652, 0.38414156436920166, -0.0696205198764801, -0.2515539824962616, -0.17747272551059723, -0.2844955027103424, 0.004043798893690109, -0.33593153953552246, -0.33264684677124023, 0.4384606182575226, 0.01700320839881897, -0.07723640650510788, -0.22626927495002747, 0.062228694558143616, 0.3358646631240845, -0.27092087268829346, 0.17083531618118286, 0.05200768634676933, -0.2650725543498993, 0.011704675853252411, 0.4868507385253906, -0.2440004050731659, 0.3427879512310028, 0.12019755691289902, -0.1655244529247284, -0.03905197232961655, -0.20386990904808044, -0.1234484612941742, 0.0991927981376648, 0.16942739486694336, -0.030192866921424866, 0.3613826036453247, -0.21136347949504852, -0.16740255057811737, 0.010533466003835201, 0.04331997036933899, 0.0594557449221611, 0.1659039556980133, -0.10908263921737671, 0.1439702957868576, -0.03303379938006401, -0.2585492730140686, -0.44593361020088196, -0.5692219138145447, 0.10587580502033234, 0.059380244463682175, 0.13857056200504303, 0.25813671946525574, 0.1298876702785492, 0.2472284734249115, 0.34788572788238525, -0.11012277007102966, -0.3189486563205719, -0.13861893117427826, 0.35731738805770874, -0.17738893628120422, -0.19554027915000916, 0.1069212406873703, -0.024517707526683807, -0.047351155430078506, 0.14091236889362335, -0.4079741835594177, 0.1772587150335312, -0.42272523045539856, 0.46870070695877075, -0.4635942578315735, -0.04442131519317627, 0.1144370436668396, -0.21715916693210602, 0.010356130078434944, 0.12779727578163147, 0.09290255606174469, -0.12362018972635269, 0.14443951845169067, 0.49612289667129517, -0.25444239377975464, 0.44793447852134705, -0.16753025352954865, 0.5885943174362183, 0.17588989436626434, 0.05358100309967995, 0.3482431471347809, 0.021755538880825043, 0.01447666808962822, -0.21496406197547913, -0.37185582518577576, 0.06305868923664093, -0.22956803441047668, -0.1729588508605957, 0.06716443598270416, -0.08266009390354156, -0.07205028086900711, 0.12978999316692352, -0.2179080694913864, -0.05128931254148483, -0.2240113615989685, 0.20996160805225372, -0.09039054811000824, 0.17387999594211578, -0.14571210741996765, -0.09767287969589233, -0.2475629448890686, -0.23845559358596802, -0.1726536750793457, 0.17912964522838593, 0.018602490425109863, 0.04128723964095116, 0.10141374170780182, -0.16951853036880493, -0.2960941195487976, 0.2517765760421753, -0.02027714252471924, 0.3787272572517395, 0.003271874040365219, 0.03430300951004028, -0.09064504504203796, -0.09841862320899963, 0.4456343650817871, 0.28611254692077637, 0.07992543280124664, 0.09266795217990875, 0.17231769859790802, -0.4492839276790619, -0.076456218957901, -0.10963420569896698, 0.3906116783618927, 0.5413093566894531, 0.3065812587738037, -0.2116076648235321, 0.14862775802612305, 0.6596485376358032, 0.4045993685722351, -0.03348797559738159, -0.1579154133796692, -0.282257616519928, -0.38411980867385864, -0.29867851734161377, 0.24832361936569214, 0.2736555337905884, 0.27473756670951843, -0.2445584237575531, -0.28429844975471497, -0.2872462868690491, -0.0773293599486351, 0.020731396973133087, -0.10377262532711029, 0.2474452257156372, -0.2777171730995178, 0.1813603639602661, -0.43756192922592163, 0.23997774720191956, 0.24989573657512665, 0.5667697787284851, 0.07643535733222961, -0.4990854263305664, 0.1059616282582283, 0.120084747672081, 0.30827513337135315, 0.09950698167085648, -0.1307036429643631, 0.22553041577339172, -0.09968683868646622, 0.44804614782333374, -0.07788205146789551, 0.5246808528900146, -0.14827927947044373, 0.22094689309597015, -0.34291067719459534, -0.19213396310806274, 0.547170877456665, 0.1663152426481247, 0.19766582548618317, 0.3111850619316101, 0.026270408183336258, -0.3059810400009155, 0.3107355833053589, -0.16278767585754395, 0.8497914671897888, 0.06669555604457855, -0.06066598370671272, 0.38529133796691895, -0.03204647824168205, 0.2201925814151764, -0.00027794018387794495, 0.13152961432933807, -0.37022724747657776, -0.027098488062620163, 0.18778760731220245, -0.13702905178070068, 0.06583811342716217, -0.18384596705436707, -0.28570640087127686, 0.2849735617637634, -0.2500235438346863, -0.09471683204174042, -0.04896274954080582, 0.3314095735549927, -0.37765559554100037, 0.007667003199458122, -0.2876814603805542, 0.15929317474365234, -0.38668298721313477, -0.053935494273900986, -0.08390773087739944, 0.04848698154091835, -0.08806009590625763, -0.15772201120853424, -0.24220161139965057, 0.08613095432519913, -0.2848759591579437, 0.3731246590614319, -0.2572709918022156, -0.29216790199279785, 0.5167397260665894, -0.09814170002937317, 0.08122798800468445, 0.29140427708625793, -0.06481871753931046, 0.034971725195646286, -0.14759615063667297, -0.18979187309741974, 0.05812549218535423, 0.17811043560504913, 0.10609754920005798, -0.020049842074513435, -0.2854974865913391, 0.04728515446186066, -0.05922948196530342, -0.16250252723693848, 0.024472326040267944, 0.10543470829725266, 0.5009015798568726, -0.48849254846572876, -0.32759889960289, -0.24513548612594604, -0.09851664304733276, -0.2617266774177551, 0.11408805847167969, -0.06117524206638336, -0.13015489280223846, 0.2037440836429596, 0.22624093294143677, -0.4189797341823578, -0.10186879336833954, 0.17977853119373322, -0.0036855190992355347, -0.12414667755365372, 0.47180846333503723, 0.1788039356470108, -0.19214396178722382, -0.13290202617645264, 0.3621409833431244, -0.1984470933675766, -0.38313984870910645, 0.2497865855693817, -0.08816082775592804, 0.3134532570838928, 0.049364469945430756, 0.1648942530155182, 0.12852762639522552, -0.02610381692647934, -0.055564820766448975, -0.47899386286735535, -0.6197270750999451, 0.020489759743213654, -0.17898087203502655, 0.07164382934570312, 0.22576233744621277, 0.11449176073074341, -0.3802782893180847, 0.06096949428319931, -0.24993325769901276, 0.11757151782512665, -0.0940813273191452, 0.10025616735219955, 0.1581793874502182, -0.285672664642334, -0.1549951136112213, 0.08355088531970978, 0.14725881814956665, 0.3399650454521179, 0.20342303812503815, -0.22011911869049072, -0.18029530346393585, 0.12341981381177902, -0.006576646119356155, -0.3159588873386383, -0.08770573139190674, -0.28387194871902466, 0.037396859377622604, -0.03816695511341095, 0.10210222005844116, 0.11634885519742966, 0.07618573307991028, 0.02099715918302536, -0.24134309589862823, 0.0034297481179237366, -0.12185151129961014, 0.19924387335777283, 0.13464704155921936, 0.4082373380661011, 0.19386886060237885, 0.5115569829940796, 0.24224495887756348, -0.04629679024219513, -0.43919476866722107, -0.008643358945846558, 0.3187031149864197, 0.03648817911744118, 0.3426598310470581, -0.2697684168815613, 0.07568514347076416, 0.16929204761981964, -0.23282288014888763, 0.22913405299186707, -0.25543516874313354, -0.09877418726682663, 0.26777660846710205, 0.16084587574005127, -0.17872226238250732, 0.13948845863342285, 0.15855363011360168, -0.3148189187049866, -0.023261284455657005, 0.2851652204990387, -0.20909349620342255, -0.1405559629201889, -0.27613288164138794, -0.02294502966105938, 0.21735170483589172, 0.2729935050010681, 0.002375860931351781, 0.4859406054019928, -0.044278278946876526, -0.21067754924297333, 0.39080774784088135, 0.16114452481269836, 0.3288120925426483, 0.8358757495880127, -0.2156842052936554, 0.133271723985672, -0.2734277546405792, 0.04166405647993088, -0.014557689428329468, -0.3601619005203247, -0.033477526158094406, 0.28801143169403076, -0.2637088894844055, 0.27294921875, 0.020296543836593628, 0.20703613758087158, -0.26228877902030945, -0.07231521606445312, -0.173462375998497, 0.2326335906982422, -0.31068432331085205, 0.10655294358730316, 0.20396822690963745, 0.08397028595209122, -0.03519570454955101, 0.21060211956501007, -0.15057437121868134, -0.04050738364458084, 0.10409249365329742, 0.3406962752342224, -0.20162175595760345, -0.271628737449646, 0.2608352601528168, 0.4320448040962219, 0.08981703221797943, -0.4641041159629822, 0.12155914306640625, 0.2563055753707886, 0.00421489030122757, -0.1815425306558609, -0.11361978203058243, 0.5183136463165283, 0.27215591073036194, 0.020924024283885956, 0.03270827978849411, 0.056745365262031555, -0.14462020993232727, 0.12292782962322235, -0.24000754952430725, 0.147347554564476, 0.4070994257926941, 0.2802129089832306, 0.08324094861745834, -0.17698591947555542, -0.03167227283120155, 0.13094188272953033, -0.0826028436422348, -0.2602497339248657, 0.28847265243530273, 0.05318643897771835, -0.39021438360214233, -0.25396913290023804, 0.010516196489334106, -0.250701367855072, -0.06606036424636841, 0.4123232364654541, 0.07801241427659988, 0.2456803321838379, 0.16989725828170776, 0.04279639571905136, -0.2895328998565674, 0.4310108423233032, 0.25519415736198425, 0.2772292494773865, -0.5120605230331421, -0.11491222679615021, -0.3112878203392029, 0.11089342087507248, -0.36213916540145874, 0.03549609333276749, 0.199350968003273, 0.0729064792394638, -0.14432817697525024, 0.11744127422571182, 0.24190343916416168, 0.27480921149253845, 0.35398057103157043, 0.165370374917984, -0.14194153249263763, -0.4123852252960205, 0.07853980362415314, -0.12405794858932495, 0.003536362200975418, -0.5456081628799438, 0.2555713951587677, -0.206376850605011, 0.008678007870912552, -0.19115620851516724, 0.009041540324687958, 0.01849699392914772, -0.05934974551200867, 0.3211500644683838, 0.24234360456466675, 0.5917177200317383, -0.010546587407588959, -0.01108473353087902, 0.2435409426689148, -0.14336103200912476, -0.10123249143362045, 0.28801119327545166, 0.10816340148448944, 0.3745174705982208, -0.03582605719566345, -0.07707174122333527, -0.22778986394405365, 0.185454323887825, -0.020570972934365273, -0.5014035105705261, 0.042701348662376404, -0.20563317835330963, -0.12497760355472565, 0.08245635777711868, 0.06540284305810928, 0.2370987832546234, 0.010593399405479431, 0.27219390869140625, -0.13509312272071838, -0.1335953176021576, 0.3531579077243805, 0.08318223059177399, -0.37515121698379517, 0.006107374094426632, 0.5184326767921448, 0.09052176028490067, -0.11257920414209366, -0.4577998220920563, 0.13875994086265564, 0.39225977659225464, -0.04285239428281784, -0.18254472315311432, 0.3959064483642578, 0.029019055888056755, 0.09268586337566376, -0.060140062123537064, 0.5353975892066956, -0.03100498393177986, -0.18696334958076477, 0.1814294308423996, -0.15507301688194275 ]
https://github.com/huggingface/datasets/issues/6007
Get an error "OverflowError: Python int too large to convert to C long" when loading a large dataset
I am afraid int32 is not the reason for this error. I have submitted a commit to use int64 for all ints in the dataset: https://huggingface.co/datasets/liwu/MNBVC/commit/857ac00d9eab96a6708ad6a82bd9001686042a9e and I have updated my env to the latest datasets release: Copy-and-paste the text below in your GitHub issue. - `datasets` version: 2.13.1 - Platform: macOS-13.2.1-arm64-arm-64bit - Python version: 3.11.2 - Huggingface_hub version: 0.13.4 - PyArrow version: 11.0.0 - Pandas version: 1.5.3 But the error still exist ``` Downloading and preparing dataset mnbvc/news_peoples_daily to /Users/silver/.cache/huggingface/datasets/liwu___mnbvc/news_peoples_daily/0.0.1/ee380f6309fe9b8b0d1fb14d77118f132444f22c8c4b28bf5c1645312688e051... Downloading data files: 100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 12/12 [00:00<00:00, 9070.40it/s] Extracting data files: 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 12/12 [00:00<00:00, 2697.16it/s] --------------------------------------------------------------------------- OverflowError Traceback (most recent call last) File ~/git/venv/lib/python3.11/site-packages/datasets/builder.py:1647, in GeneratorBasedBuilder._prepare_split_single(self, gen_kwargs, fpath, file_format, max_shard_size, split_info, check_duplicate_keys, job_id) 1646 example = self.info.features.encode_example(record) if self.info.features is not None else record -> 1647 writer.write(example, key) 1648 num_examples_progress_update += 1 File ~/git/venv/lib/python3.11/site-packages/datasets/arrow_writer.py:490, in ArrowWriter.write(self, example, key, writer_batch_size) 488 self.hkey_record = [] --> 490 self.write_examples_on_file() File ~/git/venv/lib/python3.11/site-packages/datasets/arrow_writer.py:448, in ArrowWriter.write_examples_on_file(self) 444 batch_examples[col] = [ 445 row[0][col].to_pylist()[0] if isinstance(row[0][col], (pa.Array, pa.ChunkedArray)) else row[0][col] 446 for row in self.current_examples 447 ] --> 448 self.write_batch(batch_examples=batch_examples) 449 self.current_examples = [] File ~/git/venv/lib/python3.11/site-packages/datasets/arrow_writer.py:553, in ArrowWriter.write_batch(self, batch_examples, writer_batch_size) 552 typed_sequence = OptimizedTypedSequence(col_values, type=col_type, try_type=col_try_type, col=col) --> 553 arrays.append(pa.array(typed_sequence)) 554 inferred_features[col] = typed_sequence.get_inferred_type() File ~/git/venv/lib/python3.11/site-packages/pyarrow/array.pxi:236, in pyarrow.lib.array() File ~/git/venv/lib/python3.11/site-packages/pyarrow/array.pxi:110, in pyarrow.lib._handle_arrow_array_protocol() File ~/git/venv/lib/python3.11/site-packages/datasets/arrow_writer.py:189, in TypedSequence.__arrow_array__(self, type) 188 trying_cast_to_python_objects = True --> 189 out = pa.array(cast_to_python_objects(data, only_1d_for_numpy=True)) 190 # use smaller integer precisions if possible File ~/git/venv/lib/python3.11/site-packages/pyarrow/array.pxi:320, in pyarrow.lib.array() File ~/git/venv/lib/python3.11/site-packages/pyarrow/array.pxi:39, in pyarrow.lib._sequence_to_array() File ~/git/venv/lib/python3.11/site-packages/pyarrow/error.pxi:144, in pyarrow.lib.pyarrow_internal_check_status() OverflowError: Python int too large to convert to C long During handling of the above exception, another exception occurred: OverflowError Traceback (most recent call last) File ~/git/venv/lib/python3.11/site-packages/datasets/builder.py:1656, in GeneratorBasedBuilder._prepare_split_single(self, gen_kwargs, fpath, file_format, max_shard_size, split_info, check_duplicate_keys, job_id) 1655 num_shards = shard_id + 1 -> 1656 num_examples, num_bytes = writer.finalize() 1657 writer.close() File ~/git/venv/lib/python3.11/site-packages/datasets/arrow_writer.py:584, in ArrowWriter.finalize(self, close_stream) 583 self.hkey_record = [] --> 584 self.write_examples_on_file() 585 # If schema is known, infer features even if no examples were written File ~/git/venv/lib/python3.11/site-packages/datasets/arrow_writer.py:448, in ArrowWriter.write_examples_on_file(self) 444 batch_examples[col] = [ 445 row[0][col].to_pylist()[0] if isinstance(row[0][col], (pa.Array, pa.ChunkedArray)) else row[0][col] 446 for row in self.current_examples 447 ] --> 448 self.write_batch(batch_examples=batch_examples) 449 self.current_examples = [] File ~/git/venv/lib/python3.11/site-packages/datasets/arrow_writer.py:553, in ArrowWriter.write_batch(self, batch_examples, writer_batch_size) 552 typed_sequence = OptimizedTypedSequence(col_values, type=col_type, try_type=col_try_type, col=col) --> 553 arrays.append(pa.array(typed_sequence)) 554 inferred_features[col] = typed_sequence.get_inferred_type() File ~/git/venv/lib/python3.11/site-packages/pyarrow/array.pxi:236, in pyarrow.lib.array() File ~/git/venv/lib/python3.11/site-packages/pyarrow/array.pxi:110, in pyarrow.lib._handle_arrow_array_protocol() File ~/git/venv/lib/python3.11/site-packages/datasets/arrow_writer.py:189, in TypedSequence.__arrow_array__(self, type) 188 trying_cast_to_python_objects = True --> 189 out = pa.array(cast_to_python_objects(data, only_1d_for_numpy=True)) 190 # use smaller integer precisions if possible File ~/git/venv/lib/python3.11/site-packages/pyarrow/array.pxi:320, in pyarrow.lib.array() File ~/git/venv/lib/python3.11/site-packages/pyarrow/array.pxi:39, in pyarrow.lib._sequence_to_array() File ~/git/venv/lib/python3.11/site-packages/pyarrow/error.pxi:144, in pyarrow.lib.pyarrow_internal_check_status() OverflowError: Python int too large to convert to C long The above exception was the direct cause of the following exception: DatasetGenerationError Traceback (most recent call last) Cell In[2], line 1 ----> 1 dataset = load_dataset("liwu/MNBVC", 'news_peoples_daily', split='train') File ~/git/venv/lib/python3.11/site-packages/datasets/load.py:1809, in load_dataset(path, name, data_dir, data_files, split, cache_dir, features, download_config, download_mode, verification_mode, ignore_verifications, keep_in_memory, save_infos, revision, use_auth_token, task, streaming, num_proc, storage_options, **config_kwargs) 1806 try_from_hf_gcs = path not in _PACKAGED_DATASETS_MODULES 1808 # Download and prepare data -> 1809 builder_instance.download_and_prepare( 1810 download_config=download_config, 1811 download_mode=download_mode, 1812 verification_mode=verification_mode, 1813 try_from_hf_gcs=try_from_hf_gcs, 1814 num_proc=num_proc, 1815 storage_options=storage_options, 1816 ) 1818 # Build dataset for splits 1819 keep_in_memory = ( 1820 keep_in_memory if keep_in_memory is not None else is_small_dataset(builder_instance.info.dataset_size) 1821 ) File ~/git/venv/lib/python3.11/site-packages/datasets/builder.py:909, in DatasetBuilder.download_and_prepare(self, output_dir, download_config, download_mode, verification_mode, ignore_verifications, try_from_hf_gcs, dl_manager, base_path, use_auth_token, file_format, max_shard_size, num_proc, storage_options, **download_and_prepare_kwargs) 907 if num_proc is not None: 908 prepare_split_kwargs["num_proc"] = num_proc --> 909 self._download_and_prepare( 910 dl_manager=dl_manager, 911 verification_mode=verification_mode, 912 **prepare_split_kwargs, 913 **download_and_prepare_kwargs, 914 ) 915 # Sync info 916 self.info.dataset_size = sum(split.num_bytes for split in self.info.splits.values()) File ~/git/venv/lib/python3.11/site-packages/datasets/builder.py:1670, in GeneratorBasedBuilder._download_and_prepare(self, dl_manager, verification_mode, **prepare_splits_kwargs) 1669 def _download_and_prepare(self, dl_manager, verification_mode, **prepare_splits_kwargs): -> 1670 super()._download_and_prepare( 1671 dl_manager, 1672 verification_mode, 1673 check_duplicate_keys=verification_mode == VerificationMode.BASIC_CHECKS 1674 or verification_mode == VerificationMode.ALL_CHECKS, 1675 **prepare_splits_kwargs, 1676 ) File ~/git/venv/lib/python3.11/site-packages/datasets/builder.py:1004, in DatasetBuilder._download_and_prepare(self, dl_manager, verification_mode, **prepare_split_kwargs) 1000 split_dict.add(split_generator.split_info) 1002 try: 1003 # Prepare split will record examples associated to the split -> 1004 self._prepare_split(split_generator, **prepare_split_kwargs) 1005 except OSError as e: 1006 raise OSError( 1007 "Cannot find data file. " 1008 + (self.manual_download_instructions or "") 1009 + "\nOriginal error:\n" 1010 + str(e) 1011 ) from None File ~/git/venv/lib/python3.11/site-packages/datasets/builder.py:1508, in GeneratorBasedBuilder._prepare_split(self, split_generator, check_duplicate_keys, file_format, num_proc, max_shard_size) 1506 job_id = 0 1507 with pbar: -> 1508 for job_id, done, content in self._prepare_split_single( 1509 gen_kwargs=gen_kwargs, job_id=job_id, **_prepare_split_args 1510 ): 1511 if done: 1512 result = content File ~/git/venv/lib/python3.11/site-packages/datasets/builder.py:1665, in GeneratorBasedBuilder._prepare_split_single(self, gen_kwargs, fpath, file_format, max_shard_size, split_info, check_duplicate_keys, job_id) 1663 if isinstance(e, SchemaInferenceError) and e.__context__ is not None: 1664 e = e.__context__ -> 1665 raise DatasetGenerationError("An error occurred while generating the dataset") from e 1667 yield job_id, True, (total_num_examples, total_num_bytes, writer._features, num_shards, shard_lengths) DatasetGenerationError: An error occurred while generating the dataset ``` Besides, it works fine when I am using streamed dataset.
### Describe the bug When load a large dataset with the following code ```python from datasets import load_dataset dataset = load_dataset("liwu/MNBVC", 'news_peoples_daily', split='train') ``` We encountered the error: "OverflowError: Python int too large to convert to C long" The error look something like: ``` OverflowError: Python int too large to convert to C long During handling of the above exception, another exception occurred: OverflowError Traceback (most recent call last) <ipython-input-7-0ed8700e662d> in <module> ----> 1 dataset = load_dataset("liwu/MNBVC", 'news_peoples_daily', split='train', cache_dir='/sfs/MNBVC/.cache/') /sfs/MNBVC/venv/lib64/python3.6/site-packages/datasets/load.py in load_dataset(path, name, data_dir, data_files, split, cache_dir, features, download_config, download_mode, ignore_verifications, keep_in_memory, save_infos, revision, use_auth_token, task, streaming, **config_kwargs) 1749 ignore_verifications=ignore_verifications, 1750 try_from_hf_gcs=try_from_hf_gcs, -> 1751 use_auth_token=use_auth_token, 1752 ) 1753 /sfs/MNBVC/venv/lib64/python3.6/site-packages/datasets/builder.py in download_and_prepare(self, download_config, download_mode, ignore_verifications, try_from_hf_gcs, dl_manager, base_path, use_auth_token, **download_and_prepare_kwargs) 703 if not downloaded_from_gcs: 704 self._download_and_prepare( --> 705 dl_manager=dl_manager, verify_infos=verify_infos, **download_and_prepare_kwargs 706 ) 707 # Sync info /sfs/MNBVC/venv/lib64/python3.6/site-packages/datasets/builder.py in _download_and_prepare(self, dl_manager, verify_infos) 1225 1226 def _download_and_prepare(self, dl_manager, verify_infos): -> 1227 super()._download_and_prepare(dl_manager, verify_infos, check_duplicate_keys=verify_infos) 1228 1229 def _get_examples_iterable_for_split(self, split_generator: SplitGenerator) -> ExamplesIterable: /sfs/MNBVC/venv/lib64/python3.6/site-packages/datasets/builder.py in _download_and_prepare(self, dl_manager, verify_infos, **prepare_split_kwargs) 791 try: 792 # Prepare split will record examples associated to the split --> 793 self._prepare_split(split_generator, **prepare_split_kwargs) 794 except OSError as e: 795 raise OSError( /sfs/MNBVC/venv/lib64/python3.6/site-packages/datasets/builder.py in _prepare_split(self, split_generator, check_duplicate_keys) 1219 writer.write(example, key) 1220 finally: -> 1221 num_examples, num_bytes = writer.finalize() 1222 1223 split_generator.split_info.num_examples = num_examples /sfs/MNBVC/venv/lib64/python3.6/site-packages/datasets/arrow_writer.py in finalize(self, close_stream) 536 # Re-intializing to empty list for next batch 537 self.hkey_record = [] --> 538 self.write_examples_on_file() 539 if self.pa_writer is None: 540 if self.schema: /sfs/MNBVC/venv/lib64/python3.6/site-packages/datasets/arrow_writer.py in write_examples_on_file(self) 407 # Since current_examples contains (example, key) tuples 408 batch_examples[col] = [row[0][col] for row in self.current_examples] --> 409 self.write_batch(batch_examples=batch_examples) 410 self.current_examples = [] 411 /sfs/MNBVC/venv/lib64/python3.6/site-packages/datasets/arrow_writer.py in write_batch(self, batch_examples, writer_batch_size) 506 col_try_type = try_features[col] if try_features is not None and col in try_features else None 507 typed_sequence = OptimizedTypedSequence(batch_examples[col], type=col_type, try_type=col_try_type, col=col) --> 508 arrays.append(pa.array(typed_sequence)) 509 inferred_features[col] = typed_sequence.get_inferred_type() 510 schema = inferred_features.arrow_schema if self.pa_writer is None else self.schema /sfs/MNBVC/venv/lib64/python3.6/site-packages/pyarrow/array.pxi in pyarrow.lib.array() /sfs/MNBVC/venv/lib64/python3.6/site-packages/pyarrow/array.pxi in pyarrow.lib._handle_arrow_array_protocol() /sfs/MNBVC/venv/lib64/python3.6/site-packages/datasets/arrow_writer.py in __arrow_array__(self, type) 180 else: 181 trying_cast_to_python_objects = True --> 182 out = pa.array(cast_to_python_objects(data, only_1d_for_numpy=True)) 183 # use smaller integer precisions if possible 184 if self.trying_int_optimization: /sfs/MNBVC/venv/lib64/python3.6/site-packages/pyarrow/array.pxi in pyarrow.lib.array() /sfs/MNBVC/venv/lib64/python3.6/site-packages/pyarrow/array.pxi in pyarrow.lib._sequence_to_array() /sfs/MNBVC/venv/lib64/python3.6/site-packages/pyarrow/error.pxi in pyarrow.lib.pyarrow_internal_check_status() OverflowError: Python int too large to convert to C long ``` However, that dataset can be loaded in a streaming manner: ```python from datasets import load_dataset dataset = load_dataset("liwu/MNBVC", 'news_peoples_daily', split='train', streaming=True) for i in dataset: pass # it work well ``` Another issue is reported in our dataset hub: https://huggingface.co/datasets/liwu/MNBVC/discussions/2 ### Steps to reproduce the bug from datasets import load_dataset dataset = load_dataset("liwu/MNBVC", 'news_peoples_daily', split='train') ### Expected behavior the dataset can be safely loaded ### Environment info - `datasets` version: 2.4.0 - Platform: Linux-3.10.0-1160.an7.x86_64-x86_64-with-centos-7.9 - Python version: 3.6.8 - PyArrow version: 6.0.1 - Pandas version: 1.1.5
763
Get an error "OverflowError: Python int too large to convert to C long" when loading a large dataset ### Describe the bug When load a large dataset with the following code ```python from datasets import load_dataset dataset = load_dataset("liwu/MNBVC", 'news_peoples_daily', split='train') ``` We encountered the error: "OverflowError: Python int too large to convert to C long" The error look something like: ``` OverflowError: Python int too large to convert to C long During handling of the above exception, another exception occurred: OverflowError Traceback (most recent call last) <ipython-input-7-0ed8700e662d> in <module> ----> 1 dataset = load_dataset("liwu/MNBVC", 'news_peoples_daily', split='train', cache_dir='/sfs/MNBVC/.cache/') /sfs/MNBVC/venv/lib64/python3.6/site-packages/datasets/load.py in load_dataset(path, name, data_dir, data_files, split, cache_dir, features, download_config, download_mode, ignore_verifications, keep_in_memory, save_infos, revision, use_auth_token, task, streaming, **config_kwargs) 1749 ignore_verifications=ignore_verifications, 1750 try_from_hf_gcs=try_from_hf_gcs, -> 1751 use_auth_token=use_auth_token, 1752 ) 1753 /sfs/MNBVC/venv/lib64/python3.6/site-packages/datasets/builder.py in download_and_prepare(self, download_config, download_mode, ignore_verifications, try_from_hf_gcs, dl_manager, base_path, use_auth_token, **download_and_prepare_kwargs) 703 if not downloaded_from_gcs: 704 self._download_and_prepare( --> 705 dl_manager=dl_manager, verify_infos=verify_infos, **download_and_prepare_kwargs 706 ) 707 # Sync info /sfs/MNBVC/venv/lib64/python3.6/site-packages/datasets/builder.py in _download_and_prepare(self, dl_manager, verify_infos) 1225 1226 def _download_and_prepare(self, dl_manager, verify_infos): -> 1227 super()._download_and_prepare(dl_manager, verify_infos, check_duplicate_keys=verify_infos) 1228 1229 def _get_examples_iterable_for_split(self, split_generator: SplitGenerator) -> ExamplesIterable: /sfs/MNBVC/venv/lib64/python3.6/site-packages/datasets/builder.py in _download_and_prepare(self, dl_manager, verify_infos, **prepare_split_kwargs) 791 try: 792 # Prepare split will record examples associated to the split --> 793 self._prepare_split(split_generator, **prepare_split_kwargs) 794 except OSError as e: 795 raise OSError( /sfs/MNBVC/venv/lib64/python3.6/site-packages/datasets/builder.py in _prepare_split(self, split_generator, check_duplicate_keys) 1219 writer.write(example, key) 1220 finally: -> 1221 num_examples, num_bytes = writer.finalize() 1222 1223 split_generator.split_info.num_examples = num_examples /sfs/MNBVC/venv/lib64/python3.6/site-packages/datasets/arrow_writer.py in finalize(self, close_stream) 536 # Re-intializing to empty list for next batch 537 self.hkey_record = [] --> 538 self.write_examples_on_file() 539 if self.pa_writer is None: 540 if self.schema: /sfs/MNBVC/venv/lib64/python3.6/site-packages/datasets/arrow_writer.py in write_examples_on_file(self) 407 # Since current_examples contains (example, key) tuples 408 batch_examples[col] = [row[0][col] for row in self.current_examples] --> 409 self.write_batch(batch_examples=batch_examples) 410 self.current_examples = [] 411 /sfs/MNBVC/venv/lib64/python3.6/site-packages/datasets/arrow_writer.py in write_batch(self, batch_examples, writer_batch_size) 506 col_try_type = try_features[col] if try_features is not None and col in try_features else None 507 typed_sequence = OptimizedTypedSequence(batch_examples[col], type=col_type, try_type=col_try_type, col=col) --> 508 arrays.append(pa.array(typed_sequence)) 509 inferred_features[col] = typed_sequence.get_inferred_type() 510 schema = inferred_features.arrow_schema if self.pa_writer is None else self.schema /sfs/MNBVC/venv/lib64/python3.6/site-packages/pyarrow/array.pxi in pyarrow.lib.array() /sfs/MNBVC/venv/lib64/python3.6/site-packages/pyarrow/array.pxi in pyarrow.lib._handle_arrow_array_protocol() /sfs/MNBVC/venv/lib64/python3.6/site-packages/datasets/arrow_writer.py in __arrow_array__(self, type) 180 else: 181 trying_cast_to_python_objects = True --> 182 out = pa.array(cast_to_python_objects(data, only_1d_for_numpy=True)) 183 # use smaller integer precisions if possible 184 if self.trying_int_optimization: /sfs/MNBVC/venv/lib64/python3.6/site-packages/pyarrow/array.pxi in pyarrow.lib.array() /sfs/MNBVC/venv/lib64/python3.6/site-packages/pyarrow/array.pxi in pyarrow.lib._sequence_to_array() /sfs/MNBVC/venv/lib64/python3.6/site-packages/pyarrow/error.pxi in pyarrow.lib.pyarrow_internal_check_status() OverflowError: Python int too large to convert to C long ``` However, that dataset can be loaded in a streaming manner: ```python from datasets import load_dataset dataset = load_dataset("liwu/MNBVC", 'news_peoples_daily', split='train', streaming=True) for i in dataset: pass # it work well ``` Another issue is reported in our dataset hub: https://huggingface.co/datasets/liwu/MNBVC/discussions/2 ### Steps to reproduce the bug from datasets import load_dataset dataset = load_dataset("liwu/MNBVC", 'news_peoples_daily', split='train') ### Expected behavior the dataset can be safely loaded ### Environment info - `datasets` version: 2.4.0 - Platform: Linux-3.10.0-1160.an7.x86_64-x86_64-with-centos-7.9 - Python version: 3.6.8 - PyArrow version: 6.0.1 - Pandas version: 1.1.5 I am afraid int32 is not the reason for this error. I have submitted a commit to use int64 for all ints in the dataset: https://huggingface.co/datasets/liwu/MNBVC/commit/857ac00d9eab96a6708ad6a82bd9001686042a9e and I have updated my env to the latest datasets release: Copy-and-paste the text below in your GitHub issue. - `datasets` version: 2.13.1 - Platform: macOS-13.2.1-arm64-arm-64bit - Python version: 3.11.2 - Huggingface_hub version: 0.13.4 - PyArrow version: 11.0.0 - Pandas version: 1.5.3 But the error still exist ``` Downloading and preparing dataset mnbvc/news_peoples_daily to /Users/silver/.cache/huggingface/datasets/liwu___mnbvc/news_peoples_daily/0.0.1/ee380f6309fe9b8b0d1fb14d77118f132444f22c8c4b28bf5c1645312688e051... Downloading data files: 100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 12/12 [00:00<00:00, 9070.40it/s] Extracting data files: 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 12/12 [00:00<00:00, 2697.16it/s] --------------------------------------------------------------------------- OverflowError Traceback (most recent call last) File ~/git/venv/lib/python3.11/site-packages/datasets/builder.py:1647, in GeneratorBasedBuilder._prepare_split_single(self, gen_kwargs, fpath, file_format, max_shard_size, split_info, check_duplicate_keys, job_id) 1646 example = self.info.features.encode_example(record) if self.info.features is not None else record -> 1647 writer.write(example, key) 1648 num_examples_progress_update += 1 File ~/git/venv/lib/python3.11/site-packages/datasets/arrow_writer.py:490, in ArrowWriter.write(self, example, key, writer_batch_size) 488 self.hkey_record = [] --> 490 self.write_examples_on_file() File ~/git/venv/lib/python3.11/site-packages/datasets/arrow_writer.py:448, in ArrowWriter.write_examples_on_file(self) 444 batch_examples[col] = [ 445 row[0][col].to_pylist()[0] if isinstance(row[0][col], (pa.Array, pa.ChunkedArray)) else row[0][col] 446 for row in self.current_examples 447 ] --> 448 self.write_batch(batch_examples=batch_examples) 449 self.current_examples = [] File ~/git/venv/lib/python3.11/site-packages/datasets/arrow_writer.py:553, in ArrowWriter.write_batch(self, batch_examples, writer_batch_size) 552 typed_sequence = OptimizedTypedSequence(col_values, type=col_type, try_type=col_try_type, col=col) --> 553 arrays.append(pa.array(typed_sequence)) 554 inferred_features[col] = typed_sequence.get_inferred_type() File ~/git/venv/lib/python3.11/site-packages/pyarrow/array.pxi:236, in pyarrow.lib.array() File ~/git/venv/lib/python3.11/site-packages/pyarrow/array.pxi:110, in pyarrow.lib._handle_arrow_array_protocol() File ~/git/venv/lib/python3.11/site-packages/datasets/arrow_writer.py:189, in TypedSequence.__arrow_array__(self, type) 188 trying_cast_to_python_objects = True --> 189 out = pa.array(cast_to_python_objects(data, only_1d_for_numpy=True)) 190 # use smaller integer precisions if possible File ~/git/venv/lib/python3.11/site-packages/pyarrow/array.pxi:320, in pyarrow.lib.array() File ~/git/venv/lib/python3.11/site-packages/pyarrow/array.pxi:39, in pyarrow.lib._sequence_to_array() File ~/git/venv/lib/python3.11/site-packages/pyarrow/error.pxi:144, in pyarrow.lib.pyarrow_internal_check_status() OverflowError: Python int too large to convert to C long During handling of the above exception, another exception occurred: OverflowError Traceback (most recent call last) File ~/git/venv/lib/python3.11/site-packages/datasets/builder.py:1656, in GeneratorBasedBuilder._prepare_split_single(self, gen_kwargs, fpath, file_format, max_shard_size, split_info, check_duplicate_keys, job_id) 1655 num_shards = shard_id + 1 -> 1656 num_examples, num_bytes = writer.finalize() 1657 writer.close() File ~/git/venv/lib/python3.11/site-packages/datasets/arrow_writer.py:584, in ArrowWriter.finalize(self, close_stream) 583 self.hkey_record = [] --> 584 self.write_examples_on_file() 585 # If schema is known, infer features even if no examples were written File ~/git/venv/lib/python3.11/site-packages/datasets/arrow_writer.py:448, in ArrowWriter.write_examples_on_file(self) 444 batch_examples[col] = [ 445 row[0][col].to_pylist()[0] if isinstance(row[0][col], (pa.Array, pa.ChunkedArray)) else row[0][col] 446 for row in self.current_examples 447 ] --> 448 self.write_batch(batch_examples=batch_examples) 449 self.current_examples = [] File ~/git/venv/lib/python3.11/site-packages/datasets/arrow_writer.py:553, in ArrowWriter.write_batch(self, batch_examples, writer_batch_size) 552 typed_sequence = OptimizedTypedSequence(col_values, type=col_type, try_type=col_try_type, col=col) --> 553 arrays.append(pa.array(typed_sequence)) 554 inferred_features[col] = typed_sequence.get_inferred_type() File ~/git/venv/lib/python3.11/site-packages/pyarrow/array.pxi:236, in pyarrow.lib.array() File ~/git/venv/lib/python3.11/site-packages/pyarrow/array.pxi:110, in pyarrow.lib._handle_arrow_array_protocol() File ~/git/venv/lib/python3.11/site-packages/datasets/arrow_writer.py:189, in TypedSequence.__arrow_array__(self, type) 188 trying_cast_to_python_objects = True --> 189 out = pa.array(cast_to_python_objects(data, only_1d_for_numpy=True)) 190 # use smaller integer precisions if possible File ~/git/venv/lib/python3.11/site-packages/pyarrow/array.pxi:320, in pyarrow.lib.array() File ~/git/venv/lib/python3.11/site-packages/pyarrow/array.pxi:39, in pyarrow.lib._sequence_to_array() File ~/git/venv/lib/python3.11/site-packages/pyarrow/error.pxi:144, in pyarrow.lib.pyarrow_internal_check_status() OverflowError: Python int too large to convert to C long The above exception was the direct cause of the following exception: DatasetGenerationError Traceback (most recent call last) Cell In[2], line 1 ----> 1 dataset = load_dataset("liwu/MNBVC", 'news_peoples_daily', split='train') File ~/git/venv/lib/python3.11/site-packages/datasets/load.py:1809, in load_dataset(path, name, data_dir, data_files, split, cache_dir, features, download_config, download_mode, verification_mode, ignore_verifications, keep_in_memory, save_infos, revision, use_auth_token, task, streaming, num_proc, storage_options, **config_kwargs) 1806 try_from_hf_gcs = path not in _PACKAGED_DATASETS_MODULES 1808 # Download and prepare data -> 1809 builder_instance.download_and_prepare( 1810 download_config=download_config, 1811 download_mode=download_mode, 1812 verification_mode=verification_mode, 1813 try_from_hf_gcs=try_from_hf_gcs, 1814 num_proc=num_proc, 1815 storage_options=storage_options, 1816 ) 1818 # Build dataset for splits 1819 keep_in_memory = ( 1820 keep_in_memory if keep_in_memory is not None else is_small_dataset(builder_instance.info.dataset_size) 1821 ) File ~/git/venv/lib/python3.11/site-packages/datasets/builder.py:909, in DatasetBuilder.download_and_prepare(self, output_dir, download_config, download_mode, verification_mode, ignore_verifications, try_from_hf_gcs, dl_manager, base_path, use_auth_token, file_format, max_shard_size, num_proc, storage_options, **download_and_prepare_kwargs) 907 if num_proc is not None: 908 prepare_split_kwargs["num_proc"] = num_proc --> 909 self._download_and_prepare( 910 dl_manager=dl_manager, 911 verification_mode=verification_mode, 912 **prepare_split_kwargs, 913 **download_and_prepare_kwargs, 914 ) 915 # Sync info 916 self.info.dataset_size = sum(split.num_bytes for split in self.info.splits.values()) File ~/git/venv/lib/python3.11/site-packages/datasets/builder.py:1670, in GeneratorBasedBuilder._download_and_prepare(self, dl_manager, verification_mode, **prepare_splits_kwargs) 1669 def _download_and_prepare(self, dl_manager, verification_mode, **prepare_splits_kwargs): -> 1670 super()._download_and_prepare( 1671 dl_manager, 1672 verification_mode, 1673 check_duplicate_keys=verification_mode == VerificationMode.BASIC_CHECKS 1674 or verification_mode == VerificationMode.ALL_CHECKS, 1675 **prepare_splits_kwargs, 1676 ) File ~/git/venv/lib/python3.11/site-packages/datasets/builder.py:1004, in DatasetBuilder._download_and_prepare(self, dl_manager, verification_mode, **prepare_split_kwargs) 1000 split_dict.add(split_generator.split_info) 1002 try: 1003 # Prepare split will record examples associated to the split -> 1004 self._prepare_split(split_generator, **prepare_split_kwargs) 1005 except OSError as e: 1006 raise OSError( 1007 "Cannot find data file. " 1008 + (self.manual_download_instructions or "") 1009 + "\nOriginal error:\n" 1010 + str(e) 1011 ) from None File ~/git/venv/lib/python3.11/site-packages/datasets/builder.py:1508, in GeneratorBasedBuilder._prepare_split(self, split_generator, check_duplicate_keys, file_format, num_proc, max_shard_size) 1506 job_id = 0 1507 with pbar: -> 1508 for job_id, done, content in self._prepare_split_single( 1509 gen_kwargs=gen_kwargs, job_id=job_id, **_prepare_split_args 1510 ): 1511 if done: 1512 result = content File ~/git/venv/lib/python3.11/site-packages/datasets/builder.py:1665, in GeneratorBasedBuilder._prepare_split_single(self, gen_kwargs, fpath, file_format, max_shard_size, split_info, check_duplicate_keys, job_id) 1663 if isinstance(e, SchemaInferenceError) and e.__context__ is not None: 1664 e = e.__context__ -> 1665 raise DatasetGenerationError("An error occurred while generating the dataset") from e 1667 yield job_id, True, (total_num_examples, total_num_bytes, writer._features, num_shards, shard_lengths) DatasetGenerationError: An error occurred while generating the dataset ``` Besides, it works fine when I am using streamed dataset.
[ -0.42730045318603516, -0.3950994908809662, -0.02665611356496811, 0.3553202748298645, 0.3509588837623596, -0.004374183714389801, 0.10522277653217316, 0.331129789352417, 0.31195196509361267, 0.1922844648361206, -0.027331490069627762, 0.16219580173492432, -0.11134413629770279, 0.08958712965250015, -0.2046218365430832, -0.1775018572807312, 0.1220521628856659, -0.17765238881111145, -0.25584712624549866, 0.18601104617118835, -0.3780885636806488, -0.07006936520338058, -0.17661845684051514, 0.048064276576042175, -0.23183873295783997, -0.21604019403457642, 0.12426722049713135, 0.36674559116363525, -0.2756235599517822, -0.3445779085159302, 0.0034113675355911255, -0.3893600404262543, 0.35168981552124023, 0.4516564607620239, -0.00011814466415671632, -0.18242916464805603, 0.11768415570259094, -0.042029090225696564, -0.32315704226493835, 0.09475971758365631, -0.039298251271247864, -0.5150787830352783, -0.006220826879143715, -0.45916715264320374, 0.16284555196762085, -0.05158706381917, -0.17475268244743347, -0.08125865459442139, 0.18807296454906464, 0.5761505961418152, 0.19275711476802826, 0.055086515843868256, 0.38476377725601196, 0.06680193543434143, 0.22039756178855896, -0.03740207850933075, -0.06243707239627838, 0.4031565189361572, 0.2108921855688095, 0.22969180345535278, -0.028704509139060974, -0.06308931857347488, -0.1489473581314087, -0.18602950870990753, 0.11887466907501221, -0.16871783137321472, 0.0570891909301281, -0.19999699294567108, 0.007225114852190018, -0.00796797126531601, 0.10818733274936676, -0.08280960470438004, -0.10172402858734131, -0.04120077192783356, 0.04498547315597534, -0.4488227963447571, -0.10353534668684006, 0.19530950486660004, 0.006717499345541, 0.08620800077915192, -0.18851512670516968, -0.2502252757549286, -0.2554998993873596, 0.2120245397090912, -0.32102394104003906, -0.11662086844444275, -0.14016851782798767, 0.21713149547576904, 0.21627303957939148, -0.18306414783000946, 0.017507245764136314, -0.024290628731250763, 0.03425518423318863, 0.18231849372386932, -0.3292953372001648, -0.1898389309644699, 0.003925345838069916, 0.10165248066186905, 0.2865700423717499, -0.04653023183345795, 0.06803923845291138, -0.018249500542879105, -0.11352144926786423, 0.14824597537517548, 0.18170928955078125, 0.1451261043548584, -0.6392795443534851, 0.4040762484073639, 0.3212814927101135, -0.02512778528034687, -0.1858256608247757, -0.08128379285335541, -0.04995885491371155, -0.306194007396698, 0.2521118223667145, 0.10100943595170975, 0.3818824291229248, -0.3228907883167267, -0.41205209493637085, 0.14715653657913208, -0.21592304110527039, 0.28504449129104614, 0.28412044048309326, 0.34671279788017273, -0.09875354915857315, 0.23286649584770203, 0.07463964074850082, 0.08334185183048248, -0.23511558771133423, -0.20238308608531952, -0.15069420635700226, 0.10457052290439606, -0.07249986380338669, -0.04433203488588333, 0.0936983972787857, -0.07169461250305176, 0.17004035413265228, 0.28497105836868286, 0.18396618962287903, -0.33783644437789917, 0.005977662280201912, -0.4781578481197357, 0.03976692631840706, 0.08606648445129395, -0.07800450921058655, -0.11582841724157333, 0.37072739005088806, 0.15519371628761292, -0.1194450706243515, 0.3418324589729309, -0.5060864686965942, -0.3711854815483093, -0.18037086725234985, 0.1869175285100937, 0.014307916164398193, -0.01662929356098175, -0.26676449179649353, -0.17007222771644592, 0.21955472230911255, -0.18516604602336884, 0.21145731210708618, -0.4256848096847534, 0.2160862684249878, -0.16842709481716156, -0.04905072972178459, 0.17450213432312012, -0.2994723916053772, 0.25893083214759827, -0.01978052407503128, 0.19197964668273926, 0.41219577193260193, 0.5086793899536133, -0.18264180421829224, -0.033356644213199615, -0.3783024847507477, -0.33097341656684875, 0.3757345378398895, -0.18065184354782104, -0.43467360734939575, 0.4298314154148102, -0.04181225225329399, -0.04125894606113434, -0.14741253852844238, 0.10902555286884308, 0.18719500303268433, -0.0816936120390892, 0.19337141513824463, 0.40117591619491577, -0.2251415252685547, 0.1918102353811264, -0.4496757984161377, -0.2674904465675354, 0.24783213436603546, 0.1967029720544815, 0.17562878131866455, -0.06670371443033218, 0.21777880191802979, -0.07312412559986115, 0.2588134706020355, -0.06310270726680756, -0.22276179492473602, 0.2580525279045105, 0.11467486619949341, 0.13091275095939636, -0.21843716502189636, -0.2864813506603241, 0.010846499353647232, -0.02313442900776863, -0.010160811245441437, -0.16320107877254486, 0.09471727907657623, -0.15478797256946564, -0.51869136095047, 0.23062573373317719, 0.07093244045972824, 0.3605084717273712, 0.04756245017051697, 0.018511291593313217, 0.16914500296115875, -0.06382670253515244, 0.1751853972673416, 0.45256394147872925, -0.434812992811203, 0.005193493328988552, -0.07389724254608154, 0.14947402477264404, -0.13532640039920807, -0.1558477133512497, 0.026621952652931213, 0.12149637192487717, 0.3321802616119385, -0.03791804984211922, -0.3654502332210541, 0.18011757731437683, -0.009776225313544273, -0.29486942291259766, -0.3651312291622162, -0.2157198041677475, 0.22062039375305176, -0.3945513963699341, 0.29898008704185486, 0.19280105829238892, 0.24524268507957458, -0.047357313334941864, 0.04771691560745239, 0.2859414219856262, -0.3086586892604828, 0.12132122367620468, 0.09259235858917236, -0.041770800948143005, 0.3189939856529236, -0.12412536144256592, 0.20322884619235992, 0.007417544722557068, 0.0014881305396556854, 0.19949939846992493, 0.15952810645103455, -0.05024313926696777, -0.2033296376466751, -0.13109645247459412, 0.6715540289878845, -0.06587813794612885, 0.10676909983158112, 0.2518104910850525, -0.20792314410209656, -0.03859367221593857, 0.06895805150270462, -0.21736617386341095, 0.5505901575088501, 0.3331361413002014, -0.08229184150695801, -0.06867225468158722, 0.014712135307490826, -0.09951192140579224, 0.2664300203323364, 0.16960284113883972, 0.32267507910728455, 0.15934407711029053, 0.4819996654987335, -0.04444257169961929, -0.20974647998809814, -0.27626344561576843, 0.04477187991142273, 0.26742932200431824, -0.3840709626674652, 0.38414156436920166, -0.0696205198764801, -0.2515539824962616, -0.17747272551059723, -0.2844955027103424, 0.004043798893690109, -0.33593153953552246, -0.33264684677124023, 0.4384606182575226, 0.01700320839881897, -0.07723640650510788, -0.22626927495002747, 0.062228694558143616, 0.3358646631240845, -0.27092087268829346, 0.17083531618118286, 0.05200768634676933, -0.2650725543498993, 0.011704675853252411, 0.4868507385253906, -0.2440004050731659, 0.3427879512310028, 0.12019755691289902, -0.1655244529247284, -0.03905197232961655, -0.20386990904808044, -0.1234484612941742, 0.0991927981376648, 0.16942739486694336, -0.030192866921424866, 0.3613826036453247, -0.21136347949504852, -0.16740255057811737, 0.010533466003835201, 0.04331997036933899, 0.0594557449221611, 0.1659039556980133, -0.10908263921737671, 0.1439702957868576, -0.03303379938006401, -0.2585492730140686, -0.44593361020088196, -0.5692219138145447, 0.10587580502033234, 0.059380244463682175, 0.13857056200504303, 0.25813671946525574, 0.1298876702785492, 0.2472284734249115, 0.34788572788238525, -0.11012277007102966, -0.3189486563205719, -0.13861893117427826, 0.35731738805770874, -0.17738893628120422, -0.19554027915000916, 0.1069212406873703, -0.024517707526683807, -0.047351155430078506, 0.14091236889362335, -0.4079741835594177, 0.1772587150335312, -0.42272523045539856, 0.46870070695877075, -0.4635942578315735, -0.04442131519317627, 0.1144370436668396, -0.21715916693210602, 0.010356130078434944, 0.12779727578163147, 0.09290255606174469, -0.12362018972635269, 0.14443951845169067, 0.49612289667129517, -0.25444239377975464, 0.44793447852134705, -0.16753025352954865, 0.5885943174362183, 0.17588989436626434, 0.05358100309967995, 0.3482431471347809, 0.021755538880825043, 0.01447666808962822, -0.21496406197547913, -0.37185582518577576, 0.06305868923664093, -0.22956803441047668, -0.1729588508605957, 0.06716443598270416, -0.08266009390354156, -0.07205028086900711, 0.12978999316692352, -0.2179080694913864, -0.05128931254148483, -0.2240113615989685, 0.20996160805225372, -0.09039054811000824, 0.17387999594211578, -0.14571210741996765, -0.09767287969589233, -0.2475629448890686, -0.23845559358596802, -0.1726536750793457, 0.17912964522838593, 0.018602490425109863, 0.04128723964095116, 0.10141374170780182, -0.16951853036880493, -0.2960941195487976, 0.2517765760421753, -0.02027714252471924, 0.3787272572517395, 0.003271874040365219, 0.03430300951004028, -0.09064504504203796, -0.09841862320899963, 0.4456343650817871, 0.28611254692077637, 0.07992543280124664, 0.09266795217990875, 0.17231769859790802, -0.4492839276790619, -0.076456218957901, -0.10963420569896698, 0.3906116783618927, 0.5413093566894531, 0.3065812587738037, -0.2116076648235321, 0.14862775802612305, 0.6596485376358032, 0.4045993685722351, -0.03348797559738159, -0.1579154133796692, -0.282257616519928, -0.38411980867385864, -0.29867851734161377, 0.24832361936569214, 0.2736555337905884, 0.27473756670951843, -0.2445584237575531, -0.28429844975471497, -0.2872462868690491, -0.0773293599486351, 0.020731396973133087, -0.10377262532711029, 0.2474452257156372, -0.2777171730995178, 0.1813603639602661, -0.43756192922592163, 0.23997774720191956, 0.24989573657512665, 0.5667697787284851, 0.07643535733222961, -0.4990854263305664, 0.1059616282582283, 0.120084747672081, 0.30827513337135315, 0.09950698167085648, -0.1307036429643631, 0.22553041577339172, -0.09968683868646622, 0.44804614782333374, -0.07788205146789551, 0.5246808528900146, -0.14827927947044373, 0.22094689309597015, -0.34291067719459534, -0.19213396310806274, 0.547170877456665, 0.1663152426481247, 0.19766582548618317, 0.3111850619316101, 0.026270408183336258, -0.3059810400009155, 0.3107355833053589, -0.16278767585754395, 0.8497914671897888, 0.06669555604457855, -0.06066598370671272, 0.38529133796691895, -0.03204647824168205, 0.2201925814151764, -0.00027794018387794495, 0.13152961432933807, -0.37022724747657776, -0.027098488062620163, 0.18778760731220245, -0.13702905178070068, 0.06583811342716217, -0.18384596705436707, -0.28570640087127686, 0.2849735617637634, -0.2500235438346863, -0.09471683204174042, -0.04896274954080582, 0.3314095735549927, -0.37765559554100037, 0.007667003199458122, -0.2876814603805542, 0.15929317474365234, -0.38668298721313477, -0.053935494273900986, -0.08390773087739944, 0.04848698154091835, -0.08806009590625763, -0.15772201120853424, -0.24220161139965057, 0.08613095432519913, -0.2848759591579437, 0.3731246590614319, -0.2572709918022156, -0.29216790199279785, 0.5167397260665894, -0.09814170002937317, 0.08122798800468445, 0.29140427708625793, -0.06481871753931046, 0.034971725195646286, -0.14759615063667297, -0.18979187309741974, 0.05812549218535423, 0.17811043560504913, 0.10609754920005798, -0.020049842074513435, -0.2854974865913391, 0.04728515446186066, -0.05922948196530342, -0.16250252723693848, 0.024472326040267944, 0.10543470829725266, 0.5009015798568726, -0.48849254846572876, -0.32759889960289, -0.24513548612594604, -0.09851664304733276, -0.2617266774177551, 0.11408805847167969, -0.06117524206638336, -0.13015489280223846, 0.2037440836429596, 0.22624093294143677, -0.4189797341823578, -0.10186879336833954, 0.17977853119373322, -0.0036855190992355347, -0.12414667755365372, 0.47180846333503723, 0.1788039356470108, -0.19214396178722382, -0.13290202617645264, 0.3621409833431244, -0.1984470933675766, -0.38313984870910645, 0.2497865855693817, -0.08816082775592804, 0.3134532570838928, 0.049364469945430756, 0.1648942530155182, 0.12852762639522552, -0.02610381692647934, -0.055564820766448975, -0.47899386286735535, -0.6197270750999451, 0.020489759743213654, -0.17898087203502655, 0.07164382934570312, 0.22576233744621277, 0.11449176073074341, -0.3802782893180847, 0.06096949428319931, -0.24993325769901276, 0.11757151782512665, -0.0940813273191452, 0.10025616735219955, 0.1581793874502182, -0.285672664642334, -0.1549951136112213, 0.08355088531970978, 0.14725881814956665, 0.3399650454521179, 0.20342303812503815, -0.22011911869049072, -0.18029530346393585, 0.12341981381177902, -0.006576646119356155, -0.3159588873386383, -0.08770573139190674, -0.28387194871902466, 0.037396859377622604, -0.03816695511341095, 0.10210222005844116, 0.11634885519742966, 0.07618573307991028, 0.02099715918302536, -0.24134309589862823, 0.0034297481179237366, -0.12185151129961014, 0.19924387335777283, 0.13464704155921936, 0.4082373380661011, 0.19386886060237885, 0.5115569829940796, 0.24224495887756348, -0.04629679024219513, -0.43919476866722107, -0.008643358945846558, 0.3187031149864197, 0.03648817911744118, 0.3426598310470581, -0.2697684168815613, 0.07568514347076416, 0.16929204761981964, -0.23282288014888763, 0.22913405299186707, -0.25543516874313354, -0.09877418726682663, 0.26777660846710205, 0.16084587574005127, -0.17872226238250732, 0.13948845863342285, 0.15855363011360168, -0.3148189187049866, -0.023261284455657005, 0.2851652204990387, -0.20909349620342255, -0.1405559629201889, -0.27613288164138794, -0.02294502966105938, 0.21735170483589172, 0.2729935050010681, 0.002375860931351781, 0.4859406054019928, -0.044278278946876526, -0.21067754924297333, 0.39080774784088135, 0.16114452481269836, 0.3288120925426483, 0.8358757495880127, -0.2156842052936554, 0.133271723985672, -0.2734277546405792, 0.04166405647993088, -0.014557689428329468, -0.3601619005203247, -0.033477526158094406, 0.28801143169403076, -0.2637088894844055, 0.27294921875, 0.020296543836593628, 0.20703613758087158, -0.26228877902030945, -0.07231521606445312, -0.173462375998497, 0.2326335906982422, -0.31068432331085205, 0.10655294358730316, 0.20396822690963745, 0.08397028595209122, -0.03519570454955101, 0.21060211956501007, -0.15057437121868134, -0.04050738364458084, 0.10409249365329742, 0.3406962752342224, -0.20162175595760345, -0.271628737449646, 0.2608352601528168, 0.4320448040962219, 0.08981703221797943, -0.4641041159629822, 0.12155914306640625, 0.2563055753707886, 0.00421489030122757, -0.1815425306558609, -0.11361978203058243, 0.5183136463165283, 0.27215591073036194, 0.020924024283885956, 0.03270827978849411, 0.056745365262031555, -0.14462020993232727, 0.12292782962322235, -0.24000754952430725, 0.147347554564476, 0.4070994257926941, 0.2802129089832306, 0.08324094861745834, -0.17698591947555542, -0.03167227283120155, 0.13094188272953033, -0.0826028436422348, -0.2602497339248657, 0.28847265243530273, 0.05318643897771835, -0.39021438360214233, -0.25396913290023804, 0.010516196489334106, -0.250701367855072, -0.06606036424636841, 0.4123232364654541, 0.07801241427659988, 0.2456803321838379, 0.16989725828170776, 0.04279639571905136, -0.2895328998565674, 0.4310108423233032, 0.25519415736198425, 0.2772292494773865, -0.5120605230331421, -0.11491222679615021, -0.3112878203392029, 0.11089342087507248, -0.36213916540145874, 0.03549609333276749, 0.199350968003273, 0.0729064792394638, -0.14432817697525024, 0.11744127422571182, 0.24190343916416168, 0.27480921149253845, 0.35398057103157043, 0.165370374917984, -0.14194153249263763, -0.4123852252960205, 0.07853980362415314, -0.12405794858932495, 0.003536362200975418, -0.5456081628799438, 0.2555713951587677, -0.206376850605011, 0.008678007870912552, -0.19115620851516724, 0.009041540324687958, 0.01849699392914772, -0.05934974551200867, 0.3211500644683838, 0.24234360456466675, 0.5917177200317383, -0.010546587407588959, -0.01108473353087902, 0.2435409426689148, -0.14336103200912476, -0.10123249143362045, 0.28801119327545166, 0.10816340148448944, 0.3745174705982208, -0.03582605719566345, -0.07707174122333527, -0.22778986394405365, 0.185454323887825, -0.020570972934365273, -0.5014035105705261, 0.042701348662376404, -0.20563317835330963, -0.12497760355472565, 0.08245635777711868, 0.06540284305810928, 0.2370987832546234, 0.010593399405479431, 0.27219390869140625, -0.13509312272071838, -0.1335953176021576, 0.3531579077243805, 0.08318223059177399, -0.37515121698379517, 0.006107374094426632, 0.5184326767921448, 0.09052176028490067, -0.11257920414209366, -0.4577998220920563, 0.13875994086265564, 0.39225977659225464, -0.04285239428281784, -0.18254472315311432, 0.3959064483642578, 0.029019055888056755, 0.09268586337566376, -0.060140062123537064, 0.5353975892066956, -0.03100498393177986, -0.18696334958076477, 0.1814294308423996, -0.15507301688194275 ]
https://github.com/huggingface/datasets/issues/6007
Get an error "OverflowError: Python int too large to convert to C long" when loading a large dataset
`simhash` is the problematic column - it has values such as `18329103420363166823` that are out of the int64 range. You can fix this by setting the feature type to `Value("string")` (it's advised to use this type for hash values in general) > Besides, it works fine when I am using streamed dataset. Streaming yields Python dictionaries from the script without converting them to the Arrow representation, as this conversion step is not that cheap performance-wise.
### Describe the bug When load a large dataset with the following code ```python from datasets import load_dataset dataset = load_dataset("liwu/MNBVC", 'news_peoples_daily', split='train') ``` We encountered the error: "OverflowError: Python int too large to convert to C long" The error look something like: ``` OverflowError: Python int too large to convert to C long During handling of the above exception, another exception occurred: OverflowError Traceback (most recent call last) <ipython-input-7-0ed8700e662d> in <module> ----> 1 dataset = load_dataset("liwu/MNBVC", 'news_peoples_daily', split='train', cache_dir='/sfs/MNBVC/.cache/') /sfs/MNBVC/venv/lib64/python3.6/site-packages/datasets/load.py in load_dataset(path, name, data_dir, data_files, split, cache_dir, features, download_config, download_mode, ignore_verifications, keep_in_memory, save_infos, revision, use_auth_token, task, streaming, **config_kwargs) 1749 ignore_verifications=ignore_verifications, 1750 try_from_hf_gcs=try_from_hf_gcs, -> 1751 use_auth_token=use_auth_token, 1752 ) 1753 /sfs/MNBVC/venv/lib64/python3.6/site-packages/datasets/builder.py in download_and_prepare(self, download_config, download_mode, ignore_verifications, try_from_hf_gcs, dl_manager, base_path, use_auth_token, **download_and_prepare_kwargs) 703 if not downloaded_from_gcs: 704 self._download_and_prepare( --> 705 dl_manager=dl_manager, verify_infos=verify_infos, **download_and_prepare_kwargs 706 ) 707 # Sync info /sfs/MNBVC/venv/lib64/python3.6/site-packages/datasets/builder.py in _download_and_prepare(self, dl_manager, verify_infos) 1225 1226 def _download_and_prepare(self, dl_manager, verify_infos): -> 1227 super()._download_and_prepare(dl_manager, verify_infos, check_duplicate_keys=verify_infos) 1228 1229 def _get_examples_iterable_for_split(self, split_generator: SplitGenerator) -> ExamplesIterable: /sfs/MNBVC/venv/lib64/python3.6/site-packages/datasets/builder.py in _download_and_prepare(self, dl_manager, verify_infos, **prepare_split_kwargs) 791 try: 792 # Prepare split will record examples associated to the split --> 793 self._prepare_split(split_generator, **prepare_split_kwargs) 794 except OSError as e: 795 raise OSError( /sfs/MNBVC/venv/lib64/python3.6/site-packages/datasets/builder.py in _prepare_split(self, split_generator, check_duplicate_keys) 1219 writer.write(example, key) 1220 finally: -> 1221 num_examples, num_bytes = writer.finalize() 1222 1223 split_generator.split_info.num_examples = num_examples /sfs/MNBVC/venv/lib64/python3.6/site-packages/datasets/arrow_writer.py in finalize(self, close_stream) 536 # Re-intializing to empty list for next batch 537 self.hkey_record = [] --> 538 self.write_examples_on_file() 539 if self.pa_writer is None: 540 if self.schema: /sfs/MNBVC/venv/lib64/python3.6/site-packages/datasets/arrow_writer.py in write_examples_on_file(self) 407 # Since current_examples contains (example, key) tuples 408 batch_examples[col] = [row[0][col] for row in self.current_examples] --> 409 self.write_batch(batch_examples=batch_examples) 410 self.current_examples = [] 411 /sfs/MNBVC/venv/lib64/python3.6/site-packages/datasets/arrow_writer.py in write_batch(self, batch_examples, writer_batch_size) 506 col_try_type = try_features[col] if try_features is not None and col in try_features else None 507 typed_sequence = OptimizedTypedSequence(batch_examples[col], type=col_type, try_type=col_try_type, col=col) --> 508 arrays.append(pa.array(typed_sequence)) 509 inferred_features[col] = typed_sequence.get_inferred_type() 510 schema = inferred_features.arrow_schema if self.pa_writer is None else self.schema /sfs/MNBVC/venv/lib64/python3.6/site-packages/pyarrow/array.pxi in pyarrow.lib.array() /sfs/MNBVC/venv/lib64/python3.6/site-packages/pyarrow/array.pxi in pyarrow.lib._handle_arrow_array_protocol() /sfs/MNBVC/venv/lib64/python3.6/site-packages/datasets/arrow_writer.py in __arrow_array__(self, type) 180 else: 181 trying_cast_to_python_objects = True --> 182 out = pa.array(cast_to_python_objects(data, only_1d_for_numpy=True)) 183 # use smaller integer precisions if possible 184 if self.trying_int_optimization: /sfs/MNBVC/venv/lib64/python3.6/site-packages/pyarrow/array.pxi in pyarrow.lib.array() /sfs/MNBVC/venv/lib64/python3.6/site-packages/pyarrow/array.pxi in pyarrow.lib._sequence_to_array() /sfs/MNBVC/venv/lib64/python3.6/site-packages/pyarrow/error.pxi in pyarrow.lib.pyarrow_internal_check_status() OverflowError: Python int too large to convert to C long ``` However, that dataset can be loaded in a streaming manner: ```python from datasets import load_dataset dataset = load_dataset("liwu/MNBVC", 'news_peoples_daily', split='train', streaming=True) for i in dataset: pass # it work well ``` Another issue is reported in our dataset hub: https://huggingface.co/datasets/liwu/MNBVC/discussions/2 ### Steps to reproduce the bug from datasets import load_dataset dataset = load_dataset("liwu/MNBVC", 'news_peoples_daily', split='train') ### Expected behavior the dataset can be safely loaded ### Environment info - `datasets` version: 2.4.0 - Platform: Linux-3.10.0-1160.an7.x86_64-x86_64-with-centos-7.9 - Python version: 3.6.8 - PyArrow version: 6.0.1 - Pandas version: 1.1.5
75
Get an error "OverflowError: Python int too large to convert to C long" when loading a large dataset ### Describe the bug When load a large dataset with the following code ```python from datasets import load_dataset dataset = load_dataset("liwu/MNBVC", 'news_peoples_daily', split='train') ``` We encountered the error: "OverflowError: Python int too large to convert to C long" The error look something like: ``` OverflowError: Python int too large to convert to C long During handling of the above exception, another exception occurred: OverflowError Traceback (most recent call last) <ipython-input-7-0ed8700e662d> in <module> ----> 1 dataset = load_dataset("liwu/MNBVC", 'news_peoples_daily', split='train', cache_dir='/sfs/MNBVC/.cache/') /sfs/MNBVC/venv/lib64/python3.6/site-packages/datasets/load.py in load_dataset(path, name, data_dir, data_files, split, cache_dir, features, download_config, download_mode, ignore_verifications, keep_in_memory, save_infos, revision, use_auth_token, task, streaming, **config_kwargs) 1749 ignore_verifications=ignore_verifications, 1750 try_from_hf_gcs=try_from_hf_gcs, -> 1751 use_auth_token=use_auth_token, 1752 ) 1753 /sfs/MNBVC/venv/lib64/python3.6/site-packages/datasets/builder.py in download_and_prepare(self, download_config, download_mode, ignore_verifications, try_from_hf_gcs, dl_manager, base_path, use_auth_token, **download_and_prepare_kwargs) 703 if not downloaded_from_gcs: 704 self._download_and_prepare( --> 705 dl_manager=dl_manager, verify_infos=verify_infos, **download_and_prepare_kwargs 706 ) 707 # Sync info /sfs/MNBVC/venv/lib64/python3.6/site-packages/datasets/builder.py in _download_and_prepare(self, dl_manager, verify_infos) 1225 1226 def _download_and_prepare(self, dl_manager, verify_infos): -> 1227 super()._download_and_prepare(dl_manager, verify_infos, check_duplicate_keys=verify_infos) 1228 1229 def _get_examples_iterable_for_split(self, split_generator: SplitGenerator) -> ExamplesIterable: /sfs/MNBVC/venv/lib64/python3.6/site-packages/datasets/builder.py in _download_and_prepare(self, dl_manager, verify_infos, **prepare_split_kwargs) 791 try: 792 # Prepare split will record examples associated to the split --> 793 self._prepare_split(split_generator, **prepare_split_kwargs) 794 except OSError as e: 795 raise OSError( /sfs/MNBVC/venv/lib64/python3.6/site-packages/datasets/builder.py in _prepare_split(self, split_generator, check_duplicate_keys) 1219 writer.write(example, key) 1220 finally: -> 1221 num_examples, num_bytes = writer.finalize() 1222 1223 split_generator.split_info.num_examples = num_examples /sfs/MNBVC/venv/lib64/python3.6/site-packages/datasets/arrow_writer.py in finalize(self, close_stream) 536 # Re-intializing to empty list for next batch 537 self.hkey_record = [] --> 538 self.write_examples_on_file() 539 if self.pa_writer is None: 540 if self.schema: /sfs/MNBVC/venv/lib64/python3.6/site-packages/datasets/arrow_writer.py in write_examples_on_file(self) 407 # Since current_examples contains (example, key) tuples 408 batch_examples[col] = [row[0][col] for row in self.current_examples] --> 409 self.write_batch(batch_examples=batch_examples) 410 self.current_examples = [] 411 /sfs/MNBVC/venv/lib64/python3.6/site-packages/datasets/arrow_writer.py in write_batch(self, batch_examples, writer_batch_size) 506 col_try_type = try_features[col] if try_features is not None and col in try_features else None 507 typed_sequence = OptimizedTypedSequence(batch_examples[col], type=col_type, try_type=col_try_type, col=col) --> 508 arrays.append(pa.array(typed_sequence)) 509 inferred_features[col] = typed_sequence.get_inferred_type() 510 schema = inferred_features.arrow_schema if self.pa_writer is None else self.schema /sfs/MNBVC/venv/lib64/python3.6/site-packages/pyarrow/array.pxi in pyarrow.lib.array() /sfs/MNBVC/venv/lib64/python3.6/site-packages/pyarrow/array.pxi in pyarrow.lib._handle_arrow_array_protocol() /sfs/MNBVC/venv/lib64/python3.6/site-packages/datasets/arrow_writer.py in __arrow_array__(self, type) 180 else: 181 trying_cast_to_python_objects = True --> 182 out = pa.array(cast_to_python_objects(data, only_1d_for_numpy=True)) 183 # use smaller integer precisions if possible 184 if self.trying_int_optimization: /sfs/MNBVC/venv/lib64/python3.6/site-packages/pyarrow/array.pxi in pyarrow.lib.array() /sfs/MNBVC/venv/lib64/python3.6/site-packages/pyarrow/array.pxi in pyarrow.lib._sequence_to_array() /sfs/MNBVC/venv/lib64/python3.6/site-packages/pyarrow/error.pxi in pyarrow.lib.pyarrow_internal_check_status() OverflowError: Python int too large to convert to C long ``` However, that dataset can be loaded in a streaming manner: ```python from datasets import load_dataset dataset = load_dataset("liwu/MNBVC", 'news_peoples_daily', split='train', streaming=True) for i in dataset: pass # it work well ``` Another issue is reported in our dataset hub: https://huggingface.co/datasets/liwu/MNBVC/discussions/2 ### Steps to reproduce the bug from datasets import load_dataset dataset = load_dataset("liwu/MNBVC", 'news_peoples_daily', split='train') ### Expected behavior the dataset can be safely loaded ### Environment info - `datasets` version: 2.4.0 - Platform: Linux-3.10.0-1160.an7.x86_64-x86_64-with-centos-7.9 - Python version: 3.6.8 - PyArrow version: 6.0.1 - Pandas version: 1.1.5 `simhash` is the problematic column - it has values such as `18329103420363166823` that are out of the int64 range. You can fix this by setting the feature type to `Value("string")` (it's advised to use this type for hash values in general) > Besides, it works fine when I am using streamed dataset. Streaming yields Python dictionaries from the script without converting them to the Arrow representation, as this conversion step is not that cheap performance-wise.
[ -0.42730045318603516, -0.3950994908809662, -0.02665611356496811, 0.3553202748298645, 0.3509588837623596, -0.004374183714389801, 0.10522277653217316, 0.331129789352417, 0.31195196509361267, 0.1922844648361206, -0.027331490069627762, 0.16219580173492432, -0.11134413629770279, 0.08958712965250015, -0.2046218365430832, -0.1775018572807312, 0.1220521628856659, -0.17765238881111145, -0.25584712624549866, 0.18601104617118835, -0.3780885636806488, -0.07006936520338058, -0.17661845684051514, 0.048064276576042175, -0.23183873295783997, -0.21604019403457642, 0.12426722049713135, 0.36674559116363525, -0.2756235599517822, -0.3445779085159302, 0.0034113675355911255, -0.3893600404262543, 0.35168981552124023, 0.4516564607620239, -0.00011814466415671632, -0.18242916464805603, 0.11768415570259094, -0.042029090225696564, -0.32315704226493835, 0.09475971758365631, -0.039298251271247864, -0.5150787830352783, -0.006220826879143715, -0.45916715264320374, 0.16284555196762085, -0.05158706381917, -0.17475268244743347, -0.08125865459442139, 0.18807296454906464, 0.5761505961418152, 0.19275711476802826, 0.055086515843868256, 0.38476377725601196, 0.06680193543434143, 0.22039756178855896, -0.03740207850933075, -0.06243707239627838, 0.4031565189361572, 0.2108921855688095, 0.22969180345535278, -0.028704509139060974, -0.06308931857347488, -0.1489473581314087, -0.18602950870990753, 0.11887466907501221, -0.16871783137321472, 0.0570891909301281, -0.19999699294567108, 0.007225114852190018, -0.00796797126531601, 0.10818733274936676, -0.08280960470438004, -0.10172402858734131, -0.04120077192783356, 0.04498547315597534, -0.4488227963447571, -0.10353534668684006, 0.19530950486660004, 0.006717499345541, 0.08620800077915192, -0.18851512670516968, -0.2502252757549286, -0.2554998993873596, 0.2120245397090912, -0.32102394104003906, -0.11662086844444275, -0.14016851782798767, 0.21713149547576904, 0.21627303957939148, -0.18306414783000946, 0.017507245764136314, -0.024290628731250763, 0.03425518423318863, 0.18231849372386932, -0.3292953372001648, -0.1898389309644699, 0.003925345838069916, 0.10165248066186905, 0.2865700423717499, -0.04653023183345795, 0.06803923845291138, -0.018249500542879105, -0.11352144926786423, 0.14824597537517548, 0.18170928955078125, 0.1451261043548584, -0.6392795443534851, 0.4040762484073639, 0.3212814927101135, -0.02512778528034687, -0.1858256608247757, -0.08128379285335541, -0.04995885491371155, -0.306194007396698, 0.2521118223667145, 0.10100943595170975, 0.3818824291229248, -0.3228907883167267, -0.41205209493637085, 0.14715653657913208, -0.21592304110527039, 0.28504449129104614, 0.28412044048309326, 0.34671279788017273, -0.09875354915857315, 0.23286649584770203, 0.07463964074850082, 0.08334185183048248, -0.23511558771133423, -0.20238308608531952, -0.15069420635700226, 0.10457052290439606, -0.07249986380338669, -0.04433203488588333, 0.0936983972787857, -0.07169461250305176, 0.17004035413265228, 0.28497105836868286, 0.18396618962287903, -0.33783644437789917, 0.005977662280201912, -0.4781578481197357, 0.03976692631840706, 0.08606648445129395, -0.07800450921058655, -0.11582841724157333, 0.37072739005088806, 0.15519371628761292, -0.1194450706243515, 0.3418324589729309, -0.5060864686965942, -0.3711854815483093, -0.18037086725234985, 0.1869175285100937, 0.014307916164398193, -0.01662929356098175, -0.26676449179649353, -0.17007222771644592, 0.21955472230911255, -0.18516604602336884, 0.21145731210708618, -0.4256848096847534, 0.2160862684249878, -0.16842709481716156, -0.04905072972178459, 0.17450213432312012, -0.2994723916053772, 0.25893083214759827, -0.01978052407503128, 0.19197964668273926, 0.41219577193260193, 0.5086793899536133, -0.18264180421829224, -0.033356644213199615, -0.3783024847507477, -0.33097341656684875, 0.3757345378398895, -0.18065184354782104, -0.43467360734939575, 0.4298314154148102, -0.04181225225329399, -0.04125894606113434, -0.14741253852844238, 0.10902555286884308, 0.18719500303268433, -0.0816936120390892, 0.19337141513824463, 0.40117591619491577, -0.2251415252685547, 0.1918102353811264, -0.4496757984161377, -0.2674904465675354, 0.24783213436603546, 0.1967029720544815, 0.17562878131866455, -0.06670371443033218, 0.21777880191802979, -0.07312412559986115, 0.2588134706020355, -0.06310270726680756, -0.22276179492473602, 0.2580525279045105, 0.11467486619949341, 0.13091275095939636, -0.21843716502189636, -0.2864813506603241, 0.010846499353647232, -0.02313442900776863, -0.010160811245441437, -0.16320107877254486, 0.09471727907657623, -0.15478797256946564, -0.51869136095047, 0.23062573373317719, 0.07093244045972824, 0.3605084717273712, 0.04756245017051697, 0.018511291593313217, 0.16914500296115875, -0.06382670253515244, 0.1751853972673416, 0.45256394147872925, -0.434812992811203, 0.005193493328988552, -0.07389724254608154, 0.14947402477264404, -0.13532640039920807, -0.1558477133512497, 0.026621952652931213, 0.12149637192487717, 0.3321802616119385, -0.03791804984211922, -0.3654502332210541, 0.18011757731437683, -0.009776225313544273, -0.29486942291259766, -0.3651312291622162, -0.2157198041677475, 0.22062039375305176, -0.3945513963699341, 0.29898008704185486, 0.19280105829238892, 0.24524268507957458, -0.047357313334941864, 0.04771691560745239, 0.2859414219856262, -0.3086586892604828, 0.12132122367620468, 0.09259235858917236, -0.041770800948143005, 0.3189939856529236, -0.12412536144256592, 0.20322884619235992, 0.007417544722557068, 0.0014881305396556854, 0.19949939846992493, 0.15952810645103455, -0.05024313926696777, -0.2033296376466751, -0.13109645247459412, 0.6715540289878845, -0.06587813794612885, 0.10676909983158112, 0.2518104910850525, -0.20792314410209656, -0.03859367221593857, 0.06895805150270462, -0.21736617386341095, 0.5505901575088501, 0.3331361413002014, -0.08229184150695801, -0.06867225468158722, 0.014712135307490826, -0.09951192140579224, 0.2664300203323364, 0.16960284113883972, 0.32267507910728455, 0.15934407711029053, 0.4819996654987335, -0.04444257169961929, -0.20974647998809814, -0.27626344561576843, 0.04477187991142273, 0.26742932200431824, -0.3840709626674652, 0.38414156436920166, -0.0696205198764801, -0.2515539824962616, -0.17747272551059723, -0.2844955027103424, 0.004043798893690109, -0.33593153953552246, -0.33264684677124023, 0.4384606182575226, 0.01700320839881897, -0.07723640650510788, -0.22626927495002747, 0.062228694558143616, 0.3358646631240845, -0.27092087268829346, 0.17083531618118286, 0.05200768634676933, -0.2650725543498993, 0.011704675853252411, 0.4868507385253906, -0.2440004050731659, 0.3427879512310028, 0.12019755691289902, -0.1655244529247284, -0.03905197232961655, -0.20386990904808044, -0.1234484612941742, 0.0991927981376648, 0.16942739486694336, -0.030192866921424866, 0.3613826036453247, -0.21136347949504852, -0.16740255057811737, 0.010533466003835201, 0.04331997036933899, 0.0594557449221611, 0.1659039556980133, -0.10908263921737671, 0.1439702957868576, -0.03303379938006401, -0.2585492730140686, -0.44593361020088196, -0.5692219138145447, 0.10587580502033234, 0.059380244463682175, 0.13857056200504303, 0.25813671946525574, 0.1298876702785492, 0.2472284734249115, 0.34788572788238525, -0.11012277007102966, -0.3189486563205719, -0.13861893117427826, 0.35731738805770874, -0.17738893628120422, -0.19554027915000916, 0.1069212406873703, -0.024517707526683807, -0.047351155430078506, 0.14091236889362335, -0.4079741835594177, 0.1772587150335312, -0.42272523045539856, 0.46870070695877075, -0.4635942578315735, -0.04442131519317627, 0.1144370436668396, -0.21715916693210602, 0.010356130078434944, 0.12779727578163147, 0.09290255606174469, -0.12362018972635269, 0.14443951845169067, 0.49612289667129517, -0.25444239377975464, 0.44793447852134705, -0.16753025352954865, 0.5885943174362183, 0.17588989436626434, 0.05358100309967995, 0.3482431471347809, 0.021755538880825043, 0.01447666808962822, -0.21496406197547913, -0.37185582518577576, 0.06305868923664093, -0.22956803441047668, -0.1729588508605957, 0.06716443598270416, -0.08266009390354156, -0.07205028086900711, 0.12978999316692352, -0.2179080694913864, -0.05128931254148483, -0.2240113615989685, 0.20996160805225372, -0.09039054811000824, 0.17387999594211578, -0.14571210741996765, -0.09767287969589233, -0.2475629448890686, -0.23845559358596802, -0.1726536750793457, 0.17912964522838593, 0.018602490425109863, 0.04128723964095116, 0.10141374170780182, -0.16951853036880493, -0.2960941195487976, 0.2517765760421753, -0.02027714252471924, 0.3787272572517395, 0.003271874040365219, 0.03430300951004028, -0.09064504504203796, -0.09841862320899963, 0.4456343650817871, 0.28611254692077637, 0.07992543280124664, 0.09266795217990875, 0.17231769859790802, -0.4492839276790619, -0.076456218957901, -0.10963420569896698, 0.3906116783618927, 0.5413093566894531, 0.3065812587738037, -0.2116076648235321, 0.14862775802612305, 0.6596485376358032, 0.4045993685722351, -0.03348797559738159, -0.1579154133796692, -0.282257616519928, -0.38411980867385864, -0.29867851734161377, 0.24832361936569214, 0.2736555337905884, 0.27473756670951843, -0.2445584237575531, -0.28429844975471497, -0.2872462868690491, -0.0773293599486351, 0.020731396973133087, -0.10377262532711029, 0.2474452257156372, -0.2777171730995178, 0.1813603639602661, -0.43756192922592163, 0.23997774720191956, 0.24989573657512665, 0.5667697787284851, 0.07643535733222961, -0.4990854263305664, 0.1059616282582283, 0.120084747672081, 0.30827513337135315, 0.09950698167085648, -0.1307036429643631, 0.22553041577339172, -0.09968683868646622, 0.44804614782333374, -0.07788205146789551, 0.5246808528900146, -0.14827927947044373, 0.22094689309597015, -0.34291067719459534, -0.19213396310806274, 0.547170877456665, 0.1663152426481247, 0.19766582548618317, 0.3111850619316101, 0.026270408183336258, -0.3059810400009155, 0.3107355833053589, -0.16278767585754395, 0.8497914671897888, 0.06669555604457855, -0.06066598370671272, 0.38529133796691895, -0.03204647824168205, 0.2201925814151764, -0.00027794018387794495, 0.13152961432933807, -0.37022724747657776, -0.027098488062620163, 0.18778760731220245, -0.13702905178070068, 0.06583811342716217, -0.18384596705436707, -0.28570640087127686, 0.2849735617637634, -0.2500235438346863, -0.09471683204174042, -0.04896274954080582, 0.3314095735549927, -0.37765559554100037, 0.007667003199458122, -0.2876814603805542, 0.15929317474365234, -0.38668298721313477, -0.053935494273900986, -0.08390773087739944, 0.04848698154091835, -0.08806009590625763, -0.15772201120853424, -0.24220161139965057, 0.08613095432519913, -0.2848759591579437, 0.3731246590614319, -0.2572709918022156, -0.29216790199279785, 0.5167397260665894, -0.09814170002937317, 0.08122798800468445, 0.29140427708625793, -0.06481871753931046, 0.034971725195646286, -0.14759615063667297, -0.18979187309741974, 0.05812549218535423, 0.17811043560504913, 0.10609754920005798, -0.020049842074513435, -0.2854974865913391, 0.04728515446186066, -0.05922948196530342, -0.16250252723693848, 0.024472326040267944, 0.10543470829725266, 0.5009015798568726, -0.48849254846572876, -0.32759889960289, -0.24513548612594604, -0.09851664304733276, -0.2617266774177551, 0.11408805847167969, -0.06117524206638336, -0.13015489280223846, 0.2037440836429596, 0.22624093294143677, -0.4189797341823578, -0.10186879336833954, 0.17977853119373322, -0.0036855190992355347, -0.12414667755365372, 0.47180846333503723, 0.1788039356470108, -0.19214396178722382, -0.13290202617645264, 0.3621409833431244, -0.1984470933675766, -0.38313984870910645, 0.2497865855693817, -0.08816082775592804, 0.3134532570838928, 0.049364469945430756, 0.1648942530155182, 0.12852762639522552, -0.02610381692647934, -0.055564820766448975, -0.47899386286735535, -0.6197270750999451, 0.020489759743213654, -0.17898087203502655, 0.07164382934570312, 0.22576233744621277, 0.11449176073074341, -0.3802782893180847, 0.06096949428319931, -0.24993325769901276, 0.11757151782512665, -0.0940813273191452, 0.10025616735219955, 0.1581793874502182, -0.285672664642334, -0.1549951136112213, 0.08355088531970978, 0.14725881814956665, 0.3399650454521179, 0.20342303812503815, -0.22011911869049072, -0.18029530346393585, 0.12341981381177902, -0.006576646119356155, -0.3159588873386383, -0.08770573139190674, -0.28387194871902466, 0.037396859377622604, -0.03816695511341095, 0.10210222005844116, 0.11634885519742966, 0.07618573307991028, 0.02099715918302536, -0.24134309589862823, 0.0034297481179237366, -0.12185151129961014, 0.19924387335777283, 0.13464704155921936, 0.4082373380661011, 0.19386886060237885, 0.5115569829940796, 0.24224495887756348, -0.04629679024219513, -0.43919476866722107, -0.008643358945846558, 0.3187031149864197, 0.03648817911744118, 0.3426598310470581, -0.2697684168815613, 0.07568514347076416, 0.16929204761981964, -0.23282288014888763, 0.22913405299186707, -0.25543516874313354, -0.09877418726682663, 0.26777660846710205, 0.16084587574005127, -0.17872226238250732, 0.13948845863342285, 0.15855363011360168, -0.3148189187049866, -0.023261284455657005, 0.2851652204990387, -0.20909349620342255, -0.1405559629201889, -0.27613288164138794, -0.02294502966105938, 0.21735170483589172, 0.2729935050010681, 0.002375860931351781, 0.4859406054019928, -0.044278278946876526, -0.21067754924297333, 0.39080774784088135, 0.16114452481269836, 0.3288120925426483, 0.8358757495880127, -0.2156842052936554, 0.133271723985672, -0.2734277546405792, 0.04166405647993088, -0.014557689428329468, -0.3601619005203247, -0.033477526158094406, 0.28801143169403076, -0.2637088894844055, 0.27294921875, 0.020296543836593628, 0.20703613758087158, -0.26228877902030945, -0.07231521606445312, -0.173462375998497, 0.2326335906982422, -0.31068432331085205, 0.10655294358730316, 0.20396822690963745, 0.08397028595209122, -0.03519570454955101, 0.21060211956501007, -0.15057437121868134, -0.04050738364458084, 0.10409249365329742, 0.3406962752342224, -0.20162175595760345, -0.271628737449646, 0.2608352601528168, 0.4320448040962219, 0.08981703221797943, -0.4641041159629822, 0.12155914306640625, 0.2563055753707886, 0.00421489030122757, -0.1815425306558609, -0.11361978203058243, 0.5183136463165283, 0.27215591073036194, 0.020924024283885956, 0.03270827978849411, 0.056745365262031555, -0.14462020993232727, 0.12292782962322235, -0.24000754952430725, 0.147347554564476, 0.4070994257926941, 0.2802129089832306, 0.08324094861745834, -0.17698591947555542, -0.03167227283120155, 0.13094188272953033, -0.0826028436422348, -0.2602497339248657, 0.28847265243530273, 0.05318643897771835, -0.39021438360214233, -0.25396913290023804, 0.010516196489334106, -0.250701367855072, -0.06606036424636841, 0.4123232364654541, 0.07801241427659988, 0.2456803321838379, 0.16989725828170776, 0.04279639571905136, -0.2895328998565674, 0.4310108423233032, 0.25519415736198425, 0.2772292494773865, -0.5120605230331421, -0.11491222679615021, -0.3112878203392029, 0.11089342087507248, -0.36213916540145874, 0.03549609333276749, 0.199350968003273, 0.0729064792394638, -0.14432817697525024, 0.11744127422571182, 0.24190343916416168, 0.27480921149253845, 0.35398057103157043, 0.165370374917984, -0.14194153249263763, -0.4123852252960205, 0.07853980362415314, -0.12405794858932495, 0.003536362200975418, -0.5456081628799438, 0.2555713951587677, -0.206376850605011, 0.008678007870912552, -0.19115620851516724, 0.009041540324687958, 0.01849699392914772, -0.05934974551200867, 0.3211500644683838, 0.24234360456466675, 0.5917177200317383, -0.010546587407588959, -0.01108473353087902, 0.2435409426689148, -0.14336103200912476, -0.10123249143362045, 0.28801119327545166, 0.10816340148448944, 0.3745174705982208, -0.03582605719566345, -0.07707174122333527, -0.22778986394405365, 0.185454323887825, -0.020570972934365273, -0.5014035105705261, 0.042701348662376404, -0.20563317835330963, -0.12497760355472565, 0.08245635777711868, 0.06540284305810928, 0.2370987832546234, 0.010593399405479431, 0.27219390869140625, -0.13509312272071838, -0.1335953176021576, 0.3531579077243805, 0.08318223059177399, -0.37515121698379517, 0.006107374094426632, 0.5184326767921448, 0.09052176028490067, -0.11257920414209366, -0.4577998220920563, 0.13875994086265564, 0.39225977659225464, -0.04285239428281784, -0.18254472315311432, 0.3959064483642578, 0.029019055888056755, 0.09268586337566376, -0.060140062123537064, 0.5353975892066956, -0.03100498393177986, -0.18696334958076477, 0.1814294308423996, -0.15507301688194275 ]
https://github.com/huggingface/datasets/issues/6007
Get an error "OverflowError: Python int too large to convert to C long" when loading a large dataset
i am using uint64 for simhash uint64 ranges up to about 3.69E19. 18329103420363166823 is less than this value. moreover, our simhash algorithm use 64 bits. it should fit in uint64.
### Describe the bug When load a large dataset with the following code ```python from datasets import load_dataset dataset = load_dataset("liwu/MNBVC", 'news_peoples_daily', split='train') ``` We encountered the error: "OverflowError: Python int too large to convert to C long" The error look something like: ``` OverflowError: Python int too large to convert to C long During handling of the above exception, another exception occurred: OverflowError Traceback (most recent call last) <ipython-input-7-0ed8700e662d> in <module> ----> 1 dataset = load_dataset("liwu/MNBVC", 'news_peoples_daily', split='train', cache_dir='/sfs/MNBVC/.cache/') /sfs/MNBVC/venv/lib64/python3.6/site-packages/datasets/load.py in load_dataset(path, name, data_dir, data_files, split, cache_dir, features, download_config, download_mode, ignore_verifications, keep_in_memory, save_infos, revision, use_auth_token, task, streaming, **config_kwargs) 1749 ignore_verifications=ignore_verifications, 1750 try_from_hf_gcs=try_from_hf_gcs, -> 1751 use_auth_token=use_auth_token, 1752 ) 1753 /sfs/MNBVC/venv/lib64/python3.6/site-packages/datasets/builder.py in download_and_prepare(self, download_config, download_mode, ignore_verifications, try_from_hf_gcs, dl_manager, base_path, use_auth_token, **download_and_prepare_kwargs) 703 if not downloaded_from_gcs: 704 self._download_and_prepare( --> 705 dl_manager=dl_manager, verify_infos=verify_infos, **download_and_prepare_kwargs 706 ) 707 # Sync info /sfs/MNBVC/venv/lib64/python3.6/site-packages/datasets/builder.py in _download_and_prepare(self, dl_manager, verify_infos) 1225 1226 def _download_and_prepare(self, dl_manager, verify_infos): -> 1227 super()._download_and_prepare(dl_manager, verify_infos, check_duplicate_keys=verify_infos) 1228 1229 def _get_examples_iterable_for_split(self, split_generator: SplitGenerator) -> ExamplesIterable: /sfs/MNBVC/venv/lib64/python3.6/site-packages/datasets/builder.py in _download_and_prepare(self, dl_manager, verify_infos, **prepare_split_kwargs) 791 try: 792 # Prepare split will record examples associated to the split --> 793 self._prepare_split(split_generator, **prepare_split_kwargs) 794 except OSError as e: 795 raise OSError( /sfs/MNBVC/venv/lib64/python3.6/site-packages/datasets/builder.py in _prepare_split(self, split_generator, check_duplicate_keys) 1219 writer.write(example, key) 1220 finally: -> 1221 num_examples, num_bytes = writer.finalize() 1222 1223 split_generator.split_info.num_examples = num_examples /sfs/MNBVC/venv/lib64/python3.6/site-packages/datasets/arrow_writer.py in finalize(self, close_stream) 536 # Re-intializing to empty list for next batch 537 self.hkey_record = [] --> 538 self.write_examples_on_file() 539 if self.pa_writer is None: 540 if self.schema: /sfs/MNBVC/venv/lib64/python3.6/site-packages/datasets/arrow_writer.py in write_examples_on_file(self) 407 # Since current_examples contains (example, key) tuples 408 batch_examples[col] = [row[0][col] for row in self.current_examples] --> 409 self.write_batch(batch_examples=batch_examples) 410 self.current_examples = [] 411 /sfs/MNBVC/venv/lib64/python3.6/site-packages/datasets/arrow_writer.py in write_batch(self, batch_examples, writer_batch_size) 506 col_try_type = try_features[col] if try_features is not None and col in try_features else None 507 typed_sequence = OptimizedTypedSequence(batch_examples[col], type=col_type, try_type=col_try_type, col=col) --> 508 arrays.append(pa.array(typed_sequence)) 509 inferred_features[col] = typed_sequence.get_inferred_type() 510 schema = inferred_features.arrow_schema if self.pa_writer is None else self.schema /sfs/MNBVC/venv/lib64/python3.6/site-packages/pyarrow/array.pxi in pyarrow.lib.array() /sfs/MNBVC/venv/lib64/python3.6/site-packages/pyarrow/array.pxi in pyarrow.lib._handle_arrow_array_protocol() /sfs/MNBVC/venv/lib64/python3.6/site-packages/datasets/arrow_writer.py in __arrow_array__(self, type) 180 else: 181 trying_cast_to_python_objects = True --> 182 out = pa.array(cast_to_python_objects(data, only_1d_for_numpy=True)) 183 # use smaller integer precisions if possible 184 if self.trying_int_optimization: /sfs/MNBVC/venv/lib64/python3.6/site-packages/pyarrow/array.pxi in pyarrow.lib.array() /sfs/MNBVC/venv/lib64/python3.6/site-packages/pyarrow/array.pxi in pyarrow.lib._sequence_to_array() /sfs/MNBVC/venv/lib64/python3.6/site-packages/pyarrow/error.pxi in pyarrow.lib.pyarrow_internal_check_status() OverflowError: Python int too large to convert to C long ``` However, that dataset can be loaded in a streaming manner: ```python from datasets import load_dataset dataset = load_dataset("liwu/MNBVC", 'news_peoples_daily', split='train', streaming=True) for i in dataset: pass # it work well ``` Another issue is reported in our dataset hub: https://huggingface.co/datasets/liwu/MNBVC/discussions/2 ### Steps to reproduce the bug from datasets import load_dataset dataset = load_dataset("liwu/MNBVC", 'news_peoples_daily', split='train') ### Expected behavior the dataset can be safely loaded ### Environment info - `datasets` version: 2.4.0 - Platform: Linux-3.10.0-1160.an7.x86_64-x86_64-with-centos-7.9 - Python version: 3.6.8 - PyArrow version: 6.0.1 - Pandas version: 1.1.5
30
Get an error "OverflowError: Python int too large to convert to C long" when loading a large dataset ### Describe the bug When load a large dataset with the following code ```python from datasets import load_dataset dataset = load_dataset("liwu/MNBVC", 'news_peoples_daily', split='train') ``` We encountered the error: "OverflowError: Python int too large to convert to C long" The error look something like: ``` OverflowError: Python int too large to convert to C long During handling of the above exception, another exception occurred: OverflowError Traceback (most recent call last) <ipython-input-7-0ed8700e662d> in <module> ----> 1 dataset = load_dataset("liwu/MNBVC", 'news_peoples_daily', split='train', cache_dir='/sfs/MNBVC/.cache/') /sfs/MNBVC/venv/lib64/python3.6/site-packages/datasets/load.py in load_dataset(path, name, data_dir, data_files, split, cache_dir, features, download_config, download_mode, ignore_verifications, keep_in_memory, save_infos, revision, use_auth_token, task, streaming, **config_kwargs) 1749 ignore_verifications=ignore_verifications, 1750 try_from_hf_gcs=try_from_hf_gcs, -> 1751 use_auth_token=use_auth_token, 1752 ) 1753 /sfs/MNBVC/venv/lib64/python3.6/site-packages/datasets/builder.py in download_and_prepare(self, download_config, download_mode, ignore_verifications, try_from_hf_gcs, dl_manager, base_path, use_auth_token, **download_and_prepare_kwargs) 703 if not downloaded_from_gcs: 704 self._download_and_prepare( --> 705 dl_manager=dl_manager, verify_infos=verify_infos, **download_and_prepare_kwargs 706 ) 707 # Sync info /sfs/MNBVC/venv/lib64/python3.6/site-packages/datasets/builder.py in _download_and_prepare(self, dl_manager, verify_infos) 1225 1226 def _download_and_prepare(self, dl_manager, verify_infos): -> 1227 super()._download_and_prepare(dl_manager, verify_infos, check_duplicate_keys=verify_infos) 1228 1229 def _get_examples_iterable_for_split(self, split_generator: SplitGenerator) -> ExamplesIterable: /sfs/MNBVC/venv/lib64/python3.6/site-packages/datasets/builder.py in _download_and_prepare(self, dl_manager, verify_infos, **prepare_split_kwargs) 791 try: 792 # Prepare split will record examples associated to the split --> 793 self._prepare_split(split_generator, **prepare_split_kwargs) 794 except OSError as e: 795 raise OSError( /sfs/MNBVC/venv/lib64/python3.6/site-packages/datasets/builder.py in _prepare_split(self, split_generator, check_duplicate_keys) 1219 writer.write(example, key) 1220 finally: -> 1221 num_examples, num_bytes = writer.finalize() 1222 1223 split_generator.split_info.num_examples = num_examples /sfs/MNBVC/venv/lib64/python3.6/site-packages/datasets/arrow_writer.py in finalize(self, close_stream) 536 # Re-intializing to empty list for next batch 537 self.hkey_record = [] --> 538 self.write_examples_on_file() 539 if self.pa_writer is None: 540 if self.schema: /sfs/MNBVC/venv/lib64/python3.6/site-packages/datasets/arrow_writer.py in write_examples_on_file(self) 407 # Since current_examples contains (example, key) tuples 408 batch_examples[col] = [row[0][col] for row in self.current_examples] --> 409 self.write_batch(batch_examples=batch_examples) 410 self.current_examples = [] 411 /sfs/MNBVC/venv/lib64/python3.6/site-packages/datasets/arrow_writer.py in write_batch(self, batch_examples, writer_batch_size) 506 col_try_type = try_features[col] if try_features is not None and col in try_features else None 507 typed_sequence = OptimizedTypedSequence(batch_examples[col], type=col_type, try_type=col_try_type, col=col) --> 508 arrays.append(pa.array(typed_sequence)) 509 inferred_features[col] = typed_sequence.get_inferred_type() 510 schema = inferred_features.arrow_schema if self.pa_writer is None else self.schema /sfs/MNBVC/venv/lib64/python3.6/site-packages/pyarrow/array.pxi in pyarrow.lib.array() /sfs/MNBVC/venv/lib64/python3.6/site-packages/pyarrow/array.pxi in pyarrow.lib._handle_arrow_array_protocol() /sfs/MNBVC/venv/lib64/python3.6/site-packages/datasets/arrow_writer.py in __arrow_array__(self, type) 180 else: 181 trying_cast_to_python_objects = True --> 182 out = pa.array(cast_to_python_objects(data, only_1d_for_numpy=True)) 183 # use smaller integer precisions if possible 184 if self.trying_int_optimization: /sfs/MNBVC/venv/lib64/python3.6/site-packages/pyarrow/array.pxi in pyarrow.lib.array() /sfs/MNBVC/venv/lib64/python3.6/site-packages/pyarrow/array.pxi in pyarrow.lib._sequence_to_array() /sfs/MNBVC/venv/lib64/python3.6/site-packages/pyarrow/error.pxi in pyarrow.lib.pyarrow_internal_check_status() OverflowError: Python int too large to convert to C long ``` However, that dataset can be loaded in a streaming manner: ```python from datasets import load_dataset dataset = load_dataset("liwu/MNBVC", 'news_peoples_daily', split='train', streaming=True) for i in dataset: pass # it work well ``` Another issue is reported in our dataset hub: https://huggingface.co/datasets/liwu/MNBVC/discussions/2 ### Steps to reproduce the bug from datasets import load_dataset dataset = load_dataset("liwu/MNBVC", 'news_peoples_daily', split='train') ### Expected behavior the dataset can be safely loaded ### Environment info - `datasets` version: 2.4.0 - Platform: Linux-3.10.0-1160.an7.x86_64-x86_64-with-centos-7.9 - Python version: 3.6.8 - PyArrow version: 6.0.1 - Pandas version: 1.1.5 i am using uint64 for simhash uint64 ranges up to about 3.69E19. 18329103420363166823 is less than this value. moreover, our simhash algorithm use 64 bits. it should fit in uint64.
[ -0.42730045318603516, -0.3950994908809662, -0.02665611356496811, 0.3553202748298645, 0.3509588837623596, -0.004374183714389801, 0.10522277653217316, 0.331129789352417, 0.31195196509361267, 0.1922844648361206, -0.027331490069627762, 0.16219580173492432, -0.11134413629770279, 0.08958712965250015, -0.2046218365430832, -0.1775018572807312, 0.1220521628856659, -0.17765238881111145, -0.25584712624549866, 0.18601104617118835, -0.3780885636806488, -0.07006936520338058, -0.17661845684051514, 0.048064276576042175, -0.23183873295783997, -0.21604019403457642, 0.12426722049713135, 0.36674559116363525, -0.2756235599517822, -0.3445779085159302, 0.0034113675355911255, -0.3893600404262543, 0.35168981552124023, 0.4516564607620239, -0.00011814466415671632, -0.18242916464805603, 0.11768415570259094, -0.042029090225696564, -0.32315704226493835, 0.09475971758365631, -0.039298251271247864, -0.5150787830352783, -0.006220826879143715, -0.45916715264320374, 0.16284555196762085, -0.05158706381917, -0.17475268244743347, -0.08125865459442139, 0.18807296454906464, 0.5761505961418152, 0.19275711476802826, 0.055086515843868256, 0.38476377725601196, 0.06680193543434143, 0.22039756178855896, -0.03740207850933075, -0.06243707239627838, 0.4031565189361572, 0.2108921855688095, 0.22969180345535278, -0.028704509139060974, -0.06308931857347488, -0.1489473581314087, -0.18602950870990753, 0.11887466907501221, -0.16871783137321472, 0.0570891909301281, -0.19999699294567108, 0.007225114852190018, -0.00796797126531601, 0.10818733274936676, -0.08280960470438004, -0.10172402858734131, -0.04120077192783356, 0.04498547315597534, -0.4488227963447571, -0.10353534668684006, 0.19530950486660004, 0.006717499345541, 0.08620800077915192, -0.18851512670516968, -0.2502252757549286, -0.2554998993873596, 0.2120245397090912, -0.32102394104003906, -0.11662086844444275, -0.14016851782798767, 0.21713149547576904, 0.21627303957939148, -0.18306414783000946, 0.017507245764136314, -0.024290628731250763, 0.03425518423318863, 0.18231849372386932, -0.3292953372001648, -0.1898389309644699, 0.003925345838069916, 0.10165248066186905, 0.2865700423717499, -0.04653023183345795, 0.06803923845291138, -0.018249500542879105, -0.11352144926786423, 0.14824597537517548, 0.18170928955078125, 0.1451261043548584, -0.6392795443534851, 0.4040762484073639, 0.3212814927101135, -0.02512778528034687, -0.1858256608247757, -0.08128379285335541, -0.04995885491371155, -0.306194007396698, 0.2521118223667145, 0.10100943595170975, 0.3818824291229248, -0.3228907883167267, -0.41205209493637085, 0.14715653657913208, -0.21592304110527039, 0.28504449129104614, 0.28412044048309326, 0.34671279788017273, -0.09875354915857315, 0.23286649584770203, 0.07463964074850082, 0.08334185183048248, -0.23511558771133423, -0.20238308608531952, -0.15069420635700226, 0.10457052290439606, -0.07249986380338669, -0.04433203488588333, 0.0936983972787857, -0.07169461250305176, 0.17004035413265228, 0.28497105836868286, 0.18396618962287903, -0.33783644437789917, 0.005977662280201912, -0.4781578481197357, 0.03976692631840706, 0.08606648445129395, -0.07800450921058655, -0.11582841724157333, 0.37072739005088806, 0.15519371628761292, -0.1194450706243515, 0.3418324589729309, -0.5060864686965942, -0.3711854815483093, -0.18037086725234985, 0.1869175285100937, 0.014307916164398193, -0.01662929356098175, -0.26676449179649353, -0.17007222771644592, 0.21955472230911255, -0.18516604602336884, 0.21145731210708618, -0.4256848096847534, 0.2160862684249878, -0.16842709481716156, -0.04905072972178459, 0.17450213432312012, -0.2994723916053772, 0.25893083214759827, -0.01978052407503128, 0.19197964668273926, 0.41219577193260193, 0.5086793899536133, -0.18264180421829224, -0.033356644213199615, -0.3783024847507477, -0.33097341656684875, 0.3757345378398895, -0.18065184354782104, -0.43467360734939575, 0.4298314154148102, -0.04181225225329399, -0.04125894606113434, -0.14741253852844238, 0.10902555286884308, 0.18719500303268433, -0.0816936120390892, 0.19337141513824463, 0.40117591619491577, -0.2251415252685547, 0.1918102353811264, -0.4496757984161377, -0.2674904465675354, 0.24783213436603546, 0.1967029720544815, 0.17562878131866455, -0.06670371443033218, 0.21777880191802979, -0.07312412559986115, 0.2588134706020355, -0.06310270726680756, -0.22276179492473602, 0.2580525279045105, 0.11467486619949341, 0.13091275095939636, -0.21843716502189636, -0.2864813506603241, 0.010846499353647232, -0.02313442900776863, -0.010160811245441437, -0.16320107877254486, 0.09471727907657623, -0.15478797256946564, -0.51869136095047, 0.23062573373317719, 0.07093244045972824, 0.3605084717273712, 0.04756245017051697, 0.018511291593313217, 0.16914500296115875, -0.06382670253515244, 0.1751853972673416, 0.45256394147872925, -0.434812992811203, 0.005193493328988552, -0.07389724254608154, 0.14947402477264404, -0.13532640039920807, -0.1558477133512497, 0.026621952652931213, 0.12149637192487717, 0.3321802616119385, -0.03791804984211922, -0.3654502332210541, 0.18011757731437683, -0.009776225313544273, -0.29486942291259766, -0.3651312291622162, -0.2157198041677475, 0.22062039375305176, -0.3945513963699341, 0.29898008704185486, 0.19280105829238892, 0.24524268507957458, -0.047357313334941864, 0.04771691560745239, 0.2859414219856262, -0.3086586892604828, 0.12132122367620468, 0.09259235858917236, -0.041770800948143005, 0.3189939856529236, -0.12412536144256592, 0.20322884619235992, 0.007417544722557068, 0.0014881305396556854, 0.19949939846992493, 0.15952810645103455, -0.05024313926696777, -0.2033296376466751, -0.13109645247459412, 0.6715540289878845, -0.06587813794612885, 0.10676909983158112, 0.2518104910850525, -0.20792314410209656, -0.03859367221593857, 0.06895805150270462, -0.21736617386341095, 0.5505901575088501, 0.3331361413002014, -0.08229184150695801, -0.06867225468158722, 0.014712135307490826, -0.09951192140579224, 0.2664300203323364, 0.16960284113883972, 0.32267507910728455, 0.15934407711029053, 0.4819996654987335, -0.04444257169961929, -0.20974647998809814, -0.27626344561576843, 0.04477187991142273, 0.26742932200431824, -0.3840709626674652, 0.38414156436920166, -0.0696205198764801, -0.2515539824962616, -0.17747272551059723, -0.2844955027103424, 0.004043798893690109, -0.33593153953552246, -0.33264684677124023, 0.4384606182575226, 0.01700320839881897, -0.07723640650510788, -0.22626927495002747, 0.062228694558143616, 0.3358646631240845, -0.27092087268829346, 0.17083531618118286, 0.05200768634676933, -0.2650725543498993, 0.011704675853252411, 0.4868507385253906, -0.2440004050731659, 0.3427879512310028, 0.12019755691289902, -0.1655244529247284, -0.03905197232961655, -0.20386990904808044, -0.1234484612941742, 0.0991927981376648, 0.16942739486694336, -0.030192866921424866, 0.3613826036453247, -0.21136347949504852, -0.16740255057811737, 0.010533466003835201, 0.04331997036933899, 0.0594557449221611, 0.1659039556980133, -0.10908263921737671, 0.1439702957868576, -0.03303379938006401, -0.2585492730140686, -0.44593361020088196, -0.5692219138145447, 0.10587580502033234, 0.059380244463682175, 0.13857056200504303, 0.25813671946525574, 0.1298876702785492, 0.2472284734249115, 0.34788572788238525, -0.11012277007102966, -0.3189486563205719, -0.13861893117427826, 0.35731738805770874, -0.17738893628120422, -0.19554027915000916, 0.1069212406873703, -0.024517707526683807, -0.047351155430078506, 0.14091236889362335, -0.4079741835594177, 0.1772587150335312, -0.42272523045539856, 0.46870070695877075, -0.4635942578315735, -0.04442131519317627, 0.1144370436668396, -0.21715916693210602, 0.010356130078434944, 0.12779727578163147, 0.09290255606174469, -0.12362018972635269, 0.14443951845169067, 0.49612289667129517, -0.25444239377975464, 0.44793447852134705, -0.16753025352954865, 0.5885943174362183, 0.17588989436626434, 0.05358100309967995, 0.3482431471347809, 0.021755538880825043, 0.01447666808962822, -0.21496406197547913, -0.37185582518577576, 0.06305868923664093, -0.22956803441047668, -0.1729588508605957, 0.06716443598270416, -0.08266009390354156, -0.07205028086900711, 0.12978999316692352, -0.2179080694913864, -0.05128931254148483, -0.2240113615989685, 0.20996160805225372, -0.09039054811000824, 0.17387999594211578, -0.14571210741996765, -0.09767287969589233, -0.2475629448890686, -0.23845559358596802, -0.1726536750793457, 0.17912964522838593, 0.018602490425109863, 0.04128723964095116, 0.10141374170780182, -0.16951853036880493, -0.2960941195487976, 0.2517765760421753, -0.02027714252471924, 0.3787272572517395, 0.003271874040365219, 0.03430300951004028, -0.09064504504203796, -0.09841862320899963, 0.4456343650817871, 0.28611254692077637, 0.07992543280124664, 0.09266795217990875, 0.17231769859790802, -0.4492839276790619, -0.076456218957901, -0.10963420569896698, 0.3906116783618927, 0.5413093566894531, 0.3065812587738037, -0.2116076648235321, 0.14862775802612305, 0.6596485376358032, 0.4045993685722351, -0.03348797559738159, -0.1579154133796692, -0.282257616519928, -0.38411980867385864, -0.29867851734161377, 0.24832361936569214, 0.2736555337905884, 0.27473756670951843, -0.2445584237575531, -0.28429844975471497, -0.2872462868690491, -0.0773293599486351, 0.020731396973133087, -0.10377262532711029, 0.2474452257156372, -0.2777171730995178, 0.1813603639602661, -0.43756192922592163, 0.23997774720191956, 0.24989573657512665, 0.5667697787284851, 0.07643535733222961, -0.4990854263305664, 0.1059616282582283, 0.120084747672081, 0.30827513337135315, 0.09950698167085648, -0.1307036429643631, 0.22553041577339172, -0.09968683868646622, 0.44804614782333374, -0.07788205146789551, 0.5246808528900146, -0.14827927947044373, 0.22094689309597015, -0.34291067719459534, -0.19213396310806274, 0.547170877456665, 0.1663152426481247, 0.19766582548618317, 0.3111850619316101, 0.026270408183336258, -0.3059810400009155, 0.3107355833053589, -0.16278767585754395, 0.8497914671897888, 0.06669555604457855, -0.06066598370671272, 0.38529133796691895, -0.03204647824168205, 0.2201925814151764, -0.00027794018387794495, 0.13152961432933807, -0.37022724747657776, -0.027098488062620163, 0.18778760731220245, -0.13702905178070068, 0.06583811342716217, -0.18384596705436707, -0.28570640087127686, 0.2849735617637634, -0.2500235438346863, -0.09471683204174042, -0.04896274954080582, 0.3314095735549927, -0.37765559554100037, 0.007667003199458122, -0.2876814603805542, 0.15929317474365234, -0.38668298721313477, -0.053935494273900986, -0.08390773087739944, 0.04848698154091835, -0.08806009590625763, -0.15772201120853424, -0.24220161139965057, 0.08613095432519913, -0.2848759591579437, 0.3731246590614319, -0.2572709918022156, -0.29216790199279785, 0.5167397260665894, -0.09814170002937317, 0.08122798800468445, 0.29140427708625793, -0.06481871753931046, 0.034971725195646286, -0.14759615063667297, -0.18979187309741974, 0.05812549218535423, 0.17811043560504913, 0.10609754920005798, -0.020049842074513435, -0.2854974865913391, 0.04728515446186066, -0.05922948196530342, -0.16250252723693848, 0.024472326040267944, 0.10543470829725266, 0.5009015798568726, -0.48849254846572876, -0.32759889960289, -0.24513548612594604, -0.09851664304733276, -0.2617266774177551, 0.11408805847167969, -0.06117524206638336, -0.13015489280223846, 0.2037440836429596, 0.22624093294143677, -0.4189797341823578, -0.10186879336833954, 0.17977853119373322, -0.0036855190992355347, -0.12414667755365372, 0.47180846333503723, 0.1788039356470108, -0.19214396178722382, -0.13290202617645264, 0.3621409833431244, -0.1984470933675766, -0.38313984870910645, 0.2497865855693817, -0.08816082775592804, 0.3134532570838928, 0.049364469945430756, 0.1648942530155182, 0.12852762639522552, -0.02610381692647934, -0.055564820766448975, -0.47899386286735535, -0.6197270750999451, 0.020489759743213654, -0.17898087203502655, 0.07164382934570312, 0.22576233744621277, 0.11449176073074341, -0.3802782893180847, 0.06096949428319931, -0.24993325769901276, 0.11757151782512665, -0.0940813273191452, 0.10025616735219955, 0.1581793874502182, -0.285672664642334, -0.1549951136112213, 0.08355088531970978, 0.14725881814956665, 0.3399650454521179, 0.20342303812503815, -0.22011911869049072, -0.18029530346393585, 0.12341981381177902, -0.006576646119356155, -0.3159588873386383, -0.08770573139190674, -0.28387194871902466, 0.037396859377622604, -0.03816695511341095, 0.10210222005844116, 0.11634885519742966, 0.07618573307991028, 0.02099715918302536, -0.24134309589862823, 0.0034297481179237366, -0.12185151129961014, 0.19924387335777283, 0.13464704155921936, 0.4082373380661011, 0.19386886060237885, 0.5115569829940796, 0.24224495887756348, -0.04629679024219513, -0.43919476866722107, -0.008643358945846558, 0.3187031149864197, 0.03648817911744118, 0.3426598310470581, -0.2697684168815613, 0.07568514347076416, 0.16929204761981964, -0.23282288014888763, 0.22913405299186707, -0.25543516874313354, -0.09877418726682663, 0.26777660846710205, 0.16084587574005127, -0.17872226238250732, 0.13948845863342285, 0.15855363011360168, -0.3148189187049866, -0.023261284455657005, 0.2851652204990387, -0.20909349620342255, -0.1405559629201889, -0.27613288164138794, -0.02294502966105938, 0.21735170483589172, 0.2729935050010681, 0.002375860931351781, 0.4859406054019928, -0.044278278946876526, -0.21067754924297333, 0.39080774784088135, 0.16114452481269836, 0.3288120925426483, 0.8358757495880127, -0.2156842052936554, 0.133271723985672, -0.2734277546405792, 0.04166405647993088, -0.014557689428329468, -0.3601619005203247, -0.033477526158094406, 0.28801143169403076, -0.2637088894844055, 0.27294921875, 0.020296543836593628, 0.20703613758087158, -0.26228877902030945, -0.07231521606445312, -0.173462375998497, 0.2326335906982422, -0.31068432331085205, 0.10655294358730316, 0.20396822690963745, 0.08397028595209122, -0.03519570454955101, 0.21060211956501007, -0.15057437121868134, -0.04050738364458084, 0.10409249365329742, 0.3406962752342224, -0.20162175595760345, -0.271628737449646, 0.2608352601528168, 0.4320448040962219, 0.08981703221797943, -0.4641041159629822, 0.12155914306640625, 0.2563055753707886, 0.00421489030122757, -0.1815425306558609, -0.11361978203058243, 0.5183136463165283, 0.27215591073036194, 0.020924024283885956, 0.03270827978849411, 0.056745365262031555, -0.14462020993232727, 0.12292782962322235, -0.24000754952430725, 0.147347554564476, 0.4070994257926941, 0.2802129089832306, 0.08324094861745834, -0.17698591947555542, -0.03167227283120155, 0.13094188272953033, -0.0826028436422348, -0.2602497339248657, 0.28847265243530273, 0.05318643897771835, -0.39021438360214233, -0.25396913290023804, 0.010516196489334106, -0.250701367855072, -0.06606036424636841, 0.4123232364654541, 0.07801241427659988, 0.2456803321838379, 0.16989725828170776, 0.04279639571905136, -0.2895328998565674, 0.4310108423233032, 0.25519415736198425, 0.2772292494773865, -0.5120605230331421, -0.11491222679615021, -0.3112878203392029, 0.11089342087507248, -0.36213916540145874, 0.03549609333276749, 0.199350968003273, 0.0729064792394638, -0.14432817697525024, 0.11744127422571182, 0.24190343916416168, 0.27480921149253845, 0.35398057103157043, 0.165370374917984, -0.14194153249263763, -0.4123852252960205, 0.07853980362415314, -0.12405794858932495, 0.003536362200975418, -0.5456081628799438, 0.2555713951587677, -0.206376850605011, 0.008678007870912552, -0.19115620851516724, 0.009041540324687958, 0.01849699392914772, -0.05934974551200867, 0.3211500644683838, 0.24234360456466675, 0.5917177200317383, -0.010546587407588959, -0.01108473353087902, 0.2435409426689148, -0.14336103200912476, -0.10123249143362045, 0.28801119327545166, 0.10816340148448944, 0.3745174705982208, -0.03582605719566345, -0.07707174122333527, -0.22778986394405365, 0.185454323887825, -0.020570972934365273, -0.5014035105705261, 0.042701348662376404, -0.20563317835330963, -0.12497760355472565, 0.08245635777711868, 0.06540284305810928, 0.2370987832546234, 0.010593399405479431, 0.27219390869140625, -0.13509312272071838, -0.1335953176021576, 0.3531579077243805, 0.08318223059177399, -0.37515121698379517, 0.006107374094426632, 0.5184326767921448, 0.09052176028490067, -0.11257920414209366, -0.4577998220920563, 0.13875994086265564, 0.39225977659225464, -0.04285239428281784, -0.18254472315311432, 0.3959064483642578, 0.029019055888056755, 0.09268586337566376, -0.060140062123537064, 0.5353975892066956, -0.03100498393177986, -0.18696334958076477, 0.1814294308423996, -0.15507301688194275 ]
https://github.com/huggingface/datasets/issues/6007
Get an error "OverflowError: Python int too large to convert to C long" when loading a large dataset
You are right. I overlooked the feature type. This is a reproducer: ```python import pyarrow as pa from datasets.arrow_writer import TypedSequence pa.array(TypedSequence([18329103420363166823], type=Value("uint64"))) ``` `pa.array([18329103420363166823])` also fails with the same error, so it seems PyArrow does not always infer the correct type as NumPy does (`uint64` in this case). I'll report this issue in the Arrow repo. `pa.array([18329103420363166823], pa.uint64)` works, so maybe we can implement a temporary fix (supporting complex input such as `[{"image": pil_image, "num": uint64_value}]` would be hard though). In the meantime, you should be able to bypass this error by returning the `simhash` values as NumPy scalars in the script: ```python def _generate_examples(self, ...): ... yield {..., "simhash": np.uint64(simhash), ...} ```
### Describe the bug When load a large dataset with the following code ```python from datasets import load_dataset dataset = load_dataset("liwu/MNBVC", 'news_peoples_daily', split='train') ``` We encountered the error: "OverflowError: Python int too large to convert to C long" The error look something like: ``` OverflowError: Python int too large to convert to C long During handling of the above exception, another exception occurred: OverflowError Traceback (most recent call last) <ipython-input-7-0ed8700e662d> in <module> ----> 1 dataset = load_dataset("liwu/MNBVC", 'news_peoples_daily', split='train', cache_dir='/sfs/MNBVC/.cache/') /sfs/MNBVC/venv/lib64/python3.6/site-packages/datasets/load.py in load_dataset(path, name, data_dir, data_files, split, cache_dir, features, download_config, download_mode, ignore_verifications, keep_in_memory, save_infos, revision, use_auth_token, task, streaming, **config_kwargs) 1749 ignore_verifications=ignore_verifications, 1750 try_from_hf_gcs=try_from_hf_gcs, -> 1751 use_auth_token=use_auth_token, 1752 ) 1753 /sfs/MNBVC/venv/lib64/python3.6/site-packages/datasets/builder.py in download_and_prepare(self, download_config, download_mode, ignore_verifications, try_from_hf_gcs, dl_manager, base_path, use_auth_token, **download_and_prepare_kwargs) 703 if not downloaded_from_gcs: 704 self._download_and_prepare( --> 705 dl_manager=dl_manager, verify_infos=verify_infos, **download_and_prepare_kwargs 706 ) 707 # Sync info /sfs/MNBVC/venv/lib64/python3.6/site-packages/datasets/builder.py in _download_and_prepare(self, dl_manager, verify_infos) 1225 1226 def _download_and_prepare(self, dl_manager, verify_infos): -> 1227 super()._download_and_prepare(dl_manager, verify_infos, check_duplicate_keys=verify_infos) 1228 1229 def _get_examples_iterable_for_split(self, split_generator: SplitGenerator) -> ExamplesIterable: /sfs/MNBVC/venv/lib64/python3.6/site-packages/datasets/builder.py in _download_and_prepare(self, dl_manager, verify_infos, **prepare_split_kwargs) 791 try: 792 # Prepare split will record examples associated to the split --> 793 self._prepare_split(split_generator, **prepare_split_kwargs) 794 except OSError as e: 795 raise OSError( /sfs/MNBVC/venv/lib64/python3.6/site-packages/datasets/builder.py in _prepare_split(self, split_generator, check_duplicate_keys) 1219 writer.write(example, key) 1220 finally: -> 1221 num_examples, num_bytes = writer.finalize() 1222 1223 split_generator.split_info.num_examples = num_examples /sfs/MNBVC/venv/lib64/python3.6/site-packages/datasets/arrow_writer.py in finalize(self, close_stream) 536 # Re-intializing to empty list for next batch 537 self.hkey_record = [] --> 538 self.write_examples_on_file() 539 if self.pa_writer is None: 540 if self.schema: /sfs/MNBVC/venv/lib64/python3.6/site-packages/datasets/arrow_writer.py in write_examples_on_file(self) 407 # Since current_examples contains (example, key) tuples 408 batch_examples[col] = [row[0][col] for row in self.current_examples] --> 409 self.write_batch(batch_examples=batch_examples) 410 self.current_examples = [] 411 /sfs/MNBVC/venv/lib64/python3.6/site-packages/datasets/arrow_writer.py in write_batch(self, batch_examples, writer_batch_size) 506 col_try_type = try_features[col] if try_features is not None and col in try_features else None 507 typed_sequence = OptimizedTypedSequence(batch_examples[col], type=col_type, try_type=col_try_type, col=col) --> 508 arrays.append(pa.array(typed_sequence)) 509 inferred_features[col] = typed_sequence.get_inferred_type() 510 schema = inferred_features.arrow_schema if self.pa_writer is None else self.schema /sfs/MNBVC/venv/lib64/python3.6/site-packages/pyarrow/array.pxi in pyarrow.lib.array() /sfs/MNBVC/venv/lib64/python3.6/site-packages/pyarrow/array.pxi in pyarrow.lib._handle_arrow_array_protocol() /sfs/MNBVC/venv/lib64/python3.6/site-packages/datasets/arrow_writer.py in __arrow_array__(self, type) 180 else: 181 trying_cast_to_python_objects = True --> 182 out = pa.array(cast_to_python_objects(data, only_1d_for_numpy=True)) 183 # use smaller integer precisions if possible 184 if self.trying_int_optimization: /sfs/MNBVC/venv/lib64/python3.6/site-packages/pyarrow/array.pxi in pyarrow.lib.array() /sfs/MNBVC/venv/lib64/python3.6/site-packages/pyarrow/array.pxi in pyarrow.lib._sequence_to_array() /sfs/MNBVC/venv/lib64/python3.6/site-packages/pyarrow/error.pxi in pyarrow.lib.pyarrow_internal_check_status() OverflowError: Python int too large to convert to C long ``` However, that dataset can be loaded in a streaming manner: ```python from datasets import load_dataset dataset = load_dataset("liwu/MNBVC", 'news_peoples_daily', split='train', streaming=True) for i in dataset: pass # it work well ``` Another issue is reported in our dataset hub: https://huggingface.co/datasets/liwu/MNBVC/discussions/2 ### Steps to reproduce the bug from datasets import load_dataset dataset = load_dataset("liwu/MNBVC", 'news_peoples_daily', split='train') ### Expected behavior the dataset can be safely loaded ### Environment info - `datasets` version: 2.4.0 - Platform: Linux-3.10.0-1160.an7.x86_64-x86_64-with-centos-7.9 - Python version: 3.6.8 - PyArrow version: 6.0.1 - Pandas version: 1.1.5
114
Get an error "OverflowError: Python int too large to convert to C long" when loading a large dataset ### Describe the bug When load a large dataset with the following code ```python from datasets import load_dataset dataset = load_dataset("liwu/MNBVC", 'news_peoples_daily', split='train') ``` We encountered the error: "OverflowError: Python int too large to convert to C long" The error look something like: ``` OverflowError: Python int too large to convert to C long During handling of the above exception, another exception occurred: OverflowError Traceback (most recent call last) <ipython-input-7-0ed8700e662d> in <module> ----> 1 dataset = load_dataset("liwu/MNBVC", 'news_peoples_daily', split='train', cache_dir='/sfs/MNBVC/.cache/') /sfs/MNBVC/venv/lib64/python3.6/site-packages/datasets/load.py in load_dataset(path, name, data_dir, data_files, split, cache_dir, features, download_config, download_mode, ignore_verifications, keep_in_memory, save_infos, revision, use_auth_token, task, streaming, **config_kwargs) 1749 ignore_verifications=ignore_verifications, 1750 try_from_hf_gcs=try_from_hf_gcs, -> 1751 use_auth_token=use_auth_token, 1752 ) 1753 /sfs/MNBVC/venv/lib64/python3.6/site-packages/datasets/builder.py in download_and_prepare(self, download_config, download_mode, ignore_verifications, try_from_hf_gcs, dl_manager, base_path, use_auth_token, **download_and_prepare_kwargs) 703 if not downloaded_from_gcs: 704 self._download_and_prepare( --> 705 dl_manager=dl_manager, verify_infos=verify_infos, **download_and_prepare_kwargs 706 ) 707 # Sync info /sfs/MNBVC/venv/lib64/python3.6/site-packages/datasets/builder.py in _download_and_prepare(self, dl_manager, verify_infos) 1225 1226 def _download_and_prepare(self, dl_manager, verify_infos): -> 1227 super()._download_and_prepare(dl_manager, verify_infos, check_duplicate_keys=verify_infos) 1228 1229 def _get_examples_iterable_for_split(self, split_generator: SplitGenerator) -> ExamplesIterable: /sfs/MNBVC/venv/lib64/python3.6/site-packages/datasets/builder.py in _download_and_prepare(self, dl_manager, verify_infos, **prepare_split_kwargs) 791 try: 792 # Prepare split will record examples associated to the split --> 793 self._prepare_split(split_generator, **prepare_split_kwargs) 794 except OSError as e: 795 raise OSError( /sfs/MNBVC/venv/lib64/python3.6/site-packages/datasets/builder.py in _prepare_split(self, split_generator, check_duplicate_keys) 1219 writer.write(example, key) 1220 finally: -> 1221 num_examples, num_bytes = writer.finalize() 1222 1223 split_generator.split_info.num_examples = num_examples /sfs/MNBVC/venv/lib64/python3.6/site-packages/datasets/arrow_writer.py in finalize(self, close_stream) 536 # Re-intializing to empty list for next batch 537 self.hkey_record = [] --> 538 self.write_examples_on_file() 539 if self.pa_writer is None: 540 if self.schema: /sfs/MNBVC/venv/lib64/python3.6/site-packages/datasets/arrow_writer.py in write_examples_on_file(self) 407 # Since current_examples contains (example, key) tuples 408 batch_examples[col] = [row[0][col] for row in self.current_examples] --> 409 self.write_batch(batch_examples=batch_examples) 410 self.current_examples = [] 411 /sfs/MNBVC/venv/lib64/python3.6/site-packages/datasets/arrow_writer.py in write_batch(self, batch_examples, writer_batch_size) 506 col_try_type = try_features[col] if try_features is not None and col in try_features else None 507 typed_sequence = OptimizedTypedSequence(batch_examples[col], type=col_type, try_type=col_try_type, col=col) --> 508 arrays.append(pa.array(typed_sequence)) 509 inferred_features[col] = typed_sequence.get_inferred_type() 510 schema = inferred_features.arrow_schema if self.pa_writer is None else self.schema /sfs/MNBVC/venv/lib64/python3.6/site-packages/pyarrow/array.pxi in pyarrow.lib.array() /sfs/MNBVC/venv/lib64/python3.6/site-packages/pyarrow/array.pxi in pyarrow.lib._handle_arrow_array_protocol() /sfs/MNBVC/venv/lib64/python3.6/site-packages/datasets/arrow_writer.py in __arrow_array__(self, type) 180 else: 181 trying_cast_to_python_objects = True --> 182 out = pa.array(cast_to_python_objects(data, only_1d_for_numpy=True)) 183 # use smaller integer precisions if possible 184 if self.trying_int_optimization: /sfs/MNBVC/venv/lib64/python3.6/site-packages/pyarrow/array.pxi in pyarrow.lib.array() /sfs/MNBVC/venv/lib64/python3.6/site-packages/pyarrow/array.pxi in pyarrow.lib._sequence_to_array() /sfs/MNBVC/venv/lib64/python3.6/site-packages/pyarrow/error.pxi in pyarrow.lib.pyarrow_internal_check_status() OverflowError: Python int too large to convert to C long ``` However, that dataset can be loaded in a streaming manner: ```python from datasets import load_dataset dataset = load_dataset("liwu/MNBVC", 'news_peoples_daily', split='train', streaming=True) for i in dataset: pass # it work well ``` Another issue is reported in our dataset hub: https://huggingface.co/datasets/liwu/MNBVC/discussions/2 ### Steps to reproduce the bug from datasets import load_dataset dataset = load_dataset("liwu/MNBVC", 'news_peoples_daily', split='train') ### Expected behavior the dataset can be safely loaded ### Environment info - `datasets` version: 2.4.0 - Platform: Linux-3.10.0-1160.an7.x86_64-x86_64-with-centos-7.9 - Python version: 3.6.8 - PyArrow version: 6.0.1 - Pandas version: 1.1.5 You are right. I overlooked the feature type. This is a reproducer: ```python import pyarrow as pa from datasets.arrow_writer import TypedSequence pa.array(TypedSequence([18329103420363166823], type=Value("uint64"))) ``` `pa.array([18329103420363166823])` also fails with the same error, so it seems PyArrow does not always infer the correct type as NumPy does (`uint64` in this case). I'll report this issue in the Arrow repo. `pa.array([18329103420363166823], pa.uint64)` works, so maybe we can implement a temporary fix (supporting complex input such as `[{"image": pil_image, "num": uint64_value}]` would be hard though). In the meantime, you should be able to bypass this error by returning the `simhash` values as NumPy scalars in the script: ```python def _generate_examples(self, ...): ... yield {..., "simhash": np.uint64(simhash), ...} ```
[ -0.42730045318603516, -0.3950994908809662, -0.02665611356496811, 0.3553202748298645, 0.3509588837623596, -0.004374183714389801, 0.10522277653217316, 0.331129789352417, 0.31195196509361267, 0.1922844648361206, -0.027331490069627762, 0.16219580173492432, -0.11134413629770279, 0.08958712965250015, -0.2046218365430832, -0.1775018572807312, 0.1220521628856659, -0.17765238881111145, -0.25584712624549866, 0.18601104617118835, -0.3780885636806488, -0.07006936520338058, -0.17661845684051514, 0.048064276576042175, -0.23183873295783997, -0.21604019403457642, 0.12426722049713135, 0.36674559116363525, -0.2756235599517822, -0.3445779085159302, 0.0034113675355911255, -0.3893600404262543, 0.35168981552124023, 0.4516564607620239, -0.00011814466415671632, -0.18242916464805603, 0.11768415570259094, -0.042029090225696564, -0.32315704226493835, 0.09475971758365631, -0.039298251271247864, -0.5150787830352783, -0.006220826879143715, -0.45916715264320374, 0.16284555196762085, -0.05158706381917, -0.17475268244743347, -0.08125865459442139, 0.18807296454906464, 0.5761505961418152, 0.19275711476802826, 0.055086515843868256, 0.38476377725601196, 0.06680193543434143, 0.22039756178855896, -0.03740207850933075, -0.06243707239627838, 0.4031565189361572, 0.2108921855688095, 0.22969180345535278, -0.028704509139060974, -0.06308931857347488, -0.1489473581314087, -0.18602950870990753, 0.11887466907501221, -0.16871783137321472, 0.0570891909301281, -0.19999699294567108, 0.007225114852190018, -0.00796797126531601, 0.10818733274936676, -0.08280960470438004, -0.10172402858734131, -0.04120077192783356, 0.04498547315597534, -0.4488227963447571, -0.10353534668684006, 0.19530950486660004, 0.006717499345541, 0.08620800077915192, -0.18851512670516968, -0.2502252757549286, -0.2554998993873596, 0.2120245397090912, -0.32102394104003906, -0.11662086844444275, -0.14016851782798767, 0.21713149547576904, 0.21627303957939148, -0.18306414783000946, 0.017507245764136314, -0.024290628731250763, 0.03425518423318863, 0.18231849372386932, -0.3292953372001648, -0.1898389309644699, 0.003925345838069916, 0.10165248066186905, 0.2865700423717499, -0.04653023183345795, 0.06803923845291138, -0.018249500542879105, -0.11352144926786423, 0.14824597537517548, 0.18170928955078125, 0.1451261043548584, -0.6392795443534851, 0.4040762484073639, 0.3212814927101135, -0.02512778528034687, -0.1858256608247757, -0.08128379285335541, -0.04995885491371155, -0.306194007396698, 0.2521118223667145, 0.10100943595170975, 0.3818824291229248, -0.3228907883167267, -0.41205209493637085, 0.14715653657913208, -0.21592304110527039, 0.28504449129104614, 0.28412044048309326, 0.34671279788017273, -0.09875354915857315, 0.23286649584770203, 0.07463964074850082, 0.08334185183048248, -0.23511558771133423, -0.20238308608531952, -0.15069420635700226, 0.10457052290439606, -0.07249986380338669, -0.04433203488588333, 0.0936983972787857, -0.07169461250305176, 0.17004035413265228, 0.28497105836868286, 0.18396618962287903, -0.33783644437789917, 0.005977662280201912, -0.4781578481197357, 0.03976692631840706, 0.08606648445129395, -0.07800450921058655, -0.11582841724157333, 0.37072739005088806, 0.15519371628761292, -0.1194450706243515, 0.3418324589729309, -0.5060864686965942, -0.3711854815483093, -0.18037086725234985, 0.1869175285100937, 0.014307916164398193, -0.01662929356098175, -0.26676449179649353, -0.17007222771644592, 0.21955472230911255, -0.18516604602336884, 0.21145731210708618, -0.4256848096847534, 0.2160862684249878, -0.16842709481716156, -0.04905072972178459, 0.17450213432312012, -0.2994723916053772, 0.25893083214759827, -0.01978052407503128, 0.19197964668273926, 0.41219577193260193, 0.5086793899536133, -0.18264180421829224, -0.033356644213199615, -0.3783024847507477, -0.33097341656684875, 0.3757345378398895, -0.18065184354782104, -0.43467360734939575, 0.4298314154148102, -0.04181225225329399, -0.04125894606113434, -0.14741253852844238, 0.10902555286884308, 0.18719500303268433, -0.0816936120390892, 0.19337141513824463, 0.40117591619491577, -0.2251415252685547, 0.1918102353811264, -0.4496757984161377, -0.2674904465675354, 0.24783213436603546, 0.1967029720544815, 0.17562878131866455, -0.06670371443033218, 0.21777880191802979, -0.07312412559986115, 0.2588134706020355, -0.06310270726680756, -0.22276179492473602, 0.2580525279045105, 0.11467486619949341, 0.13091275095939636, -0.21843716502189636, -0.2864813506603241, 0.010846499353647232, -0.02313442900776863, -0.010160811245441437, -0.16320107877254486, 0.09471727907657623, -0.15478797256946564, -0.51869136095047, 0.23062573373317719, 0.07093244045972824, 0.3605084717273712, 0.04756245017051697, 0.018511291593313217, 0.16914500296115875, -0.06382670253515244, 0.1751853972673416, 0.45256394147872925, -0.434812992811203, 0.005193493328988552, -0.07389724254608154, 0.14947402477264404, -0.13532640039920807, -0.1558477133512497, 0.026621952652931213, 0.12149637192487717, 0.3321802616119385, -0.03791804984211922, -0.3654502332210541, 0.18011757731437683, -0.009776225313544273, -0.29486942291259766, -0.3651312291622162, -0.2157198041677475, 0.22062039375305176, -0.3945513963699341, 0.29898008704185486, 0.19280105829238892, 0.24524268507957458, -0.047357313334941864, 0.04771691560745239, 0.2859414219856262, -0.3086586892604828, 0.12132122367620468, 0.09259235858917236, -0.041770800948143005, 0.3189939856529236, -0.12412536144256592, 0.20322884619235992, 0.007417544722557068, 0.0014881305396556854, 0.19949939846992493, 0.15952810645103455, -0.05024313926696777, -0.2033296376466751, -0.13109645247459412, 0.6715540289878845, -0.06587813794612885, 0.10676909983158112, 0.2518104910850525, -0.20792314410209656, -0.03859367221593857, 0.06895805150270462, -0.21736617386341095, 0.5505901575088501, 0.3331361413002014, -0.08229184150695801, -0.06867225468158722, 0.014712135307490826, -0.09951192140579224, 0.2664300203323364, 0.16960284113883972, 0.32267507910728455, 0.15934407711029053, 0.4819996654987335, -0.04444257169961929, -0.20974647998809814, -0.27626344561576843, 0.04477187991142273, 0.26742932200431824, -0.3840709626674652, 0.38414156436920166, -0.0696205198764801, -0.2515539824962616, -0.17747272551059723, -0.2844955027103424, 0.004043798893690109, -0.33593153953552246, -0.33264684677124023, 0.4384606182575226, 0.01700320839881897, -0.07723640650510788, -0.22626927495002747, 0.062228694558143616, 0.3358646631240845, -0.27092087268829346, 0.17083531618118286, 0.05200768634676933, -0.2650725543498993, 0.011704675853252411, 0.4868507385253906, -0.2440004050731659, 0.3427879512310028, 0.12019755691289902, -0.1655244529247284, -0.03905197232961655, -0.20386990904808044, -0.1234484612941742, 0.0991927981376648, 0.16942739486694336, -0.030192866921424866, 0.3613826036453247, -0.21136347949504852, -0.16740255057811737, 0.010533466003835201, 0.04331997036933899, 0.0594557449221611, 0.1659039556980133, -0.10908263921737671, 0.1439702957868576, -0.03303379938006401, -0.2585492730140686, -0.44593361020088196, -0.5692219138145447, 0.10587580502033234, 0.059380244463682175, 0.13857056200504303, 0.25813671946525574, 0.1298876702785492, 0.2472284734249115, 0.34788572788238525, -0.11012277007102966, -0.3189486563205719, -0.13861893117427826, 0.35731738805770874, -0.17738893628120422, -0.19554027915000916, 0.1069212406873703, -0.024517707526683807, -0.047351155430078506, 0.14091236889362335, -0.4079741835594177, 0.1772587150335312, -0.42272523045539856, 0.46870070695877075, -0.4635942578315735, -0.04442131519317627, 0.1144370436668396, -0.21715916693210602, 0.010356130078434944, 0.12779727578163147, 0.09290255606174469, -0.12362018972635269, 0.14443951845169067, 0.49612289667129517, -0.25444239377975464, 0.44793447852134705, -0.16753025352954865, 0.5885943174362183, 0.17588989436626434, 0.05358100309967995, 0.3482431471347809, 0.021755538880825043, 0.01447666808962822, -0.21496406197547913, -0.37185582518577576, 0.06305868923664093, -0.22956803441047668, -0.1729588508605957, 0.06716443598270416, -0.08266009390354156, -0.07205028086900711, 0.12978999316692352, -0.2179080694913864, -0.05128931254148483, -0.2240113615989685, 0.20996160805225372, -0.09039054811000824, 0.17387999594211578, -0.14571210741996765, -0.09767287969589233, -0.2475629448890686, -0.23845559358596802, -0.1726536750793457, 0.17912964522838593, 0.018602490425109863, 0.04128723964095116, 0.10141374170780182, -0.16951853036880493, -0.2960941195487976, 0.2517765760421753, -0.02027714252471924, 0.3787272572517395, 0.003271874040365219, 0.03430300951004028, -0.09064504504203796, -0.09841862320899963, 0.4456343650817871, 0.28611254692077637, 0.07992543280124664, 0.09266795217990875, 0.17231769859790802, -0.4492839276790619, -0.076456218957901, -0.10963420569896698, 0.3906116783618927, 0.5413093566894531, 0.3065812587738037, -0.2116076648235321, 0.14862775802612305, 0.6596485376358032, 0.4045993685722351, -0.03348797559738159, -0.1579154133796692, -0.282257616519928, -0.38411980867385864, -0.29867851734161377, 0.24832361936569214, 0.2736555337905884, 0.27473756670951843, -0.2445584237575531, -0.28429844975471497, -0.2872462868690491, -0.0773293599486351, 0.020731396973133087, -0.10377262532711029, 0.2474452257156372, -0.2777171730995178, 0.1813603639602661, -0.43756192922592163, 0.23997774720191956, 0.24989573657512665, 0.5667697787284851, 0.07643535733222961, -0.4990854263305664, 0.1059616282582283, 0.120084747672081, 0.30827513337135315, 0.09950698167085648, -0.1307036429643631, 0.22553041577339172, -0.09968683868646622, 0.44804614782333374, -0.07788205146789551, 0.5246808528900146, -0.14827927947044373, 0.22094689309597015, -0.34291067719459534, -0.19213396310806274, 0.547170877456665, 0.1663152426481247, 0.19766582548618317, 0.3111850619316101, 0.026270408183336258, -0.3059810400009155, 0.3107355833053589, -0.16278767585754395, 0.8497914671897888, 0.06669555604457855, -0.06066598370671272, 0.38529133796691895, -0.03204647824168205, 0.2201925814151764, -0.00027794018387794495, 0.13152961432933807, -0.37022724747657776, -0.027098488062620163, 0.18778760731220245, -0.13702905178070068, 0.06583811342716217, -0.18384596705436707, -0.28570640087127686, 0.2849735617637634, -0.2500235438346863, -0.09471683204174042, -0.04896274954080582, 0.3314095735549927, -0.37765559554100037, 0.007667003199458122, -0.2876814603805542, 0.15929317474365234, -0.38668298721313477, -0.053935494273900986, -0.08390773087739944, 0.04848698154091835, -0.08806009590625763, -0.15772201120853424, -0.24220161139965057, 0.08613095432519913, -0.2848759591579437, 0.3731246590614319, -0.2572709918022156, -0.29216790199279785, 0.5167397260665894, -0.09814170002937317, 0.08122798800468445, 0.29140427708625793, -0.06481871753931046, 0.034971725195646286, -0.14759615063667297, -0.18979187309741974, 0.05812549218535423, 0.17811043560504913, 0.10609754920005798, -0.020049842074513435, -0.2854974865913391, 0.04728515446186066, -0.05922948196530342, -0.16250252723693848, 0.024472326040267944, 0.10543470829725266, 0.5009015798568726, -0.48849254846572876, -0.32759889960289, -0.24513548612594604, -0.09851664304733276, -0.2617266774177551, 0.11408805847167969, -0.06117524206638336, -0.13015489280223846, 0.2037440836429596, 0.22624093294143677, -0.4189797341823578, -0.10186879336833954, 0.17977853119373322, -0.0036855190992355347, -0.12414667755365372, 0.47180846333503723, 0.1788039356470108, -0.19214396178722382, -0.13290202617645264, 0.3621409833431244, -0.1984470933675766, -0.38313984870910645, 0.2497865855693817, -0.08816082775592804, 0.3134532570838928, 0.049364469945430756, 0.1648942530155182, 0.12852762639522552, -0.02610381692647934, -0.055564820766448975, -0.47899386286735535, -0.6197270750999451, 0.020489759743213654, -0.17898087203502655, 0.07164382934570312, 0.22576233744621277, 0.11449176073074341, -0.3802782893180847, 0.06096949428319931, -0.24993325769901276, 0.11757151782512665, -0.0940813273191452, 0.10025616735219955, 0.1581793874502182, -0.285672664642334, -0.1549951136112213, 0.08355088531970978, 0.14725881814956665, 0.3399650454521179, 0.20342303812503815, -0.22011911869049072, -0.18029530346393585, 0.12341981381177902, -0.006576646119356155, -0.3159588873386383, -0.08770573139190674, -0.28387194871902466, 0.037396859377622604, -0.03816695511341095, 0.10210222005844116, 0.11634885519742966, 0.07618573307991028, 0.02099715918302536, -0.24134309589862823, 0.0034297481179237366, -0.12185151129961014, 0.19924387335777283, 0.13464704155921936, 0.4082373380661011, 0.19386886060237885, 0.5115569829940796, 0.24224495887756348, -0.04629679024219513, -0.43919476866722107, -0.008643358945846558, 0.3187031149864197, 0.03648817911744118, 0.3426598310470581, -0.2697684168815613, 0.07568514347076416, 0.16929204761981964, -0.23282288014888763, 0.22913405299186707, -0.25543516874313354, -0.09877418726682663, 0.26777660846710205, 0.16084587574005127, -0.17872226238250732, 0.13948845863342285, 0.15855363011360168, -0.3148189187049866, -0.023261284455657005, 0.2851652204990387, -0.20909349620342255, -0.1405559629201889, -0.27613288164138794, -0.02294502966105938, 0.21735170483589172, 0.2729935050010681, 0.002375860931351781, 0.4859406054019928, -0.044278278946876526, -0.21067754924297333, 0.39080774784088135, 0.16114452481269836, 0.3288120925426483, 0.8358757495880127, -0.2156842052936554, 0.133271723985672, -0.2734277546405792, 0.04166405647993088, -0.014557689428329468, -0.3601619005203247, -0.033477526158094406, 0.28801143169403076, -0.2637088894844055, 0.27294921875, 0.020296543836593628, 0.20703613758087158, -0.26228877902030945, -0.07231521606445312, -0.173462375998497, 0.2326335906982422, -0.31068432331085205, 0.10655294358730316, 0.20396822690963745, 0.08397028595209122, -0.03519570454955101, 0.21060211956501007, -0.15057437121868134, -0.04050738364458084, 0.10409249365329742, 0.3406962752342224, -0.20162175595760345, -0.271628737449646, 0.2608352601528168, 0.4320448040962219, 0.08981703221797943, -0.4641041159629822, 0.12155914306640625, 0.2563055753707886, 0.00421489030122757, -0.1815425306558609, -0.11361978203058243, 0.5183136463165283, 0.27215591073036194, 0.020924024283885956, 0.03270827978849411, 0.056745365262031555, -0.14462020993232727, 0.12292782962322235, -0.24000754952430725, 0.147347554564476, 0.4070994257926941, 0.2802129089832306, 0.08324094861745834, -0.17698591947555542, -0.03167227283120155, 0.13094188272953033, -0.0826028436422348, -0.2602497339248657, 0.28847265243530273, 0.05318643897771835, -0.39021438360214233, -0.25396913290023804, 0.010516196489334106, -0.250701367855072, -0.06606036424636841, 0.4123232364654541, 0.07801241427659988, 0.2456803321838379, 0.16989725828170776, 0.04279639571905136, -0.2895328998565674, 0.4310108423233032, 0.25519415736198425, 0.2772292494773865, -0.5120605230331421, -0.11491222679615021, -0.3112878203392029, 0.11089342087507248, -0.36213916540145874, 0.03549609333276749, 0.199350968003273, 0.0729064792394638, -0.14432817697525024, 0.11744127422571182, 0.24190343916416168, 0.27480921149253845, 0.35398057103157043, 0.165370374917984, -0.14194153249263763, -0.4123852252960205, 0.07853980362415314, -0.12405794858932495, 0.003536362200975418, -0.5456081628799438, 0.2555713951587677, -0.206376850605011, 0.008678007870912552, -0.19115620851516724, 0.009041540324687958, 0.01849699392914772, -0.05934974551200867, 0.3211500644683838, 0.24234360456466675, 0.5917177200317383, -0.010546587407588959, -0.01108473353087902, 0.2435409426689148, -0.14336103200912476, -0.10123249143362045, 0.28801119327545166, 0.10816340148448944, 0.3745174705982208, -0.03582605719566345, -0.07707174122333527, -0.22778986394405365, 0.185454323887825, -0.020570972934365273, -0.5014035105705261, 0.042701348662376404, -0.20563317835330963, -0.12497760355472565, 0.08245635777711868, 0.06540284305810928, 0.2370987832546234, 0.010593399405479431, 0.27219390869140625, -0.13509312272071838, -0.1335953176021576, 0.3531579077243805, 0.08318223059177399, -0.37515121698379517, 0.006107374094426632, 0.5184326767921448, 0.09052176028490067, -0.11257920414209366, -0.4577998220920563, 0.13875994086265564, 0.39225977659225464, -0.04285239428281784, -0.18254472315311432, 0.3959064483642578, 0.029019055888056755, 0.09268586337566376, -0.060140062123537064, 0.5353975892066956, -0.03100498393177986, -0.18696334958076477, 0.1814294308423996, -0.15507301688194275 ]
https://github.com/huggingface/datasets/issues/6007
Get an error "OverflowError: Python int too large to convert to C long" when loading a large dataset
Thank you for checking this issue in detail. However, it seems that using `np.uint64(simhash)` does not work. The same issue still exists. https://huggingface.co/datasets/liwu/MNBVC/commit/1e44f1e400b7e61052647d44c99cdae3bae9c830 Anyway, we decide to use string type for these simhash values. Hope pyarrow can fix their bug soon.
### Describe the bug When load a large dataset with the following code ```python from datasets import load_dataset dataset = load_dataset("liwu/MNBVC", 'news_peoples_daily', split='train') ``` We encountered the error: "OverflowError: Python int too large to convert to C long" The error look something like: ``` OverflowError: Python int too large to convert to C long During handling of the above exception, another exception occurred: OverflowError Traceback (most recent call last) <ipython-input-7-0ed8700e662d> in <module> ----> 1 dataset = load_dataset("liwu/MNBVC", 'news_peoples_daily', split='train', cache_dir='/sfs/MNBVC/.cache/') /sfs/MNBVC/venv/lib64/python3.6/site-packages/datasets/load.py in load_dataset(path, name, data_dir, data_files, split, cache_dir, features, download_config, download_mode, ignore_verifications, keep_in_memory, save_infos, revision, use_auth_token, task, streaming, **config_kwargs) 1749 ignore_verifications=ignore_verifications, 1750 try_from_hf_gcs=try_from_hf_gcs, -> 1751 use_auth_token=use_auth_token, 1752 ) 1753 /sfs/MNBVC/venv/lib64/python3.6/site-packages/datasets/builder.py in download_and_prepare(self, download_config, download_mode, ignore_verifications, try_from_hf_gcs, dl_manager, base_path, use_auth_token, **download_and_prepare_kwargs) 703 if not downloaded_from_gcs: 704 self._download_and_prepare( --> 705 dl_manager=dl_manager, verify_infos=verify_infos, **download_and_prepare_kwargs 706 ) 707 # Sync info /sfs/MNBVC/venv/lib64/python3.6/site-packages/datasets/builder.py in _download_and_prepare(self, dl_manager, verify_infos) 1225 1226 def _download_and_prepare(self, dl_manager, verify_infos): -> 1227 super()._download_and_prepare(dl_manager, verify_infos, check_duplicate_keys=verify_infos) 1228 1229 def _get_examples_iterable_for_split(self, split_generator: SplitGenerator) -> ExamplesIterable: /sfs/MNBVC/venv/lib64/python3.6/site-packages/datasets/builder.py in _download_and_prepare(self, dl_manager, verify_infos, **prepare_split_kwargs) 791 try: 792 # Prepare split will record examples associated to the split --> 793 self._prepare_split(split_generator, **prepare_split_kwargs) 794 except OSError as e: 795 raise OSError( /sfs/MNBVC/venv/lib64/python3.6/site-packages/datasets/builder.py in _prepare_split(self, split_generator, check_duplicate_keys) 1219 writer.write(example, key) 1220 finally: -> 1221 num_examples, num_bytes = writer.finalize() 1222 1223 split_generator.split_info.num_examples = num_examples /sfs/MNBVC/venv/lib64/python3.6/site-packages/datasets/arrow_writer.py in finalize(self, close_stream) 536 # Re-intializing to empty list for next batch 537 self.hkey_record = [] --> 538 self.write_examples_on_file() 539 if self.pa_writer is None: 540 if self.schema: /sfs/MNBVC/venv/lib64/python3.6/site-packages/datasets/arrow_writer.py in write_examples_on_file(self) 407 # Since current_examples contains (example, key) tuples 408 batch_examples[col] = [row[0][col] for row in self.current_examples] --> 409 self.write_batch(batch_examples=batch_examples) 410 self.current_examples = [] 411 /sfs/MNBVC/venv/lib64/python3.6/site-packages/datasets/arrow_writer.py in write_batch(self, batch_examples, writer_batch_size) 506 col_try_type = try_features[col] if try_features is not None and col in try_features else None 507 typed_sequence = OptimizedTypedSequence(batch_examples[col], type=col_type, try_type=col_try_type, col=col) --> 508 arrays.append(pa.array(typed_sequence)) 509 inferred_features[col] = typed_sequence.get_inferred_type() 510 schema = inferred_features.arrow_schema if self.pa_writer is None else self.schema /sfs/MNBVC/venv/lib64/python3.6/site-packages/pyarrow/array.pxi in pyarrow.lib.array() /sfs/MNBVC/venv/lib64/python3.6/site-packages/pyarrow/array.pxi in pyarrow.lib._handle_arrow_array_protocol() /sfs/MNBVC/venv/lib64/python3.6/site-packages/datasets/arrow_writer.py in __arrow_array__(self, type) 180 else: 181 trying_cast_to_python_objects = True --> 182 out = pa.array(cast_to_python_objects(data, only_1d_for_numpy=True)) 183 # use smaller integer precisions if possible 184 if self.trying_int_optimization: /sfs/MNBVC/venv/lib64/python3.6/site-packages/pyarrow/array.pxi in pyarrow.lib.array() /sfs/MNBVC/venv/lib64/python3.6/site-packages/pyarrow/array.pxi in pyarrow.lib._sequence_to_array() /sfs/MNBVC/venv/lib64/python3.6/site-packages/pyarrow/error.pxi in pyarrow.lib.pyarrow_internal_check_status() OverflowError: Python int too large to convert to C long ``` However, that dataset can be loaded in a streaming manner: ```python from datasets import load_dataset dataset = load_dataset("liwu/MNBVC", 'news_peoples_daily', split='train', streaming=True) for i in dataset: pass # it work well ``` Another issue is reported in our dataset hub: https://huggingface.co/datasets/liwu/MNBVC/discussions/2 ### Steps to reproduce the bug from datasets import load_dataset dataset = load_dataset("liwu/MNBVC", 'news_peoples_daily', split='train') ### Expected behavior the dataset can be safely loaded ### Environment info - `datasets` version: 2.4.0 - Platform: Linux-3.10.0-1160.an7.x86_64-x86_64-with-centos-7.9 - Python version: 3.6.8 - PyArrow version: 6.0.1 - Pandas version: 1.1.5
41
Get an error "OverflowError: Python int too large to convert to C long" when loading a large dataset ### Describe the bug When load a large dataset with the following code ```python from datasets import load_dataset dataset = load_dataset("liwu/MNBVC", 'news_peoples_daily', split='train') ``` We encountered the error: "OverflowError: Python int too large to convert to C long" The error look something like: ``` OverflowError: Python int too large to convert to C long During handling of the above exception, another exception occurred: OverflowError Traceback (most recent call last) <ipython-input-7-0ed8700e662d> in <module> ----> 1 dataset = load_dataset("liwu/MNBVC", 'news_peoples_daily', split='train', cache_dir='/sfs/MNBVC/.cache/') /sfs/MNBVC/venv/lib64/python3.6/site-packages/datasets/load.py in load_dataset(path, name, data_dir, data_files, split, cache_dir, features, download_config, download_mode, ignore_verifications, keep_in_memory, save_infos, revision, use_auth_token, task, streaming, **config_kwargs) 1749 ignore_verifications=ignore_verifications, 1750 try_from_hf_gcs=try_from_hf_gcs, -> 1751 use_auth_token=use_auth_token, 1752 ) 1753 /sfs/MNBVC/venv/lib64/python3.6/site-packages/datasets/builder.py in download_and_prepare(self, download_config, download_mode, ignore_verifications, try_from_hf_gcs, dl_manager, base_path, use_auth_token, **download_and_prepare_kwargs) 703 if not downloaded_from_gcs: 704 self._download_and_prepare( --> 705 dl_manager=dl_manager, verify_infos=verify_infos, **download_and_prepare_kwargs 706 ) 707 # Sync info /sfs/MNBVC/venv/lib64/python3.6/site-packages/datasets/builder.py in _download_and_prepare(self, dl_manager, verify_infos) 1225 1226 def _download_and_prepare(self, dl_manager, verify_infos): -> 1227 super()._download_and_prepare(dl_manager, verify_infos, check_duplicate_keys=verify_infos) 1228 1229 def _get_examples_iterable_for_split(self, split_generator: SplitGenerator) -> ExamplesIterable: /sfs/MNBVC/venv/lib64/python3.6/site-packages/datasets/builder.py in _download_and_prepare(self, dl_manager, verify_infos, **prepare_split_kwargs) 791 try: 792 # Prepare split will record examples associated to the split --> 793 self._prepare_split(split_generator, **prepare_split_kwargs) 794 except OSError as e: 795 raise OSError( /sfs/MNBVC/venv/lib64/python3.6/site-packages/datasets/builder.py in _prepare_split(self, split_generator, check_duplicate_keys) 1219 writer.write(example, key) 1220 finally: -> 1221 num_examples, num_bytes = writer.finalize() 1222 1223 split_generator.split_info.num_examples = num_examples /sfs/MNBVC/venv/lib64/python3.6/site-packages/datasets/arrow_writer.py in finalize(self, close_stream) 536 # Re-intializing to empty list for next batch 537 self.hkey_record = [] --> 538 self.write_examples_on_file() 539 if self.pa_writer is None: 540 if self.schema: /sfs/MNBVC/venv/lib64/python3.6/site-packages/datasets/arrow_writer.py in write_examples_on_file(self) 407 # Since current_examples contains (example, key) tuples 408 batch_examples[col] = [row[0][col] for row in self.current_examples] --> 409 self.write_batch(batch_examples=batch_examples) 410 self.current_examples = [] 411 /sfs/MNBVC/venv/lib64/python3.6/site-packages/datasets/arrow_writer.py in write_batch(self, batch_examples, writer_batch_size) 506 col_try_type = try_features[col] if try_features is not None and col in try_features else None 507 typed_sequence = OptimizedTypedSequence(batch_examples[col], type=col_type, try_type=col_try_type, col=col) --> 508 arrays.append(pa.array(typed_sequence)) 509 inferred_features[col] = typed_sequence.get_inferred_type() 510 schema = inferred_features.arrow_schema if self.pa_writer is None else self.schema /sfs/MNBVC/venv/lib64/python3.6/site-packages/pyarrow/array.pxi in pyarrow.lib.array() /sfs/MNBVC/venv/lib64/python3.6/site-packages/pyarrow/array.pxi in pyarrow.lib._handle_arrow_array_protocol() /sfs/MNBVC/venv/lib64/python3.6/site-packages/datasets/arrow_writer.py in __arrow_array__(self, type) 180 else: 181 trying_cast_to_python_objects = True --> 182 out = pa.array(cast_to_python_objects(data, only_1d_for_numpy=True)) 183 # use smaller integer precisions if possible 184 if self.trying_int_optimization: /sfs/MNBVC/venv/lib64/python3.6/site-packages/pyarrow/array.pxi in pyarrow.lib.array() /sfs/MNBVC/venv/lib64/python3.6/site-packages/pyarrow/array.pxi in pyarrow.lib._sequence_to_array() /sfs/MNBVC/venv/lib64/python3.6/site-packages/pyarrow/error.pxi in pyarrow.lib.pyarrow_internal_check_status() OverflowError: Python int too large to convert to C long ``` However, that dataset can be loaded in a streaming manner: ```python from datasets import load_dataset dataset = load_dataset("liwu/MNBVC", 'news_peoples_daily', split='train', streaming=True) for i in dataset: pass # it work well ``` Another issue is reported in our dataset hub: https://huggingface.co/datasets/liwu/MNBVC/discussions/2 ### Steps to reproduce the bug from datasets import load_dataset dataset = load_dataset("liwu/MNBVC", 'news_peoples_daily', split='train') ### Expected behavior the dataset can be safely loaded ### Environment info - `datasets` version: 2.4.0 - Platform: Linux-3.10.0-1160.an7.x86_64-x86_64-with-centos-7.9 - Python version: 3.6.8 - PyArrow version: 6.0.1 - Pandas version: 1.1.5 Thank you for checking this issue in detail. However, it seems that using `np.uint64(simhash)` does not work. The same issue still exists. https://huggingface.co/datasets/liwu/MNBVC/commit/1e44f1e400b7e61052647d44c99cdae3bae9c830 Anyway, we decide to use string type for these simhash values. Hope pyarrow can fix their bug soon.
[ -0.42730045318603516, -0.3950994908809662, -0.02665611356496811, 0.3553202748298645, 0.3509588837623596, -0.004374183714389801, 0.10522277653217316, 0.331129789352417, 0.31195196509361267, 0.1922844648361206, -0.027331490069627762, 0.16219580173492432, -0.11134413629770279, 0.08958712965250015, -0.2046218365430832, -0.1775018572807312, 0.1220521628856659, -0.17765238881111145, -0.25584712624549866, 0.18601104617118835, -0.3780885636806488, -0.07006936520338058, -0.17661845684051514, 0.048064276576042175, -0.23183873295783997, -0.21604019403457642, 0.12426722049713135, 0.36674559116363525, -0.2756235599517822, -0.3445779085159302, 0.0034113675355911255, -0.3893600404262543, 0.35168981552124023, 0.4516564607620239, -0.00011814466415671632, -0.18242916464805603, 0.11768415570259094, -0.042029090225696564, -0.32315704226493835, 0.09475971758365631, -0.039298251271247864, -0.5150787830352783, -0.006220826879143715, -0.45916715264320374, 0.16284555196762085, -0.05158706381917, -0.17475268244743347, -0.08125865459442139, 0.18807296454906464, 0.5761505961418152, 0.19275711476802826, 0.055086515843868256, 0.38476377725601196, 0.06680193543434143, 0.22039756178855896, -0.03740207850933075, -0.06243707239627838, 0.4031565189361572, 0.2108921855688095, 0.22969180345535278, -0.028704509139060974, -0.06308931857347488, -0.1489473581314087, -0.18602950870990753, 0.11887466907501221, -0.16871783137321472, 0.0570891909301281, -0.19999699294567108, 0.007225114852190018, -0.00796797126531601, 0.10818733274936676, -0.08280960470438004, -0.10172402858734131, -0.04120077192783356, 0.04498547315597534, -0.4488227963447571, -0.10353534668684006, 0.19530950486660004, 0.006717499345541, 0.08620800077915192, -0.18851512670516968, -0.2502252757549286, -0.2554998993873596, 0.2120245397090912, -0.32102394104003906, -0.11662086844444275, -0.14016851782798767, 0.21713149547576904, 0.21627303957939148, -0.18306414783000946, 0.017507245764136314, -0.024290628731250763, 0.03425518423318863, 0.18231849372386932, -0.3292953372001648, -0.1898389309644699, 0.003925345838069916, 0.10165248066186905, 0.2865700423717499, -0.04653023183345795, 0.06803923845291138, -0.018249500542879105, -0.11352144926786423, 0.14824597537517548, 0.18170928955078125, 0.1451261043548584, -0.6392795443534851, 0.4040762484073639, 0.3212814927101135, -0.02512778528034687, -0.1858256608247757, -0.08128379285335541, -0.04995885491371155, -0.306194007396698, 0.2521118223667145, 0.10100943595170975, 0.3818824291229248, -0.3228907883167267, -0.41205209493637085, 0.14715653657913208, -0.21592304110527039, 0.28504449129104614, 0.28412044048309326, 0.34671279788017273, -0.09875354915857315, 0.23286649584770203, 0.07463964074850082, 0.08334185183048248, -0.23511558771133423, -0.20238308608531952, -0.15069420635700226, 0.10457052290439606, -0.07249986380338669, -0.04433203488588333, 0.0936983972787857, -0.07169461250305176, 0.17004035413265228, 0.28497105836868286, 0.18396618962287903, -0.33783644437789917, 0.005977662280201912, -0.4781578481197357, 0.03976692631840706, 0.08606648445129395, -0.07800450921058655, -0.11582841724157333, 0.37072739005088806, 0.15519371628761292, -0.1194450706243515, 0.3418324589729309, -0.5060864686965942, -0.3711854815483093, -0.18037086725234985, 0.1869175285100937, 0.014307916164398193, -0.01662929356098175, -0.26676449179649353, -0.17007222771644592, 0.21955472230911255, -0.18516604602336884, 0.21145731210708618, -0.4256848096847534, 0.2160862684249878, -0.16842709481716156, -0.04905072972178459, 0.17450213432312012, -0.2994723916053772, 0.25893083214759827, -0.01978052407503128, 0.19197964668273926, 0.41219577193260193, 0.5086793899536133, -0.18264180421829224, -0.033356644213199615, -0.3783024847507477, -0.33097341656684875, 0.3757345378398895, -0.18065184354782104, -0.43467360734939575, 0.4298314154148102, -0.04181225225329399, -0.04125894606113434, -0.14741253852844238, 0.10902555286884308, 0.18719500303268433, -0.0816936120390892, 0.19337141513824463, 0.40117591619491577, -0.2251415252685547, 0.1918102353811264, -0.4496757984161377, -0.2674904465675354, 0.24783213436603546, 0.1967029720544815, 0.17562878131866455, -0.06670371443033218, 0.21777880191802979, -0.07312412559986115, 0.2588134706020355, -0.06310270726680756, -0.22276179492473602, 0.2580525279045105, 0.11467486619949341, 0.13091275095939636, -0.21843716502189636, -0.2864813506603241, 0.010846499353647232, -0.02313442900776863, -0.010160811245441437, -0.16320107877254486, 0.09471727907657623, -0.15478797256946564, -0.51869136095047, 0.23062573373317719, 0.07093244045972824, 0.3605084717273712, 0.04756245017051697, 0.018511291593313217, 0.16914500296115875, -0.06382670253515244, 0.1751853972673416, 0.45256394147872925, -0.434812992811203, 0.005193493328988552, -0.07389724254608154, 0.14947402477264404, -0.13532640039920807, -0.1558477133512497, 0.026621952652931213, 0.12149637192487717, 0.3321802616119385, -0.03791804984211922, -0.3654502332210541, 0.18011757731437683, -0.009776225313544273, -0.29486942291259766, -0.3651312291622162, -0.2157198041677475, 0.22062039375305176, -0.3945513963699341, 0.29898008704185486, 0.19280105829238892, 0.24524268507957458, -0.047357313334941864, 0.04771691560745239, 0.2859414219856262, -0.3086586892604828, 0.12132122367620468, 0.09259235858917236, -0.041770800948143005, 0.3189939856529236, -0.12412536144256592, 0.20322884619235992, 0.007417544722557068, 0.0014881305396556854, 0.19949939846992493, 0.15952810645103455, -0.05024313926696777, -0.2033296376466751, -0.13109645247459412, 0.6715540289878845, -0.06587813794612885, 0.10676909983158112, 0.2518104910850525, -0.20792314410209656, -0.03859367221593857, 0.06895805150270462, -0.21736617386341095, 0.5505901575088501, 0.3331361413002014, -0.08229184150695801, -0.06867225468158722, 0.014712135307490826, -0.09951192140579224, 0.2664300203323364, 0.16960284113883972, 0.32267507910728455, 0.15934407711029053, 0.4819996654987335, -0.04444257169961929, -0.20974647998809814, -0.27626344561576843, 0.04477187991142273, 0.26742932200431824, -0.3840709626674652, 0.38414156436920166, -0.0696205198764801, -0.2515539824962616, -0.17747272551059723, -0.2844955027103424, 0.004043798893690109, -0.33593153953552246, -0.33264684677124023, 0.4384606182575226, 0.01700320839881897, -0.07723640650510788, -0.22626927495002747, 0.062228694558143616, 0.3358646631240845, -0.27092087268829346, 0.17083531618118286, 0.05200768634676933, -0.2650725543498993, 0.011704675853252411, 0.4868507385253906, -0.2440004050731659, 0.3427879512310028, 0.12019755691289902, -0.1655244529247284, -0.03905197232961655, -0.20386990904808044, -0.1234484612941742, 0.0991927981376648, 0.16942739486694336, -0.030192866921424866, 0.3613826036453247, -0.21136347949504852, -0.16740255057811737, 0.010533466003835201, 0.04331997036933899, 0.0594557449221611, 0.1659039556980133, -0.10908263921737671, 0.1439702957868576, -0.03303379938006401, -0.2585492730140686, -0.44593361020088196, -0.5692219138145447, 0.10587580502033234, 0.059380244463682175, 0.13857056200504303, 0.25813671946525574, 0.1298876702785492, 0.2472284734249115, 0.34788572788238525, -0.11012277007102966, -0.3189486563205719, -0.13861893117427826, 0.35731738805770874, -0.17738893628120422, -0.19554027915000916, 0.1069212406873703, -0.024517707526683807, -0.047351155430078506, 0.14091236889362335, -0.4079741835594177, 0.1772587150335312, -0.42272523045539856, 0.46870070695877075, -0.4635942578315735, -0.04442131519317627, 0.1144370436668396, -0.21715916693210602, 0.010356130078434944, 0.12779727578163147, 0.09290255606174469, -0.12362018972635269, 0.14443951845169067, 0.49612289667129517, -0.25444239377975464, 0.44793447852134705, -0.16753025352954865, 0.5885943174362183, 0.17588989436626434, 0.05358100309967995, 0.3482431471347809, 0.021755538880825043, 0.01447666808962822, -0.21496406197547913, -0.37185582518577576, 0.06305868923664093, -0.22956803441047668, -0.1729588508605957, 0.06716443598270416, -0.08266009390354156, -0.07205028086900711, 0.12978999316692352, -0.2179080694913864, -0.05128931254148483, -0.2240113615989685, 0.20996160805225372, -0.09039054811000824, 0.17387999594211578, -0.14571210741996765, -0.09767287969589233, -0.2475629448890686, -0.23845559358596802, -0.1726536750793457, 0.17912964522838593, 0.018602490425109863, 0.04128723964095116, 0.10141374170780182, -0.16951853036880493, -0.2960941195487976, 0.2517765760421753, -0.02027714252471924, 0.3787272572517395, 0.003271874040365219, 0.03430300951004028, -0.09064504504203796, -0.09841862320899963, 0.4456343650817871, 0.28611254692077637, 0.07992543280124664, 0.09266795217990875, 0.17231769859790802, -0.4492839276790619, -0.076456218957901, -0.10963420569896698, 0.3906116783618927, 0.5413093566894531, 0.3065812587738037, -0.2116076648235321, 0.14862775802612305, 0.6596485376358032, 0.4045993685722351, -0.03348797559738159, -0.1579154133796692, -0.282257616519928, -0.38411980867385864, -0.29867851734161377, 0.24832361936569214, 0.2736555337905884, 0.27473756670951843, -0.2445584237575531, -0.28429844975471497, -0.2872462868690491, -0.0773293599486351, 0.020731396973133087, -0.10377262532711029, 0.2474452257156372, -0.2777171730995178, 0.1813603639602661, -0.43756192922592163, 0.23997774720191956, 0.24989573657512665, 0.5667697787284851, 0.07643535733222961, -0.4990854263305664, 0.1059616282582283, 0.120084747672081, 0.30827513337135315, 0.09950698167085648, -0.1307036429643631, 0.22553041577339172, -0.09968683868646622, 0.44804614782333374, -0.07788205146789551, 0.5246808528900146, -0.14827927947044373, 0.22094689309597015, -0.34291067719459534, -0.19213396310806274, 0.547170877456665, 0.1663152426481247, 0.19766582548618317, 0.3111850619316101, 0.026270408183336258, -0.3059810400009155, 0.3107355833053589, -0.16278767585754395, 0.8497914671897888, 0.06669555604457855, -0.06066598370671272, 0.38529133796691895, -0.03204647824168205, 0.2201925814151764, -0.00027794018387794495, 0.13152961432933807, -0.37022724747657776, -0.027098488062620163, 0.18778760731220245, -0.13702905178070068, 0.06583811342716217, -0.18384596705436707, -0.28570640087127686, 0.2849735617637634, -0.2500235438346863, -0.09471683204174042, -0.04896274954080582, 0.3314095735549927, -0.37765559554100037, 0.007667003199458122, -0.2876814603805542, 0.15929317474365234, -0.38668298721313477, -0.053935494273900986, -0.08390773087739944, 0.04848698154091835, -0.08806009590625763, -0.15772201120853424, -0.24220161139965057, 0.08613095432519913, -0.2848759591579437, 0.3731246590614319, -0.2572709918022156, -0.29216790199279785, 0.5167397260665894, -0.09814170002937317, 0.08122798800468445, 0.29140427708625793, -0.06481871753931046, 0.034971725195646286, -0.14759615063667297, -0.18979187309741974, 0.05812549218535423, 0.17811043560504913, 0.10609754920005798, -0.020049842074513435, -0.2854974865913391, 0.04728515446186066, -0.05922948196530342, -0.16250252723693848, 0.024472326040267944, 0.10543470829725266, 0.5009015798568726, -0.48849254846572876, -0.32759889960289, -0.24513548612594604, -0.09851664304733276, -0.2617266774177551, 0.11408805847167969, -0.06117524206638336, -0.13015489280223846, 0.2037440836429596, 0.22624093294143677, -0.4189797341823578, -0.10186879336833954, 0.17977853119373322, -0.0036855190992355347, -0.12414667755365372, 0.47180846333503723, 0.1788039356470108, -0.19214396178722382, -0.13290202617645264, 0.3621409833431244, -0.1984470933675766, -0.38313984870910645, 0.2497865855693817, -0.08816082775592804, 0.3134532570838928, 0.049364469945430756, 0.1648942530155182, 0.12852762639522552, -0.02610381692647934, -0.055564820766448975, -0.47899386286735535, -0.6197270750999451, 0.020489759743213654, -0.17898087203502655, 0.07164382934570312, 0.22576233744621277, 0.11449176073074341, -0.3802782893180847, 0.06096949428319931, -0.24993325769901276, 0.11757151782512665, -0.0940813273191452, 0.10025616735219955, 0.1581793874502182, -0.285672664642334, -0.1549951136112213, 0.08355088531970978, 0.14725881814956665, 0.3399650454521179, 0.20342303812503815, -0.22011911869049072, -0.18029530346393585, 0.12341981381177902, -0.006576646119356155, -0.3159588873386383, -0.08770573139190674, -0.28387194871902466, 0.037396859377622604, -0.03816695511341095, 0.10210222005844116, 0.11634885519742966, 0.07618573307991028, 0.02099715918302536, -0.24134309589862823, 0.0034297481179237366, -0.12185151129961014, 0.19924387335777283, 0.13464704155921936, 0.4082373380661011, 0.19386886060237885, 0.5115569829940796, 0.24224495887756348, -0.04629679024219513, -0.43919476866722107, -0.008643358945846558, 0.3187031149864197, 0.03648817911744118, 0.3426598310470581, -0.2697684168815613, 0.07568514347076416, 0.16929204761981964, -0.23282288014888763, 0.22913405299186707, -0.25543516874313354, -0.09877418726682663, 0.26777660846710205, 0.16084587574005127, -0.17872226238250732, 0.13948845863342285, 0.15855363011360168, -0.3148189187049866, -0.023261284455657005, 0.2851652204990387, -0.20909349620342255, -0.1405559629201889, -0.27613288164138794, -0.02294502966105938, 0.21735170483589172, 0.2729935050010681, 0.002375860931351781, 0.4859406054019928, -0.044278278946876526, -0.21067754924297333, 0.39080774784088135, 0.16114452481269836, 0.3288120925426483, 0.8358757495880127, -0.2156842052936554, 0.133271723985672, -0.2734277546405792, 0.04166405647993088, -0.014557689428329468, -0.3601619005203247, -0.033477526158094406, 0.28801143169403076, -0.2637088894844055, 0.27294921875, 0.020296543836593628, 0.20703613758087158, -0.26228877902030945, -0.07231521606445312, -0.173462375998497, 0.2326335906982422, -0.31068432331085205, 0.10655294358730316, 0.20396822690963745, 0.08397028595209122, -0.03519570454955101, 0.21060211956501007, -0.15057437121868134, -0.04050738364458084, 0.10409249365329742, 0.3406962752342224, -0.20162175595760345, -0.271628737449646, 0.2608352601528168, 0.4320448040962219, 0.08981703221797943, -0.4641041159629822, 0.12155914306640625, 0.2563055753707886, 0.00421489030122757, -0.1815425306558609, -0.11361978203058243, 0.5183136463165283, 0.27215591073036194, 0.020924024283885956, 0.03270827978849411, 0.056745365262031555, -0.14462020993232727, 0.12292782962322235, -0.24000754952430725, 0.147347554564476, 0.4070994257926941, 0.2802129089832306, 0.08324094861745834, -0.17698591947555542, -0.03167227283120155, 0.13094188272953033, -0.0826028436422348, -0.2602497339248657, 0.28847265243530273, 0.05318643897771835, -0.39021438360214233, -0.25396913290023804, 0.010516196489334106, -0.250701367855072, -0.06606036424636841, 0.4123232364654541, 0.07801241427659988, 0.2456803321838379, 0.16989725828170776, 0.04279639571905136, -0.2895328998565674, 0.4310108423233032, 0.25519415736198425, 0.2772292494773865, -0.5120605230331421, -0.11491222679615021, -0.3112878203392029, 0.11089342087507248, -0.36213916540145874, 0.03549609333276749, 0.199350968003273, 0.0729064792394638, -0.14432817697525024, 0.11744127422571182, 0.24190343916416168, 0.27480921149253845, 0.35398057103157043, 0.165370374917984, -0.14194153249263763, -0.4123852252960205, 0.07853980362415314, -0.12405794858932495, 0.003536362200975418, -0.5456081628799438, 0.2555713951587677, -0.206376850605011, 0.008678007870912552, -0.19115620851516724, 0.009041540324687958, 0.01849699392914772, -0.05934974551200867, 0.3211500644683838, 0.24234360456466675, 0.5917177200317383, -0.010546587407588959, -0.01108473353087902, 0.2435409426689148, -0.14336103200912476, -0.10123249143362045, 0.28801119327545166, 0.10816340148448944, 0.3745174705982208, -0.03582605719566345, -0.07707174122333527, -0.22778986394405365, 0.185454323887825, -0.020570972934365273, -0.5014035105705261, 0.042701348662376404, -0.20563317835330963, -0.12497760355472565, 0.08245635777711868, 0.06540284305810928, 0.2370987832546234, 0.010593399405479431, 0.27219390869140625, -0.13509312272071838, -0.1335953176021576, 0.3531579077243805, 0.08318223059177399, -0.37515121698379517, 0.006107374094426632, 0.5184326767921448, 0.09052176028490067, -0.11257920414209366, -0.4577998220920563, 0.13875994086265564, 0.39225977659225464, -0.04285239428281784, -0.18254472315311432, 0.3959064483642578, 0.029019055888056755, 0.09268586337566376, -0.060140062123537064, 0.5353975892066956, -0.03100498393177986, -0.18696334958076477, 0.1814294308423996, -0.15507301688194275 ]
https://github.com/huggingface/datasets/issues/6007
Get an error "OverflowError: Python int too large to convert to C long" when loading a large dataset
May be something read your training data line by line. Then your training data just only one line. It is so large. I guess.
### Describe the bug When load a large dataset with the following code ```python from datasets import load_dataset dataset = load_dataset("liwu/MNBVC", 'news_peoples_daily', split='train') ``` We encountered the error: "OverflowError: Python int too large to convert to C long" The error look something like: ``` OverflowError: Python int too large to convert to C long During handling of the above exception, another exception occurred: OverflowError Traceback (most recent call last) <ipython-input-7-0ed8700e662d> in <module> ----> 1 dataset = load_dataset("liwu/MNBVC", 'news_peoples_daily', split='train', cache_dir='/sfs/MNBVC/.cache/') /sfs/MNBVC/venv/lib64/python3.6/site-packages/datasets/load.py in load_dataset(path, name, data_dir, data_files, split, cache_dir, features, download_config, download_mode, ignore_verifications, keep_in_memory, save_infos, revision, use_auth_token, task, streaming, **config_kwargs) 1749 ignore_verifications=ignore_verifications, 1750 try_from_hf_gcs=try_from_hf_gcs, -> 1751 use_auth_token=use_auth_token, 1752 ) 1753 /sfs/MNBVC/venv/lib64/python3.6/site-packages/datasets/builder.py in download_and_prepare(self, download_config, download_mode, ignore_verifications, try_from_hf_gcs, dl_manager, base_path, use_auth_token, **download_and_prepare_kwargs) 703 if not downloaded_from_gcs: 704 self._download_and_prepare( --> 705 dl_manager=dl_manager, verify_infos=verify_infos, **download_and_prepare_kwargs 706 ) 707 # Sync info /sfs/MNBVC/venv/lib64/python3.6/site-packages/datasets/builder.py in _download_and_prepare(self, dl_manager, verify_infos) 1225 1226 def _download_and_prepare(self, dl_manager, verify_infos): -> 1227 super()._download_and_prepare(dl_manager, verify_infos, check_duplicate_keys=verify_infos) 1228 1229 def _get_examples_iterable_for_split(self, split_generator: SplitGenerator) -> ExamplesIterable: /sfs/MNBVC/venv/lib64/python3.6/site-packages/datasets/builder.py in _download_and_prepare(self, dl_manager, verify_infos, **prepare_split_kwargs) 791 try: 792 # Prepare split will record examples associated to the split --> 793 self._prepare_split(split_generator, **prepare_split_kwargs) 794 except OSError as e: 795 raise OSError( /sfs/MNBVC/venv/lib64/python3.6/site-packages/datasets/builder.py in _prepare_split(self, split_generator, check_duplicate_keys) 1219 writer.write(example, key) 1220 finally: -> 1221 num_examples, num_bytes = writer.finalize() 1222 1223 split_generator.split_info.num_examples = num_examples /sfs/MNBVC/venv/lib64/python3.6/site-packages/datasets/arrow_writer.py in finalize(self, close_stream) 536 # Re-intializing to empty list for next batch 537 self.hkey_record = [] --> 538 self.write_examples_on_file() 539 if self.pa_writer is None: 540 if self.schema: /sfs/MNBVC/venv/lib64/python3.6/site-packages/datasets/arrow_writer.py in write_examples_on_file(self) 407 # Since current_examples contains (example, key) tuples 408 batch_examples[col] = [row[0][col] for row in self.current_examples] --> 409 self.write_batch(batch_examples=batch_examples) 410 self.current_examples = [] 411 /sfs/MNBVC/venv/lib64/python3.6/site-packages/datasets/arrow_writer.py in write_batch(self, batch_examples, writer_batch_size) 506 col_try_type = try_features[col] if try_features is not None and col in try_features else None 507 typed_sequence = OptimizedTypedSequence(batch_examples[col], type=col_type, try_type=col_try_type, col=col) --> 508 arrays.append(pa.array(typed_sequence)) 509 inferred_features[col] = typed_sequence.get_inferred_type() 510 schema = inferred_features.arrow_schema if self.pa_writer is None else self.schema /sfs/MNBVC/venv/lib64/python3.6/site-packages/pyarrow/array.pxi in pyarrow.lib.array() /sfs/MNBVC/venv/lib64/python3.6/site-packages/pyarrow/array.pxi in pyarrow.lib._handle_arrow_array_protocol() /sfs/MNBVC/venv/lib64/python3.6/site-packages/datasets/arrow_writer.py in __arrow_array__(self, type) 180 else: 181 trying_cast_to_python_objects = True --> 182 out = pa.array(cast_to_python_objects(data, only_1d_for_numpy=True)) 183 # use smaller integer precisions if possible 184 if self.trying_int_optimization: /sfs/MNBVC/venv/lib64/python3.6/site-packages/pyarrow/array.pxi in pyarrow.lib.array() /sfs/MNBVC/venv/lib64/python3.6/site-packages/pyarrow/array.pxi in pyarrow.lib._sequence_to_array() /sfs/MNBVC/venv/lib64/python3.6/site-packages/pyarrow/error.pxi in pyarrow.lib.pyarrow_internal_check_status() OverflowError: Python int too large to convert to C long ``` However, that dataset can be loaded in a streaming manner: ```python from datasets import load_dataset dataset = load_dataset("liwu/MNBVC", 'news_peoples_daily', split='train', streaming=True) for i in dataset: pass # it work well ``` Another issue is reported in our dataset hub: https://huggingface.co/datasets/liwu/MNBVC/discussions/2 ### Steps to reproduce the bug from datasets import load_dataset dataset = load_dataset("liwu/MNBVC", 'news_peoples_daily', split='train') ### Expected behavior the dataset can be safely loaded ### Environment info - `datasets` version: 2.4.0 - Platform: Linux-3.10.0-1160.an7.x86_64-x86_64-with-centos-7.9 - Python version: 3.6.8 - PyArrow version: 6.0.1 - Pandas version: 1.1.5
24
Get an error "OverflowError: Python int too large to convert to C long" when loading a large dataset ### Describe the bug When load a large dataset with the following code ```python from datasets import load_dataset dataset = load_dataset("liwu/MNBVC", 'news_peoples_daily', split='train') ``` We encountered the error: "OverflowError: Python int too large to convert to C long" The error look something like: ``` OverflowError: Python int too large to convert to C long During handling of the above exception, another exception occurred: OverflowError Traceback (most recent call last) <ipython-input-7-0ed8700e662d> in <module> ----> 1 dataset = load_dataset("liwu/MNBVC", 'news_peoples_daily', split='train', cache_dir='/sfs/MNBVC/.cache/') /sfs/MNBVC/venv/lib64/python3.6/site-packages/datasets/load.py in load_dataset(path, name, data_dir, data_files, split, cache_dir, features, download_config, download_mode, ignore_verifications, keep_in_memory, save_infos, revision, use_auth_token, task, streaming, **config_kwargs) 1749 ignore_verifications=ignore_verifications, 1750 try_from_hf_gcs=try_from_hf_gcs, -> 1751 use_auth_token=use_auth_token, 1752 ) 1753 /sfs/MNBVC/venv/lib64/python3.6/site-packages/datasets/builder.py in download_and_prepare(self, download_config, download_mode, ignore_verifications, try_from_hf_gcs, dl_manager, base_path, use_auth_token, **download_and_prepare_kwargs) 703 if not downloaded_from_gcs: 704 self._download_and_prepare( --> 705 dl_manager=dl_manager, verify_infos=verify_infos, **download_and_prepare_kwargs 706 ) 707 # Sync info /sfs/MNBVC/venv/lib64/python3.6/site-packages/datasets/builder.py in _download_and_prepare(self, dl_manager, verify_infos) 1225 1226 def _download_and_prepare(self, dl_manager, verify_infos): -> 1227 super()._download_and_prepare(dl_manager, verify_infos, check_duplicate_keys=verify_infos) 1228 1229 def _get_examples_iterable_for_split(self, split_generator: SplitGenerator) -> ExamplesIterable: /sfs/MNBVC/venv/lib64/python3.6/site-packages/datasets/builder.py in _download_and_prepare(self, dl_manager, verify_infos, **prepare_split_kwargs) 791 try: 792 # Prepare split will record examples associated to the split --> 793 self._prepare_split(split_generator, **prepare_split_kwargs) 794 except OSError as e: 795 raise OSError( /sfs/MNBVC/venv/lib64/python3.6/site-packages/datasets/builder.py in _prepare_split(self, split_generator, check_duplicate_keys) 1219 writer.write(example, key) 1220 finally: -> 1221 num_examples, num_bytes = writer.finalize() 1222 1223 split_generator.split_info.num_examples = num_examples /sfs/MNBVC/venv/lib64/python3.6/site-packages/datasets/arrow_writer.py in finalize(self, close_stream) 536 # Re-intializing to empty list for next batch 537 self.hkey_record = [] --> 538 self.write_examples_on_file() 539 if self.pa_writer is None: 540 if self.schema: /sfs/MNBVC/venv/lib64/python3.6/site-packages/datasets/arrow_writer.py in write_examples_on_file(self) 407 # Since current_examples contains (example, key) tuples 408 batch_examples[col] = [row[0][col] for row in self.current_examples] --> 409 self.write_batch(batch_examples=batch_examples) 410 self.current_examples = [] 411 /sfs/MNBVC/venv/lib64/python3.6/site-packages/datasets/arrow_writer.py in write_batch(self, batch_examples, writer_batch_size) 506 col_try_type = try_features[col] if try_features is not None and col in try_features else None 507 typed_sequence = OptimizedTypedSequence(batch_examples[col], type=col_type, try_type=col_try_type, col=col) --> 508 arrays.append(pa.array(typed_sequence)) 509 inferred_features[col] = typed_sequence.get_inferred_type() 510 schema = inferred_features.arrow_schema if self.pa_writer is None else self.schema /sfs/MNBVC/venv/lib64/python3.6/site-packages/pyarrow/array.pxi in pyarrow.lib.array() /sfs/MNBVC/venv/lib64/python3.6/site-packages/pyarrow/array.pxi in pyarrow.lib._handle_arrow_array_protocol() /sfs/MNBVC/venv/lib64/python3.6/site-packages/datasets/arrow_writer.py in __arrow_array__(self, type) 180 else: 181 trying_cast_to_python_objects = True --> 182 out = pa.array(cast_to_python_objects(data, only_1d_for_numpy=True)) 183 # use smaller integer precisions if possible 184 if self.trying_int_optimization: /sfs/MNBVC/venv/lib64/python3.6/site-packages/pyarrow/array.pxi in pyarrow.lib.array() /sfs/MNBVC/venv/lib64/python3.6/site-packages/pyarrow/array.pxi in pyarrow.lib._sequence_to_array() /sfs/MNBVC/venv/lib64/python3.6/site-packages/pyarrow/error.pxi in pyarrow.lib.pyarrow_internal_check_status() OverflowError: Python int too large to convert to C long ``` However, that dataset can be loaded in a streaming manner: ```python from datasets import load_dataset dataset = load_dataset("liwu/MNBVC", 'news_peoples_daily', split='train', streaming=True) for i in dataset: pass # it work well ``` Another issue is reported in our dataset hub: https://huggingface.co/datasets/liwu/MNBVC/discussions/2 ### Steps to reproduce the bug from datasets import load_dataset dataset = load_dataset("liwu/MNBVC", 'news_peoples_daily', split='train') ### Expected behavior the dataset can be safely loaded ### Environment info - `datasets` version: 2.4.0 - Platform: Linux-3.10.0-1160.an7.x86_64-x86_64-with-centos-7.9 - Python version: 3.6.8 - PyArrow version: 6.0.1 - Pandas version: 1.1.5 May be something read your training data line by line. Then your training data just only one line. It is so large. I guess.
[ -0.42730045318603516, -0.3950994908809662, -0.02665611356496811, 0.3553202748298645, 0.3509588837623596, -0.004374183714389801, 0.10522277653217316, 0.331129789352417, 0.31195196509361267, 0.1922844648361206, -0.027331490069627762, 0.16219580173492432, -0.11134413629770279, 0.08958712965250015, -0.2046218365430832, -0.1775018572807312, 0.1220521628856659, -0.17765238881111145, -0.25584712624549866, 0.18601104617118835, -0.3780885636806488, -0.07006936520338058, -0.17661845684051514, 0.048064276576042175, -0.23183873295783997, -0.21604019403457642, 0.12426722049713135, 0.36674559116363525, -0.2756235599517822, -0.3445779085159302, 0.0034113675355911255, -0.3893600404262543, 0.35168981552124023, 0.4516564607620239, -0.00011814466415671632, -0.18242916464805603, 0.11768415570259094, -0.042029090225696564, -0.32315704226493835, 0.09475971758365631, -0.039298251271247864, -0.5150787830352783, -0.006220826879143715, -0.45916715264320374, 0.16284555196762085, -0.05158706381917, -0.17475268244743347, -0.08125865459442139, 0.18807296454906464, 0.5761505961418152, 0.19275711476802826, 0.055086515843868256, 0.38476377725601196, 0.06680193543434143, 0.22039756178855896, -0.03740207850933075, -0.06243707239627838, 0.4031565189361572, 0.2108921855688095, 0.22969180345535278, -0.028704509139060974, -0.06308931857347488, -0.1489473581314087, -0.18602950870990753, 0.11887466907501221, -0.16871783137321472, 0.0570891909301281, -0.19999699294567108, 0.007225114852190018, -0.00796797126531601, 0.10818733274936676, -0.08280960470438004, -0.10172402858734131, -0.04120077192783356, 0.04498547315597534, -0.4488227963447571, -0.10353534668684006, 0.19530950486660004, 0.006717499345541, 0.08620800077915192, -0.18851512670516968, -0.2502252757549286, -0.2554998993873596, 0.2120245397090912, -0.32102394104003906, -0.11662086844444275, -0.14016851782798767, 0.21713149547576904, 0.21627303957939148, -0.18306414783000946, 0.017507245764136314, -0.024290628731250763, 0.03425518423318863, 0.18231849372386932, -0.3292953372001648, -0.1898389309644699, 0.003925345838069916, 0.10165248066186905, 0.2865700423717499, -0.04653023183345795, 0.06803923845291138, -0.018249500542879105, -0.11352144926786423, 0.14824597537517548, 0.18170928955078125, 0.1451261043548584, -0.6392795443534851, 0.4040762484073639, 0.3212814927101135, -0.02512778528034687, -0.1858256608247757, -0.08128379285335541, -0.04995885491371155, -0.306194007396698, 0.2521118223667145, 0.10100943595170975, 0.3818824291229248, -0.3228907883167267, -0.41205209493637085, 0.14715653657913208, -0.21592304110527039, 0.28504449129104614, 0.28412044048309326, 0.34671279788017273, -0.09875354915857315, 0.23286649584770203, 0.07463964074850082, 0.08334185183048248, -0.23511558771133423, -0.20238308608531952, -0.15069420635700226, 0.10457052290439606, -0.07249986380338669, -0.04433203488588333, 0.0936983972787857, -0.07169461250305176, 0.17004035413265228, 0.28497105836868286, 0.18396618962287903, -0.33783644437789917, 0.005977662280201912, -0.4781578481197357, 0.03976692631840706, 0.08606648445129395, -0.07800450921058655, -0.11582841724157333, 0.37072739005088806, 0.15519371628761292, -0.1194450706243515, 0.3418324589729309, -0.5060864686965942, -0.3711854815483093, -0.18037086725234985, 0.1869175285100937, 0.014307916164398193, -0.01662929356098175, -0.26676449179649353, -0.17007222771644592, 0.21955472230911255, -0.18516604602336884, 0.21145731210708618, -0.4256848096847534, 0.2160862684249878, -0.16842709481716156, -0.04905072972178459, 0.17450213432312012, -0.2994723916053772, 0.25893083214759827, -0.01978052407503128, 0.19197964668273926, 0.41219577193260193, 0.5086793899536133, -0.18264180421829224, -0.033356644213199615, -0.3783024847507477, -0.33097341656684875, 0.3757345378398895, -0.18065184354782104, -0.43467360734939575, 0.4298314154148102, -0.04181225225329399, -0.04125894606113434, -0.14741253852844238, 0.10902555286884308, 0.18719500303268433, -0.0816936120390892, 0.19337141513824463, 0.40117591619491577, -0.2251415252685547, 0.1918102353811264, -0.4496757984161377, -0.2674904465675354, 0.24783213436603546, 0.1967029720544815, 0.17562878131866455, -0.06670371443033218, 0.21777880191802979, -0.07312412559986115, 0.2588134706020355, -0.06310270726680756, -0.22276179492473602, 0.2580525279045105, 0.11467486619949341, 0.13091275095939636, -0.21843716502189636, -0.2864813506603241, 0.010846499353647232, -0.02313442900776863, -0.010160811245441437, -0.16320107877254486, 0.09471727907657623, -0.15478797256946564, -0.51869136095047, 0.23062573373317719, 0.07093244045972824, 0.3605084717273712, 0.04756245017051697, 0.018511291593313217, 0.16914500296115875, -0.06382670253515244, 0.1751853972673416, 0.45256394147872925, -0.434812992811203, 0.005193493328988552, -0.07389724254608154, 0.14947402477264404, -0.13532640039920807, -0.1558477133512497, 0.026621952652931213, 0.12149637192487717, 0.3321802616119385, -0.03791804984211922, -0.3654502332210541, 0.18011757731437683, -0.009776225313544273, -0.29486942291259766, -0.3651312291622162, -0.2157198041677475, 0.22062039375305176, -0.3945513963699341, 0.29898008704185486, 0.19280105829238892, 0.24524268507957458, -0.047357313334941864, 0.04771691560745239, 0.2859414219856262, -0.3086586892604828, 0.12132122367620468, 0.09259235858917236, -0.041770800948143005, 0.3189939856529236, -0.12412536144256592, 0.20322884619235992, 0.007417544722557068, 0.0014881305396556854, 0.19949939846992493, 0.15952810645103455, -0.05024313926696777, -0.2033296376466751, -0.13109645247459412, 0.6715540289878845, -0.06587813794612885, 0.10676909983158112, 0.2518104910850525, -0.20792314410209656, -0.03859367221593857, 0.06895805150270462, -0.21736617386341095, 0.5505901575088501, 0.3331361413002014, -0.08229184150695801, -0.06867225468158722, 0.014712135307490826, -0.09951192140579224, 0.2664300203323364, 0.16960284113883972, 0.32267507910728455, 0.15934407711029053, 0.4819996654987335, -0.04444257169961929, -0.20974647998809814, -0.27626344561576843, 0.04477187991142273, 0.26742932200431824, -0.3840709626674652, 0.38414156436920166, -0.0696205198764801, -0.2515539824962616, -0.17747272551059723, -0.2844955027103424, 0.004043798893690109, -0.33593153953552246, -0.33264684677124023, 0.4384606182575226, 0.01700320839881897, -0.07723640650510788, -0.22626927495002747, 0.062228694558143616, 0.3358646631240845, -0.27092087268829346, 0.17083531618118286, 0.05200768634676933, -0.2650725543498993, 0.011704675853252411, 0.4868507385253906, -0.2440004050731659, 0.3427879512310028, 0.12019755691289902, -0.1655244529247284, -0.03905197232961655, -0.20386990904808044, -0.1234484612941742, 0.0991927981376648, 0.16942739486694336, -0.030192866921424866, 0.3613826036453247, -0.21136347949504852, -0.16740255057811737, 0.010533466003835201, 0.04331997036933899, 0.0594557449221611, 0.1659039556980133, -0.10908263921737671, 0.1439702957868576, -0.03303379938006401, -0.2585492730140686, -0.44593361020088196, -0.5692219138145447, 0.10587580502033234, 0.059380244463682175, 0.13857056200504303, 0.25813671946525574, 0.1298876702785492, 0.2472284734249115, 0.34788572788238525, -0.11012277007102966, -0.3189486563205719, -0.13861893117427826, 0.35731738805770874, -0.17738893628120422, -0.19554027915000916, 0.1069212406873703, -0.024517707526683807, -0.047351155430078506, 0.14091236889362335, -0.4079741835594177, 0.1772587150335312, -0.42272523045539856, 0.46870070695877075, -0.4635942578315735, -0.04442131519317627, 0.1144370436668396, -0.21715916693210602, 0.010356130078434944, 0.12779727578163147, 0.09290255606174469, -0.12362018972635269, 0.14443951845169067, 0.49612289667129517, -0.25444239377975464, 0.44793447852134705, -0.16753025352954865, 0.5885943174362183, 0.17588989436626434, 0.05358100309967995, 0.3482431471347809, 0.021755538880825043, 0.01447666808962822, -0.21496406197547913, -0.37185582518577576, 0.06305868923664093, -0.22956803441047668, -0.1729588508605957, 0.06716443598270416, -0.08266009390354156, -0.07205028086900711, 0.12978999316692352, -0.2179080694913864, -0.05128931254148483, -0.2240113615989685, 0.20996160805225372, -0.09039054811000824, 0.17387999594211578, -0.14571210741996765, -0.09767287969589233, -0.2475629448890686, -0.23845559358596802, -0.1726536750793457, 0.17912964522838593, 0.018602490425109863, 0.04128723964095116, 0.10141374170780182, -0.16951853036880493, -0.2960941195487976, 0.2517765760421753, -0.02027714252471924, 0.3787272572517395, 0.003271874040365219, 0.03430300951004028, -0.09064504504203796, -0.09841862320899963, 0.4456343650817871, 0.28611254692077637, 0.07992543280124664, 0.09266795217990875, 0.17231769859790802, -0.4492839276790619, -0.076456218957901, -0.10963420569896698, 0.3906116783618927, 0.5413093566894531, 0.3065812587738037, -0.2116076648235321, 0.14862775802612305, 0.6596485376358032, 0.4045993685722351, -0.03348797559738159, -0.1579154133796692, -0.282257616519928, -0.38411980867385864, -0.29867851734161377, 0.24832361936569214, 0.2736555337905884, 0.27473756670951843, -0.2445584237575531, -0.28429844975471497, -0.2872462868690491, -0.0773293599486351, 0.020731396973133087, -0.10377262532711029, 0.2474452257156372, -0.2777171730995178, 0.1813603639602661, -0.43756192922592163, 0.23997774720191956, 0.24989573657512665, 0.5667697787284851, 0.07643535733222961, -0.4990854263305664, 0.1059616282582283, 0.120084747672081, 0.30827513337135315, 0.09950698167085648, -0.1307036429643631, 0.22553041577339172, -0.09968683868646622, 0.44804614782333374, -0.07788205146789551, 0.5246808528900146, -0.14827927947044373, 0.22094689309597015, -0.34291067719459534, -0.19213396310806274, 0.547170877456665, 0.1663152426481247, 0.19766582548618317, 0.3111850619316101, 0.026270408183336258, -0.3059810400009155, 0.3107355833053589, -0.16278767585754395, 0.8497914671897888, 0.06669555604457855, -0.06066598370671272, 0.38529133796691895, -0.03204647824168205, 0.2201925814151764, -0.00027794018387794495, 0.13152961432933807, -0.37022724747657776, -0.027098488062620163, 0.18778760731220245, -0.13702905178070068, 0.06583811342716217, -0.18384596705436707, -0.28570640087127686, 0.2849735617637634, -0.2500235438346863, -0.09471683204174042, -0.04896274954080582, 0.3314095735549927, -0.37765559554100037, 0.007667003199458122, -0.2876814603805542, 0.15929317474365234, -0.38668298721313477, -0.053935494273900986, -0.08390773087739944, 0.04848698154091835, -0.08806009590625763, -0.15772201120853424, -0.24220161139965057, 0.08613095432519913, -0.2848759591579437, 0.3731246590614319, -0.2572709918022156, -0.29216790199279785, 0.5167397260665894, -0.09814170002937317, 0.08122798800468445, 0.29140427708625793, -0.06481871753931046, 0.034971725195646286, -0.14759615063667297, -0.18979187309741974, 0.05812549218535423, 0.17811043560504913, 0.10609754920005798, -0.020049842074513435, -0.2854974865913391, 0.04728515446186066, -0.05922948196530342, -0.16250252723693848, 0.024472326040267944, 0.10543470829725266, 0.5009015798568726, -0.48849254846572876, -0.32759889960289, -0.24513548612594604, -0.09851664304733276, -0.2617266774177551, 0.11408805847167969, -0.06117524206638336, -0.13015489280223846, 0.2037440836429596, 0.22624093294143677, -0.4189797341823578, -0.10186879336833954, 0.17977853119373322, -0.0036855190992355347, -0.12414667755365372, 0.47180846333503723, 0.1788039356470108, -0.19214396178722382, -0.13290202617645264, 0.3621409833431244, -0.1984470933675766, -0.38313984870910645, 0.2497865855693817, -0.08816082775592804, 0.3134532570838928, 0.049364469945430756, 0.1648942530155182, 0.12852762639522552, -0.02610381692647934, -0.055564820766448975, -0.47899386286735535, -0.6197270750999451, 0.020489759743213654, -0.17898087203502655, 0.07164382934570312, 0.22576233744621277, 0.11449176073074341, -0.3802782893180847, 0.06096949428319931, -0.24993325769901276, 0.11757151782512665, -0.0940813273191452, 0.10025616735219955, 0.1581793874502182, -0.285672664642334, -0.1549951136112213, 0.08355088531970978, 0.14725881814956665, 0.3399650454521179, 0.20342303812503815, -0.22011911869049072, -0.18029530346393585, 0.12341981381177902, -0.006576646119356155, -0.3159588873386383, -0.08770573139190674, -0.28387194871902466, 0.037396859377622604, -0.03816695511341095, 0.10210222005844116, 0.11634885519742966, 0.07618573307991028, 0.02099715918302536, -0.24134309589862823, 0.0034297481179237366, -0.12185151129961014, 0.19924387335777283, 0.13464704155921936, 0.4082373380661011, 0.19386886060237885, 0.5115569829940796, 0.24224495887756348, -0.04629679024219513, -0.43919476866722107, -0.008643358945846558, 0.3187031149864197, 0.03648817911744118, 0.3426598310470581, -0.2697684168815613, 0.07568514347076416, 0.16929204761981964, -0.23282288014888763, 0.22913405299186707, -0.25543516874313354, -0.09877418726682663, 0.26777660846710205, 0.16084587574005127, -0.17872226238250732, 0.13948845863342285, 0.15855363011360168, -0.3148189187049866, -0.023261284455657005, 0.2851652204990387, -0.20909349620342255, -0.1405559629201889, -0.27613288164138794, -0.02294502966105938, 0.21735170483589172, 0.2729935050010681, 0.002375860931351781, 0.4859406054019928, -0.044278278946876526, -0.21067754924297333, 0.39080774784088135, 0.16114452481269836, 0.3288120925426483, 0.8358757495880127, -0.2156842052936554, 0.133271723985672, -0.2734277546405792, 0.04166405647993088, -0.014557689428329468, -0.3601619005203247, -0.033477526158094406, 0.28801143169403076, -0.2637088894844055, 0.27294921875, 0.020296543836593628, 0.20703613758087158, -0.26228877902030945, -0.07231521606445312, -0.173462375998497, 0.2326335906982422, -0.31068432331085205, 0.10655294358730316, 0.20396822690963745, 0.08397028595209122, -0.03519570454955101, 0.21060211956501007, -0.15057437121868134, -0.04050738364458084, 0.10409249365329742, 0.3406962752342224, -0.20162175595760345, -0.271628737449646, 0.2608352601528168, 0.4320448040962219, 0.08981703221797943, -0.4641041159629822, 0.12155914306640625, 0.2563055753707886, 0.00421489030122757, -0.1815425306558609, -0.11361978203058243, 0.5183136463165283, 0.27215591073036194, 0.020924024283885956, 0.03270827978849411, 0.056745365262031555, -0.14462020993232727, 0.12292782962322235, -0.24000754952430725, 0.147347554564476, 0.4070994257926941, 0.2802129089832306, 0.08324094861745834, -0.17698591947555542, -0.03167227283120155, 0.13094188272953033, -0.0826028436422348, -0.2602497339248657, 0.28847265243530273, 0.05318643897771835, -0.39021438360214233, -0.25396913290023804, 0.010516196489334106, -0.250701367855072, -0.06606036424636841, 0.4123232364654541, 0.07801241427659988, 0.2456803321838379, 0.16989725828170776, 0.04279639571905136, -0.2895328998565674, 0.4310108423233032, 0.25519415736198425, 0.2772292494773865, -0.5120605230331421, -0.11491222679615021, -0.3112878203392029, 0.11089342087507248, -0.36213916540145874, 0.03549609333276749, 0.199350968003273, 0.0729064792394638, -0.14432817697525024, 0.11744127422571182, 0.24190343916416168, 0.27480921149253845, 0.35398057103157043, 0.165370374917984, -0.14194153249263763, -0.4123852252960205, 0.07853980362415314, -0.12405794858932495, 0.003536362200975418, -0.5456081628799438, 0.2555713951587677, -0.206376850605011, 0.008678007870912552, -0.19115620851516724, 0.009041540324687958, 0.01849699392914772, -0.05934974551200867, 0.3211500644683838, 0.24234360456466675, 0.5917177200317383, -0.010546587407588959, -0.01108473353087902, 0.2435409426689148, -0.14336103200912476, -0.10123249143362045, 0.28801119327545166, 0.10816340148448944, 0.3745174705982208, -0.03582605719566345, -0.07707174122333527, -0.22778986394405365, 0.185454323887825, -0.020570972934365273, -0.5014035105705261, 0.042701348662376404, -0.20563317835330963, -0.12497760355472565, 0.08245635777711868, 0.06540284305810928, 0.2370987832546234, 0.010593399405479431, 0.27219390869140625, -0.13509312272071838, -0.1335953176021576, 0.3531579077243805, 0.08318223059177399, -0.37515121698379517, 0.006107374094426632, 0.5184326767921448, 0.09052176028490067, -0.11257920414209366, -0.4577998220920563, 0.13875994086265564, 0.39225977659225464, -0.04285239428281784, -0.18254472315311432, 0.3959064483642578, 0.029019055888056755, 0.09268586337566376, -0.060140062123537064, 0.5353975892066956, -0.03100498393177986, -0.18696334958076477, 0.1814294308423996, -0.15507301688194275 ]
https://github.com/huggingface/datasets/issues/5997
extend the map function so it can wrap around long text that does not fit in the context window
I just noticed the [docs](https://github.com/huggingface/datasets/blob/main/src/datasets/arrow_dataset.py#L2881C11-L2881C200) say: >If batched is `True` and `batch_size` is `n > 1`, then the function takes a batch of `n` examples as input and can return a batch with `n` examples, or with an arbitrary number of examples. so maybe this is a bug then.
### Feature request I understand `dataset` provides a [`map`](https://github.com/huggingface/datasets/blob/main/src/datasets/arrow_dataset.py#L2849) function. This function in turn takes in a callable that is used to tokenize the text on which a model is trained. Frequently this text will not fit within a models's context window. In this case it would be useful to wrap around the text into multiple rows with each row fitting the model's context window. I tried to do it using this code as example which in turn I have borrowed from [here](https://stackoverflow.com/a/76343993/147530): ``` data = data.map(lambda samples: tokenizer(samples["text"], max_length=tokenizer.model_max_length, truncation=True, stride=4, return_overflowing_tokens=True), batched=True) ``` but running the code gives me this error: ``` File "/llm/fine-tune.py", line 117, in <module> data = data.map(lambda samples: tokenizer(samples["text"], max_length=tokenizer.model_max_length, truncation=True, stride=4, return_overflowing_tokens=True), batched=True) File "/llm/.env/lib/python3.9/site-packages/datasets/arrow_dataset.py", line 580, in wrapper out: Union["Dataset", "DatasetDict"] = func(self, *args, **kwargs) File "/llm/.env/lib/python3.9/site-packages/datasets/arrow_dataset.py", line 545, in wrapper out: Union["Dataset", "DatasetDict"] = func(self, *args, **kwargs) File "/llm/.env/lib/python3.9/site-packages/datasets/arrow_dataset.py", line 3087, in map for rank, done, content in Dataset._map_single(**dataset_kwargs): File "/llm/.env/lib/python3.9/site-packages/datasets/arrow_dataset.py", line 3480, in _map_single writer.write_batch(batch) File "/llm/.env/lib/python3.9/site-packages/datasets/arrow_writer.py", line 556, in write_batch pa_table = pa.Table.from_arrays(arrays, schema=schema) File "pyarrow/table.pxi", line 3798, in pyarrow.lib.Table.from_arrays File "pyarrow/table.pxi", line 2962, in pyarrow.lib.Table.validate File "pyarrow/error.pxi", line 100, in pyarrow.lib.check_status pyarrow.lib.ArrowInvalid: Column 1 named input_ids expected length 394 but got length 447 ``` The lambda function I have provided is correctly chopping up long text so it wraps around (and because of this 394 samples become 447 after wrap around) but the dataset `map` function does not like it. ### Motivation please see above ### Your contribution I'm afraid I don't have much knowledge to help
49
extend the map function so it can wrap around long text that does not fit in the context window ### Feature request I understand `dataset` provides a [`map`](https://github.com/huggingface/datasets/blob/main/src/datasets/arrow_dataset.py#L2849) function. This function in turn takes in a callable that is used to tokenize the text on which a model is trained. Frequently this text will not fit within a models's context window. In this case it would be useful to wrap around the text into multiple rows with each row fitting the model's context window. I tried to do it using this code as example which in turn I have borrowed from [here](https://stackoverflow.com/a/76343993/147530): ``` data = data.map(lambda samples: tokenizer(samples["text"], max_length=tokenizer.model_max_length, truncation=True, stride=4, return_overflowing_tokens=True), batched=True) ``` but running the code gives me this error: ``` File "/llm/fine-tune.py", line 117, in <module> data = data.map(lambda samples: tokenizer(samples["text"], max_length=tokenizer.model_max_length, truncation=True, stride=4, return_overflowing_tokens=True), batched=True) File "/llm/.env/lib/python3.9/site-packages/datasets/arrow_dataset.py", line 580, in wrapper out: Union["Dataset", "DatasetDict"] = func(self, *args, **kwargs) File "/llm/.env/lib/python3.9/site-packages/datasets/arrow_dataset.py", line 545, in wrapper out: Union["Dataset", "DatasetDict"] = func(self, *args, **kwargs) File "/llm/.env/lib/python3.9/site-packages/datasets/arrow_dataset.py", line 3087, in map for rank, done, content in Dataset._map_single(**dataset_kwargs): File "/llm/.env/lib/python3.9/site-packages/datasets/arrow_dataset.py", line 3480, in _map_single writer.write_batch(batch) File "/llm/.env/lib/python3.9/site-packages/datasets/arrow_writer.py", line 556, in write_batch pa_table = pa.Table.from_arrays(arrays, schema=schema) File "pyarrow/table.pxi", line 3798, in pyarrow.lib.Table.from_arrays File "pyarrow/table.pxi", line 2962, in pyarrow.lib.Table.validate File "pyarrow/error.pxi", line 100, in pyarrow.lib.check_status pyarrow.lib.ArrowInvalid: Column 1 named input_ids expected length 394 but got length 447 ``` The lambda function I have provided is correctly chopping up long text so it wraps around (and because of this 394 samples become 447 after wrap around) but the dataset `map` function does not like it. ### Motivation please see above ### Your contribution I'm afraid I don't have much knowledge to help I just noticed the [docs](https://github.com/huggingface/datasets/blob/main/src/datasets/arrow_dataset.py#L2881C11-L2881C200) say: >If batched is `True` and `batch_size` is `n > 1`, then the function takes a batch of `n` examples as input and can return a batch with `n` examples, or with an arbitrary number of examples. so maybe this is a bug then.
[ -0.3404633402824402, 0.035428255796432495, -0.08898572623729706, 0.043310217559337616, 0.17575743794441223, -0.049312230199575424, 0.30036666989326477, 0.36894625425338745, -0.09006552398204803, -0.17397652566432953, 0.09924719482660294, 0.5054343342781067, -0.03185432031750679, 0.32149383425712585, 0.11065218597650528, -0.3572513163089752, 0.09137875586748123, -0.08318603038787842, 0.41484829783439636, 0.30931514501571655, -0.35015037655830383, -0.08045720309019089, -0.3951624631881714, 0.1581752896308899, -0.12172611802816391, -0.2035406082868576, -0.28787994384765625, -0.37009385228157043, 0.07613256573677063, -0.21095050871372223, 0.004973236471414566, 0.10255713015794754, -0.1655050367116928, 0.257016658782959, -0.00011748912220355123, -0.190982386469841, -0.12051738798618317, -0.06064566224813461, 0.20487312972545624, -0.15861673653125763, 0.24906641244888306, -0.22372080385684967, -0.36132338643074036, -0.13529828190803528, 0.06681124120950699, -0.10928209125995636, -0.2433512955904007, -0.20687860250473022, 0.20258185267448425, 0.31924018263816833, 0.07839351892471313, 0.1494838148355484, 0.11391156911849976, -0.11100073903799057, 0.06787844002246857, 0.13695372641086578, 0.0511980801820755, 0.045679714530706406, 0.4494413435459137, -0.17819279432296753, -0.1050446406006813, 0.3481350541114807, -0.24123704433441162, -0.047522250562906265, 0.2019260823726654, -0.13029807806015015, -0.18552365899085999, -0.3786453306674957, -0.015575367957353592, 0.09814587235450745, 0.32770389318466187, -0.3860637843608856, -0.2718268036842346, -0.40748587250709534, 0.14553646743297577, -0.12824678421020508, -0.02961597591638565, 0.05700640380382538, 0.04083307087421417, 0.0796305388212204, -0.3519154191017151, -0.33039629459381104, -0.14965520799160004, 0.2792605757713318, -0.303865522146225, 0.2699803113937378, -0.011285598389804363, 0.3705306053161621, 0.15413272380828857, -0.27678990364074707, -0.09276019781827927, 0.031949903815984726, 0.0819268748164177, 0.278782457113266, -0.10765381157398224, -0.13869303464889526, 0.19040584564208984, 0.19666212797164917, 0.40852537751197815, 0.09637299925088882, -0.0729731023311615, 0.10346158593893051, 0.00860158633440733, -0.09260808676481247, 0.07116466760635376, -0.01517317071557045, 0.262451708316803, 0.37068963050842285, -0.09171472489833832, -0.25112849473953247, -0.023759067058563232, -0.03629177063703537, -0.06699828803539276, -0.2617032527923584, -0.3784729540348053, -0.004212735220789909, -0.010323930531740189, 0.398409903049469, 0.1197366937994957, -0.028970390558242798, -0.4952002763748169, 0.1421579271554947, 0.19884905219078064, 0.19346889853477478, 0.10586294531822205, -0.03845101594924927, 0.05717500299215317, 0.17932990193367004, 0.17043818533420563, -0.1749744564294815, -0.07210066169500351, -0.03683425858616829, -0.04450768977403641, 0.11701057106256485, -0.043906304985284805, 0.13054530322551727, 0.11023867875337601, -0.2339380979537964, 0.06001492589712143, -0.1450650691986084, -0.36503031849861145, -0.08257237076759338, 0.08170582354068756, 0.10225386917591095, -0.2738770842552185, 0.08975275605916977, 0.13631941378116608, 0.1371951550245285, -0.11911443620920181, 0.08527666330337524, -0.24731823801994324, -0.2024703472852707, -0.08486124128103256, -0.01969839632511139, 0.03058721125125885, 0.22944025695323944, -0.036156781017780304, 0.4400523900985718, 0.3117678761482239, -0.26031389832496643, 0.4102972745895386, -0.150978222489357, -0.5485771894454956, -0.25987204909324646, 0.15054799616336823, 0.29924365878105164, -0.37419843673706055, -0.14816930890083313, 0.04471879079937935, 0.16440941393375397, -0.18171662092208862, 0.2643900215625763, -0.10530449450016022, 0.2594386339187622, -0.3027675747871399, 0.5635429620742798, 0.40210241079330444, -0.3849397897720337, -0.6354625821113586, 0.2609867751598358, -0.47289347648620605, -0.09041354060173035, -0.18840447068214417, -0.2228679209947586, 0.44145581126213074, 0.13902775943279266, 0.31493884325027466, 0.3012656569480896, -0.1226651668548584, -0.07793593406677246, 0.06015383079648018, -0.04622142016887665, 0.4465785026550293, 0.1373033970594406, -0.11783382296562195, -0.14681237936019897, -0.07267916947603226, -0.21498408913612366, 0.4182831645011902, 0.0029621534049510956, 0.33366337418556213, -0.0622982457280159, 0.22778229415416718, 0.11390700191259384, -0.03949929401278496, -0.4559001624584198, -0.16410425305366516, -0.12966954708099365, 0.12050500512123108, -0.05765794217586517, -0.4009089469909668, -0.315460741519928, 0.04485832154750824, 0.22018815577030182, 0.02433362975716591, -0.06482104957103729, -0.03241852670907974, -0.17037366330623627, 0.036544378846883774, -0.08307847380638123, 0.364768385887146, 0.027537688612937927, -0.05253526195883751, 0.2877940833568573, 0.11662578582763672, 0.08485765755176544, 0.20722609758377075, 0.0655045136809349, -0.13344669342041016, 0.17517498135566711, 0.21988865733146667, -0.07445242255926132, -0.09213338792324066, 0.4355398118495941, 0.11001215875148773, -0.11072169244289398, -0.5617769360542297, 0.01862521469593048, 0.14548859000205994, -0.17776665091514587, 0.109561987221241, 0.010065343230962753, -0.06271160393953323, -0.160072922706604, -0.21718242764472961, 0.3256163001060486, 0.3290832042694092, 0.5256913900375366, -0.22631655633449554, 0.3410674035549164, 0.0978015810251236, 0.051613714545965195, -0.1625584065914154, -0.2957461476325989, -0.06772814691066742, 0.176100954413414, 0.18836602568626404, -0.21864421665668488, 0.053303807973861694, 0.42098796367645264, 0.31095269322395325, -0.14626973867416382, 0.09390996396541595, 0.192674458026886, -0.22578978538513184, 0.06108624488115311, 0.254670649766922, -0.07445983588695526, 0.13948151469230652, 0.2595921754837036, -0.22253185510635376, 0.18089036643505096, 0.038381658494472504, 0.04513094201683998, 0.07933163642883301, 0.20589372515678406, 0.051004327833652496, 0.16269846260547638, 0.37886273860931396, -0.060028720647096634, -0.10357090830802917, -0.42567241191864014, 0.23824036121368408, 0.06449045240879059, -0.17320506274700165, 0.07763630151748657, -0.3611445426940918, -0.25288325548171997, -0.029945027083158493, -0.15476839244365692, 0.009838711470365524, -0.08103227615356445, -0.07115216553211212, 0.252302885055542, -0.24779047071933746, 0.414192259311676, 0.15440748631954193, 0.47492343187332153, 0.3921352028846741, -0.14865419268608093, 0.10203015804290771, -0.12295651435852051, 0.14213965833187103, -0.03261625021696091, 0.11930492520332336, -0.13123147189617157, 0.2022922933101654, 0.28139227628707886, 0.25295209884643555, -0.42269888520240784, -0.3874351680278778, 0.17516565322875977, -0.1679999977350235, 0.0354589968919754, 0.27332261204719543, -0.011810161173343658, -0.35483288764953613, -0.06292440742254257, 0.27059292793273926, 0.05246679484844208, -0.2039964646100998, -0.17524172365665436, 0.05253598093986511, -0.0038210502825677395, -0.0789795070886612, 0.14870135486125946, -0.24281899631023407, -0.5070274472236633, 0.7082015872001648, -0.09519334137439728, 0.1702631413936615, -0.0530119389295578, 0.29934796690940857, 0.09136997908353806, -0.07949365675449371, -0.290679931640625, -0.1596786081790924, 0.21359401941299438, 0.38422906398773193, -0.2740488052368164, 0.19754503667354584, -0.16936294734477997, -0.13298237323760986, 0.07145801186561584, 0.3513786792755127, -0.3469688892364502, 0.06758810579776764, 0.2367648482322693, 0.2765224575996399, -0.10500022768974304, -0.09016188979148865, 0.40401914715766907, 0.026312513276934624, 0.07693897187709808, -0.02420312538743019, -0.32392874360084534, 0.06526651233434677, 0.14260929822921753, -0.041309110820293427, 0.16759899258613586, 0.46014416217803955, 0.03356155380606651, 0.21707595884799957, 0.4217304587364197, 0.09804369509220123, -0.06518219411373138, -0.28305837512016296, -0.06399357318878174, 0.14282740652561188, -0.20407162606716156, 0.2851988971233368, -0.059337109327316284, 0.06231343001127243, 0.20527058839797974, 0.00876192282885313, 0.011962473392486572, 0.44512057304382324, -0.5256561040878296, 0.039406560361385345, -0.40785667300224304, 0.2844271659851074, -0.24637773633003235, 0.28881341218948364, -0.18175920844078064, 0.11616254597902298, -0.5182759761810303, -0.003616956528276205, 0.1301763653755188, -0.2540516257286072, 0.11028453707695007, -0.2262728065252304, -0.4621546268463135, -0.08973310142755508, -0.367807537317276, 0.3322157859802246, 0.25426316261291504, 0.2578848600387573, 0.1071614921092987, 0.027249671518802643, -0.2208702713251114, -0.12094957381486893, 1.1360121965408325, -0.43459638953208923, -0.30661189556121826, 0.06347620487213135, 0.300932377576828, -0.44085246324539185, 0.08212082087993622, 0.09385298192501068, 0.42820611596107483, 0.0751284584403038, 0.3090178966522217, 0.03301684558391571, 0.11162255704402924, 0.14134667813777924, 0.007975875400006771, -0.04608154296875, -0.07042576372623444, 0.2906409204006195, -0.05978158116340637, -0.44624173641204834, 0.3578272759914398, 0.42414024472236633, 0.1587781459093094, 0.3746342658996582, -0.17255209386348724, 0.2219318151473999, -0.35967981815338135, 0.01284772902727127, 0.04135415703058243, 0.31147482991218567, 0.08833563327789307, -0.007153673097491264, 0.046642083674669266, -0.19230955839157104, 0.2976382076740265, 0.29479527473449707, -0.2231651246547699, -0.47910553216934204, -0.03292294591665268, -0.07600899040699005, 0.7516548037528992, 0.26700037717819214, 0.0717875137925148, 0.4508938193321228, 0.04298572987318039, 0.355025053024292, -0.24011656641960144, 0.37647658586502075, 0.16421079635620117, 0.04493967071175575, -0.12845104932785034, -0.3409554362297058, 0.12137986719608307, 0.07193689048290253, -0.173549622297287, 0.5154905915260315, -0.007950067520141602, -0.45775106549263, 0.4530089497566223, -0.058078862726688385, 0.883158802986145, 0.3307889699935913, 0.035818375647068024, 0.08209340274333954, 0.056541889905929565, 0.4589218199253082, -0.4920358657836914, 0.1755957007408142, -0.07979770004749298, 0.4327980577945709, -0.0672927275300026, -0.04044075310230255, -0.09218274801969528, 0.3042164444923401, -0.2670699954032898, -0.20639431476593018, 0.1331765502691269, 0.253635436296463, -0.15243983268737793, 0.06030673533678055, 0.04521569982171059, -0.4763352870941162, -0.10166734457015991, 0.07777653634548187, 0.06609906256198883, -0.2757861018180847, 0.09587770700454712, 0.0727873370051384, 0.23103132843971252, -0.466361403465271, -0.5284129977226257, 0.05456322431564331, -0.8976744413375854, -0.04081882908940315, -0.03469843789935112, -0.05979479104280472, 0.6094908714294434, 0.062301989644765854, -0.1247422993183136, 0.35733655095100403, -0.12054963409900665, 0.2531416714191437, 0.21837052702903748, 0.0045656198635697365, -0.0038160437252372503, -0.2993079125881195, 0.12339317798614502, 0.20964813232421875, -0.2148970365524292, 0.03363792225718498, 0.16806602478027344, -0.3500326871871948, -0.10648917406797409, 0.13219766318798065, 0.2821146249771118, -0.48486363887786865, -0.06820665299892426, -0.18366917967796326, 0.05063061788678169, -0.4232964813709259, -0.0016000475734472275, -0.03280481696128845, -0.06166824698448181, 0.17483900487422943, -0.13904763758182526, -0.10476631671190262, -0.03179451823234558, 0.3460019826889038, -0.18708786368370056, -0.07773957401514053, 0.2389012724161148, 0.4109818935394287, -0.13502094149589539, -0.19141370058059692, 0.05261050909757614, 0.3124786615371704, -0.19816377758979797, 0.24161449074745178, -0.05899907648563385, -0.12030094861984253, -0.07870399206876755, 0.19898851215839386, 0.016318868845701218, 0.3198191821575165, -0.18262092769145966, -0.4311830699443817, -0.43404000997543335, 0.3258070945739746, 0.04812612384557724, 0.11390070617198944, 0.03869602829217911, 0.601409912109375, -0.06140929460525513, 0.33868643641471863, -0.21740543842315674, -0.009359379298985004, 0.20656108856201172, -0.05435200780630112, -0.1231759786605835, 0.026039786636829376, 0.0983228087425232, 0.10497839748859406, -0.04941849783062935, 0.5990945100784302, -0.1714390367269516, -0.11580688506364822, -0.2641921043395996, 0.1420581340789795, 0.3685688078403473, -0.1653563678264618, 0.07469593733549118, -0.19146013259887695, 0.038658615201711655, -0.28359755873680115, 0.1749849170446396, -0.17605310678482056, 0.021182391792535782, -0.2599444091320038, 0.0598355196416378, -0.1278732717037201, 0.040776580572128296, 0.005466189235448837, 0.17477749288082123, 0.12650595605373383, 0.1959124356508255, 0.20630748569965363, -0.020351354032754898, 0.04985891282558441, 0.03533383086323738, 0.2515842318534851, 0.5503160953521729, -0.18873092532157898, 0.17902565002441406, 0.2268994003534317, -0.329096257686615, 0.19660229980945587, 0.14794698357582092, 0.41397666931152344, -0.24958373606204987, -0.006932497955858707, 0.4477417767047882, 0.09143239259719849, -0.2916794717311859, -0.21685567498207092, 0.24292130768299103, -0.1725894659757614, 0.2548201382160187, 0.2027062177658081, -0.02111992798745632, -0.10009843856096268, -0.27527713775634766, -0.0167248398065567, 0.44324439764022827, -0.13857142627239227, -0.09457410871982574, 0.3790890872478485, -0.03372886776924133, -0.052637238055467606, 0.5745445489883423, 0.306823194026947, 0.5995927453041077, 0.22681300342082977, 0.0006851255893707275, -0.04488581418991089, -0.079957515001297, 0.016252435743808746, 0.214496910572052, -0.2840226888656616, -0.02516860142350197, 0.13842527568340302, 0.06171529367566109, 0.30451861023902893, 0.06025145202875137, 0.03354716673493385, -0.19083042442798615, -0.3884446322917938, 0.041283510625362396, 0.3055020272731781, -0.1800367832183838, -0.08863586187362671, -0.30553779006004333, -0.14985767006874084, -0.03262990340590477, -0.10458309948444366, 0.05078163370490074, -0.40309202671051025, 0.3280828595161438, -0.26770853996276855, -0.0427698940038681, -0.15682032704353333, -0.2070237398147583, -0.13299903273582458, 0.20471401512622833, -0.4250927269458771, 0.13726374506950378, -0.025348588824272156, -0.10788942873477936, -0.06619638204574585, 0.01273284386843443, 0.3487318456172943, -0.136895090341568, -0.1363186538219452, -0.09708528220653534, -0.432405561208725, -0.0119812386110425, -0.08544006943702698, 0.15303678810596466, 0.18760547041893005, -0.19922125339508057, 0.1933136284351349, 0.05309855937957764, -0.10655636340379715, 0.2753041684627533, 0.22037607431411743, -0.03842511400580406, 0.01874077133834362, -0.03493300825357437, 0.05991942062973976, -0.3842769265174866, -0.1966182440519333, -0.21980759501457214, -0.050289515405893326, 0.01878693886101246, 0.501025378704071, -0.3934376835823059, 0.1237456426024437, -0.13451862335205078, 0.04000617563724518, 0.24200890958309174, 0.26690587401390076, 0.3300684094429016, 0.16872265934944153, -0.30719342827796936, -0.3047505021095276, -0.1991519033908844, 0.002949759364128113, -0.28480520844459534, -0.1400425285100937, 0.17361769080162048, -0.0953463539481163, 0.40956273674964905, -0.13941945135593414, 0.01645796000957489, -0.09382422268390656, -0.21128077805042267, 0.08829434216022491, -0.2495390772819519, 0.12898977100849152, 0.14776769280433655, 0.4396391212940216, 0.3972841799259186, -0.18406587839126587, 0.17787203192710876, 0.052068404853343964, -0.13694056868553162, -0.5402087569236755, 0.18655350804328918, -0.16842137277126312, -0.5176968574523926, 0.4642573893070221, 0.1210923045873642, 0.09263747930526733, -0.1153545007109642, 0.21360896527767181, -0.2986201345920563, 0.1618986427783966, -0.19674567878246307, 0.34112581610679626, 0.22414834797382355, 0.36589208245277405, -0.21927344799041748, -0.2590039372444153, 0.10093527287244797, -0.3461408019065857, 0.04824057221412659, -0.22011642158031464, -0.09821974486112595, 0.5013654232025146, -0.26075559854507446, 0.1356317400932312, -0.025523869320750237, 0.18728551268577576, -0.11052235960960388, 0.2276315838098526, 0.1450180858373642, -0.32018235325813293, 0.4635969400405884, -0.33868181705474854, -0.4526124596595764, 0.26614144444465637, 0.07066452503204346, -0.05517309159040451, -0.1092916950583458, -0.7755764722824097, -0.27343428134918213, 0.2527864873409271, 0.4349396824836731, -0.23726345598697662, 0.19596384465694427, -0.12700289487838745, -0.15048085153102875, -0.2798532545566559, 0.3930574953556061, -0.009770918637514114, -0.1346481442451477, -0.08246076852083206, -0.5477558970451355 ]
https://github.com/huggingface/datasets/issues/5997
extend the map function so it can wrap around long text that does not fit in the context window
All the values in a batch must be of the same length. So one solution is dropping all the input columns: ```python data = data.map(lambda samples: tokenizer(samples["text"], max_length=tokenizer.model_max_length, truncation=True, stride=4, return_overflowing_tokens=True), batched=True, remove_columns=data.column_names) ``` Another is padding/transforming the input columns to the tokenizer output's length (447).
### Feature request I understand `dataset` provides a [`map`](https://github.com/huggingface/datasets/blob/main/src/datasets/arrow_dataset.py#L2849) function. This function in turn takes in a callable that is used to tokenize the text on which a model is trained. Frequently this text will not fit within a models's context window. In this case it would be useful to wrap around the text into multiple rows with each row fitting the model's context window. I tried to do it using this code as example which in turn I have borrowed from [here](https://stackoverflow.com/a/76343993/147530): ``` data = data.map(lambda samples: tokenizer(samples["text"], max_length=tokenizer.model_max_length, truncation=True, stride=4, return_overflowing_tokens=True), batched=True) ``` but running the code gives me this error: ``` File "/llm/fine-tune.py", line 117, in <module> data = data.map(lambda samples: tokenizer(samples["text"], max_length=tokenizer.model_max_length, truncation=True, stride=4, return_overflowing_tokens=True), batched=True) File "/llm/.env/lib/python3.9/site-packages/datasets/arrow_dataset.py", line 580, in wrapper out: Union["Dataset", "DatasetDict"] = func(self, *args, **kwargs) File "/llm/.env/lib/python3.9/site-packages/datasets/arrow_dataset.py", line 545, in wrapper out: Union["Dataset", "DatasetDict"] = func(self, *args, **kwargs) File "/llm/.env/lib/python3.9/site-packages/datasets/arrow_dataset.py", line 3087, in map for rank, done, content in Dataset._map_single(**dataset_kwargs): File "/llm/.env/lib/python3.9/site-packages/datasets/arrow_dataset.py", line 3480, in _map_single writer.write_batch(batch) File "/llm/.env/lib/python3.9/site-packages/datasets/arrow_writer.py", line 556, in write_batch pa_table = pa.Table.from_arrays(arrays, schema=schema) File "pyarrow/table.pxi", line 3798, in pyarrow.lib.Table.from_arrays File "pyarrow/table.pxi", line 2962, in pyarrow.lib.Table.validate File "pyarrow/error.pxi", line 100, in pyarrow.lib.check_status pyarrow.lib.ArrowInvalid: Column 1 named input_ids expected length 394 but got length 447 ``` The lambda function I have provided is correctly chopping up long text so it wraps around (and because of this 394 samples become 447 after wrap around) but the dataset `map` function does not like it. ### Motivation please see above ### Your contribution I'm afraid I don't have much knowledge to help
46
extend the map function so it can wrap around long text that does not fit in the context window ### Feature request I understand `dataset` provides a [`map`](https://github.com/huggingface/datasets/blob/main/src/datasets/arrow_dataset.py#L2849) function. This function in turn takes in a callable that is used to tokenize the text on which a model is trained. Frequently this text will not fit within a models's context window. In this case it would be useful to wrap around the text into multiple rows with each row fitting the model's context window. I tried to do it using this code as example which in turn I have borrowed from [here](https://stackoverflow.com/a/76343993/147530): ``` data = data.map(lambda samples: tokenizer(samples["text"], max_length=tokenizer.model_max_length, truncation=True, stride=4, return_overflowing_tokens=True), batched=True) ``` but running the code gives me this error: ``` File "/llm/fine-tune.py", line 117, in <module> data = data.map(lambda samples: tokenizer(samples["text"], max_length=tokenizer.model_max_length, truncation=True, stride=4, return_overflowing_tokens=True), batched=True) File "/llm/.env/lib/python3.9/site-packages/datasets/arrow_dataset.py", line 580, in wrapper out: Union["Dataset", "DatasetDict"] = func(self, *args, **kwargs) File "/llm/.env/lib/python3.9/site-packages/datasets/arrow_dataset.py", line 545, in wrapper out: Union["Dataset", "DatasetDict"] = func(self, *args, **kwargs) File "/llm/.env/lib/python3.9/site-packages/datasets/arrow_dataset.py", line 3087, in map for rank, done, content in Dataset._map_single(**dataset_kwargs): File "/llm/.env/lib/python3.9/site-packages/datasets/arrow_dataset.py", line 3480, in _map_single writer.write_batch(batch) File "/llm/.env/lib/python3.9/site-packages/datasets/arrow_writer.py", line 556, in write_batch pa_table = pa.Table.from_arrays(arrays, schema=schema) File "pyarrow/table.pxi", line 3798, in pyarrow.lib.Table.from_arrays File "pyarrow/table.pxi", line 2962, in pyarrow.lib.Table.validate File "pyarrow/error.pxi", line 100, in pyarrow.lib.check_status pyarrow.lib.ArrowInvalid: Column 1 named input_ids expected length 394 but got length 447 ``` The lambda function I have provided is correctly chopping up long text so it wraps around (and because of this 394 samples become 447 after wrap around) but the dataset `map` function does not like it. ### Motivation please see above ### Your contribution I'm afraid I don't have much knowledge to help All the values in a batch must be of the same length. So one solution is dropping all the input columns: ```python data = data.map(lambda samples: tokenizer(samples["text"], max_length=tokenizer.model_max_length, truncation=True, stride=4, return_overflowing_tokens=True), batched=True, remove_columns=data.column_names) ``` Another is padding/transforming the input columns to the tokenizer output's length (447).
[ -0.3404633402824402, 0.035428255796432495, -0.08898572623729706, 0.043310217559337616, 0.17575743794441223, -0.049312230199575424, 0.30036666989326477, 0.36894625425338745, -0.09006552398204803, -0.17397652566432953, 0.09924719482660294, 0.5054343342781067, -0.03185432031750679, 0.32149383425712585, 0.11065218597650528, -0.3572513163089752, 0.09137875586748123, -0.08318603038787842, 0.41484829783439636, 0.30931514501571655, -0.35015037655830383, -0.08045720309019089, -0.3951624631881714, 0.1581752896308899, -0.12172611802816391, -0.2035406082868576, -0.28787994384765625, -0.37009385228157043, 0.07613256573677063, -0.21095050871372223, 0.004973236471414566, 0.10255713015794754, -0.1655050367116928, 0.257016658782959, -0.00011748912220355123, -0.190982386469841, -0.12051738798618317, -0.06064566224813461, 0.20487312972545624, -0.15861673653125763, 0.24906641244888306, -0.22372080385684967, -0.36132338643074036, -0.13529828190803528, 0.06681124120950699, -0.10928209125995636, -0.2433512955904007, -0.20687860250473022, 0.20258185267448425, 0.31924018263816833, 0.07839351892471313, 0.1494838148355484, 0.11391156911849976, -0.11100073903799057, 0.06787844002246857, 0.13695372641086578, 0.0511980801820755, 0.045679714530706406, 0.4494413435459137, -0.17819279432296753, -0.1050446406006813, 0.3481350541114807, -0.24123704433441162, -0.047522250562906265, 0.2019260823726654, -0.13029807806015015, -0.18552365899085999, -0.3786453306674957, -0.015575367957353592, 0.09814587235450745, 0.32770389318466187, -0.3860637843608856, -0.2718268036842346, -0.40748587250709534, 0.14553646743297577, -0.12824678421020508, -0.02961597591638565, 0.05700640380382538, 0.04083307087421417, 0.0796305388212204, -0.3519154191017151, -0.33039629459381104, -0.14965520799160004, 0.2792605757713318, -0.303865522146225, 0.2699803113937378, -0.011285598389804363, 0.3705306053161621, 0.15413272380828857, -0.27678990364074707, -0.09276019781827927, 0.031949903815984726, 0.0819268748164177, 0.278782457113266, -0.10765381157398224, -0.13869303464889526, 0.19040584564208984, 0.19666212797164917, 0.40852537751197815, 0.09637299925088882, -0.0729731023311615, 0.10346158593893051, 0.00860158633440733, -0.09260808676481247, 0.07116466760635376, -0.01517317071557045, 0.262451708316803, 0.37068963050842285, -0.09171472489833832, -0.25112849473953247, -0.023759067058563232, -0.03629177063703537, -0.06699828803539276, -0.2617032527923584, -0.3784729540348053, -0.004212735220789909, -0.010323930531740189, 0.398409903049469, 0.1197366937994957, -0.028970390558242798, -0.4952002763748169, 0.1421579271554947, 0.19884905219078064, 0.19346889853477478, 0.10586294531822205, -0.03845101594924927, 0.05717500299215317, 0.17932990193367004, 0.17043818533420563, -0.1749744564294815, -0.07210066169500351, -0.03683425858616829, -0.04450768977403641, 0.11701057106256485, -0.043906304985284805, 0.13054530322551727, 0.11023867875337601, -0.2339380979537964, 0.06001492589712143, -0.1450650691986084, -0.36503031849861145, -0.08257237076759338, 0.08170582354068756, 0.10225386917591095, -0.2738770842552185, 0.08975275605916977, 0.13631941378116608, 0.1371951550245285, -0.11911443620920181, 0.08527666330337524, -0.24731823801994324, -0.2024703472852707, -0.08486124128103256, -0.01969839632511139, 0.03058721125125885, 0.22944025695323944, -0.036156781017780304, 0.4400523900985718, 0.3117678761482239, -0.26031389832496643, 0.4102972745895386, -0.150978222489357, -0.5485771894454956, -0.25987204909324646, 0.15054799616336823, 0.29924365878105164, -0.37419843673706055, -0.14816930890083313, 0.04471879079937935, 0.16440941393375397, -0.18171662092208862, 0.2643900215625763, -0.10530449450016022, 0.2594386339187622, -0.3027675747871399, 0.5635429620742798, 0.40210241079330444, -0.3849397897720337, -0.6354625821113586, 0.2609867751598358, -0.47289347648620605, -0.09041354060173035, -0.18840447068214417, -0.2228679209947586, 0.44145581126213074, 0.13902775943279266, 0.31493884325027466, 0.3012656569480896, -0.1226651668548584, -0.07793593406677246, 0.06015383079648018, -0.04622142016887665, 0.4465785026550293, 0.1373033970594406, -0.11783382296562195, -0.14681237936019897, -0.07267916947603226, -0.21498408913612366, 0.4182831645011902, 0.0029621534049510956, 0.33366337418556213, -0.0622982457280159, 0.22778229415416718, 0.11390700191259384, -0.03949929401278496, -0.4559001624584198, -0.16410425305366516, -0.12966954708099365, 0.12050500512123108, -0.05765794217586517, -0.4009089469909668, -0.315460741519928, 0.04485832154750824, 0.22018815577030182, 0.02433362975716591, -0.06482104957103729, -0.03241852670907974, -0.17037366330623627, 0.036544378846883774, -0.08307847380638123, 0.364768385887146, 0.027537688612937927, -0.05253526195883751, 0.2877940833568573, 0.11662578582763672, 0.08485765755176544, 0.20722609758377075, 0.0655045136809349, -0.13344669342041016, 0.17517498135566711, 0.21988865733146667, -0.07445242255926132, -0.09213338792324066, 0.4355398118495941, 0.11001215875148773, -0.11072169244289398, -0.5617769360542297, 0.01862521469593048, 0.14548859000205994, -0.17776665091514587, 0.109561987221241, 0.010065343230962753, -0.06271160393953323, -0.160072922706604, -0.21718242764472961, 0.3256163001060486, 0.3290832042694092, 0.5256913900375366, -0.22631655633449554, 0.3410674035549164, 0.0978015810251236, 0.051613714545965195, -0.1625584065914154, -0.2957461476325989, -0.06772814691066742, 0.176100954413414, 0.18836602568626404, -0.21864421665668488, 0.053303807973861694, 0.42098796367645264, 0.31095269322395325, -0.14626973867416382, 0.09390996396541595, 0.192674458026886, -0.22578978538513184, 0.06108624488115311, 0.254670649766922, -0.07445983588695526, 0.13948151469230652, 0.2595921754837036, -0.22253185510635376, 0.18089036643505096, 0.038381658494472504, 0.04513094201683998, 0.07933163642883301, 0.20589372515678406, 0.051004327833652496, 0.16269846260547638, 0.37886273860931396, -0.060028720647096634, -0.10357090830802917, -0.42567241191864014, 0.23824036121368408, 0.06449045240879059, -0.17320506274700165, 0.07763630151748657, -0.3611445426940918, -0.25288325548171997, -0.029945027083158493, -0.15476839244365692, 0.009838711470365524, -0.08103227615356445, -0.07115216553211212, 0.252302885055542, -0.24779047071933746, 0.414192259311676, 0.15440748631954193, 0.47492343187332153, 0.3921352028846741, -0.14865419268608093, 0.10203015804290771, -0.12295651435852051, 0.14213965833187103, -0.03261625021696091, 0.11930492520332336, -0.13123147189617157, 0.2022922933101654, 0.28139227628707886, 0.25295209884643555, -0.42269888520240784, -0.3874351680278778, 0.17516565322875977, -0.1679999977350235, 0.0354589968919754, 0.27332261204719543, -0.011810161173343658, -0.35483288764953613, -0.06292440742254257, 0.27059292793273926, 0.05246679484844208, -0.2039964646100998, -0.17524172365665436, 0.05253598093986511, -0.0038210502825677395, -0.0789795070886612, 0.14870135486125946, -0.24281899631023407, -0.5070274472236633, 0.7082015872001648, -0.09519334137439728, 0.1702631413936615, -0.0530119389295578, 0.29934796690940857, 0.09136997908353806, -0.07949365675449371, -0.290679931640625, -0.1596786081790924, 0.21359401941299438, 0.38422906398773193, -0.2740488052368164, 0.19754503667354584, -0.16936294734477997, -0.13298237323760986, 0.07145801186561584, 0.3513786792755127, -0.3469688892364502, 0.06758810579776764, 0.2367648482322693, 0.2765224575996399, -0.10500022768974304, -0.09016188979148865, 0.40401914715766907, 0.026312513276934624, 0.07693897187709808, -0.02420312538743019, -0.32392874360084534, 0.06526651233434677, 0.14260929822921753, -0.041309110820293427, 0.16759899258613586, 0.46014416217803955, 0.03356155380606651, 0.21707595884799957, 0.4217304587364197, 0.09804369509220123, -0.06518219411373138, -0.28305837512016296, -0.06399357318878174, 0.14282740652561188, -0.20407162606716156, 0.2851988971233368, -0.059337109327316284, 0.06231343001127243, 0.20527058839797974, 0.00876192282885313, 0.011962473392486572, 0.44512057304382324, -0.5256561040878296, 0.039406560361385345, -0.40785667300224304, 0.2844271659851074, -0.24637773633003235, 0.28881341218948364, -0.18175920844078064, 0.11616254597902298, -0.5182759761810303, -0.003616956528276205, 0.1301763653755188, -0.2540516257286072, 0.11028453707695007, -0.2262728065252304, -0.4621546268463135, -0.08973310142755508, -0.367807537317276, 0.3322157859802246, 0.25426316261291504, 0.2578848600387573, 0.1071614921092987, 0.027249671518802643, -0.2208702713251114, -0.12094957381486893, 1.1360121965408325, -0.43459638953208923, -0.30661189556121826, 0.06347620487213135, 0.300932377576828, -0.44085246324539185, 0.08212082087993622, 0.09385298192501068, 0.42820611596107483, 0.0751284584403038, 0.3090178966522217, 0.03301684558391571, 0.11162255704402924, 0.14134667813777924, 0.007975875400006771, -0.04608154296875, -0.07042576372623444, 0.2906409204006195, -0.05978158116340637, -0.44624173641204834, 0.3578272759914398, 0.42414024472236633, 0.1587781459093094, 0.3746342658996582, -0.17255209386348724, 0.2219318151473999, -0.35967981815338135, 0.01284772902727127, 0.04135415703058243, 0.31147482991218567, 0.08833563327789307, -0.007153673097491264, 0.046642083674669266, -0.19230955839157104, 0.2976382076740265, 0.29479527473449707, -0.2231651246547699, -0.47910553216934204, -0.03292294591665268, -0.07600899040699005, 0.7516548037528992, 0.26700037717819214, 0.0717875137925148, 0.4508938193321228, 0.04298572987318039, 0.355025053024292, -0.24011656641960144, 0.37647658586502075, 0.16421079635620117, 0.04493967071175575, -0.12845104932785034, -0.3409554362297058, 0.12137986719608307, 0.07193689048290253, -0.173549622297287, 0.5154905915260315, -0.007950067520141602, -0.45775106549263, 0.4530089497566223, -0.058078862726688385, 0.883158802986145, 0.3307889699935913, 0.035818375647068024, 0.08209340274333954, 0.056541889905929565, 0.4589218199253082, -0.4920358657836914, 0.1755957007408142, -0.07979770004749298, 0.4327980577945709, -0.0672927275300026, -0.04044075310230255, -0.09218274801969528, 0.3042164444923401, -0.2670699954032898, -0.20639431476593018, 0.1331765502691269, 0.253635436296463, -0.15243983268737793, 0.06030673533678055, 0.04521569982171059, -0.4763352870941162, -0.10166734457015991, 0.07777653634548187, 0.06609906256198883, -0.2757861018180847, 0.09587770700454712, 0.0727873370051384, 0.23103132843971252, -0.466361403465271, -0.5284129977226257, 0.05456322431564331, -0.8976744413375854, -0.04081882908940315, -0.03469843789935112, -0.05979479104280472, 0.6094908714294434, 0.062301989644765854, -0.1247422993183136, 0.35733655095100403, -0.12054963409900665, 0.2531416714191437, 0.21837052702903748, 0.0045656198635697365, -0.0038160437252372503, -0.2993079125881195, 0.12339317798614502, 0.20964813232421875, -0.2148970365524292, 0.03363792225718498, 0.16806602478027344, -0.3500326871871948, -0.10648917406797409, 0.13219766318798065, 0.2821146249771118, -0.48486363887786865, -0.06820665299892426, -0.18366917967796326, 0.05063061788678169, -0.4232964813709259, -0.0016000475734472275, -0.03280481696128845, -0.06166824698448181, 0.17483900487422943, -0.13904763758182526, -0.10476631671190262, -0.03179451823234558, 0.3460019826889038, -0.18708786368370056, -0.07773957401514053, 0.2389012724161148, 0.4109818935394287, -0.13502094149589539, -0.19141370058059692, 0.05261050909757614, 0.3124786615371704, -0.19816377758979797, 0.24161449074745178, -0.05899907648563385, -0.12030094861984253, -0.07870399206876755, 0.19898851215839386, 0.016318868845701218, 0.3198191821575165, -0.18262092769145966, -0.4311830699443817, -0.43404000997543335, 0.3258070945739746, 0.04812612384557724, 0.11390070617198944, 0.03869602829217911, 0.601409912109375, -0.06140929460525513, 0.33868643641471863, -0.21740543842315674, -0.009359379298985004, 0.20656108856201172, -0.05435200780630112, -0.1231759786605835, 0.026039786636829376, 0.0983228087425232, 0.10497839748859406, -0.04941849783062935, 0.5990945100784302, -0.1714390367269516, -0.11580688506364822, -0.2641921043395996, 0.1420581340789795, 0.3685688078403473, -0.1653563678264618, 0.07469593733549118, -0.19146013259887695, 0.038658615201711655, -0.28359755873680115, 0.1749849170446396, -0.17605310678482056, 0.021182391792535782, -0.2599444091320038, 0.0598355196416378, -0.1278732717037201, 0.040776580572128296, 0.005466189235448837, 0.17477749288082123, 0.12650595605373383, 0.1959124356508255, 0.20630748569965363, -0.020351354032754898, 0.04985891282558441, 0.03533383086323738, 0.2515842318534851, 0.5503160953521729, -0.18873092532157898, 0.17902565002441406, 0.2268994003534317, -0.329096257686615, 0.19660229980945587, 0.14794698357582092, 0.41397666931152344, -0.24958373606204987, -0.006932497955858707, 0.4477417767047882, 0.09143239259719849, -0.2916794717311859, -0.21685567498207092, 0.24292130768299103, -0.1725894659757614, 0.2548201382160187, 0.2027062177658081, -0.02111992798745632, -0.10009843856096268, -0.27527713775634766, -0.0167248398065567, 0.44324439764022827, -0.13857142627239227, -0.09457410871982574, 0.3790890872478485, -0.03372886776924133, -0.052637238055467606, 0.5745445489883423, 0.306823194026947, 0.5995927453041077, 0.22681300342082977, 0.0006851255893707275, -0.04488581418991089, -0.079957515001297, 0.016252435743808746, 0.214496910572052, -0.2840226888656616, -0.02516860142350197, 0.13842527568340302, 0.06171529367566109, 0.30451861023902893, 0.06025145202875137, 0.03354716673493385, -0.19083042442798615, -0.3884446322917938, 0.041283510625362396, 0.3055020272731781, -0.1800367832183838, -0.08863586187362671, -0.30553779006004333, -0.14985767006874084, -0.03262990340590477, -0.10458309948444366, 0.05078163370490074, -0.40309202671051025, 0.3280828595161438, -0.26770853996276855, -0.0427698940038681, -0.15682032704353333, -0.2070237398147583, -0.13299903273582458, 0.20471401512622833, -0.4250927269458771, 0.13726374506950378, -0.025348588824272156, -0.10788942873477936, -0.06619638204574585, 0.01273284386843443, 0.3487318456172943, -0.136895090341568, -0.1363186538219452, -0.09708528220653534, -0.432405561208725, -0.0119812386110425, -0.08544006943702698, 0.15303678810596466, 0.18760547041893005, -0.19922125339508057, 0.1933136284351349, 0.05309855937957764, -0.10655636340379715, 0.2753041684627533, 0.22037607431411743, -0.03842511400580406, 0.01874077133834362, -0.03493300825357437, 0.05991942062973976, -0.3842769265174866, -0.1966182440519333, -0.21980759501457214, -0.050289515405893326, 0.01878693886101246, 0.501025378704071, -0.3934376835823059, 0.1237456426024437, -0.13451862335205078, 0.04000617563724518, 0.24200890958309174, 0.26690587401390076, 0.3300684094429016, 0.16872265934944153, -0.30719342827796936, -0.3047505021095276, -0.1991519033908844, 0.002949759364128113, -0.28480520844459534, -0.1400425285100937, 0.17361769080162048, -0.0953463539481163, 0.40956273674964905, -0.13941945135593414, 0.01645796000957489, -0.09382422268390656, -0.21128077805042267, 0.08829434216022491, -0.2495390772819519, 0.12898977100849152, 0.14776769280433655, 0.4396391212940216, 0.3972841799259186, -0.18406587839126587, 0.17787203192710876, 0.052068404853343964, -0.13694056868553162, -0.5402087569236755, 0.18655350804328918, -0.16842137277126312, -0.5176968574523926, 0.4642573893070221, 0.1210923045873642, 0.09263747930526733, -0.1153545007109642, 0.21360896527767181, -0.2986201345920563, 0.1618986427783966, -0.19674567878246307, 0.34112581610679626, 0.22414834797382355, 0.36589208245277405, -0.21927344799041748, -0.2590039372444153, 0.10093527287244797, -0.3461408019065857, 0.04824057221412659, -0.22011642158031464, -0.09821974486112595, 0.5013654232025146, -0.26075559854507446, 0.1356317400932312, -0.025523869320750237, 0.18728551268577576, -0.11052235960960388, 0.2276315838098526, 0.1450180858373642, -0.32018235325813293, 0.4635969400405884, -0.33868181705474854, -0.4526124596595764, 0.26614144444465637, 0.07066452503204346, -0.05517309159040451, -0.1092916950583458, -0.7755764722824097, -0.27343428134918213, 0.2527864873409271, 0.4349396824836731, -0.23726345598697662, 0.19596384465694427, -0.12700289487838745, -0.15048085153102875, -0.2798532545566559, 0.3930574953556061, -0.009770918637514114, -0.1346481442451477, -0.08246076852083206, -0.5477558970451355 ]
https://github.com/huggingface/datasets/issues/5993
ValueError: Table schema does not match schema used to create file
We'll do a new release of `datasets` soon to make the fix available :) In the meantime you can use `datasets` from source (main)
### Describe the bug Saving a dataset as parquet fails with a `ValueError: Table schema does not match schema used to create file` if the dataset was obtained out of a `.select_columns()` call with columns selected out of order. ### Steps to reproduce the bug ```python import datasets dataset = datasets.Dataset.from_dict( { "x1": [1, 2, 3], "x2": [10, 11, 12], } ) ds = dataset.select_columns(["x2", "x1"]) ds.to_parquet("demo.parquet") ``` ```shell >>> ValueError: Table schema does not match schema used to create file: table: x2: int64 x1: int64 -- schema metadata -- huggingface: '{"info": {"features": {"x2": {"dtype": "int64", "_type": "V' + 53 vs. file: x1: int64 x2: int64 -- schema metadata -- huggingface: '{"info": {"features": {"x1": {"dtype": "int64", "_type": "V' + 53 ``` --- I think this is because after the `.select_columns()` call with out of order columns, the output dataset features' schema ends up being out of sync with the schema of the arrow table backing it. ```python ds.features.arrow_schema >>> x1: int64 x2: int64 -- schema metadata -- huggingface: '{"info": {"features": {"x1": {"dtype": "int64", "_type": "V' + 53 ds.data.schema >>> x2: int64 x1: int64 -- schema metadata -- huggingface: '{"info": {"features": {"x2": {"dtype": "int64", "_type": "V' + 53 ``` So when we call `.to_parquet()`, the call behind the scenes to `datasets.io.parquet.ParquetDatasetWriter(...).write()` which initialises the backend `pyarrow.parquet.ParquetWriter` with `schema = self.dataset.features.arrow_schema` triggers `pyarrow` on write when [it checks](https://github.com/apache/arrow/blob/11b140a734a516e436adaddaeb35d23f30dcce44/python/pyarrow/parquet/core.py#L1086-L1090) that the `ParquetWriter` schema matches the schema of the table being written 🙌 https://github.com/huggingface/datasets/blob/6ed837325cb539a5deb99129e5ad181d0269e050/src/datasets/io/parquet.py#L139-L141 ### Expected behavior The dataset gets successfully saved as parquet. *In the same way as it does if saving it as csv: ```python import datasets dataset = datasets.Dataset.from_dict( { "x1": [1, 2, 3], "x2": [10, 11, 12], } ) ds = dataset.select_columns(["x2", "x1"]) ds.to_csv("demo.csv") ``` ### Environment info `python==3.11` `datasets==2.13.1`
24
ValueError: Table schema does not match schema used to create file ### Describe the bug Saving a dataset as parquet fails with a `ValueError: Table schema does not match schema used to create file` if the dataset was obtained out of a `.select_columns()` call with columns selected out of order. ### Steps to reproduce the bug ```python import datasets dataset = datasets.Dataset.from_dict( { "x1": [1, 2, 3], "x2": [10, 11, 12], } ) ds = dataset.select_columns(["x2", "x1"]) ds.to_parquet("demo.parquet") ``` ```shell >>> ValueError: Table schema does not match schema used to create file: table: x2: int64 x1: int64 -- schema metadata -- huggingface: '{"info": {"features": {"x2": {"dtype": "int64", "_type": "V' + 53 vs. file: x1: int64 x2: int64 -- schema metadata -- huggingface: '{"info": {"features": {"x1": {"dtype": "int64", "_type": "V' + 53 ``` --- I think this is because after the `.select_columns()` call with out of order columns, the output dataset features' schema ends up being out of sync with the schema of the arrow table backing it. ```python ds.features.arrow_schema >>> x1: int64 x2: int64 -- schema metadata -- huggingface: '{"info": {"features": {"x1": {"dtype": "int64", "_type": "V' + 53 ds.data.schema >>> x2: int64 x1: int64 -- schema metadata -- huggingface: '{"info": {"features": {"x2": {"dtype": "int64", "_type": "V' + 53 ``` So when we call `.to_parquet()`, the call behind the scenes to `datasets.io.parquet.ParquetDatasetWriter(...).write()` which initialises the backend `pyarrow.parquet.ParquetWriter` with `schema = self.dataset.features.arrow_schema` triggers `pyarrow` on write when [it checks](https://github.com/apache/arrow/blob/11b140a734a516e436adaddaeb35d23f30dcce44/python/pyarrow/parquet/core.py#L1086-L1090) that the `ParquetWriter` schema matches the schema of the table being written 🙌 https://github.com/huggingface/datasets/blob/6ed837325cb539a5deb99129e5ad181d0269e050/src/datasets/io/parquet.py#L139-L141 ### Expected behavior The dataset gets successfully saved as parquet. *In the same way as it does if saving it as csv: ```python import datasets dataset = datasets.Dataset.from_dict( { "x1": [1, 2, 3], "x2": [10, 11, 12], } ) ds = dataset.select_columns(["x2", "x1"]) ds.to_csv("demo.csv") ``` ### Environment info `python==3.11` `datasets==2.13.1` We'll do a new release of `datasets` soon to make the fix available :) In the meantime you can use `datasets` from source (main)
[ -0.2826022505760193, -0.036040544509887695, 0.04691923037171364, 0.3035893440246582, 0.12757623195648193, 0.07862845808267593, -0.09735161066055298, 0.29069283604621887, 0.07794839143753052, 0.22120481729507446, 0.3267451524734497, 0.6393990516662598, -0.09413168579339981, 0.417728453874588, -0.1704547107219696, -0.19860604405403137, 0.19568981230258942, 0.1380510926246643, -0.09969842433929443, 0.05204429477453232, -0.3040846288204193, 0.1974124312400818, 0.137843057513237, 0.05682670325040817, 0.03328925743699074, -0.07410388439893723, -0.1052376851439476, 0.28137555718421936, -0.23371732234954834, -0.15883977711200714, 0.02065875567495823, -0.4134068489074707, 0.01629059389233589, 0.39033880829811096, -0.0001145242786151357, -0.17147067189216614, -0.032543838024139404, -0.18897484242916107, -0.11790210008621216, -0.3422318696975708, -0.06711812317371368, -0.23107556998729706, -0.048899948596954346, -0.30002066493034363, -0.04009055346250534, -0.14235781133174896, -0.3200642466545105, -0.3352254033088684, 0.19804218411445618, 0.24472039937973022, 0.22421026229858398, 0.17065848410129547, 0.3409293591976166, -0.08201240003108978, 0.5941997170448303, 0.005449481308460236, -0.36635729670524597, 0.055063772946596146, 0.04692960903048515, 0.0009286701679229736, 0.38410142064094543, 0.1871216893196106, -0.039664361625909805, -0.27336040139198303, 0.22736990451812744, 0.24192336201667786, 0.1813325583934784, -0.02826094627380371, -0.02427680790424347, 0.037700265645980835, 0.3732569217681885, -0.3112727999687195, -0.3224003314971924, -0.13631291687488556, -0.11056859791278839, -0.4180324375629425, 0.2967771589756012, 0.27179211378097534, 0.31424111127853394, 0.12907527387142181, 0.2320457398891449, 0.09943694621324539, -0.1134292259812355, -0.1301562786102295, 0.04988127946853638, 0.059568312019109726, -0.09049422293901443, 0.10234013199806213, -0.12793491780757904, -0.18437740206718445, -0.15931905806064606, -0.30077579617500305, -0.3128792643547058, 0.03117290511727333, -0.16378730535507202, -0.1818476766347885, -0.07438401132822037, -0.04114308953285217, 0.04720129817724228, 0.43042051792144775, 0.1600251942873001, -0.11069659143686295, 0.08656623959541321, 0.1107470765709877, 0.36614635586738586, 0.056987982243299484, -0.16886574029922485, 0.22131937742233276, -0.17447367310523987, 0.369894802570343, 0.04640447720885277, -0.13735082745552063, 0.3556908071041107, -0.04542234167456627, 0.2135002315044403, -0.07405975461006165, 0.4067268967628479, -0.1552269458770752, -0.23541578650474548, 0.525094211101532, 0.01784089207649231, 0.030386516824364662, -0.14980119466781616, 0.28988122940063477, 0.15416938066482544, 0.09399662911891937, 0.06268014013767242, 0.3532600998878479, 0.07824500650167465, 0.0023330403491854668, -0.22531425952911377, 0.03289975970983505, 0.015285048633813858, 0.027194594964385033, -0.21085412800312042, 0.16800573468208313, 0.061052821576595306, 0.39545634388923645, -0.13179215788841248, -0.051783487200737, 0.08751904219388962, -0.29905033111572266, 0.025028973817825317, 0.20447520911693573, -0.014235559850931168, 0.15626150369644165, 0.32317212224006653, -0.20696808397769928, -0.28300678730010986, 0.14319372177124023, -0.3770212233066559, -0.17129787802696228, -0.31302592158317566, 0.22776207327842712, 0.12445499002933502, -0.06822598725557327, -0.7790533304214478, -0.2816196382045746, 0.35932719707489014, -0.15064822137355804, 0.052006371319293976, -0.15395699441432953, -0.16215556859970093, -0.2640952169895172, -0.1243739202618599, 0.23238669335842133, -0.3286084532737732, 0.2685233950614929, 0.2988893389701843, 0.08139152824878693, 0.31529250741004944, 0.08954787254333496, -0.016210921108722687, -0.03954440355300903, -0.08149971812963486, 0.1537274718284607, 0.44904112815856934, -0.19894063472747803, -0.29236850142478943, -0.04183297976851463, -0.18152040243148804, 0.19579987227916718, 0.26791030168533325, -0.08968866616487503, 0.3698817193508148, -0.05353008583188057, -0.1759321391582489, 0.23634345829486847, 0.030276579782366753, 0.21083416044712067, -0.2645777463912964, -0.15161390602588654, 0.12571294605731964, -0.011989060789346695, -0.36886996030807495, -0.0635848417878151, 0.10420849174261093, -0.177500382065773, 0.22516188025474548, -0.1586097776889801, -0.16548870503902435, 0.2243809849023819, 0.507524847984314, 0.3529881238937378, 0.06473216414451599, -0.32966023683547974, -0.3658536374568939, 0.201645165681839, 0.19269512593746185, -0.26701322197914124, -0.2995913028717041, -0.15267136693000793, -0.23795849084854126, 0.07845064252614975, -0.31040701270103455, -0.05236545577645302, 0.14210616052150726, 0.11103762686252594, 0.018489129841327667, -0.053805235773324966, -0.1169189065694809, 0.06940191984176636, -0.49174538254737854, 0.10165904462337494, -0.12950406968593597, 0.49778884649276733, -0.298166424036026, -0.37475642561912537, 0.19221901893615723, 0.04340077191591263, 0.18014417588710785, -0.12590430676937103, -0.09315648674964905, 0.5157523155212402, 0.3612669110298157, 0.09528845548629761, -0.40158286690711975, 0.19804586470127106, -0.11399806290864944, 0.06690475344657898, -0.1452895849943161, -0.06219685450196266, 0.19258257746696472, 0.034132689237594604, -0.3661895990371704, 0.3217177093029022, -0.12770740687847137, 0.2239018976688385, 0.14624692499637604, -0.07767805457115173, 0.11057837307453156, 0.09311516582965851, 0.07199106365442276, -0.2379148304462433, 0.06372390687465668, 0.12330059707164764, -0.2240523099899292, -0.0647343248128891, -0.4021715819835663, 0.3022197186946869, 0.726588249206543, 0.16359031200408936, 0.19242644309997559, -0.16061490774154663, 0.324098140001297, -0.027534713968634605, 0.0881834328174591, 0.30524155497550964, 0.41767555475234985, 0.17713993787765503, -0.4053998291492462, 0.027457263320684433, -0.25117844343185425, 0.04785117506980896, 0.15661177039146423, 0.00492694228887558, 0.29095137119293213, 0.37308135628700256, 0.22414742410182953, 0.12082695215940475, -0.16512876749038696, 0.09425781667232513, -0.23932024836540222, 0.16346493363380432, -0.37371310591697693, 0.20825083553791046, -0.2906978130340576, 0.29832375049591064, -0.305728554725647, 0.12993745505809784, -0.0627453476190567, -0.3759010136127472, -0.01807432621717453, 0.22305171191692352, -0.2839876413345337, -0.009016742929816246, -0.27005335688591003, 0.002746269106864929, 0.09946781396865845, -0.1360490471124649, -0.008574772626161575, -0.13163205981254578, -0.06348391622304916, 0.01678130030632019, -0.009777985513210297, 0.2645034193992615, 0.2931673526763916, -0.01068535540252924, 0.0008687600493431091, -0.5045115351676941, -0.23223242163658142, 0.050879381597042084, -0.17026449739933014, 0.1751452088356018, 0.19830262660980225, 0.12636606395244598, 0.09337256848812103, -0.4405452013015747, 0.1811944544315338, -0.019557397812604904, -0.3114273250102997, 0.2802219092845917, 0.06376572698354721, -0.25056806206703186, 0.14270873367786407, -0.5030375123023987, 0.06954092532396317, -0.30519720911979675, 0.2174583524465561, 0.4242861270904541, 0.09920910745859146, -0.25132596492767334, -0.07928749918937683, -0.1478547751903534, -0.21364477276802063, 0.3604814112186432, -0.207334965467453, 0.07531924545764923, 0.16450227797031403, -0.15678882598876953, -0.2873241603374481, 0.14728803932666779, -0.018635855987668037, -0.08988577127456665, 0.0805058404803276, -0.1972297877073288, -0.08011071383953094, -0.32330626249313354, -0.07246792316436768, -0.2856382429599762, 0.0906071662902832, 0.6133341789245605, 0.12044665962457657, -0.022535059601068497, -0.11566624045372009, -0.06436125934123993, 0.16244739294052124, 0.26630327105522156, 0.13792192935943604, -0.21070662140846252, 0.7190149426460266, -0.057287223637104034, 0.4144975543022156, 0.006699191406369209, 0.03395340219140053, 0.4099947512149811, -0.07504943013191223, 0.3551829159259796, -0.4577169120311737, -0.007965382188558578, -0.16413451731204987, -0.06596994400024414, 0.08214645832777023, 0.1311078667640686, -0.11889062076807022, 0.26405707001686096, 0.14431218802928925, 0.09967471659183502, -0.06291984021663666, -0.12214112281799316, -0.1615561544895172, 0.007364820688962936, 0.19627249240875244, -0.039985477924346924, 0.006399691104888916, 0.03361492604017258, 0.04143921285867691, 0.20939110219478607, 0.21729156374931335, 0.0745885893702507, -0.11066345125436783, -0.45003315806388855, 0.21166308224201202, 0.01480480283498764, 0.06388283520936966, 0.05168021842837334, 0.24868659675121307, 0.10905089974403381, -0.4211992025375366, -0.07564546167850494, -0.17036575078964233, 0.42511624097824097, -0.11779255419969559, 0.15502260625362396, -0.046104270964860916, 0.04055093973875046, -0.280966579914093, -0.24824738502502441, -0.18717524409294128, 0.06794917583465576, -0.12083430588245392, 0.7257598042488098, -0.3563994765281677, 0.1550687700510025, 0.2691226005554199, 0.2522052824497223, -0.22242261469364166, -0.00043134111911058426, -0.30244219303131104, 0.07448286563158035, -0.24167345464229584, 0.025621309876441956, 0.07846353948116302, 0.2639853358268738, -0.059037692844867706, 0.11023713648319244, -0.3329578936100006, -0.23091784119606018, -0.2911549210548401, -0.102226123213768, 0.5514556169509888, -0.3638690412044525, 0.3075854778289795, -0.2840902507305145, 0.30671554803848267, 0.24996565282344818, 0.7031443119049072, 0.04774966835975647, -0.42325425148010254, 0.07609465718269348, -0.26630276441574097, 0.021381080150604248, 0.11851818114519119, -0.10314412415027618, 0.12632758915424347, -0.48707494139671326, 0.11359633505344391, -0.16549955308437347, -0.41432371735572815, 0.35767847299575806, -0.250978022813797, 0.06127166002988815, -0.22575615346431732, 0.4874981939792633, 0.1248946338891983, -0.06655676662921906, 0.05365905538201332, 0.7177587151527405, -0.2241651564836502, 0.7436782121658325, 0.3434171676635742, 0.9538721442222595, 0.15666800737380981, 0.28774532675743103, 0.4041461944580078, -0.5263165831565857, 0.33316516876220703, -0.22395913302898407, -0.13924559950828552, -0.46029675006866455, -0.5001591444015503, -0.045908063650131226, -0.2419942021369934, 0.24628478288650513, 0.12966099381446838, -0.19148151576519012, 0.30920422077178955, -0.3433583974838257, 0.3573959171772003, -0.24749834835529327, 0.05722421407699585, -0.1964268684387207, -0.042284831404685974, -0.3331587612628937, 0.08908216655254364, 0.21051739156246185, -0.33694809675216675, -0.03184117376804352, 0.1099986582994461, -0.3409520983695984, -0.2315681129693985, -0.2390131950378418, 0.21344855427742004, -0.11926666647195816, 0.12489605695009232, 0.009635383263230324, -0.36687177419662476, 0.09964451193809509, 0.15868456661701202, -0.10015685856342316, 0.033961519598960876, 0.06625677645206451, 0.04983440041542053, 0.3585372269153595, 0.02791944146156311, 0.05942616984248161, -0.11515285819768906, 0.2272855043411255, -0.03466234728693962, 0.19235309958457947, 0.07729080319404602, -0.0347236730158329, -0.2452545464038849, -0.24634964764118195, 0.13490840792655945, 0.07847952842712402, -0.4022619426250458, -0.6202479004859924, -0.07364171743392944, -0.015679705888032913, -0.2643457055091858, 0.15366698801517487, -0.07783132791519165, -0.0956103578209877, 0.052926257252693176, -0.3341299295425415, -0.22636662423610687, -0.13052622973918915, 0.32599836587905884, -0.11406565457582474, 0.2556762397289276, 0.4678446352481842, 0.021601948887109756, -0.24492226541042328, -0.16091835498809814, 0.14831271767616272, 0.1967516392469406, -0.4645688533782959, 0.06884480267763138, -0.28306540846824646, -0.0021664947271347046, 0.11831200122833252, 0.34885933995246887, 0.28130462765693665, -0.014353044331073761, -0.00427631288766861, -0.29930198192596436, 0.2223973572254181, 0.1552583873271942, 0.08088655769824982, 0.010139606893062592, 0.014647364616394043, -0.15024371445178986, -0.31037259101867676, -0.08672954142093658, -0.3090810179710388, -0.046222493052482605, -0.0437733456492424, 0.24806207418441772, 0.43359190225601196, 0.14767718315124512, -0.12697072327136993, -0.18319344520568848, 0.203438401222229, 0.03336433693766594, 0.08139445632696152, -0.2020995318889618, -0.14034023880958557, 0.09390033036470413, 0.1744864583015442, 0.19800150394439697, -0.1915455162525177, -0.3339722752571106, -0.16710397601127625, -0.07246582955121994, 0.005308846011757851, 0.13977348804473877, -0.01918002963066101, -0.23137719929218292, 0.4154258370399475, 0.04821132495999336, -0.16560861468315125, 0.010316470637917519, -0.49044278264045715, 0.10600897669792175, -0.22830839455127716, 0.036992356181144714, -0.17445337772369385, -0.04364117607474327, -0.1908823549747467, 0.171229749917984, -0.14658118784427643, 0.24206995964050293, 0.41456788778305054, -0.15897324681282043, -0.1437809020280838, 0.23284047842025757, 0.507765531539917, 0.324551522731781, -0.10494633764028549, -0.4606674909591675, 0.16459962725639343, 0.22385837137699127, -0.1618986576795578, -0.4337437152862549, -0.06040147319436073, -0.053464099764823914, -0.04744467884302139, 0.2917652428150177, 0.033712346106767654, 0.09119762480258942, -0.4307333827018738, 0.25847670435905457, 0.27619490027427673, -0.2897249460220337, 0.4358806014060974, 0.4201584756374359, -0.10321786999702454, 0.11390998214483261, 0.23012520372867584, 0.09834183752536774, 0.33647775650024414, 0.26515328884124756, 0.3761058449745178, 0.17770840227603912, 0.5965555310249329, -0.189919576048851, 0.09466440230607986, -0.17548511922359467, -0.21207882463932037, -0.11264783143997192, 0.1692867875099182, 0.07650874555110931, 0.22614285349845886, -0.03678852319717407, 0.09839273244142532, -0.19304849207401276, -0.29288238286972046, 0.08140237629413605, -0.08923019468784332, 0.06543399393558502, 0.18061420321464539, -0.21960684657096863, -0.18874916434288025, 0.014263179153203964, -0.26833900809288025, 0.21091876924037933, -0.12920154631137848, -0.02107919752597809, 0.16173985600471497, -0.17584000527858734, -0.017308663576841354, -0.1201685443520546, 0.3046742081642151, -0.2857811748981476, 0.20141741633415222, 0.16010911762714386, -0.01935039460659027, -0.06183374300599098, -0.021120959892868996, 0.46426093578338623, 0.3938438594341278, 0.0916571319103241, 0.057783182710409164, 0.056069064885377884, -0.11504262685775757, 0.18120113015174866, 0.1346133053302765, -0.23214343190193176, -0.11547239124774933, 0.4085085690021515, 0.19125521183013916, -0.2123701274394989, -0.03444909676909447, 0.2520483136177063, 0.24444067478179932, -0.2564796507358551, 0.32218095660209656, -0.14467810094356537, -0.17830157279968262, 0.1304689347743988, 0.25443369150161743, -0.14549896121025085, -0.31887727975845337, -0.07023744285106659, 0.3077040910720825, 0.19910788536071777, 0.04321536794304848, 0.1127069741487503, 0.18961629271507263, 0.24526864290237427, 0.33136215806007385, -0.289840966463089, -0.19958072900772095, -0.08210283517837524, -0.39049258828163147, -0.04582881182432175, -0.3307628035545349, -0.3864752948284149, 0.14755798876285553, 0.32537826895713806, 0.15075358748435974, 0.11992373317480087, 0.2461027204990387, 0.3226912319660187, -0.19450245797634125, 0.2317219227552414, -0.2546519935131073, -0.2557470202445984, 0.13452386856079102, -0.2643774747848511, -0.21299615502357483, -0.39912036061286926, 0.05294819176197052, 0.4162563979625702, 0.1050030067563057, -0.1229013204574585, -0.05670172721147537, -0.1902056783437729, -0.0643492192029953, 0.08967673033475876, 0.08092208206653595, 0.10788952559232712, -0.13153845071792603, -0.16363583505153656, 0.003454238176345825, -0.3836943209171295, -0.25725099444389343, 0.4605361819267273, -0.14603647589683533, 0.3900015652179718, -0.022922374308109283, -0.1820128858089447, -0.3910791277885437, -0.06962788850069046, -0.17246946692466736, 0.09741761535406113, -0.4291355013847351, 0.12955954670906067, 0.07717358320951462, -0.01356553565710783, -0.035700347274541855, 0.103202223777771, 0.022149618715047836, 0.4197377562522888, 0.08251519501209259, -0.3639180362224579, 0.3991797864437103, 0.19502706825733185, -0.24134698510169983, 0.13610239326953888, 0.30530697107315063, 0.25690802931785583, 0.07933890074491501, -0.10241372138261795, -0.04366987943649292, 0.28356310725212097, -0.00893276184797287, 0.043747249990701675, 0.15349918603897095, 0.03444881737232208, 0.0013320408761501312, 0.025922227650880814, 0.39450550079345703, -0.1397058665752411, -0.05368402972817421, 0.08178146183490753, -0.1888648271560669 ]
https://github.com/huggingface/datasets/issues/5989
Set a rule on the config and split names
in this case we need to decide what to do with the existing datasets with white space characters (there shouldn't be a lot of them I think)
> should we actually allow characters like spaces? maybe it's better to add validation for whitespace symbols and directly in datasets and raise https://github.com/huggingface/datasets-server/issues/853
27
Set a rule on the config and split names > should we actually allow characters like spaces? maybe it's better to add validation for whitespace symbols and directly in datasets and raise https://github.com/huggingface/datasets-server/issues/853 in this case we need to decide what to do with the existing datasets with white space characters (there shouldn't be a lot of them I think)
[ -0.059814613312482834, -0.041503727436065674, -0.08315175771713257, 0.05934183672070503, 0.19995617866516113, -0.1714780628681183, 0.4647015929222107, 0.13817772269248962, 0.13507820665836334, 0.22843343019485474, -0.12750552594661713, -0.20322945713996887, -0.012206715531647205, 0.43768545985221863, -0.17629674077033997, -0.08739545941352844, -0.07381632179021835, 0.26114821434020996, -0.08996137976646423, -0.11255136132240295, -0.15544813871383667, -0.030858797952532768, 0.0579649955034256, 0.20066678524017334, -0.37705671787261963, -0.26042747497558594, 0.15332117676734924, 0.03571788966655731, -0.27947500348091125, -0.3001684844493866, -0.0336356945335865, 0.30586135387420654, -0.19392968714237213, 0.34277576208114624, -0.00009997150482377037, -0.04932994395494461, 0.19067272543907166, 0.0630963072180748, -0.15399619936943054, -0.053894028067588806, -0.29042989015579224, -0.10750837624073029, 0.05888199061155319, -0.157285675406456, -0.13482064008712769, -0.026530832052230835, 0.08000922948122025, -0.3283947706222534, 0.34650832414627075, 0.12652485072612762, 0.3050198256969452, 0.23442500829696655, -0.2100372463464737, -0.017853738740086555, -0.018410712480545044, 0.2574557662010193, -0.16488519310951233, -0.26992374658584595, 0.04754204675555229, 0.11766469478607178, -0.19188761711120605, 0.30831021070480347, 0.2524952292442322, 0.049661800265312195, 0.05292268097400665, 0.18597541749477386, -0.37078025937080383, -0.1867523044347763, 0.06278107315301895, 0.5087835192680359, 0.21485841274261475, -0.10203301161527634, -0.33386117219924927, -0.3606228828430176, -0.13789866864681244, -0.45176684856414795, 0.5895064473152161, 0.12829798460006714, 0.01852928102016449, 0.1880786418914795, -0.31036385893821716, -0.23445548117160797, -0.11715548485517502, -0.011133551597595215, -0.06652747839689255, 0.2362545132637024, -0.0943392813205719, -0.045047663152217865, -0.038968924432992935, -0.31091469526290894, -0.1240169033408165, -0.16827261447906494, -0.1524033546447754, -0.11673687398433685, -0.18602193892002106, -0.1856255680322647, -0.3328595757484436, 0.20258310437202454, 0.2956921458244324, 0.153341606259346, -0.16427819430828094, 0.1171831414103508, 0.00599007960408926, -0.010954715311527252, 0.1425294578075409, -0.06543494015932083, 0.20586204528808594, -0.03277360275387764, 0.5845929384231567, 0.10953248292207718, 0.053537819534540176, -0.11640603095293045, 0.33094996213912964, -0.31695711612701416, -0.2588381767272949, -0.23492655158042908, 0.2011827975511551, -0.1852102428674698, -0.013191523030400276, 0.16764718294143677, 0.3738541305065155, -0.06611311435699463, 0.10355066508054733, 0.30420324206352234, 0.05052992329001427, 0.008175600320100784, -0.11362658441066742, 0.15579092502593994, 0.05437586456537247, -0.22899232804775238, -0.21735380589962006, -0.20352624356746674, -0.24138417840003967, 0.19127622246742249, 0.15204785764217377, 0.009286337532103062, 0.19704298675060272, 0.17224690318107605, 0.19718651473522186, 0.11570329964160919, -0.02312469482421875, -0.02385743334889412, 0.09382352232933044, 0.26958996057510376, 0.048531513661146164, 0.19897769391536713, -0.17893527448177338, -0.22442856431007385, 0.08988925069570541, -0.25015854835510254, -0.1470784842967987, -0.0917627364397049, -0.30165019631385803, 0.28828203678131104, -0.09307502210140228, -0.031838446855545044, -0.1868574023246765, 0.04102812334895134, 0.21768537163734436, -0.015454653650522232, 0.05161001905798912, 0.20633774995803833, -0.18550796806812286, 0.0035890222061425447, 0.024263663217425346, 0.09972818940877914, -0.16889479756355286, -0.005247276276350021, 0.03863903135061264, -0.10975153744220734, 0.18615862727165222, 0.4155954420566559, -0.06277192384004593, -0.31046003103256226, -0.2680954933166504, 0.5925041437149048, 0.07340705394744873, -0.1602085679769516, -0.029472509399056435, 0.3161614239215851, 0.08008083701133728, -0.2707698345184326, 0.23524612188339233, -0.32095828652381897, 0.4741118550300598, -0.10138297826051712, 0.055481843650341034, 0.23217514157295227, -0.002645425498485565, 0.159053772687912, -0.2465846687555313, -0.2982569932937622, 0.03484124317765236, 0.010949637740850449, -0.023223143070936203, -0.22992688417434692, 0.005778416991233826, 0.036349110305309296, 0.2709132432937622, -0.296625554561615, 0.1697741597890854, 0.06633827090263367, 0.3122742772102356, 0.160663902759552, -0.08896569162607193, -0.15416845679283142, -0.3377014994621277, -0.07242236286401749, 0.09259474277496338, 0.09316898137331009, -0.051423802971839905, -0.35677433013916016, -0.09271281212568283, -0.16096635162830353, -0.25801151990890503, 0.08497991412878036, 0.26123201847076416, 0.20133066177368164, -0.07872595638036728, -0.13217495381832123, -0.2700554132461548, 0.21216197311878204, -0.005665535107254982, 0.4100058972835541, -0.20999173820018768, 0.13052281737327576, -0.0493287518620491, -0.0323023684322834, 0.17007523775100708, 0.10783742368221283, 0.04595667123794556, -0.11991693824529648, -0.019708584994077682, 0.4738353490829468, 0.1772156059741974, 0.2951948940753937, 0.17373405396938324, 0.13449887931346893, 0.4153675138950348, 0.028619196265935898, -0.04323923587799072, 0.11420699954032898, -0.05474894866347313, 0.15728414058685303, -0.19908064603805542, 0.47280681133270264, -0.14374785125255585, 0.034631699323654175, -0.033682793378829956, 0.06276835501194, 0.3241333067417145, -0.26840469241142273, -0.0773211345076561, -0.4271948039531708, 0.10378113389015198, -0.12862294912338257, 0.3298439085483551, 0.2310703992843628, -0.5067042708396912, -0.13660648465156555, 0.558229923248291, 0.06362167000770569, 0.1368872970342636, -0.0747009664773941, 0.05786328762769699, -0.005261005833745003, 0.22725167870521545, 0.23508138954639435, 0.13732843101024628, 0.37233299016952515, -0.15263894200325012, -0.011985203251242638, -0.06143829971551895, -0.32123246788978577, 0.40932267904281616, 0.053562767803668976, -0.0989069938659668, 0.1572258472442627, -0.06401646137237549, -0.0975206196308136, -0.593891441822052, -0.015412291511893272, -0.014959068968892097, -0.127151757478714, -0.3626907765865326, -0.10343131422996521, -0.2782818377017975, -0.11256188899278641, -0.10585790872573853, -0.012626984156668186, -0.3956224024295807, -0.21668119728565216, 0.3325164318084717, -0.10076922178268433, -0.3328877091407776, 0.30801400542259216, -0.06825129687786102, 0.2823399305343628, -0.16267429292201996, 0.13803760707378387, -0.409178227186203, 0.04331749305129051, -0.1431770622730255, 0.21536292135715485, 0.19522809982299805, -0.09637722373008728, 0.4600456655025482, -0.029382780194282532, 0.05353447049856186, -0.15483912825584412, -0.46844449639320374, 0.1557641625404358, -0.1973154991865158, 0.11742951720952988, 0.3609984219074249, 0.2623371481895447, 0.16511274874210358, -0.25478652119636536, 0.07934032380580902, -0.18952232599258423, -0.09764301776885986, -0.10579695552587509, 0.08411046862602234, -0.06340621411800385, -0.36763831973075867, -0.3710164427757263, -0.036966435611248016, -0.30988022685050964, 0.16797217726707458, -0.2386702299118042, 0.028002388775348663, 0.3517352342605591, -0.22113445401191711, -0.10548052191734314, -0.32201990485191345, 0.12063026428222656, -0.42870309948921204, -0.386730432510376, 0.3481419086456299, -0.2560679316520691, -0.2589150071144104, 0.0666661262512207, 0.11994774639606476, 0.044851839542388916, -0.1371612697839737, -0.17591366171836853, -0.10605961829423904, -0.23739491403102875, 0.1743292510509491, 0.42232993245124817, 0.06696804612874985, 0.057590194046497345, 0.09404763579368591, -0.21480435132980347, -0.24243289232254028, -0.14932724833488464, 0.08215328305959702, -0.08849748224020004, 0.23246020078659058, -0.001270567998290062, 0.258767306804657, -0.022978533059358597, 0.32288503646850586, -0.02017071284353733, 0.08447708189487457, 0.395120769739151, -0.11134151369333267, 0.33330702781677246, 0.09925572574138641, -0.14993098378181458, 0.3195871412754059, 0.053170062601566315, 0.10037696361541748, 0.5257633328437805, 0.050663579255342484, 0.2547248899936676, 0.033723749220371246, 0.09384910762310028, -0.13476711511611938, -0.47622236609458923, 0.024853814393281937, 0.14066651463508606, 0.0010867714881896973, 0.15984497964382172, -0.043761253356933594, 0.12535929679870605, -0.19069719314575195, -0.13556775450706482, 0.1460655927658081, -0.12108968943357468, -0.16220355033874512, -0.5452072024345398, 0.1740780919790268, -0.2702636122703552, 0.23985916376113892, -0.046109337359666824, 0.2060443013906479, -0.17892786860466003, 0.022684156894683838, 0.0754450261592865, 0.15237396955490112, 0.6880313754081726, -0.4112885892391205, -0.15955834090709686, -0.3130110502243042, 0.13428223133087158, -0.158408522605896, 0.07011134922504425, -0.19228626787662506, 0.08445581048727036, 0.06260664761066437, 0.4126169681549072, -0.48435863852500916, -0.3757074475288391, 0.09204836934804916, 0.12764088809490204, -0.24964551627635956, 0.09397470206022263, -0.13285282254219055, -0.18472564220428467, -0.3261662721633911, 0.09567464888095856, 0.11846859008073807, 0.18285076320171356, 0.01574590429663658, -0.01072767935693264, -0.09230118989944458, -0.14783141016960144, 0.4255356788635254, 0.37748855352401733, 0.3365352749824524, -0.10907236486673355, 0.061975475400686264, 0.21586953103542328, 0.3496887981891632, 0.24558816850185394, 0.30695104598999023, -0.38940295577049255, -0.32571080327033997, -0.010241754353046417, -0.3627699315547943, 0.5042270421981812, 0.4302448332309723, -0.022885553538799286, 0.09078238159418106, 0.09337480366230011, 0.4370940327644348, -0.09336400032043457, 0.14331357181072235, 0.2248922735452652, 0.20496568083763123, -0.3718661665916443, -0.1682489812374115, 0.17925283312797546, 0.17655302584171295, -0.15777021646499634, 0.025803253054618835, 0.6529098749160767, -0.6058458685874939, 0.21631477773189545, -0.010945841670036316, 0.7847921848297119, 0.17088520526885986, 0.22465696930885315, 0.12457356601953506, -0.27033525705337524, 0.4305536448955536, -0.06709502637386322, -0.15656155347824097, -0.21605508029460907, -0.19583015143871307, -0.016289714723825455, 0.13890396058559418, 0.371157705783844, 0.19384826719760895, -0.19213788211345673, 0.29610905051231384, 0.0466284304857254, 0.20398341119289398, -0.19827638566493988, 0.34029102325439453, -0.18459410965442657, -0.4953114092350006, -0.4436987340450287, 0.2091030776500702, -0.028063081204891205, -0.05375673249363899, 0.01572680100798607, -0.1979757696390152, 0.23266145586967468, -0.3348919749259949, -0.009658470749855042, -0.16154181957244873, -0.2515231966972351, -0.11359597742557526, 0.1293940544128418, 0.05213725566864014, 0.13464133441448212, 0.07213248312473297, 0.5368790626525879, 0.41222959756851196, -0.12870100140571594, 0.22818586230278015, -0.13884907960891724, 0.20757050812244415, -0.42405641078948975, 0.11548318713903427, 0.04821692407131195, -0.1698305606842041, -0.12653768062591553, -0.2719196081161499, 0.13385789096355438, 0.05429583042860031, -0.12436404824256897, -0.09501323103904724, -0.2569925785064697, -0.5709558129310608, 0.15111587941646576, -0.2197301983833313, 0.03092341497540474, -0.2750784754753113, 0.2340974658727646, -0.18616415560245514, -0.16816917061805725, 0.2991412281990051, 0.2941063940525055, -0.054820723831653595, -0.22503919899463654, -0.01417793333530426, -0.05244661867618561, 0.1282290518283844, 0.3134042024612427, -0.04768012464046478, -0.27245837450027466, -0.4156717360019684, 0.198552668094635, 0.15905839204788208, -0.29753366112709045, 0.18115760385990143, 0.2369558960199356, -0.4184721112251282, -0.08556820452213287, 0.2076965719461441, 0.1838674247264862, -0.004231303930282593, 0.25339433550834656, -0.1541079878807068, -0.09844876080751419, 0.2822277545928955, -0.10885179042816162, 0.3279723525047302, 0.19033285975456238, 0.1905876100063324, -0.10606181621551514, -0.08943891525268555, -0.43488648533821106, 0.052332960069179535, -0.13930164277553558, 0.09837836027145386, 0.09516537934541702, -0.20337426662445068, 0.36179232597351074, -0.31638669967651367, 0.18619439005851746, 0.044733356684446335, -0.13203789293766022, -0.2920316755771637, -0.23324260115623474, 0.0716622844338417, -0.02489582449197769, -0.06962066888809204, -0.05012296885251999, 0.1255243420600891, 0.0261814184486866, -0.12340085208415985, 0.2268049716949463, 0.11090558022260666, 0.12981057167053223, 0.1983100324869156, 0.19014526903629303, -0.26984694600105286, -0.10004915297031403, -0.07298042625188828, 0.2009485363960266, 0.2667251229286194, 0.16882678866386414, 0.19214878976345062, -0.25904953479766846, -0.14996042847633362, 0.32675403356552124, 0.20524853467941284, 0.12919215857982635, 0.15199759602546692, 0.09143351763486862, -0.19914542138576508, -0.20770089328289032, 0.36565691232681274, 0.44937416911125183, 0.32298028469085693, -0.13944585621356964, -0.16270656883716583, 0.14547303318977356, 0.33813297748565674, -0.3454238474369049, 0.00921596959233284, 0.25132501125335693, 0.014582261443138123, 0.24992424249649048, 0.2876076400279999, 0.23690101504325867, -0.05290060117840767, -0.25800150632858276, 0.15640395879745483, 0.2032238095998764, -0.15462183952331543, 0.21381841599941254, 0.31054267287254333, -0.24085178971290588, 0.07846467196941376, 0.501675009727478, 0.10588578879833221, 0.0003982633352279663, 0.46541517972946167, -0.17448031902313232, 0.4824703633785248, -0.005766872316598892, 0.05729709193110466, 0.18838080763816833, -0.06285247206687927, 0.1009160727262497, 0.08086138963699341, -0.18133652210235596, -0.013637959957122803, 0.100847028195858, 0.2441839575767517, -0.12571227550506592, -0.4471279978752136, -0.25703126192092896, 0.15839555859565735, -0.18291795253753662, -0.3064689636230469, -0.20758125185966492, 0.036595433950424194, -0.15449705719947815, 0.026718970388174057, -0.028702545911073685, -0.060289978981018066, 0.2984035611152649, 0.06343580782413483, 0.20541739463806152, -0.35565876960754395, 0.16915327310562134, 0.05840424820780754, 0.22552534937858582, -0.1283859759569168, 0.41641202569007874, 0.08818992972373962, -0.15185873210430145, 0.2473829835653305, 0.3072163760662079, 0.2881358563899994, -0.12120194733142853, 0.09358295798301697, 0.03151118382811546, -0.21089622378349304, -0.09370523691177368, -0.11105915904045105, 0.1462540626525879, 0.16008193790912628, 0.11336810886859894, 0.35292404890060425, 0.2598724067211151, -0.21094530820846558, 0.10633444786071777, -0.08318383991718292, -0.18357951939105988, -0.040467217564582825, 0.0741811990737915, 0.17082899808883667, -0.18299426138401031, -0.20562322437763214, -0.33800840377807617, -0.347455769777298, 0.01894538477063179, 0.5091773271560669, -0.22675958275794983, 0.17633646726608276, -0.3616165220737457, 0.141913041472435, 0.27766719460487366, 0.4314122796058655, 0.08658266067504883, -0.0859147384762764, -0.023713912814855576, -0.12526123225688934, -0.5163717269897461, -0.08261788636445999, -0.07995277643203735, 0.07731624692678452, -0.18002015352249146, -0.09032014012336731, -0.018457651138305664, -0.005916576832532883, 0.11587170511484146, 0.011044429615139961, -0.16772443056106567, -0.2968249022960663, -0.3058258295059204, 0.11712624132633209, 0.23207923769950867, 0.0786421000957489, 0.17083583772182465, -0.20474019646644592, 0.3105700612068176, 0.014224068261682987, 0.07741273194551468, -0.09147606045007706, 0.42539629340171814, 0.021052341908216476, -0.11447231471538544, -0.1376047283411026, 0.31293779611587524, 0.1796242594718933, -0.18636423349380493, 0.05580252408981323, -0.07200212776660919, -0.3557929992675781, -0.4168335199356079, 0.2578214108943939, 0.2140236347913742, 0.23239877820014954, -0.020812805742025375, -0.08066976070404053, -0.20044095814228058, 0.22012361884117126, -0.008668474853038788, 0.23567160964012146, -0.12379519641399384, 0.210753932595253, 0.1965193748474121, -0.02675844356417656, -0.08036436885595322, 0.22479790449142456, -0.2505497932434082, -0.024566184729337692, -0.05563106760382652, -0.7402986288070679, 0.4203835725784302, -0.16240113973617554, -0.2697303295135498, -0.07495952397584915, 0.30281227827072144, 0.31342288851737976, -0.17084404826164246, -0.6178938746452332, 0.08120808750391006, 0.09997816383838654, -0.1578766405582428, -0.3008093535900116, 0.17182061076164246, 0.22307421267032623, -0.1989801824092865, -0.016246821731328964, 0.40038925409317017, 0.2701091468334198, -0.46145138144493103, 0.19493645429611206, -0.04237259179353714 ]
https://github.com/huggingface/datasets/issues/5988
ConnectionError: Couldn't reach dataset_infos.json
Unfortunately, I can't reproduce the error. What does the following code return for you? ```python import requests from huggingface_hub import hf_hub_url r = requests.get(hf_hub_url("codeparrot/codeparrot-clean-train", "dataset_infos.json", repo_type="dataset")) ``` Also, can you provide more info about your network (region, proxies, etc.)?
### Describe the bug I'm trying to load codeparrot/codeparrot-clean-train, but get the following error: ConnectionError: Couldn't reach https://huggingface.co/datasets/codeparrot/codeparrot-clean-train/resolve/main/dataset_infos.json (ConnectionError(ProtocolError('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer')))) ### Steps to reproduce the bug train_data = load_dataset('codeparrot/codeparrot-clean-train', split='train') ### Expected behavior download the dataset ### Environment info centos7
39
ConnectionError: Couldn't reach dataset_infos.json ### Describe the bug I'm trying to load codeparrot/codeparrot-clean-train, but get the following error: ConnectionError: Couldn't reach https://huggingface.co/datasets/codeparrot/codeparrot-clean-train/resolve/main/dataset_infos.json (ConnectionError(ProtocolError('Connection aborted.', ConnectionResetError(104, 'Connection reset by peer')))) ### Steps to reproduce the bug train_data = load_dataset('codeparrot/codeparrot-clean-train', split='train') ### Expected behavior download the dataset ### Environment info centos7 Unfortunately, I can't reproduce the error. What does the following code return for you? ```python import requests from huggingface_hub import hf_hub_url r = requests.get(hf_hub_url("codeparrot/codeparrot-clean-train", "dataset_infos.json", repo_type="dataset")) ``` Also, can you provide more info about your network (region, proxies, etc.)?
[ -0.3649469316005707, -0.220248743891716, -0.050982750952243805, 0.3098018765449524, 0.1473006308078766, -0.14014975726604462, -0.03622337803244591, 0.34880319237709045, 0.2515791952610016, 0.1794556826353073, -0.2331954687833786, 0.24075721204280853, 0.3046640455722809, 0.2398938089609146, 0.13381211459636688, -0.1438741534948349, -0.0334167554974556, 0.05077642202377319, -0.0849597156047821, 0.04738134890794754, -0.1367792934179306, 0.0709344893693924, -0.053434859961271286, 0.21579350531101227, -0.35426658391952515, 0.014486984349787235, -0.07097315043210983, 0.37592023611068726, -0.15931108593940735, -0.3751789629459381, 0.5421236753463745, 0.08637955784797668, 0.19603516161441803, 0.6905549168586731, -0.00011963956785621122, 0.244020476937294, 0.42100560665130615, -0.008982913568615913, -0.4476308226585388, -0.45807886123657227, -0.3492898643016815, -0.12814904749393463, 0.2390432506799698, -0.09648331999778748, -0.054024092853069305, 0.09128322452306747, 0.06441589444875717, 0.0826423168182373, 0.45429521799087524, 0.2584652602672577, 0.16597679257392883, 0.40060630440711975, 0.2445455938577652, -0.15861903131008148, -0.12004280835390091, -0.0642855167388916, 0.019660940393805504, 0.8044688701629639, 0.04144260659813881, -0.11286133527755737, -0.05659521371126175, 0.18271727859973907, 0.006435258314013481, 0.05215389281511307, 0.2294463813304901, -0.11488667875528336, 0.031266819685697556, -0.051219210028648376, 0.032318681478500366, 0.037110716104507446, 0.10331090539693832, -0.19636750221252441, -0.3040107786655426, -0.10591533780097961, -0.0986737534403801, -0.3249180316925049, 0.3139742910861969, -0.005766283720731735, -0.2443317174911499, 0.2545090317726135, -0.4414653480052948, -0.3518935441970825, -0.21556931734085083, 0.28282058238983154, 0.003273487091064453, 0.04728292301297188, -0.21564671397209167, 0.15498892962932587, 0.1757173389196396, 0.12490112334489822, -0.017461031675338745, -0.1525181531906128, 0.1425940841436386, 0.057283416390419006, -0.18023601174354553, 0.09028160572052002, 0.04759591817855835, 0.08079323172569275, 0.28020116686820984, 0.22944708168506622, -0.12015324831008911, 0.09960436820983887, -0.22007209062576294, 0.22418728470802307, 0.2742583453655243, -0.021889198571443558, -0.1370846927165985, 0.186884343624115, 0.35646337270736694, 0.6122466325759888, -0.03291845694184303, -0.0355990007519722, -0.09860267490148544, 0.0735996812582016, -0.36986491084098816, -0.12273106724023819, 0.32796984910964966, -0.20901167392730713, -0.23249158263206482, 0.24234643578529358, -0.16106565296649933, 0.012069042772054672, 0.14114443957805634, 0.512945830821991, -0.39787518978118896, 0.15719306468963623, 0.03384215384721756, 0.18407142162322998, -0.16201257705688477, 0.17339371144771576, -0.22651568055152893, 0.12632758915424347, -0.18283507227897644, 0.26004818081855774, 0.09171120822429657, -0.23900842666625977, 0.14312101900577545, -0.04809762164950371, 0.21969307959079742, -0.4488971531391144, -0.009769264608621597, 0.009898455813527107, -0.4572109878063202, 0.24075599014759064, 0.11621019244194031, 0.11378682404756546, 0.2819119691848755, -0.10817724466323853, -0.09300154447555542, -0.23765209317207336, -0.5613497495651245, -0.43511074781417847, 0.09058886766433716, 0.09670254588127136, -0.11783523112535477, 0.09802426397800446, -0.48985156416893005, -0.2629542350769043, -0.1754760444164276, 0.03022809699177742, -0.17050224542617798, -0.024511083960533142, -0.04795069620013237, -0.13245145976543427, 0.36374717950820923, 0.391836941242218, 0.21056389808654785, -0.18981368839740753, 0.2715347707271576, -0.06933973729610443, 0.07942523062229156, 0.2427772581577301, -0.22268320620059967, 0.03203826770186424, -0.3754899799823761, -0.015558168292045593, 0.2614949345588684, -0.4603726863861084, -0.5666583180427551, 0.4166881740093231, -0.3172912001609802, 0.2076081484556198, -0.1171087995171547, -0.1039450392127037, -0.17511829733848572, 0.22538498044013977, 0.41089531779289246, 0.1526462286710739, 0.17268618941307068, -0.0960388034582138, -0.1276227980852127, -0.35205546021461487, -0.045404039323329926, 0.3016889691352844, 0.17149780690670013, 0.2456788420677185, 0.10841979086399078, -0.006747112609446049, 0.45962345600128174, 0.0692763403058052, 0.03862251341342926, 0.3125873804092407, 0.21376940608024597, 0.29441168904304504, -0.009316736832261086, -0.22363874316215515, -0.024898506700992584, 0.27745532989501953, 0.080918088555336, -0.04578421264886856, -0.2343614250421524, -0.0888906866312027, -0.4960404932498932, 0.1540602147579193, -0.14994686841964722, -0.02219005674123764, 0.05649509280920029, 0.2646123468875885, 0.09818604588508606, 0.060665521770715714, -0.2618025839328766, 0.79482102394104, -0.31383898854255676, 0.22865381836891174, -0.3671492636203766, 0.7102521061897278, -0.16250969469547272, -0.0013692770153284073, 0.08957180380821228, 0.26595237851142883, 0.17812716960906982, -0.17468322813510895, -0.049658793956041336, 0.42762652039527893, 0.054693855345249176, 0.1617358922958374, 0.3407091200351715, -0.0870329886674881, 0.13131415843963623, -0.5390531420707703, -0.13817313313484192, 0.17223940789699554, 0.1940115988254547, 0.20351389050483704, 0.2534838914871216, 0.20880407094955444, 0.07864421606063843, 0.4384022057056427, 0.10059638321399689, 0.024487068876624107, 0.20181751251220703, -0.02795441262423992, -0.08104260265827179, 0.21115875244140625, 0.41353175044059753, -0.029360469430685043, 0.04399704560637474, -0.13485561311244965, -0.11831000447273254, -0.1594075858592987, 0.15354043245315552, -0.1345272809267044, 0.1221536248922348, 0.32992205023765564, 0.012956388294696808, -0.07127520442008972, 0.0022838637232780457, -0.06956275552511215, 0.2817949652671814, -0.021749325096607208, -0.20418256521224976, 0.23559480905532837, -0.1414288431406021, 0.0033221058547496796, 0.032456375658512115, 0.09552660584449768, 0.08212100714445114, 0.1143079400062561, 0.020637480542063713, -0.11757462471723557, -0.14568239450454712, -0.5302064418792725, -0.21900129318237305, 0.2042948603630066, -0.3213411867618561, 0.2516320049762726, -0.2158721685409546, 0.2308996617794037, 0.022349298000335693, -0.12834393978118896, -0.42332419753074646, -0.24504366517066956, -0.10890118777751923, 0.3123020529747009, 0.14058928191661835, -0.008315108716487885, -0.3425429165363312, 0.034397199749946594, -0.04385487735271454, -0.10616963356733322, -0.10425293445587158, -0.18869103491306305, -0.10234237462282181, -0.09017063677310944, 0.0034237438812851906, -0.017169317230582237, 0.1767556369304657, -0.3678867816925049, -0.17132152616977692, -0.05517767369747162, -0.03554845228791237, 0.24002903699874878, -0.05873347073793411, 0.1859884262084961, 0.36288851499557495, 0.4928804039955139, -0.013686498627066612, -0.11840235441923141, 0.4103645384311676, 0.0712711438536644, -0.10223785042762756, 0.030583549290895462, -0.06231602281332016, 0.1153889074921608, 0.11218312382698059, -0.01017732173204422, -0.31091147661209106, -0.5235150456428528, 0.43115830421447754, -0.15894073247909546, 0.05082635208964348, 0.21978610754013062, 0.1871740072965622, 0.2058032602071762, 0.010143788531422615, 0.09387229382991791, -0.2423316240310669, -0.4523586928844452, 0.15727753937244415, -0.07014893740415573, -0.20742711424827576, -0.02116439864039421, 0.0916612520813942, 0.23478931188583374, -0.1386217176914215, -0.7353417277336121, -0.38597846031188965, -0.11589951813220978, 0.29723283648490906, -0.1096809059381485, 0.013348031789064407, -0.022288620471954346, -0.3959837257862091, 0.01023024506866932, 0.03473030775785446, -0.27739086747169495, -0.16634753346443176, -0.025546856224536896, 0.3655047118663788, 0.22036299109458923, 0.4054454565048218, -0.16364595293998718, 0.2813362777233124, 0.2737545371055603, 0.1319950371980667, 0.4200882613658905, -0.07397779077291489, 0.37184447050094604, -0.11828234046697617, -0.4180029332637787, -0.1715170294046402, -0.23458418250083923, -0.17388537526130676, -0.04085451364517212, 0.14743530750274658, 0.2221079170703888, -0.5265593528747559, -0.4957572817802429, -0.2626056969165802, -0.2731196880340576, -0.024977197870612144, 0.12754985690116882, 0.1706305742263794, 0.06126146391034126, 0.06845618039369583, -0.17451788485050201, 0.046964582055807114, 0.10594265162944794, 0.6751939654350281, 0.12729960680007935, 0.07196138054132462, -0.5166996717453003, -0.3624286651611328, -0.20466211438179016, 0.2633059620857239, 0.14498083293437958, 0.22726887464523315, -0.2297750860452652, 0.2541193664073944, 0.1566641926765442, -0.23832982778549194, 0.6379551291465759, 0.06444872170686722, 0.3019980192184448, -0.029810994863510132, -0.1605454385280609, -0.4601234197616577, 0.06698267161846161, 0.13693733513355255, 0.2788071930408478, 0.1674811989068985, 0.40875300765037537, -0.3763374984264374, -0.17296071350574493, 0.12413670122623444, -0.013814462348818779, -0.06427158415317535, -0.15067189931869507, -0.3222644031047821, -0.4502655863761902, -0.4501877427101135, 0.06710031628608704, 0.021406831219792366, 0.2936961352825165, 0.013521205633878708, -0.19623510539531708, 0.34173232316970825, -0.14764302968978882, 0.03946084529161453, 0.12264285981655121, 0.1552881896495819, -0.04287692904472351, 0.058417726308107376, 0.3746485412120819, 0.30126407742500305, 0.33406081795692444, 0.5701931118965149, 0.054112859070301056, -0.24493670463562012, 0.37887558341026306, 0.15157252550125122, 0.21433615684509277, 0.4454843997955322, 0.009888912551105022, 0.23228305578231812, 0.3898245692253113, 0.2704450190067291, -0.27433913946151733, 0.042095623910427094, 0.21154150366783142, 0.006367450580000877, -0.43571344017982483, -0.3945060670375824, 0.48397397994995117, -0.259366899728775, -0.012133888900279999, 0.08216850459575653, 0.32151639461517334, 0.0725492537021637, 0.1454310417175293, -0.43366992473602295, 1.1236441135406494, 0.20276188850402832, 0.09744993597269058, 0.19251763820648193, -0.5093623995780945, 0.5768758654594421, -0.58897864818573, 0.16332663595676422, -0.21398764848709106, 0.03947518393397331, -0.09119874984025955, -0.22364406287670135, 0.032353419810533524, -0.2237686663866043, 0.021942276507616043, 0.15392941236495972, -0.35139548778533936, 0.15345805883407593, -0.05747172236442566, 0.1417268067598343, -0.3723846673965454, 0.09411323070526123, -0.689367949962616, 0.1406038999557495, -0.18138451874256134, 0.5208198428153992, -0.1204897090792656, -0.0944017693400383, -0.4496375024318695, -0.33406418561935425, -0.26382511854171753, 0.13736197352409363, 0.09237119555473328, 0.26971131563186646, 0.13389207422733307, -0.038168132305145264, -0.15598508715629578, -0.15428169071674347, 0.11794253438711166, 0.04621294513344765, -0.3628973364830017, 0.1777980774641037, -0.4373835325241089, -0.09745163470506668, 0.08697129786014557, 0.07149716466665268, -0.14076434075832367, -0.13972875475883484, -0.5380977988243103, 0.25981444120407104, -0.1871296763420105, -0.5826142430305481, 0.18212002515792847, 0.09286776930093765, 0.11675059795379639, -0.13009484112262726, 0.047099415212869644, -0.16982844471931458, 0.1608235239982605, -0.14087063074111938, 0.0909319519996643, 0.14054124057292938, -0.13755139708518982, -0.11904323846101761, 0.3252142071723938, -0.31089019775390625, -0.07403041422367096, 0.594602644443512, -0.05005030333995819, -0.21865791082382202, 0.37254995107650757, 0.2237175852060318, -0.2515130043029785, -0.13968399167060852, 0.0011936575174331665, 0.43632426857948303, -0.4150051474571228, -0.0016648033633828163, -0.17329247295856476, 0.08066989481449127, -0.33453184366226196, 0.17416517436504364, 0.3235308527946472, -0.06656550616025925, 0.05813707038760185, -0.6675126552581787, -0.35196614265441895, 0.18894490599632263, -0.1349380910396576, 0.17238524556159973, 0.11235702782869339, 0.29529914259910583, -0.17322728037834167, -0.1340135931968689, -0.23534442484378815, 0.17736144363880157, -0.46518072485923767, -0.05723973363637924, 0.4022446572780609, -0.12191740423440933, 0.3319564461708069, -0.03946148231625557, 0.10694803297519684, 0.1483868807554245, -0.2260056585073471, -0.09938406944274902, -0.24826420843601227, 0.1833452731370926, -0.010234225541353226, -0.214509055018425, -0.16222615540027618, -0.13008075952529907, 0.016328170895576477, 0.08164756745100021, 0.1626642495393753, 0.18555837869644165, 0.14093351364135742, -0.2505280077457428, -0.06682714819908142, -0.08853606134653091, -0.27446281909942627, 0.21174028515815735, 0.20557399094104767, 0.6283970475196838, -0.1004987508058548, -0.011410925537347794, -0.2728860676288605, 0.018912620842456818, -0.12551534175872803, 0.1472688615322113, 0.13106724619865417, 0.14990222454071045, 0.4241059720516205, -0.22197391092777252, 0.13358280062675476, 0.026143984869122505, 0.3296678960323334, 0.35159388184547424, -0.21196554601192474, 0.07068204879760742, 0.001118205487728119, 0.13267020881175995, -0.023968946188688278, -0.03502947837114334, 0.443778395652771, -0.07673317939043045, -0.12851250171661377, 0.1111074909567833, 0.04282773658633232, 0.10909116268157959, -0.05549885332584381, 0.11105094105005264, 0.5164974927902222, 0.37446123361587524, 0.03474114090204239, 0.2542921006679535, -0.012569267302751541, 0.05354403331875801, 0.0068457964807748795, -0.018442757427692413, 0.20973724126815796, 0.2763553857803345, -0.18832144141197205, -0.0024749189615249634, -0.20505690574645996, 0.4119744598865509, -0.05492793768644333, -0.2569000720977783, -0.04637550190091133, 0.0538218691945076, -0.13955047726631165, -0.07565467804670334, -0.33892586827278137, 0.3785012364387512, -0.3547714650630951, 0.1427868753671646, -0.37498605251312256, 0.10038849711418152, -0.10216746479272842, -0.07881096005439758, -0.1656733602285385, -0.3325175642967224, -0.4314316213130951, -0.08090938627719879, 0.08209726214408875, -0.13205371797084808, 0.14172883331775665, -0.04933585226535797, -0.05005842447280884, -0.30737364292144775, -0.21254804730415344, 0.37462934851646423, 0.13877466320991516, -0.0939260721206665, 0.2088506519794464, 0.12919192016124725, -0.01137753576040268, 0.10517066717147827, 0.13155779242515564, 0.49302083253860474, 0.10192925482988358, 0.05092734843492508, 0.05588280409574509, 0.24999889731407166, 0.004065528512001038, -0.06448423117399216, 0.03770684078335762, 0.17327439785003662, -0.12992802262306213, 0.21865519881248474, 0.18735747039318085, -0.18095843493938446, 0.06522621214389801, -0.13725365698337555, 0.40506669878959656, -0.2704634666442871, 0.38986918330192566, -0.2452193796634674, 0.0773012563586235, -0.20460477471351624, -0.11704235523939133, -0.4501871168613434, -0.04382213577628136, 0.21732178330421448, -0.10652396082878113, 0.20024818181991577, -0.12050046026706696, 0.04055384173989296, -0.3074747323989868, 0.4837445914745331, 0.45723143219947815, 0.1821857988834381, -0.20987406373023987, -0.2897014617919922, -0.21205638349056244, 0.325637549161911, -0.22347116470336914, -0.1459001749753952, 0.08975233137607574, -0.14592969417572021, -0.1510474979877472, 0.20136627554893494, 0.05730853229761124, 0.08326422423124313, 0.10529463738203049, 0.17277351021766663, -0.005086380988359451, -0.3372519314289093, 0.004558630287647247, 0.17573508620262146, 0.0443076491355896, -0.19905546307563782, 0.19938212633132935, 0.022123664617538452, -0.08233140408992767, 0.03870993107557297, -0.058694805949926376, 0.05632896348834038, -0.4882325828075409, 0.4914519786834717, 0.16468532383441925, 0.5233274698257446, -0.047299280762672424, -0.45322707295417786, -0.2502761483192444, -0.44423192739486694, 0.069397933781147, 0.11737944930791855, -0.09710481762886047, 0.4478450417518616, -0.07648081332445145, -0.1512221395969391, -0.31983867287635803, 0.4637080729007721, 0.08205725252628326, -0.18006420135498047, 0.027068933472037315, -0.0599338635802269, -0.22194284200668335, 0.0353299081325531, 0.08754822611808777, 0.11730687320232391, 0.052503976970911026, 0.25227469205856323, -0.004700176417827606, -0.12299354374408722, 0.6923561096191406, -0.2536272406578064, -0.3920578062534332, 0.015155666507780552, 0.228067547082901, 0.0392523854970932, -0.1506918966770172, -0.37890899181365967, 0.07279037684202194, 0.3544307053089142, 0.18795090913772583, -0.2532353103160858, 0.14158526062965393, -0.2589241862297058, -0.06404490023851395, 0.05555665120482445, 0.2551461458206177, -0.06929720193147659, -0.283033549785614, 0.32673147320747375, -0.056714802980422974 ]